aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-07-04 14:45:31 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-02-01 18:06:18 +0100
commitad7c788e7a5b66b05a4cc8b7df35ffcec1ce5d49 (patch)
tree7bed08082a26de3a4a55215f1a6d90a1777edf2b
parent3a8d5ac8681871e44062965566f9211a8d302da4 (diff)
downloadsparse-dev-ad7c788e7a5b66b05a4cc8b7df35ffcec1ce5d49.tar.gz
add helpers: valid_expr_type() & valid_subexpr_type()
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--evaluate.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/evaluate.c b/evaluate.c
index 3c4a2532..14922017 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -47,6 +47,17 @@ struct symbol *current_fn;
static struct symbol *degenerate(struct expression *expr);
static struct symbol *evaluate_symbol(struct symbol *sym);
+static inline int valid_expr_type(struct expression *expr)
+{
+ return expr && valid_type(expr->ctype);
+}
+
+static inline int valid_subexpr_type(struct expression *expr)
+{
+ return valid_expr_type(expr->left)
+ && valid_expr_type(expr->right);
+}
+
static struct symbol *evaluate_symbol_expression(struct expression *expr)
{
struct expression *addr;