Improve the printing of C++ construction expressions, from Yuri Gribov!

llvm-svn: 124123
This commit is contained in:
Douglas Gregor 2011-01-24 17:25:03 +00:00
parent 1eb95961d3
commit baba85dc34
1 changed files with 8 additions and 7 deletions

View 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) {