[libcxx] r271489 - Mark LWG issue 2545 as complete. Add extra tests

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jun  2 00:44:14 2016
New Revision: 271489

URL: http://llvm.org/viewvc/llvm-project?rev=271489=rev
Log:
Mark LWG issue 2545 as complete. Add extra tests

Added:

libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
Modified:

libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Added: 
libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp?rev=271489=auto
==
--- 
libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
 Thu Jun  2 00:44:14 2016
@@ -0,0 +1,131 @@
+//===--===//
+//
+// 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
+
+// 
+
+// template
+//   unspecified bind(Fn, Types...);
+// template
+//   unspecified bind(Fn, Types...);
+
+// Check that the call operators have the proper return type and that they
+// only SFINAE away when too few arguments are provided. Otherwise they should
+// be well formed and should ignore any additional arguments.
+
+#include 
+#include 
+#include 
+
+int dummy = 42;
+
+int return_value(int) { return dummy; }
+int& return_lvalue(int) { return dummy; }
+const int& return_const_lvalue(int) { return dummy; }
+int&& return_rvalue(int) { return std::move(dummy); }
+const int&& return_const_rvalue(int) { return std::move(dummy); }
+
+template 
+auto CheckCallImp(int)
+-> decltype((std::declval()(std::declval()...)), 
std::true_type{});
+
+template 
+auto CheckCallImp(long) -> std::false_type;
+
+template 
+constexpr bool CheckCall() {
+return decltype(CheckCallImp(0))::value;
+}
+
+template 
+void do_test(Fn* func) {
+using namespace std::placeholders;
+auto ret = std::bind(func, _1);
+auto ret_r = std::bind(func, _1);
+using Bind = decltype(ret);
+using BindR = decltype(ret_r);
+
+using Ret = decltype(ret(42));
+using Ret2 = decltype(ret(42, 43)); // Test that the extra argument is 
discarded.
+using RetR = decltype(ret_r(42));
+using RetR2 = decltype(ret_r(42, 43));
+
+static_assert(std::is_same::value, "");
+static_assert(std::is_same::value, "");
+static_assert(std::is_same::value, "");
+static_assert(std::is_same::value, "");
+
+Expect exp = ret(100); // the input value is ignored. dummy is returned.
+Expect exp2 = ret(101, 102);
+Expect exp_r = ret_r(100);
+Expect exp_r2 = ret_r(101, 102);
+
+assert(exp == 42);
+assert(exp2 == 42);
+assert(exp_r == 42);
+assert(exp_r2 == 42);
+
+if ((std::is_reference::value)) {
+assert( == );
+assert( == );
+assert(_r == );
+assert(_r2 == );
+}
+// Check that the call operator SFINAE's away when too few arguments
+// are provided but is well-formed otherwise.
+{
+static_assert(!CheckCall(), "");
+static_assert(CheckCall(), "");
+static_assert(CheckCall(), "");
+static_assert(!CheckCall(), "");
+static_assert(CheckCall(), "");
+static_assert(CheckCall(), "");
+}
+}
+
+
+// Test but with an explicit return type which differs from the real one.
+template 
+void do_test_r(Fn* func) {
+using namespace std::placeholders;
+auto ret = std::bind(func, _1);
+using Bind = decltype(ret);
+using Ret = decltype(ret(42));
+using Ret2 = decltype(ret(42, 43)); // Test that the extra argument is 
discarded.
+static_assert(std::is_same::value, "");
+static_assert(std::is_same::value, "");
+Expect exp = ret(100); // the input value is ignored
+Expect exp2 = ret(101, 102);
+assert(exp == 42);
+assert(exp2 == 42);
+// Check that the call operator SFINAE's away when too few arguments
+// are provided but is well-formed otherwise.
+{
+static_assert(!CheckCall(), "");
+static_assert(CheckCall(), "");
+static_assert(CheckCall(), "");
+}
+}
+
+int main()
+{
+do_test(return_value);
+do_test(return_lvalue);
+do_test(return_const_lvalue);
+do_test(return_rvalue);
+

Re: [PATCH] D20709: For RenderScript, set alignment and width of long to 64-bits

2016-06-01 Thread Stephen Hines via cfe-commits
srhines added a comment.

After talking to Richard this afternoon on IRC, we are going with a slightly 
different plan here. We will create two new triples (renderscript32-*-* and 
renderscript64-*-*), which are direct subclasses of the general Android ARM32 
and ARM64 targets. In this case, we can use all of the existing ABI info we 
already have built up for these targets (and override longs to be 64-bit on the 
renderscript32-*-* target). Additionally, the renderscript targets will also 
set the triple name back to the ARM-related triple, since we can't break 
compatibility for generating RenderScript code that is expected to embed the 
ARM triples in the bitcode (mostly ignored, but might be validated).

One thing that didn't come up in the IRC discussion, but we probably still need 
a LangOpt for RenderScript. There is a coming patch that adds a single 
attribute (for "kernel"), that has error checking to ensure that it is only 
used by our RenderScript targets. I assume that the cleanest way to retain that 
diagnostic (and get the last of these divergent patches in) will be to still 
key off of a LangOpt. If you think it is preferable to check against a target 
instead, I can change the code to do that, but I figured this is more 
consistent with how other attributes work.


http://reviews.llvm.org/D20709



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


[libcxx] r271487 - Fix leak in __enable_weak_this(). Thanks to Arthur O'Dwyer for finding it.

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun  1 23:57:00 2016
New Revision: 271487

URL: http://llvm.org/viewvc/llvm-project?rev=271487=rev
Log:
Fix leak in __enable_weak_this(). Thanks to Arthur O'Dwyer for finding it.

Modified:
libcxx/trunk/include/memory

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=271487=271486=271487=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Wed Jun  1 23:57:00 2016
@@ -4122,9 +4122,11 @@ private:
 {
 if (__e && __e->__weak_this_.expired())
 {
-__e->__weak_this_.__ptr_ = const_cast<_Yp*>(static_cast(__e));
-__e->__weak_this_.__cntrl_ = __cntrl_;
+weak_ptr<_Yp> __tmp;
+__tmp.__ptr_ = const_cast<_Yp*>(static_cast(__e));
+__tmp.__cntrl_ = __cntrl_;
 __cntrl_->__add_weak();
+__e->__weak_this_.swap(__tmp);
 }
 }
 

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=271487=271486=271487=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
 Wed Jun  1 23:57:00 2016
@@ -26,6 +26,7 @@
 #include 
 
 #include "test_macros.h"
+#include "count_new.hpp"
 
 struct T
 : public std::enable_shared_from_this
@@ -62,7 +63,7 @@ int main()
 // * Using 'weak_from_this().expired()' in C++17.
 // * Using 'shared_from_this()' in all dialects.
 {
-
+assert(globalMemCounter.checkOutstandingNewEq(0));
 T* ptr = new T;
 std::shared_ptr s(ptr);
 {
@@ -87,6 +88,37 @@ int main()
 }
 }
 #endif
+s.reset();
+assert(globalMemCounter.checkOutstandingNewEq(0));
+}
+// Test LWG issue 2529 again. This time check that an expired pointer
+// is replaced.
+{
+assert(globalMemCounter.checkOutstandingNewEq(0));
+T* ptr = new T;
+std::weak_ptr weak;
+{
+std::shared_ptr s(ptr, );
+assert(ptr->shared_from_this() == s);
+weak = s;
+assert(!weak.expired());
+}
+assert(weak.expired());
+weak.reset();
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+try {
+ptr->shared_from_this();
+assert(false);
+} catch (std::bad_weak_ptr const&) {
+} catch (...) { assert(false); }
+#endif
+{
+std::shared_ptr s2(ptr, );
+assert(ptr->shared_from_this() == s2);
+}
+delete ptr;
+assert(globalMemCounter.checkOutstandingNewEq(0));
 }
 // Test weak_from_this_methods
 #if TEST_STD_VER > 14


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


Re: [libcxx] r271459 - Remove enable_shared_from_this test since it leaks the control block and fails with ASAN

2016-06-01 Thread Eric Fiselier via cfe-commits
Fixed in r271487.

On Wed, Jun 1, 2016 at 10:56 PM, Eric Fiselier  wrote:

> Nevermind my last comment. It's just a bug in my implementation. Thanks
> again for catching it.
>
> On Wed, Jun 1, 2016 at 10:40 PM, Eric Fiselier  wrote:
>
>> Oh goodness your right. There are a bunch of bugs in the shared_ptr
>> constructors/destructors use both the specified deleters and allocators.
>>
>> Thanks for pointing out my stupidity!
>>
>> On Wed, Jun 1, 2016 at 10:25 PM, Arthur O'Dwyer <
>> arthur.j.odw...@gmail.com> wrote:
>>
>>> On Wed, Jun 1, 2016 at 7:00 PM, Eric Fiselier  wrote:
>>>
 No the leak was my fault. The sneaky line was "std::shared_ptr
 s(ptr, );", which caused the allocation of a shared control
 block.

>>>
>>> But surely the control block is allocated and deallocated by libc++
>>> behind the scenes, foolproofly?
>>>
>>>
 Since the deleter is a NOP it gets leaked and ASAN reports it.

>>>
>>> Surely the NOP deleter applies only to the controlled object *ptr, not
>>> to the control block?  Is the supplied deleter actually used to
>>> allocate/deallocate the control block as well?
>>>
>>> The controlled object *ptr is explicitly delete'd at the end of the test
>>> case, which is why it seems safe to me.
>>>
>>> –Arthur
>>>
>>>
>>> On Jun 1, 2016 6:15 PM, "Eric Fiselier via cfe-commits" <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: ericwf
>> Date: Wed Jun  1 20:09:12 2016
>> New Revision: 271459
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=271459=rev
>> Log:
>> Remove enable_shared_from_this test since it leaks the control block
>> and fails with ASAN
>>
>> Modified:
>>
>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>>
>> Modified:
>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=271459=271458=271459=diff
>>
>> ==
>> ---
>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>> (original)
>> +++
>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>> Wed Jun  1 20:09:12 2016
>> @@ -88,32 +88,6 @@ int main()
>>  }
>>  #endif
>>  }
>> -// Test LWG issue 2529 again. This time check that an expired
>> pointer
>> -// is replaced.
>> -{
>> -T* ptr = new T;
>> -std::weak_ptr weak;
>> -{
>> -std::shared_ptr s(ptr, );
>> -assert(ptr->shared_from_this() == s);
>> -weak = s;
>> -assert(!weak.expired());
>> -}
>> -assert(weak.expired());
>> -weak.reset();
>> -#ifndef TEST_HAS_NO_EXCEPTIONS
>> -try {
>> -ptr->shared_from_this();
>> -assert(false);
>> -} catch (std::bad_weak_ptr const&) {
>> -} catch (...) { assert(false); }
>> -#endif
>> -{
>> -std::shared_ptr s2(ptr, );
>> -assert(ptr->shared_from_this() == s2);
>> -}
>> -delete ptr;
>> -}
>>  // Test weak_from_this_methods
>>  #if TEST_STD_VER > 14
>>  {
>>
>>
>> ___
>> 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


Re: [libcxx] r271459 - Remove enable_shared_from_this test since it leaks the control block and fails with ASAN

2016-06-01 Thread Eric Fiselier via cfe-commits
Nevermind my last comment. It's just a bug in my implementation. Thanks
again for catching it.

On Wed, Jun 1, 2016 at 10:40 PM, Eric Fiselier  wrote:

> Oh goodness your right. There are a bunch of bugs in the shared_ptr
> constructors/destructors use both the specified deleters and allocators.
>
> Thanks for pointing out my stupidity!
>
> On Wed, Jun 1, 2016 at 10:25 PM, Arthur O'Dwyer  > wrote:
>
>> On Wed, Jun 1, 2016 at 7:00 PM, Eric Fiselier  wrote:
>>
>>> No the leak was my fault. The sneaky line was "std::shared_ptr s(ptr,
>>> );", which caused the allocation of a shared control block.
>>>
>>
>> But surely the control block is allocated and deallocated by libc++
>> behind the scenes, foolproofly?
>>
>>
>>> Since the deleter is a NOP it gets leaked and ASAN reports it.
>>>
>>
>> Surely the NOP deleter applies only to the controlled object *ptr, not to
>> the control block?  Is the supplied deleter actually used to
>> allocate/deallocate the control block as well?
>>
>> The controlled object *ptr is explicitly delete'd at the end of the test
>> case, which is why it seems safe to me.
>>
>> –Arthur
>>
>>
>> On Jun 1, 2016 6:15 PM, "Eric Fiselier via cfe-commits" <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: ericwf
> Date: Wed Jun  1 20:09:12 2016
> New Revision: 271459
>
> URL: http://llvm.org/viewvc/llvm-project?rev=271459=rev
> Log:
> Remove enable_shared_from_this test since it leaks the control block
> and fails with ASAN
>
> Modified:
>
> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>
> Modified:
> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=271459=271458=271459=diff
>
> ==
> ---
> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
> (original)
> +++
> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
> Wed Jun  1 20:09:12 2016
> @@ -88,32 +88,6 @@ int main()
>  }
>  #endif
>  }
> -// Test LWG issue 2529 again. This time check that an expired
> pointer
> -// is replaced.
> -{
> -T* ptr = new T;
> -std::weak_ptr weak;
> -{
> -std::shared_ptr s(ptr, );
> -assert(ptr->shared_from_this() == s);
> -weak = s;
> -assert(!weak.expired());
> -}
> -assert(weak.expired());
> -weak.reset();
> -#ifndef TEST_HAS_NO_EXCEPTIONS
> -try {
> -ptr->shared_from_this();
> -assert(false);
> -} catch (std::bad_weak_ptr const&) {
> -} catch (...) { assert(false); }
> -#endif
> -{
> -std::shared_ptr s2(ptr, );
> -assert(ptr->shared_from_this() == s2);
> -}
> -delete ptr;
> -}
>  // Test weak_from_this_methods
>  #if TEST_STD_VER > 14
>  {
>
>
> ___
> 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


Re: [libcxx] r271459 - Remove enable_shared_from_this test since it leaks the control block and fails with ASAN

2016-06-01 Thread Eric Fiselier via cfe-commits
Oh goodness your right. There are a bunch of bugs in the shared_ptr
constructors/destructors use both the specified deleters and allocators.

Thanks for pointing out my stupidity!

On Wed, Jun 1, 2016 at 10:25 PM, Arthur O'Dwyer 
wrote:

> On Wed, Jun 1, 2016 at 7:00 PM, Eric Fiselier  wrote:
>
>> No the leak was my fault. The sneaky line was "std::shared_ptr s(ptr,
>> );", which caused the allocation of a shared control block.
>>
>
> But surely the control block is allocated and deallocated by libc++ behind
> the scenes, foolproofly?
>
>
>> Since the deleter is a NOP it gets leaked and ASAN reports it.
>>
>
> Surely the NOP deleter applies only to the controlled object *ptr, not to
> the control block?  Is the supplied deleter actually used to
> allocate/deallocate the control block as well?
>
> The controlled object *ptr is explicitly delete'd at the end of the test
> case, which is why it seems safe to me.
>
> –Arthur
>
>
> On Jun 1, 2016 6:15 PM, "Eric Fiselier via cfe-commits" <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: ericwf
 Date: Wed Jun  1 20:09:12 2016
 New Revision: 271459

 URL: http://llvm.org/viewvc/llvm-project?rev=271459=rev
 Log:
 Remove enable_shared_from_this test since it leaks the control block
 and fails with ASAN

 Modified:

 libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp

 Modified:
 libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=271459=271458=271459=diff

 ==
 ---
 libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
 (original)
 +++
 libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
 Wed Jun  1 20:09:12 2016
 @@ -88,32 +88,6 @@ int main()
  }
  #endif
  }
 -// Test LWG issue 2529 again. This time check that an expired
 pointer
 -// is replaced.
 -{
 -T* ptr = new T;
 -std::weak_ptr weak;
 -{
 -std::shared_ptr s(ptr, );
 -assert(ptr->shared_from_this() == s);
 -weak = s;
 -assert(!weak.expired());
 -}
 -assert(weak.expired());
 -weak.reset();
 -#ifndef TEST_HAS_NO_EXCEPTIONS
 -try {
 -ptr->shared_from_this();
 -assert(false);
 -} catch (std::bad_weak_ptr const&) {
 -} catch (...) { assert(false); }
 -#endif
 -{
 -std::shared_ptr s2(ptr, );
 -assert(ptr->shared_from_this() == s2);
 -}
 -delete ptr;
 -}
  // Test weak_from_this_methods
  #if TEST_STD_VER > 14
  {


 ___
 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


Re: [libcxx] r271459 - Remove enable_shared_from_this test since it leaks the control block and fails with ASAN

2016-06-01 Thread Arthur O'Dwyer via cfe-commits
On Wed, Jun 1, 2016 at 7:00 PM, Eric Fiselier  wrote:

> No the leak was my fault. The sneaky line was "std::shared_ptr s(ptr,
> );", which caused the allocation of a shared control block.
>

But surely the control block is allocated and deallocated by libc++ behind
the scenes, foolproofly?


> Since the deleter is a NOP it gets leaked and ASAN reports it.
>

Surely the NOP deleter applies only to the controlled object *ptr, not to
the control block?  Is the supplied deleter actually used to
allocate/deallocate the control block as well?

The controlled object *ptr is explicitly delete'd at the end of the test
case, which is why it seems safe to me.

–Arthur


On Jun 1, 2016 6:15 PM, "Eric Fiselier via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
>>> Date: Wed Jun  1 20:09:12 2016
>>> New Revision: 271459
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=271459=rev
>>> Log:
>>> Remove enable_shared_from_this test since it leaks the control block and
>>> fails with ASAN
>>>
>>> Modified:
>>>
>>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>>>
>>> Modified:
>>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=271459=271458=271459=diff
>>>
>>> ==
>>> ---
>>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>>> (original)
>>> +++
>>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>>> Wed Jun  1 20:09:12 2016
>>> @@ -88,32 +88,6 @@ int main()
>>>  }
>>>  #endif
>>>  }
>>> -// Test LWG issue 2529 again. This time check that an expired
>>> pointer
>>> -// is replaced.
>>> -{
>>> -T* ptr = new T;
>>> -std::weak_ptr weak;
>>> -{
>>> -std::shared_ptr s(ptr, );
>>> -assert(ptr->shared_from_this() == s);
>>> -weak = s;
>>> -assert(!weak.expired());
>>> -}
>>> -assert(weak.expired());
>>> -weak.reset();
>>> -#ifndef TEST_HAS_NO_EXCEPTIONS
>>> -try {
>>> -ptr->shared_from_this();
>>> -assert(false);
>>> -} catch (std::bad_weak_ptr const&) {
>>> -} catch (...) { assert(false); }
>>> -#endif
>>> -{
>>> -std::shared_ptr s2(ptr, );
>>> -assert(ptr->shared_from_this() == s2);
>>> -}
>>> -delete ptr;
>>> -}
>>>  // Test weak_from_this_methods
>>>  #if TEST_STD_VER > 14
>>>  {
>>>
>>>
>>> ___
>>> 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


[libcxx] r271473 - Mark LWG issue 2450 as complete.

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun  1 22:12:44 2016
New Revision: 271473

URL: http://llvm.org/viewvc/llvm-project?rev=271473=rev
Log:
Mark LWG issue 2450 as complete.

Added:

libcxx/trunk/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp
Modified:

libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp

libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp

libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
libcxx/trunk/test/std/utilities/function.objects/comparisons/less.pass.cpp

libcxx/trunk/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp

libcxx/trunk/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: 
libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp?rev=271473=271472=271473=diff
==
--- 
libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp 
Wed Jun  1 22:12:44 2016
@@ -15,6 +15,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 int main()
 {
 typedef std::equal_to F;
@@ -24,7 +26,7 @@ int main()
 static_assert((std::is_same::value), "" );
 assert(f(36, 36));
 assert(!f(36, 6));
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
 typedef std::equal_to<> F2;
 const F2 f2 = F2();
 assert(f2(36, 36));

Modified: 
libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp?rev=271473=271472=271473=diff
==
--- 
libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp 
Wed Jun  1 22:12:44 2016
@@ -15,6 +15,9 @@
 #include 
 #include 
 
+#include "test_macros.h"
+#include "pointer_comparison_test_helper.hpp"
+
 int main()
 {
 typedef std::greater F;
@@ -25,7 +28,12 @@ int main()
 assert(!f(36, 36));
 assert(f(36, 6));
 assert(!f(6, 36));
-#if _LIBCPP_STD_VER > 11
+{
+// test total ordering of int* for greater and
+// greater.
+do_pointer_comparison_test();
+}
+#if TEST_STD_VER > 11
 typedef std::greater<> F2;
 const F2 f2 = F2();
 assert(!f2(36, 36));

Modified: 
libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp?rev=271473=271472=271473=diff
==
--- 
libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
 Wed Jun  1 22:12:44 2016
@@ -15,6 +15,9 @@
 #include 
 #include 
 
+#include "test_macros.h"
+#include "pointer_comparison_test_helper.hpp"
+
 int main()
 {
 typedef std::greater_equal F;
@@ -25,7 +28,12 @@ int main()
 assert(f(36, 36));
 assert(f(36, 6));
 assert(!f(6, 36));
-#if _LIBCPP_STD_VER > 11
+{
+// test total ordering of int* for greater_equal and
+// greater_equal.
+do_pointer_comparison_test();
+}
+#if TEST_STD_VER > 11
 typedef std::greater_equal<> F2;
 const F2 f2 = F2();
 assert(f2(36, 36));

Modified: 
libcxx/trunk/test/std/utilities/function.objects/comparisons/less.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/less.pass.cpp?rev=271473=271472=271473=diff
==
--- libcxx/trunk/test/std/utilities/function.objects/comparisons/less.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/function.objects/comparisons/less.pass.cpp 
Wed Jun  1 22:12:44 2016
@@ -15,6 +15,9 @@
 #include 
 #include 
 
+#include "test_macros.h"
+#include "pointer_comparison_test_helper.hpp"
+
 int main()
 {
 typedef std::less F;
@@ -25,7 +28,11 @@ int main()
 assert(!f(36, 36));
 assert(!f(36, 6));
 assert(f(6, 36));
-#if _LIBCPP_STD_VER > 11
+{
+// test total ordering of int* for less and less.
+do_pointer_comparison_test();
+}
+#if TEST_STD_VER > 11
 typedef std::less<> F2;
 const F2 f2 = F2();
 assert(!f2(36, 36));

Modified: 

r271472 - [docs] Fix misplaced comma

2016-06-01 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Wed Jun  1 21:45:59 2016
New Revision: 271472

URL: http://llvm.org/viewvc/llvm-project?rev=271472=rev
Log:
[docs] Fix misplaced comma

Modified:
cfe/trunk/docs/SourceBasedCodeCoverage.rst

Modified: cfe/trunk/docs/SourceBasedCodeCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SourceBasedCodeCoverage.rst?rev=271472=271471=271472=diff
==
--- cfe/trunk/docs/SourceBasedCodeCoverage.rst (original)
+++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Wed Jun  1 21:45:59 2016
@@ -52,7 +52,7 @@ based on this program:
 Compiling with coverage enabled
 ===
 
-To compile code with coverage, enabled pass ``-fprofile-instr-generate
+To compile code with coverage enabled, pass ``-fprofile-instr-generate
 -fcoverage-mapping`` to the compiler:
 
 .. code-block:: console


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


r271471 - [docs] Minor formatting changes and typo fixes

2016-06-01 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Wed Jun  1 21:25:13 2016
New Revision: 271471

URL: http://llvm.org/viewvc/llvm-project?rev=271471=rev
Log:
[docs] Minor formatting changes and typo fixes

Modified:
cfe/trunk/docs/SourceBasedCodeCoverage.rst

Modified: cfe/trunk/docs/SourceBasedCodeCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SourceBasedCodeCoverage.rst?rev=271471=271470=271471=diff
==
--- cfe/trunk/docs/SourceBasedCodeCoverage.rst (original)
+++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Wed Jun  1 21:25:13 2016
@@ -26,11 +26,11 @@ The code coverage workflow
 
 The code coverage workflow consists of three main steps:
 
-1. Compiling with coverage enabled.
+* Compiling with coverage enabled.
 
-2. Running the instrumented program.
+* Running the instrumented program.
 
-3. Creating coverage reports.
+* Creating coverage reports.
 
 The next few sections work through a complete, copy-'n-paste friendly example
 based on this program:
@@ -52,7 +52,7 @@ based on this program:
 Compiling with coverage enabled
 ===
 
-To compile code with coverage enabled pass ``-fprofile-instr-generate
+To compile code with coverage, enabled pass ``-fprofile-instr-generate
 -fcoverage-mapping`` to the compiler:
 
 .. code-block:: console
@@ -68,12 +68,11 @@ Running the instrumented program
 
 The next step is to run the instrumented program. When the program exits it
 will write a **raw profile** to the path specified by the ``LLVM_PROFILE_FILE``
-environment variable. If that variable does not exist the profile is written to
-``default.profraw`` in the current directory of the program.
-
-If ``LLVM_PROFILE_FILE`` contains a path to a non-existent directory the
-missing directory structure will be created.  Additionally, the following
-special **pattern strings** are replaced:
+environment variable. If that variable does not exist, the profile is written
+to ``default.profraw`` in the current directory of the program. If
+``LLVM_PROFILE_FILE`` contains a path to a non-existent directory, the missing
+directory structure will be created.  Additionally, the following special
+**pattern strings** are rewritten:
 
 * "%p" expands out to the process ID.
 
@@ -87,7 +86,7 @@ special **pattern strings** are replaced
 Creating coverage reports
 =
 
-Raw profiles have to be **indexed** before they can be used to generated
+Raw profiles have to be **indexed** before they can be used to generate
 coverage reports. This is done using the "merge" tool in ``llvm-profdata``, so
 named because it can combine and index profiles at the same time:
 


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


[libcxxabi] r271470 - [libcxxabi] Allow target flags to affect configuration tests.

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun  1 21:18:31 2016
New Revision: 271470

URL: http://llvm.org/viewvc/llvm-project?rev=271470=rev
Log:
[libcxxabi] Allow target flags to affect configuration tests.

Summary:
This patch changes the libc++abi CMake so that it adds certain target flags 
like  '-m32' or '--gcc-toolchain' before including `config-ix.cmake`.
Since these flags can affect things like `check_library_exists([...])` they 
needed to be added before the tests are performed.

Additionally this patch adds `LIBCXXABI_BUILD_32_BITS` which defaults to 
`LLVM_BUILD_32_BITS`.

This patch fixes:

https://llvm.org/bugs/show_bug.cgi?id=27950
https://llvm.org/bugs/show_bug.cgi?id=27959

Reviewers: danalbert, jroelofs, bcraig, compnerd, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D20886

Modified:
libcxxabi/trunk/CMakeLists.txt
libcxxabi/trunk/test/CMakeLists.txt
libcxxabi/trunk/test/lit.site.cfg.in

Modified: libcxxabi/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=271470=271469=271470=diff
==
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Wed Jun  1 21:18:31 2016
@@ -115,6 +115,8 @@ option(LIBCXXABI_ENABLE_WERROR "Fail and
 option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
 option(LIBCXXABI_ENABLE_THREADS "Build with threads enabled" ON)
 option(LIBCXXABI_HAS_PTHREAD_API "Ignore auto-detection and force use of 
pthread API" OFF)
+option(LIBCXXABI_BUILD_32_BITS "Build 32 bit libc++abi." ${LLVM_BUILD_32_BITS})
+set(LIBCXXABI_TARGET_TRIPLE "" CACHE STRING "Target triple for cross 
compiling.")
 set(LIBCXXABI_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
 set(LIBCXXABI_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
 set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.")
@@ -173,9 +175,6 @@ set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
   )
 
-# Configure compiler.
-include(config-ix)
-
 set(LIBCXXABI_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBCXXABI_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXXABI_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
@@ -191,6 +190,16 @@ if (NOT LIBCXXABI_LIBCXX_LIBRARY_PATH)
   "The path to libc++ library.")
 endif ()
 
+
+# Check that we can build with 32 bits if requested.
+if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
+  if (LIBCXXABI_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate 
the output from LLVM
+message(STATUS "Building 32 bits executables and libraries.")
+  endif()
+elseif(LIBCXXABI_BUILD_32_BITS)
+  message(FATAL_ERROR "LIBCXXABI_BUILD_32_BITS=ON is not supported on this 
platform.")
+endif()
+
 
#===
 # Setup Compiler Flags
 
#===
@@ -202,11 +211,30 @@ macro(append_if list condition var)
   endif()
 endmacro()
 
+macro(add_target_flags_if condition var)
+  if (${condition})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${var}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${var}")
+list(APPEND LIBCXXABI_LINK_FLAGS ${var})
+  endif()
+endmacro()
+
 set(LIBCXXABI_C_FLAGS "")
 set(LIBCXXABI_CXX_FLAGS "")
 set(LIBCXXABI_COMPILE_FLAGS "")
 set(LIBCXXABI_LINK_FLAGS "")
 
+# Configure target flags
+add_target_flags_if(LIBCXXABI_BUILD_32_BITS "-m32")
+add_target_flags_if(LIBCXXABI_TARGET_TRIPLE
+  "-target ${LIBCXXABI_TARGET_TRIPLE}")
+add_target_flags_if(LIBCXXABI_GCC_TOOLCHAIN
+ "-gcc-toolchain ${LIBCXXABI_GCC_TOOLCHAIN}")
+add_target_flags_if(LIBCXXABI_SYSROOT
+  "--sysroot=${LIBCXXABI_SYSROOT}")
+
+# Configure compiler. Must happen after setting the target flags.
+include(config-ix)
 
 if (LIBCXXABI_HAS_NOSTDINCXX_FLAG)
   list(APPEND LIBCXXABI_COMPILE_FLAGS -nostdinc++)
@@ -312,12 +340,6 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_
   add_definitions(-DLIBCXXABI_USE_LLVM_UNWINDER=1)
 endif()
 
-append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_TARGET_TRIPLE
-  "-target ${LIBCXXABI_TARGET_TRIPLE}")
-append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_GCC_TOOLCHAIN
- "-gcc-toolchain ${LIBCXXABI_GCC_TOOLCHAIN}")
-append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_SYSROOT
-  "--sysroot ${LIBCXXABI_SYSROOT}")
 string(REPLACE ";" " " LIBCXXABI_CXX_FLAGS "${LIBCXXABI_CXX_FLAGS}")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXXABI_CXX_FLAGS}")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")

Modified: libcxxabi/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/CMakeLists.txt?rev=271470=271469=271470=diff
==
--- libcxxabi/trunk/test/CMakeLists.txt (original)
+++ libcxxabi/trunk/test/CMakeLists.txt Wed Jun  1 21:18:31 2016
@@ -10,7 +10,7 @@ if (NOT DEFINED LIBCXX_ENABLE_SHARED)
   

[libcxx] r271469 - Update libcxx.llvm.org documentation by linking to new docs.

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun  1 21:16:28 2016
New Revision: 271469

URL: http://llvm.org/viewvc/llvm-project?rev=271469=rev
Log:
Update libcxx.llvm.org documentation by linking to new docs.

Summary:
Currently much of the libcxx website is duplicated between the old www/ 
documentation and newer Sphinx docs. This patch changes the main libc++ webpage 
so that it links to the new documentation where possible. This means removing 
numerous sections from the landing page.

@mclow.lists What do you think?

Reviewers: mclow.lists

Subscribers: cfe-commits, mclow.lists

Differential Revision: http://reviews.llvm.org/D19250

Removed:
libcxx/trunk/www/lit_usage.html
Modified:
libcxx/trunk/docs/BuildingLibcxx.rst
libcxx/trunk/www/index.html

Modified: libcxx/trunk/docs/BuildingLibcxx.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/BuildingLibcxx.rst?rev=271469=271468=271469=diff
==
--- libcxx/trunk/docs/BuildingLibcxx.rst (original)
+++ libcxx/trunk/docs/BuildingLibcxx.rst Wed Jun  1 21:16:28 2016
@@ -1,3 +1,4 @@
+.. _BuildingLibcxx:
 
 ===
 Building libc++
@@ -336,3 +337,72 @@ own copy of libsupc++ and this can lead
   $ make install
 
 You can now run clang with -stdlib=libc++.
+
+
+.. _libcxxrt_ref:
+
+Using libcxxrt on Linux
+
+
+You will need to keep the source tree of `libcxxrt`_ available
+on your build machine and your copy of the libcxxrt shared library must
+be placed where your linker will find it.
+
+We can now run CMake like:
+
+.. code-block:: bash
+
+  $ CC=clang CXX=clang++ cmake -G "Unix Makefiles" \
+  -DLIBCXX_CXX_ABI=libcxxrt \
+  -DLIBCXX_CXX_ABI_INCLUDE_PATHS=path/to/libcxxrt-sources/src \
+-DCMAKE_BUILD_TYPE=Release \
+-DCMAKE_INSTALL_PREFIX=/usr \
+
+  $ make cxx
+  $ make install
+
+Unfortunately you can't simply run clang with "-stdlib=libc++" at this point, 
as
+clang is set up to link for libc++ linked to libsupc++.  To get around this
+you'll have to set up your linker yourself (or patch clang).  For example,
+
+.. code-block:: bash
+
+  $ clang++ -stdlib=libc++ helloworld.cpp \
+-nodefaultlibs -lc++ -lcxxrt -lm -lc -lgcc_s -lgcc
+
+Alternately, you could just add libcxxrt to your libraries list, which in most
+situations will give the same result:
+
+.. code-block:: bash
+
+  $ clang++ -stdlib=libc++ helloworld.cpp -lcxxrt
+
+.. _`libcxxrt`: https://github.com/pathscale/libcxxrt/
+
+
+Using a local ABI library installation
+---
+
+.. warning::
+  This is not recommended in almost all cases.
+
+These instructions should only be used when you can't install your ABI library.
+
+Normally you must link libc++ against a ABI shared library that the
+linker can find.  If you want to build and test libc++ against an ABI
+library not in the linker's path you needq to set
+``-DLIBCXX_CXX_ABI_LIBRARY_PATH=/path/to/abi/lib`` when configuring CMake.
+
+An example build using libc++abi would look like:
+
+.. code-block:: bash
+
+  $ CC=clang CXX=clang++ cmake \
+  -DLIBCXX_CXX_ABI=libc++abi  \
+  -DLIBCXX_CXX_ABI_INCLUDE_PATHS="/path/to/libcxxabi/include" \
+  -DLIBCXX_CXX_ABI_LIBRARY_PATH="/path/to/libcxxabi-build/lib" \
+   path/to/libcxx
+  $ make
+
+When testing libc++ LIT will automatically link against the proper ABI
+library.

Modified: libcxx/trunk/www/index.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/index.html?rev=271469=271468=271469=diff
==
--- libcxx/trunk/www/index.html (original)
+++ libcxx/trunk/www/index.html Wed Jun  1 21:16:28 2016
@@ -166,96 +166,18 @@
   First please review our
  http://llvm.org/docs/DeveloperPolicy.html;>Developer's 
Policy.
 
-  
- On Mac OS 10.7 (Lion) and later, the easiest way to get this library is 
to install
- Xcode 4.2 or later.  However if you want to install tip-of-trunk from here
- (getting the bleeding edge), read on.  However, be warned that Mac OS
- 10.7 will not boot without a valid copy of libc++.1.dylib in
- /usr/lib.
-  
-
-  To check out the code, use:
-
-  
-  svn co http://llvm.org/svn/llvm-project/libcxx/trunk 
libcxx
-  
-
-  
-Note that for an in-tree build, you should check out libcxx to
-llvm/projects.
-  
-
-  
-The following instructions are for building libc++ on FreeBSD, Linux, or 
Mac
-using http://libcxxabi.llvm.org/;>libc++abi as the C++ ABI
-library. On Linux, it is also possible to use
-libsupc++ or libcxxrt.
-  
-
-  In-tree build:
-  
-cd where-you-want-to-live
-Check out libcxx and http://libcxxabi.llvm.org/;>libcxxabi
-  into llvm/projects
-cd where-you-want-to-build
-mkdir build  cd build
-cmake path/to/llvm # Linux may require 

Re: [PATCH] D19250: Update libcxx.llvm.org documentation by linking to new docs.

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

LGTM.


http://reviews.llvm.org/D19250



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


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

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

REQUIRES-ANY landed in r271468.


http://reviews.llvm.org/D20660



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


Re: [PATCH] D20389: NVPTX: Add supported CL features

2016-06-01 Thread Jan Vesely via cfe-commits
jvesely added inline comments.


Comment at: test/Misc/nvptx.languageOptsOpenCL.cl:1
@@ +1,2 @@
+// REQUIRES: nvptx-registered-target
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown

Anastasia wrote:
> Should we check for errors on unsupported extensions for this target too?
I didn't want to do that. Including unsupported extensions in these tests would 
imply that every OCL extension needs test in 4 places (nvptx, amdgcn, r600, 
extension-version.cl), possibly more if more targets are added, which seemed 
excessive.


Repository:
  rL LLVM

http://reviews.llvm.org/D20389



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


Re: [libcxx] r271459 - Remove enable_shared_from_this test since it leaks the control block and fails with ASAN

2016-06-01 Thread Eric Fiselier via cfe-commits
No the leak was my fault. The sneaky line was "std::shared_ptr s(ptr,
);", which caused the allocation of a shared control block.
Since the deleter is a NOP it gets leaked and ASAN reports it.
I'm going to follow up with a better test that ASAN doesn't complain about.

On Wed, Jun 1, 2016 at 7:49 PM, Arthur O'Dwyer 
wrote:

> I don't get it. If this code doesn't pass ASAN, or if it leaks anything,
> doesn't that indicate a bug in the library implementation of C++1z
> shared_ptr? I can't find where this code does anything sneaky that a
> sanitizer ought to care about...
> On Jun 1, 2016 6:15 PM, "Eric Fiselier via cfe-commits" <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: ericwf
>> Date: Wed Jun  1 20:09:12 2016
>> New Revision: 271459
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=271459=rev
>> Log:
>> Remove enable_shared_from_this test since it leaks the control block and
>> fails with ASAN
>>
>> Modified:
>>
>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>>
>> Modified:
>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=271459=271458=271459=diff
>>
>> ==
>> ---
>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>> (original)
>> +++
>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>> Wed Jun  1 20:09:12 2016
>> @@ -88,32 +88,6 @@ int main()
>>  }
>>  #endif
>>  }
>> -// Test LWG issue 2529 again. This time check that an expired pointer
>> -// is replaced.
>> -{
>> -T* ptr = new T;
>> -std::weak_ptr weak;
>> -{
>> -std::shared_ptr s(ptr, );
>> -assert(ptr->shared_from_this() == s);
>> -weak = s;
>> -assert(!weak.expired());
>> -}
>> -assert(weak.expired());
>> -weak.reset();
>> -#ifndef TEST_HAS_NO_EXCEPTIONS
>> -try {
>> -ptr->shared_from_this();
>> -assert(false);
>> -} catch (std::bad_weak_ptr const&) {
>> -} catch (...) { assert(false); }
>> -#endif
>> -{
>> -std::shared_ptr s2(ptr, );
>> -assert(ptr->shared_from_this() == s2);
>> -}
>> -delete ptr;
>> -}
>>  // Test weak_from_this_methods
>>  #if TEST_STD_VER > 14
>>  {
>>
>>
>> ___
>> 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


[libunwind] r271466 - Attempt to fix libunwind build

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun  1 20:50:10 2016
New Revision: 271466

URL: http://llvm.org/viewvc/llvm-project?rev=271466=rev
Log:
Attempt to fix libunwind build

Modified:
libunwind/trunk/src/CMakeLists.txt

Modified: libunwind/trunk/src/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=271466=271465=271466=diff
==
--- libunwind/trunk/src/CMakeLists.txt (original)
+++ libunwind/trunk/src/CMakeLists.txt Wed Jun  1 20:50:10 2016
@@ -105,9 +105,9 @@ set_target_properties(unwind
 VERSION   "1.0"
 SOVERSION "1")
 set_property(SOURCE ${LIBUNWIND_CXX_SOURCES}
- APPEND_STRING PROPERTY COMPILE_FLAGS "${CMAKE_CXX_FLAGS} 
${LIBUNWIND_CXX_FLAGS}")
+ APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_CXX_FLAGS} 
${LIBUNWIND_CXX_FLAGS}")
 set_property(SOURCE ${LIBUNWIND_C_SOURCES}
- APPEND_STRING PROPERTY COMPILE_FLAGS "${CMAKE_C_FLAGS} 
${LIBUNWIND_C_FLAGS}")
+ APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_C_FLAGS} 
${LIBUNWIND_C_FLAGS}")
 
 install(TARGETS unwind
 LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}


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


Re: [libcxx] r271459 - Remove enable_shared_from_this test since it leaks the control block and fails with ASAN

2016-06-01 Thread Arthur O'Dwyer via cfe-commits
I don't get it. If this code doesn't pass ASAN, or if it leaks anything,
doesn't that indicate a bug in the library implementation of C++1z
shared_ptr? I can't find where this code does anything sneaky that a
sanitizer ought to care about...
On Jun 1, 2016 6:15 PM, "Eric Fiselier via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Wed Jun  1 20:09:12 2016
> New Revision: 271459
>
> URL: http://llvm.org/viewvc/llvm-project?rev=271459=rev
> Log:
> Remove enable_shared_from_this test since it leaks the control block and
> fails with ASAN
>
> Modified:
>
> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
>
> Modified:
> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=271459=271458=271459=diff
>
> ==
> ---
> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
> (original)
> +++
> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
> Wed Jun  1 20:09:12 2016
> @@ -88,32 +88,6 @@ int main()
>  }
>  #endif
>  }
> -// Test LWG issue 2529 again. This time check that an expired pointer
> -// is replaced.
> -{
> -T* ptr = new T;
> -std::weak_ptr weak;
> -{
> -std::shared_ptr s(ptr, );
> -assert(ptr->shared_from_this() == s);
> -weak = s;
> -assert(!weak.expired());
> -}
> -assert(weak.expired());
> -weak.reset();
> -#ifndef TEST_HAS_NO_EXCEPTIONS
> -try {
> -ptr->shared_from_this();
> -assert(false);
> -} catch (std::bad_weak_ptr const&) {
> -} catch (...) { assert(false); }
> -#endif
> -{
> -std::shared_ptr s2(ptr, );
> -assert(ptr->shared_from_this() == s2);
> -}
> -delete ptr;
> -}
>  // Test weak_from_this_methods
>  #if TEST_STD_VER > 14
>  {
>
>
> ___
> 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


[libcxx] r271464 - Add C++17 std::not_fn negator.

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun  1 20:25:41 2016
New Revision: 271464

URL: http://llvm.org/viewvc/llvm-project?rev=271464=rev
Log:
Add C++17 std::not_fn negator.

Summary:
Exactly what it sounds like.

I plan to commit this in a couple of days assuming no objections.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D20799

Added:
libcxx/trunk/test/std/utilities/function.objects/func.not_fn/
libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
Modified:
libcxx/trunk/include/functional
libcxx/trunk/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/functional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/functional?rev=271464=271463=271464=diff
==
--- libcxx/trunk/include/functional (original)
+++ libcxx/trunk/include/functional Wed Jun  1 20:25:41 2016
@@ -207,6 +207,8 @@ public:
 
 template  binary_negate not2(const Predicate& 
pred);
 
+template  unspecified not_fn(F&& f); // C++17
+
 template struct is_bind_expression;
 template struct is_placeholder;
 
@@ -2585,11 +2587,54 @@ struct _LIBCPP_TYPE_VIS_ONLY hash
 
 
 #if _LIBCPP_STD_VER > 14
+
 template 
 result_of_t<_Fn&&(_Args&&...)>
-invoke(_Fn&& __f, _Args&&... __args) {
-return __invoke(_VSTD::forward<_Fn>(__f), 
_VSTD::forward<_Args>(__args)...);
+invoke(_Fn&& __f, _Args&&... __args)
+noexcept(noexcept(_VSTD::__invoke(_VSTD::forward<_Fn>(__f), 
_VSTD::forward<_Args>(__args)...)))
+{
+return _VSTD::__invoke(_VSTD::forward<_Fn>(__f), 
_VSTD::forward<_Args>(__args)...);
 }
+
+template 
+class _LIBCPP_TYPE_VIS_ONLY __not_fn_imp {
+  _DecayFunc __fd;
+
+public:
+__not_fn_imp() = delete;
+
+template 
+_LIBCPP_INLINE_VISIBILITY
+auto operator()(_Args&& ...__args)
+noexcept(noexcept(!_VSTD::invoke(__fd, 
_VSTD::forward<_Args>(__args)...)))
+-> decltype(!_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...))
+{ return !_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...); }
+
+template 
+_LIBCPP_INLINE_VISIBILITY
+auto operator()(_Args&& ...__args) const
+noexcept(noexcept(!_VSTD::invoke(__fd, 
_VSTD::forward<_Args>(__args)...)))
+-> decltype(!_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...))
+{ return !_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...); }
+
+private:
+template , 
__not_fn_imp>::value>>
+_LIBCPP_INLINE_VISIBILITY
+explicit __not_fn_imp(_RawFunc&& __rf)
+: __fd(_VSTD::forward<_RawFunc>(__rf)) {}
+
+template 
+friend inline _LIBCPP_INLINE_VISIBILITY
+__not_fn_imp> not_fn(_RawFunc&&);
+};
+
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+__not_fn_imp> not_fn(_RawFunc&& __fn) {
+return __not_fn_imp>(_VSTD::forward<_RawFunc>(__fn));
+}
+
 #endif
 
 // struct hash in 

