From: Coby Tayree Date: Sun, 5 Feb 2017 10:23:06 +0000 (+0000) Subject: [X86][MS]Adjacent comments within multi-line inline assembly statement X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80283fe1d92762e2e6a0b38e9cfa357845a810bc;p=clang [X86][MS]Adjacent comments within multi-line inline assembly statement Allowing adjacent comments within MS inline assembly multi-line statement Differential Revision: https://reviews.llvm.org/D28989 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294120 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseStmtAsm.cpp b/lib/Parse/ParseStmtAsm.cpp index 293de78505..7fd9fa2146 100644 --- a/lib/Parse/ParseStmtAsm.cpp +++ b/lib/Parse/ParseStmtAsm.cpp @@ -457,6 +457,11 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { break; LineNo = SrcMgr.getLineNumber(ExpLoc.first, ExpLoc.second); SkippedStartOfLine = Tok.isAtStartOfLine(); + } else if (Tok.is(tok::semi)) { + // A multi-line asm-statement, where next line is a comment + InAsmComment = true; + FID = ExpLoc.first; + LineNo = SrcMgr.getLineNumber(FID, ExpLoc.second); } } else if (!InAsmComment && Tok.is(tok::r_brace)) { // In MSVC mode, braces only participate in brace matching and diff --git a/test/CodeGen/ms-inline-asm.c b/test/CodeGen/ms-inline-asm.c index 6efc09aec5..6db0cff50d 100644 --- a/test/CodeGen/ms-inline-asm.c +++ b/test/CodeGen/ms-inline-asm.c @@ -55,9 +55,15 @@ void t7() { } } __asm {} + __asm { + ; + ; label + mov eax, ebx + } // CHECK: t7 // CHECK: call void asm sideeffect inteldialect "int $$0x2cU", "~{dirflag},~{fpsr},~{flags}"() // CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"() +// CHECK: call void asm sideeffect inteldialect "mov eax, ebx", "~{eax},~{dirflag},~{fpsr},~{flags}"() } int t8() {