[cfe-dev] How to analyze a C++ header file with a clang tool?

Jacob Carlborg doob at me.com
Wed Jun 4 12:04:08 PDT 2014


On 2014-06-04 19:16, Richard wrote:

> 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.

I see. I don't use a compilation database for my tool. I'm using 
libclang and the tool is intended to process header files. Works 
perfectly fine.

-- 
/Jacob Carlborg




More information about the cfe-dev mailing list