[libcxx] r300417 - Cleanup one more test

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 23:05:15 2017
New Revision: 300417

URL: http://llvm.org/viewvc/llvm-project?rev=300417=rev
Log:
Cleanup one more  test

Removed:

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp
Modified:

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp

Removed: 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp?rev=300416=auto
==
--- 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp
 (removed)
@@ -1,35 +0,0 @@
-//===--===//
-//
-// 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.
-//
-//===--===//
-
-// 
-
-// explicit forward_list(size_type n);
-
-#include 
-#include 
-
-#include "DefaultOnly.h"
-
-int main()
-{
-{
-typedef DefaultOnly T;
-typedef std::forward_list C;
-unsigned N = 10;
-C c = N;
-unsigned n = 0;
-for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-assert(*i == T());
-#else
-;
-#endif
-assert(n == N);
-}
-}

Modified: 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp?rev=300417=300416=300417=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
 Sat Apr 15 23:05:15 2017
@@ -36,6 +36,11 @@ void check_allocator(unsigned n, Allocat
 
 int main()
 {
+{ // test that the ctor is explicit
+  typedef std::forward_list C;
+  static_assert((std::is_constructible::value), "");
+  static_assert((!std::is_convertible::value), "");
+}
 {
 typedef DefaultOnly T;
 typedef std::forward_list C;


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


[libcxx] r300415 - Replace _LIBCPP_HAS_NO_<C++03 feature> with _LIBCPP_CXX03_LANG in

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 23:02:01 2017
New Revision: 300415

URL: http://llvm.org/viewvc/llvm-project?rev=300415=rev
Log:
Replace _LIBCPP_HAS_NO_ with _LIBCPP_CXX03_LANG in 

Modified:
libcxx/trunk/include/forward_list

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp

Modified: libcxx/trunk/include/forward_list
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/forward_list?rev=300415=300414=300415=diff
==
--- libcxx/trunk/include/forward_list (original)
+++ libcxx/trunk/include/forward_list Sat Apr 15 23:02:01 2017
@@ -478,14 +478,14 @@ protected:
 __forward_list_base(const allocator_type& __a)
 : __before_begin_(__begin_node(), __node_allocator(__a)) {}
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
 public:
 _LIBCPP_INLINE_VISIBILITY
 __forward_list_base(__forward_list_base&& __x)
 _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
 _LIBCPP_INLINE_VISIBILITY
 __forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif  // _LIBCPP_CXX03_LANG
 
 private:
 __forward_list_base(const __forward_list_base&);
@@ -539,7 +539,7 @@ private:
 {__alloc() = _VSTD::move(__x.__alloc());}
 };
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
 
 template 
 inline
@@ -563,7 +563,7 @@ __forward_list_base<_Tp, _Alloc>::__forw
 }
 }
 
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif  // _LIBCPP_CXX03_LANG
 
 template 
 __forward_list_base<_Tp, _Alloc>::~__forward_list_base()
@@ -656,32 +656,33 @@ public:
  >::type* = nullptr);
 forward_list(const forward_list& __x);
 forward_list(const forward_list& __x, const allocator_type& __a);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+forward_list& operator=(const forward_list& __x);
+
+#ifndef _LIBCPP_CXX03_LANG
 _LIBCPP_INLINE_VISIBILITY
 forward_list(forward_list&& __x)
 _NOEXCEPT_(is_nothrow_move_constructible::value)
 : base(_VSTD::move(__x)) {}
 forward_list(forward_list&& __x, const allocator_type& __a);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
 forward_list(initializer_list __il);
 forward_list(initializer_list __il, const allocator_type& __a);
-#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
-// ~forward_list() = default;
-
-forward_list& operator=(const forward_list& __x);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 _LIBCPP_INLINE_VISIBILITY
 forward_list& operator=(forward_list&& __x)
 _NOEXCEPT_(
  __node_traits::propagate_on_container_move_assignment::value &&
  is_nothrow_move_assignable::value);
-#endif
-#ifndef  _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
 _LIBCPP_INLINE_VISIBILITY
 forward_list& operator=(initializer_list __il);
-#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+_LIBCPP_INLINE_VISIBILITY
+void assign(initializer_list __il);
+#endif  // _LIBCPP_CXX03_LANG
+
+// ~forward_list() = default;
 
 template 
 typename enable_if
@@ -691,10 +692,6 @@ public:
 >::type
 assign(_InputIterator __f, _InputIterator __l);
 void assign(size_type __n, const value_type& __v);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-_LIBCPP_INLINE_VISIBILITY
-void assign(initializer_list __il);
-#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
 _LIBCPP_INLINE_VISIBILITY
 allocator_type get_allocator() const _NOEXCEPT
@@ -745,27 +742,26 @@ public:
 _LIBCPP_INLINE_VISIBILITY
 const_reference front() const {return 
base::__before_begin()->__next_->__value_;}
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
 #if _LIBCPP_STD_VER > 14
 

[libcxx] r300414 - Replace _LIBCPP_HAS_NO_<C++03 feature> with _LIBCPP_CXX03_LANG in

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 22:45:35 2017
New Revision: 300414

URL: http://llvm.org/viewvc/llvm-project?rev=300414=rev
Log:
Replace _LIBCPP_HAS_NO_ with _LIBCPP_CXX03_LANG in 

Modified:
libcxx/trunk/include/list

libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp

Modified: libcxx/trunk/include/list
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/list?rev=300414=300413=300414=diff
==
--- libcxx/trunk/include/list (original)
+++ libcxx/trunk/include/list Sat Apr 15 22:45:35 2017
@@ -860,11 +860,10 @@ public:
 list(const list& __c, const allocator_type& __a);
 _LIBCPP_INLINE_VISIBILITY
 list& operator=(const list& __c);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
 list(initializer_list __il);
 list(initializer_list __il, const allocator_type& __a);
-#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
 _LIBCPP_INLINE_VISIBILITY
 list(list&& __c)
 _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
@@ -875,22 +874,20 @@ public:
 _NOEXCEPT_(
 __node_alloc_traits::propagate_on_container_move_assignment::value 
&&
 is_nothrow_move_assignable<__node_allocator>::value);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
 _LIBCPP_INLINE_VISIBILITY
 list& operator=(initializer_list __il)
 {assign(__il.begin(), __il.end()); return *this;}
-#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+_LIBCPP_INLINE_VISIBILITY
+void assign(initializer_list __il)
+{assign(__il.begin(), __il.end());}
+#endif  // _LIBCPP_CXX03_LANG
 
 template 
 void assign(_InpIter __f, _InpIter __l,
  typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 
0);
 void assign(size_type __n, const value_type& __x);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-_LIBCPP_INLINE_VISIBILITY
-void assign(initializer_list __il)
-{assign(__il.begin(), __il.end());}
-#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
 _LIBCPP_INLINE_VISIBILITY
 allocator_type get_allocator() const _NOEXCEPT;
@@ -964,10 +961,10 @@ public:
 return base::__end_.__prev_->__as_node()->__value_;
 }
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
 void push_front(value_type&& __x);
 void push_back(value_type&& __x);
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+
 template 
 #if _LIBCPP_STD_VER > 14
reference emplace_front(_Args&&... __args);
@@ -982,9 +979,13 @@ public:
 #endif
 template 
 iterator emplace(const_iterator __p, _Args&&... __args);
-#endif  // _LIBCPP_HAS_NO_VARIADICS
+
 iterator insert(const_iterator __p, value_type&& __x);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+_LIBCPP_INLINE_VISIBILITY
+iterator insert(const_iterator __p, initializer_list __il)
+{return insert(__p, __il.begin(), __il.end());}
+#endif  // _LIBCPP_CXX03_LANG
 
 void push_front(const value_type& __x);
 void push_back(const value_type& __x);
@@ -994,11 +995,6 @@ public:
 template 
 iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,
  typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 
0);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-_LIBCPP_INLINE_VISIBILITY
-iterator insert(const_iterator __p, initializer_list __il)
-{return insert(__p, __il.begin(), __il.end());}
-#endif   // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
 _LIBCPP_INLINE_VISIBILITY
 void swap(list& __c)
@@ -1022,22 +1018,18 @@ public:
 void resize(size_type __n, const value_type& __x);
 
 void splice(const_iterator __p, list& __c);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
 _LIBCPP_INLINE_VISIBILITY
 void splice(const_iterator __p, list&& __c) {splice(__p, __c);}
-#endif
-void splice(const_iterator __p, list& __c, const_iterator __i);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 _LIBCPP_INLINE_VISIBILITY
 void 

[libcxx] r300413 - Replace _LIBCPP_HAS_NO_<C++03 feature> with _LIBCPP_CXX03_LANG in deque

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 22:17:01 2017
New Revision: 300413

URL: http://llvm.org/viewvc/llvm-project?rev=300413=rev
Log:
Replace _LIBCPP_HAS_NO_ with _LIBCPP_CXX03_LANG in deque

Modified:
libcxx/trunk/include/deque

libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp

Modified: libcxx/trunk/include/deque
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/deque?rev=300413=300412=300413=diff
==
--- libcxx/trunk/include/deque (original)
+++ libcxx/trunk/include/deque Sat Apr 15 22:17:01 2017
@@ -968,13 +968,12 @@ protected:
 public:
 ~__deque_base();
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+#ifndef _LIBCPP_CXX03_LANG
 __deque_base(__deque_base&& __c)
 _NOEXCEPT_(is_nothrow_move_constructible::value);
 __deque_base(__deque_base&& __c, const allocator_type& __a);
+#endif  // _LIBCPP_CXX03_LANG
 
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 void swap(__deque_base& __c)
 #if _LIBCPP_STD_VER >= 14
 _NOEXCEPT;
@@ -1108,7 +1107,7 @@ __deque_base<_Tp, _Allocator>::~__deque_
 __alloc_traits::deallocate(__alloc(), *__i, __block_size);
 }
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
 
 template 
 __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c)
@@ -1140,7 +1139,7 @@ __deque_base<_Tp, _Allocator>::__deque_b
 }
 }
 
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif  // _LIBCPP_CXX03_LANG
 
 template 
 void
@@ -1230,18 +1229,16 @@ public:
   typename 
enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);
 deque(const deque& __c);
 deque(const deque& __c, const allocator_type& __a);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+deque& operator=(const deque& __c);
+
+#ifndef _LIBCPP_CXX03_LANG
 deque(initializer_list __il);
 deque(initializer_list __il, const allocator_type& __a);
-#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
-deque& operator=(const deque& __c);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 _LIBCPP_INLINE_VISIBILITY
 deque& operator=(initializer_list __il) {assign(__il); return 
*this;}
-#endif   // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 _LIBCPP_INLINE_VISIBILITY
 deque(deque&& __c) 
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
 _LIBCPP_INLINE_VISIBILITY
