1 /* Utility functions for the analyzer.
2 Copyright (C) 2019-2020 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
5 This file is part of GCC.
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)
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.
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/>. */
21 #ifndef GCC_ANALYZER_ANALYZER_H
22 #define GCC_ANALYZER_ANALYZER_H
28 /* Forward decls of common types, with indentation to show inheritance. */
34 class switch_cfg_superedge
;
35 class callgraph_superedge
;
37 class return_superedge
;
40 class constant_svalue
;
41 class poisoned_svalue
;
47 class symbolic_region
;
49 class region_model_context
;
50 class impl_region_model_context
;
51 class constraint_manager
;
54 struct svalue_id_merger_mapping
;
55 struct canonicalization
;
56 class pending_diagnostic
;
57 class state_change_event
;
59 class extrinsic_state
;
67 class feasibility_problem
;
68 class exploded_cluster
;
71 class state_purge_map
;
72 class state_purge_per_ssa_name
;
76 /* Forward decls of functions. */
78 extern void dump_quoted_tree (pretty_printer
*pp
, tree t
);
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
);
92 extern const char *get_user_facing_name (const gcall
*call
);
94 extern void register_analyzer_pass ();
96 extern label_text
make_label_text (bool can_colorize
, const char *fmt
, ...);
98 extern bool fndecl_has_gimple_body_p (tree fndecl
);
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. */
107 auto_cfun (function
*fun
) { push_cfun (fun
); }
108 ~auto_cfun () { pop_cfun (); }
111 /* A template for creating hash traits for a POD type. */
113 template <typename Type
>
114 struct pod_hash_traits
: typed_noop_remove
<Type
>
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
);
127 #endif /* GCC_ANALYZER_ANALYZER_H */