return_to_param: delete debug code
[smatch.git] / smatch_unknown_value.c
blob47dcc54c5765287f9f74abfc149adb7035777403
1 /*
2 * Copyright (C) 2014 Oracle.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
19 * The situation here is that we often need to fake an assignment but we don't
20 * know anything about the right hand side of the assignment. We use a fake
21 * function call of &llong_ctype. The reason for using a function call instead
22 * of a value is so we don't start storing the equivalence.
26 #include "smatch.h"
28 struct ident fake_assign = {
29 .len = sizeof("fake assign"),
30 .name = "fake assign",
33 static struct symbol fake_fn_symbol = {
34 .type = SYM_FN,
35 .ident = &fake_assign,
38 static struct symbol fake_node_symbol = {
39 .type = SYM_NODE,
40 .ident = &fake_assign,
43 static struct expression fake_fn_expr = {
44 .type = EXPR_SYMBOL,
45 .ctype = &llong_ctype,
48 static struct expression fake_call = {
49 .type = EXPR_CALL,
50 .ctype = &llong_ctype,
53 static void __attribute__((constructor)) initialize_local_variables(void)
55 fake_fn_symbol.ctype.base_type = &llong_ctype;
56 fake_node_symbol.ctype.base_type = &fake_fn_symbol;
57 fake_fn_expr.symbol = &fake_node_symbol;
58 fake_fn_expr.symbol_name = &fake_assign;
59 fake_call.fn = &fake_fn_expr;
62 struct expression *unknown_value_expression(struct expression *expr)
64 fake_fn_expr.parent = 0;
65 fake_call.parent = 0;
66 return &fake_call;
69 int is_fake_call(struct expression *expr)
71 return expr == &fake_call;