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

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 05:23:27 PDT 2024


" + sys::path::filename(Record.getInputFilename()),"
In-Reply-To: <llvm.org/llvm/llvm-project/pull/104716 at github.com>


================
@@ -12,22 +12,76 @@
 
 #include "llvm/TableGen/TableGenBackend.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <cassert>
 #include <cstddef>
+#include <variant>
 
 using namespace llvm;
+using namespace TableGen::Emitter;
 
 const size_t MAX_LINE_LEN = 80U;
 
-namespace llvm::TableGen::Emitter {
-ManagedStatic<cl::opt<FnT>, OptCreatorT> Action;
-void *OptCreatorT::call() {
-  return new cl::opt<FnT>(cl::desc("Action to perform:"));
+using FnT = std::variant<FnNonConstT, FnConstT>;
----------------
jurahul wrote:

As I said above, I was actually able to get rid of it, and it simplified the code as well.

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


More information about the llvm-commits mailing list