[clang] Fix scope of typedefs present inside a template class (PR #146729)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 19 06:41:18 PDT 2025
================
@@ -4189,8 +4189,13 @@ llvm::DICompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
llvm::MDNode::replaceWithDistinct(llvm::TempDICompositeType(RealDecl));
break;
}
-
- RegionMap[Ty->getDecl()].reset(RealDecl);
+ if (auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(Ty->getDecl())) {
+ CXXRecordDecl *TemplateDecl =
+ CTSD->getSpecializedTemplate()->getTemplatedDecl();
+ RegionMap[TemplateDecl].reset(RealDecl);
+ } else {
+ RegionMap[Ty->getDecl()].reset(RealDecl);
+ }
----------------
ykhatav wrote:
Are you suggesting introducing a way to find the class template specialization the Typedef Decl belongs to, perhaps through the two functions you mentioned earlier? Since the PR is already approved, could you clarify if this is a suggestion for a follow-up task, or if you'd like it incorporated into this PR before merging? If it's a follow-up, should a new issue be created for it?
https://github.com/llvm/llvm-project/pull/146729
More information about the cfe-commits
mailing list