diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-02-05 01:50:22 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-02-05 01:50:22 +0000 |
commit | 964c809fb28f2bbb5b7c35d7951911abff242b94 (patch) | |
tree | b28da004d38101795417db74c7864f081e38ba3f /gcc/go/gofrontend/expressions.h | |
parent | 4cff15eaca92180183608371351ba2c818990304 (diff) | |
download | gcc-964c809fb28f2bbb5b7c35d7951911abff242b94.zip gcc-964c809fb28f2bbb5b7c35d7951911abff242b94.tar.gz gcc-964c809fb28f2bbb5b7c35d7951911abff242b94.tar.bz2 |
compiler: in range, evaluate array if it has receives or calls
The last change was incomplete, in that it did not evaluate the array
argument in some cases where it had to be evaluated. This reuses the
existing code for checking whether len/cap is constant.
Also clean up the use of _ as the second variable in a for/range,
which was previously inconsistent depending on whether the statement
used = or :=.
Updates golang/go#22313
Reviewed-on: https://go-review.googlesource.com/91715
From-SVN: r257377
Diffstat (limited to 'gcc/go/gofrontend/expressions.h')
-rw-r--r-- | gcc/go/gofrontend/expressions.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index 6b00cab..18fd91b 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -2406,6 +2406,11 @@ class Builtin_call_expression : public Call_expression is_builtin() { return true; } + // Return whether EXPR, of array type, is a constant if passed to + // len or cap. + static bool + array_len_is_constant(Expression* expr); + protected: // This overrides Call_expression::do_lower. Expression* |