From: Erik Pilkington Date: Tue, 28 Apr 2020 16:24:54 +0000 (-0400) Subject: [AST] Fix a crash on a dependent vector_size attribute X-Git-Tag: llvmorg-12-init~7581 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2bb686b4b629e3565dab239fd53b49f3a882d856;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 47834d4..9b07a88 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 caa8405..0c143ba 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 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; +} +}