Skip to content

Commit

Permalink
[AST] Fix a crash on a dependent vector_size attribute
Browse files Browse the repository at this point in the history
Looks like this was just a copy & paste mistake from
getDependentSizedExtVectorType. rdar://60092165

Differential revision: https://reviews.llvm.org/D79012

Conflicts:
	clang/lib/AST/ASTContext.cpp
	clang/test/SemaCXX/vector.cpp
  • Loading branch information
epilk committed Apr 28, 2020
1 parent a46ea66 commit df8d249
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clang/lib/AST/ASTContext.cpp
Expand Up @@ -3629,10 +3629,10 @@ ASTContext::getDependentVectorType(QualType VecType, Expr *SizeExpr,
(void)CanonCheck;
DependentVectorTypes.InsertNode(New, InsertPos);
} else {
QualType Canon = getDependentSizedExtVectorType(CanonVecTy, SizeExpr,
SourceLocation());
QualType CanonTy = getDependentVectorType(CanonVecTy, SizeExpr,
SourceLocation(), VecKind);
New = new (*this, TypeAlignment) DependentVectorType(
*this, VecType, Canon, SizeExpr, AttrLoc, VecKind);
*this, VecType, CanonTy, SizeExpr, AttrLoc, VecKind);
}
}

Expand Down
9 changes: 9 additions & 0 deletions clang/test/SemaCXX/vector.cpp
Expand Up @@ -400,3 +400,12 @@ namespace swizzle_typo_correction {
return A.xyzw < B.x && B.y > A.y; // OK, not a typo for 'xyzv'
}
}

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;
}
}

0 comments on commit df8d249

Please sign in to comment.