[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 08:55:27 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:

The new `setInstantiatedFromMemberTemplate` is being used from existing callers, which before this patch would call this member from a FunctionTemplateDecl object, which would call `RedeclarableTemplateDecl::setInstantiatedFromMemberTemplate`.

With this patch, these callers will find `FunctionTemplateDecl::setInstantiatedFromMemberTemplate` instead.

See the implementation of the latter, where it also forwards the call to the former.

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


More information about the cfe-commits mailing list