r323078 - [NFC] fix trivial typos in comments

2018-01-21 Thread Hiroshi Inoue via cfe-commits
Author: inouehrs
Date: Sun Jan 21 23:44:38 2018
New Revision: 323078

URL: http://llvm.org/viewvc/llvm-project?rev=323078=rev
Log:
[NFC] fix trivial typos in comments

"the the" -> "the"


Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/GTestChecker.cpp
cfe/trunk/test/Analysis/copypaste/macro-complexity.cpp
cfe/trunk/test/Analysis/malloc-custom.c
cfe/trunk/utils/analyzer/SATestAdd.py
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp?rev=323078=323077=323078=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp Sun Jan 21 
23:44:38 2018
@@ -645,7 +645,7 @@ ObjCDeallocChecker::findPropertyOnDeallo
 bool ObjCDeallocChecker::diagnoseExtraRelease(SymbolRef ReleasedValue,
   const ObjCMethodCall ,
   CheckerContext ) const {
-  // Try to get the region from which the the released value was loaded.
+  // Try to get the region from which the released value was loaded.
   // Note that, unlike diagnosing for missing releases, here we don't track
   // values that must not be released in the state. This is because even if
   // these values escape, it is still an error under the rules of MRR to

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/GTestChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/GTestChecker.cpp?rev=323078=323077=323078=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/GTestChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/GTestChecker.cpp Sun Jan 21 23:44:38 
2018
@@ -161,7 +161,7 @@ void GTestChecker::modelAssertionResultC
 const CXXConstructorCall *Call, CheckerContext ) const {
   assert(Call->getNumArgs() == 1);
 
-  // The first parameter of the the copy constructor must be the other
+  // The first parameter of the copy constructor must be the other
   // instance to initialize this instances fields from.
   SVal OtherVal = Call->getArgSVal(0);
   SVal ThisVal = Call->getCXXThisVal();

Modified: cfe/trunk/test/Analysis/copypaste/macro-complexity.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/copypaste/macro-complexity.cpp?rev=323078=323077=323078=diff
==
--- cfe/trunk/test/Analysis/copypaste/macro-complexity.cpp (original)
+++ cfe/trunk/test/Analysis/copypaste/macro-complexity.cpp Sun Jan 21 23:44:38 
2018
@@ -1,7 +1,7 @@
 // RUN: %clang_analyze_cc1 -std=c++11 
-analyzer-checker=alpha.clone.CloneChecker -analyzer-config 
alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s
 
 // Tests that the complexity value of a macro expansion is about the same as
-// the complexity value of a normal function call and the the macro body 
doesn't
+// the complexity value of a normal function call and the macro body doesn't
 // influence the complexity. See the CloneSignature class in CloneDetection.h
 // for more information about complexity values of clones.
 

Modified: cfe/trunk/test/Analysis/malloc-custom.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/malloc-custom.c?rev=323078=323077=323078=diff
==
--- cfe/trunk/test/Analysis/malloc-custom.c (original)
+++ cfe/trunk/test/Analysis/malloc-custom.c Sun Jan 21 23:44:38 2018
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc 
-Wno-incompatible-library-redeclaration -verify %s
 
-// Various tests to make the the analyzer is robust against custom
+// Various tests to make the analyzer is robust against custom
 // redeclarations of memory routines.
 //
 // You wouldn't expect to see much of this in normal code, but, for example,

Modified: cfe/trunk/utils/analyzer/SATestAdd.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestAdd.py?rev=323078=323077=323078=diff
==
--- cfe/trunk/utils/analyzer/SATestAdd.py (original)
+++ cfe/trunk/utils/analyzer/SATestAdd.py Sun Jan 21 23:44:38 2018
@@ -32,11 +32,11 @@ the Repository Directory.
  (e.g., to adapt to newer version of clang)
  that should be applied to CachedSource
  before analysis. To construct this patch,
- run the the download script to download
+ run the download script to download
 

[PATCH] D42359: a simple comment fix in include/list

2018-01-21 Thread Qian Yun via Phabricator via cfe-commits
oldk1331 created this revision.
Herald added a subscriber: cfe-commits.

Hello all,

This is a simple (and my first) patch that fixes a comment
in include/list.

Qian Yun


Repository:
  rCXX libc++

https://reviews.llvm.org/D42359

Files:
  include/list


Index: include/list
===
--- include/list
+++ include/list
@@ -1130,7 +1130,7 @@
 base::__end_.__next_ = __f;
 }
 
-// Link in nodes [__f, __l] at the front of the list
+// Link in nodes [__f, __l] at the back of the list
 template 
 inline
 void


Index: include/list
===
--- include/list
+++ include/list
@@ -1130,7 +1130,7 @@
 base::__end_.__next_ = __f;
 }
 
-// Link in nodes [__f, __l] at the front of the list
+// Link in nodes [__f, __l] at the back of the list
 template 
 inline
 void
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42319: [CUDA] CUDA has no device-side library builtins.

2018-01-21 Thread Justin Lebar via Phabricator via cfe-commits
jlebar added a comment.

How does this affect e.g. calling memcpy()?  There isn't a standard library 
implementation of this on nvptx, but we do want calls to memcpy() to be lowered 
to llvm.memcpy so that they can be optimized.


https://reviews.llvm.org/D42319



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


[PATCH] D42357: Under limitation of allocated buffer, inplace_merge does NOT take usge of partial allocated buffer but uses native rotate directly. It makes the performace far behind from correspondin

2018-01-21 Thread WeiChungChang via Phabricator via cfe-commits
WeiChungChang created this revision.
Herald added a subscriber: cfe-commits.

...buffer firstly. Experiment shows 28.35% & 25.06% speedup for merging two 
equal size sorted integers for -O3 & no -O3 cases.


Repository:
  rCXX libc++

https://reviews.llvm.org/D42357

Files:
  include/algorithm


