[all-commits] [llvm/llvm-project] b8f6f9: [libc++] Avoid creating temporaries in unary expre...

Louis Dionne via All-commits all-commits at lists.llvm.org
Mon Jun 6 09:59:17 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b8f6f9e741c60a06cbe14adf890db0889b3b333f
      https://github.com/llvm/llvm-project/commit/b8f6f9e741c60a06cbe14adf890db0889b3b333f
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2022-06-06 (Mon, 06 Jun 2022)

  Changed paths:
    M libcxx/docs/ReleaseNotes.rst
    M libcxx/include/valarray
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.unary/bit_not.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.unary/negate.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.unary/not.pass.cpp
    M libcxx/test/std/numerics/numarray/template.valarray/valarray.unary/plus.pass.cpp

  Log Message:
  -----------
  [libc++] Avoid creating temporaries in unary expressions involving valarray

Currently, unary expressions involving valarray will create a temporary.
This leads to dangling references in expressions like `-a * b`, because
`-a` is a temporary and the resulting expression will refer to it. This
patch fixes the problem by creating a lazy expression to perform the unary
operation instead of eagerly creating a temporary valarray. This is
permitted by the Standard, which does not specify the exact type of
most expressions involving valarrays.

This is technically an ABI break, however I believe the actual potential
for breakage is very low.

rdar://90152242

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


  Commit: eebbfbcd500be4c644cb10adf3e4fc45a4a79e0a
      https://github.com/llvm/llvm-project/commit/eebbfbcd500be4c644cb10adf3e4fc45a4a79e0a
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2022-06-06 (Mon, 06 Jun 2022)

  Changed paths:
    M libcxx/include/__format/format_context.h
    M libcxx/include/__format/formatter_floating_point.h
    M libcxx/include/__iterator/istream_iterator.h
    M libcxx/include/__iterator/ostream_iterator.h
    M libcxx/include/__iterator/ostreambuf_iterator.h

  Log Message:
  -----------
  [libc++][NFC] Add missing includes


Compare: https://github.com/llvm/llvm-project/compare/04d4130a5137...eebbfbcd500b


More information about the All-commits mailing list