[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / sanitize-recover.c
blobfa53c2e7ca45efaa23aafbe4b8d82035f25443ac
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsanitize=unsigned-integer-overflow -fsanitize-recover=unsigned-integer-overflow %s -emit-llvm -o - | FileCheck %s --check-prefix=RECOVER
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsanitize=unsigned-integer-overflow %s -emit-llvm -o - | FileCheck %s --check-prefix=ABORT
3 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsanitize=null,object-size,alignment -fsanitize-recover=object-size %s -emit-llvm -o - | FileCheck %s --check-prefix=PARTIAL
5 // RECOVER: @test
6 // ABORT: @test
7 void test(void) {
8 extern volatile unsigned x, y, z;
10 // RECOVER: uadd.with.overflow.i32{{.*}}, !nosanitize
11 // RECOVER: ubsan_handle_add_overflow({{.*}}, !nosanitize
12 // RECOVER-NOT: unreachable
13 // ABORT: uadd.with.overflow.i32{{.*}}, !nosanitize
14 // ABORT: ubsan_handle_add_overflow_abort({{.*}}, !nosanitize
15 // ABORT: unreachable{{.*}}, !nosanitize
16 x = y + z;
19 void foo(void) {
20 union { int i; } u;
21 u.i=1;
22 // PARTIAL: %[[SIZE:.*]] = call i64 @llvm.objectsize.i64.p0(ptr {{.*}}, i1 false, i1 false)
23 // PARTIAL-NEXT: %[[CHECK0:.*]] = icmp uge i64 %[[SIZE]], 4
25 // PARTIAL: br i1 %[[CHECK0]], {{.*}} !nosanitize
27 // PARTIAL: call void @__ubsan_handle_type_mismatch_v1(