Index: include/algorithm
===
--- include/algorithm
+++ include/algorithm
@@ -2497,6 +2497,41 @@
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 _ForwardIterator
+__buffered__rotate(_ForwardIterator __first, _ForwardIterator __middle, 
_ForwardIterator __last,
+ typename iterator_traits<_ForwardIterator>::value_type* __buff, 
ptrdiff_t __buff_size)
+{
+if (__first == __middle)
+return __last;
+if (__middle == __last)
+return __first;
+typedef typename _VSTD::iterator_traits<_ForwardIterator>::value_type 
value_type;
+typedef typename _VSTD::iterator_traits<_ForwardIterator>::difference_type 
difference_type;
+typedef typename _VSTD::iterator_traits<_ForwardIterator>::value_type* 
pointer;
+difference_type __len1, __len2;
+__len1 = __middle - __first;
+__len2 = __last - __middle;
+if ((__len1 <= __buff_size) && __len1 < __len2) 
+{
+pointer __buff_end = __move(__first, __middle,  __buff);
+__move(__middle, __last, __first);
+return __move_backward(__buff, __buff_end, __last);
+}
+else if (__len2 <= __buff_size)
+{
+pointer __buffer_end = __move(__middle, __last,  __buff);
+__move_backward(__first, __middle, __last);
+return __move(__buff, __buffer_end, __first);
+}
+else
+{
+return _VSTD::__rotate(__first, __middle, __last,
+   typename 
_VSTD::iterator_traits<_ForwardIterator>::iterator_category());
+}
+}
+
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
 rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator 
__last)
 {
 if (__first == __middle)
@@ -4543,7 +4578,8 @@
 difference_type __len22 = __len2 - __len21;  // distance(__m2, __last)
 // [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last)
 // swap middle two partitions
-__middle = _VSTD::rotate(__m1, __middle, __m2);
+//__middle = _VSTD::rotate(__m1, __middle, __m2);
+__middle = _VSTD::__buffered_rotate(__m1, __middle, __m2, __buff, 
__buff_size);
 // __len12 and __len21 now have swapped meanings
 // merge smaller range with recurisve call and larger with tail 
recursion elimination
 if (__len11 + __len21 < __len12 + __len22)


Index: include/algorithm
===
--- include/algorithm
+++ include/algorithm
@@ -2497,6 +2497,41 @@
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 _ForwardIterator
+__buffered__rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
+ typename iterator_traits<_ForwardIterator>::value_type* __buff, ptrdiff_t __buff_size)
+{
+if (__first == __middle)
+return __last;
+if (__middle == __last)
+return __first;
+typedef typename _VSTD::iterator_traits<_ForwardIterator>::value_type value_type;
+typedef typename _VSTD::iterator_traits<_ForwardIterator>::difference_type difference_type;
+typedef typename _VSTD::iterator_traits<_ForwardIterator>::value_type* pointer;
+difference_type __len1, __len2;
+__len1 = __middle - __first;
+__len2 = __last - __middle;
+if ((__len1 <= __buff_size) && __len1 < __len2) 
+{
+pointer __buff_end = __move(__first, __middle,  __buff);
+__move(__middle, __last, __first);
+return __move_backward(__buff, __buff_end, __last);
+}
+else if (__len2 <= __buff_size)
+{
+pointer __buffer_end = __move(__middle, __last,  __buff);
+__move_backward(__first, __middle, __last);
+return __move(__buff, __buffer_end, __first);
+}
+else
+{
+return _VSTD::__rotate(__first, __middle, __last,
+   typename _VSTD::iterator_traits<_ForwardIterator>::iterator_category());
+}
+}
+
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
 rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
 {
 if (__first == __middle)
@@ -4543,7 +4578,8 @@
 difference_type __len22 = __len2 - __len21;  // distance(__m2, __last)
 // [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last)
 // swap middle two partitions
-__middle = _VSTD::rotate(__m1, __middle, __m2);
+//__middle = _VSTD::rotate(__m1, __middle, __m2);
+__middle = _VSTD::__buffered_rotate(__m1, __middle, __m2, __buff, __buff_size);
 // __len12 and __len21 now have swapped meanings
 // merge smaller range with recurisve call and larger with tail recursion elimination
   

[libcxx] r323072 - Really comment out the constexpr tests.

2018-01-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Sun Jan 21 17:51:49 2018
New Revision: 323072

URL: http://llvm.org/viewvc/llvm-project?rev=323072=rev
Log:
Really comment out the constexpr tests.

Modified:
libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp
libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp

Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp?rev=323072=323071=323072=diff
==
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp 
(original)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp Sun 
Jan 21 17:51:49 2018
@@ -26,20 +26,20 @@
 #include "test_iterators.h"
 
 
-#if TEST_STD_VER > 17
-TEST_CONSTEXPR bool test_constexpr() {
-  int ia[]   = {0, 1, 2, 3, 4};
-  int ib[]   = {2, 4, 6, 8};
-  int ic[]   = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8};
-
-auto it = std::merge(std::begin(ia), std::end(ia), std::begin(ib), 
std::end(ib), std::begin(ic));
-return std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib))
-&& *it == 0
-&& std::equal(std::begin(ic), it, std::begin(expected), 
std::end(expected))
-;
-}
-#endif
+// #if TEST_STD_VER > 17
+// TEST_CONSTEXPR bool test_constexpr() {
+//   int ia[]   = {0, 1, 2, 3, 4};
+//   int ib[]   = {2, 4, 6, 8};
+//   int ic[]   = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+// const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8};
+// 
+// auto it = std::merge(std::begin(ia), std::end(ia), std::begin(ib), 
std::end(ib), std::begin(ic));
+// return std::distance(std::begin(ic), it) == (std::size(ia) + 
std::size(ib))
+// && *it == 0
+// && std::equal(std::begin(ic), it, std::begin(expected), 
std::end(expected))
+// ;
+// }
+// #endif
 
 std::mt19937 randomness;
 

Modified: 
libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp?rev=323072=323071=323072=diff
==
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp 
(original)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp 
Sun Jan 21 17:51:49 2018
@@ -29,22 +29,22 @@
 #include "test_iterators.h"
 #include "counting_predicates.hpp"
 
