File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
clang/test/Analysis/Checkers/WebKit Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -279,6 +279,20 @@ inline CFTypeRef bridge_cast(NSObject *object)
279279 return (__bridge CFTypeRef)object;
280280}
281281
282+ inline id bridge_id_cast (CFTypeRef object)
283+ {
284+ return (__bridge id )object;
285+ }
286+
287+ inline RetainPtr<id > bridge_id_cast (RetainPtr<CFTypeRef>&& object)
288+ {
289+ #if __has_feature(objc_arc)
290+ return adoptNS ((__bridge_transfer id )object.leakRef ());
291+ #else
292+ return adoptNS ((__bridge id )object.leakRef ());
293+ #endif
294+ }
295+
282296template <typename ExpectedType>
283297struct ObjCTypeCastTraits {
284298public:
@@ -419,6 +433,7 @@ using WTF::adoptCF;
419433using WTF::retainPtr;
420434using WTF::downcast;
421435using WTF::bridge_cast;
436+ using WTF::bridge_id_cast;
422437using WTF::is_objc;
423438using WTF::checked_objc_cast;
424439using WTF::dynamic_objc_cast;
Original file line number Diff line number Diff line change @@ -395,6 +395,11 @@ unsigned ccf(CFTypeRef obj) {
395395 return CFArrayGetCount (checked_cf_cast<CFArrayRef>(obj));
396396}
397397
398+ void some_function (id );
399+ void idcf (CFTypeRef obj) {
400+ some_function (bridge_id_cast (obj));
401+ }
402+
398403} // ptr_conversion
399404
400405@interface TestObject : NSObject
You can’t perform that action at this time.
0 commit comments