Tweak in DeclPrinter printing of uses of copy constructors. Patch by Jim Goodnow II.

llvm-svn: 114235
This commit is contained in:
Ted Kremenek 2010-09-17 23:04:38 +00:00
parent 196cf88a01
commit 3586938d37
1 changed files with 5 additions and 2 deletions

View File

@ -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 << ")";