The easiest way to start using the LLVM C++ API by example is to have LLVM generate the API usage for a given code sample. In this example it will emit the code required to rebuild the test.c
sample by using LLVM:
$ clang -c -emit-llvm test.c -o test.ll
$ llc -march=cpp test.ll -o test.cpp