diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-02-25 18:03:55 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-02-25 18:03:55 +0000 |
commit | 00e8a1915a258bf02edae8a349a1d751362fe979 (patch) | |
tree | db582f07657d16c2583788fd2f43d3d97f50854e /clang/lib/AST/DeclPrinter.cpp | |
parent | 8e38871865530e38c1a9740443a73ac07957e7dc (diff) | |
download | bcm5719-llvm-00e8a1915a258bf02edae8a349a1d751362fe979.tar.gz bcm5719-llvm-00e8a1915a258bf02edae8a349a1d751362fe979.zip |
Reapply "Pretty Printer: Fix printing of conversion operator decls and calls."
There were many additional tests that had the bad behavior baked in.
llvm-svn: 202174
Diffstat (limited to 'clang/lib/AST/DeclPrinter.cpp')
-rw-r--r-- | clang/lib/AST/DeclPrinter.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index aa753887a21..05701a5b061 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -385,6 +385,7 @@ void DeclPrinter::VisitEnumConstantDecl(EnumConstantDecl *D) { void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { CXXConstructorDecl *CDecl = dyn_cast<CXXConstructorDecl>(D); + CXXConversionDecl *ConversionDecl = dyn_cast<CXXConversionDecl>(D); if (!Policy.SuppressSpecifiers) { switch (D->getStorageClass()) { case SC_None: break; @@ -398,7 +399,8 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { if (D->isInlineSpecified()) Out << "inline "; if (D->isVirtualAsWritten()) Out << "virtual "; if (D->isModulePrivate()) Out << "__module_private__ "; - if (CDecl && CDecl->isExplicitSpecified()) + if ((CDecl && CDecl->isExplicitSpecified()) || + (ConversionDecl && ConversionDecl->isExplicit())) Out << "explicit "; } @@ -536,15 +538,15 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { } Out << ")"; } - if (!Proto.empty()) - Out << Proto; - } else { + } else if (!ConversionDecl) { if (FT && FT->hasTrailingReturn()) { Out << "auto " << Proto << " -> "; Proto.clear(); } AFT->getReturnType().print(Out, Policy, Proto); + Proto.clear(); } + Out << Proto; } else { Ty.print(Out, Policy, Proto); } |