[compiler-rt] [asan] Throw std::bad_alloc from operator new on allocation failure (PR #196388)

David Justo via llvm-commits llvm-commits at lists.llvm.org
Sun May 24 16:31:46 PDT 2026


================
@@ -167,7 +178,10 @@ add_compiler_rt_object_libraries(RTAsan_dynamic
   ARCHS ${ASAN_SUPPORTED_ARCH}
   SOURCES ${ASAN_SOURCES} ${ASAN_CXX_SOURCES}
   ADDITIONAL_HEADERS ${ASAN_HEADERS}
-  CFLAGS ${ASAN_DYNAMIC_CFLAGS}
+  # Build the whole dynamic ASan with -fexceptions rather than splitting it
+  # into C and C++ slices — only asan_new_delete.cpp uses exceptions but the
+  # extra flag is harmless on the C sources and avoids the build-system split.
+  CFLAGS ${ASAN_DYNAMIC_CXX_CFLAGS}
----------------
davidmrdavid wrote:

ultra-nit (I don't really feel strongly about this at all) - if we're not splitting this between CXX and C variants, then why not call this `ASAN_DYNAMIC_FLAGS` and then explain that there's no splitting between languages right next to the var declaration?

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


More information about the llvm-commits mailing list