@@ -1250,7 +1247,10 @@ public:
 deque& operator=(deque&& __c)
 
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable::value);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+_LIBCPP_INLINE_VISIBILITY
+void assign(initializer_list __il) {assign(__il.begin(), 
__il.end());}
+#endif  // _LIBCPP_CXX03_LANG
 
 template 
 void assign(_InputIter __f, _InputIter __l,
@@ -1260,10 +1260,6 @@ public:
 void assign(_RAIter __f, _RAIter __l,
 typename 
enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
 void assign(size_type __n, const value_type& __v);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-_LIBCPP_INLINE_VISIBILITY
-void assign(initializer_list __il) {assign(__il.begin(), 
__il.end());}
-#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
 _LIBCPP_INLINE_VISIBILITY
 allocator_type get_allocator() const _NOEXCEPT;
@@ -1340,8 +1336,7 @@ public:
 // 23.2.2.3 modifiers:
 void push_front(const value_type& __v);
 void push_back(const value_type& __v);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
 #if _LIBCPP_STD_VER > 14
 template  reference emplace_front(_Args&&... __args);
 template  reference emplace_back (_Args&&... __args);
@@ -1350,11 +1345,16 @@ public:
 template  void  emplace_back (_Args&&... __args);
 #endif
 template  iterator emplace(const_iterator __p, _Args&&... 
__args);
-#endif  // _LIBCPP_HAS_NO_VARIADICS
+
 void push_front(value_type&& __v);
 void push_back(value_type&& 

[libcxx] r300412 - Replace _LIBCPP_HAS_NO_<C++03 feature> with _LIBCPP_CXX03_LANG in

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 21:50:40 2017
New Revision: 300412

URL: http://llvm.org/viewvc/llvm-project?rev=300412=rev
Log:
Replace _LIBCPP_HAS_NO_ with _LIBCPP_CXX03_LANG in 

Modified:
libcxx/trunk/include/array
libcxx/trunk/test/std/containers/sequences/array/array.size/size.pass.cpp

Modified: libcxx/trunk/include/array
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/array?rev=300412=300411=300412=diff
==
--- libcxx/trunk/include/array (original)
+++ libcxx/trunk/include/array Sat Apr 15 21:50:40 2017
@@ -316,7 +316,7 @@ get(const array<_Tp, _Size>& __a) _NOEXC
 return __a.__elems_[_Ip];
 }
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -336,7 +336,7 @@ get(const array<_Tp, _Size>&& __a) _NOEX
 return _VSTD::move(__a.__elems_[_Ip]);
 }
 
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif  // !_LIBCPP_CXX03_LANG
 
 _LIBCPP_END_NAMESPACE_STD
 

Modified: 
libcxx/trunk/test/std/containers/sequences/array/array.size/size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.size/size.pass.cpp?rev=300412=300411=300412=diff
==
--- libcxx/trunk/test/std/containers/sequences/array/array.size/size.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/sequences/array/array.size/size.pass.cpp 
Sat Apr 15 21:50:40 2017
@@ -14,6 +14,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 // std::array is explicitly allowed to be initialized with A a = { init-list 
};.
 // Disable the missing braces warning for this reason.
 #include "disable_missing_braces_warning.h"
@@ -36,7 +38,7 @@ int main()
 assert(c.max_size() == 0);
 assert(c.empty());
 }
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+#if TEST_STD_VER >= 11
 {
 typedef double T;
 typedef std::array C;


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


[libcxx] r300411 - Workaround Clang bug regarding template template parameters

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 21:47:46 2017
New Revision: 300411

URL: http://llvm.org/viewvc/llvm-project?rev=300411=rev
Log:
Workaround Clang bug regarding template template parameters

Modified:

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp?rev=300411=300410=300411=diff
==
--- 
libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp
 Sat Apr 15 21:47:46 2017
@@ -46,17 +46,23 @@ using EnableIfNotSame = typename std::en
 !std::is_same::type, typename 
std::decay::type>::value
 >::type;
 
-template  class Templ, class Other>
-struct is_specialization : std::false_type {};
+template 
+struct is_specialization;
 
-template  class Templ, int ID>
-struct is_specialization : std::true_type {};
+template  class Templ, int ID1, class Other>
+struct is_specialization : std::false_type {};
 
-template  class Templ, class Other>
+template  class Templ, int ID1, int ID2>
+struct is_specialization : std::true_type {};
+
+template 
 using EnableIfSpecialization = typename std::enable_if<
 is_specialization::value
   >::type;
 
+template  struct TrackingDeleter;
+template  struct ConstTrackingDeleter;
+
 template 
 struct TrackingDeleter {
   TrackingDeleter() : arg_type(<>()) {}


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


[libcxx] r300410 - Replace _LIBCPP_HAS_NO_<C++03 feature> with _LIBCPP_CXX03_LANG in vector.

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 21:40:45 2017
New Revision: 300410

URL: http://llvm.org/viewvc/llvm-project?rev=300410=rev
Log:
Replace _LIBCPP_HAS_NO_ with _LIBCPP_CXX03_LANG in vector.

This patch cleans up all usages of the following feature test macros inside
 and its tests:

* _LIBCPP_HAS_NO_RVALUE_REFERENCES
* _LIBCPP_HAS_NO_VARIADICS
* _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS

Where needed the above guards were replaced with _LIBCPP_CXX03_LANG.

Modified:
libcxx/trunk/include/vector

libcxx/trunk/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp
libcxx/trunk/test/std/containers/sequences/vector.bool/assign_move.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp
libcxx/trunk/test/std/containers/sequences/vector.bool/move.pass.cpp
libcxx/trunk/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp
libcxx/trunk/test/std/containers/sequences/vector/vector.cons/move.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp

Modified: libcxx/trunk/include/vector
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=300410=300409=300410=diff
==
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Sat Apr 15 21:40:45 2017
@@ -527,12 +527,7 @@ public:
  is_constructible<
 value_type,
 typename 
iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-_LIBCPP_INLINE_VISIBILITY
-vector(initializer_list __il);
-_LIBCPP_INLINE_VISIBILITY
-vector(initializer_list __il, const allocator_type& __a);
-#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
 #if _LIBCPP_DEBUG_LEVEL >= 2
 _LIBCPP_INLINE_VISIBILITY
 ~vector()
@@ -545,7 +540,14 @@ public:
 vector(const vector& __x, const allocator_type& __a);
 _LIBCPP_INLINE_VISIBILITY
 vector& operator=(const vector& __x);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_CXX03_LANG
+_LIBCPP_INLINE_VISIBILITY
+vector(initializer_list __il);
+
+_LIBCPP_INLINE_VISIBILITY
+vector(initializer_list __il, const allocator_type& __a);
+
 _LIBCPP_INLINE_VISIBILITY
 vector(vector&& __x)
 #if _LIBCPP_STD_VER > 14
@@ -553,17 +555,18 @@ public:
 #else
 _NOEXCEPT_(is_nothrow_move_constructible::value);
 #endif
+
 _LIBCPP_INLINE_VISIBILITY
 vector(vector&& __x, const allocator_type& __a);
 _LIBCPP_INLINE_VISIBILITY
 vector& operator=(vector&& __x)
 _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, 
__alloc_traits>::value));
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
 _LIBCPP_INLINE_VISIBILITY
 vector& operator=(initializer_list __il)
 {assign(__il.begin(), __il.end()); return *this;}
-#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#endif  // !_LIBCPP_CXX03_LANG
 
 template 
 typename enable_if
@@ -588,11 +591,12 @@ public:
 assign(_ForwardIterator __first, _ForwardIterator __last);
 
 void assign(size_type __n, const_reference __u);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_CXX03_LANG
 _LIBCPP_INLINE_VISIBILITY
 void assign(initializer_list __il)
 {assign(__il.begin(), __il.end());}
-#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif
 
 _LIBCPP_INLINE_VISIBILITY
 allocator_type get_allocator() const _NOEXCEPT
@@ -676,9 +680,10 @@ public:
 {return _VSTD::__to_raw_pointer(this->__begin_);}
 
 _LIBCPP_INLINE_VISIBILITY void push_back(const_reference 

[libcxx] r300409 - [CMake][libcxx] Fix the --target and --gcc-toolchain flag handling

2017-04-15 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Sat Apr 15 21:25:55 2017
New Revision: 300409

URL: http://llvm.org/viewvc/llvm-project?rev=300409=rev
Log:
[CMake][libcxx] Fix the --target and --gcc-toolchain flag handling

CMake has the problem with the single dash variant because of the
space, so use the double dash with equal sign version. We also
don't have to pass the target triple when checking for compiler-rt
since that flag is already included in compile flags now.

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

Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=300409=300408=300409=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Sat Apr 15 21:25:55 2017
@@ -370,9 +370,9 @@ include(HandleLibcxxFlags)
 # 'config-ix' use them during feature checks. It also adds them to both
 # 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'
 add_target_flags_if(LIBCXX_BUILD_32_BITS "-m32")
-add_target_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
+add_target_flags_if(LIBCXX_TARGET_TRIPLE "--target=${LIBCXX_TARGET_TRIPLE}")
 add_target_flags_if(LIBCXX_SYSROOT "--sysroot=${LIBCXX_SYSROOT}")
-add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain 
${LIBCXX_GCC_TOOLCHAIN}")
+add_target_flags_if(LIBCXX_GCC_TOOLCHAIN 
"--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
 if (LIBCXX_TARGET_TRIPLE)
   set(TARGET_TRIPLE "${LIBCXX_TARGET_TRIPLE}")
 endif()

Modified: libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=300409=300408=300409=diff
==
--- libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake (original)
+++ libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake Sat Apr 15 21:25:55 2017
@@ -3,7 +3,7 @@ function(find_compiler_rt_library name d
 message(FATAL_ERROR "LIBCXX_COMPILE_FLAGS must be defined when using this 
function")
   endif()
   set(dest "" PARENT_SCOPE)
-  set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${TARGET_TRIPLE} 
${LIBCXX_COMPILE_FLAGS}
+  set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS}
   "--rtlib=compiler-rt" "--print-libgcc-file-name")
   if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_CXX_COMPILER_TARGET)
 list(APPEND CLANG_COMMAND "--target=${CMAKE_CXX_COMPILER_TARGET}")


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


[libcxx] r300408 - Cleanup and better scope unique_ptr internals

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 21:14:31 2017
New Revision: 300408

URL: http://llvm.org/viewvc/llvm-project?rev=300408=rev
Log:
Cleanup and better scope unique_ptr internals

Modified:
libcxx/trunk/include/memory

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=300408=300407=300408=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Sat Apr 15 21:14:31 2017
@@ -2342,19 +2342,19 @@ private:
   struct __nat { int __for_bool_; };
 
 #ifndef _LIBCPP_CXX03_LANG
-  typedef __unique_ptr_deleter_sfinae<_Dp> _SFINAE;
+  typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
 
   template 
   using _LValRefType =
-  typename __dependent_type<_SFINAE, _Dummy>::__lval_ref_type;
+  typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
 
   template 
   using _GoodRValRefType =
-  typename __dependent_type<_SFINAE, _Dummy>::__good_rval_ref_type;
+  typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
 
   template 
   using _BadRValRefType =
-  typename __dependent_type<_SFINAE, _Dummy>::__bad_rval_ref_type;
+  typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
 
   template , _Dummy>::type>
@@ -2587,17 +2587,6 @@ public:
   }
 };
 
