[clang] Reland: [clang] Track function template instantiation from definition (PR #125266)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 2 13:41:11 PST 2025


================
@@ -2298,6 +2298,13 @@ class FunctionDecl : public DeclaratorDecl,
     FunctionDeclBits.IsLateTemplateParsed = ILT;
   }
 
+  bool isInstantiatedFromMemberTemplate() const {
+    return FunctionDeclBits.IsInstantiatedFromMemberTemplate;
+  }
+  void setInstantiatedFromMemberTemplate(bool Val = true) {
+    FunctionDeclBits.IsInstantiatedFromMemberTemplate = Val;
+  }
+
----------------
mizvekov wrote:

```
Note that RedeclarableTemplateDecl::setInstantiatedFromMemberTemplate is already called everywhere it needs to (hopefully) and isCompatibleWithDefinition() can just be  return isInstantiatedFromMemberTemplate() || isThisDeclarationADefinition();` - unless I am missing something, but in that case the PR needs more explanation.
```
The field `RedeclarableTemplateDecl::setInstantiatedFromMemberTemplate` uses is in the common area, the new flag which is set from the new `setInstantiatedFromMemberTemplate` is per declaration.


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


More information about the cfe-commits mailing list