Modified: 
libcxx/trunk/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp?rev=271464=271463=271464=diff
==
--- 
libcxx/trunk/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp 
Wed Jun  1 20:25:41 2016
@@ -304,8 +304,46 @@ void bullet_five_tests() {
 }
 }
 
+struct CopyThrows {
+  CopyThrows() {}
+  CopyThrows(CopyThrows const&) {}
+  CopyThrows(CopyThrows&&) noexcept {}
+};
+
+struct NoThrowCallable {
+  void operator()() noexcept {}
+  void operator()(CopyThrows) noexcept {}
+};
+
+struct ThrowsCallable {
+  void operator()() {}
+};
+
+struct MemberObj {
+  int x;
+};
+
+void noexcept_test() {
+{
+NoThrowCallable obj;
+CopyThrows arg;
+static_assert(noexcept(std::invoke(obj)));
+static_assert(!noexcept(std::invoke(obj, arg)));
+static_assert(noexcept(std::invoke(obj, std::move(arg;
+}
+{
+ThrowsCallable obj;
+static_assert(!noexcept(std::invoke(obj)));
+}
+{
+MemberObj obj{42};
+static_assert(noexcept(std::invoke(::x, obj)));
+}
+}
+
 int main() {
 bullet_one_two_tests();
 bullet_three_four_tests();
 bullet_five_tests();
+noexcept_test();
 }

Added: 
libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp?rev=271464=auto
==
--- 
libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp 
(added)
+++ 

Re: [clang-tools-extra] r261991 - [clang-tidy] Fix a crash issue when clang-tidy runs with compilation database.

2016-06-01 Thread Tom Stellard via cfe-commits
On Wed, Jun 01, 2016 at 11:19:44PM +0200, Edoardo P. wrote:
> Ping.
> 
> Deadline to merge the changes to the 3.8 branch is today.
> 

I will make sure to merge this before -rc1.  Thanks for reminding me.

-Tom

> Cheers,
> Edward-san
> 
> 2016-05-24 20:25 GMT+02:00 Edoardo P. :
> > Ping,
> >
> > who's going to merge? I have no commit access.
> >
> > Cheers,
> > Edward-san
> >
> >
> > 2016-05-20 18:34 GMT+02:00 Tom Stellard :
> >> Hi,
> >>
> >> This looks fine to me, go ahead and merge.
> >>
> >> -Tom
> >>
> >> On Thu, May 19, 2016 at 08:29:14PM +0200, Alexander Kornienko wrote:
> >>> On Thu, May 19, 2016 at 4:45 PM, Hans Wennborg  wrote:
> >>>
> >>> > +Tom who manages 3.8.1
> >>> > +Alex who's owner of clang-tidy: is this ok for 3.8.1?
> >>> >
> >>>
> >>> Yes, would be nice to have this in 3.8.1. This fixes a rather annoying
> >>> problem.
> >>>
> >>>
> >>> >
> >>> > On Thu, May 19, 2016 at 1:56 AM, Edoardo P. via cfe-commits
> >>> >  wrote:
> >>> > > Is it possible to port this commit to 3.8.1?
> >>> > >
> >>> > > Cheers,
> >>> > > Edward-san
> >>> > >
> >>> > > 2016-02-26 10:19 GMT+01:00 Haojian Wu via cfe-commits
> >>> > > :
> >>> > >> Author: hokein
> >>> > >> Date: Fri Feb 26 03:19:33 2016
> >>> > >> New Revision: 261991
> >>> > >>
> >>> > >> URL: http://llvm.org/viewvc/llvm-project?rev=261991=rev
> >>> > >> Log:
> >>> > >> [clang-tidy] Fix a crash issue when clang-tidy runs with compilation
> >>> > database.
> >>> > >>
> >>> > >> Summary:
> >>> > >> The clang-tidy will trigger an assertion if it's not in the building
> >>> > directory.
> >>> > >>
> >>> > >> TEST:
> >>> > >> cd /
> >>> > >> ./build/bin/clang-tidy --checks=-*,modernize-use-nullptr -p build
> >>> > tools/clang/tools/extra/clang-tidy/ClangTidy.cpp
> >>> > >>
> >>> > >> The crash issue is gone after applying this patch.
> >>> > >>
> >>> > >> Fixes PR24834, PR26241
> >>> > >>
> >>> > >> Reviewers: bkramer, alexfh
> >>> > >>
> >>> > >> Subscribers: rizsotto.mailinglist, cfe-commits
> >>> > >>
> >>> > >> Differential Revision: http://reviews.llvm.org/D17335
> >>> > >>
> >>> > >> Added:
> >>> > >> 
> >>> > >> clang-tools-extra/trunk/test/clang-tidy/Inputs/compilation-database/
> >>> > >>
> >>> >  
> >>> > clang-tools-extra/trunk/test/clang-tidy/Inputs/compilation-database/template.json
> >>> > >>
> >>> >  
> >>> > clang-tools-extra/trunk/test/clang-tidy/clang-tidy-run-with-database.cpp
> >>> > >> Modified:
> >>> > >> clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
> >>> > >> 
> >>> > >> clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
> >>> > >> clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h
> >>> > >>
> >>> > >> Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
> >>> > >> URL:
> >>> > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=261991=261990=261991=diff
> >>> > >>
> >>> > ==
> >>> > >> --- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
> >>> > >> +++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Fri Feb 26
> >>> > 03:19:33 2016
> >>> > >> @@ -107,6 +107,10 @@ public:
> >>> > >>  DiagPrinter->BeginSourceFile(LangOpts);
> >>> > >>}
> >>> > >>
> >>> > >> +  SourceManager& getSourceManager() {
> >>> > >> +return SourceMgr;
> >>> > >> +  }
> >>> > >> +
> >>> > >>void reportDiagnostic(const ClangTidyError ) {
> >>> > >>  const ClangTidyMessage  = Error.Message;
> >>> > >>  SourceLocation Loc = getLocation(Message.FilePath,
> >>> > Message.FileOffset);
> >>> > >> @@ -124,7 +128,10 @@ public:
> >>> > >>auto Diag = Diags.Report(Loc, Diags.getCustomDiagID(Level, "%0
> >>> > [%1]"))
> >>> > >><< Message.Message << Name;
> >>> > >>for (const tooling::Replacement  : Error.Fix) {
> >>> > >> -SourceLocation FixLoc = getLocation(Fix.getFilePath(),
> >>> > Fix.getOffset());
> >>> > >> +SmallString<128> FixAbsoluteFilePath = Fix.getFilePath();
> >>> > >> +Files.makeAbsolutePath(FixAbsoluteFilePath);
> >>> > >> +SourceLocation FixLoc =
> >>> > >> +getLocation(FixAbsoluteFilePath, Fix.getOffset());
> >>> > >>  SourceLocation FixEndLoc =
> >>> > FixLoc.getLocWithOffset(Fix.getLength());
> >>> > >>  Diag << FixItHint::CreateReplacement(SourceRange(FixLoc,
> >>> > FixEndLoc),
> >>> > >>   
> >>> > >> Fix.getReplacementText());
> >>> > >> @@ -232,6 +239,13 @@ ClangTidyASTConsumerFactory::CreateASTCo
> >>> > >>Context.setCurrentFile(File);
> >>> > >>Context.setASTContext(());
> >>> > >>
> >>> > >> +  auto WorkingDir = Compiler.getSourceManager()
> >>> > >> +.getFileManager()
> >>> > >> +.getVirtualFileSystem()
> >>> > >> + 

Re: [PATCH] D20886: [libcxxabi] Allow target flags to affect configuration tests.

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.


Comment at: CMakeLists.txt:201
@@ +200,3 @@
+  message(FATAL_ERROR "LIBCXXABI_BUILD_32_BITS=ON is not supported on this 
platform.")
+endif()
+

Done in r271462.


http://reviews.llvm.org/D20886



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


[libunwind] r271462 - Add status/warning message for 32 bit builds

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun  1 20:19:52 2016
New Revision: 271462

URL: http://llvm.org/viewvc/llvm-project?rev=271462=rev
Log:
Add status/warning message for 32 bit builds

Modified:
libunwind/trunk/CMakeLists.txt

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=271462=271461=271462=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Wed Jun  1 20:19:52 2016
@@ -110,6 +110,16 @@ set(LIBUNWIND_TARGET_TRIPLE "" CACHE STR
 set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
 set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
 
+
+# Check that we can build with 32 bits if requested.
+if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
+  if (LIBUNWIND_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate 
the output from LLVM
+message(STATUS "Building 32 bits executables and libraries.")
+  endif()
+elseif(LIBUNWIND_BUILD_32_BITS)
+  message(FATAL_ERROR "LIBUNWIND_BUILD_32_BITS=ON is not supported on this 
platform.")
+endif()
+
 
#===
 # Configure System
 
#===


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


Re: [PATCH] D20886: [libcxxabi] Allow target flags to affect configuration tests.

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.


Comment at: CMakeLists.txt:201
@@ +200,3 @@
+  message(FATAL_ERROR "LIBCXXABI_BUILD_32_BITS=ON is not supported on this 
platform.")
+endif()
+

compnerd wrote:
> Why not handle this like libunwind?  Alternative, we could duplicate this 
> into libunwind.  But we should behave similarly across the two I think.
I just forgot to copy/paste it. I'll check it in.


Comment at: CMakeLists.txt:219
@@ +218,3 @@
+list(APPEND LIBCXXABI_LINK_FLAGS ${var})
+endmacro()
+

compnerd wrote:
> No CMAKE_LINKER_FLAGS like libunwind/libc++?
`CMAKE_LINKER_FLAGS` isn't a thing. libunwind and libc++ both use 
`_LINK_FLAGS`.

Also `CMAKE_COMPILE_FLAGS` is not a CMake variable either. (which I did replace 
in libunwind).


http://reviews.llvm.org/D20886



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


r271461 - [docs] Use cpp code-blocks where appropriate

2016-06-01 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Wed Jun  1 20:15:59 2016
New Revision: 271461

URL: http://llvm.org/viewvc/llvm-project?rev=271461=rev
Log:
[docs] Use cpp code-blocks where appropriate

Modified:
cfe/trunk/docs/SourceBasedCodeCoverage.rst

Modified: cfe/trunk/docs/SourceBasedCodeCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SourceBasedCodeCoverage.rst?rev=271461=271460=271461=diff
==
--- cfe/trunk/docs/SourceBasedCodeCoverage.rst (original)
+++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Wed Jun  1 20:15:59 2016
@@ -35,7 +35,7 @@ The code coverage workflow consists of t
 The next few sections work through a complete, copy-'n-paste friendly example
 based on this program:
 
-.. code-block:: console
+.. code-block:: cpp
 
 % cat < foo.cc
 #define BAR(x) ((x) || (x))
@@ -116,7 +116,7 @@ distinct views for ``foo(...)`` and
 ``-show-line-counts-or-regions`` is enabled, ``llvm-cov`` displays sub-line
 region counts (even in macro expansions):
 
-.. code-block:: console
+.. code-block:: cpp
 
20|1|#define BAR(x) ((x) || (x))
^20 ^2


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


[libcxx] r271460 - [libcxx] Allow target flags to affect CMake configuration tests

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun  1 20:10:08 2016
New Revision: 271460

URL: http://llvm.org/viewvc/llvm-project?rev=271460=rev
Log:
[libcxx] Allow target flags to affect CMake configuration tests

Summary:
This patch changes the libc++ CMake so that it adds certain target flags like 
'-m32' or '--gcc-toolchain' before including config-ix.cmake.
Since these flags can affect things like check_library_exists([...]) they 
needed to be added before the tests are performed.

This patch fixes:

https://llvm.org/bugs/show_bug.cgi?id=24322

Reviewers: danalbert, jroelofs, bcraig, compnerd

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D20887

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

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=271460=271459=271460=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Wed Jun  1 20:10:08 2016
@@ -247,6 +247,18 @@ set(LIBCXX_COMPILE_FLAGS "")
 set(LIBCXX_LINK_FLAGS "")
 set(LIBCXX_LIBRARIES "")
 
+# Include macros for adding and removing libc++ flags.
+include(HandleLibcxxFlags)
+
+# Target flags 
+# These flags get added to CMAKE_CXX_FLAGS and CMAKE_C_FLAGS so that
+# 'config-ix' use them during feature checks. It also adds them to both
+# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'
+add_target_flags_if(LIBCXX_BUILD_32_BITS "-m32")
+add_target_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
+add_target_flags_if(LIBCXX_SYSROOT "--sysroot=${LIBCXX_SYSROOT}")
+add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain 
${LIBCXX_GCC_TOOLCHAIN}")
+
 # Configure compiler.
 include(config-ix)
 
@@ -264,9 +276,6 @@ string(TOUPPER "${CMAKE_BUILD_TYPE}" upp
 
 include(HandleLibCXXABI) # Setup the ABI library flags
 
-# Include macros for adding and removing libc++ flags.
-include(HandleLibcxxFlags)
-
 # Remove flags that may have snuck in.
 remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG
  -stdlib=libc++ -stdlib=libstdc++ -lc++abi -m32)
@@ -288,11 +297,6 @@ endif()
 # headers
 add_compile_flags_if_supported(-nostdinc++)
 
-# Target flags 
-add_flags_if(LIBCXX_BUILD_32_BITS -m32)
-add_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
-add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
-add_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
 
 # Warning flags ===
 add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

Modified: libcxx/trunk/cmake/Modules/HandleLibcxxFlags.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleLibcxxFlags.cmake?rev=271460=271459=271460=diff
==
--- libcxx/trunk/cmake/Modules/HandleLibcxxFlags.cmake (original)
+++ libcxx/trunk/cmake/Modules/HandleLibcxxFlags.cmake Wed Jun  1 20:10:08 2016
@@ -76,6 +76,26 @@ macro(config_define value def)
   set(LIBCXX_NEEDS_SITE_CONFIG ON)
 endmacro()
 
+# Add a list of flags to all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS',
+# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
+macro(add_target_flags)
+  foreach(value ${ARGN})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${value}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${value}")
+list(APPEND LIBCXX_COMPILE_FLAGS ${value})
+list(APPEND LIBCXX_LINK_FLAGS ${value})
+  endforeach()
+endmacro()
+
+# If the specified 'condition' is true then add a list of flags to
+# all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXX_COMPILE_FLAGS'
+# and 'LIBCXX_LINK_FLAGS'.
+macro(add_target_flags_if condition)
+  if (${condition})
+add_target_flags(${ARGN})
+  endif()
+endmacro()
+
 # Add a specified list of flags to both 'LIBCXX_COMPILE_FLAGS' and
 # 'LIBCXX_LINK_FLAGS'.
 macro(add_flags)


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


[libcxx] r271459 - Remove enable_shared_from_this test since it leaks the control block and fails with ASAN

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun  1 20:09:12 2016
New Revision: 271459

URL: http://llvm.org/viewvc/llvm-project?rev=271459=rev
Log:
Remove enable_shared_from_this test since it leaks the control block and fails 
with ASAN

Modified:

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=271459=271458=271459=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
 Wed Jun  1 20:09:12 2016
@@ -88,32 +88,6 @@ int main()
 }
 #endif
 }
-// Test LWG issue 2529 again. This time check that an expired pointer
-// is replaced.
-{
-T* ptr = new T;
-std::weak_ptr weak;
-{
-std::shared_ptr s(ptr, );
-assert(ptr->shared_from_this() == s);
-weak = s;
-assert(!weak.expired());
-}
-assert(weak.expired());
-weak.reset();
-#ifndef TEST_HAS_NO_EXCEPTIONS
-try {
-ptr->shared_from_this();
-assert(false);
-} catch (std::bad_weak_ptr const&) {
-} catch (...) { assert(false); }
-#endif
-{
-std::shared_ptr s2(ptr, );
-assert(ptr->shared_from_this() == s2);
-}
-delete ptr;
-}
 // Test weak_from_this_methods
 #if TEST_STD_VER > 14
 {


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


[libunwind] r271458 - [libunwind] Allow target flags to affect CMake configuration tests

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun  1 20:02:10 2016
New Revision: 271458

URL: http://llvm.org/viewvc/llvm-project?rev=271458=rev
Log:
[libunwind] Allow target flags to affect CMake configuration tests

Summary:
This patch changes the libunwind CMake so that it adds certain target flags 
like '-m32' or '--gcc-toolchain' before including config-ix.cmake.
Since these flags can affect things like check_library_exists([...]) they 
needed to be added before the tests are performed.

Additionally this patch adds LIBUNWIND_BUILD_32_BITS which defaults to 
LLVM_BUILD_32_BITS.

This patch fixes:

https://llvm.org/bugs/show_bug.cgi?id=27950
https://llvm.org/bugs/show_bug.cgi?id=27959

Reviewers: jroelofs, danalbert, bcraig, rmaprath, compnerd

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D20889

Modified:
libunwind/trunk/CMakeLists.txt
libunwind/trunk/src/CMakeLists.txt

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=271458=271457=271458=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Wed Jun  1 20:02:10 2016
@@ -99,14 +99,16 @@ endif()
 
#===
 
 # Define options.
+option(LIBUNWIND_BUILD_32_BITS "Build 32 bit libunwind" ${LLVM_BUILD_32_BITS})
 option(LIBUNWIND_ENABLE_ASSERTIONS "Enable assertions independent of build 
mode." ON)
 option(LIBUNWIND_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
 option(LIBUNWIND_ENABLE_SHARED "Build libunwind as a shared library." ON)
 option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding 
support." OFF)
 
-set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE STRING "GCC toolchain for cross 
compiling.")
-set(LIBUNWIND_SYSROOT "" CACHE STRING "Sysroot for cross compiling.")
+set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross 
compiling.")
+set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
+set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
 
 
#===
 # Configure System
@@ -117,17 +119,15 @@ set(CMAKE_MODULE_PATH
 "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
 ${CMAKE_MODULE_PATH})
 
-# Configure compiler.
-include(config-ix)
-
 set(LIBUNWIND_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBUNWIND_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBUNWIND_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
 set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
 
-#===
-# Setup Compiler Flags
-#===
+set(LIBUNWIND_C_FLAGS "")
+set(LIBUNWIND_CXX_FLAGS "")
+set(LIBUNWIND_COMPILE_FLAGS "")
+set(LIBUNWIND_LINK_FLAGS "")
 
 # Get required flags.
 macro(append_if list condition var)
@@ -136,10 +136,29 @@ macro(append_if list condition var)
   endif()
 endmacro()
 
-set(LIBUNWIND_C_FLAGS "")
-set(LIBUNWIND_CXX_FLAGS "")
-set(LIBUNWIND_COMPILE_FLAGS "")
-set(LIBUNWIND_LINK_FLAGS "")
+macro(add_target_flags_if condition var)
+  if (${condition})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${var}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${var}")
+list(APPEND LINUNWIND_COMPILE_FLAGS ${var})
+list(APPEND LIBUNWIND_LINK_FLAGS ${var})
+  endif()
+endmacro()
+
+add_target_flags_if(LIBUNWIND_BUILD_32_BITS "-m32")
+add_target_flags_if(LIBUNWIND_TARGET_TRIPLE
+  "-target ${LIBUNWIND_TARGET_TRIPLE}")
+add_target_flags_if(LIBUNWIND_GCC_TOOLCHAIN
+  "-gcc-toolchain ${LIBUNWIND_GCC_TOOLCHAIN}")
+add_target_flags_if(LIBUNWIND_SYSROOT
+  "--sysroot=${LIBUNWIND_SYSROOT}")
+
+# Configure compiler.
+include(config-ix)
+
+#===
+# Setup Compiler Flags
+#===
 
 append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WERROR_FLAG 
-Werror=return-type)
 
@@ -213,13 +232,6 @@ if (MSVC)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif ()
 
-append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_TARGET_TRIPLE
-  "-target ${LIBUNWIND_TARGET_TRIPLE}")
-append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_GCC_TOOLCHAIN
-  "-gcc-toolchain ${LIBUNWIND_GCC_TOOLCHAIN}")
-append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_SYSROOT
-  "--sysroot=${LIBUNWIND_SYSROOT}")
-
 
#===
 # Setup Source Code
 
#===

Modified: libunwind/trunk/src/CMakeLists.txt
URL: 

r271457 - [docs] Add missing newline to console section

2016-06-01 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Wed Jun  1 20:01:48 2016
New Revision: 271457

URL: http://llvm.org/viewvc/llvm-project?rev=271457=rev
Log:
[docs] Add missing newline to console section

Modified:
cfe/trunk/docs/SourceBasedCodeCoverage.rst

Modified: cfe/trunk/docs/SourceBasedCodeCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SourceBasedCodeCoverage.rst?rev=271457=271456=271457=diff
==
--- cfe/trunk/docs/SourceBasedCodeCoverage.rst (original)
+++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Wed Jun  1 20:01:48 2016
@@ -107,6 +107,7 @@ generate a line-oriented report:
 To demangle any C++ identifiers in the ouput, use:
 
 .. code-block:: console
+
 % llvm-cov show ./foo -instr-profile=foo.profdata | c++filt -n
 
 This report includes a summary view as well as dedicated sub-views for


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


Re: [PATCH] D20887: [libcxx] Allow target flags to affect CMake configuration tests

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 59325.
EricWF added a comment.

Address review comments. Add "=" sign in sysroot.


http://reviews.llvm.org/D20887

Files:
  CMakeLists.txt
  cmake/Modules/HandleLibcxxFlags.cmake

Index: cmake/Modules/HandleLibcxxFlags.cmake
===
--- cmake/Modules/HandleLibcxxFlags.cmake
+++ cmake/Modules/HandleLibcxxFlags.cmake
@@ -76,6 +76,26 @@
   set(LIBCXX_NEEDS_SITE_CONFIG ON)
 endmacro()
 
+# Add a list of flags to all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS',
+# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
+macro(add_target_flags)
+  foreach(value ${ARGN})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${value}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${value}")
+list(APPEND LIBCXX_COMPILE_FLAGS ${value})
+list(APPEND LIBCXX_LINK_FLAGS ${value})
+  endforeach()
+endmacro()
+
+# If the specified 'condition' is true then add a list of flags to
+# all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXX_COMPILE_FLAGS'
+# and 'LIBCXX_LINK_FLAGS'.
+macro(add_target_flags_if condition)
+  if (${condition})
+add_target_flags(${ARGN})
+  endif()
+endmacro()
+
 # Add a specified list of flags to both 'LIBCXX_COMPILE_FLAGS' and
 # 'LIBCXX_LINK_FLAGS'.
 macro(add_flags)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -247,6 +247,18 @@
 set(LIBCXX_LINK_FLAGS "")
 set(LIBCXX_LIBRARIES "")
 
+# Include macros for adding and removing libc++ flags.
+include(HandleLibcxxFlags)
+
+# Target flags 
+# These flags get added to CMAKE_CXX_FLAGS and CMAKE_C_FLAGS so that
+# 'config-ix' use them during feature checks. It also adds them to both
+# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'
+add_target_flags_if(LIBCXX_BUILD_32_BITS "-m32")
+add_target_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
+add_target_flags_if(LIBCXX_SYSROOT "--sysroot=${LIBCXX_SYSROOT}")
+add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain 
${LIBCXX_GCC_TOOLCHAIN}")
+
 # Configure compiler.
 include(config-ix)
 
@@ -264,9 +276,6 @@
 
 include(HandleLibCXXABI) # Setup the ABI library flags
 
-# Include macros for adding and removing libc++ flags.
-include(HandleLibcxxFlags)
-
 # Remove flags that may have snuck in.
 remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG
  -stdlib=libc++ -stdlib=libstdc++ -lc++abi -m32)
@@ -288,11 +297,6 @@
 # headers
 add_compile_flags_if_supported(-nostdinc++)
 
-# Target flags 
-add_flags_if(LIBCXX_BUILD_32_BITS -m32)
-add_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
-add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
-add_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
 
 # Warning flags ===
 add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)


Index: cmake/Modules/HandleLibcxxFlags.cmake
===
--- cmake/Modules/HandleLibcxxFlags.cmake
+++ cmake/Modules/HandleLibcxxFlags.cmake
@@ -76,6 +76,26 @@
   set(LIBCXX_NEEDS_SITE_CONFIG ON)
 endmacro()
 
+# Add a list of flags to all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS',
+# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
+macro(add_target_flags)
+  foreach(value ${ARGN})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${value}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${value}")
+list(APPEND LIBCXX_COMPILE_FLAGS ${value})
+list(APPEND LIBCXX_LINK_FLAGS ${value})
+  endforeach()
+endmacro()
+
+# If the specified 'condition' is true then add a list of flags to
+# all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXX_COMPILE_FLAGS'
+# and 'LIBCXX_LINK_FLAGS'.
+macro(add_target_flags_if condition)
+  if (${condition})
+add_target_flags(${ARGN})
+  endif()
+endmacro()
+
 # Add a specified list of flags to both 'LIBCXX_COMPILE_FLAGS' and
 # 'LIBCXX_LINK_FLAGS'.
 macro(add_flags)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -247,6 +247,18 @@
 set(LIBCXX_LINK_FLAGS "")
 set(LIBCXX_LIBRARIES "")
 
+# Include macros for adding and removing libc++ flags.
+include(HandleLibcxxFlags)
+
+# Target flags 
+# These flags get added to CMAKE_CXX_FLAGS and CMAKE_C_FLAGS so that
+# 'config-ix' use them during feature checks. It also adds them to both
+# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'
+add_target_flags_if(LIBCXX_BUILD_32_BITS "-m32")
+add_target_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
+add_target_flags_if(LIBCXX_SYSROOT "--sysroot=${LIBCXX_SYSROOT}")
+add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
+
 # Configure compiler.
 include(config-ix)
 
@@ -264,9 +276,6 @@
 
 

Re: [PATCH] D20799: Add C++17 std::not_fn negator.

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 59324.
EricWF added a comment.

- Make not_fn call operator conditionally noexcept.
- Make 'std::invoke' conditionally noexcept as well.


http://reviews.llvm.org/D20799

Files:
  include/functional
  test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
  test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
  www/cxx1z_status.html

Index: www/cxx1z_status.html
===
--- www/cxx1z_status.html
+++ www/cxx1z_status.html
@@ -81,9 +81,9 @@
 	http://wg21.link/P0024R2;>P0024R2LWGThe Parallelism TS Should be StandardizedJacksonville
 	http://wg21.link/P0226R1;>P0226R1LWGMathematical Special Functions for C++17Jacksonville
 	http://wg21.link/P0220R1;>P0220R1LWGAdopt Library Fundamentals V1 TS Components for C++17Jacksonville
-	http://wg21.link/P0218R1;>P0218R1LWGAdopt the File System TS for C++17Jacksonville	
+	http://wg21.link/P0218R1;>P0218R1LWGAdopt the File System TS for C++17Jacksonville
 	http://wg21.link/P0033R1;>P0033R1LWGRe-enabling shared_from_thisJacksonvilleComplete3.9
-	http://wg21.link/P0005R4;>P0005R4LWGAdopt not_fn from Library Fundamentals 2 for C++17Jacksonville
+	http://wg21.link/P0005R4;>P0005R4LWGAdopt not_fn from Library Fundamentals 2 for C++17JacksonvilleComplete3.9
 	http://wg21.link/P0152R1;>P0152R1LWGconstexpr atomic::is_always_lock_freeJacksonvilleComplete3.9
 	http://wg21.link/P0185R1;>P0185R1LWGAdding [nothrow-]swappable traitsJacksonvilleComplete3.9
 	http://wg21.link/P0253R1;>P0253R1LWGFixing a design mistake in the searchers interfaceJacksonvilleComplete3.9
Index: test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
===
--- /dev/null
+++ test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
@@ -0,0 +1,540 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template  unspecified not_fn(F&& f);
+
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+#include "type_id.h"
+
+
+///
+//   CALLABLE TEST TYPES
+///
+
+bool returns_true() { return true; }
+
+template 
+struct MoveOnlyCallable {
+  MoveOnlyCallable(MoveOnlyCallable const&) = delete;
+  MoveOnlyCallable(MoveOnlyCallable&& other)
+  : value(other.value)
+  { other.value = !other.value; }
+
+  template 
+  Ret operator()(Args&&...) { return Ret{value}; }
+
+  explicit MoveOnlyCallable(bool x) : value(x) {}
+  Ret value;
+};
+
+template 
+struct CopyCallable {
+  CopyCallable(CopyCallable const& other)
+  : value(other.value) {}
+
+  CopyCallable(CopyCallable&& other)
+  : value(other.value) { other.value = !other.value; }
+
+  template 
+  Ret operator()(Args&&...) { return Ret{value}; }
+
+  explicit CopyCallable(bool x) : value(x)  {}
+  Ret value;
+};
+
+
+template 
+struct ConstCallable {
+  ConstCallable(ConstCallable const& other)
+  : value(other.value) {}
+
+  ConstCallable(ConstCallable&& other)
+  : value(other.value) { other.value = !other.value; }
+
+  template 
+  Ret operator()(Args&&...) const { return Ret{value}; }
+
+  explicit ConstCallable(bool x) : value(x)  {}
+  Ret value;
+};
+
+
+
+template 
+struct NoExceptCallable {
+  NoExceptCallable(NoExceptCallable const& other)
+  : value(other.value) {}
+
+  template 
+  Ret operator()(Args&&...) noexcept { return Ret{value}; }
+
+  template 
+  Ret operator()(Args&&...) const noexcept { return Ret{value}; }
+
+  explicit NoExceptCallable(bool x) : value(x)  {}
+  Ret value;
+};
+
+
+struct CopyAssignableWrapper {
+  CopyAssignableWrapper(CopyAssignableWrapper const&) = default;
+  CopyAssignableWrapper(CopyAssignableWrapper&&) = default;
+  CopyAssignableWrapper& operator=(CopyAssignableWrapper const&) = default;
+  CopyAssignableWrapper& operator=(CopyAssignableWrapper &&) = default;
+
+  template 
+  bool operator()(Args&&...) { return value; }
+
+  explicit CopyAssignableWrapper(bool x) : value(x) {}
+  bool value;
+};
+
+
+struct MoveAssignableWrapper {
+  MoveAssignableWrapper(MoveAssignableWrapper const&) = delete;
+  MoveAssignableWrapper(MoveAssignableWrapper&&) = default;
+  MoveAssignableWrapper& operator=(MoveAssignableWrapper const&) = delete;
+  MoveAssignableWrapper& operator=(MoveAssignableWrapper &&) = default;
+
+  template 
+  bool operator()(Args&&...) { return value; }
+
+  explicit MoveAssignableWrapper(bool x) : value(x) {}
+  bool value;
+};
+
+struct MemFunCallable 

r271454 - [docs] Document the source-based code coverage feature

2016-06-01 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Wed Jun  1 19:51:50 2016
New Revision: 271454

URL: http://llvm.org/viewvc/llvm-project?rev=271454=rev
Log:
[docs] Document the source-based code coverage feature

Differential Revision: http://reviews.llvm.org/D20715

Added:
cfe/trunk/docs/SourceBasedCodeCoverage.rst
Modified:
cfe/trunk/docs/index.rst

Added: cfe/trunk/docs/SourceBasedCodeCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SourceBasedCodeCoverage.rst?rev=271454=auto
==
--- cfe/trunk/docs/SourceBasedCodeCoverage.rst (added)
+++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Wed Jun  1 19:51:50 2016
@@ -0,0 +1,186 @@
+==
+Source-based Code Coverage
+==
+
+.. contents::
+   :local:
+
+Introduction
+
+
+This document explains how to use clang's source-based code coverage feature.
+It's called "source-based" because it operates on AST and preprocessor
+information directly. This allows it to generate very precise coverage data.
+
+Clang ships two other code coverage implementations:
+
+* :doc:`SanitizerCoverage` - A low-overhead tool meant for use alongside the
+  various sanitizers. It can provide up to edge-level coverage.
+
+* gcov - A GCC-compatible coverage implementation which operates on DebugInfo.
+
+From this point onwards "code coverage" will refer to the source-based kind.
+
+The code coverage workflow
+==
+
+The code coverage workflow consists of three main steps:
+
+1. Compiling with coverage enabled.
+
+2. Running the instrumented program.
+
+3. Creating coverage reports.
+
+The next few sections work through a complete, copy-'n-paste friendly example
+based on this program:
+
+.. code-block:: console
+
+% cat < foo.cc
+#define BAR(x) ((x) || (x))
+template  void foo(T x) {
+  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
+}
+int main() {
+  foo(0);
+  foo(0);
+  return 0;
+}
+EOF
+
+Compiling with coverage enabled
+===
+
+To compile code with coverage enabled pass ``-fprofile-instr-generate
+-fcoverage-mapping`` to the compiler:
+
+.. code-block:: console
+
+# Step 1: Compile with coverage enabled.
+% clang++ -fprofile-instr-generate -fcoverage-mapping foo.cc -o foo
+
+Note that linking together code with and without coverage instrumentation is
+supported: any uninstrumented code simply won't be accounted for.
+
+Running the instrumented program
+
+
+The next step is to run the instrumented program. When the program exits it
+will write a **raw profile** to the path specified by the ``LLVM_PROFILE_FILE``
+environment variable. If that variable does not exist the profile is written to
+``default.profraw`` in the current directory of the program.
+
+If ``LLVM_PROFILE_FILE`` contains a path to a non-existent directory the
+missing directory structure will be created.  Additionally, the following
+special **pattern strings** are replaced:
+
+* "%p" expands out to the process ID.
+
+* "%h" expands out to the hostname of the machine running the program.
+
+.. code-block:: console
+
+# Step 2: Run the program.
+% LLVM_PROFILE_FILE="foo.profraw" ./foo
+
+Creating coverage reports
+=
+
+Raw profiles have to be **indexed** before they can be used to generated
+coverage reports. This is done using the "merge" tool in ``llvm-profdata``, so
+named because it can combine and index profiles at the same time:
+
+.. code-block:: console
+
+# Step 3(a): Index the raw profile.
+% llvm-profdata merge -sparse foo.profraw -o foo.profdata
+
+There are multiple different ways to render coverage reports. One option is to
+generate a line-oriented report:
+
+.. code-block:: console
+
+# Step 3(b): Create a line-oriented coverage report.
+% llvm-cov show ./foo -instr-profile=foo.profdata
+
+To demangle any C++ identifiers in the ouput, use:
+
+.. code-block:: console
+% llvm-cov show ./foo -instr-profile=foo.profdata | c++filt -n
+
+This report includes a summary view as well as dedicated sub-views for
+templated functions and their instantiations. For our example program, we get
+distinct views for ``foo(...)`` and ``foo(...)``.  If
+``-show-line-counts-or-regions`` is enabled, ``llvm-cov`` displays sub-line
+region counts (even in macro expansions):
+
+.. code-block:: console
+
+   20|1|#define BAR(x) ((x) || (x))
+   ^20 ^2
+2|2|template  void foo(T x) {
+   22|3|  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
+   ^22 ^20  ^20^20
+2|4|}
+--
+| void foo(int):
+|  1|2|template  void foo(T x) {
+| 11|3|  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
+| ^11 ^10  ^10^10
+|  1|4|}
+   

Re: [PATCH] D20715: [docs] Document the source-based code coverage feature

2016-06-01 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271454: [docs] Document the source-based code coverage 
feature (authored by vedantk).

Changed prior to commit:
  http://reviews.llvm.org/D20715?vs=59078=59322#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20715

Files:
  cfe/trunk/docs/SourceBasedCodeCoverage.rst
  cfe/trunk/docs/index.rst

Index: cfe/trunk/docs/index.rst
===
--- cfe/trunk/docs/index.rst
+++ cfe/trunk/docs/index.rst
@@ -33,6 +33,7 @@
ControlFlowIntegrity
LTOVisibility
SafeStack
+   SourceBasedCodeCoverage
Modules
MSVCCompatibility
CommandGuide/index
Index: cfe/trunk/docs/SourceBasedCodeCoverage.rst
===
--- cfe/trunk/docs/SourceBasedCodeCoverage.rst
+++ cfe/trunk/docs/SourceBasedCodeCoverage.rst
@@ -0,0 +1,186 @@
+==
+Source-based Code Coverage
+==
+
+.. contents::
+   :local:
+
+Introduction
+
+
+This document explains how to use clang's source-based code coverage feature.
+It's called "source-based" because it operates on AST and preprocessor
+information directly. This allows it to generate very precise coverage data.
+
+Clang ships two other code coverage implementations:
+
+* :doc:`SanitizerCoverage` - A low-overhead tool meant for use alongside the
+  various sanitizers. It can provide up to edge-level coverage.
+
+* gcov - A GCC-compatible coverage implementation which operates on DebugInfo.
+
+From this point onwards "code coverage" will refer to the source-based kind.
+
+The code coverage workflow
+==
+
+The code coverage workflow consists of three main steps:
+
+1. Compiling with coverage enabled.
+
+2. Running the instrumented program.
+
+3. Creating coverage reports.
+
+The next few sections work through a complete, copy-'n-paste friendly example
+based on this program:
+
+.. code-block:: console
+
+% cat < foo.cc
+#define BAR(x) ((x) || (x))
+template  void foo(T x) {
+  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
+}
+int main() {
+  foo(0);
+  foo(0);
+  return 0;
+}
+EOF
+
+Compiling with coverage enabled
+===
+
+To compile code with coverage enabled pass ``-fprofile-instr-generate
+-fcoverage-mapping`` to the compiler:
+
+.. code-block:: console
+
+# Step 1: Compile with coverage enabled.
+% clang++ -fprofile-instr-generate -fcoverage-mapping foo.cc -o foo
+
+Note that linking together code with and without coverage instrumentation is
+supported: any uninstrumented code simply won't be accounted for.
+
+Running the instrumented program
+
+
+The next step is to run the instrumented program. When the program exits it
+will write a **raw profile** to the path specified by the ``LLVM_PROFILE_FILE``
+environment variable. If that variable does not exist the profile is written to
+``default.profraw`` in the current directory of the program.
+
+If ``LLVM_PROFILE_FILE`` contains a path to a non-existent directory the
+missing directory structure will be created.  Additionally, the following
+special **pattern strings** are replaced:
+
+* "%p" expands out to the process ID.
+
+* "%h" expands out to the hostname of the machine running the program.
+
+.. code-block:: console
+
+# Step 2: Run the program.
+% LLVM_PROFILE_FILE="foo.profraw" ./foo
+
+Creating coverage reports
+=
+
+Raw profiles have to be **indexed** before they can be used to generated
+coverage reports. This is done using the "merge" tool in ``llvm-profdata``, so
+named because it can combine and index profiles at the same time:
+
+.. code-block:: console
+
+# Step 3(a): Index the raw profile.
+% llvm-profdata merge -sparse foo.profraw -o foo.profdata
+
+There are multiple different ways to render coverage reports. One option is to
+generate a line-oriented report:
+
+.. code-block:: console
+
+# Step 3(b): Create a line-oriented coverage report.
+% llvm-cov show ./foo -instr-profile=foo.profdata
+
+To demangle any C++ identifiers in the ouput, use:
+
+.. code-block:: console
+% llvm-cov show ./foo -instr-profile=foo.profdata | c++filt -n
+
+This report includes a summary view as well as dedicated sub-views for
+templated functions and their instantiations. For our example program, we get
+distinct views for ``foo(...)`` and ``foo(...)``.  If
+``-show-line-counts-or-regions`` is enabled, ``llvm-cov`` displays sub-line
+region counts (even in macro expansions):
+
+.. code-block:: console
+
+   20|1|#define BAR(x) ((x) || (x))
+   ^20 ^2
+2|2|template  void foo(T x) {
+   22|3|  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
+   ^22 ^20  ^20^20
+2|4|}
+

Re: [PATCH] D20715: [docs] Document the source-based code coverage feature

2016-06-01 Thread Vedant Kumar via cfe-commits

> On Jun 1, 2016, at 11:30 AM, Justin Bogner  wrote:
> 
> Vedant Kumar  writes:
>> vsk created this revision.
>> vsk added a reviewer: bogner.
>> vsk added subscribers: kcc, cfe-commits, silvas.
>> 
>> It would be helpful to have a user-friendly guide for code
>> coverage. There is some overlap with [1], but this document visits
>> issues which may affect users in more depth.
>> 
>> Prompted by: https://llvm.org/bugs/show_bug.cgi?id=27781
>> 
>> [1] http://llvm.org/docs/CoverageMappingFormat.html
> ...
>> vsk updated this revision to Diff 59078.
>> vsk marked an inline comment as done.
>> vsk added a comment.
>> 
>> - Actually link in the new document into Index.rst.
> 
> A couple of comments below, but since this is prose it's basically all
> just opinion. Feel free to commit any time - we can always make
> improvements in tree later.

Thanks for all the feedback! I've incorporated all of it with minor
changes.

Let's use r271454 as a starting point, then.

vedant

> 
>> 
>> http://reviews.llvm.org/D20715
>> 
>> Files:
>>  docs/SourceBasedCodeCoverage.rst
>>  docs/index.rst
>> 
>> Index: docs/index.rst
>> ===
>> --- docs/index.rst
>> +++ docs/index.rst
>> @@ -33,6 +33,7 @@
>>ControlFlowIntegrity
>>LTOVisibility
>>SafeStack
>> +   SourceBasedCodeCoverage
>>Modules
>>MSVCCompatibility
>>CommandGuide/index
>> Index: docs/SourceBasedCodeCoverage.rst
>> ===
>> --- /dev/null
>> +++ docs/SourceBasedCodeCoverage.rst
>> @@ -0,0 +1,187 @@
>> +==
>> +Source-based Code Coverage
>> +==
>> +
>> +.. contents::
>> +   :local:
>> +
>> +Introduction
>> +
>> +
>> +This document explains how to use clang's source-based code coverage 
>> feature.
>> +It's called "source-based" because it operates on AST and preprocessor
>> +information directly. This allows it to generate very precise coverage data.
>> +
>> +Clang ships two other code coverage implementations:
>> +
>> +* :doc:`SanitizerCoverage` - A low-overhead tool meant for use alongside the
>> +  various sanitizers. It can provide up to edge-level coverage.
>> +
>> +* gcov - A GCC-compatible coverage implementation which operates on 
>> DebugInfo.
>> +
>> +From this point onwards "code coverage" will refer to the source-based kind.
>> +
>> +The code coverage workflow
>> +==
>> +
>> +The code coverage workflow consists of three main steps:
>> +
>> +1. Compiling with coverage enabled.
>> +
>> +2. Running the instrumented program.
>> +
>> +3. Creating coverage reports.
>> +
>> +The next few sections work through a complete, copy-'n-paste friendly 
>> example
>> +based on this program:
>> +
>> +.. code-block:: console
>> +
>> +% cat < foo.cc
>> +#define BAR(x) ((x) || (x))
>> +template  void foo(T x) {
>> +  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
>> +}
>> +int main() {
>> +  foo(0);
>> +  foo(0);
>> +  return 0;
>> +}
>> +EOF
>> +
>> +Compiling with coverage enabled
>> +===
>> +
>> +To compile code with coverage enabled pass ``-fprofile-instr-generate
>> +-fcoverage-mapping`` to the compiler:
>> +
>> +.. code-block:: console
>> +
>> +# Step 1: Compile with coverage enabled.
>> +% clang++ -fprofile-instr-generate -fcoverage-mapping foo.cc -o foo
>> +
>> +Note that linking together code with and without coverage instrumentation is
>> +supported: any uninstrumented code simply won't be accounted for.
>> +
>> +Running the instrumented program
>> +
>> +
>> +The next step is to run the instrumented program. When the program exits it
>> +will write a **raw profile** to the path specified by the 
>> ``LLVM_PROFILE_FILE``
>> +environment variable. If that variable does not exist the profile is 
>> written to
>> +``./default.profraw``.
> 
> Something like "``default.profraw`` in the current directory of the
> program" might be clearer.
> 
>> +
>> +If ``LLVM_PROFILE_FILE`` contains a path to a non-existent directory the
>> +missing directory structure will be created.  Additionally, the following
>> +special **pattern strings** are replaced:
>> +
>> +* "%p" expands out to the PID.
> 
> Maybe spell out process ID?
> 
>> +
>> +* "%h" expands out to the hostname of the machine running the program.
>> +
>> +.. code-block:: console
>> +
>> +# Step 2: Run the program.
>> +% LLVM_PROFILE_FILE="foo.profraw" ./foo
>> +
>> +Creating coverage reports
>> +=
>> +
>> +Raw profiles have to be **indexed** before they can be used to generated
>> +coverage reports:
>> +
>> +.. code-block:: console
>> +
>> +# Step 3(a): Index the raw profile.
>> +% llvm-profdata merge -sparse foo.profraw -o foo.profdata
>> +
>> +You may be wondering why raw profiles aren't indexed 

Re: [PATCH] D20887: [libcxx] Allow target flags to affect CMake configuration tests

2016-06-01 Thread Saleem Abdulrasool via cfe-commits
compnerd requested changes to this revision.
This revision now requires changes to proceed.


Comment at: CMakeLists.txt:259
@@ +258,3 @@
+add_target_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
+add_target_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
+add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain 
${LIBCXX_GCC_TOOLCHAIN}")

This is missing the `='.  As much as I like the separate arguments, it does 
cause a difference here :-(.  It should be "--sysroot=${LIBCXX_SYSROOT}".


http://reviews.llvm.org/D20887



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


r271451 - [asan] Added -fsanitize-address-use-after-scope flag

2016-06-01 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Wed Jun  1 19:24:20 2016
New Revision: 271451

URL: http://llvm.org/viewvc/llvm-project?rev=271451=rev
Log:
[asan] Added -fsanitize-address-use-after-scope flag

Summary:
Also emit lifetime markers for -fsanitize-address-use-after-scope.
Asan uses life-time markers for use-after-scope check.

PR27453

Reviewers: kcc, eugenis, aizatsky

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20759

Added:
cfe/trunk/test/CodeGen/lifetime-asan.c
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/SanitizerArgs.h
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/Driver/SanitizerArgs.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Driver/fsanitize.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=271451=271450=271451=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Jun  1 19:24:20 2016
@@ -642,6 +642,9 @@ def fsanitize_memory_use_after_dtor : Fl
 def fsanitize_address_field_padding : Joined<["-"], 
"fsanitize-address-field-padding=">,
 Group, 
Flags<[CC1Option]>,
 HelpText<"Level of field padding for 
AddressSanitizer">;
+def fsanitize_address_use_after_scope : Flag<["-"], 
"fsanitize-address-use-after-scope">,
+Group, 
Flags<[CC1Option]>,
+HelpText<"Enable use-after-scope 
detection in AddressSanitizer">;
 def fsanitize_recover : Flag<["-"], "fsanitize-recover">, Group,
 Flags<[CoreOption]>;
 def fno_sanitize_recover : Flag<["-"], "fno-sanitize-recover">,

Modified: cfe/trunk/include/clang/Driver/SanitizerArgs.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/SanitizerArgs.h?rev=271451=271450=271451=diff
==
--- cfe/trunk/include/clang/Driver/SanitizerArgs.h (original)
+++ cfe/trunk/include/clang/Driver/SanitizerArgs.h Wed Jun  1 19:24:20 2016
@@ -34,6 +34,7 @@ class SanitizerArgs {
   bool CfiCrossDso = false;
   int AsanFieldPadding = 0;
   bool AsanSharedRuntime = false;
+  bool AsanUseAfterScope = false;
   bool LinkCXXRuntimes = false;
   bool NeedPIE = false;
   bool Stats = false;

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=271451=271450=271451=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Wed Jun  1 19:24:20 2016
@@ -125,6 +125,8 @@ CODEGENOPT(RelaxAll  , 1, 0) ///
 CODEGENOPT(RelaxedAliasing   , 1, 0) ///< Set when -fno-strict-aliasing is 
enabled.
 CODEGENOPT(StructPathTBAA, 1, 0) ///< Whether or not to use struct-path 
TBAA.
 CODEGENOPT(SaveTempLabels, 1, 0) ///< Save temporary labels.
+CODEGENOPT(SanitizeAddressUseAfterScope , 1, 0) ///< Enable use-after-scope 
detection
+///< in AddressSanitizer
 CODEGENOPT(SanitizeMemoryTrackOrigins, 2, 0) ///< Enable tracking origins in
  ///< MemorySanitizer
 CODEGENOPT(SanitizeMemoryUseAfterDtor, 1, 0) ///< Enable use-after-delete 
detection

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=271451=271450=271451=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed Jun  1 19:24:20 2016
@@ -184,7 +184,7 @@ static void addInstructionCombiningPass(
 }
 
 static void addBoundsCheckingPass(const PassManagerBuilder ,
-legacy::PassManagerBase ) {
+  legacy::PassManagerBase ) {
   PM.add(createBoundsCheckingPass());
 }
 
@@ -210,14 +210,17 @@ static void addAddressSanitizerPasses(co
   static_cast(Builder);
   const CodeGenOptions  = BuilderWrapper.getCGOpts();
   bool Recover = CGOpts.SanitizeRecover.has(SanitizerKind::Address);
-  PM.add(createAddressSanitizerFunctionPass(/*CompileKernel*/false, Recover));
+  bool UseAfterScope = CGOpts.SanitizeAddressUseAfterScope;
+  PM.add(createAddressSanitizerFunctionPass(/*CompileKernel*/ false, Recover,
+UseAfterScope));
   PM.add(createAddressSanitizerModulePass(/*CompileKernel*/false, Recover));
 }
 
 

r271450 - clang/test/Driver/android-ndk-standalone.cpp: Tweak for dos r'\\'.

2016-06-01 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Wed Jun  1 19:19:14 2016
New Revision: 271450

URL: http://llvm.org/viewvc/llvm-project?rev=271450=rev
Log:
clang/test/Driver/android-ndk-standalone.cpp: Tweak for dos r'\\'.

Modified:
cfe/trunk/test/Driver/android-ndk-standalone.cpp

Modified: cfe/trunk/test/Driver/android-ndk-standalone.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/android-ndk-standalone.cpp?rev=271450=271449=271450=diff
==
--- cfe/trunk/test/Driver/android-ndk-standalone.cpp (original)
+++ cfe/trunk/test/Driver/android-ndk-standalone.cpp Wed Jun  1 19:19:14 2016
@@ -17,7 +17,7 @@
 // CHECK-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
 // CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
 // CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
-// CHECK: "-internal-isystem" "{{.*}}/lib/clang/{{[^"]+}}/include"
+// CHECK: "-internal-isystem" 
"{{.*(/|)}}lib{{(/|)}}clang{{(/|)[^"]+(/|)}}include"
 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
 // CHECK: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
@@ -53,7 +53,7 @@
 // CHECK-ARMV7-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi"
 // CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
 // CHECK-ARMV7: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
-// CHECK-ARMV7: "-internal-isystem" "{{.*}}/lib/clang/{{[^"]+}}/include"
+// CHECK-ARMV7: "-internal-isystem" 
"{{.*(/|)}}lib{{(/|)}}clang{{(/|)[^"]+(/|)}}include"
 // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
 // CHECK-ARMV7: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
@@ -111,7 +111,7 @@
 // CHECK-THUMB-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi"
 // CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
 // CHECK-THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
-// CHECK-THUMB: "-internal-isystem" "{{.*}}/lib/clang/{{[^"]+}}/include"
+// CHECK-THUMB: "-internal-isystem" 
"{{.*(/|)}}lib{{(/|)}}clang{{(/|)[^"]+(/|)}}include"
 // CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
 // CHECK-THUMB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
@@ -149,7 +149,7 @@
 // CHECK-ARMV7THUMB-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi"
 // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
 // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
-// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/lib/clang/{{[^"]+}}/include"
+// CHECK-ARMV7THUMB: "-internal-isystem" 
"{{.*(/|)}}lib{{(/|)}}clang{{(/|)[^"]+(/|)}}include"
 // CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
 // CHECK-ARMV7THUMB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"


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


[libcxx] r271449 - Implement P0033R1 - Re-enabling shared_from_this

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun  1 19:15:35 2016
New Revision: 271449

URL: http://llvm.org/viewvc/llvm-project?rev=271449=rev
Log:
Implement P0033R1 - Re-enabling shared_from_this

Summary: See 
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0033r1.html

Reviewers: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D19254

Modified:
libcxx/trunk/include/memory

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=271449=271448=271449=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Wed Jun  1 19:15:35 2016
@@ -4120,7 +4120,7 @@ private:
 void
 __enable_weak_this(const enable_shared_from_this<_Yp>* __e) _NOEXCEPT
 {
-if (__e)
+if (__e && __e->__weak_this_.expired())
 {
 __e->__weak_this_.__ptr_ = const_cast<_Yp*>(static_cast(__e));
 __e->__weak_this_.__cntrl_ = __cntrl_;
@@ -5432,6 +5432,16 @@ public:
 shared_ptr<_Tp const> shared_from_this() const
 {return shared_ptr(__weak_this_);}
 
+#if _LIBCPP_STD_VER > 14
+_LIBCPP_INLINE_VISIBILITY
+weak_ptr<_Tp> weak_from_this() _NOEXCEPT
+   { return __weak_this_; }
+
+_LIBCPP_INLINE_VISIBILITY
+weak_ptr weak_from_this() const _NOEXCEPT
+{ return __weak_this_; }
+#endif // _LIBCPP_STD_VER > 14
+
 template  friend class shared_ptr;
 };
 

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=271449=271448=271449=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
 Wed Jun  1 19:15:35 2016
@@ -18,11 +18,15 @@
 // public:
 // shared_ptr shared_from_this();
 // shared_ptr shared_from_this() const;
+// weak_ptr weak_from_this() noexcept; // C++17
+// weak_ptr weak_from_this() const noexecpt; // C++17
 // };
 
 #include 
 #include 
 
+#include "test_macros.h"
+
 struct T
 : public std::enable_shared_from_this
 {
@@ -32,6 +36,8 @@ struct Y : T {};
 
 struct Z : Y {};
 
+void nullDeleter(void*) {}
+
 int main()
 {
 {  // https://llvm.org/bugs/show_bug.cgi?id=18843
@@ -50,4 +56,84 @@ int main()
 assert(p == q);
 assert(!p.owner_before(q) && !q.owner_before(p)); // p and q share 
ownership
 }
+// Test LWG issue 2529. Only reset '__weak_ptr_' when it's already expired.
+// http://cplusplus.github.io/LWG/lwg-active.html#2529.
+// Test two different ways:
+// * Using 'weak_from_this().expired()' in C++17.
+// * Using 'shared_from_this()' in all dialects.
+{
+
+T* ptr = new T;
+std::shared_ptr s(ptr);
+{
+// Don't re-initialize the "enabled_shared_from_this" base
+// because it already references a non-expired shared_ptr.
+std::shared_ptr s2(ptr, );
+}
+#if TEST_STD_VER > 14
+// The enabled_shared_from_this base should still be referencing
+// the original shared_ptr.
+assert(!ptr->weak_from_this().expired());
+#endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
+{
+try {
+std::shared_ptr new_s = ptr->shared_from_this();
+assert(new_s == s);
+} catch (std::bad_weak_ptr const&) {
+assert(false);
+} catch (...) {
+assert(false);
+}
+}
+#endif
+}
+// Test LWG issue 2529 again. This time check that an expired pointer
+// is replaced.
+{
+T* ptr = new T;
+std::weak_ptr weak;
+{
+std::shared_ptr s(ptr, );
+assert(ptr->shared_from_this() == s);
+weak = s;
+assert(!weak.expired());
+}
+assert(weak.expired());
+weak.reset();
+#ifndef TEST_HAS_NO_EXCEPTIONS
+try {
+ptr->shared_from_this();
+assert(false);
+} catch (std::bad_weak_ptr const&) {
+} catch (...) { assert(false); }
+#endif
+{
+std::shared_ptr s2(ptr, );
+assert(ptr->shared_from_this() == s2);
+}
+delete ptr;
+}
+// Test weak_from_this_methods
+#if TEST_STD_VER > 14
+{
+T* ptr = new T;
+const T* cptr = ptr;
+
+

Re: [PATCH] D19254: Implement P0033R1 - Re-enabling shared_from_this

2016-06-01 Thread Eric Fiselier via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271449: Implement P0033R1 - Re-enabling shared_from_this 
(authored by EricWF).

Changed prior to commit:
  http://reviews.llvm.org/D19254?vs=54150=59316#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19254

Files:
  libcxx/trunk/include/memory
  
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
  libcxx/trunk/www/cxx1z_status.html

Index: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
===
--- libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
+++ libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
@@ -18,11 +18,15 @@
 // public:
 // shared_ptr shared_from_this();
 // shared_ptr shared_from_this() const;
+// weak_ptr weak_from_this() noexcept; // C++17
+// weak_ptr weak_from_this() const noexecpt; // C++17
 // };
 
 #include 
 #include 
 
+#include "test_macros.h"
+
 struct T
 : public std::enable_shared_from_this
 {
@@ -32,6 +36,8 @@
 
 struct Z : Y {};
 
+void nullDeleter(void*) {}
+
 int main()
 {
 {  // https://llvm.org/bugs/show_bug.cgi?id=18843
@@ -50,4 +56,84 @@
 assert(p == q);
 assert(!p.owner_before(q) && !q.owner_before(p)); // p and q share ownership
 }
+// Test LWG issue 2529. Only reset '__weak_ptr_' when it's already expired.
+// http://cplusplus.github.io/LWG/lwg-active.html#2529.
+// Test two different ways:
+// * Using 'weak_from_this().expired()' in C++17.
+// * Using 'shared_from_this()' in all dialects.
+{
+
+T* ptr = new T;
+std::shared_ptr s(ptr);
+{
+// Don't re-initialize the "enabled_shared_from_this" base
+// because it already references a non-expired shared_ptr.
+std::shared_ptr s2(ptr, );
+}
+#if TEST_STD_VER > 14
+// The enabled_shared_from_this base should still be referencing
+// the original shared_ptr.
+assert(!ptr->weak_from_this().expired());
+#endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
+{
+try {
+std::shared_ptr new_s = ptr->shared_from_this();
+assert(new_s == s);
+} catch (std::bad_weak_ptr const&) {
+assert(false);
+} catch (...) {
+assert(false);
+}
+}
+#endif
+}
+// Test LWG issue 2529 again. This time check that an expired pointer
+// is replaced.
+{
+T* ptr = new T;
+std::weak_ptr weak;
+{
+std::shared_ptr s(ptr, );
+assert(ptr->shared_from_this() == s);
+weak = s;
+assert(!weak.expired());
+}
+assert(weak.expired());
+weak.reset();
+#ifndef TEST_HAS_NO_EXCEPTIONS
+try {
+ptr->shared_from_this();
+assert(false);
+} catch (std::bad_weak_ptr const&) {
+} catch (...) { assert(false); }
+#endif
+{
+std::shared_ptr s2(ptr, );
+assert(ptr->shared_from_this() == s2);
+}
+delete ptr;
+}
+// Test weak_from_this_methods
+#if TEST_STD_VER > 14
+{
+T* ptr = new T;
+const T* cptr = ptr;
+
+static_assert(noexcept(ptr->weak_from_this()), "Operation must be noexcept");
+static_assert(noexcept(cptr->weak_from_this()), "Operation must be noexcept");
+
+std::weak_ptr my_weak = ptr->weak_from_this();
+assert(my_weak.expired());
+
+std::weak_ptr my_const_weak = cptr->weak_from_this();
+assert(my_const_weak.expired());
+
+// Enable shared_from_this with ptr.
+std::shared_ptr sptr(ptr);
+my_weak = ptr->weak_from_this();
+assert(!my_weak.expired());
+assert(my_weak.lock().get() == ptr);
+}
+#endif
 }
Index: libcxx/trunk/www/cxx1z_status.html
===
--- libcxx/trunk/www/cxx1z_status.html
+++ libcxx/trunk/www/cxx1z_status.html
@@ -82,7 +82,7 @@
 	http://wg21.link/P0226R1;>P0226R1LWGMathematical Special Functions for C++17Jacksonville
 	http://wg21.link/P0220R1;>P0220R1LWGAdopt Library Fundamentals V1 TS Components for C++17Jacksonville
 	http://wg21.link/P0218R1;>P0218R1LWGAdopt the File System TS for C++17Jacksonville	
-	http://wg21.link/P0033R1;>P0033R1LWGRe-enabling shared_from_thisJacksonville
+	http://wg21.link/P0033R1;>P0033R1LWGRe-enabling shared_from_thisJacksonvilleComplete3.9
 	http://wg21.link/P0005R4;>P0005R4LWGAdopt not_fn from Library Fundamentals 2 for C++17Jacksonville
 	http://wg21.link/P0152R1;>P0152R1LWGconstexpr atomic::is_always_lock_freeJacksonvilleComplete3.9
 	

Re: [PATCH] D20844: FixIt: use getLocForEndOfToken to insert fix-it after a type name.

2016-06-01 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271448: FixIt: use getLocForEndOfToken to insert fix-it 
after a type name. (authored by mren).

Changed prior to commit:
  http://reviews.llvm.org/D20844?vs=59296=59315#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20844

Files:
  cfe/trunk/lib/Parse/ParseObjc.cpp
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/test/FixIt/fixit-interface-as-param.m

Index: cfe/trunk/test/FixIt/fixit-interface-as-param.m
===
--- cfe/trunk/test/FixIt/fixit-interface-as-param.m
+++ cfe/trunk/test/FixIt/fixit-interface-as-param.m
@@ -1,11 +1,20 @@
-// RUN: not %clang_cc1 -triple x86_64-apple-darwin10  
-fdiagnostics-parseable-fixits -x objective-c %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -fblocks 
-fdiagnostics-parseable-fixits -x objective-c %s 2>&1 | FileCheck %s
 // rdar://11311333
 
 @interface NSView @end
 
 @interface INTF
 - (void) drawRect : inView:(NSView)view;
+- (void)test:(NSView )a;
+- (void)foo;
 @end
 
 // CHECK: {7:35-7:35}:"*"
-
+// CHECK: {8:21-8:21}:"*"
+@implementation INTF
+-(void)foo {
+  ^(NSView view) {
+  };
+}
+@end
+// CHECK: {16:11-16:11}:"*"
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -10954,7 +10954,8 @@
   // Parameter declarators cannot be interface types. All ObjC objects are
   // passed by reference.
   if (T->isObjCObjectType()) {
-SourceLocation TypeEndLoc = TSInfo->getTypeLoc().getLocEnd();
+SourceLocation TypeEndLoc =
+getLocForEndOfToken(TSInfo->getTypeLoc().getLocEnd());
 Diag(NameLoc,
  diag::err_object_cannot_be_passed_returned_by_value) << 1 << T
   << FixItHint::CreateInsertion(TypeEndLoc, "*");
Index: cfe/trunk/lib/Parse/ParseObjc.cpp
===
--- cfe/trunk/lib/Parse/ParseObjc.cpp
+++ cfe/trunk/lib/Parse/ParseObjc.cpp
@@ -1277,7 +1277,6 @@
 if (context == Declarator::ObjCResultContext)
   dsContext = DSC_objc_method_result;
 ParseSpecifierQualifierList(declSpec, AS_none, dsContext);
-declSpec.SetRangeEnd(Tok.getLocation());
 Declarator declarator(declSpec, context);
 ParseDeclarator(declarator);
 


Index: cfe/trunk/test/FixIt/fixit-interface-as-param.m
===
--- cfe/trunk/test/FixIt/fixit-interface-as-param.m
+++ cfe/trunk/test/FixIt/fixit-interface-as-param.m
@@ -1,11 +1,20 @@
-// RUN: not %clang_cc1 -triple x86_64-apple-darwin10  -fdiagnostics-parseable-fixits -x objective-c %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fdiagnostics-parseable-fixits -x objective-c %s 2>&1 | FileCheck %s
 // rdar://11311333
 
 @interface NSView @end
 
 @interface INTF
 - (void) drawRect : inView:(NSView)view;
+- (void)test:(NSView )a;
+- (void)foo;
 @end
 
 // CHECK: {7:35-7:35}:"*"
-
+// CHECK: {8:21-8:21}:"*"
+@implementation INTF
+-(void)foo {
+  ^(NSView view) {
+  };
+}
+@end
+// CHECK: {16:11-16:11}:"*"
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -10954,7 +10954,8 @@
   // Parameter declarators cannot be interface types. All ObjC objects are
   // passed by reference.
   if (T->isObjCObjectType()) {
-SourceLocation TypeEndLoc = TSInfo->getTypeLoc().getLocEnd();
+SourceLocation TypeEndLoc =
+getLocForEndOfToken(TSInfo->getTypeLoc().getLocEnd());
 Diag(NameLoc,
  diag::err_object_cannot_be_passed_returned_by_value) << 1 << T
   << FixItHint::CreateInsertion(TypeEndLoc, "*");
Index: cfe/trunk/lib/Parse/ParseObjc.cpp
===
--- cfe/trunk/lib/Parse/ParseObjc.cpp
+++ cfe/trunk/lib/Parse/ParseObjc.cpp
@@ -1277,7 +1277,6 @@
 if (context == Declarator::ObjCResultContext)
   dsContext = DSC_objc_method_result;
 ParseSpecifierQualifierList(declSpec, AS_none, dsContext);
-declSpec.SetRangeEnd(Tok.getLocation());
 Declarator declarator(declSpec, context);
 ParseDeclarator(declarator);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r271448 - FixIt: use getLocForEndOfToken to insert fix-it after a type name.

2016-06-01 Thread Manman Ren via cfe-commits
Author: mren
Date: Wed Jun  1 19:11:03 2016
New Revision: 271448

URL: http://llvm.org/viewvc/llvm-project?rev=271448=rev
Log:
FixIt: use getLocForEndOfToken to insert fix-it after a type name.

Instead of setting DeclSpec's range end to point to the next token
after the DeclSpec, we use getLocForEndOfToken to insert fix-it after a type
name.

Before this fix, fix-it will change
^(NSView view) to ^(*NSView view)

This commit correctly updates the source to ^(NSView* view).

rdar://21042144
Differential Revision: http://reviews.llvm.org/D20844

Modified:
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/FixIt/fixit-interface-as-param.m

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=271448=271447=271448=diff
==
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Wed Jun  1 19:11:03 2016
@@ -1277,7 +1277,6 @@ ParsedType Parser::ParseObjCTypeName(Obj
 if (context == Declarator::ObjCResultContext)
   dsContext = DSC_objc_method_result;
 ParseSpecifierQualifierList(declSpec, AS_none, dsContext);
-declSpec.SetRangeEnd(Tok.getLocation());
 Declarator declarator(declSpec, context);
 ParseDeclarator(declarator);
 

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=271448=271447=271448=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Jun  1 19:11:03 2016
@@ -10954,7 +10954,8 @@ ParmVarDecl *Sema::CheckParameter(DeclCo
   // Parameter declarators cannot be interface types. All ObjC objects are
   // passed by reference.
   if (T->isObjCObjectType()) {
-SourceLocation TypeEndLoc = TSInfo->getTypeLoc().getLocEnd();
+SourceLocation TypeEndLoc =
+getLocForEndOfToken(TSInfo->getTypeLoc().getLocEnd());
 Diag(NameLoc,
  diag::err_object_cannot_be_passed_returned_by_value) << 1 << T
   << FixItHint::CreateInsertion(TypeEndLoc, "*");

Modified: cfe/trunk/test/FixIt/fixit-interface-as-param.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit-interface-as-param.m?rev=271448=271447=271448=diff
==
--- cfe/trunk/test/FixIt/fixit-interface-as-param.m (original)
+++ cfe/trunk/test/FixIt/fixit-interface-as-param.m Wed Jun  1 19:11:03 2016
@@ -1,11 +1,20 @@
-// RUN: not %clang_cc1 -triple x86_64-apple-darwin10  
-fdiagnostics-parseable-fixits -x objective-c %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -fblocks 
-fdiagnostics-parseable-fixits -x objective-c %s 2>&1 | FileCheck %s
 // rdar://11311333
 
 @interface NSView @end
 
 @interface INTF
 - (void) drawRect : inView:(NSView)view;
+- (void)test:(NSView )a;
+- (void)foo;
 @end
 
 // CHECK: {7:35-7:35}:"*"
-
+// CHECK: {8:21-8:21}:"*"
+@implementation INTF
+-(void)foo {
+  ^(NSView view) {
+  };
+}
+@end
+// CHECK: {16:11-16:11}:"*"


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


r271443 - Summary: Remove unused option

2016-06-01 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Wed Jun  1 19:00:38 2016
New Revision: 271443

URL: http://llvm.org/viewvc/llvm-project?rev=271443=rev
Log:
Summary: Remove unused option

Reviewers: kcc, eugenis, aizatsky

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20740

Modified:
cfe/trunk/include/clang/Frontend/CodeGenOptions.def

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=271443=271442=271443=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Wed Jun  1 19:00:38 2016
@@ -58,7 +58,7 @@ CODEGENOPT(DisableLLVMPasses , 1, 0) ///
 CODEGENOPT(DisableRedZone, 1, 0) ///< Set when -mno-red-zone is enabled.
 CODEGENOPT(DisableTailCalls  , 1, 0) ///< Do not emit tail calls.
 CODEGENOPT(EmitDeclMetadata  , 1, 0) ///< Emit special metadata indicating what
- ///< Decl* various IR entities came from. 
+ ///< Decl* various IR entities came from.
  ///< Only useful when running CodeGen as a
  ///< subroutine.
 CODEGENOPT(EmitGcovArcs  , 1, 0) ///< Emit coverage data files, aka. GCDA.
@@ -103,7 +103,7 @@ CODEGENOPT(NoInline  , 1, 0) ///
 CODEGENOPT(NoNaNsFPMath  , 1, 0) ///< Assume FP arguments, results not NaN.
 CODEGENOPT(NoZeroInitializedInBSS , 1, 0) ///< -fno-zero-initialized-in-bss.
 /// \brief Method of Objective-C dispatch to use.
-ENUM_CODEGENOPT(ObjCDispatchMethod, ObjCDispatchMethodKind, 2, Legacy) 
+ENUM_CODEGENOPT(ObjCDispatchMethod, ObjCDispatchMethodKind, 2, Legacy)
 CODEGENOPT(OmitLeafFramePointer , 1, 0) ///< Set when 
-momit-leaf-frame-pointer is
 ///< enabled.
 VALUE_CODEGENOPT(OptimizationLevel, 2, 0) ///< The -O[0-3] option specified.
@@ -125,8 +125,6 @@ CODEGENOPT(RelaxAll  , 1, 0) ///
 CODEGENOPT(RelaxedAliasing   , 1, 0) ///< Set when -fno-strict-aliasing is 
enabled.
 CODEGENOPT(StructPathTBAA, 1, 0) ///< Whether or not to use struct-path 
TBAA.
 CODEGENOPT(SaveTempLabels, 1, 0) ///< Save temporary labels.
-CODEGENOPT(SanitizeAddressZeroBaseShadow , 1, 0) ///< Map shadow memory at zero
- ///< offset in 
AddressSanitizer.
 CODEGENOPT(SanitizeMemoryTrackOrigins, 2, 0) ///< Enable tracking origins in
  ///< MemorySanitizer
 CODEGENOPT(SanitizeMemoryUseAfterDtor, 1, 0) ///< Enable use-after-delete 
detection
@@ -172,7 +170,7 @@ CODEGENOPT(StackRealignment  , 1, 0) ///
  ///< realignment.
 CODEGENOPT(UseInitArray  , 1, 0) ///< Control whether to use .init_array or
  ///< .ctors.
-VALUE_CODEGENOPT(StackAlignment, 32, 0) ///< Overrides default stack 
+VALUE_CODEGENOPT(StackAlignment, 32, 0) ///< Overrides default stack
 ///< alignment, if not 0.
 VALUE_CODEGENOPT(StackProbeSize, 32, 4096) ///< Overrides default stack
///< probe size, even if 0.
@@ -182,8 +180,8 @@ CODEGENOPT(DebugColumnInfo, 1, 0) ///< W
 CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< Whether or not debug info should 
contain
///< external references to a PCH or module.
 
-CODEGENOPT(DebugExplicitImport, 1, 0)  ///< Whether or not debug info should 
-   ///< contain explicit imports for 
+CODEGENOPT(DebugExplicitImport, 1, 0)  ///< Whether or not debug info should
+   ///< contain explicit imports for
///< anonymous namespaces
 
 CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists.


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


Re: [PATCH] D20886: [libcxxabi] Allow target flags to affect configuration tests.

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 59308.
EricWF added a comment.

Add missing declaration for `LIBCXXABI_TARGET_TRIPLE` option.


http://reviews.llvm.org/D20886

Files:
  CMakeLists.txt
  test/CMakeLists.txt
  test/lit.site.cfg.in

Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -10,7 +10,7 @@
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
 config.enable_threads   = "@LIBCXXABI_ENABLE_THREADS@"
 config.use_sanitizer= "@LLVM_USE_SANITIZER@"
-config.enable_32bit = "@LLVM_BUILD_32_BITS@"
+config.enable_32bit = "@LIBCXXABI_BUILD_32_BITS@"
 config.target_info  = "@LIBCXXABI_TARGET_INFO@"
 config.executor = "@LIBCXXABI_EXECUTOR@"
 config.thread_atexit= "@LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL@"
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -10,7 +10,7 @@
   set(LIBCXX_ENABLE_SHARED ON)
 endif()
 
-pythonize_bool(LLVM_BUILD_32_BITS)
+pythonize_bool(LIBCXXABI_BUILD_32_BITS)
 pythonize_bool(LIBCXX_ENABLE_SHARED)
 pythonize_bool(LIBCXXABI_ENABLE_SHARED)
 pythonize_bool(LIBCXXABI_ENABLE_THREADS)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -115,6 +115,8 @@
 option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
 option(LIBCXXABI_ENABLE_THREADS "Build with threads enabled" ON)
 option(LIBCXXABI_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF)
+option(LIBCXXABI_BUILD_32_BITS "Build 32 bit libc++abi." ${LLVM_BUILD_32_BITS})
+set(LIBCXXABI_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
 set(LIBCXXABI_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
 set(LIBCXXABI_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
 set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.")
@@ -173,9 +175,6 @@
   ${CMAKE_MODULE_PATH}
   )
 
-# Configure compiler.
-include(config-ix)
-
 set(LIBCXXABI_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBCXXABI_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXXABI_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
@@ -191,6 +190,16 @@
   "The path to libc++ library.")
 endif ()
 
+
+# Check that we can build with 32 bits if requested.
+if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
+  if (LIBCXXABI_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
+message(STATUS "Building 32 bits executables and libraries.")
+  endif()
+elseif(LIBCXXABI_BUILD_32_BITS)
+  message(FATAL_ERROR "LIBCXXABI_BUILD_32_BITS=ON is not supported on this platform.")
+endif()
+
 #===
 # Setup Compiler Flags
 #===
@@ -202,11 +211,29 @@
   endif()
 endmacro()
 
+macro(add_target_flags_if condition var)
+  if (${condition})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${var}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${var}")
+list(APPEND LIBCXXABI_LINK_FLAGS ${var})
+endmacro()
+
 set(LIBCXXABI_C_FLAGS "")
 set(LIBCXXABI_CXX_FLAGS "")
 set(LIBCXXABI_COMPILE_FLAGS "")
 set(LIBCXXABI_LINK_FLAGS "")
 
+# Configure target flags
+add_target_flags_if(LIBCXXABI_BUILD_32_BITS "-m32")
+add_target_flags_if(LIBCXXABI_TARGET_TRIPLE
+  "-target ${LIBCXXABI_TARGET_TRIPLE}")
+add_target_flags_if(LIBCXXABI_GCC_TOOLCHAIN
+ "-gcc-toolchain ${LIBCXXABI_GCC_TOOLCHAIN}")
+add_target_flags_if(LIBCXXABI_SYSROOT
+  "--sysroot ${LIBCXXABI_SYSROOT}")
+
+# Configure compiler. Must happen after setting the target flags.
+include(config-ix)
 
 if (LIBCXXABI_HAS_NOSTDINCXX_FLAG)
   list(APPEND LIBCXXABI_COMPILE_FLAGS -nostdinc++)
@@ -312,12 +339,6 @@
   add_definitions(-DLIBCXXABI_USE_LLVM_UNWINDER=1)
 endif()
 
-append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_TARGET_TRIPLE
-  "-target ${LIBCXXABI_TARGET_TRIPLE}")
-append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_GCC_TOOLCHAIN
- "-gcc-toolchain ${LIBCXXABI_GCC_TOOLCHAIN}")
-append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_SYSROOT
-  "--sysroot ${LIBCXXABI_SYSROOT}")
 string(REPLACE ";" " " LIBCXXABI_CXX_FLAGS "${LIBCXXABI_CXX_FLAGS}")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXXABI_CXX_FLAGS}")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20881: [libunwind] Add LIBUNWIND_BUILD_32_BITS CMake option.

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF abandoned this revision.
EricWF added a comment.

Abandoning in preference of http://reviews.llvm.org/D20889.


http://reviews.llvm.org/D20881



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


Re: [PATCH] D20889: [libunwind] Allow target flags to affect CMake configuration tests

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 59307.
EricWF added a comment.

Add missing declaration for "LIBUNWIND_TARGET_TRIPLE".


http://reviews.llvm.org/D20889

Files:
  CMakeLists.txt
  src/CMakeLists.txt

Index: src/CMakeLists.txt
===
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -94,17 +94,20 @@
 
 string(REPLACE ";" " " LIBUNWIND_COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}")
 string(REPLACE ";" " " LIBUNWIND_CXX_FLAGS "${LIBUNWIND_CXX_FLAGS}")
+string(REPLACE ";" " " LIBUNWIND_C_FLAGS "${LIBUNWIND_C_FLAGS}")
 string(REPLACE ";" " " LIBUNWIND_LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}")
 
 set_target_properties(unwind
   PROPERTIES
-COMPILE_FLAGS "${CMAKE_COMPILE_FLAGS} ${LIBUNWIND_COMPILE_FLAGS}"
-LINK_FLAGS"${CMAKE_LINK_FLAGS} ${LIBUNWIND_LINK_FLAGS}"
+COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}"
+LINK_FLAGS"${LIBUNWIND_LINK_FLAGS}"
 OUTPUT_NAME   "unwind"
 VERSION   "1.0"
 SOVERSION "1")
 set_property(SOURCE ${LIBUNWIND_CXX_SOURCES}
- APPEND_STRING PROPERTY COMPILE_FLAGS "${LIBUNWIND_CXX_FLAGS}")
+ APPEND_STRING PROPERTY COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${LIBUNWIND_CXX_FLAGS}")
+set_property(SOURCE ${LIBUNWIND_C_SOURCES}
+ APPEND_STRING PROPERTY COMPILE_FLAGS "${CMAKE_C_FLAGS} ${LIBUNWIND_C_FLAGS}")
 
 install(TARGETS unwind
 LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -99,14 +99,16 @@
 #===
 
 # Define options.
+option(LIBUNWIND_BUILD_32_BITS "Build 32 bit libunwind" ${LLVM_BUILD_32_BITS})
 option(LIBUNWIND_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
 option(LIBUNWIND_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
 option(LIBUNWIND_ENABLE_SHARED "Build libunwind as a shared library." ON)
 option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding support." OFF)
 
-set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE STRING "GCC toolchain for cross compiling.")
-set(LIBUNWIND_SYSROOT "" CACHE STRING "Sysroot for cross compiling.")
+set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
+set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
+set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
 
 #===
 # Configure System
@@ -117,29 +119,46 @@
 "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
 ${CMAKE_MODULE_PATH})
 
-# Configure compiler.
-include(config-ix)
-
 set(LIBUNWIND_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBUNWIND_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBUNWIND_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
 set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
 
-#===
-# Setup Compiler Flags
-#===
+set(LIBUNWIND_C_FLAGS "")
+set(LIBUNWIND_CXX_FLAGS "")
+set(LIBUNWIND_COMPILE_FLAGS "")
+set(LIBUNWIND_LINK_FLAGS "")
 
 # Get required flags.
 macro(append_if list condition var)
   if (${condition})
 list(APPEND ${list} ${var})
   endif()
 endmacro()
 
-set(LIBUNWIND_C_FLAGS "")
-set(LIBUNWIND_CXX_FLAGS "")
-set(LIBUNWIND_COMPILE_FLAGS "")
-set(LIBUNWIND_LINK_FLAGS "")
+macro(add_target_flags_if condition var)
+  if (${condition})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${var}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${var}")
+list(APPEND LINUNWIND_COMPILE_FLAGS ${var})
+list(APPEND LIBUNWIND_LINK_FLAGS ${var})
+  endif()
+endmacro()
+
+add_target_flags_if(LIBUNWIND_BUILD_32_BITS "-m32")
+add_target_flags_if(LIBUNWIND_TARGET_TRIPLE
+  "-target ${LIBUNWIND_TARGET_TRIPLE}")
+add_target_flags_if(LIBUNWIND_GCC_TOOLCHAIN
+  "-gcc-toolchain ${LIBUNWIND_GCC_TOOLCHAIN}")
+add_target_flags_if(LIBUNWIND_SYSROOT
+  "--sysroot=${LIBUNWIND_SYSROOT}")
+
+# Configure compiler.
+include(config-ix)
+
+#===
+# Setup Compiler Flags
+#===
 
 append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WERROR_FLAG -Werror=return-type)
 
@@ -213,13 +232,6 @@
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif ()
 
-append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_TARGET_TRIPLE
-  "-target ${LIBUNWIND_TARGET_TRIPLE}")
-append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_GCC_TOOLCHAIN
-  "-gcc-toolchain 

[PATCH] D20889: [libunwind] Allow target flags to affect CMake configuration tests

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: jroelofs, danalbert, compnerd, bcraig, rmaprath.
EricWF added a subscriber: cfe-commits.

This patch changes the libunwind CMake so that it adds certain target flags 
like '-m32' or '--gcc-toolchain' before including config-ix.cmake.
Since these flags can affect things like check_library_exists([...]) they 
needed to be added before the tests are performed.

Additionally this patch adds LIBUNWIND_BUILD_32_BITS which defaults to 
LLVM_BUILD_32_BITS.

This patch fixes:

https://llvm.org/bugs/show_bug.cgi?id=27950
https://llvm.org/bugs/show_bug.cgi?id=27959

http://reviews.llvm.org/D20889

Files:
  CMakeLists.txt
  src/CMakeLists.txt

Index: src/CMakeLists.txt
===
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -94,17 +94,20 @@
 
 string(REPLACE ";" " " LIBUNWIND_COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}")
 string(REPLACE ";" " " LIBUNWIND_CXX_FLAGS "${LIBUNWIND_CXX_FLAGS}")
+string(REPLACE ";" " " LIBUNWIND_C_FLAGS "${LIBUNWIND_C_FLAGS}")
 string(REPLACE ";" " " LIBUNWIND_LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}")
 
 set_target_properties(unwind
   PROPERTIES
-COMPILE_FLAGS "${CMAKE_COMPILE_FLAGS} ${LIBUNWIND_COMPILE_FLAGS}"
-LINK_FLAGS"${CMAKE_LINK_FLAGS} ${LIBUNWIND_LINK_FLAGS}"
+COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}"
+LINK_FLAGS"${LIBUNWIND_LINK_FLAGS}"
 OUTPUT_NAME   "unwind"
 VERSION   "1.0"
 SOVERSION "1")
 set_property(SOURCE ${LIBUNWIND_CXX_SOURCES}
- APPEND_STRING PROPERTY COMPILE_FLAGS "${LIBUNWIND_CXX_FLAGS}")
+ APPEND_STRING PROPERTY COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${LIBUNWIND_CXX_FLAGS}")
+set_property(SOURCE ${LIBUNWIND_C_SOURCES}
+ APPEND_STRING PROPERTY COMPILE_FLAGS "${CMAKE_C_FLAGS} ${LIBUNWIND_C_FLAGS}")
 
 install(TARGETS unwind
 LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -99,6 +99,7 @@
 #===
 
 # Define options.
+option(LIBUNWIND_BUILD_32_BITS "Build 32 bit libunwind" ${LLVM_BUILD_32_BITS})
 option(LIBUNWIND_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
 option(LIBUNWIND_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
@@ -117,29 +118,46 @@
 "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
 ${CMAKE_MODULE_PATH})
 
-# Configure compiler.
-include(config-ix)
-
 set(LIBUNWIND_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBUNWIND_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBUNWIND_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
 set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
 
-#===
-# Setup Compiler Flags
-#===
+set(LIBUNWIND_C_FLAGS "")
+set(LIBUNWIND_CXX_FLAGS "")
+set(LIBUNWIND_COMPILE_FLAGS "")
+set(LIBUNWIND_LINK_FLAGS "")
 
 # Get required flags.
 macro(append_if list condition var)
   if (${condition})
 list(APPEND ${list} ${var})
   endif()
 endmacro()
 
-set(LIBUNWIND_C_FLAGS "")
-set(LIBUNWIND_CXX_FLAGS "")
-set(LIBUNWIND_COMPILE_FLAGS "")
-set(LIBUNWIND_LINK_FLAGS "")
+macro(add_target_flags_if condition var)
+  if (${condition})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${var}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${var}")
+list(APPEND LINUNWIND_COMPILE_FLAGS ${var})
+list(APPEND LIBUNWIND_LINK_FLAGS ${var})
+  endif()
+endmacro()
+
+add_target_flags_if(LIBUNWIND_BUILD_32_BITS "-m32")
+add_target_flags_if(LIBUNWIND_TARGET_TRIPLE
+  "-target ${LIBUNWIND_TARGET_TRIPLE}")
+add_target_flags_if(LIBUNWIND_GCC_TOOLCHAIN
+  "-gcc-toolchain ${LIBUNWIND_GCC_TOOLCHAIN}")
+add_target_flags_if(LIBUNWIND_SYSROOT
+  "--sysroot=${LIBUNWIND_SYSROOT}")
+
+# Configure compiler.
+include(config-ix)
+
+#===
+# Setup Compiler Flags
+#===
 
 append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WERROR_FLAG -Werror=return-type)
 
@@ -213,13 +231,6 @@
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif ()
 
-append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_TARGET_TRIPLE
-  "-target ${LIBUNWIND_TARGET_TRIPLE}")
-append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_GCC_TOOLCHAIN
-  "-gcc-toolchain ${LIBUNWIND_GCC_TOOLCHAIN}")
-append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_SYSROOT
-  "--sysroot=${LIBUNWIND_SYSROOT}")
-
 

Re: [PATCH] D20844: FixIt: use getLocForEndOfToken to insert fix-it after a type name.

2016-06-01 Thread John McCall via cfe-commits
rjmccall added a comment.

LGTM.


http://reviews.llvm.org/D20844



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


[PATCH] D20887: [libcxx] Allow target flags to affect CMake configuration tests

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: danalbert, jroelofs, bcraig, compnerd.
EricWF added a subscriber: cfe-commits.

This patch changes the libc++ CMake so that it adds certain target flags like 
'-m32' or '--gcc-toolchain' before including config-ix.cmake.
Since these flags can affect things like check_library_exists([...]) they 
needed to be added before the tests are performed.

This patch fixes:

https://llvm.org/bugs/show_bug.cgi?id=24322

http://reviews.llvm.org/D20887

Files:
  CMakeLists.txt
  cmake/Modules/HandleLibcxxFlags.cmake

Index: cmake/Modules/HandleLibcxxFlags.cmake
===
--- cmake/Modules/HandleLibcxxFlags.cmake
+++ cmake/Modules/HandleLibcxxFlags.cmake
@@ -76,6 +76,26 @@
   set(LIBCXX_NEEDS_SITE_CONFIG ON)
 endmacro()
 
+# Add a list of flags to all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS',
+# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
+macro(add_target_flags)
+  foreach(value ${ARGN})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${value}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${value}")
+list(APPEND LIBCXX_COMPILE_FLAGS ${value})
+list(APPEND LIBCXX_LINK_FLAGS ${value})
+  endforeach()
+endmacro()
+
+# If the specified 'condition' is true then add a list of flags to
+# all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXX_COMPILE_FLAGS'
+# and 'LIBCXX_LINK_FLAGS'.
+macro(add_target_flags_if condition)
+  if (${condition})
+add_target_flags(${ARGN})
+  endif()
+endmacro()
+
 # Add a specified list of flags to both 'LIBCXX_COMPILE_FLAGS' and
 # 'LIBCXX_LINK_FLAGS'.
 macro(add_flags)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -247,6 +247,18 @@
 set(LIBCXX_LINK_FLAGS "")
 set(LIBCXX_LIBRARIES "")
 
+# Include macros for adding and removing libc++ flags.
+include(HandleLibcxxFlags)
+
+# Target flags 
+# These flags get added to CMAKE_CXX_FLAGS and CMAKE_C_FLAGS so that
+# 'config-ix' use them during feature checks. It also adds them to both
+# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'
+add_target_flags_if(LIBCXX_BUILD_32_BITS "-m32")
+add_target_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
+add_target_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
+add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain 
${LIBCXX_GCC_TOOLCHAIN}")
+
 # Configure compiler.
 include(config-ix)
 
@@ -264,9 +276,6 @@
 
 include(HandleLibCXXABI) # Setup the ABI library flags
 
-# Include macros for adding and removing libc++ flags.
-include(HandleLibcxxFlags)
-
 # Remove flags that may have snuck in.
 remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG
  -stdlib=libc++ -stdlib=libstdc++ -lc++abi -m32)
@@ -288,11 +297,6 @@
 # headers
 add_compile_flags_if_supported(-nostdinc++)
 
-# Target flags 
-add_flags_if(LIBCXX_BUILD_32_BITS -m32)
-add_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
-add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
-add_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
 
 # Warning flags ===
 add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)


Index: cmake/Modules/HandleLibcxxFlags.cmake
===
--- cmake/Modules/HandleLibcxxFlags.cmake
+++ cmake/Modules/HandleLibcxxFlags.cmake
@@ -76,6 +76,26 @@
   set(LIBCXX_NEEDS_SITE_CONFIG ON)
 endmacro()
 
+# Add a list of flags to all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS',
+# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
+macro(add_target_flags)
+  foreach(value ${ARGN})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${value}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${value}")
+list(APPEND LIBCXX_COMPILE_FLAGS ${value})
+list(APPEND LIBCXX_LINK_FLAGS ${value})
+  endforeach()
+endmacro()
+
+# If the specified 'condition' is true then add a list of flags to
+# all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXX_COMPILE_FLAGS'
+# and 'LIBCXX_LINK_FLAGS'.
+macro(add_target_flags_if condition)
+  if (${condition})
+add_target_flags(${ARGN})
+  endif()
+endmacro()
+
 # Add a specified list of flags to both 'LIBCXX_COMPILE_FLAGS' and
 # 'LIBCXX_LINK_FLAGS'.
 macro(add_flags)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -247,6 +247,18 @@
 set(LIBCXX_LINK_FLAGS "")
 set(LIBCXX_LIBRARIES "")
 
+# Include macros for adding and removing libc++ flags.
+include(HandleLibcxxFlags)
+
+# Target flags 
+# These flags get added to CMAKE_CXX_FLAGS and CMAKE_C_FLAGS so that
+# 'config-ix' use them during feature checks. It also adds them to both
+# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'

[PATCH] D20886: [libcxxabi] Allow target flags to affect configuration tests.

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: danalbert, jroelofs, bcraig, compnerd.
EricWF added a subscriber: cfe-commits.

This patch changes the libc++abi CMake so that it adds certain target flags 
like  '-m32' or '--gcc-toolchain' before including `config-ix.cmake`.
Since these flags can affect things like `check_library_exists([...])` they 
needed to be added before the tests are performed.

Additionally this patch adds `LIBCXXABI_BUILD_32_BITS` which defaults to 
`LLVM_BUILD_32_BITS`.

This patch fixes:

https://llvm.org/bugs/show_bug.cgi?id=27950
https://llvm.org/bugs/show_bug.cgi?id=27959

http://reviews.llvm.org/D20886

Files:
  CMakeLists.txt
  test/CMakeLists.txt
  test/lit.site.cfg.in

Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -10,7 +10,7 @@
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
 config.enable_threads   = "@LIBCXXABI_ENABLE_THREADS@"
 config.use_sanitizer= "@LLVM_USE_SANITIZER@"
-config.enable_32bit = "@LLVM_BUILD_32_BITS@"
+config.enable_32bit = "@LIBCXXABI_BUILD_32_BITS@"
 config.target_info  = "@LIBCXXABI_TARGET_INFO@"
 config.executor = "@LIBCXXABI_EXECUTOR@"
 config.thread_atexit= "@LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL@"
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -10,7 +10,7 @@
   set(LIBCXX_ENABLE_SHARED ON)
 endif()
 
-pythonize_bool(LLVM_BUILD_32_BITS)
+pythonize_bool(LIBCXXABI_BUILD_32_BITS)
 pythonize_bool(LIBCXX_ENABLE_SHARED)
 pythonize_bool(LIBCXXABI_ENABLE_SHARED)
 pythonize_bool(LIBCXXABI_ENABLE_THREADS)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -115,6 +115,7 @@
 option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
 option(LIBCXXABI_ENABLE_THREADS "Build with threads enabled" ON)
 option(LIBCXXABI_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF)
+option(LIBCXXABI_BUILD_32_BITS "Build 32 bit libc++abi." ${LLVM_BUILD_32_BITS})
 set(LIBCXXABI_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
 set(LIBCXXABI_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
 set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.")
@@ -173,9 +174,6 @@
   ${CMAKE_MODULE_PATH}
   )
 
-# Configure compiler.
-include(config-ix)
-
 set(LIBCXXABI_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBCXXABI_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXXABI_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
@@ -191,6 +189,16 @@
   "The path to libc++ library.")
 endif ()
 
+
+# Check that we can build with 32 bits if requested.
+if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
+  if (LIBCXXABI_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
+message(STATUS "Building 32 bits executables and libraries.")
+  endif()
+elseif(LIBCXXABI_BUILD_32_BITS)
+  message(FATAL_ERROR "LIBCXXABI_BUILD_32_BITS=ON is not supported on this platform.")
+endif()
+
 #===
 # Setup Compiler Flags
 #===
@@ -202,11 +210,29 @@
   endif()
 endmacro()
 
+macro(add_target_flags_if condition var)
+  if (${condition})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${var}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${var}")
+list(APPEND LIBCXXABI_LINK_FLAGS ${var})
+endmacro()
+
 set(LIBCXXABI_C_FLAGS "")
 set(LIBCXXABI_CXX_FLAGS "")
 set(LIBCXXABI_COMPILE_FLAGS "")
 set(LIBCXXABI_LINK_FLAGS "")
 
+# Configure target flags
+add_target_flags_if(LIBCXXABI_BUILD_32_BITS "-m32")
+add_target_flags_if(LIBCXXABI_TARGET_TRIPLE
+  "-target ${LIBCXXABI_TARGET_TRIPLE}")
+add_target_flags_if(LIBCXXABI_GCC_TOOLCHAIN
+ "-gcc-toolchain ${LIBCXXABI_GCC_TOOLCHAIN}")
+add_target_flags_if(LIBCXXABI_SYSROOT
+  "--sysroot ${LIBCXXABI_SYSROOT}")
+
+# Configure compiler. Must happen after setting the target flags.
+include(config-ix)
 
 if (LIBCXXABI_HAS_NOSTDINCXX_FLAG)
   list(APPEND LIBCXXABI_COMPILE_FLAGS -nostdinc++)
@@ -312,12 +338,6 @@
   add_definitions(-DLIBCXXABI_USE_LLVM_UNWINDER=1)
 endif()
 
-append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_TARGET_TRIPLE
-  "-target ${LIBCXXABI_TARGET_TRIPLE}")
-append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_GCC_TOOLCHAIN
- "-gcc-toolchain ${LIBCXXABI_GCC_TOOLCHAIN}")
-append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_SYSROOT
-  "--sysroot ${LIBCXXABI_SYSROOT}")
 string(REPLACE ";" " " LIBCXXABI_CXX_FLAGS "${LIBCXXABI_CXX_FLAGS}")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXXABI_CXX_FLAGS}")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
___

r271438 - [driver][arm] change regular expression to work on Windows

2016-06-01 Thread Chih-Hung Hsieh via cfe-commits
Author: chh
Date: Wed Jun  1 17:53:59 2016
New Revision: 271438

URL: http://llvm.org/viewvc/llvm-project?rev=271438=rev
Log:
[driver][arm] change regular expression to work on Windows

Differential Revision: http://reviews.llvm.org/D20600

Modified:
cfe/trunk/test/Driver/android-ndk-standalone.cpp

Modified: cfe/trunk/test/Driver/android-ndk-standalone.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/android-ndk-standalone.cpp?rev=271438=271437=271438=diff
==
--- cfe/trunk/test/Driver/android-ndk-standalone.cpp (original)
+++ cfe/trunk/test/Driver/android-ndk-standalone.cpp Wed Jun  1 17:53:59 2016
@@ -17,7 +17,7 @@
 // CHECK-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
 // CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
 // CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
-// CHECK: "-internal-isystem" "{{.*}}/lib/clang/{{[^/]*}}/include"
+// CHECK: "-internal-isystem" "{{.*}}/lib/clang/{{[^"]+}}/include"
 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
 // CHECK: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
@@ -53,7 +53,7 @@
 // CHECK-ARMV7-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi"
 // CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
 // CHECK-ARMV7: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
-// CHECK-ARMV7: "-internal-isystem" "{{.*}}/lib/clang/{{[^/]*}}/include"
+// CHECK-ARMV7: "-internal-isystem" "{{.*}}/lib/clang/{{[^"]+}}/include"
 // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
 // CHECK-ARMV7: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
@@ -111,7 +111,7 @@
 // CHECK-THUMB-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi"
 // CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
 // CHECK-THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
-// CHECK-THUMB: "-internal-isystem" "{{.*}}/lib/clang/{{[^/]*}}/include"
+// CHECK-THUMB: "-internal-isystem" "{{.*}}/lib/clang/{{[^"]+}}/include"
 // CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
 // CHECK-THUMB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
@@ -149,7 +149,7 @@
 // CHECK-ARMV7THUMB-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi"
 // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
 // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
-// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/lib/clang/{{[^/]*}}/include"
+// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/lib/clang/{{[^"]+}}/include"
 // CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
 // CHECK-ARMV7THUMB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"


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


Re: [PATCH] D20844: FixIt: use getLocForEndOfToken to insert fix-it after a type name.

2016-06-01 Thread Manman Ren via cfe-commits
manmanren retitled this revision from "FixIt: correctly set DeclSpec's range 
end for a type name annotation." to "FixIt: use getLocForEndOfToken to insert 
fix-it after a type name.".
manmanren updated the summary for this revision.
manmanren updated this revision to Diff 59296.
manmanren added a comment.

Use getLocForEndOfToken to insert fix-it after a type name instead of setting 
DeclSpec's range end.


http://reviews.llvm.org/D20844

Files:
  lib/Parse/ParseObjc.cpp
  lib/Sema/SemaDecl.cpp
  test/FixIt/fixit-interface-as-param.m

Index: test/FixIt/fixit-interface-as-param.m
===
--- test/FixIt/fixit-interface-as-param.m
+++ test/FixIt/fixit-interface-as-param.m
@@ -5,7 +5,16 @@
 
 @interface INTF
 - (void) drawRect : inView:(NSView)view;
+- (void)test:(NSView )a;
+- (void)foo;
 @end
 
 // CHECK: {7:35-7:35}:"*"
-
+// CHECK: {8:21-8:21}:"*"
+@implementation INTF
+-(void)foo {
+  ^(NSView view) {
+  };
+}
+@end
+// CHECK: {16:11-16:11}:"*"
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -10954,7 +10954,8 @@
   // Parameter declarators cannot be interface types. All ObjC objects are
   // passed by reference.
   if (T->isObjCObjectType()) {
-SourceLocation TypeEndLoc = TSInfo->getTypeLoc().getLocEnd();
+SourceLocation TypeEndLoc =
+getLocForEndOfToken(TSInfo->getTypeLoc().getLocEnd());
 Diag(NameLoc,
  diag::err_object_cannot_be_passed_returned_by_value) << 1 << T
   << FixItHint::CreateInsertion(TypeEndLoc, "*");
Index: lib/Parse/ParseObjc.cpp
===
--- lib/Parse/ParseObjc.cpp
+++ lib/Parse/ParseObjc.cpp
@@ -1277,7 +1277,6 @@
 if (context == Declarator::ObjCResultContext)
   dsContext = DSC_objc_method_result;
 ParseSpecifierQualifierList(declSpec, AS_none, dsContext);
-declSpec.SetRangeEnd(Tok.getLocation());
 Declarator declarator(declSpec, context);
 ParseDeclarator(declarator);
 


Index: test/FixIt/fixit-interface-as-param.m
===
--- test/FixIt/fixit-interface-as-param.m
+++ test/FixIt/fixit-interface-as-param.m
@@ -5,7 +5,16 @@
 
 @interface INTF
 - (void) drawRect : inView:(NSView)view;
+- (void)test:(NSView )a;
+- (void)foo;
 @end
 
 // CHECK: {7:35-7:35}:"*"
-
+// CHECK: {8:21-8:21}:"*"
+@implementation INTF
+-(void)foo {
+  ^(NSView view) {
+  };
+}
+@end
+// CHECK: {16:11-16:11}:"*"
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -10954,7 +10954,8 @@
   // Parameter declarators cannot be interface types. All ObjC objects are
   // passed by reference.
   if (T->isObjCObjectType()) {
-SourceLocation TypeEndLoc = TSInfo->getTypeLoc().getLocEnd();
+SourceLocation TypeEndLoc =
+getLocForEndOfToken(TSInfo->getTypeLoc().getLocEnd());
 Diag(NameLoc,
  diag::err_object_cannot_be_passed_returned_by_value) << 1 << T
   << FixItHint::CreateInsertion(TypeEndLoc, "*");
Index: lib/Parse/ParseObjc.cpp
===
--- lib/Parse/ParseObjc.cpp
+++ lib/Parse/ParseObjc.cpp
@@ -1277,7 +1277,6 @@
 if (context == Declarator::ObjCResultContext)
   dsContext = DSC_objc_method_result;
 ParseSpecifierQualifierList(declSpec, AS_none, dsContext);
-declSpec.SetRangeEnd(Tok.getLocation());
 Declarator declarator(declSpec, context);
 ParseDeclarator(declarator);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20709: Support ARM subtarget feature +long64

2016-06-01 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith.
rsmith added a comment.

The summary and content of this patch are very different.

If you have an ABI variant that any language should be able to target, that 
should be controlled by the triple and related flags, not by a RenderScript 
language option.

If you want to introduce RenderScript as a supported language in Clang, that 
may well be reasonable, but that's a very different discussion.

Normally, we don't want to have ABI variants in clang that only a single 
language can target. There doesn't seem to be any fundamental reason why you 
couldn't compile C++ code for the RenderScript ABI, for instance, so tying the 
ABI to the language doesn't seem like the right approach.


http://reviews.llvm.org/D20709



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


Re: [PATCH] D20844: FixIt: correctly set DeclSpec's range end for a type name annotation.

2016-06-01 Thread Manman Ren via cfe-commits

> On Jun 1, 2016, at 1:18 PM, Richard Smith via cfe-commits 
>  wrote:
> 
> On Wed, Jun 1, 2016 at 12:42 PM, Manman Ren via cfe-commits 
> > wrote:
> manmanren added a comment.
> 
> In http://reviews.llvm.org/D20844#445762 
> , @rjmccall wrote:
> 
> > Hmm.  No, I think the original code is correct here — RangeEnd is a token 
> > range, and those are generally inclusive rather than exclusive.  The fix-it 
> > needs to be inserting at the end of the token.
> 
> 
> We currently insert the fix-it here
> SourceLocation TypeEndLoc = TSInfo->getTypeLoc().getLocEnd();
> 
> Yep, that's the bug. That source location refers to the start of the last 
> token in the source range.

Thanks for the clarification!

>  
> And we call "TL.setNameEndLoc(DS.getLocEnd());" for ObjCInterfaceTypeLoc.
> 
> The problem is that for annotation token, both the start and the end point to 
> the same location. With "DS.SetRangeEnd(Tok.getAnnotationEndLoc());", the 
> DeclSpec has the same start and end location.
> 
> Is there a way to get the real end of the annotation token, since 
> getAnnotationEndLoc returns the start location?
> 
> You can use Preprocessor::getLocForEndOfToken to get the character location 
> past the end of the token. (If you want the * to be after the space in your 
> example, you'll need to also skip that whitespace.)

I will  update the patch with your suggestion.

Thanks,
Manman
> ___
> 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


Re: [PATCH] D20709: Support ARM subtarget feature +long64

2016-06-01 Thread Pirama Arumuga Nainar via cfe-commits
pirama updated this revision to Diff 59294.
pirama removed a reviewer: rsmith.
pirama added a comment.
Herald added subscribers: danalbert, tberghammer.

Add a RenderScript langopt and updated to change long's size and alignment in
TargetInfo::adjust().


http://reviews.llvm.org/D20709

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Driver/Types.def
  include/clang/Frontend/FrontendOptions.h
  lib/Basic/TargetInfo.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/FrontendActions.cpp
  test/CodeGen/renderscript.c

Index: test/CodeGen/renderscript.c
===
--- /dev/null
+++ test/CodeGen/renderscript.c
@@ -0,0 +1,5 @@
+// RUN: %clang -target arm-linux-androideabi -DLONG_SIZE_AND_ALIGN=4 -fsyntax-only %s
+// RUN: %clang -target arm-linux-androideabi -x renderscript -DLONG_SIZE_AND_ALIGN=8 -fsyntax-only %s
+
+_Static_assert(sizeof(long) == LONG_SIZE_AND_ALIGN, "sizeof long is wrong");
+_Static_assert(_Alignof(long) == LONG_SIZE_AND_ALIGN, "alignof long is wrong");
Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -735,6 +735,7 @@
   case IK_PreprocessedObjCXX:
   case IK_AST:
   case IK_LLVM_IR:
+  case IK_Renderscript:
 // We can't do anything with these.
 return;
   }
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1242,6 +1242,7 @@
   .Case("objective-c++-header", IK_ObjCXX)
   .Cases("ast", "pcm", IK_AST)
   .Case("ir", IK_LLVM_IR)
+  .Case("renderscript", IK_Renderscript)
   .Default(IK_None);
 if (DashX == IK_None)
   Diags.Report(diag::err_drv_invalid_value)
@@ -1445,6 +1446,9 @@
 case IK_PreprocessedObjCXX:
   LangStd = LangStandard::lang_gnucxx98;
   break;
+case IK_Renderscript:
+  LangStd = LangStandard::lang_c99;
+  break;
 }
   }
 
@@ -1487,6 +1491,8 @@
   Opts.CUDA = IK == IK_CUDA || IK == IK_PreprocessedCuda ||
   LangStd == LangStandard::lang_cuda;
 
+  Opts.Renderscript = IK == IK_Renderscript;
+
   // OpenCL and C++ both have bool, true, false keywords.
   Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
 
Index: lib/Basic/TargetInfo.cpp
===
--- lib/Basic/TargetInfo.cpp
+++ lib/Basic/TargetInfo.cpp
@@ -318,6 +318,14 @@
 FloatFormat = ::APFloat::IEEEsingle;
 LongDoubleFormat = ::APFloat::IEEEquad;
   }
+
+  if (Opts.Renderscript) {
+// In RenderScript, long types are always 8 bytes wide and aligned to
+// 8-byte boundary.
+if (PointerWidth == 32) {
+  LongWidth = LongAlign = 64;
+}
+  }
 }
 
 bool TargetInfo::initFeatureMap(
Index: include/clang/Frontend/FrontendOptions.h
===
--- include/clang/Frontend/FrontendOptions.h
+++ include/clang/Frontend/FrontendOptions.h
@@ -75,7 +75,8 @@
   IK_CUDA,
   IK_PreprocessedCuda,
   IK_AST,
-  IK_LLVM_IR
+  IK_LLVM_IR,
+  IK_Renderscript
 };
 
   
Index: include/clang/Driver/Types.def
===
--- include/clang/Driver/Types.def
+++ include/clang/Driver/Types.def
@@ -53,6 +53,7 @@
 TYPE("objective-c++-cpp-output", PP_ObjCXX,INVALID, "mii",   "u")
 TYPE("objc++-cpp-output",PP_ObjCXX_Alias, INVALID,  "mii",   "u")
 TYPE("objective-c++",ObjCXX,   PP_ObjCXX,   "mm","u")
+TYPE("renderscript", Renderscript, PP_C,"rs","u")
 
 // C family input files to precompile.
 TYPE("c-header-cpp-output",  PP_CHeader,   INVALID, "i", "p")
Index: include/clang/Basic/LangOptions.def
===
--- include/clang/Basic/LangOptions.def
+++ include/clang/Basic/LangOptions.def
@@ -185,6 +185,7 @@
 LANGOPT(OpenMP, 1, 0, "OpenMP support")
 LANGOPT(OpenMPUseTLS  , 1, 0, "Use TLS for threadprivates or runtime calls")
 LANGOPT(OpenMPIsDevice, 1, 0, "Generate code only for OpenMP target device")
+LANGOPT(Renderscript  , 1, 0, "RenderScript")
 
 LANGOPT(CUDAIsDevice  , 1, 0, "compiling for CUDA device")
 LANGOPT(CUDAAllowVariadicFunctions, 1, 0, "allowing variadic functions in CUDA device code")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20709: Support ARM subtarget feature +long64

2016-06-01 Thread Pirama Arumuga Nainar via cfe-commits
pirama added a reviewer: rsmith.
pirama added a comment.

Adding Richard to reviewers as the planned direction of this patch directly 
relates to the Frontend.


http://reviews.llvm.org/D20709



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


[PATCH] D20883: [cmake] Fix builds with LLVM_ENABLE_PIC=0

2016-06-01 Thread Pavel Labath via cfe-commits
labath created this revision.
labath added a reviewer: beanz.
labath added a subscriber: cfe-commits.

When this flag is specified, the target llvm-lto is not built, but is still
used as a dependency of the test targets. cmake 2.8 silently ignored this
situation, but with cmake_minimum_required(3.4) it becomes an error. Fix this
by avoiding the inclusion the target as a dependency.

http://reviews.llvm.org/D20883

Files:
  test/CMakeLists.txt

Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -68,14 +68,20 @@
 FileCheck count not
 llc
 llvm-bcanalyzer
-llvm-lto
 llvm-objdump
 llvm-profdata
 llvm-readobj
 llvm-symbolizer
-LTO
 opt
 )
+
+  if(TARGET llvm-lto)
+set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-lto)
+  endif()
+
+  if(TARGET LTO)
+set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LTO)
+  endif()
 endif()
 
 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})


Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -68,14 +68,20 @@
 FileCheck count not
 llc
 llvm-bcanalyzer
-llvm-lto
 llvm-objdump
 llvm-profdata
 llvm-readobj
 llvm-symbolizer
-LTO
 opt
 )
+
+  if(TARGET llvm-lto)
+set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-lto)
+  endif()
+
+  if(TARGET LTO)
+set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LTO)
+  endif()
 endif()
 
 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20358: [Clang][AVX512][Intrinsics]Convert AVX non-temporal store builtins to LLVM-native IR.

2016-06-01 Thread Simon Pilgrim via cfe-commits
RKSimon added a comment.

In http://reviews.llvm.org/D20358#446220, @ab wrote:

> In http://reviews.llvm.org/D20358#446218, @ab wrote:
>
> > In http://reviews.llvm.org/D20358#446210, @RKSimon wrote:
> >
> > > Is there any reason why we can't just get rid of all the SSE movnt 
> > > builtins and use __builtin_nontemporal_store instead 
> > > (http://reviews.llvm.org/D12313)?
> >
> >
> > I wanted to suggest that too, but I think you'd have problems with the 
> > (natural?) alignment requirement of __builtin_nontemporal_store (whereas 
> > IIRC, movnti & friends accept unaligned pointers).
>
>
> But now that I look at this again, I suppose we could have some 
> __attribute__((aligned(1))), or something like r271214.


True, luckily that only affects _mm_stream_si32 and _mm_stream_si64 - the 
'real' vector movnt stores all require type alignment. The _mm_stream_load_* 
(movntdqa) loads cases should be trivial as well.


http://reviews.llvm.org/D20358



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


[PATCH] D20881: [libunwind] Add LIBUNWIND_BUILD_32_BITS CMake option.

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: rmaprath, compnerd, jroelofs.
EricWF added a subscriber: cfe-commits.

This option defaults to LLVM_BUILD_32_BITS but it allows it to be modified 
separate from the rest of LLVM.

This is intended to help fix PR27959.
(https://llvm.org/bugs/show_bug.cgi?id=27959)

http://reviews.llvm.org/D20881

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -99,6 +99,7 @@
 
#===
 
 # Define options.
+option(LIBUNWIND_BUILD_32_BITS "Build 32 bit libunwind" ${LLVM_BUILD_32_BITS})
 option(LIBUNWIND_ENABLE_ASSERTIONS "Enable assertions independent of build 
mode." ON)
 option(LIBUNWIND_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
@@ -213,6 +214,8 @@
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif ()
 
+append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_BUILD_32_BITS "-m32")
+append_if(LIBUNWIND_LINK_FLAGS LIBUNWIND_BUILD_32_BITS "-m32")
 append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_TARGET_TRIPLE
   "-target ${LIBUNWIND_TARGET_TRIPLE}")
 append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_GCC_TOOLCHAIN


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -99,6 +99,7 @@
 #===
 
 # Define options.
+option(LIBUNWIND_BUILD_32_BITS "Build 32 bit libunwind" ${LLVM_BUILD_32_BITS})
 option(LIBUNWIND_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
 option(LIBUNWIND_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
@@ -213,6 +214,8 @@
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif ()
 
+append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_BUILD_32_BITS "-m32")
+append_if(LIBUNWIND_LINK_FLAGS LIBUNWIND_BUILD_32_BITS "-m32")
 append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_TARGET_TRIPLE
   "-target ${LIBUNWIND_TARGET_TRIPLE}")
 append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_GCC_TOOLCHAIN
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20358: [Clang][AVX512][Intrinsics]Convert AVX non-temporal store builtins to LLVM-native IR.

2016-06-01 Thread Ahmed Bougacha via cfe-commits
ab added a comment.

In http://reviews.llvm.org/D20358#446218, @ab wrote:

> In http://reviews.llvm.org/D20358#446210, @RKSimon wrote:
>
> > Is there any reason why we can't just get rid of all the SSE movnt builtins 
> > and use __builtin_nontemporal_store instead 
> > (http://reviews.llvm.org/D12313)?
>
>
> I wanted to suggest that too, but I think you'd have problems with the 
> (natural?) alignment requirement of __builtin_nontemporal_store (whereas 
> IIRC, movnti & friends accept unaligned pointers).


But now that I look at this again, I suppose we could have some 
__attribute__((aligned(1))), or something like r271214.


http://reviews.llvm.org/D20358



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


Re: [PATCH] D20358: [Clang][AVX512][Intrinsics]Convert AVX non-temporal store builtins to LLVM-native IR.

2016-06-01 Thread Ahmed Bougacha via cfe-commits
ab added a subscriber: ab.
ab added a comment.

In http://reviews.llvm.org/D20358#446210, @RKSimon wrote:

> Is there any reason why we can't just get rid of all the SSE movnt builtins 
> and use __builtin_nontemporal_store instead (http://reviews.llvm.org/D12313)?


I wanted to suggest that too, but I think you'd have problems with the 
(natural?) alignment requirement of __builtin_nontemporal_store (whereas IIRC, 
movnti & friends accept unaligned pointers).


http://reviews.llvm.org/D20358



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


Re: [PATCH] D20358: [Clang][AVX512][Intrinsics]Convert AVX non-temporal store builtins to LLVM-native IR.

2016-06-01 Thread Simon Pilgrim via cfe-commits
RKSimon added a subscriber: RKSimon.
RKSimon added a comment.

Is there any reason why we can't just get rid of all the SSE movnt builtins and 
use __builtin_nontemporal_store instead (http://reviews.llvm.org/D12313)?


http://reviews.llvm.org/D20358



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


[PATCH] D20880: [Coverage] Push a region and propagate counts through try blocks

2016-06-01 Thread Vedant Kumar via cfe-commits
vsk created this revision.
vsk added reviewers: ikudrin, bogner, MaggieYi, phillip.power.
vsk added a subscriber: cfe-commits.

This lets us handle expansions in the try block properly. Here's how the final 
report changes:

```
Before:

   |   16|// CHECK: Z3fn3v:
  1|   17|void fn3() TRY { return; } // CHECK: [[@LINE]]:15 -> 
[[@LINE+1]]:14 = #1
 ^1 ^1
  0|   18|CATCH(...) {}  // CHECK: [[@LINE]]:12 -> [[@LINE]]:14 
= #2
   |   19|
   |   20|// CHECK: Z3fn4v:
  1|   21|#define TRY2 try { // CHECK-DAG: File 1, [[@LINE]]:18 -> 
[[@LINE]]:19 = #1
  1|   22|void fn4() TRY2 // CHECK-DAG: Expansion,File 0, [[@LINE]]:12 -> 
[[@LINE]]:16 = #1 (Expanded file = 1)
 ^1  ^1
  1|   23|  for (;;)
  1|   24|return;
  1|   25|}
  0|   26|catch (...) {}
   |   27|
   |   28|// CHECK: Z3fn5v:
   |   29|#define TRY3 try { return; } catch (...) // CHECK-DAG: File 2, 
[[@LINE]]:18 -> [[@LINE]]:29 = #1
  0|   30|#define TRY4 try { TRY3 { return; } } catch (...) // CHECK-DAG: 
Expansion,File 1, [[@LINE]]:20 -> [[@LINE]]:24 = #1 (Expanded file = 2)
  1|   31|void fn5() {
  1|   32|  for (;;) {
  0|   33|TRY4 { return; } // CHECK-DAG: Expansion,File 0, [[@LINE]]:5 
-> [[@LINE]]:9 = #1 (Expanded file = 1)
  ^0   ^0
  1|   34|  }  // CHECK-DAG: File 0, [[@LINE-1]]:10 -> 
[[@LINE-1]]:21 = #5
  1|   35|}


After:

   |   20|// CHECK: Z3fn4v:
  1|   21|#define TRY2 try { // CHECK-DAG: File 1, [[@LINE]]:18 -> 
[[@LINE]]:19 = #1
   ^1  ^1
  1|   22|void fn4() TRY2 // CHECK-DAG: Expansion,File 0, [[@LINE]]:12 -> 
[[@LINE]]:16 = #1 (Expanded file = 1)
 ^1  ^1
  1|   23|  for (;;)
  1|   24|return;
  1|   25|}
  0|   26|catch (...) {}
   |   27|
   |   28|// CHECK: Z3fn5v:
  1|   29|#define TRY3 try { return; } catch (...) // CHECK-DAG: File 2, 
[[@LINE]]:18 -> [[@LINE]]:29 = #1
  1|   30|#define TRY4 try { TRY3 { return; } } catch (...) // CHECK-DAG: 
Expansion,File 1, [[@LINE]]:20 -> [[@LINE]]:24 = #1 (Expanded file = 2)
   ^1^1   ^0
  1|   31|void fn5() {
  1|   32|  for (;;) {
  1|   33|TRY4 { return; } // CHECK-DAG: Expansion,File 0, [[@LINE]]:5 
-> [[@LINE]]:9 = #1 (Expanded file = 1)
  ^1   ^0
  1|   34|  }  // CHECK-DAG: File 0, [[@LINE-1]]:10 -> 
[[@LINE-1]]:21 = #5
  1|   35|}
```

http://reviews.llvm.org/D20880

Files:
  lib/CodeGen/CoverageMappingGen.cpp
  test/CoverageMapping/trycatch.cpp
  test/CoverageMapping/trymacro.cpp

Index: test/CoverageMapping/trymacro.cpp
===
--- test/CoverageMapping/trymacro.cpp
+++ test/CoverageMapping/trymacro.cpp
@@ -17,8 +17,27 @@
 void fn3() TRY { return; } // CHECK: [[@LINE]]:15 -> [[@LINE+1]]:14 = #1
 CATCH(...) {}  // CHECK: [[@LINE]]:12 -> [[@LINE]]:14 = #2
 
+// CHECK: Z3fn4v:
+#define TRY2 try { // CHECK-DAG: File 1, [[@LINE]]:18 -> [[@LINE]]:19 = #1
+void fn4() TRY2 // CHECK-DAG: Expansion,File 0, [[@LINE]]:12 -> [[@LINE]]:16 = 
#1 (Expanded file = 1)
+  for (;;)
+return;
+}
+catch (...) {}
+
+// CHECK: Z3fn5v:
+#define TRY3 try { return; } catch (...) // CHECK-DAG: File 2, [[@LINE]]:18 -> 
[[@LINE]]:29 = #1
+#define TRY4 try { TRY3 { return; } } catch (...) // CHECK-DAG: Expansion,File 
1, [[@LINE]]:20 -> [[@LINE]]:24 = #1 (Expanded file = 2)
+void fn5() {
+  for (;;) {
+TRY4 { return; } // CHECK-DAG: Expansion,File 0, [[@LINE]]:5 -> 
[[@LINE]]:9 = #1 (Expanded file = 1)
+  }  // CHECK-DAG: File 0, [[@LINE-1]]:10 -> [[@LINE-1]]:21 = 
#5
+}
+
 int main() {
   fn1();
   fn2();
   fn3();
+  fn4();
+  fn5();
 }
Index: test/CoverageMapping/trycatch.cpp
===
--- test/CoverageMapping/trycatch.cpp
+++ test/CoverageMapping/trycatch.cpp
@@ -23,7 +23,7 @@
   // CHECK-NEXT: main
 int main() {  // CHECK-NEXT: File 0, [[@LINE]]:12 -> 
[[@LINE+13]]:2 = #0
   int j = 1;
-  try {
+  try {   // CHECK-NEXT: File 0, [[@LINE]]:7 -> 
[[@LINE+2]]:4 = #0
 func(j);
   } catch(const Error ) {   // CHECK-NEXT: File 0, [[@LINE]]:27 -> 
[[@LINE+2]]:4 = #2
 j = 1;
Index: lib/CodeGen/CoverageMappingGen.cpp
===
--- lib/CodeGen/CoverageMappingGen.cpp
+++ lib/CodeGen/CoverageMappingGen.cpp
@@ -847,7 +847,12 @@
 
   void VisitCXXTryStmt(const CXXTryStmt *S) {
 extendRegion(S);
-Visit(S->getTryBlock());
+// Handle macros that generate the "try" but not the rest.
+extendRegion(S->getTryBlock());
+
+Counter ParentCount = getRegion().getCounter();
+propagateCounts(ParentCount, S->getTryBlock());
+
 for (unsigned I = 

Re: [PATCH] D20871: [Clang][AVX512][Intrinsics] Adding two definitions _mm512_setzero and _mm512_setzero_epi32

2016-06-01 Thread Simon Pilgrim via cfe-commits
RKSimon added a subscriber: RKSimon.
RKSimon added a comment.

Tests?


http://reviews.llvm.org/D20871



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


r271436 - [X86][SSE] Replace (V)CVTTPS2DQ and VCVTTPD2DQ truncating (round to zero) f32/f64 to i32 with generic IR (clang)

2016-06-01 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Wed Jun  1 16:46:51 2016
New Revision: 271436

URL: http://llvm.org/viewvc/llvm-project?rev=271436=rev
Log:
[X86][SSE] Replace (V)CVTTPS2DQ and VCVTTPD2DQ truncating (round to zero) 
f32/f64 to i32 with generic IR (clang)

The 'cvtt' truncation (round to zero) conversions can be safely represented as 
generic __builtin_convertvector (fptosi) calls instead of x86 intrinsics. We 
already do this (implicitly) for the scalar equivalents.

Note: I looked at updating _mm_cvttpd_epi32 as well but this still requires a 
lot more backend work to correctly lower (both for debug and optimized builds).

Differential Revision: http://reviews.llvm.org/D20859

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avxintrin.h
cfe/trunk/lib/Headers/emmintrin.h
cfe/trunk/test/CodeGen/avx-builtins.c
cfe/trunk/test/CodeGen/builtins-x86.c
cfe/trunk/test/CodeGen/sse2-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=271436=271435=271436=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed Jun  1 16:46:51 2016
@@ -339,7 +339,6 @@ TARGET_BUILTIN(__builtin_ia32_cvttpd2dq,
 TARGET_BUILTIN(__builtin_ia32_cvtsd2si, "iV2d", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_cvtsd2si64, "LLiV2d", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_cvtps2dq, "V4iV4f", "", "sse2")
-TARGET_BUILTIN(__builtin_ia32_cvttps2dq, "V4iV4f", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_clflush, "vvC*", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_lfence, "v", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_mfence, "v", "", "sse2")
@@ -462,9 +461,7 @@ TARGET_BUILTIN(__builtin_ia32_cmpps256,
 TARGET_BUILTIN(__builtin_ia32_cvtdq2ps256, "V8fV8i", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_cvtpd2ps256, "V4fV4d", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_cvtps2dq256, "V8iV8f", "", "avx")
-TARGET_BUILTIN(__builtin_ia32_cvttpd2dq256, "V4iV4d", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_cvtpd2dq256, "V4iV4d", "", "avx")
-TARGET_BUILTIN(__builtin_ia32_cvttps2dq256, "V8iV8f", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_vperm2f128_pd256, "V4dV4dV4dIc", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_vperm2f128_ps256, "V8fV8fV8fIc", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_vperm2f128_si256, "V8iV8iV8iIc", "", "avx")

Modified: cfe/trunk/lib/Headers/avxintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avxintrin.h?rev=271436=271435=271436=diff
==
--- cfe/trunk/lib/Headers/avxintrin.h (original)
+++ cfe/trunk/lib/Headers/avxintrin.h Wed Jun  1 16:46:51 2016
@@ -2108,7 +2108,7 @@ _mm256_cvtps_pd(__m128 __a)
 static __inline __m128i __DEFAULT_FN_ATTRS
 _mm256_cvttpd_epi32(__m256d __a)
 {
-  return (__m128i)__builtin_ia32_cvttpd2dq256((__v4df) __a);
+  return (__m128i)__builtin_convertvector((__v4df) __a, __v4si);
 }
 
 static __inline __m128i __DEFAULT_FN_ATTRS
@@ -2120,7 +2120,7 @@ _mm256_cvtpd_epi32(__m256d __a)
 static __inline __m256i __DEFAULT_FN_ATTRS
 _mm256_cvttps_epi32(__m256 __a)
 {
-  return (__m256i)__builtin_ia32_cvttps2dq256((__v8sf) __a);
+  return (__m256i)__builtin_convertvector((__v8sf) __a, __v8si);
 }
 
 static __inline double __DEFAULT_FN_ATTRS

Modified: cfe/trunk/lib/Headers/emmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/emmintrin.h?rev=271436=271435=271436=diff
==
--- cfe/trunk/lib/Headers/emmintrin.h (original)
+++ cfe/trunk/lib/Headers/emmintrin.h Wed Jun  1 16:46:51 2016
@@ -1744,7 +1744,7 @@ _mm_cvtps_epi32(__m128 __a)
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_cvttps_epi32(__m128 __a)
 {
-  return (__m128i)__builtin_ia32_cvttps2dq((__v4sf)__a);
+  return (__m128i)__builtin_convertvector((__v4sf)__a, __v4si);
 }
 
 /// \brief Returns a vector of [4 x i32] where the lowest element is the input

Modified: cfe/trunk/test/CodeGen/avx-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx-builtins.c?rev=271436=271435=271436=diff
==
--- cfe/trunk/test/CodeGen/avx-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx-builtins.c Wed Jun  1 16:46:51 2016
@@ -286,13 +286,13 @@ __m256d test_mm256_cvtps_pd(__m128 A) {
 
 __m128i test_mm256_cvttpd_epi32(__m256d A) {
   // CHECK-LABEL: test_mm256_cvttpd_epi32
-  // CHECK: call <4 x i32> @llvm.x86.avx.cvtt.pd2dq.256(<4 x double> %{{.*}})
+  // CHECK: fptosi <4 x double> %{{.*}} to <4 x i32>
   return _mm256_cvttpd_epi32(A);
 }
 
 __m256i test_mm256_cvttps_epi32(__m256 A) {
   // CHECK-LABEL: test_mm256_cvttps_epi32
-  // CHECK: call <8 x i32> @llvm.x86.avx.cvtt.ps2dq.256(<8 x float> %{{.*}})
+  // CHECK: 

Re: [PATCH] D20859: [X86][SSE] Replace (V)CVTTPS2DQ and VCVTTPD2DQ truncating (round to zero) f32/f64 to i32 with generic IR (clang)

2016-06-01 Thread Simon Pilgrim via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271436: [X86][SSE] Replace (V)CVTTPS2DQ and VCVTTPD2DQ 
truncating (round to zero)… (authored by RKSimon).

Changed prior to commit:
  http://reviews.llvm.org/D20859?vs=59204=59284#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20859

Files:
  cfe/trunk/include/clang/Basic/BuiltinsX86.def
  cfe/trunk/lib/Headers/avxintrin.h
  cfe/trunk/lib/Headers/emmintrin.h
  cfe/trunk/test/CodeGen/avx-builtins.c
  cfe/trunk/test/CodeGen/builtins-x86.c
  cfe/trunk/test/CodeGen/sse2-builtins.c

Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def
@@ -339,7 +339,6 @@
 TARGET_BUILTIN(__builtin_ia32_cvtsd2si, "iV2d", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_cvtsd2si64, "LLiV2d", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_cvtps2dq, "V4iV4f", "", "sse2")
-TARGET_BUILTIN(__builtin_ia32_cvttps2dq, "V4iV4f", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_clflush, "vvC*", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_lfence, "v", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_mfence, "v", "", "sse2")
@@ -462,9 +461,7 @@
 TARGET_BUILTIN(__builtin_ia32_cvtdq2ps256, "V8fV8i", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_cvtpd2ps256, "V4fV4d", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_cvtps2dq256, "V8iV8f", "", "avx")
-TARGET_BUILTIN(__builtin_ia32_cvttpd2dq256, "V4iV4d", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_cvtpd2dq256, "V4iV4d", "", "avx")
-TARGET_BUILTIN(__builtin_ia32_cvttps2dq256, "V8iV8f", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_vperm2f128_pd256, "V4dV4dV4dIc", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_vperm2f128_ps256, "V8fV8fV8fIc", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_vperm2f128_si256, "V8iV8iV8iIc", "", "avx")
Index: cfe/trunk/test/CodeGen/avx-builtins.c
===
--- cfe/trunk/test/CodeGen/avx-builtins.c
+++ cfe/trunk/test/CodeGen/avx-builtins.c
@@ -286,13 +286,13 @@
 
 __m128i test_mm256_cvttpd_epi32(__m256d A) {
   // CHECK-LABEL: test_mm256_cvttpd_epi32
-  // CHECK: call <4 x i32> @llvm.x86.avx.cvtt.pd2dq.256(<4 x double> %{{.*}})
+  // CHECK: fptosi <4 x double> %{{.*}} to <4 x i32>
   return _mm256_cvttpd_epi32(A);
 }
 
 __m256i test_mm256_cvttps_epi32(__m256 A) {
   // CHECK-LABEL: test_mm256_cvttps_epi32
-  // CHECK: call <8 x i32> @llvm.x86.avx.cvtt.ps2dq.256(<8 x float> %{{.*}})
+  // CHECK: fptosi <8 x float> %{{.*}} to <8 x i32>
   return _mm256_cvttps_epi32(A);
 }
 
Index: cfe/trunk/test/CodeGen/builtins-x86.c
===
--- cfe/trunk/test/CodeGen/builtins-x86.c
+++ cfe/trunk/test/CodeGen/builtins-x86.c
@@ -335,7 +335,6 @@
   tmp_LLi = __builtin_ia32_cvtsd2si64(tmp_V2d);
 #endif
   tmp_V4i = __builtin_ia32_cvtps2dq(tmp_V4f);
-  tmp_V4i = __builtin_ia32_cvttps2dq(tmp_V4f);
   (void) __builtin_ia32_clflush(tmp_vCp);
   (void) __builtin_ia32_lfence();
   (void) __builtin_ia32_mfence();
@@ -415,9 +414,7 @@
   tmp_V8f = __builtin_ia32_cvtdq2ps256(tmp_V8i);
   tmp_V4f = __builtin_ia32_cvtpd2ps256(tmp_V4d);
   tmp_V8i = __builtin_ia32_cvtps2dq256(tmp_V8f);
-  tmp_V4i = __builtin_ia32_cvttpd2dq256(tmp_V4d);
   tmp_V4i = __builtin_ia32_cvtpd2dq256(tmp_V4d);
-  tmp_V8i = __builtin_ia32_cvttps2dq256(tmp_V8f);
   tmp_V4d = __builtin_ia32_vperm2f128_pd256(tmp_V4d, tmp_V4d, 0x7);
   tmp_V8f = __builtin_ia32_vperm2f128_ps256(tmp_V8f, tmp_V8f, 0x7);
   tmp_V8i = __builtin_ia32_vperm2f128_si256(tmp_V8i, tmp_V8i, 0x7);
Index: cfe/trunk/test/CodeGen/sse2-builtins.c
===
--- cfe/trunk/test/CodeGen/sse2-builtins.c
+++ cfe/trunk/test/CodeGen/sse2-builtins.c
@@ -533,7 +533,7 @@
 
 __m128i test_mm_cvttps_epi32(__m128 A) {
   // CHECK-LABEL: test_mm_cvttps_epi32
-  // CHECK: call <4 x i32> @llvm.x86.sse2.cvttps2dq(<4 x float> %{{.*}})
+  // CHECK: fptosi <4 x float> %{{.*}} to <4 x i32>
   return _mm_cvttps_epi32(A);
 }
 
Index: cfe/trunk/lib/Headers/avxintrin.h
===
--- cfe/trunk/lib/Headers/avxintrin.h
+++ cfe/trunk/lib/Headers/avxintrin.h
@@ -2108,7 +2108,7 @@
 static __inline __m128i __DEFAULT_FN_ATTRS
 _mm256_cvttpd_epi32(__m256d __a)
 {
-  return (__m128i)__builtin_ia32_cvttpd2dq256((__v4df) __a);
+  return (__m128i)__builtin_convertvector((__v4df) __a, __v4si);
 }
 
 static __inline __m128i __DEFAULT_FN_ATTRS
@@ -2120,7 +2120,7 @@
 static __inline __m256i __DEFAULT_FN_ATTRS
 _mm256_cvttps_epi32(__m256 __a)
 {
-  return (__m256i)__builtin_ia32_cvttps2dq256((__v8sf) __a);
+  return (__m256i)__builtin_convertvector((__v8sf) __a, __v8si);
 }
 
 static __inline double __DEFAULT_FN_ATTRS
Index: cfe/trunk/lib/Headers/emmintrin.h
===
--- cfe/trunk/lib/Headers/emmintrin.h
+++ 

Re: [PATCH] D19201: [clang-tidy] misc-throw-with-noexcept

2016-06-01 Thread Stanisław Barzowski via cfe-commits
sbarzowski marked 11 inline comments as done.


Comment at: clang-tidy/misc/ThrowWithNoexceptCheck.cpp:33
@@ +32,3 @@
+// token including trailing whitespace.
+static SourceRange findToken(const SourceManager , LangOptions 
LangOpts,
+ SourceLocation StartLoc, SourceLocation EndLoc,

I agree 100%. I see the code here as a temporary solution, before we have a 
proper AST functionality for doing that cleanly.


Repository:
  rL LLVM

http://reviews.llvm.org/D19201



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


Re: [PATCH] D19201: [clang-tidy] misc-throw-with-noexcept

2016-06-01 Thread Piotr Padlewski via cfe-commits
Prazek added inline comments.


Comment at: clang-tidy/misc/ThrowWithNoexceptCheck.cpp:25
@@ +24,3 @@
+  Finder->addMatcher(
+  cxxThrowExpr(stmt(hasAncestor(functionDecl(isNoThrow()).bind("func"
+  .bind("throw"),

aaron.ballman wrote:
> Prazek wrote:
> > you can use forFunction instead of hasAncestor(functionDecl(
> > cxxThrowExpr(stmt(forFunction(isNoThrow() or 
> > cxxThrowExpr(stmt(forFunction(functionDecl(isNoThrow(
> > you can even try to remove stmt.
> > 
> > 
> > Also add test case
> > 
> >   void getFunction() noexcept {
> >struct X { 
> > static void inner()
> > {
> > throw 42;
> > }
> >}; 
> >   }
> > 
> Hmm, I wonder if it's trivial enough to filter out throw statements that are 
> inside a try block scope (even without checking the expression and catch 
> block types)?
unless(hasAncestor(cxxTryStmt())) should do the work for almost all cases. 
Maybe even something like this to catch only valid try blocks

 cxxThrowExpr(stmt(forFunction(functionDecl(isNoThrow()).bind("func"))),
unless(hasAncestor(cxxTryStmt().bind("try"), 
forFunction(hasBody(hasDescendant(equalsBoundNode("try")

+ it should check that the throw is not in CXXCatchStmt (unless it is in 
another try block).



Repository:
  rL LLVM

http://reviews.llvm.org/D19201



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


r271431 - [Sema] Fix incorrect enum token namespace

2016-06-01 Thread Etienne Bergeron via cfe-commits
Author: etienneb
Date: Wed Jun  1 16:17:32 2016
New Revision: 271431

URL: http://llvm.org/viewvc/llvm-project?rev=271431=rev
Log:
[Sema] Fix incorrect enum token namespace

Summary:
This patch fix the scoping of enum literal. They were not resolving
to the right type.

It was not causing any problem as one is a copy of the other one.

The literal in the switch are resolving to Sema.h:5527
```
  enum AccessResult {
AR_accessible,
AR_inaccessible,
AR_dependent,
AR_delayed
  };
```

Instead of SemaAccess.cpp:27
```
/// A copy of Sema's enum without AR_delayed.
enum AccessResult {
  AR_accessible,
  AR_inaccessible,
  AR_dependent
};
```

This issue was found by a new clang-tidy check (still on-going).

Reviewers: rsmith, aaron.ballman

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D20773

Modified:
cfe/trunk/lib/Sema/SemaAccess.cpp

Modified: cfe/trunk/lib/Sema/SemaAccess.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=271431=271430=271431=diff
==
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Wed Jun  1 16:17:32 2016
@@ -1766,9 +1766,9 @@ Sema::AccessResult Sema::CheckFriendAcce
   // while the ParsingDeclarator is active.
   EffectiveContext EC(CurContext);
   switch (CheckEffectiveAccess(*this, EC, target->getLocation(), entity)) {
-  case AR_accessible: return Sema::AR_accessible;
-  case AR_inaccessible: return Sema::AR_inaccessible;
-  case AR_dependent: return Sema::AR_dependent;
+  case ::AR_accessible: return Sema::AR_accessible;
+  case ::AR_inaccessible: return Sema::AR_inaccessible;
+  case ::AR_dependent: return Sema::AR_dependent;
   }
   llvm_unreachable("invalid access result");
 }


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


Re: [PATCH] D19201: [clang-tidy] misc-throw-with-noexcept

2016-06-01 Thread Stanisław Barzowski via cfe-commits
sbarzowski updated this revision to Diff 59277.
sbarzowski added a comment.

Thanks for review, guys. I fixed as many easy problems as I had time for today, 
will continue later.


Repository:
  rL LLVM

http://reviews.llvm.org/D19201

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/ThrowWithNoexceptCheck.cpp
  clang-tidy/misc/ThrowWithNoexceptCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-throw-with-noexcept.rst
  test/clang-tidy/misc-throw-with-noexcept.cpp

Index: test/clang-tidy/misc-throw-with-noexcept.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-throw-with-noexcept.cpp
@@ -0,0 +1,85 @@
+// RUN: %check_clang_tidy %s misc-throw-with-noexcept %t
+
+void f_throw_with_ne() noexcept(true) {
+  {
+throw 5;
+  }
+}
+// CHECK-MESSAGES: :[[@LINE-5]]:24: warning: In function declared no-throw here: [misc-throw-with-noexcept]
+// CHECK-MESSAGES: :[[@LINE-4]]:5: warning: 'throw' expression in a function declared with a non-throwing exception specification [misc-throw-with-noexcept]
+// CHECK-FIXES: void f_throw_with_ne() {
+
+void f_noexcept_false() noexcept(false) {
+  throw 5;
+}
+
+void f_decl_only() noexcept;
+
+// Controversial example
+void throw_and_catch() noexcept(true) {
+  try {
+throw 5;
+  } catch (...) {
+  }
+}
+// CHECK-MESSAGES: :[[@LINE-6]]:24: warning: In function declared no-throw here: [misc-throw-with-noexcept]
+// CHECK-MESSAGES: :[[@LINE-5]]:5: warning: 'throw' expression in a function declared with a non-throwing exception specification [misc-throw-with-noexcept]
+// CHECK-FIXES: void throw_and_catch() {
+
+void with_parens() noexcept((true)) {
+	throw 42;
+}
+// CHECK-MESSAGES: :[[@LINE-3]]:20: warning: In function declared no-throw here: [misc-throw-with-noexcept]
+// CHECK-MESSAGES: :[[@LINE-3]]:2: warning: 'throw' expression in a function declared with a non-throwing exception specification [misc-throw-with-noexcept]
+// CHECK-FIXES: void with_parens() {
+
+
+void with_parens_and_spaces() noexcept(  (true)  ) {
+	throw 42;
+}
+// CHECK-MESSAGES: :[[@LINE-3]]:31: warning: In function declared no-throw here: [misc-throw-with-noexcept]
+// CHECK-MESSAGES: :[[@LINE-3]]:2: warning: 'throw' expression in a function declared with a non-throwing exception specification [misc-throw-with-noexcept]
+// CHECK-FIXES: void with_parens_and_spaces() {
+
+class Class {
+  void InClass() const noexcept(true) {
+throw 42;
+  }
+};
+// CHECK-MESSAGES: :[[@LINE-4]]:24: warning: In function declared no-throw here: [misc-throw-with-noexcept]
+// CHECK-MESSAGES: :[[@LINE-4]]:5: warning: 'throw' expression in a function declared with a non-throwing exception specification [misc-throw-with-noexcept]
+// CHECK-FIXES: void InClass() const {
+
+
+void forward_declared() noexcept;
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: In function declared no-throw here: [misc-throw-with-noexcept]
+// CHECK-FIXES: void forward_declared() ;
+
+void forward_declared() noexcept {
+	throw 42;
+}
+// CHECK-MESSAGES: :[[@LINE-3]]:25: warning: In function declared no-throw here: [misc-throw-with-noexcept]
+// CHECK-MESSAGES: :[[@LINE-3]]:2: warning: 'throw' expression in a function declared with a non-throwing exception specification [misc-throw-with-noexcept]
+// CHECK-FIXES: void forward_declared() {
+
+#define NOEXCEPT noexcept
+
+void with_macro() NOEXCEPT {
+	throw 42;
+}
+// CHECK-MESSAGES: :[[@LINE-2]]:2: warning: 'throw' expression in a function declared with a non-throwing exception specification [misc-throw-with-noexcept]
+
+void dynamic_exception_spec() throw() {
+  throw 42;
+}
+// CHECK-MESSAGES: :[[@LINE-2]]:3: warning: 'throw' expression in a function declared with a non-throwing exception specification [misc-throw-with-noexcept]
+// FIXME expect a fix here
+
+void getFunction() noexcept {
+  struct X {
+static void inner()
+{
+throw 42;
+}
+  };
+}
Index: docs/clang-tidy/checks/misc-throw-with-noexcept.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/misc-throw-with-noexcept.rst
@@ -0,0 +1,22 @@
+.. title:: clang-tidy - misc-throw-with-noexcept
+
+boost-use-to-string
+===
+
+This check finds cases of using ``throw`` in a function declared as noexcept.
+Please note that the warning is issued even if the exception is caught within
+the same function, as that would be probably a bad style anyway.
+
+It removes the noexcept specifier as a fix.
+
+
+  .. code-block:: c++
+
+void f() noexcept {
+	throw 42;
+}
+
+// Will be changed to
+void f() {
+	throw 42;
+}
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -83,6 +83,7 @@
misc-suspicious-string-compare
misc-swapped-arguments

Re: [clang-tools-extra] r261991 - [clang-tidy] Fix a crash issue when clang-tidy runs with compilation database.

2016-06-01 Thread Edoardo P. via cfe-commits
Ping.

Deadline to merge the changes to the 3.8 branch is today.

Cheers,
Edward-san

2016-05-24 20:25 GMT+02:00 Edoardo P. :
> Ping,
>
> who's going to merge? I have no commit access.
>
> Cheers,
> Edward-san
>
>
> 2016-05-20 18:34 GMT+02:00 Tom Stellard :
>> Hi,
>>
>> This looks fine to me, go ahead and merge.
>>
>> -Tom
>>
>> On Thu, May 19, 2016 at 08:29:14PM +0200, Alexander Kornienko wrote:
>>> On Thu, May 19, 2016 at 4:45 PM, Hans Wennborg  wrote:
>>>
>>> > +Tom who manages 3.8.1
>>> > +Alex who's owner of clang-tidy: is this ok for 3.8.1?
>>> >
>>>
>>> Yes, would be nice to have this in 3.8.1. This fixes a rather annoying
>>> problem.
>>>
>>>
>>> >
>>> > On Thu, May 19, 2016 at 1:56 AM, Edoardo P. via cfe-commits
>>> >  wrote:
>>> > > Is it possible to port this commit to 3.8.1?
>>> > >
>>> > > Cheers,
>>> > > Edward-san
>>> > >
>>> > > 2016-02-26 10:19 GMT+01:00 Haojian Wu via cfe-commits
>>> > > :
>>> > >> Author: hokein
>>> > >> Date: Fri Feb 26 03:19:33 2016
>>> > >> New Revision: 261991
>>> > >>
>>> > >> URL: http://llvm.org/viewvc/llvm-project?rev=261991=rev
>>> > >> Log:
>>> > >> [clang-tidy] Fix a crash issue when clang-tidy runs with compilation
>>> > database.
>>> > >>
>>> > >> Summary:
>>> > >> The clang-tidy will trigger an assertion if it's not in the building
>>> > directory.
>>> > >>
>>> > >> TEST:
>>> > >> cd /
>>> > >> ./build/bin/clang-tidy --checks=-*,modernize-use-nullptr -p build
>>> > tools/clang/tools/extra/clang-tidy/ClangTidy.cpp
>>> > >>
>>> > >> The crash issue is gone after applying this patch.
>>> > >>
>>> > >> Fixes PR24834, PR26241
>>> > >>
>>> > >> Reviewers: bkramer, alexfh
>>> > >>
>>> > >> Subscribers: rizsotto.mailinglist, cfe-commits
>>> > >>
>>> > >> Differential Revision: http://reviews.llvm.org/D17335
>>> > >>
>>> > >> Added:
>>> > >> 
>>> > >> clang-tools-extra/trunk/test/clang-tidy/Inputs/compilation-database/
>>> > >>
>>> >  
>>> > clang-tools-extra/trunk/test/clang-tidy/Inputs/compilation-database/template.json
>>> > >>
>>> >  clang-tools-extra/trunk/test/clang-tidy/clang-tidy-run-with-database.cpp
>>> > >> Modified:
>>> > >> clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
>>> > >> clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
>>> > >> clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h
>>> > >>
>>> > >> Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
>>> > >> URL:
>>> > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=261991=261990=261991=diff
>>> > >>
>>> > ==
>>> > >> --- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
>>> > >> +++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Fri Feb 26
>>> > 03:19:33 2016
>>> > >> @@ -107,6 +107,10 @@ public:
>>> > >>  DiagPrinter->BeginSourceFile(LangOpts);
>>> > >>}
>>> > >>
>>> > >> +  SourceManager& getSourceManager() {
>>> > >> +return SourceMgr;
>>> > >> +  }
>>> > >> +
>>> > >>void reportDiagnostic(const ClangTidyError ) {
>>> > >>  const ClangTidyMessage  = Error.Message;
>>> > >>  SourceLocation Loc = getLocation(Message.FilePath,
>>> > Message.FileOffset);
>>> > >> @@ -124,7 +128,10 @@ public:
>>> > >>auto Diag = Diags.Report(Loc, Diags.getCustomDiagID(Level, "%0
>>> > [%1]"))
>>> > >><< Message.Message << Name;
>>> > >>for (const tooling::Replacement  : Error.Fix) {
>>> > >> -SourceLocation FixLoc = getLocation(Fix.getFilePath(),
>>> > Fix.getOffset());
>>> > >> +SmallString<128> FixAbsoluteFilePath = Fix.getFilePath();
>>> > >> +Files.makeAbsolutePath(FixAbsoluteFilePath);
>>> > >> +SourceLocation FixLoc =
>>> > >> +getLocation(FixAbsoluteFilePath, Fix.getOffset());
>>> > >>  SourceLocation FixEndLoc =
>>> > FixLoc.getLocWithOffset(Fix.getLength());
>>> > >>  Diag << FixItHint::CreateReplacement(SourceRange(FixLoc,
>>> > FixEndLoc),
>>> > >>   
>>> > >> Fix.getReplacementText());
>>> > >> @@ -232,6 +239,13 @@ ClangTidyASTConsumerFactory::CreateASTCo
>>> > >>Context.setCurrentFile(File);
>>> > >>Context.setASTContext(());
>>> > >>
>>> > >> +  auto WorkingDir = Compiler.getSourceManager()
>>> > >> +.getFileManager()
>>> > >> +.getVirtualFileSystem()
>>> > >> +->getCurrentWorkingDirectory();
>>> > >> +  if (WorkingDir)
>>> > >> +Context.setCurrentBuildDirectory(WorkingDir.get());
>>> > >> +
>>> > >>std::vector Checks;
>>> > >>CheckFactories->createChecks(, Checks);
>>> > >>
>>> > >> @@ -446,8 +460,24 @@ runClangTidy(std::unique_ptr>> > >>  void handleErrors(const std::vector , bool Fix,
>>> > >>unsigned ) {
>>> > >> 

[PATCH] D20878: [Coverage] Do not push a new region after a CXXTryStmt

2016-06-01 Thread Vedant Kumar via cfe-commits
vsk created this revision.
vsk added reviewers: bogner, MaggieYi, phillip.power.
vsk added a subscriber: cfe-commits.

There are three possible scenarios when entering a CXXTryStmt:

  1. No exceptions thrown.
  2. An exception is thrown but caught by one of the handlers.
  3. An exception is thrown but not caught by one of the handlers.

The region we push after a CXXTryStmt isn't useful in scenarios (1) or (2). In
these cases, if control flows to the try block it must flow to the region
following the CXXTryStmt.

This may not be the case in situation (3). However, we don't handle this
scenario anywhere else (e.g after function calls). Having a dedicated region
here could only be helpful if its counter expression differed from the try
block, and even then it's questionable.

http://reviews.llvm.org/D20878

Files:
  lib/CodeGen/CoverageMappingGen.cpp
  test/CoverageMapping/trycatch.cpp

Index: test/CoverageMapping/trycatch.cpp
===
--- test/CoverageMapping/trycatch.cpp
+++ test/CoverageMapping/trycatch.cpp
@@ -33,5 +33,5 @@
   catch(const Warning ) {   // CHECK-NEXT: File 0, [[@LINE]]:27 -> 
[[@LINE+2]]:4 = #4
 j = 0;
   }
-  return 0;   // CHECK-NEXT: File 0, [[@LINE]]:3 -> 
[[@LINE]]:11 = #1
+  return 0;
 }
Index: lib/CodeGen/CoverageMappingGen.cpp
===
--- lib/CodeGen/CoverageMappingGen.cpp
+++ lib/CodeGen/CoverageMappingGen.cpp
@@ -850,9 +850,6 @@
 Visit(S->getTryBlock());
 for (unsigned I = 0, E = S->getNumHandlers(); I < E; ++I)
   Visit(S->getHandler(I));
-
-Counter ExitCount = getRegionCounter(S);
-pushRegion(ExitCount);
   }
 
   void VisitCXXCatchStmt(const CXXCatchStmt *S) {


Index: test/CoverageMapping/trycatch.cpp
===
--- test/CoverageMapping/trycatch.cpp
+++ test/CoverageMapping/trycatch.cpp
@@ -33,5 +33,5 @@
   catch(const Warning ) {   // CHECK-NEXT: File 0, [[@LINE]]:27 -> [[@LINE+2]]:4 = #4
 j = 0;
   }
-  return 0;   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = #1
+  return 0;
 }
Index: lib/CodeGen/CoverageMappingGen.cpp
===
--- lib/CodeGen/CoverageMappingGen.cpp
+++ lib/CodeGen/CoverageMappingGen.cpp
@@ -850,9 +850,6 @@
 Visit(S->getTryBlock());
 for (unsigned I = 0, E = S->getNumHandlers(); I < E; ++I)
   Visit(S->getHandler(I));
-
-Counter ExitCount = getRegionCounter(S);
-pushRegion(ExitCount);
   }
 
   void VisitCXXCatchStmt(const CXXCatchStmt *S) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r271430 - Cleanup non-standard tests as reported by s...@microsoft.com. NFC.

2016-06-01 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun  1 16:05:53 2016
New Revision: 271430

URL: http://llvm.org/viewvc/llvm-project?rev=271430=rev
Log:
Cleanup non-standard tests as reported by s...@microsoft.com. NFC.

This patch addresses the following issues in the test suite:

1. Move "std::bad_array_length" test from std/ to libcxx/ test directory
   since the feature is not a part of the standard.

2. Rename "futures.tas" test directory to "futures.task" since that is the
   correct stable name.

3. Move tests for "packaged_task::result_type" from std/ to libcxx/
   test directory since the typedef is a libc++ extension.

Added:
libcxx/trunk/test/libcxx/language.support/
libcxx/trunk/test/libcxx/language.support/support.dynamic/
libcxx/trunk/test/libcxx/language.support/support.dynamic/alloc.errors/

libcxx/trunk/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/

libcxx/trunk/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp
libcxx/trunk/test/libcxx/thread/futures/futures.task/
libcxx/trunk/test/libcxx/thread/futures/futures.task/types.pass.cpp
libcxx/trunk/test/std/thread/futures/futures.task/
libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/assign_copy.fail.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/assign_move.pass.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/ctor1.fail.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/ctor2.fail.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/ctor_copy.fail.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/ctor_default.pass.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/ctor_func.pass.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/ctor_move.pass.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/swap.pass.cpp
libcxx/trunk/test/std/thread/futures/futures.task/futures.task.nonmembers/

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.nonmembers/swap.pass.cpp

libcxx/trunk/test/std/thread/futures/futures.task/futures.task.nonmembers/uses_allocator.pass.cpp
Removed:

libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp
libcxx/trunk/test/std/thread/futures/futures.tas/
Modified:
libcxx/trunk/include/future

Modified: libcxx/trunk/include/future
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/future?rev=271430=271429=271430=diff
==
--- libcxx/trunk/include/future (original)
+++ libcxx/trunk/include/future Wed Jun  1 16:05:53 2016
@@ -322,7 +322,7 @@ template 
 class packaged_task
 {
 public:
-typedef R result_type;
+typedef R result_type; // extension
 
 // construction and destruction
 packaged_task() noexcept;
@@ -1998,7 +1998,7 @@ template
 class _LIBCPP_TYPE_VIS_ONLY packaged_task<_Rp(_ArgTypes...)>
 {
 public:
-typedef _Rp result_type;
+typedef _Rp result_type; // extension
 
 private:
 __packaged_task_function __f_;
@@ -2127,7 +2127,7 @@ template
 class _LIBCPP_TYPE_VIS_ONLY packaged_task
 {
 public:
-typedef void result_type;
+typedef void result_type; // extension
 
 private:
 __packaged_task_function __f_;

Added: 
libcxx/trunk/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp?rev=271430=auto
==
--- 
libcxx/trunk/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp
 (added)
+++ 
libcxx/trunk/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp
 Wed Jun  1 16:05:53 2016
@@ -0,0 +1,28 @@
+//===--===//
+//
+//  

r271427 - [driver][arm] add armv7 and thumb include and lib paths

2016-06-01 Thread Chih-Hung Hsieh via cfe-commits
Author: chh
Date: Wed Jun  1 15:48:46 2016
New Revision: 271427

URL: http://llvm.org/viewvc/llvm-project?rev=271427=rev
Log:
[driver][arm] add armv7 and thumb include and lib paths

Add a new test android-ndk-standalone.cpp
with new Android NDK release tree structure.
Detect armv7 sub architecture and thumb mode,
to add system include and link search paths.

Differential Revision: http://reviews.llvm.org/D20600


Added:
cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/
cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/bin/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/bin/ld

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/bin/ld.bfd

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/bin/ld.gold

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/lib/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/aarch64-linux-android/lib/.keep
cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/bin/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/bin/ld

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/bin/ld.bfd

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/bin/ld.gold

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/lib/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/lib/armv7-a/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/lib/armv7-a/thumb/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/lib/armv7-a/thumb/.keep

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/lib/thumb/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/arm-linux-androideabi/lib/thumb/.keep
cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/aarch64-linux-android-ld

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/aarch64-linux-android-ld.bfd

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/aarch64-linux-android-ld.gold

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/arm-linux-androideabi-ld

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/arm-linux-androideabi-ld.bfd

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/arm-linux-androideabi-ld.gold

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/i686-linux-android-ld

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/i686-linux-android-ld.bfd

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/i686-linux-android-ld.gold

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/mipsel-linux-android-ld

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/mipsel-linux-android-ld.bfd

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/bin/mipsel-linux-android-ld.gold
cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/
cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/bin/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/bin/ld

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/bin/ld.bfd

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/bin/ld.gold
cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/lib/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/i686-linux-android/lib/.keep
cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/
cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/
cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/aarch64-linux-android/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/aarch64-linux-android/.keep

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/arm-linux-androideabi/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/arm-linux-androideabi/armv7-a/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb/.keep

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/arm-linux-androideabi/thumb/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/arm-linux-androideabi/thumb/.keep

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/backward/

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/include/c++/4.9/backward/.keep


[clang-tools-extra] r271426 - Fix uninitialized memory access when the token 'const' is not present in

2016-06-01 Thread Samuel Benzaquen via cfe-commits
Author: sbenza
Date: Wed Jun  1 15:37:23 2016
New Revision: 271426

URL: http://llvm.org/viewvc/llvm-project?rev=271426=rev
Log:
Fix uninitialized memory access when the token 'const' is not present in
the program.

If the token is not there, we still warn but we don't try to give a
fixit hint.

Modified:
clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp

clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp?rev=271426=271425=271426=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp 
Wed Jun  1 15:37:23 2016
@@ -8,6 +8,7 @@
 
//===--===//
 
 #include "AvoidConstParamsInDecls.h"
+#include "llvm/ADT/Optional.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Lex/Lexer.h"
@@ -38,8 +39,8 @@ void AvoidConstParamsInDecls::registerMa
 }
 
 // Re-lex the tokens to get precise location of last 'const'
-static Token ConstTok(CharSourceRange Range,
-  const MatchFinder::MatchResult ) {
+static llvm::Optional ConstTok(CharSourceRange Range,
+  const MatchFinder::MatchResult ) {
   const SourceManager  = *Result.SourceManager;
   std::pair LocInfo =
   Sources.getDecomposedLoc(Range.getBegin());
@@ -49,7 +50,7 @@ static Token ConstTok(CharSourceRange Ra
  Result.Context->getLangOpts(), File.begin(), TokenBegin,
  File.end());
   Token Tok;
-  Token ConstTok;
+  llvm::Optional ConstTok;
   while (!RawLexer.LexFromRawLexer(Tok)) {
 if (Sources.isBeforeInTranslationUnit(Range.getEnd(), Tok.getLocation()))
   break;
@@ -94,9 +95,11 @@ void AvoidConstParamsInDecls::check(cons
   if (!FileRange.isValid())
 return;
 
-  Token Tok = ConstTok(FileRange, Result);
+  auto Tok = ConstTok(FileRange, Result);
+  if (!Tok)
+return;
   Diag << FixItHint::CreateRemoval(
-  CharSourceRange::getTokenRange(Tok.getLocation(), Tok.getLocation()));
+  CharSourceRange::getTokenRange(Tok->getLocation(), Tok->getLocation()));
 }
 
 } // namespace readability

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp?rev=271426=271425=271426=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp
 (original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp
 Wed Jun  1 15:37:23 2016
@@ -83,3 +83,10 @@ void NF(const int&);
 void NF(const int*);
 void NF(const int* const*);
 void NF(alias_const_type);
+
+// Regression test for when the 'const' token is not in the code.
+#define CONCAT(a, b) a##b
+void ConstNotVisible(CONCAT(cons, t) int i);
+// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: parameter 'i'
+// We warn, but we can't give a fix
+// CHECK-FIXES: void ConstNotVisible(CONCAT(cons, t) int i);


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


Re: [PATCH] D16948: [libcxx] Filesystem TS -- Complete

2016-06-01 Thread Eric Fiselier via cfe-commits
EricWF marked an inline comment as done.


Comment at: src/experimental/operations.cpp:128-129
@@ +127,4 @@
+bool stat_equivalent(struct ::stat& st1, struct ::stat& st2) {
+return (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino);
+}
+

majnemer wrote:
> It is possible for `st_ino` to wrap around while the machine is still running.
> I'd mix `st_gen` into the comparison if we are running under one of the BSDs 
> or Darwin.
> 
> Linux has a `FS_IOC_GETVERSION` ioctl but it requires a file descriptor.  
> Maybe such heroics are not worth it.
> It is possible for st_ino to wrap around while the machine is still running.

Can you clarify this point? Maybe some docs I could read.

> I'd mix st_gen into the comparison if we are running under one of the BSDs or 
> Darwin.

According to the darwin docs st_gen is only available as a super user and even 
then my tests show it's always zero.
https://developer.apple.com/library/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man2/stat.2.html

How does mixing that in help if st_ino wraps?


Comment at: test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp:57
@@ -56,3 +56,3 @@
 struct Dummy { void foo() noexcept {} static void bar() noexcept {} };
-#if !defined(__cpp_noexcept_function_type)
+#if !defined(__cpp_noexcept_function_type) && 0
 {

ahatanak wrote:
> Can you explain why this change was needed? I'm trying to figure out why the 
> two static_asserts in the #else part fail.
Woops that sneaked in.  I was investigating some GCC behavior unrelated to 
filesystem but forgot to revert the changes.



http://reviews.llvm.org/D16948



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


Re: [PATCH] D20844: FixIt: correctly set DeclSpec's range end for a type name annotation.

2016-06-01 Thread Richard Smith via cfe-commits
On Wed, Jun 1, 2016 at 12:42 PM, Manman Ren via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> manmanren added a comment.
>
> In http://reviews.llvm.org/D20844#445762, @rjmccall wrote:
>
> > Hmm.  No, I think the original code is correct here — RangeEnd is a
> token range, and those are generally inclusive rather than exclusive.  The
> fix-it needs to be inserting at the end of the token.
>
>
> We currently insert the fix-it here
> SourceLocation TypeEndLoc = TSInfo->getTypeLoc().getLocEnd();
>

Yep, that's the bug. That source location refers to the start of the last
token in the source range.


> And we call "TL.setNameEndLoc(DS.getLocEnd());" for ObjCInterfaceTypeLoc.
>
> The problem is that for annotation token, both the start and the end point
> to the same location. With "DS.SetRangeEnd(Tok.getAnnotationEndLoc());",
> the DeclSpec has the same start and end location.
>
> Is there a way to get the real end of the annotation token, since
> getAnnotationEndLoc returns the start location?
>

You can use Preprocessor::getLocForEndOfToken to get the character location
past the end of the token. (If you want the * to be after the space in your
example, you'll need to also skip that whitespace.)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-01 Thread Etienne Bergeron via cfe-commits
etienneb added a comment.

I wonder if these two checks should not be merge in one checker.

  modernize-explicit-conversion-operator



Comment at: clang-tidy/modernize/ExplicitOperatorBoolCheck.cpp:21
@@ +20,3 @@
+void ExplicitOperatorBoolCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(
+  // FIXME: Use some kind of isConversionToType("bool") here,

As you state later "available since C++11",
you should check for the current language.

Example from other checkers:
```
  if (!getLangOpts().CPlusPlus)
return;
```



Comment at: clang-tidy/modernize/ExplicitOperatorBoolCheck.cpp:36
@@ +35,3 @@
+  // Or can we at least use a constant here?
+  if (CanonicalType.getAsString() != "_Bool") {
+return;

This check should be part of the matcher above.
see:booleanType

```
Matches type bool.

Given
 struct S { bool func(); };
functionDecl(returns(booleanType()))
  matches "bool func();"
```


Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:30
@@ +29,3 @@
+void OperatorVoidPointerCheck::check(const MatchFinder::MatchResult ) {
+  const auto MatchedDecl =
+  Result.Nodes.getNodeAs("operator-void-pointer");

nit: const auto *MatchedDecl
and below...


Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:37
@@ +36,3 @@
+  // Or can we at least use a constant here?
+  if (CanonicalType.getAsString() != "const void *") {
+return;

nit: no { }


Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:37
@@ +36,3 @@
+  // Or can we at least use a constant here?
+  if (CanonicalType.getAsString() != "const void *") {
+return;

etienneb wrote:
> nit: no { }
should be part of the matcher.


Comment at: docs/clang-tidy/checks/list.rst:7
@@ -6,3 +6,2 @@
 .. toctree::
-
boost-use-to-string

why removing this line?


Comment at: docs/clang-tidy/checks/modernize-explicit-operator-bool.rst:11
@@ +10,3 @@
+be compared accidentally. For instance, even when objects a and b have no
+operator = overloads, an implicit operator bool would allow `a == b` to compile
+because both a and b can be implictly converted to bool.

operator =  --> operator ==  ???


Repository:
  rL LLVM

http://reviews.llvm.org/D20857



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


Re: r271387 - Adding front-end support to several intrinsics (bit scanning, conversion and state reading intrinsics)

2016-06-01 Thread David Majnemer via cfe-commits
Please implement _bit_scan_forward and _bit_scan_reverse in terms of
__builtin_ctz and __builtin_clz.

On Wed, Jun 1, 2016 at 5:21 AM, Michael Zuckerman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: mzuckerm
> Date: Wed Jun  1 07:21:00 2016
> New Revision: 271387
>
> URL: http://llvm.org/viewvc/llvm-project?rev=271387=rev
> Log:
> Adding front-end support to several intrinsics (bit scanning, conversion
> and state reading intrinsics)
>
>
> Adding LLVM front-end support to two intrinsics dealing with bit scan:
> _bit_scan_forward and _bit_scan_reverse.
>  Their functionality is as described in Intel intrinsics guide:
>
> https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bit_scan_forward=371,370
>
> https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bit_scan_reverse=371,370
>
>  Furthermore, adding clang front-end support to these conversion
> intrinsics: _mm256_cvtsd_f64, _mm256_cvtsi256_si32 and _mm256_cvtss_f32.
>
>  Finally, adding tests to all of the above, as well as to the state
> reading intrinsics _rdpmc and _rdtsc.
>   Their functionality is also specified in the Intel intrinsics guide.
>
>
> Commit on behalf of Omer Paparo Bivas
>
>
> Added:
> cfe/trunk/test/CodeGen/bitscan-builtins.c
> cfe/trunk/test/CodeGen/rd-builtins.c
> Modified:
> cfe/trunk/include/clang/Basic/BuiltinsX86.def
> cfe/trunk/lib/Headers/avxintrin.h
> cfe/trunk/lib/Headers/ia32intrin.h
> cfe/trunk/lib/Headers/immintrin.h
> cfe/trunk/test/CodeGen/avx-builtins.c
>
> Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=271387=271386=271387=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
> +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed Jun  1 07:21:00 2016
> @@ -35,6 +35,10 @@ BUILTIN(__builtin_ms_va_start, "vc*&.",
>  BUILTIN(__builtin_ms_va_end, "vc*&", "n")
>  BUILTIN(__builtin_ms_va_copy, "vc**&", "n")
>
> +// Bit scan
> +TARGET_BUILTIN(__builtin_ia32_bit_scan_forward, "ii", "", "")
> +TARGET_BUILTIN(__builtin_ia32_bit_scan_reverse, "ii", "", "")
> +
>  // Undefined Values
>  //
>  TARGET_BUILTIN(__builtin_ia32_undef128, "V2d", "nc", "")
>
> Modified: cfe/trunk/lib/Headers/avxintrin.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avxintrin.h?rev=271387=271386=271387=diff
>
> ==
> --- cfe/trunk/lib/Headers/avxintrin.h (original)
> +++ cfe/trunk/lib/Headers/avxintrin.h Wed Jun  1 07:21:00 2016
> @@ -2123,6 +2123,25 @@ _mm256_cvttps_epi32(__m256 __a)
>return (__m256i)__builtin_ia32_cvttps2dq256((__v8sf) __a);
>  }
>
> +static __inline double __DEFAULT_FN_ATTRS
> +_mm256_cvtsd_f64(__m256d __a)
> +{
> + return __a[0];
> +}
> +
> +static __inline int __DEFAULT_FN_ATTRS
> +_mm256_cvtsi256_si32(__m256i __a)
> +{
> + __v8si __b = (__v8si)__a;
> + return __b[0];
> +}
> +
> +static __inline float __DEFAULT_FN_ATTRS
> +_mm256_cvtss_f32(__m256 __a)
> +{
> + return __a[0];
> +}
> +
>  /* Vector replicate */
>  static __inline __m256 __DEFAULT_FN_ATTRS
>  _mm256_movehdup_ps(__m256 __a)
>
> Modified: cfe/trunk/lib/Headers/ia32intrin.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/ia32intrin.h?rev=271387=271386=271387=diff
>
> ==
> --- cfe/trunk/lib/Headers/ia32intrin.h (original)
> +++ cfe/trunk/lib/Headers/ia32intrin.h Wed Jun  1 07:21:00 2016
> @@ -74,4 +74,6 @@ __rdtscp(unsigned int *__A) {
>
>  #define _rdtsc() __rdtsc()
>
> +#define _rdpmc(A) __rdpmc(A)
> +
>  #endif /* __IA32INTRIN_H */
>
> Modified: cfe/trunk/lib/Headers/immintrin.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/immintrin.h?rev=271387=271386=271387=diff
>
> ==
> --- cfe/trunk/lib/Headers/immintrin.h (original)
> +++ cfe/trunk/lib/Headers/immintrin.h Wed Jun  1 07:21:00 2016
> @@ -169,6 +169,18 @@ _rdrand32_step(unsigned int *__p)
>return __builtin_ia32_rdrand32_step(__p);
>  }
>
> +/* __bit_scan_forward */
> +static __inline__ int __attribute__((__always_inline__, __nodebug__))
> +_bit_scan_forward(int __A) {
> + return __builtin_ia32_bit_scan_forward(__A);
> +}
> +
> +/* __bit_scan_reverse */
> +static __inline__ int __attribute__((__always_inline__, __nodebug__))
> +_bit_scan_reverse(int __A) {
> + return __builtin_ia32_bit_scan_reverse(__A);
> +}
> +
>  #ifdef __x86_64__
>  static __inline__ int __attribute__((__always_inline__, __nodebug__,
> __target__("rdrnd")))
>  _rdrand64_step(unsigned long long *__p)
> @@ -227,6 +239,7 @@ _writegsbase_u64(unsigned long long __V)
>  {
>return __builtin_ia32_wrgsbase64(__V);
>  }
> +
>  #endif
>  #endif /* __FSGSBASE__ */
>
>
> Modified: 

Re: [PATCH] D20844: FixIt: correctly set DeclSpec's range end for a type name annotation.

2016-06-01 Thread Manman Ren via cfe-commits
manmanren added a comment.

In http://reviews.llvm.org/D20844#445762, @rjmccall wrote:

> Hmm.  No, I think the original code is correct here — RangeEnd is a token 
> range, and those are generally inclusive rather than exclusive.  The fix-it 
> needs to be inserting at the end of the token.


We currently insert the fix-it here
SourceLocation TypeEndLoc = TSInfo->getTypeLoc().getLocEnd();

And we call "TL.setNameEndLoc(DS.getLocEnd());" for ObjCInterfaceTypeLoc.

The problem is that for annotation token, both the start and the end point to 
the same location. With "DS.SetRangeEnd(Tok.getAnnotationEndLoc());", the 
DeclSpec has the same start and end location.

Is there a way to get the real end of the annotation token, since 
getAnnotationEndLoc returns the start location?

Thanks,
Manman


http://reviews.llvm.org/D20844



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


Re: [PATCH] D17462: Fix a codegen bug for variadic functions with pass_object_size params

2016-06-01 Thread George Burgess IV via cfe-commits
george.burgess.iv added a comment.

Ping :)


http://reviews.llvm.org/D17462



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


Re: [PATCH] D14326: ASTImporter: expressions, pt.2

2016-06-01 Thread Serge Pavlov via cfe-commits
sepavloff added inline comments.


Comment at: lib/AST/ASTImporter.cpp:2373
@@ +2372,3 @@
+  Error = true;
+ToInfo = TemplateArgumentLocInfo(TSI);
+  } else {

Maybe `else` before this statement so that in the case of error `ToInfo` 
remained default initialized?


Comment at: lib/AST/ASTImporter.cpp:2502-2507
@@ +2501,8 @@
+
+  DeclContext *LexicalDC = DC;
+  if (D->getDeclContext() != D->getLexicalDeclContext()) {
+LexicalDC = Importer.ImportContext(D->getLexicalDeclContext());
+if (!LexicalDC)
+  return nullptr;
+  }
+

Is there a reason to handle lexical context of `StaticAssertDecl` separately? I 
would say `static_assert` is always in the context where it is declared, no?


Comment at: lib/AST/ASTImporter.cpp:2518-2519
@@ +2517,4 @@
+Importer.Import(D->getMessage()));
+  if (!Message)
+return nullptr;
+

Since C++17 `static_assert` may be used without message, so null pointer here 
is not an error.


Comment at: lib/AST/ASTImporter.cpp:3356
@@ +3355,3 @@
+Decl *ASTNodeImporter::VisitFriendDecl(FriendDecl *D) {
+  // Import the major distinguishing characteristics of a variable.
+  DeclContext *DC = Importer.ImportContext(D->getDeclContext());

`variable` -> `declaration`?


Comment at: lib/AST/ASTImporter.cpp:3363
@@ +3362,3 @@
+
+  // Determine whether we've already imported this decl.
+  // FriendDecl is not a NamedDecl so we cannot use localUncachedLookup.

Maybe it is more natural to put this check into `bool 
IsStructurallyEquivalent(StructuralEquivalenceContext , RecordDecl *D1, 
RecordDecl *D2)`? If records are equivalent, existing decl can be used as a 
result of import, if not - entire record must be recreated anyway.


http://reviews.llvm.org/D14326



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


Re: [PATCH] D20871: [Clang][AVX512][Intrinsics] Adding two definitions _mm512_setzero and _mm512_setzero_epi32

2016-06-01 Thread Elena Demikhovsky via cfe-commits
delena added a comment.

Why do you need them. Is it a part of API?


http://reviews.llvm.org/D20871



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


[libcxxabi] r271423 - [libcxxabi][test] Add missing return statement.

2016-06-01 Thread Asiri Rathnayake via cfe-commits
Author: asiri
Date: Wed Jun  1 14:13:53 2016
New Revision: 271423

URL: http://llvm.org/viewvc/llvm-project?rev=271423=rev
Log:
[libcxxabi][test] Add missing return statement.

This causes a test failure when running with -Werror=return-type.

NFC.

Modified:
libcxxabi/trunk/test/cxa_bad_typeid.pass.cpp

Modified: libcxxabi/trunk/test/cxa_bad_typeid.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/cxa_bad_typeid.pass.cpp?rev=271423=271422=271423=diff
==
--- libcxxabi/trunk/test/cxa_bad_typeid.pass.cpp (original)
+++ libcxxabi/trunk/test/cxa_bad_typeid.pass.cpp Wed Jun  1 14:13:53 2016
@@ -24,7 +24,7 @@ class Base {
 class Derived : public Base {};
 
 std::string test_bad_typeid(Derived *p) {
-typeid(*p).name();
+return typeid(*p).name();
 }
 
 void my_terminate() { std::cout << "A" << std::endl; exit(0); }


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


Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-01 Thread Aaron Ballman via cfe-commits
aaron.ballman requested changes to this revision.
aaron.ballman added a comment.
This revision now requires changes to proceed.

In http://reviews.llvm.org/D20561#445824, @rogfer01 wrote:

> I think I wasn't clear with the purpose of the fix-it: there are a few cases 
> where getting the address of an unaligned pointer is safe (i.e. false 
> positives).
>
> For instance, when I checked Firefox and Chromium there are cases where 
> getting the address of an unaligned pointer is fine. For the particular case 
> of these two browsers, they both use a library (usrsctp) that represents 
> protocol data as packed structs. That library passes addresses of packed 
> fields to `memcpy` and `memmove` which is OK.


I think this is a false-positive that should be fixed.

> The fix-it can help silencing the warning for those cases once deemed safe. 
> This is the reason why I keep comparing the new warning to the 
> assignment-vs-comparison warning: there may not be an error, just extra 
> syntax (parentheses) can be used to silence the warning.


Assignment vs comparison is not a valuable comparison because that is a case 
relying on programmer intent (could be assignment, could be comparison, but 
there's no way to tell what's more likely, so use parens to disambiguate). In 
this case, there is code that could be dangerous (more likely) or benign (less 
likely), but adding parens does not disambiguate between two choices, it simply 
disables the diagnostic while leaving the semantics the same.

Fix-its are meant to be used when we can reasonably fix the user's code. Adding 
parens does *not* fix the user's code for the true positive case and is 
actually a dangerous code transformation (because it hides a true positive). I 
do not think this check should have a fix-it simply to silence false positives. 
If the false positive rate is that high, this should become a clang-tidy check 
instead (and I would still be opposed to the fix-it hint there as well).



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5392
@@ -5388,1 +5391,3 @@
+def note_address_of_packed_member_silence : Note<
+  "place parentheses around the '%0' expression to silence this warning">;
 

I don't think this note adds value. Placing parens around the expression does 
silence the warning for false-positives, but that seems more like a 
documentation issue than a diagnostic.


Comment at: lib/Sema/SemaExpr.cpp:10537-10538
@@ +10536,4 @@
+  Diag(rhs->getLocStart(), diag::note_address_of_packed_member_silence)
+  << rhs << FixItHint::CreateInsertion(rhs->getLocStart(), "(")
+  << FixItHint::CreateInsertion(rhs->getLocEnd(), ")");
+  break;

I do not think this diagnostic should have a FixIt hint. This isn't actually 
*fixing* the problem, it is simply a way to silence the diagnostic while 
retaining the same behavior.


Comment at: test/SemaCXX/address-packed.cpp:92-93
@@ +91,4 @@
+   // expected-warning@-1 {{packed member 'X' of class or structure 
'S'}}
+   // expected-note@-2 {{place parentheses around the 'this->X'}}
+   // expected-note@-3 {{place parentheses around the 'this->X'}}
+  }

Why `this->X` in the diagnostic when that's not what the user wrote?


http://reviews.llvm.org/D20561



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


Re: [PATCH] D20874: [libcxx] Two more threading dependencies

2016-06-01 Thread Ben Craig via cfe-commits
bcraig added inline comments.


Comment at: include/__threading_support:187
@@ +186,3 @@
+{
+std::terminate();
+}

Why does this need to go in threading_support?  Seems like this is mostly 
orthogonal to threading.  libcxxabi seems like the better place to hold changes 
to terminate anyway.


http://reviews.llvm.org/D20874



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


[PATCH] D20874: [libcxx] Two more threading dependencies

2016-06-01 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added reviewers: EricWF, bcraig, mclow.lists.
rmaprath added a subscriber: cfe-commits.

Bumped into these while working on the externally threaded variant. I think it 
makes most sense to group these two under the main threading API. This greatly 
simplifies the presentation of the externally threaded library variant as well.

http://reviews.llvm.org/D20874

Files:
  include/__threading_support
  src/thread.cpp

Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -40,7 +40,7 @@
 thread::~thread()
 {
 if (__t_ != 0)
-terminate();
+__libcpp_thread_terminate();
 }
 
 void
@@ -130,7 +130,7 @@
 ts.tv_nsec = giga::num - 1;
 }
 
-while (nanosleep(, ) == -1 && errno == EINTR)
+while (__libcpp_thread_nanosleep(, ) == -1 && errno == EINTR)
 ;
 }
 }
Index: include/__threading_support
===
--- include/__threading_support
+++ include/__threading_support
@@ -22,6 +22,8 @@
 #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
 #include 
 #include 
+#include 
+#include 
 #endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
@@ -156,6 +158,12 @@
 }
 
 inline _LIBCPP_ALWAYS_INLINE
+int __libcpp_thread_nanosleep(const timespec *req, timespec *rem)
+{
+return nanosleep(req, rem);
+}
+
+inline _LIBCPP_ALWAYS_INLINE
 int __libcpp_thread_join(__libcpp_thread_t* __t)
 {
 return pthread_join(*__t, 0);
@@ -173,6 +181,12 @@
 sched_yield();
 }
 
+inline _LIBCPP_ALWAYS_INLINE
+void __libcpp_thread_terminate()
+{
+std::terminate();
+}
+
 // Thread local storage
 typedef pthread_key_t __libcpp_tl_key;
 


Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -40,7 +40,7 @@
 thread::~thread()
 {
 if (__t_ != 0)
-terminate();
+__libcpp_thread_terminate();
 }
 
 void
@@ -130,7 +130,7 @@
 ts.tv_nsec = giga::num - 1;
 }
 
-while (nanosleep(, ) == -1 && errno == EINTR)
+while (__libcpp_thread_nanosleep(, ) == -1 && errno == EINTR)
 ;
 }
 }
Index: include/__threading_support
===
--- include/__threading_support
+++ include/__threading_support
@@ -22,6 +22,8 @@
 #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
 #include 
 #include 
+#include 
+#include 
 #endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
@@ -156,6 +158,12 @@
 }
 
 inline _LIBCPP_ALWAYS_INLINE
+int __libcpp_thread_nanosleep(const timespec *req, timespec *rem)
+{
+return nanosleep(req, rem);
+}
+
+inline _LIBCPP_ALWAYS_INLINE
 int __libcpp_thread_join(__libcpp_thread_t* __t)
 {
 return pthread_join(*__t, 0);
@@ -173,6 +181,12 @@
 sched_yield();
 }
 
+inline _LIBCPP_ALWAYS_INLINE
+void __libcpp_thread_terminate()
+{
+std::terminate();
+}
+
 // Thread local storage
 typedef pthread_key_t __libcpp_tl_key;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20415: Update Clang for D20147 ("DebugInfo: New metadata representation for global variables.")

2016-06-01 Thread Peter Collingbourne via cfe-commits
pcc updated this revision to Diff 59260.
pcc marked 2 inline comments as done.
pcc added a comment.

- Address review comments


http://reviews.llvm.org/D20415

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGen/2009-10-20-GlobalDebug.c
  test/CodeGen/2010-08-10-DbgConstant.c
  test/CodeGen/debug-info-packed-struct.c
  test/CodeGen/debug-info-static.c
  test/CodeGenCXX/debug-info-access.cpp
  test/CodeGenCXX/debug-info-alias.cpp
  test/CodeGenCXX/debug-info-anon-namespace.cpp
  test/CodeGenCXX/debug-info-anon-union-vars.cpp
  test/CodeGenCXX/debug-info-method.cpp
  test/CodeGenCXX/debug-info-namespace.cpp
  test/CodeGenCXX/debug-info-static-member.cpp
  test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
  test/CodeGenCXX/debug-info-template-member.cpp
  test/CodeGenCXX/debug-info-template.cpp
  test/CodeGenCXX/debug-info-uuid.cpp
  test/CodeGenCXX/debug-info.cpp
  test/CodeGenCXX/debug-lambda-expressions.cpp
  test/CodeGenCXX/inline-dllexport-member.cpp
  test/Driver/darwin-debug-flags.c
  test/Modules/ExtDebugInfo.cpp
  test/Modules/ExtDebugInfo.m

Index: test/Modules/ExtDebugInfo.m
===
--- test/Modules/ExtDebugInfo.m
+++ test/Modules/ExtDebugInfo.m
@@ -34,14 +34,8 @@
   return [c property];
 }
 
-// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClassWithPrivateIVars",
-// CHECK-SAME: flags: DIFlagObjcClassComplete
-
 // CHECK: ![[MOD:.*]] = !DIModule(scope: null, name: "DebugObjC
 
-// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "hidden_ivar",
-// CHECK-SAME:   flags: DIFlagPrivate)
-
 // CHECK: !DIGlobalVariable(name: "GlobalUnion",
 // CHECK-SAME:  type: ![[GLOBAL_UNION:[0-9]+]]
 // CHECK: ![[GLOBAL_UNION]] = distinct !DICompositeType(tag: DW_TAG_union_type,
@@ -52,10 +46,11 @@
 // CHECK: ![[GLOBAL_STRUCT]] = distinct !DICompositeType(tag: DW_TAG_structure_type,
 // CHECK-SAME:elements: !{{[0-9]+}})
 
-// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion",
-// CHECK-SAME:   baseType: ![[TD_UNION:.*]])
-// CHECK: ![[TD_UNION]] = !DICompositeType(tag: DW_TAG_union_type,
-// CHECK-SAME: flags: DIFlagFwdDecl)
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClassWithPrivateIVars",
+// CHECK-SAME: flags: DIFlagObjcClassComplete
+
+// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "hidden_ivar",
+// CHECK-SAME:   flags: DIFlagPrivate)
 
 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefEnum",
 // CHECK-SAME:   baseType: ![[TD_ENUM:.*]])
@@ -67,6 +62,11 @@
 // CHECK: ![[TD_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type,
 // CHECK-SAME: flags: DIFlagFwdDecl)
 
+// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion",
+// CHECK-SAME:   baseType: ![[TD_UNION:.*]])
+// CHECK: ![[TD_UNION]] = !DICompositeType(tag: DW_TAG_union_type,
+// CHECK-SAME: flags: DIFlagFwdDecl)
+
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK-SAME: scope: ![[MOD]],
 // CHECK-SAME: flags: DIFlagFwdDecl)
Index: test/Modules/ExtDebugInfo.cpp
===
--- test/Modules/ExtDebugInfo.cpp
+++ test/Modules/ExtDebugInfo.cpp
@@ -67,20 +67,14 @@
   anon.i = GlobalStruct.i = GlobalUnion.i = GlobalEnum;
 }
 
-
-// CHECK: ![[STRUCT:.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Struct",
+// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum",
 // CHECK-SAME: scope: ![[NS:[0-9]+]],
 // CHECK-SAME: flags: DIFlagFwdDecl,
-// CHECK-SAME: identifier: "_ZTSN8DebugCXX6StructE")
+// CHECK-SAME: identifier:  "_ZTSN8DebugCXX4EnumE")
 
 // CHECK: ![[NS]] = !DINamespace(name: "DebugCXX", scope: ![[MOD:[0-9]+]],
 // CHECK: ![[MOD]] = !DIModule(scope: null, name: {{.*}}DebugCXX
 
-// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum",
-// CHECK-SAME: scope: ![[NS]],
-// CHECK-SAME: flags: DIFlagFwdDecl,
-// CHECK-SAME: identifier:  "_ZTSN8DebugCXX4EnumE")
-
 // This type is anchored in the module by an explicit template instantiation.
 // CHECK: !DICompositeType(tag: DW_TAG_class_type,
 // CHECK-SAME: name: "Template",
@@ -119,7 +113,12 @@
 // CHECK-SAME: identifier: "_ZTSN8DebugCXX1AIJvEEE")
 
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "static_member",
-// CHECK-SAME:   scope: ![[STRUCT]]
+// CHECK-SAME:   scope: ![[STRUCT:[0-9]*]]
+
+// CHECK: ![[STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Struct",
+// CHECK-SAME: scope: ![[NS]],
+// CHECK-SAME: flags: DIFlagFwdDecl,
+// CHECK-SAME: identifier: 

Re: [PATCH] D20715: [docs] Document the source-based code coverage feature

2016-06-01 Thread Justin Bogner via cfe-commits
Vedant Kumar  writes:
> vsk created this revision.
> vsk added a reviewer: bogner.
> vsk added subscribers: kcc, cfe-commits, silvas.
>
> It would be helpful to have a user-friendly guide for code
> coverage. There is some overlap with [1], but this document visits
> issues which may affect users in more depth.
>
> Prompted by: https://llvm.org/bugs/show_bug.cgi?id=27781
>
> [1] http://llvm.org/docs/CoverageMappingFormat.html
 ...
> vsk updated this revision to Diff 59078.
> vsk marked an inline comment as done.
> vsk added a comment.
>
> - Actually link in the new document into Index.rst.

A couple of comments below, but since this is prose it's basically all
just opinion. Feel free to commit any time - we can always make
improvements in tree later.

>
> http://reviews.llvm.org/D20715
>
> Files:
>   docs/SourceBasedCodeCoverage.rst
>   docs/index.rst
>
> Index: docs/index.rst
> ===
> --- docs/index.rst
> +++ docs/index.rst
> @@ -33,6 +33,7 @@
> ControlFlowIntegrity
> LTOVisibility
> SafeStack
> +   SourceBasedCodeCoverage
> Modules
> MSVCCompatibility
> CommandGuide/index
> Index: docs/SourceBasedCodeCoverage.rst
> ===
> --- /dev/null
> +++ docs/SourceBasedCodeCoverage.rst
> @@ -0,0 +1,187 @@
> +==
> +Source-based Code Coverage
> +==
> +
> +.. contents::
> +   :local:
> +
> +Introduction
> +
> +
> +This document explains how to use clang's source-based code coverage feature.
> +It's called "source-based" because it operates on AST and preprocessor
> +information directly. This allows it to generate very precise coverage data.
> +
> +Clang ships two other code coverage implementations:
> +
> +* :doc:`SanitizerCoverage` - A low-overhead tool meant for use alongside the
> +  various sanitizers. It can provide up to edge-level coverage.
> +
> +* gcov - A GCC-compatible coverage implementation which operates on 
> DebugInfo.
> +
> +From this point onwards "code coverage" will refer to the source-based kind.
> +
> +The code coverage workflow
> +==
> +
> +The code coverage workflow consists of three main steps:
> +
> +1. Compiling with coverage enabled.
> +
> +2. Running the instrumented program.
> +
> +3. Creating coverage reports.
> +
> +The next few sections work through a complete, copy-'n-paste friendly example
> +based on this program:
> +
> +.. code-block:: console
> +
> +% cat < foo.cc
> +#define BAR(x) ((x) || (x))
> +template  void foo(T x) {
> +  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
> +}
> +int main() {
> +  foo(0);
> +  foo(0);
> +  return 0;
> +}
> +EOF
> +
> +Compiling with coverage enabled
> +===
> +
> +To compile code with coverage enabled pass ``-fprofile-instr-generate
> +-fcoverage-mapping`` to the compiler:
> +
> +.. code-block:: console
> +
> +# Step 1: Compile with coverage enabled.
> +% clang++ -fprofile-instr-generate -fcoverage-mapping foo.cc -o foo
> +
> +Note that linking together code with and without coverage instrumentation is
> +supported: any uninstrumented code simply won't be accounted for.
> +
> +Running the instrumented program
> +
> +
> +The next step is to run the instrumented program. When the program exits it
> +will write a **raw profile** to the path specified by the 
> ``LLVM_PROFILE_FILE``
> +environment variable. If that variable does not exist the profile is written 
> to
> +``./default.profraw``.

Something like "``default.profraw`` in the current directory of the
program" might be clearer.

> +
> +If ``LLVM_PROFILE_FILE`` contains a path to a non-existent directory the
> +missing directory structure will be created.  Additionally, the following
> +special **pattern strings** are replaced:
> +
> +* "%p" expands out to the PID.

Maybe spell out process ID?

> +
> +* "%h" expands out to the hostname of the machine running the program.
> +
> +.. code-block:: console
> +
> +# Step 2: Run the program.
> +% LLVM_PROFILE_FILE="foo.profraw" ./foo
> +
> +Creating coverage reports
> +=
> +
> +Raw profiles have to be **indexed** before they can be used to generated
> +coverage reports:
> +
> +.. code-block:: console
> +
> +# Step 3(a): Index the raw profile.
> +% llvm-profdata merge -sparse foo.profraw -o foo.profdata
> +
> +You may be wondering why raw profiles aren't indexed automatically. In
> +real-world projects multiple profiles have to be merged together before a
> +report can be generated. This merge step is inevitable, so it makes sense to
> +handle the compute-intensive indexing process at that point. A separate
> +indexing step has the added benefit of keeping the compiler runtime small and
> +simple.

This comment feels like it comes out of nowhere, and I'm 

Re: [PATCH] D19254: Implement P0033R1 - Re-enabling shared_from_this

2016-06-01 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

Other than the versioning, this looks fine to me.



Comment at: include/memory:5439
@@ -5438,1 +5438,3 @@
 
+_LIBCPP_INLINE_VISIBILITY
+weak_ptr<_Tp> weak_from_this() _NOEXCEPT

Shouldn't these be wrapped in `#ifdef _LIBCPP_VER > 14` ?


Comment at: 
test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp:59
@@ -52,1 +58,3 @@
 }
+// Test weak_from_this_methods
+{

These too - C++17 only?


http://reviews.llvm.org/D19254



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


Re: r271336 - [CUDA] Conservatively mark inline asm as convergent.

2016-06-01 Thread Justin Lebar via cfe-commits
Thank you, Tom.  I will have a look.

On Wed, Jun 1, 2016 at 11:22 AM, Tom Stellard  wrote:
> On Tue, May 31, 2016 at 09:27:13PM -, Justin Lebar via cfe-commits wrote:
>> Author: jlebar
>> Date: Tue May 31 16:27:13 2016
>> New Revision: 271336
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=271336=rev
>> Log:
>> [CUDA] Conservatively mark inline asm as convergent.
>>
>> Summary:
>> This is particularly important because a some convergent CUDA intrinsics
>> (e.g.  __shfl_down) are implemented in terms of inline asm.
>>
>
> Hi,
>
> The MachineInstr INLINEASM also needs to be marked as convergent,
> otherwise you will run into the same problem with the
> MachineInstr passes.
>
> -Tom
>
>> Reviewers: tra
>>
>> Subscribers: cfe-commits
>>
>> Differential Revision: http://reviews.llvm.org/D20836
>>
>> Modified:
>> cfe/trunk/lib/CodeGen/CGStmt.cpp
>> cfe/trunk/test/CodeGenCUDA/convergent.cu
>>
>> Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=271336=271335=271336=diff
>> ==
>> --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue May 31 16:27:13 2016
>> @@ -2054,6 +2054,14 @@ void CodeGenFunction::EmitAsmStmt(const
>>
>> llvm::ConstantAsMetadata::get(Loc)));
>>}
>>
>> +  if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) {
>> +// Conservatively, mark all inline asm blocks in CUDA as convergent
>> +// (meaning, they may call an intrinsically convergent op, such as 
>> bar.sync,
>> +// and so can't have certain optimizations applied around them).
>> +Result->addAttribute(llvm::AttributeSet::FunctionIndex,
>> + llvm::Attribute::Convergent);
>> +  }
>> +
>>// Extract all of the register value results from the asm.
>>std::vector RegResults;
>>if (ResultRegTypes.size() == 1) {
>>
>> Modified: cfe/trunk/test/CodeGenCUDA/convergent.cu
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCUDA/convergent.cu?rev=271336=271335=271336=diff
>> ==
>> --- cfe/trunk/test/CodeGenCUDA/convergent.cu (original)
>> +++ cfe/trunk/test/CodeGenCUDA/convergent.cu Tue May 31 16:27:13 2016
>> @@ -25,6 +25,11 @@ __host__ __device__ void baz();
>>  __host__ __device__ void bar() {
>>// DEVICE: call void @_Z3bazv() [[CALL_ATTR:#[0-9]+]]
>>baz();
>> +  // DEVICE: call i32 asm "trap;", "=l"() [[ASM_ATTR:#[0-9]+]]
>> +  int x;
>> +  asm ("trap;" : "=l"(x));
>> +  // DEVICE: call void asm sideeffect "trap;", ""() [[ASM_ATTR:#[0-9]+]]
>> +  asm volatile ("trap;");
>>  }
>>
>>  // DEVICE: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
>> @@ -32,6 +37,7 @@ __host__ __device__ void bar() {
>>  // DEVICE-SAME: convergent
>>  // DEVICE-SAME: }
>>  // DEVICE: attributes [[CALL_ATTR]] = { convergent }
>> +// DEVICE: attributes [[ASM_ATTR]] = { convergent
>>
>>  // HOST: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
>>  // HOST: attributes [[BAZ_ATTR]] = {
>>
>>
>> ___
>> 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


Re: r271336 - [CUDA] Conservatively mark inline asm as convergent.

2016-06-01 Thread Tom Stellard via cfe-commits
On Tue, May 31, 2016 at 09:27:13PM -, Justin Lebar via cfe-commits wrote:
> Author: jlebar
> Date: Tue May 31 16:27:13 2016
> New Revision: 271336
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=271336=rev
> Log:
> [CUDA] Conservatively mark inline asm as convergent.
> 
> Summary:
> This is particularly important because a some convergent CUDA intrinsics
> (e.g.  __shfl_down) are implemented in terms of inline asm.
> 

Hi,

The MachineInstr INLINEASM also needs to be marked as convergent,
otherwise you will run into the same problem with the
MachineInstr passes.

-Tom

> Reviewers: tra
> 
> Subscribers: cfe-commits
> 
> Differential Revision: http://reviews.llvm.org/D20836
> 
> Modified:
> cfe/trunk/lib/CodeGen/CGStmt.cpp
> cfe/trunk/test/CodeGenCUDA/convergent.cu
> 
> Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=271336=271335=271336=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue May 31 16:27:13 2016
> @@ -2054,6 +2054,14 @@ void CodeGenFunction::EmitAsmStmt(const
>
> llvm::ConstantAsMetadata::get(Loc)));
>}
>  
> +  if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) {
> +// Conservatively, mark all inline asm blocks in CUDA as convergent
> +// (meaning, they may call an intrinsically convergent op, such as 
> bar.sync,
> +// and so can't have certain optimizations applied around them).
> +Result->addAttribute(llvm::AttributeSet::FunctionIndex,
> + llvm::Attribute::Convergent);
> +  }
> +
>// Extract all of the register value results from the asm.
>std::vector RegResults;
>if (ResultRegTypes.size() == 1) {
> 
> Modified: cfe/trunk/test/CodeGenCUDA/convergent.cu
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCUDA/convergent.cu?rev=271336=271335=271336=diff
> ==
> --- cfe/trunk/test/CodeGenCUDA/convergent.cu (original)
> +++ cfe/trunk/test/CodeGenCUDA/convergent.cu Tue May 31 16:27:13 2016
> @@ -25,6 +25,11 @@ __host__ __device__ void baz();
>  __host__ __device__ void bar() {
>// DEVICE: call void @_Z3bazv() [[CALL_ATTR:#[0-9]+]]
>baz();
> +  // DEVICE: call i32 asm "trap;", "=l"() [[ASM_ATTR:#[0-9]+]]
> +  int x;
> +  asm ("trap;" : "=l"(x));
> +  // DEVICE: call void asm sideeffect "trap;", ""() [[ASM_ATTR:#[0-9]+]]
> +  asm volatile ("trap;");
>  }
>  
>  // DEVICE: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
> @@ -32,6 +37,7 @@ __host__ __device__ void bar() {
>  // DEVICE-SAME: convergent
>  // DEVICE-SAME: }
>  // DEVICE: attributes [[CALL_ATTR]] = { convergent }
> +// DEVICE: attributes [[ASM_ATTR]] = { convergent
>  
>  // HOST: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
>  // HOST: attributes [[BAZ_ATTR]] = {
> 
> 
> ___
> 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


Re: [PATCH] D20714: [Clang-tidy] Fix some Include What You Use warnings; other minor fixes

2016-06-01 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

See https://github.com/include-what-you-use/include-what-you-use/issues/292 and 
https://github.com/include-what-you-use/include-what-you-use/issues/301.


Repository:
  rL LLVM

http://reviews.llvm.org/D20714



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


r271414 - Disable warning about core features by default

2016-06-01 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Wed Jun  1 13:04:53 2016
New Revision: 271414

URL: http://llvm.org/viewvc/llvm-project?rev=271414=rev
Log:
Disable warning about core features by default

Reviewers: Anastasia, yaxunl

Differential Revision: http://reviews.llvm.org/D20744

Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/test/Parser/opencl-atomics-cl20.cl
cfe/trunk/test/SemaOpenCL/extension-version.cl
cfe/trunk/test/SemaOpenCL/invalid-logical-ops-1.2.cl

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=271414=271413=271414=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Wed Jun  1 13:04:53 
2016
@@ -929,7 +929,7 @@ def warn_pragma_unknown_extension : Warn
 def warn_pragma_unsupported_extension : Warning<
   "unsupported OpenCL extension %0 - ignoring">, InGroup;
 def warn_pragma_extension_is_core : Warning<
-  "OpenCL extension %0 is core feature or supported optional core feature - 
ignoring">, InGroup;
+  "OpenCL extension %0 is core feature or supported optional core feature - 
ignoring">, InGroup>, DefaultIgnore;
 
 // OpenCL errors.
 def err_opencl_taking_function_address_parser : Error<

Modified: cfe/trunk/test/Parser/opencl-atomics-cl20.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/opencl-atomics-cl20.cl?rev=271414=271413=271414=diff
==
--- cfe/trunk/test/Parser/opencl-atomics-cl20.cl (original)
+++ cfe/trunk/test/Parser/opencl-atomics-cl20.cl Wed Jun  1 13:04:53 2016
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic 
-fsyntax-only
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only 
-cl-std=CL2.0 -DCL20
-// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only 
-cl-std=CL2.0 -DCL20 -DEXT
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only 
-cl-std=CL2.0 -DCL20 -DEXT -Wpedantic-core-features
 
 #ifdef EXT
 #pragma OPENCL EXTENSION cl_khr_int64_base_atomics:enable

Modified: cfe/trunk/test/SemaOpenCL/extension-version.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/extension-version.cl?rev=271414=271413=271414=diff
==
--- cfe/trunk/test/SemaOpenCL/extension-version.cl (original)
+++ cfe/trunk/test/SemaOpenCL/extension-version.cl Wed Jun  1 13:04:53 2016
@@ -2,8 +2,12 @@
 // RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown
 // RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown
 // RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown 
-Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown 
-Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown 
-Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown 
-Wpedantic-core-features -DTEST_CORE_FEATURES
 
-#if __OPENCL_C_VERSION__ >= 200
+#if __OPENCL_C_VERSION__ >= 200 && ! defined TEST_CORE_FEATURES
 // expected-no-diagnostics
 #endif
 
@@ -39,56 +43,76 @@
 #pragma OPENCL EXTENSION cl_khr_icd: enable
 
 // Core features in CL 1.1
-#if (__OPENCL_C_VERSION__ < 110)
+
 #ifndef cl_khr_byte_addressable_store
 #error "Missing cl_khr_byte_addressable_store define"
 #endif
 #pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is 
core feature or supported optional core feature - ignoring}}
+#endif
 
 #ifndef cl_khr_global_int32_base_atomics
 #error "Missing cl_khr_global_int32_base_atomics define"
 #endif
 #pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is 
core feature or supported optional core feature - ignoring}}
+#endif
 
 #ifndef cl_khr_global_int32_extended_atomics
 #error "Missing cl_khr_global_int32_extended_atomics define"
 #endif
 #pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 
