Files
swift-mirror/test/Interop/Cxx/driver/sanitizer-detect.h
Gabor Horvath 06f2713a0a [cxx-interop] Forward sanitizer flags to Clang importer
Turning on the sanitizer for Swift did not have an effect on C++ code
imported by the ClangImporter. This is confusing behavior, this PR makes
sure the sanitizer frontend flags corresponding to the sanitizers used
by Swift are set.

rdar://170982364
2026-04-22 11:53:51 +01:00

34 lines
462 B
C

#pragma once
bool is_asan_enabled() {
#if __has_feature(address_sanitizer)
return true;
#else
return false;
#endif
}
bool is_tsan_enabled() {
#if __has_feature(thread_sanitizer)
return true;
#else
return false;
#endif
}
bool is_ubsan_enabled() {
#if __has_feature(undefined_behavior_sanitizer)
return true;
#else
return false;
#endif
}
bool is_memtagstack_enabled() {
#if __has_feature(memtag_stack)
return true;
#else
return false;
#endif
}