[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 6 00:44:32 PST 2024


================
@@ -8494,10 +8495,21 @@ DeclResult Sema::ActOnClassTemplateSpecialization(
   return Specialization;
 }
 
-Decl *Sema::ActOnTemplateDeclarator(Scope *S,
-                              MultiTemplateParamsArg TemplateParameterLists,
-                                    Declarator &D) {
+Decl *Sema::ActOnTemplateDeclarator(
+    Scope *S, MultiTemplateParamsArg TemplateParameterLists, Declarator &D) {
   Decl *NewDecl = HandleDeclarator(S, D, TemplateParameterLists);
+  if (auto *D = NewDecl) {
+    if (auto *TD = dyn_cast<FunctionTemplateDecl>(D))
+      D = TD->getTemplatedDecl();
+    else if (auto *TD = dyn_cast<VarTemplateDecl>(D))
+      D = TD->getTemplatedDecl();
+    else if (!(isa<FunctionDecl>(D) || isa<VarDecl>(D) ||
+               isa<VarTemplateSpecializationDecl>(D))) {
+      D->dumpColor();
+      llvm_unreachable("FU");
----------------
zyn0217 wrote:

FU?

https://github.com/llvm/llvm-project/pull/107942


More information about the cfe-commits mailing list