-template 
-struct __check_array_pointer_conversion : is_same<_From, typename 
_ToUnique::pointer> {};
-
-template 
-struct __check_array_pointer_conversion<_FromElem*, _ToUnique>
-: integral_constant::value ||
-  (is_same::value &&
-   is_convertible<_FromElem(*)[], typename 
_ToUnique::element_type(*)[]>::value)
->
-{};
 
 template 
 class _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> {
@@ -2609,26 +2598,32 @@ public:
 private:
   __compressed_pair __ptr_;
 
-  struct __nat { int __for_bool_; };
+  template 
+  struct _CheckArrayPointerConversion : is_same<_From, pointer> {};
 
-  typedef deleter_type& _Dp_reference;
-  typedef typename remove_reference::type>::type&
-  _Dp_const_reference;
+  template 
+  struct _CheckArrayPointerConversion<_FromElem*>
+  : integral_constant::value ||
+(is_same::value &&
+ is_convertible<_FromElem(*)[], element_type(*)[]>::value)
+  >
+  {};
 
 #ifndef _LIBCPP_CXX03_LANG
-  typedef __unique_ptr_deleter_sfinae<_Dp> _SFINAE;
+  typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
 
   template 
   using _LValRefType =
-  typename __dependent_type<_SFINAE, _Dummy>::__lval_ref_type;
+  typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
 
   template 
   using _GoodRValRefType =
-  typename __dependent_type<_SFINAE, _Dummy>::__good_rval_ref_type;
+  typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
 
   template 
   using _BadRValRefType =
-  typename __dependent_type<_SFINAE, _Dummy>::__bad_rval_ref_type;
+  typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
 
   template , _Dummy>::type>
@@ -2642,7 +2637,7 @@ private:
 
   template 
   using _EnableIfPointerConvertible = typename enable_if<
-  __check_array_pointer_conversion<_Pp, unique_ptr>::value
+  _CheckArrayPointerConversion<_Pp>::value
   >::type;
 
   template 
   _LIBCPP_INLINE_VISIBILITY
   typename enable_if<
-  __check_array_pointer_conversion<_Pp, unique_ptr>::value
+  _CheckArrayPointerConversion<_Pp>::value
   >::type
   reset(_Pp __p) _NOEXCEPT {
 pointer __tmp = __ptr_.first();


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


[libcxx] r300407 - Cleanup default_delete specializations

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 21:06:25 2017
New Revision: 300407

URL: http://llvm.org/viewvc/llvm-project?rev=300407=rev
Log:
Cleanup default_delete specializations

Modified:
libcxx/trunk/include/memory

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=300407=300406=300407=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Sat Apr 15 21:06:25 2017
@@ -2245,75 +2245,63 @@ void swap(__compressed_pair<_T1, _T2>& _
   __x.swap(__y);
 }
 
-// __same_or_less_cv_qualified
-
-template ::element_type>::type,
- typename remove_cv::element_type>::type
->::value
- >
-struct __same_or_less_cv_qualified_imp
-: is_convertible<_Ptr1, _Ptr2> {};
-
-template 
-struct __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false>
-: false_type {};
-
-template ::value ||
-   is_same<_Ptr1, _Ptr2>::value ||
-   __has_element_type<_Ptr1>::value>
-struct __same_or_less_cv_qualified
-: __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {};
-
-template 
-struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, false>
-: false_type {};
-
 // default_delete
 
 template 
-struct _LIBCPP_TEMPLATE_VIS default_delete
-{
-#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
-_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = 
default;
+struct _LIBCPP_TEMPLATE_VIS default_delete {
+#ifndef _LIBCPP_CXX03_LANG
+  _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
 #else
-_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {}
+  _LIBCPP_INLINE_VISIBILITY default_delete() {}
 #endif
-template 
-_LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up>&,
- typename enable_if::value>::type* = 0) 
_NOEXCEPT {}
-_LIBCPP_INLINE_VISIBILITY void operator() (_Tp* __ptr) const _NOEXCEPT
-{
-static_assert(sizeof(_Tp) > 0, "default_delete can not delete 
incomplete type");
-static_assert(!is_void<_Tp>::value, "default_delete can not delete 
incomplete type");
-delete __ptr;
-}
+  template 
+  _LIBCPP_INLINE_VISIBILITY
+  default_delete(const default_delete<_Up>&,
+ typename enable_if::value>::type* =
+ 0) _NOEXCEPT {}
+
+  _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __ptr) const _NOEXCEPT {
+static_assert(sizeof(_Tp) > 0,
+  "default_delete can not delete incomplete type");
+static_assert(!is_void<_Tp>::value,
+  "default_delete can not delete incomplete type");
+delete __ptr;
+  }
 };
 
 template 
-struct _LIBCPP_TEMPLATE_VIS default_delete<_Tp[]>
-{
+struct _LIBCPP_TEMPLATE_VIS default_delete<_Tp[]> {
+private:
+  template 
+  struct _EnableIfConvertible
+  : enable_if::value> {};
+
 public:
-#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
-_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = 
default;
+#ifndef _LIBCPP_CXX03_LANG
+  _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
 #else
-_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {}
+  _LIBCPP_INLINE_VISIBILITY default_delete() {}
 #endif
-template 
-_LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up[]>&,
- typename enable_if<__same_or_less_cv_qualified<_Up*, 
_Tp*>::value>::type* = 0) _NOEXCEPT {}
-template 
-_LIBCPP_INLINE_VISIBILITY
-void operator() (_Up* __ptr,
- typename enable_if<__same_or_less_cv_qualified<_Up*, 
_Tp*>::value>::type* = 0) const _NOEXCEPT
-{
-static_assert(sizeof(_Tp) > 0, "default_delete can not delete 
incomplete type");
-static_assert(!is_void<_Tp>::value, "default_delete can not delete 
void type");
-delete [] __ptr;
-}
+
+  template 
+  _LIBCPP_INLINE_VISIBILITY
+  default_delete(const default_delete<_Up[]>&,
+ typename _EnableIfConvertible<_Up>::type* = 0) _NOEXCEPT {}
+
+  template 
+  _LIBCPP_INLINE_VISIBILITY
+  typename _EnableIfConvertible<_Up>::type
+  operator()(_Up* __ptr) const _NOEXCEPT {
+static_assert(sizeof(_Tp) > 0,
+  "default_delete can not delete incomplete type");
+static_assert(!is_void<_Tp>::value,
+  "default_delete can not delete void type");
+delete[] __ptr;
+  }
 };
 
 
+
 #ifndef _LIBCPP_CXX03_LANG
 template 
 struct __unique_ptr_deleter_sfinae {


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


[libcxx] r300406 - Overhaul unique_ptr - Implement LWG 2801, 2905, 2520.

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 20:51:04 2017
New Revision: 300406

URL: http://llvm.org/viewvc/llvm-project?rev=300406=rev
Log:
Overhaul unique_ptr - Implement LWG 2801, 2905, 2520.

This patch overhauls both specializations of unique_ptr while implementing
the following LWG issues:

* LWG 2801 - This issue constrains unique_ptr's constructors when the deleter 
type
  is not default constructible. Additionally it adds SFINAE conditions
  to unique_ptr::unique_ptr(Up).

* LWG 2905 - This issue reworks the unique_ptr(pointer, /* see below */ deleter)
  constructors so that they correctly SFINAE when the deleter argument cannot
  be used to construct the stored deleter.

* LWG 2520 - This issue fixes initializing unique_ptr from nullptr.
  Libc++ had previously implemented this issue, but the suggested resolution
  still broke initialization from NULL. This patch re-works the
  unique_ptr(Up, deleter) overloads so that they accept NULL as well
  as nullptr.

Added:

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.pass.cpp
Modified:
libcxx/trunk/include/memory

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.runtime.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/nullptr.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.fail.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.dtor/null.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/release.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/swap.pass.cpp
libcxx/trunk/test/support/deleter_types.h
libcxx/trunk/test/support/test_workarounds.h
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=300406=300405=300406=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Sat Apr 15 20:51:04 2017
@@ -2313,412 +2313,587 @@ public:
 }
 };
 
+
+#ifndef _LIBCPP_CXX03_LANG
+template 
+struct __unique_ptr_deleter_sfinae {
+  static_assert(!is_reference<_Deleter>::value, "incorrect specialization");
+  typedef const _Deleter& __lval_ref_type;
+  typedef _Deleter&& __good_rval_ref_type;
+  typedef true_type __enable_rval_overload;
+};
+
+template 
+struct __unique_ptr_deleter_sfinae<_Deleter const&> {
+  typedef const _Deleter& __lval_ref_type;
+  typedef const _Deleter&& __bad_rval_ref_type;
+  typedef false_type __enable_rval_overload;
+};
+
+template 
+struct __unique_ptr_deleter_sfinae<_Deleter&> {
+  typedef _Deleter& __lval_ref_type;
+  typedef _Deleter&& __bad_rval_ref_type;
+  typedef false_type __enable_rval_overload;
+};
+#endif // !defined(_LIBCPP_CXX03_LANG)
+
 template  >
-class _LIBCPP_TEMPLATE_VIS unique_ptr
-{
+class _LIBCPP_TEMPLATE_VIS unique_ptr {
 public:
-typedef _Tp element_type;
-typedef _Dp deleter_type;
-typedef typename __pointer_type<_Tp, deleter_type>::type pointer;
+  typedef _Tp element_type;
+  typedef _Dp deleter_type;
+  typedef typename __pointer_type<_Tp, deleter_type>::type pointer;
+
+  static_assert(!is_rvalue_reference::value,
+"the specified deleter type cannot be an rvalue reference");
+
 private:
-__compressed_pair __ptr_;
+  __compressed_pair __ptr_;
 
-#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-unique_ptr(unique_ptr&);
-template 
-unique_ptr(unique_ptr<_Up, _Ep>&);
-unique_ptr& operator=(unique_ptr&);
-template 
-unique_ptr& operator=(unique_ptr<_Up, _Ep>&);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-struct __nat {int __for_bool_;};
-
-typedef typename remove_reference::type& _Dp_reference;
-typedef typename remove_reference::type>::type&
-

[PATCH] D32112: [clang] Register isConstexpr matcher

2017-04-15 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap created this revision.
alexshap created this object with visibility "All Users".

I was working on some analyzer / clang-tidy code and noticed that
isConstexpr was not available in clang-query.
This diff registers this matcher.

F3226452: Screen Shot 2017-04-15 at 4.21.23 PM.png 


F3226453: Screen Shot 2017-04-15 at 4.21.16 PM.png 



Repository:
  rL LLVM

https://reviews.llvm.org/D32112

Files:
  Registry.cpp


Index: Registry.cpp
===
--- Registry.cpp
+++ Registry.cpp
@@ -296,6 +296,7 @@
   REGISTER_MATCHER(isCatchAll);
   REGISTER_MATCHER(isClass);
   REGISTER_MATCHER(isConst);
+  REGISTER_MATCHER(isConstexpr);
   REGISTER_MATCHER(isConstQualified);
   REGISTER_MATCHER(isCopyAssignmentOperator);
   REGISTER_MATCHER(isCopyConstructor);


Index: Registry.cpp
===
--- Registry.cpp
+++ Registry.cpp
@@ -296,6 +296,7 @@
   REGISTER_MATCHER(isCatchAll);
   REGISTER_MATCHER(isClass);
   REGISTER_MATCHER(isConst);
+  REGISTER_MATCHER(isConstexpr);
   REGISTER_MATCHER(isConstQualified);
   REGISTER_MATCHER(isCopyAssignmentOperator);
   REGISTER_MATCHER(isCopyConstructor);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31562: [coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present.

2017-04-15 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 95382.
EricWF marked an inline comment as done.
EricWF added a comment.

- Fix `MaybeODRUseExprs` assertion.
- Remove mistakenly present `CoroutineBuilder.h` file.

I'll land this later today if there are no objections.


https://reviews.llvm.org/D31562

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaCoroutine.cpp
  test/CodeGenCoroutines/coro-alloc.cpp
  test/SemaCXX/coroutines.cpp

Index: test/SemaCXX/coroutines.cpp
===
--- test/SemaCXX/coroutines.cpp
+++ test/SemaCXX/coroutines.cpp
@@ -654,6 +654,18 @@
   co_return; //expected-note {{function is a coroutine due to use of 'co_return' here}}
 }
 
+namespace std {
+  struct nothrow_t {};
+  constexpr nothrow_t nothrow = {};
+}
+
+using SizeT = decltype(sizeof(int));
+
+void* operator new(SizeT __sz, const std::nothrow_t&) noexcept;
+void  operator delete(void* __p, const std::nothrow_t&) noexcept;
+
+
+
 struct promise_on_alloc_failure_tag {};
 
 template<>
@@ -694,3 +706,43 @@
 }
 template coro dependent_private_alloc_failure_handler(bad_promise_11);
 // expected-note@-1 {{requested here}}
+
+struct bad_promise_12 {
+  coro get_return_object();
+  suspend_always initial_suspend();
+  suspend_always final_suspend();
+  void unhandled_exception();
+  void return_void();
+  static coro get_return_object_on_allocation_failure();
+
+  static void* operator new(SizeT);
+  // expected-error@-1 2 {{'operator new' is required to have a non-throwing noexcept specification when the promise type declares 'get_return_object_on_allocation_failure()'}}
+};
+coro throwing_in_class_new() { // expected-note {{call to 'operator new' implicitly required by coroutine function here}}
+  co_return;
+}
+
+template 
+coro dependent_throwing_in_class_new(T) { // expected-note {{call to 'operator new' implicitly required by coroutine function here}}
+   co_return;
+}
+template coro dependent_throwing_in_class_new(bad_promise_12); // expected-note {{requested here}}
+
+
+struct good_promise_13 {
+  coro get_return_object();
+  suspend_always initial_suspend();
+  suspend_always final_suspend();
+  void unhandled_exception();
+  void return_void();
+  static coro get_return_object_on_allocation_failure();
+};
+coro uses_nothrow_new() {
+  co_return;
+}
+
+template 
+coro dependent_uses_nothrow_new(T) {
+   co_return;
+}
+template coro dependent_uses_nothrow_new(good_promise_13);
Index: test/CodeGenCoroutines/coro-alloc.cpp
===
--- test/CodeGenCoroutines/coro-alloc.cpp
+++ test/CodeGenCoroutines/coro-alloc.cpp
@@ -19,8 +19,19 @@
   coroutine_handle(coroutine_handle) {}
 };
 
-}
-}
+} // end namespace experimental
+
+struct nothrow_t {};
+constexpr nothrow_t nothrow = {};
+
+} // end namespace std
+
+// Required when get_return_object_on_allocation_failure() is defined by
+// the promise.
+using SizeT = decltype(sizeof(int));
+void* operator new(SizeT __sz, const std::nothrow_t&) noexcept;
+void  operator delete(void* __p, const std::nothrow_t&) noexcept;
+
 
 struct suspend_always {
   bool await_ready() { return false; }
@@ -145,7 +156,7 @@
 extern "C" int f4(promise_on_alloc_failure_tag) {
   // CHECK: %[[ID:.+]] = call token @llvm.coro.id(i32 16
   // CHECK: %[[SIZE:.+]] = call i64 @llvm.coro.size.i64()
-  // CHECK: %[[MEM:.+]] = call i8* @_Znwm(i64 %[[SIZE]])
+  // CHECK: %[[MEM:.+]] = call i8* @_ZnwmRKSt9nothrow_t(i64 %[[SIZE]], %"struct.std::nothrow_t"* dereferenceable(1) @_ZStL7nothrow)
   // CHECK: %[[OK:.+]] = icmp ne i8* %[[MEM]], null
   // CHECK: br i1 %[[OK]], label %[[OKBB:.+]], label %[[ERRBB:.+]]
 
Index: lib/Sema/SemaCoroutine.cpp
===
--- lib/Sema/SemaCoroutine.cpp
+++ lib/Sema/SemaCoroutine.cpp
@@ -454,7 +454,7 @@
  /*IsImplicit*/ true);
 Suspend = S.ActOnFinishFullExpr(Suspend.get());
 if (Suspend.isInvalid()) {
-  S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required)
+  S.Diag(Loc, diag::note_coroutine_promise_suspend_implicitly_required)
   << ((Name == "initial_suspend") ? 0 : 1);
   S.Diag(KWLoc, diag::note_declared_coroutine_here) << Keyword;
   return StmtError();
@@ -660,6 +660,39 @@
   return Res;
 }
 
