[llvm] 0545e9f - [LLVM][TableGen] Change DFAEmitter to use const Record pointers (#109042)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 18 09:52:54 PDT 2024
Author: Rahul Joshi
Date: 2024-09-18T09:52:50-07:00
New Revision: 0545e9f5b6e0cb3743ca27ce88c24974e6f29f56
URL: https://github.com/llvm/llvm-project/commit/0545e9f5b6e0cb3743ca27ce88c24974e6f29f56
DIFF: https://github.com/llvm/llvm-project/commit/0545e9f5b6e0cb3743ca27ce88c24974e6f29f56.diff
LOG: [LLVM][TableGen] Change DFAEmitter to use const Record pointers (#109042)
Change DFAEmitter to use const Record pointers.
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
Added:
Modified:
llvm/utils/TableGen/DFAEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/DFAEmitter.cpp b/llvm/utils/TableGen/DFAEmitter.cpp
index 18620b2a073f19..7d274a1cf632e5 100644
--- a/llvm/utils/TableGen/DFAEmitter.cpp
+++ b/llvm/utils/TableGen/DFAEmitter.cpp
@@ -170,7 +170,7 @@ void DfaEmitter::printActionValue(action_type A, raw_ostream &OS) { OS << A; }
namespace {
-using Action = std::variant<Record *, unsigned, std::string>;
+using Action = std::variant<const Record *, unsigned, std::string>;
using ActionTuple = std::vector<Action>;
class Automaton;
@@ -356,7 +356,7 @@ void CustomDfaEmitter::printActionValue(action_type A, raw_ostream &OS) {
ListSeparator LS;
for (const auto &SingleAction : AT) {
OS << LS;
- if (const auto *R = std::get_if<Record *>(&SingleAction))
+ if (const auto *R = std::get_if<const Record *>(&SingleAction))
OS << (*R)->getName();
else if (const auto *S = std::get_if<std::string>(&SingleAction))
OS << '"' << *S << '"';
More information about the llvm-commits
mailing list