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

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 5 19:04:40 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;
----------------
mizvekov wrote:

In this case, we don't even have the real function declaration that we want to start with, so I am afraid this is too much of an special case  to handle within `getTemplateInstantiationArgs()`.

I think the best way to handle this one is to have one overload of `getTemplateInstantiationArgs` which takes an initial MLTAL, and just adds more template arguments on top of it.

Yeah, I am planning on holding this off a little bit until the refactoring lands.

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


More information about the cfe-commits mailing list