[cfe-dev] [bug?] How to use EmitLLVMOnlyAction in clang tool?
Viktor Was BSc via cfe-dev
cfe-dev at lists.llvm.org
Mon Apr 29 18:32:54 PDT 2019
When trying to run an EmitLLVMOnlyAction via ClangTool::run(act_factory) I get the following error:
Clang: Not enough positional command line arguments specified!
Stepping through the code I found that there seems to be a problem in setCommandLineOpts in clang/lib/CodeGen/BackendUtils.cpp, the BackendArgs.push_back with literals doesn't seem to work and a corrupt SmallVector is passed to ParseCommandLineOptions.
Why is setCommandLineOpts even called, isn't EmitLLVMOnlyAction supposed to create llvm::Module in memory only without without outputting it to a file? Did I misinterpret the Emit_Nothing flag? What does EmitLLVMOnlyAction do?
What command line args does EmitLLVMOnlyAction expect?
Cmd line: mytool test.cpp -p=compile_commands.json
"command": "/usr/local/bin/clang++ -Ipath/to/include - std=c++11 -Wall -o path/to/test.cpp.o -c /path/to/test.cpp",
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev