[cfe-dev] Paths to system header files
Jacob Carlborg via cfe-dev
cfe-dev at lists.llvm.org
Fri Feb 26 07:08:16 PST 2016
On 2016-02-26 14:06, Pedro Delgado Perez via cfe-dev wrote:
> Sorry about the format of the previous message. I write it again here.
>
>
> Sorry, Jacob, no idea on how to use your solution in my code. Manuel,
> nothing is written in your message I think...
> My code is something like this:
>
> static cl::OptionCategory MyToolCategory("My tool options");
>
> int main(int argc, const char **argv) {
> CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);
> ClangTool Tool(OptionsParser.getCompilations(),
> OptionsParser.getSourcePathList());
> return Tool.run(newFrontendActionFactory<SyntaxOnlyAction>().get());
> }
>
> What I was doing by the moment is to process argv before creating the
> object OptionsParser and then include internal Clang headers, but I
> guess I can't do that when using Json compilation database. Could you
> help me with that? Otherwise, is there a way to ship in the executable
> all the necessary headers so that the user does not require to have
> clang installed?
I haven't used the C++ interface, only the C interface. But look at the
original post in the thread I linked to [1]. There it seems like
"mapVirtualFile" in clang::tooling::ClangTool is used to add a virtual
header file. See also the last post by "Mikhail Ramalho". You need to
add the path where the virtual file is located as an include path.
[1]
http://clang-developers.42468.n3.nabble.com/Builtin-headers-td4049705.html
--
/Jacob Carlborg
More information about the cfe-dev
mailing list