So, if you have:

class foo {
public:
        foo() {}
};
foo foobar;

then the AST output gives:

foo foobar = ;

This patch fixes that.

 - jim

Index: lib/AST/DeclPrinter.cpp
===================================================================
--- lib/AST/DeclPrinter.cpp     (revision 112954)
+++ lib/AST/DeclPrinter.cpp     (working copy)
@@ -518,12 +518,13 @@
     T = Parm->getOriginalType();
   T.getAsStringInternal(Name, Policy);
   Out << Name;
-  if (D->getInit()) {
+  Expr *Init = D->getInit();
+  if (Init && !dyn_cast<CXXConstructExpr>(Init)) {
     if (D->hasCXXDirectInitializer())
       Out << "(";
     else
       Out << " = ";
-    D->getInit()->printPretty(Out, Context, 0, Policy, Indentation);
+    Init->printPretty(Out, Context, 0, Policy, Indentation);
     if (D->hasCXXDirectInitializer())
       Out << ")";
   }

Attachment: DeclPrinter.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to