libabigail
abg-reporter.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) 2017-2023 Red Hat, Inc.
5 //
6 // Author: Dodji Seketeli
7 
8 /// @file
9 ///
10 /// The declaration of the reporting types of libabigail's diff
11 /// engine.
12 
13 #ifndef __ABG_REPORTER_H__
14 #define __ABG_REPORTER_H__
15 
16 #include <memory>
17 #include <ostream>
18 #include <string>
19 
20 namespace abigail
21 {
22 
23 using std::shared_ptr;
24 
25 namespace comparison
26 {
27 class diff;
28 class type_decl_diff;
29 class enum_diff;
30 class typedef_diff;
31 class qualified_type_diff;
32 class distinct_diff;
33 class pointer_diff;
34 class reference_diff;
35 class subrange_diff;
36 class array_diff;
37 class base_diff;
38 class class_or_union_diff;
39 class class_diff;
40 class union_diff;
41 class scope_diff;
42 class fn_parm_diff;
43 class function_type_diff;
44 class function_decl_diff;
45 class var_diff;
46 class translation_unit_diff;
47 class corpus_diff;
48 class diff_maps;
49 class reporter_base;
50 
51 /// A convenience typedef for a shared pointer to a @ref
52 /// reporter_base.
53 typedef shared_ptr<reporter_base> reporter_base_sptr;
54 
55 /// The base class of all the reporting classes.
57 {
58 public:
59 
60  virtual bool diff_to_be_reported(const diff *d) const;
61 
62  virtual bool diff_has_net_changes(const corpus_diff *d) const = 0;
63 
64  virtual void
65  report(const type_decl_diff& d, std::ostream& out,
66  const std::string& indent = "") const = 0;
67 
68  virtual void
69  report(const enum_diff& d, std::ostream& out,
70  const std::string& indent = "") const = 0;
71 
72  virtual void
73  report(const typedef_diff& d, std::ostream& out,
74  const std::string& indent = "") const = 0;
75 
76  virtual void
77  report(const qualified_type_diff& d, std::ostream& out,
78  const std::string& indent = "") const = 0;
79 
80  virtual void
81  report(const distinct_diff& d, std::ostream& out,
82  const std::string& indent = "") const = 0;
83 
84  virtual void
85  report(const pointer_diff& d, std::ostream& out,
86  const std::string& indent = "") const = 0;
87 
88  virtual void
89  report(const reference_diff& d, std::ostream& out,
90  const std::string& indent = "") const = 0;
91 
92  virtual void
93  report(const array_diff& d, std::ostream& out,
94  const std::string& indent = "") const = 0;
95 
96  virtual void
97  report(const subrange_diff& d, std::ostream& out,
98  const std::string& indent = "") const = 0;
99 
100  virtual void
101  report(const base_diff& d, std::ostream& out,
102  const std::string& indent = "") const = 0;
103 
104  virtual void
105  report(const class_or_union_diff& d, std::ostream& out,
106  const std::string& indent = "") const = 0;
107 
108  virtual void
109  report(const class_diff& d, std::ostream& out,
110  const std::string& indent = "") const = 0;
111 
112  virtual void
113  report(const union_diff& d, std::ostream& out,
114  const std::string& indent = "") const = 0;
115 
116  virtual void
117  report(const scope_diff& d, std::ostream& out,
118  const std::string& indent = "") const = 0;
119 
120  virtual void
121  report(const fn_parm_diff& d, std::ostream& out,
122  const std::string& indent = "") const = 0;
123 
124  virtual void
125  report(const function_type_diff& d, std::ostream& out,
126  const std::string& indent = "") const = 0;
127 
128  virtual void
129  report(const function_decl_diff& d, std::ostream& out,
130  const std::string& indent = "") const = 0;
131 
132  virtual void
133  report(const var_diff& d, std::ostream& out,
134  const std::string& indent = "") const = 0;
135 
136  virtual void
137  report(const translation_unit_diff& d, std::ostream& out,
138  const std::string& indent = "") const = 0;
139 
140  virtual void
141  report(const corpus_diff& d, std::ostream& out,
142  const std::string& indent = "") const = 0;
143 
144  virtual ~reporter_base() {}
145 }; //end class reporter_base
146 
147 class default_reporter;
148 
149 /// A convenience typedef for a shared_ptr to a @ref default_reporter.
150 typedef shared_ptr<default_reporter> default_reporter_sptr;
151 
152 /// The default, initial, reporter of the libabigail comparison engine.
154 {
155 public:
156 
157  virtual bool diff_has_net_changes(const corpus_diff *d) const;
158 
159  virtual void
160  report(const type_decl_diff& d, std::ostream& out,
161  const std::string& indent = "") const;
162 
163  virtual void
164  report(const enum_diff& d, std::ostream& out,
165  const std::string& indent = "") const;
166 
167  void
169  std::ostream& out,
170  const std::string& indent) const;
171 
172  virtual void
173  report(const typedef_diff& d, std::ostream& out,
174  const std::string& indent = "") const;
175 
176  bool
178  std::ostream& out,
179  const std::string& indent) const;
180 
181  void
183  ostream& out,
184  const string& indent) const;
185 
186  virtual void
187  report(const qualified_type_diff& d, std::ostream& out,
188  const std::string& indent = "") const;
189 
190  virtual void
191  report(const pointer_diff& d, std::ostream& out,
192  const std::string& indent = "") const;
193 
194  void
196  std::ostream& out,
197  const std::string& indent) const;
198 
199  virtual void
200  report(const reference_diff& d, std::ostream& out,
201  const std::string& indent = "") const;
202 
203  virtual void
204  report(const fn_parm_diff& d, std::ostream& out,
205  const std::string& indent = "") const;
206 
207  void
209  std::ostream& out,
210  const std::string& indent) const;
211 
212  virtual void
213  report(const function_type_diff& d, std::ostream& out,
214  const std::string& indent = "") const;
215 
216  virtual void
217  report(const subrange_diff& d, std::ostream& out,
218  const std::string& indent = "") const;
219 
220  virtual void
221  report(const array_diff& d, std::ostream& out,
222  const std::string& indent = "") const;
223 
224  virtual void
225  report(const base_diff& d, std::ostream& out,
226  const std::string& indent = "") const;
227 
228  virtual void
229  report(const scope_diff& d, std::ostream& out,
230  const std::string& indent = "") const;
231 
232  virtual void
233  report(const class_or_union_diff& d, std::ostream& out,
234  const std::string& indent = "") const;
235 
236  virtual void
237  report(const class_diff& d, std::ostream& out,
238  const std::string& indent = "") const;
239 
240  virtual void
241  report(const union_diff& d, std::ostream& out,
242  const std::string& indent = "") const;
243 
244  virtual void
245  report(const distinct_diff& d, std::ostream& out,
246  const std::string& indent = "") const;
247 
248  virtual void
249  report(const function_decl_diff& d, std::ostream& out,
250  const std::string& indent = "") const;
251 
252  virtual void
253  report(const var_diff& d, std::ostream& out,
254  const std::string& indent = "") const;
255 
256  virtual void
257  report(const translation_unit_diff& d, std::ostream& out,
258  const std::string& indent = "") const;
259 
260  virtual void
261  report(const corpus_diff& d, std::ostream& out,
262  const std::string& indent = "") const;
263 }; // end class default_reporter
264 
265 /// A reporter that only reports leaf changes
267 {
268 public:
269 
270  virtual bool diff_to_be_reported(const diff *d) const;
271 
272  virtual bool diff_has_net_changes(const corpus_diff *d) const;
273 
274  void
275  report_changes_from_diff_maps(const diff_maps&, std::ostream& out,
276  const std::string& indent) const;
277 
278  virtual void
279  report(const typedef_diff& d, std::ostream& out,
280  const std::string& indent = "") const;
281 
282  virtual void
283  report(const qualified_type_diff& d, std::ostream& out,
284  const std::string& indent = "") const;
285 
286  virtual void
287  report(const pointer_diff& d, std::ostream& out,
288  const std::string& indent = "") const;
289 
290  virtual void
291  report(const reference_diff& d, std::ostream& out,
292  const std::string& indent = "") const;
293 
294  virtual void
295  report(const fn_parm_diff& d, std::ostream& out,
296  const std::string& indent = "") const;
297 
298  virtual void
299  report(const function_type_diff& d, std::ostream& out,
300  const std::string& indent = "") const;
301 
302  virtual void
303  report(const subrange_diff& d, std::ostream& out,
304  const std::string& indent = "") const;
305 
306  virtual void
307  report(const array_diff& d, std::ostream& out,
308  const std::string& indent = "") const;
309 
310  virtual void
311  report(const scope_diff& d, std::ostream& out,
312  const std::string& indent = "") const;
313 
314  virtual void
315  report(const class_or_union_diff& d, std::ostream& out,
316  const std::string& indent = "") const;
317 
318  virtual void
319  report(const class_diff& d, std::ostream& out,
320  const std::string& indent = "") const;
321 
322  virtual void
323  report(const union_diff& d, std::ostream& out,
324  const std::string& indent = "") const;
325 
326  virtual void
327  report(const distinct_diff& d, std::ostream& out,
328  const std::string& indent = "") const;
329 
330  virtual void
331  report(const function_decl_diff& d, std::ostream& out,
332  const std::string& indent = "") const;
333 
334  virtual void
335  report(const var_diff& d, std::ostream& out,
336  const std::string& indent = "") const;
337 
338  virtual void
339  report(const translation_unit_diff& d, std::ostream& out,
340  const std::string& indent = "") const;
341 
342  virtual void
343  report(const corpus_diff& d, std::ostream& out,
344  const std::string& indent = "") const;
345 }; // end class leaf_reporter
346 
347 } // end namespace comparison
348 } // end namespace abigail
349 
350 #endif // __ABG_REPORTER_H__
The abstraction of a diff between two arrays.
An abstraction of a diff between two instances of class_decl::base_spec.
This type abstracts changes for a class_decl.
This is the base class of class_diff and union_diff.
An abstraction of a diff between between two abi corpus.
The default, initial, reporter of the libabigail comparison engine.
Definition: abg-reporter.h:154
bool report_local_qualified_type_changes(const qualified_type_diff &d, std::ostream &out, const std::string &indent) const
For a qualified_type_diff node, report the changes that are local.
void report_local_function_type_changes(const function_type_diff &d, std::ostream &out, const std::string &indent) const
For a function_type_diff node, report the local changes carried by the diff node.
void report_underlying_changes_of_qualified_type(const qualified_type_diff &d, ostream &out, const string &indent) const
For a qualified_type_diff node, report the changes of its underlying type.
virtual bool diff_has_net_changes(const corpus_diff *d) const
Test if a given instance of corpus_diff carries changes whose reports are not suppressed by any suppr...
void report_local_reference_type_changes(const reference_diff &d, std::ostream &out, const std::string &indent) const
For a @reference_diff node, report the local changes carried by the diff node.
void report_non_type_typedef_changes(const typedef_diff &d, std::ostream &out, const std::string &indent) const
For a typedef_diff node, report the local changes to the typedef rather the changes to its underlying...
This type contains maps. Each map associates a type name to a diff of that type. Not all kinds of dif...
The abstraction of a change between two ABI artifacts, a.k.a an artifact change.
An abstraction of a diff between entities that are of a different kind (disctinct).
Abstraction of a diff between two enums.
Abstraction of a diff between two function parameters.
Abstraction of a diff between two function_decl.
Abstraction of a diff between two function types.
A reporter that only reports leaf changes.
Definition: abg-reporter.h:267
virtual bool diff_has_net_changes(const corpus_diff *d) const
Test if a given instance of corpus_diff carries changes whose reports are not suppressed by any suppr...
void report_changes_from_diff_maps(const diff_maps &, std::ostream &out, const std::string &indent) const
Report the changes carried by an instance of diff_maps.
virtual bool diff_to_be_reported(const diff *d) const
Test if a diff node is to be reported by the current instance of leaf_reporter.
The abstraction of a diff between two pointers.
Abstraction of a diff between two qualified types.
The abstraction of a diff between two references.
The base class of all the reporting classes.
Definition: abg-reporter.h:57
virtual bool diff_to_be_reported(const diff *d) const
Tests if the diff node is to be reported.
An abstractions of the changes between two scopes.
The abstraction of the diff between two subrange types.
An abstraction of a diff between two translation units.
Abstraction of a diff between two basic type declarations.
Abstraction of a diff between two typedef_decl.
Abstracts a diff between two instances of var_decl.
shared_ptr< reporter_base > reporter_base_sptr
A convenience typedef for a shared pointer to a reporter_base.
Definition: abg-reporter.h:49
shared_ptr< default_reporter > default_reporter_sptr
A convenience typedef for a shared_ptr to a default_reporter.
Definition: abg-reporter.h:147
Toplevel namespace for libabigail.