libabigail
abg-suppression.h
1// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2// -*- Mode: C++ -*-
3//
4// Copyright (C) 2016-2023 Red Hat, Inc.
5//
6// Author: Dodji Seketeli
7
8#ifndef __ABG_SUPPRESSION_H__
9#define __ABG_SUPPRESSION_H__
10
11#include <unordered_set>
12
13#include "abg-ini.h"
14#include "abg-ir.h"
15
16namespace abigail
17{
18
19class fe_iface;
20
21/// @brief an engine to suppress the parts of the result of comparing
22/// two sets of ABI artifacts.
23///
24/// The user specifies the kind of changes between ABI artefact she
25/// wants to see suppressed. That suppression specification is done
26/// in an INI format.
27///
28/// That INI file is parsed and represented internally using the types
29/// that are defined in this namespace.
30namespace suppr
31{
32using std::unordered_set;
33using std::string;
34using std::shared_ptr;
35using std::vector;
36using comparison::diff;
38
39/// Base type of a direct suppression specifications types.
40///
41/// This abstracts a suppression specification. It's a way to specify
42/// how to drop reports about a particular diff node on the floor, if
43/// it matches the supppression specification.
44///
45/// Note that a direct suppression specification suppresses (for
46/// reporting purposes) the diff node that it matches. A negated
47/// suppression specification, however, suppresses a diff node that it
48/// DOES NOT match. A Negated suppression specification is abstracted
49/// by the class @ref negated_suppression_base.
51{
52public:
53 class priv; // declare publicly to allow subclasses to reuse the priv
54private:
55 // Forbid default constructor
57
58public:
59 std::unique_ptr<priv> priv_;
60
61 suppression_base(const string& label);
62
63 suppression_base(const string& label,
64 const string& file_name_regex_str,
65 const string& file_name_not_regex_str);
66
67 bool
69
70 void
72
73 bool
74 get_is_artificial() const;
75
76 void
78
79 const string
80 get_label() const;
81
82 void
83 set_label(const string&);
84
85 void
86 set_file_name_regex_str(const string& regexp);
87
88 const string&
90
91 void
92 set_file_name_not_regex_str(const string& regexp);
93
94 const string&
96
97 bool
99
100 void
101 set_soname_regex_str(const string& regexp);
102
103 const string&
104 get_soname_regex_str() const;
105
106 void
107 set_soname_not_regex_str(const string& regexp);
108
109 const string&
111
112 bool
114
115 virtual bool
116 suppresses_diff(const diff*) const = 0;
117
118 virtual ~suppression_base();
119
120 friend bool
121 suppression_matches_soname(const string& soname,
122 const suppression_base& suppr);
123
124 friend bool
125 suppression_matches_soname_or_filename(const string& soname,
126 const string& filename,
127 const suppression_base& suppr);
128}; // end class suppression_base
129
130/// Convenience typedef for a shared pointer to a @ref suppression.
131typedef shared_ptr<suppression_base> suppression_sptr;
132
133/// Convenience typedef for a vector of @ref suppression_sptr
134typedef vector<suppression_sptr> suppressions_type;
135
136void
137read_suppressions(std::istream& input,
138 suppressions_type& suppressions);
139
140void
141read_suppressions(const string& file_path,
142 suppressions_type& suppressions);
143
144class type_suppression;
145
146/// Convenience typedef for a shared pointer to type_suppression.
147typedef shared_ptr<type_suppression> type_suppression_sptr;
148
149/// Convenience typedef for vector of @ref type_suppression_sptr.
150typedef vector<type_suppression_sptr> type_suppressions_type;
151
152/// The base class of suppression specifications that are defined by
153/// the negation of matching clauses.
154///
155/// A direct suppression specification suppresses (for reporting
156/// purposes) the diff node that it matches. A negated suppression
157/// specification suppresses a diff node that it DOES NOT match.
159{
160public:
162
164}; // end class negated_suppression_base.
165
166/// A convenience typedef for a shared pointer to @ref
167/// negated_suppression_base.
168typedef shared_ptr<negated_suppression_base> negated_suppression_sptr;
169
170/// Convenience typedef for a vector of @ref negated_suppression_sptr
171typedef vector<negated_suppression_sptr> negated_suppressions_type;
172
173bool
175
178
181
182/// Abstraction of a type suppression specification.
183///
184/// Specifies under which condition reports about a type diff node
185/// should be dropped on the floor.
187{
188 class priv;
189
190 // Forbid this;
192
193public:
194 std::unique_ptr<priv> priv_;
195
196 /// The kind of the type the current type suppression is supposed to
197 /// be about.
199 {
200 UNKNOWN_TYPE_KIND,
201 CLASS_TYPE_KIND,
202 STRUCT_TYPE_KIND,
203 UNION_TYPE_KIND,
204 ENUM_TYPE_KIND,
205 ARRAY_TYPE_KIND,
206 TYPEDEF_TYPE_KIND,
207 BUILTIN_TYPE_KIND
208 }; // end enum type_kind
209
210 /// The different ways through which the type diff has been reached.
212 {
213 /// The type diff has been reached (from a function or variable
214 /// change) directly.
216
217 /// The type diff has been reached (from a function or variable
218 /// change) through a pointer.
220
221 /// The type diff has been reached (from a function or variable
222 /// change) through a reference; you know, like a c++ reference..
224
225 /// The type diff has been reached (from a function or variable
226 /// change) through either a reference or a pointer.
228 }; // end enum reach_kind
229
230 class insertion_range;
231 /// A convenience typedef for a shared pointer to @ref
232 /// insertion_range.
233 typedef shared_ptr<insertion_range> insertion_range_sptr;
234 /// A convenience typedef for a vector of @ref insertion_range_sptr.
235 typedef vector<insertion_range_sptr> insertion_ranges;
236
237 type_suppression(const string& label,
238 const string& type_name_regexp,
239 const string& type_name);
240
241 virtual ~type_suppression();
242
243 void
244 set_type_name_regex_str(const string& name_regex_str);
245
246 const string&
248
249 void
250 set_type_name_not_regex_str(const string& name_regex_str);
251
252 const string&
254
255 void
256 set_type_name(const string& name);
257
258 const string&
259 get_type_name() const;
260
261 bool
263
264 void
266
267 void
269
271 get_type_kind() const;
272
273 bool
275
276 void
278
280 get_reach_kind() const;
281
282 void
284
285 bool
286 get_has_size_change() const;
287
288 void
289 set_has_size_change(bool flag);
290
291 const string_set_type&
293
294 void
295 set_potential_data_member_names(const string_set_type&) const;
296
297 const string&
299
300 void
302
303 void
305
306 const insertion_ranges&
308
311
312 const unordered_set<string>&
314
315 unordered_set<string>&
317
318 void
319 set_source_locations_to_keep(const unordered_set<string>&);
320
321 const string&
323
324 void
326
327 const vector<string>&
329
330 void
331 set_changed_enumerator_names(const vector<string>&);
332
333 virtual bool
334 suppresses_diff(const diff* diff) const;
335
336 bool
337 suppresses_type(const type_base_sptr& type,
338 const diff_context_sptr& ctxt) const;
339
340 bool
341 suppresses_type(const type_base_sptr& type) const;
342
343 bool
344 suppresses_type(const type_base_sptr& type,
345 const scope_decl* type_scope) const;
346}; // end type_suppression
347
350
351/// The abstraction of a range of offsets in which a member of a type
352/// might get inserted.
354{
355 struct priv;
356 std::unique_ptr<priv> priv_;
357
358public:
359
360 class boundary;
361 class integer_boundary;
363
364 /// Convenience typedef for a shared_ptr to @ref boundary
365 typedef shared_ptr<boundary> boundary_sptr;
366
367 /// Convenience typedef for a shared_ptr to a @ref integer_boundary
368 typedef shared_ptr<integer_boundary> integer_boundary_sptr;
369
370 /// Convenience typedef for a shared_ptr to a @ref
371 /// fn_call_expr_boundary
372 typedef shared_ptr<fn_call_expr_boundary> fn_call_expr_boundary_sptr;
373
375
377
379 begin() const;
380
382 end() const;
383
385 create_integer_boundary(int value);
386
389
391 create_fn_call_expr_boundary(const string&);
392
393 static bool
395 const class_or_union* context,
396 uint64_t& value);
397
398 static bool
399 boundary_value_is_end(uint64_t value);
400}; // end class insertion_range
401
404
407
408/// The abstraction of the boundary of an @ref insertion_range, in the
409/// context of a @ref type_suppression
411{
412 struct priv;
413 std::unique_ptr<priv> priv_;
414
415public:
416 boundary();
417 virtual ~boundary();
418};// end class type_suppression::insertion_range::boundary
419
420/// An @ref insertion_range boundary that is expressed as an integer
421/// value. That integer value is usually a bit offset.
424{
425 struct priv;
426 std::unique_ptr<priv> priv_;
427
429
430public:
431 integer_boundary(uint64_t value);
432 uint64_t as_integer() const;
433 operator uint64_t () const;
435}; //end class type_suppression::insertion_range::integer_boundary
436
437/// An @ref insertion_range boundary that is expressed as function
438/// call expression. The (integer) value of that expression is
439/// usually a bit offset.
442{
443 struct priv;
444 std::unique_ptr<priv> priv_;
445
447
448public:
451 operator ini::function_call_expr_sptr () const;
453}; //end class type_suppression::insertion_range::fn_call_expr_boundary
454
455/// Abstraction of a negated type suppression specification.
456///
457/// A negated type suppression suppresses a type if the negation of
458/// the equivalent propositions for a @ref type_suppression are valid.
460 virtual public negated_suppression_base
461{
462
463public:
464
465 negated_type_suppression(const string& label,
466 const string& type_name_regexp,
467 const string& type_name);
468
469 virtual bool
470 suppresses_diff(const diff* diff) const;
471
472 bool
473 suppresses_type(const type_base_sptr& type,
474 const diff_context_sptr& ctxt) const;
475
476 bool
477 suppresses_type(const type_base_sptr& type) const;
478
479 bool
480 suppresses_type(const type_base_sptr& type,
481 const scope_decl* type_scope) const;
482
484};// end class negated_type_suppression
485
487
488/// Convenience typedef for a shared pointer to function_suppression.
489typedef shared_ptr<function_suppression> function_suppression_sptr;
490
491/// Convenience typedef for a vector of @ref function_suppression_sptr.
492typedef vector<function_suppression_sptr> function_suppressions_type;
493
494/// Abstraction of a function suppression specification.
495///
496/// Specifies under which condition reports about a @ref
497/// function_decl_diff diff node should be dropped on the floor for
498/// the purpose of reporting.
500{
501 struct priv;
502
503public:
504
505 std::unique_ptr<priv> priv_;
506 class parameter_spec;
507
508 /// Convenience typedef for shared_ptr of @ref parameter_spec.
509 typedef shared_ptr<parameter_spec> parameter_spec_sptr;
510
511 /// Convenience typedef for vector of @ref parameter_spec_sptr.
512 typedef vector<parameter_spec_sptr> parameter_specs_type;
513
514 /// The kind of change the current function suppression should apply
515 /// to.
517 {
518 UNDEFINED_CHANGE_KIND,
519 /// A change in a sub-type of the function.
521 /// The function was added to the second subject of the diff.
523 /// The function was deleted from the second subject of the diff.
525 /// This represents all the changes possibly described by this
526 /// enum. It's a logical 'OR' of all the change enumerators
527 /// above.
531 };
532
534
535 function_suppression(const string& label,
536 const string& name,
537 const string& name_regex,
538 const string& return_type_name,
539 const string& return_type_regex,
540 parameter_specs_type& parm_specs,
541 const string& symbol_name,
542 const string& symbol_name_regex,
543 const string& symbol_version,
544 const string& symbol_version_regex_str);
545
546 virtual ~function_suppression();
547
548 static change_kind
549 parse_change_kind(const string&);
550
552 get_change_kind() const;
553
554 void
556
557 const string&
558 get_name() const;
559
560 void
561 set_name(const string&);
562
563 const string&
564 get_name_regex_str() const;
565
566 void
567 set_name_regex_str(const string&);
568
569 const string&
571
572 void
573 set_name_not_regex_str(const string&);
574
575 const string&
576 get_return_type_name() const;
577
578 void
579 set_return_type_name(const string&);
580
581 const string&
583
584 void
585 set_return_type_regex_str(const string& r);
586
588 get_parameter_specs() const;
589
590 void
592
593 void
595
596 const string&
597 get_symbol_name() const;
598
599 void
600 set_symbol_name(const string& n);
601
602 const string&
604
605 void
606 set_symbol_name_regex_str(const string&);
607
608 const string&
610
611 void
612 set_symbol_name_not_regex_str(const string&);
613
614 const string&
615 get_symbol_version() const;
616
617 void
618 set_symbol_version(const string&);
619
620 const string&
622
623 void
624 set_symbol_version_regex_str(const string&);
625
626 bool
628
629 void
631
632 virtual bool
633 suppresses_diff(const diff* diff) const;
634
635 bool
637 change_kind k,
638 const diff_context_sptr ctxt) const;
639
640 bool
642 change_kind k,
643 const diff_context_sptr ctxt) const;
644
645 bool
647 change_kind k,
648 const diff_context_sptr ctxt);
649
650 bool
652 change_kind k,
653 const diff_context_sptr ctxt);
654}; // end class function_suppression.
655
658
662
666
667/// Abstraction of the specification of a function parameter in a
668/// function suppression specification.
670{
671 friend class function_suppression;
672
673 class priv;
674 std::unique_ptr<priv> priv_;
675
676 // Forbid this.
678
679public:
680 parameter_spec(size_t index,
681 const string& type_name,
682 const string& type_name_regex);
683
684 size_t
685 get_index() const;
686
687 void
688 set_index(size_t);
689
690 const string&
692
693 void
694 set_parameter_type_name(const string&);
695
696 const string&
698
699 void
701};// end class function_suppression::parameter_spec
702
704
705/// A convenience typedef for a shared pointer to @ref
706/// variable_suppression.
707typedef shared_ptr<variable_suppression> variable_suppression_sptr;
708
709/// A convenience typedef for a vector of @ref
710/// variable_suppression_sptr.
711typedef vector<variable_suppression_sptr> variable_suppressions_type;
712
713/// The abstraction of a variable suppression specification.
714///
715/// It specifies under which condition reports about a @ref var_diff
716/// diff node should be dropped on the floor for the purpose of
717/// reporting.
719{
720public:
721
722 /// The kind of change the current variable suppression should apply
723 /// to.
725 {
726 UNDEFINED_CHANGE_KIND,
727 /// A change in a sub-type of the variable.
729 /// The variable was added to the second second subject of the
730 /// diff.
732 /// The variable was deleted from the second subject of the diff.
734 /// This represents all the changes possibly described by this
735 /// enum. It's a logical 'OR' of all the change enumerators
736 /// above.
740 };
741
742private:
743 struct priv;
744
745public:
746 std::unique_ptr<priv> priv_;
747
748 variable_suppression(const string& label = "",
749 const string& name = "",
750 const string& name_regex_str = "",
751 const string& symbol_name = "",
752 const string& symbol_name_regex_str = "",
753 const string& symbol_version = "",
754 const string& symbol_version_regex_str = "",
755 const string& type_name = "",
756 const string& type_name_regex_str = "");
757
758 virtual ~variable_suppression();
759
760 static change_kind
761 parse_change_kind(const string&);
762
764 get_change_kind() const;
765
766 void
768
769 const string&
770 get_name() const;
771
772 void
773 set_name(const string&);
774
775 const string&
776 get_name_regex_str() const;
777
778 void
779 set_name_regex_str(const string&);
780
781 const string&
783
784 void
785 set_name_not_regex_str(const string&);
786
787 const string&
788 get_symbol_name() const;
789
790 void
791 set_symbol_name(const string&);
792
793 const string&
795
796 void
797 set_symbol_name_regex_str(const string&);
798
799 const string&
801
802 void
803 set_symbol_name_not_regex_str(const string&);
804
805 const string&
806 get_symbol_version() const;
807
808 void
809 set_symbol_version(const string&);
810
811 const string&
813
814 void
815 set_symbol_version_regex_str(const string&);
816
817 const string&
818 get_type_name() const;
819
820 void
821 set_type_name(const string&);
822
823 const string&
825
826 void
827 set_type_name_regex_str(const string&);
828
829 bool
830 suppresses_diff(const diff* d) const;
831
832 bool
833 suppresses_variable(const var_decl* var,
834 change_kind k,
835 const diff_context_sptr cxt) const;
836
837 bool
839 change_kind k,
840 const diff_context_sptr cxt) const;
841
842 bool
844 change_kind k,
845 const diff_context_sptr cxt) const;
846
847 bool
849 change_kind k,
850 const diff_context_sptr cxt) const;
851}; // end class variable_suppression
852
855
859
863
864class file_suppression;
865
866/// A convenience typedef for a shared_ptr to @ref file_suppression
867typedef shared_ptr<file_suppression> file_suppression_sptr;
868
869/// Abstraction of a suppression specification to avoid loading a
870/// file.
871///
872/// This can be used by a tool that loads (binary) files, to know
873/// which file it has to avoid loading.
875{
876 std::unique_ptr<priv> priv_;
877
878 // Forbid this
880
881public:
882
883 file_suppression(const string& label,
884 const string& file_name_regex,
885 const string& file_name_not_regex);
886
887 virtual bool
888 suppresses_diff(const diff* diff) const;
889
890 bool
891 suppresses_file(const string& file_path);
892
893 virtual ~file_suppression();
894}; // end file_suppression
895
898
900file_is_suppressed(const string& file_path,
901 const suppressions_type& suppressions);
902
903bool
904suppression_matches_soname(const string& soname,
905 const suppression_base& suppr);
906
907bool
908suppression_matches_soname_or_filename(const string& soname,
909 const string& filename,
910 const suppression_base& suppr);
911
912const char*
914
915bool
917
918bool
920
921bool
923 const suppression_base&);
924
925bool
926suppression_matches_function_name(const fe_iface&,
928 const string&);
929
930bool
931suppression_matches_function_sym_name(const fe_iface&,
933 const string& fn_linkage_name);
934
935bool
938 const string& var_name);
939
940bool
943 const string&);
944
945bool
948 const string&,
949 const location&);
950
951bool
953 const elf_symbol_sptr& symbol);
954
955bool
957 const string& sym_name,
958 elf_symbol::type sym_type);
959
960bool
962 const string& fn_name,
963 const string& fn_linkage_name,
964 bool require_drop_property = false);
965
966bool
968 const string& var_name,
969 const string& var_linkage_name,
970 bool require_drop_property = false);
971
972bool
974 const string& type_name,
975 const location& type_location,
976 bool& type_is_private,
977 bool require_drop_property = false);
978
979bool
982 const class_or_union*);
983
984} // end namespace suppr
985
986
987} // end namespace abigail
988
989#endif //__ABG_SUPPRESSION_H__
This file contains the declarations for the ini file reader used in the libabigail library.
Types of the main internal representation of libabigail.
The abstraction of a change between two ABI artifacts, a.k.a an artifact change.
The base class of all libabigail front-ends: The Front End Interface.
Definition: abg-fe-iface.h:29
The base type of class_decl and union_decl.
Definition: abg-ir.h:3948
Abstraction of an elf symbol.
Definition: abg-ir.h:909
type
The type of a symbol.
Definition: abg-ir.h:913
Abstraction for a function declaration.
Definition: abg-ir.h:3033
The source location of a token.
Definition: abg-ir.h:299
A declaration that introduces a scope.
Definition: abg-ir.h:1796
Abstracts a variable declaration.
Definition: abg-ir.h:2930
Abstraction of a suppression specification to avoid loading a file.
virtual ~file_suppression()
Destructor of file_suppression.
bool suppresses_file(const string &file_path)
Test if a instances of this file_suppression suppresses a given file.
virtual bool suppresses_diff(const diff *diff) const
Test if instances of this file_suppression suppresses a certain instance of diff.
Abstraction of the specification of a function parameter in a function suppression specification.
const string & get_parameter_type_name() const
Getter for the type name of the parameter designated by this specification.
const string & get_parameter_type_name_regex_str() const
Getter for the regular expression that defines a set of type names for the parameter designated by th...
void set_parameter_type_name_regex_str(const string &)
Setter for the regular expression that defines a set of type names for the parameter designated by th...
void set_parameter_type_name(const string &)
Setter for the type name of the parameter designated by this specification.
void set_index(size_t)
Setter for the index of the parameter designated by this specification.
size_t get_index() const
Getter for the index of the parameter designated by this specification.
Abstraction of a function suppression specification.
void set_name_regex_str(const string &)
Setter for a regular expression for a family of names of functions the user wants the current specifi...
change_kind get_change_kind() const
Getter of the "change-kind" property.
const string & get_symbol_version() const
Getter for the name of the version of the symbol of the function the user wants this specification to...
void set_change_kind(change_kind k)
Setter of the "change-kind" property.
change_kind
The kind of change the current function suppression should apply to.
@ ALL_CHANGE_KIND
This represents all the changes possibly described by this enum. It's a logical 'OR' of all the chang...
@ ADDED_FUNCTION_CHANGE_KIND
The function was added to the second subject of the diff.
@ FUNCTION_SUBTYPE_CHANGE_KIND
A change in a sub-type of the function.
@ DELETED_FUNCTION_CHANGE_KIND
The function was deleted from the second subject of the diff.
const string & get_symbol_version_regex_str() const
Getter for a regular expression for a family of versions of symbols of functions the user wants the c...
bool suppresses_function(const function_decl *fn, change_kind k, const diff_context_sptr ctxt) const
Evaluate the current function suppression specification on a given function_decl and say if a report ...
const string & get_return_type_name() const
Getter for the name of the return type of the function the user wants this specification to designate...
static change_kind parse_change_kind(const string &)
Parses a string containing the content of the "change-kind" property and returns the an instance of f...
bool suppresses_function_symbol(const elf_symbol *sym, change_kind k, const diff_context_sptr ctxt)
Evaluate the current function suppression specification on a given elf_symbol and say if a report abo...
void set_return_type_name(const string &)
Setter for the name of the return type of the function the user wants this specification to designate...
const string & get_name() const
Getter for the name of the function the user wants the current specification to designate....
const string & get_symbol_name() const
Getter for the name of symbol of the function the user wants this specification to designate.
vector< parameter_spec_sptr > parameter_specs_type
Convenience typedef for vector of parameter_spec_sptr.
void set_symbol_name_regex_str(const string &)
Setter for a regular expression for a family of names of symbols of functions the user wants this spe...
const string & get_symbol_name_regex_str() const
Getter for a regular expression for a family of names of symbols of functions the user wants this spe...
void set_symbol_name_not_regex_str(const string &)
Setter for a regular expression for a family of names of symbols of functions the user wants this spe...
void set_name_not_regex_str(const string &)
Setter for a regular expression for a family of names of functions the user wants the current specifi...
void set_symbol_version(const string &)
Setter for the name of the version of the symbol of the function the user wants this specification to...
void set_parameter_specs(parameter_specs_type &)
Setter for a vector of parameter specifications to specify properties of the parameters of the functi...
void set_name(const string &)
Setter for the name of the function the user wants the current specification to designate....
const parameter_specs_type & get_parameter_specs() const
Getter for a vector of parameter specifications to specify properties of the parameters of the functi...
virtual bool suppresses_diff(const diff *diff) const
Evaluate this suppression specification on a given diff node and say if the diff node should be suppr...
void set_return_type_regex_str(const string &r)
Setter for a regular expression for a family of return type names for functions the user wants the cu...
const string & get_name_not_regex_str() const
Getter for a regular expression of a family of names of functions the user wants the current specific...
void set_symbol_name(const string &n)
Setter for the name of symbol of the function the user wants this specification to designate.
const string & get_symbol_name_not_regex_str() const
Getter for a regular expression for a family of names of symbols of functions the user wants this spe...
void append_parameter_specs(const parameter_spec_sptr)
Append a specification of a parameter of the function specification.
void set_allow_other_aliases(bool f)
Setter for the "allow_other_aliases" property of the function suppression specification.
void set_symbol_version_regex_str(const string &)
Setter for a regular expression for a family of versions of symbols of functions the user wants the c...
function_suppression()
Default constructor for the function_suppression type.
const string & get_name_regex_str() const
Getter for a regular expression for a family of names of functions the user wants the current specifi...
bool get_allow_other_aliases() const
Getter for the "allow_other_aliases" property of the function suppression specification.
const string & get_return_type_regex_str() const
Getter for a regular expression for a family of return type names for functions the user wants the cu...
shared_ptr< parameter_spec > parameter_spec_sptr
Convenience typedef for shared_ptr of parameter_spec.
The base class of suppression specifications that are defined by the negation of matching clauses.
virtual ~negated_suppression_base()
Destructor of the negated_suppression_base.
negated_suppression_base()
Constructor of the negated_suppression_base.
Abstraction of a negated type suppression specification.
negated_type_suppression(const string &label, const string &type_name_regexp, const string &type_name)
Constructor for negated_type_suppression.
virtual bool suppresses_diff(const diff *diff) const
Evaluate this suppression specification on a given diff node and say if the diff node should be suppr...
virtual ~negated_type_suppression()
Destructor of the negated_type_suppression type.
The private data of suppression_base.
Base type of a direct suppression specifications types.
const string & get_file_name_regex_str() const
Getter for the "file_name_regex" property of the current instance of suppression_base.
bool get_drops_artifact_from_ir() const
Tests if the current suppression specification is to avoid adding the matched ABI artifact to the int...
bool get_is_artificial() const
Test is the suppression specification is artificial.
void set_file_name_regex_str(const string &regexp)
Setter for the "file_name_regex" property of the current instance of suppression_base.
void set_soname_not_regex_str(const string &regexp)
Setter of the "soname_not_regex_str property of the current instance of suppression_base.
const string & get_soname_not_regex_str() const
Getter of the "soname_not_regex_str property of the current instance of suppression_base.
const string get_label() const
Getter for the label associated to this suppression specification.
void set_file_name_not_regex_str(const string &regexp)
Setter for the "file_name_not_regex" property of the current instance of suppression_base.
void set_is_artificial(bool)
Set a flag saying if the suppression specification is artificial or not.
const string & get_file_name_not_regex_str() const
Getter for the "file_name_not_regex" property of the current instance of suppression_base.
friend bool suppression_matches_soname_or_filename(const string &soname, const string &filename, const suppression_base &suppr)
Test if a given SONAME or file name is matched by a given suppression specification.
void set_label(const string &)
Setter for the label associated to this suppression specification.
friend bool suppression_matches_soname(const string &soname, const suppression_base &suppr)
Test if a given SONAME is matched by a given suppression specification.
const string & get_soname_regex_str() const
Getter of the "soname_regex_str property of the current instance of suppression_base.
bool has_soname_related_property() const
Test if the current suppression has a property related to SONAMEs.
void set_soname_regex_str(const string &regexp)
Setter of the "soname_regex_str property of the current instance of suppression_base.
bool has_file_name_related_property() const
Test if the current suppression has a property related to file name.
void set_drops_artifact_from_ir(bool)
Set the flag that says whether the current suppression specification is to avoid adding the matched A...
The abstraction of the boundary of an insertion_range, in the context of a type_suppression.
virtual ~boundary()
Destructor of type_suppression::insertion_range::boundary.
boundary()
Default constructor of type_suppression::insertion_range::boundary.
An insertion_range boundary that is expressed as function call expression. The (integer) value of tha...
~fn_call_expr_boundary()
Destructor of type_suppression::insertion_range::fn_call_expr_boundary.
ini::function_call_expr_sptr as_function_call_expr() const
Returns the function call expression value of the current boundary.
An insertion_range boundary that is expressed as an integer value. That integer value is usually a bi...
~integer_boundary()
Destructor of type_suppression::insertion_range::integer_boundary.
uint64_t as_integer() const
Return the integer value of the current instance of type_suppression::insertion_range::integer_bounda...
The abstraction of a range of offsets in which a member of a type might get inserted.
static insertion_range::integer_boundary_sptr create_integer_boundary(int value)
Create an integer boundary.
static insertion_range::fn_call_expr_boundary_sptr create_fn_call_expr_boundary(ini::function_call_expr_sptr)
Create a function call expression boundary.
shared_ptr< fn_call_expr_boundary > fn_call_expr_boundary_sptr
Convenience typedef for a shared_ptr to a fn_call_expr_boundary.
boundary_sptr end() const
Getter for the end of the range.
static bool boundary_value_is_end(uint64_t value)
Test if a given value supposed to be inside an insertion range represents the end of the range.
shared_ptr< integer_boundary > integer_boundary_sptr
Convenience typedef for a shared_ptr to a integer_boundary.
static bool eval_boundary(const boundary_sptr boundary, const class_or_union *context, uint64_t &value)
Evaluate an insertion range boundary to get a resulting integer value.
shared_ptr< boundary > boundary_sptr
Convenience typedef for a shared_ptr to boundary.
boundary_sptr begin() const
Getter for the beginning of the range.
insertion_range()
Default Constructor of type_suppression::insertion_range.
The private data for type_suppression.
Abstraction of a type suppression specification.
void set_type_name_not_regex_str(const string &name_regex_str)
Setter for the "type_name_not_regex_str" property of the type suppression specification.
const vector< string > & get_changed_enumerator_names() const
Getter of the vector of the changed enumerators that are supposed to be suppressed....
void set_type_name_regex_str(const string &name_regex_str)
Setter for the "type_name_regex" property of the type suppression specification.
void set_type_name(const string &name)
Setter for the name of the type about which diff reports should be suppressed.
void set_consider_type_kind(bool f)
Setter of the property that says whether to consider the kind of type this suppression is about.
reach_kind get_reach_kind() const
Getter of the way the diff node matching the current suppression specification is to be reached.
const string & get_source_location_to_keep_regex_str() const
Getter of the regular expression string that designates the source location paths of types that shoul...
vector< insertion_range_sptr > insertion_ranges
A convenience typedef for a vector of insertion_range_sptr.
void set_changed_enumerator_names(const vector< string > &)
Setter of the vector of changed enumerators that are supposed to be suppressed. Note that this will b...
void set_source_location_to_keep_regex_str(const string &)
Setter of the regular expression string that designates the source location paths of types that shoul...
void set_source_locations_to_keep(const unordered_set< string > &)
Setter for the array of source location paths of types that should *NOT* be suppressed.
bool get_consider_type_kind() const
Getter of the property that says whether to consider the kind of type this suppression is about.
type_kind
The kind of the type the current type suppression is supposed to be about.
const string & get_type_name_regex_str() const
Getter for the "type_name_regex" property of the type suppression specification.
void set_consider_reach_kind(bool f)
Set a flag saying if the current type suppression specification suggests to consider how the matching...
type_kind get_type_kind() const
Getter of the kind of type this suppression is about.
void set_type_kind(type_kind k)
Setter of the kind of type this suppression is about.
const insertion_ranges & get_data_member_insertion_ranges() const
Getter for the vector of data member insertion range that specifiers where a data member is inserted ...
const string_set_type & get_potential_data_member_names() const
Getter of the "potential_data_member_names" property.
reach_kind
The different ways through which the type diff has been reached.
@ REFERENCE_REACH_KIND
The type diff has been reached (from a function or variable change) through a reference; you know,...
@ POINTER_REACH_KIND
The type diff has been reached (from a function or variable change) through a pointer.
@ REFERENCE_OR_POINTER_REACH_KIND
The type diff has been reached (from a function or variable change) through either a reference or a p...
@ DIRECT_REACH_KIND
The type diff has been reached (from a function or variable change) directly.
bool get_consider_reach_kind() const
Test if the current type suppression specification suggests to consider how the matching diff node is...
const unordered_set< string > & get_source_locations_to_keep() const
Getter for the array of source location paths of types that should *NOT* be suppressed.
const string & get_type_name_not_regex_str() const
Getter for the "type_name_not_regex_str" property of the type suppression specification.
virtual bool suppresses_diff(const diff *diff) const
Evaluate this suppression specification on a given diff node and say if the diff node should be suppr...
bool suppresses_type(const type_base_sptr &type, const diff_context_sptr &ctxt) const
Test if the current instance of type_suppression suppresses a change reports about a given type.
void set_has_size_change(bool flag)
Setter of the "has_size_change" property.
void set_reach_kind(reach_kind k)
Setter of the way the diff node matching the current suppression specification is to be reached.
void set_potential_data_member_names(const string_set_type &) const
Setter of the "potential_data_member_names" property.
bool get_has_size_change() const
Getter of the "has_size_change" property.
const string & get_potential_data_member_names_regex_str() const
Getter of the "potential_data_member_names_regex" string.
const string & get_type_name() const
Getter for the name of the type about which diff reports should be suppressed.
void set_data_member_insertion_ranges(const insertion_ranges &r)
Setter for the vector of data member insertion ranges that specifies where a data member is inserted ...
void set_potential_data_member_names_regex_str(const string &) const
Setter of the "potential_data_member_names_regex" string.
shared_ptr< insertion_range > insertion_range_sptr
A convenience typedef for a shared pointer to insertion_range.
The abstraction of a variable suppression specification.
void set_symbol_name(const string &)
Setter for the name of the symbol of the variable the user wants the current specification to designa...
void set_name_regex_str(const string &)
Setter for the regular expression for a family of names of variables the user wants the current speci...
virtual ~variable_suppression()
Virtual destructor for the @erf variable_suppression type. variable_suppression type.
const string & get_symbol_version() const
Getter for the version of the symbol of the variable the user wants the current specification to desi...
variable_suppression(const string &label="", const string &name="", const string &name_regex_str="", const string &symbol_name="", const string &symbol_name_regex_str="", const string &symbol_version="", const string &symbol_version_regex_str="", const string &type_name="", const string &type_name_regex_str="")
Constructor for the variable_suppression type.
void set_change_kind(change_kind k)
Setter of the "change_kind" property.
static change_kind parse_change_kind(const string &)
Parses a string containing the content of the "change-kind" property and returns the an instance of v...
change_kind
The kind of change the current variable suppression should apply to.
@ ADDED_VARIABLE_CHANGE_KIND
The variable was added to the second second subject of the diff.
@ ALL_CHANGE_KIND
This represents all the changes possibly described by this enum. It's a logical 'OR' of all the chang...
@ DELETED_VARIABLE_CHANGE_KIND
The variable was deleted from the second subject of the diff.
@ VARIABLE_SUBTYPE_CHANGE_KIND
A change in a sub-type of the variable.
const string & get_symbol_version_regex_str() const
Getter of the regular expression for a family of versions of symbol for the variables the user wants ...
const string & get_name() const
Getter for the name of the variable the user wants the current specification to designate....
const string & get_symbol_name() const
Getter for the name of the symbol of the variable the user wants the current specification to designa...
void set_symbol_name_regex_str(const string &)
Setter of the regular expression for a family of symbol names of the variables this specification is ...
const string & get_symbol_name_regex_str() const
Getter of the regular expression for a family of symbol names of the variables this specification is ...
const string & get_type_name_regex_str() const
Getter for the regular expression for a family of type names of variables the user wants the current ...
void set_symbol_name_not_regex_str(const string &)
Setter for a regular expression for a family of names of symbols of variables the user wants this spe...
void set_type_name(const string &)
Setter for the name of the type of the variable the user wants the current specification to designate...
change_kind get_change_kind() const
Getter of the "change_king" property.
void set_name_not_regex_str(const string &)
Setter for the "name_not_regexp" property of the specification.
void set_symbol_version(const string &)
Setter for the version of the symbol of the variable the user wants the current specification to desi...
bool suppresses_variable(const var_decl *var, change_kind k, const diff_context_sptr cxt) const
Evaluate the current variable suppression specification on a given var_decl and say if a report about...
void set_name(const string &)
Setter for the name of the variable the user wants the current specification to designate....
const string & get_name_not_regex_str() const
Getter for the "name_not_regexp" property of the specification.
const string & get_symbol_name_not_regex_str() const
Getter for a regular expression for a family of names of symbols of variables the user wants this spe...
void set_type_name_regex_str(const string &)
Setter for the regular expression for a family of type names of variables the user wants the current ...
void set_symbol_version_regex_str(const string &)
Setter of the regular expression for a family of versions of symbol for the variables the user wants ...
const string & get_type_name() const
Getter for the name of the type of the variable the user wants the current specification to designate...
bool suppresses_diff(const diff *d) const
Evaluate this suppression specification on a given diff node and say if the diff node should be suppr...
const string & get_name_regex_str() const
Getter for the regular expression for a family of names of variables the user wants the current speci...
bool suppresses_variable_symbol(const elf_symbol *sym, change_kind k, const diff_context_sptr cxt) const
Evaluate the current variable suppression specification on a given elf_symbol and say if a report abo...
shared_ptr< diff_context > diff_context_sptr
Convenience typedef for a shared pointer of diff_context.
Definition: abg-fwd.h:71
shared_ptr< function_call_expr > function_call_expr_sptr
Convenience typedef for a shared pointer to function_call_expr.
Definition: abg-ini.h:430
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
Definition: abg-fwd.h:266
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
Definition: abg-ir.h:874
change_kind
A bitfield that gives callers of abigail::ir::equals() some insight about how different two internal ...
Definition: abg-ir.h:1309
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
Definition: abg-fwd.h:249
type_suppression::insertion_range::fn_call_expr_boundary_sptr is_fn_call_expr_boundary(type_suppression::insertion_range::boundary_sptr b)
Tests if a given instance of type_suppression::insertion_range::boundary is actually an function call...
function_suppression::change_kind operator|(function_suppression::change_kind l, function_suppression::change_kind r)
The bitwise 'or' operator for the enum function_suppression::change_kind.
type_suppression::insertion_range::integer_boundary_sptr is_integer_boundary(type_suppression::insertion_range::boundary_sptr b)
Tests if a given instance of type_suppression::insertion_range::boundary is actually an integer bound...
vector< negated_suppression_sptr > negated_suppressions_type
Convenience typedef for a vector of negated_suppression_sptr.
shared_ptr< variable_suppression > variable_suppression_sptr
A convenience typedef for a shared pointer to variable_suppression.
shared_ptr< negated_suppression_base > negated_suppression_sptr
A convenience typedef for a shared pointer to negated_suppression_base.
shared_ptr< file_suppression > file_suppression_sptr
A convenience typedef for a shared_ptr to file_suppression.
vector< suppression_sptr > suppressions_type
Convenience typedef for a vector of suppression_sptr.
Definition: abg-fwd.h:1556
shared_ptr< function_suppression > function_suppression_sptr
Convenience typedef for a shared pointer to function_suppression.
variable_suppression_sptr is_variable_suppression(const suppression_sptr s)
Test if an instance of suppression is an instance of variable_suppression.
const char * get_private_types_suppr_spec_label()
bool is_private_type_suppr_spec(const type_suppression &s)
Test if a type suppression specification represents a private type suppression automatically generate...
vector< variable_suppression_sptr > variable_suppressions_type
A convenience typedef for a vector of variable_suppression_sptr.
vector< function_suppression_sptr > function_suppressions_type
Convenience typedef for a vector of function_suppression_sptr.
bool suppression_can_match(const fe_iface &fe, const suppression_base &s)
Test if a given suppression specification can match an ABI artifact coming from the corpus being anal...
file_suppression_sptr is_file_suppression(const suppression_sptr s)
Test if a given suppression specification is a file suppression specification.
bool is_elf_symbol_suppressed(const fe_iface &fe, const elf_symbol_sptr &symbol)
Test if an ELF symbol is suppressed by at least one of the suppression specifications associated with...
shared_ptr< type_suppression > type_suppression_sptr
Convenience typedef for a shared pointer to type_suppression.
function_suppression_sptr is_function_suppression(const suppression_sptr suppr)
Test if an instance of suppression is an instance of function_suppression.
bool suppression_matches_variable_name(const suppr::variable_suppression &s, const string &var_name)
Test if a variable suppression matches a variable denoted by its name.
bool suppression_matches_soname_or_filename(const string &soname, const string &filename, const suppression_base &suppr)
Test if a given SONAME or file name is matched by a given suppression specification.
type_suppression_sptr is_type_suppression(suppression_sptr suppr)
Test if an instance of suppression is an instance of type_suppression.
bool is_type_suppressed(const fe_iface &fe, const string &type_name, const location &type_location, bool &type_is_private, bool require_drop_property)
Test if a type is matched by at least one suppression specification associated with a given front-end...
vector< type_suppression_sptr > type_suppressions_type
Convenience typedef for vector of type_suppression_sptr.
bool suppression_matches_type_name_or_location(const type_suppression &s, const string &type_name, const location &type_location)
Test if a type suppression matches a type name and location.
function_suppression::change_kind operator&(function_suppression::change_kind l, function_suppression::change_kind r)
The bitwise 'and' operator for the enum function_suppression::change_kind.
bool is_data_member_offset_in_range(const var_decl_sptr &dm, const type_suppression::insertion_range_sptr &range, const class_or_union *context)
Test if a data memer offset is in a given insertion range.
bool is_function_suppressed(const fe_iface &fe, const string &fn_name, const string &fn_linkage_name, bool require_drop_property)
Test if a function is matched by at least one suppression specification associated with a given front...
bool suppression_matches_soname(const string &soname, const suppression_base &suppr)
Test if a given SONAME is matched by a given suppression specification.
void read_suppressions(std::istream &input, suppressions_type &suppressions)
Read suppressions specifications from an input stream.
shared_ptr< suppression_base > suppression_sptr
Convenience typedef for a shared pointer to a suppression.
Definition: abg-fwd.h:1553
bool is_negated_suppression(const suppression_base &s)
Test if a suppression specification is a negated suppression.
bool suppression_matches_variable_sym_name(const suppr::variable_suppression &s, const string &var_linkage_name)
Test if a variable suppression matches a variable denoted by its symbol name.
file_suppression_sptr file_is_suppressed(const string &file_path, const suppressions_type &sprs)
Test if a given file path is "suppressed" by at least one file suppression specification among a vect...
bool is_variable_suppressed(const fe_iface &fe, const string &var_name, const string &var_linkage_name, bool require_drop_property)
Test if a variable is matched by at least one suppression specification associated with a given front...
Toplevel namespace for libabigail.
Private data for the diff type. The details of generic view of the diff node are expressed here.
The type of the private data of the function_suppression type.