summaryrefslogtreecommitdiff
path: root/include/llvm/MC/MCELFStreamer.h
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
commit030f63a397edc20f8f661bac62f7b90cb5cf57bc (patch)
treec102045afd6db912521b48e1c84a111551d990ef /include/llvm/MC/MCELFStreamer.h
parent9bac6b29b832419f8b76bb2c27af74bb57a8d99a (diff)
downloadllvm-030f63a397edc20f8f661bac62f7b90cb5cf57bc.tar.gz
llvm-030f63a397edc20f8f661bac62f7b90cb5cf57bc.tar.bz2
llvm-030f63a397edc20f8f661bac62f7b90cb5cf57bc.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172450 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCELFStreamer.h')
-rw-r--r--include/llvm/MC/MCELFStreamer.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/llvm/MC/MCELFStreamer.h b/include/llvm/MC/MCELFStreamer.h
index ab20ee89a8..60a360f896 100644
--- a/include/llvm/MC/MCELFStreamer.h
+++ b/include/llvm/MC/MCELFStreamer.h
@@ -44,6 +44,7 @@ public:
/// @{
virtual void InitSections();
+ virtual void InitToTextSection();
virtual void ChangeSection(const MCSection *Section);
virtual void EmitLabel(MCSymbol *Symbol);
virtual void EmitDebugLabel(MCSymbol *Symbol);