[PATCH] D67719: [clang] [Basic] Enable __has_feature(leak_sanitizer)

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 22 13:53:08 PDT 2019


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&id=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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67719.221238.patch
Type: text/x-patch
Size: 1236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190922/997efb8a/attachment.bin>


More information about the llvm-commits mailing list