[PATCH] D34210: Add __has_feature(leak_sanitizer)
Francis Ricci via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 14 09:10:56 PDT 2017
fjricci created this revision.
Stand-alone leak sanitizer builds are supported with -fsanitize=leak,
adds an attribute for consistency with the rest of the sanitizer attributes.
https://reviews.llvm.org/D34210
Files:
lib/Lex/PPMacroExpansion.cpp
test/Lexer/has_feature_leak_sanitizer.cpp
Index: test/Lexer/has_feature_leak_sanitizer.cpp
===================================================================
--- /dev/null
+++ 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: lib/Lex/PPMacroExpansion.cpp
===================================================================
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -1133,6 +1133,7 @@
.Case("enumerator_attributes", true)
.Case("nullability", true)
.Case("nullability_on_arrays", true)
+ .Case("leak_sanitizer", LangOpts.Sanitize.has(SanitizerKind::Leak))
.Case("memory_sanitizer", LangOpts.Sanitize.has(SanitizerKind::Memory))
.Case("thread_sanitizer", LangOpts.Sanitize.has(SanitizerKind::Thread))
.Case("dataflow_sanitizer", LangOpts.Sanitize.has(SanitizerKind::DataFlow))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34210.102560.patch
Type: text/x-patch
Size: 1179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170614/764f48e2/attachment-0001.bin>
More information about the cfe-commits
mailing list