[libcxx] r303966 - Workaround debug info bug in Clangs coroutine implementation

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 23:09:38 2017
New Revision: 303966

URL: http://llvm.org/viewvc/llvm-project?rev=303966=rev
Log:
Workaround debug info bug in Clangs coroutine implementation

Modified:

libcxx/trunk/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp

Modified: 
libcxx/trunk/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp?rev=303966=303965=303966=diff
==
--- 
libcxx/trunk/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp
 Thu May 25 23:09:38 2017
@@ -10,6 +10,10 @@
 
 // REQUIRES: fcoroutines-ts
 
+// These configurations run the tests with '-g', which hits a bug in Clangs
+// coroutine implementation.
+// XFAIL: asan, msan, ubsan, tsan
+
 // RUN: %build -fcoroutines-ts
 // RUN: %run
 


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


[PATCH] D33080: [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 100361.
EricWF added a comment.

- Fix whitespace in `__config`.

@compnerd Any final thoughts?


https://reviews.llvm.org/D33080

Files:
  include/__bit_reference
  include/__config
  include/__hash_table
  include/__mutex_base
  include/__split_buffer
  include/__std_stream
  include/__string
  include/__threading_support
  include/__tree
  include/__undef_macros
  include/__undef_min_max
  include/algorithm
  include/array
  include/bitset
  include/chrono
  include/deque
  include/experimental/algorithm
  include/experimental/dynarray
  include/experimental/functional
  include/experimental/memory_resource
  include/experimental/numeric
  include/experimental/optional
  include/experimental/string_view
  include/forward_list
  include/fstream
  include/istream
  include/limits
  include/list
  include/locale
  include/memory
  include/module.modulemap
  include/mutex
  include/numeric
  include/optional
  include/random
  include/ratio
  include/regex
  include/shared_mutex
  include/sstream
  include/streambuf
  include/string
  include/string_view
  include/thread
  include/valarray
  include/vector
  src/condition_variable.cpp
  src/ios.cpp
  src/locale.cpp
  src/mutex.cpp
  src/strstream.cpp
  test/libcxx/min_max_macros.sh.cpp

Index: test/libcxx/min_max_macros.sh.cpp
===
--- /dev/null
+++ test/libcxx/min_max_macros.sh.cpp
@@ -0,0 +1,298 @@
+// -*- C++ -*-
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// Test that we can include each header in two TU's and link them together.
+
+// RUN: %compile -fsyntax-only
+
+// Prevent  from generating deprecated warnings for this test.
+#if defined(__DEPRECATED)
+#undef __DEPRECATED
+#endif
+
+#define TEST_MACROS() static_assert(min() == true && max() == true, "")
+#define min() true
+#define max() true
+
+// Top level headers
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();

[PATCH] D33082: Fix Libc++ build with MinGW64

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 100358.
EricWF added a comment.

- remove `asprintf` declaration and definition entirely. It's not used anywhere 
within libc++.


https://reviews.llvm.org/D33082

Files:
  include/__config
  include/__locale
  include/locale
  include/stdio.h
  include/support/win32/locale_win32.h
  include/wchar.h
  src/chrono.cpp
  src/new.cpp
  src/support/win32/locale_win32.cpp
  src/support/win32/support.cpp
  src/system_error.cpp
  src/thread.cpp

Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -34,7 +34,7 @@
 
 #if defined(_LIBCPP_WIN32API)
 #include 
-#endif // defined(_LIBCPP_WIN32API)
+#endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
Index: src/system_error.cpp
===
--- src/system_error.cpp
+++ src/system_error.cpp
@@ -65,7 +65,7 @@
 
 string do_strerror_r(int ev);
 
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 string do_strerror_r(int ev) {
   char buffer[strerror_buff_size];
   if (::strerror_s(buffer, strerror_buff_size, ev) == 0)
Index: src/support/win32/support.cpp
===
--- src/support/win32/support.cpp
+++ src/support/win32/support.cpp
@@ -15,17 +15,6 @@
 #include  // strcpy, wcsncpy
 #include   // mbstate_t
 
-// Some of these functions aren't standard or if they conform, the name does not.
-
-int asprintf(char **sptr, const char *__restrict format, ...)
-{
-va_list ap;
-va_start(ap, format);
-int result;
-result = vasprintf(sptr, format, ap);
-va_end(ap);
-return result;
-}
 
 // Like sprintf, but when return value >= 0 it returns
 // a pointer to a malloc'd string in *sptr.
Index: src/support/win32/locale_win32.cpp
===
--- src/support/win32/locale_win32.cpp
+++ src/support/win32/locale_win32.cpp
@@ -34,6 +34,18 @@
 // uselocale returns the old locale_t
 return old_locale;
 }
+
+decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
+{
+#if defined(_LIBCPP_MSVCRT)
+  return ___mb_cur_max_l_func(__l);
+#else
+  __libcpp_locale_guard __current(__l);
+  return MB_CUR_MAX;
+#endif
+}
+
+
 lconv *localeconv_l( locale_t loc )
 {
 __libcpp_locale_guard __current(loc);
@@ -109,3 +121,15 @@
 __libcpp_locale_guard __current(loc);
 return vasprintf( ret, format, ap );
 }
+
+#if !defined(_LIBCPP_MSVCRT)
+float strtof_l(const char* nptr, char** endptr, locale_t loc) {
+  __libcpp_locale_guard __current(loc);
+  return strtof(nptr, endptr);
+}
+
+long double strtold_l(const char* nptr, char** endptr, locale_t loc) {
+  __libcpp_locale_guard __current(loc);
+  return strtold(nptr, endptr);
+}
+#endif
Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -183,7 +183,7 @@
 if (static_cast(alignment) < sizeof(void*))
   alignment = std::align_val_t(sizeof(void*));
 void* p;
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 while ((p = _aligned_malloc(size, static_cast(alignment))) == nullptr)
 #else
 while (::posix_memalign(, static_cast(alignment), size) != 0)
@@ -256,7 +256,7 @@
 operator delete(void* ptr, std::align_val_t) _NOEXCEPT
 {
 if (ptr)
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 ::_aligned_free(ptr);
 #else
 ::free(ptr);
Index: src/chrono.cpp
===
--- src/chrono.cpp
+++ src/chrono.cpp
@@ -37,7 +37,7 @@
 #if defined(_LIBCPP_WIN32API)
 #define WIN32_LEAN_AND_MEAN
 #define VC_EXTRA_LEAN
-#include 
+#include 
 #if _WIN32_WINNT >= _WIN32_WINNT_WIN8
 #include 
 #endif
Index: include/wchar.h
===
--- include/wchar.h
+++ include/wchar.h
@@ -166,7 +166,7 @@
 }
 #endif
 
-#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT)
+#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT_LIKE)
 extern "C" {
 size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
   size_t nmc, size_t len, mbstate_t *__restrict ps);
Index: include/support/win32/locale_win32.h
===
--- include/support/win32/locale_win32.h
+++ include/support/win32/locale_win32.h
@@ -52,20 +52,21 @@
  size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc);
 wint_t btowc_l( int c, locale_t loc );
 int wctob_l( wint_t c, locale_t loc );
-inline _LIBCPP_ALWAYS_INLINE
-decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
-{
-  return ___mb_cur_max_l_func(__l);
-}
+
+decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l );
 
 // the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
 #define mbtowc_l _mbtowc_l
 #define strtoll_l _strtoi64_l
 #define strtoull_l _strtoui64_l
-#define strtof_l _strtof_l
 #define strtod_l 

[PATCH] D33082: Fix Libc++ build with MinGW64

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D33082#765282, @bcraig wrote:

> I think that we generally shouldn't be giving functions names that are 
> already claimed elsewhere (like mbsnrtowcs and wcsnrtombs).  It is my opinion 
> that these should always be qualified as __libcpp_* symbols.  We can easily 
> run into trouble if users also defined mbsnrtowcs.  They have just as much of 
> a right to do so as we do.
>
> That being said, I think that's a change for a different changelist.


Agreed.  Libc++ shouldn't be stealing names it doesn't own, but fixing that is 
a separate change.

In https://reviews.llvm.org/D33082#765185, @martell wrote:

> > ! In https://reviews.llvm.org/D33082#764617, @EricWF wrote:
> >  Defining `_GNU_SOURCE` during the library build isn't enough, it's also 
> > has to be defined when people are using the headers,
> >  and in that case we must depend on the compiler to pre-define it. Is it 
> > important that MinGW not define `_GNU_SOURCE` by default?
>
> I'm not sure why this isn't the default, it could be some backwards 
> compatibility with mingw.org.
>  I will ask kai the author and find out.
>
> > Also do you know why `asprintf` is declared by mingw-w64 but `vasprintf` 
> > isn't? At minimum I think we still need to declare `vasprintf` in the
> >  headers because we can't count on `_GNU_SOURCE` being defined before 
> > `` is first included, but we should be able to omit
> >  the definition.
>
> I believe it is in stdio.h but behind the guard `__USE_MINGW_ANSI_STDIO`
>  You are currently picking up is msvc compatable asprintf and not gnu.
>  Defining this will give you the gnu versions of both `vasprintf`, `asprintf` 
> and also the GNU printf format specifiers.
>  You should be able use this to build libcxx just don't declare it publicly


Libc++ uses `vasprintf` in the headers, so it's not just a matter of building 
the library with `_GNU_SOURCE`. 
Since we can't dependably define `_GNU_SOURCE` or `__USE_MINGW_ANSI_STDIO` in 
the headers we're 
eventually going to have to provide our own implementations under different 
names. But I would rather do that as a separate commit if that's OK.


https://reviews.llvm.org/D33082



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


[libcxx] r303963 - Get working in C++03.

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 22:02:54 2017
New Revision: 303963

URL: http://llvm.org/viewvc/llvm-project?rev=303963=rev
Log:
Get  working in C++03.

Clang supports coroutines in all dialects; Therefore libc++ should too,
otherwise the Clang extension is unusable.

I'm not convinced extending support to C++03 is a feasible long term
plan, since as the library grows to offer things like generators it
will be come increasingly difficult to limit the implementation to C++03.

However for the time being supporting C++03 isn't a big deal.

Added:

libcxx/trunk/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp
Modified:
libcxx/trunk/include/experimental/coroutine

Modified: libcxx/trunk/include/experimental/coroutine
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/coroutine?rev=303963=303962=303963=diff
==
--- libcxx/trunk/include/experimental/coroutine (original)
+++ libcxx/trunk/include/experimental/coroutine Thu May 25 22:02:54 2017
@@ -27,12 +27,12 @@ class coroutine_traits;
 template 
 class coroutine_handle;
 // 18.11.2.7 comparison operators:
