aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2020-02-07 11:32:13 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-02-07 14:53:51 +0100
commit98276e6116f3bc34839519db3a1cccc78a2f0838 (patch)
tree1b9e0078449c1a029384dcabbb48ef6642643fce
parentf3a6f29a8ab2ac4f4892115fa3ce49b091cbee75 (diff)
downloadsparse-98276e6116f3bc34839519db3a1cccc78a2f0838.tar.gz
dissect: kill return_type
Now that we have dissect_ctx do_statement(STMT_RETURN) can use base_type(dissect_ctx->ctype.base_type) instead. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--dissect.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/dissect.c b/dissect.c
index b48cd852..85489a2a 100644
--- a/dissect.c
+++ b/dissect.c
@@ -54,7 +54,6 @@ typedef unsigned usage_t;
struct symbol *dissect_ctx;
static struct reporter *reporter;
-static struct symbol *return_type;
static void do_sym_list(struct symbol_list *list);
@@ -489,8 +488,10 @@ static struct symbol *do_statement(usage_t mode, struct statement *stmt)
break; case STMT_EXPRESSION:
ret = do_expression(mode, stmt->expression);
- break; case STMT_RETURN:
- do_expression(u_lval(return_type), stmt->expression);
+ break; case STMT_RETURN: {
+ struct symbol *type = dissect_ctx->ctype.base_type;
+ do_expression(u_lval(base_type(type)), stmt->expression);
+ }
break; case STMT_ASM:
do_expression(U_R_VAL, stmt->asm_string);
@@ -617,11 +618,9 @@ static inline struct symbol *do_symbol(struct symbol *sym)
show_ident(sym->ident));
dissect_ctx = sym;
- return_type = base_type(type);
do_sym_list(type->arguments);
do_statement(U_VOID, stmt);
dissect_ctx = dctx;
- return_type = NULL;
}
return type;