We want to create a tool (in C# .NET, EXE) which invokes the clang tool (C++, DLL). While implementing we realized that the CommonOptionsParser only expects the call to the Clang tool to be in the form of command line options. Is there a way around this issue that someone has encountered earlier?
On the other hand, if I pass the c code as a string buffer to the tooling, the included .h files are not recognized by clang tooling. So somehow Common Options Parser was the choice.
We want to create a tool (in C# .NET, EXE) which invokes the clang tool
(C++, DLL). While implementing we realized that the CommonOptionsParser
only expects the call to the Clang tool to be in the form of command line
options. Is there a way around this issue that someone has encountered
earlier?
On the other hand, if I pass the c code as a string buffer to the tooling,
the included .h files are not recognized by clang tooling. So somehow
Common Options Parser was the choice.
int result = Tool.run(newFrontendActionFactory<DFAMainClassAction
>().get());
return result;
}
Any help would be greatly appreciated J
I think that you can use pass the arguments as an array of strings to your
DLL and create the tool using the FixedCompilationDatabase, like in the
example below:
std::vector<std::string> CommandLineArguments = { "-I", "includes" }; //
Get the arguments
// Create the tool
std::unique_ptr<CompilationDatabase> Compilations(new
FixedCompilationDatabase(".", CommandLineArguments));
ClangTool Tool(*Compilations, Filename);