-bool operator==(coroutine_handle<> x, coroutine_handle<> y) noexcept;
-bool operator!=(coroutine_handle<> x, coroutine_handle<> y) noexcept;
-bool operator<(coroutine_handle<> x, coroutine_handle<> y) noexcept;
-bool operator<=(coroutine_handle<> x, coroutine_handle<> y) noexcept;
-bool operator>=(coroutine_handle<> x, coroutine_handle<> y) noexcept;
-bool operator>(coroutine_handle<> x, coroutine_handle<> y) noexcept;
+bool operator==(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator!=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator<(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator<=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator>=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator>(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
 // 18.11.3 trivial awaitables
 struct suspend_never;
 struct suspend_always;
@@ -94,22 +94,22 @@ template <>
 class _LIBCPP_TEMPLATE_VIS coroutine_handle {
 public:
 _LIBCPP_ALWAYS_INLINE
-constexpr coroutine_handle() noexcept : __handle_(nullptr) {}
+_LIBCPP_CONSTEXPR coroutine_handle() _NOEXCEPT : __handle_(nullptr) {}
 
 _LIBCPP_ALWAYS_INLINE
-constexpr coroutine_handle(nullptr_t) noexcept : __handle_(nullptr) {}
+_LIBCPP_CONSTEXPR coroutine_handle(nullptr_t) _NOEXCEPT : 
__handle_(nullptr) {}
 
 _LIBCPP_ALWAYS_INLINE
-coroutine_handle& operator=(nullptr_t) noexcept {
+coroutine_handle& operator=(nullptr_t) _NOEXCEPT {
 __handle_ = nullptr;
 return *this;
 }
 
 _LIBCPP_ALWAYS_INLINE
-constexpr void* address() const noexcept { return __handle_; }
+_LIBCPP_CONSTEXPR void* address() const _NOEXCEPT { return __handle_; }
 
 _LIBCPP_ALWAYS_INLINE
-constexpr explicit operator bool() const noexcept { return __handle_; }
+_LIBCPP_CONSTEXPR explicit operator bool() const _NOEXCEPT { return 
__handle_; }
 
 _LIBCPP_ALWAYS_INLINE
 void operator()() { resume(); }
@@ -139,14 +139,14 @@ public:
 
 public:
 _LIBCPP_ALWAYS_INLINE
-static coroutine_handle from_address(void* __addr) noexcept {
+static coroutine_handle from_address(void* __addr) _NOEXCEPT {
 coroutine_handle __tmp;
 __tmp.__handle_ = __addr;
 return __tmp;
 }
 
 private:
-  bool __is_suspended() const noexcept  {
+  bool __is_suspended() const _NOEXCEPT  {
 // FIXME actually implement a check for if the coro is suspended.
 return __handle_;
   }
@@ -157,27 +157,27 @@ private:
 
 // 18.11.2.7 comparison operators:
 inline _LIBCPP_ALWAYS_INLINE
-bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
+bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
 return __x.address() == __y.address();
 }
 inline _LIBCPP_ALWAYS_INLINE
-bool operator!=(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
+bool operator!=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
 return !(__x == __y);
 }
 inline _LIBCPP_ALWAYS_INLINE
-bool operator<(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
+bool operator<(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
 return less()(__x.address(), __y.address());
 }
 inline _LIBCPP_ALWAYS_INLINE
-bool operator>(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
+bool operator>(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
 return __y < __x;
 }
 inline _LIBCPP_ALWAYS_INLINE
-bool operator<=(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
+bool operator<=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
 return !(__x > __y);
 }
 inline _LIBCPP_ALWAYS_INLINE
-bool operator>=(coroutine_handle<> __x, coroutine_handle<> __y) noexcept 

r303962 - [docs] Point coroutine link to an actual document

2017-05-25 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Thu May 25 21:56:51 2017
New Revision: 303962

URL: http://llvm.org/viewvc/llvm-project?rev=303962=rev
Log:
[docs] Point coroutine link to an actual document

Unsure if there's a better document, but what we had before led to a
404. :)

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=303962=303961=303962=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Thu May 25 21:56:51 2017
@@ -831,7 +831,7 @@ and library features that are not part o
 
 
   [DRAFT TS] Coroutines
-  http://wg21.link/p0057r7;>P0057R7
+  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0057r7.pdf;>P0057R7
   
   WIP
 


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


[PATCH] D33568: Fix crash when evaluating constant expressions involving nullptr

2017-05-25 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover closed this revision.
t.p.northover added a comment.

Thanks Richard. I've committed this as r303957.


https://reviews.llvm.org/D33568



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


r303957 - Create valid LValue to represent null pointers in constant exprs

2017-05-25 Thread Tim Northover via cfe-commits
Author: tnorthover
Date: Thu May 25 21:16:00 2017
New Revision: 303957

URL: http://llvm.org/viewvc/llvm-project?rev=303957=rev
Log:
Create valid LValue to represent null pointers in constant exprs

We were leaving the SubobjectDesignator in a surprising situation, where
it was allegedly valid but didn't actually refer to a type. This caused
a crash later on.

This patch fills out the SubobjectDesignator with the pointee type (as
happens in other evaluations of constant pointers) so that we don't
crash later.

Added:
cfe/trunk/test/SemaCXX/null-cast.cpp
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=303957=303956=303957=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu May 25 21:16:00 2017
@@ -1230,8 +1230,7 @@ namespace {
   IsNullPtr = V.isNullPointer();
 }
 
-void set(APValue::LValueBase B, unsigned I = 0, bool BInvalid = false,
- bool IsNullPtr_ = false, uint64_t Offset_ = 0) {
+void set(APValue::LValueBase B, unsigned I = 0, bool BInvalid = false) {
 #ifndef NDEBUG
   // We only allow a few types of invalid bases. Enforce that here.
   if (BInvalid) {
@@ -1242,11 +1241,20 @@ namespace {
 #endif
 
   Base = B;
-  Offset = CharUnits::fromQuantity(Offset_);
+  Offset = CharUnits::fromQuantity(0);
   InvalidBase = BInvalid;
   CallIndex = I;
   Designator = SubobjectDesignator(getType(B));
-  IsNullPtr = IsNullPtr_;
+  IsNullPtr = false;
+}
+
+void setNull(QualType PointerTy, uint64_t TargetVal) {
+  Base = (Expr *)nullptr;
+  Offset = CharUnits::fromQuantity(TargetVal);
+  InvalidBase = false;
+  CallIndex = 0;
+  Designator = SubobjectDesignator(PointerTy->getPointeeType());
+  IsNullPtr = true;
 }
 
 void setInvalid(APValue::LValueBase B, unsigned I = 0) {
@@ -5494,8 +5502,8 @@ public:
 return true;
   }
   bool ZeroInitialization(const Expr *E) {
-auto Offset = Info.Ctx.getTargetNullPointerValue(E->getType());
-Result.set((Expr*)nullptr, 0, false, true, Offset);
+auto TargetVal = Info.Ctx.getTargetNullPointerValue(E->getType());
+Result.setNull(E->getType(), TargetVal);
 return true;
   }
 

Added: cfe/trunk/test/SemaCXX/null-cast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/null-cast.cpp?rev=303957=auto
==
--- cfe/trunk/test/SemaCXX/null-cast.cpp (added)
+++ cfe/trunk/test/SemaCXX/null-cast.cpp Thu May 25 21:16:00 2017
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct A {};
+struct B : virtual A {};
+
+void foo() {
+  (void)static_cast(*(B *)0); // expected-warning {{binding dereferenced 
null pointer to reference has undefined behavior}}
+}


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


[libcxx] r303956 - Guard against older Clang versions.

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 20:52:59 2017
New Revision: 303956

URL: http://llvm.org/viewvc/llvm-project?rev=303956=rev
Log:
Guard  against older Clang versions.

Clang started providing -fcoroutines and defining __cpp_coroutines
way before it implemented the __builtin_coro_foo functions. This
means that simply checking if __cpp_coroutines is not a sufficient
way of detecting the actual feature.

This patch implements _LIBCPP_HAS_NO_COROUTINES which implements
a slightly more complex feature check. Specifically it requires
__cpp_coroutines >= 201703L, which only holds for Clang 5.0 built
after 2017/05/24.

Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/experimental/coroutine

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=303956=303955=303956=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Thu May 25 20:52:59 2017
@@ -1126,6 +1126,10 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit
 # define _LIBCPP_HAS_NO_IS_AGGREGATE
 #endif
 
+#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
+# define _LIBCPP_HAS_NO_COROUTINES
+#endif
+
 #endif // __cplusplus
 
 // Decide whether to use availability macros.

Modified: libcxx/trunk/include/experimental/coroutine
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/coroutine?rev=303956=303955=303956=diff
==
--- libcxx/trunk/include/experimental/coroutine (original)
+++ libcxx/trunk/include/experimental/coroutine Thu May 25 20:52:59 2017
@@ -59,7 +59,7 @@ template  struct hash cannot be used with this 
compiler")
 # else
@@ -67,6 +67,8 @@ template  struct hash
@@ -88,8 +90,6 @@ struct _LIBCPP_TEMPLATE_VIS coroutine_tr
 template 
 class _LIBCPP_TEMPLATE_VIS coroutine_handle;
 
-#if defined(__cpp_coroutines)
-
 template <>
 class _LIBCPP_TEMPLATE_VIS coroutine_handle {
 public:
@@ -235,8 +235,6 @@ struct _LIBCPP_TYPE_VIS suspend_always {
   void await_resume() const noexcept {}
 };
 
-#endif // defined(__cpp_coroutines)
-
 _LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES
 
 _LIBCPP_BEGIN_NAMESPACE_STD
@@ -251,4 +249,6 @@ struct hash<_VSTD_CORO::coroutine_handle
 
 _LIBCPP_END_NAMESPACE_STD
 
+#endif // !defined(_LIBCPP_HAS_NO_COROUTINES)
+
 #endif /* _LIBCPP_EXPERIMENTAL_COROUTINE */


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


[PATCH] D32520: Support __fp16 vectors

2017-05-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 100354.
ahatanak added a comment.

Rebase.


https://reviews.llvm.org/D32520

Files:
  include/clang/Sema/Sema.h
  lib/CodeGen/CGExprScalar.cpp
  lib/Sema/SemaExpr.cpp
  test/CodeGen/fp16vec-ops.c
  test/Sema/fp16vec-sema.c

Index: test/Sema/fp16vec-sema.c
===
--- /dev/null
+++ test/Sema/fp16vec-sema.c
@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+typedef __fp16 half4 __attribute__ ((vector_size (8)));
+typedef float float4 __attribute__ ((vector_size (16)));
+typedef short short4 __attribute__ ((vector_size (8)));
+typedef int int4 __attribute__ ((vector_size (16)));
+
+half4 hv0, hv1;
+float4 fv0, fv1;
+short4 sv0;
+int4 iv0;
+
+void testFP16Vec(int c) {
+  hv0 = hv0 + hv1;
+  hv0 = hv0 - hv1;
+  hv0 = hv0 * hv1;
+  hv0 = hv0 / hv1;
+  hv0 = c ? hv0 : hv1;
+  hv0 += hv1;
+  hv0 -= hv1;
+  hv0 *= hv1;
+  hv0 /= hv1;
+  sv0 = hv0 == hv1;
+  sv0 = hv0 != hv1;
+  sv0 = hv0 < hv1;
+  sv0 = hv0 > hv1;
+  sv0 = hv0 <= hv1;
+  sv0 = hv0 >= hv1;
+  sv0 = hv0 || hv1; // expected-error{{logical expression with vector types 'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
+  sv0 = hv0 && hv1; // expected-error{{logical expression with vector types 'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
+
+  // Implicit conversion between half vectors and float vectors are not allowed.
+  hv0 = fv0; // expected-error{{assigning to}}
+  fv0 = hv0; // expected-error{{assigning to}}
+  hv0 = (half4)fv0; // expected-error{{invalid conversion between}}
+  fv0 = (float4)hv0; // expected-error{{invalid conversion between}}
+  hv0 = fv0 + fv1; // expected-error{{assigning to}}
+  fv0 = hv0 + hv1; // expected-error{{assigning to}}
+  hv0 = hv0 + fv1; // expected-error{{cannot convert between vector}}
+  hv0 = c ? hv0 : fv1; // expected-error{{cannot convert between vector}}
+  sv0 = hv0 == fv1; // expected-error{{cannot convert between vector}}
+  sv0 = hv0 < fv1; // expected-error{{cannot convert between vector}}
+  sv0 = hv0 || fv1; // expected-error{{cannot convert between vector}} expected-error{{invalid operands to binary expression}}
+  iv0 = hv0 == hv1; // expected-error{{assigning to}}
+
+  // clang currently disallows using these operators on vectors, which is
+  // allowed by gcc.
+  sv0 = !hv0; // expected-error{{invalid argument type}}
+  hv0++; // expected-error{{cannot increment value of type}}
+  ++hv0; // expected-error{{cannot increment value of type}}
+}
Index: test/CodeGen/fp16vec-ops.c
===
--- /dev/null
+++ test/CodeGen/fp16vec-ops.c
@@ -0,0 +1,162 @@
+// REQUIRES: arm-registered-target
+// RUN: %clang_cc1 -triple arm64-apple-ios9 -emit-llvm -o - -fallow-half-arguments-and-returns %s | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -triple armv7-apple-ios9 -emit-llvm -o - -fallow-half-arguments-and-returns %s | FileCheck %s --check-prefix=CHECK
+
+typedef __fp16 half4 __attribute__ ((vector_size (8)));
+typedef short short4 __attribute__ ((vector_size (8)));
+
+half4 hv0, hv1;
+short4 sv0;
+
+// CHECK-LABEL: testFP16Vec0
+// CHECK: %[[V0:.*]] = load <4 x half>, <4 x half>* @hv0, align 8
+// CHECK: %[[CONV:.*]] = fpext <4 x half> %[[V0]] to <4 x float>
+// CHECK: %[[V1:.*]] = load <4 x half>, <4 x half>* @hv1, align 8
+// CHECK: %[[CONV1:.*]] = fpext <4 x half> %[[V1]] to <4 x float>
+// CHECK: %[[ADD:.*]] = fadd <4 x float> %[[CONV]], %[[CONV1]]
+// CHECK: %[[CONV2:.*]] = fptrunc <4 x float> %[[ADD]] to <4 x half>
+// CHECK: store <4 x half> %[[CONV2]], <4 x half>* @hv0, align 8
+// CHECK: %[[V2:.*]] = load <4 x half>, <4 x half>* @hv0, align 8
+// CHECK: %[[CONV3:.*]] = fpext <4 x half> %[[V2]] to <4 x float>
+// CHECK: %[[V3:.*]] = load <4 x half>, <4 x half>* @hv1, align 8
+// CHECK: %[[CONV4:.*]] = fpext <4 x half> %[[V3]] to <4 x float>
+// CHECK: %[[SUB:.*]] = fsub <4 x float> %[[CONV3]], %[[CONV4]]
+// CHECK: %[[CONV5:.*]] = fptrunc <4 x float> %[[SUB]] to <4 x half>
+// CHECK: store <4 x half> %[[CONV5]], <4 x half>* @hv0, align 8
+// CHECK: %[[V4:.*]] = load <4 x half>, <4 x half>* @hv0, align 8
+// CHECK: %[[CONV6:.*]] = fpext <4 x half> %[[V4]] to <4 x float>
+// CHECK: %[[V5:.*]] = load <4 x half>, <4 x half>* @hv1, align 8
+// CHECK: %[[CONV7:.*]] = fpext <4 x half> %[[V5]] to <4 x float>
+// CHECK: %[[MUL:.*]] = fmul <4 x float> %[[CONV6]], %[[CONV7]]
+// CHECK: %[[CONV8:.*]] = fptrunc <4 x float> %[[MUL]] to <4 x half>
+// CHECK: store <4 x half> %[[CONV8]], <4 x half>* @hv0, align 8
+// CHECK: %[[V6:.*]] = load <4 x half>, <4 x half>* @hv0, align 8
+// CHECK: %[[CONV9:.*]] = fpext <4 x half> %[[V6]] to <4 x float>
+// CHECK: %[[V7:.*]] = load <4 x half>, <4 x half>* @hv1, align 8
+// CHECK: %[[CONV10:.*]] = fpext <4 x half> %[[V7]] to <4 x float>
+// CHECK: %[[DIV:.*]] = fdiv <4 x float> %[[CONV9]], %[[CONV10]]
+// CHECK: %[[CONV11:.*]] = fptrunc <4 x 

[PATCH] D33082: Fix Libc++ build with MinGW64

2017-05-25 Thread Ben Craig via Phabricator via cfe-commits
bcraig added a comment.

> Are you suggesting that libc++ should stop declaring/defining these 
> functions, at least publically?

I think that we generally shouldn't be giving functions names that are already 
claimed elsewhere (like mbsnrtowcs and wcsnrtombs).  It is my opinion that 
these should always be qualified as __libcpp_* symbols.  We can easily run into 
trouble if users also defined mbsnrtowcs.  They have just as much of a right to 
do so as we do.

That being said, I think that's a change for a different changelist.


https://reviews.llvm.org/D33082



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


[libcxx] r303953 - Remove incorrect #ifdef guards around variant tests.

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 20:27:08 2017
New Revision: 303953

URL: http://llvm.org/viewvc/llvm-project?rev=303953=rev
Log:
Remove incorrect #ifdef guards around variant tests.

The tests were previously guarded by #if defined(_LIBCPP_VER) || 
defined(_MSVC_STL_VER),
which is both incorrect (e.g. _LIBCPP_VERSION) and unneeded. Although the tests 
are
technically non-standard (yet) they are supported by both libc++ and MSVC's STL.

libstdc++ doesn't regularly use the test suite so I'm not concerned about 
guarding these
tests for them.

Modified:

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp?rev=303953=303952=303953=diff
==
--- 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
 Thu May 25 20:27:08 2017
@@ -149,7 +149,7 @@ constexpr bool test_constexpr_copy_ctor_
 }
 
 void test_constexpr_copy_ctor_extension() {
-#if defined(_LIBCPP_VER) || defined(_MSVC_STL_VER)
+  // NOTE: This test is for not yet standardized behavior.
   using V = std::variant;
 #ifdef TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
   static_assert(std::is_trivially_destructible::value, "");
@@ -163,7 +163,6 @@ void test_constexpr_copy_ctor_extension(
   static_assert(test_constexpr_copy_ctor_extension_imp<0>(V(42l)), "");
   static_assert(test_constexpr_copy_ctor_extension_imp<1>(V(nullptr)), "");
   static_assert(test_constexpr_copy_ctor_extension_imp<2>(V(101)), "");
-#endif
 }
 
 int main() {

Modified: 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp?rev=303953=303952=303953=diff
==
--- 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
 Thu May 25 20:27:08 2017
@@ -186,7 +186,7 @@ constexpr bool test_constexpr_ctor_exten
 }
 
 void test_constexpr_move_ctor_extension() {
-#if defined(_LIBCPP_VER) || defined(_MSVC_STL_VER)
+  // NOTE: This test is for not yet standardized behavior.
   using V = std::variant;
 #ifdef TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
   static_assert(std::is_trivially_destructible::value, "");
@@ -201,7 +201,6 @@ void test_constexpr_move_ctor_extension(
   static_assert(test_constexpr_ctor_extension_imp<0>(V(42l)), "");
   static_assert(test_constexpr_ctor_extension_imp<1>(V(nullptr)), "");
   static_assert(test_constexpr_ctor_extension_imp<2>(V(101)), "");
-#endif
 }
 
 int main() {


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


[PATCH] D33178: Remove requirement for libunwind sources.

2017-05-25 Thread Shiz via Phabricator via cfe-commits
Shiz added a comment.

@EricWF: Thanks for reviewing! Is there anything else I need to do at this 
point or will it be committed automatically?


Repository:
  rL LLVM

https://reviews.llvm.org/D33178



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


[libcxx] r303951 - [test] Fix breakage from r303947 =(

2017-05-25 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu May 25 20:00:56 2017
New Revision: 303951

URL: http://llvm.org/viewvc/llvm-project?rev=303951=rev
Log:
[test] Fix breakage from r303947 =(

Modified:

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp?rev=303951=303950=303951=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
 Thu May 25 20:00:56 2017
@@ -45,6 +45,7 @@ struct Foo
 virtual ~Foo() = default;
 };
 
+#ifdef _LIBCPP_VERSION
 struct Result {};
 static Result theFunction() { return Result(); }
 static int resultDeletorCount;
@@ -54,14 +55,15 @@ static void resultDeletor(Result (*pf)()
 }
 
 void test_pointer_to_function() {
-#ifdef _LIBCPP_VER
 { // https://bugs.llvm.org/show_bug.cgi?id=27566
   std::shared_ptr x(, );
   std::shared_ptr y(theFunction, resultDeletor);
 }
 assert(resultDeletorCount == 2);
-#endif
 }
+#else // _LIBCPP_VERSION
+void test_pointer_to_function() {}
+#endif // _LIBCPP_VERSION
 
 int main()
 {


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


[PATCH] D33448: [CodeGen] Add thumb-mode to target-features for arm/thumb triples.

2017-05-25 Thread Eric Christopher via Phabricator via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

One minor nit and LGTM.

Thanks!

-eric




Comment at: lib/Basic/Targets.cpp:5353
 
+// enable or disable thumb-mode per function
+if (isThumb())

Minor nit: comments are full sentences.


https://reviews.llvm.org/D33448



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


[libcxx] r303947 - [test] make_shared<T()>(...) is, uh, libc++-specific

2017-05-25 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu May 25 19:37:33 2017
New Revision: 303947

URL: http://llvm.org/viewvc/llvm-project?rev=303947=rev
Log:
[test] make_shared(...) is, uh, libc++-specific

Modified:

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp?rev=303947=303946=303947=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
 Thu May 25 19:37:33 2017
@@ -53,6 +53,16 @@ static void resultDeletor(Result (*pf)()
   ++resultDeletorCount;
 }
 
+void test_pointer_to_function() {
+#ifdef _LIBCPP_VER
+{ // https://bugs.llvm.org/show_bug.cgi?id=27566
+  std::shared_ptr x(, );
+  std::shared_ptr y(theFunction, resultDeletor);
+}
+assert(resultDeletorCount == 2);
+#endif
+}
+
 int main()
 {
 int nc = globalMemCounter.outstanding_new;
@@ -72,11 +82,9 @@ int main()
 std::shared_ptr p2 = std::make_shared();
 assert(p2.get());
 }
-{ // https://bugs.llvm.org/show_bug.cgi?id=27566
-  std::shared_ptr x(, );
-  std::shared_ptr y(theFunction, resultDeletor);
-}
-assert(resultDeletorCount == 2);
+
+test_pointer_to_function();
+
 #if TEST_STD_VER >= 11
 nc = globalMemCounter.outstanding_new;
 {


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


[PATCH] D33538: [coroutines] Support "coroutines" feature in module map requires clause

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D33538#765225, @rsmith wrote:

> In https://reviews.llvm.org/D33538#765146, @EricWF wrote:
>
> > In https://reviews.llvm.org/D33538#765045, @rsmith wrote:
> >
> > > Do we need to conditionalize this part of libc++? Nothing in the 
> > >  header appears to need compiler support.
> >
> >
> > That's correct. I was mistaken as to why this was needed. I mistook a bug 
> > in libc++ for the reason this was needed. 
> >  So I have no need for this patch anymore.
> >
> > Do you still want to land this for the reasons you mentioned?
>
>
> r303936 will break the libc++ modules build if used with an older version of 
> clang that doesn't have the coroutines builtins. If you're OK with that, then 
> we don't need this. But if you intend to support older versions of Clang, 
> then I think you need either this or a different approach (such as splitting 
> out a separate top-level module for the coroutines header) to avoid that 
> problem.


I'll have to investigate this further. I had assumed the builtins were added at 
the same time as the `__cpp_coroutines` macro, but if that's not the case 
libc++ could still guard the header correctly using either `__has_builtin` or 
the newly updated value of `__cpp_coroutines`; but a complete library solution 
seems possible.

For other users of Clang module maps, though, I see the convince of being able 
to do this within the module map.


https://reviews.llvm.org/D33538



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


Re: [clang-tools-extra] r303884 - [Documentation] Mention hicpp check group in Clang-tidy main document.

2017-05-25 Thread Eugene Zelenko via cfe-commits
Hi, Alexander!

On Thu, May 25, 2017 at 5:16 PM, Alexander Kornienko  wrote:
>
>
> On 25 May 2017 19:22, "Eugene Zelenko via cfe-commits"
>  wrote:
>
> Author: eugenezelenko
> Date: Thu May 25 12:22:29 2017
> New Revision: 303884
>
> URL: http://llvm.org/viewvc/llvm-project?rev=303884=rev
> Log:
> [Documentation] Mention hicpp check group in Clang-tidy main document.
>
> Modified:
> clang-tools-extra/trunk/docs/clang-tidy/index.rst
>
> Modified: clang-tools-extra/trunk/docs/clang-tidy/index.rst
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/index.rst?rev=303884=303883=303884=diff
> ==
> --- clang-tools-extra/trunk/docs/clang-tidy/index.rst (original)
> +++ clang-tools-extra/trunk/docs/clang-tidy/index.rst Thu May 25 12:22:29
> 2017
> @@ -59,7 +59,8 @@ Name prefixDescription
>  ``cert-``  Checks related to CERT Secure Coding Guidelines.
>  ``cppcoreguidelines-`` Checks related to C++ Core Guidelines.
>  ``clang-analyzer-``Clang Static Analyzer checks.
> -``google-``Checks related to the Google coding conventions.
> +``google-``Checks related to Google coding conventions.
>
>
> Could you explain why you think that the article should be omitted here?
> (Maybe a native speaker could chime in? ;)

I'm not native speaker, but I think article should be used/not used
consistently for all references in this table.

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


Re: [clang-tools-extra] r303884 - [Documentation] Mention hicpp check group in Clang-tidy main document.

2017-05-25 Thread Alexander Kornienko via cfe-commits
On 25 May 2017 19:22, "Eugene Zelenko via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

Author: eugenezelenko
Date: Thu May 25 12:22:29 2017
New Revision: 303884

URL: http://llvm.org/viewvc/llvm-project?rev=303884=rev
Log:
[Documentation] Mention hicpp check group in Clang-tidy main document.

Modified:
clang-tools-extra/trunk/docs/clang-tidy/index.rst

Modified: clang-tools-extra/trunk/docs/clang-tidy/index.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/
docs/clang-tidy/index.rst?rev=303884=303883=303884=diff

==
--- clang-tools-extra/trunk/docs/clang-tidy/index.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/index.rst Thu May 25 12:22:29
2017
@@ -59,7 +59,8 @@ Name prefixDescription
 ``cert-``  Checks related to CERT Secure Coding Guidelines.
 ``cppcoreguidelines-`` Checks related to C++ Core Guidelines.
 ``clang-analyzer-``Clang Static Analyzer checks.
-``google-``Checks related to the Google coding conventions.
+``google-``Checks related to Google coding conventions.


Could you explain why you think that the article should be omitted here?
(Maybe a native speaker could chime in? ;)

+``hicpp-`` Checks related to High Integrity C++ Coding
Standard.
 ``llvm-``  Checks related to the LLVM coding conventions.
 ``misc-``  Checks that we didn't have a better category for.
 ``modernize-`` Checks that advocate usage of modern (currently
"modern"
@@ -652,7 +653,7 @@ The script provides multiple configurati
 * To restrict the files examined you can provide one or more regex
arguments
   that the file names are matched against.
   ``run-clang-tidy.py clang-tidy/.*Check\.cpp`` will only analyze
clang-tidy
-  checkers. It may also be necessary to restrict the header files warnings
are
+  checks. It may also be necessary to restrict the header files warnings
are
   displayed from using the ``-header-filter`` flag. It has the same
behavior
   as the corresponding :program:`clang-tidy` flag.



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


[PATCH] D33538: [coroutines] Support "coroutines" feature in module map requires clause

2017-05-25 Thread Richard Smith via Phabricator via cfe-commits
rsmith added a comment.

In https://reviews.llvm.org/D33538#765146, @EricWF wrote:

> In https://reviews.llvm.org/D33538#765045, @rsmith wrote:
>
> > Do we need to conditionalize this part of libc++? Nothing in the 
> >  header appears to need compiler support.
>
>
> That's correct. I was mistaken as to why this was needed. I mistook a bug in 
> libc++ for the reason this was needed. 
>  So I have no need for this patch anymore.
>
> Do you still want to land this for the reasons you mentioned?


r303936 will break the libc++ modules build if used with an older version of 
clang that doesn't have the coroutines builtins. If you're OK with that, then 
we don't need this. But if you intend to support older versions of Clang, then 
I think you need either this or a different approach (such as splitting out a 
separate top-level module for the coroutines header) to avoid that problem.


https://reviews.llvm.org/D33538



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


r303945 - Factor resolving of header directives -> files out of module map parser.

2017-05-25 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu May 25 19:01:53 2017
New Revision: 303945

URL: http://llvm.org/viewvc/llvm-project?rev=303945=rev
Log:
Factor resolving of header directives -> files out of module map parser.

Modified:
cfe/trunk/include/clang/Lex/ModuleMap.h
cfe/trunk/lib/Lex/ModuleMap.cpp

Modified: cfe/trunk/include/clang/Lex/ModuleMap.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/ModuleMap.h?rev=303945=303944=303945=diff
==
--- cfe/trunk/include/clang/Lex/ModuleMap.h (original)
+++ cfe/trunk/include/clang/Lex/ModuleMap.h Thu May 25 19:01:53 2017
@@ -257,6 +257,23 @@ private:
   /// resolved.
   Module *resolveModuleId(const ModuleId , Module *Mod, bool Complain) 
const;
 
+  /// Resolve the given header directive to an actual header file.
+  ///
+  /// \param M The module in which we're resolving the header directive.
+  /// \param Header The header directive to resolve.
+  /// \param RelativePathName Filled in with the relative path name from the
+  ///module to the resolved header.
+  /// \return The resolved file, if any.
+  const FileEntry *resolveHeader(Module *M,
+ Module::UnresolvedHeaderDirective Header,
+ SmallVectorImpl );
+
+  /// Attempt to resolve the specified header directive as naming a builtin
+  /// header.
+  const FileEntry *
+  resolveAsBuiltinHeader(Module *M, Module::UnresolvedHeaderDirective Header,
+ SmallVectorImpl );
+
   /// \brief Looks up the modules that \p File corresponds to.
   ///
   /// If \p File represents a builtin header within Clang's builtin include

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=303945=303944=303945=diff
==
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Thu May 25 19:01:53 2017
@@ -84,6 +84,90 @@ Module *ModuleMap::resolveModuleId(const
   return Context;
 }
 
+/// \brief Append to \p Paths the set of paths needed to get to the 
+/// subframework in which the given module lives.
+static void appendSubframeworkPaths(Module *Mod,
+SmallVectorImpl ) {
+  // Collect the framework names from the given module to the top-level module.
+  SmallVector Paths;
+  for (; Mod; Mod = Mod->Parent) {
+if (Mod->IsFramework)
+  Paths.push_back(Mod->Name);
+  }
+  
+  if (Paths.empty())
+return;
+  
+  // Add Frameworks/Name.framework for each subframework.
+  for (unsigned I = Paths.size() - 1; I != 0; --I)
+llvm::sys::path::append(Path, "Frameworks", Paths[I-1] + ".framework");
+}
+
+const FileEntry *
+ModuleMap::resolveHeader(Module *M, Module::UnresolvedHeaderDirective Header,
+ SmallVectorImpl ) {
+  if (llvm::sys::path::is_absolute(Header.FileName)) {
+RelativePathName.clear();
+RelativePathName.append(Header.FileName.begin(), Header.FileName.end());
+return SourceMgr.getFileManager().getFile(Header.FileName);
+  }
+
+  // Search for the header file within the module's home directory.
+  auto *Directory = M->Directory;
+  SmallString<128> FullPathName(Directory->getName());
+  unsigned FullPathLength = FullPathName.size();
+
+  if (M->isPartOfFramework()) {
+appendSubframeworkPaths(M, RelativePathName);
+unsigned RelativePathLength = RelativePathName.size();
+
+// Check whether this file is in the public headers.
+llvm::sys::path::append(RelativePathName, "Headers", Header.FileName);
+llvm::sys::path::append(FullPathName, RelativePathName);
+if (auto *File = SourceMgr.getFileManager().getFile(FullPathName))
+  return File;
+
+// Check whether this file is in the private headers.
+// Ideally, private modules in the form 'FrameworkName.Private' should
+// be defined as 'module FrameworkName.Private', and not as
+// 'framework module FrameworkName.Private', since a 'Private.Framework'
+// does not usually exist. However, since both are currently widely used
+// for private modules, make sure we find the right path in both cases.
+if (M->IsFramework && M->Name == "Private")
+  RelativePathName.clear();
+else
+  RelativePathName.resize(RelativePathLength);
+FullPathName.resize(FullPathLength);
+llvm::sys::path::append(RelativePathName, "PrivateHeaders",
+Header.FileName);
+llvm::sys::path::append(FullPathName, RelativePathName);
+return SourceMgr.getFileManager().getFile(FullPathName);
+  }
+
+  // Lookup for normal headers.
+  llvm::sys::path::append(RelativePathName, Header.FileName);
+  llvm::sys::path::append(FullPathName, RelativePathName);
+  return SourceMgr.getFileManager().getFile(FullPathName);
+}
+
+const FileEntry *
+ModuleMap::resolveAsBuiltinHeader(Module *M,

[PATCH] D33538: [coroutines] Support "coroutines" feature in module map requires clause

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

Also see r303936, which re-adds  to the module map and 
fixes the bug.


https://reviews.llvm.org/D33538



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


[PATCH] D33082: Fix Libc++ build with MinGW64

2017-05-25 Thread Martell Malone via Phabricator via cfe-commits
martell added a comment.

> ! In https://reviews.llvm.org/D33082#764617, @EricWF wrote:
>  Defining `_GNU_SOURCE` during the library build isn't enough, it's also has 
> to be defined when people are using the headers,
>  and in that case we must depend on the compiler to pre-define it. Is it 
> important that MinGW not define `_GNU_SOURCE` by default?

I'm not sure why this isn't the default, it could be some backwards 
compatability with mingw.org.
I will ask kai the author and find out.

> Also do you know why `asprintf` is declared by mingw-w64 but `vasprintf` 
> isn't? At minimum I think we still need to declare `vasprintf` in the
>  headers because we can't count on `_GNU_SOURCE` being defined before 
> `` is first included, but we should be able to omit
>  the definition.

I believe it is in stdio.h but behind the guard `__USE_MINGW_ANSI_STDIO`
You are currently picking up is msvc compatable asprintf and not gnu.
Defining this will give you the gnu versions of both and also the GNU printf 
format specifiers.

> Are you suggesting that libc++ should stop declaring/defining these 
> functions, at least publically?

We could in the future run into real world problems with projects that work 
with libstdc++ fine but will have problems with libc++ if a project implements 
its own version but
I wouldn't be too concerned about this right now because when that becomes a 
problem it will prompt people to get these into mingw-w64 upstream.


https://reviews.llvm.org/D33082



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


[libcxx] r303936 - Re-add to the module map.

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 18:39:29 2017
New Revision: 303936

URL: http://llvm.org/viewvc/llvm-project?rev=303936=rev
Log:
Re-add  to the module map.

The original issues were caused because 
didn't correctly #ifdef out enough of the header, which caused incomplete
types to be used.

This patch fixes the `#if defined(__cpp_coroutines)` guard and re-adds
the headers to the module map.

It also uglifies some incorrectly non-reserved names.

Modified:
libcxx/trunk/include/experimental/coroutine
libcxx/trunk/include/module.modulemap

Modified: libcxx/trunk/include/experimental/coroutine
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/coroutine?rev=303936=303935=303936=diff
==
--- libcxx/trunk/include/experimental/coroutine (original)
+++ libcxx/trunk/include/experimental/coroutine Thu May 25 18:39:29 2017
@@ -85,7 +85,7 @@ struct _LIBCPP_TEMPLATE_VIS coroutine_tr
 {
 };
 
-template 
+template 
 class _LIBCPP_TEMPLATE_VIS coroutine_handle;
 
 #if defined(__cpp_coroutines)
@@ -217,8 +217,6 @@ public:
 }
 };
 
-#endif // defined(__cpp_coroutines)
-
 struct _LIBCPP_TYPE_VIS suspend_never {
   _LIBCPP_ALWAYS_INLINE
   bool await_ready() const noexcept { return true; }
@@ -237,6 +235,8 @@ struct _LIBCPP_TYPE_VIS suspend_always {
   void await_resume() const noexcept {}
 };
 
+#endif // defined(__cpp_coroutines)
+
 _LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES
 
 _LIBCPP_BEGIN_NAMESPACE_STD

Modified: libcxx/trunk/include/module.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/module.modulemap?rev=303936=303935=303936=diff
==
--- libcxx/trunk/include/module.modulemap (original)
+++ libcxx/trunk/include/module.modulemap Thu May 25 18:39:29 2017
@@ -501,12 +501,10 @@ module std [system] {
   header "experimental/chrono"
   export *
 }
-// FIXME: This module only works when -fcoroutines-ts is enabled and it
-// breaks the modules build otherwise.
-// module coroutine {
-//  header "experimental/coroutine"
-//  export *
-// }
+ module coroutine {
+  header "experimental/coroutine"
+  export *
+}
 module deque {
   header "experimental/deque"
   export *


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


[PATCH] D28404: IRGen: Add optnone attribute on function during O0

2017-05-25 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

Actually, looking through the comments, it appears that everyone (eventually) 
agreed with the approach in the patch.  I agree too.  LGTM.

Mehdi, are you able to rebase and commit, or should someone take over?


https://reviews.llvm.org/D28404



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


[PATCH] D33538: [coroutines] Support "coroutines" feature in module map requires clause

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D33538#765045, @rsmith wrote:

> Do we need to conditionalize this part of libc++? Nothing in the  
> header appears to need compiler support.


That's correct. I was mistaken as to why this was needed. I mistook a bug in 
libc++ for the reason this was needed. 
So I have no need for this patch anymore.

Do you still want to land this for the reasons you mentioned?


https://reviews.llvm.org/D33538



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


r303934 - "*" => "+" to avoid matching on empty string.

2017-05-25 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Thu May 25 18:25:36 2017
New Revision: 303934

URL: http://llvm.org/viewvc/llvm-project?rev=303934=rev
Log:
"*" => "+" to avoid matching on empty string.

Modified:
cfe/trunk/test/Driver/baremetal.cpp

Modified: cfe/trunk/test/Driver/baremetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/baremetal.cpp?rev=303934=303933=303934=diff
==
--- cfe/trunk/test/Driver/baremetal.cpp (original)
+++ cfe/trunk/test/Driver/baremetal.cpp Thu May 25 18:25:36 2017
@@ -4,7 +4,7 @@
 // RUN: -L some/directory/user/asked/for \
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-C %s
-// CHECK-V6M-C: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]*}}{{[/\\]+}}clang{{.*}}" 
"-cc1" "-triple" "thumbv6m-none--eabi"
+// CHECK-V6M-C: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]+}}{{[/\\]+}}clang{{.*}}" 
"-cc1" "-triple" "thumbv6m-none--eabi"
 // CHECK-V6M-C-SAME: "-resource-dir" 
"[[PREFIX_DIR]]{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}[[VERSION:[^"]*]]"
 // CHECK-V6M-C-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
 // CHECK-V6M-C-SAME: "-internal-isystem" 
"[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"


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


[PATCH] D33568: Fix crash when evaluating constant expressions involving nullptr

2017-05-25 Thread Richard Smith via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Thanks!


https://reviews.llvm.org/D33568



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


[PATCH] D33538: [coroutines] Support "coroutines" feature in module map requires clause

2017-05-25 Thread Richard Smith via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D33538#765062, @rsmith wrote:

> In https://reviews.llvm.org/D33538#765045, @rsmith wrote:
>
> > Do we need to conditionalize this part of libc++? Nothing in the 
> >  header appears to need compiler support.
>
>
> Oh wait, I see what's going on. You're not testing for whether coroutines is 
> enabled, you're testing for whether the `__builtin_coro_*` builtins exist. 
> Are we sufficiently confident that those aren't going to change that we're 
> prepared to make libc++ rely on this? (If we change the signature of those 
> builtins in the future, then new versions of clang would stop being able to 
> build old versions of the libc++ module.)


On reflection, I think this is fine. If the signatures of the builtins change, 
and the user builds with `-fmodules` `-fcoroutines-ts` and libc++, and there's 
version skew between libc++ and clang, they'll get a compile error. That's 
mostly the expected outcome; the issue is that we'd produce this compile error 
*even if* they never `#include `, because building the 
complete libc++ module would fail in that situation.

If we're worried about that, we could split the coroutines header out of the 
main libc++ module into its own top-level module, but I don't think we need to 
worry too much about rejecting code that uses `-fcoroutines-ts` but never 
actually uses a coroutine.


https://reviews.llvm.org/D33538



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


[PATCH] D33568: Fix crash when evaluating constant expressions involving nullptr

2017-05-25 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover updated this revision to Diff 100321.
t.p.northover added a comment.

Sounds very reasonable to me. I've uploaded a new diff.


https://reviews.llvm.org/D33568

Files:
  clang/lib/AST/ExprConstant.cpp
  clang/test/SemaCXX/null-cast.cpp


Index: clang/test/SemaCXX/null-cast.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/null-cast.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct A {};
+struct B : virtual A {};
+
+void foo() {
+  (void)static_cast(*(B *)0); // expected-warning {{binding dereferenced 
null pointer to reference has undefined behavior}}
+}
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -1230,8 +1230,7 @@
   IsNullPtr = V.isNullPointer();
 }
 
-void set(APValue::LValueBase B, unsigned I = 0, bool BInvalid = false,
- bool IsNullPtr_ = false, uint64_t Offset_ = 0) {
+void set(APValue::LValueBase B, unsigned I = 0, bool BInvalid = false) {
 #ifndef NDEBUG
   // We only allow a few types of invalid bases. Enforce that here.
   if (BInvalid) {
@@ -1242,11 +1241,20 @@
 #endif
 
   Base = B;
-  Offset = CharUnits::fromQuantity(Offset_);
+  Offset = CharUnits::fromQuantity(0);
   InvalidBase = BInvalid;
   CallIndex = I;
   Designator = SubobjectDesignator(getType(B));
-  IsNullPtr = IsNullPtr_;
+  IsNullPtr = false;
+}
+
+void setNull(QualType PointerTy, uint64_t TargetVal) {
+  Base = (Expr *)nullptr;
+  Offset = CharUnits::fromQuantity(TargetVal);
+  InvalidBase = false;
+  CallIndex = 0;
+  Designator = SubobjectDesignator(PointerTy->getPointeeType());
+  IsNullPtr = true;
 }
 
 void setInvalid(APValue::LValueBase B, unsigned I = 0) {
@@ -5494,8 +5502,8 @@
 return true;
   }
   bool ZeroInitialization(const Expr *E) {
-auto Offset = Info.Ctx.getTargetNullPointerValue(E->getType());
-Result.set((Expr*)nullptr, 0, false, true, Offset);
+auto TargetVal = Info.Ctx.getTargetNullPointerValue(E->getType());
+Result.setNull(E->getType(), TargetVal);
 return true;
   }
 


Index: clang/test/SemaCXX/null-cast.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/null-cast.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct A {};
+struct B : virtual A {};
+
+void foo() {
+  (void)static_cast(*(B *)0); // expected-warning {{binding dereferenced null pointer to reference has undefined behavior}}
+}
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -1230,8 +1230,7 @@
   IsNullPtr = V.isNullPointer();
 }
 
-void set(APValue::LValueBase B, unsigned I = 0, bool BInvalid = false,
- bool IsNullPtr_ = false, uint64_t Offset_ = 0) {
+void set(APValue::LValueBase B, unsigned I = 0, bool BInvalid = false) {
 #ifndef NDEBUG
   // We only allow a few types of invalid bases. Enforce that here.
   if (BInvalid) {
@@ -1242,11 +1241,20 @@
 #endif
 
   Base = B;
-  Offset = CharUnits::fromQuantity(Offset_);
+  Offset = CharUnits::fromQuantity(0);
   InvalidBase = BInvalid;
   CallIndex = I;
   Designator = SubobjectDesignator(getType(B));
-  IsNullPtr = IsNullPtr_;
+  IsNullPtr = false;
+}
+
+void setNull(QualType PointerTy, uint64_t TargetVal) {
+  Base = (Expr *)nullptr;
+  Offset = CharUnits::fromQuantity(TargetVal);
+  InvalidBase = false;
+  CallIndex = 0;
+  Designator = SubobjectDesignator(PointerTy->getPointeeType());
+  IsNullPtr = true;
 }
 
 void setInvalid(APValue::LValueBase B, unsigned I = 0) {
@@ -5494,8 +5502,8 @@
 return true;
   }
   bool ZeroInitialization(const Expr *E) {
-auto Offset = Info.Ctx.getTargetNullPointerValue(E->getType());
-Result.set((Expr*)nullptr, 0, false, true, Offset);
+auto TargetVal = Info.Ctx.getTargetNullPointerValue(E->getType());
+Result.setNull(E->getType(), TargetVal);
 return true;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r303932 - Make test/Driver/baremetal.cpp work when output directory isn't named 'bin'.

2017-05-25 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Thu May 25 18:03:08 2017
New Revision: 303932

URL: http://llvm.org/viewvc/llvm-project?rev=303932=rev
Log:
Make test/Driver/baremetal.cpp work when output directory isn't named 'bin'.


Modified:
cfe/trunk/test/Driver/baremetal.cpp

Modified: cfe/trunk/test/Driver/baremetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/baremetal.cpp?rev=303932=303931=303932=diff
==
--- cfe/trunk/test/Driver/baremetal.cpp (original)
+++ cfe/trunk/test/Driver/baremetal.cpp Thu May 25 18:03:08 2017
@@ -4,7 +4,7 @@
 // RUN: -L some/directory/user/asked/for \
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-C %s
-// CHECK-V6M-C: "[[PREFIX_DIR:.*]]{{[/\\]+}}bin{{[/\\]+}}clang{{.*}}" "-cc1" 
"-triple" "thumbv6m-none--eabi"
+// CHECK-V6M-C: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]*}}{{[/\\]+}}clang{{.*}}" 
"-cc1" "-triple" "thumbv6m-none--eabi"
 // CHECK-V6M-C-SAME: "-resource-dir" 
"[[PREFIX_DIR]]{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}[[VERSION:[^"]*]]"
 // CHECK-V6M-C-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
 // CHECK-V6M-C-SAME: "-internal-isystem" 
"[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"


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


[PATCH] D33538: [coroutines] Support "coroutines" feature in module map requires clause

2017-05-25 Thread Richard Smith via Phabricator via cfe-commits
rsmith added a comment.

In https://reviews.llvm.org/D33538#765045, @rsmith wrote:

> Do we need to conditionalize this part of libc++? Nothing in the  
> header appears to need compiler support.


Oh wait, I see what's going on. You're not testing for whether coroutines is 
enabled, you're testing for whether the `__builtin_coro_*` builtins exist. Are 
we sufficiently confident that those aren't going to change that we're prepared 
to make libc++ rely on this? (If we change the signature of those builtins in 
the future, then new versions of clang would stop being able to build old 
versions of the libc++ module.)

If we're not confident of that, how about calling the new feature something 
ugly like experimental_coroutines_builtins_20170525 or similar? That way, 
future versions of Clang can stop advertising that feature if we change the 
design of the builtins, and we can add a feature 'coroutines' later in a 
non-disruptive way if/when we decide we're happy with them as-is.




Comment at: test/Modules/requires-coroutines.mm:1
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules 
-fimplicit-module-maps -F %S/Inputs %s -verify

EricWF wrote:
> Should this test be called `requires-coroutines.cpp` or is using Obj-C++ a 
> correct thing to do here?
You can use a .cpp extension and the Modules TS `import` keyword if you prefer 
(add `-fmodules-ts` to the clang arguments), or use a .cpp extension and 
`#pragma clang module import` if you don't want to depend on a second TS in 
this test.


https://reviews.llvm.org/D33538



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


[PATCH] D32842: Specify which sanitizers are covered by a sanitizer blacklist

2017-05-25 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov added a comment.

@vsk Looks reasonable to me, although I would say such a change should probably 
require more tests.
However, I am not a C++ expert, and I am still not overly familiar with a 
codebase, so I'm not sure whether I should be a single reviewer.


https://reviews.llvm.org/D32842



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


[PATCH] D33538: [coroutines] Support "coroutines" feature in module map requires clause

2017-05-25 Thread Richard Smith via Phabricator via cfe-commits
rsmith added a comment.

Do we need to conditionalize this part of libc++? Nothing in the  
header appears to need compiler support.


https://reviews.llvm.org/D33538



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


r303930 - Switch from using a DiagnosticTrap and a note for "while defining a special

2017-05-25 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu May 25 17:47:05 2017
New Revision: 303930

URL: http://llvm.org/viewvc/llvm-project?rev=303930=rev
Log:
Switch from using a DiagnosticTrap and a note for "while defining a special
member function" context notes to registering an entry on the context stack.

Also reorder the steps within defining special members to be consistent.

This has a few benefits: if multiple diagnostics are produced while checking
such a member, the note is now attached to the first such diagnostic rather
than the last, this prepares us for persisting these diagnostics between the
point at which we require the implicit instantiation of a template and the
point at which that instantiation is actually performed, and this fixes some
cases where we would fail to produce a full note stack leading back to user
code in the case of such a diagnostic.

The reordering exposed a case where we could recursively attempt to define a
defaulted destructor while we're already defining one (and other such cases
also appear to be possible, with or without this change), so this change also
reuses the "willHaveBody" flag on function declarations to track that we're in
the middle of synthesizing a body for the function and bails out if we try to
define a function that we're already defining.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/test/CXX/class.access/p4.cpp
cfe/trunk/test/SemaCXX/default-assignment-operator.cpp
cfe/trunk/test/SemaCXX/deprecated.cpp
cfe/trunk/test/SemaCXX/uninitialized.cpp
cfe/trunk/test/SemaCXX/virtual-base-used.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=303930=303929=303930=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu May 25 17:47:05 
2017
@@ -1554,9 +1554,9 @@ def note_ivar_decl : Note<"instance vari
 def note_bitfield_decl : Note<"bit-field is declared here">;
 def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
 def note_member_synthesized_at : Note<
-  "implicit %select{default constructor|copy constructor|move constructor|copy 
"
-  "assignment operator|move assignment operator|destructor}0 for %1 first "
-  "required here">;
+  "in implicit %select{default constructor|copy constructor|move constructor|"
+  "copy assignment operator|move assignment operator|destructor}0 for %1 "
+  "first required here">;
 def note_inhctor_synthesized_at : Note<
   "inherited constructor for %0 first required here">;
 def err_missing_default_ctor : Error<

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=303930=303929=303930=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu May 25 17:47:05 2017
@@ -689,17 +689,37 @@ public:
   class SynthesizedFunctionScope {
 Sema 
 Sema::ContextRAII SavedContext;
+bool PushedCodeSynthesisContext = false;
 
   public:
 SynthesizedFunctionScope(Sema , DeclContext *DC)
-  : S(S), SavedContext(S, DC)
-{
+: S(S), SavedContext(S, DC) {
   S.PushFunctionScope();
   S.PushExpressionEvaluationContext(
   Sema::ExpressionEvaluationContext::PotentiallyEvaluated);
+  if (auto *FD = dyn_cast(DC))
+FD->setWillHaveBody(true);
+  else
+assert(isa(DC));
+}
+
+void addContextNote(SourceLocation UseLoc) {
+  assert(!PushedCodeSynthesisContext);
+
+  Sema::CodeSynthesisContext Ctx;
+  Ctx.Kind = Sema::CodeSynthesisContext::DefiningSynthesizedFunction;
+  Ctx.PointOfInstantiation = UseLoc;
+  Ctx.Entity = cast(S.CurContext);
+  S.pushCodeSynthesisContext(Ctx);
+
+  PushedCodeSynthesisContext = true;
 }
 
 ~SynthesizedFunctionScope() {
+  if (PushedCodeSynthesisContext)
+S.popCodeSynthesisContext();
+  if (auto *FD = dyn_cast(S.CurContext))
+FD->setWillHaveBody(false);
   S.PopExpressionEvaluationContext();
   S.PopFunctionScopeInfo();
 }
@@ -6974,6 +6994,10 @@ public:
 
   /// We are declaring an implicit special member function.
   DeclaringSpecialMember,
+
+  /// We are defining a synthesized function (such as a defaulted special
+  /// member).
+  DefiningSynthesizedFunction,
 } Kind;
 
 /// \brief Was the enclosing context a non-instantiation SFINAE context?

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=303930=303929=303930=diff

[libcxx] r303929 - Correct typo: LIBCXXABI_BUILTINS_LIBRARY -> LIBCXX_BUILTINS_LIBRARY

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 17:43:42 2017
New Revision: 303929

URL: http://llvm.org/viewvc/llvm-project?rev=303929=rev
Log:
Correct typo: LIBCXXABI_BUILTINS_LIBRARY -> LIBCXX_BUILTINS_LIBRARY

Modified:
libcxx/trunk/cmake/config-ix.cmake

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=303929=303928=303929=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Thu May 25 17:43:42 2017
@@ -42,7 +42,7 @@ if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
 # Mingw64 requires quite a few "C" runtime libraries in order for basic
 # programs to link successfully with -nodefaultlibs.
 if (LIBCXX_USE_COMPILER_RT)
-  set(MINGW_RUNTIME ${LIBCXXABI_BUILTINS_LIBRARY})
+  set(MINGW_RUNTIME ${LIBCXX_BUILTINS_LIBRARY})
 else ()
   set(MINGW_RUNTIME gcc_s gcc)
 endif()


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


[libcxx] r303928 - libcxx: fix bootstrapping for mingw-w64

2017-05-25 Thread Martell Malone via cfe-commits
Author: martell
Date: Thu May 25 17:37:15 2017
New Revision: 303928

URL: http://llvm.org/viewvc/llvm-project?rev=303928=rev
Log:
libcxx: fix bootstrapping for mingw-w64

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

Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/include/__threading_support
libcxx/trunk/lib/CMakeLists.txt

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=303928=303927=303928=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Thu May 25 17:37:15 2017
@@ -41,7 +41,15 @@ if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
   if (MINGW)
 # Mingw64 requires quite a few "C" runtime libraries in order for basic
 # programs to link successfully with -nodefaultlibs.
-list(APPEND CMAKE_REQUIRED_LIBRARIES mingw32 gcc gcc_eh mingwex msvcrt gcc)
+if (LIBCXX_USE_COMPILER_RT)
+  set(MINGW_RUNTIME ${LIBCXXABI_BUILTINS_LIBRARY})
+else ()
+  set(MINGW_RUNTIME gcc_s gcc)
+endif()
+set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt 
advapi32
+shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME}
+moldname mingwex msvcrt)
+list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
   endif()
   if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")

Modified: libcxx/trunk/include/__threading_support
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=303928=303927=303928=diff
==
--- libcxx/trunk/include/__threading_support (original)
+++ libcxx/trunk/include/__threading_support Thu May 25 17:37:15 2017
@@ -27,7 +27,7 @@
 # include 
 # include 
 #elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
-#include 
+#include 
 #include 
 #include 
 #include <__undef_min_max>

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=303928=303927=303928=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Thu May 25 17:37:15 2017
@@ -242,14 +242,11 @@ endif()
 if (LIBCXX_ENABLE_STATIC)
   add_library(cxx_static STATIC $)
   target_link_libraries(cxx_static ${LIBCXX_LIBRARIES})
-  set(STATIC_OUTPUT_NAME "c++")
-  if (WIN32)
-set(STATIC_OUTPUT_NAME "libc++")
-  endif()
+  set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
   set_target_properties(cxx_static
 PROPERTIES
   LINK_FLAGS"${LIBCXX_LINK_FLAGS}"
-  OUTPUT_NAME   "${STATIC_OUTPUT_NAME}"
+  OUTPUT_NAME   "c++"
   )
 
   list(APPEND LIBCXX_TARGETS "cxx_static")


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


[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-05-25 Thread Leo Li via Phabricator via cfe-commits
aoli added a comment.

@jroelofs we are not building builtins currently but we are planning to do so. 
I just added some basic configurations for builtins.


https://reviews.llvm.org/D33561



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


[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-05-25 Thread Leo Li via Phabricator via cfe-commits
aoli updated this revision to Diff 100308.
aoli added a comment.

Add builtin configurations.


https://reviews.llvm.org/D33561

Files:
  cmake/caches/Android-stage2.cmake
  cmake/caches/Android.cmake


Index: cmake/caches/Android.cmake
===
--- /dev/null
+++ cmake/caches/Android.cmake
@@ -0,0 +1,31 @@
+# This file sets up a CMakeCache for an Android toolchain build.
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_BUILD_RUNTIME OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
+set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  if (Android_${target}_C_FLAGS)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_C_FLAGS=${Android_${target}_C_FLAGS})
+  endif()
+  if (Android_${target}_SYSROOT)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_SYSROOT=${Android_${target}_SYSROOT})
+  endif()
+  if (Android_${target}_CXX_FLAGS)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_CXX_FLAGS=${Android_${target}_CXX_FLAGS})
+  endif()
+endforeach()
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS "${EXTRA_ARGS} 
-C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake" CACHE STRING "")
Index: cmake/caches/Android-stage2.cmake
===
--- /dev/null
+++ cmake/caches/Android-stage2.cmake
@@ -0,0 +1,30 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+set(CMAKE_BUILT_TYPE RELEASE CACHE STRING "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+
+
+set(LLVM_BUILTIN_TARGETS 
"i686-linux-android;x86_64-linux-android;aarch64-linux-android;armv7-linux-android"
 CACHE STRING "")
+foreach(target i686;x86_64;aarch64;armv7)
+  set(BUILTINS_${target}-linux-android_ANDROID 1 CACHE STRING "")
+  set(BUILTINS_${target}-linux-android_CMAKE_ASM_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(BUILTINS_${target}-linux-android_CMAKE_C_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(BUILTINS_${target}-linux-android_CMAKE_SYSROOT 
${Android_${target}_SYSROOT} CACHE PATH "")
+endforeach()
+
+
+set(LLVM_RUNTIME_TARGETS 
"i686-linux-android;x86_64-linux-android;aarch64-linux-android;armv7-linux-android"
 CACHE STRING "")
+foreach(target i686;x86_64;aarch64;armv7)
+  set(RUNTIMES_${target}-linux-android_ANDROID 1 CACHE STRING "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_ASM_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_C_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_CXX_FLAGS 
${Android_${target}_CXX_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_SYSROOT 
${Android_${target}_SYSROOT} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_ENABLE_WERROR ON CACHE BOOL 
"")
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_INCLUDE_TESTS OFF CACHE 
BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+endforeach()


Index: cmake/caches/Android.cmake
===
--- /dev/null
+++ cmake/caches/Android.cmake
@@ -0,0 +1,31 @@
+# This file sets up a CMakeCache for an Android toolchain build.
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_BUILD_RUNTIME OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
+set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  if (Android_${target}_C_FLAGS)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_C_FLAGS=${Android_${target}_C_FLAGS})
+  endif()
+  if (Android_${target}_SYSROOT)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_SYSROOT=${Android_${target}_SYSROOT})
+  endif()
+  if (Android_${target}_CXX_FLAGS)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_CXX_FLAGS=${Android_${target}_CXX_FLAGS})
+  endif()
+endforeach()
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS "${EXTRA_ARGS} -C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake" CACHE STRING "")

Re: r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Jonathan Roelofs via cfe-commits



On 5/25/17 2:41 PM, Hans Wennborg wrote:

The test was failing on Windows; r303910 for that.


Oh yuk.. thanks for fixing that.


Jon



On Thu, May 25, 2017 at 11:55 AM, Jonathan Roelofs via cfe-commits
 wrote:


On 5/25/17 11:39 AM, Galina Kistanova wrote:

Hello Jonathan,

This commit broke one of our builders:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2608/steps/build-unified-tree/logs/stdio

Please have a look at this?


r303898 should take care of that.


Jon



Thanks

Galina

On Thu, May 25, 2017 at 8:42 AM, Jonathan Roelofs via cfe-commits
 wrote:

Author: jroelofs
Date: Thu May 25 10:42:13 2017
New Revision: 303873

URL: http://llvm.org/viewvc/llvm-project?rev=303873=rev
Log:
Don't defer to the GCC driver for linking arm-baremetal

Also comes with a cmake cache for building the runtime bits:

  $ cmake  \
-DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
-DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
-DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
-C /path/to/clang/cmake/caches/BaremetalARM.cmake \
/path/to/llvm

https://reviews.llvm.org/D33259

Added:
 cfe/trunk/cmake/caches/BaremetalARM.cmake
 cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
 cfe/trunk/lib/Driver/ToolChains/BareMetal.h
 cfe/trunk/test/Driver/Inputs/baremetal_arm/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
 cfe/trunk/test/Driver/baremetal.cpp
Modified:
 cfe/trunk/lib/Driver/CMakeLists.txt
 cfe/trunk/lib/Driver/Driver.cpp
 cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
 cfe/trunk/lib/Driver/ToolChains/Linux.cpp
 cfe/trunk/test/Frontend/gnu-mcount.c

Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/BaremetalARM.cmake?rev=303873=auto

==
--- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
+++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
@@ -0,0 +1,50 @@
+set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
+
+# Builtins
+set(LLVM_BUILTIN_TARGETS
"armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi" CACHE STRING "Builtin
Targets")
+
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV6M_SYSROOT}
CACHE STRING "armv6m-none-eabi Sysroot")
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
"armv6m-none-eabi System Name")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
"armv6m-none-eabi Baremetal build")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING
"armv6m-none-eabi os dir")
+
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7M_SYSROOT}
CACHE STRING "armv7m-none-eabi Sysroot")
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
"armv7m-none-eabi System Name")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
"armv7m-none-eabi Baremetal build")
+set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE STRING
"armv7m-none-eabi C Flags")
+set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
STRING "armv7m-none-eabi ASM Flags")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING
"armv7m-none-eabi os dir")
+
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7EM_SYSROOT}
CACHE STRING "armv7em-none-eabi Sysroot")
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
"armv7em-none-eabi System Name")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
"armv7em-none-eabi Baremetal build")
+set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE
STRING "armv7em-none-eabi C Flags")
+set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
STRING "armv7em-none-eabi ASM Flags")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE
STRING "armv7em-none-eabi os dir")
+
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+set(LLVM_TOOLCHAIN_TOOLS
+  llc
+  llvm-ar
+  llvm-cxxfilt
+  llvm-dwarfdump
+  llvm-dsymutil
+  llvm-nm
+  llvm-objdump
+  llvm-ranlib
+  llvm-readobj
+  llvm-size
+  llvm-symbolizer
+  opt
+  CACHE STRING "")
+
+set(LLVM_DISTRIBUTION_COMPONENTS
+  clang
+  lld
+  clang-headers
+  builtins-armv6m-none-eabi
+  builtins-armv7m-none-eabi
+  builtins-armv7em-none-eabi
+  runtimes
+  ${LLVM_TOOLCHAIN_TOOLS}
+  CACHE STRING "")

