libabigail
abg-comparison.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2 // -*- Mode: C++ -*-
3 //
4 // Copyright (C) 2013-2025 Red Hat, Inc.
5 //
6 // Author: Dodji Seketeli
7 
8 #ifndef __ABG_COMPARISON_H__
9 #define __ABG_COMPARISON_H__
10 
11 /// @file
12 
13 #include <memory>
14 #include <ostream>
15 #include <unordered_map>
16 #include <unordered_set>
17 #include "abg-corpus.h"
18 #include "abg-diff-utils.h"
19 #include "abg-reporter.h"
20 #include "abg-suppression.h"
21 
22 namespace abigail
23 {
24 
25 /// @brief utilities to compare abi artifacts
26 ///
27 /// The main entry points of the namespace are the compute_diff()
28 /// overloads used to compute the difference between two abi artifacts.
29 namespace comparison
30 {
31 
32 namespace filtering
33 {
34 struct filter_base;
35 typedef shared_ptr<filter_base> filter_base_sptr;
36 typedef std::vector<filter_base_sptr> filters;
37 }
38 
39 // Inject types we need into this namespace.
40 using std::ostream;
41 using std::vector;
42 using std::unordered_map;
43 using std::unordered_set;
44 using std::pair;
45 
46 using diff_utils::insertion;
47 using diff_utils::deletion;
48 using diff_utils::edit_script;
49 
50 /// Hasher for @ref diff_sptr.
52 {
53  /// The actual hashing functor.
54  size_t
55  operator()(const diff_sptr& t) const
56  {return reinterpret_cast<size_t>(t.get());}
57 }; // end struct diff_sptr_hasher
58 
59 /// Convenience typedef for a vector of @ref diff_sptr.
60 typedef vector<diff_sptr> diff_sptrs_type;
61 
62 /// Convenience typedef for a vector of @ref diff*.
63 typedef vector<diff*> diff_ptrs_type;
64 
65 /// Convenience typedef for an unoredered set of @ref diff_sptr
66 typedef unordered_set<diff_sptr, diff_sptr_hasher> unordered_diff_sptr_set;
67 
69 
70 /// Convenience typedef for a shared_ptr of @ref decl_diff_base.
71 typedef shared_ptr<decl_diff_base> decl_diff_base_sptr;
72 
73 /// Convenience typedef for a vector of @ref decl_diff_base_sptr.
74 typedef vector<decl_diff_base_sptr> decl_diff_base_sptrs_type;
75 
77 /// Convenience pointer for a shared pointer to a type_diff_base
78 typedef shared_ptr<type_diff_base> type_diff_base_sptr;
79 
80 /// Convenience typedef for a vector of @ref type_diff_base_sptr
81 typedef vector<type_diff_base_sptr> type_diff_base_sptrs_type;
82 
84 
85 /// Convenience typedef for a shared pointer to a @ref function_decl type.
86 typedef shared_ptr<function_decl_diff> function_decl_diff_sptr;
87 
88 /// Convenience typedef for a vector of @ref function_decl_diff_sptr
89 typedef vector<function_decl_diff_sptr> function_decl_diff_sptrs_type;
90 
92 
93 /// Convenience typedef for a shared pointer to a @ref fn_parm_diff
94 /// type.
95 typedef shared_ptr<fn_parm_diff> fn_parm_diff_sptr;
96 
97 class var_diff;
98 
99 /// Convenience typedef for a shared pointer to a @ref var_diff type.
100 typedef shared_ptr<var_diff> var_diff_sptr;
101 
102 /// Convenience typedef for a vector of @ref var_diff_sptr.
103 typedef vector<var_diff_sptr> var_diff_sptrs_type;
104 
105 class base_diff;
106 
107 /// Convenience typedef for a shared pointer to a @ref base_diff type.
108 typedef shared_ptr<base_diff> base_diff_sptr;
109 
110 /// Convenience typedef for a vector of @ref base_diff_sptr.
111 typedef vector<base_diff_sptr> base_diff_sptrs_type;
112 
114 
115 /// Convenience typedef for a shared pointer on a @ref class_diff type.
116 typedef shared_ptr<class_diff> class_diff_sptr;
117 
118 /// Convenience typedef for a map of pointer values. The Key is a
119 /// pointer value and the value is potentially another pointer value
120 /// associated to the first one.
121 typedef unordered_map<size_t, size_t> pointer_map;
122 
123 /// Convenience typedef for a map which key is a string and which
124 /// value is a @ref type_base_sptr.
125 typedef unordered_map<string, type_base_sptr> string_type_base_sptr_map;
126 
127 /// Convenience typedef for a map which key is an unsigned integer and
128 /// which value is a @ref decl_base_sptr
129 typedef unordered_map<unsigned, decl_base_sptr> unsigned_decl_base_sptr_map;
130 
131 /// Convenience typedef for a map of string and class_decl::basse_spec_sptr.
132 typedef unordered_map<string, class_decl::base_spec_sptr> string_base_sptr_map;
133 
134 /// Convenience typedef for a map of string and @ref base_diff_sptr.
135 typedef unordered_map<string, base_diff_sptr> string_base_diff_sptr_map;
136 
137 /// Convenience typedef for a map which value is a changed function
138 /// parameter and which key is the name of the function parameter.
139 typedef unordered_map<string, fn_parm_diff_sptr> string_fn_parm_diff_sptr_map;
140 
141 /// Convenience typedef for a map which key is an integer and which
142 /// value is a changed parameter.
143 typedef unordered_map<unsigned, fn_parm_diff_sptr>
145 
146 /// Convenience typedef for a map which key is an integer and which
147 /// value is a parameter.
148 typedef unordered_map<unsigned,
150 
151 /// Convenience typedef for a map which value is a
152 /// type_diff_base_sptr. The key of the map is the qualified name of
153 /// the changed type.
154 typedef unordered_map<string,
155  type_diff_base_sptr> string_type_diff_base_sptr_map;
156 
157 /// Convenience typedef for a map which value is a
158 /// decl_diff_base_sptr. The key of the map is the qualified name of
159 /// the changed type.
160 typedef unordered_map<string,
161  decl_diff_base_sptr> string_decl_diff_base_sptr_map;
162 
163 /// Convenience typedef for a map which value is a diff_sptr. The key
164 /// of the map is the qualified name of the changed type.
165 typedef unordered_map<string, diff_sptr> string_diff_sptr_map;
166 
167 /// Convenience typedef for a map which value is a diff*. The key of
168 /// the map is the qualified name of the changed type.
169 typedef unordered_map<string, diff*> string_diff_ptr_map;
170 
171 /// Convenience typedef for a map whose key is a string and whose
172 /// value is a changed variable of type @ref var_diff_sptr.
173 typedef unordered_map<string,
174  var_diff_sptr> string_var_diff_sptr_map;
175 
176 
177 /// Convenience typedef for a map whose key is an unsigned int and
178 /// whose value is a changed variable of type @ref var_diff_sptr.
179 typedef unordered_map<unsigned, var_diff_sptr> unsigned_var_diff_sptr_map;
180 
181 /// Convenience typedef for a map which value is a function
182 /// parameter. The key is the name of the function parm.
183 typedef unordered_map<string, function_decl::parameter_sptr> string_parm_map;
184 
185 /// Convenience typedef for a map which value is an enumerator. The
186 /// key is the name of the enumerator.
187 typedef unordered_map<string, enum_type_decl::enumerator> string_enumerator_map;
188 
189 /// Convenience typedef for a changed enumerator. The first element
190 /// of the pair is the old enumerator and the second one is the new enumerator.
191 typedef std::pair<enum_type_decl::enumerator,
192  enum_type_decl::enumerator> changed_enumerator;
193 
194 /// Convenience typedef for a vector of changed enumerators.
195 typedef vector<changed_enumerator> changed_enumerators_type;
196 
197 /// Convenience typedef for a map which value is a changed enumerator.
198 /// The key is the name of the changed enumerator.
199 typedef unordered_map<string, changed_enumerator> string_changed_enumerator_map;
200 
201 /// Convenience typedef for a map which key is a string and which
202 /// value is a pointer to @ref decl_base.
203 typedef unordered_map<string, const function_decl*> string_function_ptr_map;
204 
205 /// Convenience typedef for a map which key is a string and which
206 /// value is a @ref function_decl_diff_sptr.
207 typedef unordered_map<string,
208  function_decl_diff_sptr>
210 
211 /// Convenience typedef for a pair of class_decl::member_function_sptr
212 /// representing a changed member function. The first element of the
213 /// pair is the initial member function and the second element is the
214 /// changed one.
215 typedef pair<method_decl_sptr,
216  method_decl_sptr> changed_member_function_sptr;
217 
218 /// Convenience typedef for a hash map of strings and changed member functions.
219 typedef unordered_map<string,
220  changed_member_function_sptr>
222 
223 /// Convenience typedef for a hash map of strings and member functions.
224 typedef unordered_map<string, method_decl_sptr> string_member_function_sptr_map;
225 
226 /// Convenience typedef for a map which key is a string and which
227 /// value is a point to @ref var_decl.
228 typedef unordered_map<string, var_decl_sptr> string_var_ptr_map;
229 
230 /// Convenience typedef for a pair of pointer to @ref var_decl
231 /// representing a @ref var_decl change. The first member of the pair
232 /// represents the initial variable and the second member represents
233 /// the changed variable.
234 typedef std::pair<var_decl*, var_decl*> changed_var_ptr;
235 
236 /// Convenience typedef for a pair of @ref var_decl_sptr representing
237 /// a @ref var_decl change. The first member of the pair represents
238 /// the initial variable and the second member represents the changed
239 /// variable.
240 typedef std::pair<var_decl_sptr, var_decl_sptr> changed_var_sptr;
241 
242 /// Convenience typedef for a vector of @changed_var_sptr.gg381
243 typedef vector<changed_var_sptr> changed_var_sptrs_type;
244 
245 /// Convenience typedef for a map whose key is a string and whose
246 /// value is an @ref elf_symbol_sptr.
247 typedef unordered_map<string, elf_symbol_sptr> string_elf_symbol_map;
248 
249 /// Convenience typedef for a map which key is a string and which
250 /// value is a @ref var_diff_sptr.
251 typedef unordered_map<string, var_diff_sptr> string_var_diff_ptr_map;
252 
253 class diff_node_visitor;
254 
256 
257 /// Convenience typedef for shared_ptr on diff_traversable_base.
258 typedef shared_ptr<diff_traversable_base> diff_traversable_base_sptr;
259 
260 /// An enum for the different ways to visit a diff tree node.
261 ///
262 /// This is used by the node traversing code, to know when to avoid
263 /// visiting children nodes, for instance.
265 {
266  /// The default enumerator value of this enum. It doesn't have any
267  /// particular meaning yet.
269 
270  /// This says that the traversing code should avoid visiting the
271  /// children nodes of the current node being visited.
273 
274  /// This says that the traversing code should not mark visited nodes
275  /// as having been traversed. This is useful, for instance, for
276  /// visitors which have debugging purposes.
278 };
279 
282 
285 
288 
289 /// The base class for the diff classes that are to be traversed.
291 {
292 public:
293  virtual bool
295 }; // end struct diff_traversable_base
296 
297 /// An enum for the different categories that a diff tree node falls
298 /// into, regarding the kind of changes it represents.
299 ///
300 /// Note that if you add an enumerator to this enum, you need to
301 /// update a few spots accordingly:
302 ///
303 /// * update the ACCESS_CHANGE_CATEGORY enumerator (which is the
304 /// last enumerator of this enum by OR-ing its initializer with
305 /// the new enumerator.
306 ///
307 /// * update the categorize_harmless_diff_node or
308 /// categorize_harmful_diff_node function depending on if the new
309 /// enumerator classifies diff nodes as harmless or harmful.
310 ///
311 /// * update the get_default_harmless_categories_bitmap or
312 /// get_default_harmful_categories_bitmap function as well, just
313 /// like above.
314 ///
315 /// * update the "operator<<(ostream& o, diff_category c)" streaming
316 /// operator so that it can stream the new enumerator to a textual
317 /// output stream.
319 {
320  /// This means the diff node does not carry any (meaningful) change,
321  /// or that it carries changes that have not yet been categorized.
323 
324  /// This means the diff node (or at least one of its descendant
325  /// nodes) carries access related changes, e.g, a private member
326  /// that becomes public.
328 
329  /// This means the diff node (or at least one of its descendant
330  /// nodes) carries a change involving two compatible types. For
331  /// instance a type and its typedefs.
333 
334  /// This means that a diff node in the sub-tree carries a harmless
335  /// declaration name change. This is set only for name changes for
336  /// data members and typedefs.
338 
339  /// This means that a diff node in the sub-tree carries an addition
340  /// or removal of a non-virtual member function.
342 
343  /// This means that a diff node in the sub-tree carries an addition
344  /// or removal of a static data member.
346 
347  /// This means that a diff node in the sub-tree carries an addition
348  /// of enumerator to an enum type.
350 
351  /// This means that a diff node in the sub-tree carries an a symbol
352  /// alias change that is harmless.
354 
355  /// This means that a diff node in the sub-tree carries a harmless
356  /// union or class change.
358 
359  /// This means that a diff node in the sub-tree carries a harmless
360  /// data member change. An example of harmless data member change
361  /// is an anonymous data member that replaces a given data member
362  /// without locally changing the layout.
364 
365  /// This means that a diff node was marked as suppressed by a
366  /// user-provided suppression specification.
368 
369  /// This means that a diff node was warked as being for a private
370  /// type. That is, the diff node is meant to be suppressed by a
371  /// suppression specification that was auto-generated to filter out
372  /// changes to private types.
374 
375  /// This means the diff node (or at least one of its descendant
376  /// nodes) carries a change that modifies the size of a type or an
377  /// offset of a type member. Removal or changes of enumerators in a
378  /// enum fall in this category too.
380 
381  /// This means that a diff node in the sub-tree carries an
382  /// incompatible change to a vtable.
384 
385  REFERENCE_LVALUENESS_CHANGE_CATEGORY = 1 << 13,
386 
387  /// A change between two non-compatible types of different kinds.
389 
390  /// A non-compatible name change between two types.
392 
393  /// A diff node in this category is redundant. That means it's
394  /// present as a child of a other nodes in the diff tree.
396 
397  /// This means that a diff node in the sub-tree carries a type that
398  /// was declaration-only and that is now defined, or vice versa.
400 
401  /// A diff node in this category is a function parameter type which
402  /// top cv-qualifiers change.
404 
405  /// A diff node in this category has a function parameter type with a
406  /// cv-qualifiers change.
408 
409  /// A diff node in this category is a function return type with a
410  /// cv-qualifier change.
412 
413  /// A diff node in this category is a function (or function type)
414  /// with at least one parameter added or removed.
416 
417  /// A diff node in this category is for a variable which type holds
418  /// a cv-qualifier change.
420 
421  /// A diff node in this category carries a change from void pointer
422  /// to non-void pointer.
424 
425  /// A diff node in this category carries a change in the size of the
426  /// array type of a global variable, but the ELF size of the
427  /// variable didn't change.
429 
430  /// A diff node in this category carries a change that must be
431  /// reported, even if the diff node is also in the
432  /// SUPPRESSED_CATEGORY or PRIVATE_TYPE_CATEGORY categories.
433  /// Typically, this node matches a suppression specification like
434  /// the [allow_type] directive.
436 
437  /// A diff node in this category has a descendant node that is in
438  /// the HAS_ALLOWED_CHANGE_CATEGORY category. Nodes in this
439  /// category must be reported, even if they are also in the
440  /// SUPPRESSED_CATEGORY or PRIVATE_TYPE_CATEGORY categories.
442 
443  /// A diff node in this category has a parent node that is in the
444  /// HAS_ALLOWED_CHANGE_CATEGORY category. Nodes in this category
445  /// must be reported, even if they are also in the
446  /// SUPPRESSED_CATEGORY or PRIVATE_TYPE_CATEGORY categories.
448 
449  /// A special enumerator that is the logical 'or' all the
450  /// enumerators above.
451  ///
452  /// This one must stay the last enumerator. Please update it each
453  /// time you add a new enumerator above.
468  | REFERENCE_LVALUENESS_CHANGE_CATEGORY
483 }; // enum diff_category
484 
487 
489 operator|=(diff_category& c1, diff_category c2);
490 
492 operator&=(diff_category& c1, diff_category c2);
493 
495 operator^(diff_category c1, diff_category c2);
496 
499 
502 
505 
508 
509 bool
511 
512 ostream&
513 operator<<(ostream& o, diff_category);
514 
515 class corpus_diff;
516 
517 /// This type contains maps. Each map associates a type name to a
518 /// diff of that type. Not all kinds of diffs are present; only those
519 /// that carry leaf changes are, for now.
521 {
522  struct priv;
523  std::unique_ptr<priv> priv_;
524 
525 public:
526 
527  diff_maps();
528 
529  ~diff_maps();
530 
531  const string_diff_ptr_map&
532  get_type_decl_diff_map() const;
533 
534  string_diff_ptr_map&
536 
537  const string_diff_ptr_map&
538  get_enum_diff_map() const;
539 
540  string_diff_ptr_map&
542 
543  const string_diff_ptr_map&
544  get_class_diff_map() const;
545 
546  string_diff_ptr_map&
548 
549  const string_diff_ptr_map&
550  get_union_diff_map() const;
551 
552  string_diff_ptr_map&
554 
555  const string_diff_ptr_map&
556  get_typedef_diff_map() const;
557 
558  string_diff_ptr_map&
560 
561  const string_diff_ptr_map&
562  get_subrange_diff_map() const;
563 
564  string_diff_ptr_map&
566 
567  const string_diff_ptr_map&
568  get_array_diff_map() const;
569 
570  string_diff_ptr_map&
572 
573  const string_diff_ptr_map&
574  get_reference_diff_map() const;
575 
576  string_diff_ptr_map&
578 
579  const string_diff_ptr_map&
580  get_fn_parm_diff_map() const;
581 
582  string_diff_ptr_map&
584 
585  const string_diff_ptr_map&
587 
588  string_diff_ptr_map&
590 
591  const string_diff_ptr_map&
593 
594  string_diff_ptr_map&
596 
597  const string_diff_ptr_map&
598  get_var_decl_diff_map() const;
599 
600  string_diff_ptr_map&
602 
603  const string_diff_ptr_map&
604  get_distinct_diff_map() const;
605 
606  string_diff_ptr_map&
608 
609  bool
610  insert_diff_node(const diff *d,
611  const type_or_decl_base_sptr& impacted_iface);
612 
614  lookup_impacted_interfaces(const diff *d) const;
615 }; // end class diff_maps
616 
617 /// A convenience typedef for a shared pointer to @ref corpus_diff.
618 typedef shared_ptr<corpus_diff> corpus_diff_sptr;
619 
620 /// The context of the diff. This type holds various bits of
621 /// information that is going to be used throughout the diffing of two
622 /// entities and the reporting that follows.
624 {
625  struct priv;
626  std::unique_ptr<priv> priv_;
627 
628  diff_sptr
629  has_diff_for(const type_or_decl_base_sptr first,
630  const type_or_decl_base_sptr second) const;
631 
632  diff_sptr
633  has_diff_for_types(const type_base_sptr first,
634  const type_base_sptr second) const;
635 
636  const diff*
637  has_diff_for(const diff* d) const;
638 
639  diff_sptr
640  has_diff_for(const diff_sptr d) const;
641 
642  void
643  add_diff(const type_or_decl_base_sptr first,
644  const type_or_decl_base_sptr second,
645  const diff_sptr d);
646 
647  void
648  add_diff(const diff_sptr d);
649 
650  void
651  add_diff(const diff* d);
652 
653  void
654  set_canonical_diff_for(const type_or_decl_base_sptr first,
655  const type_or_decl_base_sptr second,
656  const diff_sptr);
657 
658  diff_sptr
659  set_or_get_canonical_diff_for(const type_or_decl_base_sptr first,
660  const type_or_decl_base_sptr second,
661  const diff_sptr canonical_diff);
662 
663 public:
664  diff_context();
665 
666  ~diff_context();
667 
668  bool
669  do_log() const;
670 
671  void
672  do_log(bool);
673 
674  void
675  set_corpus_diff(const corpus_diff_sptr&);
676 
677  const corpus_diff_sptr&
678  get_corpus_diff() const;
679 
680  corpus_sptr
681  get_first_corpus() const;
682 
683  corpus_sptr
684  get_second_corpus() const;
685 
687  get_reporter() const;
688 
689  void
691 
692  diff_sptr
694  const type_or_decl_base_sptr second) const;
695 
696  diff_sptr
697  get_canonical_diff_for(const diff_sptr d) const;
698 
699  void
701 
702  void
704 
705  diff*
706  diff_has_been_visited(const diff*) const;
707 
708  diff_sptr
709  diff_has_been_visited(const diff_sptr) const;
710 
711  void
712  mark_diff_as_visited(const diff*);
713 
714  void
716 
717  void
718  mark_last_diff_visited_per_class_of_equivalence(const diff*);
719 
720  void
721  clear_last_diffs_visited_per_class_of_equivalence();
722 
723  const diff*
724  get_last_visited_diff_of_class_of_equivalence(const diff*);
725 
726  void
728 
729  bool
731 
732  void
734 
735  bool
737 
739  get_allowed_category() const;
740 
741  void
743 
744  void
746 
747  void
749 
750  const filtering::filters&
751  diff_filters() const;
752 
753  void
755 
756  void
758 
759  void
760  maybe_apply_filters(corpus_diff_sptr diff);
761 
763  suppressions() const;
764 
766  suppressions();
767 
769  negated_suppressions() const;
770 
772  direct_suppressions() const;
773 
774  void
776 
777  void
779 
780  bool
782 
783  void
785 
786  void
787  show_leaf_changes_only(bool f);
788 
789  bool
790  show_leaf_changes_only() const;
791 
792  bool
793  show_hex_values() const;
794 
795  void
796  show_hex_values(bool f);
797 
798  bool
800 
801  void
803 
804  void
806 
807  bool
809 
810  void
811  show_stats_only(bool f);
812 
813  bool
814  show_stats_only() const;
815 
816  void
817  show_soname_change(bool f);
818 
819  bool
820  show_soname_change() const;
821 
822  void
823  show_architecture_change(bool f);
824 
825  bool
826  show_architecture_change() const;
827 
828  void
829  show_deleted_fns(bool f);
830 
831  bool
832  show_deleted_fns() const;
833 
834  void
835  show_changed_fns(bool f);
836 
837  bool
838  show_changed_fns() const;
839 
840  void
841  show_added_fns(bool f);
842 
843  bool
844  show_added_fns() const;
845 
846  void
847  show_deleted_vars(bool f);
848 
849  bool
850  show_deleted_vars() const;
851 
852  void
853  show_changed_vars(bool f);
854 
855  bool
856  show_changed_vars() const;
857 
858  void
859  show_added_vars(bool f);
860 
861  bool
862  show_added_vars() const;
863 
864  bool
865  show_linkage_names() const;
866 
867  void
868  show_linkage_names(bool f);
869 
870  bool
871  show_locs() const;
872 
873  void
874  show_locs(bool f);
875 
876  bool
877  show_redundant_changes() const;
878 
879  void
880  show_redundant_changes(bool f);
881 
882  bool
884 
885  void
887 
888  bool
890 
891  void
893 
894  void show_unreachable_types(bool f);
895 
896  bool show_unreachable_types();
897 
898  bool
899  show_impacted_interfaces() const;
900 
901  void
902  show_impacted_interfaces(bool f);
903 
904  void
905  default_output_stream(ostream*);
906 
907  ostream*
909 
910  void
911  error_output_stream(ostream*);
912 
913  ostream*
914  error_output_stream() const;
915 
916  bool
917  dump_diff_tree() const;
918 
919  void
920  dump_diff_tree(bool f);
921 
922  void
923  do_dump_diff_tree(const diff_sptr) const;
924 
925  void
926  do_dump_diff_tree(const corpus_diff_sptr) const;
927 
928  friend class_diff_sptr
929  compute_diff(const class_decl_sptr first,
930  const class_decl_sptr second,
931  diff_context_sptr ctxt);
932 };//end struct diff_context.
933 
934 /// The abstraction of a change between two ABI artifacts, a.k.a an
935 /// artifact change.
936 ///
937 /// In the grand scheme of things, a diff is strongly typed; for
938 /// instance, a change between two enums is represented by an
939 /// enum_diff type. A change between two function_type is represented
940 /// by a function_type_diff type and a change between two class_decl
941 /// is represented by a class_diff type. All of these types derive
942 /// from the @ref diff parent class.
943 ///
944 /// An artifact change D can have one (or more) details named D'. A
945 /// detail is an artifact change that "belongs" to another one. Here,
946 /// D' belongs to D. Or said otherwise, D' is a child change of D.
947 /// Said otherwise, D and D' are related, and the relation is a
948 /// "child relation".
949 ///
950 /// For instance, if we consider a change carried by a class_diff, the
951 /// detail change might be a change on one data member of the class.
952 /// In other word, the class_diff change might have a child diff node
953 /// that would be a var_diff node.
954 ///
955 /// There are two ways to get the child var_diff node (for the data
956 /// member change detail) of the class_diff.
957 ///
958 /// The first way is through the typed API, that is, through the
959 /// class_diff::sorted_changed_data_members() member function which
960 /// returns var_diff nodes.
961 ///
962 /// The second way is through the generic API, that is, through the
963 /// diff::children_nodes() member function which returns generic diff
964 /// nodes. This second way enables us to walk the diff nodes graph in
965 /// a generic way, regardless of the types of the diff nodes.
966 ///
967 /// Said otherwise, there are two views for a given diff node. There
968 /// is typed view, and there is the generic view. In the typed view,
969 /// the details are accessed through the typed API. In the generic
970 /// view, the details are gathered through the generic view.
971 ///
972 ///
973 /// Please read more about the @ref DiffNode "IR" of the comparison
974 /// engine to learn more about this.
975 ///
976 /// This type encapsulates an edit script (a set of insertions and
977 /// deletions) for two constructs that are to be diff'ed. The two
978 /// constructs are called the "subjects" of the diff.
980 {
981  friend class diff_context;
982 
983  // Forbidden
984  diff();
985 
986 protected:
987  struct priv;
988  std::unique_ptr<priv> priv_;
989 
992 
993  diff(type_or_decl_base_sptr first_subject,
994  type_or_decl_base_sptr second_subject,
995  diff_context_sptr ctxt);
996 
997  bool
998  do_log() const;
999 
1000  void
1001  do_log(bool);
1002 
1003  void
1004  begin_traversing();
1005 
1006  void
1007  end_traversing();
1008 
1009  virtual void
1010  finish_diff_type();
1011 
1012  void
1014 
1015 public:
1017  first_subject() const;
1018 
1020  second_subject() const;
1021 
1022  const vector<diff*>&
1023  children_nodes() const;
1024 
1025  const diff*
1026  parent_node() const;
1027 
1028  diff* get_canonical_diff() const;
1029 
1030  bool
1031  is_traversing() const;
1032 
1033  void
1035 
1036  const diff_context_sptr
1037  context() const;
1038 
1039  void
1041 
1042  bool
1043  currently_reporting() const;
1044 
1045  void
1046  currently_reporting(bool f) const;
1047 
1048  bool
1049  reported_once() const;
1050 
1051  void
1052  reported_once(bool f) const;
1053 
1055  get_category() const;
1056 
1058  get_local_category() const;
1059 
1062 
1065 
1068 
1069  void
1071 
1074 
1077 
1078  void
1080 
1081  void
1083 
1084  bool
1085  is_filtered_out() const;
1086 
1087  bool
1089 
1090  bool
1092 
1093  bool
1094  is_suppressed() const;
1095 
1096  bool
1097  is_suppressed(bool &is_private_type) const;
1098 
1099  bool
1101 
1102  bool
1103  to_be_reported() const;
1104 
1105  bool
1107 
1108  bool
1110 
1111  bool
1113 
1114  bool
1116 
1117  virtual const string&
1118  get_pretty_representation() const;
1119 
1120  /// This constructs the relation between this diff node and its
1121  /// detail diff nodes, in the generic view of the diff node.
1122  ///
1123  /// Each specific typed diff node should implement how the typed
1124  /// view "links" itself to its detail nodes in the generic sense.
1125  virtual void
1127 
1128  /// Pure interface to get the length of the changes encapsulated by
1129  /// this diff. A length of zero means that the current instance of
1130  /// @ref diff doesn't carry any change.
1131  ///
1132  /// This is to be implemented by all descendants of this type.
1133  virtual bool
1134  has_changes() const = 0;
1135 
1136  /// Pure interface to know if the current instance of @diff carries
1137  /// a local change. A local change is a change that is on the @ref
1138  /// diff object itself, as opposed to a change that is carried by
1139  /// some of its children nodes.
1140  ///
1141  /// This is to be implemented by all descendants of this type.
1142  virtual enum change_kind
1143  has_local_changes() const = 0;
1144 
1145  /// Pure interface to report the diff in a serialized form that is
1146  /// legible for the user.
1147  ///
1148  /// Note that the serializd report has to leave one empty line at
1149  /// the end of its content.
1150  ///
1151  /// @param out the output stream to serialize the report to.
1152  ///
1153  /// @param indent the indentation string to use.
1154  virtual void
1155  report(ostream& out, const string& indent = "") const = 0;
1156 
1157  virtual bool
1159 };// end class diff
1160 
1161 diff_sptr
1162 compute_diff(const decl_base_sptr,
1163  const decl_base_sptr,
1164  diff_context_sptr ctxt);
1165 
1166 diff_sptr
1167 compute_diff(const type_base_sptr,
1168  const type_base_sptr,
1169  diff_context_sptr ctxt);
1170 
1171 /// Convert the type of a particular diff node into the generic @ref
1172 /// diff_sptr type.
1173 ///
1174 /// @tparam DiffNodePtr the specific type of the diff node to convert
1175 /// into @ref diff_sptr
1176 ///
1177 /// @param n the diff node to consider.
1178 ///
1179 /// @return the instance of @ref diff_sptr @p n was converted into.
1180 template <class DiffNodePtr>
1181 diff_sptr
1182 is_diff(DiffNodePtr& n)
1183 {return std::dynamic_pointer_cast<diff>(n);}
1184 
1185 /// The base class of diff between types.
1186 class type_diff_base : public diff
1187 {
1188  struct priv;
1189  std::unique_ptr<priv> priv_;
1190 
1191 protected:
1192  type_diff_base(type_base_sptr first_subject,
1193  type_base_sptr second_subject,
1194  diff_context_sptr ctxt);
1195 
1196 public:
1197 
1198  type_diff_base() = delete;
1199 
1200  virtual enum change_kind
1201  has_local_changes() const = 0;
1202 
1203  virtual ~type_diff_base();
1204 };// end class type_diff_base
1205 
1206 /// The base class of diff between decls.
1207 class decl_diff_base : public diff
1208 {
1209  struct priv;
1210  std::unique_ptr<priv> priv_;
1211 
1212 protected:
1213  decl_diff_base(decl_base_sptr first_subject,
1214  decl_base_sptr second_subject,
1215  diff_context_sptr ctxt);
1216 
1217 public:
1218 
1219  virtual enum change_kind
1220  has_local_changes() const = 0;
1221 
1222  virtual ~decl_diff_base();
1223 };// end class decl_diff_base
1224 
1225 string
1227 
1229 
1230 /// Convenience typedef for a shared pointer to distinct_types_diff
1231 typedef shared_ptr<distinct_diff> distinct_diff_sptr;
1232 
1233 /// An abstraction of a diff between entities that are of a different
1234 /// kind (disctinct).
1235 class distinct_diff : public diff
1236 {
1237  struct priv;
1238  std::unique_ptr<priv> priv_;
1239 
1240 protected:
1244 
1245 public:
1246 
1248  first() const;
1249 
1251  second() const;
1252 
1253  const diff_sptr
1254  compatible_child_diff() const;
1255 
1256  virtual const string&
1257  get_pretty_representation() const;
1258 
1259  virtual bool
1260  has_changes() const;
1261 
1262  virtual enum change_kind
1263  has_local_changes() const;
1264 
1265  virtual void
1266  report(ostream& out, const string& indent = "") const;
1267 
1268  virtual void
1270 
1271  static bool
1273  type_or_decl_base_sptr second);
1274 
1275  friend distinct_diff_sptr
1277  const type_or_decl_base_sptr second,
1278  diff_context_sptr ctxt);
1279 };// end class distinct_types_diff
1280 
1281 distinct_diff_sptr
1283  const type_or_decl_base_sptr,
1284  diff_context_sptr ctxt);
1285 
1286 /// Abstracts a diff between two instances of @ref var_decl
1287 class var_diff : public decl_diff_base
1288 {
1289  struct priv;
1290  std::unique_ptr<priv> priv_;
1291 
1292 protected:
1293  var_diff(var_decl_sptr first,
1294  var_decl_sptr second,
1297 
1298 public:
1300  first_var() const;
1301 
1303  second_var() const;
1304 
1305  diff_sptr
1306  type_diff() const;
1307 
1308  virtual void
1310 
1311  virtual bool
1312  has_changes() const;
1313 
1314  virtual enum change_kind
1315  has_local_changes() const;
1316 
1317  virtual void
1318  report(ostream& out, const string& indent = "") const;
1319 
1320  virtual const string&
1321  get_pretty_representation() const;
1322 
1323  friend var_diff_sptr
1324  compute_diff(const var_decl_sptr first,
1325  const var_decl_sptr second,
1326  diff_context_sptr ctxt);
1327 };// end class var_diff
1328 
1329 var_diff_sptr
1331 
1333 /// Convenience typedef for a shared pointer on a @ref
1334 /// pointer_diff type.
1335 typedef shared_ptr<pointer_diff> pointer_diff_sptr;
1336 
1337 /// The abstraction of a diff between two pointers.
1339 {
1340  struct priv;
1341  std::unique_ptr<priv> priv_;
1342 
1343 protected:
1345  pointer_type_def_sptr second,
1348 
1349 public:
1350  const pointer_type_def_sptr
1351  first_pointer() const;
1352 
1353  const pointer_type_def_sptr
1354  second_pointer() const;
1355 
1356  diff_sptr
1357  underlying_type_diff() const;
1358 
1359  void
1361 
1362  virtual const string&
1363  get_pretty_representation() const;
1364 
1365  virtual bool
1366  has_changes() const;
1367 
1368  virtual enum change_kind
1369  has_local_changes() const;
1370 
1371  virtual void
1372  report(ostream&, const string& indent = "") const;
1373 
1374  virtual void
1376 
1377  friend pointer_diff_sptr
1379  pointer_type_def_sptr second,
1380  diff_context_sptr ctxt);
1381 };// end class pointer_diff
1382 
1383 pointer_diff_sptr
1385  pointer_type_def_sptr second,
1386  diff_context_sptr ctxt);
1387 
1389 
1390 /// Convenience typedef for a shared pointer on a @ref
1391 /// reference_diff type.
1392 typedef shared_ptr<reference_diff> reference_diff_sptr;
1393 
1394 /// The abstraction of a diff between two references.
1396 {
1397  struct priv;
1398  std::unique_ptr<priv> priv_;
1399 
1400 protected:
1402  const reference_type_def_sptr second,
1403  diff_sptr underlying,
1405 
1406 public:
1408  first_reference() const;
1409 
1411  second_reference() const;
1412 
1413  const diff_sptr&
1414  underlying_type_diff() const;
1415 
1416  diff_sptr&
1418 
1419  virtual const string&
1420  get_pretty_representation() const;
1421 
1422  virtual bool
1423  has_changes() const;
1424 
1425  virtual enum change_kind
1426  has_local_changes() const;
1427 
1428  virtual void
1429  report(ostream&, const string& indent = "") const;
1430 
1431  virtual void
1433 
1434  friend reference_diff_sptr
1436  reference_type_def_sptr second,
1437  diff_context_sptr ctxt);
1438 };// end class reference_diff
1439 
1440 reference_diff_sptr
1442  reference_type_def_sptr second,
1443  diff_context_sptr ctxt);
1444 
1445 
1447 
1448 /// Typedef of a shared_ptr to @ref ptr_to_mbr_diff
1449 typedef shared_ptr<ptr_to_mbr_diff> ptr_to_mbr_diff_sptr;
1450 
1451 /// The abstraction of a diff between two @ref ptr_to_mbr_type.
1453 {
1454  struct priv;
1455  std::unique_ptr<priv> priv_;
1456 
1457  ptr_to_mbr_diff() = delete;
1458 
1459 protected:
1461  const ptr_to_mbr_type_sptr& second,
1462  const diff_sptr& member_type_diff,
1464  diff_context_sptr ctxt);
1465 
1466 public:
1467 
1469  first_ptr_to_mbr_type() const;
1470 
1472  second_ptr_to_mbr_type() const;
1473 
1474  const diff_sptr
1475  member_type_diff() const;
1476 
1477  const diff_sptr
1478  containing_type_diff() const;
1479 
1480  virtual bool
1481  has_changes() const;
1482 
1483  virtual enum change_kind
1484  has_local_changes() const;
1485 
1486  virtual const string&
1487  get_pretty_representation() const;
1488 
1489  virtual void
1490  report(ostream&, const string& indent = "") const;
1491 
1492  virtual void
1494 
1495  virtual ~ptr_to_mbr_diff();
1496 
1497  friend ptr_to_mbr_diff_sptr
1498  compute_diff(const ptr_to_mbr_type_sptr& first,
1499  const ptr_to_mbr_type_sptr& second,
1500  diff_context_sptr& ctxt);
1501 }; // end class ptr_to_mbr_diff
1502 
1503 ptr_to_mbr_diff_sptr
1504 compute_diff(const ptr_to_mbr_type_sptr& first,
1505  const ptr_to_mbr_type_sptr& second,
1506  diff_context_sptr& ctxt);
1507 
1509 
1510 /// A convenience typedef for a shared pointer to subrange_diff type.
1511 typedef shared_ptr<subrange_diff> subrange_diff_sptr;
1512 
1513 /// The abstraction of the diff between two subrange types.
1515 {
1516  struct priv;
1517  std::unique_ptr<priv> priv_;
1518 
1519 protected:
1521  const array_type_def::subrange_sptr& second,
1523  const diff_context_sptr ctxt = diff_context_sptr());
1524 
1525 public:
1527  first_subrange() const;
1528 
1530  second_subrange() const;
1531 
1532  const diff_sptr
1533  underlying_type_diff() const;
1534 
1535  virtual const string&
1536  get_pretty_representation() const;
1537 
1538  virtual bool
1539  has_changes() const;
1540 
1541  virtual enum change_kind
1542  has_local_changes() const;
1543 
1544  virtual void
1545  report(ostream&, const string& indent = "") const;
1546 
1547  virtual void
1549 
1550  friend subrange_diff_sptr
1553  diff_context_sptr ctxt);
1554 }; // end subrange_diff
1555 
1556 subrange_diff_sptr
1559  diff_context_sptr ctxt);
1560 
1561 
1563 
1564 /// Convenience typedef for a shared pointer on a @ref
1565 /// array_diff type.
1566 typedef shared_ptr<array_diff> array_diff_sptr;
1567 
1568 /// The abstraction of a diff between two arrays.
1570 {
1571  struct priv;
1572  std::unique_ptr<priv> priv_;
1573 
1574 protected:
1575  array_diff(const array_type_def_sptr first,
1576  const array_type_def_sptr second,
1578  vector<subrange_diff_sptr>& subrange_diffs,
1580 
1581 public:
1582  const array_type_def_sptr
1583  first_array() const;
1584 
1585  const array_type_def_sptr
1586  second_array() const;
1587 
1588  const diff_sptr&
1589  element_type_diff() const;
1590 
1591  const vector<subrange_diff_sptr>&
1592  subrange_diffs() const;
1593 
1594  void
1596 
1597  void
1598  subrange_diffs(const vector<subrange_diff_sptr>&);
1599 
1600  bool
1602 
1603  virtual const string&
1604  get_pretty_representation() const;
1605 
1606  virtual bool
1607  has_changes() const;
1608 
1609  virtual enum change_kind
1610  has_local_changes() const;
1611 
1612  virtual void
1613  report(ostream&, const string& indent = "") const;
1614 
1615  virtual void
1617 
1618  friend array_diff_sptr
1620  array_type_def_sptr second,
1621  diff_context_sptr ctxt);
1622 };// end class array_diff
1623 
1624 array_diff_sptr
1626  array_type_def_sptr second,
1627  diff_context_sptr ctxt);
1628 
1629 class qualified_type_diff;
1630 typedef class shared_ptr<qualified_type_diff> qualified_type_diff_sptr;
1631 
1632 /// Abstraction of a diff between two qualified types.
1634 {
1635  struct priv;
1636  std::unique_ptr<priv> priv_;
1637 
1638 protected:
1639  qualified_type_diff(qualified_type_def_sptr first,
1640  qualified_type_def_sptr second,
1641  diff_sptr underling,
1643 
1644 public:
1645  const qualified_type_def_sptr
1646  first_qualified_type() const;
1647 
1648  const qualified_type_def_sptr
1649  second_qualified_type() const;
1650 
1651  diff_sptr
1652  underlying_type_diff() const;
1653 
1654  void
1656 
1657  diff_sptr
1658  leaf_underlying_type_diff() const;
1659 
1660  virtual const string&
1661  get_pretty_representation() const;
1662 
1663  virtual bool
1664  has_changes() const;
1665 
1666  virtual enum change_kind
1667  has_local_changes() const;
1668 
1669  virtual void
1670  report(ostream&, const string& indent = "") const;
1671 
1672  virtual void
1674 
1675  friend qualified_type_diff_sptr
1676  compute_diff(const qualified_type_def_sptr first,
1677  const qualified_type_def_sptr second,
1678  diff_context_sptr ctxt);
1679 };// end class qualified_type_diff.
1680 
1681 qualified_type_diff_sptr
1682 compute_diff(const qualified_type_def_sptr first,
1683  const qualified_type_def_sptr second,
1684  diff_context_sptr ctxt);
1685 
1686 class enum_diff;
1687 typedef shared_ptr<enum_diff> enum_diff_sptr;
1688 
1689 /// Abstraction of a diff between two enums.
1691 {
1692  struct priv;
1693  std::unique_ptr<priv> priv_;
1694 
1695  void
1696  clear_lookup_tables();
1697 
1698  bool
1699  lookup_tables_empty() const;
1700 
1701  void
1702  ensure_lookup_tables_populated();
1703 
1704 protected:
1706  const enum_type_decl_sptr,
1707  const diff_sptr,
1709 
1710 public:
1711  const enum_type_decl_sptr
1712  first_enum() const;
1713 
1714  const enum_type_decl_sptr
1715  second_enum() const;
1716 
1717  diff_sptr
1718  underlying_type_diff() const;
1719 
1720  const string_enumerator_map&
1721  deleted_enumerators() const;
1722 
1723  const string_enumerator_map&
1724  inserted_enumerators() const;
1725 
1726  const string_changed_enumerator_map&
1727  changed_enumerators() const;
1728 
1729  virtual const string&
1730  get_pretty_representation() const;
1731 
1732  virtual bool
1733  has_changes() const;
1734 
1735  virtual enum change_kind
1736  has_local_changes() const;
1737 
1738  virtual void
1739  report(ostream&, const string& indent = "") const;
1740 
1741  virtual void
1743 
1744  friend enum_diff_sptr
1745  compute_diff(const enum_type_decl_sptr first,
1746  const enum_type_decl_sptr second,
1747  diff_context_sptr ctxt);
1748 };//end class enum_diff;
1749 
1750 enum_diff_sptr
1752  const enum_type_decl_sptr,
1754 
1755 /// This is the base class of @ref class_diff and @ref union_diff.
1757 {
1758 protected:
1759  struct priv;
1760  typedef std::unique_ptr<priv> priv_ptr;
1761  priv_ptr priv_;
1762 
1763  void
1764  clear_lookup_tables(void);
1765 
1766  bool
1767  lookup_tables_empty(void) const;
1768 
1769  void
1770  ensure_lookup_tables_populated(void) const;
1771 
1772  void
1774 
1775 protected:
1776  class_or_union_diff(class_or_union_sptr first_scope,
1777  class_or_union_sptr second_scope,
1779 
1780 public:
1781 
1782  const class_or_union_diff::priv_ptr&
1783  get_priv() const;
1784 
1785  //TODO: add change of the name of the type.
1786 
1787  virtual ~class_or_union_diff();
1788 
1789  class_or_union_sptr
1790  first_class_or_union() const;
1791 
1792  class_or_union_sptr
1793  second_class_or_union() const;
1794 
1795  const edit_script&
1796  member_types_changes() const;
1797 
1798  edit_script&
1800 
1801  const edit_script&
1802  data_members_changes() const;
1803 
1804  edit_script&
1806 
1808  inserted_data_members() const;
1809 
1811  deleted_data_members() const;
1812 
1813  const unsigned_var_diff_sptr_map&
1814  changed_data_members() const;
1815 
1816  const var_diff_sptrs_type&
1818 
1819  const edit_script&
1820  member_fns_changes() const;
1821 
1822  edit_script&
1824 
1825  const function_decl_diff_sptrs_type&
1826  changed_member_fns() const;
1827 
1828  const string_member_function_sptr_map&
1829  deleted_member_fns() const;
1830 
1831  const string_member_function_sptr_map&
1832  inserted_member_fns() const;
1833 
1834  size_t
1835  count_filtered_changed_data_members(bool local_only = false) const;
1836 
1837  const var_diff_sptrs_type&
1839 
1840  size_t
1841  count_filtered_subtype_changed_data_members(bool local_only = false) const;
1842 
1845 
1846  const changed_var_sptrs_type&
1848 
1849  const edit_script&
1850  member_fn_tmpls_changes() const;
1851 
1852  edit_script&
1854 
1855  const edit_script&
1857 
1858  edit_script&
1860 
1861  virtual bool
1862  has_changes() const;
1863 
1864  virtual enum change_kind
1865  has_local_changes() const;
1866 
1867  virtual void
1868  report(ostream&, const string& indent = "") const;
1869 
1870  virtual void
1872 
1873  friend class default_reporter;
1874 }; // end class_or_union_diff;
1875 
1876 /// This type abstracts changes for a class_decl.
1878 {
1879  struct priv;
1880  typedef std::unique_ptr<priv> priv_ptr;
1881  priv_ptr priv_;
1882 
1883  const priv_ptr& get_priv()const;
1884 
1885  void
1886  clear_lookup_tables(void);
1887 
1888  bool
1889  lookup_tables_empty(void) const;
1890 
1891  void
1892  ensure_lookup_tables_populated(void) const;
1893 
1894  void
1895  allocate_priv_data();
1896 
1897 protected:
1898  class_diff(class_decl_sptr first_scope,
1899  class_decl_sptr second_scope,
1901 
1902 public:
1903  //TODO: add change of the name of the type.
1904 
1905  virtual ~class_diff();
1906 
1908  first_class_decl() const;
1909 
1911  second_class_decl() const;
1912 
1913  const edit_script&
1914  base_changes() const;
1915 
1916  edit_script&
1917  base_changes();
1918 
1919  const string_base_sptr_map&
1920  deleted_bases() const;
1921 
1922  const string_base_sptr_map&
1923  inserted_bases() const;
1924 
1925  const base_diff_sptrs_type&
1926  changed_bases();
1927 
1928  const vector<class_decl::base_spec_sptr>&
1929  moved_bases() const;
1930 
1931  virtual bool
1932  has_changes() const;
1933 
1934  virtual enum change_kind
1935  has_local_changes() const;
1936 
1937  virtual const string&
1938  get_pretty_representation() const;
1939 
1940  virtual void
1941  report(ostream&, const string& indent = "") const;
1942 
1943  virtual void
1945 
1946  friend class_diff_sptr
1947  compute_diff(const class_decl_sptr first,
1948  const class_decl_sptr second,
1949  diff_context_sptr ctxt);
1950 
1951  friend class default_reporter;
1952 };// end class_diff
1953 
1954 class_diff_sptr
1955 compute_diff(const class_decl_sptr first,
1956  const class_decl_sptr second,
1957  diff_context_sptr ctxt);
1958 
1959 class union_diff;
1960 typedef shared_ptr<union_diff> union_diff_sptr;
1961 
1963 {
1964  void
1965  clear_lookup_tables(void);
1966 
1967  bool
1968  lookup_tables_empty(void) const;
1969 
1970  void
1971  ensure_lookup_tables_populated(void) const;
1972 
1973  void
1974  allocate_priv_data();
1975 
1976 protected:
1977  union_diff(union_decl_sptr first_union,
1978  union_decl_sptr second_union,
1980 
1981 public:
1982 
1983  virtual ~union_diff();
1984 
1985  union_decl_sptr
1986  first_union_decl() const;
1987 
1988  union_decl_sptr
1989  second_union_decl() const;
1990 
1991  virtual const string&
1992  get_pretty_representation() const;
1993 
1994  virtual void
1995  report(ostream&, const string& indent = "") const;
1996 
1997  friend union_diff_sptr
1998  compute_diff(const union_decl_sptr first,
1999  const union_decl_sptr second,
2000  diff_context_sptr ctxt);
2001 }; // end class union_diff
2002 
2003 union_diff_sptr
2004 compute_diff(const union_decl_sptr first,
2005  const union_decl_sptr second,
2006  diff_context_sptr ctxt);
2007 
2008 /// An abstraction of a diff between two instances of class_decl::base_spec.
2009 class base_diff : public diff
2010 {
2011  struct priv;
2012  std::unique_ptr<priv> priv_;
2013 
2014 protected:
2017  class_diff_sptr underlying,
2019 
2020 public:
2022  first_base() const;
2023 
2025  second_base() const;
2026 
2027  const class_diff_sptr
2028  get_underlying_class_diff() const;
2029 
2030  void
2031  set_underlying_class_diff(class_diff_sptr d);
2032 
2033  virtual const string&
2034  get_pretty_representation() const;
2035 
2036  virtual bool
2037  has_changes() const;
2038 
2039  virtual enum change_kind
2040  has_local_changes() const;
2041 
2042  virtual void
2043  report(ostream&, const string& indent = "") const;
2044 
2045  virtual void
2047 
2048  friend base_diff_sptr
2050  const class_decl::base_spec_sptr second,
2051  diff_context_sptr ctxt);
2052 };// end class base_diff
2053 
2054 base_diff_sptr
2056  const class_decl::base_spec_sptr second,
2057  diff_context_sptr ctxt);
2058 
2060 
2061 /// Convenience typedef for a shared pointer on a @ref scope_diff.
2062 typedef shared_ptr<scope_diff> scope_diff_sptr;
2063 
2064 /// An abstractions of the changes between two scopes.
2065 class scope_diff : public diff
2066 {
2067  struct priv;
2068  std::unique_ptr<priv> priv_;
2069 
2070  bool
2071  lookup_tables_empty() const;
2072 
2073  void
2074  clear_lookup_tables();
2075 
2076  void
2077  ensure_lookup_tables_populated();
2078 
2079 protected:
2083 
2084 public:
2085 
2086  friend scope_diff_sptr
2087  compute_diff(const scope_decl_sptr first,
2088  const scope_decl_sptr second,
2089  scope_diff_sptr d,
2090  diff_context_sptr ctxt);
2091 
2092  friend scope_diff_sptr
2093  compute_diff(const scope_decl_sptr first_scope,
2094  const scope_decl_sptr second_scope,
2095  diff_context_sptr ctxt);
2096 
2097  const scope_decl_sptr
2098  first_scope() const;
2099 
2100  const scope_decl_sptr
2101  second_scope() const;
2102 
2103  const edit_script&
2104  member_changes() const;
2105 
2106  edit_script&
2107  member_changes();
2108 
2109  const decl_base_sptr
2110  deleted_member_at(unsigned index) const;
2111 
2112  const decl_base_sptr
2113  deleted_member_at(vector<deletion>::const_iterator) const;
2114 
2115  const decl_base_sptr
2116  inserted_member_at(unsigned i);
2117 
2118  const decl_base_sptr
2119  inserted_member_at(vector<unsigned>::const_iterator i);
2120 
2121  const diff_sptrs_type&
2122  changed_types() const;
2123 
2124  const diff_sptrs_type&
2125  changed_decls() const;
2126 
2128  removed_types() const;
2129 
2131  removed_decls() const;
2132 
2134  added_types() const;
2135 
2137  added_decls() const;
2138 
2139  virtual const string&
2140  get_pretty_representation() const;
2141 
2142  virtual bool
2143  has_changes() const;
2144 
2145  virtual enum change_kind
2146  has_local_changes() const;
2147 
2148  virtual void
2149  report(ostream& out, const string& indent = "") const;
2150 
2151  virtual void
2153 
2154  friend class default_reporter;
2155  friend class leaf_reporter;
2156 };// end class scope_diff
2157 
2158 scope_diff_sptr
2159 compute_diff(const scope_decl_sptr first,
2160  const scope_decl_sptr second,
2161  scope_diff_sptr d,
2162  diff_context_sptr ctxt);
2163 
2164 scope_diff_sptr
2165 compute_diff(const scope_decl_sptr first_scope,
2166  const scope_decl_sptr second_scope,
2167  diff_context_sptr ctxt);
2168 
2169 /// Abstraction of a diff between two function parameters.
2171 {
2172  struct priv;
2173  std::unique_ptr<priv> priv_;
2174 
2176  const function_decl::parameter_sptr second,
2177  diff_context_sptr ctxt);
2178 
2179 public:
2180  friend fn_parm_diff_sptr
2182  const function_decl::parameter_sptr second,
2183  diff_context_sptr ctxt);
2184 
2186  first_parameter() const;
2187 
2189  second_parameter() const;
2190 
2191  diff_sptr
2192  type_diff() const;
2193 
2194  virtual const string&
2195  get_pretty_representation() const;
2196 
2197  virtual bool
2198  has_changes() const;
2199 
2200  virtual enum change_kind
2201  has_local_changes() const;
2202 
2203  virtual void
2204  report(ostream&, const string& indent = "") const;
2205 
2206  virtual void
2208 }; // end class fn_parm_diff
2209 
2210 fn_parm_diff_sptr
2212  const function_decl::parameter_sptr second,
2213  diff_context_sptr ctxt);
2214 
2216 
2217 /// A convenience typedef for a shared pointer to @ref
2218 /// function_type_type_diff
2219 typedef shared_ptr<function_type_diff> function_type_diff_sptr;
2220 
2221 /// Abstraction of a diff between two function types.
2223 {
2224  struct priv;
2225  std::unique_ptr<priv> priv_;
2226 
2227  void
2228  ensure_lookup_tables_populated();
2229 
2231  deleted_parameter_at(int i) const;
2232 
2234  inserted_parameter_at(int i) const;
2235 
2236 protected:
2238  const function_type_sptr second,
2239  diff_context_sptr ctxt);
2240 
2241 public:
2242  friend function_type_diff_sptr
2243  compute_diff(const function_type_sptr first,
2244  const function_type_sptr second,
2245  diff_context_sptr ctxt);
2246 
2247  const function_type_sptr
2248  first_function_type() const;
2249 
2250  const function_type_sptr
2251  second_function_type() const;
2252 
2253  const diff_sptr
2254  return_type_diff() const;
2255 
2256  const string_fn_parm_diff_sptr_map&
2257  subtype_changed_parms() const;
2258 
2259  const string_parm_map&
2260  removed_parms() const;
2261 
2262  const string_parm_map&
2263  added_parms() const;
2264 
2265  const vector<function_decl::parameter_sptr>&
2266  sorted_deleted_parms() const;
2267 
2268  const vector<function_decl::parameter_sptr>&
2269  sorted_added_parms() const;
2270 
2271  virtual const string&
2272  get_pretty_representation() const;
2273 
2274  virtual bool
2275  has_changes() const;
2276 
2277  virtual enum change_kind
2278  has_local_changes() const;
2279 
2280  virtual void
2281  report(ostream&, const string& indent = "") const;
2282 
2283  virtual void
2285 
2286  friend class default_reporter;
2287  friend class leaf_reporter;
2288 };// end class function_type_diff
2289 
2290 function_type_diff_sptr
2291 compute_diff(const function_type_sptr first,
2292  const function_type_sptr second,
2293  diff_context_sptr ctxt);
2294 
2295 /// Abstraction of a diff between two function_decl.
2297 {
2298  struct priv;
2299  std::unique_ptr<priv> priv_;
2300 
2301  void
2302  ensure_lookup_tables_populated();
2303 
2304 
2305 protected:
2307  const function_decl_sptr second,
2308  diff_context_sptr ctxt);
2309 
2310 public:
2311 
2312 friend function_decl_diff_sptr
2313 compute_diff(const function_decl_sptr first,
2314  const function_decl_sptr second,
2315  diff_context_sptr ctxt);
2316 
2317  const function_decl_sptr
2318  first_function_decl() const;
2319 
2320  const function_decl_sptr
2321  second_function_decl() const;
2322 
2323  const function_type_diff_sptr
2324  type_diff() const;
2325 
2326  virtual const string&
2327  get_pretty_representation() const;
2328 
2329  virtual bool
2330  has_changes() const;
2331 
2332  virtual enum change_kind
2333  has_local_changes() const;
2334 
2335  virtual void
2336  report(ostream&, const string& indent = "") const;
2337 
2338  virtual void
2340 }; // end class function_decl_diff
2341 
2342 function_decl_diff_sptr
2343 compute_diff(const function_decl_sptr first,
2344  const function_decl_sptr second,
2345  diff_context_sptr ctxt);
2346 
2348 
2349 /// Convenience typedef for a shared pointer on a @ref type_decl_diff type.
2350 typedef shared_ptr<type_decl_diff> type_decl_diff_sptr;
2351 
2352 /// Abstraction of a diff between two basic type declarations.
2354 {
2355  type_decl_diff();
2356 
2357 protected:
2358  type_decl_diff(const type_decl_sptr first,
2359  const type_decl_sptr second,
2361 
2362 public:
2363  friend type_decl_diff_sptr
2364  compute_diff(const type_decl_sptr first,
2365  const type_decl_sptr second,
2366  diff_context_sptr ctxt);
2367 
2368  const type_decl_sptr
2369  first_type_decl() const;
2370 
2371  const type_decl_sptr
2372  second_type_decl() const;
2373 
2374  virtual const string&
2375  get_pretty_representation() const;
2376 
2377  virtual bool
2378  has_changes() const;
2379 
2380  virtual enum change_kind
2381  has_local_changes() const;
2382 
2383  virtual void
2384  report(ostream& out, const string& indent = "") const;
2385 };// end type_decl_diff
2386 
2387 type_decl_diff_sptr
2389  const type_decl_sptr,
2391 
2393 
2394 /// Convenience typedef for a shared pointer on a typedef_diff type.
2395 typedef shared_ptr<typedef_diff> typedef_diff_sptr;
2396 
2397 /// Abstraction of a diff between two typedef_decl.
2399 {
2400  struct priv;
2401  std::unique_ptr<priv> priv_;
2402 
2403  typedef_diff();
2404 
2405 protected:
2406  typedef_diff(const typedef_decl_sptr first,
2407  const typedef_decl_sptr second,
2410 
2411 public:
2412  friend typedef_diff_sptr
2413  compute_diff(const typedef_decl_sptr first,
2414  const typedef_decl_sptr second,
2415  diff_context_sptr ctxt);
2416 
2417  const typedef_decl_sptr
2418  first_typedef_decl() const;
2419 
2420  const typedef_decl_sptr
2421  second_typedef_decl() const;
2422 
2423  const diff_sptr
2424  underlying_type_diff() const;
2425 
2426  void
2428 
2429  virtual const string&
2430  get_pretty_representation() const;
2431 
2432  virtual bool
2433  has_changes() const;
2434 
2435  virtual enum change_kind
2436  has_local_changes() const;
2437 
2438  virtual void
2439  report(ostream&, const string& indent = "") const;
2440 
2441  virtual void
2443 };// end class typedef_diff
2444 
2445 typedef_diff_sptr
2447  const typedef_decl_sptr,
2448  diff_context_sptr ctxt);
2449 
2450 const diff*
2452 
2454 
2455 /// Convenience typedef for a shared pointer on a
2456 /// @ref translation_unit_diff type.
2457 typedef shared_ptr<translation_unit_diff> translation_unit_diff_sptr;
2458 
2459 /// An abstraction of a diff between two translation units.
2461 {
2462  struct priv;
2463  std::unique_ptr<priv> priv_;
2464 
2465 protected:
2467  translation_unit_sptr second,
2469 
2470 public:
2471 
2472  const translation_unit_sptr
2473  first_translation_unit() const;
2474 
2475  const translation_unit_sptr
2476  second_translation_unit() const;
2477 
2478  friend translation_unit_diff_sptr
2479  compute_diff(const translation_unit_sptr first,
2480  const translation_unit_sptr second,
2481  diff_context_sptr ctxt);
2482 
2483  virtual bool
2484  has_changes() const;
2485 
2486  virtual enum change_kind
2487  has_local_changes() const;
2488 
2489  virtual void
2490  report(ostream& out, const string& indent = "") const;
2491 };//end class translation_unit_diff
2492 
2493 translation_unit_diff_sptr
2495  const translation_unit_sptr second,
2497 
2498 /// An abstraction of a diff between between two abi corpus.
2500 {
2501  struct priv;
2502  std::unique_ptr<priv> priv_;
2503 
2504 protected:
2505  corpus_diff(corpus_sptr first,
2506  corpus_sptr second,
2508 
2509  void
2510  finish_diff_type();
2511 
2512 public:
2513 
2514  class diff_stats;
2515 
2516  virtual ~corpus_diff();
2517 
2518  /// A convenience typedef for a shared pointer to @ref diff_stats
2519  typedef shared_ptr<diff_stats> diff_stats_sptr;
2520 
2521  bool
2522  do_log() const;
2523 
2524  void
2525  do_log(bool);
2526 
2527  corpus_sptr
2528  first_corpus() const;
2529 
2530  corpus_sptr
2531  second_corpus() const;
2532 
2533  const vector<diff*>&
2534  children_nodes() const;
2535 
2536  void
2538 
2539  edit_script&
2540  function_changes() const;
2541 
2542  edit_script&
2543  variable_changes() const;
2544 
2545  bool
2546  soname_changed() const;
2547 
2548  bool
2549  architecture_changed() const;
2550 
2551  const string_function_ptr_map&
2552  deleted_functions() const;
2553 
2554  const string_function_ptr_map&
2555  added_functions();
2556 
2558  changed_functions() const;
2559 
2560  const function_decl_diff_sptrs_type&
2561  changed_functions_sorted() const;
2562 
2563  const function_decl_diff_sptrs_type&
2565 
2566  function_decl_diff_sptrs_type&
2568 
2569  const string_var_ptr_map&
2570  deleted_variables() const;
2571 
2572  const string_var_ptr_map&
2573  added_variables() const;
2574 
2575  const string_var_diff_sptr_map&
2577 
2578  const var_diff_sptrs_type&
2580 
2581  const var_diff_sptrs_type&
2583 
2584  var_diff_sptrs_type&
2586 
2587  const string_elf_symbol_map&
2589 
2590  const string_elf_symbol_map&
2592 
2593  const string_elf_symbol_map&
2595 
2596  const string_elf_symbol_map&
2598 
2599  const string_type_base_sptr_map&
2600  deleted_unreachable_types() const;
2601 
2602  const vector<type_base_sptr>&
2604 
2605  const string_type_base_sptr_map&
2606  added_unreachable_types() const;
2607 
2608  const vector<type_base_sptr>&
2610 
2611  const string_diff_sptr_map&
2612  changed_unreachable_types() const;
2613 
2614  const vector<diff_sptr>&
2616 
2617  const diff_context_sptr
2618  context() const;
2619 
2620  const string&
2621  get_pretty_representation() const;
2622 
2623  bool
2624  has_changes() const;
2625 
2626  bool
2627  has_incompatible_changes() const;
2628 
2629  bool
2630  has_net_subtype_changes() const;
2631 
2632  bool
2633  has_net_changes() const;
2634 
2635  const diff_stats&
2637 
2638  void
2640 
2641  diff_maps&
2642  get_leaf_diffs();
2643 
2644  const diff_maps&
2645  get_leaf_diffs() const;
2646 
2647  virtual void
2648  report(ostream& out, const string& indent = "") const;
2649 
2650  virtual bool
2652 
2653  virtual void
2655 
2656  friend corpus_diff_sptr
2657  compute_diff(const corpus_sptr f,
2658  const corpus_sptr s,
2659  diff_context_sptr ctxt);
2660 
2661  friend void
2662  apply_suppressions(const corpus_diff* diff_tree);
2663 
2664  friend void
2666  const corpus_diff::diff_stats &s,
2667  const string& indent,
2668  ostream& out);
2669 
2670  friend class default_reporter;
2671  friend class leaf_reporter;
2672 }; // end class corpus_diff
2673 
2674 corpus_diff_sptr
2675 compute_diff(const corpus_sptr,
2676  const corpus_sptr,
2678 
2679 corpus_diff_sptr
2680 compute_diff(const corpus_group_sptr&,
2681  const corpus_group_sptr&,
2682  diff_context_sptr ctxt);
2683 
2684 /// This is a document class that aims to capture statistics about the
2685 /// changes carried by a @ref corpus_diff type.
2686 ///
2687 /// Its values are populated by the member function
2688 /// corpus_diff::apply_filters_and_suppressions_before_reporting()
2690 {
2691  struct priv;
2692  std::unique_ptr<priv> priv_;
2693 
2694  diff_stats();
2695 
2696 public:
2697 
2699 
2700  size_t num_func_removed() const;
2701  void num_func_removed(size_t);
2702 
2703  size_t num_removed_func_filtered_out() const;
2704  void num_removed_func_filtered_out(size_t);
2705 
2706  size_t net_num_func_removed() const;
2707 
2708  size_t num_func_added() const;
2709  void num_func_added(size_t);
2710 
2711  size_t num_added_func_filtered_out() const;
2712  void num_added_func_filtered_out(size_t);
2713 
2714  size_t net_num_func_added() const;
2715 
2716  size_t num_func_changed() const;
2717  void num_func_changed(size_t);
2718 
2719  size_t num_changed_func_filtered_out() const;
2720  void num_changed_func_filtered_out(size_t);
2721 
2722  size_t num_func_with_virtual_offset_changes() const;
2724 
2725  size_t num_func_with_local_harmful_changes() const;
2727 
2728  size_t num_func_with_incompatible_changes() const;
2730 
2731  size_t num_var_with_local_harmful_changes() const;
2733 
2734  size_t num_var_with_incompatible_changes() const;
2735  void num_var_with_incompatible_changes(size_t);
2736 
2737  size_t net_num_func_changed() const;
2738 
2740 
2741  size_t num_vars_removed() const;
2742  void num_vars_removed(size_t);
2743 
2744  size_t num_removed_vars_filtered_out() const;
2745  void num_removed_vars_filtered_out(size_t) const;
2746 
2747  size_t net_num_vars_removed() const;
2748 
2749  size_t num_vars_added() const;
2750  void num_vars_added(size_t);
2751 
2752  size_t num_added_vars_filtered_out() const;
2753  void num_added_vars_filtered_out(size_t);
2754 
2755  size_t net_num_vars_added() const;
2756 
2757  size_t num_vars_changed() const;
2758  void num_vars_changed(size_t);
2759 
2760  size_t num_changed_vars_filtered_out() const;
2761  void num_changed_vars_filtered_out(size_t);
2762 
2763  size_t net_num_vars_changed() const;
2764 
2765  size_t net_num_non_incompatible_var_changed() const;
2766 
2767  size_t num_func_syms_removed() const;
2768  void num_func_syms_removed(size_t);
2769 
2770  size_t num_removed_func_syms_filtered_out() const;
2772 
2773  size_t num_func_syms_added() const;
2774  void num_func_syms_added(size_t);
2775 
2776  size_t num_added_func_syms_filtered_out() const;
2777  void num_added_func_syms_filtered_out(size_t);
2778 
2779  size_t net_num_removed_func_syms() const;
2780  size_t net_num_added_func_syms() const;
2781 
2782  size_t num_var_syms_removed() const;
2783  void num_var_syms_removed(size_t);
2784 
2785  size_t num_removed_var_syms_filtered_out() const;
2786  void num_removed_var_syms_filtered_out(size_t);
2787 
2788  size_t num_var_syms_added() const;
2789  void num_var_syms_added(size_t);
2790 
2791  size_t num_added_var_syms_filtered_out() const;
2792  void num_added_var_syms_filtered_out(size_t);
2793 
2794  size_t net_num_removed_var_syms() const;
2795  size_t net_num_added_var_syms() const;
2796 
2797  size_t num_leaf_changes() const;
2798  void num_leaf_changes(size_t);
2799 
2800  size_t num_leaf_changes_filtered_out() const;
2801  void num_leaf_changes_filtered_out(size_t);
2802 
2803  size_t net_num_leaf_changes() const;
2804 
2805  size_t num_leaf_type_changes() const;
2806  void num_leaf_type_changes(size_t);
2807 
2808  size_t num_leaf_type_changes_filtered_out() const;
2810  size_t net_num_leaf_type_changes() const;
2811 
2812  size_t num_leaf_func_changes() const;
2813  void num_leaf_func_changes(size_t);
2814 
2817 
2818  size_t num_leaf_func_changes_filtered_out() const;
2820  size_t net_num_leaf_func_changes() const;
2822 
2823  size_t num_leaf_var_changes() const;
2824  void num_leaf_var_changes(size_t);
2825 
2828 
2829  size_t num_leaf_var_changes_filtered_out() const;
2830  void num_leaf_var_changes_filtered_out(size_t);
2831  size_t net_num_leaf_var_changes() const;
2833 
2834  size_t num_added_unreachable_types() const;
2835  void num_added_unreachable_types(size_t);
2836 
2839  size_t net_num_added_unreachable_types() const;
2840 
2841  size_t num_removed_unreachable_types() const;
2842  void num_removed_unreachable_types(size_t);
2843 
2846  size_t net_num_removed_unreachable_types() const;
2847 
2848  size_t num_changed_unreachable_types() const;
2849  void num_changed_unreachable_types(size_t);
2850 
2853  size_t net_num_changed_unreachable_types() const;
2854 
2855 }; // end class corpus_diff::diff_stats
2856 
2857 /// The base class for the node visitors. These are the types used to
2858 /// visit each node traversed by the diff_traversable_base::traverse() method.
2860 {
2861 protected:
2862  struct priv;
2863  std::unique_ptr<priv> priv_;
2864 
2865 public:
2866 
2868 
2869  virtual ~diff_node_visitor();
2870 
2872 
2874  get_visiting_kind() const;
2875 
2876  void
2878 
2879  void
2881 
2882  void
2884 
2885  diff*
2887 
2888  virtual void
2889  visit_begin(diff*);
2890 
2891  virtual void
2893 
2894  virtual void
2895  visit_end(diff*);
2896 
2897  virtual void
2899 
2900  virtual bool
2901  visit(diff*, bool);
2902 
2903  virtual bool
2904  visit(distinct_diff*, bool);
2905 
2906  virtual bool
2907  visit(var_diff*, bool);
2908 
2909  virtual bool
2910  visit(pointer_diff*, bool);
2911 
2912  virtual bool
2913  visit(reference_diff*, bool);
2914 
2915  virtual bool
2916  visit(qualified_type_diff*, bool);
2917 
2918  virtual bool
2919  visit(enum_diff*, bool);
2920 
2921  virtual bool
2922  visit(class_diff*, bool);
2923 
2924  virtual bool
2925  visit(base_diff*, bool);
2926 
2927  virtual bool
2928  visit(scope_diff*, bool);
2929 
2930  virtual bool
2931  visit(function_decl_diff*, bool);
2932 
2933  virtual bool
2934  visit(type_decl_diff*, bool);
2935 
2936  virtual bool
2937  visit(typedef_diff*, bool);
2938 
2939  virtual bool
2940  visit(translation_unit_diff*, bool);
2941 
2942  virtual bool
2943  visit(corpus_diff*, bool);
2944 }; // end struct diff_node_visitor
2945 
2946 void
2947 propagate_categories(diff* diff_tree);
2948 
2949 void
2950 propagate_categories(diff_sptr diff_tree);
2951 
2952 void
2953 propagate_categories(corpus_diff* diff_tree);
2954 
2955 void
2956 propagate_categories(corpus_diff_sptr diff_tree);
2957 
2958 void
2959 apply_suppressions(diff* diff_tree);
2960 
2961 void
2962 apply_suppressions(const corpus_diff* diff_tree);
2963 
2964 void
2965 apply_suppressions(diff_sptr diff_tree);
2966 
2967 void
2968 apply_suppressions(corpus_diff_sptr diff_tree);
2969 
2970 void
2971 print_diff_tree(diff* diff_tree, std::ostream&);
2972 
2973 void
2974 print_diff_tree(corpus_diff* diff_tree,
2975  std::ostream&);
2976 
2977 void
2978 print_diff_tree(diff_sptr diff_tree,
2979  std::ostream&);
2980 
2981 void
2982 print_diff_tree(corpus_diff_sptr diff_tree,
2983  std::ostream&);
2984 
2985 void
2987 
2988 void
2989 categorize_redundancy(diff* diff_tree);
2990 
2991 void
2992 categorize_redundancy(diff_sptr diff_tree);
2993 
2994 void
2996 
2997 void
2998 categorize_redundancy(corpus_diff_sptr diff_tree);
2999 
3000 void
3002 
3003 void
3005 
3006 void
3008 
3009 void
3010 clear_redundancy_categorization(corpus_diff_sptr diff_tree);
3011 
3012 void
3014 
3015 void
3016 apply_filters_and_categorize_diff_node_tree(corpus_diff_sptr& c);
3017 
3018 bool
3020 
3021 bool
3023 
3024 bool
3026 
3027 bool
3029 
3030 const type_diff_base*
3031 is_type_diff(const diff* diff);
3032 
3033 const decl_diff_base*
3034 is_decl_diff(const diff* diff);
3035 
3036 const type_decl_diff*
3038 
3039 const type_decl_diff*
3040 is_diff_of_basic_type(const diff* diff, bool);
3041 
3042 const class_or_union_diff*
3044 
3045 bool
3047 
3048 const enum_diff*
3049 is_enum_diff(const diff *diff);
3050 
3051 const class_diff*
3052 is_class_diff(const diff* diff);
3053 
3054 const union_diff*
3055 is_union_diff(const diff* diff);
3056 
3057 const class_or_union_diff*
3058 is_class_or_union_diff(const diff* d);
3059 
3060 const class_or_union_diff*
3062 
3063 const subrange_diff*
3064 is_subrange_diff(const diff* diff);
3065 
3066 const subrange_diff*
3068 
3069 const array_diff*
3070 is_array_diff(const diff* diff);
3071 
3072 const function_type_diff*
3074 
3075 const function_type_diff*
3077 
3078 const typedef_diff*
3079 is_typedef_diff(const diff *diff);
3080 
3081 const var_diff*
3082 is_var_diff(const diff* diff);
3083 
3084 const function_decl_diff*
3086 
3087 const pointer_diff*
3088 is_pointer_diff(const diff* diff);
3089 
3090 const reference_diff*
3091 is_reference_diff(const diff* diff);
3092 
3093 const qualified_type_diff*
3095 
3096 const fn_parm_diff*
3097 is_fn_parm_diff(const diff* diff);
3098 
3099 const base_diff*
3100 is_base_diff(const diff* diff);
3101 
3102 const distinct_diff*
3103 is_distinct_diff(const diff *diff);
3104 
3105 bool
3107 
3108 bool
3110 
3111 const corpus_diff*
3112 is_corpus_diff(const diff* diff);
3113 
3114 const diff*
3115 peel_typedef_diff(const diff* dif);
3116 
3117 const diff*
3118 peel_pointer_diff(const diff* dif);
3119 
3120 const diff*
3121 peel_reference_diff(const diff* dif);
3122 
3123 const diff*
3124 peel_qualified_diff(const diff* dif);
3125 
3126 const diff*
3127 peel_fn_parm_diff(const diff* dif);
3128 
3129 const diff*
3131 
3132 const diff*
3134 
3135 const diff*
3137 }// end namespace comparison
3138 
3139 }// end namespace abigail
3140 
3141 #endif //__ABG_COMPARISON_H__
qualified_type_diff(qualified_type_def_sptr first, qualified_type_def_sptr second, diff_sptr underling, diff_context_sptr ctxt=diff_context_sptr())
Constructor for qualified_type_diff.
void set_allowed_category(diff_category c)
Setter for the bitmap that represents the set of categories that the user wants to see reported...
bool is_filtered_out_without_looking_at_allowed_changes() const
Test if this diff tree node is to be filtered out for reporting purposes, but without considering the...
bool is_child_node_of_function_parm_diff(const diff *diff)
Test if a diff node is a child node of a function parameter diff node.
vector< diff * > diff_ptrs_type
Convenience typedef for a vector of diff*.
const string_diff_ptr_map & get_class_diff_map() const
Getter of the map that contains class type diffs.
std::pair< var_decl_sptr, var_decl_sptr > changed_var_sptr
Convenience typedef for a pair of var_decl_sptr representing a var_decl change. The first member of t...
const string_var_ptr_map & added_variables() const
Getter for the added variables of the diff.
friend reference_diff_sptr compute_diff(reference_type_def_sptr first, reference_type_def_sptr second, diff_context_sptr ctxt)
Compute the diff between two references.
void set_reporter(reporter_base_sptr &)
Setter of the reporter to be used in this context.
size_t net_num_added_unreachable_types() const
Getter of the number of added types that are unreachable from public interfaces and that are *NOT* fi...
const diff * peel_typedef_qualified_type_or_parameter_diff(const diff *dif)
If a diff node is about changes between two typedefs or qualified types, get the diff node about chan...
const string_decl_base_sptr_map & inserted_data_members() const
Getter for the data members that got inserted.
unordered_map< string, var_diff_sptr > string_var_diff_ptr_map
Convenience typedef for a map which key is a string and which value is a var_diff_sptr.
bool show_offsets_sizes_in_bits() const
Get the flag that indicates if diff reports using this context should show sizes and offsets in bits...
bool has_parent_allowed_by_specific_negated_suppression() const
Test if the current diff node has a parent node which is specifically allowed by a negated suppressio...
This means the diff node (or at least one of its descendant nodes) carries a change involving two com...
The abstraction of an enumerator.
Definition: abg-ir.h:2880
shared_ptr< function_type_diff > function_type_diff_sptr
A convenience typedef for a shared pointer to function_type_type_diff.
size_t net_num_leaf_var_changes() const
Getter for the net number of leaf variable change diff nodes.
size_t num_leaf_var_changes_filtered_out() const
Getter for the number of leaf variable changes diff nodes that have been filtered out...
virtual void report(ostream &, const string &indent="") const
Report the differences between the two enums.
const string_diff_sptr_map & changed_unreachable_types() const
Getter for a map of changed types that are not reachable from global functions/variables.
const string_member_function_sptr_map & deleted_member_fns() const
ptr_to_mbr_type_sptr second_ptr_to_mbr_type() const
Getter of the second pointer-to-member subject of the current diff node.
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of subrange_di...
shared_ptr< decl_diff_base > decl_diff_base_sptr
Convenience typedef for a shared_ptr of decl_diff_base.
vector< function_decl_diff_sptr > function_decl_diff_sptrs_type
Convenience typedef for a vector of function_decl_diff_sptr.
The private data of the ptr_to_mbr_diff type.
size_t num_changed_unreachable_types_filtered_out() const
Getter of the number of changed types that are unreachable from public interfaces and that have been ...
distinct_diff(type_or_decl_base_sptr first, type_or_decl_base_sptr second, diff_context_sptr ctxt=diff_context_sptr())
Constructor for distinct_diff.
diff_category remove_from_category(diff_category c)
Remove the current diff tree node from an a existing sef of categories. The categories include those ...
size_t num_leaf_type_changes_filtered_out() const
Getter for the number of filtered out leaf type change diff nodes.
The abstraction of a change between two ABI artifacts, a.k.a an artifact change.
const pointer_diff * is_pointer_diff(const diff *diff)
Test if a diff node is about differences between two pointers.
virtual ~class_or_union_diff()
Destructor of class_or_union_diff.
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of class_or_un...
const edit_script & member_fn_tmpls_changes() const
const string_diff_ptr_map & get_function_decl_diff_map() const
Getter of the map that contains function decl diffs.
const edit_script & member_fns_changes() const
Abstraction of a diff between two qualified types.
virtual enum change_kind has_local_changes() const
size_t net_num_func_removed() const
Getter for the net number of function removed.
virtual enum change_kind has_local_changes() const
shared_ptr< class_diff > class_diff_sptr
Convenience typedef for a shared pointer on a class_diff type.
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of enum_diff...
const changed_var_sptrs_type & ordered_data_members_replaced_by_adms() const
Get an ordered vector of of data members that got replaced by anonymous data members.
size_t net_num_vars_changed() const
Getter for the number of variables that have a change in their sub-types, minus the number of these v...
vector< var_diff_sptr > var_diff_sptrs_type
Convenience typedef for a vector of var_diff_sptr.
const edit_script & base_changes() const
class_decl_sptr second_class_decl() const
Getter of the second class involved in the diff.
shared_ptr< typedef_diff > typedef_diff_sptr
Convenience typedef for a shared pointer on a typedef_diff type.
const string_parm_map & removed_parms() const
Getter for the map of parameters that got removed.
const function_decl_sptr first_function_decl() const
const string_diff_ptr_map & get_function_type_diff_map() const
Getter of the map that contains function type diffs.
const vector< diff * > & children_nodes() const
Getter for the children nodes of the current diff node.
const diff_sptrs_type & changed_decls() const
size_t net_num_changed_unreachable_types() const
Getter of the number of changed types that are unreachable from public interfaces and that have *NOT*...
virtual void report(ostream &out, const string &indent="") const
Report the diff in a serialized form.
The internal type for the impl idiom implementation of pointer_diff.
const function_decl_diff_sptrs_type & incompatible_changed_functions() const
Getter of the set of diff nodes representing incompatibly changed functions.
size_t num_func_with_incompatible_changes() const
Getter for the number of functions with incompatible changes.
const string_var_ptr_map & deleted_variables() const
Getter for the variables that got deleted from the first subject of the diff.
const string_fn_parm_diff_sptr_map & subtype_changed_parms() const
Getter for the map of function parameter changes of the current diff.
virtual bool has_changes() const
Return true iff the diff node has a change.
bool has_net_subtype_changes() const
Test if the current instance of corpus_diff carries subtype changes whose reports are not suppressed ...
diff_sptr underlying_type_diff() const
Getter for the diff between the underlying types of the two qualified types.
shared_ptr< pointer_diff > pointer_diff_sptr
Convenience typedef for a shared pointer on a pointer_diff type.
virtual void report(ostream &, const string &indent="") const
Produce a basic report about the changes between two class_decl.
virtual const string & get_pretty_representation() const
Build and return a textual representation of the current instance of fn_parm_diff.
var_decl_sptr first_var() const
Getter for the first var_decl of the diff.
shared_ptr< suppression_base > suppression_sptr
Convenience typedef for a shared pointer to a suppression.
Definition: abg-fwd.h:1681
const edit_script & data_members_changes() const
void finish_diff_type()
Finish building the current instance of corpus_diff.
size_t num_func_with_virtual_offset_changes() const
Getter for the number of functions that carry virtual member offset changes.
diff_category add_to_category(diff_category c)
Adds the current diff tree node to an additional set of categories. Note that the categories include ...
An abstractions of the changes between two scopes.
diff_category get_local_category() const
Getter for the local category of the current diff tree node.
An abstraction of a diff between entities that are of a different kind (disctinct).
friend function_decl_diff_sptr compute_diff(const function_decl_sptr first, const function_decl_sptr second, diff_context_sptr ctxt)
Compute the diff between two function_decl.
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of pointer_dif...
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of qualified_t...
bool has_incompatible_changes() const
Test if the current instance of corpus_diff carries changes that we are sure are incompatible. By incompatible change we mean a change that "breaks" the ABI of the corpus we are looking at.
const qualified_type_diff * is_qualified_type_diff(const diff *diff)
Test if a diff node is about differences between two qualified types.
const corpus_diff * is_corpus_diff(const diff *diff)
Test if a diff node is a corpus_diff node.
pair< method_decl_sptr, method_decl_sptr > changed_member_function_sptr
Convenience typedef for a pair of class_decl::member_function_sptr representing a changed member func...
virtual enum change_kind has_local_changes() const
const vector< subrange_diff_sptr > & subrange_diffs() const
Getter for the diffs between the array subranges.
virtual const string & get_pretty_representation() const
Getter the pretty representation of the subrange_diff diff node.
shared_ptr< function_type > function_type_sptr
Convenience typedef for a shared pointer on a function_type.
Definition: abg-fwd.h:208
bool show_impacted_interfaces() const
Getter of the flag that indicates if the leaf reporter should display a summary of the interfaces imp...
virtual void visit_begin(diff *)
This is called by the traversing code on a diff node just before visiting it. That is...
void append_child_node(diff_sptr)
Add a new child node to the vector of children nodes for the current diff node.
vector< changed_var_sptr > changed_var_sptrs_type
Convenience typedef for a vector of .gg381.
scope_diff(scope_decl_sptr first_scope, scope_decl_sptr second_scope, diff_context_sptr ctxt=diff_context_sptr())
Constructor for scope_diff.
void mark_diff_as_visited(const diff *)
Mark a diff node as traversed by a traversing algorithm.
A special enumerator that is the logical 'or' all the enumerators above.
A diff node in this category is a function (or function type) with at least one parameter added or re...
This means the diff node (or at least one of its descendant nodes) carries a change that modifies the...
const qualified_type_def_sptr first_qualified_type() const
Getter for the first qualified type of the diff.
size_t num_leaf_changes_filtered_out() const
Getter of the number of leaf type change diff nodes that have been filtered out.
bool do_log() const
Test if logging was requested.
size_t count_filtered_subtype_changed_data_members(bool local_only=false) const
Count the number of /filtered/ data members with a sub-type change.
bool insert_diff_node(const diff *d, const type_or_decl_base_sptr &impacted_iface)
Insert a new diff node into the current instance of diff_maps.
const string_var_diff_sptr_map & changed_variables()
Getter for the non-sorted map of variables which signature didn't change but which do have some indir...
friend qualified_type_diff_sptr compute_diff(const qualified_type_def_sptr first, const qualified_type_def_sptr second, diff_context_sptr ctxt)
Compute the diff between two qualified types.
virtual void chain_into_hierarchy()
This constructs the relation between this diff node and its detail diff nodes, in the generic view of...
virtual bool has_changes() const
Return true iff the current diff node carries a change.
const function_decl::parameter_sptr second_parameter() const
Getter for the second subject of this diff node.
edit_script & function_changes() const
This type abstracts changes for a class_decl.
virtual void report(ostream &out, const string &indent="") const =0
Pure interface to report the diff in a serialized form that is legible for the user.
void clear_redundancy_categorization(diff *diff_tree)
Walk a given diff sub-tree to clear the REDUNDANT_CATEGORY out of the category of the nodes...
const array_type_def_sptr second_array() const
Getter for the second array of the diff.
size_t num_removed_var_syms_filtered_out() const
Getter for the number of removed variable symbols, not referenced by any debug info, that have been filtered out.
const function_type_diff * is_function_type_diff_with_local_changes(const diff *diff)
Test if a given diff node carries a function type change with local changes.
This means that a diff node was marked as suppressed by a user-provided suppression specification...
const typedef_decl_sptr first_typedef_decl() const
Getter for the firt typedef_decl involved in the diff.
type_or_decl_base_sptr first_subject() const
Getter of the first subject of the diff.
This means the diff node does not carry any (meaningful) change, or that it carries changes that have...
bool show_added_symbols_unreferenced_by_debug_info() const
Getter for the flag that indicates if symbols not referenced by any debug info and that got added are...
const diff * parent_node() const
Getter for the parent node of the current diff node.
const base_diff * is_base_diff(const diff *diff)
Test if a diff node is about differences between two base class specifiers.
diff_sptr get_canonical_diff_for(const type_or_decl_base_sptr first, const type_or_decl_base_sptr second) const
Getter for the canonical diff node for the diff represented by their two subjects.
const diff_stats & apply_filters_and_suppressions_before_reporting()
Apply the different filters that are registered to be applied to the diff tree; that includes the cat...
size_t net_num_vars_added() const
Getter for the net number of added variables.
const suppr::suppressions_type & suppressions() const
Getter for the vector of suppressions that specify which diff node reports should be dropped on the f...
size_t num_removed_unreachable_types() const
Getter of the number of removed types that are unreachable from the public interface of the ABI corpu...
virtual const string & get_pretty_representation() const
Get the pretty representation of the current ptr_to_mbr_diff node.
bool is_filtered_out_wrt_non_inherited_categories() const
Test if this diff tree node is to be filtered out for reporting purposes, but by considering only the...
void forbid_visiting_a_node_twice_per_interface(bool)
This function sets a flag os that if forbid_visiting_a_node_twice() returns true, then each time the ...
unordered_map< string, class_decl::base_spec_sptr > string_base_sptr_map
Convenience typedef for a map of string and class_decl::basse_spec_sptr.
shared_ptr< diff_context > diff_context_sptr
Convenience typedef for a shared pointer of diff_context.
Definition: abg-fwd.h:67
const corpus_diff_sptr & get_corpus_diff() const
Get the corpus diff for the current context.
Abstraction of a diff between two typedef_decl.
const scope_decl_sptr first_scope() const
Getter for the first scope of the diff.
virtual enum change_kind has_local_changes() const
diff_node_visitor()
Default constructor of the diff_node_visitor type.
const var_diff * is_var_diff(const diff *diff)
Test if a diff node is about differences between variables.
virtual const string & get_pretty_representation() const
virtual void report(ostream &, const string &indent="") const
Report the changes carried by the current class_or_union_diff node in a textual format.
size_t net_num_leaf_func_non_incompatible_changes() const
Getter for the net number of leaf function diff nodes that carry changes that are NOT incompatible...
diff_category get_default_harmful_categories_bitmap()
Getter of a bitmap made of the set of change categories that are considered harmful.
size_t num_leaf_var_changes() const
Getter for the number of leaf variable change diff nodes.
A non-compatible name change between two types.
This means that a diff node in the sub-tree carries an addition of enumerator to an enum type...
virtual const string & get_pretty_representation() const
const diff * peel_typedef_diff(const diff *dif)
If a diff node is about changes between two typedef types, get the diff node about changes between th...
This means the diff node (or at least one of its descendant nodes) carries access related changes...
shared_ptr< reference_diff > reference_diff_sptr
Convenience typedef for a shared pointer on a reference_diff type.
const type_decl_sptr first_type_decl() const
Getter for the first subject of the type_decl_diff.
diff * diff_has_been_visited(const diff *) const
Test if a diff node has been traversed.
virtual void report(ostream &, const string &indent="") const
Generates a report for the current instance of base_diff.
const var_diff_sptrs_type & incompatible_changed_variables() const
Getter of the set of diff nodes representing incompatibly changed global variables.
class_decl::base_spec_sptr second_base() const
Getter for the second base spec of the diff object.
A diff node in this category carries a change from void pointer to non-void pointer.
std::pair< var_decl *, var_decl * > changed_var_ptr
Convenience typedef for a pair of pointer to var_decl representing a var_decl change. The first member of the pair represents the initial variable and the second member represents the changed variable.
diff * get_current_topmost_iface_diff() const
Getter of the diff current topmost interface which is impacted by the current diff node being visited...
virtual enum change_kind has_local_changes() const
Test whether the current diff node carries any local change.
virtual enum change_kind has_local_changes() const
void print_category(diff_category c)
Print a given category out to stdout for debuging purposes.
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
Definition: abg-fwd.h:253
class_or_union_sptr first_class_or_union() const
A diff node in this category has a parent node that is in the HAS_ALLOWED_CHANGE_CATEGORY category...
void maybe_apply_filters(diff_sptr diff)
Apply the diff filters to a given diff sub-tree.
The abstraction of a diff between two arrays.
const string_enumerator_map & deleted_enumerators() const
diff_maps()
Default constructor of the diff_maps type.
size_t num_removed_vars_filtered_out() const
Getter for the number removed variables that have been filtered out.
const string_diff_ptr_map & get_distinct_diff_map() const
Getter of the map that contains distinct diffs.
size_t num_added_var_syms_filtered_out() const
Getter for the number of added variable symbols, not referenced by any debug info, that have been filtered out.
size_t net_num_added_func_syms() const
Getter of the net number of added function symbols that are not referenced by any debug info...
This says that the traversing code should not mark visited nodes as having been traversed. This is useful, for instance, for visitors which have debugging purposes.
size_t net_num_func_added() const
Getter for the net number of added functions.
shared_ptr< distinct_diff > distinct_diff_sptr
Convenience typedef for a shared pointer to distinct_types_diff.
ostream & operator<<(ostream &o, diff_category c)
Serialize an instance of diff_category to an output stream.
The interface for types which are feeling social and want to be visited during the traversal of a hie...
Definition: abg-traverse.h:38
const fn_parm_diff * is_fn_parm_diff(const diff *diff)
Test if a diff node is about differences between two function parameters.
class_decl::base_spec_sptr first_base() const
Getter for the first base spec of the diff object.
virtual bool traverse(diff_node_visitor &v)
Traverse the diff sub-tree under the current instance corpus_diff.
const type_decl_diff * is_diff_of_basic_type(const diff *d)
Test if a diff node represents a diff between two basic types.
virtual enum change_kind has_local_changes() const
Check if the current diff node carries a local change.
shared_ptr< translation_unit > translation_unit_sptr
Convenience typedef for a shared pointer on a translation_unit type.
Definition: abg-fwd.h:133
Abstraction of a diff between two function_decl.
A diff node in this category is a function parameter type which top cv-qualifiers change...
shared_ptr< typedef_decl > typedef_decl_sptr
Convenience typedef for a shared pointer on a typedef_decl.
Definition: abg-fwd.h:164
virtual void report(ostream &out, const string &indent="") const
Report the diff in a serialized form.
The base class for the visitor type hierarchy used for traversing a hierarchy of nodes.
Definition: abg-traverse.h:27
change_kind
A bitfield that gives callers of abigail::ir::equals() some insight about how different two internal ...
Definition: abg-ir.h:1360
void propagate_categories(diff *diff_tree)
Visit all the nodes of a given sub-tree. For each node that has a particular category set...
This means that a diff node in the sub-tree carries an incompatible change to a vtable.
unordered_map< string, diff * > string_diff_ptr_map
Convenience typedef for a map which value is a diff*. The key of the map is the qualified name of the...
function_type_diff(const function_type_sptr first, const function_type_sptr second, diff_context_sptr ctxt)
Consutrctor of the function_type type.
friend union_diff_sptr compute_diff(const union_decl_sptr first, const union_decl_sptr second, diff_context_sptr ctxt)
Compute the difference between two union_decl types.
bool currently_reporting() const
Tests if we are currently in the middle of emitting a report for this diff.
corpus_diff(corpus_sptr first, corpus_sptr second, diff_context_sptr ctxt=diff_context_sptr())
Constructor for corpus_diff.
void switch_categories_on(diff_category c)
Setter for the bitmap that represents the set of categories that the user wants to see reported...
const string_diff_ptr_map & get_enum_diff_map() const
Getter of the map that contains enum type diffs.
diff_category get_allowed_category() const
Getter for the bitmap that represents the set of categories that the user wants to see reported...
The base class for the diff classes that are to be traversed.
void apply_suppressions(diff *diff_tree)
Walk a given diff-sub tree and appply the suppressions carried by the context. If the suppression app...
const enum_type_decl_sptr first_enum() const
const string_diff_ptr_map & get_reference_diff_map() const
Getter of the map that contains reference type diffs.
virtual void report(ostream &, const string &indent="") const
Report the diff in a serialized form.
shared_ptr< subrange_diff > subrange_diff_sptr
A convenience typedef for a shared pointer to subrange_diff type.
const class_diff * is_class_diff(const diff *diff)
Test if a diff node is a class_diff node.
unordered_set< diff_sptr, diff_sptr_hasher > unordered_diff_sptr_set
Convenience typedef for an unoredered set of diff_sptr.
const edit_script & member_types_changes() const
shared_ptr< scope_diff > scope_diff_sptr
Convenience typedef for a shared pointer on a scope_diff.
base_diff(class_decl::base_spec_sptr first, class_decl::base_spec_sptr second, class_diff_sptr underlying, diff_context_sptr ctxt=diff_context_sptr())
bool show_unreachable_types()
Getter for the flag that indicates if changes on types unreachable from global functions and variable...
Abstraction of a diff between two enums.
virtual void report(ostream &out, const string &indent="") const
Ouputs a report of the differences between of the two type_decl involved in the type_decl_diff.
The default, initial, reporter of the libabigail comparison engine.
Definition: abg-reporter.h:158
unordered_map< string, decl_base_sptr > string_decl_base_sptr_map
Convenience typedef for a map which key is a string and which value is a decl_base_sptr.
Definition: abg-fwd.h:157
virtual enum change_kind has_local_changes() const
The private data structure for distinct_diff.
void set_category(diff_category c)
Set the category of the current diff node. This category includes the categories inherited from the c...
virtual void report(ostream &, const string &indent="") const
Serialize a report of the changes encapsulated in the current instance of function_decl_diff over to ...
edit_script & variable_changes() const
void switch_categories_off(diff_category c)
Setter for the bitmap that represents the set of categories that the user wants to see reported...
bool is_categorized_as_suppressed() const
Test if the current diff node has been suppressed by a suppression specification or it has been categ...
The base class of diff between decls.
The base class of diff between types.
A reporter that only reports leaf changes.
Definition: abg-reporter.h:280
Abstraction of a diff between two basic type declarations.
const function_decl_sptr second_function_decl() const
unordered_map< string, var_diff_sptr > string_var_diff_sptr_map
Convenience typedef for a map whose key is a string and whose value is a changed variable of type var...
unordered_map< string, base_diff_sptr > string_base_diff_sptr_map
Convenience typedef for a map of string and base_diff_sptr.
void initialize_canonical_diff(const diff_sptr diff)
Set the canonical diff node property of a given diff node appropriately.
void allocate_priv_data()
Allocate the memory for the priv_ pimpl data member of the class_or_union_diff class.
virtual bool has_changes() const
Return true iff the current diff node carries a change.
bool soname_changed() const
Test if the soname of the underlying corpus has changed.
size_t net_num_removed_func_syms() const
Getter of the net number of removed function symbols that are not referenced by any debug info...
bool is_suppressed() const
Test if the current diff node has been suppressed by a user-provided suppression specification.
bool has_net_changes() const
Test if the current instance of corpus_diff carries changes whose reports are not suppressed by any s...
const type_or_decl_base_sptr first() const
Getter for the first subject of the diff.
visiting_kind get_visiting_kind() const
Getter for the visiting policy of the traversing code while invoking this visitor.
unordered_map< string, elf_symbol_sptr > string_elf_symbol_map
Convenience typedef for a map whose key is a string and whose value is an elf_symbol_sptr.
This is the base class of class_diff and union_diff.
const string_decl_base_sptr_map & deleted_data_members() const
Getter for the data members that got deleted.
The internal type for the impl idiom implementation of subrange_diff.
bool has_changes() const
Return true iff the current corpus_diff node carries a change.
shared_ptr< diff_traversable_base > diff_traversable_base_sptr
Convenience typedef for shared_ptr on diff_traversable_base.
size_t num_var_syms_removed() const
Getter for the number of variable symbols (not referenced by any debug info) that got removed...
The abstraction of the diff between two subrange types.
const string_diff_ptr_map & get_type_decl_diff_map() const
Getter of the map that contains basic type diffs.
unordered_map< unsigned, fn_parm_diff_sptr > unsigned_fn_parm_diff_sptr_map
Convenience typedef for a map which key is an integer and which value is a changed parameter...
An abstraction of a diff between between two abi corpus.
virtual bool traverse(diff_node_visitor &v)
The default traverse function.
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of base_diff...
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of reference_d...
function_decl_diff(const function_decl_sptr first, const function_decl_sptr second, diff_context_sptr ctxt)
Constructor for function_decl_diff.
void set_canonical_diff(diff *)
Setter for the canonical diff of the current instance of diff.
size_t net_num_leaf_var_non_incompatible_changes() const
Getter for the net number of leaf variable diff nodes that carry changes that are NOT incompatible...
vector< changed_enumerator > changed_enumerators_type
Convenience typedef for a vector of changed enumerators.
class_or_union_sptr second_class_or_union() const
bool is_traversing() const
Tell if a given node is being traversed or not.
size_t num_added_unreachable_types_filtered_out() const
Getter of the number of added types that are unreachable from public interfaces and that are filtered...
translation_unit_diff(translation_unit_sptr first, translation_unit_sptr second, diff_context_sptr ctxt=diff_context_sptr())
Constructor for translation_unit_diff.
const type_or_decl_base_sptr second() const
Getter for the second subject of the diff.
bool show_stats_only() const
Test if the comparison module should only show the diff stats.
diff_category
An enum for the different categories that a diff tree node falls into, regarding the kind of changes ...
ostream * default_output_stream()
Getter for the default output stream used by code of the comparison engine. By default the default ou...
Toplevel namespace for libabigail.
bool do_log() const
Test if logging was requested.
shared_ptr< ptr_to_mbr_type > ptr_to_mbr_type_sptr
Convenience typedef for a shared pointer to a ptr_to_mbr_type.
Definition: abg-fwd.h:237
virtual bool has_changes() const
Test if the current diff node carries a change.
bool show_leaf_changes_only() const
Get the flag that indicates if the diff using this context should show only leaf changes or not...
size_t num_changed_vars_filtered_out() const
Getter for the number of variables that have a change in one of their sub-types, and that have been f...
unordered_set< type_or_decl_base_sptr, type_or_decl_hash, type_or_decl_equal > artifact_sptr_set_type
A convenience typedef for a hash set of type_or_decl_base_sptr.
Definition: abg-ir.h:559
shared_ptr< scope_decl > scope_decl_sptr
Convenience typedef for a shared pointer on a scope_decl.
Definition: abg-fwd.h:261
virtual enum change_kind has_local_changes() const =0
Pure interface to know if the current instance of carries a local change. A local change is a change...
const diff * peel_typedef_or_qualified_type_diff(const diff *dif)
If a diff node is about changes between two typedefs or qualified types, get the diff node about chan...
unordered_map< string, changed_enumerator > string_changed_enumerator_map
Convenience typedef for a map which value is a changed enumerator. The key is the name of the changed...
An abstraction of a diff between two instances of class_decl::base_spec.
vector< decl_diff_base_sptr > decl_diff_base_sptrs_type
Convenience typedef for a vector of decl_diff_base_sptr.
visiting_kind operator&(visiting_kind l, visiting_kind r)
The overloaded and operator for visiting_kind.
const string_base_sptr_map & inserted_bases() const
Getter for the inserted base classes of the diff.
virtual const string & get_pretty_representation() const
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
Definition: abg-fwd.h:266
virtual const string & get_pretty_representation() const
virtual const string & get_pretty_representation() const
const string_diff_ptr_map & get_typedef_diff_map() const
Getter of the map that contains typedef type diffs.
bool reported_once() const
Tests if a report has already been emitted for the current diff.
virtual bool has_changes() const
Test if the current subrange_diff node carries any change.
void set_current_topmost_iface_diff(diff *)
Setter of the diff current topmost interface which is impacted by the current diff node being visited...
const diff * peel_pointer_or_qualified_type_diff(const diff *dif)
If a diff node is about changes between two pointer, reference or qualified types, get the diff node about changes between the underlying types.
const string_function_ptr_map & added_functions()
Getter for the added functions of the diff.
decl_diff_base(decl_base_sptr first_subject, decl_base_sptr second_subject, diff_context_sptr ctxt)
Constructor of decl_diff_base.
const string_function_ptr_map & deleted_functions() const
Getter for the deleted functions of the diff.
friend corpus_diff_sptr compute_diff(const corpus_sptr f, const corpus_sptr s, diff_context_sptr ctxt)
Compute the diff between two instances of corpus.
virtual bool has_changes() const
Test if the current diff node carries changes.
virtual bool has_changes() const
Return true iff the current diff node carries a change.
void set_corpus_diff(const corpus_diff_sptr &)
Set the corpus diff relevant to this context.
bool show_redundant_changes() const
A getter for the flag that says if we should report about functions or variables diff nodes that have...
The declaration of the reporting types of libabigail's diff engine.
const string_enumerator_map & inserted_enumerators() const
virtual void report(ostream &out, const string &indent="") const
Emit a report about the current diff instance.
shared_ptr< ptr_to_mbr_diff > ptr_to_mbr_diff_sptr
Typedef of a shared_ptr to ptr_to_mbr_diff.
bool perform_change_categorization() const
Test if it's requested to perform diff node categorization.
shared_ptr< parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
Definition: abg-ir.h:3183
const diff_sptrs_type & changed_types() const
size_t num_leaf_changes() const
Getter of the number of leaf type change diff nodes.
The type of the private data of corpus_diff::diff_stats.
shared_ptr< diff_stats > diff_stats_sptr
A convenience typedef for a shared pointer to diff_stats.
size_t net_num_vars_removed() const
Getter for the net number of removed variables.
size_t num_leaf_type_changes() const
Getter for the number of leaf type change diff nodes.
const edit_script & member_changes() const
Accessor of the edit script of the members of a scope.
virtual bool has_changes() const
Return true iff the current diff node carries a change.
shared_ptr< base_spec > base_spec_sptr
Convenience typedef.
Definition: abg-ir.h:4188
diff_category remove_from_local_category(diff_category c)
Remove the current diff tree node from the categories resulting from the local changes.
const string_elf_symbol_map & added_unrefed_function_symbols() const
Getter for function symbols not referenced by any debug info and that got added.
unordered_map< string, type_base_sptr > string_type_base_sptr_map
Convenience typedef for a map which key is a string and which value is a type_base_sptr.
var_decl_sptr second_var() const
Getter for the second var_decl of the diff.
This means that a diff node was warked as being for a private type. That is, the diff node is meant t...
Abstraction of a diff between two function parameters.
virtual enum change_kind has_local_changes() const
const function_decl::parameter_sptr first_parameter() const
Getter for the first subject of this diff node.
size_t num_added_unreachable_types() const
Getter of the number of added types that are unreachable from the public interface of the ABI corpus...
virtual const string & get_pretty_representation() const
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of class_diff...
friend class_diff_sptr compute_diff(const class_decl_sptr first, const class_decl_sptr second, diff_context_sptr ctxt)
Compute the set of changes between two instances of class_decl.
size_t num_var_with_incompatible_changes() const
Getter for the number of variables with incompatible changes.
size_t num_added_func_filtered_out() const
Getter for the number of added function that have been filtered out.
void forget_visited_diffs()
Unmark all the diff nodes that were marked as being traversed.
const string_type_base_sptr_map & added_unreachable_types() const
Getter for a map of added types that are not reachable from global functions/variables.
virtual enum change_kind has_local_changes() const
size_t num_removed_func_syms_filtered_out() const
Getter for the number of removed function symbols, not referenced by debug info, that have been filte...
virtual const string & get_pretty_representation() const
Get a pretty representation of the current diff node.
This means that a diff node in the sub-tree carries a harmless declaration name change. This is set only for name changes for data members and typedefs.
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of function_ty...
unordered_map< string, diff_sptr > string_diff_sptr_map
Convenience typedef for a map which value is a diff_sptr. The key of the map is the qualified name of...
const array_type_def::subrange_sptr first_subrange() const
Getter of the first subrange of the current instance subrange_diff.
This means that a diff node in the sub-tree carries a harmless data member change. An example of harmless data member change is an anonymous data member that replaces a given data member without locally changing the layout.
unordered_map< string, function_decl_diff_sptr > string_function_decl_diff_sptr_map
Convenience typedef for a map which key is a string and which value is a function_decl_diff_sptr.
unordered_map< string, changed_member_function_sptr > string_changed_member_function_sptr_map
Convenience typedef for a hash map of strings and changed member functions.
diff_sptr leaf_underlying_type_diff() const
Getter for the diff between the most underlying non-qualified types of two qualified types...
diff_sptr compute_diff(const decl_base_sptr first, const decl_base_sptr second, diff_context_sptr ctxt)
Compute the difference between two decls. The decls can represent either type declarations, or non-type declaration.
virtual enum change_kind has_local_changes() const
size_t num_func_removed() const
Getter for the number of functions removed.
diff_category get_category() const
Getter for the category of the current diff tree node.
void end_traversing()
Flag a given diff node as not being traversed anymore.
class_decl_sptr first_class_decl() const
The context of the diff. This type holds various bits of information that is going to be used through...
size_t net_num_removed_var_syms() const
Getter of the net number of removed variable symbols that are not referenced by any debug info...
unordered_map< string, var_decl_sptr > string_var_ptr_map
Convenience typedef for a map which key is a string and which value is a point to var_decl...
const diff_sptr underlying_type_diff() const
Getter of the diff node of the underlying types of the current subrange_diff diff node...
The abstraction of a diff between two ptr_to_mbr_type.
A diff node in this category is redundant. That means it's present as a child of a other nodes in the...
The abstraction of a diff between two references.
shared_ptr< function_decl_diff > function_decl_diff_sptr
Convenience typedef for a shared pointer to a function_decl type.
This means that a diff node in the sub-tree carries a type that was declaration-only and that is now ...
size_t num_vars_changed() const
Getter for the number of variables that have a change in one of their sub-types.
unordered_map< unsigned, function_decl::parameter_sptr > unsigned_parm_map
Convenience typedef for a map which key is an integer and which value is a parameter.
virtual ~union_diff()
Destructor of the union_diff node.
diff * get_canonical_diff() const
Getter for the canonical diff of the current instance of diff.
bool has_descendant_allowed_by_specific_negated_suppression() const
Test if the current diff node has a descendant node which is specifically allowed by a negated suppre...
friend var_diff_sptr compute_diff(const var_decl_sptr first, const var_decl_sptr second, diff_context_sptr ctxt)
Compute the diff between two instances of var_decl.
shared_ptr< type_or_decl_base > type_or_decl_base_sptr
A convenience typedef for a shared_ptr to type_or_decl_base.
Definition: abg-fwd.h:118
virtual const string & get_pretty_representation() const
Build and return a copy of a pretty representation of the current instance of function_type_diff.
size_t net_num_leaf_changes() const
Getter of the net number of leaf change diff nodes.
const string_diff_ptr_map & get_var_decl_diff_map() const
Getter of the map that contains var decl diffs.
virtual bool has_changes() const
Return true iff the current diff node carries a change.
shared_ptr< type_decl > type_decl_sptr
Convenience typedef for a shared pointer on a type_decl.
Definition: abg-fwd.h:159
shared_ptr< type_decl_diff > type_decl_diff_sptr
Convenience typedef for a shared pointer on a type_decl_diff type.
void keep_diff_alive(diff_sptr &)
Add a diff node to the set of diff nodes that are kept alive for the life time of the current instanc...
bool is_filtered_out() const
Test if this diff tree node is to be filtered out for reporting purposes.
void add_suppressions(const suppr::suppressions_type &supprs)
Add new suppression specifications that specify which diff node reports should be dropped on the floo...
virtual enum change_kind has_local_changes() const =0
Pure interface to know if the current instance of carries a local change. A local change is a change...
virtual bool has_changes() const
Return true iff the current diff node carries a change.
virtual void chain_into_hierarchy()
Populate the vector of children node of the corpus_diff type.
const vector< function_decl::parameter_sptr > & sorted_added_parms() const
Getter for the sorted vector of added parameters .
void apply_filters_and_categorize_diff_node_tree(diff_sptr &diff_tree)
Apply the diff tree filters that have been associated with the context of the a given diff...
ptr_to_mbr_type_sptr first_ptr_to_mbr_type() const
Getter of the first pointer-to-member subject of the current diff node.
friend enum_diff_sptr compute_diff(const enum_type_decl_sptr first, const enum_type_decl_sptr second, diff_context_sptr ctxt)
Compute the set of changes between two instances of enum_type_decl.
This file declares types and operations implementing the "O(ND) Difference Algorithm" (aka diff2) fro...
friend fn_parm_diff_sptr compute_diff(const function_decl::parameter_sptr first, const function_decl::parameter_sptr second, diff_context_sptr ctxt)
Compute the difference between two function_decl::parameter_sptr; that is, between two function param...
The abstraction of a diff between two pointers.
virtual void report(ostream &, const string &indent="") const
Report the changes carried by the current union_diff node in a textual format.
const string_elf_symbol_map & deleted_unrefed_function_symbols() const
Getter for function symbols not referenced by any debug info and that got deleted.
virtual void report(ostream &out, const string &indent="") const
Report the changes of one scope against another.
const var_diff_sptrs_type & changed_variables_sorted()
Getter for the sorted vector of variables which signature didn't change but which do have some indire...
unordered_map< string, const function_decl * > string_function_ptr_map
Convenience typedef for a map which key is a string and which value is a pointer to decl_base...
virtual bool has_changes() const
Return true iff the current diff node carries a change.
virtual const string & get_pretty_representation() const
size_t operator()(const diff_sptr &t) const
The actual hashing functor.
void forbid_visiting_a_node_twice(bool f)
This sets a flag that, if it's true, then during the traversing of a diff nodes tree each node is vis...
const typedef_diff * is_typedef_diff(const diff *diff)
Test if a diff node is a typedef_diff node.
size_t net_num_added_var_syms() const
Getter of the net number of added variable symbols that are not referenced by any debug info...
const function_decl_diff * is_function_decl_diff(const diff *diff)
Test if a diff node is about differences between functions.
virtual bool has_changes() const
Return true iff the current diff node carries a change.
const diff * peel_fn_parm_diff(const diff *dif)
If a diff node is about changes between two function parameters get the diff node about changes betwe...
diff_category get_default_harmless_categories_bitmap()
Getter of a bitmap made of the set of change categories that are considered harmless.
const diff_sptr containing_type_diff() const
Getter of the diff node carrying changes to the containing type of first subject of the current diff ...
friend scope_diff_sptr compute_diff(const scope_decl_sptr first, const scope_decl_sptr second, scope_diff_sptr d, diff_context_sptr ctxt)
Compute the diff between two scopes.
void mark_leaf_diff_nodes()
Walks the diff nodes associated to the current corpus diff and mark those that carry local changes...
friend void maybe_report_unreachable_type_changes(const corpus_diff &d, const corpus_diff::diff_stats &s, const string &indent, ostream &out)
Report changes about types that are not reachable from global functions and variables, in a given.
void set_local_category(diff_category c)
Set the local category of the current diff node.
virtual bool visit(diff *, bool)
Default visitor implementation.
shared_ptr< translation_unit_diff > translation_unit_diff_sptr
Convenience typedef for a shared pointer on a translation_unit_diff type.
size_t num_vars_removed() const
Getter for the number of variables removed.
A diff node in this category is for a variable which type holds a cv-qualifier change.
void add_suppression(const suppr::suppression_sptr suppr)
Add a new suppression specification that specifies which diff node reports should be dropped on the f...
shared_ptr< reference_type_def > reference_type_def_sptr
Convenience typedef for a shared pointer on a reference_type_def.
Definition: abg-fwd.h:232
virtual bool traverse(diff_node_visitor &v)
The generic traversing code that walks a given diff sub-tree.
virtual const string & get_pretty_representation() const
pointer_diff(pointer_type_def_sptr first, pointer_type_def_sptr second, diff_sptr underlying_type_diff, diff_context_sptr ctxt=diff_context_sptr())
Constructor for a pointer_diff.
size_t count_filtered_changed_data_members(bool local_only=false) const
Count the number of /filtered/ data members that got replaced by another data member.
visiting_kind operator|(visiting_kind l, visiting_kind r)
The overloaded or operator for visiting_kind.
diff_sptr underlying_type_diff() const
virtual bool has_changes() const
Return true iff the current diff node carries a change.
shared_ptr< var_diff > var_diff_sptr
Convenience typedef for a shared pointer to a var_diff type.
const pointer_type_def_sptr second_pointer() const
Getter for the second subject of a pointer diff.
diff_category get_class_of_equiv_category() const
Getter of the category of the class of equivalence of the current diff tree node. ...
The default enumerator value of this enum. It doesn't have any particular meaning yet...
bool do_log() const
Test if logging was requested.
class_or_union_diff(class_or_union_sptr first_scope, class_or_union_sptr second_scope, diff_context_sptr ctxt=diff_context_sptr())
Constructor for the class_or_union_diff class.
const string_elf_symbol_map & added_unrefed_variable_symbols() const
Getter for variable symbols not referenced by any debug info and that got added.
virtual enum change_kind has_local_changes() const
virtual void chain_into_hierarchy()
Populate the vector of children nodes of the diff base type sub-object of this instance of fn_parm_di...
size_t num_func_with_local_harmful_changes() const
Getter for the number of functions with local harmful changes.
virtual bool has_changes() const
Return true iff the current diff node carries a change.
size_t num_leaf_func_changes() const
Getter for the number of leaf function change diff nodes.
bool has_local_changes_to_be_reported() const
Test if this diff tree node should be reported when considering the categories that were *NOT* inheri...
virtual void visit_end(diff *)
This is called by the traversing code on a diff node just after visiting it. That is after visiting i...
virtual void report(ostream &, const string &indent="") const
Reports the difference between the two subjects of the diff in a serialized form. ...
size_t num_leaf_var_with_incompatible_changes() const
Getter for the number of leaf variable diff nodes that carry incompatible changes.
const diff * peel_qualified_diff(const diff *dif)
If a diff node is about changes between two qualified types, get the diff node about changes between ...
size_t num_func_added() const
Getter for the number of functions added.
An abstraction of a diff between two translation units.
A diff node in this category has a function parameter type with a cv-qualifiers change.
vector< suppression_sptr > suppressions_type
Convenience typedef for a vector of suppression_sptr.
Definition: abg-fwd.h:1687
virtual void report(ostream &, const string &indent="") const
Build and emit a textual report about the current function_type_diff instance.
bool show_architecture_change() const
Getter for the property that says if the comparison module should show the architecture changes in it...
visiting_kind
An enum for the different ways to visit a diff tree node.
A diff node in this category has a descendant node that is in the HAS_ALLOWED_CHANGE_CATEGORY categor...
size_t num_var_with_local_harmful_changes() const
Getter for the number of variables with local harmful changes.
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of array_diff...
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of var_diff...
const edit_script & member_class_tmpls_changes() const
virtual const string & get_pretty_representation() const
virtual void report(ostream &, const string &indent="") const
Pure interface to report the diff in a serialized form that is legible for the user.
void begin_traversing()
Flag a given diff node as being traversed.
const decl_diff_base * is_decl_diff(const diff *diff)
Test if a diff node is about differences between declarations.
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of function_de...
size_t num_changed_func_filtered_out() const
Getter for the number of functions that have a change in one of their sub-types, and that have been f...
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of scope_diff...
const string_member_function_sptr_map & inserted_member_fns() const
diff_sptr underlying_type_diff() const
Getter for the diff between the pointed-to types of the pointers of this diff.
const string_parm_map & added_parms() const
Getter for the map of parameters that got added.
unordered_map< unsigned, decl_base_sptr > unsigned_decl_base_sptr_map
Convenience typedef for a map which key is an unsigned integer and which value is a decl_base_sptr...
const vector< diff * > & children_nodes() const
virtual void report(ostream &, const string &indent="") const
Report the diff in a serialized form.
size_t net_num_non_incompatible_var_changed() const
Getter of the net number of variables with changes that are not incompatible.
const decl_base_sptr inserted_member_at(unsigned i)
Accessor that eases the manipulation of the edit script associated to this instance. It returns the scope member (of the second scope of this diff instance) that is reported as being inserted from a given index.
std::pair< enum_type_decl::enumerator, enum_type_decl::enumerator > changed_enumerator
Convenience typedef for a changed enumerator. The first element of the pair is the old enumerator and...
const array_diff * is_array_diff(const diff *diff)
Test if a diff node is a array_diff node.
bool has_basic_type_change_only(const diff *d)
Test if a diff node is a decl diff that only carries a basic type change on its type diff sub-node...
const string_function_decl_diff_sptr_map & changed_functions() const
Getter for the functions which signature didn't change, but which do have some indirect changes in th...
diff_sptr type_diff() const
Getter for the diff representing the changes on the type of the function parameter involved in the cu...
size_t num_removed_unreachable_types_filtered_out() const
Getter of the number of removed types that are not reachable from public interfaces and that have bee...
size_t net_num_func_changed() const
Getter for the number of functions that have a change in their sub-types, minus the number of these f...
const filtering::filters & diff_filters() const
Getter for the diff tree nodes filters to apply to diff sub-trees.
bool lookup_tables_empty(void) const
Tests if the lookup tables are empty.
virtual bool has_changes() const
Test whether the current diff node carries any change.
const string_diff_ptr_map & get_array_diff_map() const
Getter of the map that contains array type diffs.
This type contains maps. Each map associates a type name to a diff of that type. Not all kinds of dif...
unordered_map< unsigned, var_diff_sptr > unsigned_var_diff_sptr_map
Convenience typedef for a map whose key is an unsigned int and whose value is a changed variable of t...
size_t num_added_func_syms_filtered_out() const
Getter for the number of added function symbols, not referenced by any debug info, that have been filtered out.
const diff_sptr & element_type_diff() const
Getter for the diff between the two types of array elements.
const string & get_pretty_representation() const
virtual enum change_kind has_local_changes() const
Test if the current subrange_diff node carries any local change.
unordered_map< string, decl_diff_base_sptr > string_decl_diff_base_sptr_map
Convenience typedef for a map which value is a decl_diff_base_sptr. The key of the map is the qualifi...
friend class_diff_sptr compute_diff(const class_decl_sptr first, const class_decl_sptr second, diff_context_sptr ctxt)
Compute the set of changes between two instances of class_decl.
const type_decl_sptr second_type_decl() const
Getter for the second subject of the type_decl_diff.
bool show_symbols_unreferenced_by_debug_info() const
Getter for the flag that indicates if symbols not referenced by any debug info are to be compared and...
size_t num_var_syms_added() const
Getter for the number of variable symbols (not referenced by any debug info) that got added...
const array_type_def::subrange_sptr second_subrange() const
Getter of the second subrange of the current instance subrange_diff.
The private member (pimpl) for diff_context.
const vector< class_decl::base_spec_sptr > & moved_bases() const
Getter for the vector of bases that "moved". That is, the vector of base types which position changed...
const string_diff_ptr_map & get_subrange_diff_map() const
Getter of the map that contains subrange type diffs.
const string_diff_ptr_map & get_union_diff_map() const
Getter of the map that contains union type diffs.
const enum_diff * is_enum_diff(const diff *diff)
Test if a diff node is a enum_diff node.
virtual void report(ostream &, const string &indent="") const
Report the diff in a serialized form.
friend type_decl_diff_sptr compute_diff(const type_decl_sptr first, const type_decl_sptr second, diff_context_sptr ctxt)
Compute a diff between two type_decl.
The base class for the node visitors. These are the types used to visit each node traversed by the di...
bool dump_diff_tree() const
Test if the comparison engine should dump the diff tree for the changed functions and variables it ha...
const function_type_sptr second_function_type() const
Getter for the second subject of the diff.
void append_child_node(diff_sptr)
Append a new child node to the vector of children nodes for the current instance of corpus_diff node...
shared_ptr< enum_type_decl > enum_type_decl_sptr
Convenience typedef for shared pointer to a enum_type_decl.
Definition: abg-fwd.h:172
shared_ptr< base_diff > base_diff_sptr
Convenience typedef for a shared pointer to a base_diff type.
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of ...
const subrange_diff * is_subrange_diff(const diff *diff)
Test if a diff node is a subrange_diff node.
shared_ptr< class_decl > class_decl_sptr
Convenience typedef for a shared pointer on a class_decl.
Definition: abg-fwd.h:190
friend base_diff_sptr compute_diff(const class_decl::base_spec_sptr first, const class_decl::base_spec_sptr second, diff_context_sptr ctxt)
Constructs the diff object representing a diff between two base class specifications.
friend distinct_diff_sptr compute_diff_for_distinct_kinds(const type_or_decl_base_sptr first, const type_or_decl_base_sptr second, diff_context_sptr ctxt)
Try to diff entities that are of distinct kinds.
const decl_base_sptr deleted_member_at(unsigned index) const
Accessor that eases the manipulation of the edit script associated to this instance. It returns the scope member that is reported (in the edit script) as deleted at a given index.
const string_changed_enumerator_map & changed_enumerators() const
friend typedef_diff_sptr compute_diff(const typedef_decl_sptr first, const typedef_decl_sptr second, diff_context_sptr ctxt)
Compute a diff between two typedef_decl.
shared_ptr< array_diff > array_diff_sptr
Convenience typedef for a shared pointer on a array_diff type.
size_t num_func_syms_added() const
Getter for the number of function symbols (not referenced by any debug info) that got added...
ostream * error_output_stream() const
Getter for the errror output stream used by code of the comparison engine. By default the error outpu...
size_t num_vars_added() const
Getter for the number of variables added.
virtual enum change_kind has_local_changes() const =0
Pure interface to know if the current instance of carries a local change. A local change is a change...
virtual ~ptr_to_mbr_diff()
Destructor of ptr_to_mbr_diff.
virtual enum change_kind has_local_changes() const
bool show_soname_change() const
Getter for the property that says if the comparison module should show the soname changes in its repo...
static bool entities_are_of_distinct_kinds(type_or_decl_base_sptr first, type_or_decl_base_sptr second)
Test if the two arguments are of different kind, or that are both NULL.
friend subrange_diff_sptr compute_diff(array_type_def::subrange_sptr first, array_type_def::subrange_sptr second, diff_context_sptr ctxt)
Compute the diff between two instances of subrange_diff.
shared_ptr< fn_parm_diff > fn_parm_diff_sptr
Convenience typedef for a shared pointer to a fn_parm_diff type.
unordered_map< string, method_decl_sptr > string_member_function_sptr_map
Convenience typedef for a hash map of strings and member functions.
bool is_harmful_category(diff_category c)
Test if an instance of diff_category (a category bit-field) is harmful or not.
virtual bool has_changes() const
Return true iff the current diff node carries a change.
const class_or_union_diff * is_anonymous_class_or_union_diff(const diff *d)
Test if a diff node is a class_or_union_diff between two anonymous classes or unions.
const string_decl_base_sptr_map & data_members_replaced_by_adms() const
Get the map of data members that got replaced by anonymous data members.
bool is_diff_of_variadic_parameter(const diff *d)
Test if a diff node represents the difference between a variadic parameter and something else...
union_decl_sptr second_union_decl() const
vector< type_diff_base_sptr > type_diff_base_sptrs_type
Convenience typedef for a vector of type_diff_base_sptr.
bool show_relative_offset_changes(void)
Get the flag saying if offset changes should be reported in a relative way. That is, if the report should say how of many bits a class/struct data member did move.
The type of private data of class_or_union_diff.
void set_underlying_class_diff(class_diff_sptr d)
Setter for the diff object for the diff of the underlyng base classes.
const translation_unit_sptr first_translation_unit() const
Getter for the first translation unit of this diff.
bool to_be_reported() const
Test if this diff tree node should be reported.
void clear_lookup_tables(void)
Clear the lookup tables useful for reporting.
virtual const string & get_pretty_representation() const
void or_visiting_kind(visiting_kind v)
Setter for the visiting policy of the traversing code while invoking this visitor. This one makes a logical or between the current policy and the bitmap given in argument and assigns the current policy to the result.
const function_type_sptr first_function_type() const
Getter for the first subject of the diff.
virtual enum change_kind has_local_changes() const
Test if the current diff node carries local changes.
Abstracts a diff between two instances of var_decl.
const pointer_type_def_sptr first_pointer() const
Getter for the first subject of a pointer diff.
friend array_diff_sptr compute_diff(array_type_def_sptr first, array_type_def_sptr second, diff_context_sptr ctxt)
Compute the diff between two arrays.
diff_sptr type_diff() const
Getter for the diff of the types of the instances of var_decl.
diff_sptr is_diff(DiffNodePtr &n)
Convert the type of a particular diff node into the generic diff_sptr type.
corpus_sptr get_second_corpus() const
Getter for the second corpus of the corpus diff of the current context.
const typedef_decl_sptr second_typedef_decl() const
Getter for the second typedef_decl involved in the diff.
const vector< function_decl::parameter_sptr > & sorted_deleted_parms() const
Getter for the sorted vector of deleted parameters.
const class_or_union_diff * is_class_or_union_diff(const diff *d)
Test if a diff node is a class_or_union_diff node.
const var_diff_sptrs_type & sorted_subtype_changed_data_members() const
Getter of the sorted vector of data members with a (sub-)type change.
unordered_map< size_t, size_t > pointer_map
Convenience typedef for a map of pointer values. The Key is a pointer value and the value is potentia...
friend pointer_diff_sptr compute_diff(pointer_type_def_sptr first, pointer_type_def_sptr second, diff_context_sptr ctxt)
Compute the diff between between two pointers.
corpus_sptr get_first_corpus() const
Getter for the first corpus of the corpus diff of the current context.
This means that a diff node in the sub-tree carries an addition or removal of a non-virtual member fu...
bool is_child_node_of_base_diff(const diff *diff)
Test if a diff node is a child node of a base diff node.
unordered_map< string, fn_parm_diff_sptr > string_fn_parm_diff_sptr_map
Convenience typedef for a map which value is a changed function parameter and which key is the name o...
reference_type_def_sptr second_reference() const
Getter for the second reference of the diff.
const reference_diff * is_reference_diff(const diff *diff)
Test if a diff node is about differences between two references.
size_t net_num_removed_unreachable_types() const
Getter of the number of removed types that are not reachable from public interfaces and that have *NO...
This means that a diff node in the sub-tree carries an a symbol alias change that is harmless...
friend translation_unit_diff_sptr compute_diff(const translation_unit_sptr first, const translation_unit_sptr second, diff_context_sptr ctxt)
Compute the diff between two translation_units.
virtual void report(ostream &, const string &indent="") const
Report the diff in a serialized form.
A diff node in this category carries a change that must be reported, even if the diff node is also in...
vector< diff_sptr > diff_sptrs_type
Convenience typedef for a vector of diff_sptr.
const qualified_type_def_sptr second_qualified_type() const
Getter for the second qualified type of the diff.
bool show_hex_values() const
Get the flag that indicates if the diff reports using this context should show sizes and offsets in a...
const scope_decl_sptr second_scope() const
Getter for the second scope of the diff.
const diff * peel_reference_diff(const diff *dif)
If a diff node is about changes between two reference types, get the diff node about changes between ...
const diff * get_typedef_diff_underlying_type_diff(const diff *diff)
Return the leaf underlying diff node of a typedef_diff node.
size_t num_func_changed() const
Getter for the number of functions that have a change in one of their sub-types.
union_diff(union_decl_sptr first_union, union_decl_sptr second_union, diff_context_sptr ctxt=diff_context_sptr())
Constructor for the union_diff type.
const type_diff_base * is_type_diff(const diff *diff)
Test if a diff node is about differences between types.
size_t num_leaf_func_changes_filtered_out() const
Getter for the number of leaf function change diff nodes that were filtered out.
shared_ptr< corpus_diff > corpus_diff_sptr
A convenience typedef for a shared pointer to corpus_diff.
size_t net_num_leaf_type_changes() const
Getter for the net number of leaf type change diff nodes.
const diff_context_sptr context() const
Getter of the diff context of this diff.
const string_elf_symbol_map & deleted_unrefed_variable_symbols() const
Getter for variable symbols not referenced by any debug info and that got deleted.
subrange_diff(const array_type_def::subrange_sptr &first, const array_type_def::subrange_sptr &second, const diff_sptr &underlying_type_diff, const diff_context_sptr ctxt=diff_context_sptr())
Constructor of the subrange_diff diff node type.
void do_dump_diff_tree(const diff_sptr) const
Emit a textual representation of a diff tree to the error output stream of the current context...
const suppr::suppressions_type & direct_suppressions() const
Getter of the direct suppression specification (those that are not negated) comprised in the general ...
virtual enum change_kind has_local_changes() const
const class_or_union_diff * is_diff_of_class_or_union_type(const diff *d)
Test if a diff node represents a diff between two class or union types.
const suppr::suppressions_type & negated_suppressions() const
Getter of the negated suppression specifications that are comprised in the general vector of suppress...
const subrange_diff * is_anonymous_subrange_diff(const diff *d)
Test if a diff node is a subrange_diff between two anonymous subranges.
bool visiting_a_node_twice_is_forbidden_per_interface() const
Return a flag that, if true, then during the traversing of a diff nodes tree each node is visited at ...
reference_type_def_sptr first_reference() const
Getter for the first reference of the diff.
vector< base_diff_sptr > base_diff_sptrs_type
Convenience typedef for a vector of base_diff_sptr.
shared_ptr< type_diff_base > type_diff_base_sptr
Convenience pointer for a shared pointer to a type_diff_base.
unordered_map< string, function_decl::parameter_sptr > string_parm_map
Convenience typedef for a map which value is a function parameter. The key is the name of the functio...
const diff_sptr compatible_child_diff() const
Getter for the child diff of this distinct_diff instance.
virtual void report(ostream &, const string &indent="") const
Report about the changes carried by this node.
void add_to_local_and_inherited_categories(diff_category c)
Adds the current diff tree node to the categories resulting from the local and inherited changes of t...
virtual bool has_changes() const
Return true iff the current diff node carries a change.
const function_type_diff * is_function_type_diff(const diff *diff)
Test if a diff node is a function_type_diff node.
const function_decl_diff_sptrs_type & changed_member_fns() const
Getter for the virtual members functions that have had a change in a sub-type, without having a chang...
virtual enum change_kind has_local_changes() const
virtual bool has_changes() const =0
Pure interface to get the length of the changes encapsulated by this diff. A length of zero means tha...
This says that the traversing code should avoid visiting the children nodes of the current node being...
friend void apply_suppressions(const corpus_diff *diff_tree)
Walk a corpus_diff tree and appply the suppressions carried by the context. If the suppression applie...
virtual const string & get_pretty_representation() const
virtual enum change_kind has_local_changes() const
A diff node in this category carries a change in the size of the array type of a global variable...
const translation_unit_sptr second_translation_unit() const
Getter for the second translation unit of this diff.
const vector< diff_sptr > & changed_unreachable_types_sorted() const
Getter of a sorted vector of changed types that are not reachable from global functions/variables.
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of ptr_to_mbr_...
This means that a diff node in the sub-tree carries a harmless union or class change.
const string_base_sptr_map & deleted_bases() const
Getter for the deleted base classes of the diff.
type_or_decl_base_sptr second_subject() const
Getter of the second subject of the diff.
const var_diff_sptrs_type & sorted_changed_data_members() const
Getter of the sorted vector of data members that got replaced by another data member.
size_t num_added_vars_filtered_out() const
Getter for the number of added variables that have been filtered out.
unordered_map< string, enum_type_decl::enumerator > string_enumerator_map
Convenience typedef for a map which value is an enumerator. The key is the name of the enumerator...
const diff_sptr & underlying_type_diff() const
Getter for the diff between the two referred-to types.
bool is_allowed_by_specific_negated_suppression() const
Test if this diff node is allowed (prevented from being suppressed) by at least one negated suppressi...
virtual void report(ostream &out, const string &indent="") const
Report the diff in a serialized form.
union_decl_sptr first_union_decl() const
void categorize_redundancy(diff *diff_tree)
Walk a given diff sub-tree to categorize each of the nodes with respect to the REDUNDANT_CATEGORY.
virtual void chain_into_hierarchy()
Populate the vector of children node of the diff base type sub-object of this instance of typedef_dif...
size_t num_changed_unreachable_types() const
Getter of the number of changed types that are unreachable from the public interface of the ABI corpu...
std::vector< filter_base_sptr > filters
Convenience typedef for a vector of filter_base_sptr.
const diff_sptr underlying_type_diff() const
Getter for the diff between the two underlying types of the typedefs.
const vector< type_base_sptr > & added_unreachable_types_sorted() const
Getter of a sorted vector of added types that are not reachable from global functions/variables.
void set_visiting_kind(visiting_kind v)
Setter for the visiting policy of the traversing code while invoking this visitor.
artifact_sptr_set_type * lookup_impacted_interfaces(const diff *d) const
Lookup the interfaces that are impacted by a given leaf diff node.
This is a document class that aims to capture statistics about the changes carried by a corpus_diff t...
The type of the private data (pimpl sub-object) of the class_diff type.
virtual bool has_changes() const
Return true iff the current diff node carries a change.
bool visiting_a_node_twice_is_forbidden() const
Return a flag that, if true, then during the traversing of a diff nodes tree each node is visited at ...
const union_diff * is_union_diff(const diff *diff)
Test if a diff node is a union_diff node.
virtual const string & get_pretty_representation() const
void print_diff_tree(diff *diff_tree, ostream &out)
Emit a textual representation of a diff sub-tree to an output stream.
const function_decl_diff_sptrs_type & changed_functions_sorted() const
Getter for a sorted vector of functions which signature didn't change, but which do have some indirec...
diff_maps & get_leaf_diffs()
Get the set of maps that contain leaf nodes. A leaf node being a node with a local change...
The internal type for the impl idiom implementation of var_diff.
A diff node in this category is a function return type with a cv-qualifier change.
const string_diff_ptr_map & get_fn_parm_diff_map() const
Getter of the map that contains function parameter diffs.
reference_diff(const reference_type_def_sptr first, const reference_type_def_sptr second, diff_sptr underlying, diff_context_sptr ctxt=diff_context_sptr())
Constructor for reference_diff.
shared_ptr< diff > diff_sptr
Convenience typedef for a shared_ptr for the diff class.
Definition: abg-fwd.h:75
shared_ptr< reporter_base > reporter_base_sptr
A convenience typedef for a shared pointer to a reporter_base.
Definition: abg-reporter.h:50
enum_diff(const enum_type_decl_sptr, const enum_type_decl_sptr, const diff_sptr, diff_context_sptr ctxt=diff_context_sptr())
Constructor for enum_diff.
friend function_type_diff_sptr compute_diff(const function_type_sptr first, const function_type_sptr second, diff_context_sptr ctxt)
Compute the diff between two instances of function_type.
const vector< type_base_sptr > & deleted_unreachable_types_sorted() const
Getter of a sorted vector of deleted types that are not reachable from global functions/variables.
const distinct_diff * is_distinct_diff(const diff *diff)
Test if a diff node is about differences between two diff nodes of different kinds.
distinct_diff_sptr compute_diff_for_distinct_kinds(const type_or_decl_base_sptr first, const type_or_decl_base_sptr second, diff_context_sptr ctxt)
Try to diff entities that are of distinct kinds.
const diff * peel_pointer_diff(const diff *dif)
If a diff node is about changes between two pointer types, get the diff node about changes between th...
size_t num_leaf_func_with_incompatible_changes() const
Getter for the number of leaf function diff nodes that carry incompatible changes.
reporter_base_sptr get_reporter() const
Getter of the reporter to be used in this context.
size_t net_num_leaf_func_changes() const
Getter for the net number of leaf function change diff nodes.
var_diff(var_decl_sptr first, var_decl_sptr second, diff_sptr type_diff, diff_context_sptr ctxt=diff_context_sptr())
Constructor for var_diff.
bool any_subrange_diff_to_be_reported() const
Test if any subrange diff is to be reported.
shared_ptr< subrange_type > subrange_sptr
Convenience typedef for a shared pointer on a function_decl::subrange.
Definition: abg-ir.h:2562
virtual void report(ostream &, const string &indent="") const
Emit a textual report about the current fn_parm_diff instance.
A change between two non-compatible types of different kinds.
friend ptr_to_mbr_diff_sptr compute_diff(const ptr_to_mbr_type_sptr &first, const ptr_to_mbr_type_sptr &second, diff_context_sptr &ctxt)
Compute the diff between two ptr_to_mbr_type types.
shared_ptr< array_type_def > array_type_def_sptr
Convenience typedef for a shared pointer on a array_type_def.
Definition: abg-fwd.h:241
bool is_diff_of_variadic_parameter_type(const diff *d)
Test if a diff node represents the difference between a variadic parameter type and something else...
shared_ptr< pointer_type_def > pointer_type_def_sptr
Convenience typedef for a shared pointer on a pointer_type_def.
Definition: abg-fwd.h:223
visiting_kind operator~(visiting_kind l)
The overloaded 'bit inversion' operator for visiting_kind.
virtual const string & get_pretty_representation() const
bool architecture_changed() const
Test if the architecture of the underlying corpus has changed.
Abstraction of a diff between two function types.
virtual enum change_kind has_local_changes() const
class_diff(class_decl_sptr first_scope, class_decl_sptr second_scope, diff_context_sptr ctxt=diff_context_sptr())
Constructor of class_diff.
const class_diff_sptr get_underlying_class_diff() const
Getter for the diff object for the diff of the underlying base classes.
string get_pretty_representation(diff *d)
Get a copy of the pretty representation of a diff node.
shared_ptr< filter_base > filter_base_sptr
Convenience typedef for a shared pointer to filter_base.
const array_type_def_sptr first_array() const
Getter for the first array of the diff.
virtual const string & get_pretty_representation() const
const base_diff_sptrs_type & changed_bases()
Getter for the changed base classes of the diff.
const diff_sptr return_type_diff() const
Getter for the diff of the return types of the two function types of the current diff.
array_diff(const array_type_def_sptr first, const array_type_def_sptr second, diff_sptr element_type_diff, vector< subrange_diff_sptr > &subrange_diffs, diff_context_sptr ctxt=diff_context_sptr())
Constructor for array_diff.
void ensure_lookup_tables_populated(void) const
If the lookup tables are not yet built, walk the differences and fill them.
const string_type_base_sptr_map & deleted_unreachable_types() const
Getter for a map of deleted types that are not reachable from global functions/variables.
const diff_context_sptr context() const
Getter of the context of the current diff.
unordered_map< string, type_diff_base_sptr > string_type_diff_base_sptr_map
Convenience typedef for a map which value is a type_diff_base_sptr. The key of the map is the qualifi...
virtual void finish_diff_type()
Finish the insertion of a diff tree node into the diff graph.
const enum_type_decl_sptr second_enum() const
size_t num_removed_func_filtered_out() const
Getter for the number of removed functions that have been filtered out.
const class_or_union_diff::priv_ptr & get_priv() const
Getter of the private data of the class_or_union_diff type.
size_t net_num_non_incompatible_func_changed() const
Getter of the net number of functions with changes that are not incompatible.
void add_diff_filter(filtering::filter_base_sptr)
Setter for the diff filters to apply to a given diff sub-tree.
const diff_sptr member_type_diff() const
Getter of the diff node carrying changes to the member type of first subject of the current diff node...
size_t num_func_syms_removed() const
Getter for the number of function symbols (not referenced by any debug info) that got removed...
const unsigned_var_diff_sptr_map & changed_data_members() const
Getter of the map of data members that got replaced by another data member. The key of the map is the...
diff_category add_to_local_category(diff_category c)
Adds the current diff tree node to the categories resulting from the local changes of the current dif...
This means that a diff node in the sub-tree carries an addition or removal of a static data member...