https://github.com/zyn0217 updated 
https://github.com/llvm/llvm-project/pull/232194

>From bf8701794363dae9e90d732450dd56578f2e1691 Mon Sep 17 00:00:00 2001
From: Younan Zhang <[email protected]>
Date: Thu, 15 Oct 2026 14:18:16 +0800
Subject: [PATCH 1/4] [Clang] Fix build of PackIndexingTypeLocs

Their typelocs were not built correctly.
---
 clang/include/clang/Sema/Sema.h            | 12 +++++-------
 clang/lib/Parse/ParseDeclCXX.cpp           |  7 +++++--
 clang/lib/Parse/ParseExprCXX.cpp           | 19 ++++++++++---------
 clang/lib/Sema/DeclSpec.cpp                |  4 ++--
 clang/lib/Sema/SemaCXXScopeSpec.cpp        | 21 ++++++++++-----------
 clang/lib/Sema/SemaDeclCXX.cpp             |  6 +++---
 clang/lib/Sema/SemaExprCXX.cpp             | 10 +++++-----
 clang/lib/Sema/SemaType.cpp                | 14 ++++++--------
 clang/lib/Sema/TreeTransform.h             | 13 +++++--------
 clang/test/SemaCXX/cxx2c-pack-indexing.cpp |  2 +-
 10 files changed, 52 insertions(+), 56 deletions(-)

diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 711e083e4cedd5..865defa98a1b33 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -3505,10 +3505,9 @@ class Sema final : public SemaBase {
   bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, const DeclSpec 
&DS,
                                            SourceLocation ColonColonLoc);
 
-  bool ActOnCXXNestedNameSpecifierIndexedPack(CXXScopeSpec &SS,
-                                              const DeclSpec &DS,
-                                              SourceLocation ColonColonLoc,
-                                              QualType Type);
+  ParsedType ActOnCXXNestedNameSpecifierIndexedPack(
+      CXXScopeSpec &SS, const DeclSpec &DS, TypeSourceInfo *PatternLoc,
+      SourceLocation ColonColonLoc, QualType Type);
 
   /// IsInvalidUnlessNestedName - This method is used for error recovery
   /// purposes to determine whether the specified identifier is only valid as
@@ -15627,10 +15626,9 @@ class Sema final : public SemaBase {
   QualType BuildDecltypeType(Expr *E, bool AsUnevaluated = true);
 
   QualType ActOnPackIndexingType(QualType Pattern, Expr *IndexExpr,
-                                 SourceLocation Loc,
-                                 SourceLocation EllipsisLoc);
+                                 SourceLocation Loc);
   QualType BuildPackIndexingType(QualType Pattern, Expr *IndexExpr,
-                                 SourceLocation Loc, SourceLocation 
EllipsisLoc,
+                                 SourceLocation Loc,
                                  bool FullySubstituted = false,
                                  ArrayRef<QualType> Expansions = {});
 
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index aded5d96aa83f4..4cf445d68bdbe4 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -1157,8 +1157,11 @@ SourceLocation Parser::ParsePackIndexingType(DeclSpec 
&DS) {
     return Tok.getEndLoc();
   }
 
