[Demangler] Tidy up a bit, and add line numbers to ManglingErrors.

Because DEMANGLER_ASSERT() might cause the remanglers to return a ManglingError
with the code ManglingError::AssertionFailed, it's useful to have a line number
in the ManglingError as well as the other information.  This is also potentially
helpful for other cases where the code is used multiple times in the remanglers.

rdar://79725187
This commit is contained in:
Alastair Houghton
2021-09-06 16:42:20 +01:00
parent 227b438963
commit b8a879954a
7 changed files with 206 additions and 180 deletions

View File

@@ -644,9 +644,10 @@ void swift_reflection_dumpInfoForTypeRef(SwiftReflectionContextRef ContextRef,
MangledName.c_str());
} else {
MangledName = "<failed to mangle name>";
fprintf(stdout, "Failed to get mangled name: Node %p, error code %d\n",
Mangling.errorNode(),
Mangling.errorCode());
fprintf(stdout, "Failed to get mangled name: Node %p, error %d:%u\n",
Mangling.error().node,
Mangling.error().code,
Mangling.error().line);
}
char *DemangledName =