[ms-inline asm] PatchMSAsmString() doesn't correctly patch non-simple asm
statements. Therefore, we can't pass the PatchedAsmString to the AsmParser
and expect things to work.
llvm-svn: 161701
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index e72495f..347b34f 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -2902,6 +2902,15 @@
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();