[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / memtag-attr.cpp
blob4c8a86ef0b4328e6f0ad9ea8b600af88436ad505
1 // Make sure the sanitize_memtag attribute is emitted when using MemTag sanitizer.
2 // Make sure __attribute__((no_sanitize("memtag")) disables instrumentation.
4 // RUN: %clang_cc1 -triple aarch64-unknown-linux -disable-O0-optnone \
5 // RUN: -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-NO %s
7 // RUN: %clang_cc1 -triple aarch64-unknown-linux -fsanitize=memtag-stack \
8 // RUN: -disable-O0-optnone -emit-llvm -o - %s | \
9 // RUN: FileCheck -check-prefix=CHECK-MEMTAG %s
11 // RUN: %clang --target=aarch64-unknown-linux -march=armv8a+memtag \
12 // RUN: -fsanitize=memtag -disable-O0-optnone -S -emit-llvm -o - %s | \
13 // RUN: FileCheck -check-prefix=CHECK-MEMTAG %s
15 extern "C" int HasSanitizeMemTag() { return 1; }
16 // CHECK-NO: Function Attrs
17 // CHECK-NO-NOT: sanitize_memtag
18 // CHECK-NO-NEXT: define {{.*}} @HasSanitizeMemTag(
19 // CHECK-MEMTAG: Function Attrs: {{.*}} sanitize_memtag
20 // CHECK-MEMTAG-NEXT: define {{.*}} @HasSanitizeMemTag(
22 extern "C" __attribute__((no_sanitize("memtag"))) int NoSanitizeQuoteAddress() {
23 return 0;
25 // CHECK-NO: Function Attrs
26 // CHECK-NO-NOT: sanitize_memtag
27 // CHECK-NO-NEXT: define {{.*}} @NoSanitizeQuoteAddress(
28 // CHECK-MEMTAG: Function Attrs
29 // CHECK-MEMTAG-NOT: sanitize_memtag
30 // CHECK-MEMTAG-NEXT: define {{.*}} @NoSanitizeQuoteAddress(