Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] [Basic] Enable __has_feature(leak_sanitizer)
Add a 'leak_sanitizer' feature akin to existing '*_sanitizer' features to let programmers switch code paths accounting for leak sanitizers being enabled. Differential Revision: https://reviews.llvm.org/D67719 llvm-svn: 372527
- Loading branch information
Showing
2 changed files
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,11 @@ | |||
// RUN: %clang_cc1 -E -fsanitize=leak %s -o - | FileCheck --check-prefix=CHECK-LSAN %s | |||
// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-LSAN %s | |||
|
|||
#if __has_feature(leak_sanitizer) | |||
int LeakSanitizerEnabled(); | |||
#else | |||
int LeakSanitizerDisabled(); | |||
#endif | |||
|
|||
// CHECK-LSAN: LeakSanitizerEnabled | |||
// CHECK-NO-LSAN: LeakSanitizerDisabled |