| 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 %s |
| 3 |
|
| 4 |
@interface NSFastEnumerationState |
| 5 |
@end |
| 6 |
|
| 7 |
#define NSUInteger unsigned int |
| 8 |
|
| 9 |
@interface NSArray |
| 10 |
+(NSArray*) arrayWithObjects: (id) first, ...; |
| 11 |
- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *) state |
| 12 |
objects:(id[]) buffer |
| 13 |
count:(NSUInteger) len; |
| 14 |
-(unsigned) count; |
| 15 |
@end |
| 16 |
@interface NSString |
| 17 |
-(const char*) cString; |
| 18 |
@end |
| 19 |
|
| 20 |
void receive_NSString(NSString*); |
| 21 |
|
| 22 |
void 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: @t0 |
| 30 |
// 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" |