-#if TEST_STD_VER > 17
-TEST_CONSTEXPR bool test_constexpr() {
-  int ia[]   = {0, 1, 2, 3, 4};
-  int ib[]   = {2, 4, 6, 8};
-  int ic[]   = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8};
-
-auto it = std::merge(std::begin(ia), std::end(ia), 
- std::begin(ib), std::end(ib),
- std::begin(ic), [](int a, int b) {return a == b; });
-return std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib))
-&& *it == 0
-&& std::equal(std::begin(ic), it, std::begin(expected), 
std::end(expected))
-;
-}
-#endif
+// #if TEST_STD_VER > 17
+// TEST_CONSTEXPR bool test_constexpr() {
+//   int ia[]   = {0, 1, 2, 3, 4};
+//   int ib[]   = {2, 4, 6, 8};
+//   int ic[]   = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+// const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8};
+// 
+// auto it = std::merge(std::begin(ia), std::end(ia), 
+//  std::begin(ib), std::end(ib),
+//  std::begin(ic), [](int a, int b) {return a == b; 
});
+// return std::distance(std::begin(ic), it) == (std::size(ia) + 
std::size(ib))
+// && *it == 0
+// && std::equal(std::begin(ic), it, std::begin(expected), 
std::end(expected))
+// ;
+// }
+// #endif
 
 std::mt19937 randomness;
 


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


[libcxx] r323071 - Change a static_assert to check for is_trivial instead of is_pod, as is mandated by P0767.

2018-01-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Sun Jan 21 16:17:48 2018
New Revision: 323071

URL: http://llvm.org/viewvc/llvm-project?rev=323071=rev
Log:
Change a static_assert to check for is_trivial instead of is_pod, as is 
mandated by P0767.

Modified:
libcxx/trunk/include/string
libcxx/trunk/include/string_view

Modified: libcxx/trunk/include/string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=323071=323070=323071=diff
==
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Sun Jan 21 16:17:48 2018
@@ -651,7 +651,7 @@ public:
 typedef typename __alloc_traits::pointer pointer;
 typedef typename __alloc_traits::const_pointer   const_pointer;
 
-static_assert(is_pod::value, "Character type of basic_string 
must be a POD");
+static_assert(is_trivial::value, "Character type of 
basic_string must be trivial");
 static_assert((is_same<_CharT, typename traits_type::char_type>::value),
   "traits_type::char_type must be the same type as CharT");
 static_assert((is_same::value),

Modified: libcxx/trunk/include/string_view
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string_view?rev=323071=323070=323071=diff
==
--- libcxx/trunk/include/string_view (original)
+++ libcxx/trunk/include/string_view Sun Jan 21 16:17:48 2018
@@ -208,7 +208,7 @@ public:
 typedef ptrdiff_t  difference_type;
 static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
 
-static_assert(is_pod::value, "Character type of 
basic_string_view must be a POD");
+static_assert(is_trivial::value, "Character type of 
basic_string_view must be trivial");
 static_assert((is_same<_CharT, typename traits_type::char_type>::value),
   "traits_type::char_type must be the same type as CharT");
 


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


[libcxx] r323070 - implement (but leave commented out) the constexpr tests from P0202 for std::merge. merge requires std::copy, which isn't constexpr yet.

2018-01-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Sun Jan 21 16:11:44 2018
New Revision: 323070

URL: http://llvm.org/viewvc/llvm-project?rev=323070=rev
Log:
implement (but leave commented out) the constexpr tests from P0202 for 
std::merge. merge requires std::copy, which isn't constexpr yet.

Modified:
libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp
libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp

Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp?rev=323070=323069=323070=diff
==
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp 
(original)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp Sun 
Jan 21 16:11:44 2018
@@ -15,15 +15,32 @@
 //   requires OutputIterator
 // && OutputIterator
 // && HasLess
-//   OutIter
+//   constexpr OutIter   // constexpr after C++17
 //   merge(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2, 
OutIter result);
 
 #include 
 #include 
 #include 
 
+#include "test_macros.h"
 #include "test_iterators.h"
 
+
+#if TEST_STD_VER > 17
+TEST_CONSTEXPR bool test_constexpr() {
+  int ia[]   = {0, 1, 2, 3, 4};
+  int ib[]   = {2, 4, 6, 8};
+  int ic[]   = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8};
+
+auto it = std::merge(std::begin(ia), std::end(ia), std::begin(ib), 
std::end(ib), std::begin(ic));
+return std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib))
+&& *it == 0
+&& std::equal(std::begin(ic), it, std::begin(expected), 
std::end(expected))
+;
+}
+#endif
+
 std::mt19937 randomness;
 
 template 
@@ -224,4 +241,9 @@ int main()
 test >();
 test >();
 test();
+
+#if TEST_STD_VER > 17
+//  Not yet - waiting on std::copy
+// static_assert(test_constexpr());
+#endif
 }

Modified: 
libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp?rev=323070=323069=323070=diff
==
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp 
(original)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp 
Sun Jan 21 16:11:44 2018
@@ -16,7 +16,7 @@
 //   requires OutputIterator
 // && OutputIterator
 // && CopyConstructible
-//   OutIter
+//   constexpr OutIter   // constexpr after C++17
 //   merge(InIter1 first1, InIter1 last1,
 // InIter2 first2, InIter2 last2, OutIter result, Compare comp);
 
@@ -25,9 +25,27 @@
 #include 
 #include 
 
+#include "test_macros.h"
 #include "test_iterators.h"
 #include "counting_predicates.hpp"
 
+#if TEST_STD_VER > 17
+TEST_CONSTEXPR bool test_constexpr() {
+  int ia[]   = {0, 1, 2, 3, 4};
+  int ib[]   = {2, 4, 6, 8};
+  int ic[]   = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8};
+
+auto it = std::merge(std::begin(ia), std::end(ia), 
+ std::begin(ib), std::end(ib),
+ std::begin(ic), [](int a, int b) {return a == b; });
+return std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib))
+&& *it == 0
+&& std::equal(std::begin(ic), it, std::begin(expected), 
std::end(expected))
+;
+}
+#endif
+
 std::mt19937 randomness;
 
 template 
@@ -234,4 +252,9 @@ int main()
 test >();
 test >();
 test();
+
+#if TEST_STD_VER > 17
+//  Not yet - waiting on std::copy
+// static_assert(test_constexpr());
+#endif
 }


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


[PATCH] D41384: [analyzer] Suppress false positive warnings form security.insecureAPI.strcpy

2018-01-21 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin added inline comments.



