[llvm] [ADT] Simplify EnumeratedArray::operator[] (NFC) (PR #156811)
    via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Sep  3 23:27:16 PDT 2025
    
    
  
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
This patch simplifies EnumeratedArray::operator[] with the
injected-class-name.
---
Full diff: https://github.com/llvm/llvm-project/pull/156811.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/EnumeratedArray.h (+1-2) 
``````````diff
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; }
``````````
</details>
https://github.com/llvm/llvm-project/pull/156811
    
    
More information about the llvm-commits
mailing list