================
@@ -2535,10 +2535,17 @@ llvm::DISubprogram
*CGDebugInfo::CreateCXXMemberFunction(
SPFlags |= llvm::DISubprogram::SPFlagOptimized;
// In this debug mode, emit type info for a class when its constructor type
- // info is emitted.
- if (DebugKind == llvm::codegenoptions::DebugInfoConstructor)
- if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(Method))
- completeUnusedClass(*CD->getParent());
+ // info is emitted. Delegating constructors are ignored because the target
+ // constructor's definition will emit the type info.
+ if (DebugKind == llvm::codegenoptions::DebugInfoConstructor) {
+ if (const auto *CD = dyn_cast<CXXConstructorDecl>(Method)) {
+ const FunctionDecl *Def = nullptr;
+ if (CD->isDefined(Def) &&
+ !cast<CXXConstructorDecl>(Def)->isDelegatingConstructor()) {
+ completeUnusedClass(*CD->getParent());
+ }
----------------
dwblaikie wrote:
Can we assume this is a definition? I expect the old code was assuming it was a
definition, otherwise it wouldn't make senseto emit the class info if we were
only emitting a declaration of the function?
```suggestion
if
(!cast<CXXConstructorDecl>(CD->getDefinition())->isDelegatingConstructor()) {
completeUnusedClass(*CD->getParent());
}
```
https://github.com/llvm/llvm-project/pull/218807
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits