[LLVMdev] LLVM asserts

Eli Friedman eli.friedman at gmail.com
Wed Aug 19 18:24:39 PDT 2009


On Wed, Aug 19, 2009 at 5:28 PM, Erick
Tryzelaar<idadesub at users.sourceforge.net> wrote:
> On Wed, Aug 19, 2009 at 4:17 PM, Chris Lattner<clattner at apple.com> wrote:
>>
>> assert and abort should never happen, just like a null pointer or
>> garbage pointer dereference should never happen.  How are garbage
>> pointer and asserts different?
>
> So what should we use to validate input, such as constructing an
> APFloat from a string? llvm_report_error? Or should I change my string
> parsing function into a classmethod that returns pointer to an APFloat
> or null on failure?

Nothing in ADT should be using llvm_report_error; if something is
expected to fail, it should return an error code, and otherwise it
should assert.

-Eli




More information about the llvm-dev mailing list