diff options
author | Chris Manghane <cmang@google.com> | 2014-05-06 00:11:29 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2014-05-06 00:11:29 +0000 |
commit | fb930306ba4cbb6fd54d1cbfa013cb6c8f92ad4f (patch) | |
tree | f3a9e000cbf0028296817998178ce156cf0715e6 /gcc/go/gofrontend/expressions.h | |
parent | 3e7b0938f13f937df971a1bc42f1dd32ca8a81bb (diff) | |
download | gcc-fb930306ba4cbb6fd54d1cbfa013cb6c8f92ad4f.zip gcc-fb930306ba4cbb6fd54d1cbfa013cb6c8f92ad4f.tar.gz gcc-fb930306ba4cbb6fd54d1cbfa013cb6c8f92ad4f.tar.bz2 |
compiler: Use backend interface for slice construction.
* go-gcc.cc (Gcc_backend::implicit_variable): Rename from
gc_root_variable. Add name and is_constant parameters.
From-SVN: r210088
Diffstat (limited to 'gcc/go/gofrontend/expressions.h')
-rw-r--r-- | gcc/go/gofrontend/expressions.h | 16 |
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 |