Comment at: 
cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp:517
+if (const auto *Array = dyn_cast(DeclRef->getType())) {
+  uint64_t ArraySize = BR.getContext().getTypeSize(Array) / 8;
+  if (const auto *String = dyn_cast(Source)) {

Rather than dividing by '8', I suggest using ASTContext's getTypeSizeInChars(). 
This will make sure we handle those annoying platforms that don't have 8-bit 
chars.


Repository:
  rL LLVM

https://reviews.llvm.org/D41384



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


[PATCH] D42266: [analyzer] Prevent AnalyzerStatsChecker from crash

2018-01-21 Thread Peter Szecsi via Phabricator via cfe-commits
szepet added a comment.

> Would it make sense to use the last element of the block edge's source for 
> the diagnostic location when the destination block is empty?

I do not think so. In the testfile `emptyConditionLoop` function is a great 
counter example since the last element of the source block is the `num = 1` 
which would not make sense (in my opinion). However, in this case the location 
of the terminator statement could be used (if there is any). If you are OK with 
that solution, I can update the patch.


Repository:
  rC Clang

https://reviews.llvm.org/D42266



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


[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-21 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin accepted this revision.
dcoughlin added a comment.

Looks good to me, thanks!


https://reviews.llvm.org/D41816



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


[PATCH] D42266: [analyzer] Prevent AnalyzerStatsChecker from crash

2018-01-21 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin added a comment.

This seems reasonable.

Would it make sense to use the last element of the block edge's source for the 
diagnostic location when the destination block is empty?


Repository:
  rC Clang

https://reviews.llvm.org/D42266



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


[PATCH] D42307: [OpenCL][6.0.0 Release] Release notes for OpenCL in Clang

2018-01-21 Thread Alexey Bader via Phabricator via cfe-commits
bader accepted this revision.
bader added a comment.

Looks good to me. Thanks for working on this.


https://reviews.llvm.org/D42307



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


[PATCH] D41976: Low-hanging fruit optimization in string::__move_assign().

2018-01-21 Thread Timothy VanSlyke via Phabricator via cfe-commits
tvanslyke updated this revision to Diff 130819.
tvanslyke added a comment.

Moved `__clear_and_shrink()` to live with the other public dunder methods and 
adapted the associated test accordingly.


https://reviews.llvm.org/D41976

Files:
  include/string
  
test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp

Index: test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp
===
--- test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp
+++ test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp
@@ -0,0 +1,48 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// Call __clear_and_shrink() and ensure string invariants hold
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include 
+#include 
+
+int main()
+{
+std::string l = "Long string so that allocation definitely, for sure, absolutely happens. Probably.";
+std::string s = "short";
+
+assert(l.__invariants());
+assert(s.__invariants());
+
+s.__clear_and_shrink();
+assert(s.__invariants());
+assert(s.size() == 0);
+
+{ 
+std::string::size_type cap = l.capacity();
+l.__clear_and_shrink();
+assert(l.__invariants());
+assert(l.size() == 0);
+assert(l.capacity() < cap);
+}
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
Index: include/string
===
--- include/string
+++ include/string
@@ -1250,6 +1250,8 @@
 
 _LIBCPP_INLINE_VISIBILITY bool __invariants() const;
 
+_LIBCPP_INLINE_VISIBILITY void __clear_and_shrink();
+
 _LIBCPP_INLINE_VISIBILITY
 bool __is_long() const _NOEXCEPT
 {return bool(__r_.first().__s.__size_ & __short_mask);}
@@ -1415,16 +1417,14 @@
 {
 if (!__str.__is_long())
 {
-clear();
-shrink_to_fit();
+__clear_and_shrink();
 __alloc() = __str.__alloc();
 }
 else
 {
 allocator_type __a = __str.__alloc();
 pointer __p = __alloc_traits::allocate(__a, __str.__get_long_cap());
-clear();
-shrink_to_fit();
+__clear_and_shrink();
 __alloc() = _VSTD::move(__a);
 __set_long_pointer(__p);
 __set_long_cap(__str.__get_long_cap());
@@ -2102,8 +2102,7 @@
 _NOEXCEPT_(is_nothrow_move_assignable::value)
 #endif
 {
-clear();
-shrink_to_fit();
+__clear_and_shrink();
 __r_.first() = __str.__r_.first();
 __move_assign_alloc(__str);
 __str.__zero();
@@ -3556,6 +3555,22 @@
 return true;
 }
 
+// __clear_and_shrink
+
+template
+inline _LIBCPP_INLINE_VISIBILITY
+void 
+basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink()
+{
+clear();
+if(__is_long())
+{
+__alloc_traits::deallocate(__alloc(), __get_long_pointer(), capacity() + 1);
+__set_long_cap(0);
+__set_short_size(0);
+}
+} 
+
 // operator==
 
 template
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41622: [cmake] [libcxx] Fix path and flag problems when cross compiling.

2018-01-21 Thread Don Hinton via Phabricator via cfe-commits
hintonda updated this revision to Diff 130820.
hintonda added a comment.

- Save CMAKE_REQUIRED_FLAGS for another patch.


Repository:
  rCXX libc++

https://reviews.llvm.org/D41622

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -123,6 +123,7 @@
   ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
   ${LLVM_MAIN_SRC_DIR}/../libcxxabi/include
 NO_DEFAULT_PATH
+NO_CMAKE_FIND_ROOT_PATH
   )
   if (LIBCXX_TARGETING_MSVC)
 # FIXME: Figure out how to configure the ABI library on Windows.


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -123,6 +123,7 @@
   ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
   ${LLVM_MAIN_SRC_DIR}/../libcxxabi/include
 NO_DEFAULT_PATH
+NO_CMAKE_FIND_ROOT_PATH
   )
   if (LIBCXX_TARGETING_MSVC)
 # FIXME: Figure out how to configure the ABI library on Windows.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41976: Low-hanging fruit optimization in string::__move_assign().

2018-01-21 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

> Since __clear_and_shrink() is private

There's no reason it has to be private.
People aren't supposed to call anything with a reserved name.


https://reviews.llvm.org/D41976



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


[PATCH] D42344: [libc++] Use multi-key tree search for {map, set}::{count, equal_range}

2018-01-21 Thread N via Phabricator via cfe-commits
ng updated this revision to Diff 130817.
ng added a comment.

Fix multiset variable definition in tests


https://reviews.llvm.org/D42344

Files:
  libcxx/include/map 
  libcxx/include/set 
  libcxx/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp
  
libcxx/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp
  
libcxx/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp
  
libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp
  libcxx/test/std/containers/associative/multiset/count_transparent.pass.cpp
  
libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp
  libcxx/test/std/containers/associative/set/count_transparent.pass.cpp
  libcxx/test/std/containers/associative/set/equal_range_transparent.pass.cpp

Index: libcxx/test/std/containers/associative/set/equal_range_transparent.pass.cpp
===
--- libcxx/test/std/containers/associative/set/equal_range_transparent.pass.cpp
+++ libcxx/test/std/containers/associative/set/equal_range_transparent.pass.cpp
@@ -0,0 +1,60 @@
+//===--===//
+//
+// 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
+
+// 
+
+// class set
+
+// template
+// pair equal_range(const K& x);//
+// C++14
+// template
+// pair equal_range(const K& x) const;  //
+// C++14
+
+#include 
+#include 
+#include 
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+#include "test_macros.h"
+
+struct Comp {
+  using is_transparent = void;
+
+  bool operator()(const std::pair ,
+  const std::pair ) const {
+return lhs < rhs;
+  }
+
+  bool operator()(const std::pair , int rhs) const {
+return lhs.first < rhs;
+  }
+
+  bool operator()(int lhs, const std::pair ) const {
+return lhs < rhs.first;
+  }
+};
+
+int main() {
+  std::set, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};
+
+  auto er = s.equal_range(1);
+  long nels = 0;
+
+  for (auto it = er.first; it != er.second; it++) {
+assert(it->first == 1);
+nels++;
+  }
+
+  assert(nels == 3);
+}
Index: libcxx/test/std/containers/associative/set/count_transparent.pass.cpp
===
--- libcxx/test/std/containers/associative/set/count_transparent.pass.cpp
+++ libcxx/test/std/containers/associative/set/count_transparent.pass.cpp
@@ -0,0 +1,51 @@
+//===--===//
+//
+// 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
+
+// 
+
+// class set
+
+// template
+// iterator lower_bound(const K& x);  // C++14
+// template
+// const_iterator lower_bound(const K& x) const;  // C++14
+
+#include 
+#include 
+#include 
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+#include "test_macros.h"
+
+struct Comp {
+  using is_transparent = void;
+
+  bool operator()(const std::pair ,
+  const std::pair ) const {
+return lhs < rhs;
+  }
+
+  bool operator()(const std::pair , int rhs) const {
+return lhs.first < rhs;
+  }
+
+  bool operator()(int lhs, const std::pair ) const {
+return lhs < rhs.first;
+  }
+};
+
+int main() {
+  std::set, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};
+
+  auto cnt = s.count(1);
+  assert(cnt == 3);
+}
Index: libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp
===
--- libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp
+++ libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp
@@ -0,0 +1,60 @@
+//===--===//
+//
+// 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
+
+// 
+
+// class multiset
+
+// template
+// pair  

[PATCH] D41976: Low-hanging fruit optimization in string::__move_assign().

2018-01-21 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

In https://reviews.llvm.org/D41976#982978, @tvanslyke wrote:

> I don't have commit access myself so I've added the test to the diff.


I'll commit it then.


https://reviews.llvm.org/D41976



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


[PATCH] D42344: [libc++] Use multi-key tree search for {map, set}::{count, equal_range}

2018-01-21 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

In https://reviews.llvm.org/D42344#983265, @ng wrote:

> In https://reviews.llvm.org/D42344#983264, @mclow.lists wrote:
>
> > Shouldn't there be tests for `multimap` and `multiset`, too?
>
>
> Sure; will the same tests as for map/set be alright?


Actually, I think there are already tests for `multimap` and `multiset`.
(which is why I deleted my comment)

But the tests there are not like these, where the comparator uses only part of 
the key.
So, yes; same tests would be OK - but you might want to adjust the data so that 
there are duplicate keys.


https://reviews.llvm.org/D42344



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


[PATCH] D42344: [libc++] Use multi-key tree search for {map, set}::{count, equal_range}

2018-01-21 Thread N via Phabricator via cfe-commits
ng added a comment.

In https://reviews.llvm.org/D42344#983264, @mclow.lists wrote:

> Shouldn't there be tests for `multimap` and `multiset`, too?


Sure; will the same tests as for map/set be alright?


https://reviews.llvm.org/D42344



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


[PATCH] D42344: [libc++] Use multi-key tree search for {map, set}::{count, equal_range}

2018-01-21 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

Sometimes you get lucky ;-)
I have a task for next week that says "The transparent lookup stuff in the 
associative containers needs tests", and here is this patch.

Instead of "transparent_count.pass.cpp", please name the test 
"count_transparent.pass.cpp" so it will sort with all the other count tests.




Comment at: 
libcxx/test/std/containers/associative/map/map.ops/transparent_count.pass.cpp   
:25
+
+#if TEST_STD_VER <= 11
+#error "This test requires is C++14 (or later)"

Instead of this, just put
 //  UNSUPPORTED:  c++98, c++03, c++11

near the top of the file.



Comment at: 
libcxx/test/std/containers/associative/map/map.ops/transparent_equal_range.pass.cpp
  :28
+
+#if TEST_STD_VER <= 11
+#error "This test requires is C++14 (or later)"

Same here.



Comment at: 
libcxx/test/std/containers/associative/set/transparent_count.pass.cpp :27
+
+#if TEST_STD_VER <= 11
+#error "This test requires is C++14 (or later)"

same here.



Comment at: 
libcxx/test/std/containers/associative/set/transparent_equal_range.pass.cpp:29
+
+#if TEST_STD_VER <= 11
+#error "This test requires is C++14 (or later)"

and here.


https://reviews.llvm.org/D42344



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


[PATCH] D42351: Emit DWARF "constructor" calling convention for every supported Clang CC

2018-01-21 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a subscriber: aprantl.
rnk added a comment.

@aprantl


Repository:
  rC Clang

https://reviews.llvm.org/D42351



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


[PATCH] D42344: [libc++] Use multi-key tree search for {map, set}::{count, equal_range}

2018-01-21 Thread N via Phabricator via cfe-commits
ng updated this revision to Diff 130812.
ng added a comment.

As per the above suggestions, enabled _multi tree search only for transparent 
comparator functions, and added tests.


https://reviews.llvm.org/D42344

Files:
  libcxx/include/map  
  libcxx/include/set  
  libcxx/test/std/containers/associative/map/map.ops/transparent_count.pass.cpp 
  
  
libcxx/test/std/containers/associative/map/map.ops/transparent_equal_range.pass.cpp
  
  libcxx/test/std/containers/associative/set/transparent_count.pass.cpp 
  libcxx/test/std/containers/associative/set/transparent_equal_range.pass.cpp

Index: libcxx/test/std/containers/associative/set/transparent_equal_range.pass.cpp
===
--- libcxx/test/std/containers/associative/set/transparent_equal_range.pass.cpp
+++ libcxx/test/std/containers/associative/set/transparent_equal_range.pass.cpp
@@ -0,0 +1,63 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// class set
+
+// template
+// pair equal_range(const K& x);//
+// C++14
+// template
+// pair equal_range(const K& x) const;  //
+// C++14
+
+#include 
+#include 
+#include 
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+#include "test_macros.h"
+
+#if TEST_STD_VER <= 11
+#error "This test requires is C++14 (or later)"
+#else
+
+struct Comp {
+  using is_transparent = void;
+
+  bool operator()(const std::pair ,
+  const std::pair ) const {
+return lhs < rhs;
+  }
+
+  bool operator()(const std::pair , int rhs) const {
+return lhs.first < rhs;
+  }
+
+  bool operator()(int lhs, const std::pair ) const {
+return lhs < rhs.first;
+  }
+};
+
+int main() {
+  std::set, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};
+
+  auto er = s.equal_range(1);
+  long nels = 0;
+
+  for (auto it = er.first; it != er.second; it++) {
+assert(it->first == 1);
+nels++;
+  }
+
+  assert(nels == 3);
+}
+#endif
Index: libcxx/test/std/containers/associative/set/transparent_count.pass.cpp 
===
--- libcxx/test/std/containers/associative/set/transparent_count.pass.cpp 
+++ libcxx/test/std/containers/associative/set/transparent_count.pass.cpp 
@@ -0,0 +1,54 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// class set
+
+// template
+// iterator lower_bound(const K& x);  // C++14
+// template
+// const_iterator lower_bound(const K& x) const;  // C++14
+
+#include 
+#include 
+#include 
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+#include "test_macros.h"
+
+#if TEST_STD_VER <= 11
+#error "This test requires is C++14 (or later)"
+#else
+
+struct Comp {
+  using is_transparent = void;
+
+  bool operator()(const std::pair ,
+  const std::pair ) const {
+return lhs < rhs;
+  }
+
+  bool operator()(const std::pair , int rhs) const {
+return lhs.first < rhs;
+  }
+
+  bool operator()(int lhs, const std::pair ) const {
+return lhs < rhs.first;
+  }
+};
+
+int main() {
+  std::set, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};
+
+  auto cnt = s.count(1);
+  assert(cnt == 3);
+}
+#endif
Index: libcxx/test/std/containers/associative/map/map.ops/transparent_equal_range.pass.cpp  
===
--- libcxx/test/std/containers/associative/map/map.ops/transparent_equal_range.pass.cpp  
+++ libcxx/test/std/containers/associative/map/map.ops/transparent_equal_range.pass.cpp  
@@ -0,0 +1,63 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// class map
+
+// template
+// pair equal_range(const K& x); // C++14
+// template
+// pair equal_range(const K& x) const;
+// // C++14
+
+#include 
+#include 

