[llvm] [TableGen] Allow emitter callbacks to use `const RecordKeeper &` (PR #104716)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 21 15:57:50 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);
----------------
jurahul wrote:
This can actually be used to our advantage for eliminating the std::variant.
https://github.com/llvm/llvm-project/pull/104716
More information about the llvm-commits
mailing list