[PATCH] D27116: Fix crash when using __has_nothrow_copy with inherited constructors

2016-11-26 Thread Philippe Daouadi via Phabricator via cfe-commits
blastrock abandoned this revision.
blastrock added a comment.

No, https://reviews.llvm.org/D23765 seems to fix this issue.


https://reviews.llvm.org/D27116



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


[libcxx] r287981 - Implement the 'detection idiom' from LFTS v2

2016-11-26 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Sat Nov 26 09:49:40 2016
New Revision: 287981

URL: http://llvm.org/viewvc/llvm-project?rev=287981&view=rev
Log:
Implement the 'detection idiom' from LFTS v2

Added:
libcxx/trunk/test/std/experimental/utilities/meta/meta.detect/

libcxx/trunk/test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp

libcxx/trunk/test/std/experimental/utilities/meta/meta.detect/detected_t.pass.cpp

libcxx/trunk/test/std/experimental/utilities/meta/meta.detect/is_detected.pass.cpp

libcxx/trunk/test/std/experimental/utilities/meta/meta.detect/is_detected_convertible.pass.cpp

libcxx/trunk/test/std/experimental/utilities/meta/meta.detect/is_detected_exact.pass.cpp
Modified:
libcxx/trunk/include/experimental/type_traits

Modified: libcxx/trunk/include/experimental/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/type_traits?rev=287981&r1=287980&r2=287981&view=diff
==
--- libcxx/trunk/include/experimental/type_traits (original)
+++ libcxx/trunk/include/experimental/type_traits Sat Nov 26 09:49:40 2016
@@ -172,6 +172,45 @@ inline namespace fundamentals_v1 {
   template 
 using raw_invocation_type_t = typename raw_invocation_type::type;
 
+  // 3.3.3, Logical operator traits
+  template struct conjunction;
+  template constexpr bool conjunction_v = conjunction::value;
+  template struct disjunction;
+  template constexpr bool disjunction_v = disjunction::value;
+  template struct negation;
+  template constexpr bool negation_v = negation::value;
+
+  // 3.3.4, Detection idiom
+  template  using void_t = void;
+
+  struct nonesuch {
+nonesuch() = delete;
+~nonesuch() = delete;
+nonesuch(nonesuch const&) = delete;
+void operator=(nonesuch const&) = delete;
+  };
+
+  template  class Op, class... Args>
+using is_detected = see below;
+  template  class Op, class... Args>
+constexpr bool is_detected_v = is_detected::value;
+  template  class Op, class... Args>
+using detected_t = see below;
+  template  class Op, class... Args>
+using detected_or = see below;
+  template  class Op, class... Args>
+using detected_or_t = typename detected_or::type;
+  template  class Op, class... Args>
+using is_detected_exact = is_same>;
+  template  class Op, class... Args>
+constexpr bool is_detected_exact_v
+  = is_detected_exact::value;
+  template  class Op, class... Args>
+ using is_detected_convertible = is_convertible, 
To>;
+  template  class Op, class... Args>
+ constexpr bool is_detected_convertible_v
+   = is_detected_convertible::value;  
+
 } // namespace fundamentals_v1
 } // namespace experimental
 } // namespace std
@@ -420,6 +459,52 @@ template 
 using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
 */
 
+// 3.3.4, Detection idiom
+template  using void_t = void;
+
+struct nonesuch {
+nonesuch()  = delete;
+~nonesuch() = delete;
+nonesuch  (nonesuch const&) = delete;
+void operator=(nonesuch const&) = delete;
+  };
+
+template  class _Op, 
class... _Args>
+struct _DETECTOR {
+   using value_t = false_type;
+   using type = _Default;
+   };
+
+template  class _Op, class... _Args>
+struct _DETECTOR<_Default, void_t<_Op<_Args...>>, _Op, _Args...> {
+   using value_t = true_type;
+   using type = _Op<_Args...>;
+   };
+ 
+
+template  class _Op, class... _Args>
+  using is_detected = typename _DETECTOR::value_t;
+template  class _Op, class... _Args>
+  using detected_t = typename _DETECTOR::type;
+template  class _Op, class... _Args>
+  _LIBCPP_CONSTEXPR bool is_detected_v = is_detected<_Op, _Args...>::value;
+
+template  class _Op, class... _Args>
+  using detected_or = _DETECTOR;
+template  class _Op, class... _Args>
+  using detected_or_t = typename detected_or::type;
+
+template  class _Op, class... _Args>
+  using is_detected_exact = is_same>;
+template  class _Op, class... _Args>
+  _LIBCPP_CONSTEXPR bool is_detected_exact_v = is_detected_exact::value;
+
+template  class _Op, class... _Args>
+  using is_detected_convertible = is_convertible, 
To>;
+template  class _Op, class... _Args>
+  _LIBCPP_CONSTEXPR bool is_detected_convertible_v = 
is_detected_convertible::value;  
+
+
 _LIBCPP_END_NAMESPACE_LFTS
 
 #endif /* _LIBCPP_STD_VER > 11 */

