python3kgae updated this revision to Diff 459359. python3kgae added a comment.
Update test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133634/new/ https://reviews.llvm.org/D133634 Files: clang/lib/AST/ASTContext.cpp clang/lib/Sema/SemaType.cpp clang/test/Sema/builtin-classify-type.c clang/test/SemaCXX/ext-int.cpp Index: clang/test/SemaCXX/ext-int.cpp =================================================================== --- clang/test/SemaCXX/ext-int.cpp +++ clang/test/SemaCXX/ext-int.cpp @@ -83,11 +83,6 @@ static constexpr bool value = true; }; -// Reject vector types: -// expected-error@+1{{invalid vector element type '_BitInt(32)'}} -typedef _BitInt(32) __attribute__((vector_size(16))) VecTy; -// expected-error@+1{{invalid vector element type '_BitInt(32)'}} -typedef _BitInt(32) __attribute__((ext_vector_type(32))) OtherVecTy; // Allow _Complex: _Complex _BitInt(3) Cmplx; Index: clang/test/Sema/builtin-classify-type.c =================================================================== --- clang/test/Sema/builtin-classify-type.c +++ clang/test/Sema/builtin-classify-type.c @@ -29,6 +29,8 @@ __attribute__((vector_size(16))) int vec; typedef __attribute__((ext_vector_type(4))) int evec_t; evec_t evec; + typedef _BitInt(16) int16_t3 __attribute__((ext_vector_type(3))); + int16_t3 t3; _Atomic int atomic_i; _Atomic double atomic_d; _Complex int complex_i; Index: clang/lib/Sema/SemaType.cpp =================================================================== --- clang/lib/Sema/SemaType.cpp +++ clang/lib/Sema/SemaType.cpp @@ -2707,7 +2707,7 @@ // We explictly allow bool elements in ext_vector_type for C/C++. bool IsNoBoolVecLang = getLangOpts().OpenCL || getLangOpts().OpenCLCPlusPlus; if ((!T->isDependentType() && !T->isIntegerType() && - !T->isRealFloatingType()) || T->isBitIntType() || + !T->isRealFloatingType()) || (IsNoBoolVecLang && T->isBooleanType())) { Diag(AttrLoc, diag::err_attribute_invalid_vector_type) << T; return QualType(); Index: clang/lib/AST/ASTContext.cpp =================================================================== --- clang/lib/AST/ASTContext.cpp +++ clang/lib/AST/ASTContext.cpp @@ -4080,9 +4080,10 @@ /// getExtVectorType - Return the unique reference to an extended vector type of /// the specified element type and size. VectorType must be a built-in type. -QualType -ASTContext::getExtVectorType(QualType vecType, unsigned NumElts) const { - assert(vecType->isBuiltinType() || vecType->isDependentType()); +QualType ASTContext::getExtVectorType(QualType vecType, + unsigned NumElts) const { + assert(vecType->isBuiltinType() || vecType->isDependentType() || + vecType->isBitIntType()); // Check if we've already instantiated a vector of this type. llvm::FoldingSetNodeID ID;
Index: clang/test/SemaCXX/ext-int.cpp =================================================================== --- clang/test/SemaCXX/ext-int.cpp +++ clang/test/SemaCXX/ext-int.cpp @@ -83,11 +83,6 @@ static constexpr bool value = true; }; -// Reject vector types: -// expected-error@+1{{invalid vector element type '_BitInt(32)'}} -typedef _BitInt(32) __attribute__((vector_size(16))) VecTy; -// expected-error@+1{{invalid vector element type '_BitInt(32)'}} -typedef _BitInt(32) __attribute__((ext_vector_type(32))) OtherVecTy; // Allow _Complex: _Complex _BitInt(3) Cmplx; Index: clang/test/Sema/builtin-classify-type.c =================================================================== --- clang/test/Sema/builtin-classify-type.c +++ clang/test/Sema/builtin-classify-type.c @@ -29,6 +29,8 @@ __attribute__((vector_size(16))) int vec; typedef __attribute__((ext_vector_type(4))) int evec_t; evec_t evec; + typedef _BitInt(16) int16_t3 __attribute__((ext_vector_type(3))); + int16_t3 t3; _Atomic int atomic_i; _Atomic double atomic_d; _Complex int complex_i; Index: clang/lib/Sema/SemaType.cpp =================================================================== --- clang/lib/Sema/SemaType.cpp +++ clang/lib/Sema/SemaType.cpp @@ -2707,7 +2707,7 @@ // We explictly allow bool elements in ext_vector_type for C/C++. bool IsNoBoolVecLang = getLangOpts().OpenCL || getLangOpts().OpenCLCPlusPlus; if ((!T->isDependentType() && !T->isIntegerType() && - !T->isRealFloatingType()) || T->isBitIntType() || + !T->isRealFloatingType()) || (IsNoBoolVecLang && T->isBooleanType())) { Diag(AttrLoc, diag::err_attribute_invalid_vector_type) << T; return QualType(); Index: clang/lib/AST/ASTContext.cpp =================================================================== --- clang/lib/AST/ASTContext.cpp +++ clang/lib/AST/ASTContext.cpp @@ -4080,9 +4080,10 @@ /// getExtVectorType - Return the unique reference to an extended vector type of /// the specified element type and size. VectorType must be a built-in type. -QualType -ASTContext::getExtVectorType(QualType vecType, unsigned NumElts) const { - assert(vecType->isBuiltinType() || vecType->isDependentType()); +QualType ASTContext::getExtVectorType(QualType vecType, + unsigned NumElts) const { + assert(vecType->isBuiltinType() || vecType->isDependentType() || + vecType->isBitIntType()); // Check if we've already instantiated a vector of this type. llvm::FoldingSetNodeID ID;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits