r180867 - Fix spurious trailing comma when printing some of the __c11_atomic_* builtins. Patch by Joe Sprowes!
Richard Smith
richard-llvm at metafoo.co.uk
Wed May 1 12:02:43 PDT 2013
Author: rsmith
Date: Wed May 1 14:02:43 2013
New Revision: 180867
URL: http://llvm.org/viewvc/llvm-project?rev=180867&view=rev
Log:
Fix spurious trailing comma when printing some of the __c11_atomic_* builtins. Patch by Joe Sprowes!
Modified:
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/test/SemaCXX/ast-print.cpp
Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=180867&r1=180866&r2=180867&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Wed May 1 14:02:43 2013
@@ -1113,24 +1113,25 @@ void StmtPrinter::VisitAtomicExpr(Atomic
// AtomicExpr stores its subexpressions in a permuted order.
PrintExpr(Node->getPtr());
- OS << ", ";
if (Node->getOp() != AtomicExpr::AO__c11_atomic_load &&
Node->getOp() != AtomicExpr::AO__atomic_load_n) {
- PrintExpr(Node->getVal1());
OS << ", ";
+ PrintExpr(Node->getVal1());
}
if (Node->getOp() == AtomicExpr::AO__atomic_exchange ||
Node->isCmpXChg()) {
- PrintExpr(Node->getVal2());
OS << ", ";
+ PrintExpr(Node->getVal2());
}
if (Node->getOp() == AtomicExpr::AO__atomic_compare_exchange ||
Node->getOp() == AtomicExpr::AO__atomic_compare_exchange_n) {
- PrintExpr(Node->getWeak());
OS << ", ";
+ PrintExpr(Node->getWeak());
}
- if (Node->getOp() != AtomicExpr::AO__c11_atomic_init)
+ if (Node->getOp() != AtomicExpr::AO__c11_atomic_init) {
+ OS << ", ";
PrintExpr(Node->getOrder());
+ }
if (Node->isCmpXChg()) {
OS << ", ";
PrintExpr(Node->getOrderFail());
Modified: cfe/trunk/test/SemaCXX/ast-print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ast-print.cpp?rev=180867&r1=180866&r2=180867&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/ast-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/ast-print.cpp Wed May 1 14:02:43 2013
@@ -137,3 +137,14 @@ void test12() {
ConstrWithCleanupsClass cwcExplicitArg(VirualDestrClass(56));
}
+// CHECK: void test13() {
+// CHECK: _Atomic(int) i;
+// CHECK: __c11_atomic_init(&i, 0);
+// CHECK: __c11_atomic_load(&i, 0);
+// CHECK: }
+void test13() {
+ _Atomic(int) i;
+ __c11_atomic_init(&i, 0);
+ __c11_atomic_load(&i, 0);
+}
+
More information about the cfe-commits
mailing list