mirror of
https://github.com/intel/llvm.git
synced 2026-01-30 14:07:28 +08:00
Correct pretty printing of array new expressions.
llvm-svn: 60444
This commit is contained in:
@@ -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 << ")";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user