[clang] [WIP][DO NOT MERGE][Clang][Driver] Emit warning when -fsanitize-trap=<...> is passed without associated -fsanitize=<...> (PR #147997)

Dan Liew via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 11 07:39:47 PDT 2025


================
@@ -348,6 +348,30 @@ parseSanitizeSkipHotCutoffArgs(const Driver &D, const llvm::opt::ArgList &Args,
   return Cutoffs;
 }
 
+// Given a set of mismatched bits, TrapOnly (bits the user asked to trap but
+// that aren’t actually enabled), emit a warning based on -fsanitize-trap=NAME
+static void diagnoseTrapOnly(const Driver &D, SanitizerMask &TrapOnly) {
+// Double pass: one for sanitizer groupings, one for leaves (ex: undefined vs.
----------------
delcypher wrote:

For clarity you split this comment. One for the bit where you handle group names, and one for the individual sanitizer name (and put the comment next the code where we do this).

https://github.com/llvm/llvm-project/pull/147997


More information about the cfe-commits mailing list