'cl_khr_global_int32_extended_atomics' is core feature or supported optional 
core feature - ignoring}}
+#endif
 
 #ifndef cl_khr_local_int32_base_atomics
 #error 

Re: [PATCH] D20744: [OpenCL] Disable warning about core features by default

2016-06-01 Thread Jan Vesely via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271414: Disable warning about core features by default 
(authored by jvesely).

Changed prior to commit:
  http://reviews.llvm.org/D20744?vs=59079=59255#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20744

Files:
  cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
  cfe/trunk/test/Parser/opencl-atomics-cl20.cl
  cfe/trunk/test/SemaOpenCL/extension-version.cl
  cfe/trunk/test/SemaOpenCL/invalid-logical-ops-1.2.cl

Index: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
@@ -929,7 +929,7 @@
 def warn_pragma_unsupported_extension : Warning<
   "unsupported OpenCL extension %0 - ignoring">, InGroup;
 def warn_pragma_extension_is_core : Warning<
-  "OpenCL extension %0 is core feature or supported optional core feature - ignoring">, InGroup;
+  "OpenCL extension %0 is core feature or supported optional core feature - ignoring">, InGroup>, DefaultIgnore;
 
 // OpenCL errors.
 def err_opencl_taking_function_address_parser : Error<
Index: cfe/trunk/test/Parser/opencl-atomics-cl20.cl
===
--- cfe/trunk/test/Parser/opencl-atomics-cl20.cl
+++ cfe/trunk/test/Parser/opencl-atomics-cl20.cl
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20
-// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20 -DEXT
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20 -DEXT -Wpedantic-core-features
 
 #ifdef EXT
 #pragma OPENCL EXTENSION cl_khr_int64_base_atomics:enable
Index: cfe/trunk/test/SemaOpenCL/extension-version.cl
===
--- cfe/trunk/test/SemaOpenCL/extension-version.cl
+++ cfe/trunk/test/SemaOpenCL/extension-version.cl
@@ -2,8 +2,12 @@
 // RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown
 // RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown
 // RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
 
-#if __OPENCL_C_VERSION__ >= 200
+#if __OPENCL_C_VERSION__ >= 200 && ! defined TEST_CORE_FEATURES
 // expected-no-diagnostics
 #endif
 
@@ -39,56 +43,76 @@
 #pragma OPENCL EXTENSION cl_khr_icd: enable
 
 // Core features in CL 1.1
-#if (__OPENCL_C_VERSION__ < 110)
+
 #ifndef cl_khr_byte_addressable_store
 #error "Missing cl_khr_byte_addressable_store define"
 #endif
 #pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is core feature or supported optional core feature - ignoring}}
+#endif
 
 #ifndef cl_khr_global_int32_base_atomics
 #error "Missing cl_khr_global_int32_base_atomics define"
 #endif
 #pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring}}
+#endif
 
 #ifndef cl_khr_global_int32_extended_atomics
 #error "Missing cl_khr_global_int32_extended_atomics define"
 #endif
 #pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_extended_atomics' is core feature or supported optional core feature - ignoring}}
