diff options
author | Anna Zaks <ganna@apple.com> | 2012-02-21 00:00:44 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-02-21 00:00:44 +0000 |
commit | 9c1e1bd0405b990b6e7909647def7b23d5c28f17 (patch) | |
tree | a0ce0a11696c63ba25395f3b367d7e09b663c524 /lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp | |
parent | ee0653963537f6ea60f655856fb0c83d7d4010db (diff) |
[analyzer] Make KeyChainAPI checker inlining-aware.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151007 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp b/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp index e5f99307a5..bee27ec9ae 100644 --- a/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp @@ -447,7 +447,8 @@ void MacOSKeychainAPIChecker::checkPostStmt(const CallExpr *CE, const Expr *ArgExpr = CE->getArg(FunctionsToTrack[idx].Param); // If the argument entered as an enclosing function parameter, skip it to // avoid false positives. - if (isEnclosingFunctionParam(ArgExpr)) + if (isEnclosingFunctionParam(ArgExpr) && + C.getLocationContext()->getParent() == 0) return; if (SymbolRef V = getAsPointeeSymbol(ArgExpr, C)) { @@ -481,6 +482,10 @@ void MacOSKeychainAPIChecker::checkPreStmt(const ReturnStmt *S, if (!retExpr) return; + // If inside inlined call, skip it. + if (C.getLocationContext()->getParent() != 0) + return; + // Check if the value is escaping through the return. ProgramStateRef state = C.getState(); const MemRegion *V = @@ -549,6 +554,11 @@ void MacOSKeychainAPIChecker::checkDeadSymbols(SymbolReaper &SR, // TODO: Remove this after we ensure that checkDeadSymbols are always called. void MacOSKeychainAPIChecker::checkEndPath(CheckerContext &Ctx) const { ProgramStateRef state = Ctx.getState(); + + // If inside inlined call, skip it. + if (Ctx.getLocationContext()->getParent() != 0) + return; + AllocatedSetTy AS = state->get<AllocatedData>(); if (AS.isEmpty()) return; |