[clang] [clang] Track function template instantiation from definition (PR #110387)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 5 18:46:36 PDT 2024


================
@@ -492,8 +489,10 @@ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs(
     // has a depth of 0.
     if (const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(CurDecl))
       HandleDefaultTempArgIntoTempTempParam(TTP, Result);
-    CurDecl = Response::UseNextDecl(CurDecl).NextDecl;
-  }
+    CurDecl = DC ? Decl::castFromDeclContext(DC)
+                 : Response::UseNextDecl(CurDecl).NextDecl;
+  } else if (!CurDecl)
+    CurDecl = Decl::castFromDeclContext(DC);
----------------
zyn0217 wrote:

nit: We might want to keep this branch where it was. (i.e. to still put it on line 479 - 481)

(I remembered I was told handling it earlier makes things clearer, so...)

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


More information about the cfe-commits mailing list