Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit d0fb3ad

Browse files
committed
Improve the printing of C++ construction expressions, from Yuri Gribov!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124123 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent cb88a1f commit d0fb3ad

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/AST/StmtPrinter.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -1128,14 +1128,15 @@ void StmtPrinter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
11281128
}
11291129

11301130
void StmtPrinter::VisitCXXConstructExpr(CXXConstructExpr *E) {
1131-
// FIXME. For now we just print a trivial constructor call expression,
1132-
// constructing its first argument object.
1133-
if (E->getNumArgs() == 1) {
1134-
CXXConstructorDecl *CD = E->getConstructor();
1135-
if (CD->isTrivial())
1136-
PrintExpr(E->getArg(0));
1131+
for (unsigned i = 0, e = E->getNumArgs(); i != e; ++i) {
1132+
if (isa<CXXDefaultArgExpr>(E->getArg(i))) {
1133+
// Don't print any defaulted arguments
1134+
break;
1135+
}
1136+
1137+
if (i) OS << ", ";
1138+
PrintExpr(E->getArg(i));
11371139
}
1138-
// Nothing to print.
11391140
}
11401141

11411142
void StmtPrinter::VisitExprWithCleanups(ExprWithCleanups *E) {

0 commit comments

Comments
 (0)