[llvm] 2157055 - [ADT] Simplify EnumeratedArray::operator[] (NFC) (#156811)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 4 07:46:15 PDT 2025


Author: Kazu Hirata
Date: 2025-09-04T07:46:11-07:00
New Revision: 2157055ea781b96be1cf0dc95669f9b231e33182

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

LOG: [ADT] Simplify EnumeratedArray::operator[] (NFC) (#156811)

This patch simplifies EnumeratedArray::operator[] with the
injected-class-name.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/EnumeratedArray.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/EnumeratedArray.h b/llvm/include/llvm/ADT/EnumeratedArray.h
index fd0700c8e408a..93e1327306175 100644
--- a/llvm/include/llvm/ADT/EnumeratedArray.h
+++ b/llvm/include/llvm/ADT/EnumeratedArray.h
@@ -57,8 +57,7 @@ class EnumeratedArray {
   }
   ValueType &operator[](Enumeration Index) {
     return const_cast<ValueType &>(
-        static_cast<const EnumeratedArray<ValueType, Enumeration, LargestEnum,
-                                          IndexType, Size> &>(*this)[Index]);
+        static_cast<const EnumeratedArray &>(*this)[Index]);
   }
   IndexType size() const { return Size; }
   bool empty() const { return size() == 0; }


        


More information about the llvm-commits mailing list