From c5a8f67516e2a9f0fabe5eb9159c654662efc0ff Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 12 Jun 2014 18:21:36 +0300 Subject: [PATCH] assigned_expression: get the assigned expression using the name and sym Normally we would want to get the assignment using and expression but there are sometimes where we only have the name and sym. Signed-off-by: Dan Carpenter --- check_assigned_expr.c | 10 ++++++++++ smatch.h | 1 + 2 files changed, 11 insertions(+) diff --git a/check_assigned_expr.c b/check_assigned_expr.c index 8e965142..1f3c527d 100644 --- a/check_assigned_expr.c +++ b/check_assigned_expr.c @@ -37,6 +37,16 @@ struct expression *get_assigned_expr(struct expression *expr) return (struct expression *)state->data; } +struct expression *get_assigned_expr_name_sym(const char *name, struct symbol *sym) +{ + struct smatch_state *state; + + state = get_state(my_id, name, sym); + if (!state) + return NULL; + return (struct expression *)state->data; +} + static struct smatch_state *alloc_my_state(struct expression *expr) { struct smatch_state *state; diff --git a/smatch.h b/smatch.h index c443f104..a7a0d083 100644 --- a/smatch.h +++ b/smatch.h @@ -677,6 +677,7 @@ void print_held_locks(); /* check_assigned_expr.c */ struct expression *get_assigned_expr(struct expression *expr); +struct expression *get_assigned_expr_name_sym(const char *name, struct symbol *sym); /* smatch_comparison.c */ int get_comparison(struct expression *left, struct expression *right); -- 2.11.4.GIT