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

David Come via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 15 03:10:23 PDT 2016


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

If you have any lead,

Thanks,
David.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160315/2b0320b7/attachment.html>


More information about the cfe-dev mailing list