[clang] Add option -fstdlib-hardening= (PR #78763)

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 12:57:05 PST 2024


================
@@ -851,6 +851,33 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
                       Twine(getClangFullCPPVersion()) + "\"");
 
   // Initialize language-specific preprocessor defines.
+  if (LangOpts.getLibcxxHardeningMode()) {
+    const char *LibcxxHardeningStr;
+
+    Builder.defineMacro("_LIBCPP_HARDENING_MODE_NONE", "0");
----------------
ldionne wrote:

It would be great to avoid coupling these values between Clang and libc++. Can't you just define e.g. `_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST` without actually defining what `_LIBCPP_HARDENING_MODE_FAST` expands to?

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


More information about the cfe-commits mailing list