[clang] 2bb686b - [AST] Fix a crash on a dependent vector_size attribute
Erik Pilkington via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 09:54:57 PDT 2020
Author: Erik Pilkington
Date: 2020-04-28T12:54:49-04:00
New Revision: 2bb686b4b629e3565dab239fd53b49f3a882d856
URL: https://github.com/llvm/llvm-project/commit/2bb686b4b629e3565dab239fd53b49f3a882d856
DIFF: https://github.com/llvm/llvm-project/commit/2bb686b4b629e3565dab239fd53b49f3a882d856.diff
LOG: [AST] Fix a crash on a dependent vector_size attribute
Looks like this was just a copy & paste mistake from
getDependentSizedExtVectorType. rdar://60092165
Differential revision: https://reviews.llvm.org/D79012
Added:
Modified:
clang/lib/AST/ASTContext.cpp
clang/test/SemaCXX/vector.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 47834d41b919..9b07a883234b 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -3694,10 +3694,10 @@ ASTContext::getDependentVectorType(QualType VecType, Expr *SizeExpr,
(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);
}
}
diff --git a/clang/test/SemaCXX/vector.cpp b/clang/test/SemaCXX/vector.cpp
index caa840596d7d..0c143babbe3b 100644
--- a/clang/test/SemaCXX/vector.cpp
+++ b/clang/test/SemaCXX/vector.cpp
@@ -475,3 +475,12 @@ void use() {
#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;
+}
+}
More information about the cfe-commits
mailing list