[clang] 916bd7d - [clang][Interp][NFC] Remove Root record from opcode emitter

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 28 07:15:49 PST 2024


Author: Timm Bäder
Date: 2024-01-28T16:15:22+01:00
New Revision: 916bd7d3bb42627f52e2f8ed2f87e08db4960a72

URL: https://github.com/llvm/llvm-project/commit/916bd7d3bb42627f52e2f8ed2f87e08db4960a72
DIFF: https://github.com/llvm/llvm-project/commit/916bd7d3bb42627f52e2f8ed2f87e08db4960a72.diff

LOG: [clang][Interp][NFC] Remove Root record from opcode emitter

It's only used once and only for its name, so replace that with
a string literal.

Added: 
    

Modified: 
    clang/utils/TableGen/ClangOpcodesEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/utils/TableGen/ClangOpcodesEmitter.cpp b/clang/utils/TableGen/ClangOpcodesEmitter.cpp
index e624cb4d8cc6a58..02d5f9512d90514 100644
--- a/clang/utils/TableGen/ClangOpcodesEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpcodesEmitter.cpp
@@ -21,13 +21,11 @@ using namespace llvm;
 namespace {
 class ClangOpcodesEmitter {
   RecordKeeper &Records;
-  const Record Root;
   unsigned NumTypes;
 
 public:
   ClangOpcodesEmitter(RecordKeeper &R)
-    : Records(R), Root("Opcode", SMLoc(), R),
-      NumTypes(Records.getAllDerivedDefinitions("Type").size()) {}
+      : Records(R), NumTypes(Records.getAllDerivedDefinitions("Type").size()) {}
 
   void run(raw_ostream &OS);
 
@@ -86,7 +84,7 @@ void Enumerate(const Record *R, StringRef N,
 } // namespace
 
 void ClangOpcodesEmitter::run(raw_ostream &OS) {
-  for (const auto *Opcode : Records.getAllDerivedDefinitions(Root.getName())) {
+  for (const auto *Opcode : Records.getAllDerivedDefinitions("Opcode")) {
     // The name is the record name, unless overriden.
     StringRef N = Opcode->getValueAsString("Name");
     if (N.empty())


        


More information about the cfe-commits mailing list