[PATCH] D28933: Revert the return type for `emplace_(back|front)` to `void` in C++14 and before

2017-02-13 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists closed this revision.
mclow.lists added a comment.

Landed as r292990.


https://reviews.llvm.org/D28933



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28933: Revert the return type for `emplace_(back|front)` to `void` in C++14 and before

2017-01-24 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

Landed as revision 292990.


https://reviews.llvm.org/D28933



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29063: [libcxx] Never use within libc++

2017-01-23 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

this LGTM.   assert is not something we should have in the dylib.




Comment at: include/__config:827
 #   endif
+# if !defined(_LIBCPP_BUILDING_LIBRARY)
 #   define _LIBCPP_EXTERN_TEMPLATE(...)

Does this belong here?



https://reviews.llvm.org/D29063



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26110: Add a check for GCC to the _LIBCPP_EXPLICIT define

2017-01-23 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

Ok, this is weird. It looks like the changes to <__config> got committed, but 
not the test.


https://reviews.llvm.org/D26110



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28933: Revert the return type for `emplace_(back|front)` to `void` in C++14 and before

2017-01-19 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists created this revision.

In C++11/14, the return type of `emplace_front` and `emplace_back` was `void`. 
In http://wg21.link/p0084, Alan Talbot proposed changing the return type to 
return a reference to the newly created element.

We implemented that - but unilaterally. 
This changes that, so that the change is only realized when building for C++17 
or later.
This fixes https://llvm.org/bugs/show_bug.cgi?id=31680.


https://reviews.llvm.org/D28933

Files:
  include/deque
  include/forward_list
  include/list
  include/queue
  include/stack
  include/vector
  test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
  test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
  test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
  test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
  
test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
  test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
  test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
  test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp

Index: test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
===
--- test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
+++ test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
@@ -12,9 +12,11 @@
 //  vector.bool
 
 // template  reference emplace_back(Args&&... args);
