[llvm] [NFC][TableGen] Code cleanup in Record.h/cpp (PR #138876)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu May 8 09:22:35 PDT 2025


================
@@ -1798,9 +1793,9 @@ class Record {
   }
 
   void removeValue(const Init *Name) {
-    for (unsigned i = 0, e = Values.size(); i != e; ++i)
-      if (Values[i].getNameInit() == Name) {
-        Values.erase(Values.begin()+i);
+    for (auto [Idx, Value] : enumerate(Values))
----------------
topperc wrote:

Can we use `find_if` and pass the iterator to `erase`?

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


More information about the llvm-commits mailing list