[llvm] [TableGen] Allow emitter callbacks to use `const RecordKeeper &` (PR #104716)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 23:47:43 PDT 2024


================
@@ -24,29 +22,38 @@ class RecordKeeper;
 class raw_ostream;
 
 namespace TableGen::Emitter {
-using FnT = void (*)(RecordKeeper &Records, raw_ostream &OS);
-
-struct OptCreatorT {
-  static void *call();
-};
-
-extern ManagedStatic<cl::opt<FnT>, OptCreatorT> Action;
+// Support const and non-const forms of callback functions.
+using FnNonConstT = void (*)(RecordKeeper &Records, raw_ostream &OS);
+using FnConstT = void (*)(const RecordKeeper &Records, raw_ostream &OS);
----------------
Pierre-vh wrote:

function_ref?

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


More information about the llvm-commits mailing list