summaryrefslogtreecommitdiff
path: root/clang/test
diff options
context:
space:
mode:
authorMatthew Nagy <matthew.nagy@sony.com>2025-11-21 14:54:49 +0000
committerGitHub <noreply@github.com>2025-11-21 14:54:49 +0000
commit560b83c0cd814562ed3542583b0f62a908bcd767 (patch)
tree0eadfebf4c09c2a9bc92af7745ce58688b5cc676 /clang/test
parent2a3e745eaa75047e368024ad437950fa239a4aeb (diff)
[TySan][Clang] Add clang flag to use tysan outlined instrumentation a… (#166170)
…nd update docs
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/sanitize-type-outlined.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/CodeGen/sanitize-type-outlined.cpp b/clang/test/CodeGen/sanitize-type-outlined.cpp
new file mode 100644
index 000000000000..64e0882aa1e1
--- /dev/null
+++ b/clang/test/CodeGen/sanitize-type-outlined.cpp
@@ -0,0 +1,22 @@
+// UNSUPPORTED: target={{.*}}-windows-{{.*}}
+
+// RUN: %clang -S -fsanitize=type -emit-llvm -o - -fsanitize=type %s \
+// RUN: -fno-sanitize-type-outline-instrumentation \
+// RUN: | FileCheck %s --check-prefixes=CHECK-NO-OUTLINE
+// RUN: %clang -S -fsanitize=type -emit-llvm -o - -fsanitize=type %s \
+// RUN: -fsanitize-type-outline-instrumentation \
+// RUN: | FileCheck %s --check-prefixes=CHECK-OUTLINE
+
+// CHECK-LABEL: @alias
+// CHECK: __tysan_app_memory_mask
+// CHECK: __tysan_shadow_memory_address
+// CHECK-NO-OUTLINE-NOT: call{{.*}}@__tysan_instrument_mem_inst
+// CHECK-NO-OUTLINE-NOT: call{{.*}}@__tysan_instrument_with_shadow_update
+// CHECK-OUTLINE: call{{.*}}@__tysan_instrument_mem_inst
+// CHECK-OUTLINE: call{{.*}}@__tysan_instrument_with_shadow_update
+
+float alias(int *ptr){
+ float *aliasedPtr = (float *)ptr;
+ *aliasedPtr *= 2.0f;
+ return *aliasedPtr;
+}