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

Chen Miao via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 12 11:47:56 PDT 2026


================
@@ -2062,76 +2062,132 @@ class DependentAddressSpaceTypeLoc
 //
 //===----------------------------------------------------------------------===//
 
-// FIXME: size expression and attribute locations (or keyword if we
-// ever fully support altivec syntax).
+// FIXME: keyword location if we ever fully support altivec syntax.
 struct VectorTypeLocInfo {
   SourceLocation NameLoc;
+  SourceLocation AttrLoc;
+  Expr *SizeExpr;
 };
 
+// FIXME: Make VectorTypeLoc a common base for fixed-size and dependent vector
+// type locations, similar to MatrixTypeLoc.
 class VectorTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, VectorTypeLoc,
                                              VectorType, VectorTypeLocInfo> {
 public:
+  /// The location used for the vector type's local source range, e.g.
+  ///    int __attribute__((vector_size(16)))
+  ///    ^~~
+  ///    int __attribute__((ext_vector_type(4)))
+  ///    ^~~
   SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; }
-
   void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; }
 
+  /// The location of the attribute name, i.e.
+  ///    int __attribute__((vector_size(16)))
+  ///                       ^~~~~~~~~~~
+  ///    int __attribute__((ext_vector_type(4)))
+  ///                       ^~~~~~~~~~~~~~~
----------------
ChenMiaoi wrote:

Well, I'll remove this comment. The reason it's there is that the matrix implementation does it this way, so I just copied it over

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


More information about the cfe-commits mailing list