[PATCH] D82926: [libfuzzer] [clang] Add __has_feature(fuzzing_coverage)
Mitch Phillips via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 30 17:23:53 PDT 2020
hctim updated this revision to Diff 274656.
hctim added a comment.
Changed the filename and fixed up the inverted test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82926/new/
https://reviews.llvm.org/D82926
Files:
clang/include/clang/Basic/Features.def
clang/test/Lexer/has_feature_fuzzing_coverage.cpp
Index: clang/test/Lexer/has_feature_fuzzing_coverage.cpp
===================================================================
--- /dev/null
+++ clang/test/Lexer/has_feature_fuzzing_coverage.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NONE %s
+// RUN: %clang_cc1 -E -fsanitize=fuzzer %s -o - \
+// RUN: | FileCheck --check-prefix=CHECK-ENABLED %s
+// RUN: %clang_cc1 -E -fsanitize=fuzzer-no-link %s -o - \
+// RUN: | FileCheck --check-prefix=CHECK-ENABLED %s
+
+#if __has_feature(fuzzing_coverage)
+int FuzzingCoverageEnabled();
+#else
+int FuzzingCoverageDisabled();
+#endif
+
+// CHECK-NONE: FuzzingCoverageDisabled
+// CHECK-ENABLED: FuzzingCoverageEnabled
Index: clang/include/clang/Basic/Features.def
===================================================================
--- clang/include/clang/Basic/Features.def
+++ clang/include/clang/Basic/Features.def
@@ -49,6 +49,9 @@
FEATURE(xray_instrument, LangOpts.XRayInstrument)
FEATURE(undefined_behavior_sanitizer,
LangOpts.Sanitize.hasOneOf(SanitizerKind::Undefined))
+FEATURE(fuzzing_coverage,
+ LangOpts.Sanitize.hasOneOf(SanitizerKind::Fuzzer |
+ SanitizerKind::FuzzerNoLink))
FEATURE(assume_nonnull, true)
FEATURE(attribute_analyzer_noreturn, true)
FEATURE(attribute_availability, true)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82926.274656.patch
Type: text/x-patch
Size: 1342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200701/38c5395f/attachment-0001.bin>
More information about the cfe-commits
mailing list