aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/expressions.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/go/gofrontend/expressions.h')
-rw-r--r--gcc/go/gofrontend/expressions.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index 0936e00..6f03e02 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -1305,7 +1305,7 @@ class Unary_expression : public Expression
Unary_expression(Operator op, Expression* expr, Location location)
: Expression(EXPRESSION_UNARY, location),
op_(op), escapes_(true), create_temp_(false), is_gc_root_(false),
- expr_(expr), issue_nil_check_(false)
+ is_slice_init_(false), expr_(expr), issue_nil_check_(false)
{ }
// Return the operator.
@@ -1344,6 +1344,15 @@ class Unary_expression : public Expression
this->is_gc_root_ = true;
}
+ // Record that this is an address expression of a slice value initializer,
+ // which is mutable if the values are not copied to the heap.
+ void
+ set_is_slice_init()
+ {
+ go_assert(this->op_ == OPERATOR_AND);
+ this->is_slice_init_ = true;
+ }
+
// Apply unary opcode OP to UNC, setting NC. Return true if this
// could be done, false if not. Issue errors for overflow.
static bool
@@ -1427,6 +1436,11 @@ class Unary_expression : public Expression
// special struct composite literal that is mutable when addressed, meaning
// it cannot be represented as an immutable_struct in the backend.
bool is_gc_root_;
+ // True if this is an address expression for a slice value with an immutable
+ // initializer. The initializer for a slice's value pointer has an array
+ // type, meaning it cannot be represented as an immutable_struct in the
+ // backend.
+ bool is_slice_init_;
// The operand.
Expression* expr_;
// Whether or not to issue a nil check for this expression if its address