-  ParsedType Ty = Actions.getTypeName(*Tok.getIdentifierInfo(),
-                                      Tok.getLocation(), getCurScope());
+  ParsedType Ty = Actions.getTypeName(
+      *Tok.getIdentifierInfo(), Tok.getLocation(), getCurScope(),
+      /*SS=*/nullptr, /*isClassName=*/false, /*HasTrailingDot=*/false,
+      /*ObjectType=*/nullptr, /*IsCtorOrDtorName=*/false,
+      /*WantNontrivialTypeSourceInfo=*/true);
   if (!Ty) {
     DS.SetTypeSpecError();
     return Tok.getEndLoc();
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index ea71efc9c9358c..5bb21e70b9d847 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -205,10 +205,10 @@ bool Parser::ParseOptionalCXXScopeSpecifier(
       if (DS.getTypeSpecType() == DeclSpec::TST_error)
         return false;
 
-      QualType Pattern = Sema::GetTypeFromParser(DS.getRepAsType());
-      QualType Type =
-          Actions.ActOnPackIndexingType(Pattern, DS.getPackIndexingExpr(),
-                                        DS.getBeginLoc(), DS.getEllipsisLoc());
+      TypeSourceInfo *PatternTSI = nullptr;
+      QualType Pattern = Sema::GetTypeFromParser(DS.getRepAsType(), 
&PatternTSI);
+      QualType Type = Actions.ActOnPackIndexingType(
+          Pattern, DS.getPackIndexingExpr(), DS.getBeginLoc());
 
       if (Type.isNull())
         return false;
@@ -226,13 +226,14 @@ bool Parser::ParseOptionalCXXScopeSpecifier(
           getCurScope()->isFunctionDeclarationScope())
         Diag(Start, diag::warn_pre_cxx26_ambiguous_pack_indexing_type) << Type;
 
-      if (!TryConsumeToken(tok::coloncolon, CCLoc)) {
-        AnnotateExistingIndexedTypeNamePack(ParsedType::make(Type), Start,
-                                            EndLoc);
+      TryConsumeToken(tok::coloncolon, CCLoc);
+      ParsedType T = Actions.ActOnCXXNestedNameSpecifierIndexedPack(
+          SS, DS, PatternTSI, CCLoc, Type);
+      if (CCLoc.isInvalid()) {
+        AnnotateExistingIndexedTypeNamePack(T, Start, EndLoc);
         return false;
       }
-      if (Actions.ActOnCXXNestedNameSpecifierIndexedPack(SS, DS, CCLoc,
-                                                         std::move(Type)))
+      if (!T)
         SS.SetInvalid(SourceRange(Start, CCLoc));
       HasScopeSpecifier = true;
     }
diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp
index 1bc3bb45dc8979..ef174b3337171e 100644
--- a/clang/lib/Sema/DeclSpec.cpp
+++ b/clang/lib/Sema/DeclSpec.cpp
@@ -779,8 +779,8 @@ bool DeclSpec::SetTypeSpecType(TST T, SourceLocation 
TagKwLoc,
     // we got there from a an annotation. Reconstruct the type
     // Ugly...
     QualType QT = Rep.get();
-    const PackIndexingType *LIT = cast<PackIndexingType>(QT);
-    TypeRep = ParsedType::make(LIT->getPattern());
+    const PackIndexingType *LIT =
+        cast<PackIndexingType>(cast<LocInfoType>(QT)->getType());
     PackIndexingExpr = LIT->getIndexExpr();
   }
   return false;
diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp 
b/clang/lib/Sema/SemaCXXScopeSpec.cpp
index 8a8636ac4c4a6a..5c365de4308316 100644
--- a/clang/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp
@@ -853,28 +853,27 @@ bool 
Sema::ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS,
   return false;
 }
 
-bool Sema::ActOnCXXNestedNameSpecifierIndexedPack(CXXScopeSpec &SS,
-                                                  const DeclSpec &DS,
-                                                  SourceLocation ColonColonLoc,
-                                                  QualType Type) {
+ParsedType Sema::ActOnCXXNestedNameSpecifierIndexedPack(
+    CXXScopeSpec &SS, const DeclSpec &DS, TypeSourceInfo *PatternLoc,
+    SourceLocation ColonColonLoc, QualType Type) {
   if (SS.isInvalid() || DS.getTypeSpecType() == DeclSpec::TST_error)
-    return true;
+    return ParsedType();
 
   assert(DS.getTypeSpecType() == DeclSpec::TST_typename_pack_indexing);
 
   if (Type.isNull())
-    return true;
+    return ParsedType();
 
   assert(SS.isEmpty());
 
   TypeLocBuilder TLB;
-  TLB.pushTrivial(getASTContext(),
-                  cast<PackIndexingType>(Type.getTypePtr())->getPattern(),
-                  DS.getBeginLoc());
+  TLB.pushFullCopy(PatternLoc->getTypeLoc());
   PackIndexingTypeLoc PIT = TLB.push<PackIndexingTypeLoc>(Type);
   PIT.setEllipsisLoc(DS.getEllipsisLoc());
-  SS.Make(Context, TLB.getTypeLocInContext(Context, Type), ColonColonLoc);
-  return false;
+  TypeSourceInfo *TSI = TLB.getTypeSourceInfo(Context, Type);
+  if (ColonColonLoc.isValid())
+    SS.Make(Context, TSI->getTypeLoc(), ColonColonLoc);
+  return CreateParsedType(Type, TSI);
 }
 
 bool Sema::IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS,
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index f80fb2a3446b38..cd9771526bee37 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -4535,9 +4535,9 @@ Sema::BuildMemInitializer(Decl *ConstructorD,
     Diag(DS.getTypeSpecTypeLoc(), diag::err_decltype_auto_invalid);
     return true;
   } else if (DS.getTypeSpecType() == TST_typename_pack_indexing) {
-    BaseType =
-        BuildPackIndexingType(DS.getRepAsType().get(), 
DS.getPackIndexingExpr(),
-                              DS.getBeginLoc(), DS.getEllipsisLoc());
+    BaseType = GetTypeFromParser(DS.getRepAsType(), &TInfo);
+    if (BaseType.isNull())
+      return true;
   } else {
     LookupResult R(*this, MemberOrBase, IdLoc, LookupOrdinaryName);
     LookupParsedName(R, S, &SS, /*ObjectType=*/QualType());
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index d9bd060f7a0bf9..dd737ba3ce248a 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -7548,11 +7548,11 @@ ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, 
Expr *Base,
     break;
   }
   case DeclSpec::TST_typename_pack_indexing: {
-    T = ActOnPackIndexingType(DS.getRepAsType().get(), 
DS.getPackIndexingExpr(),
-                              DS.getBeginLoc(), DS.getEllipsisLoc());
-    TLB.pushTrivial(getASTContext(),
-                    cast<PackIndexingType>(T.getTypePtr())->getPattern(),
-                    DS.getBeginLoc());
+    TypeSourceInfo *TSI = nullptr;
+    T = GetTypeFromParser(DS.getRepAsType(), &TSI);
+    T = ActOnPackIndexingType(T, DS.getPackIndexingExpr(),
+                              DS.getBeginLoc());
+    TLB.pushFullCopy(TSI->getTypeLoc());
     PackIndexingTypeLoc PITL = TLB.push<PackIndexingTypeLoc>(T);
     PITL.setEllipsisLoc(DS.getEllipsisLoc());
     break;
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 1cb96b556971ad..c5f7b6b4b40657 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -1300,9 +1300,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState 
&state) {
   case DeclSpec::TST_typename_pack_indexing: {
     Expr *E = DS.getPackIndexingExpr();
     assert(E && "Didn't get an expression for pack indexing");
-    QualType Pattern = S.GetTypeFromParser(DS.getRepAsType());
-    Result = S.BuildPackIndexingType(Pattern, E, DS.getBeginLoc(),
-                                     DS.getEllipsisLoc());
+    Result = S.GetTypeFromParser(DS.getRepAsType());
     if (Result.isNull()) {
       declarator.setInvalidType(true);
       Result = Context.IntTy;
@@ -6121,7 +6119,9 @@ namespace {
     }
     void VisitPackIndexingTypeLoc(PackIndexingTypeLoc TL) {
       assert(DS.getTypeSpecType() == DeclSpec::TST_typename_pack_indexing);
-      TL.setEllipsisLoc(DS.getEllipsisLoc());
+      TypeSourceInfo *TInfo = nullptr;
+      Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
+      TL.copy(TInfo->getTypeLoc());
     }
     void VisitUnaryTransformTypeLoc(UnaryTransformTypeLoc TL) {
       assert(DS.isTransformTypeTrait(DS.getTypeSpecType()));
@@ -10185,8 +10185,7 @@ QualType Sema::BuildDecltypeType(Expr *E, bool 
AsUnevaluated) {
 }
 
 QualType Sema::ActOnPackIndexingType(QualType Pattern, Expr *IndexExpr,
-                                     SourceLocation Loc,
-                                     SourceLocation EllipsisLoc) {
+                                     SourceLocation Loc) {
   if (!IndexExpr)
     return QualType();
 
@@ -10194,7 +10193,7 @@ QualType Sema::ActOnPackIndexingType(QualType Pattern, 
Expr *IndexExpr,
   if (!Pattern->containsUnexpandedParameterPack())
     Diag(Loc, diag::err_expected_name_of_pack) << Pattern;
 
-  QualType Type = BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc);
+  QualType Type = BuildPackIndexingType(Pattern, IndexExpr, Loc);
 
   if (!Type.isNull())
     DiagCompat(Loc, diag_compat::pack_indexing);
@@ -10203,7 +10202,6 @@ QualType Sema::ActOnPackIndexingType(QualType Pattern, 
Expr *IndexExpr,
 
 QualType Sema::BuildPackIndexingType(QualType Pattern, Expr *IndexExpr,
                                      SourceLocation Loc,
-                                     SourceLocation EllipsisLoc,
                                      bool FullySubstituted,
                                      ArrayRef<QualType> Expansions) {
 
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 73367d6bea063d..7f56a29e729094 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -1138,7 +1138,6 @@ class TreeTransform {
 
   QualType RebuildPackIndexingType(QualType Pattern, Expr *IndexExpr,
                                    SourceLocation Loc,
-                                   SourceLocation EllipsisLoc,
                                    bool FullySubstituted,
                                    ArrayRef<QualType> Expansions = {});
 
@@ -7287,8 +7286,7 @@ 
TreeTransform<Derived>::TransformPackIndexingType(TypeLocBuilder &TLB,
       if (NotYetExpanded) {
         FullySubstituted = false;
         QualType Out = getDerived().RebuildPackIndexingType(
-            Pack, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
-            FullySubstituted);
+            Pack, IndexExpr.get(), TL.getBeginLoc(), FullySubstituted);
         if (Out.isNull())
           return QualType();
 
@@ -7326,8 +7324,8 @@ 
TreeTransform<Derived>::TransformPackIndexingType(TypeLocBuilder &TLB,
   QualType Result = getDerived().TransformType(TLB, TL.getPatternLoc());
 
   QualType Out = getDerived().RebuildPackIndexingType(
-      Result, IndexExpr.get(), SourceLocation(), TL.getEllipsisLoc(),
-      FullySubstituted, SubtitutedTypes);
+      Result, IndexExpr.get(), TL.getBeginLoc(), FullySubstituted,
+      SubtitutedTypes);
   if (Out.isNull())
     return Out;
 
@@ -18339,9 +18337,8 @@ QualType 
TreeTransform<Derived>::RebuildDecltypeType(Expr *E, SourceLocation) {
 template <typename Derived>
 QualType TreeTransform<Derived>::RebuildPackIndexingType(
     QualType Pattern, Expr *IndexExpr, SourceLocation Loc,
-    SourceLocation EllipsisLoc, bool FullySubstituted,
-    ArrayRef<QualType> Expansions) {
-  return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc, EllipsisLoc,
+    bool FullySubstituted, ArrayRef<QualType> Expansions) {
+  return SemaRef.BuildPackIndexingType(Pattern, IndexExpr, Loc,
                                        FullySubstituted, Expansions);
 }
 
diff --git a/clang/test/SemaCXX/cxx2c-pack-indexing.cpp 
b/clang/test/SemaCXX/cxx2c-pack-indexing.cpp
index 0892394955a603..bbd708d3b63f52 100644
--- a/clang/test/SemaCXX/cxx2c-pack-indexing.cpp
+++ b/clang/test/SemaCXX/cxx2c-pack-indexing.cpp
@@ -370,7 +370,7 @@ void foo(auto...x){
     //expected-error@-1 {{invalid index 4294967296 for pack 'x' of size 1}}
 
     using T1 = T...[(__int128)18446744073709551615U+1];
-    // expected-warning@-1 3{{implicit conversion from '__int128' to 
'__size_t'}}
+    // expected-warning@-1 2{{implicit conversion from '__int128' to 
'__size_t'}}
     // expected-error@-2   2{{evaluates to 18446744073709551616, which cannot 
be narrowed to type '__size_t' (aka 'unsigned long')}}
 }
 int test(){

>From 0c4a16f4a45e6e7946d85e8ce00870c72c05ce1a Mon Sep 17 00:00:00 2001
From: Younan Zhang <[email protected]>
Date: Thu, 15 Oct 2026 15:37:16 +0800
Subject: [PATCH 2/4] Fix format && add test

---
 clang/lib/Parse/ParseExprCXX.cpp           |  3 ++-
 clang/lib/Sema/SemaExprCXX.cpp             |  3 +--
 clang/lib/Sema/SemaType.cpp                |  3 +--
 clang/lib/Sema/TreeTransform.h             |  3 +--
 clang/unittests/AST/SourceLocationTest.cpp | 21 +++++++++++++++++++++
 5 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index 5bb21e70b9d847..3745ea53fc6d0d 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -206,7 +206,8 @@ bool Parser::ParseOptionalCXXScopeSpecifier(
         return false;
 
       TypeSourceInfo *PatternTSI = nullptr;
-      QualType Pattern = Sema::GetTypeFromParser(DS.getRepAsType(), 
&PatternTSI);
+      QualType Pattern =
+          Sema::GetTypeFromParser(DS.getRepAsType(), &PatternTSI);
       QualType Type = Actions.ActOnPackIndexingType(
           Pattern, DS.getPackIndexingExpr(), DS.getBeginLoc());
 
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index dd737ba3ce248a..916c5308508f10 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -7550,8 +7550,7 @@ ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr 
*Base,
   case DeclSpec::TST_typename_pack_indexing: {
     TypeSourceInfo *TSI = nullptr;
     T = GetTypeFromParser(DS.getRepAsType(), &TSI);
-    T = ActOnPackIndexingType(T, DS.getPackIndexingExpr(),
-                              DS.getBeginLoc());
+    T = ActOnPackIndexingType(T, DS.getPackIndexingExpr(), DS.getBeginLoc());
     TLB.pushFullCopy(TSI->getTypeLoc());
     PackIndexingTypeLoc PITL = TLB.push<PackIndexingTypeLoc>(T);
     PITL.setEllipsisLoc(DS.getEllipsisLoc());
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index c5f7b6b4b40657..6b67134566ab09 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -10201,8 +10201,7 @@ QualType Sema::ActOnPackIndexingType(QualType Pattern, 
Expr *IndexExpr,
 }
 
 QualType Sema::BuildPackIndexingType(QualType Pattern, Expr *IndexExpr,
-                                     SourceLocation Loc,
-                                     bool FullySubstituted,
+                                     SourceLocation Loc, bool FullySubstituted,
                                      ArrayRef<QualType> Expansions) {
 
   UnsignedOrNone Index = std::nullopt;
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 7f56a29e729094..18b2a3c65c51bc 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -1137,8 +1137,7 @@ class TreeTransform {
   QualType RebuildDecltypeType(Expr *Underlying, SourceLocation Loc);
 
   QualType RebuildPackIndexingType(QualType Pattern, Expr *IndexExpr,
-                                   SourceLocation Loc,
-                                   bool FullySubstituted,
+                                   SourceLocation Loc, bool FullySubstituted,
                                    ArrayRef<QualType> Expansions = {});
 
   /// Build a new C++11 auto type.
diff --git a/clang/unittests/AST/SourceLocationTest.cpp 
b/clang/unittests/AST/SourceLocationTest.cpp
index 021b2dfac40607..0c89dcf65dbfdc 100644
--- a/clang/unittests/AST/SourceLocationTest.cpp
+++ b/clang/unittests/AST/SourceLocationTest.cpp
@@ -1091,6 +1091,27 @@ template <X::CCC<int> T> void print(T object);
   EXPECT_TRUE(Verifier.match(Code3, templateTypeParmDecl(), Lang_CXX20));
 }
 
+class PackIndexingTypeLocVerifier
+    : public RangeVerifier<TypeLoc> {
+protected:
+  SourceRange getRange(const TypeLoc &Node) override {
+    PackIndexingTypeLoc TL = Node.getAs<PackIndexingTypeLoc>();
+    assert(!TL.isNull());
+    return SourceRange(TL.getPatternLoc().getBeginLoc(), TL.getEllipsisLoc());
+  }
+};
+
+TEST(PackIndexingTypeLoc, PatternAndEllipsisLoc) {
+  PackIndexingTypeLocVerifier Verifier;
+  // FIXME: There's no packIndexingType matcher yet.
+  Verifier.expectRange(2, 8, 2, 9);
+  EXPECT_TRUE(Verifier.match(
+      R"cpp(template <class... T> void foo() {
+       T...[0] x;
+  })cpp",
+      typeLoc(hasParent(varDecl(hasName("x")))), Lang_CXX26));
+}
+
 class ConceptSpecializationExprConceptReferenceRangeVerifier
     : public RangeVerifier<VarTemplateDecl> {
 protected:

>From c7b1bab238d27a011b2df54c747f26bd9c13f642 Mon Sep 17 00:00:00 2001
From: Younan Zhang <[email protected]>
Date: Thu, 15 Oct 2026 15:48:36 +0800
Subject: [PATCH 3/4] Apply review suggestion from Hirata

---
 clang/lib/Sema/DeclSpec.cpp | 9 ---------
 clang/lib/Sema/SemaType.cpp | 2 --
 2 files changed, 11 deletions(-)

diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp
index ef174b3337171e..e83ba3db9f1fd6 100644
--- a/clang/lib/Sema/DeclSpec.cpp
+++ b/clang/lib/Sema/DeclSpec.cpp
@@ -774,15 +774,6 @@ bool DeclSpec::SetTypeSpecType(TST T, SourceLocation 
TagKwLoc,
   TSTLoc = TagKwLoc;
   TSTNameLoc = TagNameLoc;
   TypeSpecOwned = false;
-
-  if (T == TST_typename_pack_indexing) {
-    // we got there from a an annotation. Reconstruct the type
-    // Ugly...
-    QualType QT = Rep.get();
-    const PackIndexingType *LIT =
-        cast<PackIndexingType>(cast<LocInfoType>(QT)->getType());
-    PackIndexingExpr = LIT->getIndexExpr();
-  }
   return false;
 }
 
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 6b67134566ab09..3d444bfabc8c39 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -1298,8 +1298,6 @@ static QualType ConvertDeclSpecToType(TypeProcessingState 
&state) {
     break;
   }
   case DeclSpec::TST_typename_pack_indexing: {
-    Expr *E = DS.getPackIndexingExpr();
-    assert(E && "Didn't get an expression for pack indexing");
     Result = S.GetTypeFromParser(DS.getRepAsType());
     if (Result.isNull()) {
       declarator.setInvalidType(true);

>From 57c2410a689626626d4a42d1f74c8060de78b898 Mon Sep 17 00:00:00 2001
From: Younan Zhang <[email protected]>
Date: Thu, 15 Oct 2026 16:15:51 +0800
Subject: [PATCH 4/4] Run clang-format

---
 clang/unittests/AST/SourceLocationTest.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/unittests/AST/SourceLocationTest.cpp 
b/clang/unittests/AST/SourceLocationTest.cpp
index 0c89dcf65dbfdc..06993a0270300d 100644
--- a/clang/unittests/AST/SourceLocationTest.cpp
+++ b/clang/unittests/AST/SourceLocationTest.cpp
@@ -1091,8 +1091,7 @@ template <X::CCC<int> T> void print(T object);
   EXPECT_TRUE(Verifier.match(Code3, templateTypeParmDecl(), Lang_CXX20));
 }
 
-class PackIndexingTypeLocVerifier
-    : public RangeVerifier<TypeLoc> {
+class PackIndexingTypeLocVerifier : public RangeVerifier<TypeLoc> {
 protected:
   SourceRange getRange(const TypeLoc &Node) override {
     PackIndexingTypeLoc TL = Node.getAs<PackIndexingTypeLoc>();

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to