diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-09-06 19:56:25 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-09-06 19:56:25 +0000 |
commit | 46b0a0adbe44c48a88b1cd280333d7dd2e170ecb (patch) | |
tree | 91d7efb211297e7da1b9bec3a10892e4dd16cadb /clang/lib/Sema/SemaStmtAsm.cpp | |
parent | c3366ccecb3ffa7eecf0c8a173e5fc8387a44b29 (diff) | |
download | bcm5719-llvm-46b0a0adbe44c48a88b1cd280333d7dd2e170ecb.tar.gz bcm5719-llvm-46b0a0adbe44c48a88b1cd280333d7dd2e170ecb.zip |
[ms-inline asm] Output empty asm statements for the directives we don't
handle. Otherwise, the AsmParser will explode if we try to generate an
object files.
llvm-svn: 163345
Diffstat (limited to 'clang/lib/Sema/SemaStmtAsm.cpp')
-rw-r--r-- | clang/lib/Sema/SemaStmtAsm.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp index c6432ddc66c..5cab02d9248 100644 --- a/clang/lib/Sema/SemaStmtAsm.cpp +++ b/clang/lib/Sema/SemaStmtAsm.cpp @@ -454,11 +454,11 @@ static std::string buildMSAsmString(Sema &SemaRef, ArrayRef<Token> AsmToks, return Res.str(); } -#define DEF_SIMPLE_MSASM \ +#define DEF_SIMPLE_MSASM(STR) \ MSAsmStmt *NS = \ new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, /*IsSimple*/ true, \ /*IsVolatile*/ true, AsmToks, Inputs, Outputs, \ - InputExprs, OutputExprs, AsmString, Constraints, \ + InputExprs, OutputExprs, STR, Constraints, \ Clobbers, EndLoc); StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, @@ -478,11 +478,8 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, SmallVector<std::string, 4> OutputExprNames; // Empty asm statements don't need to instantiate the AsmParser, etc. - if (AsmToks.empty()) { - StringRef AsmString; - DEF_SIMPLE_MSASM; - return Owned(NS); - } + StringRef EmptyAsmStr; + if (AsmToks.empty()) { DEF_SIMPLE_MSASM(EmptyAsmStr); return Owned(NS); } std::vector<std::string> AsmStrings; std::vector<std::pair<unsigned,unsigned> > AsmTokRanges; @@ -495,7 +492,7 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, bool IsSimple = isSimpleMSAsm(Pieces, Context.getTargetInfo()); // AsmParser doesn't fully support these asm statements. - if (bailOnMSAsm(Pieces)) { DEF_SIMPLE_MSASM; return Owned(NS); } + if (bailOnMSAsm(Pieces)) { DEF_SIMPLE_MSASM(EmptyAsmStr); return Owned(NS); } // Initialize targets and assembly printers/parsers. llvm::InitializeAllTargetInfos(); @@ -549,7 +546,7 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, bool HadError = TargetParser->ParseInstruction(OpcodeStr.str(), IDLoc, Operands); // If we had an error parsing the operands, fail gracefully. - if (HadError) { DEF_SIMPLE_MSASM; return Owned(NS); } + if (HadError) { DEF_SIMPLE_MSASM(EmptyAsmStr); return Owned(NS); } // Match the MCInstr. unsigned Kind; @@ -559,7 +556,7 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, ErrorInfo, /*matchingInlineAsm*/ true); // If we had an error parsing the operands, fail gracefully. - if (HadError) { DEF_SIMPLE_MSASM; return Owned(NS); } + if (HadError) { DEF_SIMPLE_MSASM(EmptyAsmStr); return Owned(NS); } // Get the instruction descriptor. llvm::MCInst Inst = Instrs[0]; |