aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-24 17:25:03 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-24 17:25:03 +0000
commitd0fb3adeed631385a53d15ced60d67c5f64eb133 (patch)
treed35844a6477dd33c9202f2687fade71c2ff4f491
parentcb88a1f968c3d4eb451dafb421a8d9578edcbf1a (diff)
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
-rw-r--r--lib/AST/StmtPrinter.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index cea3173eb6..74429ce31d 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -1128,14 +1128,15 @@ void StmtPrinter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
}
void StmtPrinter::VisitCXXConstructExpr(CXXConstructExpr *E) {
- // FIXME. For now we just print a trivial constructor call expression,
- // constructing its first argument object.
- if (E->getNumArgs() == 1) {
- CXXConstructorDecl *CD = E->getConstructor();
- if (CD->isTrivial())
- PrintExpr(E->getArg(0));
+ for (unsigned i = 0, e = E->getNumArgs(); i != e; ++i) {
+ if (isa<CXXDefaultArgExpr>(E->getArg(i))) {
+ // Don't print any defaulted arguments
+ break;
+ }
+
+ if (i) OS << ", ";
+ PrintExpr(E->getArg(i));
}
- // Nothing to print.
}
void StmtPrinter::VisitExprWithCleanups(ExprWithCleanups *E) {