[cfe-commits] r124123 - /cfe/trunk/lib/AST/StmtPrinter.cpp

Douglas Gregor dgregor at apple.com
Mon Jan 24 09:25:03 PST 2011


Author: dgregor
Date: Mon Jan 24 11:25:03 2011
New Revision: 124123

URL: http://llvm.org/viewvc/llvm-project?rev=124123&view=rev
Log:
Improve the printing of C++ construction expressions, from Yuri Gribov!

Modified:
    cfe/trunk/lib/AST/StmtPrinter.cpp

Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=124123&r1=124122&r2=124123&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Mon Jan 24 11:25:03 2011
@@ -1128,14 +1128,15 @@
 }
 
 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) {





More information about the cfe-commits mailing list