SMAT-Lab/Scalpel

Inquiry about the plan to release DefUseChain module

Opened this issue · 9 comments

Hi~
First of all, thank you for sharing such an awesome static analysis tool like Scalpel. It has been incredibly useful in my work.

I notice that there is a module named DefUseChain in SSA, but it seems that it is not implemented yet. Do you have any plan to implement and release it?

Thanks :)

Jarvx commented

Hi,

Thank you for your interest. Yes, this work is in progress, and we will have a major release in coming months. Please feel free to share your ideas and contribute.

There is an existing implementation of Def-Use chains, it's pretty well-tested.

https://github.com/serge-sans-paille/beniget

I think it would be easy to adjust it work with ast nodes (it works with gast, wich is compatibility layer on top of ast, but it's mainly the same except for deprecated nodes and except handlers.)

Adjusting that module would be the path of least resistance in term of implementation, I've already done it once.

I have used beniget successfully with HeaderGen on top of PyCG. It is pretty useful. We are currently working towards integrating beniget directly into PyCG.

Jarvx commented

There is an existing implementation of Def-Use chains, it's pretty well-tested.

https://github.com/serge-sans-paille/beniget

I think it would be easy to adjust it work with ast nodes (it works with gast, wich is compatibility layer on top of ast, but it's mainly the same except for deprecated nodes and except handlers.)

Adjusting that module would be the path of least resistance in term of implementation, I've already done it once.

Thanks for this point. Sure, I will look into the project and see how we can appropriately integrate this tool into Scalpel.

Please don't forget to include the tests if your forking beniget! :)

I’ve personally worked hard for the latest beniget improvements.

Probably you won't have to fork and maintain this code since we are looking fixing the compatibility with the standard ast module: serge-sans-paille/beniget#94

Scalpel will be able to use beniget directly when this is merged.

I suspect that the code you included in scalpel is not passing the tests... This is because this code was written to work with gast and not the standard ast.

Probably you won't have to fork and maintain this code since we are looking fixing the compatibility with the standard ast module: serge-sans-paille/beniget#94

Scalpel will be able to use beniget directly when this is merged.

I suspect that the code you included in scalpel is not passing the tests... This is because this code was written to work with gast and not the standard ast.

Thanks for letting me know this. Yeah, I initially want to built the one adapted from beniget using standard ast. Sure, will be very happy to directly use beniget.

Hello, just an update to mention that the upstream (yet unreleased) implementation now support the standard library nodes. So no need to fork the code, just use https://github.com/serge-sans-paille/beniget directly