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 diagnostics {
50namespace markup {
51
52class node;
54
55} } // namespace diagnostics:markup
56
57namespace ana {
58
59/* Forward decls of common types, with indentation to show inheritance. */
60
61class supergraph;
62class supernode;
63class superedge;
64
65class integer;
66template<typename Unit> class integer_with_unit;
67
68namespace units {
69 struct bit;
70 struct byte;
71}
72
73namespace symbolic
74{
75 template<typename ConcreteValueType>
76 class range;
77
78 class node_dump_state;
79 template <typename NodeClass> class node_set;
80
81 class node_visitor;
82 class liveness_context;
83 struct markup_context;
84
85 class node;
86 class bit_contents;
92 class bit_overlay;
95
96 template <typename ConcreteValueType>
97 class scalar;
98
99 class value_node;
100 class bit_vector;
101 class concat_bit_vector;
103 class constant_bit_vector;
104 class cropped_bit_vector;
108 class uniform_bit_vector;
109 class empty_bit_vector;
112
113 /* Top-level manager class. */
114 class node_manager;
115
116 /* Managers for specific kinds of symbolic::node. */
118 class bit_vector_manager;
119 class scalar_managers;
120 template<typename ConcreteValueType> class scalar_manager;
121
122} // namespace ana::symbolic
123
126
127class svalue;
128 class pointer_svalue;
129 class constant_svalue;
130 class unknown_svalue;
131 class poisoned_svalue;
132 class setjmp_svalue;
133 class initial_svalue;
134 class unaryop_svalue;
135 class binop_svalue;
137 class unmergeable_svalue;
138 class placeholder_svalue;
139 class widening_svalue;
140 class asm_output_svalue;
142class region;
143 class cluster_region;
144 class frame_region;
145 class function_region;
146 class label_region;
147 class decl_region;
148 class symbolic_region;
149 class element_region;
150 class offset_region;
151 class sized_region;
152 class cast_region;
153 class field_region;
154 class string_region;
155 class bit_range_region;
156 class var_arg_region;
158class conjured_purge;
159struct model_merger;
160class store;
161class region_model;
164class call_details;
167class equiv_class;
169class bounded_ranges;
171
172class setjmp_record;
173
174struct pending_location;
176class pending_note;
177class saved_diagnostic;
178struct event_loc_info;
179class checker_event;
180 class state_change_event;
181 class warning_event;
182class checker_path;
183class extrinsic_state;
184class sm_state_map;
185class call_string;
186class program_point;
187class program_state;
188class exploded_graph;
189class exploded_node;
190class exploded_edge;
193class exploded_cluster;
194class exploded_path;
195class analysis_plan;
196class state_purge_map;
199class state_change;
200class rewind_info_t;
201
202class engine;
203class state_machine;
204class logger;
205class visitor;
207class call_summary;
209struct per_function_data;
210struct interesting_t;
211class state_transition;
214class uncertainty_t;
215
216class feasible_node;
217
218class known_function;
221
222class translation_unit;
223
224/* Forward decls of functions. */
225
226extern void dump_tree (pretty_printer *pp, tree t);
231extern int readability_comparator (const void *p1, const void *p2);
232extern int tree_cmp (const void *p1, const void *p2);
236
237inline bool
238useful_location_p (location_t loc)
239{
240 return get_pure_location (loc) != UNKNOWN_LOCATION;
241}
242
243/* A tree, extended with stack frame information for locals, so that
244 we can distinguish between different values of locals within a potentially
245 recursive callstack. */
246
248{
249public:
250 path_var (tree t, int stack_depth)
251 : m_tree (t), m_stack_depth (stack_depth)
252 {
253 // TODO: ignore stack depth for globals and constants
254 }
255
256 bool operator== (const path_var &other) const
257 {
258 return (m_tree == other.m_tree
259 && m_stack_depth == other.m_stack_depth);
260 }
261
262 operator bool () const
263 {
264 return m_tree != NULL_TREE;
265 }
266
267 void dump (pretty_printer *pp) const;
268
270 int m_stack_depth; // or -1 for globals?
271};
272
273typedef offset_int bit_offset_t;
274typedef offset_int bit_size_t;
275typedef offset_int byte_offset_t;
276typedef offset_int byte_size_t;
277
279
280extern bool
282 enum tree_code op,
284
285extern int
287
288extern location_t get_stmt_location (const gimple *stmt, function *fun);
289
290extern bool compat_types_p (tree src_type, tree dst_type);
291
292/* Abstract base class for simulating the behavior of known functions,
293 supplied by the core of the analyzer, or by plugins.
294 The former are typically implemented in the various kf*.cc */
295
297{
298public:
299 virtual ~known_function () {}
300 virtual bool matches_call_types_p (const call_details &cd) const = 0;
301
302 /* A hook for performing additional checks on the expected state
303 at a call. */
304 virtual void
306 {
307 // no-op
308 }
309
310 virtual void impl_call_pre (const call_details &) const
311 {
312 return;
313 }
314 virtual void impl_call_post (const call_details &) const
315 {
316 return;
317 }
318
319 virtual const builtin_known_function *
320 dyn_cast_builtin_kf () const { return nullptr; }
321};
322
323/* Subclass of known_function for builtin functions. */
324
326{
327public:
328 virtual enum built_in_function builtin_code () const = 0;
331 return builtin_info[builtin_code ()].decl;
332 }
333
335 dyn_cast_builtin_kf () const final override { return this; }
336};
337
338/* Subclass of known_function for IFN_* functions. */
339
341{
342public:
343 bool matches_call_types_p (const call_details &) const final override
344 {
345 /* Types are assumed to be correct. */
346 return true;
347 }
348};
349
350/* Abstract subclass of known_function that merely sets the return
351 value of the function (based on function attributes), and assumes
352 it has no side-effects. */
353
355{
356public:
357 void impl_call_pre (const call_details &cd) const override;
358};
359
367
368/* An enum for describing the direction of an access to memory. */
369
371{
374};
375
376/* State tracked along an execution path that's pertinent to a specific
377 diagnostic (e.g. for a divide-by-zero warning where the zero value
378 comes from). */
379
381{
383 : m_region_holding_value (nullptr)
384 {
385 }
386
387 diagnostic_state (std::string debug_desc,
388 const region *region_holding_value)
389 : m_debug_desc (std::move (debug_desc)),
390 m_region_holding_value (region_holding_value)
391 {
392 }
393
395 void dump () const;
396
397 bool
398 operator== (const diagnostic_state &other) const
399 {
400 return m_region_holding_value == other.m_region_holding_value;
401 }
402 bool
403 operator!= (const diagnostic_state &other) const
404 {
405 return !(*this == other);
406 }
407
408 std::string m_debug_desc;
410};
411
412struct rewind_context;
413
414/* Abstract base class for associating custom data with an
415 exploded_edge, for handling non-standard edges such as
416 rewinding from a longjmp, signal handlers, etc.
417 Also used when "bifurcating" state: splitting the execution
418 path in non-standard ways (e.g. for simulating the various
419 outcomes of "realloc"). */
420
422{
423public:
424 virtual ~custom_edge_info () {}
425
426 /* Hook for making .dot label more readable. */
427 virtual void print (pretty_printer *pp) const = 0;
428
429 virtual void
430 get_dot_attrs (const char *&out_style,
431 const char *&out_color) const;
432
433 /* Hook for updating STATE when handling bifurcation. */
435 const exploded_edge *eedge,
436 region_model_context *ctxt) const;
437
438 /* Hook for updating MODEL within exploded_path::feasible_p
439 and when handling bifurcation. */
440 virtual bool update_model (region_model *model,
441 const exploded_edge *eedge,
442 region_model_context *ctxt) const = 0;
443
444 virtual void add_events_to_path (checker_path *emission_path,
445 const exploded_edge &eedge,
447 const state_transition *state_trans) const = 0;
448
450 const program_point &point,
452 exploded_node *enode_for_diag,
453 region_model_context *ctxt) const;
454
455 virtual bool
457 {
458 return false;
459 }
460};
461
462/* Abstract base class for splitting state.
463
464 Most of the state-management code in the analyzer involves
465 modifying state objects in-place, which assumes a single outcome.
466
467 This class provides an escape hatch to allow for multiple outcomes
468 for such updates e.g. for modelling multiple outcomes from function
469 calls, such as the various outcomes of "realloc". */
470
472{
473public:
474 virtual ~path_context () {}
475
476 /* Hook for clients to split state with a non-standard path. */
477 virtual void bifurcate (std::unique_ptr<custom_edge_info> info) = 0;
478
479 /* Hook for clients to terminate the standard path. */
480 virtual void terminate_path () = 0;
481
482 /* Hook for clients to determine if the standard path has been
483 terminated. */
484 virtual bool terminate_path_p () const = 0;
485};
486
487extern tree get_stashed_constant_by_name (const char *name);
489
491
492extern std::unique_ptr<json::value>
494
495extern std::unique_ptr<json::value>
497
498extern std::unique_ptr<json::value>
500
501extern std::unique_ptr<json::value>
503
504extern tristate
505compare_constants (tree lhs_const, enum tree_code op, tree rhs_const);
506
507extern tree
509
510extern tree
512
513extern const svalue *
515
517
518/* An enum describing a particular kind of "poisoned" value. */
519
520enum class poison_kind
521{
522 /* For use to describe uninitialized memory. */
524
525 /* For use to describe freed memory. */
527
528 /* For use to describe deleted memory. */
530
531 /* For use on pointers to regions within popped stack frames. */
533
534 /* Placeholder value (e.g. for string_scan when we don't have
535 a poison_kind). */
537};
538
539extern const char *
541
542/* An enum for discriminating different baseline states,
543 for determining the implicit contents of base regions
544 that don't have their contents explicitly tracked. */
545
547{
548 /* Analysis is on a direct path from entry to "main", so
549 the implicit contents of a global variable is that of
550 its initializer (or 0). */
552
553 /* Analysis is on an entrypoint that isn't on "main", so
554 the implicit contents of a global variable is its initial_svalue. */
556};
557
558extern const char *
560
561/* An enum for tracking the state of an iteration. */
562
563enum class iter_result
564{
567};
568
569extern void
571 tree type,
572 auto_vec<path_var> *out_pvs);
573
574} // namespace ana
575
576extern bool is_special_named_call_p (const gcall &call, const char *funcname,
577 unsigned int num_args,
578 bool look_in_std = false);
579extern bool is_named_call_p (const_tree fndecl, const char *funcname);
580extern bool is_named_call_p (const_tree fndecl, const char *funcname,
581 const gcall &call, unsigned int num_args);
582extern bool is_std_function_p (const_tree fndecl);
583extern bool is_cxxabi_function_p (const_tree fndecl);
584extern bool is_std_named_call_p (const_tree fndecl, const char *funcname);
585extern bool is_std_named_call_p (const_tree fndecl, const char *funcname,
586 const gcall &call, unsigned int num_args);
587extern bool is_setjmp_call_p (const gcall &call);
588extern bool is_longjmp_call_p (const gcall &call);
589extern bool is_placement_new_p (const gcall &call);
590extern bool is_cxa_throw_p (const gcall &call);
591extern bool is_cxa_rethrow_p (const gcall &call);
592extern bool is_cxa_end_catch_p (const gcall &call);
593
594extern const char *get_user_facing_name (const gcall &call);
595
597
598extern label_text make_label_text (bool can_colorize, const char *fmt, ...);
599extern label_text make_label_text_n (bool can_colorize,
600 unsigned HOST_WIDE_INT n,
601 const char *singular_fmt,
602 const char *plural_fmt, ...);
603
604extern bool fndecl_has_gimple_body_p (tree fndecl);
605
606/* An RAII-style class for pushing/popping cfun within a scope.
607 Doing so ensures we get "In function " announcements
608 from the diagnostics subsystem. */
609
611{
612public:
613 auto_cfun (function *fun) { push_cfun (fun); }
615};
616
617/* A template for creating hash traits for a POD type. */
618
619template <typename Type>
621{
622 typedef Type value_type;
623 typedef Type compare_type;
624 static inline hashval_t hash (value_type);
625 static inline bool equal (const value_type &existing,
626 const value_type &candidate);
627 static inline void mark_deleted (Type &);
628 static inline void mark_empty (Type &);
629 static inline bool is_deleted (Type);
630 static inline bool is_empty (Type);
631};
632
633/* A hash traits class that uses member functions to implement
634 the various required ops. */
635
636template <typename Type>
638{
639 typedef Type value_type;
640 typedef Type compare_type;
641 static inline hashval_t hash (value_type v) { return v.hash (); }
642 static inline bool equal (const value_type &existing,
643 const value_type &candidate)
644 {
645 return existing == candidate;
646 }
647 static inline void mark_deleted (Type &t) { t.mark_deleted (); }
648 static inline void mark_empty (Type &t) { t.mark_empty (); }
649 static inline bool is_deleted (Type t) { return t.is_deleted (); }
650 static inline bool is_empty (Type t) { return t.is_empty (); }
651};
652
653/* A map from T::key_t to T* for use in consolidating instances of T.
654 Owns all instances of T.
655 T::key_t should have operator== and be hashable. */
656
657template <typename T>
659{
660public:
661 typedef typename T::key_t key_t;
662 typedef T instance_t;
664 typedef typename inner_map_t::iterator iterator;
665
666 /* Delete all instances of T. */
667
669 {
670 for (typename inner_map_t::iterator iter = m_inner_map.begin ();
671 iter != m_inner_map.end (); ++iter)
672 delete (*iter).second;
673 }
674
675 /* Get the instance of T for K if one exists, or nullptr. */
676
677 T *get (const key_t &k) const
678 {
679 if (instance_t **slot = const_cast<inner_map_t &> (m_inner_map).get (k))
680 return *slot;
681 return nullptr;
682 }
683
684 /* Take ownership of INSTANCE. */
685
686 void put (const key_t &k, T *instance)
687 {
688 m_inner_map.put (k, instance);
689 }
690
691 size_t elements () const { return m_inner_map.elements (); }
692
693 iterator begin () const { return m_inner_map.begin (); }
694 iterator end () const { return m_inner_map.end (); }
695
696private:
698};
699
700/* Disable -Wformat-diag; we want to be able to use pp_printf
701 for logging/dumping without complying with the rules for diagnostics. */
702#if __GNUC__ >= 10
703#pragma GCC diagnostic ignored "-Wformat-diag"
704#endif
705
706namespace gcc {
707namespace topics {
708
709/* A topic for messages relating to the analyzer. */
710
711namespace analyzer_events {
712
713/* A message published by the analyzer when the frontend finishes
714 parsing the TU, to allow it to look up pertinent items using the FE's
715 name-resolution logic. */
716
718{
720 const ana::translation_unit &m_tu;
721};
722
723/* A message published by the analyzer as it starts up, intended for
724 subsystems/plugins that want to register additional functionality
725 within the analyzer. */
726
728{
729 virtual void
730 register_state_machine (std::unique_ptr<ana::state_machine>) const = 0;
731
732 virtual void
733 register_known_function (const char *name,
734 std::unique_ptr<ana::known_function>) const = 0;
735
736 virtual ana::logger *
737 get_logger () const = 0;
738};
739
740/* A message published by the analyzer when it simulates popping a stack
741 frame. */
742
750
751/* A message published by the analyzer when it has finished and is about
752 to clean up. */
753
759
761
762 virtual ~subscriber () = default;
763
764 virtual void on_message (const on_tu_finished &) {}
765 virtual void on_message (const on_ana_init &) {}
766 virtual void on_message (const on_frame_popped &) {}
767 virtual void on_message (const on_ana_done &) {}
768};
769
770} // namespace gcc::topics::analyzer_events
771} // namespace gcc::topics
772} // namespace gcc
773
774#if !ENABLE_ANALYZER
775extern void sorry_no_analyzer ();
776#endif /* #if !ENABLE_ANALYZER */
777
778#endif /* GCC_ANALYZER_COMMON_H */
void sorry_no_analyzer()
Definition analyzer-pass.cc:104
Definition analysis-plan.h:35
Definition svalue.h:1170
Definition svalue.h:745
Definition region.h:1483
Definition constraint-manager.h:178
Definition common.h:326
virtual enum built_in_function builtin_code() const =0
const builtin_known_function * dyn_cast_builtin_kf() const final override
Definition common.h:335
tree builtin_decl() const
Definition common.h:329
Definition call-details.h:32
Definition call-string.h:44
Definition call-summary.h:68
Definition call-summary.h:34
Definition region.h:1292
Definition checker-event.h:100
Definition checker-path.h:32
Definition region.h:537
Definition symbolic-nodes.h:585
Definition svalue.h:1301
Definition svalue.h:309
Definition constraint-manager.h:410
Definition common.h:422
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:456
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:424
Definition region.h:792
Definition region.h:965
Definition region-model.h:1410
Definition constraint-manager.h:240
Definition exploded-graph.h:350
Definition exploded-graph.h:809
Definition exploded-graph.h:221
Definition exploded-path.h:33
Definition program-state.h:34
Definition exploded-graph.h:964
Definition exploded-graph.h:992
Definition feasible-graph.h:84
Definition region.h:872
Definition region.h:406
Definition region.h:570
Definition exploded-graph.h:40
Definition svalue.h:607
Definition common.h:341
bool matches_call_types_p(const call_details &) const final override
Definition common.h:343
Definition known-function-manager.h:41
Definition common.h:297
virtual void impl_call_post(const call_details &) const
Definition common.h:314
virtual void impl_call_pre(const call_details &) const
Definition common.h:310
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:320
virtual ~known_function()
Definition common.h:299
virtual void check_any_preconditions(const call_details &) const
Definition common.h:305
Definition region.h:619
Definition analyzer-logging.h:36
Definition region.h:1076
Definition common.h:472
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:474
Definition common.h:248
bool operator==(const path_var &other) const
Definition common.h:256
int m_stack_depth
Definition common.h:270
path_var(tree t, int stack_depth)
Definition common.h:250
void dump(pretty_printer *pp) const
tree m_tree
Definition common.h:269
Definition pending-diagnostic.h:258
Definition pending-diagnostic.h:548
Definition svalue.h:1005
Definition svalue.h:219
Definition svalue.h:425
Definition program-point.h:54
Definition program-state.h:239
void impl_call_pre(const call_details &cd) const override
Definition region-model-reachability.h:36
Definition region-model.h:838
Definition region-model-manager.h:36
Definition region-model.h:289
Definition region.h:154
Definition region-model.h:1343
Definition exploded-graph.h:472
Definition diagnostic-manager.h:79
Definition svalue.h:528
Definition region.h:1186
Definition program-state.h:98
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:709
Definition region.h:1435
Definition svalue.h:844
Definition svalue.h:82
Definition symbolic-bit-contents.h:517
Definition symbolic-bit-contents.h:1072
Definition symbolic-bit-contents.h:68
Definition symbolic-bit-contents.h:714
Definition symbolic-bit-vectors.h:899
Definition symbolic-bit-vectors.h:990
Definition symbolic-bit-vectors.h:1128
Definition symbolic-bit-vectors.h:107
Definition symbolic-bit-vectors.h:315
Definition symbolic-bit-contents.h:749
Definition symbolic-bit-contents.h:579
Definition symbolic-bit-vectors.h:405
Definition symbolic-bit-vectors.h:511
Definition symbolic-bit-vectors.h:689
Definition liveness-context.h:33
Definition symbolic-nodes.h:48
Definition symbolic-nodes.h:224
Definition symbolic-nodes.h:502
Definition symbolic-bit-contents.h:979
Definition symbolic-bit-vectors.h:733
Definition symbolic-ranges.h:32
Definition symbolic-bit-vectors.h:814
Definition symbolic-scalars.h:660
Definition symbolic-scalars.h:759
Definition symbolic-scalars.h:67
Definition symbolic-bit-contents.h:884
Definition symbolic-bit-vectors.h:1054
Definition symbolic-bit-contents.h:476
Definition symbolic-bit-contents.h:230
Definition symbolic-bit-vectors.h:667
Definition symbolic-nodes.h:468
Definition region.h:699
Definition type.h:29
Definition svalue.h:662
Definition store.h:357
Definition svalue.h:390
Definition svalue.h:951
Definition region.h:1592
Definition region-model.h:222
Definition checker-event.h:931
Definition svalue.h:1062
~auto_cfun()
Definition common.h:614
auto_cfun(function *fun)
Definition common.h:613
Definition vec.h:1667
Definition common.h:659
inner_map_t::iterator iterator
Definition common.h:664
inner_map_t m_inner_map
Definition common.h:697
T * get(const key_t &k) const
Definition common.h:677
T::key_t key_t
Definition common.h:661
~consolidation_map()
Definition common.h:668
iterator begin() const
Definition common.h:693
T instance_t
Definition common.h:662
hash_map< key_t, instance_t * > inner_map_t
Definition common.h:663
void put(const key_t &k, T *instance)
Definition common.h:686
size_t elements() const
Definition common.h:691
iterator end() const
Definition common.h:694
Definition genmatch.cc:1627
Definition graphviz.h:388
Definition hash-map.h:40
iterator begin() const
Definition hash-map.h:302
size_t elements() const
Definition hash-map.h:247
iterator end() const
Definition hash-map.h:303
bool put(const Key &k, const Value &v)
Definition hash-map.h:168
Definition pretty-print.h:241
Definition lra-spills.cc:101
Definition tristate.h:26
int main(int argc, char **argv)
Definition collect2.cc:770
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)
bool is_std_named_call_p(const_tree fndecl, const char *funcname)
bool is_cxxabi_function_p(const_tree fndecl)
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:2004
void push_cfun(struct function *new_cfun)
Definition function.cc:4853
void pop_cfun(void)
Definition function.cc:4879
built_in_function
Definition genmatch.cc:1018
tree_code
Definition genmatch.cc:1011
#define UNKNOWN_LOCATION
Definition input.h:32
location_t get_pure_location(location_t loc)
Definition input.h:183
Definition common.h:74
Definition common.h:68
Definition access-diagram.h:30
bool compat_types_p(tree src_type, tree dst_type)
void append_pathvar_with_type(path_var pv, tree type, auto_vec< path_var > *out_pvs)
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:276
const char * baseline_state_to_str(baseline_state)
@ state_change
Definition checker-event.h:42
offset_int bit_offset_t
Definition common.h:273
tree fixup_tree_for_diagnostic(tree)
symbolic::range< integer_with_unit< units::bit > > symbolic_bit_range
Definition common.h:124
void dump_tree(pretty_printer *pp, tree t)
tree get_string_cst_size(const_tree string_cst)
void register_known_analyzer_functions(known_function_manager &kfm)
access_direction
Definition common.h:371
@ read
Definition common.h:372
@ write
Definition common.h:373
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)
int cmp_csts_and_types(const_tree cst1, const_tree cst2)
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 &)
poison_kind
Definition common.h:521
@ uninit
Definition common.h:523
@ freed
Definition common.h:526
@ other
Definition common.h:536
@ popped_stack
Definition common.h:532
@ deleted
Definition common.h:529
offset_int byte_offset_t
Definition common.h:275
iter_result
Definition common.h:564
@ keep_going
Definition common.h:565
@ stop
Definition common.h:566
symbolic::range< integer_with_unit< units::byte > > symbolic_byte_range
Definition common.h:125
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)
baseline_state
Definition common.h:547
@ after_main
Definition common.h:555
const char * poison_kind_to_str(enum poison_kind)
void log_stashed_constants(logger *logger)
offset_int bit_size_t
Definition common.h:274
int tree_cmp(const void *p1, const void *p2)
tree remove_ssa_names(tree expr)
tree get_diagnostic_tree_for_gassign(const gassign *)
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 compare_bit_offsets_p(bit_offset_t a, enum tree_code op, bit_offset_t b)
bool useful_location_p(location_t loc)
Definition common.h:238
int cmp_types(const_tree a, const_tree b)
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
Definition common.h:50
diagnostic_event_id_t event_id_t
Definition event-id.h:66
Definition cfghooks.h:26
Definition channels.h:26
Ca const poly_int< N, Cb > & b
Definition poly-int.h:771
Ca & a
Definition poly-int.h:770
Definition constraint-manager.h:123
diagnostic_state(std::string debug_desc, const region *region_holding_value)
Definition common.h:387
bool operator!=(const diagnostic_state &other) const
Definition common.h:403
void dump_to_pp(pretty_printer *) const
bool operator==(const diagnostic_state &other) const
Definition common.h:398
std::string m_debug_desc
Definition common.h:408
const region * m_region_holding_value
Definition common.h:409
diagnostic_state()
Definition common.h:382
Definition event-loc-info.h:29
Definition pending-diagnostic.h:42
Definition region-model.h:1293
Definition diagnostic-manager.h:35
Definition exploded-graph.h:684
Definition ops.h:78
Definition svalue.h:500
Definition symbolic-nodes.h:88
Definition symbolic-nodes.h:276
Definition units.h:34
Definition units.h:47
Definition tree-loop-distribution.cc:240
Definition function.h:249
Definition gimple.h:911
Definition gimple.h:356
const ana::engine & m_engine
Definition common.h:756
const ana::exploded_graph & m_eg
Definition common.h:757
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:746
const ana::svalue * m_retval
Definition common.h:747
const ana::region_model * m_new_model
Definition common.h:745
ana::region_model_context * m_ctxt
Definition common.h:748
ana::logger * m_logger
Definition common.h:719
const ana::translation_unit & m_tu
Definition common.h:720
virtual void on_message(const on_frame_popped &)
Definition common.h:766
virtual void on_message(const on_ana_init &)
Definition common.h:765
virtual void on_message(const on_tu_finished &)
Definition common.h:764
virtual void on_message(const on_ana_done &)
Definition common.h:767
Definition gimple.h:225
Definition common.h:638
static void mark_empty(Type &t)
Definition common.h:648
static hashval_t hash(value_type v)
Definition common.h:641
Type compare_type
Definition common.h:640
Type value_type
Definition common.h:639
static bool equal(const value_type &existing, const value_type &candidate)
Definition common.h:642
static void mark_deleted(Type &t)
Definition common.h:647
static bool is_empty(Type t)
Definition common.h:650
static bool is_deleted(Type t)
Definition common.h:649
Definition ira-emit.cc:158
Definition common.h:621
static void mark_deleted(Type &)
Type compare_type
Definition common.h:623
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:622
static hashval_t hash(value_type)
static void mark_empty(Type &)
Definition genautomata.cc:669
Definition hash-traits.h:75
#define gcc_assert(EXPR)
Definition system.h:758
#define bool
Definition system.h:830
@ END_BUILTINS
Definition tree-core.h:3619
#define NULL_TREE
Definition tree.h:328