[clang] [WebKit checkers] Recognize NS_RETURNS_RETAINED and CF_RETURNS_RETAINED. (PR #157629)

Rashmi Mudduluru via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 11 10:07:01 PDT 2025


================
@@ -438,6 +438,20 @@ void use_const_local() {
 
 } // namespace const_global
 
+namespace ns_retained_return_value {
+
+NSString *provideNS() NS_RETURNS_RETAINED;
+CFDictionaryRef provideCF() CF_RETURNS_RETAINED;
+void consumeNS(NSString *);
+void consumeCF(CFDictionaryRef);
+
+void foo() {
+  consumeNS(provideNS());
+  consumeCF(provideCF());
+}
+
+} // namespace ns_retained_return_value
+
----------------
t-rasmud wrote:

> Or are you talking about adding a test case where `provideNS` is defined in a C++ class then a subclass of it calls `consumeNS(provideNS())` in some member function?

I was thinking of this case.

https://github.com/llvm/llvm-project/pull/157629


More information about the cfe-commits mailing list