tweak warning to suggest that it is just a bad thing to do.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180175
91177308-0d34-0410-b5e6-
96231b3b80d8
"object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
def warn_objc_pointer_masking : Warning<
"bitmasking for introspection of Objective-C object pointers is strongly "
- "discouraged in favor of using runtime APIs">,
+ "discouraged">,
InGroup<DiagGroup<"deprecated-objc-pointer-introspection">>;
def warn_objc_property_default_assign_on_object : Warning<
"default property attribute 'assign' not appropriate for non-GC object">,
}
@end
+// Test for introspection of Objective-C pointers via bitmasking.
+
+void testBitmasking(NSObject *p) {
+ (void) (((NSUInteger) p) & 0x1); // expected-warning {{bitmasking for introspection of Objective-C object pointers is strongly discouraged}}
+ (void) (0x1 & ((NSUInteger) p)); // expected-warning {{bitmasking for introspection of Objective-C object pointers is strongly discouraged}}
+ (void) (((NSUInteger) p) ^ 0x1); // no-warning
+ (void) (0x1 ^ ((NSUInteger) p)); // no-warning
+}
\ No newline at end of file