[clang] [NFC][analyzer] Add regression tests from bisection commits to the CSA's test suite (PR #241058)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 11 02:40:24 PST 2026
================
@@ -255,3 +255,32 @@ void R8261992_test(R8261992 *tc) {
*p = 0xDEADBEEF; // expected-warning{{null}}
}
+extern CFStringRef CFStringCreateCopy(CFAllocatorRef, CFStringRef) __attribute__((cf_returns_retained));
+extern CFStringRef exampleString;
+CFStringRef GH19340_Strings[2][2];
+
+ at interface GH19340_StringCache : NSObject {
+ CFStringRef strings[2];
+ CFStringRef moreStrings[2][2];
+}
+ at end
+
+ at implementation GH19340_StringCache
+- (CFStringRef)stringAtZ:(int)z {
+ if (!strings[z])
+ strings[z] = CFStringCreateCopy(kCFAllocatorDefault, exampleString);
+ return strings[z]; // no-warning
+}
+
+- (CFStringRef)stringAtX:(int)x y:(int)y {
+ if (!moreStrings[x][y])
+ moreStrings[x][y] = CFStringCreateCopy(kCFAllocatorDefault, exampleString);
+ return moreStrings[x][y]; // no-warning
+}
+
+- (CFStringRef)staticStringAtX:(int)x y:(int)y {
+ if (!GH19340_Strings[x][y])
+ GH19340_Strings[x][y] = CFStringCreateCopy(kCFAllocatorDefault, exampleString);
+ return GH19340_Strings[x][y]; // no-warning
+}
----------------
steakhal wrote:
This doesn't seem to be trivial. Would deserve some comments.
https://github.com/llvm/llvm-project/pull/241058
More information about the cfe-commits
mailing list