[cfe-dev] [Libtooling] Parse file with previous AST

Manuel Klimek via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 15 03:16:08 PDT 2016


On Tue, Mar 15, 2016 at 11:11 AM David Come via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hello,
>
> I'm writing a some tool for doing static analysis on C++ code.
>
> My tool has obviously two inputs:  the file(s) to check (let's say *f.cpp*)
> and the property to check .
>
> Currently (I'm in a early stage of development), I want to describe the
> property directly in C++ (let's say *prop.cpp*).
> and use clang/libtooling to read it .The thing is that the property will
> use symbols that are defined in the code to analyze.
>
> Thus, I wish to parse *prop.cpp *knowing *f.cpp*'s AST so I don't run
> into unknown symbols. But I haven't been successful so far.
>
> i could cheat and merge the two files in a temporary file but I don't like
> that idea.
> I could also require *prop.cpp *to be self contained  (with all the
> headers needed) but that would hinder the tool's usability (headers to
> include, need to provide to clang all the compilation options...).
>

Unfortunately, that's a general restriction of C++ tools. C++ is unparsable
without knowing the full types.


>
> If you have any lead,
>
> Thanks,
> David.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160315/98422ecc/attachment.html>


More information about the cfe-dev mailing list