]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/analyzer/analyzer.h
analyzer: introduce namespace to avoid ODR clashes (PR 93307)
[thirdparty/gcc.git] / gcc / analyzer / analyzer.h
CommitLineData
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
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it
8under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful, but
13WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along 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
26class graphviz_out;
75038aa6
DM
27
28namespace ana {
29
757bf1df
DM
30class supergraph;
31class supernode;
32class superedge;
33 class cfg_superedge;
34 class switch_cfg_superedge;
35 class callgraph_superedge;
36 class call_superedge;
37 class return_superedge;
38class svalue;
39 class region_svalue;
40 class constant_svalue;
41 class poisoned_svalue;
42 class unknown_svalue;
43 class setjmp_svalue;
44class region;
45 class map_region;
46 class symbolic_region;
47class region_model;
48class region_model_context;
49 class impl_region_model_context;
50class constraint_manager;
51class equiv_class;
52struct model_merger;
53struct svalue_id_merger_mapping;
54struct canonicalization;
55class pending_diagnostic;
56class state_change_event;
57class checker_path;
58class extrinsic_state;
59class sm_state_map;
60class stmt_finder;
61class program_point;
62class program_state;
63class exploded_graph;
64class exploded_node;
65class exploded_edge;
66class exploded_cluster;
67class exploded_path;
68class analysis_plan;
69class state_purge_map;
70class state_purge_per_ssa_name;
71class state_change;
72class rewind_info_t;
73
75038aa6
DM
74} // namespace ana
75
757bf1df
DM
76extern bool is_special_named_call_p (const gcall *call, const char *funcname,
77 unsigned int num_args);
78extern bool is_named_call_p (tree fndecl, const char *funcname);
79extern bool is_named_call_p (tree fndecl, const char *funcname,
80 const gcall *call, unsigned int num_args);
81extern bool is_setjmp_call_p (const gimple *stmt);
82extern bool is_longjmp_call_p (const gcall *call);
83
84extern void register_analyzer_pass ();
85
86extern label_text make_label_text (bool can_colorize, const char *fmt, ...);
87
ef7827b0
DM
88extern 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
94class auto_cfun
95{
96public:
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
115template <typename Type>
116struct 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 */