summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-12-11 00:17:53 +0000
committerAnna Zaks <ganna@apple.com>2012-12-11 00:17:53 +0000
commita7b1c47c1abb7e97173cbc4027687229121c2724 (patch)
tree4604309054e43fc6a5ddd93230c454f0b6034579 /clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
parentdb1450800aa00302ccf9283379f734e0b219a404 (diff)
downloadbcm5719-llvm-a7b1c47c1abb7e97173cbc4027687229121c2724.tar.gz
bcm5719-llvm-a7b1c47c1abb7e97173cbc4027687229121c2724.zip
[analyzer] Don't generate a summary for "freeWhenDone" if method is
inlined. Fixes a false positive that occurs if a user writes their own initWithBytesNoCopy:freeWhenDone wrapper. llvm-svn: 169795
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index 6d48f0258b4..26fd1c26ea7 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -499,6 +499,9 @@ static bool isFreeWhenDoneSetToZero(const ObjCMethodCall &Call) {
void MallocChecker::checkPostObjCMessage(const ObjCMethodCall &Call,
CheckerContext &C) const {
+ if (C.wasInlined)
+ return;
+
// If the first selector is dataWithBytesNoCopy, assume that the memory will
// be released with 'free' by the new object.
// Ex: [NSData dataWithBytesNoCopy:bytes length:10];
OpenPOWER on IntegriCloud