[cfe-dev] Visitor Question
David Blaikie
dblaikie at gmail.com
Mon Aug 6 11:12:32 PDT 2012
On Mon, Aug 6, 2012 at 9:20 AM, Socrates Katsoulacos
<socrates.katsoulacos11 at imperial.ac.uk> wrote:
> Dear Sir/Madam,
>
> I am implementing a code that typechecks C source code.
> At some point in my program I used the following function in order to visit
> all functions and their bodies.
>
> // Function (declaration and body) visitor.
> void VisitFunctionDecl(FunctionDecl *D) {
> BaseDeclVisitor::VisitFunctionDecl(D);
> if (D->isThisDeclarationADefinition()) {
> BaseStmtVisitor::Visit(D->getBody());
>
> }
> }
>
> The problem that I have is that if I test a C source file that has function
> calls to another file which contains the declaration and body of the
> functions, then it does not give me back the body of these functions.
> As a result it tests only functions that their body is specified in the same
> source file that I am testing.
> Any suggestions on how can I retrieve the functions bodies of these
> functions that are specified in other files ?
Clang works per-TU. You'd have to implement your own storage to
gather/inspect cross-TU facts, as far as I know.
- David
>
> Sincerely yours,
>
> Socrates
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
More information about the cfe-dev
mailing list