]> granicus.if.org Git - clang/commitdiff
[ms-inline asm] PatchMSAsmString() doesn't correctly patch non-simple asm
authorChad Rosier <mcrosier@apple.com>
Fri, 10 Aug 2012 21:27:11 +0000 (21:27 +0000)
committerChad Rosier <mcrosier@apple.com>
Fri, 10 Aug 2012 21:27:11 +0000 (21:27 +0000)
statements.  Therefore, we can't pass the PatchedAsmString to the AsmParser
and expect things to work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161701 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaStmt.cpp

index e72495fc7b05cb12b317c7fc89b49705f7739fd7..347b34f78a3c6d0ce96b3ef55999c27c207d9f70 100644 (file)
@@ -2902,6 +2902,15 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
   std::string PatchedAsmString =
     PatchMSAsmString(*this, IsSimple, AsmLoc, AsmToks, Context.getTargetInfo());
 
+  // PatchMSAsmString doesn't correctly patch non-simple asm statements.
+  if (!IsSimple) {
+    MSAsmStmt *NS =
+      new (Context) MSAsmStmt(Context, AsmLoc, /* IsSimple */ true,
+                              /* IsVolatile */ true, AsmToks, LineEnds,
+                              AsmString, Clobbers, EndLoc);
+    return Owned(NS);
+  }
+
   // Initialize targets and assembly printers/parsers.
   llvm::InitializeAllTargetInfos();
   llvm::InitializeAllTargetMCs();