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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 3 07:10:41 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;
+  }
+
----------------
erichkeane wrote:

I consider we could probably do this tracking more cleanly at the `RedeclarableTemplateDecl` level (have it track WHICH declaration is the one that was instantiated), but that both requires modifying the `RedeclarableTemplateDecl` after it was generated (making it not-const), plus using 64 bits, instead of 1-per-decl.

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


More information about the cfe-commits mailing list