]> granicus.if.org Git - clang/commitdiff
Fix printing of GCCAsmExprs with input or output arguments.
authorJonathan Roelofs <jonathan@codesourcery.com>
Tue, 9 Jun 2015 14:13:31 +0000 (14:13 +0000)
committerJonathan Roelofs <jonathan@codesourcery.com>
Tue, 9 Jun 2015 14:13:31 +0000 (14:13 +0000)
Patch by Nick Sumner!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239406 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/StmtPrinter.cpp
test/Sema/ast-print.c

index cd65d729730d0ed9c0246a2d5503f376611e4acf..db6d8c231ef22c1f4debdb875ba59877418874a8 100644 (file)
@@ -396,8 +396,9 @@ void StmtPrinter::VisitGCCAsmStmt(GCCAsmStmt *Node) {
     }
 
     VisitStringLiteral(Node->getOutputConstraintLiteral(i));
-    OS << " ";
+    OS << " (";
     Visit(Node->getOutputExpr(i));
+    OS << ")";
   }
 
   // Inputs
@@ -415,8 +416,9 @@ void StmtPrinter::VisitGCCAsmStmt(GCCAsmStmt *Node) {
     }
 
     VisitStringLiteral(Node->getInputConstraintLiteral(i));
-    OS << " ";
+    OS << " (";
     Visit(Node->getInputExpr(i));
+    OS << ")";
   }
 
   // Clobbers
index b4d76844fef780812aa45291135fb7b9f6cc721b..80ae8f054ccc1957425c8d7cc4fbe087a62d2eb3 100644 (file)
@@ -53,3 +53,9 @@ struct pair_t {
 
 // CHECK: struct pair_t p = {a: 3, .b = 4};
 struct pair_t p = {a: 3, .b = 4};
+
+void assembly() {
+  int added;
+  // CHECK: asm volatile ("addl %%ebx,%%eax" : "=a" (added) : "a" (1), "b" (2));
+  __asm__ __volatile__("addl %%ebx,%%eax" : "=a" (added) : "a" (1), "b" (2) );
+}