+/// Look up the std::nothrow object.
+static Expr *buildStdNoThrowDeclRef(Sema , SourceLocation Loc) {
+  NamespaceDecl *Std = S.getStdNamespace();
+  assert(Std && "Should already be diagnosed");
+
+  LookupResult Result(S, ().get("nothrow"), Loc,
+  Sema::LookupOrdinaryName);
+  if (!S.LookupQualifiedName(Result, Std)) {
+// FIXME:  should have been included already.
+// If we require it to include  then this diagnostic is no longer
+// needed.
+S.Diag(Loc, diag::err_implicit_coroutine_std_nothrow_type_not_found);
+return nullptr;
+  }
+
+  // FIXME: Mark the variable as ODR used. This 

[PATCH] D31562: [coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present.

2017-04-15 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked an inline comment as done.
EricWF added inline comments.



Comment at: lib/Sema/CoroutineBuilder.h:1
+//===- CoroutineBuilder.h - Coroutine Semantic checking -*- C++ 
-*-===//
+//

GorNishanov wrote:
> This file is called:
> 
>   CoroutineStmtBuilder.h
> 
> in trunk
Woops, this file should have been deleted.


https://reviews.llvm.org/D31562



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


[PATCH] D31538: [analyzer] MisusedMovedObjectChecker: Fix a false positive on state-resetting a base-class sub-object.

2017-04-15 Thread Peter Szecsi via Phabricator via cfe-commits
szepet accepted this revision.
szepet added inline comments.
This revision is now accepted and ready to land.



Comment at: lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp:426
+
+State = State->remove(WholeObjectRegion);
 C.addTransition(State);

szepet wrote:
> szepet wrote:
> > I am wondering if I made a mistake but I think this should be 
> > removeFromState() function call. (We should remove every marked subregions 
> > of the object too.)
> > So I suspect a code like this would result a false positive:
> > ```
> > struct A{
> > B b;
> > void clear();
> > };
> > 
> > void test(){
> > A a;
> > B b = std::move(a.b);
> > a.clear();
> > b = std::move(a); //report a bug
> > }
> > ```
> > 
> > I mean it is probably a report we do not want to have.
> Shame on the test file writer that he does not covered this, though. ^^
Okay, I have checked it and yes, it produces a bugreport (false positive) on 
the code snippet above (which contains a misspelled variable name so let me 
write it again):

```
struct B{};

struct A{
B b;
void clear();
};

void test(){
A a;
B b = std::move(a.b);
a.clear();
b = std::move(a.b); //report a bug
}
```

In order to eliminate these type of bugs I suggest using here the 
removeFromState function and move this "WholeObjectRegion algorithm" (the for 
loop) to the removeFromState function.
It is probably out of scope from this patch. Anyway, I accept this since it is 
great to fix this bug and a good step to a follow-up patch. (Well, if you would 
like to make these changes in this patch. I'm not gonna hold you back. It is 
highly appreciated and I would certainly review and all the stuff but I would 
do it gladly in a follow-up too.) 
Again, thank you for pointing this out and making the checker more precise!


https://reviews.llvm.org/D31538



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


[PATCH] D32111: [modules] Attempt to fix PR31905 - #include "stddef.h" breaks module map search paths; causes redefinitions.

2017-04-15 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF created this revision.

This patch attempts to fix llvm.org/PR31905. However I have no clue if this fix 
is correct; I simply stumbled upon it.

The fix is to remove the `_Builtin_stddef_max_align_t` module, making 
`__stddef_max_align_t.h` non-modular. This fixes the issue because including 
`` no longer includes an modularized header, and therefore no longer 
performs the problematic `module.modulemap` search.

All of the modules tests pass after applying these changes, but it's possible 
the need for `_Builtin_stddef_max_align_t` is untested.


https://reviews.llvm.org/D32111

Files:
  lib/Basic/Module.cpp
  lib/Headers/module.modulemap
  test/Modules/Inputs/PR31905/my-project/module.modulemap
  test/Modules/Inputs/PR31905/my-project/my-header.h
  test/Modules/pr31905.cpp


Index: test/Modules/pr31905.cpp
===
--- /dev/null
+++ test/Modules/pr31905.cpp
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: cp -R %S/Inputs/PR31905 %t/other-include
+// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR31905/ -I%t/other-include 
-fmodules -fmodules-local-submodule-visibility \
+// RUN:-fimplicit-module-maps -fmodules-cache-path=%t  -verify %s
+
+#include "my-project/my-header.h"
+
+int main() {} // expected-no-diagnostics
Index: test/Modules/Inputs/PR31905/my-project/my-header.h
===
--- /dev/null
+++ test/Modules/Inputs/PR31905/my-project/my-header.h
@@ -0,0 +1,4 @@
+#ifndef MY_HEADER_H
+#define MY_HEADER_H
+#include 
+#endif
Index: test/Modules/Inputs/PR31905/my-project/module.modulemap
===
--- /dev/null
+++ test/Modules/Inputs/PR31905/my-project/module.modulemap
@@ -0,0 +1,3 @@
+module my_project {
+  header "my-header.h"
+}
Index: lib/Headers/module.modulemap
===
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -157,10 +157,6 @@
   }
 }
 
-module _Builtin_stddef_max_align_t [system] [extern_c] {
-  header "__stddef_max_align_t.h"
-}
-
 module opencl_c {
   requires opencl
   header "opencl-c.h"
Index: lib/Basic/Module.cpp
===
--- lib/Basic/Module.cpp
+++ lib/Basic/Module.cpp
@@ -184,10 +184,6 @@
 if (Requested->isSubModuleOf(Use))
   return true;
 
-  // Anyone is allowed to use our builtin stddef.h and its accompanying module.
-  if (!Requested->Parent && Requested->Name == "_Builtin_stddef_max_align_t")
-return true;
-
   return false;
 }
 


Index: test/Modules/pr31905.cpp
===
--- /dev/null
+++ test/Modules/pr31905.cpp
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: cp -R %S/Inputs/PR31905 %t/other-include
+// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR31905/ -I%t/other-include -fmodules -fmodules-local-submodule-visibility \
+// RUN:-fimplicit-module-maps -fmodules-cache-path=%t  -verify %s
+
+#include "my-project/my-header.h"
+
+int main() {} // expected-no-diagnostics
Index: test/Modules/Inputs/PR31905/my-project/my-header.h
===
--- /dev/null
+++ test/Modules/Inputs/PR31905/my-project/my-header.h
@@ -0,0 +1,4 @@
+#ifndef MY_HEADER_H
+#define MY_HEADER_H
+#include 
+#endif
Index: test/Modules/Inputs/PR31905/my-project/module.modulemap
===
--- /dev/null
+++ test/Modules/Inputs/PR31905/my-project/module.modulemap
@@ -0,0 +1,3 @@
+module my_project {
+  header "my-header.h"
+}
Index: lib/Headers/module.modulemap
===
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -157,10 +157,6 @@
   }
 }
 