Modified: cfe/trunk/lib/Driver/CMakeLists.txt
URL:

[PATCH] D33568: Fix crash when evaluating constant expressions involving nullptr

2017-05-25 Thread Richard Smith via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:5498-5500
 Result.set((Expr*)nullptr, 0, false, true, Offset);
+Result.getLValueDesignator() =
+SubobjectDesignator(E->getType()->getPointeeType());

This is the only caller of `set()` that passes more than three arguments (that 
is, the only caller that passes `true` as `IsNullPtr_`). It seems that such 
calls would always be unsafe / wrong, so I think we can do better than this.

How about this: split `set()` into two functions: for one of them, remove the 
last two parameters (`IsNullPtr_` and `Offset_`), and for the other one, rename 
to `setNull()` and just pass a `QualType` and offset.


https://reviews.llvm.org/D33568



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


[PATCH] D33568: Fix crash when evaluating constant expressions involving nullptr

2017-05-25 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover created this revision.
Herald added a subscriber: mcrosier.

For the simple casts in the test, we were crashing because the 
ZeroInitialization function created an LValue with an unexpected 
SubobjectDesignator: it was valid but didn't actually refer to a valid 
MostDerivedType.

Since PointerExprEvaluator actually creates an LValue based notionally on what 
you'd get if you dereferenced the pointer (I think), the MostDerivedType should 
be set by stripping the pointer from the type as in this patch.

The theoretically simpler solution of providing an invalid SubobjectDesignator 
(as happens for an int to pointer cast) is incorrect because nullptr has more 
possible uses in constexprs than other casts of integers.

Does my reasoning look sound? I've been all over that file before I finally 
thought I knew what was going on and I'm still not entirely confident.


https://reviews.llvm.org/D33568

Files:
  clang/lib/AST/ExprConstant.cpp
  clang/test/SemaCXX/null-cast.cpp


Index: clang/test/SemaCXX/null-cast.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/null-cast.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct A {};
+struct B : virtual A {};
+
+void foo() {
+  (void)static_cast(*(B *)0); // expected-warning {{binding dereferenced 
null pointer to reference has undefined behavior}}
+}
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -5496,6 +5496,8 @@
   bool ZeroInitialization(const Expr *E) {
 auto Offset = Info.Ctx.getTargetNullPointerValue(E->getType());
 Result.set((Expr*)nullptr, 0, false, true, Offset);
+Result.getLValueDesignator() =
+SubobjectDesignator(E->getType()->getPointeeType());
 return true;
   }
 


