forked from OSchip/llvm-project
Fix printing CXXTemporaryObjectExpr with default args.
Patch by Will Wilson. llvm-svn: 182651
This commit is contained in:
parent
780593580f
commit
6f6f3c4e38
|
@ -1339,6 +1339,8 @@ void StmtPrinter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *Node) {
|
|||
for (CXXTemporaryObjectExpr::arg_iterator Arg = Node->arg_begin(),
|
||||
ArgEnd = Node->arg_end();
|
||||
Arg != ArgEnd; ++Arg) {
|
||||
if (Arg->isDefaultArgument())
|
||||
break;
|
||||
if (Arg != Node->arg_begin())
|
||||
OS << ", ";
|
||||
PrintExpr(*Arg);
|
||||
|
|
|
@ -103,6 +103,7 @@ int test11() {
|
|||
struct DefaultArgClass
|
||||
{
|
||||
DefaultArgClass(int a = 1) {}
|
||||
DefaultArgClass(int a, int b, int c = 1) {}
|
||||
};
|
||||
|
||||
struct NoArgClass
|
||||
|
@ -124,6 +125,8 @@ struct ConstrWithCleanupsClass
|
|||
// CHECK: test12
|
||||
// CHECK-NEXT: DefaultArgClass useDefaultArg;
|
||||
// CHECK-NEXT: DefaultArgClass overrideDefaultArg(1);
|
||||
// CHECK-NEXT: DefaultArgClass(1, 2);
|
||||
// CHECK-NEXT: DefaultArgClass(1, 2, 3);
|
||||
// CHECK-NEXT: NoArgClass noArg;
|
||||
// CHECK-NEXT: ConstrWithCleanupsClass cwcNoArg;
|
||||
// CHECK-NEXT: ConstrWithCleanupsClass cwcOverrideArg(48);
|
||||
|
@ -131,6 +134,8 @@ struct ConstrWithCleanupsClass
|
|||
void test12() {
|
||||
DefaultArgClass useDefaultArg;
|
||||
DefaultArgClass overrideDefaultArg(1);
|
||||
DefaultArgClass tempWithDefaultArg = DefaultArgClass(1, 2);
|
||||
DefaultArgClass tempWithExplictArg = DefaultArgClass(1, 2, 3);
|
||||
NoArgClass noArg;
|
||||
ConstrWithCleanupsClass cwcNoArg;
|
||||
ConstrWithCleanupsClass cwcOverrideArg(48);
|
||||
|
|
Loading…
Reference in New Issue