[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / catch-alignment-assumption-ignorelist.c
blob9087c26e98f3d8da9e58e49712ab93819c75ab13
1 // RUN: %clang_cc1 -fsanitize=alignment -fsanitize-recover=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK
3 // CHECK-LABEL: @baseline
4 void *baseline(void *x) {
5 // CHECK: call void @__ubsan_handle_alignment_assumption(
6 return __builtin_assume_aligned(x, 1);
9 // CHECK-LABEL: ignorelist_0
10 __attribute__((no_sanitize("undefined"))) void *ignorelist_0(void *x) {
11 return __builtin_assume_aligned(x, 1);
14 // CHECK-LABEL: ignorelist_1
15 __attribute__((no_sanitize("alignment"))) void *ignorelist_1(void *x) {
16 return __builtin_assume_aligned(x, 1);
19 // CHECK-LABEL: dont_ignore_volatile_ptrs
20 void *dont_ignore_volatile_ptrs(void * volatile x) {
21 // CHECK: call void @__ubsan_handle_alignment_assumption(
22 return __builtin_assume_aligned(x, 1);
25 // CHECK-LABEL: ignore_volatiles
26 void *ignore_volatiles(volatile void * x) {
27 return __builtin_assume_aligned(x, 1);
30 // CHECK-LABEL: ignore_array_volatiles
31 void *ignore_array_volatiles() {
32 volatile int arr[] = {1};
33 return __builtin_assume_aligned(arr, 4);