Index: clang/test/SemaCXX/null-cast.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/null-cast.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct A {};
+struct B : virtual A {};
+
+void foo() {
+  (void)static_cast(*(B *)0); // expected-warning {{binding dereferenced null pointer to reference has undefined behavior}}
+}
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -5496,6 +5496,8 @@
   bool ZeroInitialization(const Expr *E) {
 auto Offset = Info.Ctx.getTargetNullPointerValue(E->getType());
 Result.set((Expr*)nullptr, 0, false, true, Offset);
+Result.getLValueDesignator() =
+SubobjectDesignator(E->getType()->getPointeeType());
 return true;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28404: IRGen: Add optnone attribute on function during O0

2017-05-25 Thread Matthias Braun via Phabricator via cfe-commits
MatzeB added a comment.

FWIW, I think this makes sense.
Moving O0 and optnone get closer seems sensible. Even though -O3 with an 
optnone function indeed gives you different results today.
We are basically maintaining two things for the same "do not optimize" goal.
This obviously won't make O0 and optnone being the same in todays pass 
managers, but it is a step in the right direction.


https://reviews.llvm.org/D28404



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


[PATCH] D33470: [clang-tidy] Add misc-default-numerics

2017-05-25 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap added inline comments.



Comment at: clang-tidy/misc/DefaultNumericsCheck.h:20
+/// This check flags usages of ``std::numeric_limits::{min,max}()`` for
+/// unspecialized types. It is dangerous because it returns T(), which might is
+/// rarely minimum or maximum for this type.

nit: (feel free to correct me) 
replace 
"which might is ..." 
with 
"which rarely might be minimum or maximum for this type" 


https://reviews.llvm.org/D33470



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


[PATCH] D33470: [clang-tidy] Add misc-default-numerics

2017-05-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

Once you fix the typo in the check, can you run it over some large C++ code 
bases to see if it finds any results?




Comment at: clang-tidy/misc/DefaultNumericsCheck.cpp:30
+  ofClass(classTemplateSpecializationDecl(
+  hasName("::std::numeric_limit"),
+  unless(isExplicitTemplateSpecialization()),

This should be checking for `::std::numeric_limits` (plural).



Comment at: docs/ReleaseNotes.rst:77
+  `_ 
check
+  Finds uses of ``std::numeric_limit`` for unspecialized types
+

numeric_limits



Comment at: test/clang-tidy/misc-default-numerics.cpp:6
+template 
+struct numeric_limit {
+  static T min() { return T(); }

numeric_limits (same elsewhere in this file).


https://reviews.llvm.org/D33470



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


[PATCH] D33537: [clang-tidy] Exception Escape Checker

2017-05-25 Thread Piotr Padlewski via Phabricator via cfe-commits
Prazek added a comment.

How is that compared to https://reviews.llvm.org/D19201 and the clang patch 
mentioned in this patch?


Repository:
  rL LLVM

https://reviews.llvm.org/D33537



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


Re: r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Hans Wennborg via cfe-commits
The test was failing on Windows; r303910 for that.

On Thu, May 25, 2017 at 11:55 AM, Jonathan Roelofs via cfe-commits
 wrote:
>
>
> On 5/25/17 11:39 AM, Galina Kistanova wrote:
>
> Hello Jonathan,
>
> This commit broke one of our builders:
>
> http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2608/steps/build-unified-tree/logs/stdio
>
> Please have a look at this?
>
>
> r303898 should take care of that.
>
>
> Jon
>
>
>
> Thanks
>
> Galina
>
> On Thu, May 25, 2017 at 8:42 AM, Jonathan Roelofs via cfe-commits
>  wrote:
>>
>> Author: jroelofs
>> Date: Thu May 25 10:42:13 2017
>> New Revision: 303873
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=303873=rev
>> Log:
>> Don't defer to the GCC driver for linking arm-baremetal
>>
>> Also comes with a cmake cache for building the runtime bits:
>>
>>  $ cmake  \
>>-DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
>>-DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
>>-DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
>>-C /path/to/clang/cmake/caches/BaremetalARM.cmake \
>>/path/to/llvm
>>
>> https://reviews.llvm.org/D33259
>>
>> Added:
>> cfe/trunk/cmake/caches/BaremetalARM.cmake
>> cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
>> cfe/trunk/lib/Driver/ToolChains/BareMetal.h
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
>> cfe/trunk/test/Driver/baremetal.cpp
>> Modified:
>> cfe/trunk/lib/Driver/CMakeLists.txt
>> cfe/trunk/lib/Driver/Driver.cpp
>> cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
>> cfe/trunk/lib/Driver/ToolChains/Linux.cpp
>> cfe/trunk/test/Frontend/gnu-mcount.c
>>
>> Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/BaremetalARM.cmake?rev=303873=auto
>>
>> ==
>> --- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
>> +++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
>> @@ -0,0 +1,50 @@
>> +set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
>> +
>> +# Builtins
>> +set(LLVM_BUILTIN_TARGETS
>> "armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi" CACHE STRING "Builtin
>> Targets")
>> +
>> +set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV6M_SYSROOT}
>> CACHE STRING "armv6m-none-eabi Sysroot")
>> +set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
>> "armv6m-none-eabi System Name")
>> +set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
>> "armv6m-none-eabi Baremetal build")
>> +set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING
>> "armv6m-none-eabi os dir")
>> +
>> +set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7M_SYSROOT}
>> CACHE STRING "armv7m-none-eabi Sysroot")
>> +set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
>> "armv7m-none-eabi System Name")
>> +set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
>> "armv7m-none-eabi Baremetal build")
>> +set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE STRING
>> "armv7m-none-eabi C Flags")
>> +set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
>> STRING "armv7m-none-eabi ASM Flags")
>> +set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING
>> "armv7m-none-eabi os dir")
>> +
>> +set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7EM_SYSROOT}
>> CACHE STRING "armv7em-none-eabi Sysroot")
>> +set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
>> "armv7em-none-eabi System Name")
>> +set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
>> "armv7em-none-eabi Baremetal build")
>> +set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE
>> STRING "armv7em-none-eabi C Flags")
>> +set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
>> STRING "armv7em-none-eabi ASM Flags")
>> +set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE
>> STRING "armv7em-none-eabi os dir")
>> +
>> +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
>> +set(LLVM_TOOLCHAIN_TOOLS
>> +  llc
>> +  llvm-ar
>> +  llvm-cxxfilt
>> +  llvm-dwarfdump
>> +  llvm-dsymutil
>> +  llvm-nm
>> +  llvm-objdump
>> +  llvm-ranlib
>> +  llvm-readobj
>> +  llvm-size
>> +  llvm-symbolizer
>> +  opt
>> +  CACHE STRING "")
>> +
>> +set(LLVM_DISTRIBUTION_COMPONENTS
>> +  

r303910 - Make test/Driver/baremetal.cpp pass on Windows

2017-05-25 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu May 25 15:39:52 2017
New Revision: 303910

URL: http://llvm.org/viewvc/llvm-project?rev=303910=rev
Log:
Make test/Driver/baremetal.cpp pass on Windows

Modified:
cfe/trunk/test/Driver/baremetal.cpp

Modified: cfe/trunk/test/Driver/baremetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/baremetal.cpp?rev=303910=303909=303910=diff
==
--- cfe/trunk/test/Driver/baremetal.cpp (original)
+++ cfe/trunk/test/Driver/baremetal.cpp Thu May 25 15:39:52 2017
@@ -4,15 +4,15 @@
 // RUN: -L some/directory/user/asked/for \
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-C %s
-// CHECK-V6M-C: "[[PREFIX_DIR:.*]]/bin/clang" "-cc1" "-triple" 
"thumbv6m-none--eabi"
-// CHECK-V6M-C-SAME: "-resource-dir" 
"[[PREFIX_DIR]]/lib/clang/[[VERSION:[^"]*]]"
+// CHECK-V6M-C: "[[PREFIX_DIR:.*]]{{[/\\]+}}bin{{[/\\]+}}clang{{.*}}" "-cc1" 
"-triple" "thumbv6m-none--eabi"
+// CHECK-V6M-C-SAME: "-resource-dir" 
"[[PREFIX_DIR]]{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}[[VERSION:[^"]*]]"
 // CHECK-V6M-C-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
-// CHECK-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]/include/c++/v1"
-// CHECk-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]/include"
+// CHECK-V6M-C-SAME: "-internal-isystem" 
"[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
+// CHECk-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include"
 // CHECK-V6M-C-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
 // CHECK-V6M-C-NEXT: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-C-SAME: "-L[[PREFIX_DIR]]/lib/clang/[[VERSION]]/lib/baremetal"
-// CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome/directory/user/asked/for"
+// CHECK-V6M-C-SAME: 
"-L[[PREFIX_DIR]]{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}[[VERSION]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
+// CHECK-V6M-C-SAME: "-T" "semihosted.lds" 
"-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
 // CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-C-SAME: "-o" "{{.*}}.o"
 
@@ -33,7 +33,7 @@
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-DEFAULTCXX %s
 // CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-DEFAULTCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
@@ -43,10 +43,10 @@
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN: -stdlib=libc++ \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-LIBCXX %s
-// CHECK-V6M-LIBCXX-NOT: "-internal-isystem" "{{[^"]+}}/include/c++/{{[^v].*}}"
-// CHECK-V6M-LIBCXX: "-internal-isystem" "{{[^"]+}}/include/c++/v1"
+// CHECK-V6M-LIBCXX-NOT: "-internal-isystem" 
"{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}{{[^v].*}}"
+// CHECK-V6M-LIBCXX: "-internal-isystem" 
"{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
 // CHECK-V6M-LIBCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-LIBCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
 // CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o"
@@ -56,10 +56,10 @@
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN: -stdlib=libstdc++ \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-LIBSTDCXX %s
-// CHECK-V6M-LIBSTDCXX-NOT: "-internal-isystem" "{{[^"]+}}/include/c++/v1"
-// CHECK-V6M-LIBSTDCXX: "-internal-isystem" "{{[^"]+}}/include/c++/6.0.0"
+// CHECK-V6M-LIBSTDCXX-NOT: "-internal-isystem" 
"{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
+// CHECK-V6M-LIBSTDCXX: "-internal-isystem" 
"{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}6.0.0"
 // CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-LIBSTDCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-LIBSTDCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
@@ -70,7 +70,7 @@
 // RUN: -nodefaultlibs \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-NDL %s
 // CHECK-V6M-NDL: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-NDL-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal" "-o" 
"{{.*}}.o"
+// CHECK-V6M-NDL-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 "-o" "{{.*}}.o"
 
 // RUN: %clangxx -target 

[clang-tools-extra] r303909 - Earlier revert introduced an extra space, remove it.

2017-05-25 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 25 15:29:17 2017
New Revision: 303909

URL: http://llvm.org/viewvc/llvm-project?rev=303909=rev
Log:
Earlier revert introduced an extra space, remove it.

Modified:
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp?rev=303909=303908=303909=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
Thu May 25 15:29:17 2017
@@ -264,7 +264,7 @@ void implicitCastInNegationExpressions()
   // CHECK-FIXES: bool boolComingFromNegatedChar = (character == 0);
 
   int* pointer = nullptr;
-  bool boolComingFromNegatedPointer = not  pointer;
+  bool boolComingFromNegatedPointer = not pointer;
   // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: implicit cast 'int *' -> bool
   // CHECK-FIXES: bool boolComingFromNegatedPointer = pointer == nullptr;
 }


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


r303908 - Revert "[AMDGPU] add __builtin_amdgcn_s_getpc"

2017-05-25 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Thu May 25 15:28:26 2017
New Revision: 303908

URL: http://llvm.org/viewvc/llvm-project?rev=303908=rev
Log:
Revert "[AMDGPU] add __builtin_amdgcn_s_getpc"

This reverts commit r303861, the LLVM intrinsic was reverted.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def
cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl

Modified: cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def?rev=303908=303907=303908=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def Thu May 25 15:28:26 2017
@@ -36,7 +36,6 @@ BUILTIN(__builtin_amdgcn_workitem_id_z,
 // Instruction builtins.
 
//===--===//
 BUILTIN(__builtin_amdgcn_s_getreg, "UiIi", "n")
-BUILTIN(__builtin_amdgcn_s_getpc, "LUi", "n")
 BUILTIN(__builtin_amdgcn_s_waitcnt, "vIi", "n")
 BUILTIN(__builtin_amdgcn_s_sendmsg, "vIiUi", "n")
 BUILTIN(__builtin_amdgcn_s_sendmsghalt, "vIiUi", "n")

Modified: cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl?rev=303908=303907=303908=diff
==
--- cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl Thu May 25 15:28:26 2017
@@ -481,13 +481,6 @@ void test_fmed3_f32(global float* out, f
   *out = __builtin_amdgcn_fmed3f(a, b, c);
 }
 
-// CHECK-LABEL: @test_s_getpc
-// CHECK: call i64 @llvm.amdgcn.s.getpc()
-void test_s_getpc(global ulong* out)
-{
-  *out = __builtin_amdgcn_s_getpc();
-}
-
 // CHECK-DAG: [[WI_RANGE]] = !{i32 0, i32 1024}
 // CHECK-DAG: attributes #[[NOUNWIND_READONLY:[0-9]+]] = { nounwind readonly }
 // CHECK-DAG: attributes #[[READ_EXEC_ATTRS]] = { convergent }


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


[PATCH] D33563: Track whether a unary operation can overflow

2017-05-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman created this revision.

We do not explicitly model integer promotions on unary operators even though 
those promotions happen in practice. This patch tracks the most important piece 
of information about the promotion on the AST node: whether the operator can 
overflow or not. It then pulls this logic out from various places and instead 
uses what's calculated on the AST node.

This is effectively a NFC patch, however, it does help out-of-tree builds that 
need to know about the integral promotions.


https://reviews.llvm.org/D33563

Files:
  include/clang/AST/Expr.h
  lib/AST/ASTDumper.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/ExprConstant.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/Misc/ast-dump-stmt.c

Index: test/Misc/ast-dump-stmt.c
===
--- test/Misc/ast-dump-stmt.c
+++ test/Misc/ast-dump-stmt.c
@@ -33,3 +33,35 @@
 // CHECK-NEXT:   OpaqueValueExpr
 // CHECK-NEXT: IntegerLiteral
 // CHECK-NEXT:   IntegerLiteral
+
+void TestUnaryOperatorExpr(void) {
+  char T1 = 1;
+  int T2 = 1;
+
+  T1++;
+  T2++;
+  // CHECK:  UnaryOperator{{.*}}postfix '++' cannot overflow
+  // CHECK-NEXT:   DeclRefExpr{{.*}}'T1' 'char'
+  // CHECK-NOT:  UnaryOperator{{.*}}postfix '++' cannot overflow
+  // CHECK:DeclRefExpr{{.*}}'T2' 'int'
+
+  -T1;
+  -T2;
+  // CHECK:  UnaryOperator{{.*}}prefix '-' cannot overflow
+  // CHECK-NEXT:   ImplicitCastExpr
+  // CHECK-NEXT: ImplicitCastExpr
+  // CHECK-NEXT:   DeclRefExpr{{.*}}'T1' 'char'
+  // CHECK-NOT:  UnaryOperator{{.*}}prefix '-' cannot overflow
+  // CHECK:ImplicitCastExpr
+  // CHECK:  DeclRefExpr{{.*}}'T2' 'int'
+
+  ~T1;
+  ~T2;
+  // CHECK:  UnaryOperator{{.*}}prefix '~' cannot overflow
+  // CHECK-NEXT:   ImplicitCastExpr
+  // CHECK-NEXT: ImplicitCastExpr
+  // CHECK-NEXT:   DeclRefExpr{{.*}}'T1' 'char'
+  // CHECK-NOT:  UnaryOperator{{.*}}prefix '~' cannot overflow
+  // CHECK:ImplicitCastExpr
+  // CHECK:  DeclRefExpr{{.*}}'T2' 'int'
+}
Index: lib/Serialization/ASTWriterStmt.cpp
===
--- lib/Serialization/ASTWriterStmt.cpp
+++ lib/Serialization/ASTWriterStmt.cpp
@@ -490,6 +490,7 @@
   Record.AddStmt(E->getSubExpr());
   Record.push_back(E->getOpcode()); // FIXME: stable encoding
   Record.AddSourceLocation(E->getOperatorLoc());
+  Record.push_back(E->canOverflow());
   Code = serialization::EXPR_UNARY_OPERATOR;
 }
 
Index: lib/Serialization/ASTReaderStmt.cpp
===
--- lib/Serialization/ASTReaderStmt.cpp
+++ lib/Serialization/ASTReaderStmt.cpp
@@ -536,6 +536,7 @@
   E->setSubExpr(Record.readSubExpr());
   E->setOpcode((UnaryOperator::Opcode)Record.readInt());
   E->setOperatorLoc(ReadSourceLocation());
+  E->setCanOverflow(Record.readInt());
 }
 
 void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
Index: lib/Sema/SemaPseudoObject.cpp
===
--- lib/Sema/SemaPseudoObject.cpp
+++ lib/Sema/SemaPseudoObject.cpp
@@ -527,9 +527,12 @@
   (result.get()->isTypeDependent() || CanCaptureValue(result.get(
 setResultToLastSemantic();
 
-  UnaryOperator *syntactic =
-new (S.Context) UnaryOperator(syntacticOp, opcode, resultType,
-  VK_LValue, OK_Ordinary, opcLoc);
+  UnaryOperator *syntactic = new (S.Context) UnaryOperator(
+  syntacticOp, opcode, resultType, VK_LValue, OK_Ordinary, opcLoc,
+  !resultType->isDependentType()
+  ? S.Context.getTypeSize(resultType) >=
+S.Context.getTypeSize(S.Context.IntTy)
+  : false);
   return complete(syntactic);
 }
 
@@ -1639,9 +1642,9 @@
   Expr *syntax = E->getSyntacticForm();
   if (UnaryOperator *uop = dyn_cast(syntax)) {
 Expr *op = stripOpaqueValuesFromPseudoObjectRef(*this, uop->getSubExpr());
-return new (Context) UnaryOperator(op, uop->getOpcode(), uop->getType(),
-   uop->getValueKind(), uop->getObjectKind(),
-   uop->getOperatorLoc());
+return new (Context) UnaryOperator(
+op, uop->getOpcode(), uop->getType(), uop->getValueKind(),
+uop->getObjectKind(), uop->getOperatorLoc(), uop->canOverflow());
   } else if (CompoundAssignOperator *cop
= dyn_cast(syntax)) {
 Expr *lhs = stripOpaqueValuesFromPseudoObjectRef(*this, cop->getLHS());
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -11860,6 +11860,16 @@
   return CreateBuiltinBinOp(OpLoc, Opc, LHSExpr, RHSExpr);
 }
 
+static bool isOverflowingIntegerType(ASTContext , 

Re: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Reid Kleckner via cfe-commits
I agree with Nico in retrospect. Setting -fno-operator-names is too big a
hammer. Instead we should add some MSVCCompat hacks to pretend we saw an
identifier token instead of a keyword token when these keywords are used as
declarators.

On Thu, May 25, 2017 at 10:14 AM, Nico Weber  wrote:

> Among the goals of the clang-cl project are a) being able to parse MS
> system headers b) helper users to write standards-compliant C++ (in
> particular, if your code builds with clang-cl without warnings, it'd be
> good if it also built with regular clang then).
>
> The regular change plus header change plus warning would be one way to
> achieve this, yes.
>
> On Thu, May 25, 2017 at 1:01 PM, Keane, Erich 
> wrote:
>
>> No problem, I definitely think it was the right choice.
>>
>>
>>
>> A change that contains all of what Melanie’s original patch did, plus the
>> Header changes (plus the clang-tidy fixes that came out of this) would be
>> acceptable?
>>
>>
>>
>> Also, I believe she’s working on the warning as well.  We were discussing
>> it, and I was thinking that if we track down where the
>> operator-identification is done (hints as to where that is is appreciated),
>> that we could simply warn if the user is using one of the Operators with
>> operators off.  The warning itself could then be suppressed if necessary.
>>
>>
>>
>> Thoughts?
>>
>>
>>
>>
>>
>> *From:* Nico Weber [mailto:tha...@google.com]
>> *Sent:* Thursday, May 25, 2017 9:56 AM
>> *To:* Keane, Erich 
>> *Cc:* Blower, Melanie ; rnk ;
>> cfe-commits ; Hans Wennborg <
>> h...@chromium.org>
>>
>> *Subject:* Re: r303798 - For Microsoft compatibility, set
>> fno_operator_names
>>
>>
>>
>> On Thu, May 25, 2017 at 12:18 PM, Keane, Erich 
>> wrote:
>>
>> How does chromium compiler in CL?  It seems that it would have a similar
>> problem here…
>>
>>
>>
>> That's a good question! It looks like iso646.h is included, and in MSVC
>> that contains something like `#define and &&`. But clang's
>> lib/Headers/iso646.h assumes that the compiler provides this and doesn't
>> define `and`. So for the reland, that header would have to check if the
>> operator name is disabled, and if so, define it. (Or, better, maybe we can
>> come up with something more targeted for the system header, similar to e.g.
>> http://llvm.org/viewvc/llvm-project?view=revision=212238)
>>
>>
>>
>> Thanks for the revert!
>>
>>
>>
>>
>>
>> *From:* tha...@google.com [mailto:tha...@google.com] *On Behalf Of *Nico
>> Weber
>> *Sent:* Thursday, May 25, 2017 9:16 AM
>> *To:* Blower, Melanie 
>> *Cc:* rnk ; Keane, Erich ;
>> cfe-commits ; Hans Wennborg <
>> h...@chromium.org>
>>
>>
>> *Subject:* RE: r303798 - For Microsoft compatibility, set
>> fno_operator_names
>>
>>
>>
>> In addition to this making clang-cl silently accept invalid code, it also
>> breaks existing valid code, building chromium now fails. Let's revert and
>> come up with something better asynchronously.
>>
>>
>>
>> FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
>>
>>
>> E:\b\c\goma_client/gomacc.exe ../../third_party/llvm-build/R
>> elease+Asserts/bin/clang-cl.exe /nologo /showIncludes /FC
>> @obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp
>> /c ../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
>> /Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
>> /Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
>>
>> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\cu
>> stom\CustomElementRegistry.cpp(229,7):  error: unknown type name
>> 'definition'
>>
>>   if (definition and definition->Descriptor().LocalName() ==
>> desc.LocalName()) {
>>
>>   ^
>>
>> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\cu
>> stom\CustomElementRegistry.cpp(229,18):  error: variable declaration in
>> condition must have an initializer
>>
>>   if (definition and definition->Descriptor().LocalName() ==
>> desc.LocalName()) {
>>
>>  ^
>>
>> 2 errors generated.
>>
>>
>>
>>
>>
>> On May 24, 2017 4:01 PM, "Blower, Melanie" 
>> wrote:
>>
>> Thanks for the feedback, working on it…
>>
>>
>>
>> *From:* Keane, Erich
>> *Sent:* Wednesday, May 24, 2017 3:47 PM
>> *To:* Nico Weber ; Blower, Melanie <
>> melanie.blo...@intel.com>
>>
>>
>> *Cc:* cfe-commits ; rnk 
>>
>> *Subject:* RE: r303798 - For Microsoft compatibility, set
>> fno_operator_names
>>
>>
>>
>> Adding Melanie, the author of the patch.
>>
>>
>>
>> *From:* tha...@google.com [mailto:tha...@google.com ] *On
>> Behalf Of *Nico Weber
>> *Sent:* Wednesday, May 24, 2017 12:43 PM
>> *To:* Keane, Erich 

[PATCH] D33525: [ThinLTO] Migrate ThinLTOBitcodeWriter to the new PM.

2017-05-25 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added inline comments.



Comment at: clang/test/CodeGen/thin_link_bitcode.c:5
+// RUN: %clang_cc1 -o %t -flto=thin -fexperimental-new-pass-manager 
-fthin-link-bitcode=%t.newpm -triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
+// RUN: llvm-bcanalyzer -dump %t.newpm | FileCheck %s --check-prefix=NEW_PM
 int main (void) {

`s/NEW_PM/NO_DEBUG/` and remove line 12.

I think you also want to test the contents of `%t` here.


https://reviews.llvm.org/D33525



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


[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-05-25 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added a comment.

what about the builtins?


https://reviews.llvm.org/D33561



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


[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-05-25 Thread Leo Li via Phabricator via cfe-commits
aoli updated this revision to Diff 100282.
aoli added a comment.

Fix wrong flags.


https://reviews.llvm.org/D33561

Files:
  cmake/caches/Android-stage2.cmake
  cmake/caches/Android.cmake


Index: cmake/caches/Android.cmake
===
--- /dev/null
+++ cmake/caches/Android.cmake
@@ -0,0 +1,31 @@
+# This file sets up a CMakeCache for an Android toolchain build.
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_BUILD_RUNTIME OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
+set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  if (Android_${target}_C_FLAGS)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_C_FLAGS=${Android_${target}_C_FLAGS})
+  endif()
+  if (Android_${target}_SYSROOT)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_SYSROOT=${Android_${target}_SYSROOT})
+  endif()
+  if (Android_${target}_CXX_FLAGS)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_CXX_FLAGS=${Android_${target}_CXX_FLAGS})
+  endif()
+endforeach()
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS "${EXTRA_ARGS} 
-C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake" CACHE STRING "")
Index: cmake/caches/Android-stage2.cmake
===
--- /dev/null
+++ cmake/caches/Android-stage2.cmake
@@ -0,0 +1,21 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+set(CMAKE_BUILT_TYPE RELEASE CACHE STRING "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+
+set(LLVM_RUNTIME_TARGETS 
"i686-linux-android;x86_64-linux-android;aarch64-linux-android;armv7-linux-android"
 CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  set(RUNTIMES_${target}-linux-android_ANDROID 1 CACHE STRING "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_ASM_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_C_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_CXX_FLAGS 
${Android_${target}_CXX_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_SYSROOT 
${Android_${target}_SYSROOT} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_ENABLE_WERROR ON CACHE BOOL 
"")
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_INCLUDE_TESTS OFF CACHE 
BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+endforeach()


Index: cmake/caches/Android.cmake
===
--- /dev/null
+++ cmake/caches/Android.cmake
@@ -0,0 +1,31 @@
+# This file sets up a CMakeCache for an Android toolchain build.
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_BUILD_RUNTIME OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
+set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  if (Android_${target}_C_FLAGS)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_C_FLAGS=${Android_${target}_C_FLAGS})
+  endif()
+  if (Android_${target}_SYSROOT)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_SYSROOT=${Android_${target}_SYSROOT})
+  endif()
+  if (Android_${target}_CXX_FLAGS)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_CXX_FLAGS=${Android_${target}_CXX_FLAGS})
+  endif()
+endforeach()
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS "${EXTRA_ARGS} -C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake" CACHE STRING "")
Index: cmake/caches/Android-stage2.cmake
===
--- /dev/null
+++ cmake/caches/Android-stage2.cmake
@@ -0,0 +1,21 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+set(CMAKE_BUILT_TYPE RELEASE CACHE STRING "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+
+set(LLVM_RUNTIME_TARGETS "i686-linux-android;x86_64-linux-android;aarch64-linux-android;armv7-linux-android" CACHE STRING "")
+
+foreach(target 

[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-05-25 Thread Leo Li via Phabricator via cfe-commits
aoli created this revision.
Herald added a subscriber: mgorny.

Thoes files are used to build Android toolchain. 
https://reviews.llvm.org/D32816 makes it possible to build runtimes for targets.


https://reviews.llvm.org/D33561

Files:
  cmake/caches/Android-stage2.cmake
  cmake/caches/Android.cmake


Index: cmake/caches/Android.cmake
===
--- /dev/null
+++ cmake/caches/Android.cmake
@@ -0,0 +1,31 @@
+# This file sets up a CMakeCache for an Android toolchain build.
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_BUILD_RUNTIME OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
+set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  if (Android_${target}_C_FLAGS)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_C_FLAGS=${Android_${target}_C_FLAGS})
+  endif()
+  if (Android_${target}_SYSROOT)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_SYSROOT=${Android_${target}_SYSROOT})
+  endif()
+  if (Android_${target}_CXX_FLAGS)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_CXX_FLAGS=${Android_${target}_CXX_FLAGS})
+  endif()
+endforeach()
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS "${EXTRA_ARGS} 
-C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake" CACHE STRING "")
Index: cmake/caches/Android-stage2.cmake
===
--- /dev/null
+++ cmake/caches/Android-stage2.cmake
@@ -0,0 +1,21 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+set(CMAKE_BUILT_TYPE RELEASE CACHE STRING "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+
+set(LLVM_RUNTIME_TARGETS 
"i686-linux-android;x86_64-linux-android;aarch64-linux-android;armv7-linux-android"
 CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  set(RUNTIMES_${target}-linux-android_ANDROID 1 CACHE STRING "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_ASM_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_C_FLAGS 
${Android_${target}_CXX_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_CXX_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_SYSROOT 
${Android_${target}_SYSROOT} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_ENABLE_WERROR ON CACHE BOOL 
"")
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_INCLUDE_TESTS OFF CACHE 
BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+endforeach()


Index: cmake/caches/Android.cmake
===
--- /dev/null
+++ cmake/caches/Android.cmake
@@ -0,0 +1,31 @@
+# This file sets up a CMakeCache for an Android toolchain build.
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_BUILD_RUNTIME OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
+set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  if (Android_${target}_C_FLAGS)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_C_FLAGS=${Android_${target}_C_FLAGS})
+  endif()
+  if (Android_${target}_SYSROOT)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_SYSROOT=${Android_${target}_SYSROOT})
+  endif()
+  if (Android_${target}_CXX_FLAGS)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_CXX_FLAGS=${Android_${target}_CXX_FLAGS})
+  endif()
+endforeach()
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS "${EXTRA_ARGS} -C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake" CACHE STRING "")
Index: cmake/caches/Android-stage2.cmake
===
--- /dev/null
+++ cmake/caches/Android-stage2.cmake
@@ -0,0 +1,21 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+set(CMAKE_BUILT_TYPE RELEASE CACHE STRING "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+
+set(LLVM_RUNTIME_TARGETS 

[PATCH] D33525: [ThinLTO] Migrate ThinLTOBitcodeWriter to the new PM.

2017-05-25 Thread Tim Shen via Phabricator via cfe-commits
timshen added a comment.

In https://reviews.llvm.org/D33525#764251, @chandlerc wrote:

> (focusing on the LLVM side of this review for now)
>
> Can you add an LLVM-based test? Can you add this to 
> `lib/Passes/PassRegistry.def`?


I see that not all passes are registered (BitcodeWriterPass). Is it an 
oversight?

Does a pass have to be default constructible, in order to be registered easily?


https://reviews.llvm.org/D33525



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


[libcxx] r303900 - Update more coroutine_handle signatures to reflect N4663.

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 14:04:55 2017
New Revision: 303900

URL: http://llvm.org/viewvc/llvm-project?rev=303900=rev
Log:
Update more coroutine_handle signatures to reflect N4663.

Thanks to Casey Carter for pointing out the out-of-date tests and
implementation.

Modified:
libcxx/trunk/include/experimental/coroutine

libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp

libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp

libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.sh.cpp

Modified: libcxx/trunk/include/experimental/coroutine
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/coroutine?rev=303900=303899=303900=diff
==
--- libcxx/trunk/include/experimental/coroutine (original)
+++ libcxx/trunk/include/experimental/coroutine Thu May 25 14:04:55 2017
@@ -112,10 +112,10 @@ public:
 constexpr explicit operator bool() const noexcept { return __handle_; }
 
 _LIBCPP_ALWAYS_INLINE
-void operator()() const { resume(); }
+void operator()() { resume(); }
 
 _LIBCPP_ALWAYS_INLINE
-void resume() const {
+void resume() {
   _LIBCPP_ASSERT(__is_suspended(),
  "resume() can only be called on suspended coroutines");
   _LIBCPP_ASSERT(!done(),
@@ -124,7 +124,7 @@ public:
 }
 
 _LIBCPP_ALWAYS_INLINE
-void destroy() const {
+void destroy() {
   _LIBCPP_ASSERT(__is_suspended(),
  "destroy() can only be called on suspended coroutines");
   __builtin_coro_destroy(__handle_);

Modified: 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp?rev=303900=303899=303900=diff
==
--- 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
 Thu May 25 14:04:55 2017
@@ -19,8 +19,7 @@
 // template 
 // struct coroutine_handle;
 
-// Promise& promise()
-// Promise const& promise() const
+// Promise& promise() const
 
 #include 
 #include 

Modified: 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp?rev=303900=303899=303900=diff
==
--- 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp
 Thu May 25 14:04:55 2017
@@ -19,7 +19,7 @@
 // template 
 // struct coroutine_handle;
 
-// void destroy() const
+// void destroy()
 
 #include 
 #include 
@@ -32,12 +32,29 @@
 
 namespace coro = std::experimental;
 
+template 
+auto has_destroy_imp(H&& h, int) -> decltype(h.destroy(), std::true_type{});
+template 
+auto has_destroy_imp(H&&, long) -> std::false_type;
+
+template 
+constexpr bool has_destroy() {
+  return decltype(has_destroy_imp(std::declval(), 0))::value;
+}
+
 template 
-void do_test(coro::coroutine_handle const& H) {
+void do_test(coro::coroutine_handle&& H) {
+  using HType = coro::coroutine_handle;
   // FIXME Add a runtime test
   {
 ASSERT_SAME_TYPE(decltype(H.destroy()), void);
-ASSERT_NOT_NOEXCEPT(H.destroy());
+LIBCPP_ASSERT_NOT_NOEXCEPT(H.destroy());
+static_assert(has_destroy(), "");
+static_assert(has_destroy(), "");
+  }
+  {
+static_assert(!has_destroy(), "");
+static_assert(!has_destroy(), "");
   }
 }
 

Modified: 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.sh.cpp?rev=303900=303899=303900=diff
==
--- 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.sh.cpp
 (original)
+++ 

[PATCH] D33340: [libcxx] [test] Add string nullptr asserts to erase functions.

2017-05-25 Thread Billy Robert O'Neal III via Phabricator via cfe-commits
BillyONeal closed this revision.
BillyONeal added a comment.

In https://reviews.llvm.org/D33340#764206, @EricWF wrote:

> Sorry for the delay reviewing such a simple change.


No problem! Their simplicity also means no likely merge conflicts :)

In https://reviews.llvm.org/D33340#764213, @EricWF wrote:

> @BillyONeal Changes like this are good for post-commit review (ie just commit 
> it). Adding clearly correct assertions and test cases is never an 
> objectionable thing.


Sounds good, thanks!


https://reviews.llvm.org/D33340



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


[libcxx] r303899 - Add asserts that the nullptr is maintained in string erase operations.

2017-05-25 Thread Billy Robert O'Neal III via cfe-commits
Author: bion
Date: Thu May 25 14:01:14 2017
New Revision: 303899

URL: http://llvm.org/viewvc/llvm-project?rev=303899=rev
Log:
Add asserts that the nullptr is maintained in string erase operations.

Modified:

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp?rev=303899=303898=303899=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
 Thu May 25 14:01:14 2017
@@ -24,6 +24,7 @@ test(S s, typename S::difference_type po
 typename S::const_iterator p = s.begin() + pos;
 typename S::iterator i = s.erase(p);
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 assert(i - s.begin() == pos);
 }

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp?rev=303899=303898=303899=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
 Thu May 25 14:01:14 2017
@@ -25,6 +25,7 @@ test(S s, typename S::difference_type po
 typename S::const_iterator last = s.cbegin() + pos + n;
 typename S::iterator i = s.erase(first, last);
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 assert(i - s.begin() == pos);
 }

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp?rev=303899=303898=303899=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
 Thu May 25 14:01:14 2017
@@ -23,6 +23,7 @@ test(S s, S expected)
 {
 s.pop_back();
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 }
 

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp?rev=303899=303898=303899=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
 Thu May 25 14:01:14 2017
@@ -29,6 +29,7 @@ test(S s, typename S::size_type pos, typ
 {
 s.erase(pos, n);
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 }
 #ifndef TEST_HAS_NO_EXCEPTIONS
@@ -58,6 +59,7 @@ test(S s, typename S::size_type pos, S e
 {
 s.erase(pos);
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 }
 #ifndef TEST_HAS_NO_EXCEPTIONS
@@ -83,6 +85,7 @@ test(S s, S expected)
 {
 s.erase();
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 }
 


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


Re: r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Jonathan Roelofs via cfe-commits



On 5/25/17 11:39 AM, Galina Kistanova wrote:

Hello Jonathan,

This commit broke one of our builders:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2608/steps/build-unified-tree/logs/stdio

Please have a look at this?


r303898 should take care of that.


Jon



Thanks

Galina

On Thu, May 25, 2017 at 8:42 AM, Jonathan Roelofs via cfe-commits 
> wrote:


Author: jroelofs
Date: Thu May 25 10:42:13 2017
New Revision: 303873

URL: http://llvm.org/viewvc/llvm-project?rev=303873=rev

Log:
Don't defer to the GCC driver for linking arm-baremetal

Also comes with a cmake cache for building the runtime bits:

 $ cmake  \
   -DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
   -C /path/to/clang/cmake/caches/BaremetalARM.cmake \
   /path/to/llvm

https://reviews.llvm.org/D33259 

Added:
cfe/trunk/cmake/caches/BaremetalARM.cmake
cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
cfe/trunk/lib/Driver/ToolChains/BareMetal.h
cfe/trunk/test/Driver/Inputs/baremetal_arm/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
cfe/trunk/test/Driver/baremetal.cpp
Modified:
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/lib/Driver/ToolChains/Linux.cpp
cfe/trunk/test/Frontend/gnu-mcount.c

Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/BaremetalARM.cmake?rev=303873=auto



==
--- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
+++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
@@ -0,0 +1,50 @@
+set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
+
+# Builtins
+set(LLVM_BUILTIN_TARGETS
"armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi" CACHE STRING
"Builtin Targets")
+
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT
${BAREMETAL_ARMV6M_SYSROOT} CACHE STRING "armv6m-none-eabi Sysroot")
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE
STRING "armv6m-none-eabi System Name")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON
CACHE BOOL "armv6m-none-eabi Baremetal build")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal"
CACHE STRING "armv6m-none-eabi os dir")
+
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT
${BAREMETAL_ARMV7M_SYSROOT} CACHE STRING "armv7m-none-eabi Sysroot")
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE
STRING "armv7m-none-eabi System Name")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON
CACHE BOOL "armv7m-none-eabi Baremetal build")
+set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8"
CACHE STRING "armv7m-none-eabi C Flags")
+set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8"
CACHE STRING "armv7m-none-eabi ASM Flags")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal"
CACHE STRING "armv7m-none-eabi os dir")
+
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT
${BAREMETAL_ARMV7EM_SYSROOT} CACHE STRING "armv7em-none-eabi Sysroot")
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE
STRING "armv7em-none-eabi System Name")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON
CACHE BOOL "armv7em-none-eabi Baremetal build")
+set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8"
CACHE STRING "armv7em-none-eabi C Flags")
+set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8"
CACHE STRING "armv7em-none-eabi ASM Flags")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal"
CACHE STRING "armv7em-none-eabi os dir")
+
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+set(LLVM_TOOLCHAIN_TOOLS
+  llc
+  llvm-ar
+  llvm-cxxfilt
+  llvm-dwarfdump
+  llvm-dsymutil
+  llvm-nm
+  llvm-objdump
+  llvm-ranlib
+  llvm-readobj

r303898 - Appease more buildbots about r303873

2017-05-25 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu May 25 13:55:22 2017
New Revision: 303898

URL: http://llvm.org/viewvc/llvm-project?rev=303898=rev
Log:
Appease more buildbots about r303873

Modified:
cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp?rev=303898=303897=303898=diff
==
--- cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp Thu May 25 13:55:22 2017
@@ -136,6 +136,7 @@ std::string BareMetal::findLibCxxInclude
 return Dir.str();
   }
   }
