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 frame_region;
144 class function_region;
145 class label_region;
146 class decl_region;
147 class symbolic_region;
148 class element_region;
149 class offset_region;
150 class sized_region;
151 class cast_region;
152 class field_region;
153 class string_region;
154 class bit_range_region;
155 class var_arg_region;
157class conjured_purge;
158struct model_merger;
159class store;
160class region_model;
163class call_details;
166class equiv_class;
168class bounded_ranges;
170
171class setjmp_record;
172
173struct pending_location;
175class pending_note;
176class saved_diagnostic;
177struct event_loc_info;
178class checker_event;
179 class state_change_event;
180 class warning_event;
181class checker_path;
182class extrinsic_state;
183class sm_state_map;
184class call_string;
185class program_point;
186class program_state;
187class exploded_graph;
188class exploded_node;
189class exploded_edge;
192class exploded_cluster;
193class exploded_path;
194class analysis_plan;
195class state_purge_map;
198class state_change;
199class rewind_info_t;
200
201class engine;
202class state_machine;
203class logger;
204class visitor;
206class call_summary;
208struct per_function_data;
209struct interesting_t;
210class state_transition;
213class uncertainty_t;
214
215class feasible_node;
216
217class known_function;
220
221class translation_unit;
222
223/* Forward decls of functions. */
224
225extern void dump_tree (pretty_printer *pp, tree t);
230extern int readability_comparator (const void *p1, const void *p2);
231extern int tree_cmp (const void *p1, const void *p2);
235
236inline bool
237useful_location_p (location_t loc)
238{
239 return get_pure_location (loc) != UNKNOWN_LOCATION;
240}
241
242/* A tree, extended with stack frame information for locals, so that
243 we can distinguish between different values of locals within a potentially
244 recursive callstack. */
245
247{
248public:
249 path_var (tree t, int stack_depth)
250 : m_tree (t), m_stack_depth (stack_depth)
251 {
252 // TODO: ignore stack depth for globals and constants
253 }
254
255 bool operator== (const path_var &other) const
256 {
257 return (m_tree == other.m_tree
258 && m_stack_depth == other.m_stack_depth);
259 }
260
261 operator bool () const
262 {
263 return m_tree != NULL_TREE;
264 }
265
266 void dump (pretty_printer *pp) const;
267
269 int m_stack_depth; // or -1 for globals?
270};
271
272typedef offset_int bit_offset_t;
273typedef offset_int bit_size_t;
274typedef offset_int byte_offset_t;
275typedef offset_int byte_size_t;
276
278
279extern bool
281 enum tree_code op,
283
284extern int
286
287extern location_t get_stmt_location (const gimple *stmt, function *fun);
288
289extern bool compat_types_p (tree src_type, tree dst_type);
290
291/* Abstract base class for simulating the behavior of known functions,
292 supplied by the core of the analyzer, or by plugins.
293 The former are typically implemented in the various kf*.cc */
294
296{
297public:
298 virtual ~known_function () {}
299 virtual bool matches_call_types_p (const call_details &cd) const = 0;
300
301 /* A hook for performing additional checks on the expected state
302 at a call. */
303 virtual void
305 {
306 // no-op
307 }
308
309 virtual void impl_call_pre (const call_details &) const
310 {
311 return;
312 }
313 virtual void impl_call_post (const call_details &) const
314 {
315 return;
316 }
317
318 virtual const builtin_known_function *
319 dyn_cast_builtin_kf () const { return nullptr; }
320};
321
322/* Subclass of known_function for builtin functions. */
323
325{
326public:
327 virtual enum built_in_function builtin_code () const = 0;
330 return builtin_info[builtin_code ()].decl;
331 }
332
334 dyn_cast_builtin_kf () const final override { return this; }
335};
336
337/* Subclass of known_function for IFN_* functions. */
338
340{
341public:
342 bool matches_call_types_p (const call_details &) const final override
343 {
344 /* Types are assumed to be correct. */
345 return true;
346 }
347};
348
349/* Abstract subclass of known_function that merely sets the return
350 value of the function (based on function attributes), and assumes
351 it has no side-effects. */
352
354{
355public:
356 void impl_call_pre (const call_details &cd) const override;
357};
358
366
367/* An enum for describing the direction of an access to memory. */
368
370{
373};
374
375/* State tracked along an execution path that's pertinent to a specific
376 diagnostic (e.g. for a divide-by-zero warning where the zero value
377 comes from). */
378
380{
382 : m_region_holding_value (nullptr)
383 {
384 }
385
386 diagnostic_state (std::string debug_desc,
387 const region *region_holding_value)
388 : m_debug_desc (std::move (debug_desc)),
389 m_region_holding_value (region_holding_value)
390 {
391 }
392
394 void dump () const;
395
396 bool
397 operator== (const diagnostic_state &other) const
398 {
399 return m_region_holding_value == other.m_region_holding_value;
400 }
401 bool
402 operator!= (const diagnostic_state &other) const
403 {
404 return !(*this == other);
405 }
406
407 std::string m_debug_desc;
409};
410
411struct rewind_context;
412
413/* Abstract base class for associating custom data with an
414 exploded_edge, for handling non-standard edges such as
415 rewinding from a longjmp, signal handlers, etc.
416 Also used when "bifurcating" state: splitting the execution
417 path in non-standard ways (e.g. for simulating the various
418 outcomes of "realloc"). */
419
421{
422public:
423 virtual ~custom_edge_info () {}
424
425 /* Hook for making .dot label more readable. */
426 virtual void print (pretty_printer *pp) const = 0;
427
428 virtual void
429 get_dot_attrs (const char *&out_style,
430 const char *&out_color) const;
431
432 /* Hook for updating STATE when handling bifurcation. */
434 const exploded_edge *eedge,
435 region_model_context *ctxt) const;
436
437 /* Hook for updating MODEL within exploded_path::feasible_p
438 and when handling bifurcation. */
439 virtual bool update_model (region_model *model,
440 const exploded_edge *eedge,
441 region_model_context *ctxt) const = 0;
442
443 virtual void add_events_to_path (checker_path *emission_path,
444 const exploded_edge &eedge,
446 const state_transition *state_trans) const = 0;
447
449 const program_point &point,
451 exploded_node *enode_for_diag,
452 region_model_context *ctxt) const;
453
454 virtual bool
456 {
457 return false;
458 }
459};
460
461/* Abstract base class for splitting state.
462
463 Most of the state-management code in the analyzer involves
464 modifying state objects in-place, which assumes a single outcome.
465
466 This class provides an escape hatch to allow for multiple outcomes
467 for such updates e.g. for modelling multiple outcomes from function
468 calls, such as the various outcomes of "realloc". */
469
471{
472public:
473 virtual ~path_context () {}
474
475 /* Hook for clients to split state with a non-standard path. */
476 virtual void bifurcate (std::unique_ptr<custom_edge_info> info) = 0;
477
478 /* Hook for clients to terminate the standard path. */
479 virtual void terminate_path () = 0;
480
481 /* Hook for clients to determine if the standard path has been
482 terminated. */
483 virtual bool terminate_path_p () const = 0;
484};
485
486extern tree get_stashed_constant_by_name (const char *name);
488
490
491extern std::unique_ptr<json::value>
493
494extern std::unique_ptr<json::value>
496
497extern std::unique_ptr<json::value>
499
500extern std::unique_ptr<json::value>
502
503extern tristate
504compare_constants (tree lhs_const, enum tree_code op, tree rhs_const);
505
506extern tree
508
509extern tree
511
512extern const svalue *
514
516
517/* An enum describing a particular kind of "poisoned" value. */
518
519enum class poison_kind
520{
521 /* For use to describe uninitialized memory. */
523
524 /* For use to describe freed memory. */
526
527 /* For use to describe deleted memory. */
529
530 /* For use on pointers to regions within popped stack frames. */
532
533 /* Placeholder value (e.g. for string_scan when we don't have
534 a poison_kind). */
536};
537
538extern const char *
540
541/* An enum for discriminating different baseline states,
542 for determining the implicit contents of base regions
543 that don't have their contents explicitly tracked. */
544
546{
547 /* Analysis is on a direct path from entry to "main", so
548 the implicit contents of a global variable is that of
549 its initializer (or 0). */
551
552 /* Analysis is on an entrypoint that isn't on "main", so
553 the implicit contents of a global variable is its initial_svalue. */
555};
556
557extern const char *
559
560/* An enum for tracking the state of an iteration. */
561
562enum class iter_result
563{
566};
567
568extern void
570 tree type,
571 auto_vec<path_var> *out_pvs);
572
573} // namespace ana
574
575extern bool is_special_named_call_p (const gcall &call, const char *funcname,
576 unsigned int num_args,
577 bool look_in_std = false);
578extern bool is_named_call_p (const_tree fndecl, const char *funcname);
579extern bool is_named_call_p (const_tree fndecl, const char *funcname,
580 const gcall &call, unsigned int num_args);
581extern bool is_std_function_p (const_tree fndecl);
582extern bool is_cxxabi_function_p (const_tree fndecl);
583extern bool is_std_named_call_p (const_tree fndecl, const char *funcname);
584extern bool is_std_named_call_p (const_tree fndecl, const char *funcname,
585 const gcall &call, unsigned int num_args);
586extern bool is_setjmp_call_p (const gcall &call);
587extern bool is_longjmp_call_p (const gcall &call);
588extern bool is_placement_new_p (const gcall &call);
589extern bool is_cxa_throw_p (const gcall &call);
590extern bool is_cxa_rethrow_p (const gcall &call);
591extern bool is_cxa_end_catch_p (const gcall &call);
592
593extern const char *get_user_facing_name (const gcall &call);
594
596
597extern label_text make_label_text (bool can_colorize, const char *fmt, ...);
598extern label_text make_label_text_n (bool can_colorize,
599 unsigned HOST_WIDE_INT n,
600 const char *singular_fmt,
601 const char *plural_fmt, ...);
602
603extern bool fndecl_has_gimple_body_p (tree fndecl);
604
605/* An RAII-style class for pushing/popping cfun within a scope.
606 Doing so ensures we get "In function " announcements
607 from the diagnostics subsystem. */
608
610{
611public:
612 auto_cfun (function *fun) { push_cfun (fun); }
614};
615
616/* A template for creating hash traits for a POD type. */
617
618template <typename Type>
620{
621 typedef Type value_type;
622 typedef Type compare_type;
623 static inline hashval_t hash (value_type);
624 static inline bool equal (const value_type &existing,
625 const value_type &candidate);
626 static inline void mark_deleted (Type &);
627 static inline void mark_empty (Type &);
628 static inline bool is_deleted (Type);
629 static inline bool is_empty (Type);
630};
631
632/* A hash traits class that uses member functions to implement
633 the various required ops. */
634
635template <typename Type>
637{
638 typedef Type value_type;
639 typedef Type compare_type;
640 static inline hashval_t hash (value_type v) { return v.hash (); }
641 static inline bool equal (const value_type &existing,
642 const value_type &candidate)
643 {
644 return existing == candidate;
645 }
646 static inline void mark_deleted (Type &t) { t.mark_deleted (); }
647 static inline void mark_empty (Type &t) { t.mark_empty (); }
648 static inline bool is_deleted (Type t) { return t.is_deleted (); }
649 static inline bool is_empty (Type t) { return t.is_empty (); }
650};
651
652/* A map from T::key_t to T* for use in consolidating instances of T.
653 Owns all instances of T.
654 T::key_t should have operator== and be hashable. */
655
656template <typename T>
658{
659public:
660 typedef typename T::key_t key_t;
661 typedef T instance_t;
663 typedef typename inner_map_t::iterator iterator;
664
665 /* Delete all instances of T. */
666
668 {
669 for (typename inner_map_t::iterator iter = m_inner_map.begin ();
670 iter != m_inner_map.end (); ++iter)
671 delete (*iter).second;
672 }
673
674 /* Get the instance of T for K if one exists, or nullptr. */
675
676 T *get (const key_t &k) const
677 {
678 if (instance_t **slot = const_cast<inner_map_t &> (m_inner_map).get (k))
679 return *slot;
680 return nullptr;
681 }
682
683 /* Take ownership of INSTANCE. */
684
685 void put (const key_t &k, T *instance)
686 {
687 m_inner_map.put (k, instance);
688 }
689
690 size_t elements () const { return m_inner_map.elements (); }
691
692 iterator begin () const { return m_inner_map.begin (); }
693 iterator end () const { return m_inner_map.end (); }
694
695private:
697};
698
699/* Disable -Wformat-diag; we want to be able to use pp_printf
700 for logging/dumping without complying with the rules for diagnostics. */
701#if __GNUC__ >= 10
702#pragma GCC diagnostic ignored "-Wformat-diag"
703#endif
704
705namespace gcc {
706namespace topics {
707
708/* A topic for messages relating to the analyzer. */
709
710namespace analyzer_events {
711
712/* A message published by the analyzer when the frontend finishes
713 parsing the TU, to allow it to look up pertinent items using the FE's
714 name-resolution logic. */
715
717{
719 const ana::translation_unit &m_tu;
720};
721
722/* A message published by the analyzer as it starts up, intended for
723 subsystems/plugins that want to register additional functionality
724 within the analyzer. */
725
727{
728 virtual void
729 register_state_machine (std::unique_ptr<ana::state_machine>) const = 0;
730
731 virtual void
732 register_known_function (const char *name,
733 std::unique_ptr<ana::known_function>) const = 0;
734
735 virtual ana::logger *
736 get_logger () const = 0;
737};
738
739/* A message published by the analyzer when it simulates popping a stack
740 frame. */
741
749
750/* A message published by the analyzer when it has finished and is about
751 to clean up. */
752
758
760
761 virtual ~subscriber () = default;
762
763 virtual void on_message (const on_tu_finished &) {}
764 virtual void on_message (const on_ana_init &) {}
765 virtual void on_message (const on_frame_popped &) {}
766 virtual void on_message (const on_ana_done &) {}
767};
768
769} // namespace gcc::topics::analyzer_events
770} // namespace gcc::topics
771} // namespace gcc
772
773#if !ENABLE_ANALYZER
774extern void sorry_no_analyzer ();
775#endif /* #if !ENABLE_ANALYZER */
776
777#endif /* GCC_ANALYZER_COMMON_H */
void sorry_no_analyzer()
Definition analyzer-pass.cc:104
Definition analysis-plan.h:35
Definition svalue.h:1163
Definition svalue.h:741
Definition region.h:1494
Definition constraint-manager.h:178
Definition common.h:325
virtual enum built_in_function builtin_code() const =0
const builtin_known_function * dyn_cast_builtin_kf() const final override
Definition common.h:334
tree builtin_decl() const
Definition common.h:328
Definition call-details.h:32
Definition call-string.h:44
Definition call-summary.h:68
Definition call-summary.h:34
Definition region.h:1305
Definition checker-event.h:100
Definition checker-path.h:32
Definition symbolic-nodes.h:585
Definition svalue.h:1294
Definition svalue.h:305
Definition constraint-manager.h:410
Definition common.h:421
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:455
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:423
Definition region.h:820
Definition region.h:989
Definition region-model.h:1412
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:899
Definition region.h:323
Definition region.h:509
Definition exploded-graph.h:40
Definition svalue.h:603
Definition common.h:340
bool matches_call_types_p(const call_details &) const final override
Definition common.h:342
Definition known-function-manager.h:41
Definition common.h:296
virtual void impl_call_post(const call_details &) const
Definition common.h:313
virtual void impl_call_pre(const call_details &) const
Definition common.h:309
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:319
virtual ~known_function()
Definition common.h:298
virtual void check_any_preconditions(const call_details &) const
Definition common.h:304
Definition region.h:555
Definition analyzer-logging.h:36
Definition region.h:1095
Definition common.h:471
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:473
Definition common.h:247
bool operator==(const path_var &other) const
Definition common.h:255
int m_stack_depth
Definition common.h:269
path_var(tree t, int stack_depth)
Definition common.h:249
void dump(pretty_printer *pp) const
tree m_tree
Definition common.h:268
Definition pending-diagnostic.h:258
Definition pending-diagnostic.h:548
Definition svalue.h:998
Definition svalue.h:219
Definition svalue.h:421
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:840
Definition region-model-manager.h:36
Definition region-model.h:289
Definition region.h:130
Definition region-model.h:1345
Definition exploded-graph.h:472
Definition diagnostic-manager.h:79
Definition svalue.h:524
Definition region.h:1202
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:1446
Definition svalue.h:837
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:733
Definition type.h:29
Definition svalue.h:658
Definition store.h:357
Definition svalue.h:386
Definition svalue.h:944
Definition region.h:1600
Definition region-model.h:222
Definition checker-event.h:931
Definition svalue.h:1055
~auto_cfun()
Definition common.h:613
auto_cfun(function *fun)
Definition common.h:612
Definition vec.h:1667
Definition common.h:658
inner_map_t::iterator iterator
Definition common.h:663
inner_map_t m_inner_map
Definition common.h:696
T * get(const key_t &k) const
Definition common.h:676
T::key_t key_t
Definition common.h:660
~consolidation_map()
Definition common.h:667
iterator begin() const
Definition common.h:692
T instance_t
Definition common.h:661
hash_map< key_t, instance_t * > inner_map_t
Definition common.h:662
void put(const key_t &k, T *instance)
Definition common.h:685
size_t elements() const
Definition common.h:690
iterator end() const
Definition common.h:693
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:4842
void pop_cfun(void)
Definition function.cc:4868
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:275
const char * baseline_state_to_str(baseline_state)
@ state_change
Definition checker-event.h:42
offset_int bit_offset_t
Definition common.h:272
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:370
@ read
Definition common.h:371
@ write
Definition common.h:372
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:520
@ uninit
Definition common.h:522
@ freed
Definition common.h:525
@ other
Definition common.h:535
@ popped_stack
Definition common.h:531
@ deleted
Definition common.h:528
offset_int byte_offset_t
Definition common.h:274
iter_result
Definition common.h:563
@ keep_going
Definition common.h:564
@ stop
Definition common.h:565
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:546
@ after_main
Definition common.h:554
const char * poison_kind_to_str(enum poison_kind)
void log_stashed_constants(logger *logger)
offset_int bit_size_t
Definition common.h:273
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:237
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:386
bool operator!=(const diagnostic_state &other) const
Definition common.h:402
void dump_to_pp(pretty_printer *) const
bool operator==(const diagnostic_state &other) const
Definition common.h:397
std::string m_debug_desc
Definition common.h:407
const region * m_region_holding_value
Definition common.h:408
diagnostic_state()
Definition common.h:381
Definition event-loc-info.h:29
Definition pending-diagnostic.h:42
Definition region-model.h:1295
Definition diagnostic-manager.h:35
Definition exploded-graph.h:684
Definition ops.h:78
Definition svalue.h:496
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:755
const ana::exploded_graph & m_eg
Definition common.h:756
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:745
const ana::svalue * m_retval
Definition common.h:746
const ana::region_model * m_new_model
Definition common.h:744
ana::region_model_context * m_ctxt
Definition common.h:747
ana::logger * m_logger
Definition common.h:718
const ana::translation_unit & m_tu
Definition common.h:719
virtual void on_message(const on_frame_popped &)
Definition common.h:765
virtual void on_message(const on_ana_init &)
Definition common.h:764
virtual void on_message(const on_tu_finished &)
Definition common.h:763
virtual void on_message(const on_ana_done &)
Definition common.h:766
Definition gimple.h:225
Definition common.h:637
static void mark_empty(Type &t)
Definition common.h:647
static hashval_t hash(value_type v)
Definition common.h:640
Type compare_type
Definition common.h:639
Type value_type
Definition common.h:638
static bool equal(const value_type &existing, const value_type &candidate)
Definition common.h:641
static void mark_deleted(Type &t)
Definition common.h:646
static bool is_empty(Type t)
Definition common.h:649
static bool is_deleted(Type t)
Definition common.h:648
Definition ira-emit.cc:158
Definition common.h:620
static void mark_deleted(Type &)
Type compare_type
Definition common.h:622
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:621
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:772
#define bool
Definition system.h:844
@ END_BUILTINS
Definition tree-core.h:3619
#define NULL_TREE
Definition tree.h:320