summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2016-10-03 12:12:03 +0000
committerAlex Lorenz <arphaman@gmail.com>2016-10-03 12:12:03 +0000
commit2bc02892be4fa05a03b3777cbcce4e2a962141ae (patch)
treed2447e383343b1baeedeb18d71feac5a49740038 /clang/lib
parent10874f70fa274c4dac2efd7ea1eb729cc05b6fcc (diff)
downloadbcm5719-llvm-2bc02892be4fa05a03b3777cbcce4e2a962141ae.tar.gz
bcm5719-llvm-2bc02892be4fa05a03b3777cbcce4e2a962141ae.zip
Fix PR 28885: Fix AST Printer output for the inherited constructor using
declarations. This commit ensures that the correct record type is printed out for the using declarations that represent C++ inherited constructors. It fixes a regression introduced in r274049 which changed the name that's stored in the using declarations that correspond to inherited constructors. Differential Revision: https://reviews.llvm.org/D25131 llvm-svn: 283102
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/DeclPrinter.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 7e786990bec..6d47dd7b883 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -1346,6 +1346,17 @@ void DeclPrinter::VisitUsingDecl(UsingDecl *D) {
if (D->hasTypename())
Out << "typename ";
D->getQualifier()->print(Out, Policy);
+
+ // Use the correct record name when the using declaration is used for
+ // inheriting constructors.
+ for (const auto *Shadow : D->shadows()) {
+ if (const auto *ConstructorShadow =
+ dyn_cast<ConstructorUsingShadowDecl>(Shadow)) {
+ assert(Shadow->getDeclContext() == ConstructorShadow->getDeclContext());
+ Out << *ConstructorShadow->getNominatedBaseClass();
+ return;
+ }
+ }
Out << *D;
}
OpenPOWER on IntegriCloud