+  llvm_unreachable("unhandled LibType");
 }
 
 void BareMetal::AddClangCXXStdlibIncludeArgs(


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


[libcxx] r303895 - Update coroutine_handle::promise to reflect N4663.

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 13:52:34 2017
New Revision: 303895

URL: http://llvm.org/viewvc/llvm-project?rev=303895=rev
Log:
Update coroutine_handle::promise to reflect N4663.

This patch updates the promise() member to match the current spec.
Specifically it removes the non-const overload and make the return
type of the const overload non-const.

This patch also makes the ASSERT_NOT_NOEXCEPT tests libc++ specific,
since other implementations may be free to strengthen the specification.

Modified:
libcxx/trunk/include/experimental/coroutine

libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp

Modified: libcxx/trunk/include/experimental/coroutine
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/coroutine?rev=303895=303894=303895=diff
==
--- libcxx/trunk/include/experimental/coroutine (original)
+++ libcxx/trunk/include/experimental/coroutine Thu May 25 13:52:34 2017
@@ -194,15 +194,9 @@ public:
 return *this;
 }
 
-  _LIBCPP_INLINE_VISIBILITY
-_Promise& promise() {
-return *reinterpret_cast<_Promise*>(
-__builtin_coro_promise(this->__handle_, alignof(_Promise), false));
-}
-
 _LIBCPP_INLINE_VISIBILITY
-_Promise const& promise() const {
-return *reinterpret_cast<_Promise const*>(
+_Promise& promise() const {
+return *reinterpret_cast<_Promise*>(
 __builtin_coro_promise(this->__handle_, alignof(_Promise), false));
 }
 

Modified: 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp?rev=303895=303894=303895=diff
==
--- 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
 Thu May 25 13:52:34 2017
@@ -39,12 +39,12 @@ void do_test(coro::coroutine_handlehttp://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D33550: Make __wrap_iter constexpr

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

@mclow.lists Could you update this diff with more context?


https://reviews.llvm.org/D33550



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


[PATCH] D33080: [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 100269.
EricWF added a comment.

- Remove the external include guards for `__undef_macros` as requested by 
@compnerd.

I couldn't come up with a easy test case that showed any notable difference 
having the external guards.


https://reviews.llvm.org/D33080

Files:
  include/__bit_reference
  include/__config
  include/__hash_table
  include/__mutex_base
  include/__split_buffer
  include/__std_stream
  include/__string
  include/__threading_support
  include/__tree
  include/__undef_macros
  include/__undef_min_max
  include/algorithm
  include/array
  include/bitset
  include/chrono
  include/deque
  include/experimental/algorithm
  include/experimental/dynarray
  include/experimental/functional
  include/experimental/memory_resource
  include/experimental/numeric
  include/experimental/optional
  include/experimental/string_view
  include/forward_list
  include/fstream
  include/istream
  include/limits
  include/list
  include/locale
  include/memory
  include/module.modulemap
  include/mutex
  include/numeric
  include/optional
  include/random
  include/ratio
  include/regex
  include/shared_mutex
  include/sstream
  include/streambuf
  include/string
  include/string_view
  include/thread
  include/valarray
  include/vector
  src/condition_variable.cpp
  src/ios.cpp
  src/locale.cpp
  src/mutex.cpp
  src/strstream.cpp
  test/libcxx/min_max_macros.sh.cpp

Index: test/libcxx/min_max_macros.sh.cpp
===
--- /dev/null
+++ test/libcxx/min_max_macros.sh.cpp
@@ -0,0 +1,298 @@
+// -*- C++ -*-
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// Test that we can include each header in two TU's and link them together.
+
+// RUN: %compile -fsyntax-only
+
+// Prevent  from generating deprecated warnings for this test.
+#if defined(__DEPRECATED)
+#undef __DEPRECATED
+#endif
+
+#define TEST_MACROS() static_assert(min() == true && max() == true, "")
+#define min() true
+#define max() true
+
+// Top level headers
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 

[PATCH] D33290: [libcxx] [test] Remove workaround for C1XX conversion-to-nullptr bug

2017-05-25 Thread Casey Carter via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
CaseyCarter marked an inline comment as done.
Closed by commit rL303889: [test] Remove workaround for C1XX 
conversion-to-nullptr bug (authored by CaseyCarter).

Changed prior to commit:
  https://reviews.llvm.org/D33290?vs=99336=100265#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33290

Files:
  libcxx/trunk/test/support/poisoned_hash_helper.hpp
  
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
  libcxx/trunk/test/support/test_workarounds.h


Index: 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
===
--- 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
+++ 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
@@ -1,29 +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.
-//
-//===--===//
-
-// UNSUPPORTED: c++98, c++03
-
-// Verify TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR.
-
-#include 
-
-#include "test_workarounds.h"
-
-struct ConvertsToNullptr {
-  using DestType = decltype(nullptr);
-  operator DestType() const { return nullptr; }
-};
-
-int main() {
-#if defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
-  static_assert(!std::is_convertible::value, "");
-#else
-  static_assert(std::is_convertible::value, "");
-#endif
-}
Index: libcxx/trunk/test/support/test_workarounds.h
===
--- libcxx/trunk/test/support/test_workarounds.h
+++ libcxx/trunk/test/support/test_workarounds.h
@@ -14,15 +14,14 @@
 #include "test_macros.h"
 
 #if defined(TEST_COMPILER_EDG)
-# define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR
+# define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR // VSO#424280
 #endif
 
 #if defined(TEST_COMPILER_C1XX)
-# define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
-# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
-# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE // VSO#117743
+# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION // VSO#109062
 # ifndef _MSC_EXTENSIONS
-#  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
+#  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK // VSO#119998
 # endif
 #endif
 
Index: libcxx/trunk/test/support/poisoned_hash_helper.hpp
===
--- libcxx/trunk/test/support/poisoned_hash_helper.hpp
+++ libcxx/trunk/test/support/poisoned_hash_helper.hpp
@@ -50,11 +50,9 @@
 // specializations of hash for nullptr t and all cv-unqualified
 // arithmetic, enumeration, and pointer types.
 using LibraryHashTypes = TypeList<
-#if !defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
 #if TEST_STD_VER > 14
   decltype(nullptr),
 #endif
-#endif
   bool,
   char,
   signed char,


Index: libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
===
--- libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
+++ libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
@@ -1,29 +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.
-//
-//===--===//
-
-// UNSUPPORTED: c++98, c++03
-
-// Verify TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR.
-
-#include 
-
-#include "test_workarounds.h"
-
-struct ConvertsToNullptr {
-  using DestType = decltype(nullptr);
-  operator DestType() const { return nullptr; }
-};
-
-int main() {
-#if defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
-  static_assert(!std::is_convertible::value, "");
-#else
-  static_assert(std::is_convertible::value, "");
-#endif
-}
Index: libcxx/trunk/test/support/test_workarounds.h
===
--- libcxx/trunk/test/support/test_workarounds.h
+++ libcxx/trunk/test/support/test_workarounds.h
@@ -14,15 +14,14 @@
 #include "test_macros.h"
 
 #if 

[PATCH] D33214: [libcxx] [test] Workaround C1XX bug in uses_allocator_types.hpp

2017-05-25 Thread Casey Carter via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303888: [test] Workaround C1XX bug in 
uses_allocator_types.hpp (authored by CaseyCarter).

Changed prior to commit:
  https://reviews.llvm.org/D33214?vs=99086=100264#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33214

Files:
  
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
  
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
  libcxx/trunk/test/support/test_workarounds.h
  libcxx/trunk/test/support/uses_alloc_types.hpp

Index: libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
===
--- libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
+++ libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
@@ -0,0 +1,49 @@
+//===--===//
+//
+// 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
+
+// Verify TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION.
+
+#include 
+
+#include "test_workarounds.h"
+
+template
+struct identity {
+using type = T;
+};
+
+template struct list {};
+
+// C1XX believes this function template is not viable when LArgs is an empty
+// parameter pack.
+template 
+int f2(typename identity::type..., int i) {
+return i;
+}
+
+#ifdef TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+// C1XX believes this function template *is* viable when LArgs is an empty
+// parameter pack. Conforming compilers believe the two overloads are
+// ambiguous when LArgs is an empty pack.
+template 
+int f2(int i) {
+return i;
+}
+#endif
+
+template 
+int f1(list, Args&&... args) {
+return f2(args...);
+}
+
+int main() {
+f1(list<>{}, 42);
+}
Index: libcxx/trunk/test/support/uses_alloc_types.hpp
===
--- libcxx/trunk/test/support/uses_alloc_types.hpp
+++ libcxx/trunk/test/support/uses_alloc_types.hpp
@@ -15,6 +15,7 @@
 #include 
 
 #include "test_macros.h"
+#include "test_workarounds.h"
 #include "type_id.h"
 
 // There are two forms of uses-allocator construction:
@@ -256,6 +257,13 @@
 return alloc;
 }
 
+#ifdef TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+template 
+static CtorAlloc getAllocatorFromPackImp(CtorAlloc const& alloc) {
+return alloc;
+}
+#endif
+
 bool has_alloc() const { return alloc_store.get_allocator() != nullptr; }
 const CtorAlloc *get_alloc() const { return alloc_store.get_allocator(); }
 public:
Index: libcxx/trunk/test/support/test_workarounds.h
===
--- libcxx/trunk/test/support/test_workarounds.h
+++ libcxx/trunk/test/support/test_workarounds.h
@@ -20,6 +20,7 @@
 #if defined(TEST_COMPILER_C1XX)
 # define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
 # define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
+# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
 # ifndef _MSC_EXTENSIONS
 #  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
 # endif
Index: libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
===
--- libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
+++ libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
@@ -39,6 +39,7 @@
 using SA = std::scoped_allocator_adaptor;
 static_assert(std::uses_allocator::value, "");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Alloc CA(P);
 SA A(CA);
 A.construct(ptr);
@@ -61,6 +62,7 @@
 using SA = std::scoped_allocator_adaptor;
 static_assert(std::uses_allocator::value, "");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Alloc CA(P);
 SA A(CA);
 A.construct(ptr);
@@ -77,7 +79,6 @@
 
 void test_with_inner_alloc()
 {
-using VoidAlloc1 = CountingAllocator;
 using VoidAlloc2 = CountingAllocator;
 
 AllocController POuter;
@@ -93,6 +94,7 @@
 static_assert(!std::uses_allocator::value, "");
 static_assert(std::uses_allocator::value, "");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Outer O(POuter);
 Inner I(PInner);
 SA A(O, I);
@@ -119,6 +121,7 @@
   

[libcxx] r303889 - [test] Remove workaround for C1XX conversion-to-nullptr bug

2017-05-25 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu May 25 12:42:21 2017
New Revision: 303889

URL: http://llvm.org/viewvc/llvm-project?rev=303889=rev
Log:
[test] Remove workaround for C1XX conversion-to-nullptr bug

VSO#391542 "Types can't be convertible to nullptr_t"

Also put internal bug numbers on the workarounds in test_workarounds.h for 
correlation.

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

Removed:

libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
Modified:
libcxx/trunk/test/support/poisoned_hash_helper.hpp
libcxx/trunk/test/support/test_workarounds.h

Modified: libcxx/trunk/test/support/poisoned_hash_helper.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/poisoned_hash_helper.hpp?rev=303889=303888=303889=diff
==
--- libcxx/trunk/test/support/poisoned_hash_helper.hpp (original)
+++ libcxx/trunk/test/support/poisoned_hash_helper.hpp Thu May 25 12:42:21 2017
@@ -50,11 +50,9 @@ namespace PoisonedHashDetail {
 // specializations of hash for nullptr t and all cv-unqualified
 // arithmetic, enumeration, and pointer types.
 using LibraryHashTypes = TypeList<
-#if !defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
 #if TEST_STD_VER > 14
   decltype(nullptr),
 #endif
-#endif
   bool,
   char,
   signed char,

Removed: 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp?rev=303888=auto
==
--- 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
 (original)
+++ 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
 (removed)
@@ -1,29 +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.
-//
-//===--===//
-
-// UNSUPPORTED: c++98, c++03
-
-// Verify TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR.
-
-#include 
-
-#include "test_workarounds.h"
-
-struct ConvertsToNullptr {
-  using DestType = decltype(nullptr);
-  operator DestType() const { return nullptr; }
-};
-
-int main() {
-#if defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
-  static_assert(!std::is_convertible::value, "");
-#else
-  static_assert(std::is_convertible::value, "");
-#endif
-}

Modified: libcxx/trunk/test/support/test_workarounds.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_workarounds.h?rev=303889=303888=303889=diff
==
--- libcxx/trunk/test/support/test_workarounds.h (original)
+++ libcxx/trunk/test/support/test_workarounds.h Thu May 25 12:42:21 2017
@@ -14,15 +14,14 @@
 #include "test_macros.h"
 
 #if defined(TEST_COMPILER_EDG)
-# define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR
+# define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR // VSO#424280
 #endif
 
 #if defined(TEST_COMPILER_C1XX)
-# define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
-# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
-# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE // VSO#117743
+# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION // VSO#109062
 # ifndef _MSC_EXTENSIONS
-#  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
+#  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK // VSO#119998
 # endif
 #endif
 


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


[libcxx] r303888 - [test] Workaround C1XX bug in uses_allocator_types.hpp

2017-05-25 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu May 25 12:42:17 2017
New Revision: 303888

URL: http://llvm.org/viewvc/llvm-project?rev=303888=rev
Log:
[test] Workaround C1XX bug in uses_allocator_types.hpp

VSO#109062 "Explicit template argument specification with empty template 
parameter pack expansion does not imply further empty pack expansion"

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

Added:

libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
Modified:

libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
libcxx/trunk/test/support/test_workarounds.h
libcxx/trunk/test/support/uses_alloc_types.hpp

Modified: 
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp?rev=303888=303887=303888=diff
==
--- 
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
 Thu May 25 12:42:17 2017
@@ -39,6 +39,7 @@ void test_no_inner_alloc()
 using SA = std::scoped_allocator_adaptor;
 static_assert(std::uses_allocator::value, 
"");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Alloc CA(P);
 SA A(CA);
 A.construct(ptr);
@@ -61,6 +62,7 @@ void test_no_inner_alloc()
 using SA = std::scoped_allocator_adaptor;
 static_assert(std::uses_allocator::value, 
"");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Alloc CA(P);
 SA A(CA);
 A.construct(ptr);
@@ -77,7 +79,6 @@ void test_no_inner_alloc()
 
 void test_with_inner_alloc()
 {
-using VoidAlloc1 = CountingAllocator;
 using VoidAlloc2 = CountingAllocator;
 
 AllocController POuter;
@@ -93,6 +94,7 @@ void test_with_inner_alloc()
 static_assert(!std::uses_allocator::value, "");
 static_assert(std::uses_allocator::value, "");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Outer O(POuter);
 Inner I(PInner);
 SA A(O, I);
@@ -119,6 +121,7 @@ void test_with_inner_alloc()
 static_assert(!std::uses_allocator::value, "");
 static_assert(std::uses_allocator::value, "");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Outer O(POuter);
 Inner I(PInner);
 SA A(O, I);

Added: 
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp?rev=303888=auto
==
--- 
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
 (added)
+++ 
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
 Thu May 25 12:42:17 2017
@@ -0,0 +1,49 @@
+//===--===//
+//
+// 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
+
+// Verify TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION.
+
+#include 
+
+#include "test_workarounds.h"
+
+template
+struct identity {
+using type = T;
+};
+
+template struct list {};
+
+// C1XX believes this function template is not viable when LArgs is an empty
+// parameter pack.
+template 
+int f2(typename identity::type..., int i) {
+return i;
+}
+
+#ifdef TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+// C1XX believes this function template *is* viable when LArgs is an empty
+// parameter pack. Conforming compilers believe the two overloads are
+// ambiguous when LArgs is an empty pack.
+template 
+int f2(int i) {
+return i;
+}
+#endif
+
+template 
+int f1(list, Args&&... args) {
+return f2(args...);
+}
+
+int main() {
+f1(list<>{}, 42);
+}

Modified: libcxx/trunk/test/support/test_workarounds.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_workarounds.h?rev=303888=303887=303888=diff
==
--- libcxx/trunk/test/support/test_workarounds.h (original)
+++ libcxx/trunk/test/support/test_workarounds.h Thu May 25 12:42:17 2017
@@ -20,6 +20,7 @@
 #if 

Re: r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Galina Kistanova via cfe-commits
Hello Jonathan,

This commit broke one of our builders:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2608/steps/build-unified-tree/logs/stdio

Please have a look at this?

Thanks

Galina

On Thu, May 25, 2017 at 8:42 AM, Jonathan Roelofs via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jroelofs
> Date: Thu May 25 10:42:13 2017
> New Revision: 303873
>
> URL: http://llvm.org/viewvc/llvm-project?rev=303873=rev
> Log:
> Don't defer to the GCC driver for linking arm-baremetal
>
> Also comes with a cmake cache for building the runtime bits:
>
>  $ cmake  \
>-DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
>-DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
>-DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
>-C /path/to/clang/cmake/caches/BaremetalARM.cmake \
>/path/to/llvm
>
> https://reviews.llvm.org/D33259
>
> Added:
> cfe/trunk/cmake/caches/BaremetalARM.cmake
> cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
> cfe/trunk/lib/Driver/ToolChains/BareMetal.h
> cfe/trunk/test/Driver/Inputs/baremetal_arm/
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
> cfe/trunk/test/Driver/baremetal.cpp
> Modified:
> cfe/trunk/lib/Driver/CMakeLists.txt
> cfe/trunk/lib/Driver/Driver.cpp
> cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
> cfe/trunk/lib/Driver/ToolChains/Linux.cpp
> cfe/trunk/test/Frontend/gnu-mcount.c
>
> Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/
> caches/BaremetalARM.cmake?rev=303873=auto
> 
> ==
> --- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
> +++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
> @@ -0,0 +1,50 @@
> +set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
> +
> +# Builtins
> +set(LLVM_BUILTIN_TARGETS 
> "armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi"
> CACHE STRING "Builtin Targets")
> +
> +set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV6M_SYSROOT}
> CACHE STRING "armv6m-none-eabi Sysroot")
> +set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
> "armv6m-none-eabi System Name")
> +set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
> "armv6m-none-eabi Baremetal build")
> +set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE
> STRING "armv6m-none-eabi os dir")
> +
> +set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7M_SYSROOT}
> CACHE STRING "armv7m-none-eabi Sysroot")
> +set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
> "armv7m-none-eabi System Name")
> +set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
> "armv7m-none-eabi Baremetal build")
> +set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE
> STRING "armv7m-none-eabi C Flags")
> +set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
> STRING "armv7m-none-eabi ASM Flags")
> +set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE
> STRING "armv7m-none-eabi os dir")
> +
> +set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT
> ${BAREMETAL_ARMV7EM_SYSROOT} CACHE STRING "armv7em-none-eabi Sysroot")
> +set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
> "armv7em-none-eabi System Name")
> +set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
> "armv7em-none-eabi Baremetal build")
> +set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE
> STRING "armv7em-none-eabi C Flags")
> +set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
> STRING "armv7em-none-eabi ASM Flags")
> +set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE
> STRING "armv7em-none-eabi os dir")
> +
> +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
> +set(LLVM_TOOLCHAIN_TOOLS
> +  llc
> +  llvm-ar
> +  llvm-cxxfilt
> +  llvm-dwarfdump
> +  llvm-dsymutil
> +  llvm-nm
> +  llvm-objdump
> +  llvm-ranlib
> +  llvm-readobj
> +  llvm-size
> +  llvm-symbolizer
> +  opt
> +  CACHE STRING "")
> +
> +set(LLVM_DISTRIBUTION_COMPONENTS
> +  clang
> +  lld
> +  clang-headers
> +  builtins-armv6m-none-eabi
> +  builtins-armv7m-none-eabi
> +  builtins-armv7em-none-eabi
> +  runtimes
> +  ${LLVM_TOOLCHAIN_TOOLS}
> +  CACHE STRING "")
>
> Modified: cfe/trunk/lib/Driver/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> CMakeLists.txt?rev=303873=303872=303873=diff
> 

