aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-08-09 20:52:43 +0000
committerChad Rosier <mcrosier@apple.com>2012-08-09 20:52:43 +0000
commit4144f9079e685408cef414e29970b7b7960eddf0 (patch)
treeea39aa3f9fee1098d3ae61094aa5e579286e233e /lib/Sema/SemaStmt.cpp
parent47f49892fb229488ff11653e1dec373873dfcffb (diff)
[ms-inline asm] Simplify logic for empty asm statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161615 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index f2d155513a..856a60203d 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -2888,6 +2888,16 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
// MS-style inline assembly is not fully supported, so emit a warning.
Diag(AsmLoc, diag::warn_unsupported_msasm);
+ // Empty asm statements don't need to instantiate the AsmParser, etc.
+ if (AsmToks.empty()) {
+ std::string AsmString;
+ MSAsmStmt *NS =
+ new (Context) MSAsmStmt(Context, AsmLoc, /* IsSimple */ true,
+ /* IsVolatile */ true, AsmToks, LineEnds,
+ AsmString, EndLoc);
+ return Owned(NS);
+ }
+
std::string AsmString = buildMSAsmString(*this, AsmToks, LineEnds);
bool IsSimple;