mirror of
https://github.com/apple/swift.git
synced 2026-10-12 14:50:47 +02:00
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
34 lines
462 B
C
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
|
|
}
|