aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Faust <david.faust@oracle.com>2022-07-06 12:21:03 -0700
committerDavid Faust <david.faust@oracle.com>2022-07-06 12:21:03 -0700
commitfe64842ff930e552917272319de55f9a1e4cd2fa (patch)
tree0f7cb141958ead3207545965e3b3052752345f1c
parent29d594e263f0ccbcbd2babf43ff453c5188f4f2c (diff)
downloadgcc-fe64842ff930e552917272319de55f9a1e4cd2fa.zip
gcc-fe64842ff930e552917272319de55f9a1e4cd2fa.tar.gz
gcc-fe64842ff930e552917272319de55f9a1e4cd2fa.tar.bz2
HIR: add Literal is_equal ()
A small helper for checking when two Literals contain the same value.
-rw-r--r--gcc/rust/hir/tree/rust-hir.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/rust/hir/tree/rust-hir.h b/gcc/rust/hir/tree/rust-hir.h
index 8f94354..ff4c39e 100644
--- a/gcc/rust/hir/tree/rust-hir.h
+++ b/gcc/rust/hir/tree/rust-hir.h
@@ -122,6 +122,12 @@ public:
// Returns whether literal is in an invalid state.
bool is_error () const { return value_as_string == ""; }
+
+ bool is_equal (Literal &other)
+ {
+ return value_as_string == other.value_as_string && type == other.type
+ && type_hint == other.type_hint;
+ }
};
/* Base statement abstract class. Note that most "statements" are not allowed in