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-2025 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
20namespace abigail
21{
22
23using std::shared_ptr;
24
25namespace comparison
26{
27class diff;
28class type_decl_diff;
29class enum_diff;
30class typedef_diff;
31class qualified_type_diff;
32class distinct_diff;
33class pointer_diff;
34class reference_diff;
35class ptr_to_mbr_diff;
36class subrange_diff;
37class array_diff;
38class base_diff;
39class class_or_union_diff;
40class class_diff;
41class union_diff;
42class scope_diff;
43class fn_parm_diff;
44class function_type_diff;
45class function_decl_diff;
46class var_diff;
47class translation_unit_diff;
48class corpus_diff;
49class diff_maps;
50class reporter_base;
51
52/// A convenience typedef for a shared pointer to a @ref
53/// reporter_base.
54typedef shared_ptr<reporter_base> reporter_base_sptr;
55
56/// The base class of all the reporting classes.
58{
59public:
60
61 virtual bool diff_to_be_reported(const diff *d) const;
62
63 virtual bool diff_has_net_changes(const corpus_diff *d) const = 0;
64
65 virtual void
66 report(const type_decl_diff& d, std::ostream& out,
67 const std::string& indent = "") const = 0;
68
69 virtual void
70 report(const enum_diff& d, std::ostream& out,
71 const std::string& indent = "") const = 0;
72
73 virtual void
74 report(const typedef_diff& d, std::ostream& out,
75 const std::string& indent = "") const = 0;
76
77 virtual void
78 report(const qualified_type_diff& d, std::ostream& out,
79 const std::string& indent = "") const = 0;
80
81 virtual void
82 report(const distinct_diff& d, std::ostream& out,
83 const std::string& indent = "") const = 0;
84
85 virtual void
86 report(const pointer_diff& d, std::ostream& out,
87 const std::string& indent = "") const = 0;
88
89 virtual void
90 report(const reference_diff& d, std::ostream& out,
91 const std::string& indent = "") const = 0;
92
93 virtual void
94 report(const ptr_to_mbr_diff& d, std::ostream& out,
95 const std::string& indent = "") const = 0;
96
97 virtual void
98 report(const array_diff& d, std::ostream& out,
99 const std::string& indent = "") const = 0;
100
101 virtual void
102 report(const subrange_diff& d, std::ostream& out,
103 const std::string& indent = "") const = 0;
104
105 virtual void
106 report(const base_diff& d, std::ostream& out,
107 const std::string& indent = "") const = 0;
108
109 virtual void
110 report(const class_or_union_diff& d, std::ostream& out,
111 const std::string& indent = "") const = 0;
112
113 virtual void
114 report(const class_diff& d, std::ostream& out,
115 const std::string& indent = "") const = 0;
116
117 virtual void
118 report(const union_diff& d, std::ostream& out,
119 const std::string& indent = "") const = 0;
120
121 virtual void
122 report(const scope_diff& d, std::ostream& out,
123 const std::string& indent = "") const = 0;
124
125 virtual void
126 report(const fn_parm_diff& d, std::ostream& out,
127 const std::string& indent = "") const = 0;
128
129 virtual void
130 report(const function_type_diff& d, std::ostream& out,
131 const std::string& indent = "") const = 0;
132
133 virtual void
134 report(const function_decl_diff& d, std::ostream& out,
135 const std::string& indent = "") const = 0;
136
137 virtual void
138 report(const var_diff& d, std::ostream& out,
139 const std::string& indent = "") const = 0;
140
141 virtual void
142 report(const translation_unit_diff& d, std::ostream& out,
143 const std::string& indent = "") const = 0;
144
145 virtual void
146 report(const corpus_diff& d, std::ostream& out,
147 const std::string& indent = "") const = 0;
148
149 virtual ~reporter_base() {}
150}; //end class reporter_base
151
152class default_reporter;
153
154/// A convenience typedef for a shared_ptr to a @ref default_reporter.
155typedef shared_ptr<default_reporter> default_reporter_sptr;
156
157/// The default, initial, reporter of the libabigail comparison engine.
159{
160public:
161
162 virtual bool diff_has_net_changes(const corpus_diff *d) const;
163
164 virtual void
165 report(const type_decl_diff& d, std::ostream& out,
166 const std::string& indent = "") const;
167
168 virtual void
169 report(const enum_diff& d, std::ostream& out,
170 const std::string& indent = "") const;
171
172 void
174 std::ostream& out,
175 const std::string& indent) const;
176
177 virtual void
178 report(const typedef_diff& d, std::ostream& out,
179 const std::string& indent = "") const;
180
181 bool
183 std::ostream& out,
184 const std::string& indent) const;
185
186 void
188 ostream& out,
189 const string& indent) const;
190
191 virtual void
192 report(const qualified_type_diff& d, std::ostream& out,
193 const std::string& indent = "") const;
194
195 virtual void
196 report(const pointer_diff& d, std::ostream& out,
197 const std::string& indent = "") const;
198
199 void
201 std::ostream& out,
202 const std::string& indent) const;
203
204 virtual void
205 report(const reference_diff& d, std::ostream& out,
206 const std::string& indent = "") const;
207
208 bool
210 std::ostream& out,
211 const std::string& indent = "") const;
212
213 virtual void
214 report(const ptr_to_mbr_diff& d, std::ostream& out,
215 const std::string& indent = "") const;
216
217 virtual void
218 report(const fn_parm_diff& d, std::ostream& out,
219 const std::string& indent = "") const;
220
221 void
223 std::ostream& out,
224 const std::string& indent) const;
225
226 virtual void
227 report(const function_type_diff& d, std::ostream& out,
228 const std::string& indent = "") const;
229
230 virtual void
231 report(const subrange_diff& d, std::ostream& out,
232 const std::string& indent = "") const;
233
234 virtual void
235 report(const array_diff& d, std::ostream& out,
236 const std::string& indent = "") const;
237
238 virtual void
239 report(const base_diff& d, std::ostream& out,
240 const std::string& indent = "") const;
241
242 virtual void
243 report(const scope_diff& d, std::ostream& out,
244 const std::string& indent = "") const;
245
246 virtual void
247 report(const class_or_union_diff& d, std::ostream& out,
248 const std::string& indent = "") const;
249
250 virtual void
251 report(const class_diff& d, std::ostream& out,
252 const std::string& indent = "") const;
253
254 virtual void
255 report(const union_diff& d, std::ostream& out,
256 const std::string& indent = "") const;
257
258 virtual void
259 report(const distinct_diff& d, std::ostream& out,
260 const std::string& indent = "") const;
261
262 virtual void
263 report(const function_decl_diff& d, std::ostream& out,
264 const std::string& indent = "") const;
265
266 virtual void
267 report(const var_diff& d, std::ostream& out,
268 const std::string& indent = "") const;
269
270 virtual void
271 report(const translation_unit_diff& d, std::ostream& out,
272 const std::string& indent = "") const;
273
274 virtual void
275 report(const corpus_diff& d, std::ostream& out,
276 const std::string& indent = "") const;
277}; // end class default_reporter
278
279/// A reporter that only reports leaf changes
281{
282public:
283
284 virtual bool diff_to_be_reported(const diff *d) const;
285
286 virtual bool diff_has_net_changes(const corpus_diff *d) const;
287
288 void
289 report_changes_from_diff_maps(const diff_maps&, std::ostream& out,
290 const std::string& indent) const;
291
292 virtual void
293 report(const typedef_diff& d, std::ostream& out,
294 const std::string& indent = "") const;
295
296 virtual void
297 report(const qualified_type_diff& d, std::ostream& out,
298 const std::string& indent = "") const;
299
300 virtual void
301 report(const pointer_diff& d, std::ostream& out,
302 const std::string& indent = "") const;
303
304 virtual void
305 report(const reference_diff& d, std::ostream& out,
306 const std::string& indent = "") const;
307
308 virtual void
309 report(const ptr_to_mbr_diff& d, std::ostream& out,
310 const std::string& indent = "") const;
311
312 virtual void
313 report(const fn_parm_diff& d, std::ostream& out,
314 const std::string& indent = "") const;
315
316 virtual void
317 report(const function_type_diff& d, std::ostream& out,
318 const std::string& indent = "") const;
319
320 virtual void
321 report(const subrange_diff& d, std::ostream& out,
322 const std::string& indent = "") const;
323
324 virtual void
325 report(const array_diff& d, std::ostream& out,
326 const std::string& indent = "") const;
327
328 virtual void
329 report(const scope_diff& d, std::ostream& out,
330 const std::string& indent = "") const;
331
332 virtual void
333 report(const class_or_union_diff& d, std::ostream& out,
334 const std::string& indent = "") const;
335
336 virtual void
337 report(const class_diff& d, std::ostream& out,
338 const std::string& indent = "") const;
339
340 virtual void
341 report(const union_diff& d, std::ostream& out,
342 const std::string& indent = "") const;
343
344 virtual void
345 report(const distinct_diff& d, std::ostream& out,
346 const std::string& indent = "") const;
347
348 virtual void
349 report(const function_decl_diff& d, std::ostream& out,
350 const std::string& indent = "") const;
351
352 virtual void
353 report(const var_diff& d, std::ostream& out,
354 const std::string& indent = "") const;
355
356 virtual void
357 report(const translation_unit_diff& d, std::ostream& out,
358 const std::string& indent = "") const;
359
360 virtual void
361 report(const corpus_diff& d, std::ostream& out,
362 const std::string& indent = "") const;
363}; // end class leaf_reporter
364
365} // end namespace comparison
366} // end namespace abigail
367
368#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:159
bool report_local_ptr_to_mbr_type_changes(const ptr_to_mbr_diff &d, std::ostream &out, const std::string &indent="") const
Report the local changes carried by a ptr_to_mbr_diff diff node.
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:281
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.
The abstraction of a diff between two ptr_to_mbr_type.
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:58
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:54
shared_ptr< default_reporter > default_reporter_sptr
A convenience typedef for a shared_ptr to a default_reporter.
Definition: abg-reporter.h:155
Toplevel namespace for libabigail.