C constructs to generate some of LLVM IR instructions?


I was studying the LLVM IR instruction set by analyzing how constructs in C language is getting converted to IR form.

I found difficulty in finding C constructs which could generate Invoke, Resume, Unreachable, ExtractValue, InsertValue instructions. Can someone help me find some simple C code that generates these instructions in LLVM IR?

A great way to find such information is search in the tests directory of
clang. So if you have clang checked out into the LLVM tree, run a recursive
grep over all C files in 'tools/clang/tests'


I have attempted to use the C API to LLVM in the past, and I have found
that it does not always expose all the features one might need.
For my project I used the C++ API to LLVM and then created my own C API to
I am only talking as a user, and not an LLVM developer.
That combined with the clang -march=cpp feature makes using the C++ API to
create LLVM IR a lot easier.