[PATCH] D18041: [ELF] use fatal() instead of llvm_unreachable when performing relaxations.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 09:37:36 PST 2016


On 10 March 2016 at 12:27, George Rimar <grimar at accesssoftek.com> wrote:
>>>
>>> I think existence of such test would mean a bug in lld.
>>
>>In which case that is exactly what assert/llvm_unreachable are for.
>>
>>> But we have fatal() in void X86_64TargetInfo::relocateOne() for example, I also don't sure we can write a test for that.
>>
>>It should be possible with at .o with an invalid reloc number, no?
>>
>>So the summary is that if you can reach something without a bug, that
>>should be a fatal/error. If getting there is a a bug, it should be
>>llvm_unreachable.
>
> Ok, so can I replace with assert() then ? (for http://reviews.llvm.org/D18041).
> I want to output the Type of relocation, like I did when used fatal.

How does using assert help? llvm_unreachable(msg) is basically assert(0 && msg);

Cheers,
Rafael


More information about the llvm-commits mailing list