[cfe-dev] How to analyze a C++ header file with a clang tool?
Richard
legalize at xmission.com
Wed Jun 4 10:16:45 PDT 2014
In article <lmmfo6$at5$1 at ger.gmane.org>,
Jacob Carlborg <doob at me.com> writes:
> On 04/06/14 02:51, Manasij Mukherjee wrote:
> > Hi
> > I have seen the examples in clang/tools/, and even built a few simple
> > tools myself.
> > But all of them work on source files.
> > For example, I am not sure if I can use clang-check on a header file.
>
> Is there a difference? Just pass the header file to the tool instead.
Many tools use a compilation database to specify the set of defined
symbols, include order, etc., all of which are still relevant to
analyzing a header file.
Unfortunately the compilation database is typically generated from a
build system that says how source files are compiled into object
files, so it won't have instructions for how to compile a header file.
However, the compilation database is just a JSON file with a simple
syntax, so you should be able to construct command lines for a header
file just as you would for a source file. I haven't tried this, so I
don't know how/if it will work.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>
More information about the cfe-dev
mailing list