]> granicus.if.org Git - clang/commitdiff
Improve the printing of C++ construction expressions, from Yuri Gribov!
authorDouglas Gregor <dgregor@apple.com>
Mon, 24 Jan 2011 17:25:03 +0000 (17:25 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 24 Jan 2011 17:25:03 +0000 (17:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124123 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/StmtPrinter.cpp

index cea3173eb68bae46eff3fb4a1ccc79331c097c6c..74429ce31df4a072b11538dc7b5e6ce4d9f2523f 100644 (file)
@@ -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) {