jyknight wrote: I think we can check whether it's been overridden more easily using an asm alias like this (when libc++ is built under -fno-exceptions): ``` #include <cstdlib> #include <new>
__attribute__((weak)) void* operator new(std::size_t size) { void* mem = malloc(size); if (!mem) abort(); return mem; } // TODO: ifdef for MSVC mangling. static void* original_operator_new(std::size_t size) __attribute__((alias(__USER_LABEL_PREFIX__ "_Znwm"))); __attribute__((weak)) void* operator new(std::size_t size, std::nothrow_t) noexcept { if (static_cast<void*(*)(std::size_t)>(&::operator new) != original_operator_new) abort(); return malloc(size); } ``` https://github.com/llvm/llvm-project/pull/69498 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits