r239406 - Fix printing of GCCAsmExprs with input or output arguments.

Jonathan Roelofs jonathan at codesourcery.com
Tue Jun 9 07:13:32 PDT 2015


Author: jroelofs
Date: Tue Jun  9 09:13:31 2015
New Revision: 239406

URL: http://llvm.org/viewvc/llvm-project?rev=239406&view=rev
Log:
Fix printing of GCCAsmExprs with input or output arguments.

Patch by Nick Sumner!

Modified:
    cfe/trunk/lib/AST/StmtPrinter.cpp
    cfe/trunk/test/Sema/ast-print.c

Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=239406&r1=239405&r2=239406&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Tue Jun  9 09:13:31 2015
@@ -396,8 +396,9 @@ void StmtPrinter::VisitGCCAsmStmt(GCCAsm
     }
 
     VisitStringLiteral(Node->getOutputConstraintLiteral(i));
-    OS << " ";
+    OS << " (";
     Visit(Node->getOutputExpr(i));
+    OS << ")";
   }
 
   // Inputs
@@ -415,8 +416,9 @@ void StmtPrinter::VisitGCCAsmStmt(GCCAsm
     }
 
     VisitStringLiteral(Node->getInputConstraintLiteral(i));
-    OS << " ";
+    OS << " (";
     Visit(Node->getInputExpr(i));
+    OS << ")";
   }
 
   // Clobbers

Modified: cfe/trunk/test/Sema/ast-print.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/ast-print.c?rev=239406&r1=239405&r2=239406&view=diff
==============================================================================
--- cfe/trunk/test/Sema/ast-print.c (original)
+++ cfe/trunk/test/Sema/ast-print.c Tue Jun  9 09:13:31 2015
@@ -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) );
+}





More information about the cfe-commits mailing list