GCC Middle and Back End API Reference
common.h
Go to the documentation of this file.
1/* Base header for the analyzer, plus utility functions.
2 Copyright (C) 2019-2026 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_COMMON_H
22#define GCC_ANALYZER_COMMON_H
23
24#include "config.h"
25#define INCLUDE_ALGORITHM
26#define INCLUDE_LIST
27#define INCLUDE_MAP
28#define INCLUDE_SET
29#define INCLUDE_STRING
30#define INCLUDE_VECTOR
31#include "system.h"
32#include "coretypes.h"
33#include "tree.h"
34#include "function.h"
35#include "basic-block.h"
36#include "gimple.h"
37#include "options.h"
38#include "bitmap.h"
39#include "diagnostic-core.h"
40#include "diagnostics/paths.h"
41#include "rich-location.h"
42#include "function.h"
43#include "json.h"
44#include "tristate.h"
45#include "value-range.h"
46
47class graphviz_out;
48
49namespace ana {
50
51/* Forward decls of common types, with indentation to show inheritance. */
52
53class supergraph;
54class supernode;
55class superedge;
56
57class svalue;
58 class region_svalue;
59 class constant_svalue;
60 class unknown_svalue;
61 class poisoned_svalue;
62 class setjmp_svalue;
63 class initial_svalue;
64 class unaryop_svalue;
65 class binop_svalue;
66 class sub_svalue;
67 class repeated_svalue;
68 class bits_within_svalue;
69 class unmergeable_svalue;
70 class placeholder_svalue;
71 class widening_svalue;
72 class compound_svalue;
73 class conjured_svalue;
74 class asm_output_svalue;
75 class const_fn_result_svalue;
77class region;
78 class frame_region;
79 class function_region;
80 class label_region;
81 class decl_region;
82 class symbolic_region;
83 class element_region;
84 class offset_region;
85 class sized_region;
86 class cast_region;
87 class field_region;
88 class string_region;
89 class bit_range_region;
90 class var_arg_region;
92class conjured_purge;
93struct model_merger;
94class store_manager;
95class store;
96class region_model;
99class call_details;
102class equiv_class;
104class bounded_ranges;
106
107struct pending_location;
109class pending_note;
110class saved_diagnostic;
111struct event_loc_info;
112class checker_event;
113 class state_change_event;
114 class warning_event;
115class checker_path;
116class extrinsic_state;
117class sm_state_map;
118class program_point;
119class program_state;
120class exploded_graph;
121class exploded_node;
122class exploded_edge;
125class exploded_cluster;
126class exploded_path;
127class analysis_plan;
128class state_purge_map;
131class state_change;
132class rewind_info_t;
133
134class engine;
135class state_machine;
136class logger;
137class visitor;
139class call_summary;
141struct per_function_data;
142struct interesting_t;
143class state_transition;
146class uncertainty_t;
147
148class feasible_node;
149
150class known_function;
153
154class translation_unit;
155
156/* Forward decls of functions. */
157
158extern void dump_tree (pretty_printer *pp, tree t);
163extern int readability_comparator (const void *p1, const void *p2);
164extern int tree_cmp (const void *p1, const void *p2);
167
168inline bool
169useful_location_p (location_t loc)
170{
171 return get_pure_location (loc) != UNKNOWN_LOCATION;
172}
173
174/* A tree, extended with stack frame information for locals, so that
175 we can distinguish between different values of locals within a potentially
176 recursive callstack. */
177
179{
180public:
181 path_var (tree t, int stack_depth)
182 : m_tree (t), m_stack_depth (stack_depth)
183 {
184 // TODO: ignore stack depth for globals and constants
185 }
186
187 bool operator== (const path_var &other) const
188 {
189 return (m_tree == other.m_tree
190 && m_stack_depth == other.m_stack_depth);
191 }
192
193 operator bool () const
194 {
195 return m_tree != NULL_TREE;
196 }
197
198 void dump (pretty_printer *pp) const;
199
201 int m_stack_depth; // or -1 for globals?
202};
203
204typedef offset_int bit_offset_t;
205typedef offset_int bit_size_t;
206typedef offset_int byte_offset_t;
207typedef offset_int byte_size_t;
208
210
212
213/* The location of a region expressesd as an offset relative to a
214 base region. */
215
217{
218public:
220 : m_base_region (nullptr), m_offset (0), m_sym_offset (nullptr)
221 {
222 }
223
224 static region_offset make_concrete (const region *base_region,
225 bit_offset_t offset)
226 {
227 return region_offset (base_region, offset, nullptr);
228 }
229 static region_offset make_symbolic (const region *base_region,
230 const svalue *sym_offset)
231 {
232 return region_offset (base_region, 0, sym_offset);
233 }
234 static region_offset make_byte_offset (const region *base_region,
235 const svalue *num_bytes_sval);
236
237 const region *get_base_region () const { return m_base_region; }
238
239 bool concrete_p () const { return m_sym_offset == nullptr; }
240 bool symbolic_p () const { return m_sym_offset != nullptr; }
241
243 {
245 return m_offset;
246 }
247
249 {
251 if (m_offset % BITS_PER_UNIT == 0)
252 {
253 *out = m_offset / BITS_PER_UNIT;
254 return true;
255 }
256 return false;
257 }
258
260 {
262 return m_sym_offset;
263 }
264
267
268 bool operator== (const region_offset &other) const
269 {
270 return (m_base_region == other.m_base_region
271 && m_offset == other.m_offset
272 && m_sym_offset == other.m_sym_offset);
273 }
274
275 void dump_to_pp (pretty_printer *pp, bool) const;
276 void dump (bool) const;
277
278private:
279 region_offset (const region *base_region, bit_offset_t offset,
280 const svalue *sym_offset)
281 : m_base_region (base_region), m_offset (offset), m_sym_offset (sym_offset)
282 {}
283
287};
288
289extern bool operator< (const region_offset &, const region_offset &);
290extern bool operator<= (const region_offset &, const region_offset &);
291extern bool operator> (const region_offset &, const region_offset &);
292extern bool operator>= (const region_offset &, const region_offset &);
293
294extern location_t get_stmt_location (const gimple *stmt, function *fun);
295
296extern bool compat_types_p (tree src_type, tree dst_type);
297
298/* Abstract base class for simulating the behavior of known functions,
299 supplied by the core of the analyzer, or by plugins.
300 The former are typically implemented in the various kf*.cc */
301
303{
304public:
305 virtual ~known_function () {}
306 virtual bool matches_call_types_p (const call_details &cd) const = 0;
307
308 /* A hook for performing additional checks on the expected state
309 at a call. */
310 virtual void
312 {
313 // no-op
314 }
315
316 virtual void impl_call_pre (const call_details &) const
317 {
318 return;
319 }
320 virtual void impl_call_post (const call_details &) const
321 {
322 return;
323 }
324
325 virtual const builtin_known_function *
326 dyn_cast_builtin_kf () const { return nullptr; }
327};
328
329/* Subclass of known_function for builtin functions. */
330
332{
333public:
334 virtual enum built_in_function builtin_code () const = 0;
337 return builtin_info[builtin_code ()].decl;
338 }
339
341 dyn_cast_builtin_kf () const final override { return this; }
342};
343
344/* Subclass of known_function for IFN_* functions. */
345
347{
348public:
349 bool matches_call_types_p (const call_details &) const final override
350 {
351 /* Types are assumed to be correct. */
352 return true;
353 }
354};
355
356/* Abstract subclass of known_function that merely sets the return
357 value of the function (based on function attributes), and assumes
358 it has no side-effects. */
359
361{
362public:
363 void impl_call_pre (const call_details &cd) const override;
364};
365
373
374/* An enum for describing the direction of an access to memory. */
375
377{
380};
381
382/* State tracked along an execution path that's pertinent to a specific
383 diagnostic (e.g. for a divide-by-zero warning where the zero value
384 comes from). */
385
387{
389 : m_region_holding_value (nullptr)
390 {
391 }
392
393 diagnostic_state (std::string debug_desc,
394 const region *region_holding_value)
395 : m_debug_desc (std::move (debug_desc)),
396 m_region_holding_value (region_holding_value)
397 {
398 }
399
401 void dump () const;
402
403 bool
404 operator== (const diagnostic_state &other) const
405 {
406 return m_region_holding_value == other.m_region_holding_value;
407 }
408 bool
409 operator!= (const diagnostic_state &other) const
410 {
411 return !(*this == other);
412 }
413
414 std::string m_debug_desc;
416};
417
418struct rewind_context;
419
420/* Abstract base class for associating custom data with an
421 exploded_edge, for handling non-standard edges such as
422 rewinding from a longjmp, signal handlers, etc.
423 Also used when "bifurcating" state: splitting the execution
424 path in non-standard ways (e.g. for simulating the various
425 outcomes of "realloc"). */
426
428{
429public:
430 virtual ~custom_edge_info () {}
431
432 /* Hook for making .dot label more readable. */
433 virtual void print (pretty_printer *pp) const = 0;
434
435 virtual void
436 get_dot_attrs (const char *&out_style,
437 const char *&out_color) const;
438
439 /* Hook for updating STATE when handling bifurcation. */
441 const exploded_edge *eedge,
442 region_model_context *ctxt) const;
443
444 /* Hook for updating MODEL within exploded_path::feasible_p
445 and when handling bifurcation. */
446 virtual bool update_model (region_model *model,
447 const exploded_edge *eedge,
448 region_model_context *ctxt) const = 0;
449
450 virtual void add_events_to_path (checker_path *emission_path,
451 const exploded_edge &eedge,
453 const state_transition *state_trans) const = 0;
454
456 const program_point &point,
458 exploded_node *enode_for_diag,
459 region_model_context *ctxt) const;
460
461 virtual bool
463 {
464 return false;
465 }
466};
467
468/* Abstract base class for splitting state.
469
470 Most of the state-management code in the analyzer involves
471 modifying state objects in-place, which assumes a single outcome.
472
473 This class provides an escape hatch to allow for multiple outcomes
474 for such updates e.g. for modelling multiple outcomes from function
475 calls, such as the various outcomes of "realloc". */
476
478{
479public:
480 virtual ~path_context () {}
481
482 /* Hook for clients to split state with a non-standard path. */
483 virtual void bifurcate (std::unique_ptr<custom_edge_info> info) = 0;
484
485 /* Hook for clients to terminate the standard path. */
486 virtual void terminate_path () = 0;
487
488 /* Hook for clients to determine if the standard path has been
489 terminated. */
490 virtual bool terminate_path_p () const = 0;
491};
492
493extern tree get_stashed_constant_by_name (const char *name);
495
497
498extern std::unique_ptr<json::value>
500
501extern std::unique_ptr<json::value>
503
504extern std::unique_ptr<json::value>
506
507extern std::unique_ptr<json::value>
509
510extern tristate
511compare_constants (tree lhs_const, enum tree_code op, tree rhs_const);
512
513extern tree
515
516extern tree
518
519extern const svalue *
521
522extern region_offset
524
526
527} // namespace ana
528
529extern bool is_special_named_call_p (const gcall &call, const char *funcname,
530 unsigned int num_args,
531 bool look_in_std = false);
532extern bool is_named_call_p (const_tree fndecl, const char *funcname);
533extern bool is_named_call_p (const_tree fndecl, const char *funcname,
534 const gcall &call, unsigned int num_args);
535extern bool is_std_function_p (const_tree fndecl);
536extern bool is_std_named_call_p (const_tree fndecl, const char *funcname);
537extern bool is_std_named_call_p (const_tree fndecl, const char *funcname,
538 const gcall &call, unsigned int num_args);
539extern bool is_setjmp_call_p (const gcall &call);
540extern bool is_longjmp_call_p (const gcall &call);
541extern bool is_placement_new_p (const gcall &call);
542extern bool is_cxa_throw_p (const gcall &call);
543extern bool is_cxa_rethrow_p (const gcall &call);
544extern bool is_cxa_end_catch_p (const gcall &call);
545
546extern const char *get_user_facing_name (const gcall &call);
547
549
550extern label_text make_label_text (bool can_colorize, const char *fmt, ...);
551extern label_text make_label_text_n (bool can_colorize,
552 unsigned HOST_WIDE_INT n,
553 const char *singular_fmt,
554 const char *plural_fmt, ...);
555
556extern bool fndecl_has_gimple_body_p (tree fndecl);
557
558/* An RAII-style class for pushing/popping cfun within a scope.
559 Doing so ensures we get "In function " announcements
560 from the diagnostics subsystem. */
561
563{
564public:
565 auto_cfun (function *fun) { push_cfun (fun); }
567};
568
569/* A template for creating hash traits for a POD type. */
570
571template <typename Type>
573{
574 typedef Type value_type;
575 typedef Type compare_type;
576 static inline hashval_t hash (value_type);
577 static inline bool equal (const value_type &existing,
578 const value_type &candidate);
579 static inline void mark_deleted (Type &);
580 static inline void mark_empty (Type &);
581 static inline bool is_deleted (Type);
582 static inline bool is_empty (Type);
583};
584
585/* A hash traits class that uses member functions to implement
586 the various required ops. */
587
588template <typename Type>
590{
591 typedef Type value_type;
592 typedef Type compare_type;
593 static inline hashval_t hash (value_type v) { return v.hash (); }
594 static inline bool equal (const value_type &existing,
595 const value_type &candidate)
596 {
597 return existing == candidate;
598 }
599 static inline void mark_deleted (Type &t) { t.mark_deleted (); }
600 static inline void mark_empty (Type &t) { t.mark_empty (); }
601 static inline bool is_deleted (Type t) { return t.is_deleted (); }
602 static inline bool is_empty (Type t) { return t.is_empty (); }
603};
604
605/* A map from T::key_t to T* for use in consolidating instances of T.
606 Owns all instances of T.
607 T::key_t should have operator== and be hashable. */
608
609template <typename T>
611{
612public:
613 typedef typename T::key_t key_t;
614 typedef T instance_t;
616 typedef typename inner_map_t::iterator iterator;
617
618 /* Delete all instances of T. */
619
621 {
622 for (typename inner_map_t::iterator iter = m_inner_map.begin ();
623 iter != m_inner_map.end (); ++iter)
624 delete (*iter).second;
625 }
626
627 /* Get the instance of T for K if one exists, or nullptr. */
628
629 T *get (const key_t &k) const
630 {
631 if (instance_t **slot = const_cast<inner_map_t &> (m_inner_map).get (k))
632 return *slot;
633 return nullptr;
634 }
635
636 /* Take ownership of INSTANCE. */
637
638 void put (const key_t &k, T *instance)
639 {
640 m_inner_map.put (k, instance);
641 }
642
643 size_t elements () const { return m_inner_map.elements (); }
644
645 iterator begin () const { return m_inner_map.begin (); }
646 iterator end () const { return m_inner_map.end (); }
647
648private:
650};
651
652/* Disable -Wformat-diag; we want to be able to use pp_printf
653 for logging/dumping without complying with the rules for diagnostics. */
654#if __GNUC__ >= 10
655#pragma GCC diagnostic ignored "-Wformat-diag"
656#endif
657
658namespace gcc {
659namespace topics {
660
661/* A topic for messages relating to the analyzer. */
662
663namespace analyzer_events {
664
665/* A message published by the analyzer when the frontend finishes
666 parsing the TU, to allow it to look up pertinent items using the FE's
667 name-resolution logic. */
668
670{
672 const ana::translation_unit &m_tu;
673};
674
675/* A message published by the analyzer as it starts up, intended for
676 subsystems/plugins that want to register additional functionality
677 within the analyzer. */
678
680{
681 virtual void
682 register_state_machine (std::unique_ptr<ana::state_machine>) const = 0;
683
684 virtual void
685 register_known_function (const char *name,
686 std::unique_ptr<ana::known_function>) const = 0;
687
688 virtual ana::logger *
689 get_logger () const = 0;
690};
691
692/* A message published by the analyzer when it simulates popping a stack
693 frame. */
694
702
704
705 virtual ~subscriber () = default;
706
707 virtual void on_message (const on_tu_finished &) {}
708 virtual void on_message (const on_ana_init &) {}
709 virtual void on_message (const on_frame_popped &) {}
710};
711
712} // namespace gcc::topics::analyzer_events
713} // namespace gcc::topics
714} // namespace gcc
715
716#if !ENABLE_ANALYZER
717extern void sorry_no_analyzer ();
718#endif /* #if !ENABLE_ANALYZER */
719
720#endif /* GCC_ANALYZER_COMMON_H */
Definition analysis-plan.h:35
Definition region.h:1317
Definition constraint-manager.h:178
Definition common.h:332
virtual enum built_in_function builtin_code() const =0
const builtin_known_function * dyn_cast_builtin_kf() const final override
Definition common.h:341
tree builtin_decl() const
Definition common.h:335
Definition call-details.h:31
Definition call-summary.h:68
Definition call-summary.h:34
Definition region.h:1169
Definition checker-event.h:100
Definition checker-path.h:32
Definition svalue.h:1521
Definition constraint-manager.h:410
Definition common.h:428
virtual bool update_state(program_state *state, const exploded_edge *eedge, region_model_context *ctxt) const
virtual void get_dot_attrs(const char *&out_style, const char *&out_color) const
virtual bool try_to_rewind_data_flow(rewind_context &) const
Definition common.h:462
virtual void add_events_to_path(checker_path *emission_path, const exploded_edge &eedge, pending_diagnostic &pd, const state_transition *state_trans) const =0
virtual bool update_model(region_model *model, const exploded_edge *eedge, region_model_context *ctxt) const =0
virtual exploded_node * create_enode(exploded_graph &eg, const program_point &point, program_state &&state, exploded_node *enode_for_diag, region_model_context *ctxt) const
virtual void print(pretty_printer *pp) const =0
virtual ~custom_edge_info()
Definition common.h:430
Definition region.h:743
Definition region.h:880
Definition region-model.h:1314
Definition constraint-manager.h:240
Definition exploded-graph.h:335
Definition exploded-graph.h:794
Definition exploded-graph.h:206
Definition exploded-path.h:33
Definition program-state.h:34
Definition exploded-graph.h:943
Definition exploded-graph.h:963
Definition feasible-graph.h:84
Definition region.h:803
Definition region.h:320
Definition region.h:482
Definition exploded-graph.h:40
Definition common.h:347
bool matches_call_types_p(const call_details &) const final override
Definition common.h:349
Definition known-function-manager.h:41
Definition common.h:303
virtual void impl_call_post(const call_details &) const
Definition common.h:320
virtual void impl_call_pre(const call_details &) const
Definition common.h:316
virtual bool matches_call_types_p(const call_details &cd) const =0
virtual const builtin_known_function * dyn_cast_builtin_kf() const
Definition common.h:326
virtual ~known_function()
Definition common.h:305
virtual void check_any_preconditions(const call_details &) const
Definition common.h:311
Definition region.h:521
Definition analyzer-logging.h:36
Definition region.h:974
Definition common.h:478
virtual bool terminate_path_p() const =0
virtual void bifurcate(std::unique_ptr< custom_edge_info > info)=0
virtual void terminate_path()=0
virtual ~path_context()
Definition common.h:480
bool operator==(const path_var &other) const
Definition common.h:187
int m_stack_depth
Definition common.h:201
path_var(tree t, int stack_depth)
Definition common.h:181
void dump(pretty_printer *pp) const
tree m_tree
Definition common.h:200
Definition pending-diagnostic.h:258
Definition pending-diagnostic.h:546
Definition program-point.h:54
Definition program-state.h:224
void impl_call_pre(const call_details &cd) const override
Definition region-model-reachability.h:36
Definition region-model.h:748
Definition region-model-manager.h:32
Definition region-model.h:294
Definition common.h:217
bit_offset_t get_bit_offset() const
Definition common.h:242
bool symbolic_p() const
Definition common.h:240
const region * get_base_region() const
Definition common.h:237
bit_offset_t m_offset
Definition common.h:285
static region_offset make_byte_offset(const region *base_region, const svalue *num_bytes_sval)
const svalue * m_sym_offset
Definition common.h:286
static region_offset make_concrete(const region *base_region, bit_offset_t offset)
Definition common.h:224
void dump_to_pp(pretty_printer *pp, bool) const
region_offset()
Definition common.h:219
const svalue * calc_symbolic_byte_offset(region_model_manager *mgr) const
region_offset(const region *base_region, bit_offset_t offset, const svalue *sym_offset)
Definition common.h:279
void dump(bool) const
bool operator==(const region_offset &other) const
Definition common.h:268
const svalue & calc_symbolic_bit_offset(region_model_manager *mgr) const
const region * m_base_region
Definition common.h:284
bool get_concrete_byte_offset(byte_offset_t *out) const
Definition common.h:248
static region_offset make_symbolic(const region *base_region, const svalue *sym_offset)
Definition common.h:229
const svalue * get_symbolic_byte_offset() const
Definition common.h:259
bool concrete_p() const
Definition common.h:239
Definition region.h:127
Definition region-model.h:1254
Definition exploded-graph.h:457
Definition diagnostic-manager.h:79
Definition region.h:1068
Definition program-state.h:92
Definition checker-event.h:417
Definition sm.h:43
Definition state-purge.h:31
Definition state-purge.h:152
Definition state-purge.h:119
Definition state-transition.h:99
Definition state-transition.h:126
Definition state-transition.h:31
Definition store.h:1042
Definition store.h:923
Definition region.h:1277
Definition svalue.h:92
Definition region.h:664
Definition store.h:162
Definition region.h:1407
Definition region-model.h:223
Definition checker-event.h:931
~auto_cfun()
Definition common.h:566
auto_cfun(function *fun)
Definition common.h:565
Definition common.h:611
inner_map_t::iterator iterator
Definition common.h:616
inner_map_t m_inner_map
Definition common.h:649
T * get(const key_t &k) const
Definition common.h:629
T::key_t key_t
Definition common.h:613
~consolidation_map()
Definition common.h:620
iterator begin() const
Definition common.h:645
T instance_t
Definition common.h:614
hash_map< key_t, instance_t * > inner_map_t
Definition common.h:615
void put(const key_t &k, T *instance)
Definition common.h:638
size_t elements() const
Definition common.h:643
iterator end() const
Definition common.h:646
Definition genmatch.cc:1506
Definition graphviz.h:388
Definition hash-map.h:40
Definition hash-set.h:37
Definition pretty-print.h:241
Definition lra-spills.cc:101
Definition tristate.h:26
bool is_named_call_p(const_tree fndecl, const char *funcname)
bool is_cxa_rethrow_p(const gcall &call)
bool is_std_function_p(const_tree fndecl)
bool is_placement_new_p(const gcall &call)
bool is_setjmp_call_p(const gcall &call)
void sorry_no_analyzer()
Definition analyzer-pass.cc:104
bool is_std_named_call_p(const_tree fndecl, const char *funcname)
label_text make_label_text_n(bool can_colorize, unsigned HOST_WIDE_INT n, const char *singular_fmt, const char *plural_fmt,...)
bool is_cxa_end_catch_p(const gcall &call)
bool is_cxa_throw_p(const gcall &call)
bool fndecl_has_gimple_body_p(tree fndecl)
label_text make_label_text(bool can_colorize, const char *fmt,...)
const char * get_user_facing_name(const gcall &call)
bool is_special_named_call_p(const gcall &call, const char *funcname, unsigned int num_args, bool look_in_std=false)
void register_analyzer_pass()
bool is_longjmp_call_p(const gcall &call)
const union tree_node * const_tree
Definition coretypes.h:98
union tree_node * tree
Definition coretypes.h:97
void final(rtx_insn *first, FILE *file, int optimize_p)
Definition final.cc:2009
void push_cfun(struct function *new_cfun)
Definition function.cc:4765
void pop_cfun(void)
Definition function.cc:4791
static struct token T
Definition gengtype-parse.cc:45
static void record_type(type_p type)
Definition gengtype-state.cc:1426
built_in_function
Definition genmatch.cc:1009
tree_code
Definition genmatch.cc:1002
#define UNKNOWN_LOCATION
Definition input.h:32
location_t get_pure_location(location_t loc)
Definition input.h:183
Definition access-diagram.h:30
bool compat_types_p(tree src_type, tree dst_type)
void register_known_functions_lang_cp(known_function_manager &kfm)
void register_known_functions(known_function_manager &kfm, region_model_manager &rmm)
std::unique_ptr< json::value > byte_offset_to_json(const byte_offset_t &offset)
std::unique_ptr< json::value > bit_offset_to_json(const bit_offset_t &offset)
offset_int byte_size_t
Definition common.h:207
@ stmt
Definition checker-event.h:38
@ state_change
Definition checker-event.h:42
bool operator>(const region_offset &, const region_offset &)
offset_int bit_offset_t
Definition common.h:204
tree fixup_tree_for_diagnostic(tree)
void dump_tree(pretty_printer *pp, tree t)
bool operator>=(const region_offset &, const region_offset &)
tree get_string_cst_size(const_tree string_cst)
bool operator<(const region_offset &, const region_offset &)
void register_known_analyzer_functions(known_function_manager &kfm)
access_direction
Definition common.h:377
@ read
Definition common.h:378
@ write
Definition common.h:379
bool operator<=(const region_offset &, const region_offset &)
tree get_field_at_bit_offset(tree record_type, bit_offset_t bit_offset)
void print_expr_for_user(pretty_printer *pp, tree t)
tristate compare_constants(tree lhs_const, enum tree_code op, tree rhs_const)
tree get_stashed_constant_by_name(const char *name)
bool int_size_in_bits(const_tree type, bit_size_t *out)
std::unique_ptr< json::value > tree_to_json(tree node)
tree get_ssa_default_def(const function &fun, tree var)
std::unique_ptr< json::value > diagnostic_event_id_to_json(const diagnostics::paths::event_id_t &)
offset_int byte_offset_t
Definition common.h:206
location_t get_stmt_location(const gimple *stmt, function *fun)
const svalue * strip_types(const svalue *sval, region_model_manager &mgr)
FILE * get_or_create_any_logfile()
void dump_quoted_tree(pretty_printer *pp, tree t)
void log_stashed_constants(logger *logger)
offset_int bit_size_t
Definition common.h:205
int tree_cmp(const void *p1, const void *p2)
tree remove_ssa_names(tree expr)
tree get_diagnostic_tree_for_gassign(const gassign *)
hash_set< const svalue * > svalue_set
Definition common.h:76
void register_varargs_builtins(known_function_manager &kfm)
bool printable_expr_p(const_tree expr)
void register_known_fd_functions(known_function_manager &kfm)
int readability_comparator(const void *p1, const void *p2)
bool useful_location_p(location_t loc)
Definition common.h:169
void register_known_file_functions(known_function_manager &kfm)
void print_quoted_type(pretty_printer *pp, tree t)
Definition custom-sarif-properties/state-graphs.h:33
diagnostic_event_id_t event_id_t
Definition event-id.h:66
Definition channels.h:26
Definition constraint-manager.h:123
diagnostic_state(std::string debug_desc, const region *region_holding_value)
Definition common.h:393
bool operator!=(const diagnostic_state &other) const
Definition common.h:409
void dump_to_pp(pretty_printer *) const
bool operator==(const diagnostic_state &other) const
Definition common.h:404
std::string m_debug_desc
Definition common.h:414
const region * m_region_holding_value
Definition common.h:415
diagnostic_state()
Definition common.h:388
Definition event-loc-info.h:29
Definition pending-diagnostic.h:42
Definition region-model.h:1204
Definition diagnostic-manager.h:35
Definition exploded-graph.h:669
Definition ops.h:78
Definition tree-loop-distribution.cc:240
Definition function.h:249
Definition gimple.h:910
Definition gimple.h:355
virtual void register_state_machine(std::unique_ptr< ana::state_machine >) const =0
virtual void register_known_function(const char *name, std::unique_ptr< ana::known_function >) const =0
virtual ana::logger * get_logger() const =0
const ana::region_model * m_old_model
Definition common.h:698
const ana::svalue * m_retval
Definition common.h:699
const ana::region_model * m_new_model
Definition common.h:697
ana::region_model_context * m_ctxt
Definition common.h:700
ana::logger * m_logger
Definition common.h:671
const ana::translation_unit & m_tu
Definition common.h:672
virtual void on_message(const on_frame_popped &)
Definition common.h:709
virtual void on_message(const on_ana_init &)
Definition common.h:708
virtual void on_message(const on_tu_finished &)
Definition common.h:707
Definition gimple.h:224
Definition common.h:590
static void mark_empty(Type &t)
Definition common.h:600
static hashval_t hash(value_type v)
Definition common.h:593
Type compare_type
Definition common.h:592
Type value_type
Definition common.h:591
static bool equal(const value_type &existing, const value_type &candidate)
Definition common.h:594
static void mark_deleted(Type &t)
Definition common.h:599
static bool is_empty(Type t)
Definition common.h:602
static bool is_deleted(Type t)
Definition common.h:601
Definition ira-emit.cc:158
Definition common.h:573
static void mark_deleted(Type &)
Type compare_type
Definition common.h:575
static bool is_empty(Type)
static bool equal(const value_type &existing, const value_type &candidate)
static bool is_deleted(Type)
Type value_type
Definition common.h:574
static hashval_t hash(value_type)
static void mark_empty(Type &)
Definition genautomata.cc:669
Definition gengtype.h:252
Definition hash-traits.h:75
#define gcc_assert(EXPR)
Definition system.h:817
#define bool
Definition system.h:889
@ END_BUILTINS
Definition tree-core.h:3548
static tree candidate(unsigned uid)
Definition tree-sra.cc:326
static control_dependences * cd
Definition tree-ssa-dce.cc:105
#define NULL_TREE
Definition tree.h:318