[cfe-dev] Avoid/reduce re-compilations of source files for multiple passes

Himanshu via cfe-dev cfe-dev at lists.llvm.org
Thu Jul 14 16:57:07 PDT 2016


Hi James,

I am not sure if that would give me correct results? I want to find and
visit all the functions called starting from one source function. Given
that clang creates one AST per TU, I would need to visit all the relevant
TU's to visit definitions after some functions to visit are identified in a
pass.

Maybe I am doing it in an inefficient manner? Is there a way to visit
function definitions in translation units without creating a
RecuriveASTVisitor?

--
Himanshu

On Thu, Jul 14, 2016 at 4:09 PM, James Dennett <james.dennett at gmail.com>
wrote:

> On Thu, Jul 14, 2016 at 1:38 PM, Himanshu via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Hi all,
>>
>> I run a front end action using the ClangTool::run( ... ) API on a C
>> codebase. The action starts with a given functionof interest, and within it
>> finds more functions of interest, and visits those. Thus, I make multiple
>> passes over the code-base. Hence, the outline of my approach is:
>>
>> Create ClangTool tool
>> // set some initial target function, and then execute the loop:
>>
>> while(new target functions found) {
>>            tool.run (front-end-action that visits functions )
>> }
>>
>> The tool seems to execute the compile commands for each pass, even though
>> the compilation units don't change. Is there a way to avoid this
>> re-compilation of the same files? Or is there a better way of doing what I
>> am trying to do?
>>
>>
> Can you pull that loop inside your ClangTool's code, rather than
> repeatedly running the tool?
>
> -- James
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160714/f407ac64/attachment.html>


More information about the cfe-dev mailing list