-module _Builtin_stddef_max_align_t [system] [extern_c] {
-  header "__stddef_max_align_t.h"
-}
-
 module opencl_c {
   requires opencl
   header "opencl-c.h"
Index: lib/Basic/Module.cpp
===
--- lib/Basic/Module.cpp
+++ lib/Basic/Module.cpp
@@ -184,10 +184,6 @@
 if (Requested->isSubModuleOf(Use))
   return true;
 
-  // Anyone is allowed to use our builtin stddef.h and its accompanying module.
-  if (!Requested->Parent && Requested->Name == "_Builtin_stddef_max_align_t")
-return true;
-
   return false;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D32107: [libc++][test] LWG2857 test coverage for variant

2017-04-15 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF commandeered this revision.
EricWF edited reviewers, added: CaseyCarter; removed: EricWF.
EricWF added a comment.

LGTM, Thanks @CaseyCarter.

I committed these tests and the changes to libc++'s variant in r300403.

I'm hijacking this revision so I can close it.


https://reviews.llvm.org/D32107



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


[libcxx] r300403 - Implement LWG 2857 for variant. Tests from Casey Carter @ Microsoft.

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 14:32:02 2017
New Revision: 300403

URL: http://llvm.org/viewvc/llvm-project?rev=300403=rev
Log:
Implement LWG 2857 for variant. Tests from Casey Carter @ Microsoft.

Also mark LWG 2857 as complete, since the changes to optional and
any were completed by Marshall earlier.

Modified:
libcxx/trunk/include/variant

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_init_list_args.pass.cpp

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_init_list_args.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/variant
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/variant?rev=300403=300402=300403=diff
==
--- libcxx/trunk/include/variant (original)
+++ libcxx/trunk/include/variant Sat Apr 15 14:32:02 2017
@@ -53,16 +53,16 @@ namespace std {
 
 // 20.7.2.4, modifiers
 template 
-void emplace(Args&&...);
+T& emplace(Args&&...);
 
 template 
-void emplace(initializer_list, Args&&...);
+T& emplace(initializer_list, Args&&...);
 
 template 
-void emplace(Args&&...);
+variant_alternative_t& emplace(Args&&...);
 
 template 
-void emplace(initializer_list, Args&&...);
+variant_alternative_t& emplace(initializer_list, Args&&...);
 
 // 20.7.2.5, value status
 constexpr bool valueless_by_exception() const noexcept;
@@ -764,9 +764,10 @@ public:
 protected:
   template 
   inline _LIBCPP_INLINE_VISIBILITY
-  static void __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) {
-::new (_VSTD::addressof(__a))
+  static _Tp& __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) {
+::new ((void*)_VSTD::addressof(__a))
 __alt<_Ip, _Tp>(in_place, _VSTD::forward<_Args>(__args)...);
+return __a.__value;
   }
 
   template 
@@ -876,11 +877,12 @@ public:
 
   template 
   inline _LIBCPP_INLINE_VISIBILITY
-  void __emplace(_Args&&... __args) {
+  auto& __emplace(_Args&&... __args) {
 this->__destroy();
-this->__construct_alt(__access::__base::__get_alt<_Ip>(*this),
+auto& __res = 
this->__construct_alt(__access::__base::__get_alt<_Ip>(*this),
   _VSTD::forward<_Args>(__args)...);
 this->__index = _Ip;
+return __res;
   }
 
 protected:
@@ -1218,8 +1220,8 @@ public:
   class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
   enable_if_t, int> = 0>
   inline _LIBCPP_INLINE_VISIBILITY
-  void emplace(_Args&&... __args) {
-__impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...);
+  _Tp& emplace(_Args&&... __args) {
+return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...);
   }
 
   template <
@@ -1231,8 +1233,8 @@ public:
   enable_if_t&, _Args...>,
   int> = 0>
   inline _LIBCPP_INLINE_VISIBILITY
-  void emplace(initializer_list<_Up> __il, _Args&&... __args) {
-__impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...);
+  _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
+return __impl.template __emplace<_Ip>(__il, 
_VSTD::forward<_Args>(__args)...);
   }
 
   template <
@@ -1242,8 +1244,8 @@ public:
   __find_detail::__find_unambiguous_index_sfinae<_Tp, 
_Types...>::value,
   enable_if_t, int> = 0>
   inline _LIBCPP_INLINE_VISIBILITY
-  void emplace(_Args&&... __args) {
-__impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...);
+  _Tp& emplace(_Args&&... __args) {
+return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...);
   }
 
   template <
@@ -1255,8 +1257,8 @@ public:
   enable_if_t&, _Args...>,
   int> = 0>
   inline _LIBCPP_INLINE_VISIBILITY
-  void emplace(initializer_list<_Up> __il, _Args&&... __args) {
-__impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...);
+  _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
+return __impl.template __emplace<_Ip>(__il, 
_VSTD::forward<_Args>(__args)...);
   }
 
   inline _LIBCPP_INLINE_VISIBILITY

Modified: 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp?rev=300403=300402=300403=diff
==
--- 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp
 (original)
+++ 

[PATCH] D31830: Emit invariant.group.barrier when using union field

2017-04-15 Thread Piotr Padlewski via Phabricator via cfe-commits
Prazek added a comment.

ping


https://reviews.llvm.org/D31830



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


[PATCH] D15006: Driver: Better detection of mingw-gcc

2017-04-15 Thread Mateusz MikuĊ‚a via Phabricator via cfe-commits
mati865 accepted this revision.
mati865 added a comment.
This revision is now accepted and ready to land.

Looks fine for MinGW on Windows.


Repository:
  rL LLVM

https://reviews.llvm.org/D15006



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


[PATCH] D32110: Emit invariant.group loads with empty group md

2017-04-15 Thread Piotr Padlewski via Phabricator via cfe-commits
Prazek created this revision.

As discussed here
http://lists.llvm.org/pipermail/llvm-dev/2017-January/109332.html
having different groups doesn't solve the problem entirly.


https://reviews.llvm.org/D32110

Files:
  lib/CodeGen/CodeGenModule.cpp
  test/CodeGenCXX/invariant.group-for-vptrs.cpp


Index: test/CodeGenCXX/invariant.group-for-vptrs.cpp
===
--- test/CodeGenCXX/invariant.group-for-vptrs.cpp
+++ test/CodeGenCXX/invariant.group-for-vptrs.cpp
@@ -12,15 +12,15 @@
 void testExternallyVisible() {
   A *a = new A;
 
-  // CHECK: load {{.*}} !invariant.group ![[A_MD:[0-9]+]]
+  // CHECK: load {{.*}} !invariant.group ![[MD:[0-9]+]]
   a->foo();
 
   D *d = new D;
   // CHECK: call void @_ZN1DC1Ev(
-  // CHECK: load {{.*}} !invariant.group ![[D_MD:[0-9]+]]
+  // CHECK: load {{.*}} !invariant.group ![[MD]]
   d->foo();
   A *a2 = d;
-  // CHECK: load {{.*}} !invariant.group ![[A_MD]]
+  // CHECK: load {{.*}} !invariant.group ![[MD]]
   a2->foo();
 }
 // CHECK-LABEL: {{^}}}
@@ -40,35 +40,32 @@
 // CHECK-LABEL: define void @_Z21testInternallyVisibleb(
 void testInternallyVisible(bool p) {
   B *b = new B;
-  // CHECK: = load {{.*}}, !invariant.group ![[B_MD:[0-9]+]]
+  // CHECK: = load {{.*}}, !invariant.group ![[MD]]
   b->bar();
 
   // CHECK: call void @_ZN12_GLOBAL__N_11CC1Ev(
   C *c = new C;
-  // CHECK: = load {{.*}}, !invariant.group ![[C_MD:[0-9]+]]
+  // CHECK: = load {{.*}}, !invariant.group ![[MD]]
   c->bar();
 }
 
 // Checking A::A()
 // CHECK-LABEL: define linkonce_odr void @_ZN1AC2Ev(
-// CHECK: store {{.*}}, !invariant.group ![[A_MD]]
+// CHECK: store {{.*}}, !invariant.group ![[MD]]
 // CHECK-LABEL: {{^}}}
 
 // Checking D::D()
 // CHECK-LABEL: define linkonce_odr void @_ZN1DC2Ev(
 // CHECK:  = call i8* @llvm.invariant.group.barrier(i8*
 // CHECK:  call void @_ZN1AC2Ev(%struct.A*
-// CHECK: store {{.*}} !invariant.group ![[D_MD]]
+// CHECK: store {{.*}} !invariant.group ![[MD]]
 
 // Checking B::B()
 // CHECK-LABEL: define internal void @_ZN12_GLOBAL__N_11BC2Ev(
-// CHECK:  store {{.*}}, !invariant.group ![[B_MD]]
+// CHECK:  store {{.*}}, !invariant.group ![[MD]]
 
 // Checking C::C()
 // CHECK-LABEL: define internal void @_ZN12_GLOBAL__N_11CC2Ev(
-// CHECK:  store {{.*}}, !invariant.group ![[C_MD]]
+// CHECK:  store {{.*}}, !invariant.group ![[MD]]
 
