[all-commits] [llvm/llvm-project] be4c65: [libc++] Consistently replace `::new(__p) T` with ...

Quuxplusone via All-commits all-commits at lists.llvm.org
Mon Dec 14 09:09:39 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: be4c657b010c3fd850ca5cfcee0f96b464740523
      https://github.com/llvm/llvm-project/commit/be4c657b010c3fd850ca5cfcee0f96b464740523
  Author: Arthur O'Dwyer <arthur.j.odwyer at gmail.com>
  Date:   2020-12-14 (Mon, 14 Dec 2020)

  Changed paths:
    M libcxx/include/__debug
    M libcxx/include/__functional_03
    M libcxx/include/algorithm
    M libcxx/include/functional
    M libcxx/include/future
    M libcxx/include/memory
    M libcxx/include/optional
    M libcxx/include/valarray
    A libcxx/test/std/algorithms/robust_against_adl_on_new.pass.cpp

  Log Message:
  -----------
  [libc++] Consistently replace `::new(__p) T` with `::new ((void*)__p) T`. NFCI.

Everywhere, normalize the whitespace to `::new (EXPR) T`.
Everywhere, normalize the spelling of the cast to `(void*)EXPR`.

Without the cast to `(void*)`, the expression triggers ADL on GCC.
(I think this is a GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98249)
Even if it doesn't trigger ADL, it still seems incorrect to use any argument
that's not exactly `(void*)` because that opens the possibility of overload
resolution picking a user-defined overload of `operator new`, which would be
wrong.

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


  Commit: 3c8e31e17b85c3d24ade9053d56c1998b4dd28cd
      https://github.com/llvm/llvm-project/commit/3c8e31e17b85c3d24ade9053d56c1998b4dd28cd
  Author: Arthur O'Dwyer <arthur.j.odwyer at gmail.com>
  Date:   2020-12-14 (Mon, 14 Dec 2020)

  Changed paths:
    M libcxx/include/__functional_base
    M libcxx/include/__functional_base_03
    M libcxx/include/functional
    A libcxx/test/std/utilities/function.objects/func.memfn/robust_against_adl.pass.cpp
    A libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/robust_against_adl.pass.cpp
    A libcxx/test/std/utilities/function.objects/refwrap/refwrap.invoke/robust_against_adl.pass.cpp

  Log Message:
  -----------
  [libc++] ADL-proof <functional> by adding _VSTD:: qualification on calls.

- std::reference_wrapper
- std::function
- std::mem_fn

While I'm here, remove _VSTD:: qualification from calls to `declval`
because it takes no arguments and thus isn't susceptible to ADL.

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


Compare: https://github.com/llvm/llvm-project/compare/640ad769110f...3c8e31e17b85


More information about the All-commits mailing list