Skip to content

Commit 524f090

Browse files
authored
[alpha.webkit.UncountedCallArgsChecker] Treat CFEqual as a safe function (#146369)
CFEqual is a trivial function, so treat it as safe.
1 parent 6731f15 commit 524f090

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefCallArgsChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ class RawPtrRefCallArgsChecker
294294
if (name == "adoptRef" || name == "getPtr" || name == "WeakPtr" ||
295295
name == "is" || name == "equal" || name == "hash" || name == "isType" ||
296296
// FIXME: Most/all of these should be implemented via attributes.
297-
name == "equalIgnoringASCIICase" ||
297+
name == "CFEqual" || name == "equalIgnoringASCIICase" ||
298298
name == "equalIgnoringASCIICaseCommon" ||
299299
name == "equalIgnoringNullity" || name == "toString")
300300
return true;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
2+
// expected-no-diagnostics
3+
4+
#include "objc-mock-types.h"
5+
6+
CGImageRef provideImage();
7+
8+
Boolean cfe(CFTypeRef obj)
9+
{
10+
return CFEqual(obj, provideImage());
11+
}
12+

clang/test/Analysis/Checkers/WebKit/objc-mock-types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ CFDictionaryRef CFDictionaryCreateCopy(CFAllocatorRef allocator, CFDictionaryRef
4545
CFDictionaryRef CFDictionaryCreateMutableCopy(CFAllocatorRef allocator, CFIndex capacity, CFDictionaryRef theDict);
4646
CFIndex CFDictionaryGetCount(CFDictionaryRef theDict);
4747
Boolean CFDictionaryContainsKey(CFDictionaryRef theDict, const void *key);
48+
Boolean CFEqual(CFTypeRef, CFTypeRef);
4849
Boolean CFDictionaryContainsValue(CFDictionaryRef theDict, const void *value);
4950
const void *CFDictionaryGetValue(CFDictionaryRef theDict, const void *key);
5051
void CFDictionaryAddValue(CFMutableDictionaryRef theDict, const void *key, const void *value);

0 commit comments

Comments
 (0)