brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · ed2d5ff Raw
33 lines · plain
1// RUN: %clang_cc1 -triple arm64-apple-macosx14.0.0 -O0 -debug-info-kind=standalone -dwarf-version=5 \2// RUN: -fsanitize=objc-cast -fsanitize-trap=objc-cast -emit-llvm %s -o - | FileCheck %s3 4@interface NSFastEnumerationState5@end6 7#define NSUInteger unsigned int8 9@interface NSArray10+(NSArray*) arrayWithObjects: (id) first, ...;11- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *) state 12                                   objects:(id[]) buffer 13                                     count:(NSUInteger) len;14-(unsigned) count;15@end16@interface NSString17-(const char*) cString;18@end19 20void receive_NSString(NSString*);21 22void t0(void) {23  NSArray *array = [NSArray arrayWithObjects: @"0", @"1", (void*)0];24  for (NSString *i in array) {25    receive_NSString(i);26  }27}28 29// CHECK-LABEL: @t030// CHECK: call void @llvm.ubsantrap(i8 9) {{.*}}!dbg [[LOC:![0-9]+]]31// CHECK: [[LOC]] = !DILocation(line: 0, scope: [[MSG:![0-9]+]], {{.+}})32// CHECK: [[MSG]] = distinct !DISubprogram(name: "__clang_trap_msg$Undefined Behavior Sanitizer$Invalid Objective-C cast"33