[LLVMdev] llvm-c bindings and exceptions?
Mahadevan R
mdevan.foobar at gmail.com
Sun Aug 3 22:01:37 PDT 2008
Hi,
On Sun, Aug 3, 2008 at 11:42 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Aug 3, 2008, at 7:54 AM, Mahadevan R wrote:
>
>> Hi,
>>
>> Just wondering -- shouldn't all (C linkage) functions exposed by
>> LLVM-C (and written in C++) be catching std::exception (or "...") to
>> prevent exceptions being passed on to C callers?
>
> LLVM doesn't use exceptions in anything that has C bindings, so the
> catch isn't needed.
It does use 'new' (e.g. LLVMCreateModuleProviderForExistingModule),
and also calls C++ functions which in turn use new (e.g.
LLVMGetBitcodeModuleProvider -> llvm::getBitcodeModuleProvider), so
std::bad_alloc is a possibility (a quick search didn't turn up any
"set_new_handler" also).
There might also be C++ client code (e.g. overridden virtual functions
in custom passes) which might (unintentionally) throw exceptions.
Regards,
-Mahadevan.
More information about the llvm-dev
mailing list