summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-02-21 00:00:44 +0000
committerAnna Zaks <ganna@apple.com>2012-02-21 00:00:44 +0000
commit19a66678d5b18892ec28ed5661bc595b322bd79f (patch)
tree6d833ace3f4b355a2ab752f21b8fae77ec75beb3 /clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
parent7e2ce889a00679365a29b40229db5e10e96cc4e6 (diff)
downloadbcm5719-llvm-19a66678d5b18892ec28ed5661bc595b322bd79f.tar.gz
bcm5719-llvm-19a66678d5b18892ec28ed5661bc595b322bd79f.zip
[analyzer] Make KeyChainAPI checker inlining-aware.
llvm-svn: 151007
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
index e5f99307a5c..bee27ec9ae6 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud