1 // Make sure the sanitize_memtag attribute is emitted when using MemTag sanitizer.
2 // Make sure __attribute__((no_sanitize("memtag")) disables instrumentation.
3 
4 // RUN: %clang_cc1 -triple aarch64-unknown-linux -disable-O0-optnone \
5 // RUN:   -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-NO %s
6 
7 // RUN: %clang_cc1 -triple aarch64-unknown-linux -fsanitize=memtag \
8 // RUN:   -disable-O0-optnone -emit-llvm -o - %s | \
9 // RUN:   FileCheck -check-prefix=CHECK-MEMTAG %s
10 
11 int HasSanitizeMemTag() { return 1; }
12 // CHECK-NO: {{Function Attrs: mustprogress noinline nounwind$}}
13 // CHECK-MEMTAG: Function Attrs: mustprogress noinline nounwind sanitize_memtag
14 
15 __attribute__((no_sanitize("memtag"))) int NoSanitizeQuoteAddress() {
16   return 0;
17 }
18 // CHECK-NO: {{Function Attrs: mustprogress noinline nounwind$}}
19 // CHECK-MEMTAG: {{Function Attrs: mustprogress noinline nounwind$}}
20