This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] Replace `transfer(const Stmt *, ...)` with `transfer(const CFGElement *, ...)` in `clang/Analysis/FlowSensitive`.
ClosedPublic

Authored by wyt on Sep 15 2022, 3:25 AM.

Diff Detail

Event Timeline

wyt created this revision.Sep 15 2022, 3:25 AM
Herald added a project: Restricted Project. · View Herald Transcript
wyt requested review of this revision.Sep 15 2022, 3:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 3:25 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sgatev accepted this revision.Sep 15 2022, 3:59 AM
This revision is now accepted and ready to land.Sep 15 2022, 3:59 AM
martong added inline comments.Sep 15 2022, 7:24 AM
clang/unittests/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp
138–141

This is exactly the same code that you have in SingleVarConstantPropagationTest.cpp and in the rest of the files. I think this could be hoisted into a common function declared in FlowSensitive/DataflowAnalysis.h.

By the way, wouldn't it be more convenient for the client to provide a transferStmt function if the they are interested only in Stmts? (Defining both transferStmt and transfer should be a compile time error)

gribozavr2 accepted this revision.Sep 15 2022, 4:04 PM
wyt added inline comments.Sep 16 2022, 9:18 AM
clang/unittests/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp
138–141

Thanks for the comment!

For now, I decided not to pull this out into a common function. This seems more like a utility function that does not quite belong DataflowAnalysis.h - it would be nice to keep the code there dedicated to analysis logic. Besides, I don't think we save much since the boilerplate is just a few lines.

Also, about having another transferStmt function, at this stage I feel that it's best if we keep things compact and have just one way of doing things - the framework is constantly evolving and having multiple implementations of the same concept can be distracting.

This revision was landed with ongoing or failed builds.Sep 19 2022, 11:07 AM
This revision was automatically updated to reflect the committed changes.