[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:37 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;
----------------
zyn0217 wrote:

Hmmm, now that we end up having to wire up `DC` and `Innermost`, we'd need to update the doxygen of `getTemplateInstantiationArgs()` as well.

Same question as the last attempt of doing so: can we somehow 'introspect' the use case and handle them separately within the function? Or rather, given that @sdkrystian is going to reland his refactoring work soon, can we try to rebase the implementation on top of that so that we would have less pain when these two are merged?

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


More information about the cfe-commits mailing list