[PATCH] D33080: [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D33080#754442, @compnerd wrote:

> I think that we should sink the `min`/`max` checks into `__undef_macros`.  I 
> don't like the idea of littering that check everywhere.


I would much rather litter at the cost of the implementation than needlessly 
include `__undef_macros` in every header; Especially because
it's almost always unneeded. I realize it's ugly internally but I think it's 
worth it. I'll attempt to write some compile time tests to ensure
I'm not making a mountain out of a molehill but could you also re-consider 
@compnerd?


https://reviews.llvm.org/D33080



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


[PATCH] D33082: Fix Libc++ build with MinGW64

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 100263.
EricWF added a comment.

Add `_LIBCPP_MSVCRT_LIKE` and use it to replace `_LIBCPP_WIN32API` where 
appropriate.


https://reviews.llvm.org/D33082

Files:
  include/__config
  include/__locale
  include/locale
  include/stdio.h
  include/support/win32/locale_win32.h
  include/wchar.h
  src/chrono.cpp
  src/new.cpp
  src/support/win32/locale_win32.cpp
  src/support/win32/support.cpp
  src/system_error.cpp
  src/thread.cpp

Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -34,7 +34,7 @@
 
 #if defined(_LIBCPP_WIN32API)
 #include 
-#endif // defined(_LIBCPP_WIN32API)
+#endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
Index: src/system_error.cpp
===
--- src/system_error.cpp
+++ src/system_error.cpp
@@ -65,7 +65,7 @@
 
 string do_strerror_r(int ev);
 
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 string do_strerror_r(int ev) {
   char buffer[strerror_buff_size];
   if (::strerror_s(buffer, strerror_buff_size, ev) == 0)
Index: src/support/win32/support.cpp
===
--- src/support/win32/support.cpp
+++ src/support/win32/support.cpp
@@ -16,7 +16,7 @@
 #include   // mbstate_t
 
 // Some of these functions aren't standard or if they conform, the name does not.
-
+#if defined(_LIBCPP_MSVCRT)
 int asprintf(char **sptr, const char *__restrict format, ...)
 {
 va_list ap;
@@ -26,6 +26,7 @@
 va_end(ap);
 return result;
 }
+#endif
 
 // Like sprintf, but when return value >= 0 it returns
 // a pointer to a malloc'd string in *sptr.
Index: src/support/win32/locale_win32.cpp
===
--- src/support/win32/locale_win32.cpp
+++ src/support/win32/locale_win32.cpp
@@ -34,6 +34,18 @@
 // uselocale returns the old locale_t
 return old_locale;
 }
+
+decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
+{
+#if defined(_LIBCPP_MSVCRT)
+  return ___mb_cur_max_l_func(__l);
+#else
+  __libcpp_locale_guard __current(__l);
+  return MB_CUR_MAX;
+#endif
+}
+
+
 lconv *localeconv_l( locale_t loc )
 {
 __libcpp_locale_guard __current(loc);
@@ -109,3 +121,15 @@
 __libcpp_locale_guard __current(loc);
 return vasprintf( ret, format, ap );
 }
+
+#if !defined(_LIBCPP_MSVCRT)
+float strtof_l(const char* nptr, char** endptr, locale_t loc) {
+  __libcpp_locale_guard __current(loc);
+  return strtof(nptr, endptr);
+}
+
+long double strtold_l(const char* nptr, char** endptr, locale_t loc) {
+  __libcpp_locale_guard __current(loc);
+  return strtold(nptr, endptr);
+}
+#endif
Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -183,7 +183,7 @@
 if (static_cast(alignment) < sizeof(void*))
   alignment = std::align_val_t(sizeof(void*));
 void* p;
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 while ((p = _aligned_malloc(size, static_cast(alignment))) == nullptr)
 #else
 while (::posix_memalign(, static_cast(alignment), size) != 0)
@@ -256,7 +256,7 @@
 operator delete(void* ptr, std::align_val_t) _NOEXCEPT
 {
 if (ptr)
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 ::_aligned_free(ptr);
 #else
 ::free(ptr);
Index: src/chrono.cpp
===
--- src/chrono.cpp
+++ src/chrono.cpp
@@ -37,7 +37,7 @@
 #if defined(_LIBCPP_WIN32API)
 #define WIN32_LEAN_AND_MEAN
 #define VC_EXTRA_LEAN
-#include 
+#include 
 #if _WIN32_WINNT >= _WIN32_WINNT_WIN8
 #include 
 #endif
Index: include/wchar.h
===
--- include/wchar.h
+++ include/wchar.h
@@ -166,7 +166,7 @@
 }
 #endif
 
-#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT)
+#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT_LIKE)
 extern "C" {
 size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
   size_t nmc, size_t len, mbstate_t *__restrict ps);
Index: include/support/win32/locale_win32.h
===
--- include/support/win32/locale_win32.h
+++ include/support/win32/locale_win32.h
@@ -52,20 +52,21 @@
  size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc);
 wint_t btowc_l( int c, locale_t loc );
 int wctob_l( wint_t c, locale_t loc );
-inline _LIBCPP_ALWAYS_INLINE
-decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
-{
-  return ___mb_cur_max_l_func(__l);
-}
+
+decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l );
 
 // the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
 #define mbtowc_l _mbtowc_l
 #define strtoll_l _strtoi64_l
 #define strtoull_l _strtoui64_l
-#define strtof_l _strtof_l
 #define strtod_l _strtod_l
+#if defined(_LIBCPP_MSVCRT)
+#define strtof_l _strtof_l
 

[clang-tools-extra] r303884 - [Documentation] Mention hicpp check group in Clang-tidy main document.

2017-05-25 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Thu May 25 12:22:29 2017
New Revision: 303884

URL: http://llvm.org/viewvc/llvm-project?rev=303884=rev
Log:
[Documentation] Mention hicpp check group in Clang-tidy main document.

Modified:
clang-tools-extra/trunk/docs/clang-tidy/index.rst

Modified: clang-tools-extra/trunk/docs/clang-tidy/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/index.rst?rev=303884=303883=303884=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/index.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/index.rst Thu May 25 12:22:29 2017
@@ -59,7 +59,8 @@ Name prefixDescription
 ``cert-``  Checks related to CERT Secure Coding Guidelines.
 ``cppcoreguidelines-`` Checks related to C++ Core Guidelines.
 ``clang-analyzer-``Clang Static Analyzer checks.
-``google-``Checks related to the Google coding conventions.
+``google-``Checks related to Google coding conventions.
+``hicpp-`` Checks related to High Integrity C++ Coding Standard.
 ``llvm-``  Checks related to the LLVM coding conventions.
 ``misc-``  Checks that we didn't have a better category for.
 ``modernize-`` Checks that advocate usage of modern (currently "modern"
@@ -652,7 +653,7 @@ The script provides multiple configurati
 * To restrict the files examined you can provide one or more regex arguments
   that the file names are matched against.
   ``run-clang-tidy.py clang-tidy/.*Check\.cpp`` will only analyze clang-tidy
-  checkers. It may also be necessary to restrict the header files warnings are
+  checks. It may also be necessary to restrict the header files warnings are
   displayed from using the ``-header-filter`` flag. It has the same behavior
   as the corresponding :program:`clang-tidy` flag.
 


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


[PATCH] D33082: Fix Libc++ build with MinGW64

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked 3 inline comments as done.
EricWF added a comment.

In https://reviews.llvm.org/D33082#760516, @martell wrote:

> I want to give some context here to dispel the confusion of what is and isn't 
> win32 api specific.
>
> First lets take `vasprintf` and `asprintf ` which are not implemented in 
> msvcrt.
>  In mingw-w64 we would just have posix implementations of both.
>  They are hidden behind the guard `_GNU_SOURCE`, we don't need to declare 
> them in `include/stdio.h` in libcxx but
>  By default gcc doesn't pass this flag for the mingw target so we should add 
> it in cmake within libc++.


Defining `_GNU_SOURCE` during the library build isn't enough, it's also has to 
be defined when people are using the headers,
and in that case we must depend on the compiler to pre-define it. Is it 
important that MinGW not define `_GNU_SOURCE` by default?

Also do you know why `asprintf` is declared by mingw-w64 but `vasprintf` isn't? 
At minimum I think we still need to declare `vasprintf` in the
headers because we can't count on `_GNU_SOURCE` being defined before 
`` is first included, but we should be able to omit
the definition.

> Next example `mbsnrtowcs` and `wcsnrtombs` above
>  There is technically a win32api specific implementation in msvc. The 
> mingw-w64 implementation or lack there of would rely on the MSVC 
> implementation.
>  This is why a custom implementation lives in libc++ in `support.cpp` that is 
> posix compliant.

Good to know.

> Unfortunately a posix implementation might not be accepted upstream into 
> mingw-w64 because they need to maintain compatibility with msvc, even with 
> some bugs eek.

I'm not personally concerned about upstreaming MinGW-w64 changes/fixes. If we 
can adequately solve it within libc++ without any terrible hacks I'm happy with 
that for now.

> It generally comes down to if a bunch of projects are using it already and we 
> should not disrupt them relying on msvc implementations/bugs.
>  This is probably not the case for these two functions but there are many 
> others already in the library that follow this guideline.

Are you suggesting that libc++ should stop declaring/defining these functions, 
at least publically?

> A good read of this specific bug is here.
>  http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20130325/077071.html
> 
> @smeenai suggestion of `_LIBCPP_MSVCRT_LIKE` makes a lot of sense here 
> because mingw-w64 is only partially posixy, this leaves room for future 
> possible targets like midipix which uses musl libc to ignore this section of 
> code where mingw and msvc opt in.




https://reviews.llvm.org/D33082



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


[PATCH] D33537: [clang-tidy] Exception Escape Checker

2017-05-25 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment.

Please mention this check in docs/ReleaseNotes.rst (in alphabetical order).




Comment at: docs/clang-tidy/checks/misc-exception-escape.rst:7
+Finds functions which should not throw exceptions:
++ Destructors
++ Copy constructors

I think - or * is more correct.



Comment at: docs/clang-tidy/checks/misc-exception-escape.rst:10
++ Copy assignment operators
++ The main() functions
++ swap() functions

Please enclose main() in ``. Same for other functions and keywords.



Comment at: docs/clang-tidy/checks/misc-exception-escape.rst:29
+   Comma separated list containing function names which should not throw. An
+   example for using this parameter is the function WinMain in the Windows API.
+   Default vale is empty string.

Please add () to WinMain and enclose it in ``.



Comment at: docs/clang-tidy/checks/misc-exception-escape.rst:35
+   Comma separated list containing type names which are not counted as thrown
+   exceptions in the checker. Default value is empty string.

Please use check instead of checker.


https://reviews.llvm.org/D33537



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


Re: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Nico Weber via cfe-commits
Among the goals of the clang-cl project are a) being able to parse MS
system headers b) helper users to write standards-compliant C++ (in
particular, if your code builds with clang-cl without warnings, it'd be
good if it also built with regular clang then).

The regular change plus header change plus warning would be one way to
achieve this, yes.

On Thu, May 25, 2017 at 1:01 PM, Keane, Erich  wrote:

