[PATCH] D76692: [AST][SVE] Treat built-in SVE types as trivial

Richard Sandiford via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 24 05:21:02 PDT 2020


rsandifo-arm created this revision.
rsandifo-arm added reviewers: sdesmalen, efriedma, rovka, rjmccall.
Herald added subscribers: cfe-commits, psnobl, rkruppe, tschuett.
Herald added a reviewer: rengolin.
Herald added a project: clang.
rsandifo-arm added a parent revision: D76691: [AST][SVE] Treat built-in SVE types as trivially copyable.

Built-in SVE types are trivial, since they're trivially copyable
and support default construction.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76692

Files:
  clang/lib/AST/Type.cpp
  clang/test/SemaCXX/sizeless-1.cpp


Index: clang/test/SemaCXX/sizeless-1.cpp
===================================================================
--- clang/test/SemaCXX/sizeless-1.cpp
+++ clang/test/SemaCXX/sizeless-1.cpp
@@ -527,6 +527,7 @@
   _Static_assert(!__is_literal(svint8_t), "");
   _Static_assert(__is_pod(svint8_t), "");
   _Static_assert(!__is_polymorphic(svint8_t), "");
+  _Static_assert(__is_trivial(svint8_t), "");
   _Static_assert(__is_object(svint8_t), "");
   _Static_assert(!__is_arithmetic(svint8_t), "");
   _Static_assert(!__is_floating_point(svint8_t), "");
Index: clang/lib/AST/Type.cpp
===================================================================
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -2264,6 +2264,9 @@
   if ((*this)->isArrayType())
     return Context.getBaseElementType(*this).isTrivialType(Context);
 
+  if ((*this)->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 ((*this)->isIncompleteType())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76692.252273.patch
Type: text/x-patch
Size: 1071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200324/e6fc1e9f/attachment-0001.bin>


More information about the cfe-commits mailing list