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.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index 09c71ad..6ba7fe1 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -581,6 +581,12 @@ class Expression
string_constant_value(std::string* val) const
{ return this->do_string_constant_value(val); }
+ // If this is not a constant expression with boolean type, return
+ // false. If it is one, return true, and set VAL to the value.
+ bool
+ boolean_constant_value(bool* val) const
+ { return this->do_boolean_constant_value(val); }
+
// This is called if the value of this expression is being
// discarded. This issues warnings about computed values being
// unused. This returns true if all is well, false if it issued an
@@ -1125,6 +1131,12 @@ class Expression
do_string_constant_value(std::string*) const
{ return false; }
+ // Return whether this is a constant expression of boolean type, and
+ // set VAL to the value.
+ virtual bool
+ do_boolean_constant_value(bool*) const
+ { return false; }
+
// Called by the parser if the value is being discarded.
virtual bool
do_discarding_value();
@@ -1771,6 +1783,9 @@ class Type_conversion_expression : public Expression
bool
do_string_constant_value(std::string*) const;
+ bool
+ do_boolean_constant_value(bool*) const;
+
Type*
do_type()
{ return this->type_; }
@@ -1965,6 +1980,9 @@ class Unary_expression : public Expression
bool
do_numeric_constant_value(Numeric_constant*) const;
+ bool
+ do_boolean_constant_value(bool*) const;
+
Type*
do_type();
@@ -2120,6 +2138,9 @@ class Binary_expression : public Expression
do_numeric_constant_value(Numeric_constant*) const;
bool
+ do_boolean_constant_value(bool*) const;
+
+ bool
do_discarding_value();
Type*