+#endif
 
 #ifndef cl_khr_local_int32_base_atomics
 #error "Missing cl_khr_local_int32_base_atomics define"
 #endif
 #pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_base_atomics' is core feature or supported optional core feature - ignoring}}
+#endif
 
 #ifndef cl_khr_local_int32_extended_atomics
 #error "Missing cl_khr_local_int32_extended_atomics define"
 #endif
 #pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable
+#if 

r271413 - Fixup list of available extensions

2016-06-01 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Wed Jun  1 13:04:50 2016
New Revision: 271413

URL: http://llvm.org/viewvc/llvm-project?rev=271413=rev
Log:
Fixup list of available extensions

Reviewers: Anastasia

Differential Revision: http://reviews.llvm.org/D20447

Added:
cfe/trunk/test/SemaOpenCL/extension-version.cl
Modified:
cfe/trunk/include/clang/Basic/OpenCLExtensions.def

Modified: cfe/trunk/include/clang/Basic/OpenCLExtensions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenCLExtensions.def?rev=271413=271412=271413=diff
==
--- cfe/trunk/include/clang/Basic/OpenCLExtensions.def (original)
+++ cfe/trunk/include/clang/Basic/OpenCLExtensions.def Wed Jun  1 13:04:50 2016
@@ -34,35 +34,39 @@
 #endif // OPENCLEXT_INTERNAL
 
 // OpenCL 1.0.