-// CHECK: ![[A_MD]] = !{!"_ZTS1A"}
-// CHECK: ![[D_MD]] = !{!"_ZTS1D"}
-// CHECK: ![[B_MD]] = distinct !{}
-// CHECK: ![[C_MD]] = distinct !{}
+// CHECK: ![[MD]] = !{}
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -561,12 +561,8 @@
 
 void CodeGenModule::DecorateInstructionWithInvariantGroup(
 llvm::Instruction *I, const CXXRecordDecl *RD) {
-  llvm::Metadata *MD = 
CreateMetadataIdentifierForType(QualType(RD->getTypeForDecl(), 0));
-  auto *MetaDataNode = dyn_cast(MD);
-  // Check if we have to wrap MDString in MDNode.
-  if (!MetaDataNode)
-MetaDataNode = llvm::MDNode::get(getLLVMContext(), MD);
-  I->setMetadata(llvm::LLVMContext::MD_invariant_group, MetaDataNode);
+  I->setMetadata(llvm::LLVMContext::MD_invariant_group,
+ llvm::MDNode::get(getLLVMContext(), {}));
 }
 
 void CodeGenModule::Error(SourceLocation loc, StringRef message) {


Index: test/CodeGenCXX/invariant.group-for-vptrs.cpp
===
--- test/CodeGenCXX/invariant.group-for-vptrs.cpp
+++ test/CodeGenCXX/invariant.group-for-vptrs.cpp
@@ -12,15 +12,15 @@
 void testExternallyVisible() {
   A *a = new A;
 
-  // CHECK: load {{.*}} !invariant.group ![[A_MD:[0-9]+]]
+  // CHECK: load {{.*}} !invariant.group ![[MD:[0-9]+]]
   a->foo();
 
   D *d = new D;
   // CHECK: call void @_ZN1DC1Ev(
-  // CHECK: load {{.*}} !invariant.group ![[D_MD:[0-9]+]]
+  // CHECK: load {{.*}} !invariant.group ![[MD]]
   d->foo();
   A *a2 = d;
-  // CHECK: load {{.*}} !invariant.group ![[A_MD]]
+  // CHECK: load {{.*}} !invariant.group ![[MD]]
   a2->foo();
 }
 // CHECK-LABEL: {{^}}}
@@ -40,35 +40,32 @@
 // CHECK-LABEL: define void @_Z21testInternallyVisibleb(
 void testInternallyVisible(bool p) {
   B *b = new B;
-  // CHECK: = load {{.*}}, !invariant.group ![[B_MD:[0-9]+]]
+  // CHECK: = load {{.*}}, !invariant.group ![[MD]]
   b->bar();
 
   // CHECK: call void @_ZN12_GLOBAL__N_11CC1Ev(
   C *c = new C;
-  // CHECK: = load {{.*}}, !invariant.group ![[C_MD:[0-9]+]]
+  // CHECK: = load {{.*}}, !invariant.group ![[MD]]
   c->bar();
 }
 
 // Checking A::A()
 // CHECK-LABEL: define linkonce_odr void @_ZN1AC2Ev(
-// CHECK: store {{.*}}, !invariant.group ![[A_MD]]
+// CHECK: store {{.*}}, !invariant.group ![[MD]]
 // CHECK-LABEL: {{^}}}
 
 // Checking D::D()
 // CHECK-LABEL: define linkonce_odr void @_ZN1DC2Ev(
 // CHECK:  = call i8* @llvm.invariant.group.barrier(i8*
 // CHECK:  call void @_ZN1AC2Ev(%struct.A*
-// CHECK: store {{.*}} 

[PATCH] D31542: [clang-tidy] Extend readability-container-size-empty to add comparisons to newly-constructed objects

2017-04-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

> ... which has the wrong precedence; an extra set of parens is necessary.
>  However, I don't want to add a set of parens if it isn't necessary. ...

One way to handle this is to not suggest the fixit if the container part of the 
equality check is not a DeclRefExpr (perhaps after ignoring implicit casts, 
etc). This means the fixit won't get suggested in some cases where it otherwise 
could, such as:

  std::vector v;
  if (v[0] == "") {
  }

but it does mean that it will still catch the common cases.




Comment at: clang-tidy/readability/ContainerSizeEmptyCheck.cpp:70
+  ignoringImpCasts(cxxBindTemporaryExpr(has(cxxConstructExpr(
+  hasDeclaration(cxxConstructorDecl(isDefaultConstructor())),
+  ignoringImplicit(cxxConstructExpr(

You should pull the 
`cxxConstructExpr(hasDeclaration(cxxConstructorDecl(isDefaultConstructor(` 
into a separate variable and reuse it instead of spelling it out four times.


Repository:
  rL LLVM

https://reviews.llvm.org/D31542



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


r300400 - Add isStaticStorageClass to the dynamic matcher registry so that it can be used from clang-query.

2017-04-15 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Sat Apr 15 07:53:20 2017
New Revision: 300400

URL: http://llvm.org/viewvc/llvm-project?rev=300400=rev
Log:
Add isStaticStorageClass to the dynamic matcher registry so that it can be used 
from clang-query.

Patch by Dave Lee.

Modified:
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=300400=300399=300400=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Sat Apr 15 07:53:20 2017
@@ -330,6 +330,7 @@ RegistryMaps::RegistryMaps() {
   REGISTER_MATCHER(isPublic);
   REGISTER_MATCHER(isPure);
   REGISTER_MATCHER(isSignedInteger);
+  REGISTER_MATCHER(isStaticStorageClass);
   REGISTER_MATCHER(isStruct);
   REGISTER_MATCHER(isTemplateInstantiation);
   REGISTER_MATCHER(isUnion);


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


[PATCH] D31869: Register isStaticStorageClass matcher

2017-04-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Thanks! I've commit in r300400.


https://reviews.llvm.org/D31869



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


[PATCH] D31757: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations

2017-04-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


https://reviews.llvm.org/D31757



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


[libcxx] r300399 - Simplify test helper

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 07:05:11 2017
New Revision: 300399

URL: http://llvm.org/viewvc/llvm-project?rev=300399=rev
Log:
Simplify test helper

Modified:
libcxx/trunk/test/support/unique_ptr_test_helper.h

Modified: libcxx/trunk/test/support/unique_ptr_test_helper.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/unique_ptr_test_helper.h?rev=300399=300398=300399=diff
==
--- libcxx/trunk/test/support/unique_ptr_test_helper.h (original)
+++ libcxx/trunk/test/support/unique_ptr_test_helper.h Sat Apr 15 07:05:11 2017
@@ -99,13 +99,7 @@ template , class... Args>
 void doIncompleteTypeTest(int expect_alive, Args&&... ctor_args) {
   using ValueT = typename std::remove_all_extents::type;
-
-
-  if (expect_alive == 0)
-checkNumIncompleteTypeAlive(0);
-  else
-checkNumIncompleteTypeAlive(expect_alive);
-
+  checkNumIncompleteTypeAlive(expect_alive);
   {
 StoresIncomplete sptr(std::forward(ctor_args)...);
 checkNumIncompleteTypeAlive(expect_alive);


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


[PATCH] D31887: [clangd] Add documentation page

2017-04-15 Thread Jonas Devlieghere via Phabricator via cfe-commits
JDevlieghere added a comment.

Great to see this coming along!




Comment at: docs/clangd.rst:10
+
+:program:`clangd` is an implementation of the `Language Server Protocol 
`_ leveraging Clang.
+Clangd's goal is to provide language "smartness" features like code 
completion, find references, etc. for clients such as C/C++ Editors.

s/clangd/Clangd



Comment at: docs/clangd.rst:10
+
+:program:`clangd` is an implementation of the `Language Server Protocol 
`_ leveraging Clang.
+Clangd's goal is to provide language "smartness" features like code 
completion, find references, etc. for clients such as C/C++ Editors.

JDevlieghere wrote:
> s/clangd/Clangd
Reflow text to 80 columns



Comment at: docs/clangd.rst:20
+At the moment, `Visual Studio Code `_ is 
mainly used
+in order to test :program:`Clangd`` but more clients are likely to make use of 
:program:`Clangd`` in the
+future as it matures and becomes a production quality tool. If you are 
interested

Spurious backticks



Comment at: docs/clangd.rst:22
+future as it matures and becomes a production quality tool. If you are 
interested
+in trying :program:`Clangd`` in combination with Visual Studio Code, you can 
start by `building Clangd`_,
+then open Visual Studio Code in the clangd-vscode folder and launch the 
extension.

Spurious backtick



Comment at: docs/clangd.rst:33
+
+Many features could be implemented in :program:`Clangd``.
+Here is a list of features that could be useful with the status of whether or

Spurious backtick



Comment at: docs/clangd.rst:35
+Here is a list of features that could be useful with the status of whether or
+not they are already implemented in :program:`Clangd`` and specified in the 
Language Server Protocol.
+Note that for some of the features, it is not clear whether or not they should 
be part of the

Spurious backtick



Comment at: docs/clangd.rst:37
+Note that for some of the features, it is not clear whether or not they should 
be part of the
+Language Server Protocol, so those features might be eventually developed 
outside :program:`Clangd``.
+

Spurious backtick



Comment at: docs/clangd.rst:91
+A good place for interested contributors is the `Clang developer mailing list 
`_.
+If you're also interested in contributing patches to Clangd, take a look at the
+`LLVM Developer Policy `_ and `Code 
Reviews `_ page.

:program:`Clangd` 



Comment at: docs/clangd.rst:94
+Contributions of new features to the `Language Server Protocol 
`_ itself would also be 
very useful,
+so that Clangd can eventually implement them in a conforming way.

:program:`Clangd` 


https://reviews.llvm.org/D31887



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


[PATCH] D27651: [clang-format] Even with AlignConsecutiveDeclarations, PointerAlignment: Right should keep *s and to the right

2017-04-15 Thread Ken-Patrick Lehrmann via Phabricator via cfe-commits
KP updated this revision to Diff 95375.
KP added a comment.

Rebase on current trunk.

Is there any chance to get this merge ? Please let me know if anything else is 
needed.

Thanks,
Ken-Patrick


https://reviews.llvm.org/D27651

Files:
  lib/Format/WhitespaceManager.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -7848,9 +7848,11 @@
"  doublebar();\n"
"};\n",
Alignment);
+
+  // PAS_RIGHT
   EXPECT_EQ("void SomeFunction(int parameter = 0) {\n"
 "  int const i   = 1;\n"
-"  int * j   = 2;\n"
+"  int  *j   = 2;\n"
 "  int   big = 1;\n"
 "\n"
 "  unsigned oneTwoThree = 123;\n"
@@ -7871,6 +7873,141 @@
"int ll=1;\n"
"}",
Alignment));
+  EXPECT_EQ("void SomeFunction(int parameter = 0) {\n"
+"  int const i   = 1;\n"
+"  int **j   = 2, ***k;\n"
+"  int = i;\n"
+"  int &   = i + j;\n"
+"  int   big = 1;\n"
+"\n"
+"  unsigned oneTwoThree = 123;\n"
+"  int  oneTwo  = 12;\n"
+"  method();\n"
+"  float k  = 2;\n"
+"  int   ll = 1;\n"
+"}",
+format("void SomeFunction(int parameter= 0) {\n"
+   " int const  i= 1;\n"
+   "  int **j=2,***k;\n"
+   "int =i;\n"
+   "int &=i+j;\n"
+   " int big  =  1;\n"
+   "\n"
+   "unsigned oneTwoThree  =123;\n"
+   "int oneTwo = 12;\n"
+   "  method();\n"
+   "float k= 2;\n"
+   "int ll=1;\n"
+   "}",
+   Alignment));
+
+  // PAS_LEFT
+  FormatStyle AlignmentLeft = Alignment;
+  AlignmentLeft.PointerAlignment = FormatStyle::PAS_Left;
+  EXPECT_EQ("void SomeFunction(int parameter = 0) {\n"
+"  int const i   = 1;\n"
+"  int*  j   = 2;\n"
+"  int   big = 1;\n"
+"\n"
+"  unsigned oneTwoThree = 123;\n"
+"  int  oneTwo  = 12;\n"
+"  method();\n"
+"  float k  = 2;\n"
+"  int   ll = 1;\n"
+"}",
+format("void SomeFunction(int parameter= 0) {\n"
+   " int const  i= 1;\n"
+   "  int *j=2;\n"
+   " int big  =  1;\n"
+   "\n"
+   "unsigned oneTwoThree  =123;\n"
+   "int oneTwo = 12;\n"
+   "  method();\n"
+   "float k= 2;\n"
+   "int ll=1;\n"
+   "}",
+   AlignmentLeft));
+  EXPECT_EQ("void SomeFunction(int parameter = 0) {\n"
+"  int const i   = 1;\n"
+"  int** j   = 2;\n"
+"  int&  k   = i;\n"
+"  int&& l   = i + j;\n"
+"  int   big = 1;\n"
+"\n"
+"  unsigned oneTwoThree = 123;\n"
+"  int  oneTwo  = 12;\n"
+"  method();\n"
+"  float k  = 2;\n"
+"  int   ll = 1;\n"
+"}",
+format("void SomeFunction(int parameter= 0) {\n"
+   " int const  i= 1;\n"
+   "  int **j=2;\n"
+   "int =i;\n"
+   "int &=i+j;\n"
+   " int big  =  1;\n"
+   "\n"
+   "unsigned oneTwoThree  =123;\n"
+   "int oneTwo = 12;\n"
+   "  method();\n"
+   "float k= 2;\n"
+   "int ll=1;\n"
+   "}",
+   AlignmentLeft));
+  // PAS_MIDDLE
+  FormatStyle AlignmentMiddle = Alignment;
+  AlignmentMiddle.PointerAlignment = FormatStyle::PAS_Middle;
+  EXPECT_EQ("void SomeFunction(int parameter = 0) {\n"
+"  int const i   = 1;\n"
+"  int * j   = 2;\n"
+"  int   big = 1;\n"
+"\n"
+"  unsigned oneTwoThree = 123;\n"
+"  int  oneTwo  = 12;\n"
+"  method();\n"
+"  float k  = 2;\n"
+"  int   ll = 1;\n"
+"}",
+format("void SomeFunction(int parameter= 0) {\n"
+   " int const  i= 1;\n"
+   "  int *j=2;\n"
+   " int big  =  1;\n"
+   "\n"
+   "unsigned oneTwoThree  =123;\n"
+   "int oneTwo = 12;\n"
+   "  method();\n"
+   "float k= 2;\n"
+   "int 

[PATCH] D32109: [Driver] Limit .exe extension addition to Windows hosts

2017-04-15 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai planned changes to this revision.
smeenai added a comment.

Forgot to fix a test


https://reviews.llvm.org/D32109



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


[PATCH] D32109: [Driver] Limit .exe extension addition to Windows hosts

2017-04-15 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai created this revision.

The driver should invoke lld as `lld-link` rather than `lld-link.exe`
when cross compiling.

The alternative would be to teach lld's build system to always produce
`lld-link.exe` even on non-Windows hosts, but I think it's cleaner to
change the driver to respect the host system's executable suffix (or
lack thereof).


https://reviews.llvm.org/D32109

Files:
  lib/Driver/ToolChains/MSVC.cpp


Index: lib/Driver/ToolChains/MSVC.cpp
===
--- lib/Driver/ToolChains/MSVC.cpp
+++ lib/Driver/ToolChains/MSVC.cpp
@@ -523,7 +523,8 @@
 #endif
   } else {
 linkPath = Linker;
-llvm::sys::path::replace_extension(linkPath, "exe");
+if (llvm::Triple(LLVM_HOST_TRIPLE).isOSWindows())
+  llvm::sys::path::replace_extension(linkPath, "exe");
 linkPath = TC.GetProgramPath(linkPath.c_str());
   }
 


Index: lib/Driver/ToolChains/MSVC.cpp
===
--- lib/Driver/ToolChains/MSVC.cpp
+++ lib/Driver/ToolChains/MSVC.cpp
@@ -523,7 +523,8 @@
 #endif
   } else {
 linkPath = Linker;
-llvm::sys::path::replace_extension(linkPath, "exe");
+if (llvm::Triple(LLVM_HOST_TRIPLE).isOSWindows())
+  llvm::sys::path::replace_extension(linkPath, "exe");
 linkPath = TC.GetProgramPath(linkPath.c_str());
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r300397 - Fix PR32642 - string::insert and string::append don't work with move_iterator.

2017-04-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Apr 15 01:49:02 2017
New Revision: 300397

URL: http://llvm.org/viewvc/llvm-project?rev=300397=rev
Log:
Fix PR32642 - string::insert and string::append don't work with move_iterator.

Modified:
libcxx/trunk/include/string

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp

Modified: libcxx/trunk/include/string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=300397=300396=300397=diff
==
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Sat Apr 15 01:49:02 2017
@@ -2276,7 +2276,9 @@ basic_string<_CharT, _Traits, _Allocator
 size_type __n = static_cast(_VSTD::distance(__first, __last));
 if (__n)
 {
-if ( __ptr_in_range(&*__first, data(), data() + size()))
+typedef typename iterator_traits<_ForwardIterator>::reference _CharRef;
+_CharRef __tmp_ref = *__first;
+if (__ptr_in_range(_VSTD::addressof(__tmp_ref), data(), data() + 
size()))
 {
 const basic_string __temp (__first, __last, __alloc());
 append(__temp.data(), __temp.size());
@@ -2440,7 +2442,9 @@ basic_string<_CharT, _Traits, _Allocator
 size_type __n = static_cast(_VSTD::distance(__first, __last));
 if (__n)
 {
-if ( __ptr_in_range(&*__first, data(), data() + size()))
+typedef typename iterator_traits<_ForwardIterator>::reference _CharRef;
+_CharRef __tmp_char = *__first;
+if (__ptr_in_range(_VSTD::addressof(__tmp_char), data(), data() + 
size()))
 {
 const basic_string __temp(__first, __last, __alloc());
 return insert(__pos, __temp.data(), __temp.data() + __temp.size());

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp?rev=300397=300396=300397=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
 Sat Apr 15 01:49:02 2017
@@ -204,4 +204,20 @@ int main()
assert(s == "ABCD");
}
 
+  { // test with a move iterator that returns char&&
+typedef forward_iterator It;
+typedef std::move_iterator MoveIt;
+const char p[] = "ABCD";
+std::string s;
+s.append(MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1)));
+assert(s == "ABCD");
+  }
+  { // test with a move iterator that returns char&&
+typedef const char* It;
+typedef std::move_iterator MoveIt;
+const char p[] = "ABCD";
+std::string s;
+s.append(MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1)));
+assert(s == "ABCD");
+  }
 }

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp?rev=300397=300396=300397=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
 Sat Apr 15 01:49:02 2017
@@ -188,10 +188,35 @@ int main()
 
{ // test assigning a different type
 typedef std::string S;
-   const uint8_t p[] = "ABCD";
+const uint8_t p[] = "ABCD";
 
-   S s;
-   s.insert(s.begin(), p, p + 4);
-   assert(s == "ABCD");
+S s;
+s.insert(s.begin(), p, p + 4);
+assert(s == "ABCD");
}
+
+  { // test with a move iterator that returns char&&
+typedef input_iterator It;
+typedef std::move_iterator MoveIt;
+const char p[] = "ABCD";
+std::string s;
+s.insert(s.begin(), MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 
1)));
+assert(s == "ABCD");
+  }
+  { // test with a move iterator that returns char&&
+typedef forward_iterator It;
+typedef std::move_iterator MoveIt;
+const char p[] = "ABCD";
+std::string s;
+s.insert(s.begin(), MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 
1)));
+assert(s == "ABCD");
+  }
+  { // test with a move iterator that returns char&&
+typedef const char* It;
+typedef std::move_iterator MoveIt;
+const char p[] = "ABCD";
+std::string s;
+s.insert(s.begin(), MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 
1)));
+assert(s == "ABCD");
+  }
 }


