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
213extern bool
215 enum tree_code op,
217
218/* The location of a region expressesd as an offset relative to a
219 base region. */
220
222{
223public:
225 : m_base_region (nullptr), m_offset (0), m_sym_offset (nullptr)
226 {
227 }
228
229 static region_offset make_concrete (const region *base_region,
230 bit_offset_t offset)
231 {
232 return region_offset (base_region, offset, nullptr);
233 }
234 static region_offset make_symbolic (const region *base_region,
235 const svalue *sym_offset)
236 {
237 return region_offset (base_region, 0, sym_offset);
238 }
239 static region_offset make_byte_offset (const region *base_region,
240 const svalue *num_bytes_sval);
241
242 const region *get_base_region () const { return m_base_region; }
243
244 bool concrete_p () const { return m_sym_offset == nullptr; }
245 bool symbolic_p () const { return m_sym_offset != nullptr; }
246
248 {
250 return m_offset;
251 }
252
254 {
256 if (m_offset % BITS_PER_UNIT == 0)
257 {
258 *out = m_offset / BITS_PER_UNIT;
259 return true;
260 }
261 return false;
262 }
263
265 {
267 return m_sym_offset;
268 }
269
272
273 bool operator== (const region_offset &other) const
274 {
275 return (m_base_region == other.m_base_region
276 && m_offset == other.m_offset
277 && m_sym_offset == other.m_sym_offset);
278 }
279
280 void dump_to_pp (pretty_printer *pp, bool) const;
281 void dump (bool) const;
282
283private:
284 region_offset (const region *base_region, bit_offset_t offset,
285 const svalue *sym_offset)
286 : m_base_region (base_region), m_offset (offset), m_sym_offset (sym_offset)
287 {}
288
292};
293
294extern bool operator< (const region_offset &, const region_offset &);
295extern bool operator<= (const region_offset &, const region_offset &);
296extern bool operator> (const region_offset &, const region_offset &);
297extern bool operator>= (const region_offset &, const region_offset &);
298
299extern tristate
301 enum tree_code op,
302 region_offset rhs_offset,
303 const region_model &model);
304
305extern location_t get_stmt_location (const gimple *stmt, function *fun);
306
307extern bool compat_types_p (tree src_type, tree dst_type);
308
309/* Abstract base class for simulating the behavior of known functions,
310 supplied by the core of the analyzer, or by plugins.
311 The former are typically implemented in the various kf*.cc */
312
314{
315public:
316 virtual ~known_function () {}
317 virtual bool matches_call_types_p (const call_details &cd) const = 0;
318
319 /* A hook for performing additional checks on the expected state
320 at a call. */
321 virtual void
323 {
324 // no-op
325 }
326
327 virtual void impl_call_pre (const call_details &) const
328 {
329 return;
330 }
331 virtual void impl_call_post (const call_details &) const
332 {
333 return;
334 }
335
336 virtual const builtin_known_function *
337 dyn_cast_builtin_kf () const { return nullptr; }
338};
339
340/* Subclass of known_function for builtin functions. */
341
343{
344public:
345 virtual enum built_in_function builtin_code () const = 0;
348 return builtin_info[builtin_code ()].decl;
349 }
350
352 dyn_cast_builtin_kf () const final override { return this; }
353};
354
355/* Subclass of known_function for IFN_* functions. */
356
358{
359public:
360 bool matches_call_types_p (const call_details &) const final override
361 {
362 /* Types are assumed to be correct. */
363 return true;
364 }
365};
366
367/* Abstract subclass of known_function that merely sets the return
368 value of the function (based on function attributes), and assumes
369 it has no side-effects. */
370
372{
373public:
374 void impl_call_pre (const call_details &cd) const override;
375};
376
384
385/* An enum for describing the direction of an access to memory. */
386
388{
391};
392
393/* State tracked along an execution path that's pertinent to a specific
394 diagnostic (e.g. for a divide-by-zero warning where the zero value
395 comes from). */
396
398{
400 : m_region_holding_value (nullptr)
401 {
402 }
403
404 diagnostic_state (std::string debug_desc,
405 const region *region_holding_value)
406 : m_debug_desc (std::move (debug_desc)),
407 m_region_holding_value (region_holding_value)
408 {
409 }
410
412 void dump () const;
413
414 bool
415 operator== (const diagnostic_state &other) const
416 {
417 return m_region_holding_value == other.m_region_holding_value;
418 }
419 bool
420 operator!= (const diagnostic_state &other) const
421 {
422 return !(*this == other);
423 }
424
425 std::string m_debug_desc;
427};
428
429struct rewind_context;
430
431/* Abstract base class for associating custom data with an
432 exploded_edge, for handling non-standard edges such as
433 rewinding from a longjmp, signal handlers, etc.
434 Also used when "bifurcating" state: splitting the execution
435 path in non-standard ways (e.g. for simulating the various
436 outcomes of "realloc"). */
437
439{
440public:
441 virtual ~custom_edge_info () {}
442
443 /* Hook for making .dot label more readable. */
444 virtual void print (pretty_printer *pp) const = 0;
445
446 virtual void
447 get_dot_attrs (const char *&out_style,
448 const char *&out_color) const;
449
450 /* Hook for updating STATE when handling bifurcation. */
452 const exploded_edge *eedge,
453 region_model_context *ctxt) const;
454
455 /* Hook for updating MODEL within exploded_path::feasible_p
456 and when handling bifurcation. */
457 virtual bool update_model (region_model *model,
458 const exploded_edge *eedge,
459 region_model_context *ctxt) const = 0;
460
461 virtual void add_events_to_path (checker_path *emission_path,
462 const exploded_edge &eedge,
464 const state_transition *state_trans) const = 0;
465
467 const program_point &point,
469 exploded_node *enode_for_diag,
470 region_model_context *ctxt) const;
471
472 virtual bool
474 {
475 return false;
476 }
477};
478
479/* Abstract base class for splitting state.
480
481 Most of the state-management code in the analyzer involves
482 modifying state objects in-place, which assumes a single outcome.
483
484 This class provides an escape hatch to allow for multiple outcomes
485 for such updates e.g. for modelling multiple outcomes from function
486 calls, such as the various outcomes of "realloc". */
487
489{
490public:
491 virtual ~path_context () {}
492
493 /* Hook for clients to split state with a non-standard path. */
494 virtual void bifurcate (std::unique_ptr<custom_edge_info> info) = 0;
495
496 /* Hook for clients to terminate the standard path. */
497 virtual void terminate_path () = 0;
498
499 /* Hook for clients to determine if the standard path has been
500 terminated. */
501 virtual bool terminate_path_p () const = 0;
502};
503
504extern tree get_stashed_constant_by_name (const char *name);
506
508
509extern std::unique_ptr<json::value>
511
512extern std::unique_ptr<json::value>
514
515extern std::unique_ptr<json::value>
517
518extern std::unique_ptr<json::value>
520
521extern tristate
522compare_constants (tree lhs_const, enum tree_code op, tree rhs_const);
523
524extern tree
526
527extern tree
529
530extern const svalue *
532
533extern region_offset
535
537
538} // namespace ana
539
540extern bool is_special_named_call_p (const gcall &call, const char *funcname,
541 unsigned int num_args,
542 bool look_in_std = false);
543extern bool is_named_call_p (const_tree fndecl, const char *funcname);
544extern bool is_named_call_p (const_tree fndecl, const char *funcname,
545 const gcall &call, unsigned int num_args);
546extern bool is_std_function_p (const_tree fndecl);
547extern bool is_std_named_call_p (const_tree fndecl, const char *funcname);
548extern bool is_std_named_call_p (const_tree fndecl, const char *funcname,
549 const gcall &call, unsigned int num_args);
550extern bool is_setjmp_call_p (const gcall &call);
551extern bool is_longjmp_call_p (const gcall &call);
552extern bool is_placement_new_p (const gcall &call);
553extern bool is_cxa_throw_p (const gcall &call);
554extern bool is_cxa_rethrow_p (const gcall &call);
555extern bool is_cxa_end_catch_p (const gcall &call);
556
557extern const char *get_user_facing_name (const gcall &call);
558
560
561extern label_text make_label_text (bool can_colorize, const char *fmt, ...);
562extern label_text make_label_text_n (bool can_colorize,
563 unsigned HOST_WIDE_INT n,
564 const char *singular_fmt,
565 const char *plural_fmt, ...);
566
567extern bool fndecl_has_gimple_body_p (tree fndecl);
568
569/* An RAII-style class for pushing/popping cfun within a scope.
570 Doing so ensures we get "In function " announcements
571 from the diagnostics subsystem. */
572
574{
575public:
576 auto_cfun (function *fun) { push_cfun (fun); }
578};
579
580/* A template for creating hash traits for a POD type. */
581
582template <typename Type>
584{
585 typedef Type value_type;
586 typedef Type compare_type;
587 static inline hashval_t hash (value_type);
588 static inline bool equal (const value_type &existing,
589 const value_type &candidate);
590 static inline void mark_deleted (Type &);
591 static inline void mark_empty (Type &);
592 static inline bool is_deleted (Type);
593 static inline bool is_empty (Type);
594};
595
596/* A hash traits class that uses member functions to implement
597 the various required ops. */
598
599template <typename Type>
601{
602 typedef Type value_type;
603 typedef Type compare_type;
604 static inline hashval_t hash (value_type v) { return v.hash (); }
605 static inline bool equal (const value_type &existing,
606 const value_type &candidate)
607 {
608 return existing == candidate;
609 }
610 static inline void mark_deleted (Type &t) { t.mark_deleted (); }
611 static inline void mark_empty (Type &t) { t.mark_empty (); }
612 static inline bool is_deleted (Type t) { return t.is_deleted (); }
613 static inline bool is_empty (Type t) { return t.is_empty (); }
614};
615
616/* A map from T::key_t to T* for use in consolidating instances of T.
617 Owns all instances of T.
618 T::key_t should have operator== and be hashable. */
619
620template <typename T>
622{
623public:
624 typedef typename T::key_t key_t;
625 typedef T instance_t;
627 typedef typename inner_map_t::iterator iterator;
628
629 /* Delete all instances of T. */
630
632 {
633 for (typename inner_map_t::iterator iter = m_inner_map.begin ();
634 iter != m_inner_map.end (); ++iter)
635 delete (*iter).second;
636 }
637
638 /* Get the instance of T for K if one exists, or nullptr. */
639
640 T *get (const key_t &k) const
641 {
642 if (instance_t **slot = const_cast<inner_map_t &> (m_inner_map).get (k))
643 return *slot;
644 return nullptr;
645 }
646
647 /* Take ownership of INSTANCE. */
648
649 void put (const key_t &k, T *instance)
650 {
651 m_inner_map.put (k, instance);
652 }
653
654 size_t elements () const { return m_inner_map.elements (); }
655
656 iterator begin () const { return m_inner_map.begin (); }
657 iterator end () const { return m_inner_map.end (); }
658
659private:
661};
662
663/* Disable -Wformat-diag; we want to be able to use pp_printf
664 for logging/dumping without complying with the rules for diagnostics. */
665#if __GNUC__ >= 10
666#pragma GCC diagnostic ignored "-Wformat-diag"
667#endif
668
669namespace gcc {
670namespace topics {
671
672/* A topic for messages relating to the analyzer. */
673
674namespace analyzer_events {
675
676/* A message published by the analyzer when the frontend finishes
677 parsing the TU, to allow it to look up pertinent items using the FE's
678 name-resolution logic. */
679
681{
683 const ana::translation_unit &m_tu;
684};
685
686/* A message published by the analyzer as it starts up, intended for
687 subsystems/plugins that want to register additional functionality
688 within the analyzer. */
689
691{
692 virtual void
693 register_state_machine (std::unique_ptr<ana::state_machine>) const = 0;
694
695 virtual void
696 register_known_function (const char *name,
697 std::unique_ptr<ana::known_function>) const = 0;
698
699 virtual ana::logger *
700 get_logger () const = 0;
701};
702
703/* A message published by the analyzer when it simulates popping a stack
704 frame. */
705
713
715
716 virtual ~subscriber () = default;
717
718 virtual void on_message (const on_tu_finished &) {}
719 virtual void on_message (const on_ana_init &) {}
720 virtual void on_message (const on_frame_popped &) {}
721};
722
723} // namespace gcc::topics::analyzer_events
724} // namespace gcc::topics
725} // namespace gcc
726
727#if !ENABLE_ANALYZER
728extern void sorry_no_analyzer ();
729#endif /* #if !ENABLE_ANALYZER */
730
731#endif /* GCC_ANALYZER_COMMON_H */
Definition analysis-plan.h:35
Definition region.h:1317
Definition constraint-manager.h:178
Definition common.h:343
virtual enum built_in_function builtin_code() const =0
const builtin_known_function * dyn_cast_builtin_kf() const final override
Definition common.h:352
tree builtin_decl() const
Definition common.h:346
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:1522
Definition constraint-manager.h:410
Definition common.h:439
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:473
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:441
Definition region.h:743
Definition region.h:880
Definition region-model.h:1314
Definition constraint-manager.h:240
Definition exploded-graph.h:331
Definition exploded-graph.h:790
Definition exploded-graph.h:206
Definition exploded-path.h:33
Definition program-state.h:34
Definition exploded-graph.h:939
Definition exploded-graph.h:959
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:358
bool matches_call_types_p(const call_details &) const final override
Definition common.h:360
Definition known-function-manager.h:41
Definition common.h:314
virtual void impl_call_post(const call_details &) const
Definition common.h:331
virtual void impl_call_pre(const call_details &) const
Definition common.h:327
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:337
virtual ~known_function()
Definition common.h:316
virtual void check_any_preconditions(const call_details &) const
Definition common.h:322
Definition region.h:521
Definition analyzer-logging.h:36
Definition region.h:974
Definition common.h:489
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:491
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:222
bit_offset_t get_bit_offset() const
Definition common.h:247
bool symbolic_p() const
Definition common.h:245
const region * get_base_region() const
Definition common.h:242
bit_offset_t m_offset
Definition common.h:290
static region_offset make_byte_offset(const region *base_region, const svalue *num_bytes_sval)
const svalue * m_sym_offset
Definition common.h:291
static region_offset make_concrete(const region *base_region, bit_offset_t offset)
Definition common.h:229
void dump_to_pp(pretty_printer *pp, bool) const
region_offset()
Definition common.h:224
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:284
void dump(bool) const
bool operator==(const region_offset &other) const
Definition common.h:273
const svalue & calc_symbolic_bit_offset(region_model_manager *mgr) const
const region * m_base_region
Definition common.h:289
bool get_concrete_byte_offset(byte_offset_t *out) const
Definition common.h:253
static region_offset make_symbolic(const region *base_region, const svalue *sym_offset)
Definition common.h:234
const svalue * get_symbolic_byte_offset() const
Definition common.h:264
bool concrete_p() const
Definition common.h:244
Definition region.h:127
Definition region-model.h:1254
Definition exploded-graph.h:453
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:1045
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:577
auto_cfun(function *fun)
Definition common.h:576
Definition common.h:622
inner_map_t::iterator iterator
Definition common.h:627
inner_map_t m_inner_map
Definition common.h:660
T * get(const key_t &k) const
Definition common.h:640
T::key_t key_t
Definition common.h:624
~consolidation_map()
Definition common.h:631
iterator begin() const
Definition common.h:656
T instance_t
Definition common.h:625
hash_map< key_t, instance_t * > inner_map_t
Definition common.h:626
void put(const key_t &k, T *instance)
Definition common.h:649
size_t elements() const
Definition common.h:654
iterator end() const
Definition common.h:657
Definition genmatch.cc:1507
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:4784
void pop_cfun(void)
Definition function.cc:4810
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:388
@ read
Definition common.h:389
@ write
Definition common.h:390
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)
tristate eval_region_offset_comparison(region_offset lhs_offset, enum tree_code op, region_offset rhs_offset, const region_model &model)
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 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: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
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:404
bool operator!=(const diagnostic_state &other) const
Definition common.h:420
void dump_to_pp(pretty_printer *) const
bool operator==(const diagnostic_state &other) const
Definition common.h:415
std::string m_debug_desc
Definition common.h:425
const region * m_region_holding_value
Definition common.h:426
diagnostic_state()
Definition common.h:399
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:665
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:709
const ana::svalue * m_retval
Definition common.h:710
const ana::region_model * m_new_model
Definition common.h:708
ana::region_model_context * m_ctxt
Definition common.h:711
ana::logger * m_logger
Definition common.h:682
const ana::translation_unit & m_tu
Definition common.h:683
virtual void on_message(const on_frame_popped &)
Definition common.h:720
virtual void on_message(const on_ana_init &)
Definition common.h:719
virtual void on_message(const on_tu_finished &)
Definition common.h:718
Definition gimple.h:224
Definition common.h:601
static void mark_empty(Type &t)
Definition common.h:611
static hashval_t hash(value_type v)
Definition common.h:604
Type compare_type
Definition common.h:603
Type value_type
Definition common.h:602
static bool equal(const value_type &existing, const value_type &candidate)
Definition common.h:605
static void mark_deleted(Type &t)
Definition common.h:610
static bool is_empty(Type t)
Definition common.h:613
static bool is_deleted(Type t)
Definition common.h:612
Definition ira-emit.cc:158
Definition common.h:584
static void mark_deleted(Type &)
Type compare_type
Definition common.h:586
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:585
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:3553
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