[all-commits] [llvm/llvm-project] 0c324f: [Support] Fix the return type of AddOverflow, SubO...

Kazu Hirata via All-commits all-commits at lists.llvm.org
Sun Sep 13 07:12:26 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0c324f10322b490d66de738d73458f6f65460cdb
      https://github.com/llvm/llvm-project/commit/0c324f10322b490d66de738d73458f6f65460cdb
  Author: Kazu Hirata <kazu at google.com>
  Date:   2026-09-13 (Sun, 13 Sep 2026)

  Changed paths:
    M llvm/include/llvm/Support/MathExtras.h

  Log Message:
  -----------
  [Support] Fix the return type of AddOverflow, SubOverflow, and MulOverflow (#223217)

This patch fixes the return type of the 3-argument overloads of
AddOverflow, SubOverflow, and MulOverflow to bool.

Without this patch, these functions are declared with a return type
of T:

  template <typename T>
std::enable_if_t<std::is_signed_v<T>, T> AddOverflow(T X, T Y, T
&Result);

even though they return a boolean indicating whether an overflow
occurred, as stated in the comment:

/// Add two signed integers, computing the two's complement truncated
result,
  /// returning true if overflow occurred.

Assisted-by: Antigravity



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