[cfe-commits] [PATCH][Review Request] - AST Print Problem with Constructor Initializer
Jim Goodnow II
jim at thegoodnows.net
Fri Sep 3 04:32:22 PDT 2010
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 << ")";
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DeclPrinter.patch
Type: application/octet-stream
Size: 689 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100903/7571eed8/attachment.obj>
More information about the cfe-commits
mailing list