@@ -1716,6 +1716,9 @@ public:
const base_diff_sptrs_type&
changed_bases();
+ const vector<class_decl::base_spec_sptr>&
+ moved_bases() const;
+
virtual bool
has_changes() const;
@@ -613,6 +613,7 @@ struct class_diff::priv
class_decl::base_specs sorted_inserted_bases_;
string_base_diff_sptr_map changed_bases_;
base_diff_sptrs_type sorted_changed_bases_;
+ vector<class_decl::base_spec_sptr> moved_bases_;
class_decl::base_spec_sptr
base_has_changed(class_decl::base_spec_sptr) const;
@@ -5217,6 +5217,11 @@ class_diff::ensure_lookup_tables_populated(void) const
if (j->second != b)
get_priv()->changed_bases_[name] =
compute_diff(j->second, b, context());
+ else
+ // The base class changed place. IOW, the base
+ // classes got re-arranged. Let's keep track of the
+ // base classes that moved.
+ get_priv()->moved_bases_.push_back(b);
get_priv()->deleted_bases_.erase(j);
}
else
@@ -5547,6 +5552,16 @@ const base_diff_sptrs_type&
class_diff::changed_bases()
{return get_priv()->sorted_changed_bases_;}
+/// Getter for the vector of bases that "moved".
+/// That is, the vector of base types which position changed. If this
+/// vector is not empty, it means the bases of the underlying class
+/// type got re-ordered.
+///
+/// @return the vector of bases that moved.
+const vector<class_decl::base_spec_sptr>&
+class_diff::moved_bases() const
+{return get_priv()->moved_bases_;}
+
/// @return the edit script of the bases of the two classes.
edit_script&
class_diff::base_changes()
@@ -1348,6 +1348,9 @@ default_reporter::report(const class_diff& d, ostream& out,
out << "\n";
}
}
+
+ // Report base classes re-organisation
+ maybe_report_base_class_reordering(d, out, indent);
}
d.class_or_union_diff::report(out, indent);
@@ -691,6 +691,8 @@ leaf_reporter::report(const class_diff& d,
d.class_or_union_diff::report(out, indent);
+ maybe_report_base_class_reordering(d, out, indent);
+
maybe_report_interfaces_impacted_by_diff(&d, out, indent);
d.reported_once(true);
@@ -1451,5 +1451,53 @@ maybe_report_data_members_replaced_by_anon_dm(const class_or_union_diff &d,
}
}
+/// Report about the base classes of a class having been re-ordered.
+///
+/// @param d the class diff to consider.
+///
+/// @param out the output stream to report the change to.
+///
+/// @param indent the indentation string to use.
+void
+maybe_report_base_class_reordering(const class_diff &d,
+ ostream &out,
+ const string &indent)
+{
+ if (d.moved_bases().empty())
+ return;
+
+ class_decl_sptr first = d.first_class_decl(),
+ second = d.second_class_decl();
+
+ ABG_ASSERT(!first->get_base_specifiers().empty());
+ ABG_ASSERT(!second->get_base_specifiers().empty());
+
+ out << indent << "base classes of '"
+ << first->get_pretty_representation()
+ << "' are re-ordered from: ";
+
+ vector<class_decl_sptr> classes = {first, second};
+ unsigned nb_classes_seen = 0;
+ for (auto &klass : classes)
+ {
+ if (nb_classes_seen >= 1)
+ out << " to: ";
+ out << "'";
+ bool needs_comma = false;
+ for (auto &b : klass->get_base_specifiers())
+ {
+ if (needs_comma)
+ out << ", ";
+ if (b->get_is_virtual())
+ out << "virtual ";
+ out << b->get_base_class()->get_qualified_name();
+ needs_comma = true;
+ }
+ out << "'";
+ nb_classes_seen++;
+ }
+ if (nb_classes_seen)
+ out << "\n";
+}
} // Namespace comparison
} // end namespace abigail
@@ -241,6 +241,10 @@ maybe_report_data_members_replaced_by_anon_dm(const class_or_union_diff &d,
const string indent);
+void
+maybe_report_base_class_reordering(const class_diff &d,
+ ostream &out,
+ const string &indent);
} // end namespace comparison
} // end namespace abigail
@@ -98,12 +98,16 @@ test-abidiff/test-PR27985-v0.o.abi \
test-abidiff/test-PR27985-v1.c \
test-abidiff/test-PR27985-v1.o \
test-abidiff/test-PR27985-v1.o.abi \
+test-abidiff/test-PR27616-squished-v0.abi \
+test-abidiff/test-PR27616-squished-v1.abi \
+test-abidiff/test-PR27616-v0.xml \
+test-abidiff/test-PR27616-v1.xml \
+\
test-abidiff-exit/test-PR28316-v0.cc \
test-abidiff-exit/test-PR28316-v1.cc \
test-abidiff-exit/test-PR28316-v0.o \
test-abidiff-exit/test-PR28316-v1.o \
test-abidiff-exit/test-PR28316-report.txt \
-\
test-abidiff-exit/test1-voffset-change-report0.txt \
test-abidiff-exit/test1-voffset-change-report1.txt \
test-abidiff-exit/test1-voffset-change.abignore \
@@ -218,10 +222,12 @@ test-abidiff-exit/test-crc-v1.abi \
test-abidiff-exit/test-missing-alias-report.txt \
test-abidiff-exit/test-missing-alias.abi \
test-abidiff-exit/test-missing-alias.suppr \
-test-abidiff/test-PR27616-squished-v0.abi \
-test-abidiff/test-PR27616-squished-v1.abi \
-test-abidiff/test-PR27616-v0.xml \
-test-abidiff/test-PR27616-v1.xml \
+test-abidiff-exit/test-PR29144-report-2.txt \
+test-abidiff-exit/test-PR29144-report.txt \
+test-abidiff-exit/test-PR29144-v0.cc \
+test-abidiff-exit/test-PR29144-v0.o \
+test-abidiff-exit/test-PR29144-v1.cc \
+test-abidiff-exit/test-PR29144-v1.o \
\
test-diff-dwarf/test0-v0.cc \
test-diff-dwarf/test0-v0.o \
new file mode 100644
@@ -0,0 +1,8 @@
+Leaf changes summary: 1 artifact changed
+Changed leaf types summary: 1 leaf type changed
+Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
+Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable
+
+'struct D at 1.cc:13:1' changed:
+ type size hasn't changed
+ base classes of 'struct D' are re-ordered from: 'A, B, C' to: 'B, A, C'
new file mode 100644
@@ -0,0 +1,10 @@
+Functions changes summary: 0 Removed, 0 Changed, 0 Added function
+Variables changes summary: 0 Removed, 1 Changed, 0 Added variable
+
+1 Changed variable:
+
+ [C] 'D order' was changed at 2.cc:17:1:
+ type of variable changed:
+ type size hasn't changed
+ base classes of 'struct D' are re-ordered from: 'A, B, C' to: 'B, A, C'
+
new file mode 100644
@@ -0,0 +1,17 @@
+struct A {
+ int x;
+};
+
+struct B {
+ int y;
+};
+
+struct C {
+ int z;
+};
+
+struct D: A, B, C {
+ int d;
+};
+
+D order;
new file mode 100644
GIT binary patch
literal 2560
zcmbVNOK;Oa5T3P@l42T~M&i|qxClgf#A%|?mZFwGfPz4XhY%;IoMf9C^1^XZ3kNE}
z0SR$HLL4}A;K+?Dzk?Hhfink~S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@_4iW!Q+&#&
rb7}9B1iz4jlEEkL`_nhk?;geXB&h$h==D?HIQ~od{XbK(i0J%ZNgcXU
literal 0
HcmV?d00001
new file mode 100644
@@ -0,0 +1,18 @@
+struct A {
+ int x;
+};
+
+struct B {
+ int y;
+};
+
+struct C {
+ int z;
+};
+
+struct D: B, A, C {
+ int d;
+};
+
+D order;
+
new file mode 100644
GIT binary patch
literal 2560
zcmbVNOK;Oa5T3P@l42T~M&i|qxClgf#A%|?mZFwGfPz4XhY%;IoMf9C^1^XZ3kNE}
z0SR$HLL4}A;K+?Dzk?Hhfink~S?>mSYXo8>@63EV-|Toin>@RC?UKP5C}FS&zdeNl
zRFV-}m=(yv7`#I}2`oiWf|f~Il(2J<U`6zdbudU{a3bk-0$}GMk-SPf8!!~^uqq^m
z?-TR{c1q|1jE+1<$ehCk%!9ZjOroWX2Baxy7YyMFEMpRN*d#{?%Q7=%S@V<ZjCFc4
z#j==q1k98Kc3jEMS(tJHLL-r3N77l#%#G(p_hOlc!Lk-D6JKno3}$-X!YtO6?AiUs
zK1@G>k0Fi`Z!WCpQbH#QDL9UrG4>-pLW&xT4;neqV}s?4-C-I*?)nYx!_xITcJ;)G
z;;daPIYp;vm!?al=~L6Q_S7xjurIrT+{hP?+4**`*5M0H-r>GiN7wc1s|)LMGx?da
zoo_;6wcF-}Mz`_6D>S{J(DG_-&1<?|tFYp&^M0Y{2fQEj3pZ|+P8Z8%C^_}|f3gG>
zma5fxdkSCT*gw=SX2!;sr}07#HkEx5b0iu<?FxO-FNwt|+E2jupK*I;IGNkF%y4vK
z@ZoJ30Vd$U#E6MQs0$5c1{q35l_8oGerST!`0PaccQn9=j3=CWBZeIHSOh05ye9yA
zG+erHAc9Bx`XYiyt~R`pIQ4Ufv`MM+sh-Hh!XX($IK|9J|D=XDrLXE$@hypi)8A+Z
zZVh$dhk8|60bdWmX}Ez4POaYu$LB5AY4F-wbJ^>xba7AEZms6?$6K~t-|aN{R!Yn3
za7Do*lu7Wi@ax@no8xbk)9D7>!Kuvm1GoNA`pwRo)APGM?gtyH`2W}ANTpt@{;EtB
zWoTNz2a~u@Saf!XQlTYAbpBC{p&9%We=xT)m+sT|)N@j3g%*_ep&G1uEX@hcWn~Z%
z8k@49j}oVIDNfxN`Vl5sz(>zX_*Ys`?uBZw>ajO)N5?35R)RJ;5z%AmzbLN$DFRVc
zom4;FC%yg#VtP)5;I0JKeIkrRk6lJA?)-{8|FU2K(E0SMrk~$KjB-xn6P4HUpxaRp
zZFRoVPbH@FzsZ0{f8oFS1OKKG5(|Ifzm<F~3^pZS$5q`5|9}R47d>3@_4iW!Q+&#&
rb7}9B1iz4jlEEkL`_nhk?;geXB&h$h==D?HIQ~od{XbK(i0J%ZXQaAT
literal 0
HcmV?d00001
@@ -427,6 +427,28 @@ InOutSpec in_out_specs[] =
"data/test-abidiff-exit/test-PR28316-report.txt",
"output/test-abidiff-exit/test-PR28316-report.txt"
},
+ {
+ "data/test-abidiff-exit/test-PR29144-v0.o",
+ "data/test-abidiff-exit/test-PR29144-v1.o",
+ "",
+ "",
+ "",
+ "--no-default-suppression --harmless",
+ abigail::tools_utils::ABIDIFF_ABI_CHANGE,
+ "data/test-abidiff-exit/test-PR29144-report.txt",
+ "output/test-abidiff-exit/test-PR29144-report.txt"
+ },
+ {
+ "data/test-abidiff-exit/test-PR29144-v0.o",
+ "data/test-abidiff-exit/test-PR29144-v1.o",
+ "",
+ "",
+ "",
+ "--leaf-changes-only --no-default-suppression --harmless",
+ abigail::tools_utils::ABIDIFF_ABI_CHANGE,
+ "data/test-abidiff-exit/test-PR29144-report-2.txt",
+ "output/test-abidiff-exit/test-PR29144-report-2.txt"
+ },
{0, 0, 0 ,0, 0, 0, abigail::tools_utils::ABIDIFF_OK, 0, 0}
};