[clang][dataflow] Handle return statements
authorSam Estep <sam@samestep.com>
Thu, 4 Aug 2022 17:42:01 +0000 (17:42 +0000)
committerSam Estep <sam@samestep.com>
Thu, 4 Aug 2022 17:42:19 +0000 (17:42 +0000)
commit0eaecbbc231883b43d3ac761b276d9f505c89c27
tree812c4eed1a839a9a90801cb34330a92448ced48f
parent8c30f4a5ab3e8dc4a75669d497723f9a2d8d39c8
[clang][dataflow] Handle return statements

This patch adds a `ReturnLoc` field to the `Environment`, serving a similar to the `ThisPointeeLoc` field in the `DataflowAnalysisContext`. It then uses that (along with a new `VisitReturnStmt` method in `TransferVisitor`) to handle non-`void`-returning functions in context-sensitive analysis.

Reviewed By: ymandel, sgatev

Differential Revision: https://reviews.llvm.org/D130600
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h
clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
clang/lib/Analysis/FlowSensitive/Transfer.cpp
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp