[PATCH] D67719: [clang] [Basic] Enable __has_feature(leak_sanitizer)
This revision was automatically updated to reflect the committed changes. Closed by commit rL372527: [clang] [Basic] Enable __has_feature(leak_sanitizer) (authored by mgorny, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D67719?vs=221155=221238#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67719/new/ https://reviews.llvm.org/D67719 Files: cfe/trunk/include/clang/Basic/Features.def cfe/trunk/test/Lexer/has_feature_leak_sanitizer.cpp Index: cfe/trunk/include/clang/Basic/Features.def === --- cfe/trunk/include/clang/Basic/Features.def +++ cfe/trunk/include/clang/Basic/Features.def @@ -39,6 +39,8 @@ FEATURE(address_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::Address | SanitizerKind::KernelAddress)) +FEATURE(leak_sanitizer, +LangOpts.Sanitize.has(SanitizerKind::Leak)) FEATURE(hwaddress_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::HWAddress | SanitizerKind::KernelHWAddress)) Index: cfe/trunk/test/Lexer/has_feature_leak_sanitizer.cpp === --- cfe/trunk/test/Lexer/has_feature_leak_sanitizer.cpp +++ cfe/trunk/test/Lexer/has_feature_leak_sanitizer.cpp @@ -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 Index: cfe/trunk/include/clang/Basic/Features.def === --- cfe/trunk/include/clang/Basic/Features.def +++ cfe/trunk/include/clang/Basic/Features.def @@ -39,6 +39,8 @@ FEATURE(address_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::Address | SanitizerKind::KernelAddress)) +FEATURE(leak_sanitizer, +LangOpts.Sanitize.has(SanitizerKind::Leak)) FEATURE(hwaddress_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::HWAddress | SanitizerKind::KernelHWAddress)) Index: cfe/trunk/test/Lexer/has_feature_leak_sanitizer.cpp === --- cfe/trunk/test/Lexer/has_feature_leak_sanitizer.cpp +++ cfe/trunk/test/Lexer/has_feature_leak_sanitizer.cpp @@ -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 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D67719: [clang] [Basic] Enable __has_feature(leak_sanitizer)
phosek accepted this revision. phosek added a comment. This revision is now accepted and ready to land. LGTM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67719/new/ https://reviews.llvm.org/D67719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D67719: [clang] [Basic] Enable __has_feature(leak_sanitizer)
mgorny updated this revision to Diff 221155. mgorny added a comment. Test added. Thanks for the suggestion! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67719/new/ https://reviews.llvm.org/D67719 Files: clang/include/clang/Basic/Features.def clang/test/Lexer/has_feature_leak_sanitizer.cpp Index: clang/test/Lexer/has_feature_leak_sanitizer.cpp === --- /dev/null +++ clang/test/Lexer/has_feature_leak_sanitizer.cpp @@ -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 Index: clang/include/clang/Basic/Features.def === --- clang/include/clang/Basic/Features.def +++ clang/include/clang/Basic/Features.def @@ -39,6 +39,8 @@ FEATURE(address_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::Address | SanitizerKind::KernelAddress)) +FEATURE(leak_sanitizer, +LangOpts.Sanitize.has(SanitizerKind::Leak)) FEATURE(hwaddress_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::HWAddress | SanitizerKind::KernelHWAddress)) Index: clang/test/Lexer/has_feature_leak_sanitizer.cpp === --- /dev/null +++ clang/test/Lexer/has_feature_leak_sanitizer.cpp @@ -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 Index: clang/include/clang/Basic/Features.def === --- clang/include/clang/Basic/Features.def +++ clang/include/clang/Basic/Features.def @@ -39,6 +39,8 @@ FEATURE(address_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::Address | SanitizerKind::KernelAddress)) +FEATURE(leak_sanitizer, +LangOpts.Sanitize.has(SanitizerKind::Leak)) FEATURE(hwaddress_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::HWAddress | SanitizerKind::KernelHWAddress)) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D67719: [clang] [Basic] Enable __has_feature(leak_sanitizer)
phosek requested changes to this revision. phosek added a comment. This revision now requires changes to proceed. Actually, can you please add a test akin to https://github.com/llvm/llvm-project/blob/master/clang/test/Lexer/has_feature_memory_sanitizer.cpp? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67719/new/ https://reviews.llvm.org/D67719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D67719: [clang] [Basic] Enable __has_feature(leak_sanitizer)
phosek accepted this revision. phosek added a comment. This revision is now accepted and ready to land. LGTM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67719/new/ https://reviews.llvm.org/D67719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D67719: [clang] [Basic] Enable __has_feature(leak_sanitizer)
krytarowski added a comment. Looks good to me but I will leave the final decision to someone else. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67719/new/ https://reviews.llvm.org/D67719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D67719: [clang] [Basic] Enable __has_feature(leak_sanitizer)
mgorny created this revision. mgorny added reviewers: krytarowski, eugenis, leonardchan, vitalybuka, phosek. Add a 'leak_sanitizer' feature akin to existing '*_sanitizer' features to let programmers switch code paths accounting for leak sanitizers being enabled. https://reviews.llvm.org/D67719 Files: clang/include/clang/Basic/Features.def Index: clang/include/clang/Basic/Features.def === --- clang/include/clang/Basic/Features.def +++ clang/include/clang/Basic/Features.def @@ -39,6 +39,8 @@ FEATURE(address_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::Address | SanitizerKind::KernelAddress)) +FEATURE(leak_sanitizer, +LangOpts.Sanitize.has(SanitizerKind::Leak)) FEATURE(hwaddress_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::HWAddress | SanitizerKind::KernelHWAddress)) Index: clang/include/clang/Basic/Features.def === --- clang/include/clang/Basic/Features.def +++ clang/include/clang/Basic/Features.def @@ -39,6 +39,8 @@ FEATURE(address_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::Address | SanitizerKind::KernelAddress)) +FEATURE(leak_sanitizer, +LangOpts.Sanitize.has(SanitizerKind::Leak)) FEATURE(hwaddress_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::HWAddress | SanitizerKind::KernelHWAddress)) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits