[cfe-commits] r60444 - /cfe/trunk/lib/AST/StmtPrinter.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Tue Dec 2 14:09:00 PST 2008


Author: cornedbee
Date: Tue Dec  2 16:08:59 2008
New Revision: 60444

URL: http://llvm.org/viewvc/llvm-project?rev=60444&view=rev
Log:
Correct pretty printing of array new expressions.

Modified:
    cfe/trunk/lib/AST/StmtPrinter.cpp

Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=60444&r1=60443&r2=60444&view=diff

==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Tue Dec  2 16:08:59 2008
@@ -953,10 +953,15 @@
   }
   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 << ")";
 





More information about the cfe-commits mailing list