[clang] [clang][TableGen] Change Opcode Emitter to use const RecordKeeper (PR #108211)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 11 07:41:10 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Rahul Joshi (jurahul)
<details>
<summary>Changes</summary>
Change Opcode Emitter to use const RecordKeeper.
This is a part of effort to have better const correctness in TableGen backends:
https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
---
Full diff: https://github.com/llvm/llvm-project/pull/108211.diff
2 Files Affected:
- (modified) clang/utils/TableGen/ClangOpcodesEmitter.cpp (+3-3)
- (modified) clang/utils/TableGen/TableGenBackends.h (+1-1)
``````````diff
diff --git a/clang/utils/TableGen/ClangOpcodesEmitter.cpp b/clang/utils/TableGen/ClangOpcodesEmitter.cpp
index 120e1e2efa32b4..7e426d59359a87 100644
--- a/clang/utils/TableGen/ClangOpcodesEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpcodesEmitter.cpp
@@ -20,11 +20,11 @@ using namespace llvm;
namespace {
class ClangOpcodesEmitter {
- RecordKeeper &Records;
+ const RecordKeeper &Records;
unsigned NumTypes;
public:
- ClangOpcodesEmitter(RecordKeeper &R)
+ ClangOpcodesEmitter(const RecordKeeper &R)
: Records(R), NumTypes(Records.getAllDerivedDefinitions("Type").size()) {}
void run(raw_ostream &OS);
@@ -404,6 +404,6 @@ void ClangOpcodesEmitter::PrintTypes(raw_ostream &OS,
OS << ">";
}
-void clang::EmitClangOpcodes(RecordKeeper &Records, raw_ostream &OS) {
+void clang::EmitClangOpcodes(const RecordKeeper &Records, raw_ostream &OS) {
ClangOpcodesEmitter(Records).run(OS);
}
diff --git a/clang/utils/TableGen/TableGenBackends.h b/clang/utils/TableGen/TableGenBackends.h
index 3a424c9c91fe71..5050b764b09fb8 100644
--- a/clang/utils/TableGen/TableGenBackends.h
+++ b/clang/utils/TableGen/TableGenBackends.h
@@ -94,7 +94,7 @@ void EmitClangCommentCommandInfo(llvm::RecordKeeper &Records,
llvm::raw_ostream &OS);
void EmitClangCommentCommandList(llvm::RecordKeeper &Records,
llvm::raw_ostream &OS);
-void EmitClangOpcodes(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitClangOpcodes(const llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitClangSyntaxNodeList(llvm::RecordKeeper &Records,
llvm::raw_ostream &OS);
``````````
</details>
https://github.com/llvm/llvm-project/pull/108211
More information about the cfe-commits
mailing list