[cfe-dev] Compile to ast and llvm bytecode using Clang API

Michael Collison via cfe-dev cfe-dev at lists.llvm.org
Sun Nov 11 12:53:35 PST 2018


I have a requirement to parse a .cpp file to a .ast file and a .bc file. 
I have the parsing, with filtering of the AST working using the the 
tooling tempalte on this page: 
https://clang.llvm.org/docs/RAVFrontendAction.html. I also need to 
generate LLVM code to write out to a .bc file. I tried using :

tool.run (newFrontEndActionFactory<EmitBCAction>().get())

where tool is an instance of ClangTool but received an error saying "not 
enough position command line arguments specified". Any ideas? Are there 
any examples I can look at?

Regards,

Michael Collison





More information about the cfe-dev mailing list