Compiling C++ with the Clang API
This post describes how to compile a single C++ source file to an
object file with the Clang API. Here is the code. It behaves like a
simplified clang executable that handles -c
and -S.
1cat > main.cc <<eof
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106#include <clang/CodeGen/CodeGenAction.h> #include <clang/Driver/Compilation.h>#incl...
Read more at maskray.me