[clang] Frontend: Define __SANITIZE_*__ macros for certain sanitizers. (PR #153888)

Peter Collingbourne via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 15 15:37:16 PDT 2025


================
@@ -1519,6 +1519,13 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
   if (TI.getTriple().isOSBinFormatELF())
     Builder.defineMacro("__ELF__");
 
+  if (LangOpts.Sanitize.has(SanitizerKind::Address))
----------------
pcc wrote:

Yes, we likely want to add the rest of the sanitizers here as well (in a followup). I started with the ones that are already supported by GCC with a macro.

For UBSan, we may consider reverting #148322 and redoing it here.

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


More information about the cfe-commits mailing list