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

via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 3 08:08:44 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;
+  }
+
----------------
cor3ntin wrote:

I had a chat with @erichkeane - I think I understand a bit more now.
At least I understand why `RedeclarableTemplateDecl` is not suitable

However, why is `FunctionDecl::getInstantiatedFromDecl` / `FunctionDecl::getMemberSpecializationInfo`  not what we want?

If we can't use that, why are we storing a bit in FunctionDecl and not in `FunctionTemplateSpecializationInfo` for example?

I think we need comments somewhere explaining all of that because It's not trivial.









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


More information about the cfe-commits mailing list