[PATCH] D103159: [Clang] Enable __has_feature(coverage_sanitizer)

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 26 10:48:04 PDT 2021


aaron.ballman added a reviewer: rsmith.
aaron.ballman added inline comments.


================
Comment at: clang/docs/SanitizerCoverage.rst:319
 It is possible to disable coverage instrumentation for select functions via the
-function attribute ``__attribute__((no_sanitize("coverage")))``.
+function attribute ``__attribute__((no_sanitize("coverage")))``. Since this
+attribute may not be supported by other compilers, it is recommended to use it
----------------



================
Comment at: clang/include/clang/Basic/Features.def:52
         LangOpts.Sanitize.hasOneOf(SanitizerKind::Undefined))
+FEATURE(coverage_sanitizer, LangOpts.SanitizeCoverage)
 FEATURE(assume_nonnull, true)
----------------
I think this is likely fine, but wanted to call it out explicitly in case others had opinions.

`FEATURE` is supposed to be used for standard features and `EXTENSION` used for Clang extensions. This is an extension, not a standard feature, so it's wrong in that way. However, it's following the same pattern as the other sanitizers which is consistent. I think consistently wrong is better than inconsistently right for this case, but I have no idea how others feel.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103159/new/

https://reviews.llvm.org/D103159



More information about the cfe-commits mailing list