diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-12-02 22:08:59 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-12-02 22:08:59 +0000 |
commit | d6d55eeef587e617ce08cbe38d48b3c528cb5abb (patch) | |
tree | 7d5f6db946ae771be943628bb048030037e2389d /clang/lib/AST | |
parent | e62150cae4be76e9f6953a303bc7be27238bc3d5 (diff) | |
download | bcm5719-llvm-d6d55eeef587e617ce08cbe38d48b3c528cb5abb.tar.gz bcm5719-llvm-d6d55eeef587e617ce08cbe38d48b3c528cb5abb.zip |
Correct pretty printing of array new expressions.
llvm-svn: 60444
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 445e3e47552..8cd79a8347d 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/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 << ")"; |