[PATCH] D42354: Fix libcxx MSVC C++17 redefinition of 'align_val_t'

2018-01-21 Thread Force.Charlie-I via Phabricator via cfe-commits
fcharlie created this revision.
Herald added a reviewer: EricWF.
Herald added a subscriber: cfe-commits.

When use

  clang-cl -std:c++17 -Iinclude\c++\v1 hello.cc c++.lib



  In file included from hello.cc:1:
  In file included from include\c++\v1\iostream:38:
  In file included from include\c++\v1\ios:216:
  In file included from include\c++\v1\__locale:15:
  In file included from include\c++\v1\string:477:
  In file included from include\c++\v1\string_view:176:
  In file included from include\c++\v1\__string:56:
  In file included from include\c++\v1\algorithm:643:
  In file included from include\c++\v1\memory:656:
  include\c++\v1\new(165,29):  error: redefinition of 'align_val_t'
  enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
  ^
  C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\vcruntime_new.h(43,16): 
 note:
previous definition is here
  enum class align_val_t : size_t {};
 ^
  1 error generated.


Repository:
  rCXX libc++

https://reviews.llvm.org/D42354

Files:
  include/new


Index: include/new
===
--- include/new
+++ include/new
@@ -160,6 +160,9 @@
 
 #endif  // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
 
