Take into account return type of the function as well, as otherwise we have unexpected collisions with kernel-land function with the same name.
Details
- Reviewers
dcoughlin zaks.anna NoQ - Commits
- rG77886fc0f075: Revert r314820 "[Analyzer] More granular special casing in RetainCountChecker"
rGfec6b1afe66c: [Analyzer] More granular special casing in RetainCountChecker
rC314831: Revert r314820 "[Analyzer] More granular special casing in RetainCountChecker"
rC314820: [Analyzer] More granular special casing in RetainCountChecker
rL314831: Revert r314820 "[Analyzer] More granular special casing in RetainCountChecker"
rL314820: [Analyzer] More granular special casing in RetainCountChecker
Diff Detail
- Repository
- rL LLVM
Event Timeline
Looks good to me with the (minor) inline comments addressed.
lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | ||
---|---|---|
1089 ↗ | (On Diff #117462) | __CFDictionary is technically an implementation detail. It is probably better to use RetTy.getAsString() == "CFMutableDictionaryRef" |
test/Analysis/retain-release.mm | ||
471 ↗ | (On Diff #117462) | Please add a // no-warning comment to this line to let future maintainers know that it is specifically not supposed to warn. It is also probably worth explicitly extending the comment on IOBSDNameMatching() to say that we don't want to warn unless the return type is CFMutableDictionaryRef. |
Yep, looks good.
lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | ||
---|---|---|
1066–1068 ↗ | (On Diff #117462) | A bit fancier and a common pattern here: if (const IdentifierInfo *II = RetTy.getBaseTypeIdentifier()) { RetTyName = II->getName(); } |
Hi,
I see a failure on retain-release.m with this patch. Revert it for now.
- TEST 'Clang :: Analysis/retain-release.m' FAILED ****
Script:
rm -f /usr/local/google/home/timshen/src/llvm-build/tools/clang/test/Analysis/Output/retain-release.m.tmp.objc.plist /usr/local/google/home/timshen/src/llvm-build/tools/clang/test/Analysis/Output/retain-release.m.tmp.objcpp.plist
/usr/local/google/home/timshen/src/llvm-build/bin/clang -cc1 -internal-isystem /usr/local/google/home/timshen/src/llvm-build/lib/clang/6.0.0/include -nostdsysteminc -analyze -analyzer-constraints=range -triple x86_64-apple-darwin10 -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -fblocks -verify -Wno-objc-root-class /usr/local/google/home/timshen/src/llvm-project/clang/test/Analysis/retain-release.m -analyzer-output=plist -o /usr/local/google/home/timshen/src/llvm-build/tools/clang/test/Analysis/Output/retain-release.m.tmp.objc.plist
/usr/local/google/home/timshen/src/llvm-build/bin/clang -cc1 -internal-isystem /usr/local/google/home/timshen/src/llvm-build/lib/clang/6.0.0/include -nostdsysteminc -analyze -analyzer-constraints=range -triple x86_64-apple-darwin10 -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -fblocks -verify -x objective-c++ -std=gnu++98 -Wno-objc-root-class /usr/local/google/home/timshen/src/llvm-project/clang/test/Analysis/retain-release.m -analyzer-output=plist -o /usr/local/google/home/timshen/src/llvm-build/tools/clang/test/Analysis/Output/retain-release.m.tmp.objcpp.plist
Exit Code: 1
Command Output (stderr):
error: 'warning' diagnostics expected but not seen:
File /usr/local/google/home/timshen/src/llvm-project/clang/test/Analysis/retain-release.m Line 974: leak File /usr/local/google/home/timshen/src/llvm-project/clang/test/Analysis/retain-release.m Line 978: leak File /usr/local/google/home/timshen/src/llvm-project/clang/test/Analysis/retain-release.m Line 982: leak File /usr/local/google/home/timshen/src/llvm-project/clang/test/Analysis/retain-release.m Line 997: leak File /usr/local/google/home/timshen/src/llvm-project/clang/test/Analysis/retain-release.m Line 1002: leak
5 errors generated.