[clang] [clang] Preserve ext_vector_type locations during template substitution (PR #229328)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 13 01:57:17 PDT 2026


================
@@ -525,7 +525,16 @@ class ASTNodeTraverser
     Visit(TL.getSizeExpr());
   }
   void VisitDependentSizedExtVectorTypeLoc(DependentSizedExtVectorTypeLoc TL) {
-    Visit(cast<DependentSizedExtVectorType>(TL.getType())->getSizeExpr());
+    Expr *Size = TL.getSizeExpr();
+    Visit(Size ? Size : TL.getTypePtr()->getSizeExpr());
+  }
+  void VisitVectorTypeLoc(VectorTypeLoc TL) {
+    if (Expr *Size = TL.getSizeExpr())
+      Visit(Size);
+  }
+  void VisitDependentVectorTypeLoc(DependentVectorTypeLoc TL) {
+    Expr *Size = TL.getSizeExpr();
+    Visit(Size ? Size : TL.getTypePtr()->getSizeExpr());
----------------
zwuis wrote:

When is `TL.getSizeExpr()` null but `TL.getTypePtr()->getSizeExpr()` isn't?

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


More information about the cfe-commits mailing list