+#if defined(_LIBCPP_ABI_MICROSOFT) && defined(_HAS_ALIGNED_NEW)
+/// vcruntime_new.h defined align_val_t
+#else
 #if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14
 #ifndef _LIBCPP_CXX03_LANG
 enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
@@ -167,6 +170,7 @@
 enum align_val_t { __zero = 0, __max = (size_t)-1 };
 #endif
 #endif
+#endif
 
 }  // std
 


Index: include/new
===
--- include/new
+++ include/new
@@ -160,6 +160,9 @@
 
 #endif  // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
 
+#if defined(_LIBCPP_ABI_MICROSOFT) && defined(_HAS_ALIGNED_NEW)
+/// vcruntime_new.h defined align_val_t
+#else
 #if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14
 #ifndef _LIBCPP_CXX03_LANG
 enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
@@ -167,6 +170,7 @@
 enum align_val_t { __zero = 0, __max = (size_t)-1 };
 #endif
 #endif
+#endif
 
 }  // std
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42352: [ReleaseNotes] Mention OpenMP Tools Interface in runtime library

2018-01-21 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld created this revision.
Hahnfeld added reviewers: rsmith, ABataev, hans.
Herald added subscribers: cfe-commits, guansong.

The OpenMP runtime has no dedicated Release Notes, so add it to Clang's section 
about OpenMP.


Repository:
  rC Clang

https://reviews.llvm.org/D42352

Files:
  docs/ReleaseNotes.rst


Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -222,6 +222,14 @@
 - Added support for `reduction`-based clauses on `task`-based directives from
   upcoming OpenMP 5.0.
 