-OPENCLEXT_INTERNAL(cl_khr_3d_image_writes, 100, 120)
+OPENCLEXT_INTERNAL(cl_khr_3d_image_writes, 100, 200)
+// fprounding mode is special since it is not mentioned beyond 1.0
+OPENCLEXT_INTERNAL(cl_khr_select_fprounding_mode, 100, 110)
 OPENCLEXT_INTERNAL(cl_khr_byte_addressable_store, 100, 110)
 OPENCLEXT_INTERNAL(cl_khr_fp16, 100, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_fp64, 100, 120)
 OPENCLEXT_INTERNAL(cl_khr_global_int32_base_atomics, 100, 110)
 OPENCLEXT_INTERNAL(cl_khr_global_int32_extended_atomics, 100, 110)
-OPENCLEXT_INTERNAL(cl_khr_gl_sharing, 100, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_icd, 100, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_local_int32_base_atomics, 100, 110)
 OPENCLEXT_INTERNAL(cl_khr_local_int32_extended_atomics, 100, 110)
+OPENCLEXT_INTERNAL(cl_khr_int64_base_atomics, 100, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_int64_extended_atomics, 100, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_gl_sharing, 100, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_icd, 100, ~0U)
 
 // OpenCL 1.1.
-OPENCLEXT_INTERNAL(cl_khr_d3d10_sharing, 110, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_gl_event, 110, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_int64_base_atomics, 110, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_int64_extended_atomics, 110, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_d3d10_sharing, 110, ~0U)
 
 // OpenCL 1.2.
