[cfe-commits] [PATCH][Review Request] - handle non-copy constructor initializers

Jim Goodnow II jim at thegoodnows.net
Fri Sep 17 05:46:45 PDT 2010


Just a fixup to my previous patch that handles non-copy constructor 
initializers in DeclPrinter.

  - jim

Index: lib/AST/DeclPrinter.cpp
===================================================================
--- lib/AST/DeclPrinter.cpp	(revision 113834)
+++ lib/AST/DeclPrinter.cpp	(working copy)
@@ -521,8 +521,11 @@
    if (Expr *Init = D->getInit()) {
      if (D->hasCXXDirectInitializer())
        Out << "(";
-    else if (!dyn_cast<CXXConstructExpr>(Init))
-      Out << " = ";
+    else {
+        CXXConstructExpr *CCE = dyn_cast<CXXConstructExpr>(Init);
+        if (!CCE || CCE->getConstructor()->isCopyConstructor())
+          Out << " = ";
+    }
      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: 669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100917/54411ea2/attachment.obj>


More information about the cfe-commits mailing list