[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

@@ -2398,8 +2398,9 @@ static int doPrintLocalTypes(const CompilerInvocation &InitInvok,
auto mangling = Demangle::mangleNode(typeNode);
if (!mangling.isSuccess()) {
llvm::errs() << "Couldn't remangle type (failed at Node "
<< mangling.errorNode() << " with error "
<< mangling.errorCode() << ")\n";
<< mangling.error().node << " with error "
<< mangling.error().code << ":" << mangling.error().line
<< ")\n";
return EXIT_FAILURE;
}
auto remangled = mangling.result();