[all-commits] [llvm/llvm-project] 848b0e: Improve error handling for SmallVector programming...

Geoffrey Martin-Noble via All-commits all-commits at lists.llvm.org
Wed Sep 2 15:01:29 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 848b0e244c9ff5413c2eee6357d5faab1402d619
      https://github.com/llvm/llvm-project/commit/848b0e244c9ff5413c2eee6357d5faab1402d619
  Author: Geoffrey Martin-Noble <gcmn at google.com>
  Date:   2020-09-02 (Wed, 02 Sep 2020)

  Changed paths:
    M llvm/include/llvm/ADT/SmallVector.h
    M llvm/include/llvm/Support/ErrorHandling.h
    M llvm/lib/Support/ErrorHandling.cpp
    M llvm/lib/Support/SmallVector.cpp

  Log Message:
  -----------
  Improve error handling for SmallVector programming errors

This patch changes errors in `SmallVector::grow` that are independent of
memory capacity to be reported using report_fatal_error or
std::length_error instead of report_bad_alloc_error, which falsely signals
an OOM.

It also cleans up a few related things:
- makes report_bad_alloc_error to print the failure reason passed
  to it.
- fixes the documentation to indicate that report_bad_alloc_error
  calls `abort()` not "an assertion"
- uses a consistent name for the size/capacity argument to `grow`
  and `grow_pod`

Reviewed By: mehdi_amini, MaskRay

Differential Revision: https://reviews.llvm.org/D86892




More information about the All-commits mailing list