]>
Commit | Line | Data |
---|---|---|
757bf1df DM |
1 | /* Utility functions for the analyzer. |
2 | Copyright (C) 2019-2020 Free Software Foundation, Inc. | |
3 | Contributed by David Malcolm <dmalcolm@redhat.com>. | |
4 | ||
5 | This file is part of GCC. | |
6 | ||
7 | GCC is free software; you can redistribute it and/or modify it | |
8 | under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3, or (at your option) | |
10 | any later version. | |
11 | ||
12 | GCC is distributed in the hope that it will be useful, but | |
13 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GCC; see the file COPYING3. If not see | |
19 | <http://www.gnu.org/licenses/>. */ | |
20 | ||
21 | #ifndef GCC_ANALYZER_ANALYZER_H | |
22 | #define GCC_ANALYZER_ANALYZER_H | |
23 | ||
24 | /* Forward decls of common types, with indentation to show inheritance. */ | |
25 | ||
26 | class graphviz_out; | |
75038aa6 DM |
27 | |
28 | namespace ana { | |
29 | ||
757bf1df DM |
30 | class supergraph; |
31 | class supernode; | |
32 | class superedge; | |
33 | class cfg_superedge; | |
34 | class switch_cfg_superedge; | |
35 | class callgraph_superedge; | |
36 | class call_superedge; | |
37 | class return_superedge; | |
38 | class svalue; | |
39 | class region_svalue; | |
40 | class constant_svalue; | |
41 | class poisoned_svalue; | |
42 | class unknown_svalue; | |
43 | class setjmp_svalue; | |
44 | class region; | |
45 | class map_region; | |
46 | class symbolic_region; | |
47 | class region_model; | |
48 | class region_model_context; | |
49 | class impl_region_model_context; | |
50 | class constraint_manager; | |
51 | class equiv_class; | |
52 | struct model_merger; | |
53 | struct svalue_id_merger_mapping; | |
54 | struct canonicalization; | |
55 | class pending_diagnostic; | |
56 | class state_change_event; | |
57 | class checker_path; | |
58 | class extrinsic_state; | |
59 | class sm_state_map; | |
60 | class stmt_finder; | |
61 | class program_point; | |
62 | class program_state; | |
63 | class exploded_graph; | |
64 | class exploded_node; | |
65 | class exploded_edge; | |
66 | class exploded_cluster; | |
67 | class exploded_path; | |
68 | class analysis_plan; | |
69 | class state_purge_map; | |
70 | class state_purge_per_ssa_name; | |
71 | class state_change; | |
72 | class rewind_info_t; | |
73 | ||
75038aa6 DM |
74 | } // namespace ana |
75 | ||
757bf1df DM |
76 | extern bool is_special_named_call_p (const gcall *call, const char *funcname, |
77 | unsigned int num_args); | |
78 | extern bool is_named_call_p (tree fndecl, const char *funcname); | |
79 | extern bool is_named_call_p (tree fndecl, const char *funcname, | |
80 | const gcall *call, unsigned int num_args); | |
81 | extern bool is_setjmp_call_p (const gimple *stmt); | |
82 | extern bool is_longjmp_call_p (const gcall *call); | |
83 | ||
84 | extern void register_analyzer_pass (); | |
85 | ||
86 | extern label_text make_label_text (bool can_colorize, const char *fmt, ...); | |
87 | ||
ef7827b0 DM |
88 | extern bool fndecl_has_gimple_body_p (tree fndecl); |
89 | ||
757bf1df DM |
90 | /* An RAII-style class for pushing/popping cfun within a scope. |
91 | Doing so ensures we get "In function " announcements | |
92 | from the diagnostics subsystem. */ | |
93 | ||
94 | class auto_cfun | |
95 | { | |
96 | public: | |
97 | auto_cfun (function *fun) { push_cfun (fun); } | |
98 | ~auto_cfun () { pop_cfun (); } | |
99 | }; | |
100 | ||
101 | /* Begin suppressing -Wformat and -Wformat-extra-args. */ | |
102 | ||
103 | #define PUSH_IGNORE_WFORMAT \ | |
104 | _Pragma("GCC diagnostic push") \ | |
105 | _Pragma("GCC diagnostic ignored \"-Wformat\"") \ | |
106 | _Pragma("GCC diagnostic ignored \"-Wformat-extra-args\"") | |
107 | ||
108 | /* Finish suppressing -Wformat and -Wformat-extra-args. */ | |
109 | ||
110 | #define POP_IGNORE_WFORMAT \ | |
111 | _Pragma("GCC diagnostic pop") | |
112 | ||
113 | /* A template for creating hash traits for a POD type. */ | |
114 | ||
115 | template <typename Type> | |
116 | struct pod_hash_traits : typed_noop_remove<Type> | |
117 | { | |
118 | typedef Type value_type; | |
119 | typedef Type compare_type; | |
120 | static inline hashval_t hash (value_type); | |
121 | static inline bool equal (const value_type &existing, | |
122 | const value_type &candidate); | |
123 | static inline void mark_deleted (Type &); | |
124 | static inline void mark_empty (Type &); | |
125 | static inline bool is_deleted (Type); | |
126 | static inline bool is_empty (Type); | |
127 | }; | |
128 | ||
129 | #endif /* GCC_ANALYZER_ANALYZER_H */ |