diff options
author | Ian Lance Taylor <iant@golang.org> | 2021-08-06 12:01:04 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-08-07 13:37:58 -0700 |
commit | 307e0d40367996031e9b734ba0ab44ff0b290c79 (patch) | |
tree | a355af48de54c3db0a571e9d6ba07ab4a0614ef7 /gcc/go/gofrontend/expressions.h | |
parent | cd754efa9a5349c693919046b8be074395ea114e (diff) | |
download | gcc-307e0d40367996031e9b734ba0ab44ff0b290c79.zip gcc-307e0d40367996031e9b734ba0ab44ff0b290c79.tar.gz gcc-307e0d40367996031e9b734ba0ab44ff0b290c79.tar.bz2 |
compiler: support export/import of unsafe.Add/Slice
For golang/go#19367
For golang/go#40481
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/340549
Diffstat (limited to 'gcc/go/gofrontend/expressions.h')
-rw-r--r-- | gcc/go/gofrontend/expressions.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index 79a8785..9f8f4e9 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -732,6 +732,10 @@ class Expression call_expression() { return this->convert<Call_expression, EXPRESSION_CALL>(); } + const Call_expression* + call_expression() const + { return this->convert<const Call_expression, EXPRESSION_CALL>(); } + // If this is a call_result expression, return the Call_result_expression // structure. Otherwise, return NULL. This is a controlled dynamic // cast. @@ -2460,13 +2464,16 @@ class Call_expression : public Expression // Whether this is a call to builtin function. virtual bool - is_builtin() + is_builtin() const { return false; } // Convert to a Builtin_call_expression, or return NULL. inline Builtin_call_expression* builtin_call_expression(); + inline const Builtin_call_expression* + builtin_call_expression() const; + protected: int do_traverse(Traverse*); @@ -2625,12 +2632,12 @@ class Builtin_call_expression : public Call_expression }; Builtin_function_code - code() + code() const { return this->code_; } // This overrides Call_expression::is_builtin. bool - is_builtin() + is_builtin() const { return true; } // Return whether EXPR, of array type, is a constant if passed to @@ -2726,6 +2733,14 @@ Call_expression::builtin_call_expression() : NULL); } +inline const Builtin_call_expression* +Call_expression::builtin_call_expression() const +{ + return (this->is_builtin() + ? static_cast<const Builtin_call_expression*>(this) + : NULL); +} + // A single result from a call which returns multiple results. class Call_result_expression : public Expression |