This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp | ||
---|---|---|
74–77 | ||
80 | maybe clarify that it intializes both declarations that are present *in* the substatements and those referenced *from* the sub statements? | |
clang/lib/Analysis/FlowSensitive/Transfer.cpp | ||
140 | ||
305 | should this be in the else branch? As is, Loc looks unused if the condition is true. |
Shouldn't there be a functionality to invalidate all the globals at every function call by default?
clang/lib/Analysis/FlowSensitive/Transfer.cpp | ||
---|---|---|
141 | Do we expect to ever see a global declaration in a transfer function? Or is this for static locals? If it is for the latter, I'd adjust the comment. |
I think we should provide such functionality and it probably should also apply to some of the pointer and reference values. Not sure what the default should be, but having the ability to choose the level of soundness for certain analyses is valuable so I think both options should be possible. We don't have that implemented yet and I think it might be better to consider this together with other improvements that we want to make such as lazy value initialization. Would you be ok with deferring this for now? I noted it with a FIXME in the code.
clang/lib/Analysis/FlowSensitive/Transfer.cpp | ||
---|---|---|
141 | It's for static locals. Updated the comment. |
I think the default should be as sound as reasonably possible. If we don't do any invalidations, I'd like to see some sort of warning somewhere so early users are aware of the behavior. I'm not sure what is the best place to put the warning, maybe to the documentation of a class? With that warning in place, I think it is ok to commit this.