diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-05 23:15:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-05 23:15:42 +0000 |
commit | 3b21e4d4043d80dceed698a8ed281f7d0e1f161e (patch) | |
tree | 3c41f859c9c4dd2b5248536d48f04c9c7de56c6e /llvm/lib/MC/MCParser/AsmParser.cpp | |
parent | 8900ef1931d236d354d2c413ea19ebdd6c3b488f (diff) | |
download | bcm5719-llvm-3b21e4d4043d80dceed698a8ed281f7d0e1f161e.tar.gz bcm5719-llvm-3b21e4d4043d80dceed698a8ed281f7d0e1f161e.zip |
Give AsmParser an option to control whether it finalizes
the stream. New demo:
$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
$ otool -tv t.o
t.o:
(__TEXT,__text) section
_foo:
0000000000000000 subq $0x08,%rsp
0000000000000004 movl %edi,(%rsp)
0000000000000007 movl %edi,%eax
0000000000000009 incl %eax
000000000000000b movl %eax,(%rsp)
000000000000000e movl %eax,0x04(%rsp)
0000000000000012 addq $0x08,%rsp
0000000000000016 ret
llvm-svn: 100492
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 24616b40b8e..4e62689c51e 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -138,7 +138,7 @@ const AsmToken &AsmParser::Lex() { return *tok; } -bool AsmParser::Run(bool NoInitialTextSection) { +bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) { // Create the initial section, if requested. // // FIXME: Target hook & command line option for initial section. @@ -190,7 +190,9 @@ bool AsmParser::Run(bool NoInitialTextSection) { TheCondState.Ignore != StartingCondState.Ignore) return TokError("unmatched .ifs or .elses"); - if (!HadError) + // Finalize the output stream if there are no errors and if the client wants + // us to. + if (!HadError && !NoFinalize) Out.Finish(); return HadError; |