> No problem, I definitely think it was the right choice.
>
>
>
> A change that contains all of what Melanie’s original patch did, plus the
> Header changes (plus the clang-tidy fixes that came out of this) would be
> acceptable?
>
>
>
> Also, I believe she’s working on the warning as well.  We were discussing
> it, and I was thinking that if we track down where the
> operator-identification is done (hints as to where that is is appreciated),
> that we could simply warn if the user is using one of the Operators with
> operators off.  The warning itself could then be suppressed if necessary.
>
>
>
> Thoughts?
>
>
>
>
>
> *From:* Nico Weber [mailto:tha...@google.com]
> *Sent:* Thursday, May 25, 2017 9:56 AM
> *To:* Keane, Erich 
> *Cc:* Blower, Melanie ; rnk ;
> cfe-commits ; Hans Wennborg  >
>
> *Subject:* Re: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> On Thu, May 25, 2017 at 12:18 PM, Keane, Erich 
> wrote:
>
> How does chromium compiler in CL?  It seems that it would have a similar
> problem here…
>
>
>
> That's a good question! It looks like iso646.h is included, and in MSVC
> that contains something like `#define and &&`. But clang's
> lib/Headers/iso646.h assumes that the compiler provides this and doesn't
> define `and`. So for the reland, that header would have to check if the
> operator name is disabled, and if so, define it. (Or, better, maybe we can
> come up with something more targeted for the system header, similar to e.g.
> http://llvm.org/viewvc/llvm-project?view=revision=212238)
>
>
>
> Thanks for the revert!
>
>
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com] *On Behalf Of *Nico
> Weber
> *Sent:* Thursday, May 25, 2017 9:16 AM
> *To:* Blower, Melanie 
> *Cc:* rnk ; Keane, Erich ;
> cfe-commits ; Hans Wennborg  >
>
>
> *Subject:* RE: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> In addition to this making clang-cl silently accept invalid code, it also
> breaks existing valid code, building chromium now fails. Let's revert and
> come up with something better asynchronously.
>
>
>
> FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
>
>
> E:\b\c\goma_client/gomacc.exe ../../third_party/llvm-build/
> Release+Asserts/bin/clang-cl.exe /nologo /showIncludes /FC
> @obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp
> /c ../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
> /Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
> /Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
>
> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\
> custom\CustomElementRegistry.cpp(229,7):  error: unknown type name
> 'definition'
>
>   if (definition and definition->Descriptor().LocalName() ==
> desc.LocalName()) {
>
>   ^
>
> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\
> custom\CustomElementRegistry.cpp(229,18):  error: variable declaration in
> condition must have an initializer
>
>   if (definition and definition->Descriptor().LocalName() ==
> desc.LocalName()) {
>
>  ^
>
> 2 errors generated.
>
>
>
>
>
> On May 24, 2017 4:01 PM, "Blower, Melanie" 
> wrote:
>
> Thanks for the feedback, working on it…
>
>
>
> *From:* Keane, Erich
> *Sent:* Wednesday, May 24, 2017 3:47 PM
> *To:* Nico Weber ; Blower, Melanie <
> melanie.blo...@intel.com>
>
>
> *Cc:* cfe-commits ; rnk 
>
> *Subject:* RE: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> Adding Melanie, the author of the patch.
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com ] *On
> Behalf Of *Nico Weber
> *Sent:* Wednesday, May 24, 2017 12:43 PM
> *To:* Keane, Erich 
> *Cc:* cfe-commits ; rnk 
> *Subject:* Re: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> Reviewed here: https://reviews.llvm.org/D33505
>
>
> Still, please make this warn.
>
>
>
> On Wed, May 24, 2017 at 3:42 PM, Nico Weber  wrote:
>
> Was this reviewed somewhere?
>
>
>
> Please make it so that this emits a warning. We want clang-cl to warn on
> invalid code (and in system 

[PATCH] D33416: [clangd] Allow to use vfs::FileSystem for file accesses.

2017-05-25 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 100262.
ilya-biryukov added a comment.

- Fixed file comment of ClangdTests.cpp


https://reviews.llvm.org/D33416

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  clangd/ClangdUnitStore.h
  unittests/CMakeLists.txt
  unittests/clangd/CMakeLists.txt
  unittests/clangd/ClangdTests.cpp

Index: unittests/clangd/ClangdTests.cpp
===
--- /dev/null
+++ unittests/clangd/ClangdTests.cpp
@@ -0,0 +1,364 @@
+//===-- ClangdTests.cpp - Clangd unit tests -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ClangdServer.h"
+#include "clang/Basic/VirtualFileSystem.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/Config/config.h"
+#include "llvm/Support/Errc.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Regex.h"
+#include "gtest/gtest.h"
+#include 
+#include 
+#include 
+#include 
+
+namespace clang {
+namespace vfs {
+
+/// An implementation of vfs::FileSystem that only allows access to
+/// files and folders inside a set of whitelisted directories.
+///
+/// FIXME(ibiryukov): should it also emulate access to parents of whitelisted
+/// directories with only whitelisted contents?
+class FilteredFileSystem : public vfs::FileSystem {
+public:
+  /// The paths inside \p WhitelistedDirs should be absolute
+  FilteredFileSystem(std::vector WhitelistedDirs,
+ IntrusiveRefCntPtr InnerFS)
+  : WhitelistedDirs(std::move(WhitelistedDirs)), InnerFS(InnerFS) {
+assert(std::all_of(WhitelistedDirs.begin(), WhitelistedDirs.end(),
+   [](const std::string ) -> bool {
+ return llvm::sys::path::is_absolute(Path);
+   }) &&
+   "Not all WhitelistedDirs are absolute");
+  }
+
+  virtual llvm::ErrorOr status(const Twine ) {
+if (!isInsideWhitelistedDir(Path))
+  return llvm::errc::no_such_file_or_directory;
+return InnerFS->status(Path);
+  }
+
+  virtual llvm::ErrorOr
+  openFileForRead(const Twine ) {
+if (!isInsideWhitelistedDir(Path))
+  return llvm::errc::no_such_file_or_directory;
+return InnerFS->openFileForRead(Path);
+  }
+
+  llvm::ErrorOr
+  getBufferForFile(const Twine , int64_t FileSize = -1,
+   bool RequiresNullTerminator = true,
+   bool IsVolatile = false) {
+if (!isInsideWhitelistedDir(Name))
+  return llvm::errc::no_such_file_or_directory;
+return InnerFS->getBufferForFile(Name, FileSize, RequiresNullTerminator,
+ IsVolatile);
+  }
+
+  virtual directory_iterator dir_begin(const Twine , std::error_code ) {
+if (!isInsideWhitelistedDir(Dir)) {
+  EC = llvm::errc::no_such_file_or_directory;
+  return directory_iterator();
+}
+return InnerFS->dir_begin(Dir, EC);
+  }
+
+  virtual std::error_code setCurrentWorkingDirectory(const Twine ) {
+return InnerFS->setCurrentWorkingDirectory(Path);
+  }
+
+  virtual llvm::ErrorOr getCurrentWorkingDirectory() const {
+return InnerFS->getCurrentWorkingDirectory();
+  }
+
+  bool exists(const Twine ) {
+if (!isInsideWhitelistedDir(Path))
+  return false;
+return InnerFS->exists(Path);
+  }
+
+  std::error_code makeAbsolute(SmallVectorImpl ) const {
+return InnerFS->makeAbsolute(Path);
+  }
+
+private:
+  bool isInsideWhitelistedDir(const Twine ) const {
+SmallString<128> Path;
+InputPath.toVector(Path);
+
+if (makeAbsolute(Path))
+  return false;
+
+for (const auto  : WhitelistedDirs) {
+  if (Path.startswith(Dir))
+return true;
+}
+return false;
+  }
+
+  std::vector WhitelistedDirs;
+  IntrusiveRefCntPtr InnerFS;
+};
+
+/// Create a vfs::FileSystem that has access only to temporary directories
+/// (obtained by calling system_temp_directory).
+IntrusiveRefCntPtr getTempOnlyFS() {
+  llvm::SmallString<128> TmpDir1;
+  llvm::sys::path::system_temp_directory(/*erasedOnReboot=*/false, TmpDir1);
+  llvm::SmallString<128> TmpDir2;
+  llvm::sys::path::system_temp_directory(/*erasedOnReboot=*/true, TmpDir2);
+
+  std::vector TmpDirs;
+  TmpDirs.push_back(TmpDir1.str());
+  if (TmpDir2 != TmpDir2)
+TmpDirs.push_back(TmpDir2.str());
+  return new vfs::FilteredFileSystem(std::move(TmpDirs),
+ vfs::getRealFileSystem());
+}
+} // namespace vfs
+
+namespace clangd {
+namespace {
+
+class ErrorCheckingDiagConsumer : public DiagnosticsConsumer {
+public:
+  void onDiagnosticsReady(PathRef File,
+  std::vector Diagnostics) 

[PATCH] D33082: Fix Libc++ build with MinGW64

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked 6 inline comments as done.
EricWF added inline comments.



Comment at: include/__locale:370
 static const mask blank  = _ISblank;
-#elif defined(_LIBCPP_MSVCRT)
+#elif defined(_LIBCPP_WIN32API)
 typedef unsigned short mask;

compnerd wrote:
> Are these really Win32?  These are really more libc compatibility things I 
> thought?
So `_LIBCPP_MSVCRT_LIKE`?



Comment at: include/stdio.h:113
 // snprintf
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_WIN32API)
 extern "C" {

compnerd wrote:
> Again, I dont think that this is Win32 API related.  This is a libc 
> implementation detail.  If I were to build libc++ against musl and Win32, 
> these would be present, right?
Changing to `_LIBCPP_MSVCRT_LIKE`. 



Comment at: include/wchar.h:169
 
-#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT)
+#if defined(__cplusplus) && defined(_LIBCPP_WIN32API) // Needed in MinGW as 
well
 extern "C" {

compnerd wrote:
> Again not sure that this is Win32 API specific.
Changed to `_LIBCPP_MSVCRT_LIKE`.



Comment at: src/system_error.cpp:68
 
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_WIN32API)
 string do_strerror_r(int ev) {

compnerd wrote:
> I think that MSVCRT is more appropriate here.
Changed to `MSVCRT_LIKE`.


https://reviews.llvm.org/D33082



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


RE: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Keane, Erich via cfe-commits
No problem, I definitely think it was the right choice.

A change that contains all of what Melanie’s original patch did, plus the 
Header changes (plus the clang-tidy fixes that came out of this) would be 
acceptable?

Also, I believe she’s working on the warning as well.  We were discussing it, 
and I was thinking that if we track down where the operator-identification is 
done (hints as to where that is is appreciated), that we could simply warn if 
the user is using one of the Operators with operators off.  The warning itself 
could then be suppressed if necessary.

Thoughts?


From: Nico Weber [mailto:tha...@google.com]
Sent: Thursday, May 25, 2017 9:56 AM
To: Keane, Erich 
Cc: Blower, Melanie ; rnk ; 
cfe-commits ; Hans Wennborg 
Subject: Re: r303798 - For Microsoft compatibility, set fno_operator_names

On Thu, May 25, 2017 at 12:18 PM, Keane, Erich 
> wrote:
How does chromium compiler in CL?  It seems that it would have a similar 
problem here…

That's a good question! It looks like iso646.h is included, and in MSVC that 
contains something like `#define and &&`. But clang's lib/Headers/iso646.h 
assumes that the compiler provides this and doesn't define `and`. So for the 
reland, that header would have to check if the operator name is disabled, and 
if so, define it. (Or, better, maybe we can come up with something more 
targeted for the system header, similar to e.g. 
http://llvm.org/viewvc/llvm-project?view=revision=212238)

Thanks for the revert!


From: tha...@google.com 
[mailto:tha...@google.com] On Behalf Of Nico Weber
Sent: Thursday, May 25, 2017 9:16 AM
To: Blower, Melanie >
Cc: rnk >; Keane, Erich 
>; cfe-commits 
>; Hans Wennborg 
>

Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

In addition to this making clang-cl silently accept invalid code, it also 
breaks existing valid code, building chromium now fails. Let's revert and come 
up with something better asynchronously.

FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
E:\b\c\goma_client/gomacc.exe 
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo 
/showIncludes /FC 
@obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp /c 
../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp 
/Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj 
/Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,7):
  error: unknown type name 'definition'
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
  ^
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,18):
  error: variable declaration in condition must have an initializer
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
 ^
2 errors generated.


On May 24, 2017 4:01 PM, "Blower, Melanie" 
> wrote:
Thanks for the feedback, working on it…

From: Keane, Erich
Sent: Wednesday, May 24, 2017 3:47 PM
To: Nico Weber >; Blower, 
Melanie >

Cc: cfe-commits 
>; rnk 
>
Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

Adding Melanie, the author of the patch.

From: tha...@google.com [mailto:tha...@google.com] On 
Behalf Of Nico Weber
Sent: Wednesday, May 24, 2017 12:43 PM
To: Keane, Erich >
Cc: cfe-commits 
>; rnk 
>
Subject: Re: r303798 - For Microsoft compatibility, set fno_operator_names

Reviewed here: https://reviews.llvm.org/D33505

Still, please make this warn.

On Wed, May 24, 2017 at 3:42 PM, Nico Weber 
> wrote:
Was this reviewed somewhere?

Please make it so that this emits a warning. We want clang-cl to warn on 
invalid code (and in system headers warnings are suppressed).

On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits 
> wrote:
Author: erichkeane
Date: Wed May 24 14:31:19 2017
New Revision: 

RE: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Blower, Melanie via cfe-commits
Sometimes it’s possible to reason with the open source community, then they 
change their code and make modifications which accommodate the various 
compilers. E.g. we could ask chromium team if they could use the operator 
symbol instead of ‘and’.

From: Nico Weber [mailto:tha...@google.com]
Sent: Thursday, May 25, 2017 12:56 PM
To: Keane, Erich 
Cc: Blower, Melanie ; rnk ; 
cfe-commits ; Hans Wennborg 
Subject: Re: r303798 - For Microsoft compatibility, set fno_operator_names

On Thu, May 25, 2017 at 12:18 PM, Keane, Erich 
> wrote:
How does chromium compiler in CL?  It seems that it would have a similar 
problem here…

That's a good question! It looks like iso646.h is included, and in MSVC that 
contains something like `#define and &&`. But clang's lib/Headers/iso646.h 
assumes that the compiler provides this and doesn't define `and`. So for the 
reland, that header would have to check if the operator name is disabled, and 
if so, define it. (Or, better, maybe we can come up with something more 
targeted for the system header, similar to e.g. 
http://llvm.org/viewvc/llvm-project?view=revision=212238)

Thanks for the revert!


From: tha...@google.com 
[mailto:tha...@google.com] On Behalf Of Nico Weber
Sent: Thursday, May 25, 2017 9:16 AM
To: Blower, Melanie >
Cc: rnk >; Keane, Erich 
>; cfe-commits 
>; Hans Wennborg 
>

Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

In addition to this making clang-cl silently accept invalid code, it also 
breaks existing valid code, building chromium now fails. Let's revert and come 
up with something better asynchronously.

FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
E:\b\c\goma_client/gomacc.exe 
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo 
/showIncludes /FC 
@obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp /c 
../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp 
/Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj 
/Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,7):
  error: unknown type name 'definition'
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
  ^
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,18):
  error: variable declaration in condition must have an initializer
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
 ^
2 errors generated.


On May 24, 2017 4:01 PM, "Blower, Melanie" 
> wrote:
Thanks for the feedback, working on it…

From: Keane, Erich
Sent: Wednesday, May 24, 2017 3:47 PM
To: Nico Weber >; Blower, 
Melanie >

Cc: cfe-commits 
>; rnk 
>
Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

Adding Melanie, the author of the patch.

From: tha...@google.com [mailto:tha...@google.com] On 
Behalf Of Nico Weber
Sent: Wednesday, May 24, 2017 12:43 PM
To: Keane, Erich >
Cc: cfe-commits 
>; rnk 
>
Subject: Re: r303798 - For Microsoft compatibility, set fno_operator_names

Reviewed here: https://reviews.llvm.org/D33505

Still, please make this warn.

On Wed, May 24, 2017 at 3:42 PM, Nico Weber 
> wrote:
Was this reviewed somewhere?

Please make it so that this emits a warning. We want clang-cl to warn on 
invalid code (and in system headers warnings are suppressed).

On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits 
> wrote:
Author: erichkeane
Date: Wed May 24 14:31:19 2017
New Revision: 303798

URL: http://llvm.org/viewvc/llvm-project?rev=303798=rev
Log:
For Microsoft compatibility, set fno_operator_names

There's a Microsoft header in the Windows SDK which won't
compile with clang because it uses an operator name (and)
as a field name. This patch allows that file to compile by
setting the option which disables operator 

Re: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Nico Weber via cfe-commits
On Thu, May 25, 2017 at 12:18 PM, Keane, Erich 
wrote:

> How does chromium compiler in CL?  It seems that it would have a similar
> problem here…
>

That's a good question! It looks like iso646.h is included, and in MSVC
that contains something like `#define and &&`. But clang's
lib/Headers/iso646.h assumes that the compiler provides this and doesn't
define `and`. So for the reland, that header would have to check if the
operator name is disabled, and if so, define it. (Or, better, maybe we can
come up with something more targeted for the system header, similar to e.g.
http://llvm.org/viewvc/llvm-project?view=revision=212238)

Thanks for the revert!


>
>
> *From:* tha...@google.com [mailto:tha...@google.com] *On Behalf Of *Nico
> Weber
> *Sent:* Thursday, May 25, 2017 9:16 AM
> *To:* Blower, Melanie 
> *Cc:* rnk ; Keane, Erich ;
> cfe-commits ; Hans Wennborg  >
>
> *Subject:* RE: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> In addition to this making clang-cl silently accept invalid code, it also
> breaks existing valid code, building chromium now fails. Let's revert and
> come up with something better asynchronously.
>
>
>
> FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
>
>
> E:\b\c\goma_client/gomacc.exe ../../third_party/llvm-build/R
> elease+Asserts/bin/clang-cl.exe /nologo /showIncludes /FC
> @obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp
> /c ../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
> /Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
> /Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
>
> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\cu
> stom\CustomElementRegistry.cpp(229,7):  error: unknown type name
> 'definition'
>
>   if (definition and definition->Descriptor().LocalName() ==
> desc.LocalName()) {
>
>   ^
>
> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\cu
> stom\CustomElementRegistry.cpp(229,18):  error: variable declaration in
> condition must have an initializer
>
>   if (definition and definition->Descriptor().LocalName() ==
> desc.LocalName()) {
>
>  ^
>
> 2 errors generated.
>
>
>
>
>
> On May 24, 2017 4:01 PM, "Blower, Melanie" 
> wrote:
>
> Thanks for the feedback, working on it…
>
>
>
> *From:* Keane, Erich
> *Sent:* Wednesday, May 24, 2017 3:47 PM
> *To:* Nico Weber ; Blower, Melanie <
> melanie.blo...@intel.com>
>
>
> *Cc:* cfe-commits ; rnk 
>
> *Subject:* RE: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> Adding Melanie, the author of the patch.
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com ] *On
> Behalf Of *Nico Weber
> *Sent:* Wednesday, May 24, 2017 12:43 PM
> *To:* Keane, Erich 
> *Cc:* cfe-commits ; rnk 
> *Subject:* Re: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> Reviewed here: https://reviews.llvm.org/D33505
>
>
> Still, please make this warn.
>
>
>
> On Wed, May 24, 2017 at 3:42 PM, Nico Weber  wrote:
>
> Was this reviewed somewhere?
>
>
>
> Please make it so that this emits a warning. We want clang-cl to warn on
> invalid code (and in system headers warnings are suppressed).
>
>
>
> On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: erichkeane
> Date: Wed May 24 14:31:19 2017
> New Revision: 303798
>
> URL: http://llvm.org/viewvc/llvm-project?rev=303798=rev
> Log:
> For Microsoft compatibility, set fno_operator_names
>
> There's a Microsoft header in the Windows SDK which won't
> compile with clang because it uses an operator name (and)
> as a field name. This patch allows that file to compile by
> setting the option which disables operator names.
> The header which doesn't compile  C:/Program Files (x86)/
> Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
> error: expected member name or ';' after declaration specifiers
>
>   /* [case()] */ NODERESTRICTION or;
>~~~ ^
>
>1 error generated.
>
> Contributed for Melanie Blower
>
> Differential Revision:https://reviews.llvm.org/D33505
>
> Modified:
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/test/Parser/MicrosoftExtensions.cpp
> cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/
> CompilerInvocation.cpp?rev=303798=303797=303798=diff
> 
> ==
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp 

RE: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Keane, Erich via cfe-commits
Patch and Buildbot fixes all reverted as of –r303882.  Sorry for the thrash.

From: tha...@google.com [mailto:tha...@google.com] On Behalf Of Nico Weber
Sent: Thursday, May 25, 2017 9:16 AM
To: Blower, Melanie 
Cc: rnk ; Keane, Erich ; cfe-commits 
; Hans Wennborg 
Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

In addition to this making clang-cl silently accept invalid code, it also 
breaks existing valid code, building chromium now fails. Let's revert and come 
up with something better asynchronously.

FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
E:\b\c\goma_client/gomacc.exe 
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo 
/showIncludes /FC 
@obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp /c 
../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp 
/Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj 
/Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,7):
  error: unknown type name 'definition'
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
  ^
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,18):
  error: variable declaration in condition must have an initializer
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
 ^
2 errors generated.


On May 24, 2017 4:01 PM, "Blower, Melanie" 
> wrote:
Thanks for the feedback, working on it…

From: Keane, Erich
Sent: Wednesday, May 24, 2017 3:47 PM
To: Nico Weber >; Blower, 
Melanie >

Cc: cfe-commits 
>; rnk 
>
Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

Adding Melanie, the author of the patch.

From: tha...@google.com [mailto:tha...@google.com] On 
Behalf Of Nico Weber
Sent: Wednesday, May 24, 2017 12:43 PM
To: Keane, Erich >
Cc: cfe-commits 
>; rnk 
>
Subject: Re: r303798 - For Microsoft compatibility, set fno_operator_names

Reviewed here: https://reviews.llvm.org/D33505

Still, please make this warn.

On Wed, May 24, 2017 at 3:42 PM, Nico Weber 
> wrote:
Was this reviewed somewhere?

Please make it so that this emits a warning. We want clang-cl to warn on 
invalid code (and in system headers warnings are suppressed).

On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits 
> wrote:
Author: erichkeane
Date: Wed May 24 14:31:19 2017
New Revision: 303798

URL: http://llvm.org/viewvc/llvm-project?rev=303798=rev
Log:
For Microsoft compatibility, set fno_operator_names

There's a Microsoft header in the Windows SDK which won't
compile with clang because it uses an operator name (and)
as a field name. This patch allows that file to compile by
setting the option which disables operator names.
The header which doesn't compile  C:/Program Files (x86)/
Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
error: expected member name or ';' after declaration specifiers

  /* [case()] */ NODERESTRICTION or;
   ~~~ ^

   1 error generated.

Contributed for Melanie Blower

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

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.cpp
cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=303798=303797=303798=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 24 14:31:19 2017
@@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions 
   Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
   Opts.GNUKeywords);

-  if (Args.hasArg(OPT_fno_operator_names))
+  if (Args.hasArg(OPT_fno_operator_names) || 
Args.hasArg(OPT_fms_compatibility))
 Opts.CXXOperatorNames = 0;

   if (Args.hasArg(OPT_fcuda_is_device))

Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
URL: 

r303882 - Revert MSVC CXXOperatorNames patch due to issues with Chromium

2017-05-25 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 25 11:24:49 2017
New Revision: 303882

URL: http://llvm.org/viewvc/llvm-project?rev=303882=rev
Log:
Revert MSVC CXXOperatorNames patch due to issues with Chromium

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.cpp
cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=303882=303881=303882=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu May 25 11:24:49 2017
@@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions 
   Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
   Opts.GNUKeywords);
 
-  if (Args.hasArg(OPT_fno_operator_names) || 
Args.hasArg(OPT_fms_compatibility))
+  if (Args.hasArg(OPT_fno_operator_names))
 Opts.CXXOperatorNames = 0;
 
   if (Args.hasArg(OPT_fcuda_is_device))

Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.cpp?rev=303882=303881=303882=diff
==
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Thu May 25 11:24:49 2017
@@ -261,8 +261,9 @@ int __identifier(else} = __identifier(fo
 #define identifier_weird(x) __identifier(x
 int k = identifier_weird(if)); // expected-error {{use of undeclared 
identifier 'if'}}
 
-// 'and' is not an operator name with Microsoft compatibility.
-extern int __identifier(and) r; // expected-error {{expected ';' after top 
level declarator}}
+// This is a bit weird, but the alternative tokens aren't keywords, and this
+// behavior matches MSVC. FIXME: Consider supporting this anyway.
+extern int __identifier(and) r; // expected-error {{cannot convert '&&' token 
to an identifier}}
 
 void f() {
   __identifier(() // expected-error {{cannot convert '(' token to an 
identifier}}
@@ -354,6 +355,7 @@ void TestProperty() {
   ++sp.V11;
 }
 
+//expected-warning@+1 {{C++ operator 'and' (aka '&&') used as a macro name}}
 #define and foo
 
 struct __declspec(uuid("---C000-0046")) 
__declspec(novtable) IUnknown {};

Modified: cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp?rev=303882=303881=303882=diff
==
--- cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp (original)
+++ cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp Thu May 25 11:24:49 2017
@@ -1,6 +1,5 @@
 // RUN: %clang_cc1 %s -E -verify -DOPERATOR_NAMES
 // RUN: %clang_cc1 %s -E -verify -fno-operator-names
-// RUN: %clang_cc1 %s-verify -DTESTWIN -fms-compatibility
 
 #ifndef OPERATOR_NAMES
 //expected-error@+3 {{token is not a valid binary operator in a preprocessor 
subexpression}}
@@ -30,14 +29,3 @@
 #ifdef and
 #warning and is defined
 #endif
-
-#ifdef TESTWIN
-// For cl compatibility, fno-operator-names is enabled by default.
-int and;
-int bitand;
-int bitor;
-int compl;
-int not;
-int or;
-int xor;
-#endif


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


[clang-tools-extra] r303881 - Revert 303872/303877 since the patch that caused these issues

2017-05-25 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 25 11:23:00 2017
New Revision: 303881

URL: http://llvm.org/viewvc/llvm-project?rev=303881=rev
Log:
Revert 303872/303877 since the patch that caused these issues 
is also being reverted.

Modified:

clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp?rev=303881=303880=303881=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
 (original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
 Thu May 25 11:23:00 2017
@@ -2,7 +2,7 @@
 // RUN: -config='{CheckOptions: \
 // RUN:  [{key: readability-implicit-bool-cast.AllowConditionalIntegerCasts, 
value: 1}, \
 // RUN:   {key: readability-implicit-bool-cast.AllowConditionalPointerCasts, 
value: 1}]}' \
-// RUN: -- -std=c++11 -fno-ms-compatibility
+// RUN: -- -std=c++11
 
 template
 void functionTaking(T);

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp?rev=303881=303880=303881=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
Thu May 25 11:23:00 2017
@@ -264,7 +264,7 @@ void implicitCastInNegationExpressions()
   // CHECK-FIXES: bool boolComingFromNegatedChar = (character == 0);
 
   int* pointer = nullptr;
-  bool boolComingFromNegatedPointer = ! pointer;
+  bool boolComingFromNegatedPointer = not  pointer;
   // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: implicit cast 'int *' -> bool
   // CHECK-FIXES: bool boolComingFromNegatedPointer = pointer == nullptr;
 }


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


r303880 - Relax testcase to appease buildbots

2017-05-25 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu May 25 11:20:51 2017
New Revision: 303880

URL: http://llvm.org/viewvc/llvm-project?rev=303880=rev
Log:
Relax testcase to appease buildbots

When lld isn't built, the tests as they were previously, were too picky about
the path to the linker.

Modified:
cfe/trunk/test/Driver/baremetal.cpp

Modified: cfe/trunk/test/Driver/baremetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/baremetal.cpp?rev=303880=303879=303880=diff
==
--- cfe/trunk/test/Driver/baremetal.cpp (original)
+++ cfe/trunk/test/Driver/baremetal.cpp Thu May 25 11:20:51 2017
@@ -10,7 +10,7 @@
 // CHECK-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]/include/c++/v1"
 // CHECk-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]/include"
 // CHECK-V6M-C-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
-// CHECK-V6M-C-NEXT: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-C-NEXT: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
 // CHECK-V6M-C-SAME: "-L[[PREFIX_DIR]]/lib/clang/[[VERSION]]/lib/baremetal"
 // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome/directory/user/asked/for"
 // CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
@@ -32,8 +32,8 @@
 // RUN: -target armv6m-none-eabi \
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-DEFAULTCXX %s
-// CHECK-V6M-DEFAULTCXX: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-DEFAULTCXX-SAME: "-L[[PREFIX_DIR]]/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
@@ -45,8 +45,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-LIBCXX %s
 // CHECK-V6M-LIBCXX-NOT: "-internal-isystem" "{{[^"]+}}/include/c++/{{[^v].*}}"
 // CHECK-V6M-LIBCXX: "-internal-isystem" "{{[^"]+}}/include/c++/v1"
-// CHECK-V6M-LIBCXX: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-LIBCXX-SAME: "-L[[PREFIX_DIR]]/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-LIBCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
 // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
 // CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o"
@@ -58,8 +58,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-LIBSTDCXX %s
 // CHECK-V6M-LIBSTDCXX-NOT: "-internal-isystem" "{{[^"]+}}/include/c++/v1"
 // CHECK-V6M-LIBSTDCXX: "-internal-isystem" "{{[^"]+}}/include/c++/6.0.0"
-// CHECK-V6M-LIBSTDCXX: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-LIBSTDCXX-SAME: "-L[[PREFIX_DIR]]/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-LIBSTDCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
@@ -69,8 +69,8 @@
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN: -nodefaultlibs \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-NDL %s
-// CHECK-V6M-NDL: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-NDL-SAME: "-L[[PREFIX_DIR]]/lib/clang/{{.*}}/lib/baremetal" "-o" 
"{{.*}}.o"
+// CHECK-V6M-NDL: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-NDL-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal" "-o" 
"{{.*}}.o"
 
 // RUN: %clangxx -target arm-none-eabi -v 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-THREAD-MODEL


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


RE: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Keane, Erich via cfe-commits
How does chromium compiler in CL?  It seems that it would have a similar 
problem here…

From: tha...@google.com [mailto:tha...@google.com] On Behalf Of Nico Weber
Sent: Thursday, May 25, 2017 9:16 AM
To: Blower, Melanie 
Cc: rnk ; Keane, Erich ; cfe-commits 
; Hans Wennborg 
Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

In addition to this making clang-cl silently accept invalid code, it also 
breaks existing valid code, building chromium now fails. Let's revert and come 
up with something better asynchronously.

FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
E:\b\c\goma_client/gomacc.exe 
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo 
/showIncludes /FC 
@obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp /c 
../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp 
/Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj 
/Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,7):
  error: unknown type name 'definition'
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
  ^
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,18):
  error: variable declaration in condition must have an initializer
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
 ^
2 errors generated.


On May 24, 2017 4:01 PM, "Blower, Melanie" 
> wrote:
Thanks for the feedback, working on it…

From: Keane, Erich
Sent: Wednesday, May 24, 2017 3:47 PM
To: Nico Weber >; Blower, 
Melanie >

Cc: cfe-commits 
>; rnk 
>
Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

Adding Melanie, the author of the patch.

From: tha...@google.com [mailto:tha...@google.com] On 
Behalf Of Nico Weber
Sent: Wednesday, May 24, 2017 12:43 PM
To: Keane, Erich >
Cc: cfe-commits 
>; rnk 
>
Subject: Re: r303798 - For Microsoft compatibility, set fno_operator_names

Reviewed here: https://reviews.llvm.org/D33505

Still, please make this warn.

On Wed, May 24, 2017 at 3:42 PM, Nico Weber 
> wrote:
Was this reviewed somewhere?

Please make it so that this emits a warning. We want clang-cl to warn on 
invalid code (and in system headers warnings are suppressed).

On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits 
> wrote:
Author: erichkeane
Date: Wed May 24 14:31:19 2017
New Revision: 303798

URL: http://llvm.org/viewvc/llvm-project?rev=303798=rev
Log:
For Microsoft compatibility, set fno_operator_names

There's a Microsoft header in the Windows SDK which won't
compile with clang because it uses an operator name (and)
as a field name. This patch allows that file to compile by
setting the option which disables operator names.
The header which doesn't compile  C:/Program Files (x86)/
Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
error: expected member name or ';' after declaration specifiers

  /* [case()] */ NODERESTRICTION or;
   ~~~ ^

   1 error generated.

Contributed for Melanie Blower

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

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.cpp
cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=303798=303797=303798=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 24 14:31:19 2017
@@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions 
   Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
   Opts.GNUKeywords);

-  if (Args.hasArg(OPT_fno_operator_names))
+  if (Args.hasArg(OPT_fno_operator_names) || 
Args.hasArg(OPT_fms_compatibility))
 Opts.CXXOperatorNames = 0;

   if (Args.hasArg(OPT_fcuda_is_device))

Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
URL: 

RE: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Nico Weber via cfe-commits
In addition to this making clang-cl silently accept invalid code, it also
breaks existing valid code, building chromium now fails. Let's revert and
come up with something better asynchronously.

FAILED:
obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
E:\b\c\goma_client/gomacc.exe
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo
/showIncludes /FC
@obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp
/c
../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
/Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
/Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,7):
error: unknown type name 'definition' if (definition and
definition->Descriptor().LocalName() == desc.LocalName()) { ^
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,18):
error: variable declaration in condition must have an initializer if
(definition and definition->Descriptor().LocalName() == desc.LocalName()) {
^ 2 errors generated.

On May 24, 2017 4:01 PM, "Blower, Melanie"  wrote:

Thanks for the feedback, working on it…



*From:* Keane, Erich
*Sent:* Wednesday, May 24, 2017 3:47 PM
*To:* Nico Weber ; Blower, Melanie <
melanie.blo...@intel.com>

*Cc:* cfe-commits ; rnk 
*Subject:* RE: r303798 - For Microsoft compatibility, set fno_operator_names



Adding Melanie, the author of the patch.



*From:* tha...@google.com [mailto:tha...@google.com ] *On
Behalf Of *Nico Weber
*Sent:* Wednesday, May 24, 2017 12:43 PM
*To:* Keane, Erich 
*Cc:* cfe-commits ; rnk 
*Subject:* Re: r303798 - For Microsoft compatibility, set fno_operator_names



Reviewed here: https://reviews.llvm.org/D33505


Still, please make this warn.



On Wed, May 24, 2017 at 3:42 PM, Nico Weber  wrote:

Was this reviewed somewhere?



Please make it so that this emits a warning. We want clang-cl to warn on
invalid code (and in system headers warnings are suppressed).



On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

Author: erichkeane
Date: Wed May 24 14:31:19 2017
New Revision: 303798

URL: http://llvm.org/viewvc/llvm-project?rev=303798=rev
Log:
For Microsoft compatibility, set fno_operator_names

There's a Microsoft header in the Windows SDK which won't
compile with clang because it uses an operator name (and)
as a field name. This patch allows that file to compile by
setting the option which disables operator names.
The header which doesn't compile  C:/Program Files (x86)/
Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
error: expected member name or ';' after declaration specifiers

  /* [case()] */ NODERESTRICTION or;
   ~~~ ^

   1 error generated.

Contributed for Melanie Blower

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

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.cpp
cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/
Frontend/CompilerInvocation.cpp?rev=303798=303797=303798=diff

==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 24 14:31:19 2017
@@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions 
   Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
   Opts.GNUKeywords);

-  if (Args.hasArg(OPT_fno_operator_names))
+  if (Args.hasArg(OPT_fno_operator_names) || Args.hasArg(OPT_fms_
compatibility))
 Opts.CXXOperatorNames = 0;

   if (Args.hasArg(OPT_fcuda_is_device))

Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/
MicrosoftExtensions.cpp?rev=303798=303797=303798=diff

==
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Wed May 24 14:31:19 2017
@@ -261,9 +261,8 @@ int __identifier(else} = __identifier(fo
 #define identifier_weird(x) __identifier(x
 int k = identifier_weird(if)); // expected-error {{use of undeclared
identifier 'if'}}

-// This is a bit weird, but the alternative tokens aren't keywords, and
this
-// behavior matches MSVC. FIXME: Consider supporting this anyway.
-extern int __identifier(and) r; // expected-error {{cannot convert '&&'
token to an identifier}}
+// 'and' is not an operator name with Microsoft 

[libcxx] r303878 - Fix a test that was failing in C++11 mode introduced in r303874

2017-05-25 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Thu May 25 11:16:17 2017
New Revision: 303878

URL: http://llvm.org/viewvc/llvm-project?rev=303878=rev
Log:
Fix a test that was failing in C++11 mode introduced in r303874

Modified:

libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp

Modified: 
libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp?rev=303878=303877=303878=diff
==
--- 
libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
 Thu May 25 11:16:17 2017
@@ -1,3 +1,5 @@
+// UNSUPPORTED: c++98, c++03
+
 #include 
 
 template  struct Tag {};
@@ -21,7 +23,9 @@ struct Deleter {
   void operator()(Tp) const {
 using RawT = typename std::remove_pointer::type;
 static_assert(std::is_function::value ||
-  std::is_null_pointer::value, "");
+  std::is_same::type,
+   std::nullptr_t>::value,
+  "");
   }
 };
 


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


