libabigail
Loading...
Searching...
No Matches
abg-comp-filter.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-2026 Red Hat, Inc.
5//
6// Author: Dodji Seketeli
7
8/// @file
9///
10/// This header declares filters for the diff trees resulting from
11/// comparing ABI Corpora.
12
13#ifndef __ABG_COMP_FILTER_H__
14#define __ABG_COMP_FILTER_H__
15
16#include "abg-comparison.h"
17
18namespace abigail
19{
20namespace comparison
21{
22/// Facilities to walk, categorize and possibly filter nodes of the
23/// diff tree.
24namespace filtering
25{
26
27bool
28is_harmful_name_change(const decl_base_sptr& f,
29 const decl_base_sptr& s,
30 const diff_context_sptr& ctxt);
31
32bool
33is_harmless_name_change(const decl_base_sptr& f,
34 const decl_base_sptr& s,
35 const diff_context_sptr& ctxt);
36
37bool
39
40bool
41union_diff_is_harmless_change(const union_decl_sptr l,
42 const union_decl_sptr r);
43
44bool
45is_harmful_name_change(const decl_base_sptr& f,
46 const decl_base_sptr& s,
47 const diff_context_sptr& ctxt);
48
49bool
50is_harmful_name_change(const diff* dif);
51
52bool
53has_virtual_mem_fn_change(const function_decl_diff* diff);
54
55bool
56is_decl_only_class_with_size_change(const class_or_union& first,
57 const class_or_union& second);
58
59bool
60is_decl_only_class_with_size_change(const class_or_union_sptr& first,
61 const class_or_union_sptr& second);
62
63bool
65
66bool
67has_decl_only_def_change(const decl_base_sptr& first,
68 const decl_base_sptr& second);
69
70bool
71has_decl_only_def_change(const diff *d);
72
73bool
74has_class_decl_only_def_change(const class_or_union_sptr& first,
75 const class_or_union_sptr& second);
76
77bool
79 const enum_type_decl_sptr& second);
80
81bool
82has_class_decl_only_def_change(const diff *diff);
83
84bool
85has_enum_decl_only_def_change(const diff *diff);
86
87bool
88has_basic_type_name_change(const diff *);
89
90bool
92
93bool
95
96bool
97is_mostly_distinct_diff(const diff *d);
98
99bool
101
102bool
104
105bool
107
108bool
110
111bool
113 const var_decl_sptr& var2);
114
115bool
117 const class_decl_sptr& second);
118
119bool
120has_strict_fam_conversion(const diff *d);
121
122bool
124
125bool
126has_void_ptr_to_ptr_change(const diff* d);
127
128bool
129has_void_to_non_void_change(const diff* d);
130
131bool
133
134bool
136
137bool
139
142
144has_var_harmful_local_change(const diff* d);
145
148
149bool
151
152bool
154
155bool
157
158bool
160
161bool
163
164bool
166
167bool
169 const type_base_sptr&);
170
171bool
173
174bool
176
177bool
179 const decl_base_sptr&);
180
181struct filter_base;
182/// Convenience typedef for a shared pointer to filter_base
183typedef shared_ptr<filter_base> filter_base_sptr;
184/// Convenience typedef for a vector of filter_base_sptr
185typedef std::vector<filter_base_sptr> filters;
186
187/// The base class for the diff tree node filter.
188///
189/// It's intended to walk a tree of diff nodes and tag each relevant
190/// name into one or several categories depending on well choosen
191/// properties of the diff nodes.
193{
194 friend void
196}; //end class filter_base
197
198void
200
201void
203
204void
206
207class harmless_filter;
208/// Convenience typedef for a shared pointer to a harmless_filter.
209typedef shared_ptr<harmless_filter> harmless_filter_sptr;
210
211/// A filter that walks the diff nodes tree and tags relevant diff
212/// nodes into categories considered to represent harmless changes.
214{
215 virtual bool
216 visit(diff*, bool);
217
218 virtual void
219 visit_end(diff*);
220}; // end class harmless_filter
221
223/// A convenience typedef for a shared pointer to harmful_filter.
224typedef shared_ptr<harmless_harmful_filter> harmful_harmless_filter_sptr;
225
226/// A filter that walks the diff nodes tree and tags relevant diff
227/// nodes into categories considered to represent potentially harmless
228/// or harmful changes.
230{
231 virtual bool
232 visit(diff*, bool);
233
234 virtual void
235 visit_end(diff*);
236}; // end class harmless_harmful_filter
237
238} // end namespace filtering
239} // end namespace comparison
240} // end namespace abigail
241
242#endif // __ABG_COMP_FILTER_H__
The base class for the node visitors. These are the types used to visit each node traversed by the di...
The abstraction of a change between two ABI artifacts, a.k.a an artifact change.
A filter that walks the diff nodes tree and tags relevant diff nodes into categories considered to re...
A filter that walks the diff nodes tree and tags relevant diff nodes into categories considered to re...
bool has_void_ptr_to_ptr_change(const diff *dif)
Test if a diff node carries a void* to pointer type change.
bool has_basic_type_name_change(const diff *d)
Test if a diff node carries a basic type name change.
diff_category has_fn_return_or_parm_harmful_change(const diff *d)
Test if a diff node is a function diff node that carries either a return or a parameter type change t...
bool is_data_member_to_compatible_anonymous_dm_change(const diff *d)
Test if a diff node carries a change where a data member F is modified into an anonymous data member ...
bool has_enum_decl_only_def_change(const enum_type_decl_sptr &first, const enum_type_decl_sptr &second)
Test if two enum_sptr are different just by the fact that one is decl-only and the other one is defin...
bool union_diff_is_harmless_change(const diff *d)
Test if a union diff node does have changes that don't impact its size.
diff_category has_var_harmful_local_change(const diff *d)
Test if a diff node carries a harmful local change to a variable.
std::vector< filter_base_sptr > filters
Convenience typedef for a vector of filter_base_sptr.
bool has_fn_with_virtual_offset_change(const diff *d)
Test if a diff node carries a change to the offset of a virtual function.
bool has_harmless_enum_to_int_change(const diff *diff)
Test if a diff node carries a harmless change of an enum into an integer (or vice-versa).
bool is_harmful_name_change(const decl_base_sptr &f, const decl_base_sptr &s, const diff_context_sptr &ctxt)
Test if two decls represent a harmful name change.
bool has_class_decl_only_def_change(const class_or_union_sptr &first, const class_or_union_sptr &second)
Test if two class_or_union_sptr are different just by the fact that one is decl-only and the other on...
bool has_data_member_replaced_by_anon_dm(const diff *diff)
Test if a class_or_union_diff has a data member replaced by an anonymous data member in a harmless wa...
shared_ptr< harmless_harmful_filter > harmful_harmless_filter_sptr
A convenience typedef for a shared pointer to harmful_filter.
bool is_var_1_dim_unknown_size_array_change(const var_decl_sptr &var1, const var_decl_sptr &var2)
Test if we are looking at two variables which types are both one dimension array, with one of them be...
bool is_decl_only_class_with_size_change(const class_or_union &first, const class_or_union &second)
Test if two classes that are decl-only (have the decl-only flag and carry no data members) but are di...
bool has_virtual_mem_fn_change(const function_decl_diff *diff)
Test if the function_decl_diff node has a change involving virtual member functions.
shared_ptr< filter_base > filter_base_sptr
Convenience typedef for a shared pointer to filter_base.
bool has_benign_array_of_unknown_size_change(const diff *dif)
Test if a diff node carries a benign change to the size of a variable of type array.
bool has_class_or_union_type_name_change(const diff *d)
Test if a diff node carries a class or union type name change.
bool has_decl_only_def_change(const decl_base_sptr &first, const decl_base_sptr &second)
Test if two decl_base_sptr are different just by the fact that one is decl-only and the other one is ...
bool has_basic_or_class_type_name_change(const diff *d)
Test if a diff node carries a basic or class type name change.
shared_ptr< harmless_filter > harmless_filter_sptr
Convenience typedef for a shared pointer to a harmless_filter.
bool has_incompatible_fn_or_var_change(const diff *d)
Test if a diff node carries an incompatible ABI change.
bool has_lvalue_reference_ness_change(const diff *dif)
Test if a diff node carries a change where an lvalue reference changed into a rvalue reference,...
bool has_anonymous_data_member_change(const diff *d)
Test if a diff node carries a non-anonymous data member to anonymous data member change,...
bool is_type_to_compatible_anonymous_type_change(const diff_sptr &d)
Test if a diff node carries a change where a type T is modified into an anonymous type T' of the same...
bool has_void_to_non_void_change(const diff *d)
Test if a diff node carries a "void-to-non-void" type change.
void apply_filter(filter_base &filter, corpus_diff_sptr d)
Walk the diff sub-trees of a a corpus_diff and apply a filter to the nodes visted....
bool is_mostly_distinct_diff(const diff *d)
Test if a diff node carries a distinct type change or a pointer/reference/typedef to distinct type ch...
bool is_harmless_name_change(const decl_base_sptr &f, const decl_base_sptr &s, const diff_context_sptr &ctxt)
Test if two decls represent a harmless name change.
bool has_strict_fam_conversion(const class_decl_sptr &first, const class_decl_sptr &second)
Test if a class with a fake flexible data member got changed into a class with a real fexible data me...
shared_ptr< diff > diff_sptr
Convenience typedef for a shared_ptr for the diff class.
Definition abg-fwd.h:75
diff_category
An enum for the different categories that a diff tree node falls into, regarding the kind of changes ...
shared_ptr< diff_context > diff_context_sptr
Convenience typedef for a shared pointer of diff_context.
Definition abg-fwd.h:67
shared_ptr< corpus_diff > corpus_diff_sptr
A convenience typedef for a shared pointer to corpus_diff.
shared_ptr< class_decl > class_decl_sptr
Convenience typedef for a shared pointer on a class_decl.
Definition abg-fwd.h:194
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
Definition abg-fwd.h:257
shared_ptr< enum_type_decl > enum_type_decl_sptr
Convenience typedef for shared pointer to a enum_type_decl.
Definition abg-fwd.h:176
Toplevel namespace for libabigail.
The base class for the diff tree node filter.
friend void apply_filter(filter_base_sptr f, diff_sptr deef)
Walk a diff sub-tree and apply a filter to the nodes visted. The filter categorizes each node,...