Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

This patch replaces GetFirstType with TypeAtIndex.

This patch replaces GetFirstType with TypeAtIndex.
@llvmbot
Copy link
Member

llvmbot commented Oct 12, 2025

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

Changes

This patch replaces GetFirstType with TypeAtIndex.


Full diff: https://github.com/llvm/llvm-project/pull/163036.diff

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/PointerUnion.h (+1-7)
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()); }
 

@kazutakahirata kazutakahirata merged commit 3b42d62 into llvm:main Oct 12, 2025
12 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20251011_ADT_PointerUnion branch October 12, 2025 15:51
DharuniRAcharya pushed a commit to DharuniRAcharya/llvm-project that referenced this pull request Oct 13, 2025
This patch replaces GetFirstType with TypeAtIndex.
akadutta pushed a commit to akadutta/llvm-project that referenced this pull request Oct 14, 2025
This patch replaces GetFirstType with TypeAtIndex.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants