]> granicus.if.org Git - clang/commitdiff
Fix DeclPrinter to not include '=' in printing when no initializer is provided for...
authorTed Kremenek <kremenek@apple.com>
Tue, 7 Sep 2010 22:21:59 +0000 (22:21 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 7 Sep 2010 22:21:59 +0000 (22:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113296 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclPrinter.cpp

index f18d2f0215ddb3c82fbf8b2f88175abbc2b2169d..e8c24965bdc8d4d38754aa00dc64efdf519936ca 100644 (file)
@@ -518,12 +518,12 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) {
     T = Parm->getOriginalType();
   T.getAsStringInternal(Name, Policy);
   Out << Name;
-  if (D->getInit()) {
+  if (Expr *Init = D->getInit()) {
     if (D->hasCXXDirectInitializer())
       Out << "(";
-    else
+    else if (!dyn_cast<CXXConstructExpr>(Init))
       Out << " = ";
-    D->getInit()->printPretty(Out, Context, 0, Policy, Indentation);
+    Init->printPretty(Out, Context, 0, Policy, Indentation);
     if (D->hasCXXDirectInitializer())
       Out << ")";
   }