___
cfe-commits 

r300396 - [ObjC] Use empty Objective-C collection literal constants when

2017-04-15 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Sat Apr 15 01:42:00 2017
New Revision: 300396

URL: http://llvm.org/viewvc/llvm-project?rev=300396=rev
Log:
[ObjC] Use empty Objective-C collection literal constants when
available.

Original patch by Douglas Gregor with minor modifications.

This recommits r300389, which broke bots because there have been API
changes since the original patch was written.

rdar://problem/20689633

Added:
cfe/trunk/test/CodeGenObjC/empty-collection-literals.m
Modified:
cfe/trunk/include/clang/Basic/ObjCRuntime.h
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp

Modified: cfe/trunk/include/clang/Basic/ObjCRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/ObjCRuntime.h?rev=300396=300395=300396=diff
==
--- cfe/trunk/include/clang/Basic/ObjCRuntime.h (original)
+++ cfe/trunk/include/clang/Basic/ObjCRuntime.h Sat Apr 15 01:42:00 2017
@@ -326,6 +326,20 @@ public:
 }
   }
 
+  /// Are the empty collection symbols available?
+  bool hasEmptyCollections() const {
+switch (getKind()) {
+default:
+  return false;
+case MacOSX:
+  return getVersion() >= VersionTuple(10, 11);
+case iOS:
+  return getVersion() >= VersionTuple(9);
+case WatchOS:
+  return getVersion() >= VersionTuple(2);
+}
+  }
+
   /// \brief Try to parse an Objective-C runtime specification from the given
   /// string.
   ///

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=300396=300395=300396=diff
==
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Sat Apr 15 01:42:00 2017
@@ -117,10 +117,22 @@ llvm::Value *CodeGenFunction::EmitObjCCo
   const ObjCArrayLiteral *ALE = dyn_cast(E);
   if (!ALE)
 DLE = cast(E);
-  
-  // Compute the type of the array we're initializing.
+
+  // Optimize empty collections by referencing constants, when available.
   uint64_t NumElements = 
 ALE ? ALE->getNumElements() : DLE->getNumElements();
+  if (NumElements == 0 && CGM.getLangOpts().ObjCRuntime.hasEmptyCollections()) 
{
+StringRef ConstantName = ALE ? "__NSArray0__" : "__NSDictionary0__";
+QualType IdTy(CGM.getContext().getObjCIdType());
+llvm::Constant *Constant =
+CGM.CreateRuntimeVariable(ConvertType(IdTy), ConstantName);
+Address Addr(Constant, Context.getTypeAlignInChars(IdTy));
+LValue LV = MakeAddrLValue(Addr, IdTy);
+return Builder.CreateBitCast(EmitLoadOfScalar(LV, E->getLocStart()),
+ ConvertType(E->getType()));
+  }
+
+  // Compute the type of the array we're initializing.
   llvm::APInt APNumElements(Context.getTypeSize(Context.getSizeType()),
 NumElements);
   QualType ElementType = Context.getObjCIdType().withConst();

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=300396=300395=300396=diff
==
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sat Apr 15 01:42:00 2017
@@ -5980,9 +5980,21 @@ ExprResult Sema::MaybeBindToTemporary(Ex
   } else if (ObjCBoxedExpr *BoxedExpr = dyn_cast(E)) {
 D = BoxedExpr->getBoxingMethod();
   } else if (ObjCArrayLiteral *ArrayLit = dyn_cast(E)) {
+// Don't do reclaims if we're using the zero-element array
+// constant.
+if (ArrayLit->getNumElements() == 0 &&
+Context.getLangOpts().ObjCRuntime.hasEmptyCollections())
+  return E;
+
 D = ArrayLit->getArrayWithObjectsMethod();
   } else if (ObjCDictionaryLiteral *DictLit
 = dyn_cast(E)) {
+// Don't do reclaims if we're using the zero-element dictionary
+// constant.
+if (DictLit->getNumElements() == 0 &&
+Context.getLangOpts().ObjCRuntime.hasEmptyCollections())
+  return E;
+
 D = DictLit->getDictWithObjectsMethod();
   }
 

Added: cfe/trunk/test/CodeGenObjC/empty-collection-literals.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/empty-collection-literals.m?rev=300396=auto
==
--- cfe/trunk/test/CodeGenObjC/empty-collection-literals.m (added)
+++ cfe/trunk/test/CodeGenObjC/empty-collection-literals.m Sat Apr 15 01:42:00 
2017
@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-macosx10.10.0 
-fobjc-runtime=macosx-10.10.0 -emit-llvm -fblocks -fobjc-arc 
-fobjc-runtime-has-weak -o - %s | FileCheck 
-check-prefix=CHECK-WITHOUT-EMPTY-COLLECTIONS %s
+// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-macosx10.11.0 

r300395 - When we turn on vsx it should also turn on altivec explicitly, same

2017-04-15 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Sat Apr 15 01:15:00 2017
New Revision: 300395

URL: http://llvm.org/viewvc/llvm-project?rev=300395=rev
Log:
When we turn on vsx it should also turn on altivec explicitly, same
with disabling it as well as disabling all vsx specific features when
turning off altivec.

