================
@@ -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());
----------------
ChenMiaoi wrote:
This happens because the patch adds a separate `SizeExpr` field to the
dependent vector TypeLocs and initializes it to nullptr. For example:
``` cc
template<int N> struct V {
typedef int type __attribute__((ext_vector_type(N)));
};
```
The Type retains the expression N, but the current TypeLoc-building path does
not populate the new TypeLoc field after initialization.
Looking at this again, initializing the field with
`setSizeExpr(getTypePtr()->getSizeExpr())`, as `DependentSizedArrayTypeLoc`
does, seems better and should allow us to simplify the fallback logic?
https://github.com/llvm/llvm-project/pull/229328
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits