mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-09 12:06:09 +00:00

Boilerplate code for using KMSAN instrumentation in Clang. We add a new command line flag, -fsanitize=kernel-memory, with a corresponding SanitizerKind::KernelMemory, which, along with SanitizerKind::Memory, maps to the memory_sanitizer feature. KMSAN is only supported on x86_64 Linux. It's incompatible with other sanitizers, but supports code coverage instrumentation. llvm-svn: 341641
13 lines
452 B
C++
13 lines
452 B
C++
// RUN: %clang_cc1 -E -fsanitize=memory %s -o - | FileCheck --check-prefix=CHECK-MSAN %s
|
|
// RUN: %clang_cc1 -E -fsanitize=kernel-memory %s -o - | FileCheck --check-prefix=CHECK-MSAN %s
|
|
// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-MSAN %s
|
|
|
|
#if __has_feature(memory_sanitizer)
|
|
int MemorySanitizerEnabled();
|
|
#else
|
|
int MemorySanitizerDisabled();
|
|
#endif
|
|
|
|
// CHECK-MSAN: MemorySanitizerEnabled
|
|
// CHECK-NO-MSAN: MemorySanitizerDisabled
|