[cfe-dev] standalone tool: best way to find built-in includes?
christian.convey at gmail.com
Thu Nov 20 18:32:13 PST 2014
I'm developed a standalone tool for analyzing source code. It uses
CommonOptionParser and ClangTool in what I think are the standard
My tool analyzes some other code ("foo.c") we have. We build foo.c
with clang the system-wide installed version of clang. Thanks to
cmake, we also produce a compilation database for that build of foo.c.
I'd really like to ensure that when my analysis tool runs, I'd like it
to simulate, as closely as possible, the way we normally build foo.c.
In particular, I'd like to be sure it's using the same builtin headers
and gcc-provided headers.
Unfortunately, I can't easily copy my analysis tools executable into
the same directory as the clang which we use to build foo.c.
So here's my question: Is there a good way for me to force my tool to
search the same include directories, in the same order, as our normal
copy of clang does when it's building foo.c?
I've tried running "clang -### ..." in the build system for foo.c, so
that (I think) I get explicit information about the flags being passed
to the front-end. However, I haven't found a way to pass those flags
to my analysis tool in a way that CommonOptionsParser and/or ClangTool
find acceptable. For example, they reject "-cc1".
More information about the cfe-dev