[cfe-dev] exit() emits exception handling?
Welson Sun via cfe-dev
cfe-dev at lists.llvm.org
Tue Oct 6 10:45:50 PDT 2015
Thanks Reid,
That explains. And the local variables turn out to be of type
"std::string". Although it is not possible to ask the customer not to use
std::string, at least I can explain it :-) Adapting my analysis pass is
another thing.
Thanks,
Welson
On Tue, Oct 6, 2015 at 9:47 AM, Reid Kleckner <rnk at google.com> wrote:
> If you have local variables with non-trivial destructors (say,
> std::unique_ptr or std::vector), then Clang will turn calls into invokes.
> The unwind edge of the invoke executes when an exception is thrown from the
> call, and the code along that edge destroys local objects in scope before
> resuming unwinding.
>
> On Tue, Oct 6, 2015 at 9:25 AM, Welson Sun via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Hi,
>>
>> I am trying to understand some LLVM IR Clang generates. Since I cannot
>> publish the source code, I can only describe what I see and my guess.
>>
>> This is the main() function of some code, which allocates some memory and
>> sequentially calls a list of functions. There are no explicit exception
>> handling code in the source code, however, *for each function call*, the
>> LLVM IR for the function call becomes "invoke ... unwind ...". I am
>> wondering what causes the generation of such code. One thing I noticed in
>> the source code is the exit() call in main().
>>
>> If I compile with -fno-exceptions, all function calls become normal
>> "call", without any "unwind" attribute.
>>
>>
>> Thanks
>> - Welson
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>>
>
--
- Welson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151006/452ccbca/attachment.html>
More information about the cfe-dev
mailing list