[clang] Reapply "[Clang][Sema] Refactor collection of multi-level template argument lists (#106585)" (PR #111173)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 4 10:14:32 PDT 2024
================
@@ -4159,7 +4159,7 @@ FunctionTemplateDecl *FunctionDecl::getPrimaryTemplate() const {
if (FunctionTemplateSpecializationInfo *Info
= TemplateOrSpecialization
.dyn_cast<FunctionTemplateSpecializationInfo*>()) {
- return Info->getTemplate();
+ return Info->getTemplate()->getMostRecentDecl();
----------------
mizvekov wrote:
Changing the implementation of getPrimaryTemplate has a global effect, while you are interested in fixing a behavior specific to `getTemplateInstantiationPattern`. Why can't we fix this behavior there instead?
I am worried about two things:
* The most recent declaration is not always the *right* declaration you have to follow in order to get to the pattern.
* We will degrade source fidelity for code currently using these helpers, as they won't be able to find the exact redeclaration for their primary template anymore.
https://github.com/llvm/llvm-project/pull/111173
More information about the cfe-commits
mailing list