aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-12-05 23:39:11 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-12-10 23:26:23 +0100
commitaa42d419661df95820ba8c28e93b0b1359e0f8d7 (patch)
tree67c4dc48854aff50c302f5e63bed19b47fcc1bea
parent9fe9cc26a024923483d9ae3b6133c36b037cc4ab (diff)
downloadsparse-aa42d419661df95820ba8c28e93b0b1359e0f8d7.tar.gz
extract mark_addressable() from evaluate_addressof().
This is just moving the 3 lines of code to mark a symbol as addressable in a speparate function. This is a preparatory step for one of the next patches. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--evaluate.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/evaluate.c b/evaluate.c
index 19bdab92..d78de2ed 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1540,6 +1540,14 @@ static int compatible_argument_type(struct expression *expr, struct symbol *targ
return compatible_assignment_types(expr, target, rp, where);
}
+static void mark_addressable(struct expression *expr)
+{
+ if (expr->type == EXPR_SYMBOL) {
+ struct symbol *sym = expr->symbol;
+ sym->ctype.modifiers |= MOD_ADDRESSABLE;
+ }
+}
+
static void mark_assigned(struct expression *expr)
{
struct symbol *sym;
@@ -1780,10 +1788,7 @@ static struct symbol *evaluate_addressof(struct expression *expr)
ctype = op->ctype;
*expr = *op->unop;
- if (expr->type == EXPR_SYMBOL) {
- struct symbol *sym = expr->symbol;
- sym->ctype.modifiers |= MOD_ADDRESSABLE;
- }
+ mark_addressable(expr);
/*
* symbol expression evaluation is lazy about the type