r349649 - [Driver] Add .hasAnySanitizer() to SanitizerArgs

Michal Gorny via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 19 09:25:55 PST 2018

Author: mgorny
Date: Wed Dec 19 09:25:55 2018
New Revision: 349649

URL: http://llvm.org/viewvc/llvm-project?rev=349649&view=rev
[Driver] Add .hasAnySanitizer() to SanitizerArgs

Add a simple method to query whether any sanitizer was enabled,
via SanitizerArgs.  This will be used in the NetBSD driver to pass
additional definitions that are required by all sanitizers.

Differential Revision: https://reviews.llvm.org/D55832


Modified: cfe/trunk/include/clang/Driver/SanitizerArgs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/SanitizerArgs.h?rev=349649&r1=349648&r2=349649&view=diff
--- cfe/trunk/include/clang/Driver/SanitizerArgs.h (original)
+++ cfe/trunk/include/clang/Driver/SanitizerArgs.h Wed Dec 19 09:25:55 2018
@@ -82,6 +82,7 @@ class SanitizerArgs {
   bool needsUnwindTables() const;
   bool linkCXXRuntimes() const { return LinkCXXRuntimes; }
   bool hasCrossDsoCfi() const { return CfiCrossDso; }
+  bool hasAnySanitizer() const { return !Sanitizers.empty(); }
   void addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
                llvm::opt::ArgStringList &CmdArgs, types::ID InputType) const;

More information about the cfe-commits mailing list