diff options
| author | George Karpenkov <ekarpenkov@apple.com> | 2018-09-21 20:37:20 +0000 |
|---|---|---|
| committer | George Karpenkov <ekarpenkov@apple.com> | 2018-09-21 20:37:20 +0000 |
| commit | 04553e530f971eff94d2be7111855af3781b41f4 (patch) | |
| tree | 75fd99c84ff4a0d45ed2ee6e6bdc3397b37a0ba5 /clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h | |
| parent | 200e809dbd04b074b77fb6cc0644ebff82150d1c (diff) | |
| download | bcm5719-llvm-04553e530f971eff94d2be7111855af3781b41f4.tar.gz bcm5719-llvm-04553e530f971eff94d2be7111855af3781b41f4.zip | |
[analyzer] Process state in checkEndFunction in RetainCountChecker
Modify the RetainCountChecker to perform state "adjustments" in
checkEndFunction, as performing work in PreStmt<ReturnStmt> does not
work with destructors.
The previous version made an implicit assumption that no code runs
after the return statement is executed.
rdar://43945028
Differential Revision: https://reviews.llvm.org/D52338
llvm-svn: 342770
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h index 8683b23dd96..e8d9136ffd2 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h @@ -252,7 +252,6 @@ class RetainCountChecker check::PostStmt<ObjCBoxedExpr>, check::PostStmt<ObjCIvarRefExpr>, check::PostCall, - check::PreStmt<ReturnStmt>, check::RegionChanges, eval::Assume, eval::Call > { @@ -388,8 +387,7 @@ public: const LocationContext* LCtx, const CallEvent *Call) const; - void checkPreStmt(const ReturnStmt *S, CheckerContext &C) const; - void checkReturnWithRetEffect(const ReturnStmt *S, CheckerContext &C, + ExplodedNode* checkReturnWithRetEffect(const ReturnStmt *S, CheckerContext &C, ExplodedNode *Pred, RetEffect RE, RefVal X, SymbolRef Sym, ProgramStateRef state) const; @@ -416,12 +414,20 @@ public: ProgramStateRef handleAutoreleaseCounts(ProgramStateRef state, ExplodedNode *Pred, const ProgramPointTag *Tag, CheckerContext &Ctx, - SymbolRef Sym, RefVal V) const; + SymbolRef Sym, + RefVal V, + const ReturnStmt *S=nullptr) const; ExplodedNode *processLeaks(ProgramStateRef state, SmallVectorImpl<SymbolRef> &Leaked, CheckerContext &Ctx, ExplodedNode *Pred = nullptr) const; + +private: + /// Perform the necessary checks and state adjustments at the end of the + /// function. + /// \p S Return statement, may be null. + ExplodedNode * processReturn(const ReturnStmt *S, CheckerContext &C) const; }; //===----------------------------------------------------------------------===// |