+- The LLVM OpenMP runtime `libomp` now supports the OpenMP Tools Interface 
(OMPT)
+  on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and mac OS. Performance
+  measurements show that the changes result in a slowdown of at most 4 percent
+  in micro-benchmarks. However, if you observe a larger impact on one of your
+  applications, please rebuild the runtime library with 
`-DLIBOMP_OMPT_SUPPORT=OFF`
+  and file a bug at `LLVM's Bugzilla `.
+
 Internal API Changes
 
 


Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -222,6 +222,14 @@
 - Added support for `reduction`-based clauses on `task`-based directives from
   upcoming OpenMP 5.0.
 
+- The LLVM OpenMP runtime `libomp` now supports the OpenMP Tools Interface (OMPT)
+  on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and mac OS. Performance
+  measurements show that the changes result in a slowdown of at most 4 percent
+  in micro-benchmarks. However, if you observe a larger impact on one of your
+  applications, please rebuild the runtime library with `-DLIBOMP_OMPT_SUPPORT=OFF`
+  and file a bug at `LLVM's Bugzilla `.
+
 Internal API Changes
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42351: Emit DWARF "constructor" calling convention for every supported Clang CC

2018-01-21 Thread Adrien Guinet via Phabricator via cfe-commits
aguinet created this revision.
aguinet added a reviewer: rnk.
Herald added subscribers: cfe-commits, JDevlieghere.

This needs https://reviews.llvm.org/D42350 in LLVM!


Repository:
  rC Clang

https://reviews.llvm.org/D42351

Files:
  lib/CodeGen/CGDebugInfo.cpp


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -982,20 +982,28 @@
 return llvm::dwarf::DW_CC_LLVM_vectorcall;
   case CC_X86Pascal:
 return llvm::dwarf::DW_CC_BORLAND_pascal;
-
-  // FIXME: Create new DW_CC_ codes for these calling conventions.
   case CC_Win64:
+return llvm::dwarf::DW_CC_LLVM_Win64;
   case CC_X86_64SysV:
+return llvm::dwarf::DW_CC_LLVM_X86_64SysV;
   case CC_AAPCS:
+return llvm::dwarf::DW_CC_LLVM_AAPCS;
   case CC_AAPCS_VFP:
+return llvm::dwarf::DW_CC_LLVM_AAPCS_VFP;
   case CC_IntelOclBicc:
+return llvm::dwarf::DW_CC_LLVM_IntelOclBicc;
   case CC_SpirFunction:
+return llvm::dwarf::DW_CC_LLVM_SpirFunction;
   case CC_OpenCLKernel:
+return llvm::dwarf::DW_CC_LLVM_OpenCLKernel;
   case CC_Swift:
+return llvm::dwarf::DW_CC_LLVM_Swift;
   case CC_PreserveMost:
+return llvm::dwarf::DW_CC_LLVM_PreserveMost;
   case CC_PreserveAll:
+return llvm::dwarf::DW_CC_LLVM_PreserveAll;
   case CC_X86RegCall:
-return 0;
+return llvm::dwarf::DW_CC_LLVM_X86RegCall;
   }
   return 0;
 }


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -982,20 +982,28 @@
 return llvm::dwarf::DW_CC_LLVM_vectorcall;
   case CC_X86Pascal:
 return llvm::dwarf::DW_CC_BORLAND_pascal;
-
-  // FIXME: Create new DW_CC_ codes for these calling conventions.
   case CC_Win64:
+return llvm::dwarf::DW_CC_LLVM_Win64;
   case CC_X86_64SysV:
+return llvm::dwarf::DW_CC_LLVM_X86_64SysV;
   case CC_AAPCS:
+return llvm::dwarf::DW_CC_LLVM_AAPCS;
   case CC_AAPCS_VFP:
+return llvm::dwarf::DW_CC_LLVM_AAPCS_VFP;
   case CC_IntelOclBicc:
+return llvm::dwarf::DW_CC_LLVM_IntelOclBicc;
   case CC_SpirFunction:
+return llvm::dwarf::DW_CC_LLVM_SpirFunction;
   case CC_OpenCLKernel:
+return llvm::dwarf::DW_CC_LLVM_OpenCLKernel;
   case CC_Swift:
+return llvm::dwarf::DW_CC_LLVM_Swift;
   case CC_PreserveMost:
+return llvm::dwarf::DW_CC_LLVM_PreserveMost;
   case CC_PreserveAll:
+return llvm::dwarf::DW_CC_LLVM_PreserveAll;
   case CC_X86RegCall:
-return 0;
+return llvm::dwarf::DW_CC_LLVM_X86RegCall;
   }
   return 0;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42349: [DOCS] Mention OpenMP Tools Interface in runtime library

2018-01-21 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

@hans I'd also like to merge this to `release_60` because the support landed 
before the branching. Is this ok?


Repository:
  rC Clang

https://reviews.llvm.org/D42349



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


[PATCH] D42349: [DOCS] Mention OpenMP Tools Interface in runtime library

2018-01-21 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld created this revision.
Hahnfeld added reviewers: ABataev, hans.
Herald added subscribers: cfe-commits, guansong.

Also list supported configurations (architectures + operating
systems).


Repository:
  rC Clang

https://reviews.llvm.org/D42349

Files:
  docs/OpenMPSupport.rst


Index: docs/OpenMPSupport.rst
===
--- docs/OpenMPSupport.rst
+++ docs/OpenMPSupport.rst
@@ -65,4 +65,4 @@
 * #pragma omp target teams distribute parallel for [simd]: :good:`Complete`.
 
 Clang does not support any constructs/updates from upcoming OpenMP 5.0 except 
for `reduction`-based clauses in the `task` and `target`-based directives.
-
+In addition, the LLVM OpenMP runtime `libomp` supports the OpenMP Tools 
Interface (OMPT) on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and mac 
OS.


Index: docs/OpenMPSupport.rst
===
--- docs/OpenMPSupport.rst
+++ docs/OpenMPSupport.rst
@@ -65,4 +65,4 @@
 * #pragma omp target teams distribute parallel for [simd]: :good:`Complete`.
 
 Clang does not support any constructs/updates from upcoming OpenMP 5.0 except for `reduction`-based clauses in the `task` and `target`-based directives.