+OPENCLEXT_INTERNAL(cl_khr_context_abort, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_d3d11_sharing, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_depth_images, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_dx9_media_sharing, 120, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_image2d_from_buffer, 120, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_initialize_memory, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_gl_depth_images, 120, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_gl_msaa_sharing, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_spir, 120, ~0U)
 
 // OpenCL 2.0.
 OPENCLEXT_INTERNAL(cl_khr_egl_event, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_egl_image, 200, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_gl_msaa_sharing, 200, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_initialize_memory, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_terminate_context, 200, ~0U)

Added: cfe/trunk/test/SemaOpenCL/extension-version.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/extension-version.cl?rev=271413=auto
==
--- cfe/trunk/test/SemaOpenCL/extension-version.cl (added)
+++ cfe/trunk/test/SemaOpenCL/extension-version.cl Wed Jun  1 13:04:50 2016
@@ -0,0 +1,225 @@
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown
+
+#if __OPENCL_C_VERSION__ >= 200
+// expected-no-diagnostics
+#endif
+
+// Extensions in all versions
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifndef cl_khr_fp16
+#error "Missing cl_khr_fp16 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp16: enable
+
+#ifndef cl_khr_int64_base_atomics
+#error "Missing cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+
+#ifndef cl_khr_int64_extended_atomics
+#error "Missing cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
+
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+
+#ifndef cl_khr_icd
+#error "Missing cl_khr_icd define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_icd: enable
+
+// Core features in CL 1.1
+#if (__OPENCL_C_VERSION__ < 110)
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION 

Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-06-01 Thread Jan Vesely via cfe-commits
This revision was automatically updated to reflect the committed changes.
jvesely marked 5 inline comments as done.
Closed by commit rL271413: Fixup list of available extensions (authored by 
jvesely).

