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 
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 
179 negated_suppression_sptr
180 is_negated_suppression(const suppression_sptr&);
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 
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
304  set_data_member_insertion_ranges(const insertion_ranges& r);
305 
306  const insertion_ranges&
308 
309  insertion_ranges&
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  virtual bool
340  suppresses_diff(const diff* diff) const;
341 
342  bool
343  suppresses_type(const type_base_sptr& type,
344  const diff_context_sptr& ctxt) const;
345 
346  bool
347  suppresses_type(const type_base_sptr& type) const;
348 
349  bool
350  suppresses_type(const type_base_sptr& type,
351  const scope_decl* type_scope) const;
352 }; // end type_suppression
353 
354 type_suppression_sptr
355 is_type_suppression(const suppression_sptr);
356 
357 /// The abstraction of a range of offsets in which a member of a type
358 /// might get inserted.
360 {
361  struct priv;
362  std::unique_ptr<priv> priv_;
363 
364 public:
365 
366  class boundary;
367  class integer_boundary;
368  class fn_call_expr_boundary;
370 
371  /// Convenience typedef for a shared_ptr to @ref boundary
372  typedef shared_ptr<boundary> boundary_sptr;
373 
374  /// Convenience typedef for a shared_ptr to a @ref integer_boundary
375  typedef shared_ptr<integer_boundary> integer_boundary_sptr;
376 
377  /// Convenience typedef for a shared_ptr to a @ref
378  /// fn_call_expr_boundary
379  typedef shared_ptr<fn_call_expr_boundary> fn_call_expr_boundary_sptr;
380 
381  /// Convenience typedef for a shared_ptr to a @ref
382  /// named_boundary
383  typedef shared_ptr<named_boundary> named_boundary_sptr;
384 
385  insertion_range();
386 
387  insertion_range(boundary_sptr begin, boundary_sptr end);
388 
389  boundary_sptr
390  begin() const;
391 
392  boundary_sptr
393  end() const;
394 
396  create_integer_boundary(int value);
397 
400 
402  create_fn_call_expr_boundary(const string&);
403 
405  create_named_boundary(const string&);
406 
407  static bool
408  eval_boundary(const boundary_sptr boundary,
409  const class_or_union* context,
410  uint64_t& value);
411 
412  static bool
413  boundary_value_is_end(uint64_t value);
414 }; // end class insertion_range
415 
418 
421 
424 
425 /// The abstraction of the boundary of an @ref insertion_range, in the
426 /// context of a @ref type_suppression
428 {
429  struct priv;
430  std::unique_ptr<priv> priv_;
431 
432 public:
433  boundary();
434  virtual ~boundary();
435 };// end class type_suppression::insertion_range::boundary
436 
437 /// An @ref insertion_range boundary that is expressed as an integer
438 /// value. That integer value is usually a bit offset.
441 {
442  struct priv;
443  std::unique_ptr<priv> priv_;
444 
446 
447 public:
448  integer_boundary(uint64_t value);
449  uint64_t as_integer() const;
450  operator uint64_t () const;
452 }; //end class type_suppression::insertion_range::integer_boundary
453 
454 /// An @ref insertion_range boundary that is expressed as function
455 /// call expression. The (integer) value of that expression is
456 /// usually a bit offset.
459 {
460  struct priv;
461  std::unique_ptr<priv> priv_;
462 
464 
465 public:
468  operator ini::function_call_expr_sptr () const;
470 }; //end class type_suppression::insertion_range::fn_call_expr_boundary
471 
472 /// An @ref insertion_range boundary that is expressed as a named
473 /// constant that is to be evaluated later in the context of a given
474 /// type and resolved to a bit offset.
477 {
478  struct priv;
479  std::unique_ptr<priv> priv_;
480 
481  named_boundary();
482 
483 public:
484  named_boundary(const string& name);
485  const string& get_name() const;
486 }; //end class type_suppression::insertion_range::named_boundary
487 
488 /// Abstraction of a negated type suppression specification.
489 ///
490 /// A negated type suppression suppresses a type if the negation of
491 /// the equivalent propositions for a @ref type_suppression are valid.
493  virtual public negated_suppression_base
494 {
495 
496 public:
497 
498  negated_type_suppression(const string& label,
499  const string& type_name_regexp,
500  const string& type_name);
501 
502  virtual bool
503  suppresses_diff(const diff* diff) const;
504 
505  bool
506  suppresses_type(const type_base_sptr& type,
507  const diff_context_sptr& ctxt) const;
508 
509  bool
510  suppresses_type(const type_base_sptr& type) const;
511 
512  bool
513  suppresses_type(const type_base_sptr& type,
514  const scope_decl* type_scope) const;
515 
516  virtual ~negated_type_suppression();
517 };// end class negated_type_suppression
518 
520 
521 /// Convenience typedef for a shared pointer to function_suppression.
522 typedef shared_ptr<function_suppression> function_suppression_sptr;
523 
524 /// Convenience typedef for a vector of @ref function_suppression_sptr.
525 typedef vector<function_suppression_sptr> function_suppressions_type;
526 
527 /// Abstraction of a function suppression specification.
528 ///
529 /// Specifies under which condition reports about a @ref
530 /// function_decl_diff diff node should be dropped on the floor for
531 /// the purpose of reporting.
533 {
534  struct priv;
535 
536 public:
537 
538  std::unique_ptr<priv> priv_;
540 
541  /// Convenience typedef for shared_ptr of @ref parameter_spec.
542  typedef shared_ptr<parameter_spec> parameter_spec_sptr;
543 
544  /// Convenience typedef for vector of @ref parameter_spec_sptr.
545  typedef vector<parameter_spec_sptr> parameter_specs_type;
546 
547  /// The kind of change the current function suppression should apply
548  /// to.
550  {
551  UNDEFINED_CHANGE_KIND,
552  /// A change in a sub-type of the function.
554  /// The function was added to the second subject of the diff.
556  /// The function was deleted from the second subject of the diff.
558  /// This represents all the changes possibly described by this
559  /// enum. It's a logical 'OR' of all the change enumerators
560  /// above.
564  };
565 
567 
568  function_suppression(const string& label,
569  const string& name,
570  const string& name_regex,
571  const string& return_type_name,
572  const string& return_type_regex,
573  parameter_specs_type& parm_specs,
574  const string& symbol_name,
575  const string& symbol_name_regex,
576  const string& symbol_version,
577  const string& symbol_version_regex_str);
578 
579  virtual ~function_suppression();
580 
581  static change_kind
582  parse_change_kind(const string&);
583 
585  get_change_kind() const;
586 
587  void
589 
590  const string&
591  get_name() const;
592 
593  void
594  set_name(const string&);
595 
596  const string&
597  get_name_regex_str() const;
598 
599  void
600  set_name_regex_str(const string&);
601 
602  const string&
603  get_name_not_regex_str() const;
604 
605  void
606  set_name_not_regex_str(const string&);
607 
608  const string&
609  get_return_type_name() const;
610 
611  void
612  set_return_type_name(const string&);
613 
614  const string&
616 
617  void
618  set_return_type_regex_str(const string& r);
619 
620  const parameter_specs_type&
621  get_parameter_specs() const;
622 
623  void
624  set_parameter_specs(parameter_specs_type&);
625 
626  void
627  append_parameter_specs(const parameter_spec_sptr);
628 
629  const string&
630  get_symbol_name() const;
631 
632  void
633  set_symbol_name(const string& n);
634 
635  const string&
637 
638  void
639  set_symbol_name_regex_str(const string&);
640 
641  const string&
643 
644  void
645  set_symbol_name_not_regex_str(const string&);
646 
647  const string&
648  get_symbol_version() const;
649 
650  void
651  set_symbol_version(const string&);
652 
653  const string&
655 
656  void
657  set_symbol_version_regex_str(const string&);
658 
659  bool
660  get_allow_other_aliases() const;
661 
662  void
663  set_allow_other_aliases(bool f);
664 
665  virtual bool
666  suppresses_diff(const diff* diff) const;
667 
668  bool
670  change_kind k,
671  const diff_context_sptr ctxt) const;
672 
673  bool
675  change_kind k,
676  const diff_context_sptr ctxt) const;
677 
678  bool
680  change_kind k,
681  const diff_context_sptr ctxt);
682 
683  bool
685  change_kind k,
686  const diff_context_sptr ctxt);
687 }; // end class function_suppression.
688 
689 function_suppression_sptr
690 is_function_suppression(const suppression_sptr);
691 
695 
699 
700 /// Abstraction of the specification of a function parameter in a
701 /// function suppression specification.
703 {
704  friend class function_suppression;
705 
706  class priv;
707  std::unique_ptr<priv> priv_;
708 
709  // Forbid this.
710  parameter_spec();
711 
712 public:
713  parameter_spec(size_t index,
714  const string& type_name,
715  const string& type_name_regex);
716 
717  size_t
718  get_index() const;
719 
720  void
721  set_index(size_t);
722 
723  const string&
724  get_parameter_type_name() const;
725 
726  void
727  set_parameter_type_name(const string&);
728 
729  const string&
730  get_parameter_type_name_regex_str() const;
731 
732  void
733  set_parameter_type_name_regex_str(const string&);
734 };// end class function_suppression::parameter_spec
735 
737 
738 /// A convenience typedef for a shared pointer to @ref
739 /// variable_suppression.
740 typedef shared_ptr<variable_suppression> variable_suppression_sptr;
741 
742 /// A convenience typedef for a vector of @ref
743 /// variable_suppression_sptr.
744 typedef vector<variable_suppression_sptr> variable_suppressions_type;
745 
746 /// The abstraction of a variable suppression specification.
747 ///
748 /// It specifies under which condition reports about a @ref var_diff
749 /// diff node should be dropped on the floor for the purpose of
750 /// reporting.
752 {
753 public:
754 
755  /// The kind of change the current variable suppression should apply
756  /// to.
758  {
759  UNDEFINED_CHANGE_KIND,
760  /// A change in a sub-type of the variable.
761  VARIABLE_SUBTYPE_CHANGE_KIND = 1,
762  /// The variable was added to the second second subject of the
763  /// diff.
764  ADDED_VARIABLE_CHANGE_KIND = 1 << 1,
765  /// The variable was deleted from the second subject of the diff.
766  DELETED_VARIABLE_CHANGE_KIND = 1 << 2,
767  /// This represents all the changes possibly described by this
768  /// enum. It's a logical 'OR' of all the change enumerators
769  /// above.
770  ALL_CHANGE_KIND = (VARIABLE_SUBTYPE_CHANGE_KIND
771  | ADDED_VARIABLE_CHANGE_KIND
772  | DELETED_VARIABLE_CHANGE_KIND)
773  };
774 
775 private:
776  struct priv;
777 
778 public:
779  std::unique_ptr<priv> priv_;
780 
781  variable_suppression(const string& label = "",
782  const string& name = "",
783  const string& name_regex_str = "",
784  const string& symbol_name = "",
785  const string& symbol_name_regex_str = "",
786  const string& symbol_version = "",
787  const string& symbol_version_regex_str = "",
788  const string& type_name = "",
789  const string& type_name_regex_str = "");
790 
791  virtual ~variable_suppression();
792 
793  static change_kind
794  parse_change_kind(const string&);
795 
797  get_change_kind() const;
798 
799  void
801 
802  const string&
803  get_name() const;
804 
805  void
806  set_name(const string&);
807 
808  const string&
809  get_name_regex_str() const;
810 
811  void
812  set_name_regex_str(const string&);
813 
814  const string&
815  get_name_not_regex_str() const;
816 
817  void
818  set_name_not_regex_str(const string&);
819 
820  const string&
821  get_symbol_name() const;
822 
823  void
824  set_symbol_name(const string&);
825 
826  const string&
828 
829  void
830  set_symbol_name_regex_str(const string&);
831 
832  const string&
834 
835  void
836  set_symbol_name_not_regex_str(const string&);
837 
838  const string&
839  get_symbol_version() const;
840 
841  void
842  set_symbol_version(const string&);
843 
844  const string&
846 
847  void
848  set_symbol_version_regex_str(const string&);
849 
850  const string&
851  get_type_name() const;
852 
853  void
854  set_type_name(const string&);
855 
856  const string&
857  get_type_name_regex_str() const;
858 
859  void
860  set_type_name_regex_str(const string&);
861 
862  bool
863  suppresses_diff(const diff* d) const;
864 
865  bool
866  suppresses_variable(const var_decl* var,
867  change_kind k,
868  const diff_context_sptr cxt) const;
869 
870  bool
871  suppresses_variable(const var_decl_sptr var,
872  change_kind k,
873  const diff_context_sptr cxt) const;
874 
875  bool
876  suppresses_variable_symbol(const elf_symbol* sym,
877  change_kind k,
878  const diff_context_sptr cxt) const;
879 
880  bool
881  suppresses_variable_symbol(const elf_symbol_sptr fn,
882  change_kind k,
883  const diff_context_sptr cxt) const;
884 }; // end class variable_suppression
885 
886 variable_suppression_sptr
887 is_variable_suppression(const suppression_sptr);
888 
892 
896 
898 
899 /// A convenience typedef for a shared_ptr to @ref file_suppression
900 typedef shared_ptr<file_suppression> file_suppression_sptr;
901 
902 /// Abstraction of a suppression specification to avoid loading a
903 /// file.
904 ///
905 /// This can be used by a tool that loads (binary) files, to know
906 /// which file it has to avoid loading.
908 {
909  std::unique_ptr<priv> priv_;
910 
911  // Forbid this
913 
914 public:
915 
916  file_suppression(const string& label,
917  const string& file_name_regex,
918  const string& file_name_not_regex);
919 
920  virtual bool
921  suppresses_diff(const diff* diff) const;
922 
923  bool
924  suppresses_file(const string& file_path);
925 
926  virtual ~file_suppression();
927 }; // end file_suppression
928 
929 file_suppression_sptr
930 is_file_suppression(const suppression_sptr);
931 
932 file_suppression_sptr
933 file_is_suppressed(const string& file_path,
934  const suppressions_type& suppressions);
935 
936 bool
937 suppression_matches_soname(const string& soname,
938  const suppression_base& suppr);
939 
940 bool
941 suppression_matches_soname_or_filename(const string& soname,
942  const string& filename,
943  const suppression_base& suppr);
944 
945 const char*
947 
948 bool
950 
951 bool
952 is_private_type_suppr_spec(const suppression_sptr& s);
953 
954 bool
956  const suppression_base&);
957 
958 bool
959 suppression_matches_function_name(const fe_iface&,
961  const string&);
962 
963 bool
964 suppression_matches_function_sym_name(const fe_iface&,
966  const string& fn_linkage_name);
967 
968 bool
971  const string& var_name);
972 
973 bool
976  const string&);
977 
978 bool
981  const string&,
982  const location&);
983 
984 bool
986  const elf_symbol_sptr& symbol);
987 
988 bool
990  const string& sym_name,
991  elf_symbol::type sym_type);
992 
993 bool
995  const string& fn_name,
996  const string& fn_linkage_name,
997  bool require_drop_property = false);
998 
999 bool
1001  const string& var_name,
1002  const string& var_linkage_name,
1003  bool require_drop_property = false);
1004 
1005 bool
1006 is_type_suppressed(const fe_iface& fe,
1007  const string& type_name,
1008  const location& type_location,
1009  bool& type_is_private,
1010  bool require_drop_property = false);
1011 
1012 bool
1015  const class_or_union*);
1016 
1017 } // end namespace suppr
1018 
1019 
1020 } // end namespace abigail
1021 
1022 #endif //__ABG_SUPPRESSION_H__
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...
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< negated_suppression_base > negated_suppression_sptr
A convenience typedef for a shared pointer to negated_suppression_base.
void set_type_kind(type_kind k)
Setter of 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_name_not_regex_str() const
Getter for a regular expression of a family of names of functions the user wants the current specific...
const vector< string > & get_changed_enumerator_names() const
Getter of the vector of the changed enumerators that are supposed to be suppressed. Note that this will be "valid" only if the type suppression has the 'type_kind = enum' property.
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_consider_type_kind(bool f)
Setter of the property that says whether to consider the kind of type this suppression is about...
type_suppression_sptr is_type_suppression(suppression_sptr suppr)
Test if an instance of suppression is an instance of type_suppression.
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...
function_suppression_sptr is_function_suppression(const suppression_sptr suppr)
Test if an instance of suppression is an instance of function_suppression.
An insertion_range boundary that is expressed as function call expression. The (integer) value of tha...
const string & get_type_name_not_regex_str() const
Getter for the "type_name_not_regex_str" property of the type suppression specification.
The abstraction of a change between two ABI artifacts, a.k.a an artifact change.
void set_name(const string &)
Setter for the name of the function the user wants the current specification to designate. This might be empty, in which case it's ignored at evaluation time.
const string & get_file_name_regex_str() const
Getter for the "file_name_regex" property of the current instance of suppression_base.
static insertion_range::fn_call_expr_boundary_sptr create_fn_call_expr_boundary(ini::function_call_expr_sptr)
Create a function call expression boundary.
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...
insertion_range()
Default Constructor of type_suppression::insertion_range.
An insertion_range boundary that is expressed as a named constant that is to be evaluated later in th...
The type diff has been reached (from a function or variable change) through a reference; you know...
The base class of all libabigail front-ends: The Front End Interface.
Definition: abg-fe-iface.h:28
void set_consider_reach_kind(bool f)
Set a flag saying if the current type suppression specification suggests to consider how the matching...
vector< negated_suppression_sptr > negated_suppressions_type
Convenience typedef for a vector of negated_suppression_sptr.
shared_ptr< suppression_base > suppression_sptr
Convenience typedef for a shared pointer to a suppression.
Definition: abg-fwd.h:1597
static insertion_range::named_boundary_sptr create_named_boundary(const string &)
Create a named boundary.
Abstraction of a suppression specification to avoid loading a file.
The type diff has been reached (from a function or variable change) through a pointer.
The type of the private data of the function_suppression type.
This file contains the declarations for the ini file reader used in the libabigail library...
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 ...
A declaration that introduces a scope.
Definition: abg-ir.h:1795
bool is_negated_suppression(const suppression_base &s)
Test if a suppression specification is a negated suppression.
The type diff has been reached (from a function or variable change) through either a reference or a p...
negated_type_suppression(const string &label, const string &type_name_regexp, const string &type_name)
Constructor for negated_type_suppression.
shared_ptr< function_call_expr > function_call_expr_sptr
Convenience typedef for a shared pointer to function_call_expr.
Definition: abg-ini.h:427
bool has_file_name_related_property() const
Test if the current suppression has a property related to file name.
void set_is_artificial(bool)
Set a flag saying if the suppression specification is artificial or not.
const string & get_soname_not_regex_str() const
Getter of the "soname_not_regex_str property of the current instance of suppression_base.
shared_ptr< diff_context > diff_context_sptr
Convenience typedef for a shared pointer of diff_context.
Definition: abg-fwd.h:68
bool get_drops_artifact_from_ir() const
Tests if the current suppression specification is to avoid adding the matched ABI artifact to the int...
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.
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...
const string & get_symbol_name() const
Getter for the name of symbol of the function the user wants this specification to designate...
friend bool suppression_matches_soname(const string &soname, const suppression_base &suppr)
Test if a given SONAME is matched by a given suppression specification.
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
Definition: abg-fwd.h:246
The private data for type_suppression.
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_soname_not_regex_str(const string &regexp)
Setter of the "soname_not_regex_str property of the current instance of suppression_base.
shared_ptr< file_suppression > file_suppression_sptr
A convenience typedef for a shared_ptr to file_suppression.
bool get_is_artificial() const
Test is the suppression specification is artificial.
file_suppression_sptr is_file_suppression(const suppression_sptr s)
Test if a given suppression specification is a file suppression specification.
bool get_allow_other_aliases() const
Getter for the "allow_other_aliases" property of the function suppression specification.
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...
virtual ~boundary()
Destructor of type_suppression::insertion_range::boundary.
const string & get_type_name_regex_str() const
Getter for the "type_name_regex" property of the type suppression specification.
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.
The abstraction of the boundary of an insertion_range, in the context of a type_suppression.
void set_type_name(const string &name)
Setter for the name of the type about which diff reports should be suppressed.
static insertion_range::integer_boundary_sptr create_integer_boundary(int value)
Create an integer boundary.
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_symbol_version(const string &)
Setter for the name of the version of the symbol of the function the user wants this specification to...
shared_ptr< type_suppression > type_suppression_sptr
Convenience typedef for a shared pointer to type_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.
Abstracts a variable declaration.
Definition: abg-ir.h:2943
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.
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_name(const string &)
Setter for the name of the return type of the function the user wants this specification to designate...
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...
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...
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...
ini::function_call_expr_sptr as_function_call_expr() const
Returns the function call expression value of the current boundary.
const string & get_potential_data_member_names_regex_str() const
Getter of the "potential_data_member_names_regex" string.
void set_potential_data_member_names_regex_str(const string &) const
Setter of the "potential_data_member_names_regex" string.
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_symbol_version() const
Getter for the name of the version of the symbol of the function the user wants this specification to...
void set_type_name_regex_str(const string &name_regex_str)
Setter for the "type_name_regex" property of the type suppression specification.
shared_ptr< insertion_range > insertion_range_sptr
A convenience typedef for a shared pointer to insertion_range.
Toplevel namespace for libabigail.
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.
change_kind get_change_kind() const
Getter of the "change-kind" property.
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
Definition: abg-fwd.h:263
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.
The type of the private data of the variable_suppression type.
vector< function_suppression_sptr > function_suppressions_type
Convenience typedef for a vector of function_suppression_sptr.
boundary_sptr begin() const
Getter for the beginning of the range.
reach_kind
The different ways through which the type diff has been reached.
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...
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...
vector< variable_suppression_sptr > variable_suppressions_type
A convenience typedef for a vector of variable_suppression_sptr.
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.
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...
The type diff has been reached (from a function or variable change) directly.
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.
void read_suppressions(std::istream &input, suppressions_type &suppressions)
Read suppressions specifications from an input stream.
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...
Abstraction for a function declaration.
Definition: abg-ir.h:3046
type_kind get_type_kind() const
Getter of the kind of type this suppression is about.
Types of the main internal representation of libabigail.
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...
vector< insertion_range_sptr > insertion_ranges
A convenience typedef for a vector of insertion_range_sptr.
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...
The base type of class_decl and union_decl.
Definition: abg-ir.h:3961
type
The type of a symbol.
Definition: abg-ir.h:912
The source location of a token.
Definition: abg-ir.h:298
const string & get_soname_regex_str() const
Getter of the "soname_regex_str property of the current instance of suppression_base.
~integer_boundary()
Destructor of type_suppression::insertion_range::integer_boundary.
boundary_sptr end() const
Getter for the end of the range.
Abstraction of an elf symbol.
Definition: abg-ir.h:908
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...
The function was deleted from the second subject of the diff.
shared_ptr< named_boundary > named_boundary_sptr
Convenience typedef for a shared_ptr to a named_boundary.
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.
boundary()
Default constructor of type_suppression::insertion_range::boundary.
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
Definition: abg-ir.h:872
function_suppression()
Default constructor for the function_suppression type.
virtual ~negated_type_suppression()
Destructor of the negated_type_suppression type.
Base type of a direct suppression specifications types.
virtual ~negated_suppression_base()
Destructor of the negated_suppression_base.
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...
change_kind
The kind of change the current function suppression should apply to.
void set_allow_other_aliases(bool f)
Setter for the "allow_other_aliases" property of the function suppression specification.
vector< suppression_sptr > suppressions_type
Convenience typedef for a vector of suppression_sptr.
Definition: abg-fwd.h:1603
variable_suppression_sptr is_variable_suppression(const suppression_sptr s)
Test if an instance of suppression is an instance of variable_suppression.
shared_ptr< parameter_spec > parameter_spec_sptr
Convenience typedef for shared_ptr of parameter_spec.
void append_parameter_specs(const parameter_spec_sptr)
Append a specification of a parameter of the function specification.
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(const string_set_type &) const
Setter of the "potential_data_member_names" property.
const string & get_file_name_not_regex_str() const
Getter for the "file_name_not_regex" property of the current instance of suppression_base.
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...
change_kind
The kind of change the current variable suppression should apply to.
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...
vector< parameter_spec_sptr > parameter_specs_type
Convenience typedef for vector of parameter_spec_sptr.
The function was added to the second subject of the diff.
Abstraction of a type suppression specification.
shared_ptr< fn_call_expr_boundary > fn_call_expr_boundary_sptr
Convenience typedef for a shared_ptr to a fn_call_expr_boundary.
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...
void set_reach_kind(reach_kind k)
Setter of the way the diff node matching the current suppression specification is to be reached...
const string & get_type_name() const
Getter for the name of the type about which diff reports should be suppressed.
const string & get_name() const
Getter for the name of the named boundary.
void set_symbol_name(const string &n)
Setter for the name of symbol of the function the user wants this 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...
void set_change_kind(change_kind k)
Setter of the "change-kind" 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 ...
interned_string get_type_name(const type_base_sptr &t, bool qualified, bool internal)
Get the name of a given type and return a copy of it.
Definition: abg-ir.cc:8781
bool get_has_size_change() const
Getter of the "has_size_change" property.
const string get_label() const
Getter for the label associated to this suppression specification.
void set_has_size_change(bool flag)
Setter of the "has_size_change" property.
void set_parameter_specs(parameter_specs_type &)
Setter for a vector of parameter specifications to specify properties of the parameters of the functi...
The private data of suppression_base.
void set_label(const string &)
Setter for the label associated to this suppression specification.
Abstraction of a function suppression specification.
shared_ptr< boundary > boundary_sptr
Convenience typedef for a shared_ptr to boundary.
const char * get_private_types_suppr_spec_label()
void set_drops_artifact_from_ir(bool)
Set the flag that says whether the current suppression specification is to avoid adding the matched A...
Abstraction of the specification of a function parameter in a function suppression specification...
The abstraction of a variable suppression specification.
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...
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...
An insertion_range boundary that is expressed as an integer value. That integer value is usually a bi...
~fn_call_expr_boundary()
Destructor of type_suppression::insertion_range::fn_call_expr_boundary.
uint64_t as_integer() const
Return the integer value of the current instance of type_suppression::insertion_range::integer_bounda...
vector< type_suppression_sptr > type_suppressions_type
Convenience typedef for vector of type_suppression_sptr.
The base class of suppression specifications that are defined by the negation of matching clauses...
shared_ptr< variable_suppression > variable_suppression_sptr
A convenience typedef for a shared pointer to variable_suppression.
void set_soname_regex_str(const string &regexp)
Setter of the "soname_regex_str property of the current instance of suppression_base.
bool is_private_type_suppr_spec(const type_suppression &s)
Test if a type suppression specification represents a private type suppression automatically generate...
shared_ptr< integer_boundary > integer_boundary_sptr
Convenience typedef for a shared_ptr to a integer_boundary.
void set_file_name_regex_str(const string &regexp)
Setter for the "file_name_regex" property of the current instance of suppression_base.
shared_ptr< function_suppression > function_suppression_sptr
Convenience typedef for a shared pointer to function_suppression.
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.
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_type_name_not_regex_str(const string &name_regex_str)
Setter for the "type_name_not_regex_str" property of the type suppression specification.
The abstraction of a range of offsets in which a member of a type might get inserted.
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...
reach_kind get_reach_kind() const
Getter of the way the diff node matching the current suppression specification is to be reached...
Abstraction of a negated type 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...
const string & get_name() const
Getter for the name of the function the user wants the current specification to designate. This might be empty, in which case it's ignored at evaluation time.
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...
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_set_type & get_potential_data_member_names() const
Getter of the "potential_data_member_names" property.
bool get_consider_type_kind() const
Getter of the property that says whether to consider the kind of type this suppression is about...
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 has_soname_related_property() const
Test if the current suppression has a property related to SONAMEs.
This represents all the changes possibly described by this enum. It's a logical 'OR' of all the chang...
negated_suppression_base()
Constructor of the negated_suppression_base.
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...