aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2008-12-02 22:08:59 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2008-12-02 22:08:59 +0000
commit6fec64874f282f7084d5c626e42241cdcbafac9d (patch)
tree6d0c752844f69b10bfa5353dcf361850a6cd6e1d
parent09852a8860672e77eb7c3270d9b795bc3163bb89 (diff)
Correct pretty printing of array new expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60444 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/StmtPrinter.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index 445e3e4755..8cd79a8347 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -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 << ")";