From 543cb3e93a35f7e9b246f6ab3a209f3acb41fc7d Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Thu, 9 Aug 2012 20:52:43 +0000 Subject: [PATCH] [ms-inline asm] Simplify logic for empty asm statements. llvm-svn: 161615 --- clang/lib/Sema/SemaStmt.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index f2d155513aeb..856a60203d4b 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/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;