mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
llvm-dis: Stop crashing when dropping debug info
Since r199356, we've printed a warning when dropping debug info. r225562 started crashing on that, since it registered a diagnostic handler that only expected errors. This fixes the handler to expect other severities. As a side effect, it now prints "error: " at the start of error messages, similar to `llvm-as`. There was a testcase for r199356, but it only really checked the assembler. Move `test/Bitcode/drop-debug-info.ll` to `test/Assembler`, and introduce `test/Bitcode/drop-debug-info.3.5.ll` (and companion `.bc`) to test the bitcode reader. Note: tools/gold/gold-plugin.cpp has an equivalent bug, but I'm not sure what the best fix is there. I'll file a PR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230416 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -115,14 +115,21 @@ public:
|
||||
} // end anon namespace
|
||||
|
||||
static void diagnosticHandler(const DiagnosticInfo &DI, void *Context) {
|
||||
assert(DI.getSeverity() == DS_Error && "Only expecting errors");
|
||||
|
||||
raw_ostream &OS = errs();
|
||||
OS << (char *)Context << ": ";
|
||||
switch (DI.getSeverity()) {
|
||||
case DS_Error: OS << "error: "; break;
|
||||
case DS_Warning: OS << "warning: "; break;
|
||||
case DS_Remark: OS << "remark: "; break;
|
||||
case DS_Note: OS << "note: "; break;
|
||||
}
|
||||
|
||||
DiagnosticPrinterRawOStream DP(OS);
|
||||
DI.print(DP);
|
||||
OS << '\n';
|
||||
exit(1);
|
||||
|
||||
if (DI.getSeverity() == DS_Error)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
Reference in New Issue
Block a user