diff options
author | Anna Zaks <ganna@apple.com> | 2012-02-20 22:25:23 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-02-20 22:25:23 +0000 |
commit | a19581ae489335abf5cf96b253b31ecefe96b8e4 (patch) | |
tree | ff94fe3880f0cd471fd9d0a66e5ddb3439bb59f5 /lib/StaticAnalyzer/Checkers/MallocChecker.cpp | |
parent | 9747b539cdba6e3ede2b927187a909a796336fc9 (diff) |
[analyzer] Make Malloc aware of inter-procedural execution + basic
tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150993 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/MallocChecker.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp index 38044d1aa9..fed64f1b04 100644 --- a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -827,6 +827,10 @@ void MallocChecker::checkEndPath(CheckerContext &C) const { ProgramStateRef state = C.getState(); RegionStateTy M = state->get<RegionState>(); + // If inside inlined call, skip it. + if (C.getLocationContext()->getParent() != 0) + return; + for (RegionStateTy::iterator I = M.begin(), E = M.end(); I != E; ++I) { RefState RS = I->second; if (RS.isAllocated()) { @@ -885,8 +889,9 @@ void MallocChecker::checkPreStmt(const ReturnStmt *S, CheckerContext &C) const { if (checkUseAfterFree(Sym, C, E)) return; - // Check if the symbol is escaping. - checkEscape(Sym, E, C); + // If this function body is not inlined, check if the symbol is escaping. + if (C.getLocationContext()->getParent() == 0) + checkEscape(Sym, E, C); } bool MallocChecker::checkUseAfterFree(SymbolRef Sym, CheckerContext &C, |