aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-expr.h
diff options
context:
space:
mode:
authorYizhe <yizhe@pku.edu.cn>2021-03-17 02:06:21 +0000
committerYizhePKU <yizhe@pku.edu.cn>2021-04-02 17:10:43 +0000
commitd71750b7829b3ef3443c75880e439e3e145aa8a7 (patch)
treef685de849e35a359d6f5010876c56bc311a893f2 /gcc/rust/ast/rust-expr.h
parent0a63f6d619aba46abeafe9c7544756fee00e072d (diff)
downloadgcc-d71750b7829b3ef3443c75880e439e3e145aa8a7.zip
gcc-d71750b7829b3ef3443c75880e439e3e145aa8a7.tar.gz
gcc-d71750b7829b3ef3443c75880e439e3e145aa8a7.tar.bz2
Remove ArrayExpr::has_array_elems
has_array_elems() is mostly used as a nullptr check. We don't need it anymore. To implement has_array_elems() correctly(i.e. return true when the array is zero length) would be difficult, because we may need to perform constant folding first.
Diffstat (limited to 'gcc/rust/ast/rust-expr.h')
-rw-r--r--gcc/rust/ast/rust-expr.h9
1 files changed, 1 insertions, 8 deletions
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index 08dc193..b535f8f 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -1099,9 +1099,6 @@ public:
outer_attrs = std::move (new_attrs);
}
- // Returns whether array expr has array elems or if it is just empty.
- bool has_array_elems () const { return internal_elements != nullptr; }
-
// Constructor requires ArrayElems pointer
ArrayExpr (std::unique_ptr<ArrayElems> array_elems,
std::vector<Attribute> inner_attribs,
@@ -1119,7 +1116,6 @@ public:
inner_attrs (other.inner_attrs), locus (other.locus),
marked_for_strip (other.marked_for_strip)
{
- if (other.has_array_elems ())
internal_elements = other.internal_elements->clone_array_elems ();
rust_assert (internal_elements != nullptr);
}
@@ -1133,10 +1129,7 @@ public:
marked_for_strip = other.marked_for_strip;
outer_attrs = other.outer_attrs;
- if (other.has_array_elems ())
- internal_elements = other.internal_elements->clone_array_elems ();
- else
- internal_elements = nullptr;
+ internal_elements = other.internal_elements->clone_array_elems ();
rust_assert (internal_elements != nullptr);
return *this;