[clang] [Clang][C++26] Implement Pack Indexing (P2662R3). (PR #72644)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 9 10:21:20 PST 2024


================
@@ -6460,6 +6476,100 @@ QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
   return Result;
 }
 
+template <typename Derived>
+QualType
+TreeTransform<Derived>::TransformPackIndexingType(TypeLocBuilder &TLB,
+                                                  PackIndexingTypeLoc TL) {
+  // Transform the index
+  ExprResult IndexExpr = getDerived().TransformExpr(TL.getIndexExpr());
+  if (IndexExpr.isInvalid())
+    return QualType();
+  QualType Pattern = TL.getPattern();
+
+  const PackIndexingType *PIT = TL.getTypePtr();
+  SmallVector<QualType, 5> ExpandedTypes;
+  llvm::ArrayRef<QualType> Types = PIT->getExpansions();
+
+  bool NotYetExpanded = Types.empty();
+  bool FullyExpanded = true;
+
+  if (Types.empty())
----------------
erichkeane wrote:

```suggestion
  if (NotYetExpanded)
```
I think?  Plus some comments here anyway, there are a couple of states crossing here.

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


More information about the cfe-commits mailing list