LibTooling and Control Flow Analyses

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

LibTooling and Control Flow Analyses

Hubert Tong via cfe-dev
Hi all,

I've implemented a control-flow based analysis by deriving a CFG from an
AnalysisDeclContext.  For fixed-point iteration I've used the
ForwardDataflowWorklist.  The whole analysis is implemented directly
into clang which may emit a couple of warnings during compilation.
However, the analysis is actually independent and could therefore run on
its own.  Thus I thought it would be also nice to have a standalone tool
which led me to LibTooling.

Everything I read so far about LibTooling was about walking over the
AST.  Is it also possible to derive a CFG in LibTooling (maybe from an
ASTContext)?

Cheers,
Stefan
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: LibTooling and Control Flow Analyses

Hubert Tong via cfe-dev
Yes you can build the CFG in libTooling using CFG::buildCFG by passing the ASTContext and the Stmt for which you want the CFG.

> On 4 Sep 2020, at 21:16, Stefan Schulze Frielinghaus via cfe-dev <[hidden email]> wrote:
>
> Hi all,
>
> I've implemented a control-flow based analysis by deriving a CFG from an
> AnalysisDeclContext.  For fixed-point iteration I've used the
> ForwardDataflowWorklist.  The whole analysis is implemented directly
> into clang which may emit a couple of warnings during compilation.
> However, the analysis is actually independent and could therefore run on
> its own.  Thus I thought it would be also nice to have a standalone tool
> which led me to LibTooling.
>
> Everything I read so far about LibTooling was about walking over the
> AST.  Is it also possible to derive a CFG in LibTooling (maybe from an
> ASTContext)?
>
> Cheers,
> Stefan
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: LibTooling and Control Flow Analyses

Hubert Tong via cfe-dev
That works perfectly.  Thanks for the hint!

Cheers,
Stefan

On Fri, Sep 04, 2020 at 09:58:10PM +0300, Andi-Bogdan Postelnicu wrote:

> Yes you can build the CFG in libTooling using CFG::buildCFG by passing the ASTContext and the Stmt for which you want the CFG.
>
> > On 4 Sep 2020, at 21:16, Stefan Schulze Frielinghaus via cfe-dev <[hidden email]> wrote:
> >
> > Hi all,
> >
> > I've implemented a control-flow based analysis by deriving a CFG from an
> > AnalysisDeclContext.  For fixed-point iteration I've used the
> > ForwardDataflowWorklist.  The whole analysis is implemented directly
> > into clang which may emit a couple of warnings during compilation.
> > However, the analysis is actually independent and could therefore run on
> > its own.  Thus I thought it would be also nice to have a standalone tool
> > which led me to LibTooling.
> >
> > Everything I read so far about LibTooling was about walking over the
> > AST.  Is it also possible to derive a CFG in LibTooling (maybe from an
> > ASTContext)?
> >
> > Cheers,
> > Stefan
> > _______________________________________________
> > cfe-dev mailing list
> > [hidden email]
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: LibTooling and Control Flow Analyses

Hubert Tong via cfe-dev
You’re welcome,

Cheers,
Andi

> On 5 Sep 2020, at 10:50, Stefan Schulze Frielinghaus <[hidden email]> wrote:
>
> That works perfectly.  Thanks for the hint!
>
> Cheers,
> Stefan
>
>> On Fri, Sep 04, 2020 at 09:58:10PM +0300, Andi-Bogdan Postelnicu wrote:
>> Yes you can build the CFG in libTooling using CFG::buildCFG by passing the ASTContext and the Stmt for which you want the CFG.
>>
>>>> On 4 Sep 2020, at 21:16, Stefan Schulze Frielinghaus via cfe-dev <[hidden email]> wrote:
>>>
>>> Hi all,
>>>
>>> I've implemented a control-flow based analysis by deriving a CFG from an
>>> AnalysisDeclContext.  For fixed-point iteration I've used the
>>> ForwardDataflowWorklist.  The whole analysis is implemented directly
>>> into clang which may emit a couple of warnings during compilation.
>>> However, the analysis is actually independent and could therefore run on
>>> its own.  Thus I thought it would be also nice to have a standalone tool
>>> which led me to LibTooling.
>>>
>>> Everything I read so far about LibTooling was about walking over the
>>> AST.  Is it also possible to derive a CFG in LibTooling (maybe from an
>>> ASTContext)?
>>>
>>> Cheers,
>>> Stefan
>>> _______________________________________________
>>> cfe-dev mailing list
>>> [hidden email]
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev