We know that the IR file can be obtained from foo.cpp through the clang driver:
clang++ -emit-llvm -S foo.cpp -o foo.ll
Now I want to do this by using the libTooling's API without clang driver.
But I don't know how these APIs are used, I would like to know if there are some examples of using them, for example:
How to generate AST from cpp file?
How to convert AST to IR in memory form?
How to convert AST to IR in human readable text form?
All of this jobs' source code is very complex, but if libTooling provides some APIs, it may be simple, so what I want to know is whether these APIs exist and how to use them. Are there any examples that can be referenced?