From 4cf1d2dbc34c0e83a68b38f6867df7b98a01cc91 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 3 Aug 2017 14:21:01 +0300 Subject: [PATCH] conditions: introduce get_conditions() I use this for some stuff I haven't published. Signed-off-by: Dan Carpenter --- smatch.h | 1 + smatch_stored_conditions.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/smatch.h b/smatch.h index 9cd15601..afa5e69c 100644 --- a/smatch.h +++ b/smatch.h @@ -926,6 +926,7 @@ int has_inc_dec(struct expression *expr); /* smatch_stored_conditions.c */ struct smatch_state *get_stored_condition(struct expression *expr); +struct expression_list *get_conditions(struct expression *expr); struct sm_state *stored_condition_implication_hook(struct expression *expr, struct state_list **true_stack, struct state_list **false_stack); diff --git a/smatch_stored_conditions.c b/smatch_stored_conditions.c index f76366f4..a9186986 100644 --- a/smatch_stored_conditions.c +++ b/smatch_stored_conditions.c @@ -225,6 +225,16 @@ struct smatch_state *get_stored_condition(struct expression *expr) return state; } +struct expression_list *get_conditions(struct expression *expr) +{ + struct smatch_state *state; + + state = get_state_expr(link_id, expr); + if (!state) + return NULL; + return state->data; +} + void register_stored_conditions(int id) { my_id = id; -- 2.11.4.GIT