-
+In addition, the LLVM OpenMP runtime `libomp` supports the OpenMP Tools Interface (OMPT) on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and mac OS.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42343: [coroutines] Fix application of NRVO to Coroutine "Gro" or return object.

2018-01-21 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 130801.
EricWF marked an inline comment as done.
EricWF added a comment.

- Address inline comments in test.


https://reviews.llvm.org/D42343

Files:
  lib/Sema/SemaCoroutine.cpp
  test/CodeGenCoroutines/coro-alloc.cpp
  test/CodeGenCoroutines/coro-gro-nrvo.cpp

Index: test/CodeGenCoroutines/coro-gro-nrvo.cpp
===
--- /dev/null
+++ test/CodeGenCoroutines/coro-gro-nrvo.cpp
@@ -0,0 +1,80 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 -emit-llvm %s -o - -disable-llvm-passes | FileCheck %s
+
+#include "Inputs/coroutine.h"
+
+using namespace std::experimental;
+
+namespace std {
+
+struct nothrow_t {};
+constexpr nothrow_t nothrow = {};
+
+} // end namespace std
+
+// Required when get_return_object_on_allocation_failure() is defined by
+// the promise.
+void* operator new(__SIZE_TYPE__ __sz, const std::nothrow_t&) noexcept;
+void  operator delete(void* __p, const std::nothrow_t&) noexcept;
+
+
+template 
+struct promise_type {
+RetObject get_return_object();
+suspend_always initial_suspend();
+suspend_never final_suspend();
+void return_void();
+static void unhandled_exception();
+};
+
+struct coro {
+  using promise_type = promise_type;
+  coro(coro const&);
+  struct Impl;
+  Impl *impl;
+};
+
+// Verify that the NRVO is applied to the Gro object.
+// CHECK-LABEL: define void @_Z1fi(%struct.coro* noalias sret %agg.result, i32)
+coro f(int) {
+// CHECK: coro.init:
+// CHECK: store i1 false, i1* %gro.active
+// CHECK-NEXT: call void @{{.*get_return_objectEv}}(%struct.coro* sret %agg.result
+// CHECK-NEXT: store i1 true, i1* %gro.active
+  co_return;
+}
+
+
+template 
+struct promise_type_with_on_alloc_failure {
+static RetObject get_return_object_on_allocation_failure();
+RetObject get_return_object();
+suspend_always initial_suspend();
+suspend_never final_suspend();
+void return_void();
+static void unhandled_exception();
+};
+
+struct coro_two {
+  using promise_type = promise_type_with_on_alloc_failure;
+  coro_two(coro_two const&);
+  struct Impl;
+  Impl *impl;
+};
+
+// Verify that the NRVO is applied to the Gro object.
+// CHECK-LABEL: define void @_Z1hi(%struct.coro_two* noalias sret %agg.result, i32)
+ coro_two h(int) {
+
+// CHECK: coro.ret.on.failure:
+// CHECK-NEXT: call void @{{.*get_return_object_on_allocation_failureEv}}(%struct.coro_two* sret %agg.result
+// CHECK-NEXT: br label %[[RetLabel:.*]]
+
+// CHECK: coro.init:
+// CHECK: store i1 false, i1* %gro.active
+// CHECK-NEXT: call void @{{.*get_return_objectEv}}(%struct.coro_two* sret %agg.result
+// CHECK-NEXT: store i1 true, i1* %gro.active
+
+// CHECK: [[RetLabel]]:
+// CHECK-NEXT: ret void
+  co_return;
+}
Index: test/CodeGenCoroutines/coro-alloc.cpp
===
--- test/CodeGenCoroutines/coro-alloc.cpp
+++ test/CodeGenCoroutines/coro-alloc.cpp
@@ -173,6 +173,7 @@
 // CHECK-LABEL: f4(
 extern "C" int f4(promise_on_alloc_failure_tag) {
   // CHECK: %[[RetVal:.+]] = alloca i32
+  // CHECK: %[[Gro:.+]] = alloca i32
   // CHECK: %[[ID:.+]] = call token @llvm.coro.id(i32 16
   // CHECK: %[[SIZE:.+]] = call i64 @llvm.coro.size.i64()
   // CHECK: %[[MEM:.+]] = call i8* @_ZnwmRKSt9nothrow_t(i64 %[[SIZE]], %"struct.std::nothrow_t"* dereferenceable(1) @_ZStL7nothrow)
@@ -186,7 +187,12 @@
 
   // CHECK: [[OKBB]]:
   // CHECK:   %[[OkRet:.+]] = call i32 @_ZNSt12experimental16coroutine_traitsIJi28promise_on_alloc_failure_tagEE12promise_type17get_return_objectEv(
-  // CHECK:   store i32 %[[OkRet]], i32* %[[RetVal]]
+  // CHECK:   store i32 %[[OkRet]], i32* %[[Gro]]
+
+  // CHECK: coro.ret:
+  // CHECK: %[[Tmp1:.*]] = load i32, i32* %[[Gro]]
+  // CHECK-NEXT: store i32 %[[Tmp1]], i32* %[[RetVal]]
+  // CHECK-NEXT: br label %[[RetBB]]
 
   // CHECK: [[RetBB]]:
   // CHECK:   %[[LoadRet:.+]] = load i32, i32* %[[RetVal]], align 4
Index: lib/Sema/SemaCoroutine.cpp
===
--- lib/Sema/SemaCoroutine.cpp
+++ lib/Sema/SemaCoroutine.cpp
@@ -1256,9 +1256,8 @@
   if (Res.isInvalid())
 return false;
 
-  if (GroType == FnRetType) {
+  if (S.isCopyElisionCandidate(FnRetType, GroDecl, false))
 GroDecl->setNRVOVariable(true);
-  }
 
   S.AddInitializerToDecl(GroDecl, Res.get(),
  /*DirectInit=*/false);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42343: [coroutines] Fix application of NRVO to Coroutine "Gro" or return object.

2018-01-21 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked an inline comment as done.
EricWF added inline comments.



Comment at: test/CodeGenCoroutines/coro-gro-nrvo.cpp:17
+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;

majnemer wrote:
> `SizeT` -> `__SIZE_TYPE__` ?
SGTM.


https://reviews.llvm.org/D42343



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