[llvm-dev] Detect exception throwing in basic blocks

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] Detect exception throwing in basic blocks

Muhui Jiang via llvm-dev
Hello,

For code:
try {
throw 42;
} catch(int e){}

Are there any helpers in LLVM API to give me info that in "try block" there is a throw which will be executed? I am interested in info "yes, this block throws".

Thank you

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Detect exception throwing in basic blocks

Muhui Jiang via llvm-dev
In LLVM IR, you would see an `invoke` instruction that calls the appropriate C++ runtime function to set up a C++ exception. It would be __cxa_throw or CxxThrowException on Windows.

Since only function calls can throw, this is not a property of the basic block, but a property of individual call instructions.

On Wed, May 16, 2018 at 10:28 AM Dávid Bolvanský via llvm-dev <[hidden email]> wrote:
Hello,

For code:
try {
throw 42;
} catch(int e){}

Are there any helpers in LLVM API to give me info that in "try block" there is a throw which will be executed? I am interested in info "yes, this block throws".

Thank you
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev