[llvm] bc3dfe7 - [LLVM][TableGen] Change PrintEnums to use const RecordKeeper (#109200)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 05:16:31 PDT 2024


Author: Rahul Joshi
Date: 2024-09-19T05:16:28-07:00
New Revision: bc3dfe7bdd7ce6cd1e495d46c173b4f12518b3c1

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

LOG: [LLVM][TableGen] Change PrintEnums to use const RecordKeeper (#109200)

Change PrintEnums 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

Added: 
    

Modified: 
    llvm/utils/TableGen/TableGen.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/TableGen.cpp b/llvm/utils/TableGen/TableGen.cpp
index 2cc9f364d20cb4..fff4c6b7c27ada 100644
--- a/llvm/utils/TableGen/TableGen.cpp
+++ b/llvm/utils/TableGen/TableGen.cpp
@@ -43,8 +43,8 @@ static void PrintRecords(const RecordKeeper &Records, raw_ostream &OS) {
   OS << Records; // No argument, dump all contents
 }
 
-static void PrintEnums(RecordKeeper &Records, raw_ostream &OS) {
-  for (Record *Rec : Records.getAllDerivedDefinitions(Class))
+static void PrintEnums(const RecordKeeper &Records, raw_ostream &OS) {
+  for (const Record *Rec : Records.getAllDerivedDefinitions(Class))
     OS << Rec->getName() << ", ";
   OS << "\n";
 }


        


More information about the llvm-commits mailing list