[llvm] [LLVM][TableGen] Change DFAEmitter to use const Record pointers (PR #109042)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 17 13:27:19 PDT 2024


https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/109042

Change DFAEmitter to use const Record pointers.

>From fb27996177eb0aa738c67b221ef6b3df963eb96a Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Tue, 17 Sep 2024 13:26:17 -0700
Subject: [PATCH] [LLVM][TableGen] Change DFAEmitter to use const Record
 pointers

---
 llvm/utils/TableGen/DFAEmitter.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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