[clang-tools-extra] r303877 - Clang-tidy doesn't understand -fno-ms-compatibility, so just removing 'not'

2017-05-25 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 25 11:07:19 2017
New Revision: 303877

URL: http://llvm.org/viewvc/llvm-project?rev=303877=rev
Log:
Clang-tidy doesn't understand -fno-ms-compatibility, so just removing 'not' 

Modified:
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp?rev=303877=303876=303877=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
Thu May 25 11:07:19 2017
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s -fno-ms-compatibility 
readability-implicit-bool-cast %t
+// RUN: %check_clang_tidy %s readability-implicit-bool-cast %t
 
 // We need NULL macro, but some buildbots don't like including  header
 // This is a portable way of getting it to work
@@ -264,7 +264,7 @@ void implicitCastInNegationExpressions()
   // CHECK-FIXES: bool boolComingFromNegatedChar = (character == 0);
 
   int* pointer = nullptr;
-  bool boolComingFromNegatedPointer = not pointer;
+  bool boolComingFromNegatedPointer = ! pointer;
   // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: implicit cast 'int *' -> bool
   // CHECK-FIXES: bool boolComingFromNegatedPointer = pointer == nullptr;
 }


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


[libcxx] r303876 - Mark LWG#2900 as complete - we already do this, and I checked the tests in a couple days ago (r303268 & r303824)

2017-05-25 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 25 11:05:54 2017
New Revision: 303876

URL: http://llvm.org/viewvc/llvm-project?rev=303876=rev
Log:
Mark LWG#2900 as complete - we already do this, and I checked the tests in a 
couple days ago (r303268 & r303824)

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=303876=303875=303876=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu May 25 11:05:54 2017
@@ -475,7 +475,7 @@
http://wg21.link/LWG2876;>2876shared_ptr::shared_ptr(const 
weak_ptrY) constructor should be 
constrainedKona
http://wg21.link/LWG2878;>2878Missing 
DefaultConstructible requirement for istream_iterator default 
constructorKona
http://wg21.link/LWG2890;>2890The 
definition of 'object state' applies only to class 
typesKonaComplete
-   http://wg21.link/LWG2900;>2900The copy 
and move constructors of optional are not 
constexprKona
+   http://wg21.link/LWG2900;>2900The copy 
and move constructors of optional are not 
constexprKonaComplete
http://wg21.link/LWG2903;>2903The form of 
initialization for the emplace-constructors is not 
specifiedKona
http://wg21.link/LWG2904;>2904Make 
variant move-assignment more exception safeKona
http://wg21.link/LWG2905;>2905is_constructible_vunique_ptrP,
 D, P, D const  should be false when D is not copy 
constructibleKonaComplete
@@ -489,7 +489,7 @@
 
   
 
-  Last Updated: 23-May-2017
+  Last Updated: 25-May-2017
 
 
 


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


[PATCH] D30837: [libcxx] Support for shared_ptr<T()>

2017-05-25 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303874: Add support for shared_ptr (authored 
by epilk).

Changed prior to commit:
  https://reviews.llvm.org/D30837?vs=97313=100251#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30837

Files:
  libcxx/trunk/include/memory
  
libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
  
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Index: libcxx/trunk/include/memory
===
--- libcxx/trunk/include/memory
+++ libcxx/trunk/include/memory
@@ -2251,6 +2251,8 @@
 
 template 
 struct _LIBCPP_TEMPLATE_VIS default_delete {
+static_assert(!is_function<_Tp>::value,
+  "default_delete cannot be instantiated for function types");
 #ifndef _LIBCPP_CXX03_LANG
   _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
 #else
@@ -3653,6 +3655,18 @@
 __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 
+struct __shared_ptr_dummy_rebind_allocator_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type>
+{
+public:
+template 
+struct rebind
+{
+typedef allocator<_Other> other;
+};
+};
+
 template class _LIBCPP_TEMPLATE_VIS enable_shared_from_this;
 
 template
@@ -3921,6 +3935,17 @@
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
 private:
+template ::value>
+struct __shared_ptr_default_allocator
+{
+typedef allocator<_Yp> type;
+};
+
+template 
+struct __shared_ptr_default_allocator<_Yp, true>
+{
+typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type;
+};
 
 template 
 _LIBCPP_INLINE_VISIBILITY
@@ -3939,8 +3964,7 @@
 }
 }
 
-_LIBCPP_INLINE_VISIBILITY
-void __enable_weak_this(const volatile void*, const volatile void*) _NOEXCEPT {}
+_LIBCPP_INLINE_VISIBILITY void __enable_weak_this(...) _NOEXCEPT {}
 
 template  friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
 template  friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
@@ -3972,8 +3996,9 @@
 : __ptr_(__p)
 {
 unique_ptr<_Yp> __hold(__p);
-typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), _AllocT());
 __hold.release();
 __enable_weak_this(__p, __p);
 }
@@ -3988,8 +4013,9 @@
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, __d, allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
 __enable_weak_this(__p, __p);
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
@@ -4010,8 +4036,9 @@
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-typedef __shared_ptr_pointer > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, __d, allocator<_Tp>());
+typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
+typedef __shared_ptr_pointer _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
 catch (...)
@@ -4179,8 +4206,9 @@
 else
 #endif
 {
-typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT());
 __enable_weak_this(__r.get(), __r.get());
 }
 __r.release();
@@ -4208,10 +4236,11 @@
 else
 #endif
 {
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
 typedef __shared_ptr_pointer<_Yp*,
  reference_wrapper::type>,
- allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), allocator<_Yp>());
+ _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), _AllocT());
 __enable_weak_this(__r.get(), __r.get());
 }
 __r.release();
Index: 

[libcxx] r303874 - Add support for shared_ptr

2017-05-25 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Thu May 25 10:43:31 2017
New Revision: 303874

URL: http://llvm.org/viewvc/llvm-project?rev=303874=rev
Log:
Add support for shared_ptr

Fixes PR27566.

Differential revision: https://reviews.llvm.org/D30837

Added:

libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/

libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
Modified:
libcxx/trunk/include/memory

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=303874=303873=303874=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Thu May 25 10:43:31 2017
@@ -2251,6 +2251,8 @@ void swap(__compressed_pair<_T1, _T2>& _
 
 template 
 struct _LIBCPP_TEMPLATE_VIS default_delete {
+static_assert(!is_function<_Tp>::value,
+  "default_delete cannot be instantiated for function types");
 #ifndef _LIBCPP_CXX03_LANG
   _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
 #else
@@ -3653,6 +3655,18 @@ __shared_ptr_emplace<_Tp, _Alloc>::__on_
 __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 
+struct __shared_ptr_dummy_rebind_allocator_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type>
+{
+public:
+template 
+struct rebind
+{
+typedef allocator<_Other> other;
+};
+};
+
 template class _LIBCPP_TEMPLATE_VIS enable_shared_from_this;
 
 template
@@ -3921,6 +3935,17 @@ public:
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
 private:
+template ::value>
+struct __shared_ptr_default_allocator
+{
+typedef allocator<_Yp> type;
+};
+
+template 
+struct __shared_ptr_default_allocator<_Yp, true>
+{
+typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type;
+};
 
 template 
 _LIBCPP_INLINE_VISIBILITY
@@ -3939,8 +3964,7 @@ private:
 }
 }
 
-_LIBCPP_INLINE_VISIBILITY
-void __enable_weak_this(const volatile void*, const volatile void*) 
_NOEXCEPT {}
+_LIBCPP_INLINE_VISIBILITY void __enable_weak_this(...) _NOEXCEPT {}
 
 template  friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
 template  friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
@@ -3972,8 +3996,9 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p,
 : __ptr_(__p)
 {
 unique_ptr<_Yp> __hold(__p);
-typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > 
_CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, _AllocT > 
_CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), _AllocT());
 __hold.release();
 __enable_weak_this(__p, __p);
 }
@@ -3988,8 +4013,9 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _D
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, __d, allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
 __enable_weak_this(__p, __p);
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
@@ -4010,8 +4036,9 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-typedef __shared_ptr_pointer > 
_CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, __d, allocator<_Tp>());
+typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
+typedef __shared_ptr_pointer _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
 catch (...)
@@ -4179,8 +4206,9 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_
 else
 #endif
 {
-typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), 
allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT());
 __enable_weak_this(__r.get(), __r.get());
 }
 __r.release();
@@ -4208,10 +4236,11 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_
 else
 #endif
 {
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
 typedef __shared_ptr_pointer<_Yp*,
  reference_wrapper::type>,

[PATCH] D33259: Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs closed this revision.
jroelofs added a comment.

r303873


https://reviews.llvm.org/D33259



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


r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu May 25 10:42:13 2017
New Revision: 303873

URL: http://llvm.org/viewvc/llvm-project?rev=303873=rev
Log:
Don't defer to the GCC driver for linking arm-baremetal

Also comes with a cmake cache for building the runtime bits:

 $ cmake  \
   -DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
   -C /path/to/clang/cmake/caches/BaremetalARM.cmake \
   /path/to/llvm

https://reviews.llvm.org/D33259

Added:
cfe/trunk/cmake/caches/BaremetalARM.cmake
cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
cfe/trunk/lib/Driver/ToolChains/BareMetal.h
cfe/trunk/test/Driver/Inputs/baremetal_arm/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
cfe/trunk/test/Driver/baremetal.cpp
Modified:
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/lib/Driver/ToolChains/Linux.cpp
cfe/trunk/test/Frontend/gnu-mcount.c

Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/BaremetalARM.cmake?rev=303873=auto
==
--- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
+++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
@@ -0,0 +1,50 @@
+set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
+
+# Builtins
+set(LLVM_BUILTIN_TARGETS "armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi" 
CACHE STRING "Builtin Targets")
+
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV6M_SYSROOT} CACHE 
STRING "armv6m-none-eabi Sysroot")
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING 
"armv6m-none-eabi System Name")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL 
"armv6m-none-eabi Baremetal build")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING 
"armv6m-none-eabi os dir")
+
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7M_SYSROOT} CACHE 
STRING "armv7m-none-eabi Sysroot")
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING 
"armv7m-none-eabi System Name")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL 
"armv7m-none-eabi Baremetal build")
+set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE STRING 
"armv7m-none-eabi C Flags")
+set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE STRING 
"armv7m-none-eabi ASM Flags")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING 
"armv7m-none-eabi os dir")
+
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7EM_SYSROOT} 
CACHE STRING "armv7em-none-eabi Sysroot")
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING 
"armv7em-none-eabi System Name")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL 
"armv7em-none-eabi Baremetal build")
+set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE STRING 
"armv7em-none-eabi C Flags")
+set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE STRING 
"armv7em-none-eabi ASM Flags")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING 
"armv7em-none-eabi os dir")
+
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+set(LLVM_TOOLCHAIN_TOOLS
+  llc
+  llvm-ar
+  llvm-cxxfilt
+  llvm-dwarfdump
+  llvm-dsymutil
+  llvm-nm
+  llvm-objdump
+  llvm-ranlib
+  llvm-readobj
+  llvm-size
+  llvm-symbolizer
+  opt
+  CACHE STRING "")
+
+set(LLVM_DISTRIBUTION_COMPONENTS
+  clang
+  lld
+  clang-headers
+  builtins-armv6m-none-eabi
+  builtins-armv7m-none-eabi
+  builtins-armv7em-none-eabi
+  runtimes
+  ${LLVM_TOOLCHAIN_TOOLS}
+  CACHE STRING "")

Modified: cfe/trunk/lib/Driver/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=303873=303872=303873=diff
==
--- cfe/trunk/lib/Driver/CMakeLists.txt (original)
+++ cfe/trunk/lib/Driver/CMakeLists.txt Thu May 25 10:42:13 2017
@@ -30,6 +30,7 @@ add_clang_library(clangDriver
   ToolChains/AMDGPU.cpp
   ToolChains/AVR.cpp
   ToolChains/Bitrig.cpp
+  ToolChains/BareMetal.cpp
   ToolChains/Clang.cpp
   ToolChains/CloudABI.cpp
   ToolChains/CommonArgs.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=303873=303872=303873=diff

[clang-tools-extra] r303872 - Disable MSVC-Compat mode for two tests that use C++Operator Names

2017-05-25 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 25 10:39:24 2017
New Revision: 303872

URL: http://llvm.org/viewvc/llvm-project?rev=303872=rev
Log:
Disable MSVC-Compat mode for two tests that use C++Operator Names

MSVC doesn't support C++ operator names (using 'or' instead of ||, 
'not' instead of '!', etc), so this was disabled in MSVC mode in r303798.
This fixes the regression noticed on the buildbots.

Modified:

clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp?rev=303872=303871=303872=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
 (original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
 Thu May 25 10:39:24 2017
@@ -2,7 +2,7 @@
 // RUN: -config='{CheckOptions: \
 // RUN:  [{key: readability-implicit-bool-cast.AllowConditionalIntegerCasts, 
value: 1}, \
 // RUN:   {key: readability-implicit-bool-cast.AllowConditionalPointerCasts, 
value: 1}]}' \
-// RUN: -- -std=c++11
+// RUN: -- -std=c++11 -fno-ms-compatibility
 
 template
 void functionTaking(T);

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp?rev=303872=303871=303872=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
Thu May 25 10:39:24 2017
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s readability-implicit-bool-cast %t
+// RUN: %check_clang_tidy %s -fno-ms-compatibility 
readability-implicit-bool-cast %t
 
 // We need NULL macro, but some buildbots don't like including  header
 // This is a portable way of getting it to work


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


r303871 - Make git-clang-format python 3 compatible

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 10:24:04 2017
New Revision: 303871

URL: http://llvm.org/viewvc/llvm-project?rev=303871=rev
Log:
Make git-clang-format python 3 compatible

Summary: This patch attempts to make `git-clang-format` both python2 and 
python3 compatible. Currently it only works in python2.

Reviewers: modocache, compnerd, djasper, jbcoe, srhines, ddunbar

Reviewed By: jbcoe

Subscribers: kimgr, mgorny, llvm-commits, cfe-commits

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

Modified:
cfe/trunk/tools/clang-format/git-clang-format

Modified: cfe/trunk/tools/clang-format/git-clang-format
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/git-clang-format?rev=303871=303870=303871=diff
==
--- cfe/trunk/tools/clang-format/git-clang-format (original)
+++ cfe/trunk/tools/clang-format/git-clang-format Thu May 25 10:24:04 2017
@@ -20,7 +20,7 @@ clang-format on the changes in current f
 For further details, run:  
  
 git clang-format -h
  

  
-Requires Python 2.7
  
+Requires Python 2.7 or Python 3
  
 """   
 
 from __future__ import print_function
@@ -258,7 +258,7 @@ def get_object_type(value):
   stdout, stderr = p.communicate()
   if p.returncode != 0:
 return None
-  return stdout.strip()
+  return convert_string(stdout.strip())
 
 
 def compute_diff_and_extract_lines(commits, files):
@@ -301,6 +301,7 @@ def extract_lines(patch_file):
   list of line `Range`s."""
   matches = {}
   for line in patch_file:
+line = convert_string(line)
 match = re.search(r'^\+\+\+\ [^/]+/(.*)', line)
 if match:
   filename = match.group(1).rstrip('\r\n')
@@ -385,7 +386,7 @@ def create_tree(input_lines, mode):
   with temporary_index_file():
 p = subprocess.Popen(cmd, stdin=subprocess.PIPE)
 for line in input_lines:
-  p.stdin.write('%s\0' % line)
+  p.stdin.write(to_bytes('%s\0' % line))
 p.stdin.close()
 if p.wait() != 0:
   die('`%s` failed' % ' '.join(cmd))
@@ -440,7 +441,7 @@ def clang_format_to_blob(filename, line_
 die('`%s` failed' % ' '.join(clang_format_cmd))
   if git_show and git_show.wait() != 0:
 die('`%s` failed' % ' '.join(git_show_cmd))
-  return stdout.rstrip('\r\n')
+  return convert_string(stdout).rstrip('\r\n')
 
 
 @contextlib.contextmanager
@@ -527,6 +528,10 @@ def run(*args, **kwargs):
   p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
   stdout, stderr = p.communicate(input=stdin)
+
+  stdout = convert_string(stdout)
+  stderr = convert_string(stderr)
+
   if p.returncode == 0:
 if stderr:
   if verbose:
@@ -547,5 +552,26 @@ def die(message):
   sys.exit(2)
 
 
+def to_bytes(str_input):
+# Encode to UTF-8 to get binary data.
+if isinstance(str_input, bytes):
+return str_input
+return str_input.encode('utf-8')
+
+
+def to_string(bytes_input):
+if isinstance(bytes_input, str):
+return bytes_input
+return bytes_input.encode('utf-8')
+
+
+def convert_string(bytes_input):
+try:
+return to_string(bytes_input.decode('utf-8'))
+except AttributeError: # 'str' object has no attribute 'decode'.
+return str(bytes_input)
+except UnicodeError:
+return str(bytes_input)
+
 if __name__ == '__main__':
   main()


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


r303868 - [coroutines] Diagnose when promise types fail to declare either return_void or return_value.

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 09:59:39 2017
New Revision: 303868

URL: http://llvm.org/viewvc/llvm-project?rev=303868=rev
Log:
[coroutines] Diagnose when promise types fail to declare either return_void or 
return_value.

Summary:
According to the PDTS it's perfectly legal to have a promise type that defines 
neither `return_value` nor `return_void`. However a coroutine that uses such a 
promise type will almost always have UB, because it can never `co_return`.

This patch changes Clang to diagnose such cases as an error. It also cleans up 
some of the diagnostic messages relating to member lookup in the promise type.

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaCoroutine.cpp
cfe/trunk/test/SemaCXX/coreturn.cpp
cfe/trunk/test/SemaCXX/coroutines.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=303868=303867=303868=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu May 25 09:59:39 
2017
@@ -6303,6 +6303,8 @@ def warn_ambiguous_suitable_delete_funct
   InGroup>;
 def note_member_declared_here : Note<
   "member %0 declared here">;
+def note_member_first_declared_here : Note<
+  "member %0 first declared here">;
 def err_decrement_bool : Error<"cannot decrement expression of type bool">;
 def warn_increment_bool : Warning<
   "incrementing expression of type bool is deprecated and "
@@ -8918,8 +8920,6 @@ def err_return_in_coroutine : Error<
   "return statement not allowed in coroutine; did you mean 'co_return'?">;
 def note_declared_coroutine_here : Note<
   "function is a coroutine due to use of '%0' here">;
-def note_promise_member_declared_here : Note<
-  "'%0' is declared here">;
 def err_coroutine_objc_method : Error<
   "Objective-C methods as coroutines are not yet supported">;
 def err_coroutine_unevaluated_context : Error<
@@ -8954,8 +8954,10 @@ def err_coroutine_promise_type_incomplet
 def err_coroutine_type_missing_specialization : Error<
   "this function cannot be a coroutine: missing definition of "
   "specialization %q0">;
-def err_coroutine_promise_return_ill_formed : Error<
-  "%0 declares both 'return_value' and 'return_void'">;
+def err_coroutine_promise_incompatible_return_functions : Error<
+  "the coroutine promise type %0 declares both 'return_value' and 
'return_void'">;
+def err_coroutine_promise_requires_return_function : Error<
+  "the coroutine promise type %0 must declare either 'return_value' or 
'return_void'">;
 def note_coroutine_promise_implicit_await_transform_required_here : Note<
   "call to 'await_transform' implicitly required by 'co_await' here">;
 def note_coroutine_promise_suspend_implicitly_required : Note<

Modified: cfe/trunk/lib/Sema/SemaCoroutine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCoroutine.cpp?rev=303868=303867=303868=diff
==
--- cfe/trunk/lib/Sema/SemaCoroutine.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCoroutine.cpp Thu May 25 09:59:39 2017
@@ -23,14 +23,22 @@
 using namespace clang;
 using namespace sema;
 
-static bool lookupMember(Sema , const char *Name, CXXRecordDecl *RD,
- SourceLocation Loc) {
+static LookupResult lookupMember(Sema , const char *Name, CXXRecordDecl *RD,
+ SourceLocation Loc, bool ) {
   DeclarationName DN = S.PP.getIdentifierInfo(Name);
   LookupResult LR(S, DN, Loc, Sema::LookupMemberName);
   // Suppress diagnostics when a private member is selected. The same warnings
   // will be produced again when building the call.
   LR.suppressDiagnostics();
-  return S.LookupQualifiedName(LR, RD);
+  Res = S.LookupQualifiedName(LR, RD);
+  return LR;
+}
+
+static bool lookupMember(Sema , const char *Name, CXXRecordDecl *RD,
+ SourceLocation Loc) {
+  bool Res;
+  lookupMember(S, Name, RD, Loc, Res);
+  return Res;
 }
 
 /// Look up the std::coroutine_traits<...>::promise_type for the given
@@ -861,9 +869,8 @@ bool CoroutineStmtBuilder::makeReturnOnA
   StmtResult ReturnStmt =
   S.BuildReturnStmt(Loc, ReturnObjectOnAllocationFailure.get());
   if (ReturnStmt.isInvalid()) {
-S.Diag(Found.getFoundDecl()->getLocation(),
-   diag::note_promise_member_declared_here)
-<< DN.getAsString();
+S.Diag(Found.getFoundDecl()->getLocation(), 
diag::note_member_declared_here)
+<< DN;
 S.Diag(Fn.FirstCoroutineStmtLoc, diag::note_declared_coroutine_here)
 << Fn.getFirstCoroutineStmtKeyword();
 return false;
@@ -993,13 

r303867 - [coroutines] Bump __cpp_coroutines version

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 09:58:46 2017
New Revision: 303867

URL: http://llvm.org/viewvc/llvm-project?rev=303867=rev
Log:
[coroutines] Bump __cpp_coroutines version

Summary: This patch is needed so that Libc++ can actually tess if Clang 
supports coroutines, instead of just paying lip service with a partial 
implementation. Otherwise the libc++ test suite will fail against older 
versions of Clang

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/Lexer/cxx-features.cpp

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=303867=303866=303867=diff
==
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Thu May 25 09:58:46 2017
@@ -535,7 +535,7 @@ static void InitializeCPlusPlusFeatureTe
   if (LangOpts.ConceptsTS)
 Builder.defineMacro("__cpp_experimental_concepts", "1");
   if (LangOpts.CoroutinesTS)
-Builder.defineMacro("__cpp_coroutines", "1");
+Builder.defineMacro("__cpp_coroutines", "201703L");
 }
 
 static void InitializePredefinedMacros(const TargetInfo ,

Modified: cfe/trunk/test/Lexer/cxx-features.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx-features.cpp?rev=303867=303866=303867=diff
==
--- cfe/trunk/test/Lexer/cxx-features.cpp (original)
+++ cfe/trunk/test/Lexer/cxx-features.cpp Thu May 25 09:58:46 2017
@@ -235,6 +235,6 @@
 #error "wrong value for __cpp_experimental_concepts"
 #endif
 
-#if (COROUTINES && !__cpp_coroutines) || (!COROUTINES && __cpp_coroutines)
+#if defined(COROUTINES) ? check(coroutines, 201703L, 201703L, 201703L, 
201703L) : check(coroutines, 0, 0, 0, 0)
 #error "wrong value for __cpp_coroutines"
 #endif


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


[PATCH] D33550: Make __wrap_iter constexpr

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



Comment at: include/iterator:1409
 
-private:
+// private:
 #if _LIBCPP_DEBUG_LEVEL >= 2

This is testing debris - making the constructors public for testing.


https://reviews.llvm.org/D33550



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


[PATCH] D33550: Make __wrap_iter constexpr

2017-05-25 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists created this revision.

`__wrap_iter` is an internal libc++ class that is used as an iterator type when 
(for some reason) we don't want to use raw pointers as an iterator.  It is the 
iterator type for `vector` and `string` (but not `array` - not sure why). If we 
used pointers, all the operations on the iterators would be constexpr.  With 
this patch, the corresponding operations on `__wrap_iter` are constexpr as well.

We'll have to do this when 
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#2938 is adopted.

No tests, because all the interesting constructors of `__wrap_iter` are 
private, and only accessed through friend functions.
I have written tests (after making the appropriate ctors public) and they seem 
to work.


https://reviews.llvm.org/D33550

Files:
  include/algorithm
  include/iterator

Index: include/iterator
===
--- include/iterator
+++ include/iterator
@@ -1199,32 +1199,32 @@
 template  class __wrap_iter;
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
 operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
 operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
 operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
 operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
 operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
 operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 
@@ -1236,13 +1236,13 @@
 -> decltype(__x.base() - __y.base());
 #else
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename __wrap_iter<_Iter1>::difference_type
 operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 #endif
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 __wrap_iter<_Iter>
 operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT_DEBUG;
 
@@ -1254,7 +1254,7 @@
 #if _LIBCPP_DEBUG_LEVEL < 2
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,
@@ -1265,7 +1265,7 @@
 #else
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,
@@ -1288,7 +1288,8 @@
 private:
 iterator_type __i;
 public:
-_LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT_DEBUG
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+__wrap_iter() _NOEXCEPT_DEBUG
 #if _LIBCPP_STD_VER > 11
 : __i{}
 #endif
@@ -1297,7 +1298,8 @@
 __get_db()->__insert_i(this);
 #endif
 }
-template  _LIBCPP_INLINE_VISIBILITY __wrap_iter(const __wrap_iter<_Up>& __u,
+template  _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+  __wrap_iter(const __wrap_iter<_Up>& __u,
 typename enable_if::value>::type* = 0) _NOEXCEPT_DEBUG
 : __i(__u.base())
 {
@@ -1306,13 +1308,13 @@
 #endif
 }
 #if _LIBCPP_DEBUG_LEVEL >= 2
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 __wrap_iter(const __wrap_iter& __x)
 : __i(__x.base())
 {
 __get_db()->__iterator_copy(this, &__x);
 }
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 __wrap_iter& operator=(const __wrap_iter& __x)
 {
 if (this != &__x)
@@ -1328,7 +1330,8 @@
 __get_db()->__erase_i(this);
 }
 #endif
-_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT_DEBUG
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+reference operator*() const _NOEXCEPT_DEBUG
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
@@ -1336,7 +1339,8 @@
 #endif
 return *__i;
 }
-_LIBCPP_INLINE_VISIBILITY pointer  operator->() const _NOEXCEPT_DEBUG
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+pointer  operator->() const _NOEXCEPT_DEBUG
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
@@ -1344,7 +1348,8 @@
 

  1   2   >