summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-04-27 22:00:51 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-04-27 22:00:51 +0000
commitbefce13328be3c0a4762adf26b0dd6a54e5592f5 (patch)
tree2f446ff34b96d8055064582c5e6af5e1f64f749b /clang/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp
parentefc0f8cbdc5e29dcc78ed05c1048367890687ce5 (diff)
downloadbcm5719-llvm-befce13328be3c0a4762adf26b0dd6a54e5592f5.tar.gz
bcm5719-llvm-befce13328be3c0a4762adf26b0dd6a54e5592f5.zip
[analyzer] ObjCAutoreleaseWrite: Support a few more APIs and fix warning text.
API list and improved warning text composed by Devin Coughlin. llvm-svn: 331089
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp
index 0433a8aea37..d53827b596e 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp
@@ -51,18 +51,43 @@ public:
BugReporter &BR) const;
private:
std::vector<std::string> SelectorsWithAutoreleasingPool = {
+ // Common to NSArray, NSSet, NSOrderedSet
"enumerateObjectsUsingBlock:",
- "enumerateKeysAndObjectsUsingBlock:",
- "enumerateKeysAndObjectsWithOptions:usingBlock:",
"enumerateObjectsWithOptions:usingBlock:",
+
+ // Common to NSArray and NSOrderedSet
"enumerateObjectsAtIndexes:options:usingBlock:",
+ "indexOfObjectAtIndexes:options:passingTest:",
+ "indexesOfObjectsAtIndexes:options:passingTest:",
+ "indexOfObjectPassingTest:",
+ "indexOfObjectWithOptions:passingTest:",
+ "indexesOfObjectsPassingTest:",
+ "indexesOfObjectsWithOptions:passingTest:",
+
+ // NSDictionary
+ "enumerateKeysAndObjectsUsingBlock:",
+ "enumerateKeysAndObjectsWithOptions:usingBlock:",
+ "keysOfEntriesPassingTest:",
+ "keysOfEntriesWithOptions:passingTest:",
+
+ // NSSet
+ "objectsPassingTest:",
+ "objectsWithOptions:passingTest:",
+ "enumerateIndexPathsWithOptions:usingBlock:",
+
+ // NSIndexSet
"enumerateIndexesWithOptions:usingBlock:",
"enumerateIndexesUsingBlock:",
"enumerateIndexesInRange:options:usingBlock:",
"enumerateRangesUsingBlock:",
"enumerateRangesWithOptions:usingBlock:",
- "enumerateRangesInRange:options:usingBlock:"
- "objectWithOptions:passingTest:",
+ "enumerateRangesInRange:options:usingBlock:",
+ "indexPassingTest:",
+ "indexesPassingTest:",
+ "indexWithOptions:passingTest:",
+ "indexesWithOptions:passingTest:",
+ "indexInRange:options:passingTest:",
+ "indexesInRange:options:passingTest:"
};
std::vector<std::string> FunctionsWithAutoreleasingPool = {
@@ -95,9 +120,9 @@ static void emitDiagnostics(BoundNodes &Match, const Decl *D, BugReporter &BR,
assert(SW);
BR.EmitBasicReport(
ADC->getDecl(), Checker,
- /*Name=*/"Writing into auto-releasing variable from a different queue",
+ /*Name=*/"Write to autoreleasing out parameter inside autorelease pool",
/*Category=*/"Memory",
- (llvm::Twine("Writing into an auto-releasing out parameter inside ") +
+ (llvm::Twine("Write to autoreleasing out parameter inside ") +
"autorelease pool that may exit before " + Name + " returns; consider "
"writing first to a strong local variable declared outside of the block")
.str(),
OpenPOWER on IntegriCloud