[cfe-dev] Can clangtool handle "-I"?

Nathan James via cfe-dev cfe-dev at lists.llvm.org
Tue Aug 4 07:11:33 PDT 2020


If you are using the `clang::tooling::CommonOptionsParser` to handle
the command line, then you can pass `-I` using either `extra-arg` or
after the `--`
`clang-tool -tool -specific -args -extra-arg=-I/usr/...` or
`clang-tool -tool -specific -args -- -I/usr/...`.

~Nathan James

On Tue, 2020-08-04 at 16:23 +0800, Yafei Liu via cfe-dev wrote:
> I'm writing a tool using AST matcher, and I need to pass the path of
> the clang built-in heads to my tool (or it will error me that
> "'stddef.h' file not found"), so I add `-I/path/to/the/headers` to my
> tool, but the program said that "Unknown command line argument '-
> I/usr/lib/llvm-6.0/lib/clang/6.0.0/include'."
> 
> So is there any built-in OptionCategory that can handle "-I"
> parameters?
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list