diff options
| author | Anna Zaks <ganna@apple.com> | 2012-11-03 02:54:16 +0000 |
|---|---|---|
| committer | Anna Zaks <ganna@apple.com> | 2012-11-03 02:54:16 +0000 |
| commit | 44dc91b4df5d6e0264e9fd799ac8b473b25d0f32 (patch) | |
| tree | e573bac6c856bcc414582611ea7f5b95196c4224 /clang/lib | |
| parent | 2510608e81f3a316e49c80b89b53e66d455d7d43 (diff) | |
| download | bcm5719-llvm-44dc91b4df5d6e0264e9fd799ac8b473b25d0f32.tar.gz bcm5719-llvm-44dc91b4df5d6e0264e9fd799ac8b473b25d0f32.zip | |
[analyzer] add LocationContext::inTopFrame() helper.
llvm-svn: 167351
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Analysis/AnalysisDeclContext.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | 8 |
2 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/Analysis/AnalysisDeclContext.cpp b/clang/lib/Analysis/AnalysisDeclContext.cpp index e17090f7999..e7df0a813b3 100644 --- a/clang/lib/Analysis/AnalysisDeclContext.cpp +++ b/clang/lib/Analysis/AnalysisDeclContext.cpp @@ -355,6 +355,10 @@ const StackFrameContext *LocationContext::getCurrentStackFrame() const { return NULL; } +bool LocationContext::inTopFrame() const { + return getCurrentStackFrame()->inTopFrame(); +} + bool LocationContext::isParentOf(const LocationContext *LC) const { do { const LocationContext *Parent = LC->getParent(); diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index cc5cf635310..304051c1394 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -3190,12 +3190,6 @@ bool RetainCountChecker::evalCall(const CallExpr *CE, CheckerContext &C) const { // Handle return statements. //===----------------------------------------------------------------------===// -// Return true if the current LocationContext has no caller context. -static bool inTopFrame(CheckerContext &C) { - const LocationContext *LC = C.getLocationContext(); - return LC->getParent() == 0; -} - void RetainCountChecker::checkPreStmt(const ReturnStmt *S, CheckerContext &C) const { @@ -3204,7 +3198,7 @@ void RetainCountChecker::checkPreStmt(const ReturnStmt *S, // better checking even for inlined calls, and see if they match // with their expected semantics (e.g., the method should return a retained // object, etc.). - if (!inTopFrame(C)) + if (!C.inTopFrame()) return; const Expr *RetE = S->getRetValue(); |

