diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -2631,6 +2631,13 @@ return const_cast(this)->getCanonicalDecl(); } + void printName(raw_ostream &os) const override { + if (isInheritingConstructor()) + getParent()->printName(os); + else + CXXMethodDecl::printName(os); + } + // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classofKind(Kind K) { return K == CXXConstructor; } diff --git a/clang/test/CodeGenCXX/debug-info-inheriting-constructor.cpp b/clang/test/CodeGenCXX/debug-info-inheriting-constructor.cpp --- a/clang/test/CodeGenCXX/debug-info-inheriting-constructor.cpp +++ b/clang/test/CodeGenCXX/debug-info-inheriting-constructor.cpp @@ -16,10 +16,10 @@ // CHECK-SAME: metadata ![[THIS:[0-9]+]], metadata !DIExpression()), !dbg ![[LOC:[0-9]+]] // CHECK: ret void, !dbg ![[NOINL:[0-9]+]] // CHECK: ![[FOO:.*]] = distinct !DISubprogram(name: "foo" -// CHECK-DAG: ![[A:.*]] = distinct !DISubprogram(name: "A", linkageName: "_ZN1BCI11AEiz" +// CHECK-DAG: ![[B:.*]] = distinct !DISubprogram(name: "B", linkageName: "_ZN1BCI11AEiz" void foo() { -// CHECK-DAG: ![[LOC]] = !DILocation(line: 0, scope: ![[A]], inlinedAt: ![[INL:[0-9]+]]) -// CHECK-DAG: ![[INL]] = !DILocation(line: [[@LINE+1]], scope: ![[FOO]]) + // CHECK-DAG: ![[LOC]] = !DILocation(line: 0, scope: ![[B]], inlinedAt: ![[INL:[0-9]+]]) + // CHECK-DAG: ![[INL]] = !DILocation(line: [[@LINE+1]], scope: ![[FOO]]) B b(0); // CHECK: ![[NOINL]] = !DILocation(line: [[@LINE+1]], scope: !{{[0-9]+}}) } diff --git a/clang/test/CodeGenCXX/debug-info-inlined.cpp b/clang/test/CodeGenCXX/debug-info-inlined.cpp --- a/clang/test/CodeGenCXX/debug-info-inlined.cpp +++ b/clang/test/CodeGenCXX/debug-info-inlined.cpp @@ -26,4 +26,4 @@ // CHECK-SAME: !dbg ![[INL:[0-9]+]] // CHECK: ![[INL]] = !DILocation(line: 10, scope: ![[SP:[0-9]+]], inlinedAt: -// CHECK: ![[SP]] = distinct !DISubprogram(name: "Base", {{.*}} DISPFlagDefinition +// CHECK: ![[SP]] = distinct !DISubprogram(name: "Forward", {{.*}} DISPFlagDefinition