From bdc20a8babf3f3b350abae01557cfa937c720e79 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Wed, 13 Dec 2017 15:38:20 +0000 Subject: [PATCH] Add some debugging help for ARC-compilance. --- dtable.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dtable.c b/dtable.c index 4e39562..4aa63e0 100644 --- a/dtable.c +++ b/dtable.c @@ -56,6 +56,13 @@ static BOOL ownsMethod(Class cls, SEL sel) return NO; } + +#ifdef DEBUG_ARC_COMPAT +#define ARC_DEBUG_LOG(...) fprintf(stderr, __VA_LIST__) +#else +#define ARC_DEBUG_LOG(...) do {} while(0) +#endif + /** * Checks whether the class implements memory management methods, and whether * they are safe to use with ARC. @@ -73,18 +80,21 @@ static void checkARCAccessors(Class cls) struct objc_slot *slot = objc_get_slot(cls, retain); if ((NULL != slot) && !ownsMethod(slot->owner, isARC)) { + ARC_DEBUG_LOG("%s does not support ARC correctly (implements retain)\n", cls->name); objc_clear_class_flag(cls, objc_class_flag_fast_arc); return; } slot = objc_get_slot(cls, release); if ((NULL != slot) && !ownsMethod(slot->owner, isARC)) { + ARC_DEBUG_LOG("%s does not support ARC correctly (implements release)\n", cls->name); objc_clear_class_flag(cls, objc_class_flag_fast_arc); return; } slot = objc_get_slot(cls, autorelease); if ((NULL != slot) && !ownsMethod(slot->owner, isARC)) { + ARC_DEBUG_LOG("%s does not support ARC correctly (implements autorelease)\n", cls->name); objc_clear_class_flag(cls, objc_class_flag_fast_arc); return; }