[PATCH] D79012: [AST] Fix a crash on a dependent vector_size attribute
Erik Pilkington via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 08:34:13 PDT 2020
erik.pilkington created this revision.
erik.pilkington added reviewers: erichkeane, aaron.ballman.
Herald added subscribers: ributzka, dexonsmith, jkorous.
Looks like this was just a copy & paste mistake from `getDependentSizedExtVectorType`.
rdar://60092165
Repository:
rC Clang
https://reviews.llvm.org/D79012
Files:
clang/lib/AST/ASTContext.cpp
clang/test/SemaCXX/vector.cpp
Index: clang/test/SemaCXX/vector.cpp
===================================================================
--- clang/test/SemaCXX/vector.cpp
+++ clang/test/SemaCXX/vector.cpp
@@ -475,3 +475,12 @@
#endif // __cplusplus >= 201103L
}
}
+
+namespace rdar60092165 {
+template <class T> void f() {
+ typedef T first_type __attribute__((vector_size(sizeof(T) * 4)));
+ typedef T second_type __attribute__((vector_size(sizeof(T) * 4)));
+
+ second_type st;
+}
+}
Index: clang/lib/AST/ASTContext.cpp
===================================================================
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -3694,10 +3694,10 @@
(void)CanonCheck;
DependentVectorTypes.InsertNode(New, InsertPos);
} else {
- QualType CanonExtTy = getDependentSizedExtVectorType(CanonVecTy, SizeExpr,
- SourceLocation());
+ QualType CanonTy = getDependentVectorType(CanonVecTy, SizeExpr,
+ SourceLocation(), VecKind);
New = new (*this, TypeAlignment) DependentVectorType(
- *this, VecType, CanonExtTy, SizeExpr, AttrLoc, VecKind);
+ *this, VecType, CanonTy, SizeExpr, AttrLoc, VecKind);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79012.260641.patch
Type: text/x-patch
Size: 1265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200428/942f5e42/attachment.bin>
More information about the cfe-commits
mailing list