From e0e7a08a319c183d9f5628202407a2bfeccf5852 Mon Sep 17 00:00:00 2001 From: Augusto Noronha Date: Wed, 10 Apr 2024 16:11:19 -0700 Subject: [PATCH] [DebugInfo] Emit declaration by checking both type and SIL func repr --- lib/IRGen/IRGenDebugInfo.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index b6a90c5e2e225..92f56331d9c7f 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -2958,7 +2958,12 @@ IRGenDebugInfoImpl::emitFunction(const SILDebugScope *DS, llvm::Function *Fn, // Because there's no good way to cross the CU boundary to insert a nested // DISubprogram definition in one CU into a type defined in another CU when // doing LTO builds. - if (llvm::isa(Scope)) { + if (llvm::isa(Scope) && + (Rep == SILFunctionTypeRepresentation::Method || + Rep == SILFunctionTypeRepresentation::ObjCMethod || + Rep == SILFunctionTypeRepresentation::WitnessMethod || + Rep == SILFunctionTypeRepresentation::CXXMethod || + Rep == SILFunctionTypeRepresentation::Thin)) { llvm::DISubprogram::DISPFlags SPFlags = llvm::DISubprogram::toSPFlags( /*IsLocalToUnit=*/Fn ? Fn->hasInternalLinkage() : true, /*IsDefinition=*/false, /*IsOptimized=*/Opts.shouldOptimize());