Added: 
libcxx/trunk/test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp?rev=287981&view=auto
==
--- 
libcxx/trunk/test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp
 Sat Nov 26 09:49:40 2016
@@ -0,0 +1,40 @@
+//===--===//

[PATCH] D21298: [Clang-tidy] delete null check

2016-11-26 Thread Gergely Angeli via Phabricator via cfe-commits
SilverGeri updated this revision to Diff 79338.
SilverGeri added a comment.
Herald added a subscriber: JDevlieghere.

only warn, not fix when the 'if' statement has 'else' clause
keeping comments


https://reviews.llvm.org/D21298

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/DeleteNullPointerCheck.cpp
  clang-tidy/readability/DeleteNullPointerCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-delete-null-pointer.rst
  test/clang-tidy/readability-delete-null-pointer.cpp

Index: test/clang-tidy/readability-delete-null-pointer.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-delete-null-pointer.cpp
@@ -0,0 +1,71 @@
+// RUN: %check_clang_tidy %s readability-delete-null-pointer %t
+
+#define NULL 0
+
+void f() {
+  int *p = 0;
+  // CHECK-FIXES: // comment that should not be deleted
+  if (p) {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
+// comment that should not be deleted
+delete p;
+  }
+  // CHECK-FIXES-NOT: if (p) {
+  // CHECK-FIXES: delete p;
+
+
+  int *p2 = new int[3];
+  // CHECK-FIXES: // another comment to keep
+  if (p2)
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
+// another comment to keep
+delete[] p2;
+  // CHECK-FIXES-NOT: if (p2)
+  // CHECK-FIXES: delete[] p2;
+
+  int *p3 = 0;
+  if (NULL != p3) {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
+delete p3;
+  }
+  // CHECK-FIXES-NOT: if (NULL != p3) {
+  // CHECK-FIXES: delete p3;
+
+  int *p4 = nullptr;
+  if (p4 != nullptr) {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
+delete p4;
+  }
+  // CHECK-FIXES-NOT: if (p4 != nullptr) {
+  // CHECK-FIXES: delete p4;
+
+  char *c;
+  if (c != 0) {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
+delete c;
+  }
+  // CHECK-FIXES-NOT: if (c != 0) {
+  // CHECK-FIXES: delete c;
+
+  char *c2;
+  if (c2) {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
+delete c2;
+  } else {
+c2 = c;
+  }
+}
+
+void g() {
+  int *p5, *p6;
+  if (p5)
+delete p6;
+
+  if (p5 && p6)
+delete p5;
+
+  if (p6) {
+int x = 5;
+delete p6;
+  }
+}
Index: docs/clang-tidy/checks/readability-delete-null-pointer.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/readability-delete-null-pointer.rst
@@ -0,0 +1,12 @@
+.. title:: clang-tidy - readability-delete-null-pointer
+
+readability-delete-null-pointer
+===
+
+Checks the 'if' statements where a pointer's existence is checked and then deletes the pointer.
+The check is unnecessary as deleting a nullpointer has no effect.
+
+.. code:: c++
+  int *p;
+  if (p)
+delete p;
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -127,6 +127,7 @@
readability-avoid-const-params-in-decls
readability-braces-around-statements
readability-container-size-empty
+   readability-delete-null-pointer
readability-deleted-default
readability-else-after-return
readability-function-size
Index: clang-tidy/readability/ReadabilityTidyModule.cpp
===
--- clang-tidy/readability/ReadabilityTidyModule.cpp
+++ clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -13,6 +13,7 @@
 #include "AvoidConstParamsInDecls.h"
 #include "BracesAroundStatementsCheck.h"
 #include "ContainerSizeEmptyCheck.h"
+#include "DeleteNullPointerCheck.h"
 #include "DeletedDefaultCheck.h"
 #include "ElseAfterReturnCheck.h"
 #include "FunctionSizeCheck.h"
@@ -45,6 +46,8 @@
 "readability-braces-around-statements");
 CheckFactories.registerCheck(
 "readability-container-size-empty");
