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 
16 namespace abigail
17 {
18 
19 class 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.
30 namespace suppr
31 {
32 using std::unordered_set;
33 using std::string;
34 using std::shared_ptr;
35 using std::vector;
36 using 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 {
52 public:
53  class priv; // declare publicly to allow subclasses to reuse the priv
54 private:
55  // Forbid default constructor
57 
58 public:
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
77  set_is_artificial(bool);
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&
110  get_soname_not_regex_str() const;
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.
131 typedef shared_ptr<suppression_base> suppression_sptr;
132 
133 /// Convenience typedef for a vector of @ref suppression_sptr
134 typedef vector<suppression_sptr> suppressions_type;
135 
136 void
137 read_suppressions(std::istream& input,
138  suppressions_type& suppressions);
139 
140 void
141 read_suppressions(const string& file_path,
142  suppressions_type& suppressions);
143 
144 class type_suppression;
145 
146 /// Convenience typedef for a shared pointer to type_suppression.
147 typedef shared_ptr<type_suppression> type_suppression_sptr;
148 
149 /// Convenience typedef for vector of @ref type_suppression_sptr.
150 typedef 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 {
160 public:
162 
163  virtual ~negated_suppression_base();
164 }; // end class negated_suppression_base.
165 
166 /// A convenience typedef for a shared pointer to @ref
167 /// negated_suppression_base.
168 typedef shared_ptr<negated_suppression_base> negated_suppression_sptr;
169 
170 /// Convenience typedef for a vector of @ref negated_suppression_sptr
171 typedef vector<negated_suppression_sptr> negated_suppressions_type;
172 
173 bool
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 
193 public:
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&
247  get_type_name_regex_str() const;
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
262  get_consider_type_kind() const;
263 
264  void
265  set_consider_type_kind(bool f);
266 
267  void
269 
270  type_kind
271  get_type_kind() const;
272 
273  bool
274  get_consider_reach_kind() const;
275 
276  void
277  set_consider_reach_kind(bool f);
278 
279  reach_kind
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
301  set_potential_data_member_names_regex_str(const string&) const;
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  const vector<regex::regex_t_sptr>&
335 
336  void
337  set_changed_enumerators_regexp(const vector<regex::regex_t_sptr>&);
338 
339  bool
340  has_strict_fam_conversion () const;
341 
342  void
344 
345  virtual bool
346  suppresses_diff(const diff* diff) const;
347 
348  bool
349  suppresses_type(const type_base_sptr& type,
350  const diff_context_sptr& ctxt) const;
351 
352  bool
353  suppresses_type(const type_base_sptr& type) const;
354 
355  bool
356  suppresses_type(const type_base_sptr& type,
357  const scope_decl* type_scope) const;
358 }; // end type_suppression
359 
362 
363 /// The abstraction of a range of offsets in which a member of a type
364 /// might get inserted.
366 {
367  struct priv;
368  std::unique_ptr<priv> priv_;
369 
370 public:
371 
372  class boundary;
373  class integer_boundary;
374  class fn_call_expr_boundary;
375  class named_boundary;
376 
377  /// Convenience typedef for a shared_ptr to @ref boundary
378  typedef shared_ptr<boundary> boundary_sptr;
379 
380  /// Convenience typedef for a shared_ptr to a @ref integer_boundary
381  typedef shared_ptr<integer_boundary> integer_boundary_sptr;
382 
383  /// Convenience typedef for a shared_ptr to a @ref
384  /// fn_call_expr_boundary
385  typedef shared_ptr<fn_call_expr_boundary> fn_call_expr_boundary_sptr;
386 
387  /// Convenience typedef for a shared_ptr to a @ref
388  /// named_boundary
389  typedef shared_ptr<named_boundary> named_boundary_sptr;
390 
391  insertion_range();
392 
394 
396  begin() const;
397 
399  end() const;
400 
402  create_integer_boundary(int value);
403 
406 
408  create_fn_call_expr_boundary(const string&);
409 
411  create_named_boundary(const string&);
412 
413  static bool
415  const class_or_union* context,
416  uint64_t& value);
417 
418  static bool
419  boundary_value_is_end(uint64_t value);
420 }; // end class insertion_range
421 
424 
427 
430 
431 /// The abstraction of the boundary of an @ref insertion_range, in the
432 /// context of a @ref type_suppression
434 {
435  struct priv;
436  std::unique_ptr<priv> priv_;
437 
438 public:
439  boundary();
440  virtual ~boundary();
441 };// end class type_suppression::insertion_range::boundary
442 
443 /// An @ref insertion_range boundary that is expressed as an integer
444 /// value. That integer value is usually a bit offset.
447 {
448  struct priv;
449  std::unique_ptr<priv> priv_;
450 
452 
453 public:
454  integer_boundary(uint64_t value);
455  uint64_t as_integer() const;
456  operator uint64_t () const;
458 }; //end class type_suppression::insertion_range::integer_boundary
459 
460 /// An @ref insertion_range boundary that is expressed as function
461 /// call expression. The (integer) value of that expression is
462 /// usually a bit offset.
465 {
466  struct priv;
467  std::unique_ptr<priv> priv_;
468 
470 
471 public:
474  operator ini::function_call_expr_sptr () const;
476 }; //end class type_suppression::insertion_range::fn_call_expr_boundary
477 
478 /// An @ref insertion_range boundary that is expressed as a named
479 /// constant that is to be evaluated later in the context of a given
480 /// type and resolved to a bit offset.
483 {
484  struct priv;
485  std::unique_ptr<priv> priv_;
486 
487  named_boundary();
488 
489 public:
490  named_boundary(const string& name);
491  const string& get_name() const;
492 }; //end class type_suppression::insertion_range::named_boundary
493 
494 /// Abstraction of a negated type suppression specification.
495 ///
496 /// A negated type suppression suppresses a type if the negation of
497 /// the equivalent propositions for a @ref type_suppression are valid.
499  virtual public negated_suppression_base
500 {
501 
502 public:
503 
504  negated_type_suppression(const string& label,
505  const string& type_name_regexp,
506  const string& type_name);
507 
508  virtual bool
509  suppresses_diff(const diff* diff) const;
510 
511  bool
512  suppresses_type(const type_base_sptr& type,
513  const diff_context_sptr& ctxt) const;
514 
515  bool
516  suppresses_type(const type_base_sptr& type) const;
517 
518  bool
519  suppresses_type(const type_base_sptr& type,
520  const scope_decl* type_scope) const;
521 
522  virtual ~negated_type_suppression();
523 };// end class negated_type_suppression
524 
526 
527 /// Convenience typedef for a shared pointer to function_suppression.
528 typedef shared_ptr<function_suppression> function_suppression_sptr;
529 
530 /// Convenience typedef for a vector of @ref function_suppression_sptr.
531 typedef vector<function_suppression_sptr> function_suppressions_type;
532 
533 /// Abstraction of a function suppression specification.
534 ///
535 /// Specifies under which condition reports about a @ref
536 /// function_decl_diff diff node should be dropped on the floor for
537 /// the purpose of reporting.
539 {
540  struct priv;
541 
542 public:
543 
544  std::unique_ptr<priv> priv_;
545  class parameter_spec;
546 
547  /// Convenience typedef for shared_ptr of @ref parameter_spec.
548  typedef shared_ptr<parameter_spec> parameter_spec_sptr;
549 
550  /// Convenience typedef for vector of @ref parameter_spec_sptr.
551  typedef vector<parameter_spec_sptr> parameter_specs_type;
552 
553  /// The kind of change the current function suppression should apply
554  /// to.
556  {
557  UNDEFINED_CHANGE_KIND,
558  /// A change in a sub-type of the function.
560  /// The function was added to the second subject of the diff.
562  /// The function was deleted from the second subject of the diff.
564  /// This represents all the changes possibly described by this
565  /// enum. It's a logical 'OR' of all the change enumerators
566  /// above.
570  };
571 
573 
574  function_suppression(const string& label,
575  const string& name,
576  const string& name_regex,
577  const string& return_type_name,
578  const string& return_type_regex,
579  parameter_specs_type& parm_specs,
580  const string& symbol_name,
581  const string& symbol_name_regex,
582  const string& symbol_version,
583  const string& symbol_version_regex_str);
584 
585  virtual ~function_suppression();
586 
587  static change_kind
588  parse_change_kind(const string&);
589 
591  get_change_kind() const;
592 
593  void
595 
596  const string&
597  get_name() const;
598 
599  void
600  set_name(const string&);
601 
602  const string&
603  get_name_regex_str() const;
604 
605  void
606  set_name_regex_str(const string&);
607 
608  const string&
609  get_name_not_regex_str() const;
610 
611  void
612  set_name_not_regex_str(const string&);
613 
614  const string&
615  get_return_type_name() const;
616 
617  void
618  set_return_type_name(const string&);
619 
620  const string&
622 
623  void
624  set_return_type_regex_str(const string& r);
625 
626  const parameter_specs_type&
627  get_parameter_specs() const;
628 
629  void
631 
632  void
634 
635  const string&
636  get_symbol_name() const;
637 
638  void
639  set_symbol_name(const string& n);
640 
641  const string&
643 
644  void
645  set_symbol_name_regex_str(const string&);
646 
647  const string&
649 
650  void
651  set_symbol_name_not_regex_str(const string&);
652 
653  const string&
654  get_symbol_version() const;
655 
656  void
657  set_symbol_version(const string&);
658 
659  const string&
661 
662  void
663  set_symbol_version_regex_str(const string&);
664 
665  bool
666  get_allow_other_aliases() const;
667 
668  void
669  set_allow_other_aliases(bool f);
670 
671  virtual bool
672  suppresses_diff(const diff* diff) const;
673 
674  bool
676  change_kind k,
677  const diff_context_sptr ctxt) const;
678 
679  bool
681  change_kind k,
682  const diff_context_sptr ctxt) const;
683 
684  bool
686  change_kind k,
687  const diff_context_sptr ctxt);
688 
689  bool
691  change_kind k,
692  const diff_context_sptr ctxt);
693 }; // end class function_suppression.
694 
697 
701 
705 
706 /// Abstraction of the specification of a function parameter in a
707 /// function suppression specification.
709 {
710  friend class function_suppression;
711 
712  class priv;
713  std::unique_ptr<priv> priv_;
714 
715  // Forbid this.
716  parameter_spec();
717 
718 public:
719  parameter_spec(size_t index,
720  const string& type_name,
721  const string& type_name_regex);
722 
723  size_t
724  get_index() const;
725 
726  void
727  set_index(size_t);
728 
729  const string&
730  get_parameter_type_name() const;
731 
732  void
733  set_parameter_type_name(const string&);
734 
735  const string&
737 
738  void
739  set_parameter_type_name_regex_str(const string&);
740 };// end class function_suppression::parameter_spec
741 
743 
744 /// A convenience typedef for a shared pointer to @ref
745 /// variable_suppression.
746 typedef shared_ptr<variable_suppression> variable_suppression_sptr;
747 
748 /// A convenience typedef for a vector of @ref
749 /// variable_suppression_sptr.
750 typedef vector<variable_suppression_sptr> variable_suppressions_type;
751 
752 /// The abstraction of a variable suppression specification.
753 ///
754 /// It specifies under which condition reports about a @ref var_diff
755 /// diff node should be dropped on the floor for the purpose of
756 /// reporting.
758 {
759 public:
760 
761  /// The kind of change the current variable suppression should apply
762  /// to.
764  {
765  UNDEFINED_CHANGE_KIND,
766  /// A change in a sub-type of the variable.
768  /// The variable was added to the second second subject of the
769  /// diff.
771  /// The variable was deleted from the second subject of the diff.
773  /// This represents all the changes possibly described by this
774  /// enum. It's a logical 'OR' of all the change enumerators
775  /// above.
779  };
780 
781 private:
782  struct priv;
783 
784 public:
785  std::unique_ptr<priv> priv_;
786 
787  variable_suppression(const string& label = "",
788  const string& name = "",
789  const string& name_regex_str = "",
790  const string& symbol_name = "",
791  const string& symbol_name_regex_str = "",
792  const string& symbol_version = "",
793  const string& symbol_version_regex_str = "",
794  const string& type_name = "",
795  const string& type_name_regex_str = "");
796 
797  virtual ~variable_suppression();
798 
799  static change_kind
800  parse_change_kind(const string&);
801 
803  get_change_kind() const;
804 
805  void
807 
808  const string&
809  get_name() const;
810 
811  void
812  set_name(const string&);
813 
814  const string&
815  get_name_regex_str() const;
816 
817  void
818  set_name_regex_str(const string&);
819 
820  const string&
821  get_name_not_regex_str() const;
822 
823  void
824  set_name_not_regex_str(const string&);
825 
826  const string&
827  get_symbol_name() const;
828 
829  void
830  set_symbol_name(const string&);
831 
832  const string&
834 
835  void
836  set_symbol_name_regex_str(const string&);
837 
838  const string&
840 
841  void
842  set_symbol_name_not_regex_str(const string&);
843 
844  const string&
845  get_symbol_version() const;
846 
847  void
848  set_symbol_version(const string&);
849 
850  const string&
852 
853  void
854  set_symbol_version_regex_str(const string&);
855 
856  const string&
857  get_type_name() const;
858 
859  void
860  set_type_name(const string&);
861 
862  const string&
863  get_type_name_regex_str() const;
864 
865  void
866  set_type_name_regex_str(const string&);
867 
868  bool
869  suppresses_diff(const diff* d) const;
870 
871  bool
872  suppresses_variable(const var_decl* var,
873  change_kind k,
874  const diff_context_sptr cxt) const;
875 
876  bool
878  change_kind k,
879  const diff_context_sptr cxt) const;
880 
881  bool
883  change_kind k,
884  const diff_context_sptr cxt) const;
885 
886  bool
888  change_kind k,
889  const diff_context_sptr cxt) const;
890 }; // end class variable_suppression
891 
894 
898 
902 
903 class file_suppression;
904 
905 /// A convenience typedef for a shared_ptr to @ref file_suppression
906 typedef shared_ptr<file_suppression> file_suppression_sptr;
907 
908 /// Abstraction of a suppression specification to avoid loading a
909 /// file.
910 ///
911 /// This can be used by a tool that loads (binary) files, to know
912 /// which file it has to avoid loading.
914 {
915  std::unique_ptr<priv> priv_;
916 
917  // Forbid this
919 
920 public:
921 
922  file_suppression(const string& label,
923  const string& file_name_regex,
924  const string& file_name_not_regex);
925 
926  virtual bool
927  suppresses_diff(const diff* diff) const;
928 
929  bool
930  suppresses_file(const string& file_path);
931 
932  virtual ~file_suppression();
933 }; // end file_suppression
934 
937 
939 file_is_suppressed(const string& file_path,
940  const suppressions_type& suppressions);
941 
942 bool
943 suppression_matches_soname(const string& soname,
944  const suppression_base& suppr);
945 
946 bool
947 suppression_matches_soname_or_filename(const string& soname,
948  const string& filename,
949  const suppression_base& suppr);
950 
951 const char*
953 
954 bool
956 
957 bool
959 
960 bool
962  const suppression_base&);
963 
964 bool
965 suppression_matches_function_name(const fe_iface&,
967  const string&);
968 
969 bool
970 suppression_matches_function_sym_name(const fe_iface&,
972  const string& fn_linkage_name);
973 
974 bool
977  const string& var_name);
978 
979 bool
982  const string&);
983 
984 bool
987  const string&,
988  const location&);
989 
990 bool
992  const elf_symbol_sptr& symbol);
993 
994 bool
996  const string& sym_name,
997  elf_symbol::type sym_type);
998 
999 bool
1001  const string& fn_name,
1002  const string& fn_linkage_name,
1003  bool require_drop_property = false);
1004 
1005 bool
1007  const string& var_name,
1008  const string& var_linkage_name,
1009  bool require_drop_property = false);
1010 
1011 bool
1012 is_type_suppressed(const fe_iface& fe,
1013  const string& type_name,
1014  const location& type_location,
1015  bool& type_is_private,
1016  bool require_drop_property = false);
1017 
1018 bool
1021  const class_or_union*);
1022 
1023 } // end namespace suppr
1024 
1025 
1026 } // end namespace abigail
1027 
1028 #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:4029
Abstraction of an elf symbol.
Definition: abg-ir.h:923
type
The type of a symbol.
Definition: abg-ir.h:927
Abstraction for a function declaration.
Definition: abg-ir.h:3111
The source location of a token.
Definition: abg-ir.h:299
A declaration that introduces a scope.
Definition: abg-ir.h:1809
Abstracts a variable declaration.
Definition: abg-ir.h:3008
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...
An insertion_range boundary that is expressed as a named constant that is to be evaluated later in th...
const string & get_name() const
Getter for the name of the named boundary.
The abstraction of a range of offsets in which a member of a type might get inserted.
static insertion_range::named_boundary_sptr create_named_boundary(const string &)
Create a named boundary.
shared_ptr< named_boundary > named_boundary_sptr
Convenience typedef for a shared_ptr to a named_boundary.
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 vector< regex::regex_t_sptr > & get_changed_enumerators_regexp() const
Getter of the vector of the regular expression strings for changed enumerators that are supposed to b...
void set_changed_enumerators_regexp(const vector< regex::regex_t_sptr > &)
Setter of the vector of the regular expression strings for changed enumerators that are supposed to b...
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...
bool has_strict_fam_conversion() const
Getter of the "has_string_fam_conversion" property.
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.
void set_has_strict_fam_conversion(bool)
Setter of the "has_string_fam_conversion" property.
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:68
shared_ptr< function_call_expr > function_call_expr_sptr
Convenience typedef for a shared pointer to function_call_expr.
Definition: abg-ini.h:427
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
Definition: abg-fwd.h:267
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
Definition: abg-ir.h:886
change_kind
A bitfield that gives callers of abigail::ir::equals() some insight about how different two internal ...
Definition: abg-ir.h:1323
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
Definition: abg-fwd.h:254
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 a 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.
const char * get_opaque_types_suppr_spec_label()
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:1658
type_suppression::insertion_range::named_boundary_sptr is_named_boundary(type_suppression::insertion_range::boundary_sptr b)
Test if a given instance of type_suppression::insertion_range::boundary is actually a named boundary.
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.
vector< variable_suppression_sptr > variable_suppressions_type
A convenience typedef for a vector of variable_suppression_sptr.
bool is_opaque_type_suppr_spec(const type_suppression &s)
Test if a type suppression specification represents a private type suppression automatically generate...
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.
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.
bool is_type_suppressed(const fe_iface &fe, const string &type_name, const location &type_location, bool &type_is_opaque, bool require_drop_property)
Test if a type is matched by at least one suppression specification associated with a given front-end...
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:1652
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.
The type of the private data of the function_suppression type.