[PATCH] D40144: Implement `std::launder`

2017-11-22 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists closed this revision. mclow.lists added a comment. landed as revision 318864 https://reviews.llvm.org/D40144 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D40144: Implement `std::launder`

2017-11-21 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists updated this revision to Diff 123877. mclow.lists added a comment. `_VSTD::` qualify the call to `__launder`. De-dup error messages in test. https://reviews.llvm.org/D40144 Files: include/__config include/new

[PATCH] D40144: Implement `std::launder`

2017-11-21 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments. Comment at: test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp:16 +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 +

[PATCH] D40144: Implement `std::launder`

2017-11-21 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added inline comments. Comment at: test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp:16 +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 +

[PATCH] D40144: Implement `std::launder`

2017-11-21 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments. Comment at: include/new:274 +{ +return __launder(__p); +} The call should probably be qualified to `_VSTD::__launder`. Comment at:

[PATCH] D40144: Implement `std::launder`

2017-11-20 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists updated this revision to Diff 123663. mclow.lists added a comment. Un-c++17'ed the internal function `__launder` https://reviews.llvm.org/D40144 Files: include/__config include/new test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp

[PATCH] D40144: Implement `std::launder`

2017-11-20 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added inline comments. Comment at: include/new:260 +static_assert (!is_function<_Tp>::value, "can't launder functions" ); +static_assert (!is_same_v>, "can't launder cv-void" ); +#ifdef _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER

[PATCH] D40144: Implement `std::launder`

2017-11-20 Thread Tim Song via Phabricator via cfe-commits
tcanens added inline comments. Comment at: include/new:260 +static_assert (!is_function<_Tp>::value, "can't launder functions" ); +static_assert (!is_same_v>, "can't launder cv-void" ); +#ifdef _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER

[PATCH] D40144: Implement `std::launder`

2017-11-20 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists updated this revision to Diff 123644. mclow.lists added a comment. Made an internal function `__launder` which is not c++17 specific. Fixed some wording for the standard asserts. https://reviews.llvm.org/D40144 Files: include/__config include/new

[PATCH] D40144: Implement `std::launder`

2017-11-18 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment. I've made an attempt to add `__builtin_launder` to clang in D40218 . https://reviews.llvm.org/D40144 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D40144: Implement `std::launder`

2017-11-18 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment. I think we may want a `__launder` function that we can use internally in all dialects. Comment at: include/__config:458 +#if __has_builtin(__builtin_launder) +#define_LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER +#endif These macros

[PATCH] D40144: Implement `std::launder`

2017-11-17 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists updated this revision to Diff 123422. mclow.lists marked an inline comment as done. mclow.lists added a comment. Move the `launder` function into the main libc++ namespace. Call `__builtin_launder` when available. Check to see when it's available (for gcc and clang)

[PATCH] D40144: Implement `std::launder`

2017-11-17 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists marked an inline comment as done. mclow.lists added inline comments. Comment at: include/new:174 +_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY +constexpr _Tp* launder(_Tp* __p) noexcept { return __p;} +#endif efriedma wrote: >

[PATCH] D40144: Implement `std::launder`

2017-11-16 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In https://reviews.llvm.org/D40144#927866, @hfinkel wrote: > In https://reviews.llvm.org/D40144#927828, @tcanens wrote: > > > At least for GCC, it should use `__builtin_launder`. > > > I presume we'll need to add something similar for Clang as well. Yes, we agreed to

[PATCH] D40144: Implement `std::launder`

2017-11-16 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment. In https://reviews.llvm.org/D40144#927828, @tcanens wrote: > At least for GCC, it should use `__builtin_launder`. I presume we'll need to add something similar for Clang as well. > Also needs to implement "The program is ill-formed if `T` is a function type > or

[PATCH] D40144: Implement `std::launder`

2017-11-16 Thread Tim Song via Phabricator via cfe-commits
tcanens added a comment. At least for GCC, it should use `__builtin_launder`. Also needs to implement "The program is ill-formed if `T` is a function type or //cv// `void`." https://reviews.llvm.org/D40144 ___ cfe-commits mailing list

[PATCH] D40144: Implement `std::launder`

2017-11-16 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments. Comment at: include/new:174 +_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY +constexpr _Tp* launder(_Tp* __p) noexcept { return __p;} +#endif efriedma wrote: > How is the compiler supposed to know that

[PATCH] D40144: Implement `std::launder`

2017-11-16 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments. Comment at: include/new:174 +_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY +constexpr _Tp* launder(_Tp* __p) noexcept { return __p;} +#endif How is the compiler supposed to know that "std::__1::launder()" has

[PATCH] D40144: Implement `std::launder`

2017-11-16 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments. Comment at: test/std/language.support/support.dynamic/ptr.launder/launder.fail.cpp:26 +int *p = nullptr; +std::launder(p); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +}

[PATCH] D40144: Implement `std::launder`

2017-11-16 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists created this revision. `std::launder` was introduced into c++17 as a compiler optimization barrier. It's something that the compiler 'knows about', and affects codegen. See https://wg21.link/p0137r1 for more. https://reviews.llvm.org/D40144 Files: include/new