[all-commits] [llvm/llvm-project] b80965: [Support] Report OOM from `allocate_buffer` (#85449)

Josh Stone via All-commits all-commits at lists.llvm.org
Mon Jan 27 09:05:05 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b80965efc1ea3f30cbdac090d869b1000fca5d2b
      https://github.com/llvm/llvm-project/commit/b80965efc1ea3f30cbdac090d869b1000fca5d2b
  Author: Josh Stone <jistone at redhat.com>
  Date:   2025-01-27 (Mon, 27 Jan 2025)

  Changed paths:
    M llvm/lib/Support/MemAlloc.cpp

  Log Message:
  -----------
  [Support] Report OOM from `allocate_buffer` (#85449)

Previously, it called `::operator new` which may throw `std::bad_alloc`,
regardless of whether LLVM itself was built with exception handling, and
this can cause safety issues if outside code has destructors that will
call back into LLVM. Now we use `::operator new(..., nothrow)` and call
`llvm::report_bad_alloc_error` when allocation fails, which will abort
when LLVM is built without exceptions.

Ref: https://github.com/llvm/llvm-project/issues/85281



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list