[llvm-commits] Error-handling fixes for the x86 disassembler

Eric Christopher echristo at apple.com
Wed Mar 31 16:24:44 PDT 2010


On Mar 31, 2010, at 3:42 PM, Sean Callanan wrote:

> The attached patch fixes error handling for the x86 disassembler, eliminating llvm_unreachable() and assert() in favor of using the legitimate error-handling mechanism.  The rationale is to allow clients of libEnhancedDisassembly to handle errors themselves, rather than forcing them to crash.
> 
> The difference is that now assert() and llvm_unreachable() will never be called (even before, this was extremely unlikely), and the proper error-handling mechanism is used instead.  Further diagnostic information is printed to stderr.
> 
> Please let me know what you think.

I can't tell with some of the diffs without looking closer but it appears that you have 3 different courses of action when you encounter an error:

a) print something, return -1
b) print something, return 0
c) print something, return

Is there any way to unify some of this? Perhaps even an enum with different types of errors for consumers?

-eric



More information about the llvm-commits mailing list