[llvm] 3b42d62 - [ADT] Use TypeAtIndex in PointerUnion (NFC) (#163036)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 12 08:50:21 PDT 2025


Author: Kazu Hirata
Date: 2025-10-12T08:50:17-07:00
New Revision: 3b42d621120bb818cc35d3f547ae31bcb0cdaacc

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

LOG: [ADT] Use TypeAtIndex in PointerUnion (NFC) (#163036)

This patch replaces GetFirstType with TypeAtIndex.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/PointerUnion.h b/llvm/include/llvm/ADT/PointerUnion.h
index 7b66177373011..d9087dd1c516e 100644
--- a/llvm/include/llvm/ADT/PointerUnion.h
+++ b/llvm/include/llvm/ADT/PointerUnion.h
@@ -38,11 +38,6 @@ namespace pointer_union_detail {
     return std::min<int>({PointerLikeTypeTraits<Ts>::NumLowBitsAvailable...});
   }
 
-  /// Find the first type in a list of types.
-  template <typename T, typename...> struct GetFirstType {
-    using type = T;
-  };
-
   /// Provide PointerLikeTypeTraits for void* that is used by PointerUnion
   /// for the template arguments.
   template <typename ...PTs> class PointerUnionUIntTraits {
@@ -264,8 +259,7 @@ struct PointerLikeTypeTraits<PointerUnion<PTs...>> {
 // Teach DenseMap how to use PointerUnions as keys.
 template <typename ...PTs> struct DenseMapInfo<PointerUnion<PTs...>> {
   using Union = PointerUnion<PTs...>;
-  using FirstInfo =
-      DenseMapInfo<typename pointer_union_detail::GetFirstType<PTs...>::type>;
+  using FirstInfo = DenseMapInfo<TypeAtIndex<0, PTs...>>;
 
   static inline Union getEmptyKey() { return Union(FirstInfo::getEmptyKey()); }
 


        


More information about the llvm-commits mailing list