aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclPrinter.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-09-17 23:04:38 +0000
committerTed Kremenek <kremenek@apple.com>2010-09-17 23:04:38 +0000
commitc57d655921ad0b20e1af50cbab5595520bd5da85 (patch)
tree73e73bc7f54bc05ff14ae7c307ebb4789ea18edd /lib/AST/DeclPrinter.cpp
parent837e738d91b2b79b676a7bcddd918e3f4a32bce1 (diff)
Tweak in DeclPrinter printing of uses of copy constructors. Patch by Jim Goodnow II.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114235 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclPrinter.cpp')
-rw-r--r--lib/AST/DeclPrinter.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp
index e8c24965bd..a8f19952b6 100644
--- a/lib/AST/DeclPrinter.cpp
+++ b/lib/AST/DeclPrinter.cpp
@@ -521,8 +521,11 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) {
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 << ")";