common_functions: add special handling of sprintf() and snprintf()
[smatch.git] / smatch_unknown_value.c
blobb88f6a1f2ffdb31258e5b220083852f85b87351f
1 /*
2 * smatch/smatch_unknown_value.c
4 * Copyright (C) 2014 Oracle.
6 * Licensed under the Open Software License version 1.1
8 */
11 * The situation here is that we often need to fake an assignment but we don't
12 * know anything about the right hand side of the assignment. We use a fake
13 * function call of &llong_ctype. The reason for using a function call instead
14 * of a value is so we don't start storing the equivalence.
18 #include "smatch.h"
20 struct ident fake_assign = {
21 .len = sizeof("fake assign"),
22 .name = "fake assign",
25 static struct symbol fake_fn_symbol = {
26 .type = SYM_FN,
27 .ident = &fake_assign,
28 .ctype = {
29 .base_type = &llong_ctype,
33 static struct symbol fake_node_symbol = {
34 .type = SYM_NODE,
35 .ident = &fake_assign,
36 .ctype = {
37 .base_type = &fake_fn_symbol,
41 static struct expression fake_fn_expr = {
42 .type = EXPR_SYMBOL,
43 .ctype = &llong_ctype,
44 .symbol = &fake_node_symbol,
45 .symbol_name = &fake_assign,
48 static struct expression fake_call = {
49 .type = EXPR_CALL,
50 .ctype = &llong_ctype,
51 .fn = &fake_fn_expr,
54 struct expression *unknown_value_expression(struct expression *expr)
56 return &fake_call;
59 int is_fake_call(struct expression *expr)
61 return expr == &fake_call;