[clang] 9dcb20a - [AST][SVE] Treat built-in SVE types as POD
Richard Sandiford via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 27 10:04:34 PDT 2020
Author: Richard Sandiford
Date: 2020-03-27T17:04:07Z
New Revision: 9dcb20a7d008ca179c5906ef3b2ef73d69964a94
URL: https://github.com/llvm/llvm-project/commit/9dcb20a7d008ca179c5906ef3b2ef73d69964a94
DIFF: https://github.com/llvm/llvm-project/commit/9dcb20a7d008ca179c5906ef3b2ef73d69964a94.diff
LOG: [AST][SVE] Treat built-in SVE types as POD
Built-in SVE types are POD in much the same that scalars and
fixed-length vectors are.
Differential Revision: https://reviews.llvm.org/D76690
Added:
Modified:
clang/lib/AST/Type.cpp
clang/test/SemaCXX/sizeless-1.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 69c942e46f72..d21dcdf97d2a 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -2496,6 +2496,9 @@ bool QualType::isCXX11PODType(const ASTContext &Context) const {
const Type *BaseTy = ty->getBaseElementTypeUnsafe();
assert(BaseTy && "NULL element type");
+ if (BaseTy->isSizelessBuiltinType())
+ return true;
+
// Return false for incomplete types after skipping any incomplete array
// types which are expressly allowed by the standard and thus our API.
if (BaseTy->isIncompleteType())
diff --git a/clang/test/SemaCXX/sizeless-1.cpp b/clang/test/SemaCXX/sizeless-1.cpp
index 5cbf1923d705..b472f1856f08 100644
--- a/clang/test/SemaCXX/sizeless-1.cpp
+++ b/clang/test/SemaCXX/sizeless-1.cpp
@@ -266,6 +266,7 @@ int vararg_receiver(int count, svint8_t first, ...) {
__builtin_va_list va;
__builtin_va_start(va, first);
+ __builtin_va_arg(va, svint8_t);
__builtin_va_end(va);
return count;
}
@@ -491,6 +492,16 @@ void cxx_only(int sel) {
_Static_assert(!__is_assignable(svint8_t, svint8_t), "");
_Static_assert(__is_assignable(svint8_t &, svint8_t), "");
_Static_assert(!__is_assignable(svint8_t &, svint16_t), "");
+ _Static_assert(__has_nothrow_assign(svint8_t), "");
+ _Static_assert(__has_nothrow_move_assign(svint8_t), "");
+ _Static_assert(__has_nothrow_copy(svint8_t), "");
+ _Static_assert(__has_nothrow_constructor(svint8_t), "");
+ _Static_assert(__has_trivial_assign(svint8_t), "");
+ _Static_assert(__has_trivial_move_assign(svint8_t), "");
+ _Static_assert(__has_trivial_copy(svint8_t), "");
+ _Static_assert(__has_trivial_constructor(svint8_t), "");
+ _Static_assert(__has_trivial_move_constructor(svint8_t), "");
+ _Static_assert(__has_trivial_destructor(svint8_t), "");
_Static_assert(!__has_virtual_destructor(svint8_t), "");
_Static_assert(!__is_abstract(svint8_t), "");
_Static_assert(!__is_aggregate(svint8_t), "");
@@ -502,6 +513,7 @@ void cxx_only(int sel) {
_Static_assert(!__is_enum(svint8_t), "");
_Static_assert(!__is_final(svint8_t), "");
_Static_assert(!__is_literal(svint8_t), "");
+ _Static_assert(__is_pod(svint8_t), "");
_Static_assert(!__is_polymorphic(svint8_t), "");
_Static_assert(__is_object(svint8_t), "");
_Static_assert(!__is_arithmetic(svint8_t), "");
More information about the cfe-commits
mailing list