[compiler-rt] 23e8a4d - [UBSan] Relax test expectations in Misc/objc-cast.m test

Kuba Mracek via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 05:25:07 PST 2022


Author: Kuba Mracek
Date: 2022-01-12T05:25:02-08:00
New Revision: 23e8a4d16018076e6eed4aa821c020b7fe348c69

URL: https://github.com/llvm/llvm-project/commit/23e8a4d16018076e6eed4aa821c020b7fe348c69
DIFF: https://github.com/llvm/llvm-project/commit/23e8a4d16018076e6eed4aa821c020b7fe348c69.diff

LOG: [UBSan] Relax test expectations in Misc/objc-cast.m test

The test checks that an array of Obj-C literal integers (e.g. `@1`) gets a UBSan
warning when cast to an NSString, however the actual concrete Obj-C class of
literal integers doesn't always need to be __NSCFNumber. Let's relax the test
expectations to allow NSConstantIntegerNumber. Which exact subclass of NSNumber
is used is not actually important for the test (the test is just checking that
the invalid cast warning is thrown).

Added: 
    

Modified: 
    compiler-rt/test/ubsan/TestCases/Misc/objc-cast.m

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/ubsan/TestCases/Misc/objc-cast.m b/compiler-rt/test/ubsan/TestCases/Misc/objc-cast.m
index f502e5f535372..6dd3dc7319d53 100644
--- a/compiler-rt/test/ubsan/TestCases/Misc/objc-cast.m
+++ b/compiler-rt/test/ubsan/TestCases/Misc/objc-cast.m
@@ -10,7 +10,7 @@
 
 int main() {
   NSArray *arrayOfInt = [NSArray arrayWithObjects:@1, @2, @3, (void *)0];
-  // CHECK: objc-cast.m:[[@LINE+1]]:{{.*}}: runtime error: invalid ObjC cast, object is a '__NSCFNumber', but expected a 'NSString'
+  // CHECK: objc-cast.m:[[@LINE+1]]:{{.*}}: runtime error: invalid ObjC cast, object is a '{{__NSCFNumber|NSConstantIntegerNumber}}', but expected a 'NSString'
   for (NSString *str in arrayOfInt) {
     NSLog(@"%@", str);
   }


        


More information about the llvm-commits mailing list