[llvm] [LLVM][TableGen] Change CodeEmitterGen to use const RecordKeeper (PR #109025)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 09:44:02 PDT 2024


================
@@ -448,15 +452,13 @@ void CodeEmitterGen::emitInstructionBaseValues(
 void CodeEmitterGen::emitCaseMap(
     raw_ostream &o,
     const std::map<std::string, std::vector<std::string>> &CaseMap) {
-  std::map<std::string, std::vector<std::string>>::const_iterator IE, EE;
-  for (IE = CaseMap.begin(), EE = CaseMap.end(); IE != EE; ++IE) {
-    const std::string &Case = IE->first;
-    const std::vector<std::string> &InstList = IE->second;
-
-    for (int i = 0, N = InstList.size(); i < N; i++) {
-      if (i)
+  for (const auto &[Case, InstList] : CaseMap) {
+    bool First = true;
+    for (const auto &Inst : InstList) {
+      if (!First)
         o << "\n";
-      o << "    case " << InstList[i] << ":";
+      o << "    case " << Inst << ":";
----------------
jurahul wrote:

Hmm..I am leaving the existing code untouched otherwise. I do see that we have a lot of these: 

```
llvm-project$ git grep "<< \".\"" | wc -l
6558
```

https://github.com/llvm/llvm-project/pull/109025


More information about the llvm-commits mailing list