[PATCH] D25131: Fix PR 28885: Fix AST Printer output for inheriting constructor using declarations
Alex Lorenz via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 4 01:05:15 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283102: Fix PR 28885: Fix AST Printer output for the inherited constructor using (authored by arphaman).
Changed prior to commit:
https://reviews.llvm.org/D25131?vs=73145&id=73410#toc
Repository:
rL LLVM
https://reviews.llvm.org/D25131
Files:
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
Index: cfe/trunk/lib/AST/DeclPrinter.cpp
===================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp
+++ cfe/trunk/lib/AST/DeclPrinter.cpp
@@ -1346,6 +1346,17 @@
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;
}
Index: cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
+++ cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
@@ -43,6 +43,14 @@
// CHECK: const char *PR23120 = operator""_suffix<char32_t, 66615>();
const char *PR23120 = U"𐐷"_suffix;
+// PR28885
+struct A {
+ A();
+};
+struct B : A {
+ using A::A; // CHECK: using A::A;
+}; // CHECK-NEXT: };
+
// CHECK: ;
;
// CHECK-NOT: ;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25131.73410.patch
Type: text/x-patch
Size: 1243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161004/7df91391/attachment.bin>
More information about the cfe-commits
mailing list