Add more error checking to llvm-objdump and MachODump

Rafael Espíndola via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 15:26:20 PST 2015


>> Please just use fatal errors.
> The problem with that is that it gives us no error recovery.  I now get a single error and have to quit via exit(1).

And for objdump that is fine. When was the last time you got a broken
.o that was not caused by another broken tool?

> Is that the model we’re planning on using for all of the tools?

Depends on the tool. The canonical counter example is an interactive
disassembler, where we have to be able to handle failures.

> Personally I was hoping for something more like clang where if my code contains some errors I can recover and see what comes next.

That is not exactly what clang does. Clang has a dignostic manager
that is responsible for printing the diagnostic and then return a
simple passed/failed.

We do have a diganostic handler in LLVM and we use it when, for
example, reading bitcode files. It has the advantage that most tools
can just use a fatal error handler, but a tool that needs non fatal
errors can have them.

It has been on my TODO for some time to move it to Support, but even
then it seems the wrong choice for tool code. We know if a tool can
stop or error or not.

Cheers,
Rafael


More information about the llvm-commits mailing list