]> granicus.if.org Git - clang/commitdiff
[X86][MS]Adjacent comments within multi-line inline assembly statement
authorCoby Tayree <coby.tayree@intel.com>
Sun, 5 Feb 2017 10:23:06 +0000 (10:23 +0000)
committerCoby Tayree <coby.tayree@intel.com>
Sun, 5 Feb 2017 10:23:06 +0000 (10:23 +0000)
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

lib/Parse/ParseStmtAsm.cpp
test/CodeGen/ms-inline-asm.c

index 293de78505ef3d331e7292cb68676c83dff70c26..7fd9fa21462bbca0c7ad06a2e862e98066bfa4b0 100644 (file)
@@ -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
index 6efc09aec51da3a9daa99d71f4fc95dde6855559..6db0cff50d0082fe01efad63e9b625caa1c330d1 100644 (file)
@@ -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() {