aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-tree.cc
diff options
context:
space:
mode:
authorFaisal Abbas <90.abbasfaisal@gmail.com>2022-08-06 12:55:47 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-08-25 12:40:26 +0100
commitbbc514d024a232dacfe218706dd07dcf01a51314 (patch)
tree89e307830bf69d99a6085370098a33f6f76b496a /gcc/rust/backend/rust-tree.cc
parentc628a66a92f72add62608c2c24cf0ec4c5ae45af (diff)
downloadgcc-bbc514d024a232dacfe218706dd07dcf01a51314.zip
gcc-bbc514d024a232dacfe218706dd07dcf01a51314.tar.gz
gcc-bbc514d024a232dacfe218706dd07dcf01a51314.tar.bz2
rust-constexpr.cc: port over cxx_eval_bare_aggregate. Comments out build_ctor_subob_ref
inside init_subob_ctx.
Diffstat (limited to 'gcc/rust/backend/rust-tree.cc')
-rw-r--r--gcc/rust/backend/rust-tree.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-tree.cc b/gcc/rust/backend/rust-tree.cc
index 82b5845..289b4b9 100644
--- a/gcc/rust/backend/rust-tree.cc
+++ b/gcc/rust/backend/rust-tree.cc
@@ -4079,4 +4079,33 @@ build_new_constexpr_heap_type (tree elt_type, tree cookie_size, tree full_size)
return rtype;
}
+// forked from gcc/cp/class.cc field_poverlapping_p
+
+/* Return true iff FIELD_DECL DECL is potentially overlapping. */
+
+static bool
+field_poverlapping_p (tree decl)
+{
+ return lookup_attribute ("no_unique_address", DECL_ATTRIBUTES (decl));
+}
+
+// forked from gcc/cp/class.cc is_empty_field
+
+/* Return true iff DECL is an empty field, either for an empty base or a
+ [[no_unique_address]] data member. */
+
+bool
+is_empty_field (tree decl)
+{
+ if (!decl || TREE_CODE (decl) != FIELD_DECL)
+ return false;
+
+ bool r = (is_empty_class (TREE_TYPE (decl)) && (field_poverlapping_p (decl)));
+
+ /* Empty fields should have size zero. */
+ gcc_checking_assert (!r || integer_zerop (DECL_SIZE (decl)));
+
+ return r;
+}
+
} // namespace Rust