aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCNullStreamer.cpp
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2013-01-14 19:04:57 +0000
committerEli Bendersky <eliben@google.com>2013-01-14 19:04:57 +0000
commitcbb2514d510b49bad9a4f2787ac49e4f905b20e1 (patch)
tree87448eeb9b41f1e452c85ed83b770570178fe52e /llvm/lib/MC/MCNullStreamer.cpp
parenta7b905eeaaf19be454c1aea0f06bb2fc23b16743 (diff)
downloadllvm-cbb2514d510b49bad9a4f2787ac49e4f905b20e1.zip
llvm-cbb2514d510b49bad9a4f2787ac49e4f905b20e1.tar.gz
llvm-cbb2514d510b49bad9a4f2787ac49e4f905b20e1.tar.bz2
Expose an InitToTextSection through MCStreamer.
The aim of this patch is to fix the following piece of code in the platform-independent AsmParser: void AsmParser::CheckForValidSection() { if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) { TokError("expected section directive before assembly directive"); Out.SwitchSection(Ctx.getMachOSection( "__TEXT", "__text", MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, 0, SectionKind::getText())); } } This was added for the "-n" option of llvm-mc. The proposed fix adds another virtual method to MCStreamer, called InitToTextSection. Conceptually, it's similar to the existing InitSections which initializes all common sections and switches to text. The new method is implemented by each platform streamer in a way that it sees fit. So AsmParser can now do this: void AsmParser::CheckForValidSection() { if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) { TokError("expected section directive before assembly directive"); Out.InitToTextSection(); } } Which is much more reasonable. llvm-svn: 172450
Diffstat (limited to 'llvm/lib/MC/MCNullStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCNullStreamer.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCNullStreamer.cpp b/llvm/lib/MC/MCNullStreamer.cpp
index 364c324..3eee5ca 100644
--- a/llvm/lib/MC/MCNullStreamer.cpp
+++ b/llvm/lib/MC/MCNullStreamer.cpp
@@ -24,6 +24,9 @@ namespace {
/// @name MCStreamer Interface
/// @{
+ virtual void InitToTextSection() {
+ }
+
virtual void InitSections() {
}