DeclPrinter: fix CXXConstructExpr printing with implicit default argument
This is an improvement of r173630, that handles the following case:
struct VirualDestrClass
{
VirualDestrClass(int arg);
virtual ~VirualDestrClass();
};
struct ConstrWithCleanupsClass
{
ConstrWithCleanupsClass(const VirualDestrClass& cplx = VirualDestrClass(42));
};
ConstrWithCleanupsClass cwcNoArg;
That was printed as:
ConstrWithCleanupsClass cwcNoArg();
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174296 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp
index f863bb4..333e321 100644
--- a/lib/AST/DeclPrinter.cpp
+++ b/lib/AST/DeclPrinter.cpp
@@ -649,7 +649,8 @@
Expr *Init = D->getInit();
if (!Policy.SuppressInitializers && Init) {
bool ImplicitInit = false;
- if (CXXConstructExpr *Construct = dyn_cast<CXXConstructExpr>(Init)) {
+ if (CXXConstructExpr *Construct =
+ dyn_cast<CXXConstructExpr>(Init->IgnoreImplicit())) {
if (D->getInitStyle() == VarDecl::CallInit &&
!Construct->isListInitialization()) {
ImplicitInit = Construct->getNumArgs() == 0 ||