+CheckFactories.registerCheck(
+"readability-delete-null-pointer");
 CheckFactories.registerCheck(
 "readability-deleted-default");
 CheckFactories.registerCheck(
Index: clang-tidy/readability/DeleteNullPointerCheck.h
===
--- /dev/null
+++ clang-tidy/readability/DeleteNullPointerCheck.h
@@ -0,0 +1,35 @@
+//===--- DeleteNullPointerCheck.h - clang-tidy---*- C++ -*-===//
+//
+//

[libcxx] r287988 - Implement conjuntion/disjuntion/negation for LFTS v2. Same code and tests for the ones in std::

2016-11-26 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Sat Nov 26 12:45:03 2016
New Revision: 287988

URL: http://llvm.org/viewvc/llvm-project?rev=287988&view=rev
Log:
Implement conjuntion/disjuntion/negation for LFTS v2. Same code and tests for 
the ones in std::

Added:
libcxx/trunk/test/std/experimental/utilities/meta/meta.logical/

libcxx/trunk/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp

libcxx/trunk/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp

libcxx/trunk/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp
Modified:
libcxx/trunk/include/experimental/type_traits

Modified: libcxx/trunk/include/experimental/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/type_traits?rev=287988&r1=287987&r2=287988&view=diff
==
--- libcxx/trunk/include/experimental/type_traits (original)
+++ libcxx/trunk/include/experimental/type_traits Sat Nov 26 12:45:03 2016
@@ -459,6 +459,24 @@ template 
 using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
 */
 
+// 3.3.3, Logical operator traits
+template  using void_t = void;
+
+template 
+struct conjunction : _VSTD::__and_<_Args...> {};
+template 
+_LIBCPP_CONSTEXPR bool conjunction_v = conjunction<_Args...>::value;
+
+template 
+struct disjunction : _VSTD::__or_<_Args...> {};
+template 
+_LIBCPP_CONSTEXPR bool disjunction_v = disjunction<_Args...>::value;
+
+template 
+struct negation : _VSTD::__not_<_Tp> {};
+template
+_LIBCPP_CONSTEXPR bool negation_v = negation<_Tp>::value;
+
 // 3.3.4, Detection idiom
 template  using void_t = void;
 

Added: 
libcxx/trunk/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp?rev=287988&view=auto
==
--- 
libcxx/trunk/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp
 Sat Nov 26 12:45:03 2016
@@ -0,0 +1,68 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// 
+
+// template struct conjunction;   // C++17
+// template
+//   constexpr bool conjunction_v = conjunction::value; // C++17
+
+#include 
+#include 
+
+namespace ex = std::experimental;
+
+struct True  { static constexpr bool value = true; };
+struct False { static constexpr bool value = false; };
+
+int main()
+{
+static_assert ( ex::conjunction<>::value, "" );
+static_assert ( ex::conjunction::value, "" );
+static_assert (!ex::conjunction::value, "" );
+
+static_assert ( ex::conjunction_v<>, "" );
+static_assert ( ex::conjunction_v, "" );
+static_assert (!ex::conjunction_v, "" );
+
+static_assert ( ex::conjunction::value, 
"" );
+static_assert (!ex::conjunction::value, 
"" );
+static_assert (!ex::conjunction::value, 
"" );
+static_assert (!ex::conjunction::value, 
"" );
+
+static_assert ( ex::conjunction_v, "" );
+static_assert (!ex::conjunction_v, "" );
+static_assert (!ex::conjunction_v, "" );
+static_assert (!ex::conjunction_v, "" );
+
+static_assert ( ex::conjunction::value, "" );
+static_assert (!ex::conjunction::value, "" );
+static_assert (!ex::conjunction::value, "" );
+static_assert (!ex::conjunction::value, "" );
+static_assert (!ex::conjunction::value, "" );
+static_assert (!ex::conjunction::value, "" );
+static_assert (!ex::conjunction::value, "" );
+static_assert (!ex::conjunction::value, "" );
+
+static_assert ( ex::conjunction_v, "" );
+static_assert (!ex::conjunction_v, "" );
+static_assert (!ex::conjunction_v, "" );
+static_assert (!ex::conjunction_v, "" );
+static_assert (!ex::conjunction_v, "" );
+static_assert (!ex::conjunction_v, "" );
+static_assert (!ex::conjunction_v, "" );
+static_assert (!ex::conjunction_v, "" );
+
+static_assert ( ex::conjunction::value, "" );
+static_assert (!ex::conjunction::value, "" );
+
+static_assert ( ex::conjunction_v, "" );
+static_assert (!ex::conjunction_v, "" );
+}

Added: 
libcxx/trunk/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp?rev=287988&view=auto
==
--- 
libcxx/trunk

r287990 - [DOXYGEN] Updated instruction names corresponding to avxintrin.h intrinsics.

2016-11-26 Thread Ekaterina Romanova via cfe-commits
Author: kromanova
Date: Sat Nov 26 13:38:19 2016
New Revision: 287990

URL: http://llvm.org/viewvc/llvm-project?rev=287990&view=rev
Log:
[DOXYGEN] Updated instruction names corresponding to avxintrin.h intrinsics.

Documentation for some of the avxintrin.h's intrinsics errorneously said that
non VEX-prefixed instructions could be generated. This was fixed.

I tried several different solutions to achieve pretty printing of unordered 
lists (nested and non-nested) in param sections in doxygen. 


Modified:
cfe/trunk/lib/Headers/avxintrin.h

Modified: cfe/trunk/lib/Headers/avxintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avxintrin.h?rev=287990&r1=287989&r2=287990&view=diff
==
--- cfe/trunk/lib/Headers/avxintrin.h (original)
+++ cfe/trunk/lib/Headers/avxintrin.h Sat Nov 26 13:38:19 2016
@@ -57,7 +57,7 @@ typedef long long __m256i __attribute__(
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VADDPD / ADDPD instruction.
+/// This intrinsic corresponds to the \c VADDPD instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [4 x double] containing one of the source operands.
@@ -75,7 +75,7 @@ _mm256_add_pd(__m256d __a, __m256d __b)
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VADDPS / ADDPS instruction.
+/// This intrinsic corresponds to the \c VADDPS instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [8 x float] containing one of the source operands.
@@ -93,7 +93,7 @@ _mm256_add_ps(__m256 __a, __m256 __b)
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VSUBPD / SUBPD instruction.
+/// This intrinsic corresponds to the \c VSUBPD instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [4 x double] containing the minuend.
@@ -111,7 +111,7 @@ _mm256_sub_pd(__m256d __a, __m256d __b)
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VSUBPS / SUBPS instruction.
+/// This intrinsic corresponds to the \c VSUBPS instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [8 x float] containing the minuend.
@@ -130,7 +130,7 @@ _mm256_sub_ps(__m256 __a, __m256 __b)
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VADDSUBPD / ADDSUBPD instruction.
+/// This intrinsic corresponds to the \c VADDSUBPD instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [4 x double] containing the left source operand.
@@ -149,7 +149,7 @@ _mm256_addsub_pd(__m256d __a, __m256d __
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VADDSUBPS / ADDSUBPS instruction.
+/// This intrinsic corresponds to the \c VADDSUBPS instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [8 x float] containing the left source operand.
@@ -167,7 +167,7 @@ _mm256_addsub_ps(__m256 __a, __m256 __b)
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VDIVPD / DIVPD instruction.
+/// This intrinsic corresponds to the \c VDIVPD instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [4 x double] containing the dividend.
@@ -185,7 +185,7 @@ _mm256_div_pd(__m256d __a, __m256d __b)
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VDIVPS / DIVPS instruction.
+/// This intrinsic corresponds to the \c VDIVPS instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [8 x float] containing the dividend.
@@ -204,7 +204,7 @@ _mm256_div_ps(__m256 __a, __m256 __b)
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VMAXPD / MAXPD instruction.
+/// This intrinsic corresponds to the \c VMAXPD instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [4 x double] containing one of the operands.
@@ -223,7 +223,7 @@ _mm256_max_pd(__m256d __a, __m256d __b)
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VMAXPS / MAXPS instruction.
+/// This intrinsic corresponds to the \c VMAXPS instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [8 x float] containing one of the operands.
@@ -242,7 +242,7 @@ _mm256_max_ps(__m256 __a, __m256 __b)
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VMINPD / MINPD instruction.
+/// This intrinsic corresponds to the \c VMINPD instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [4 x double] containing one of the operands.
@@ -261,7 +261,7 @@ _mm256_min_pd(__m256d __a, __m256d __b)
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VMINPS / MINPS instruction.
+/// This intrinsic corresponds to the \c VMINPS instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [8 x float] containing one of the operands.
@@ -279,7 +279,7 @@ _mm256_min_ps(__m256 __a, __m256 __b)
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VMULPD / MULPD instruction.
+/// This intrinsic corresponds to the \c VMULPD instruction.
 ///
 /// \param __a
 ///A 256-bit vector of [4 x double] containing one of the operands.
@@ -297,7 +297,7 @@ _mm25

[PATCH] D27049: [OpenCL] Refactor out ReadPipe/WritePipe

2016-11-26 Thread Yaron Keren via Phabricator via cfe-commits
yaron.keren added inline comments.



Comment at: lib/AST/ASTContext.cpp:8258
   return RHS;
-return isa(LHS) ? getReadPipeType(ResultType)
-  : getWritePipeType(ResultType);
+const PipeType *PT = LHS->getAs();
+return PT->isReadOnly() ? getReadPipeType(ResultType)

I'm not too familar how PipeTypes should be merged, is it on purpose the 
process is not commutative,

ReadPipeType merged with WritePipeType is ReadPipeType

WritePipeType merged with ReadPipeType is WritePipeType 



Repository:
  rL LLVM

https://reviews.llvm.org/D27049



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