aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuliano Procida <gprocida@google.com>2023-09-26 11:51:41 +0100
committerGiuliano Procida <gprocida@google.com>2023-10-31 17:04:03 +0000
commit7010a75158608c580606635b79666f183a838801 (patch)
tree2bff8864163ea59167f7526f348cb3116457897e
parent346f318025c50783eed82b1b3fd92a4181d26fc3 (diff)
downloadstg-7010a75158608c580606635b79666f183a838801.tar.gz
stg: better merge diagnostics
Report all causes of ABI merge failure instead of just the first one. PiperOrigin-RevId: 568489476 Change-Id: Ibff0f7677b1b2164dd1c9b167aef00d4fc940b51
-rw-r--r--stg.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/stg.cc b/stg.cc
index d403d89..d787328 100644
--- a/stg.cc
+++ b/stg.cc
@@ -56,6 +56,7 @@ struct GetInterface {
};
Id Merge(Graph& graph, const std::vector<Id>& roots, Metrics& metrics) {
+ bool failed = false;
// this rewrites the graph on destruction
Unification unification(graph, Id(0), metrics);
unification.Reserve(graph.Limit());
@@ -66,18 +67,23 @@ Id Merge(Graph& graph, const std::vector<Id>& roots, Metrics& metrics) {
const auto& interface = graph.Apply<Interface&>(get, root);
for (const auto& x : interface.symbols) {
if (!symbols.insert(x).second) {
- Die() << "merge failed with duplicate symbol: " << x.first;
+ Warn() << "duplicate symbol during merge: " << x.first;
+ failed = true;
}
}
// TODO: test type roots merge
for (const auto& x : interface.types) {
const auto [it, inserted] = types.insert(x);
if (!inserted && !unification.Unify(x.second, it->second)) {
- Die() << "merge failed with type conflict: " << x.first;
+ Warn() << "type conflict during merge: " << x.first;
+ failed = true;
}
}
graph.Remove(root);
}
+ if (failed) {
+ Die() << "merge failed";
+ }
return graph.Add<Interface>(symbols, types);
}