From 1f52d6aa1bd9b42f83b1c2a2f888663e925d0584 Mon Sep 17 00:00:00 2001 From: Jonathan Roelofs Date: Tue, 9 Jun 2015 14:13:31 +0000 Subject: [PATCH] Fix printing of GCCAsmExprs with input or output arguments. 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 | 6 ++++-- test/Sema/ast-print.c | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index cd65d72973..db6d8c231e 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -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 diff --git a/test/Sema/ast-print.c b/test/Sema/ast-print.c index b4d76844fe..80ae8f054c 100644 --- a/test/Sema/ast-print.c +++ b/test/Sema/ast-print.c @@ -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) ); +} -- 2.40.0