Fixes PR32663.

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=300395=300394=300395=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Apr 15 01:15:00 2017
@@ -1548,28 +1548,30 @@ bool PPCTargetInfo::hasFeature(StringRef
 
 void PPCTargetInfo::setFeatureEnabled(llvm::StringMap ,
   StringRef Name, bool Enabled) const {
-  // If we're enabling direct-move or power8-vector go ahead and enable vsx
-  // as well. Do the inverse if we're disabling vsx. We'll diagnose any user
-  // incompatible options.
   if (Enabled) {
-if (Name == "direct-move" ||
-Name == "power8-vector" ||
-Name == "float128" ||
-Name == "power9-vector") {
-  // power9-vector is really a superset of power8-vector so encode that.
-  Features[Name] = Features["vsx"] = true;
-  if (Name == "power9-vector")
-Features["power8-vector"] = true;
-} else {
-  Features[Name] = true;
-}
+// If we're enabling any of the vsx based features then enable vsx and
+// altivec. We'll diagnose any problems later.
+bool FeatureHasVSX = llvm::StringSwitch(Name)
+ .Case("vsx", true)
+ .Case("direct-move", true)
+ .Case("power8-vector", true)
+ .Case("power9-vector", true)
+ .Case("float128", true)
+ .Default(false);
+if (FeatureHasVSX)
+  Features["vsx"] = Features["altivec"] = true;
+if (Name == "power9-vector")
+  Features["power8-vector"] = true;
+Features[Name] = true;
   } else {
-if (Name == "vsx") {
-  Features[Name] = Features["direct-move"] = Features["power8-vector"] =
+// If we're disabling altivec or vsx go ahead and disable all of the vsx
+// features.
+if ((Name == "altivec") || (Name == "vsx"))
+  Features["vsx"] = Features["direct-move"] = Features["power8-vector"] =
   Features["float128"] = Features["power9-vector"] = false;
-} else {
-  Features[Name] = false;
-}
+if (Name == "power8-vector")
+  Features["power9-vector"] = false;
+Features[Name] = false;
   }
 }
 

Modified: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-arch-macros.c?rev=300395=300394=300395=diff
==
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c Sat Apr 15 01:15:00 
2017
@@ -1957,6 +1957,14 @@
 // End X86/GCC/Linux tests --
 
 // Begin PPC/GCC/Linux tests 
+// Check that VSX also turns on altivec.
+// RUN: %clang -mvsx -E -dM %s -o - 2>&1 \
+// RUN: -target powerpc-unknown-linux \
+// RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_PPC_VSX_M32
+//
+// CHECK_PPC_VSX_M32: #define __ALTIVEC__ 1
+// CHECK_PPC_VSX_M32: #define __VSX__ 1
+//
 // RUN: %clang -mvsx -E -dM %s -o - 2>&1 \
 // RUN: -target powerpc64-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_PPC_VSX_M64


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


r300392 - Do not run tests for crash recovery if libstdc++ safe mode is enabled

2017-04-15 Thread Serge Pavlov via cfe-commits
Author: sepavloff
Date: Sat Apr 15 00:53:49 2017
New Revision: 300392

URL: http://llvm.org/viewvc/llvm-project?rev=300392=rev
Log:
Do not run tests for crash recovery if libstdc++ safe mode is enabled

If expensive checks are enabled, safe mode of libstdc++ is enabled too.
In this mode the library uses more complex data that allow additional
checks, for instance, a container may keep list of iterators that points
to it. If a code crashes it can leave these complex library objects in
inconsistent state. It occurs in a few tests that check error recovery
if compiler crashes. These test hang in expensive check mode, as the
library tries to synchronize access to the iterators pointing to some
container, but corresponding mutex remains locked after the crash.

This fix marks these tests as unsupported if clang is built with
libstdc++ safe mode enabled.

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

Modified:
cfe/trunk/test/Index/crash-recovery-code-complete.c
cfe/trunk/test/Index/crash-recovery-modules.m
cfe/trunk/test/Index/crash-recovery-reparse.c
cfe/trunk/test/Index/crash-recovery.c
cfe/trunk/test/lit.cfg

Modified: cfe/trunk/test/Index/crash-recovery-code-complete.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/crash-recovery-code-complete.c?rev=300392=300391=300392=diff
==
--- cfe/trunk/test/Index/crash-recovery-code-complete.c (original)
+++ cfe/trunk/test/Index/crash-recovery-code-complete.c Sat Apr 15 00:53:49 2017
@@ -10,5 +10,6 @@
 
 // FIXME: Please investigate abnormal path in MemoryBuffer.
 // REQUIRES: can-remove-opened-file
+// UNSUPPORTED: libstdcxx-safe-mode
 
 #warning parsing original file

Modified: cfe/trunk/test/Index/crash-recovery-modules.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/crash-recovery-modules.m?rev=300392=300391=300392=diff
==
--- cfe/trunk/test/Index/crash-recovery-modules.m (original)
+++ cfe/trunk/test/Index/crash-recovery-modules.m Sat Apr 15 00:53:49 2017
@@ -4,7 +4,7 @@
 // Parse the file, such that building the module will cause Clang to crash.
 // RUN: not env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all 
-fmodules -fmodules-cache-path=%t -Xclang -fdisable-module-hash -I 
%S/Inputs/Headers -DCRASH %s > /dev/null 2> %t.err
 // RUN: FileCheck < %t.err -check-prefix=CHECK-CRASH %s
-// CHECK-CRASH: crash-recovery-modules.m:16:9:{16:2-16:14}: fatal error: could 
not build module 'Crash'
+// CHECK-CRASH: crash-recovery-modules.m:17:9:{17:2-17:14}: fatal error: could 
not build module 'Crash'
 
 // Parse the file again, without crashing, to make sure that
 // subsequent parses do the right thing.
@@ -12,6 +12,7 @@
 
 // REQUIRES: crash-recovery
 // REQUIRES: shell
+// UNSUPPORTED: libstdcxx-safe-mode
 
 @import Crash;
 

Modified: cfe/trunk/test/Index/crash-recovery-reparse.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/crash-recovery-reparse.c?rev=300392=300391=300392=diff
==
--- cfe/trunk/test/Index/crash-recovery-reparse.c (original)
+++ cfe/trunk/test/Index/crash-recovery-reparse.c Sat Apr 15 00:53:49 2017
@@ -7,5 +7,6 @@
 // CHECK-REPARSE-SOURCE-CRASH: Unable to reparse translation unit
 //
 // REQUIRES: crash-recovery
+// UNSUPPORTED: libstdcxx-safe-mode
 
 #warning parsing original file

Modified: cfe/trunk/test/Index/crash-recovery.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/crash-recovery.c?rev=300392=300391=300392=diff
==
--- cfe/trunk/test/Index/crash-recovery.c (original)
+++ cfe/trunk/test/Index/crash-recovery.c Sat Apr 15 00:53:49 2017
@@ -4,5 +4,6 @@
 // RUN: env LIBCLANG_DISABLE_CRASH_RECOVERY=1 not --crash c-index-test 
-test-load-source all %s
 //
 // REQUIRES: crash-recovery
+// UNSUPPORTED: libstdcxx-safe-mode
 
 #pragma clang __debug crash

Modified: cfe/trunk/test/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=300392=300391=300392=diff
==
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Sat Apr 15 00:53:49 2017
@@ -440,7 +440,8 @@ if not re.match(r'.*-(cygwin)$', config.
 if platform.system() not in ['Windows']:
 config.available_features.add('can-remove-opened-file')
 
-# Returns set of available features, registered-target(s) and asserts.
+# Returns set of available features, registered-target(s), asserts and
+# compile definitions.
 def get_llvm_config_props():
 set_of_features = set()
 
@@ -449,6 +450,7 @@ def get_llvm_config_props():
 os.path.join(llvm_tools_dir, 'llvm-config'),
 '--assertion-mode',
 '--targets-built',
+'--cxxflags'
 ],
 

[PATCH] D31126: Do not run tests for crash recovery if libstdc++ safe mode is enabled

2017-04-15 Thread Serge Pavlov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL300392: Do not run tests for crash recovery if libstdc++ 
safe mode is enabled (authored by sepavloff).

Changed prior to commit:
  https://reviews.llvm.org/D31126?vs=92276=95372#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31126

Files:
  cfe/trunk/test/Index/crash-recovery-code-complete.c
  cfe/trunk/test/Index/crash-recovery-modules.m
  cfe/trunk/test/Index/crash-recovery-reparse.c
  cfe/trunk/test/Index/crash-recovery.c
  cfe/trunk/test/lit.cfg


Index: cfe/trunk/test/Index/crash-recovery-reparse.c
===
--- cfe/trunk/test/Index/crash-recovery-reparse.c
+++ cfe/trunk/test/Index/crash-recovery-reparse.c
@@ -7,5 +7,6 @@
 // CHECK-REPARSE-SOURCE-CRASH: Unable to reparse translation unit
 //
 // REQUIRES: crash-recovery
+// UNSUPPORTED: libstdcxx-safe-mode
 
 #warning parsing original file
Index: cfe/trunk/test/Index/crash-recovery.c
===
--- cfe/trunk/test/Index/crash-recovery.c
+++ cfe/trunk/test/Index/crash-recovery.c
@@ -4,5 +4,6 @@
 // RUN: env LIBCLANG_DISABLE_CRASH_RECOVERY=1 not --crash c-index-test 
-test-load-source all %s
 //
 // REQUIRES: crash-recovery
+// UNSUPPORTED: libstdcxx-safe-mode
 
 #pragma clang __debug crash
Index: cfe/trunk/test/Index/crash-recovery-code-complete.c
===
--- cfe/trunk/test/Index/crash-recovery-code-complete.c
+++ cfe/trunk/test/Index/crash-recovery-code-complete.c
@@ -10,5 +10,6 @@
 
 // FIXME: Please investigate abnormal path in MemoryBuffer.
 // REQUIRES: can-remove-opened-file
+// UNSUPPORTED: libstdcxx-safe-mode
 
 #warning parsing original file
Index: cfe/trunk/test/Index/crash-recovery-modules.m
===
--- cfe/trunk/test/Index/crash-recovery-modules.m
+++ cfe/trunk/test/Index/crash-recovery-modules.m
@@ -4,14 +4,15 @@
 // Parse the file, such that building the module will cause Clang to crash.
 // RUN: not env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all 
-fmodules -fmodules-cache-path=%t -Xclang -fdisable-module-hash -I 
%S/Inputs/Headers -DCRASH %s > /dev/null 2> %t.err
 // RUN: FileCheck < %t.err -check-prefix=CHECK-CRASH %s
-// CHECK-CRASH: crash-recovery-modules.m:16:9:{16:2-16:14}: fatal error: could 
not build module 'Crash'
+// CHECK-CRASH: crash-recovery-modules.m:17:9:{17:2-17:14}: fatal error: could 
not build module 'Crash'
 
 // Parse the file again, without crashing, to make sure that
 // subsequent parses do the right thing.
 // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all 
-fmodules -fmodules-cache-path=%t -Xclang -fdisable-module-hash -I 
%S/Inputs/Headers %s > /dev/null
 
 // REQUIRES: crash-recovery
 // REQUIRES: shell
+// UNSUPPORTED: libstdcxx-safe-mode
 
 @import Crash;
 
Index: cfe/trunk/test/lit.cfg
===
--- cfe/trunk/test/lit.cfg
+++ cfe/trunk/test/lit.cfg
@@ -440,15 +440,17 @@
 if platform.system() not in ['Windows']:
 config.available_features.add('can-remove-opened-file')
 
-# Returns set of available features, registered-target(s) and asserts.
+# Returns set of available features, registered-target(s), asserts and
+# compile definitions.
 def get_llvm_config_props():
 set_of_features = set()
 
 cmd = subprocess.Popen(
 [
 os.path.join(llvm_tools_dir, 'llvm-config'),
 '--assertion-mode',
 '--targets-built',
+'--cxxflags'
 ],
 stdout=subprocess.PIPE,
 env=config.environment
@@ -463,6 +465,11 @@
 for arch in cmd.stdout.readline().decode('ascii').split():
 set_of_features.add(arch.lower() + '-registered-target')
 
+# 3rd line contains compile definitions, search it to define if
+# libstdc++ safe mode is set.
+if re.search(r'-D_GLIBCXX_DEBUG\b', cmd.stdout.readline().decode('ascii')):
+set_of_features.add('libstdcxx-safe-mode')
+
 return set_of_features
 
 config.available_features.update(get_llvm_config_props())


Index: cfe/trunk/test/Index/crash-recovery-reparse.c
===
--- cfe/trunk/test/Index/crash-recovery-reparse.c
+++ cfe/trunk/test/Index/crash-recovery-reparse.c
@@ -7,5 +7,6 @@
 // CHECK-REPARSE-SOURCE-CRASH: Unable to reparse translation unit
 //
 // REQUIRES: crash-recovery
+// UNSUPPORTED: libstdcxx-safe-mode
 
 #warning parsing original file
Index: cfe/trunk/test/Index/crash-recovery.c
===
--- cfe/trunk/test/Index/crash-recovery.c
+++ cfe/trunk/test/Index/crash-recovery.c
@@ -4,5 +4,6 @@
 // RUN: env LIBCLANG_DISABLE_CRASH_RECOVERY=1 not --crash c-index-test -test-load-source all %s
 //
 // REQUIRES: crash-recovery
+//