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”,