[cfe-dev] Using libclang to build an LLVM Module from a Transform Pass?

Zhang via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 12 15:52:00 PDT 2018


Hi:
Frontend noob here. I was attempting to play around with libclang and build another IR Module at transform stage.
Currently the solution I could think of is like this:
- Use __attribute__((constructor)) to obtain raw arguments passed to CFE
- Somehow use the arguments to build a CompilerInstance object
- Run the frontend action EmitLLVMOnly and extract the build module


I'm not sure if this is the correct/easiest way to go or I screwed up something fundamentally. And if is the way to go, I failed to find any method to clean up the all the frontend input files and leave everything else intact. Any feedback is welcome.


Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180313/0873643b/attachment.html>


More information about the cfe-dev mailing list