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

Rashmi Mudduluru via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 10 16:48:54 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:

I'm fairly certain this works, but can we have a test case with inheritance (sub class calls `provideNS` defined in super class) for the sake of completion?

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


More information about the cfe-commits mailing list