Fix spurious trailing comma when printing some of the __c11_atomic_* builtins. Patch by Joe Sprowes!
llvm-svn: 180867
This commit is contained in:
parent
9f8400eca4
commit
df6bee8081
|
@ -1113,24 +1113,25 @@ void StmtPrinter::VisitAtomicExpr(AtomicExpr *Node) {
|
|||
|
||||
// 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());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue