]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/analyzer/analyzer.h
analyzer: add new supergraph visualization
[thirdparty/gcc.git] / gcc / analyzer / analyzer.h
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 class graphviz_out;
25
26 namespace ana {
27
28 /* Forward decls of common types, with indentation to show inheritance. */
29
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 array_region;
47 class symbolic_region;
48 class region_model;
49 class region_model_context;
50 class impl_region_model_context;
51 class constraint_manager;
52 class equiv_class;
53 struct model_merger;
54 struct svalue_id_merger_mapping;
55 struct canonicalization;
56 class pending_diagnostic;
57 class state_change_event;
58 class checker_path;
59 class extrinsic_state;
60 class sm_state_map;
61 class stmt_finder;
62 class program_point;
63 class program_state;
64 class exploded_graph;
65 class exploded_node;
66 class exploded_edge;
67 class feasibility_problem;
68 class exploded_cluster;
69 class exploded_path;
70 class analysis_plan;
71 class state_purge_map;
72 class state_purge_per_ssa_name;
73 class state_change;
74 class rewind_info_t;
75
76 /* Forward decls of functions. */
77
78 extern void dump_quoted_tree (pretty_printer *pp, tree t);
79
80 } // namespace ana
81
82 extern bool is_special_named_call_p (const gcall *call, const char *funcname,
83 unsigned int num_args);
84 extern bool is_named_call_p (tree fndecl, const char *funcname);
85 extern bool is_named_call_p (tree fndecl, const char *funcname,
86 const gcall *call, unsigned int num_args);
87 extern bool is_std_named_call_p (tree fndecl, const char *funcname,
88 const gcall *call, unsigned int num_args);
89 extern bool is_setjmp_call_p (const gcall *call);
90 extern bool is_longjmp_call_p (const gcall *call);
91
92 extern const char *get_user_facing_name (const gcall *call);
93
94 extern void register_analyzer_pass ();
95
96 extern label_text make_label_text (bool can_colorize, const char *fmt, ...);
97
98 extern bool fndecl_has_gimple_body_p (tree fndecl);
99
100 /* An RAII-style class for pushing/popping cfun within a scope.
101 Doing so ensures we get "In function " announcements
102 from the diagnostics subsystem. */
103
104 class auto_cfun
105 {
106 public:
107 auto_cfun (function *fun) { push_cfun (fun); }
108 ~auto_cfun () { pop_cfun (); }
109 };
110
111 /* A template for creating hash traits for a POD type. */
112
113 template <typename Type>
114 struct pod_hash_traits : typed_noop_remove<Type>
115 {
116 typedef Type value_type;
117 typedef Type compare_type;
118 static inline hashval_t hash (value_type);
119 static inline bool equal (const value_type &existing,
120 const value_type &candidate);
121 static inline void mark_deleted (Type &);
122 static inline void mark_empty (Type &);
123 static inline bool is_deleted (Type);
124 static inline bool is_empty (Type);
125 };
126
127 #endif /* GCC_ANALYZER_ANALYZER_H */