+// return type is 'reference' in C++17; 'void' before
 
 #include 
 #include 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -21,8 +23,9 @@
 {
 {
 typedef std::vector C;
+C c;
+#if TEST_STD_VER > 14
 typedef C::reference Ref;
-C c;
 Ref r1 = c.emplace_back();
 assert(c.size() == 1);
 assert(c.front() == false);
@@ -36,19 +39,27 @@
 r2 = false;
 assert(c.back() == false);
 r2 = true;
-Ref r3 = c.emplace_back(1 == 1);
+#else
+c.emplace_back();
+assert(c.size() == 1);
+assert(c.front() == false);
+c.emplace_back(true);
+assert(c.size() == 2);
+assert(c.front() == false);
+assert(c.back() == true);
+#endif
+c.emplace_back(1 == 1);
 assert(c.size() == 3);
 assert(c.front() == false);
 assert(c[1] == true);
 assert(c.back() == true);
-r3 = false;
-assert(c.back() == false);
 }
 {
 typedef std::vector C;
-typedef C::reference Ref;
 C c;
 
+#if TEST_STD_VER > 14
+typedef C::reference Ref;
 Ref r1 = c.emplace_back();
 assert(c.size() == 1);
 assert(c.front() == false);
@@ -62,6 +73,15 @@
 r2 = false;
 assert(c.back() == false);
 r2 = true;
+#else
+c.emplace_back();
+assert(c.size() == 1);
+assert(c.front() == false);
+c.emplace_back(true);
+assert(c.size() == 2);
+assert(c.front() == false);
+assert(c.back() == true);
+#endif
 c.emplace_back(1 == 1);
 assert(c.size() == 3);
 assert(c.front() == false);
Index: test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
===
--- test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
+++ test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
@@ -12,9 +12,11 @@
 // 
 
 // template  reference emplace_back(Args&&... args);
+// return type is 'reference' in C++17; 'void' before
 
 #include 
 #include 
+#include "test_macros.h"
 #include "test_allocator.h"
 #include "min_allocator.h"
 #include "test_allocator.h"
@@ -56,6 +58,7 @@
 {
 {
 std::vector c;
+#if TEST_STD_VER > 14
 A& r1 = c.emplace_back(2, 3.5);
 assert(c.size() == 1);
 assert( == ());
@@ -65,8 +68,17 @@
 A& r2 = c.emplace_back(3, 4.5);
 assert(c.size() == 2);
 assert( == ());
+#else
+c.emplace_back(2, 3.5);
+assert(c.size() == 1);
 assert(c.front().geti() == 2);
 assert(c.front().getd() == 3.5);
+assert(is_contiguous_container_asan_correct(c));
+c.emplace_back(3, 4.5);
+assert(c.size() == 2);
+#endif
+assert(c.front().geti() == 2);
+assert(c.front().getd() == 3.5);
 assert(c.back().geti() == 3);
 assert(c.back().getd() == 4.5);
 assert(is_contiguous_container_asan_correct(c));
@@ -73,6 +85,7 @@
 }
 {
 std::vector > c;
+#if TEST_STD_VER > 14
 A& r1 = c.emplace_back(2, 3.5);
 assert(c.size() == 1);
 assert( == ());
@@ -82,8 +95,17 @@
 A& r2 = c.emplace_back(3, 

[PATCH] D28931: Disable aligned new/delete on Apple platforms without posix_memalign

2017-01-19 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


https://reviews.llvm.org/D28931



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20660: Remove `auto_ptr` in C++17.

2017-01-16 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists updated this revision to Diff 84593.
mclow.lists added a comment.

Updated the macro name.
Use REQUIRES-ALL
Found a couple more tests that needed to be updated.
Fixed the libcxx/test bit.


https://reviews.llvm.org/D20660

Files:
  include/memory
  test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
  test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp
  test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp
  test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp
  test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp
  test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp
  
test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp
  
test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp
  
test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp
  
test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp
  test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp
  test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp
  test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp
  test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp
  test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
  
test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp

Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
===
--- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
+++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
@@ -10,6 +10,7 @@
 // 
 
 // template explicit shared_ptr(auto_ptr&& r);
+// REQUIRES-ANY: c++98, c++03 c++11, c++14
 
 
 #include 
Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp
===
--- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp
+++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp
@@ -10,6 +10,7 @@
 // 
 
 // shared_ptr
+// REQUIRES-ANY: c++98, c++03 c++11, c++14
 
 // template shared_ptr& operator=(auto_ptr&& r);
 
Index: test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp
===
--- test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp
+++ test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp
@@ -9,7 +9,7 @@
 
 // libc++ cannot safely provide the auto_ptr constructor without rvalue
 // references.
-// XFAIL: c++98, c++03
+// REQUIRES-ANY: c++11, c++14
 
 // 
 
Index: test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
===
--- test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
+++ test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
@@ -17,6 +17,8 @@
 //   ...
 // };
 
+// REQUIRES-ANY: c++98, c++03, c++11, c++14
+
 #include 
 #include 
 
Index: test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp
===
--- test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp
+++ test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp
@@ -16,6 +16,8 @@
 #include 
 #include 
 
+// REQUIRES-ANY: c++98, c++03, c++11, c++14
+
 #include "../A.h"
 
 void
Index: test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp
===
--- test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp
+++ test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp
@@ -16,6 +16,8 @@
 #include 
 #include 
 
+// REQUIRES-ANY: c++98, c++03, c++11, c++14
+
 #include "../A.h"
 
 void
Index: test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp
===
--- test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp
+++ test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp
@@ -13,6 +13,8 @@
 
 // X& operator*() const throw();
 
+// REQUIRES-ANY: c++98, c++03, c++11, c++14
+
 #include 
 #include 
 
Index: 

[PATCH] D20660: Remove `auto_ptr` in C++17.

2017-01-16 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

> there's probably a better way to state `_LIBCPP_STD_VER <= 14 || 
> defined(_LIBCPP_NO_REMOVE_AUTO_PTR)`.

There probably is; but remember, we want to make it so someone can 
`-D_LIBCPP_NO_REMOVE_AUTO_PTR` on the command-line and get this back.

> I would love to have a semi-consistent naming scheme for macros which 
> re-enable removed C++17 features. Maybe `_LIBCPP_ENABLE_REMOVED_CXX17_FOO`

I like this: I'm using `_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR` now.




Comment at: test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp:26
+{
+std::shared_ptr p;
+}

D'oh!  `auto_ptr`


https://reviews.llvm.org/D20660



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24991: Inline hot functions in libcxx shared_ptr implementation.

2017-01-16 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added inline comments.



Comment at: libcxx/include/memory:3700
+
+template 
+inline T

`template `, please.

Otherwise when some client code does `#define T true` (yes, I've seen that!) 
this breaks.  `_Tp` is a reserved identifier, and if they use that, we can 
point at them and laugh.




Comment at: libcxx/include/memory:3702
+inline T
+__libcpp_atomic_refcount_increment(T& t) _NOEXCEPT
+{

The parameter name needs to be reserved as well. `__t`, please.



Comment at: libcxx/include/memory:3711
+
+template 
+inline T

Same comment as L3700



Comment at: libcxx/include/memory:3713
+inline T
+__libcpp_atomic_refcount_decrement(T& t) _NOEXCEPT
+{

Same comment as L3702


Repository:
  rL LLVM

https://reviews.llvm.org/D24991



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28473: Implement http://wg21.link/P0426 Constexpr for std::char_traits

2017-01-11 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a reviewer: mclow.lists.
mclow.lists added a comment.
This revision is now accepted and ready to land.

revision 291741


https://reviews.llvm.org/D28473



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28473: Implement http://wg21.link/P0426 Constexpr for std::char_traits

2017-01-09 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added inline comments.



Comment at: include/__string:261
+
+// inline _LIBCPP_CONSTEXPR_AFTER_CXX14
+// int

I will remove this block before committing.



https://reviews.llvm.org/D28473



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28473: Implement http://wg21.link/P0426 Constexpr for std::char_traits

2017-01-09 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists created this revision.
mclow.lists added reviewers: EricWF, rsmith.
mclow.lists added a subscriber: cfe-commits.

Make `assign`/`length`/`find`/`compare` for `std::char_traits` constexpr.

This makes using `string_view`s at compile time easier.

Use the compiler intrinsics when available.
Note that `__builtin_memchr` is not really appropriate, since it returns a 
`void *`.
Sadly, this turns a bunch of code into "a twisty little maze of ifdefs, all 
different", but oh well.


https://reviews.llvm.org/D28473

Files:
  include/__string
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/assign2.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/compare.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/find.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/length.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign2.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/compare.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/find.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/length.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/find.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/assign2.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/compare.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/find.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/length.pass.cpp

Index: test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/length.pass.cpp
===
--- test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/length.pass.cpp
+++ test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/length.pass.cpp
@@ -12,10 +12,21 @@
 // template<> struct char_traits
 
 // static size_t length(const char_type* s);
+// constexpr in C++17
 
 #include 
 #include 
 
+#include "test_macros.h"
+
+#if TEST_STD_VER > 14
+constexpr bool test_constexpr()
+{
+return std::char_traits::length(L"") == 0
+&& std::char_traits::length(L"abcd") == 4;
+}
+#endif
+
 int main()
 {
 assert(std::char_traits::length(L"") == 0);
@@ -23,4 +34,8 @@
 assert(std::char_traits::length(L"aa") == 2);
 assert(std::char_traits::length(L"aaa") == 3);
 assert(std::char_traits::length(L"") == 4);
+
+#if TEST_STD_VER > 14
+static_assert(test_constexpr(), "" );
+#endif
 }
Index: test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/find.pass.cpp
===
--- test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/find.pass.cpp
+++ test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/find.pass.cpp
@@ -12,10 +12,24 @@
 // template<> struct char_traits
 
 // static const char_type* find(const char_type* s, size_t n, const char_type& a);
+// constexpr in C++17
 
 #include 
 #include 
 
+#include "test_macros.h"
+
+#if TEST_STD_VER > 14
+constexpr bool test_constexpr()
+{
+constexpr const wchar_t *p = L"123";
+return std::char_traits::find(p, 3, L'1') == p
+&& std::char_traits::find(p, 3, L'2') == p + 1
+&& std::char_traits::find(p, 3, L'3') == p + 2
+&& std::char_traits::find(p, 3, L'4') == nullptr;
+}
+#endif
+
 int main()
 {
 wchar_t s1[] = {1, 2, 3};
@@ -25,4 +39,8 @@
 assert(std::char_traits::find(s1, 3, wchar_t(4)) == 0);
 assert(std::char_traits::find(s1, 3, wchar_t(0)) == 0);
 assert(std::char_traits::find(NULL, 0, wchar_t(0)) == 0);
+
+#if TEST_STD_VER > 14
+static_assert(test_constexpr(), "" );
+#endif
 }
Index: test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/compare.pass.cpp
===
--- 

[PATCH] D26667: Teach clang that 'sv' is a fine literal suffix

2017-01-09 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists abandoned this revision.
mclow.lists added a comment.

This was resolved by https://reviews.llvm.org/D26829


https://reviews.llvm.org/D26667



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28131: [libcxx] Fix PR31402: map::__find_equal_key has undefined behavior.

2017-01-05 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added inline comments.



Comment at: include/__tree:1400
 __parent_pointer& __parent, const key_type& __v);
+// FIXME: Make this function const qualified. Unfortunetly doing so
+// breaks existing code which uses non-const callable comparators.

Didn't we address this in http://wg21.link/LWG2542 ?



https://reviews.llvm.org/D28131



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28253: static_assert inside make_shared when the object is not constructible

2017-01-03 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists created this revision.
mclow.lists added a reviewer: EricWF.
mclow.lists added a subscriber: cfe-commits.

http://llvm.org/show_bug.cgi?id=28929 shows a scenario where `make_shared` of a 
class with a protected constructor compiles successfully (it should fail).

This is because we apply an empty-base class optimization to the shared_ptr.

This is one way to solve the problem; there are probably others.
However, this works, and passes all the tests (including the two new ones I 
just added).


https://reviews.llvm.org/D28253

Files:
  include/memory
  test/libcxx/test/config.py
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp

Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp
===
--- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp
+++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp
@@ -0,0 +1,29 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// shared_ptr
+
+// template shared_ptr make_shared(Args&&... args);
+
+#include 
+#include 
+
+#include "test_macros.h"
+
+struct S {
+protected:
+   S () {};  // ctor is protected
+};
+
+int main()
+{
+std::shared_ptr p = std::make_shared();
+}
Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp
===
--- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp
+++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp
@@ -0,0 +1,29 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// shared_ptr
+
+// template shared_ptr make_shared(Args&&... args);
+
+#include 
+#include 
+
+#include "test_macros.h"
+
+struct S {
+private:
+   S () {};  // ctor is private
+};
+
+int main()
+{
+std::shared_ptr p = std::make_shared();
+}
Index: test/libcxx/test/config.py
===
--- test/libcxx/test/config.py
+++ test/libcxx/test/config.py
@@ -412,6 +412,8 @@
 self.lit_config.fatal("cxx_headers='%s' is not a directory."
   % cxx_headers)
 self.cxx.compile_flags += ['-I' + cxx_headers]
+if self.libcxx_obj_root is None:
+return
 cxxabi_headers = os.path.join(self.libcxx_obj_root, 'include', 'c++-build')
 if os.path.isdir(cxxabi_headers):
 self.cxx.compile_flags += ['-I' + cxxabi_headers]
Index: include/memory
===
--- include/memory
+++ include/memory
@@ -4435,6 +4435,7 @@
 shared_ptr<_Tp>
 shared_ptr<_Tp>::make_shared(_Args&& ...__args)
 {
+static_assert( is_constructible<_Tp, _Args...>::value, "Can't construct object in make_shared" );
 typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
 typedef allocator<_CntrlBlk> _A2;
 typedef __allocator_destructor<_A2> _D2;
@@ -4453,6 +4454,7 @@
 shared_ptr<_Tp>
 shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args)
 {
+static_assert( is_constructible<_Tp, _Args...>::value, "Can't construct object in allocate_shared" );
 typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
 typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
 typedef __allocator_destructor<_A2> _D2;
@@ -4473,6 +4475,7 @@
 shared_ptr<_Tp>
 shared_ptr<_Tp>::make_shared()
 {
+static_assert((is_constructible<_Tp>::value), "Can't construct object in make_shared" );
 typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
 typedef allocator<_CntrlBlk> _Alloc2;
 typedef __allocator_destructor<_Alloc2> _D2;
@@ -4491,6 +4494,7 @@
 shared_ptr<_Tp>
 shared_ptr<_Tp>::make_shared(_A0& __a0)
 {
+static_assert((is_constructible<_Tp, _A0>::value), "Can't construct object in 

[PATCH] D28253: static_assert inside make_shared when the object is not constructible

2017-01-03 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added inline comments.



Comment at: test/libcxx/test/config.py:415
 self.cxx.compile_flags += ['-I' + cxx_headers]
+if self.libcxx_obj_root is None:
+return

Whoops. This change doesn't belong here.
But it fixes a problem running LIT to test libc++ on Mac OS when building with 
the system libc++abi.



https://reviews.llvm.org/D28253



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28223: clean up use of _WIN32

2017-01-03 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

LGTM.  My comment is a suggestion, not a requirement.




Comment at: include/support/win32/support.h:112
 // Search from LSB to MSB for first set bit.
 // Returns zero if no set bit is found.
+#if (defined(_M_ARM) || defined(__arm__)) ||   
\

I would be tempted to add another macro here. Something like:

#if (defined(_M_ARM) || defined(__arm__)) || \
  (defined(_M_AMD64) || defined(__x86_64__))
#define _LIBCPP_WIN_HAS_BITSCAN
#endif

to avoid repeating the "four-armed combo"


Repository:
  rL LLVM

https://reviews.llvm.org/D28223



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28223: clean up use of _WIN32

2017-01-03 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

I like this.  A lot.

I'm a bit concerned about @smeenai 's comments about __LP64_, and @EricWF 's 
comment about solaris.

This patch accomplishes (or maybe just moves closer, I need to check) to a goal 
of mine, which is to have no references to `_WIN32` in any header files other 
that `<__config>` (and maybe in support/)


Repository:
  rL LLVM

https://reviews.llvm.org/D28223



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28217: [libc++] Overallocation of am_pm array in locale.cpp

2017-01-03 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

This looks fine to me.  
All the other places that use this (or related functionality) have a rank of 2.

Interestingly enough, this has been there since "the beginning of time" (the 
initial import of libc++ into the LLVM subversion repo)


https://reviews.llvm.org/D28217



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27429: [Chrono][Darwin] On Darwin use CLOCK_UPTIME_RAW instead of CLOCK_MONOTONIC

2016-12-09 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

I agree with @EricWF .   If `CLOCK_UPTIME_RAW` doesn't meet the requirements of 
`steady_clock`  (i.e, monotonically increasing, and advances in real time), 
then we can't use it.


https://reviews.llvm.org/D27429



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27436: [libcxx] [test] std::get<0>([std::variant constant expression]) *is* noexcept

2016-12-05 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.

I'd appreciate it if someone made a note to revisit this test when the clang 
bug is fixed, and change the `#ifndef __clang__ ` to something like `#ifndef 
__clang__ || clang_version < `".

This LGTM.


https://reviews.llvm.org/D27436



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27068: Improve string::find

2016-12-02 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

This is starting to look good.




Comment at: libcxx/include/__string:549
+// Stop short when source is smaller than pattern.
+ptrdiff_t __len2 = __last2 - __first2;
+if (__len2 == 0)

Is there a reason that you calculate the end pointer(s) from `first + len` in 
the calling function, then recover the length here?

Also, `__len1` and `__len2` should be const.


https://reviews.llvm.org/D27068



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27254: Protect optional test under libcpp-no-exceptions

2016-11-30 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

Looks good now - thanks.


https://reviews.llvm.org/D27254



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27199: [libcxx] Make std::ignore constexpr

2016-11-30 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

This looks good to me.


https://reviews.llvm.org/D27199



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27253: Protect futures test under libcpp-no-exceptions

2016-11-30 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D27253



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27254: Protect optional test under libcpp-no-exceptions

2016-11-30 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added inline comments.



Comment at: test/std/experimental/optional/optional.specalg/swap.pass.cpp:225
 }
+#ifndef TEST_HAS_NO_EXCEPTIONS
 {

Why is this here, and not before line L#236?


https://reviews.llvm.org/D27254



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27255: Protect std::ostream::sentry test under libcpp-no-exceptions

2016-11-30 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D27255



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27252: Protect sequences test under libcpp-no-exceptions

2016-11-30 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

LGTM>


https://reviews.llvm.org/D27252



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26991: Hoist redundant load

2016-11-29 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists requested changes to this revision.
mclow.lists added inline comments.
This revision now requires changes to proceed.



Comment at: libcxx/include/algorithm:1499
+// Load the first element from __first2 outside the loop because it is 
loop invariant
+typename iterator_traits<_RandomAccessIterator1>::value_type 
__firstElement2 = *__first2;
+

I just realized that we can't do this.
This imposes a requirement that the `value_type` be copy-constructible.

With this in place, we can't search a sequence of move-only types.


https://reviews.llvm.org/D26991



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26991: Hoist redundant load

2016-11-28 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

This looks fine to me - though I wonder if the compiler can hoist `*__first2` 
w/o us helping it.


https://reviews.llvm.org/D26991



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26991: Hoist redundant load

2016-11-28 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

There are no uses of `_LIBCPP_UNROLL_LOOPS` in LLVM (other than the ones in 
``.

Googling for `_LIBCPP_UNROLL_LOOPS` on github finds the ones in libc++, and no 
others.
I think I'll just take it out, and see what happens.


https://reviews.llvm.org/D26991



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26612: Protect std::string tests under libcpp-no-exceptions

2016-11-28 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks.


https://reviews.llvm.org/D26612



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26611: Protect test for dynarray under libcpp-no-exceptions

2016-11-28 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D26611



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27095: Protect std::array tests under noexceptions

2016-11-28 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

Other than the missing `assert`s, (which are not your fault, but I would 
appreciate you fixing) this LGTM.




Comment at: test/std/containers/sequences/array/at.pass.cpp:43
+#ifndef TEST_HAS_NO_EXCEPTIONS
 try { (void) c.at(3); }
 catch (const std::out_of_range &) {}

we should really have an `assert(false);` after the call to `at` - to make sure 
that it actually throws.

Here and below.



https://reviews.llvm.org/D27095



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27093: Protect std::{, unordered_}map tests under noexceptions

2016-11-28 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D27093



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27096: Protect locale tests under noexceptions

2016-11-28 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

This LGTM.


https://reviews.llvm.org/D27096



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26896: [libcxx] Make constexpr char_traits and char_traits

2016-11-28 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added inline comments.



Comment at: include/__string:213
 
-static inline int compare(const char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT
-{return __n == 0 ? 0 : memcmp(__s1, __s2, __n);}
-static inline size_t length(const char_type* __s)  _NOEXCEPT {return 
strlen(__s);}
-static inline const char_type* find(const char_type* __s, size_t __n, 
const char_type& __a) _NOEXCEPT
-{return __n == 0 ? NULL : (const char_type*) memchr(__s, 
to_int_type(__a), __n);}
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
+static inline constexpr int

AntonBikineev wrote:
> EricWF wrote:
> > wow. This is #ifdef hell. Please find a way to do it with less (or 
> > hopefully no) conditional compilation blocks.
> yep, this is generic hell. I want to cover as many cases as possible, i.e. 
> combinations of (is_constexpr x has_builtin_xxx) for every function. I'm open 
> to suggestions
How about (for compare, say) you just forget about `memcmp`.  Either call 
`__builtin_memcmp` if it is available, or use a hand-rolled loop.

Note: gcc has had `__builtin_memcmp` since at least 4.8. (and it is constexpr)

And just mark the function with `_LIBCPP_CONSTEXPR_AFTER_CXX14`.


https://reviews.llvm.org/D26896



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26991: Hoist redundant load

2016-11-28 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

__search is the only place where `_LIBCPP_UNROLL_LOOPS` is currently used.


https://reviews.llvm.org/D26991



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26991: Hoist redundant load

2016-11-28 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

/me wonders what the perf difference when `_LIBCPP_UNROLL_LOOPS` is defined or  
not.

I think this (`_LIBCPP_UNROLL_LOOPS`) falls squarely into Chandler's request 
that we complain to him when the compiler generates sub-optimal code, instead 
of doing things like manually unrolling loops.


https://reviews.llvm.org/D26991



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27068: Improve string::find

2016-11-28 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

Definitely want to see numbers.


https://reviews.llvm.org/D27068



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


<    1   2   3   4   5