Changed prior to commit:
  http://reviews.llvm.org/D20447?vs=59240=59254#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20447

Files:
  cfe/trunk/include/clang/Basic/OpenCLExtensions.def
  cfe/trunk/test/SemaOpenCL/extension-version.cl

Index: cfe/trunk/include/clang/Basic/OpenCLExtensions.def
===
--- cfe/trunk/include/clang/Basic/OpenCLExtensions.def
+++ cfe/trunk/include/clang/Basic/OpenCLExtensions.def
@@ -34,35 +34,39 @@
 #endif // OPENCLEXT_INTERNAL
 
 // OpenCL 1.0.
-OPENCLEXT_INTERNAL(cl_khr_3d_image_writes, 100, 120)
+OPENCLEXT_INTERNAL(cl_khr_3d_image_writes, 100, 200)
+// fprounding mode is special since it is not mentioned beyond 1.0
+OPENCLEXT_INTERNAL(cl_khr_select_fprounding_mode, 100, 110)
 OPENCLEXT_INTERNAL(cl_khr_byte_addressable_store, 100, 110)
 OPENCLEXT_INTERNAL(cl_khr_fp16, 100, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_fp64, 100, 120)
 OPENCLEXT_INTERNAL(cl_khr_global_int32_base_atomics, 100, 110)
 OPENCLEXT_INTERNAL(cl_khr_global_int32_extended_atomics, 100, 110)
-OPENCLEXT_INTERNAL(cl_khr_gl_sharing, 100, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_icd, 100, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_local_int32_base_atomics, 100, 110)
 OPENCLEXT_INTERNAL(cl_khr_local_int32_extended_atomics, 100, 110)
+OPENCLEXT_INTERNAL(cl_khr_int64_base_atomics, 100, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_int64_extended_atomics, 100, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_gl_sharing, 100, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_icd, 100, ~0U)
 
 // OpenCL 1.1.
-OPENCLEXT_INTERNAL(cl_khr_d3d10_sharing, 110, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_gl_event, 110, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_int64_base_atomics, 110, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_int64_extended_atomics, 110, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_d3d10_sharing, 110, ~0U)
 
 // OpenCL 1.2.
+OPENCLEXT_INTERNAL(cl_khr_context_abort, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_d3d11_sharing, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_depth_images, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_dx9_media_sharing, 120, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_image2d_from_buffer, 120, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_initialize_memory, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_gl_depth_images, 120, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_gl_msaa_sharing, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_spir, 120, ~0U)
 
 // OpenCL 2.0.
 OPENCLEXT_INTERNAL(cl_khr_egl_event, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_egl_image, 200, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_gl_msaa_sharing, 200, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_initialize_memory, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_terminate_context, 200, ~0U)
Index: cfe/trunk/test/SemaOpenCL/extension-version.cl
===
--- cfe/trunk/test/SemaOpenCL/extension-version.cl
+++ cfe/trunk/test/SemaOpenCL/extension-version.cl
@@ -0,0 +1,225 @@
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown
+
+#if __OPENCL_C_VERSION__ >= 200
+// expected-no-diagnostics
+#endif
+
+// Extensions in all versions
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifndef cl_khr_fp16
+#error "Missing cl_khr_fp16 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp16: enable
+
+#ifndef cl_khr_int64_base_atomics
+#error "Missing cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+
+#ifndef cl_khr_int64_extended_atomics
+#error "Missing cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
+
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+
+#ifndef cl_khr_icd
+#error "Missing cl_khr_icd define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_icd: enable
+
+// Core features in CL 1.1
+#if (__OPENCL_C_VERSION__ < 110)
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+
+#ifndef 

Re: [PATCH] D20714: [Clang-tidy] Fix some Include What You Use warnings; other minor fixes

2016-06-01 Thread Etienne Bergeron via cfe-commits
etienneb added a comment.

In http://reviews.llvm.org/D20714#445911, @Eugene.Zelenko wrote:

> There is a way to tell IWYU about compound headers with pragmas 
> .
>  I also suggested to make this possible via file with compound headers list.
>
> But person who knows LLVM/Clang code base better then me should define such 
> headers.


I spent time thinking about that problem months ago and I've found so many 
strange cases.
It seems an easy problem on the surface, but when you dig you realized there is 
so many corner cases.

My comment on this patch is not related to the tool or how the tool is working.
It's more a question about whether or not we should "compound" some headers you 
expanded.
Most of the include you added are right and must be present.

A general question on your tool is: can we specify the IWYU pragma somewhere 
else than in the code.
I'm not in favor of building xmas tree with your header files.

  IWYU pragma:

I don't know how common they will be.


Repository:
  rL LLVM

http://reviews.llvm.org/D20714



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


Re: [Diffusion] rL249410: [Tooling] Reuse FileManager in ASTUnit.

2016-06-01 Thread Cameron via cfe-commits
cameron314 added a subscriber: cfe-commits.

http://reviews.llvm.org/rL249410



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


Re: [PATCH] D20843: ObjC lifetime: pull sugar off when the qualifiers conflict.

2016-06-01 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271409: ObjC lifetime: pull sugar off when the qualifiers 
conflict. (authored by mren).

Changed prior to commit:
  http://reviews.llvm.org/D20843?vs=59149=59249#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20843

Files:
  cfe/trunk/lib/Sema/SemaType.cpp
  cfe/trunk/test/SemaObjC/arc-objc-lifetime-conflict.m

Index: cfe/trunk/test/SemaObjC/arc-objc-lifetime-conflict.m
===
--- cfe/trunk/test/SemaObjC/arc-objc-lifetime-conflict.m
+++ cfe/trunk/test/SemaObjC/arc-objc-lifetime-conflict.m
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-arc 
-fobjc-runtime-has-weak %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: bitcast {{.*}} %self_weak_s_w_s
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_strong_w_s
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_weak_s
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_weak_s3
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_strong3
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_strong2
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_strong
+// CHECK-NEXT: objc_storeStrong
+@interface NSObject
+@end
+@interface A : NSObject
+@end
+@implementation A
+- (void)test {
+  __attribute__((objc_ownership(strong))) __typeof__(self) self_strong;
+  __attribute__((objc_ownership(strong))) __typeof__(self_strong) self_strong2;
+  __attribute__((objc_ownership(strong))) __typeof__(self_strong2) 
self_strong3;
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong3) self_weak_s3;
+ 
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong) self_weak_s;
+  __attribute__((objc_ownership(strong))) __typeof__(self_weak_s) 
self_strong_w_s;
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong_w_s) 
self_weak_s_w_s;
+}
+@end
Index: cfe/trunk/lib/Sema/SemaType.cpp
===
--- cfe/trunk/lib/Sema/SemaType.cpp
+++ cfe/trunk/lib/Sema/SemaType.cpp
@@ -5415,11 +5415,13 @@
 }
 
 // Otherwise, if the qualifiers actually conflict, pull sugar off
-// until we reach a type that is directly qualified.
+// and remove the ObjCLifetime qualifiers.
 if (previousLifetime != lifetime) {
-  // This should always terminate: the canonical type is
-  // qualified, so some bit of sugar must be hiding it.
-  while (!underlyingType.Quals.hasObjCLifetime()) {
+  // It's possible to have multiple local ObjCLifetime qualifiers. We
+  // can't stop after we reach a type that is directly qualified.
+  const Type *prevTy = nullptr;
+  while (!prevTy || prevTy != underlyingType.Ty) {
+prevTy = underlyingType.Ty;
 underlyingType = underlyingType.getSingleStepDesugaredType();
   }
   underlyingType.Quals.removeObjCLifetime();


Index: cfe/trunk/test/SemaObjC/arc-objc-lifetime-conflict.m
===
--- cfe/trunk/test/SemaObjC/arc-objc-lifetime-conflict.m
+++ cfe/trunk/test/SemaObjC/arc-objc-lifetime-conflict.m
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-arc -fobjc-runtime-has-weak %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: bitcast {{.*}} %self_weak_s_w_s
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_strong_w_s
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_weak_s
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_weak_s3
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_strong3
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_strong2
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_strong
+// CHECK-NEXT: objc_storeStrong
+@interface NSObject
+@end
+@interface A : NSObject
+@end
+@implementation A
+- (void)test {
+  __attribute__((objc_ownership(strong))) __typeof__(self) self_strong;
+  __attribute__((objc_ownership(strong))) __typeof__(self_strong) self_strong2;
+  __attribute__((objc_ownership(strong))) __typeof__(self_strong2) self_strong3;
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong3) self_weak_s3;
+ 
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong) self_weak_s;
+  __attribute__((objc_ownership(strong))) __typeof__(self_weak_s) self_strong_w_s;
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong_w_s) self_weak_s_w_s;
+}
+@end
Index: cfe/trunk/lib/Sema/SemaType.cpp
===
--- cfe/trunk/lib/Sema/SemaType.cpp
+++ cfe/trunk/lib/Sema/SemaType.cpp
@@ -5415,11 +5415,13 @@
 }
 
 // Otherwise, if the qualifiers actually conflict, pull sugar off
-// until we reach a type that is directly qualified.
+// and remove the 

r271409 - ObjC lifetime: pull sugar off when the qualifiers conflict.

2016-06-01 Thread Manman Ren via cfe-commits
Author: mren
Date: Wed Jun  1 12:14:19 2016
New Revision: 271409

URL: http://llvm.org/viewvc/llvm-project?rev=271409=rev
Log:
ObjC lifetime: pull sugar off when the qualifiers conflict.

It's possible to have multiple local ObjCLifetime qualifiers. When there is
a conflict, we can't stop after we reach a type that is directly qualified.
We need to keep pulling sugar off and removing the ObjCLifetime qualifers.

rdar://25804796

Differential Revision: http://reviews.llvm.org/D20843

Added:
cfe/trunk/test/SemaObjC/arc-objc-lifetime-conflict.m
Modified:
cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=271409=271408=271409=diff
==
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Wed Jun  1 12:14:19 2016
@@ -5415,11 +5415,13 @@ static bool handleObjCOwnershipTypeAttr(
 }
 
 // Otherwise, if the qualifiers actually conflict, pull sugar off
-// until we reach a type that is directly qualified.
+// and remove the ObjCLifetime qualifiers.
 if (previousLifetime != lifetime) {
-  // This should always terminate: the canonical type is
-  // qualified, so some bit of sugar must be hiding it.
-  while (!underlyingType.Quals.hasObjCLifetime()) {
+  // It's possible to have multiple local ObjCLifetime qualifiers. We
+  // can't stop after we reach a type that is directly qualified.
+  const Type *prevTy = nullptr;
+  while (!prevTy || prevTy != underlyingType.Ty) {
+prevTy = underlyingType.Ty;
 underlyingType = underlyingType.getSingleStepDesugaredType();
   }
   underlyingType.Quals.removeObjCLifetime();

Added: cfe/trunk/test/SemaObjC/arc-objc-lifetime-conflict.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-objc-lifetime-conflict.m?rev=271409=auto
==
--- cfe/trunk/test/SemaObjC/arc-objc-lifetime-conflict.m (added)
+++ cfe/trunk/test/SemaObjC/arc-objc-lifetime-conflict.m Wed Jun  1 12:14:19 
2016
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-arc 
-fobjc-runtime-has-weak %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: bitcast {{.*}} %self_weak_s_w_s
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_strong_w_s
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_weak_s
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_weak_s3
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_strong3
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_strong2
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_strong
+// CHECK-NEXT: objc_storeStrong
+@interface NSObject
+@end
+@interface A : NSObject
+@end
+@implementation A
+- (void)test {
+  __attribute__((objc_ownership(strong))) __typeof__(self) self_strong;
+  __attribute__((objc_ownership(strong))) __typeof__(self_strong) self_strong2;
+  __attribute__((objc_ownership(strong))) __typeof__(self_strong2) 
self_strong3;
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong3) self_weak_s3;
+ 
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong) self_weak_s;
+  __attribute__((objc_ownership(strong))) __typeof__(self_weak_s) 
self_strong_w_s;
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong_w_s) 
self_weak_s_w_s;
+}
+@end


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


Re: [PATCH] D20714: [Clang-tidy] Fix some Include What You Use warnings; other minor fixes

2016-06-01 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

There is a way to tell IWYU about compound headers with pragmas 
.
 I also suggested to make this possible via file with compound headers list.

But person who knows LLVM/Clang code base better then me should define such 
headers.


Repository:
  rL LLVM

http://reviews.llvm.org/D20714



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


  1   2   >