Correct pretty printing of array new expressions.

llvm-svn: 60444
This commit is contained in:
Sebastian Redl
2008-12-02 22:08:59 +00:00
parent e62150cae4
commit d6d55eeef5

View File

@@ -953,10 +953,15 @@ void StmtPrinter::VisitCXXNewExpr(CXXNewExpr *E) {
}
if (E->isParenTypeId())
OS << "(";
// FIXME: This doesn't print the dynamic array size. We'd have to split up
// the allocated type to correctly emit that, but without an ASTContext,
// that's not possible.
OS << E->getAllocatedType().getAsString();
std::string TypeS;
if (Expr *Size = E->getArraySize()) {
llvm::raw_string_ostream s(TypeS);
Size->printPretty(s);
s.flush();
TypeS = "[" + TypeS + "]";
}
E->getAllocatedType().getAsStringInternal(TypeS);
OS << TypeS;
if (E->isParenTypeId())
OS << ")";