File: AST_utils.h

package info (click to toggle)
nescc 1.3.5-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 11,604 kB
  • sloc: ansic: 72,471; sh: 4,474; yacc: 2,171; perl: 2,109; java: 1,699; makefile: 1,535; lisp: 693; xml: 182; lex: 95; cpp: 28
file content (90 lines) | stat: -rw-r--r-- 3,333 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* This file is part of the nesC compiler.

This file is derived from the RC Compiler. It is thus
   Copyright (C) 2000-2001 The Regents of the University of California.
Changes for nesC are
   Copyright (C) 2002 Intel Corporation

The attached "nesC" software is provided to you under the terms and
conditions of the GNU General Public License Version 2 as published by the
Free Software Foundation.

nesC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with nesC; see the file COPYING.  If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */

#ifndef AST_UTILS_H
#define AST_UTILS_H

#define IS_A(n, k) \
  ((n)->kind >= (k) && (n)->kind <= AST_post_kind[(k) - kind_node])

data_declaration get_parameter(declaration d);
function_declarator get_fdeclarator(declarator d);
bool oldstyle_function(function_decl fn);
bool is_void_parms(declaration parms);
bool is_localvar(expression e);
compound_stmt parent_block(node n);
function_decl parent_function(node n);
expression expression_of_stmt(compound_expr ce); /* Return expression which is value of compound statement expression, or NULL of node ("void" compound expression) */
bool expression_used(expression e);

data_declaration base_identifier(data_declaration d);
bool same_function(data_declaration d1, data_declaration d2);
bool call_to(data_declaration fnd, function_call fce);
expression ignore_fields(expression e);

/* True for expressions whose value is known to be 0 (but which
   may not be constant expressions) */
bool zero_expression(expression e);

expression build_int_constant(region r, location loc, type t, largest_int c);
expression build_uint_constant(region r, location loc, type t, largest_uint c);
#define build_zero(r, loc) build_int_constant(r, loc, int_type, 0)

expression build_identifier(region r, location loc, data_declaration id);

cval value_of_enumerator(enumerator e);

int asm_rwmode(string s);
/* Return: The first char of asm operand mode specifier s, this indicates
     the r/w mode for the operand (see gcc docs)
     The result is -1 if s is the empty string.
*/

declaration ignore_extensions(declaration d);
/* Ignore extension_decls at d, returning the "real" declaration */

tag_declaration get_unnamed_tag_decl(data_decl decl);
/* Returns:. Check to see if it is a struct or
     union, and if so return that struct or union's declaration */

const char *nice_field_name(const char *s);
/* Returns: "(anonymous)" if s == NULL, s otherwise
     This helps printing the name of potentially unnamed entities
 */

const char *tagkind_name(int tagkind);

conditional conditional_lvalue(expression e);

data_declaration string_ddecl(expression s);

char *ddecl2str(region r, data_declaration str);
/* Returns: a newly allocated string (in region r) for the string
     specified by str, or NULL if str contains wide characters
   Requires: str->kind == decl_magic_string
*/

bool is_attr_name(const char *arg, const char *name);
/* Returns: True if arg is name or __name__ */

type_element interesting_element(type_element elems);

#endif