Skip to content

Commit 90f0369

Browse files
committed
[Serialization] Add pretty stacktraces to conformance serialization
This code path can report compiler inconsistencies, so let's make the pretty stacktrace more useful when debugging. We probably want to make the assert on witness.getDecl() a hard error too, but this would break existing projects at this time.
1 parent ceb54d3 commit 90f0369

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Serialization/Serialization.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,8 @@ void Serializer::writeASTBlockEntity(
14401440
const NormalProtocolConformance *conformance) {
14411441
using namespace decls_block;
14421442

1443+
PrettyStackTraceConformance trace("serializing", conformance);
1444+
14431445
// The conformance must be complete, or we can't serialize it.
14441446
assert(conformance->isComplete() || allowCompilerErrors());
14451447
assert(NormalConformancesToSerialize.hasRef(conformance));
@@ -1460,6 +1462,9 @@ void Serializer::writeASTBlockEntity(
14601462
});
14611463

14621464
conformance->forEachValueWitness([&](ValueDecl *req, Witness witness) {
1465+
PrettyStackTraceDecl traceValueWitness(
1466+
"serializing value witness for requirement", req);
1467+
14631468
++numValueWitnesses;
14641469
data.push_back(addDeclRef(req));
14651470
data.push_back(addDeclRef(witness.getDecl()));

0 commit comments

Comments
 (0)