[PATCH] D28765: CStringChecker can crash when uninitialized checks are disabled

2017-01-19 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

You might want to give CodeChecker [1] a try as a workaround. It stores the 
results in a more compact format and you can do filtering.

[1] https://github.com/Ericsson/codechecker


https://reviews.llvm.org/D28765



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


[PATCH] D28765: CStringChecker can crash when uninitialized checks are disabled

2017-01-19 Thread Vlad Tsyrklevich via Phabricator via cfe-commits
vlad.tsyrklevich abandoned this revision.
vlad.tsyrklevich added a comment.

The motivation was to make resulting output easier to navigate and to cut the 
result size by ~90%, one default run against the FreeBSD kernel takes 3 gigs of 
storage and I'm running several builds a day as I iterate on checks. I did not 
realize that running without core was unsupported. A silencing flag would have 
done the trick.


https://reviews.llvm.org/D28765



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


Re: [libcxx] r292582 - Still expose std::align_val_t in C++17 even if we don't have aligned new/delete.

2017-01-19 Thread Eric Fiselier via cfe-commits
Hi All,

This patch addresses issues introduced by r292564. Specifically it makes
`align_val_t.pass.cpp` pass in C++17 even if the system
doesn't support aligned new/delete.

Because r292564 was merged into 4.0, this should be as well.

@Marshall can you OK this?

/Eric

On Thu, Jan 19, 2017 at 11:27 PM, Eric Fiselier via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Fri Jan 20 00:27:34 2017
> New Revision: 292582
>
> URL: http://llvm.org/viewvc/llvm-project?rev=292582=rev
> Log:
> Still expose std::align_val_t in C++17 even if we don't have aligned
> new/delete.
>
> r292564 disabled the aligned new/delete overloads on platforms without
> posix_memalign. Unfortunately that patch also disabled the  align_val_t
> definition in C++17 as well.
>
> This patch causes align_val_t to be exposed in C++17 regardless
> of if we have the new/delete overloads.
>
> Modified:
> libcxx/trunk/include/new
>
> Modified: libcxx/trunk/include/new
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/
> new?rev=292582=292581=292582=diff
> 
> ==
> --- libcxx/trunk/include/new (original)
> +++ libcxx/trunk/include/new Fri Jan 20 00:27:34 2017
> @@ -145,7 +145,7 @@ public:
>
>  #endif  // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
>
> -#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
> +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14
>  #ifndef _LIBCPP_CXX03_LANG
>  enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
>  #else
>
>
> ___
> 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] r292582 - Still expose std::align_val_t in C++17 even if we don't have aligned new/delete.

2017-01-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jan 20 00:27:34 2017
New Revision: 292582

URL: http://llvm.org/viewvc/llvm-project?rev=292582=rev
Log:
Still expose std::align_val_t in C++17 even if we don't have aligned new/delete.

r292564 disabled the aligned new/delete overloads on platforms without
posix_memalign. Unfortunately that patch also disabled the  align_val_t
definition in C++17 as well.

This patch causes align_val_t to be exposed in C++17 regardless
of if we have the new/delete overloads.

Modified:
libcxx/trunk/include/new

Modified: libcxx/trunk/include/new
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=292582=292581=292582=diff
==
--- libcxx/trunk/include/new (original)
+++ libcxx/trunk/include/new Fri Jan 20 00:27:34 2017
@@ -145,7 +145,7 @@ public:
 
 #endif  // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
 
-#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14
 #ifndef _LIBCPP_CXX03_LANG
 enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
 #else


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


[PATCH] D28938: Implement P0513R0 - "Poisoning the Hash"

2017-01-19 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF created this revision.

Exactly what the title says.

This patch also adds a `std::hash` specialization in C++17, but it 
was not added by this paper and I can't find the actual paper that adds it.

See http://wg21.link/P0513R0 for more info.

If there are no comments in the next couple of days I'll commit this


https://reviews.llvm.org/D28938

Files:
  include/__functional_base
  include/functional
  include/memory
  include/optional
  include/utility
  include/variant
  test/std/containers/sequences/vector.bool/enabled_hash.pass.cpp
  test/std/diagnostics/syserr/syserr.hash/enabled_hash.pass.cpp
  test/std/strings/basic.string.hash/enabled_hashes.pass.cpp
  test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp
  
test/std/thread/thread.threads/thread.thread.class/thread.thread.id/enabled_hashes.pass.cpp
  
test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp
  test/std/utilities/function.objects/unord.hash/enabled_hashes.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.hash/enabled_hash.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
  test/std/utilities/optional/optional.hash/enabled_hash.pass.cpp
  test/std/utilities/optional/optional.hash/hash.pass.cpp
  test/std/utilities/template.bitset/bitset.hash/enabled_hash.pass.cpp
  test/std/utilities/type.index/type.index.hash/enabled_hash.pass.cpp
  test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp
  test/std/utilities/variant/variant.hash/enabled_hash.pass.cpp
  test/std/utilities/variant/variant.hash/hash.pass.cpp
  test/support/deleter_types.h
  test/support/min_allocator.h
  test/support/poisoned_hash_helper.hpp
  test/support/test.support/test_poisoned_hash_helper.pass.cpp
  www/cxx1z_status.html

Index: www/cxx1z_status.html
===
--- www/cxx1z_status.html
+++ www/cxx1z_status.html
@@ -136,7 +136,7 @@
 	http://wg21.link/P0508R0;>P0508R0LWGWording for GB 58 - structured bindings for node_handlesIssaquah
 	http://wg21.link/P0509R1;>P0509R1LWGUpdating “Restrictions on exception handling”IssaquahNothing to don/a
 	http://wg21.link/P0510R0;>P0510R0LWGDisallowing references, incomplete types, arrays, and empty variantsIssaquahComplete4.0
-	http://wg21.link/P0513R0;>P0513R0LWGPoisoning the HashIssaquah
+	http://wg21.link/P0513R0;>P0513R0LWGPoisoning the HashIssaquahComplete5.0
 	http://wg21.link/P0516R0;>P0516R0LWGClarify That shared_future’s Copy Operations have Wide ContractsIssaquahComplete4.0
 	http://wg21.link/P0517R0;>P0517R0LWGMake future_error ConstructibleIssaquahComplete4.0
 	http://wg21.link/P0521R0;>P0521R0LWGProposed Resolution for CA 14 (shared_ptr use_count/unique)IssaquahNothing to don/a
Index: test/support/test.support/test_poisoned_hash_helper.pass.cpp
===
--- /dev/null
+++ test/support/test.support/test_poisoned_hash_helper.pass.cpp
@@ -0,0 +1,30 @@
+//===--===//
+//
+// 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
+
+// Test that the header `poisoned_hash_helper.hpp` doesn't include any
+// headers that provide hash specializations. This is required so that the
+// 'test_library_hash_specializations_available()' function returns false
+// by default, unless a STL header providing hash has already been included.
+
+#include "poisoned_hash_helper.hpp"
+
+template 
+constexpr bool is_complete_imp(int) { return true; }
+template  constexpr bool is_complete_imp(long) { return false; }
+template  constexpr bool is_complete() { return is_complete_imp(0); }
+
+template  struct has_complete_hash {
+  enum { value = is_complete() };
+};
+
+int main() {
+  static_assert(LibraryHashTypes::assertTrait(), "");
+}
Index: test/support/poisoned_hash_helper.hpp
===
--- /dev/null
+++ test/support/poisoned_hash_helper.hpp
@@ -0,0 +1,244 @@
+// -*- C++ -*-
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+#ifndef SUPPORT_POISONED_HASH_HELPER_HPP
+#define SUPPORT_POISONED_HASH_HELPER_HPP
+
+#include 
+#include 
+
+#include "test_macros.h"
+
+#if TEST_STD_VER < 11
+#error 

[PATCH] D25556: [Sema] Add variable captured by a block to the enclosing lambda's potential capture list

2017-01-19 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added reviewers: ABataev, malcolm.parsons.
ahatanak added a comment.

Add a few more people who have looked at this part of clang in the past to the 
reviewers list.


https://reviews.llvm.org/D25556



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


[libcxx] r292577 - Refactor unique_ptr/shared_ptr deleter test types into single header.

2017-01-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jan 19 22:39:17 2017
New Revision: 292577

URL: http://llvm.org/viewvc/llvm-project?rev=292577=rev
Log:
Refactor unique_ptr/shared_ptr deleter test types into single header.

Added:
libcxx/trunk/test/support/deleter_types.h
  - copied, changed from r292564, 
libcxx/trunk/test/std/utilities/memory/unique.ptr/deleter.h
Removed:
libcxx/trunk/test/std/utilities/memory/unique.ptr/deleter.h

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
Modified:

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move.pass.cpp

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

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/swap.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.special/eq.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.special/rel.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.getdeleter/get_deleter.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp


[PATCH] D28849: [compiler-rt] [test] Fix page address logic in clear_cache_test

2017-01-19 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added inline comments.



Comment at: test/builtins/Unit/clear_cache_test.c:71
+char* start = (char*)((uintptr_t)execution_buffer & (-get_page_size()));
+char* end = (char*)((uintptr_t)(_buffer[128+4096]) & 
(-get_page_size()));
 #if defined(_WIN32)

Shouldnt this read:

char *end = (char *)((uintptr_t)(_buffer[128 + get_page_size()] & 
(-get_page_size(;


https://reviews.llvm.org/D28849



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


[PATCH] D28924: [AST Printer] Print attributes on enum constants

2017-01-19 Thread Jordan Rose via Phabricator via cfe-commits
jordan_rose closed this revision.
jordan_rose added a comment.

Landed as-is in https://reviews.llvm.org/rL292571.


Repository:
  rL LLVM

https://reviews.llvm.org/D28924



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


r292571 - [AST Printer] Print attributes on enum constants

2017-01-19 Thread Jordan Rose via cfe-commits
Author: jrose
Date: Thu Jan 19 21:33:42 2017
New Revision: 292571

URL: http://llvm.org/viewvc/llvm-project?rev=292571=rev
Log:
[AST Printer] Print attributes on enum constants

The AST printer was dropping attributes on enumerators (enum
constants). Now it's not.

Modified:
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/test/Sema/ast-print.c

Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=292571=292570=292571=diff
==
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Thu Jan 19 21:33:42 2017
@@ -464,6 +464,7 @@ void DeclPrinter::VisitRecordDecl(Record
 
 void DeclPrinter::VisitEnumConstantDecl(EnumConstantDecl *D) {
   Out << *D;
+  prettyPrintAttributes(D);
   if (Expr *Init = D->getInitExpr()) {
 Out << " = ";
 Init->printPretty(Out, nullptr, Policy, Indentation);

Modified: cfe/trunk/test/Sema/ast-print.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/ast-print.c?rev=292571=292570=292571=diff
==
--- cfe/trunk/test/Sema/ast-print.c (original)
+++ cfe/trunk/test/Sema/ast-print.c Thu Jan 19 21:33:42 2017
@@ -65,3 +65,12 @@ void initializers() {
   // CHECK: } z = {(struct Z){}};
   } z = {(struct Z){}};
 }
+
+// CHECK-LABEL: enum EnumWithAttributes {
+enum EnumWithAttributes {
+  // CHECK-NEXT: EnumWithAttributesFoo __attribute__((deprecated(""))),
+  EnumWithAttributesFoo __attribute__((deprecated)),
+  // CHECK-NEXT: EnumWithAttributesBar __attribute__((unavailable(""))) = 50
+  EnumWithAttributesBar __attribute__((unavailable)) = 50
+  // CHECK-NEXT: } __attribute__((deprecated("")))
+} __attribute__((deprecated));


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


[PATCH] D28933: Revert the return type for `emplace_(back|front)` to `void` in C++14 and before

2017-01-19 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists created this revision.

In C++11/14, the return type of `emplace_front` and `emplace_back` was `void`. 
In http://wg21.link/p0084, Alan Talbot proposed changing the return type to 
return a reference to the newly created element.

We implemented that - but unilaterally. 
This changes that, so that the change is only realized when building for C++17 
or later.
This fixes https://llvm.org/bugs/show_bug.cgi?id=31680.


https://reviews.llvm.org/D28933

Files:
  include/deque
  include/forward_list
  include/list
  include/queue
  include/stack
  include/vector
  test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
  test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
  test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
  test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
  
test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
  test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
  test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
  test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp

Index: test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
===
--- test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
+++ test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
@@ -12,9 +12,11 @@
 //  vector.bool
 
 // template  reference emplace_back(Args&&... args);
+// return type is 'reference' in C++17; 'void' before
 
 #include 
 #include 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -21,8 +23,9 @@
 {
 {
 typedef std::vector C;
+C c;
+#if TEST_STD_VER > 14
 typedef C::reference Ref;
-C c;
 Ref r1 = c.emplace_back();
 assert(c.size() == 1);
 assert(c.front() == false);
@@ -36,19 +39,27 @@
 r2 = false;
 assert(c.back() == false);
 r2 = true;
-Ref r3 = c.emplace_back(1 == 1);
+#else
+c.emplace_back();
+assert(c.size() == 1);
+assert(c.front() == false);
+c.emplace_back(true);
+assert(c.size() == 2);
+assert(c.front() == false);
+assert(c.back() == true);
+#endif
+c.emplace_back(1 == 1);
 assert(c.size() == 3);
 assert(c.front() == false);
 assert(c[1] == true);
 assert(c.back() == true);
-r3 = false;
-assert(c.back() == false);
 }
 {
 typedef std::vector C;
-typedef C::reference Ref;
 C c;
 
+#if TEST_STD_VER > 14
+typedef C::reference Ref;
 Ref r1 = c.emplace_back();
 assert(c.size() == 1);
 assert(c.front() == false);
@@ -62,6 +73,15 @@
 r2 = false;
 assert(c.back() == false);
 r2 = true;
+#else
+c.emplace_back();
+assert(c.size() == 1);
+assert(c.front() == false);
+c.emplace_back(true);
+assert(c.size() == 2);
+assert(c.front() == false);
+assert(c.back() == true);
+#endif
 c.emplace_back(1 == 1);
 assert(c.size() == 3);
 assert(c.front() == false);
Index: test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
===
--- test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
+++ test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
@@ -12,9 +12,11 @@
 // 
 
 // template  reference emplace_back(Args&&... args);
+// return type is 'reference' in C++17; 'void' before
 
 #include 
 #include 
+#include "test_macros.h"
 #include "test_allocator.h"
 #include "min_allocator.h"
 #include "test_allocator.h"
@@ -56,6 +58,7 @@
 {
 {
 std::vector c;
+#if TEST_STD_VER > 14
 A& r1 = c.emplace_back(2, 3.5);
 assert(c.size() == 1);
 assert( == ());
@@ -65,8 +68,17 @@
 A& r2 = c.emplace_back(3, 4.5);
 assert(c.size() == 2);
 assert( == ());
+#else
+c.emplace_back(2, 3.5);
+assert(c.size() == 1);
 assert(c.front().geti() == 2);
 assert(c.front().getd() == 3.5);
+assert(is_contiguous_container_asan_correct(c));
+c.emplace_back(3, 4.5);
+assert(c.size() == 2);
+#endif
+assert(c.front().geti() == 2);
+assert(c.front().getd() == 3.5);
 assert(c.back().geti() == 3);
 assert(c.back().getd() == 4.5);
 assert(is_contiguous_container_asan_correct(c));
@@ -73,6 +85,7 @@
 }
 {
 std::vector > c;
+#if TEST_STD_VER > 14
 A& r1 = c.emplace_back(2, 3.5);
 assert(c.size() == 1);
 assert( == ());
@@ -82,8 +95,17 @@
 A& r2 = c.emplace_back(3, 

[PATCH] D28931: Disable aligned new/delete on Apple platforms without posix_memalign

2017-01-19 Thread Greg Parker via Phabricator via cfe-commits
gparker42 added a comment.

No, the old versions of OS X that lack `posix_memalign` also lack 
`aligned_alloc`.


https://reviews.llvm.org/D28931



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


Re: r292497 - [Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode

2017-01-19 Thread Richard Smith via cfe-commits
On 19 January 2017 at 15:52, Hans Wennborg  wrote:

> Richard, what do you think?


Yes, let's merge this.


> On Thu, Jan 19, 2017 at 9:34 AM, Alex L  wrote:
> > Hi Hans,
> >
> > Would it be possible to merge this for 4.0?
> >
> > Cheers,
> > Alex
> >
> > On 19 January 2017 at 17:17, Alex Lorenz via cfe-commits
> >  wrote:
> >>
> >> Author: arphaman
> >> Date: Thu Jan 19 11:17:57 2017
> >> New Revision: 292497
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=292497=rev
> >> Log:
> >> [Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode
> >>
> >> rdar://28532840
> >>
> >> Differential Revision: https://reviews.llvm.org/D25213
> >>
> >> Added:
> >> cfe/trunk/test/Sema/PR28181.c
> >> Modified:
> >> cfe/trunk/lib/Sema/SemaExpr.cpp
> >>
> >> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> >> URL:
> >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/
> SemaExpr.cpp?rev=292497=292496=292497=diff
> >>
> >> 
> ==
> >> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> >> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jan 19 11:17:57 2017
> >> @@ -11505,7 +11505,7 @@ ExprResult Sema::BuildBinOp(Scope *S, So
> >>return checkPseudoObjectAssignment(S, OpLoc, Opc, LHSExpr,
> >> RHSExpr);
> >>
> >>  // Don't resolve overloads if the other type is overloadable.
> >> -if (pty->getKind() == BuiltinType::Overload) {
> >> +if (getLangOpts().CPlusPlus && pty->getKind() ==
> >> BuiltinType::Overload) {
> >>// We can't actually test that if we still have a placeholder,
> >>// though.  Fortunately, none of the exceptions we see in that
> >>// code below are valid when the LHS is an overload set.  Note
> >> @@ -11530,17 +11530,16 @@ ExprResult Sema::BuildBinOp(Scope *S, So
> >>  // An overload in the RHS can potentially be resolved by the type
> >>  // being assigned to.
> >>  if (Opc == BO_Assign && pty->getKind() == BuiltinType::Overload) {
> >> -  if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent())
> >> -return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr,
> >> RHSExpr);
> >> -
> >> -  if (LHSExpr->getType()->isOverloadableType())
> >> +  if (getLangOpts().CPlusPlus &&
> >> +  (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent() ||
> >> +   LHSExpr->getType()->isOverloadableType()))
> >>  return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr,
> >> RHSExpr);
> >>
> >>return CreateBuiltinBinOp(OpLoc, Opc, LHSExpr, RHSExpr);
> >>  }
> >>
> >>  // Don't resolve overloads if the other type is overloadable.
> >> -if (pty->getKind() == BuiltinType::Overload &&
> >> +if (getLangOpts().CPlusPlus && pty->getKind() ==
> >> BuiltinType::Overload &&
> >>  LHSExpr->getType()->isOverloadableType())
> >>return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr,
> >> RHSExpr);
> >>
> >>
> >> Added: cfe/trunk/test/Sema/PR28181.c
> >> URL:
> >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/
> PR28181.c?rev=292497=auto
> >>
> >> 
> ==
> >> --- cfe/trunk/test/Sema/PR28181.c (added)
> >> +++ cfe/trunk/test/Sema/PR28181.c Thu Jan 19 11:17:57 2017
> >> @@ -0,0 +1,13 @@
> >> +// RUN: %clang_cc1 -fsyntax-only -verify %s
> >> +
> >> +struct spinlock_t {
> >> +  int lock;
> >> +} audit_skb_queue;
> >> +
> >> +void fn1() {
> >> +  audit_skb_queue = (lock); // expected-error {{use of undeclared
> >> identifier 'lock'; did you mean 'long'?}}
> >> +}   // expected-error@-1 {{assigning to
> 'struct
> >> spinlock_t' from incompatible type ''}}
> >> +
> >> +void fn2() {
> >> +  audit_skb_queue + (lock); // expected-error {{use of undeclared
> >> identifier 'lock'; did you mean 'long'?}}
> >> +}   // expected-error@-1 {{reference to
> >> overloaded function could not be resolved; did you mean to call it?}}
> >>
> >>
> >> ___
> >> 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


r292568 - [test] Remove an unwanted match for `UNSUPPORTED:`.

2017-01-19 Thread Greg Parker via cfe-commits
Author: gparker
Date: Thu Jan 19 20:12:22 2017
New Revision: 292568

URL: http://llvm.org/viewvc/llvm-project?rev=292568=rev
Log:
[test] Remove an unwanted match for `UNSUPPORTED:`.

Modified:
cfe/trunk/test/Driver/embed-bitcode.c

Modified: cfe/trunk/test/Driver/embed-bitcode.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/embed-bitcode.c?rev=292568=292567=292568=diff
==
--- cfe/trunk/test/Driver/embed-bitcode.c (original)
+++ cfe/trunk/test/Driver/embed-bitcode.c Thu Jan 19 20:12:22 2017
@@ -51,5 +51,5 @@
 // CHECK-NO-LINKER-NOT: -bitcode_bundle
 
 // RUN: %clang -target armv7-apple-darwin -miphoneos-version-min=5.0 %s 
-fembed-bitcode -### 2>&1 | \
-// RUN:   FileCheck %s -check-prefix=CHECK-PLATFORM-UNSUPPORTED
-// CHECK-PLATFORM-UNSUPPORTED: -fembed-bitcode is not supported on versions of 
iOS prior to 6.0
+// RUN:   FileCheck %s -check-prefix=CHECK-PLATFORM-NOTSUPPORTED
+// CHECK-PLATFORM-NOTSUPPORTED: -fembed-bitcode is not supported on versions 
of iOS prior to 6.0


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


[PATCH] D28931: Disable aligned new/delete on Apple platforms without posix_memalign

2017-01-19 Thread Richard Smith via Phabricator via cfe-commits
rsmith added a comment.

Does OS X have the C11 `aligned_alloc` function? Perhaps we could use that 
instead, when available.


https://reviews.llvm.org/D28931



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


Re: [libcxx] r292564 - Disable aligned new/delete on Apple platforms without posix_memalign

2017-01-19 Thread Eric Fiselier via cfe-commits
Merged.

Relevant commits:

* r292566 - Merge r292564
* r292565 - Merge r292560

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


[libcxx] r292566 - Merge r292564 - Disable aligned new/delete on Apple platforms without posix_memalign

2017-01-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jan 19 19:54:53 2017
New Revision: 292566

URL: http://llvm.org/viewvc/llvm-project?rev=292566=rev
Log:
Merge r292564 - Disable aligned new/delete on Apple platforms without 
posix_memalign

This patch disables the aligned new/delet overloads on Apple platforms without
posix_memalign. This fixes libc++.dylib build regressions on such platforms.
This fixes http://llvm.org/PR31448.

Modified:
libcxx/branches/release_40/include/__config
libcxx/branches/release_40/include/new
libcxx/branches/release_40/src/new.cpp

Modified: libcxx/branches/release_40/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/include/__config?rev=292566=292565=292566=diff
==
--- libcxx/branches/release_40/include/__config (original)
+++ libcxx/branches/release_40/include/__config Thu Jan 19 19:54:53 2017
@@ -835,6 +835,18 @@ template  struct __static_asse
 #define _DECLARE_C99_LDBL_MATH 1
 #endif
 
+#if defined(__APPLE__)
+# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
+ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#   define __MAC_OS_X_VERSION_MIN_REQUIRED 
__ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+# endif
+# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
+#   if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#   endif
+# endif
+#endif // defined(__APPLE__)
+
 #if defined(__APPLE__) || defined(__FreeBSD__)
 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
 #endif

Modified: libcxx/branches/release_40/include/new
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/include/new?rev=292566=292565=292566=diff
==
--- libcxx/branches/release_40/include/new (original)
+++ libcxx/branches/release_40/include/new Thu Jan 19 19:54:53 2017
@@ -101,8 +101,9 @@ void  operator delete[](void* ptr, void*
 # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
 #endif
 
-#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
-(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+(!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
+(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
 #endif
 

Modified: libcxx/branches/release_40/src/new.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/src/new.cpp?rev=292566=292565=292566=diff
==
--- libcxx/branches/release_40/src/new.cpp (original)
+++ libcxx/branches/release_40/src/new.cpp Thu Jan 19 19:54:53 2017
@@ -151,6 +151,8 @@ operator delete[] (void* ptr, size_t) _N
 ::operator delete[](ptr);
 }
 
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 _LIBCPP_WEAK
 void *
 operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
@@ -275,6 +277,8 @@ operator delete[] (void* ptr, size_t, st
 ::operator delete[](ptr, alignment);
 }
 
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 #endif // !__GLIBCXX__
 
 namespace std


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


[libcxx] r292565 - Merge r292560 - [NFC] Group aligned new/delete definitions together in new.cpp

2017-01-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jan 19 19:52:28 2017
New Revision: 292565

URL: http://llvm.org/viewvc/llvm-project?rev=292565=rev
Log:
Merge r292560 - [NFC] Group aligned new/delete definitions together in new.cpp

Modified:
libcxx/branches/release_40/src/new.cpp

Modified: libcxx/branches/release_40/src/new.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/src/new.cpp?rev=292565=292564=292565=diff
==
--- libcxx/branches/release_40/src/new.cpp (original)
+++ libcxx/branches/release_40/src/new.cpp Thu Jan 19 19:52:28 2017
@@ -64,38 +64,6 @@ operator new(std::size_t size) _THROW_BA
 }
 
 _LIBCPP_WEAK
-void *
-operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
-{
-if (size == 0)
-size = 1;
-if (static_cast(alignment) < sizeof(void*))
-  alignment = std::align_val_t(sizeof(void*));
-void* p;
-#if defined(_LIBCPP_MSVCRT)
-while ((p = _aligned_malloc(size, static_cast(alignment))) == 
nullptr)
-#else
-while (::posix_memalign(, static_cast(alignment), size) != 0)
-#endif
-{
-// If posix_memalign fails and there is a new_handler,
-// call it to try free up memory.
-std::new_handler nh = std::get_new_handler();
-if (nh)
-nh();
-else {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-throw std::bad_alloc();
-#else
-p = nullptr; // posix_memalign doesn't initialize 'p' on failure
-break;
-#endif
-}
-}
-return p;
-}
-
-_LIBCPP_WEAK
 void*
 operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
 {
@@ -116,14 +84,21 @@ operator new(size_t size, const std::not
 
 _LIBCPP_WEAK
 void*
-operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) 
_NOEXCEPT
+operator new[](size_t size) _THROW_BAD_ALLOC
+{
+return ::operator new(size);
+}
+
+_LIBCPP_WEAK
+void*
+operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
 {
 void* p = 0;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-p = ::operator new(size, alignment);
+p = ::operator new[](size);
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
 catch (...)
@@ -134,29 +109,90 @@ operator new(size_t size, std::align_val
 }
 
 _LIBCPP_WEAK
-void*
-operator new[](size_t size) _THROW_BAD_ALLOC
+void
+operator delete(void* ptr) _NOEXCEPT
 {
-return ::operator new(size);
+if (ptr)
+::free(ptr);
 }
 
 _LIBCPP_WEAK
-void*
-operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+void
+operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
 {
-return ::operator new(size, alignment);
+::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete(void* ptr, size_t) _NOEXCEPT
+{
+::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr) _NOEXCEPT
+{
+::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
+{
+::operator delete[](ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr, size_t) _NOEXCEPT
+{
+::operator delete[](ptr);
+}
+
+_LIBCPP_WEAK
+void *
+operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+{
+if (size == 0)
+size = 1;
+if (static_cast(alignment) < sizeof(void*))
+  alignment = std::align_val_t(sizeof(void*));
+void* p;
+#if defined(_LIBCPP_MSVCRT)
+while ((p = _aligned_malloc(size, static_cast(alignment))) == 
nullptr)
+#else
+while (::posix_memalign(, static_cast(alignment), size) != 0)
+#endif
+{
+// If posix_memalign fails and there is a new_handler,
+// call it to try free up memory.
+std::new_handler nh = std::get_new_handler();
+if (nh)
+nh();
+else {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+throw std::bad_alloc();
+#else
+p = nullptr; // posix_memalign doesn't initialize 'p' on failure
+break;
+#endif
+}
+}
+return p;
 }
 
 _LIBCPP_WEAK
 void*
-operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
+operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) 
_NOEXCEPT
 {
 void* p = 0;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-p = ::operator new[](size);
+p = ::operator new(size, alignment);
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
 catch (...)
@@ -168,6 +204,13 @@ operator new[](size_t size, const std::n
 
 _LIBCPP_WEAK
 void*
+operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+{
+return ::operator new(size, alignment);
+}
+
+_LIBCPP_WEAK
+void*
 operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) 
_NOEXCEPT
 {
 void* p = 0;
@@ -187,14 +230,6 @@ operator new[](size_t size, std::align_v
 
 _LIBCPP_WEAK
 void
-operator delete(void* ptr) _NOEXCEPT
-{
-if (ptr)
-::free(ptr);
-}
-
-_LIBCPP_WEAK

Re: [libcxx] r292564 - Disable aligned new/delete on Apple platforms without posix_memalign

2017-01-19 Thread Eric Fiselier via cfe-commits
Hi Hans,

Marshall gave this commit and r292560 permission to be merged into 4.0,
which I will being doing shortly.

/Eric

On Thu, Jan 19, 2017 at 6:47 PM, Eric Fiselier via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Thu Jan 19 19:47:26 2017
> New Revision: 292564
>
> URL: http://llvm.org/viewvc/llvm-project?rev=292564=rev
> Log:
> Disable aligned new/delete on Apple platforms without posix_memalign
>
> Summary:
> This patch disables the aligned new/delet overloads on Apple platforms
> without `posix_memalign`. This fixes libc++.dylib build regressions on such
> platforms.
> This fixes http://llvm.org/PR31448.
>
> This patch should also be merged into the 4.0 release branch
>
>
> Reviewers: mclow.lists, rsmith, dexonsmith, jeremyhu
>
> Reviewed By: mclow.lists
>
> Subscribers: cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D28931
>
> Modified:
> libcxx/trunk/include/__config
> libcxx/trunk/include/new
> libcxx/trunk/src/new.cpp
>
> Modified: libcxx/trunk/include/__config
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/_
> _config?rev=292564=292563=292564=diff
> 
> ==
> --- libcxx/trunk/include/__config (original)
> +++ libcxx/trunk/include/__config Thu Jan 19 19:47:26 2017
> @@ -848,6 +848,18 @@ template  struct __static_asse
>  #define _DECLARE_C99_LDBL_MATH 1
>  #endif
>
> +#if defined(__APPLE__)
> +# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
> + defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
> +#   define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIROMENT_MAC_OS_X_VERSION_
> MIN_REQUIRED__
> +# endif
> +# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
> +#   if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
> +# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
> +#   endif
> +# endif
> +#endif // defined(__APPLE__)
> +
>  #if defined(__APPLE__) || defined(__FreeBSD__)
>  #define _LIBCPP_HAS_DEFAULTRUNELOCALE
>  #endif
>
> Modified: libcxx/trunk/include/new
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/
> new?rev=292564=292563=292564=diff
> 
> ==
> --- libcxx/trunk/include/new (original)
> +++ libcxx/trunk/include/new Thu Jan 19 19:47:26 2017
> @@ -101,8 +101,9 @@ void  operator delete[](void* ptr, void*
>  # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
>  #endif
>
> -#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
> -(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
> +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
> +(!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
> +(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
>  # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
>  #endif
>
>
> Modified: libcxx/trunk/src/new.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.
> cpp?rev=292564=292563=292564=diff
> 
> ==
> --- libcxx/trunk/src/new.cpp (original)
> +++ libcxx/trunk/src/new.cpp Thu Jan 19 19:47:26 2017
> @@ -151,6 +151,8 @@ operator delete[] (void* ptr, size_t) _N
>  ::operator delete[](ptr);
>  }
>
> +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
> +
>  _LIBCPP_WEAK
>  void *
>  operator new(std::size_t size, std::align_val_t alignment)
> _THROW_BAD_ALLOC
> @@ -275,6 +277,8 @@ operator delete[] (void* ptr, size_t, st
>  ::operator delete[](ptr, alignment);
>  }
>
> +#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
> +
>  #endif // !__GLIBCXX__
>
>  namespace std
>
>
> ___
> 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] r292564 - Disable aligned new/delete on Apple platforms without posix_memalign

2017-01-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jan 19 19:47:26 2017
New Revision: 292564

URL: http://llvm.org/viewvc/llvm-project?rev=292564=rev
Log:
Disable aligned new/delete on Apple platforms without posix_memalign

Summary:
This patch disables the aligned new/delet overloads on Apple platforms without 
`posix_memalign`. This fixes libc++.dylib build regressions on such platforms.
This fixes http://llvm.org/PR31448.

This patch should also be merged into the 4.0 release branch


Reviewers: mclow.lists, rsmith, dexonsmith, jeremyhu

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/new
libcxx/trunk/src/new.cpp

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=292564=292563=292564=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Thu Jan 19 19:47:26 2017
@@ -848,6 +848,18 @@ template  struct __static_asse
 #define _DECLARE_C99_LDBL_MATH 1
 #endif
 
+#if defined(__APPLE__)
+# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
+ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#   define __MAC_OS_X_VERSION_MIN_REQUIRED 
__ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+# endif
+# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
+#   if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#   endif
+# endif
+#endif // defined(__APPLE__)
+
 #if defined(__APPLE__) || defined(__FreeBSD__)
 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
 #endif

Modified: libcxx/trunk/include/new
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=292564=292563=292564=diff
==
--- libcxx/trunk/include/new (original)
+++ libcxx/trunk/include/new Thu Jan 19 19:47:26 2017
@@ -101,8 +101,9 @@ void  operator delete[](void* ptr, void*
 # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
 #endif
 
-#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
-(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+(!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
+(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
 #endif
 

Modified: libcxx/trunk/src/new.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.cpp?rev=292564=292563=292564=diff
==
--- libcxx/trunk/src/new.cpp (original)
+++ libcxx/trunk/src/new.cpp Thu Jan 19 19:47:26 2017
@@ -151,6 +151,8 @@ operator delete[] (void* ptr, size_t) _N
 ::operator delete[](ptr);
 }
 
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 _LIBCPP_WEAK
 void *
 operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
@@ -275,6 +277,8 @@ operator delete[] (void* ptr, size_t, st
 ::operator delete[](ptr, alignment);
 }
 
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 #endif // !__GLIBCXX__
 
 namespace std


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


[PATCH] D28931: Disable aligned new/delete on Apple platforms without posix_memalign

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

LGTM. Thanks!


https://reviews.llvm.org/D28931



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


[PATCH] D28931: Disable aligned new/delete on Apple platforms without posix_memalign

2017-01-19 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 85082.
EricWF added a comment.

- Move `__config` block lower down in the file as suggested by Marshall.


https://reviews.llvm.org/D28931

Files:
  include/__config
  include/new
  src/new.cpp


Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -151,6 +151,8 @@
 ::operator delete[](ptr);
 }
 
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 _LIBCPP_WEAK
 void *
 operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
@@ -275,6 +277,8 @@
 ::operator delete[](ptr, alignment);
 }
 
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 #endif // !__GLIBCXX__
 
 namespace std
Index: include/new
===
--- include/new
+++ include/new
@@ -101,8 +101,9 @@
 # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
 #endif
 
-#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
-(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+(!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
+(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
 #endif
 
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -848,6 +848,18 @@
 #define _DECLARE_C99_LDBL_MATH 1
 #endif
 
+#if defined(__APPLE__)
+# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
+ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#   define __MAC_OS_X_VERSION_MIN_REQUIRED 
__ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+# endif
+# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
+#   if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#   endif
+# endif
+#endif // defined(__APPLE__)
+
 #if defined(__APPLE__) || defined(__FreeBSD__)
 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
 #endif


Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -151,6 +151,8 @@
 ::operator delete[](ptr);
 }
 
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 _LIBCPP_WEAK
 void *
 operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
@@ -275,6 +277,8 @@
 ::operator delete[](ptr, alignment);
 }
 
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 #endif // !__GLIBCXX__
 
 namespace std
Index: include/new
===
--- include/new
+++ include/new
@@ -101,8 +101,9 @@
 # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
 #endif
 
-#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
-(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+(!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
+(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
 #endif
 
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -848,6 +848,18 @@
 #define _DECLARE_C99_LDBL_MATH 1
 #endif
 
+#if defined(__APPLE__)
+# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
+ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#   define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+# endif
+# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
+#   if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#   endif
+# endif
+#endif // defined(__APPLE__)
+
 #if defined(__APPLE__) || defined(__FreeBSD__)
 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
 #endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28349: [Frontend] The macro that describes the Objective-C bool type should be defined in C as well

2017-01-19 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini accepted this revision.
mehdi_amini added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rL LLVM

https://reviews.llvm.org/D28349



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


[PATCH] D28931: Disable aligned new/delete on Apple platforms without posix_memalign

2017-01-19 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 85080.
EricWF added a comment.

- Remove `` include in place of defining the required macros 
manually.


https://reviews.llvm.org/D28931

Files:
  include/__config
  include/new
  src/new.cpp


Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -151,6 +151,8 @@
 ::operator delete[](ptr);
 }
 
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 _LIBCPP_WEAK
 void *
 operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
@@ -275,6 +277,8 @@
 ::operator delete[](ptr, alignment);
 }
 
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 #endif // !__GLIBCXX__
 
 namespace std
Index: include/new
===
--- include/new
+++ include/new
@@ -101,8 +101,9 @@
 # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
 #endif
 
-#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
-(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+(!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
+(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
 #endif
 
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -126,6 +126,18 @@
 # define _LIBCPP_ABI_ITANIUM
 #endif
 
+#if defined(__APPLE__)
+# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
+ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#   define __MAC_OS_X_VERSION_MIN_REQUIRED 
__ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+# endif
+# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
+#   if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#   endif
+# endif
+#endif // defined(__APPLE__)
+
 // Need to detect which libc we're using if we're on Linux.
 #if defined(__linux__)
 #include 


Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -151,6 +151,8 @@
 ::operator delete[](ptr);
 }
 
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 _LIBCPP_WEAK
 void *
 operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
@@ -275,6 +277,8 @@
 ::operator delete[](ptr, alignment);
 }
 
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 #endif // !__GLIBCXX__
 
 namespace std
Index: include/new
===
--- include/new
+++ include/new
@@ -101,8 +101,9 @@
 # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
 #endif
 
-#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
-(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+(!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
+(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
 #endif
 
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -126,6 +126,18 @@
 # define _LIBCPP_ABI_ITANIUM
 #endif
 
+#if defined(__APPLE__)
+# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
+ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#   define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+# endif
+# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
+#   if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#   endif
+# endif
+#endif // defined(__APPLE__)
+
 // Need to detect which libc we're using if we're on Linux.
 #if defined(__linux__)
 #include 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28793: [NVPTX] Auto-upgrade some NVPTX intrinsics to LLVM target-generic code.

2017-01-19 Thread Justin Lebar via Phabricator via cfe-commits
jlebar marked 4 inline comments as done.
jlebar added a comment.

Sorry about that broken code in the clang headers.  All removed now; we 
established it's not needed.  PHAL.


https://reviews.llvm.org/D28793



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


[PATCH] D28793: [NVPTX] Auto-upgrade some NVPTX intrinsics to LLVM target-generic code.

2017-01-19 Thread Justin Lebar via Phabricator via cfe-commits
jlebar updated this revision to Diff 85076.
jlebar added a comment.

Remove (broken) implementations of removed intrinsics from clang.

We realized we don't need this, as none of these intrinsics are accessible to
user code in nvcc.


https://reviews.llvm.org/D28793

Files:
  clang/lib/Headers/__clang_cuda_runtime_wrapper.h
  llvm/include/llvm/IR/IntrinsicsNVVM.td
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/Target/NVPTX/NVPTXIntrinsics.td
  llvm/test/Assembler/auto_upgrade_nvvm_intrinsics.ll

Index: llvm/test/Assembler/auto_upgrade_nvvm_intrinsics.ll
===
--- /dev/null
+++ llvm/test/Assembler/auto_upgrade_nvvm_intrinsics.ll
@@ -0,0 +1,102 @@
+; Test to make sure NVVM intrinsics are automatically upgraded.
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+; RUN: verify-uselistorder %s
+
+declare i32 @llvm.nvvm.brev32(i32)
+declare i64 @llvm.nvvm.brev64(i64)
+declare i32 @llvm.nvvm.clz.i(i32)
+declare i32 @llvm.nvvm.clz.ll(i64)
+declare i32 @llvm.nvvm.popc.i(i32)
+declare i32 @llvm.nvvm.popc.ll(i64)
+declare float @llvm.nvvm.h2f(i16)
+
+declare i32 @llvm.nvvm.abs.i(i32)
+declare i64 @llvm.nvvm.abs.ll(i64)
+
+declare i32 @llvm.nvvm.max.i(i32, i32)
+declare i64 @llvm.nvvm.max.ll(i64, i64)
+declare i32 @llvm.nvvm.max.ui(i32, i32)
+declare i64 @llvm.nvvm.max.ull(i64, i64)
+declare i32 @llvm.nvvm.min.i(i32, i32)
+declare i64 @llvm.nvvm.min.ll(i64, i64)
+declare i32 @llvm.nvvm.min.ui(i32, i32)
+declare i64 @llvm.nvvm.min.ull(i64, i64)
+
+; CHECK-LABEL: @simple_upgrade
+define void @simple_upgrade(i32 %a, i64 %b, i16 %c) {
+; CHECK: call i32 @llvm.bitreverse.i32(i32 %a)
+  %r1 = call i32 @llvm.nvvm.brev32(i32 %a)
+
+; CHECK: call i64 @llvm.bitreverse.i64(i64 %b)
+  %r2 = call i64 @llvm.nvvm.brev64(i64 %b)
+
+; CHECK: call i32 @llvm.ctlz.i32(i32 %a, i1 false)
+  %r3 = call i32 @llvm.nvvm.clz.i(i32 %a)
+
+; CHECK: [[clz:%[a-zA-Z0-9.]+]] = call i64 @llvm.ctlz.i64(i64 %b, i1 false)
+; CHECK: trunc i64 [[clz]] to i32
+  %r4 = call i32 @llvm.nvvm.clz.ll(i64 %b)
+
+; CHECK: call i32 @llvm.ctpop.i32(i32 %a)
+  %r5 = call i32 @llvm.nvvm.popc.i(i32 %a)
+
+; CHECK: [[popc:%[a-zA-Z0-9.]+]] = call i64 @llvm.ctpop.i64(i64 %b)
+; CHECK: trunc i64 [[popc]] to i32
+  %r6 = call i32 @llvm.nvvm.popc.ll(i64 %b)
+
+; CHECK: call float @llvm.convert.from.fp16.f32(i16 %c)
+  %r7 = call float @llvm.nvvm.h2f(i16 %c)
+  ret void
+}
+
+; CHECK-LABEL @abs
+define void @abs(i32 %a, i64 %b) {
+; CHECK-DAG: [[negi:%[a-zA-Z0-9.]+]] = sub i32 0, %a
+; CHECK-DAG: [[cmpi:%[a-zA-Z0-9.]+]] = icmp sge i32 %a, 0
+; CHECK: select i1 [[cmpi]], i32 %a, i32 [[negi]]
+  %r1 = call i32 @llvm.nvvm.abs.i(i32 %a)
+
+; CHECK-DAG: [[negll:%[a-zA-Z0-9.]+]] = sub i64 0, %b
+; CHECK-DAG: [[cmpll:%[a-zA-Z0-9.]+]] = icmp sge i64 %b, 0
+; CHECK: select i1 [[cmpll]], i64 %b, i64 [[negll]]
+  %r2 = call i64 @llvm.nvvm.abs.ll(i64 %b)
+
+  ret void
+}
+
+; CHECK-LABEL: @min_max
+define void @min_max(i32 %a1, i32 %a2, i64 %b1, i64 %b2) {
+; CHECK: [[maxi:%[a-zA-Z0-9.]+]] = icmp sge i32 %a1, %a2
+; CHECK: select i1 [[maxi]], i32 %a1, i32 %a2
+  %r1 = call i32 @llvm.nvvm.max.i(i32 %a1, i32 %a2)
+
+; CHECK: [[maxll:%[a-zA-Z0-9.]+]] = icmp sge i64 %b1, %b2
+; CHECK: select i1 [[maxll]], i64 %b1, i64 %b2
+  %r2 = call i64 @llvm.nvvm.max.ll(i64 %b1, i64 %b2)
+
+; CHECK: [[maxui:%[a-zA-Z0-9.]+]] = icmp uge i32 %a1, %a2
+; CHECK: select i1 [[maxui]], i32 %a1, i32 %a2
+  %r3 = call i32 @llvm.nvvm.max.ui(i32 %a1, i32 %a2)
+
+; CHECK: [[maxull:%[a-zA-Z0-9.]+]] = icmp uge i64 %b1, %b2
+; CHECK: select i1 [[maxull]], i64 %b1, i64 %b2
+  %r4 = call i64 @llvm.nvvm.max.ull(i64 %b1, i64 %b2)
+
+; CHECK: [[mini:%[a-zA-Z0-9.]+]] = icmp sle i32 %a1, %a2
+; CHECK: select i1 [[mini]], i32 %a1, i32 %a2
+  %r5 = call i32 @llvm.nvvm.min.i(i32 %a1, i32 %a2)
+
+; CHECK: [[minll:%[a-zA-Z0-9.]+]] = icmp sle i64 %b1, %b2
+; CHECK: select i1 [[minll]], i64 %b1, i64 %b2
+  %r6 = call i64 @llvm.nvvm.min.ll(i64 %b1, i64 %b2)
+
+; CHECK: [[minui:%[a-zA-Z0-9.]+]] = icmp ule i32 %a1, %a2
+; CHECK: select i1 [[minui]], i32 %a1, i32 %a2
+  %r7 = call i32 @llvm.nvvm.min.ui(i32 %a1, i32 %a2)
+
+; CHECK: [[minull:%[a-zA-Z0-9.]+]] = icmp ule i64 %b1, %b2
+; CHECK: select i1 [[minull]], i64 %b1, i64 %b2
+  %r8 = call i64 @llvm.nvvm.min.ull(i64 %b1, i64 %b2)
+
+  ret void
+}
Index: llvm/lib/Target/NVPTX/NVPTXIntrinsics.td
===
--- llvm/lib/Target/NVPTX/NVPTXIntrinsics.td
+++ llvm/lib/Target/NVPTX/NVPTXIntrinsics.td
@@ -187,43 +187,13 @@
 // MISC
 //
 
-def INT_NVVM_CLZ_I : F_MATH_1<"clz.b32 \t$dst, $src0;", Int32Regs, Int32Regs,
-  int_nvvm_clz_i>;
-def INT_NVVM_CLZ_LL : F_MATH_1<"clz.b64 \t$dst, $src0;", Int32Regs, Int64Regs,
-  int_nvvm_clz_ll>;
-
-def INT_NVVM_POPC_I : F_MATH_1<"popc.b32 \t$dst, $src0;", Int32Regs, Int32Regs,
-  int_nvvm_popc_i>;
-def INT_NVVM_POPC_LL : F_MATH_1<"popc.b64 \t$dst, $src0;", Int32Regs, Int64Regs,
-  int_nvvm_popc_ll>;
-
 def INT_NVVM_PRMT : F_MATH_3<"prmt.b32 

[PATCH] D28785: Split exception.cpp and new.cpp implementation into different files for different runtimes

2017-01-19 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D28785#650101, @compnerd wrote:

> While I love this direction (the original version really was an 
> unintelligible pile of code), I really think that this change may be taking 
> on too much.  Why not split it up first and do nothing else.  We could do the 
> MS ABI implementation in a subsequent change.  This would improve the code 
> and would not be gated on the MS ABI changes.


I agree this review is taking on too much, it started out much smaller and I 
tried to avoid expanding it, but in the end I had three options:

A) Regress and remove all support for MSVC, this would break the windows build. 
(at least in `exception.cpp` and `new.cpp`).
B) Implement incorrect versions of `support/runtime/_msvc.ipp`  based 
on w/e we currently have, just to keep Windows building.
C) Implement correct versions of `support/runtime/_msvc.ipp`.

I choose (C) since I didn't want to regress Windows, or spend time implementing 
incorrect `_msvc.ipp` versions.
However I'm willing to try and shrink this down if you think that would be 
better.


https://reviews.llvm.org/D28785



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


[PATCH] D28924: [AST Printer] Print attributes on enum constants

2017-01-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In https://reviews.llvm.org/D28924#651139, @jordan_rose wrote:

> Interestingly, this case doesn't actually work yet; we unconditionally print 
> enum attributes after the close-brace even though that's not valid for C++ 
> attributes. Do you think I should change that as well, or just land this 
> patch as is?


This is a pervasive issue with attributes, now that I put my thinking cap on. I 
think you're fine to land it as-is; we need a much larger fix to handle pretty 
printing attributes properly for all flavors.


Repository:
  rL LLVM

https://reviews.llvm.org/D28924



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


r292562 - clang-format: fix fallback style set to "none" not always formatting

2017-01-19 Thread Antonio Maiorano via cfe-commits
Author: amaiorano
Date: Thu Jan 19 19:22:42 2017
New Revision: 292562

URL: http://llvm.org/viewvc/llvm-project?rev=292562=rev
Log:
clang-format: fix fallback style set to "none" not always formatting

This fixes clang-format not formatting if fallback-style is explicitly set to
"none", and either a config file is found or YAML is passed in without a
"BasedOnStyle". With this change, passing "none" in these cases will have no
affect, and LLVM style will be used as the base style.

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

Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/test/Format/style-on-command-line.cpp
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=292562=292561=292562=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Thu Jan 19 19:22:42 2017
@@ -1888,8 +1888,8 @@ static FormatStyle::LanguageKind getLang
 }
 
 llvm::Expected getStyle(StringRef StyleName, StringRef FileName,
- StringRef FallbackStyle, StringRef Code,
- vfs::FileSystem *FS) {
+ StringRef FallbackStyleName,
+ StringRef Code, vfs::FileSystem *FS) {
   if (!FS) {
 FS = vfs::getRealFileSystem().get();
   }
@@ -1903,9 +1903,9 @@ llvm::Expected getStyle(Str
   (Code.contains("\n- (") || Code.contains("\n+ (")))
 Style.Language = FormatStyle::LK_ObjC;
 
-  // FIXME: If FallbackStyle is explicitly "none", format is disabled.
-  if (!getPredefinedStyle(FallbackStyle, Style.Language, ))
-return make_string_error("Invalid fallback style \"" + 
FallbackStyle.str());
+  FormatStyle FallbackStyle = getNoStyle();
+  if (!getPredefinedStyle(FallbackStyleName, Style.Language, ))
+return make_string_error("Invalid fallback style \"" + FallbackStyleName);
 
   if (StyleName.startswith("{")) {
 // Parse YAML/JSON style from the command line.
@@ -1977,7 +1977,7 @@ llvm::Expected getStyle(Str
 return make_string_error("Configuration file(s) do(es) not support " +
  getLanguageName(Style.Language) + ": " +
  UnsuitableConfigFiles);
-  return Style;
+  return FallbackStyle;
 }
 
 } // namespace format

Modified: cfe/trunk/test/Format/style-on-command-line.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/style-on-command-line.cpp?rev=292562=292561=292562=diff
==
--- cfe/trunk/test/Format/style-on-command-line.cpp (original)
+++ cfe/trunk/test/Format/style-on-command-line.cpp Thu Jan 19 19:22:42 2017
@@ -11,6 +11,21 @@
 // RUN: clang-format -style=file -assume-filename=%T/foo.cpp < %s | FileCheck 
-strict-whitespace -check-prefix=CHECK7 %s
 // RUN: clang-format -style="{BasedOnStyle: LLVM, PointerBindsToType: true}" 
%s | FileCheck -strict-whitespace -check-prefix=CHECK8 %s
 // RUN: clang-format -style="{BasedOnStyle: WebKit, PointerBindsToType: 
false}" %s | FileCheck -strict-whitespace -check-prefix=CHECK9 %s
+
+// Fallback style tests
+// RUN: rm %T/_clang-format
+// Test no config file found, WebKit fallback style is applied
+// RUN: clang-format -style=file -fallback-style=WebKit 
-assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace 
-check-prefix=CHECK10 %s
+// Test no config file and no fallback style, LLVM style is applied
+// RUN: clang-format -style=file -assume-filename=%T/foo.cpp < %s 2>&1 | 
FileCheck -strict-whitespace -check-prefix=CHECK11 %s
+// Test no config file and fallback style "none", no formatting is applied
+// RUN: clang-format -style=file -fallback-style=none 
-assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace 
-check-prefix=CHECK12 %s
+// Test config file with no based style, and fallback style "none", formatting 
is applied
+// RUN: printf "IndentWidth: 6\n" > %T/_clang-format
+// RUN: clang-format -style=file -fallback-style=none 
-assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace 
-check-prefix=CHECK13 %s
+// Test yaml with no based style, and fallback style "none", LLVM formatting 
applied
+// RUN: clang-format -style="{IndentWidth: 7}" -fallback-style=none %s | 
FileCheck -strict-whitespace -check-prefix=CHECK14 %s
+
 void f() {
 // CHECK1: {{^int\* i;$}}
 // CHECK2: {{^   int \*i;$}}
@@ -22,6 +37,11 @@ void f() {
 // CHECK7: {{^  int\* i;$}}
 // CHECK8: {{^  int\* i;$}}
 // CHECK9: {{^int \*i;$}}
+// CHECK10: {{^int\* i;$}}
+// CHECK11: {{^  int \*i;$}}
+// CHECK12: {{^int\*i;$}}
+// CHECK13: {{^  int \*i;$}}
+// CHECK14: {{^   int \*i;$}}
 int*i;
 int j;
 }

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 

[PATCH] D28844: clang-format: fix fallback style set to "none" not formatting

2017-01-19 Thread Antonio Maiorano via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL292562: clang-format: fix fallback style set to "none" not 
always formatting (authored by amaiorano).

Changed prior to commit:
  https://reviews.llvm.org/D28844?vs=84795=85074#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28844

Files:
  cfe/trunk/lib/Format/Format.cpp
  cfe/trunk/test/Format/style-on-command-line.cpp
  cfe/trunk/unittests/Format/FormatTest.cpp

Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -1888,8 +1888,8 @@
 }
 
 llvm::Expected getStyle(StringRef StyleName, StringRef FileName,
- StringRef FallbackStyle, StringRef Code,
- vfs::FileSystem *FS) {
+ StringRef FallbackStyleName,
+ StringRef Code, vfs::FileSystem *FS) {
   if (!FS) {
 FS = vfs::getRealFileSystem().get();
   }
@@ -1903,9 +1903,9 @@
   (Code.contains("\n- (") || Code.contains("\n+ (")))
 Style.Language = FormatStyle::LK_ObjC;
 
-  // FIXME: If FallbackStyle is explicitly "none", format is disabled.
-  if (!getPredefinedStyle(FallbackStyle, Style.Language, ))
-return make_string_error("Invalid fallback style \"" + FallbackStyle.str());
+  FormatStyle FallbackStyle = getNoStyle();
+  if (!getPredefinedStyle(FallbackStyleName, Style.Language, ))
+return make_string_error("Invalid fallback style \"" + FallbackStyleName);
 
   if (StyleName.startswith("{")) {
 // Parse YAML/JSON style from the command line.
@@ -1977,7 +1977,7 @@
 return make_string_error("Configuration file(s) do(es) not support " +
  getLanguageName(Style.Language) + ": " +
  UnsuitableConfigFiles);
-  return Style;
+  return FallbackStyle;
 }
 
 } // namespace format
Index: cfe/trunk/unittests/Format/FormatTest.cpp
===
--- cfe/trunk/unittests/Format/FormatTest.cpp
+++ cfe/trunk/unittests/Format/FormatTest.cpp
@@ -10978,13 +10978,31 @@
   ASSERT_TRUE((bool)Style1);
   ASSERT_EQ(*Style1, getLLVMStyle());
 
-  // Test 2: fallback to default.
+  // Test 2.1: fallback to default.
   ASSERT_TRUE(
   FS.addFile("/b/test.cpp", 0, llvm::MemoryBuffer::getMemBuffer("int i;")));
   auto Style2 = getStyle("file", "/b/test.cpp", "Mozilla", "", );
   ASSERT_TRUE((bool)Style2);
   ASSERT_EQ(*Style2, getMozillaStyle());
 
+  // Test 2.2: no format on 'none' fallback style.
+  Style2 = getStyle("file", "/b/test.cpp", "none", "", );
+  ASSERT_TRUE((bool)Style2);
+  ASSERT_EQ(*Style2, getNoStyle());
+
+  // Test 2.3: format if config is found with no based style while fallback is
+  // 'none'.
+  ASSERT_TRUE(FS.addFile("/b/.clang-format", 0,
+ llvm::MemoryBuffer::getMemBuffer("IndentWidth: 2")));
+  Style2 = getStyle("file", "/b/test.cpp", "none", "", );
+  ASSERT_TRUE((bool)Style2);
+  ASSERT_EQ(*Style2, getLLVMStyle());
+
+  // Test 2.4: format if yaml with no based style, while fallback is 'none'.
+  Style2 = getStyle("{}", "a.h", "none", "", );
+  ASSERT_TRUE((bool)Style2);
+  ASSERT_EQ(*Style2, getLLVMStyle());
+
   // Test 3: format file in parent directory.
   ASSERT_TRUE(
   FS.addFile("/c/.clang-format", 0,
Index: cfe/trunk/test/Format/style-on-command-line.cpp
===
--- cfe/trunk/test/Format/style-on-command-line.cpp
+++ cfe/trunk/test/Format/style-on-command-line.cpp
@@ -11,6 +11,21 @@
 // RUN: clang-format -style=file -assume-filename=%T/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK7 %s
 // RUN: clang-format -style="{BasedOnStyle: LLVM, PointerBindsToType: true}" %s | FileCheck -strict-whitespace -check-prefix=CHECK8 %s
 // RUN: clang-format -style="{BasedOnStyle: WebKit, PointerBindsToType: false}" %s | FileCheck -strict-whitespace -check-prefix=CHECK9 %s
+
+// Fallback style tests
+// RUN: rm %T/_clang-format
+// Test no config file found, WebKit fallback style is applied
+// RUN: clang-format -style=file -fallback-style=WebKit -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK10 %s
+// Test no config file and no fallback style, LLVM style is applied
+// RUN: clang-format -style=file -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK11 %s
+// Test no config file and fallback style "none", no formatting is applied
+// RUN: clang-format -style=file -fallback-style=none -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK12 %s
+// Test config file with no based style, and fallback style "none", formatting is applied
+// RUN: printf "IndentWidth: 6\n" > %T/_clang-format
+// RUN: clang-format -style=file -fallback-style=none 

r292561 - PR31701: Fix crash on invalid caused by parsing a dependent initializer when we

2017-01-19 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Jan 19 19:19:46 2017
New Revision: 292561

URL: http://llvm.org/viewvc/llvm-project?rev=292561=rev
Log:
PR31701: Fix crash on invalid caused by parsing a dependent initializer when we
don't know we're in a dependent context.

Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/SemaCXX/constant-expression.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=292561=292560=292561=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Jan 19 19:19:46 2017
@@ -9021,7 +9021,8 @@ bool ASTContext::DeclMustBeEmitted(const
 
   // Variables that have initialization with side-effects are required.
   if (VD->getInit() && VD->getInit()->HasSideEffects(*this) &&
-  !VD->evaluateValue())
+  // We can get a value-dependent initializer during error recovery.
+  (VD->getInit()->isValueDependent() || !VD->evaluateValue()))
 return true;
 
   // Likewise, variables with tuple-like bindings are required if their

Modified: cfe/trunk/test/SemaCXX/constant-expression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression.cpp?rev=292561=292560=292561=diff
==
--- cfe/trunk/test/SemaCXX/constant-expression.cpp (original)
+++ cfe/trunk/test/SemaCXX/constant-expression.cpp Thu Jan 19 19:19:46 2017
@@ -143,3 +143,14 @@ namespace rdar16064952 {
 }
 
 char PR17381_ice = 100 * 100; // expected-warning {{overflow}} 
expected-warning {{changes value}}
+
+namespace PR31701 {
+  struct C {
+template static int n; // expected-warning {{extension}}
+  };
+  template  class D;
+  template 
+  template void D::set() { // expected-error {{from class 'D' 
without definition}}
+const C c = C::n;
+  }
+}


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


[PATCH] D28931: Disable aligned new/delete on Apple platforms without posix_memalign

2017-01-19 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 85072.
EricWF added a comment.

- Remove NFC parts of this patch and commit them to master.


https://reviews.llvm.org/D28931

Files:
  include/__config
  include/new
  src/new.cpp


Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -151,6 +151,8 @@
 ::operator delete[](ptr);
 }
 
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 _LIBCPP_WEAK
 void *
 operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
@@ -275,6 +277,8 @@
 ::operator delete[](ptr, alignment);
 }
 
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 #endif // !__GLIBCXX__
 
 namespace std
Index: include/new
===
--- include/new
+++ include/new
@@ -101,8 +101,9 @@
 # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
 #endif
 
-#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
-(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+(!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
+(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
 #endif
 
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -126,6 +126,13 @@
 # define _LIBCPP_ABI_ITANIUM
 #endif
 
+#if defined(__APPLE__)
+# include 
+# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+#  define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+# endif
+#endif // defined(__APPLE__)
+
 // Need to detect which libc we're using if we're on Linux.
 #if defined(__linux__)
 #include 


Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -151,6 +151,8 @@
 ::operator delete[](ptr);
 }
 
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 _LIBCPP_WEAK
 void *
 operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
@@ -275,6 +277,8 @@
 ::operator delete[](ptr, alignment);
 }
 
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 #endif // !__GLIBCXX__
 
 namespace std
Index: include/new
===
--- include/new
+++ include/new
@@ -101,8 +101,9 @@
 # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
 #endif
 
-#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
-(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+(!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
+(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
 #endif
 
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -126,6 +126,13 @@
 # define _LIBCPP_ABI_ITANIUM
 #endif
 
+#if defined(__APPLE__)
+# include 
+# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+#  define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+# endif
+#endif // defined(__APPLE__)
+
 // Need to detect which libc we're using if we're on Linux.
 #if defined(__linux__)
 #include 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28924: [AST Printer] Print attributes on enum constants

2017-01-19 Thread Jordan Rose via Phabricator via cfe-commits
jordan_rose added a comment.

Interestingly, this case doesn't actually work yet; we unconditionally print 
enum attributes after the close-brace even though that's not valid for C++ 
attributes. Do you think I should change that as well, or just land this patch 
as is?


Repository:
  rL LLVM

https://reviews.llvm.org/D28924



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


[libcxx] r292560 - [NFC] Group aligned new/delete definitions together in new.cpp

2017-01-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jan 19 19:13:49 2017
New Revision: 292560

URL: http://llvm.org/viewvc/llvm-project?rev=292560=rev
Log:
[NFC] Group aligned new/delete definitions together in new.cpp

This patch is cleanup to prepare for future changes

Modified:
libcxx/trunk/src/new.cpp

Modified: libcxx/trunk/src/new.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.cpp?rev=292560=292559=292560=diff
==
--- libcxx/trunk/src/new.cpp (original)
+++ libcxx/trunk/src/new.cpp Thu Jan 19 19:13:49 2017
@@ -64,38 +64,6 @@ operator new(std::size_t size) _THROW_BA
 }
 
 _LIBCPP_WEAK
-void *
-operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
-{
-if (size == 0)
-size = 1;
-if (static_cast(alignment) < sizeof(void*))
-  alignment = std::align_val_t(sizeof(void*));
-void* p;
-#if defined(_LIBCPP_MSVCRT)
-while ((p = _aligned_malloc(size, static_cast(alignment))) == 
nullptr)
-#else
-while (::posix_memalign(, static_cast(alignment), size) != 0)
-#endif
-{
-// If posix_memalign fails and there is a new_handler,
-// call it to try free up memory.
-std::new_handler nh = std::get_new_handler();
-if (nh)
-nh();
-else {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-throw std::bad_alloc();
-#else
-p = nullptr; // posix_memalign doesn't initialize 'p' on failure
-break;
-#endif
-}
-}
-return p;
-}
-
-_LIBCPP_WEAK
 void*
 operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
 {
@@ -116,14 +84,21 @@ operator new(size_t size, const std::not
 
 _LIBCPP_WEAK
 void*
-operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) 
_NOEXCEPT
+operator new[](size_t size) _THROW_BAD_ALLOC
+{
+return ::operator new(size);
+}
+
+_LIBCPP_WEAK
+void*
+operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
 {
 void* p = 0;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-p = ::operator new(size, alignment);
+p = ::operator new[](size);
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
 catch (...)
@@ -134,29 +109,90 @@ operator new(size_t size, std::align_val
 }
 
 _LIBCPP_WEAK
-void*
-operator new[](size_t size) _THROW_BAD_ALLOC
+void
+operator delete(void* ptr) _NOEXCEPT
 {
-return ::operator new(size);
+if (ptr)
+::free(ptr);
 }
 
 _LIBCPP_WEAK
-void*
-operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+void
+operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
 {
-return ::operator new(size, alignment);
+::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete(void* ptr, size_t) _NOEXCEPT
+{
+::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr) _NOEXCEPT
+{
+::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
+{
+::operator delete[](ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr, size_t) _NOEXCEPT
+{
+::operator delete[](ptr);
+}
+
+_LIBCPP_WEAK
+void *
+operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+{
+if (size == 0)
+size = 1;
+if (static_cast(alignment) < sizeof(void*))
+  alignment = std::align_val_t(sizeof(void*));
+void* p;
+#if defined(_LIBCPP_MSVCRT)
+while ((p = _aligned_malloc(size, static_cast(alignment))) == 
nullptr)
+#else
+while (::posix_memalign(, static_cast(alignment), size) != 0)
+#endif
+{
+// If posix_memalign fails and there is a new_handler,
+// call it to try free up memory.
+std::new_handler nh = std::get_new_handler();
+if (nh)
+nh();
+else {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+throw std::bad_alloc();
+#else
+p = nullptr; // posix_memalign doesn't initialize 'p' on failure
+break;
+#endif
+}
+}
+return p;
 }
 
 _LIBCPP_WEAK
 void*
-operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
+operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) 
_NOEXCEPT
 {
 void* p = 0;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-p = ::operator new[](size);
+p = ::operator new(size, alignment);
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
 catch (...)
@@ -168,6 +204,13 @@ operator new[](size_t size, const std::n
 
 _LIBCPP_WEAK
 void*
+operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+{
+return ::operator new(size, alignment);
+}
+
+_LIBCPP_WEAK
+void*
 operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) 
_NOEXCEPT
 {
 void* p = 0;
@@ -187,14 +230,6 @@ operator new[](size_t size, std::align_v
 
 _LIBCPP_WEAK
 void
-operator delete(void* ptr) _NOEXCEPT
-{
-if (ptr)
-::free(ptr);
-}
-
-_LIBCPP_WEAK
-void
 operator delete(void* ptr, 

Re: r292555 - P0426: Make the library implementation of constexpr char_traits a little easier

2017-01-19 Thread Richard Smith via cfe-commits
Hans, can we get this onto the Clang 4 release branch (along with the
documentation added in r292558 and fixed in r292559)? This will allow us to
avoid libc++ carrying a version test for Clang, and allow it to cleanly
finish off its implementation of P0426.

On 19 January 2017 at 16:45, Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Thu Jan 19 18:45:35 2017
> New Revision: 292555
>
> URL: http://llvm.org/viewvc/llvm-project?rev=292555=rev
> Log:
> P0426: Make the library implementation of constexpr char_traits a little
> easier
> by providing a memchr builtin that returns char* instead of void*.
>
> Also add a __has_feature flag to indicate the presence of constexpr forms
> of
> the relevant  functions.
>
> Modified:
> cfe/trunk/include/clang/Basic/Builtins.def
> cfe/trunk/lib/AST/ExprConstant.cpp
> cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> cfe/trunk/lib/Lex/PPMacroExpansion.cpp
> cfe/trunk/test/CodeGenCXX/builtins.cpp
> cfe/trunk/test/Lexer/has_feature_cxx0x.cpp
> cfe/trunk/test/SemaCXX/constexpr-string.cpp
>
> Modified: cfe/trunk/include/clang/Basic/Builtins.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Basic/Builtins.def?rev=292555=292554=292555=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/Builtins.def (original)
> +++ cfe/trunk/include/clang/Basic/Builtins.def Thu Jan 19 18:45:35 2017
> @@ -1339,6 +1339,7 @@ BUILTIN(__builtin_smulll_overflow, "bSLL
>  BUILTIN(__builtin_addressof, "v*v&", "nct")
>  BUILTIN(__builtin_operator_new, "v*z", "c")
>  BUILTIN(__builtin_operator_delete, "vv*", "n")
> +BUILTIN(__builtin_char_memchr, "c*cC*iz", "n")
>
>  // Safestack builtins
>  BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn")
>
> Modified: cfe/trunk/lib/AST/ExprConstant.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/
> ExprConstant.cpp?rev=292555=292554=292555=diff
> 
> ==
> --- cfe/trunk/lib/AST/ExprConstant.cpp (original)
> +++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Jan 19 18:45:35 2017
> @@ -5683,6 +5683,7 @@ bool PointerExprEvaluator::VisitBuiltinC
>case Builtin::BI__builtin_strchr:
>case Builtin::BI__builtin_wcschr:
>case Builtin::BI__builtin_memchr:
> +  case Builtin::BI__builtin_char_memchr:
>case Builtin::BI__builtin_wmemchr: {
>  if (!Visit(E->getArg(0)))
>return false;
> @@ -5720,6 +5721,7 @@ bool PointerExprEvaluator::VisitBuiltinC
>// Fall through.
>  case Builtin::BImemchr:
>  case Builtin::BI__builtin_memchr:
> +case Builtin::BI__builtin_char_memchr:
>// memchr compares by converting both sides to unsigned char.
> That's also
>// correct for strchr if we get this far (to cope with plain char
> being
>// unsigned in the strchr case).
>
> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/
> CGBuiltin.cpp?rev=292555=292554=292555=diff
> 
> ==
> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Jan 19 18:45:35 2017
> @@ -1189,6 +1189,10 @@ RValue CodeGenFunction::EmitBuiltinExpr(
>  return RValue::get(Dest.getPointer());
>}
>
> +  case Builtin::BI__builtin_char_memchr:
> +BuiltinID = Builtin::BI__builtin_memchr;
> +break;
> +
>case Builtin::BI__builtin___memcpy_chk: {
>  // fold __builtin_memcpy_chk(x, y, cst1, cst2) to memcpy iff
> cst1<=cst2.
>  llvm::APSInt Size, DstSize;
>
> Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/
> PPMacroExpansion.cpp?rev=292555=292554=292555=diff
> 
> ==
> --- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
> +++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Thu Jan 19 18:45:35 2017
> @@ -1183,6 +1183,7 @@ static bool HasFeature(const Preprocesso
>.Case("cxx_attributes", LangOpts.CPlusPlus11)
>.Case("cxx_auto_type", LangOpts.CPlusPlus11)
>.Case("cxx_constexpr", LangOpts.CPlusPlus11)
> +  .Case("cxx_constexpr_string_builtins", LangOpts.CPlusPlus11)
>.Case("cxx_decltype", LangOpts.CPlusPlus11)
>.Case("cxx_decltype_incomplete_return_types", LangOpts.CPlusPlus11)
>.Case("cxx_default_function_template_args", LangOpts.CPlusPlus11)
>
> Modified: cfe/trunk/test/CodeGenCXX/builtins.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> CodeGenCXX/builtins.cpp?rev=292555=292554=292555=diff
> 
> ==
> --- cfe/trunk/test/CodeGenCXX/builtins.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/builtins.cpp Thu Jan 19 18:45:35 2017
> @@ -26,3 +26,7 @@ int x = 

r292559 - Fix documentation typo.

2017-01-19 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Jan 19 19:08:15 2017
New Revision: 292559

URL: http://llvm.org/viewvc/llvm-project?rev=292559=rev
Log:
Fix documentation typo.

Modified:
cfe/trunk/docs/LanguageExtensions.rst

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=292559=292558=292559=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Thu Jan 19 19:08:15 2017
@@ -1796,7 +1796,7 @@ the following functions from the C stand
 * ``wmemcmp``
 
 In each case, the builtin form has the name of the C library function prefixed
-by ``__builtin``. Example:
+by ``__builtin_``. Example:
 
 .. code-block:: c
 


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


[PATCH] D28931: Disable aligned new/delete on Apple platforms without posix_memalign

2017-01-19 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF created this revision.

This patch disables the aligned new/delet overloads on Apple platforms without 
`posix_memalign`. This fixes libc++.dylib build regressions on such platforms.
This fixes http://llvm.org/PR31448.

This patch should also be merged into the 4.0 release branch


https://reviews.llvm.org/D28931

Files:
  include/__config
  include/new
  src/new.cpp

Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -64,38 +64,6 @@
 }
 
 _LIBCPP_WEAK
-void *
-operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
-{
-if (size == 0)
-size = 1;
-if (static_cast(alignment) < sizeof(void*))
-  alignment = std::align_val_t(sizeof(void*));
-void* p;
-#if defined(_LIBCPP_MSVCRT)
-while ((p = _aligned_malloc(size, static_cast(alignment))) == nullptr)
-#else
-while (::posix_memalign(, static_cast(alignment), size) != 0)
-#endif
-{
-// If posix_memalign fails and there is a new_handler,
-// call it to try free up memory.
-std::new_handler nh = std::get_new_handler();
-if (nh)
-nh();
-else {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-throw std::bad_alloc();
-#else
-p = nullptr; // posix_memalign doesn't initialize 'p' on failure
-break;
-#endif
-}
-}
-return p;
-}
-
-_LIBCPP_WEAK
 void*
 operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
 {
@@ -116,14 +84,21 @@
 
 _LIBCPP_WEAK
 void*
-operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
+operator new[](size_t size) _THROW_BAD_ALLOC
+{
+return ::operator new(size);
+}
+
+_LIBCPP_WEAK
+void*
+operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
 {
 void* p = 0;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-p = ::operator new(size, alignment);
+p = ::operator new[](size);
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
 catch (...)
@@ -134,29 +109,92 @@
 }
 
 _LIBCPP_WEAK
-void*
-operator new[](size_t size) _THROW_BAD_ALLOC
+void
+operator delete(void* ptr) _NOEXCEPT
 {
-return ::operator new(size);
+if (ptr)
+::free(ptr);
 }
 
 _LIBCPP_WEAK
-void*
-operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+void
+operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
 {
-return ::operator new(size, alignment);
+::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete(void* ptr, size_t) _NOEXCEPT
+{
+::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr) _NOEXCEPT
+{
+::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
+{
+::operator delete[](ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr, size_t) _NOEXCEPT
+{
+::operator delete[](ptr);
+}
+
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
+_LIBCPP_WEAK
+void *
+operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+{
+if (size == 0)
+size = 1;
+if (static_cast(alignment) < sizeof(void*))
+  alignment = std::align_val_t(sizeof(void*));
+void* p;
+#if defined(_LIBCPP_MSVCRT)
+while ((p = _aligned_malloc(size, static_cast(alignment))) == nullptr)
+#else
+while (::posix_memalign(, static_cast(alignment), size) != 0)
+#endif
+{
+// If posix_memalign fails and there is a new_handler,
+// call it to try free up memory.
+std::new_handler nh = std::get_new_handler();
+if (nh)
+nh();
+else {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+throw std::bad_alloc();
+#else
+p = nullptr; // posix_memalign doesn't initialize 'p' on failure
+break;
+#endif
+}
+}
+return p;
 }
 
 _LIBCPP_WEAK
 void*
-operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
+operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
 {
 void* p = 0;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-p = ::operator new[](size);
+p = ::operator new(size, alignment);
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
 catch (...)
@@ -168,6 +206,13 @@
 
 _LIBCPP_WEAK
 void*
+operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+{
+return ::operator new(size, alignment);
+}
+
+_LIBCPP_WEAK
+void*
 operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
 {
 void* p = 0;
@@ -187,14 +232,6 @@
 
 _LIBCPP_WEAK
 void
-operator delete(void* ptr) _NOEXCEPT
-{
-if (ptr)
-::free(ptr);
-}
-
-_LIBCPP_WEAK
-void
 operator delete(void* ptr, std::align_val_t) _NOEXCEPT
 {
 if (ptr)
@@ -207,74 +244,41 @@
 
 _LIBCPP_WEAK
 void
-operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
-{
-::operator delete(ptr);
-}
-
-_LIBCPP_WEAK
-void
 operator delete(void* ptr, std::align_val_t 

r292558 - Add documentation for constexpr string builtin support.

2017-01-19 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Jan 19 18:57:59 2017
New Revision: 292558

URL: http://llvm.org/viewvc/llvm-project?rev=292558=rev
Log:
Add documentation for constexpr string builtin support.

Modified:
cfe/trunk/docs/LanguageExtensions.rst

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=292558=292557=292558=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Thu Jan 19 18:57:59 2017
@@ -1776,6 +1776,46 @@ numeric primitives such as frexp. See `L
 `_ for
 more information on the semantics.
 
+String builtins
+---
+
+Clang provides constant expression evaluation support for builtins forms of
+the following functions from the C standard library  header:
+
+* ``memchr``
+* ``memcmp``
+* ``strchr``
+* ``strcmp``
+* ``strlen``
+* ``strncmp``
+* ``wcschr``
+* ``wcscmp``
+* ``wcslen``
+* ``wcsncmp``
+* ``wmemchr``
+* ``wmemcmp``
+
+In each case, the builtin form has the name of the C library function prefixed
+by ``__builtin``. Example:
+
+.. code-block:: c
+
+  void *p = __builtin_memchr("foobar", 'b', 5);
+
+In addition to the above, one further builtin is provided:
+
+.. code-block:: c
+
+  char *__builtin_char_memchr(const char *haystack, int needle, size_t size);
+
+``__builtin_char_memchr(a, b, c)`` is identical to
+``(char*)__builtin_memchr(a, b, c)`` except that its use is permitted within
+constant expressions in C++11 onwards (where a cast from ``void*`` to ``char*``
+is disallowed in general).
+
+Support for constant expression evaluation for the above builtins be detected
+with ``__has_feature(cxx_constexpr_string_builtins)``.
+
 .. _langext-__c11_atomic:
 
 __c11_atomic builtins


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


r292555 - P0426: Make the library implementation of constexpr char_traits a little easier

2017-01-19 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Jan 19 18:45:35 2017
New Revision: 292555

URL: http://llvm.org/viewvc/llvm-project?rev=292555=rev
Log:
P0426: Make the library implementation of constexpr char_traits a little easier
by providing a memchr builtin that returns char* instead of void*.

Also add a __has_feature flag to indicate the presence of constexpr forms of
the relevant  functions.

Modified:
cfe/trunk/include/clang/Basic/Builtins.def
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Lex/PPMacroExpansion.cpp
cfe/trunk/test/CodeGenCXX/builtins.cpp
cfe/trunk/test/Lexer/has_feature_cxx0x.cpp
cfe/trunk/test/SemaCXX/constexpr-string.cpp

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=292555=292554=292555=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Thu Jan 19 18:45:35 2017
@@ -1339,6 +1339,7 @@ BUILTIN(__builtin_smulll_overflow, "bSLL
 BUILTIN(__builtin_addressof, "v*v&", "nct")
 BUILTIN(__builtin_operator_new, "v*z", "c")
 BUILTIN(__builtin_operator_delete, "vv*", "n")
+BUILTIN(__builtin_char_memchr, "c*cC*iz", "n")
 
 // Safestack builtins
 BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn")

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=292555=292554=292555=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Jan 19 18:45:35 2017
@@ -5683,6 +5683,7 @@ bool PointerExprEvaluator::VisitBuiltinC
   case Builtin::BI__builtin_strchr:
   case Builtin::BI__builtin_wcschr:
   case Builtin::BI__builtin_memchr:
+  case Builtin::BI__builtin_char_memchr:
   case Builtin::BI__builtin_wmemchr: {
 if (!Visit(E->getArg(0)))
   return false;
@@ -5720,6 +5721,7 @@ bool PointerExprEvaluator::VisitBuiltinC
   // Fall through.
 case Builtin::BImemchr:
 case Builtin::BI__builtin_memchr:
+case Builtin::BI__builtin_char_memchr:
   // memchr compares by converting both sides to unsigned char. That's also
   // correct for strchr if we get this far (to cope with plain char being
   // unsigned in the strchr case).

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=292555=292554=292555=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Jan 19 18:45:35 2017
@@ -1189,6 +1189,10 @@ RValue CodeGenFunction::EmitBuiltinExpr(
 return RValue::get(Dest.getPointer());
   }
 
+  case Builtin::BI__builtin_char_memchr:
+BuiltinID = Builtin::BI__builtin_memchr;
+break;
+
   case Builtin::BI__builtin___memcpy_chk: {
 // fold __builtin_memcpy_chk(x, y, cst1, cst2) to memcpy iff cst1<=cst2.
 llvm::APSInt Size, DstSize;

Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=292555=292554=292555=diff
==
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Thu Jan 19 18:45:35 2017
@@ -1183,6 +1183,7 @@ static bool HasFeature(const Preprocesso
   .Case("cxx_attributes", LangOpts.CPlusPlus11)
   .Case("cxx_auto_type", LangOpts.CPlusPlus11)
   .Case("cxx_constexpr", LangOpts.CPlusPlus11)
+  .Case("cxx_constexpr_string_builtins", LangOpts.CPlusPlus11)
   .Case("cxx_decltype", LangOpts.CPlusPlus11)
   .Case("cxx_decltype_incomplete_return_types", LangOpts.CPlusPlus11)
   .Case("cxx_default_function_template_args", LangOpts.CPlusPlus11)

Modified: cfe/trunk/test/CodeGenCXX/builtins.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/builtins.cpp?rev=292555=292554=292555=diff
==
--- cfe/trunk/test/CodeGenCXX/builtins.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/builtins.cpp Thu Jan 19 18:45:35 2017
@@ -26,3 +26,7 @@ int x = __builtin_abs(-2);
 long y = __builtin_abs(-2l);
 // CHECK:  [[Y:%.+]] = call i64 @_Z13__builtin_absl(i64 -2)
 // CHECK:  store i64 [[Y]], i64* @y, align 8
+
+extern const char char_memchr_arg[32];
+char *memchr_result = __builtin_char_memchr(char_memchr_arg, 123, 32);
+// CHECK: call i8* @memchr(i8* getelementptr inbounds ([32 x i8], [32 x i8]* 
@char_memchr_arg, i32 0, i32 0), i32 123, i64 32)

Modified: cfe/trunk/test/Lexer/has_feature_cxx0x.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/has_feature_cxx0x.cpp?rev=292555=292554=292555=diff

r292545 - Finish implementation of C++ DR1310 (http://wg21.link/cwg1310).

2017-01-19 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Jan 19 18:20:39 2017
New Revision: 292545

URL: http://llvm.org/viewvc/llvm-project?rev=292545=rev
Log:
Finish implementation of C++ DR1310 (http://wg21.link/cwg1310).

Diagnose the case when a dependent template name instantiates to an
injected-class-name outside a nested-name-specifier.

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
cfe/trunk/test/CXX/drs/dr10xx.cpp
cfe/trunk/test/CXX/drs/dr13xx.cpp
cfe/trunk/www/cxx_dr_status.html

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=292545=292544=292545=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu Jan 19 18:20:39 2017
@@ -5984,13 +5984,10 @@ public:
const DeclarationNameInfo ,
const TemplateArgumentListInfo *TemplateArgs);
 
-  TemplateNameKind ActOnDependentTemplateName(Scope *S,
-  CXXScopeSpec ,
-  SourceLocation TemplateKWLoc,
-  UnqualifiedId ,
-  ParsedType ObjectType,
-  bool EnteringContext,
-  TemplateTy );
+  TemplateNameKind ActOnDependentTemplateName(
+  Scope *S, CXXScopeSpec , SourceLocation TemplateKWLoc,
+  UnqualifiedId , ParsedType ObjectType, bool EnteringContext,
+  TemplateTy , bool AllowInjectedClassName = false);
 
   DeclResult
   ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK,

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=292545=292544=292545=diff
==
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Thu Jan 19 18:20:39 2017
@@ -310,11 +310,9 @@ bool Parser::ParseOptionalCXXScopeSpecif
   // Commit to parsing the template-id.
   TPA.Commit();
   TemplateTy Template;
-  if (TemplateNameKind TNK
-  = Actions.ActOnDependentTemplateName(getCurScope(),
-   SS, TemplateKWLoc, TemplateName,
-   ObjectType, EnteringContext,
-   Template)) {
+  if (TemplateNameKind TNK = Actions.ActOnDependentTemplateName(
+  getCurScope(), SS, TemplateKWLoc, TemplateName, ObjectType,
+  EnteringContext, Template, /*AllowInjectedClassName*/ true)) {
 if (AnnotateTemplateIdToken(Template, TNK, SS, TemplateKWLoc,
 TemplateName, false))
   return true;
@@ -509,12 +507,10 @@ bool Parser::ParseOptionalCXXScopeSpecif
 Diag(Tok.getLocation(), DiagID)
   << II.getName()
   << FixItHint::CreateInsertion(Tok.getLocation(), "template ");
-
-if (TemplateNameKind TNK 
-  = Actions.ActOnDependentTemplateName(getCurScope(), 
-   SS, SourceLocation(),
-   TemplateName, ObjectType,
-   EnteringContext, Template)) 
{
+
+if (TemplateNameKind TNK = Actions.ActOnDependentTemplateName(
+getCurScope(), SS, SourceLocation(), TemplateName, ObjectType,
+EnteringContext, Template, /*AllowInjectedClassName*/ true)) {
   // Consume the identifier.
   ConsumeToken();
   if (AnnotateTemplateIdToken(Template, TNK, SS, SourceLocation(),
@@ -2020,9 +2016,11 @@ bool Parser::ParseUnqualifiedIdTemplateI
   case UnqualifiedId::IK_OperatorFunctionId:
   case UnqualifiedId::IK_LiteralOperatorId:
 if (AssumeTemplateId) {
-  TNK = Actions.ActOnDependentTemplateName(getCurScope(), SS, 
TemplateKWLoc,
-   Id, ObjectType, EnteringContext,
-   Template);
+  // We defer the injected-class-name checks until we've found whether
+  // this template-id is used to form a nested-name-specifier or not.
+  TNK = Actions.ActOnDependentTemplateName(
+  getCurScope(), SS, TemplateKWLoc, Id, ObjectType, EnteringContext,
+  Template, /*AllowInjectedClassName*/ true);
   if (TNK == TNK_Non_template)
 return true;
 } else {
@@ -2051,10 

Buildbot numbers for the week of 01/08/2017 - 01/14/2017

2017-01-19 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 01/08/2017 -
01/14/2017.

Please see the same data in attached csv files:

The longest time each builder was red during the last week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the last week:

buildername | was_red
+-
 clang-ppc64le-linux-multistage | 95:35:45
 libcxx-libcxxabi-libunwind-x86_64-linux-debian | 57:47:59
 libcxx-libcxxabi-x86_64-linux-debian   | 54:04:34
 libcxx-libcxxabi-singlethreaded-x86_64-linux-debian| 53:50:01
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions  | 53:07:16
 polly-arm-linux| 52:52:43
 llvm-mips-linux| 45:18:31
 sanitizer-windows  | 41:58:29
 sanitizer-ppc64be-linux| 24:58:09
 clang-ppc64be-linux| 24:56:43
 clang-ppc64le-linux| 24:06:06
 sanitizer-x86_64-linux | 24:00:52
 clang-cuda-build   | 22:28:10
 sanitizer-x86_64-linux-fast| 20:48:03
 sanitizer-x86_64-linux-autoconf| 19:01:54
 sanitizer-x86_64-linux-bootstrap   | 16:33:09
 lldb-windows7-android  | 14:30:25
 perf-x86_64-penryn-O3-polly-before-vectorizer  | 14:27:40
 clang-native-aarch64-full  | 12:55:24
 clang-lld-x86_64-2stage| 10:34:57
 clang-cmake-aarch64-42vma  | 09:21:42
 clang-with-lto-ubuntu  | 08:47:14
 clang-with-thin-lto-ubuntu | 08:45:48
 clang-cmake-aarch64-full   | 07:12:49
 perf-x86_64-penryn-O3-polly| 07:05:43
 perf-x86_64-penryn-O3-polly-fast   | 07:05:11
 perf-x86_64-penryn-O3  | 07:01:52
 clang-3stage-ubuntu| 06:40:51
 clang-cmake-armv7-a15-full | 06:06:37
 lld-x86_64-win7| 05:45:50
 lld-x86_64-freebsd | 05:39:43
 lld-x86_64-darwin13| 05:39:39
 clang-x86-windows-msvc2015 | 04:28:04
 clang-x64-ninja-win7   | 04:27:58
 libomp-clang-ppc64le-linux-debian  | 04:26:10
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 04:12:51
 perf-x86_64-penryn-O3-polly-parallel-fast  | 04:04:10
 clang-hexagon-elf  | 03:57:47
 lldb-x86_64-ubuntu-14.04-android   | 03:44:24
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 03:40:48
 sanitizer-ppc64le-linux| 03:38:42
 clang-cmake-armv7-a15-selfhost-neon| 03:03:49
 clang-x86_64-debian-fast   | 02:47:49
 perf-x86_64-penryn-O3-polly-unprofitable   | 02:45:19
 lldb-x86_64-ubuntu-14.04-buildserver   | 02:23:53
 clang-x86_64-linux-abi-test| 02:21:18
 clang-ppc64le-linux-lnt| 02:20:23
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03 | 02:07:34
 lldb-amd64-ninja-netbsd7   | 02:05:15
 lldb-x86_64-ubuntu-14.04-cmake | 01:44:11
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 01:42:15
 lldb-x86_64-darwin-13.4| 01:40:07
 llvm-avr-linux | 01:37:49
 clang-s390x-linux  | 01:35:04
 polly-amd64-linux  | 01:23:08
 libcxx-libcxxabi-libunwind-arm-linux   | 01:21:15
 libcxx-libcxxabi-libunwind-arm-linux-noexceptions  | 01:21:11
 lldb-amd64-ninja-freebsd11 | 01:19:58
 clang-cmake-armv7-a15-selfhost | 01:19:09
 clang-cmake-armv7-a15   

Buildbot numbers for the week of 01/01/2017 - 01/07/2017

2017-01-19 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 01/01/2017 - 01/07/2017.

Please see the same data in attached csv files:

The longest time each builder was red during the last week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the last week:

buildername | was_red
+-
 clang-x86-windows-msvc2015 | 25:35:03
 libcxx-libcxxabi-x86_64-linux-debian   | 22:42:33
 sanitizer-x86_64-linux-fast| 20:33:50
 sanitizer-x86_64-linux-bootstrap   | 18:10:29
 lldb-x86_64-ubuntu-14.04-buildserver   | 13:05:04
 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only  | 12:47:45
 lldb-x86_64-ubuntu-14.04-android   | 12:29:26
 lldb-x86_64-ubuntu-14.04-cmake | 12:13:06
 lldb-amd64-ninja-freebsd11 | 12:05:28
 sanitizer-x86_64-linux | 10:15:39
 perf-x86_64-penryn-O3-polly-fast   | 08:39:44
 perf-x86_64-penryn-O3-polly-unprofitable   | 08:25:30
 clang-cmake-armv7-a15-selfhost-neon| 08:24:46
 clang-native-arm-lnt   | 08:21:09
 clang-ppc64le-linux-lnt| 08:20:56
 perf-x86_64-penryn-O3  | 08:20:16
 perf-x86_64-penryn-O3-polly-parallel-fast  | 08:16:14
 sanitizer-ppc64be-linux| 08:09:31
 clang-ppc64be-linux-lnt| 07:47:31
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 07:37:23
 clang-cmake-aarch64-quick  | 07:31:34
 clang-cmake-aarch64-full   | 07:21:20
 clang-cmake-aarch64-lld| 06:58:21
 clang-ppc64le-linux-multistage | 06:04:07
 perf-x86_64-penryn-O3-polly| 05:50:18
 clang-cuda-build   | 05:42:18
 clang-cmake-thumbv7-a15-full-sh| 04:43:57
 clang-x64-ninja-win7   | 04:37:48
 lld-x86_64-win7| 04:18:03
 clang-bpf-build| 04:16:21
 clang-x86_64-linux-selfhost-modules-2  | 04:08:21
 clang-x86_64-linux-selfhost-modules| 04:03:47
 sanitizer-ppc64le-linux| 03:43:46
 sanitizer-windows  | 03:39:27
 lldb-windows7-android  | 03:32:00
 clang-lld-x86_64-2stage| 03:30:16
 clang-cmake-armv7-a15-selfhost | 03:27:20
 clang-3stage-ubuntu| 03:14:45
 clang-with-lto-ubuntu  | 03:13:44
 lldb-amd64-ninja-netbsd7   | 03:09:37
 sanitizer-x86_64-linux-fuzzer  | 02:53:36
 clang-cmake-armv7-a15-full | 02:47:23
 clang-s390x-linux  | 02:38:53
 clang-x86_64-debian-fast   | 02:22:52
 sanitizer-x86_64-linux-autoconf| 02:21:46
 clang-cmake-armv7-a15  | 02:21:34
 libcxx-libcxxabi-singlethreaded-x86_64-linux-debian| 02:17:37
 libcxx-libcxxabi-libunwind-x86_64-linux-debian | 02:17:24
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 02:06:15
 clang-ppc64be-linux-multistage | 02:05:41
 polly-amd64-linux  | 02:01:35
 clang-cmake-aarch64-39vma  | 01:59:50
 clang-cmake-thumbv7-a15| 01:59:47
 clang-x86_64-linux-abi-test| 01:57:30
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11   | 01:53:02
 clang-ppc64le-linux| 01:43:38
 clang-ppc64be-linux| 01:43:05
 clang-cmake-aarch64-42vma  | 01:42:44
 llvm-avr-linux | 01:35:32
 

[PATCH] D28924: [AST Printer] Print attributes on enum constants

2017-01-19 Thread Jordan Rose via Phabricator via cfe-commits
jordan_rose added a comment.

Good idea, will do.


Repository:
  rL LLVM

https://reviews.llvm.org/D28924



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


[PATCH] D28924: [AST Printer] Print attributes on enum constants

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

LGTM, though if you wanted to add one more test with a C++ attribute 
(deprecated would work in C++14 mode), that would not make me sad. Something 
like:

  enum [[deprecated]] E {
One [[deprecated]] 
  };


Repository:
  rL LLVM

https://reviews.llvm.org/D28924



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


[libcxx] r292541 - Fix demangle helper after r286788

2017-01-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jan 19 18:00:31 2017
New Revision: 292541

URL: http://llvm.org/viewvc/llvm-project?rev=292541=rev
Log:
Fix demangle helper after r286788

Modified:
libcxx/trunk/test/support/demangle.h
libcxx/trunk/test/support/test.support/test_demangle.pass.cpp

Modified: libcxx/trunk/test/support/demangle.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/demangle.h?rev=292541=292540=292541=diff
==
--- libcxx/trunk/test/support/demangle.h (original)
+++ libcxx/trunk/test/support/demangle.h Thu Jan 19 18:00:31 2017
@@ -34,9 +34,7 @@ inline std::string demangle(const char*
 template  struct Printer;
 inline std::string demangle(const char* mangled_name) {
   int status = 0;
-  std::string input(mangled_name);
-  input.insert(0, "_Z");
-  char* out = __cxxabiv1::__cxa_demangle(input.c_str(), nullptr, nullptr, 
);
+  char* out = __cxxabiv1::__cxa_demangle(mangled_name, nullptr, nullptr, 
);
   if (out != nullptr) {
 std::string res(out);
 std::free(out);

Modified: libcxx/trunk/test/support/test.support/test_demangle.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test.support/test_demangle.pass.cpp?rev=292541=292540=292541=diff
==
--- libcxx/trunk/test/support/test.support/test_demangle.pass.cpp (original)
+++ libcxx/trunk/test/support/test.support/test_demangle.pass.cpp Thu Jan 19 
18:00:31 2017
@@ -20,7 +20,7 @@ int main() {
 const char* raw;
 const char* expect;
   } TestCases[] = {
-  {typeid(int).name(), "i"}, // FIXME
+  {typeid(int).name(), "int"},
   {typeid(MyType).name(), "MyType"},
   {typeid(ArgumentListID).name(), "ArgumentListID"}
   };


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


[PATCH] D28924: [AST Printer] Print attributes on enum constants

2017-01-19 Thread Jordan Rose via Phabricator via cfe-commits
jordan_rose created this revision.

The AST printer was dropping attributes on enumerators (enum constants). Now 
it's not.


Repository:
  rL LLVM

https://reviews.llvm.org/D28924

Files:
  lib/AST/DeclPrinter.cpp
  test/Sema/ast-print.c


Index: test/Sema/ast-print.c
===
--- test/Sema/ast-print.c
+++ test/Sema/ast-print.c
@@ -65,3 +65,12 @@
   // CHECK: } z = {(struct Z){}};
   } z = {(struct Z){}};
 }
+
+// CHECK-LABEL: enum EnumWithAttributes {
+enum EnumWithAttributes {
+  // CHECK-NEXT: EnumWithAttributesFoo __attribute__((deprecated(""))),
+  EnumWithAttributesFoo __attribute__((deprecated)),
+  // CHECK-NEXT: EnumWithAttributesBar __attribute__((unavailable(""))) = 50
+  EnumWithAttributesBar __attribute__((unavailable)) = 50
+  // CHECK-NEXT: } __attribute__((deprecated("")))
+} __attribute__((deprecated));
Index: lib/AST/DeclPrinter.cpp
===
--- lib/AST/DeclPrinter.cpp
+++ lib/AST/DeclPrinter.cpp
@@ -438,6 +438,7 @@
 
 void DeclPrinter::VisitEnumConstantDecl(EnumConstantDecl *D) {
   Out << *D;
+  prettyPrintAttributes(D);
   if (Expr *Init = D->getInitExpr()) {
 Out << " = ";
 Init->printPretty(Out, nullptr, Policy, Indentation);


Index: test/Sema/ast-print.c
===
--- test/Sema/ast-print.c
+++ test/Sema/ast-print.c
@@ -65,3 +65,12 @@
   // CHECK: } z = {(struct Z){}};
   } z = {(struct Z){}};
 }
+
+// CHECK-LABEL: enum EnumWithAttributes {
+enum EnumWithAttributes {
+  // CHECK-NEXT: EnumWithAttributesFoo __attribute__((deprecated(""))),
+  EnumWithAttributesFoo __attribute__((deprecated)),
+  // CHECK-NEXT: EnumWithAttributesBar __attribute__((unavailable(""))) = 50
+  EnumWithAttributesBar __attribute__((unavailable)) = 50
+  // CHECK-NEXT: } __attribute__((deprecated("")))
+} __attribute__((deprecated));
Index: lib/AST/DeclPrinter.cpp
===
--- lib/AST/DeclPrinter.cpp
+++ lib/AST/DeclPrinter.cpp
@@ -438,6 +438,7 @@
 
 void DeclPrinter::VisitEnumConstantDecl(EnumConstantDecl *D) {
   Out << *D;
+  prettyPrintAttributes(D);
   if (Expr *Init = D->getInitExpr()) {
 Out << " = ";
 Init->printPretty(Out, nullptr, Policy, Indentation);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r292539 - Adjust msvc_stdlib_force_include.hpp to handle clang++

2017-01-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jan 19 17:48:05 2017
New Revision: 292539

URL: http://llvm.org/viewvc/llvm-project?rev=292539=rev
Log:
Adjust msvc_stdlib_force_include.hpp to handle clang++

Summary: This patch adjusts the newly added `msvc_stdlib_force_include.hpp` so 
that it also works when used with `clang++`.

Reviewers: STL_MSFT

Reviewed By: STL_MSFT

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

Modified:
libcxx/trunk/include/__config
libcxx/trunk/test/libcxx/test/config.py
libcxx/trunk/test/support/msvc_stdlib_force_include.hpp

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=292539=292538=292539=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Thu Jan 19 17:48:05 2017
@@ -189,7 +189,6 @@
 #  define _LIBCPP_LITTLE_ENDIAN 1
 #  define _LIBCPP_BIG_ENDIAN0
 #  define _LIBCPP_SHORT_WCHAR   1
-
 // If mingw not explicitly detected, assume using MS C runtime only.
 #  ifndef __MINGW32__
 #define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
@@ -197,6 +196,9 @@
 #  if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || 
defined(__arm__))
 #define _LIBCPP_HAS_BITSCAN64
 #  endif
+# if defined(_LIBCPP_MSVCRT)
+#   define _LIBCPP_HAS_QUICK_EXIT
+# endif
 #endif // defined(_WIN32)
 
 #ifdef __sun__

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=292539=292538=292539=diff
==
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Thu Jan 19 17:48:05 2017
@@ -468,10 +468,9 @@ class Configuration(object):
 self.cxx.compile_flags += [
 '-include', os.path.join(support_path, 'nasty_macros.hpp')]
 if self.cxx_stdlib_under_test == 'msvc':
-# FIXME: Uncomment this once STL commits the support header.
-# self.cxx.compile_flags += [
-#'-include', os.path.join(support_path,
-# 'msvc_stdlib_force_include.h')]
+self.cxx.compile_flags += [
+'-include', os.path.join(support_path,
+ 'msvc_stdlib_force_include.hpp')]
 pass
 if self.is_windows and self.debug_build and \
 self.cxx_stdlib_under_test != 'msvc':

Modified: libcxx/trunk/test/support/msvc_stdlib_force_include.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/msvc_stdlib_force_include.hpp?rev=292539=292538=292539=diff
==
--- libcxx/trunk/test/support/msvc_stdlib_force_include.hpp (original)
+++ libcxx/trunk/test/support/msvc_stdlib_force_include.hpp Thu Jan 19 17:48:05 
2017
@@ -1,79 +1,78 @@
-//===--===//
-//
-// 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.
-//
-//===--===//
-
-#ifndef SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP
-#define SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP
-
-
-// This header is force-included when running MSVC's compiler and standard 
library with libc++'s tests.
-
-
-// Avoid assertion dialogs.
-#define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort()
-
-#include 
-#include 
-
-struct AssertionDialogAvoider {
-AssertionDialogAvoider() {
-_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
-_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
-
-_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
-_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
-}
-};
-
-const AssertionDialogAvoider assertion_dialog_avoider{};
-
-
-// Simulate feature-test macros.
-#define __has_feature(X) _MSVC_HAS_FEATURE_ ## X
-#define _MSVC_HAS_FEATURE_cxx_exceptions1
-#define _MSVC_HAS_FEATURE_cxx_rtti  1
-#define _MSVC_HAS_FEATURE_address_sanitizer 0
-#define _MSVC_HAS_FEATURE_memory_sanitizer  0
-#define _MSVC_HAS_FEATURE_thread_sanitizer  0
-
-
-// atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix.
-#define _ENABLE_ATOMIC_ALIGNMENT_FIX
-
-
-// Enable features that /std:c++latest removes by default.
-#define _HAS_AUTO_PTR_ETC  1
-#define _HAS_FUNCTION_ASSIGN   1
-#define _HAS_OLD_IOSTREAMS_MEMBERS 1
-
-
-// MSVC doesn't have __int128_t.
-#define _LIBCPP_HAS_NO_INT128
-
-
-// MSVC has quick_exit() and at_quick_exit().
-#define _LIBCPP_HAS_QUICK_EXIT
-
-
-// MSVC's STL partially supports C++17.
-#define TEST_STD_VER 17
-
-
-// Silence warnings about raw pointers and other unchecked 

Re: r292497 - [Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode

2017-01-19 Thread Hans Wennborg via cfe-commits
Richard, what do you think?

On Thu, Jan 19, 2017 at 9:34 AM, Alex L  wrote:
> Hi Hans,
>
> Would it be possible to merge this for 4.0?
>
> Cheers,
> Alex
>
> On 19 January 2017 at 17:17, Alex Lorenz via cfe-commits
>  wrote:
>>
>> Author: arphaman
>> Date: Thu Jan 19 11:17:57 2017
>> New Revision: 292497
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=292497=rev
>> Log:
>> [Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode
>>
>> rdar://28532840
>>
>> Differential Revision: https://reviews.llvm.org/D25213
>>
>> Added:
>> cfe/trunk/test/Sema/PR28181.c
>> Modified:
>> cfe/trunk/lib/Sema/SemaExpr.cpp
>>
>> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=292497=292496=292497=diff
>>
>> ==
>> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jan 19 11:17:57 2017
>> @@ -11505,7 +11505,7 @@ ExprResult Sema::BuildBinOp(Scope *S, So
>>return checkPseudoObjectAssignment(S, OpLoc, Opc, LHSExpr,
>> RHSExpr);
>>
>>  // Don't resolve overloads if the other type is overloadable.
>> -if (pty->getKind() == BuiltinType::Overload) {
>> +if (getLangOpts().CPlusPlus && pty->getKind() ==
>> BuiltinType::Overload) {
>>// We can't actually test that if we still have a placeholder,
>>// though.  Fortunately, none of the exceptions we see in that
>>// code below are valid when the LHS is an overload set.  Note
>> @@ -11530,17 +11530,16 @@ ExprResult Sema::BuildBinOp(Scope *S, So
>>  // An overload in the RHS can potentially be resolved by the type
>>  // being assigned to.
>>  if (Opc == BO_Assign && pty->getKind() == BuiltinType::Overload) {
>> -  if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent())
>> -return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr,
>> RHSExpr);
>> -
>> -  if (LHSExpr->getType()->isOverloadableType())
>> +  if (getLangOpts().CPlusPlus &&
>> +  (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent() ||
>> +   LHSExpr->getType()->isOverloadableType()))
>>  return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr,
>> RHSExpr);
>>
>>return CreateBuiltinBinOp(OpLoc, Opc, LHSExpr, RHSExpr);
>>  }
>>
>>  // Don't resolve overloads if the other type is overloadable.
>> -if (pty->getKind() == BuiltinType::Overload &&
>> +if (getLangOpts().CPlusPlus && pty->getKind() ==
>> BuiltinType::Overload &&
>>  LHSExpr->getType()->isOverloadableType())
>>return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr,
>> RHSExpr);
>>
>>
>> Added: cfe/trunk/test/Sema/PR28181.c
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/PR28181.c?rev=292497=auto
>>
>> ==
>> --- cfe/trunk/test/Sema/PR28181.c (added)
>> +++ cfe/trunk/test/Sema/PR28181.c Thu Jan 19 11:17:57 2017
>> @@ -0,0 +1,13 @@
>> +// RUN: %clang_cc1 -fsyntax-only -verify %s
>> +
>> +struct spinlock_t {
>> +  int lock;
>> +} audit_skb_queue;
>> +
>> +void fn1() {
>> +  audit_skb_queue = (lock); // expected-error {{use of undeclared
>> identifier 'lock'; did you mean 'long'?}}
>> +}   // expected-error@-1 {{assigning to 'struct
>> spinlock_t' from incompatible type ''}}
>> +
>> +void fn2() {
>> +  audit_skb_queue + (lock); // expected-error {{use of undeclared
>> identifier 'lock'; did you mean 'long'?}}
>> +}   // expected-error@-1 {{reference to
>> overloaded function could not be resolved; did you mean to call it?}}
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28451: [AVR] Add support for the 'interrupt' and 'naked' attributes

2017-01-19 Thread Dylan McKay via Phabricator via cfe-commits
dylanmckay added inline comments.



Comment at: lib/Sema/SemaDeclAttr.cpp:5145
+if (!isFunctionOrMethod(D)) {
+  S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type)
+  << "'interrupt'" << ExpectedFunctionOrMethod;

I'm pretty sure that this check shouldn't be necessary, because we define 
`Subjects = [Function]` in TableGen.

Without it though, the warning doesn't appear. Do you know why that is 
@aaron.ballman?


https://reviews.llvm.org/D28451



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


[PATCH] D28451: [AVR] Add support for the 'interrupt' and 'naked' attributes

2017-01-19 Thread Dylan McKay via Phabricator via cfe-commits
dylanmckay updated this revision to Diff 85053.
dylanmckay added a comment.

Add 'Subjects' field to 'AVRSignal'


https://reviews.llvm.org/D28451

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  lib/CodeGen/TargetInfo.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/avr/attributes/interrupt.c
  test/CodeGen/avr/attributes/signal.c
  test/Sema/avr-interrupt-attr.c
  test/Sema/avr-signal-attr.c

Index: test/Sema/avr-signal-attr.c
===
--- /dev/null
+++ test/Sema/avr-signal-attr.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -triple avr-unknown-unknown -verify -fsyntax-only
+struct a { int b; };
+
+struct a test __attribute__((signal)); // expected-warning {{'signal' attribute only applies to functions and methods}}
+
+__attribute__((signal)) void food() {}
Index: test/Sema/avr-interrupt-attr.c
===
--- /dev/null
+++ test/Sema/avr-interrupt-attr.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -triple avr-unknown-unknown -verify -fsyntax-only
+struct a { int b; };
+
+struct a test __attribute__((interrupt)); // expected-warning {{'interrupt' attribute only applies to functions and methods}}
+
+__attribute__((interrupt)) void food() {}
Index: test/CodeGen/avr/attributes/signal.c
===
--- /dev/null
+++ test/CodeGen/avr/attributes/signal.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple avr-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define void @foo() #0
+__attribute__((signal)) void foo(void) { }
+
+// CHECK: attributes #0 = {{{.*signal.*}}}
Index: test/CodeGen/avr/attributes/interrupt.c
===
--- /dev/null
+++ test/CodeGen/avr/attributes/interrupt.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple avr-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define void @foo() #0
+__attribute__((interrupt)) void foo(void) { }
+
+// CHECK: attributes #0 = {{{.*interrupt.*}}}
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -5140,6 +5140,15 @@
   case llvm::Triple::x86_64:
 handleAnyX86InterruptAttr(S, D, Attr);
 break;
+  case llvm::Triple::avr:
+if (!isFunctionOrMethod(D)) {
+  S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type)
+  << "'interrupt'" << ExpectedFunctionOrMethod;
+  return;
+}
+
+handleSimpleAttribute(S, D, Attr);
+break;
   default:
 handleARMInterruptAttr(S, D, Attr);
 break;
@@ -5700,6 +5709,14 @@
   case AttributeList::AT_AMDGPUNumVGPR:
 handleAMDGPUNumVGPRAttr(S, D, Attr);
 break;
+  case AttributeList::AT_AVRSignal:
+if (!isFunctionOrMethod(D)) {
+  S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type)
+  << "'signal'" << ExpectedFunctionOrMethod;
+  return;
+}
+handleSimpleAttribute(S, D, Attr);
+break;
   case AttributeList::AT_IBAction:
 handleSimpleAttribute(S, D, Attr);
 break;
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -6900,6 +6900,31 @@
 }
 
 //===--===//
+// AVR ABI Implementation.
+//===--===//
+
+namespace {
+class AVRTargetCodeGenInfo : public TargetCodeGenInfo {
+public:
+  AVRTargetCodeGenInfo(CodeGenTypes )
+: TargetCodeGenInfo(new DefaultABIInfo(CGT)) { }
+
+  void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
+   CodeGen::CodeGenModule ) const override {
+const auto *FD = dyn_cast_or_null(D);
+if (!FD) return;
+llvm::Function *Fn = cast(GV);
+
+if (FD->getAttr())
+  Fn->addFnAttr("interrupt");
+
+if (FD->getAttr())
+  Fn->addFnAttr("signal");
+  }
+};
+}
+
+//===--===//
 // TCE ABI Implementation (see http://tce.cs.tut.fi). Uses mostly the defaults.
 // Currently subclassed only to implement custom OpenCL C function attribute
 // handling.
@@ -8402,6 +8427,9 @@
   case llvm::Triple::mips64el:
 return SetCGInfo(new MIPSTargetCodeGenInfo(Types, false));
 
+  case llvm::Triple::avr:
+return SetCGInfo(new AVRTargetCodeGenInfo(Types));
+
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be: {
 AArch64ABIInfo::ABIKind Kind = AArch64ABIInfo::AAPCS;
Index: include/clang/Basic/AttrDocs.td
===
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -1182,6 +1182,33 @@
   }];
 }
 
+def AVRInterruptDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+Clang supports the 

[PATCH] D28451: [AVR] Add support for the 'interrupt' and 'naked' attributes

2017-01-19 Thread Dylan McKay via Phabricator via cfe-commits
dylanmckay updated this revision to Diff 85052.
dylanmckay added a comment.

Remove a test for the 'naked' attribute


https://reviews.llvm.org/D28451

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  lib/CodeGen/TargetInfo.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/avr/attributes/interrupt.c
  test/CodeGen/avr/attributes/signal.c
  test/Sema/avr-interrupt-attr.c
  test/Sema/avr-signal-attr.c

Index: test/Sema/avr-signal-attr.c
===
--- /dev/null
+++ test/Sema/avr-signal-attr.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -triple avr-unknown-unknown -verify -fsyntax-only
+struct a { int b; };
+
+struct a test __attribute__((signal)); // expected-warning {{'signal' attribute only applies to functions and methods}}
+
+__attribute__((signal)) void food() {}
Index: test/Sema/avr-interrupt-attr.c
===
--- /dev/null
+++ test/Sema/avr-interrupt-attr.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -triple avr-unknown-unknown -verify -fsyntax-only
+struct a { int b; };
+
+struct a test __attribute__((interrupt)); // expected-warning {{'interrupt' attribute only applies to functions and methods}}
+
+__attribute__((interrupt)) void food() {}
Index: test/CodeGen/avr/attributes/signal.c
===
--- /dev/null
+++ test/CodeGen/avr/attributes/signal.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple avr-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define void @foo() #0
+__attribute__((signal)) void foo(void) { }
+
+// CHECK: attributes #0 = {{{.*signal.*}}}
Index: test/CodeGen/avr/attributes/interrupt.c
===
--- /dev/null
+++ test/CodeGen/avr/attributes/interrupt.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple avr-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define void @foo() #0
+__attribute__((interrupt)) void foo(void) { }
+
+// CHECK: attributes #0 = {{{.*interrupt.*}}}
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -5140,6 +5140,15 @@
   case llvm::Triple::x86_64:
 handleAnyX86InterruptAttr(S, D, Attr);
 break;
+  case llvm::Triple::avr:
+if (!isFunctionOrMethod(D)) {
+  S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type)
+  << "'interrupt'" << ExpectedFunctionOrMethod;
+  return;
+}
+
+handleSimpleAttribute(S, D, Attr);
+break;
   default:
 handleARMInterruptAttr(S, D, Attr);
 break;
@@ -5700,6 +5709,14 @@
   case AttributeList::AT_AMDGPUNumVGPR:
 handleAMDGPUNumVGPRAttr(S, D, Attr);
 break;
+  case AttributeList::AT_AVRSignal:
+if (!isFunctionOrMethod(D)) {
+  S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type)
+  << "'signal'" << ExpectedFunctionOrMethod;
+  return;
+}
+handleSimpleAttribute(S, D, Attr);
+break;
   case AttributeList::AT_IBAction:
 handleSimpleAttribute(S, D, Attr);
 break;
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -6900,6 +6900,31 @@
 }
 
 //===--===//
+// AVR ABI Implementation.
+//===--===//
+
+namespace {
+class AVRTargetCodeGenInfo : public TargetCodeGenInfo {
+public:
+  AVRTargetCodeGenInfo(CodeGenTypes )
+: TargetCodeGenInfo(new DefaultABIInfo(CGT)) { }
+
+  void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
+   CodeGen::CodeGenModule ) const override {
+const auto *FD = dyn_cast_or_null(D);
+if (!FD) return;
+llvm::Function *Fn = cast(GV);
+
+if (FD->getAttr())
+  Fn->addFnAttr("interrupt");
+
+if (FD->getAttr())
+  Fn->addFnAttr("signal");
+  }
+};
+}
+
+//===--===//
 // TCE ABI Implementation (see http://tce.cs.tut.fi). Uses mostly the defaults.
 // Currently subclassed only to implement custom OpenCL C function attribute
 // handling.
@@ -8402,6 +8427,9 @@
   case llvm::Triple::mips64el:
 return SetCGInfo(new MIPSTargetCodeGenInfo(Types, false));
 
+  case llvm::Triple::avr:
+return SetCGInfo(new AVRTargetCodeGenInfo(Types));
+
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be: {
 AArch64ABIInfo::ABIKind Kind = AArch64ABIInfo::AAPCS;
Index: include/clang/Basic/AttrDocs.td
===
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -1182,6 +1182,33 @@
   }];
 }
 
+def AVRInterruptDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+Clang supports 

[PATCH] D28451: [AVR] Add support for the 'interrupt' and 'naked' attributes

2017-01-19 Thread Dylan McKay via Phabricator via cfe-commits
dylanmckay updated this revision to Diff 85051.
dylanmckay marked 5 inline comments as done.
dylanmckay added a comment.

Code review from Aaron

- Use 'handleSimpleAttribute' rather than duplicating it
- Use 'auto' where a type is explicitly casted
- Add warnings for when the attribute is not on a function
- Add sema tests for when the attr is not on a function


https://reviews.llvm.org/D28451

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  lib/CodeGen/TargetInfo.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/avr/attributes/interrupt.c
  test/CodeGen/avr/attributes/naked.c
  test/CodeGen/avr/attributes/signal.c
  test/Sema/avr-interrupt-attr.c
  test/Sema/avr-signal-attr.c

Index: test/Sema/avr-signal-attr.c
===
--- /dev/null
+++ test/Sema/avr-signal-attr.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -triple avr-unknown-unknown -verify -fsyntax-only
+struct a { int b; };
+
+struct a test __attribute__((signal)); // expected-warning {{'signal' attribute only applies to functions and methods}}
+
+__attribute__((signal)) void food() {}
Index: test/Sema/avr-interrupt-attr.c
===
--- /dev/null
+++ test/Sema/avr-interrupt-attr.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -triple avr-unknown-unknown -verify -fsyntax-only
+struct a { int b; };
+
+struct a test __attribute__((interrupt)); // expected-warning {{'interrupt' attribute only applies to functions and methods}}
+
+__attribute__((interrupt)) void food() {}
Index: test/CodeGen/avr/attributes/signal.c
===
--- /dev/null
+++ test/CodeGen/avr/attributes/signal.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple avr-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define void @foo() #0
+__attribute__((signal)) void foo(void) { }
+
+// CHECK: attributes #0 = {{{.*signal.*}}}
Index: test/CodeGen/avr/attributes/naked.c
===
--- /dev/null
+++ test/CodeGen/avr/attributes/naked.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple avr-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define void @foo() #0
+__attribute__((naked)) void foo(void) { }
+
+// CHECK: attributes #0 = {{{.*naked.*}}}
Index: test/CodeGen/avr/attributes/interrupt.c
===
--- /dev/null
+++ test/CodeGen/avr/attributes/interrupt.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple avr-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define void @foo() #0
+__attribute__((interrupt)) void foo(void) { }
+
+// CHECK: attributes #0 = {{{.*interrupt.*}}}
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -5140,6 +5140,15 @@
   case llvm::Triple::x86_64:
 handleAnyX86InterruptAttr(S, D, Attr);
 break;
+  case llvm::Triple::avr:
+if (!isFunctionOrMethod(D)) {
+  S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type)
+  << "'interrupt'" << ExpectedFunctionOrMethod;
+  return;
+}
+
+handleSimpleAttribute(S, D, Attr);
+break;
   default:
 handleARMInterruptAttr(S, D, Attr);
 break;
@@ -5700,6 +5709,14 @@
   case AttributeList::AT_AMDGPUNumVGPR:
 handleAMDGPUNumVGPRAttr(S, D, Attr);
 break;
+  case AttributeList::AT_AVRSignal:
+if (!isFunctionOrMethod(D)) {
+  S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type)
+  << "'signal'" << ExpectedFunctionOrMethod;
+  return;
+}
+handleSimpleAttribute(S, D, Attr);
+break;
   case AttributeList::AT_IBAction:
 handleSimpleAttribute(S, D, Attr);
 break;
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -6900,6 +6900,31 @@
 }
 
 //===--===//
+// AVR ABI Implementation.
+//===--===//
+
+namespace {
+class AVRTargetCodeGenInfo : public TargetCodeGenInfo {
+public:
+  AVRTargetCodeGenInfo(CodeGenTypes )
+: TargetCodeGenInfo(new DefaultABIInfo(CGT)) { }
+
+  void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
+   CodeGen::CodeGenModule ) const override {
+const auto *FD = dyn_cast_or_null(D);
+if (!FD) return;
+llvm::Function *Fn = cast(GV);
+
+if (FD->getAttr())
+  Fn->addFnAttr("interrupt");
+
+if (FD->getAttr())
+  Fn->addFnAttr("signal");
+  }
+};
+}
+
+//===--===//
 // TCE ABI Implementation (see http://tce.cs.tut.fi). Uses mostly the defaults.
 // Currently subclassed only to implement custom OpenCL C function 

[libcxxabi] r292524 - Merging r292418:

2017-01-19 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu Jan 19 15:57:56 2017
New Revision: 292524

URL: http://llvm.org/viewvc/llvm-project?rev=292524=rev
Log:
Merging r292418:

r292418 | jroelofs | 2017-01-18 10:12:39 -0800 (Wed, 18 Jan 2017) | 15 lines

Revert r286788

The Itanium ABI [1] specifies that __cxa_demangle accept either:

   1) symbol names, which start with "_Z"
   2) type manglings, which do not start with "_Z"

r286788 erroneously assumes that it should only handle symbols, so this patch
reverts it and adds a counterexample to the testcase.

1: https://mentorembedded.github.io/cxx-abi/abi.html#demangler


Reviewers: zygoloid, EricWF



Modified:
libcxxabi/branches/release_40/   (props changed)
libcxxabi/branches/release_40/src/cxa_demangle.cpp
libcxxabi/branches/release_40/test/test_demangle.pass.cpp

Propchange: libcxxabi/branches/release_40/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 19 15:57:56 2017
@@ -1 +1 @@
-/libcxxabi/trunk:292135
+/libcxxabi/trunk:292135,292418

Modified: libcxxabi/branches/release_40/src/cxa_demangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/branches/release_40/src/cxa_demangle.cpp?rev=292524=292523=292524=diff
==
--- libcxxabi/branches/release_40/src/cxa_demangle.cpp (original)
+++ libcxxabi/branches/release_40/src/cxa_demangle.cpp Thu Jan 19 15:57:56 2017
@@ -4979,22 +4979,12 @@ __cxa_demangle(const char *mangled_name,
 return nullptr;
 }
 
-size_t len = std::strlen(mangled_name);
-if (len < 2 || strncmp(mangled_name, "_Z", 2))
-{
-if (len < 4 || strncmp(mangled_name, "___Z", 4))
-{
-if (status)
-*status = invalid_mangled_name;
-return nullptr;
-}
-}
-
 size_t internal_size = buf != nullptr ? *n : 0;
 arena a;
 Db db(a);
 db.template_param.emplace_back(a);
 int internal_status = success;
+size_t len = std::strlen(mangled_name);
 demangle(mangled_name, mangled_name + len, db,
  internal_status);
 if (internal_status == success && db.fix_forward_references &&

Modified: libcxxabi/branches/release_40/test/test_demangle.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/branches/release_40/test/test_demangle.pass.cpp?rev=292524=292523=292524=diff
==
--- libcxxabi/branches/release_40/test/test_demangle.pass.cpp (original)
+++ libcxxabi/branches/release_40/test/test_demangle.pass.cpp Thu Jan 19 
15:57:56 2017
@@ -29594,6 +29594,9 @@ const char* cases[][2] =
 // NOTE: disable this test since it is a negative test case, you cannot 
demangle a non-mangled symbol
 // {"\x6D", nullptr},  // This use to crash with ASAN
 {"_ZTIU4_farrVKPi", "typeinfo for int* const volatile restrict _far"},
+
+// mangled names can include type manglings too, which don't start with _Z:
+{"i", "int"},
 };
 
 const unsigned N = sizeof(cases) / sizeof(cases[0]);


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


r292522 - Don't inline dllimport functions referencing non-imported methods

2017-01-19 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu Jan 19 15:33:13 2017
New Revision: 292522

URL: http://llvm.org/viewvc/llvm-project?rev=292522=rev
Log:
Don't inline dllimport functions referencing non-imported methods

This is another follow-up to r246338. I had assumed methods were already
handled by the AST visitor, but turns out they weren't.

Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGenCXX/dllimport.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=292522=292521=292522=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Jan 19 15:33:13 2017
@@ -1751,6 +1751,11 @@ namespace {
   SafeToInline = E->getConstructor()->hasAttr();
   return SafeToInline;
 }
+bool VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
+  CXXMethodDecl *M = E->getMethodDecl();
+  SafeToInline = M->hasAttr();
+  return SafeToInline;
+}
 bool VisitCXXDeleteExpr(CXXDeleteExpr *E) {
   SafeToInline = E->getOperatorDelete()->hasAttr();
   return SafeToInline;

Modified: cfe/trunk/test/CodeGenCXX/dllimport.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllimport.cpp?rev=292522=292521=292522=diff
==
--- cfe/trunk/test/CodeGenCXX/dllimport.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/dllimport.cpp Thu Jan 19 15:33:13 2017
@@ -26,6 +26,7 @@ struct ExplicitSpec_NotImported {};
 #define USEVARTYPE(type, var) type UNIQ(use)() { return var; }
 #define USEVAR(var) USEVARTYPE(int, var)
 #define USE(func) void UNIQ(use)() { func(); }
+#define USE1(func) void UNIQ(use)() { func(nullptr); }
 #define USEMEMFUNC(class, func) void (class::*UNIQ(use)())() { return 
::func; }
 #define USESTATICMEMFUNC(class, func) void (*UNIQ(use)())() { return 
::func; }
 #define USECLASS(class) void UNIQ(USE)() { class x; }
@@ -316,10 +317,13 @@ namespace ns { __declspec(dllimport) voi
 USE(ns::externalFunc)
 
 // A dllimport function referencing non-imported vars or functions must not be 
available_externally.
+
 __declspec(dllimport) int ImportedVar;
 int NonImportedVar;
 __declspec(dllimport) int ImportedFunc();
 int NonImportedFunc();
+struct ClassWithNonImportedMethod { int f(); };
+
 __declspec(dllimport) inline int ReferencingImportedVar() { return 
ImportedVar; }
 // MO1-DAG: define available_externally dllimport i32 
@"\01?ReferencingImportedVar@@YAHXZ"
 __declspec(dllimport) inline int ReferencingNonImportedVar() { return 
NonImportedVar; }
@@ -328,10 +332,13 @@ __declspec(dllimport) inline int Referen
 // MO1-DAG: define available_externally dllimport i32 
@"\01?ReferencingImportedFunc@@YAHXZ"
 __declspec(dllimport) inline int ReferencingNonImportedFunc() { return 
NonImportedFunc(); }
 // MO1-DAG: declare dllimport i32 @"\01?ReferencingNonImportedFunc@@YAHXZ"()
+__declspec(dllimport) inline int 
ReferencingNonImportedMethod(ClassWithNonImportedMethod *x) { return x->f(); }
+// MO1-DAG: declare dllimport i32 @"\01?ReferencingNonImportedMethod
 USE(ReferencingImportedVar)
 USE(ReferencingNonImportedVar)
 USE(ReferencingImportedFunc)
 USE(ReferencingNonImportedFunc)
+USE1(ReferencingNonImportedMethod)
 // References to operator new and delete count too, despite not being 
DeclRefExprs.
 __declspec(dllimport) inline int *ReferencingNonImportedNew() { return new 
int[2]; }
 // MO1-DAG: declare dllimport i32* @"\01?ReferencingNonImportedNew@@YAPAHXZ"


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


RE: PATCH: re-enable OpenCL extensions

2017-01-19 Thread Liu, Yaxun (Sam) via cfe-commits
I think the supported extensions for a target should be as accurate as 
possible, for it to be useful. Setting all extensions to be supported on all 
targets will defeat its purpose.

I recommend to introduce "pocl" as an environment in the triple and add 
supported OpenCL extensions for different targets based on that.

Sam

-Original Message-
From: Anastasia Stulova [mailto:anastasia.stul...@arm.com] 
Sent: Thursday, January 19, 2017 12:31 PM
To: Kalle Raiskila 
Cc: cfe-commits@lists.llvm.org; Liu, Yaxun (Sam) ; nd 

Subject: RE: PATCH: re-enable OpenCL extensions

As mentioned on cfe-dev as well, although it doesn't seem too critical it is 
generally not logical to enable all extensions by default because most of the 
targets don't even support OpenCL. But I understand your situation with using 
x86 or ARM backends in a generic way. Do you think this can be solved instead 
with the new " -cl-ext=" option: 
http://clang.llvm.org/docs/UsersManual.html#opencl-specific-options

May be Sam could comment more since he has done most work with the extensions 
lately.

Cheers,
Anastasia

-Original Message-
From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of 
Kalle Raiskila via cfe-commits
Sent: 19 January 2017 08:03
To: cfe-commits@lists.llvm.org
Subject: PATCH: re-enable OpenCL extensions

Hi,

I noticed a change from clang 3.8 to 3.9, that it disabled all OpenCL extension 
pragmas per default.
This broke pocl on e.g. ARM for LLVM 3.9 
(https://github.com/pocl/pocl/issues/409).

Example:
$ echo "#pragma OPENCL EXTENSION cl_khr_icd: enable" > hello.cl $ clang  
-emit-llvm -x cl -o tmp.bc -c hello.cl

works fine, but:
$ clang  -emit-llvm -x cl -o tmp.bc -c hello.cl 
--target=armv7-unknown-linux-gnueabihf
hello.cl:1:26: warning: unsupported OpenCL extension 'cl_khr_icd' - ignoring 
[-Wignored-pragmas] #pragma OPENCL EXTENSION cl_khr_icd: enable
   ^
1 warning generated.


Attached is a patch that enables OpenCL extensions for all targets per default, 
and then sets the status quo of supported extensions for those targets that 
currently customize their settings (i.e.
NVPTX and AMDGPU).
Most generic CPUs can handle all OpenCL extensions just fine.

Please keep me as CC, I am not subscribed to the list.
thanks,
kalle

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


Re: r292508 - Module: Improve diagnostic message when cxx modules are disabled and @import is used in Objective CXX.

2017-01-19 Thread Richard Smith via cfe-commits
On 19 Jan 2017 11:16 am, "Manman Ren via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

Author: mren
Date: Thu Jan 19 13:05:55 2017
New Revision: 292508

URL: http://llvm.org/viewvc/llvm-project?rev=292508=rev
Log:
Module: Improve diagnostic message when cxx modules are disabled and
@import is used in Objective CXX.

rdar://problem/19399671

Added:
cfe/trunk/test/Modules/check-syntax.mm
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseObjc.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/
DiagnosticParseKinds.td?rev=292508=292507=292508=diff

==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Thu Jan 19
13:05:55 2017
@@ -243,7 +243,10 @@ def err_expected_property_name : Error<"

 def err_unexpected_at : Error<"unexpected '@' in program">;
 def err_atimport : Error<
-"use of '@import' when modules are disabled">;
+  "use of '@import' when modules are disabled">;
+def err_atimport_cxx : Error<
+  "use of '@import' when C++ modules are disabled, consider using fmodules
"
+  "and fcxx-modules">;

 def err_invalid_reference_qualifier_application : Error<
   "'%0' qualifier may not be applied to a reference">;

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/
ParseObjc.cpp?rev=292508=292507=292508=diff

==
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Thu Jan 19 13:05:55 2017
@@ -83,7 +83,10 @@ Parser::DeclGroupPtrTy Parser::ParseObjC
   case tok::objc_import:
 if (getLangOpts().Modules || getLangOpts().DebuggerSupport)
   return ParseModuleImport(AtLoc);
-Diag(AtLoc, diag::err_atimport);
+if (getLangOpts().CPlusPlus)
+  Diag(AtLoc, diag::err_atimport_cxx);
+else
+  Diag(AtLoc, diag::err_atimport);
 SkipUntil(tok::semi);
 return Actions.ConvertDeclToDeclGroup(nullptr);
   default:

Added: cfe/trunk/test/Modules/check-syntax.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
Modules/check-syntax.mm?rev=292508=auto

==
--- cfe/trunk/test/Modules/check-syntax.mm (added)
+++ cfe/trunk/test/Modules/check-syntax.mm Thu Jan 19 13:05:55 2017
@@ -0,0 +1,5 @@
+// RUN: not %clang -fmodules -fno-cxx-modules -fsyntax-only %s 2>&1 |
FileCheck %s
+// rdar://19399671
+
+// CHECK: use of '@import' when C++ modules are disabled


Please test for diagnostics with -verify rather than FileCheck when
possible.

+@import Foundation;


___
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: r292508 - Module: Improve diagnostic message when cxx modules are disabled and @import is used in Objective CXX.

2017-01-19 Thread Richard Smith via cfe-commits
On 19 Jan 2017 11:16 am, "Manman Ren via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

Author: mren
Date: Thu Jan 19 13:05:55 2017
New Revision: 292508

URL: http://llvm.org/viewvc/llvm-project?rev=292508=rev
Log:
Module: Improve diagnostic message when cxx modules are disabled and
@import is used in Objective CXX.

rdar://problem/19399671

Added:
cfe/trunk/test/Modules/check-syntax.mm
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseObjc.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/
DiagnosticParseKinds.td?rev=292508=292507=292508=diff

==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Thu Jan 19
13:05:55 2017
@@ -243,7 +243,10 @@ def err_expected_property_name : Error<"

 def err_unexpected_at : Error<"unexpected '@' in program">;
 def err_atimport : Error<
-"use of '@import' when modules are disabled">;
+  "use of '@import' when modules are disabled">;
+def err_atimport_cxx : Error<
+  "use of '@import' when C++ modules are disabled, consider using fmodules
"
+  "and fcxx-modules">;


Please add a hyphen before fmodules. There's also no reason to suggest
-fcxx-modules; modules support for C++ is controlled by -fmodules nowadays.

I also don't think it makes sense to have different diagnostics for C and
C++ mode; we should suggest the -fmodules flag in either case.

 def err_invalid_reference_qualifier_application : Error<
   "'%0' qualifier may not be applied to a reference">;

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/
ParseObjc.cpp?rev=292508=292507=292508=diff

==
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Thu Jan 19 13:05:55 2017
@@ -83,7 +83,10 @@ Parser::DeclGroupPtrTy Parser::ParseObjC
   case tok::objc_import:
 if (getLangOpts().Modules || getLangOpts().DebuggerSupport)
   return ParseModuleImport(AtLoc);
-Diag(AtLoc, diag::err_atimport);
+if (getLangOpts().CPlusPlus)
+  Diag(AtLoc, diag::err_atimport_cxx);
+else
+  Diag(AtLoc, diag::err_atimport);
 SkipUntil(tok::semi);
 return Actions.ConvertDeclToDeclGroup(nullptr);
   default:

Added: cfe/trunk/test/Modules/check-syntax.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
Modules/check-syntax.mm?rev=292508=auto

==
--- cfe/trunk/test/Modules/check-syntax.mm (added)
+++ cfe/trunk/test/Modules/check-syntax.mm Thu Jan 19 13:05:55 2017
@@ -0,0 +1,5 @@
+// RUN: not %clang -fmodules -fno-cxx-modules -fsyntax-only %s 2>&1 |
FileCheck %s
+// rdar://19399671
+
+// CHECK: use of '@import' when C++ modules are disabled
+@import Foundation;


___
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


r292518 - PR13403 (+duplicates): implement C++ DR1310 (http://wg21.link/cwg1310).

2017-01-19 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Jan 19 15:00:13 2017
New Revision: 292518

URL: http://llvm.org/viewvc/llvm-project?rev=292518=rev
Log:
PR13403 (+duplicates): implement C++ DR1310 (http://wg21.link/cwg1310).

Under this defect resolution, the injected-class-name of a class or class
template cannot be used except in very limited circumstances (when declaring a
constructor, in a nested-name-specifier, in a base-specifier, or in an
elaborated-type-specifier). This is apparently done to make parsing easier, but
it's a pain for us since we don't know whether a template-id using the
injected-class-name is valid at the point when we annotate it (we don't yet
know whether the template-id will become part of an elaborated-type-specifier).

As a tentative resolution to a perceived language defect, mem-initializer-ids
are added to the list of exceptions here (they generally follow the same rules
as base-specifiers).

When the reference to the injected-class-name uses the 'typename' or 'template'
keywords, we permit it to be used to name a type or template as an extension;
other compilers also accept some cases in this area. There are also a couple of
corner cases with dependent template names that we do not yet diagnose, but
which will also get this treatment.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseTemplate.cpp
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
cfe/trunk/test/CXX/drs/dr13xx.cpp
cfe/trunk/test/CXX/drs/dr1xx.cpp
cfe/trunk/test/Driver/response-file.c
cfe/trunk/test/Index/annotate-nested-name-specifier.cpp
cfe/trunk/test/Parser/cxx0x-ambig.cpp
cfe/trunk/test/SemaTemplate/injected-class-name.cpp
cfe/trunk/test/SemaTemplate/instantiate-enum.cpp
cfe/trunk/test/SemaTemplate/instantiate-member-class.cpp
cfe/trunk/test/SemaTemplate/ms-sizeof-missing-typename.cpp
cfe/trunk/www/cxx_dr_status.html

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=292518=292517=292518=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Thu Jan 19 15:00:13 
2017
@@ -672,9 +672,6 @@ def warn_static_inline_explicit_inst_ign
 // Constructor template diagnostics.
 def err_out_of_line_constructor_template_id : Error<
   "out-of-line constructor for %0 cannot have template arguments">;
-def err_out_of_line_template_id_type_names_constructor : Error<
-  "qualified reference to %0 is a constructor name rather than a "
-  "%select{template name|type}1 wherever a constructor can be declared">;
 
 def err_expected_qualified_after_typename : Error<
   "expected a qualified name after 'typename'">;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=292518=292517=292518=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Jan 19 15:00:13 
2017
@@ -1453,6 +1453,15 @@ def err_nested_name_spec_is_not_class :
 def ext_nested_name_spec_is_enum : ExtWarn<
   "use of enumeration in a nested name specifier is a C++11 extension">,
   InGroup;
+def err_out_of_line_qualified_id_type_names_constructor : Error<
+  "qualified reference to %0 is a constructor name rather than a "
+  "%select{template name|type}1 in this context">;
+def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
+  "ISO C++ specifies that "
+  "qualified reference to %0 is a constructor name rather than a "
+  "%select{template name|type}1 in this context, despite preceding "
+  "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
+  InGroup>;
 
 // C++ class members
 def err_storageclass_invalid_for_member : Error<
@@ -4316,7 +4325,7 @@ def err_template_kw_refers_to_non_templa
   "%0 following the 'template' keyword does not refer to a template">;
 def err_template_kw_refers_to_class_template : Error<
   "'%0%1' instantiated to a class template, not a function template">;
-def note_referenced_class_template : Error<
+def note_referenced_class_template : Note<
   "class template declared here">;
 def err_template_kw_missing : Error<
   "missing 'template' keyword prior to dependent 

[PATCH] D28667: [clang-tidy] Don't modernize-raw-string-literal if replacement is longer.

2017-01-19 Thread András Leitereg via Phabricator via cfe-commits
leanil updated this revision to Diff 85014.
leanil added a comment.

Add config parameter to control new functionality.
Update the test cases accordingly.


https://reviews.llvm.org/D28667

Files:
  clang-tidy/modernize/RawStringLiteralCheck.cpp
  clang-tidy/modernize/RawStringLiteralCheck.h
  test/clang-tidy/modernize-raw-string-literal-delimiter.cpp
  test/clang-tidy/modernize-raw-string-literal-replace-shorter.cpp
  test/clang-tidy/modernize-raw-string-literal.cpp

Index: test/clang-tidy/modernize-raw-string-literal.cpp
===
--- test/clang-tidy/modernize-raw-string-literal.cpp
+++ test/clang-tidy/modernize-raw-string-literal.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s modernize-raw-string-literal %t
+// RUN: %check_clang_tidy %s modernize-raw-string-literal %t -- -config="{CheckOptions: [{key: modernize-raw-string-literal.ReplaceShorterLiterals, value: 1}]}" -- -std=c++11
 
 char const *const BackSlash("goink\\frob");
 // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: escaped string literal can be written as a raw string literal [modernize-raw-string-literal]
Index: test/clang-tidy/modernize-raw-string-literal-replace-shorter.cpp
===
--- test/clang-tidy/modernize-raw-string-literal-replace-shorter.cpp
+++ test/clang-tidy/modernize-raw-string-literal-replace-shorter.cpp
@@ -0,0 +1,13 @@
+// RUN: %check_clang_tidy %s modernize-raw-string-literal %t
+
+// Don't replace these, because the raw literal would be longer.
+char const *const JustAQuote("quote:\'");
+char const *const NeedDelimiter("\":)\"");
+
+char const *const ManyQuotes("quotes:\'\'\'\'");
+// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const ManyQuotes(R"(quotes:)");{{$}}
+
+char const *const LongOctal("\042\072\051\042");
+// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const LongOctal(R"lit(":)")lit");{{$}}
Index: test/clang-tidy/modernize-raw-string-literal-delimiter.cpp
===
--- test/clang-tidy/modernize-raw-string-literal-delimiter.cpp
+++ test/clang-tidy/modernize-raw-string-literal-delimiter.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s modernize-raw-string-literal %t -- -config='{CheckOptions: [{key: "modernize-raw-string-literal.DelimiterStem", value: "str"}]}' -- -std=c++11
+// RUN: %check_clang_tidy %s modernize-raw-string-literal %t -- -config='{CheckOptions: [{key: "modernize-raw-string-literal.DelimiterStem", value: "str"}, {key: modernize-raw-string-literal.ReplaceShorterLiterals, value: 1}]}' -- -std=c++11
 
 char const *const ContainsSentinel{"who\\ops)\""};
 // CHECK-MESSAGES: :[[@LINE-1]]:36: warning: {{.*}} can be written as a raw string literal
Index: clang-tidy/modernize/RawStringLiteralCheck.h
===
--- clang-tidy/modernize/RawStringLiteralCheck.h
+++ clang-tidy/modernize/RawStringLiteralCheck.h
@@ -32,9 +32,10 @@
 private:
   void replaceWithRawStringLiteral(
   const ast_matchers::MatchFinder::MatchResult ,
-  const StringLiteral *Literal);
+  const StringLiteral *Literal, StringRef Replacement);
 
   std::string DelimiterStem;
+  const bool ReplaceShorterLiterals;
 };
 
 } // namespace modernize
Index: clang-tidy/modernize/RawStringLiteralCheck.cpp
===
--- clang-tidy/modernize/RawStringLiteralCheck.cpp
+++ clang-tidy/modernize/RawStringLiteralCheck.cpp
@@ -101,10 +101,13 @@
 RawStringLiteralCheck::RawStringLiteralCheck(StringRef Name,
  ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
-  DelimiterStem(Options.get("DelimiterStem", "lit")) {}
+  DelimiterStem(Options.get("DelimiterStem", "lit")),
+  ReplaceShorterLiterals(Options.get("ReplaceShorterLiterals", false)) {}
 
 void RawStringLiteralCheck::storeOptions(ClangTidyOptions::OptionMap ) {
   ClangTidyCheck::storeOptions(Options);
+  this->Options.store(Options, "ReplaceShorterLiterals",
+  ReplaceShorterLiterals);
 }
 
 void RawStringLiteralCheck::registerMatchers(MatchFinder *Finder) {
@@ -121,19 +124,25 @@
   if (Literal->getLocStart().isMacroID())
 return;
 
-  if (containsEscapedCharacters(Result, Literal))
-replaceWithRawStringLiteral(Result, Literal);
+  if (containsEscapedCharacters(Result, Literal)) {
+std::string Replacement = asRawStringLiteral(Literal, DelimiterStem);
+if (ReplaceShorterLiterals ||
+Replacement.length() <=
+Lexer::MeasureTokenLength(Literal->getLocStart(),
+  *Result.SourceManager, getLangOpts()))
+  replaceWithRawStringLiteral(Result, Literal, Replacement);
+  }
 }
 
 void 

[PATCH] D28514: [CodeCompletion] Reset the hidden declaration obtained after lookup when caching UsingShadowDecls

2017-01-19 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

Looks good to me, but one more comment/question.




Comment at: lib/Sema/SemaLookup.cpp:3433
+  // is not hidden by the using declaration.
+  if (isa(ND) && isa(D))
+continue;

Do we have to check that ND's UsingDecl is equal to D? Or we don't have to 
worry about it?


Repository:
  rL LLVM

https://reviews.llvm.org/D28514



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


r292508 - Module: Improve diagnostic message when cxx modules are disabled and @import is used in Objective CXX.

2017-01-19 Thread Manman Ren via cfe-commits
Author: mren
Date: Thu Jan 19 13:05:55 2017
New Revision: 292508

URL: http://llvm.org/viewvc/llvm-project?rev=292508=rev
Log:
Module: Improve diagnostic message when cxx modules are disabled and @import is 
used in Objective CXX.

rdar://problem/19399671

Added:
cfe/trunk/test/Modules/check-syntax.mm
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseObjc.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=292508=292507=292508=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Thu Jan 19 13:05:55 
2017
@@ -243,7 +243,10 @@ def err_expected_property_name : Error<"
 
 def err_unexpected_at : Error<"unexpected '@' in program">;
 def err_atimport : Error<
-"use of '@import' when modules are disabled">;
+  "use of '@import' when modules are disabled">;
+def err_atimport_cxx : Error<
+  "use of '@import' when C++ modules are disabled, consider using fmodules "
+  "and fcxx-modules">;
 
 def err_invalid_reference_qualifier_application : Error<
   "'%0' qualifier may not be applied to a reference">;

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=292508=292507=292508=diff
==
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Thu Jan 19 13:05:55 2017
@@ -83,7 +83,10 @@ Parser::DeclGroupPtrTy Parser::ParseObjC
   case tok::objc_import:
 if (getLangOpts().Modules || getLangOpts().DebuggerSupport)
   return ParseModuleImport(AtLoc);
-Diag(AtLoc, diag::err_atimport);
+if (getLangOpts().CPlusPlus)
+  Diag(AtLoc, diag::err_atimport_cxx);
+else
+  Diag(AtLoc, diag::err_atimport);
 SkipUntil(tok::semi);
 return Actions.ConvertDeclToDeclGroup(nullptr);
   default:

Added: cfe/trunk/test/Modules/check-syntax.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/check-syntax.mm?rev=292508=auto
==
--- cfe/trunk/test/Modules/check-syntax.mm (added)
+++ cfe/trunk/test/Modules/check-syntax.mm Thu Jan 19 13:05:55 2017
@@ -0,0 +1,5 @@
+// RUN: not %clang -fmodules -fno-cxx-modules -fsyntax-only %s 2>&1 | 
FileCheck %s
+// rdar://19399671
+
+// CHECK: use of '@import' when C++ modules are disabled
+@import Foundation;


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


[PATCH] D28889: Change where we handle arg-dependent diagnose_if attributes

2017-01-19 Thread George Burgess IV via Phabricator via cfe-commits
george.burgess.iv updated this revision to Diff 84988.
george.burgess.iv added a comment.

Sprinkle in a few `const`s, use `const auto *` in range for loops.


https://reviews.llvm.org/D28889

Files:
  include/clang/Sema/Overload.h
  include/clang/Sema/Sema.h
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaOverload.cpp
  test/Sema/diagnose_if.c
  test/SemaCXX/diagnose_if.cpp

Index: test/SemaCXX/diagnose_if.cpp
===
--- test/SemaCXX/diagnose_if.cpp
+++ test/SemaCXX/diagnose_if.cpp
@@ -2,6 +2,8 @@
 
 #define _diagnose_if(...) __attribute__((diagnose_if(__VA_ARGS__)))
 
+using size_t = unsigned long;
+
 namespace type_dependent {
 template 
 void neverok() _diagnose_if(!T(), "oh no", "error") {} // expected-note 4{{from 'diagnose_if'}}
@@ -51,14 +53,14 @@
 }
 
 template 
-void errorIf(T a) _diagnose_if(T() != a, "oh no", "error") {} // expected-note {{candidate disabled: oh no}}
+void errorIf(T a) _diagnose_if(T() != a, "oh no", "error") {} // expected-note{{from 'diagnose_if'}}
 
 template 
-void warnIf(T a) _diagnose_if(T() != a, "oh no", "warning") {} // expected-note {{from 'diagnose_if'}}
+void warnIf(T a) _diagnose_if(T() != a, "oh no", "warning") {} // expected-note{{from 'diagnose_if'}}
 
 void runIf() {
   errorIf(0);
-  errorIf(1); // expected-error{{call to unavailable function}}
+  errorIf(1); // expected-error{{oh no}}
 
   warnIf(0);
   warnIf(1); // expected-warning{{oh no}}
@@ -114,14 +116,14 @@
 }
 
 template 
-void errorIf(int a) _diagnose_if(N != a, "oh no", "error") {} // expected-note {{candidate disabled: oh no}}
+void errorIf(int a) _diagnose_if(N != a, "oh no", "error") {} // expected-note{{from 'diagnose_if'}}
 
 template 
-void warnIf(int a) _diagnose_if(N != a, "oh no", "warning") {} // expected-note {{from 'diagnose_if'}}
+void warnIf(int a) _diagnose_if(N != a, "oh no", "warning") {} // expected-note{{from 'diagnose_if'}}
 
 void runIf() {
   errorIf<0>(0);
-  errorIf<0>(1); // expected-error{{call to unavailable function}}
+  errorIf<0>(1); // expected-error{{oh no}}
 
   warnIf<0>(0);
   warnIf<0>(1); // expected-warning{{oh no}}
@@ -135,17 +137,17 @@
 void bar(int);
 void bar(short) _diagnose_if(1, "oh no", "error");
 
-void fooArg(int a) _diagnose_if(a, "oh no", "error"); // expected-note{{candidate disabled: oh no}}
-void fooArg(short); // expected-note{{candidate function}}
+void fooArg(int a) _diagnose_if(a, "oh no", "error"); // expected-note{{from 'diagnose_if'}}
+void fooArg(short);
 
 void barArg(int);
 void barArg(short a) _diagnose_if(a, "oh no", "error");
 
 void runAll() {
   foo(1); // expected-error{{oh no}}
   bar(1);
 
-  fooArg(1); // expected-error{{call to unavailable function}}
+  fooArg(1); // expected-error{{oh no}}
   barArg(1);
 
   auto p = foo; // expected-error{{incompatible initializer of type ''}}
@@ -188,11 +190,11 @@
   void foo(int i) _diagnose_if(i, "bad i", "error"); // expected-note{{from 'diagnose_if'}}
   void bar(int i) _diagnose_if(i != T(), "bad i", "error"); // expected-note{{from 'diagnose_if'}}
 
-  void fooOvl(int i) _diagnose_if(i, "int bad i", "error"); // expected-note 2{{int bad i}}
-  void fooOvl(short i) _diagnose_if(i, "short bad i", "error"); // expected-note 2{{short bad i}}
+  void fooOvl(int i) _diagnose_if(i, "int bad i", "error"); // expected-note{{from 'diagnose_if'}}
+  void fooOvl(short i) _diagnose_if(i, "short bad i", "error"); // expected-note{{from 'diagnose_if'}}
 
-  void barOvl(int i) _diagnose_if(i != T(), "int bad i", "error"); // expected-note 2{{int bad i}}
-  void barOvl(short i) _diagnose_if(i != T(), "short bad i", "error"); // expected-note 2{{short bad i}}
+  void barOvl(int i) _diagnose_if(i != T(), "int bad i", "error"); // expected-note{{from 'diagnose_if'}}
+  void barOvl(short i) _diagnose_if(i != T(), "short bad i", "error"); // expected-note{{from 'diagnose_if'}}
 };
 
 void runErrors() {
@@ -203,14 +205,14 @@
   Errors().bar(1); // expected-error{{bad i}}
 
   Errors().fooOvl(0);
-  Errors().fooOvl(1); // expected-error{{call to unavailable}}
+  Errors().fooOvl(1); // expected-error{{int bad i}}
   Errors().fooOvl(short(0));
-  Errors().fooOvl(short(1)); // expected-error{{call to unavailable}}
+  Errors().fooOvl(short(1)); // expected-error{{short bad i}}
 
   Errors().barOvl(0);
-  Errors().barOvl(1); // expected-error{{call to unavailable}}
+  Errors().barOvl(1); // expected-error{{int bad i}}
   Errors().barOvl(short(0));
-  Errors().barOvl(short(1)); // expected-error{{call to unavailable}}
+  Errors().barOvl(short(1)); // expected-error{{short bad i}}
 }
 
 template 
@@ -275,8 +277,8 @@
 constexpr int foo();
 constexpr int foo(int a);
 
-void bar() _diagnose_if(foo(), "bad foo", "error"); // expected-note{{from 'diagnose_if'}} expected-note{{not viable: requires 0 arguments}}
-void bar(int a) _diagnose_if(foo(a), "bad foo", "error"); // expected-note{{bad 

[PATCH] D28667: [clang-tidy] Don't modernize-raw-string-literal if replacement is longer.

2017-01-19 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment.

In https://reviews.llvm.org/D28667#650586, @leanil wrote:

> In https://reviews.llvm.org/D28667#650585, @LegalizeAdulthood wrote:
>
> > In https://reviews.llvm.org/D28667#649626, @LegalizeAdulthood wrote:
> >
> > > Don't do this without introducing an option to turn it off.
> >
> >
> > To clarify my reasoning:
> >  You imposing your subjective idea of goodness on the code, i.e. style.  
> > Other people will have different ideas about what they want from the code.  
> > So, to quote the X Window System Maxim, provide tools not rules.  Allow 
> > people to say whether or not they want the raw string literal in this case.
>
>
> I agree. Which mode do you think should be the default?


As long as you can control it, I don't think it matters much and preference of 
the submitter is fine.


https://reviews.llvm.org/D28667



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


[PATCH] D28667: [clang-tidy] Don't modernize-raw-string-literal if replacement is longer.

2017-01-19 Thread András Leitereg via Phabricator via cfe-commits
leanil added a comment.

In https://reviews.llvm.org/D28667#650585, @LegalizeAdulthood wrote:

> In https://reviews.llvm.org/D28667#649626, @LegalizeAdulthood wrote:
>
> > Don't do this without introducing an option to turn it off.
>
>
> To clarify my reasoning:
>  You imposing your subjective idea of goodness on the code, i.e. style.  
> Other people will have different ideas about what they want from the code.  
> So, to quote the X Window System Maxim, provide tools not rules.  Allow 
> people to say whether or not they want the raw string literal in this case.


I agree. Which mode do you think should be the default?


https://reviews.llvm.org/D28667



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


[PATCH] D28667: [clang-tidy] Don't modernize-raw-string-literal if replacement is longer.

2017-01-19 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment.

In https://reviews.llvm.org/D28667#649626, @LegalizeAdulthood wrote:

> Don't do this without introducing an option to turn it off.


To clarify my reasoning:
You imposing your subjective idea of goodness on the code, i.e. style.  Other 
people will have different ideas about what they want from the code.  So, to 
quote the X Window System Maxim, provide tools not rules.  Allow people to say 
whether or not they want the raw string literal in this case.


https://reviews.llvm.org/D28667



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


[PATCH] D28765: CStringChecker can crash when uninitialized checks are disabled

2017-01-19 Thread Anna Zaks via Phabricator via cfe-commits
zaks.anna added a comment.

> It is not supported to run the analyzer with some of the core checkers turned 
> off.

Correct.

> Maybe we should change the behavior such that turning off core checkers turn 
> off the warnings from those checkers but not the checkers themselves?

Having this as the default behavior for "disable a checker" could be confusing. 
however, introducing a new flag for **silencing** warnings from a checker 
sounds fine.

What is the motivation for disabling the core checkers in this particular case?


https://reviews.llvm.org/D28765



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


Re: r292497 - [Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode

2017-01-19 Thread Alex L via cfe-commits
Hi Hans,

Would it be possible to merge this for 4.0?

Cheers,
Alex

On 19 January 2017 at 17:17, Alex Lorenz via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: arphaman
> Date: Thu Jan 19 11:17:57 2017
> New Revision: 292497
>
> URL: http://llvm.org/viewvc/llvm-project?rev=292497=rev
> Log:
> [Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode
>
> rdar://28532840
>
> Differential Revision: https://reviews.llvm.org/D25213
>
> Added:
> cfe/trunk/test/Sema/PR28181.c
> Modified:
> cfe/trunk/lib/Sema/SemaExpr.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaE
> xpr.cpp?rev=292497=292496=292497=diff
> 
> ==
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jan 19 11:17:57 2017
> @@ -11505,7 +11505,7 @@ ExprResult Sema::BuildBinOp(Scope *S, So
>return checkPseudoObjectAssignment(S, OpLoc, Opc, LHSExpr, RHSExpr);
>
>  // Don't resolve overloads if the other type is overloadable.
> -if (pty->getKind() == BuiltinType::Overload) {
> +if (getLangOpts().CPlusPlus && pty->getKind() ==
> BuiltinType::Overload) {
>// We can't actually test that if we still have a placeholder,
>// though.  Fortunately, none of the exceptions we see in that
>// code below are valid when the LHS is an overload set.  Note
> @@ -11530,17 +11530,16 @@ ExprResult Sema::BuildBinOp(Scope *S, So
>  // An overload in the RHS can potentially be resolved by the type
>  // being assigned to.
>  if (Opc == BO_Assign && pty->getKind() == BuiltinType::Overload) {
> -  if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent())
> -return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr,
> RHSExpr);
> -
> -  if (LHSExpr->getType()->isOverloadableType())
> +  if (getLangOpts().CPlusPlus &&
> +  (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent() ||
> +   LHSExpr->getType()->isOverloadableType()))
>  return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr,
> RHSExpr);
>
>return CreateBuiltinBinOp(OpLoc, Opc, LHSExpr, RHSExpr);
>  }
>
>  // Don't resolve overloads if the other type is overloadable.
> -if (pty->getKind() == BuiltinType::Overload &&
> +if (getLangOpts().CPlusPlus && pty->getKind() ==
> BuiltinType::Overload &&
>  LHSExpr->getType()->isOverloadableType())
>return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr);
>
>
> Added: cfe/trunk/test/Sema/PR28181.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/PR28
> 181.c?rev=292497=auto
> 
> ==
> --- cfe/trunk/test/Sema/PR28181.c (added)
> +++ cfe/trunk/test/Sema/PR28181.c Thu Jan 19 11:17:57 2017
> @@ -0,0 +1,13 @@
> +// RUN: %clang_cc1 -fsyntax-only -verify %s
> +
> +struct spinlock_t {
> +  int lock;
> +} audit_skb_queue;
> +
> +void fn1() {
> +  audit_skb_queue = (lock); // expected-error {{use of undeclared
> identifier 'lock'; did you mean 'long'?}}
> +}   // expected-error@-1 {{assigning to 'struct
> spinlock_t' from incompatible type ''}}
> +
> +void fn2() {
> +  audit_skb_queue + (lock); // expected-error {{use of undeclared
> identifier 'lock'; did you mean 'long'?}}
> +}   // expected-error@-1 {{reference to
> overloaded function could not be resolved; did you mean to call it?}}
>
>
> ___
> 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: re-enable OpenCL extensions

2017-01-19 Thread Anastasia Stulova via cfe-commits
As mentioned on cfe-dev as well, although it doesn't seem too critical it is 
generally not logical to enable all extensions by default because most of the 
targets don't even support OpenCL. But I understand your situation with using 
x86 or ARM backends in a generic way. Do you think this can be solved instead 
with the new " -cl-ext=" option: 
http://clang.llvm.org/docs/UsersManual.html#opencl-specific-options

May be Sam could comment more since he has done most work with the extensions 
lately.

Cheers,
Anastasia

-Original Message-
From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of 
Kalle Raiskila via cfe-commits
Sent: 19 January 2017 08:03
To: cfe-commits@lists.llvm.org
Subject: PATCH: re-enable OpenCL extensions

Hi,

I noticed a change from clang 3.8 to 3.9, that it disabled all OpenCL extension 
pragmas per default.
This broke pocl on e.g. ARM for LLVM 3.9 
(https://github.com/pocl/pocl/issues/409).

Example:
$ echo "#pragma OPENCL EXTENSION cl_khr_icd: enable" > hello.cl $ clang  
-emit-llvm -x cl -o tmp.bc -c hello.cl

works fine, but:
$ clang  -emit-llvm -x cl -o tmp.bc -c hello.cl 
--target=armv7-unknown-linux-gnueabihf
hello.cl:1:26: warning: unsupported OpenCL extension 'cl_khr_icd' - ignoring 
[-Wignored-pragmas] #pragma OPENCL EXTENSION cl_khr_icd: enable
   ^
1 warning generated.


Attached is a patch that enables OpenCL extensions for all targets per default, 
and then sets the status quo of supported extensions for those targets that 
currently customize their settings (i.e.
NVPTX and AMDGPU).
Most generic CPUs can handle all OpenCL extensions just fine.

Please keep me as CC, I am not subscribed to the list.
thanks,
kalle

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


[PATCH] D28902: [Sema] Reword unused lambda capture warning

2017-01-19 Thread Malcolm Parsons via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL292498: [Sema] Reword unused lambda capture warning 
(authored by malcolm.parsons).

Changed prior to commit:
  https://reviews.llvm.org/D28902?vs=84966=84984#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28902

Files:
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/test/SemaCXX/warn-unused-lambda-capture.cpp


Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -320,7 +320,7 @@
 def warn_unused_private_field: Warning<"private field %0 is not used">,
   InGroup, DefaultIgnore;
 def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
-  "%select{used|required to be captured for use in an unevaluated context}1">,
+  "%select{used|required to be captured for this use}1">,
   InGroup, DefaultIgnore;
 
 def warn_parameter_size: Warning<
Index: cfe/trunk/test/SemaCXX/warn-unused-lambda-capture.cpp
===
--- cfe/trunk/test/SemaCXX/warn-unused-lambda-capture.cpp
+++ cfe/trunk/test/SemaCXX/warn-unused-lambda-capture.cpp
@@ -22,6 +22,7 @@
 
 void test() {
   int i = 0;
+  const int k = 0;
 
   auto captures_nothing = [] {};
 
@@ -34,8 +35,9 @@
   auto explicit_by_value_used = [i] { return i + 1; };
   auto explicit_by_value_used_void = [i] { (void)i; };
   auto explicit_by_value_unused = [i] {}; // expected-warning{{lambda capture 
'i' is not used}}
-  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for use in 
an unevaluated context}}
-  auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // 
expected-warning{{lambda capture 'i' is not required to be captured for use in 
an unevaluated context}}
+  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for this 
use}}
+  auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // 
expected-warning{{lambda capture 'i' is not required to be captured for this 
use}}
+  auto explicit_by_value_unused_const = [k] { return k + 1; }; // 
expected-warning{{lambda capture 'k' is not required to be captured for this 
use}}
 
   auto explicit_by_reference_used = [] { i++; };
   auto explicit_by_reference_unused = [] {}; // expected-warning{{lambda 
capture 'i' is not used}}
@@ -70,6 +72,7 @@
 template 
 void test_templated() {
   int i = 0;
+  const int k = 0;
 
   auto captures_nothing = [] {};
 
@@ -82,8 +85,9 @@
   auto explicit_by_value_used = [i] { return i + 1; };
   auto explicit_by_value_used_void = [i] { (void)i; };
   auto explicit_by_value_unused = [i] {}; // expected-warning{{lambda capture 
'i' is not used}}
-  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for use in 
an unevaluated context}}
+  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for this 
use}}
   auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // 
expected-warning{{lambda capture 'i' is not used}}
+  auto explicit_by_value_unused_const = [k] { return k + 1; }; // 
expected-warning{{lambda capture 'k' is not required to be captured for this 
use}}
 
   auto explicit_by_reference_used = [] { i++; };
   auto explicit_by_reference_unused = [] {}; // expected-warning{{lambda 
capture 'i' is not used}}


Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -320,7 +320,7 @@
 def warn_unused_private_field: Warning<"private field %0 is not used">,
   InGroup, DefaultIgnore;
 def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
-  "%select{used|required to be captured for use in an unevaluated context}1">,
+  "%select{used|required to be captured for this use}1">,
   InGroup, DefaultIgnore;
 
 def warn_parameter_size: Warning<
Index: cfe/trunk/test/SemaCXX/warn-unused-lambda-capture.cpp
===
--- cfe/trunk/test/SemaCXX/warn-unused-lambda-capture.cpp
+++ cfe/trunk/test/SemaCXX/warn-unused-lambda-capture.cpp
@@ -22,6 +22,7 @@
 
 void test() {
   int i = 0;
+  const int k = 0;
 
   auto captures_nothing = [] {};
 
@@ -34,8 +35,9 @@
   auto explicit_by_value_used = [i] { return i + 1; };
   auto explicit_by_value_used_void = [i] { (void)i; };
   auto explicit_by_value_unused = [i] {}; // expected-warning{{lambda capture 'i' is not used}}
-  auto 

r292498 - [Sema] Reword unused lambda capture warning

2017-01-19 Thread Malcolm Parsons via cfe-commits
Author: malcolm.parsons
Date: Thu Jan 19 11:19:22 2017
New Revision: 292498

URL: http://llvm.org/viewvc/llvm-project?rev=292498=rev
Log:
[Sema] Reword unused lambda capture warning

Summary:
The warning doesn't know why the variable was looked up but not
odr-used, so reword it to not claim that it was used in an unevaluated
context.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/SemaCXX/warn-unused-lambda-capture.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=292498=292497=292498=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Jan 19 11:19:22 
2017
@@ -320,7 +320,7 @@ def warn_unneeded_member_function : Warn
 def warn_unused_private_field: Warning<"private field %0 is not used">,
   InGroup, DefaultIgnore;
 def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
-  "%select{used|required to be captured for use in an unevaluated context}1">,
+  "%select{used|required to be captured for this use}1">,
   InGroup, DefaultIgnore;
 
 def warn_parameter_size: Warning<

Modified: cfe/trunk/test/SemaCXX/warn-unused-lambda-capture.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-unused-lambda-capture.cpp?rev=292498=292497=292498=diff
==
--- cfe/trunk/test/SemaCXX/warn-unused-lambda-capture.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-unused-lambda-capture.cpp Thu Jan 19 11:19:22 
2017
@@ -22,6 +22,7 @@ int side_effect() {
 
 void test() {
   int i = 0;
+  const int k = 0;
 
   auto captures_nothing = [] {};
 
@@ -34,8 +35,9 @@ void test() {
   auto explicit_by_value_used = [i] { return i + 1; };
   auto explicit_by_value_used_void = [i] { (void)i; };
   auto explicit_by_value_unused = [i] {}; // expected-warning{{lambda capture 
'i' is not used}}
-  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for use in 
an unevaluated context}}
-  auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // 
expected-warning{{lambda capture 'i' is not required to be captured for use in 
an unevaluated context}}
+  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for this 
use}}
+  auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // 
expected-warning{{lambda capture 'i' is not required to be captured for this 
use}}
+  auto explicit_by_value_unused_const = [k] { return k + 1; }; // 
expected-warning{{lambda capture 'k' is not required to be captured for this 
use}}
 
   auto explicit_by_reference_used = [] { i++; };
   auto explicit_by_reference_unused = [] {}; // expected-warning{{lambda 
capture 'i' is not used}}
@@ -70,6 +72,7 @@ class Foo
 template 
 void test_templated() {
   int i = 0;
+  const int k = 0;
 
   auto captures_nothing = [] {};
 
@@ -82,8 +85,9 @@ void test_templated() {
   auto explicit_by_value_used = [i] { return i + 1; };
   auto explicit_by_value_used_void = [i] { (void)i; };
   auto explicit_by_value_unused = [i] {}; // expected-warning{{lambda capture 
'i' is not used}}
-  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for use in 
an unevaluated context}}
+  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for this 
use}}
   auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // 
expected-warning{{lambda capture 'i' is not used}}
+  auto explicit_by_value_unused_const = [k] { return k + 1; }; // 
expected-warning{{lambda capture 'k' is not required to be captured for this 
use}}
 
   auto explicit_by_reference_used = [] { i++; };
   auto explicit_by_reference_unused = [] {}; // expected-warning{{lambda 
capture 'i' is not used}}


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


[PATCH] D25213: Fix PR28181: Prevent operator overloading related assertion failure crash that happens in C only

2017-01-19 Thread Alex Lorenz via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
arphaman marked an inline comment as done.
Closed by commit rL292497: [Sema] Fix PR28181 by avoiding calling 
BuildOverloadedBinOp in C mode (authored by arphaman).

Changed prior to commit:
  https://reviews.llvm.org/D25213?vs=83822=84983#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25213

Files:
  cfe/trunk/lib/Sema/SemaExpr.cpp
  cfe/trunk/test/Sema/PR28181.c


Index: cfe/trunk/test/Sema/PR28181.c
===
--- cfe/trunk/test/Sema/PR28181.c
+++ cfe/trunk/test/Sema/PR28181.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct spinlock_t {
+  int lock;
+} audit_skb_queue;
+
+void fn1() {
+  audit_skb_queue = (lock); // expected-error {{use of undeclared identifier 
'lock'; did you mean 'long'?}}
+}   // expected-error@-1 {{assigning to 'struct 
spinlock_t' from incompatible type ''}}
+
+void fn2() {
+  audit_skb_queue + (lock); // expected-error {{use of undeclared identifier 
'lock'; did you mean 'long'?}}
+}   // expected-error@-1 {{reference to overloaded 
function could not be resolved; did you mean to call it?}}
Index: cfe/trunk/lib/Sema/SemaExpr.cpp
===
--- cfe/trunk/lib/Sema/SemaExpr.cpp
+++ cfe/trunk/lib/Sema/SemaExpr.cpp
@@ -11505,7 +11505,7 @@
   return checkPseudoObjectAssignment(S, OpLoc, Opc, LHSExpr, RHSExpr);
 
 // Don't resolve overloads if the other type is overloadable.
-if (pty->getKind() == BuiltinType::Overload) {
+if (getLangOpts().CPlusPlus && pty->getKind() == BuiltinType::Overload) {
   // We can't actually test that if we still have a placeholder,
   // though.  Fortunately, none of the exceptions we see in that
   // code below are valid when the LHS is an overload set.  Note
@@ -11530,17 +11530,16 @@
 // An overload in the RHS can potentially be resolved by the type
 // being assigned to.
 if (Opc == BO_Assign && pty->getKind() == BuiltinType::Overload) {
-  if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent())
-return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr);
-
-  if (LHSExpr->getType()->isOverloadableType())
+  if (getLangOpts().CPlusPlus &&
+  (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent() ||
+   LHSExpr->getType()->isOverloadableType()))
 return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr);
 
   return CreateBuiltinBinOp(OpLoc, Opc, LHSExpr, RHSExpr);
 }
 
 // Don't resolve overloads if the other type is overloadable.
-if (pty->getKind() == BuiltinType::Overload &&
+if (getLangOpts().CPlusPlus && pty->getKind() == BuiltinType::Overload &&
 LHSExpr->getType()->isOverloadableType())
   return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr);
 


Index: cfe/trunk/test/Sema/PR28181.c
===
--- cfe/trunk/test/Sema/PR28181.c
+++ cfe/trunk/test/Sema/PR28181.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct spinlock_t {
+  int lock;
+} audit_skb_queue;
+
+void fn1() {
+  audit_skb_queue = (lock); // expected-error {{use of undeclared identifier 'lock'; did you mean 'long'?}}
+}   // expected-error@-1 {{assigning to 'struct spinlock_t' from incompatible type ''}}
+
+void fn2() {
+  audit_skb_queue + (lock); // expected-error {{use of undeclared identifier 'lock'; did you mean 'long'?}}
+}   // expected-error@-1 {{reference to overloaded function could not be resolved; did you mean to call it?}}
Index: cfe/trunk/lib/Sema/SemaExpr.cpp
===
--- cfe/trunk/lib/Sema/SemaExpr.cpp
+++ cfe/trunk/lib/Sema/SemaExpr.cpp
@@ -11505,7 +11505,7 @@
   return checkPseudoObjectAssignment(S, OpLoc, Opc, LHSExpr, RHSExpr);
 
 // Don't resolve overloads if the other type is overloadable.
-if (pty->getKind() == BuiltinType::Overload) {
+if (getLangOpts().CPlusPlus && pty->getKind() == BuiltinType::Overload) {
   // We can't actually test that if we still have a placeholder,
   // though.  Fortunately, none of the exceptions we see in that
   // code below are valid when the LHS is an overload set.  Note
@@ -11530,17 +11530,16 @@
 // An overload in the RHS can potentially be resolved by the type
 // being assigned to.
 if (Opc == BO_Assign && pty->getKind() == BuiltinType::Overload) {
-  if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent())
-return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr);
-
-  if (LHSExpr->getType()->isOverloadableType())
+  if (getLangOpts().CPlusPlus &&
+  (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent() ||
+   

r292497 - [Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode

2017-01-19 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Thu Jan 19 11:17:57 2017
New Revision: 292497

URL: http://llvm.org/viewvc/llvm-project?rev=292497=rev
Log:
[Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode

rdar://28532840

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

Added:
cfe/trunk/test/Sema/PR28181.c
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=292497=292496=292497=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jan 19 11:17:57 2017
@@ -11505,7 +11505,7 @@ ExprResult Sema::BuildBinOp(Scope *S, So
   return checkPseudoObjectAssignment(S, OpLoc, Opc, LHSExpr, RHSExpr);
 
 // Don't resolve overloads if the other type is overloadable.
-if (pty->getKind() == BuiltinType::Overload) {
+if (getLangOpts().CPlusPlus && pty->getKind() == BuiltinType::Overload) {
   // We can't actually test that if we still have a placeholder,
   // though.  Fortunately, none of the exceptions we see in that
   // code below are valid when the LHS is an overload set.  Note
@@ -11530,17 +11530,16 @@ ExprResult Sema::BuildBinOp(Scope *S, So
 // An overload in the RHS can potentially be resolved by the type
 // being assigned to.
 if (Opc == BO_Assign && pty->getKind() == BuiltinType::Overload) {
-  if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent())
-return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr);
-
-  if (LHSExpr->getType()->isOverloadableType())
+  if (getLangOpts().CPlusPlus &&
+  (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent() ||
+   LHSExpr->getType()->isOverloadableType()))
 return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr);
 
   return CreateBuiltinBinOp(OpLoc, Opc, LHSExpr, RHSExpr);
 }
 
 // Don't resolve overloads if the other type is overloadable.
-if (pty->getKind() == BuiltinType::Overload &&
+if (getLangOpts().CPlusPlus && pty->getKind() == BuiltinType::Overload &&
 LHSExpr->getType()->isOverloadableType())
   return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr);
 

Added: cfe/trunk/test/Sema/PR28181.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/PR28181.c?rev=292497=auto
==
--- cfe/trunk/test/Sema/PR28181.c (added)
+++ cfe/trunk/test/Sema/PR28181.c Thu Jan 19 11:17:57 2017
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct spinlock_t {
+  int lock;
+} audit_skb_queue;
+
+void fn1() {
+  audit_skb_queue = (lock); // expected-error {{use of undeclared identifier 
'lock'; did you mean 'long'?}}
+}   // expected-error@-1 {{assigning to 'struct 
spinlock_t' from incompatible type ''}}
+
+void fn2() {
+  audit_skb_queue + (lock); // expected-error {{use of undeclared identifier 
'lock'; did you mean 'long'?}}
+}   // expected-error@-1 {{reference to overloaded 
function could not be resolved; did you mean to call it?}}


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


[PATCH] D28902: [Sema] Reword unused lambda capture warning

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

LGTM!


https://reviews.llvm.org/D28902



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


Re: Commits to be merged for 4.0

2017-01-19 Thread Hans Wennborg via cfe-commits
On Tue, Jan 17, 2017 at 9:48 PM, Marshall Clow  wrote:
> One is for libc++abi: r292135

Merged in r292495.


> The other two are for libc++:
> r292276

Eric merged this one.

> r292091

Merged in r292494.

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


r292496 - [Hexagon] Linux linker does not support .gnu-hash

2017-01-19 Thread Sumanth Gundapaneni via cfe-commits
Author: sgundapa
Date: Thu Jan 19 10:54:04 2017
New Revision: 292496

URL: http://llvm.org/viewvc/llvm-project?rev=292496=rev
Log:
[Hexagon] Linux linker does not support .gnu-hash

Hexagon Linux dynamic loader does not use (in fact does not support)
.gnu-hash

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

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/linux-ld.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=292496=292495=292496=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Jan 19 10:54:04 2017
@@ -4122,6 +4122,7 @@ Linux::Linux(const Driver , const llvm
 
   const bool IsAndroid = Triple.isAndroid();
   const bool IsMips = isMipsArch(Arch);
+  const bool IsHexagon = Arch == llvm::Triple::hexagon;
 
   if (IsMips && !SysRoot.empty())
 ExtraOpts.push_back("--sysroot=" + SysRoot);
@@ -4131,7 +4132,8 @@ Linux::Linux(const Driver , const llvm
   // .gnu.hash needs symbols to be grouped by hash code whereas the MIPS
   // ABI requires a mapping between the GOT and the symbol table.
   // Android loader does not support .gnu.hash.
-  if (!IsMips && !IsAndroid) {
+  // Hexagon linker/loader does not support .gnu.hash
+  if (!IsMips && !IsAndroid && !IsHexagon) {
 if (Distro.IsRedhat() || Distro.IsOpenSUSE() ||
 (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick))
   ExtraOpts.push_back("--hash-style=gnu");

Modified: cfe/trunk/test/Driver/linux-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=292496=292495=292496=diff
==
--- cfe/trunk/test/Driver/linux-ld.c (original)
+++ cfe/trunk/test/Driver/linux-ld.c Thu Jan 19 10:54:04 2017
@@ -705,6 +705,14 @@
 // CHECK-PPC64LE-ELFv2: "-m" "elf64lppc"
 // CHECK-PPC64LE-ELFv2: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.2"
 //
+// Check that we do not pass --hash-style=gnu or --hash-style=both to
+// hexagon linux linker
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: --target=hexagon-linux-gnu \
+// RUN:   | FileCheck --check-prefix=CHECK-HEXAGON %s
+// CHECK-HEXAGON: "{{.*}}hexagon-link{{(.exe)?}}"
+// CHECK-HEXAGON-NOT: "--hash-style={{gnu|both}}"
+//
 // Check that we do not pass --hash-style=gnu and --hash-style=both to linker
 // and provide correct path to the dynamic linker and emulation mode when build
 // for MIPS platforms.


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


[libcxxabi] r292495 - Merging r292135:

2017-01-19 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu Jan 19 10:52:39 2017
New Revision: 292495

URL: http://llvm.org/viewvc/llvm-project?rev=292495=rev
Log:
Merging r292135:

r292135 | marshall | 2017-01-16 07:28:03 -0800 (Mon, 16 Jan 2017) | 1 line

Mark the dynamic-exception tests as unsupported under C++17, since it has no 
dynamic-exception specs. Also, remove a FIXME workaround from the config that 
allowed these tests to work under C++17. This addresses PR#31621.


Modified:
libcxxabi/branches/release_40/   (props changed)
libcxxabi/branches/release_40/test/libcxxabi/test/config.py
libcxxabi/branches/release_40/test/unwind_02.pass.cpp
libcxxabi/branches/release_40/test/unwind_03.pass.cpp
libcxxabi/branches/release_40/test/unwind_04.pass.cpp
libcxxabi/branches/release_40/test/unwind_05.pass.cpp

Propchange: libcxxabi/branches/release_40/
--
svn:mergeinfo = /libcxxabi/trunk:292135

Modified: libcxxabi/branches/release_40/test/libcxxabi/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/branches/release_40/test/libcxxabi/test/config.py?rev=292495=292494=292495=diff
==
--- libcxxabi/branches/release_40/test/libcxxabi/test/config.py (original)
+++ libcxxabi/branches/release_40/test/libcxxabi/test/config.py Thu Jan 19 
10:52:39 2017
@@ -55,10 +55,6 @@ class Configuration(LibcxxConfiguration)
 if not self.get_lit_bool('enable_threads', True):
 self.cxx.compile_flags += ['-D_LIBCXXABI_HAS_NO_THREADS']
 self.config.available_features.add('libcxxabi-no-threads')
-# FIXME: Fix the unwind_* tests that test dynamic exception
-# specifications so they work in C++17 (or always test in C++14).
-# Suppressing this warning is a temporary workaround.
-self.cxx.addWarningFlagIfSupported('-Wno-dynamic-exception-spec')
 super(Configuration, self).configure_compile_flags()
 
 def configure_compile_flags_header_includes(self):

Modified: libcxxabi/branches/release_40/test/unwind_02.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/branches/release_40/test/unwind_02.pass.cpp?rev=292495=292494=292495=diff
==
--- libcxxabi/branches/release_40/test/unwind_02.pass.cpp (original)
+++ libcxxabi/branches/release_40/test/unwind_02.pass.cpp Thu Jan 19 10:52:39 
2017
@@ -8,6 +8,7 @@
 
//===--===//
 
 // UNSUPPORTED: libcxxabi-no-exceptions
+// REQUIRES-ANY: c++98, c++03, c++11, c++14
 
 #include 
 

Modified: libcxxabi/branches/release_40/test/unwind_03.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/branches/release_40/test/unwind_03.pass.cpp?rev=292495=292494=292495=diff
==
--- libcxxabi/branches/release_40/test/unwind_03.pass.cpp (original)
+++ libcxxabi/branches/release_40/test/unwind_03.pass.cpp Thu Jan 19 10:52:39 
2017
@@ -8,6 +8,7 @@
 
//===--===//
 
 // UNSUPPORTED: libcxxabi-no-exceptions
+// REQUIRES-ANY: c++98, c++03, c++11, c++14
 
 #include 
 #include 

Modified: libcxxabi/branches/release_40/test/unwind_04.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/branches/release_40/test/unwind_04.pass.cpp?rev=292495=292494=292495=diff
==
--- libcxxabi/branches/release_40/test/unwind_04.pass.cpp (original)
+++ libcxxabi/branches/release_40/test/unwind_04.pass.cpp Thu Jan 19 10:52:39 
2017
@@ -8,6 +8,7 @@
 
//===--===//
 
 // UNSUPPORTED: libcxxabi-no-exceptions
+// REQUIRES-ANY: c++98, c++03, c++11, c++14
 
 #include 
 #include 

Modified: libcxxabi/branches/release_40/test/unwind_05.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/branches/release_40/test/unwind_05.pass.cpp?rev=292495=292494=292495=diff
==
--- libcxxabi/branches/release_40/test/unwind_05.pass.cpp (original)
+++ libcxxabi/branches/release_40/test/unwind_05.pass.cpp Thu Jan 19 10:52:39 
2017
@@ -8,6 +8,7 @@
 
//===--===//
 
 // UNSUPPORTED: libcxxabi-no-exceptions
+// REQUIRES-ANY: c++98, c++03, c++11, c++14
 
 #include 
 #include 


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


Re: [libcxx] r292091 - Implement the missing constexpr stuff in . Fixes PR#31645.

2017-01-19 Thread Hans Wennborg via cfe-commits
Merged to 4.0 in r292494 as requested.

On Sun, Jan 15, 2017 at 7:02 PM, Marshall Clow via cfe-commits
 wrote:
> Author: marshall
> Date: Sun Jan 15 21:02:10 2017
> New Revision: 292091
>
> URL: http://llvm.org/viewvc/llvm-project?rev=292091=rev
> Log:
> Implement the missing constexpr stuff in . Fixes PR#31645.
>
> Modified:
> libcxx/trunk/include/array
> libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp
> libcxx/trunk/test/std/containers/sequences/array/front_back.pass.cpp
> libcxx/trunk/test/std/containers/sequences/array/indexing.pass.cpp
>
> Modified: libcxx/trunk/include/array
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/array?rev=292091=292090=292091=diff
> ==
> --- libcxx/trunk/include/array (original)
> +++ libcxx/trunk/include/array Sun Jan 15 21:02:10 2017
> @@ -185,14 +185,17 @@ struct _LIBCPP_TEMPLATE_VIS array
>  _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
>
>  // element access:
> -_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n)
>  {return __elems_[__n];}
> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference 
> operator[](size_type __n) const {return __elems_[__n];}
> -reference at(size_type __n);
> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
> +reference operator[](size_type __n) {return __elems_[__n];}
> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
> +const_reference operator[](size_type __n) const {return __elems_[__n];}
> +
> +_LIBCPP_CONSTEXPR_AFTER_CXX14   reference at(size_type __n);
>  _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
>
> -_LIBCPP_INLINE_VISIBILITY reference front() {return 
> __elems_[0];}
> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference 
> front() {return __elems_[0];}
>  _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference 
> front() const {return __elems_[0];}
> -_LIBCPP_INLINE_VISIBILITY reference back()  {return 
> __elems_[_Size > 0 ? _Size-1 : 0];}
> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() 
>  {return __elems_[_Size > 0 ? _Size-1 : 0];}
>  _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference 
> back() const  {return __elems_[_Size > 0 ? _Size-1 : 0];}
>
>  _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
> @@ -202,6 +205,7 @@ struct _LIBCPP_TEMPLATE_VIS array
>  };
>
>  template 
> +_LIBCPP_CONSTEXPR_AFTER_CXX14
>  typename array<_Tp, _Size>::reference
>  array<_Tp, _Size>::at(size_type __n)
>  {
>
> Modified: libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp?rev=292091=292090=292091=diff
> ==
> --- libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp (original)
> +++ libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp Sun Jan 15 
> 21:02:10 2017
> @@ -23,6 +23,14 @@
>  // Disable the missing braces warning for this reason.
>  #include "disable_missing_braces_warning.h"
>
> +#if TEST_STD_VER > 14
> +constexpr bool check_idx( size_t idx, double val )
> +{
> +std::array arr = {1, 2, 3.5};
> +   return arr.at(idx) == val;
> +}
> +#endif
> +
>  int main()
>  {
>  {
> @@ -82,4 +90,11 @@ int main()
>  }
>  #endif
>
> +#if TEST_STD_VER > 14
> +{
> +static_assert (check_idx(0, 1), "");
> +static_assert (check_idx(1, 2), "");
> +static_assert (check_idx(2, 3.5), "");
> +}
> +#endif
>  }
>
> Modified: libcxx/trunk/test/std/containers/sequences/array/front_back.pass.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/front_back.pass.cpp?rev=292091=292090=292091=diff
> ==
> --- libcxx/trunk/test/std/containers/sequences/array/front_back.pass.cpp 
> (original)
> +++ libcxx/trunk/test/std/containers/sequences/array/front_back.pass.cpp Sun 
> Jan 15 21:02:10 2017
> @@ -9,10 +9,10 @@
>
>  // 
>
> -// reference front();
> -// reference back();
> +// reference front();   // constexpr in C++17
> +// reference back();// constexpr in C++17
>  // const_reference front(); // constexpr in C++14
> -// const_reference back(); // constexpr in C++14
> +// const_reference back();  // constexpr in C++14
>
>  #include 
>  #include 
> @@ -23,6 +23,20 @@
>  // Disable the missing braces warning for this reason.
>  #include "disable_missing_braces_warning.h"
>
> +#if TEST_STD_VER > 14
> +constexpr bool check_front( double val )
> +{
> +std::array arr = {1, 2, 3.5};
> +   return 

[libcxx] r292494 - Merging r292091:

2017-01-19 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu Jan 19 10:50:46 2017
New Revision: 292494

URL: http://llvm.org/viewvc/llvm-project?rev=292494=rev
Log:
Merging r292091:

r292091 | marshall | 2017-01-15 19:02:10 -0800 (Sun, 15 Jan 2017) | 1 line

Implement the missing constexpr stuff in . Fixes PR#31645.


Modified:
libcxx/branches/release_40/   (props changed)
libcxx/branches/release_40/include/array
libcxx/branches/release_40/test/std/containers/sequences/array/at.pass.cpp

libcxx/branches/release_40/test/std/containers/sequences/array/front_back.pass.cpp

libcxx/branches/release_40/test/std/containers/sequences/array/indexing.pass.cpp

Propchange: libcxx/branches/release_40/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 19 10:50:46 2017
@@ -1,2 +1,2 @@
 /libcxx/branches/apple:136569-137939
-/libcxx/trunk:292013
+/libcxx/trunk:292013,292091

Modified: libcxx/branches/release_40/include/array
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/include/array?rev=292494=292493=292494=diff
==
--- libcxx/branches/release_40/include/array (original)
+++ libcxx/branches/release_40/include/array Thu Jan 19 10:50:46 2017
@@ -185,14 +185,17 @@ struct _LIBCPP_TEMPLATE_VIS array
 _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
 
 // element access:
-_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) 
{return __elems_[__n];}
-_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference 
operator[](size_type __n) const {return __elems_[__n];}
-reference at(size_type __n);
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+reference operator[](size_type __n) {return __elems_[__n];}
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const_reference operator[](size_type __n) const {return __elems_[__n];}
+
+_LIBCPP_CONSTEXPR_AFTER_CXX14   reference at(size_type __n);
 _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
 
-_LIBCPP_INLINE_VISIBILITY reference front() {return 
__elems_[0];}
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front()  
   {return __elems_[0];}
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference 
front() const {return __elems_[0];}
-_LIBCPP_INLINE_VISIBILITY reference back()  {return 
__elems_[_Size > 0 ? _Size-1 : 0];}
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back()   
   {return __elems_[_Size > 0 ? _Size-1 : 0];}
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference 
back() const  {return __elems_[_Size > 0 ? _Size-1 : 0];}
 
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
@@ -202,6 +205,7 @@ struct _LIBCPP_TEMPLATE_VIS array
 };
 
 template 
+_LIBCPP_CONSTEXPR_AFTER_CXX14
 typename array<_Tp, _Size>::reference
 array<_Tp, _Size>::at(size_type __n)
 {

Modified: 
libcxx/branches/release_40/test/std/containers/sequences/array/at.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/test/std/containers/sequences/array/at.pass.cpp?rev=292494=292493=292494=diff
==
--- libcxx/branches/release_40/test/std/containers/sequences/array/at.pass.cpp 
(original)
+++ libcxx/branches/release_40/test/std/containers/sequences/array/at.pass.cpp 
Thu Jan 19 10:50:46 2017
@@ -23,6 +23,14 @@
 // Disable the missing braces warning for this reason.
 #include "disable_missing_braces_warning.h"
 
+#if TEST_STD_VER > 14
+constexpr bool check_idx( size_t idx, double val )
+{ 
+std::array arr = {1, 2, 3.5};
+   return arr.at(idx) == val;
+}
+#endif
+
 int main()
 {
 {
@@ -82,4 +90,11 @@ int main()
 }
 #endif
 
+#if TEST_STD_VER > 14
+{
+static_assert (check_idx(0, 1), "");
+static_assert (check_idx(1, 2), "");
+static_assert (check_idx(2, 3.5), "");
+}
+#endif
 }

Modified: 
libcxx/branches/release_40/test/std/containers/sequences/array/front_back.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/test/std/containers/sequences/array/front_back.pass.cpp?rev=292494=292493=292494=diff
==
--- 
libcxx/branches/release_40/test/std/containers/sequences/array/front_back.pass.cpp
 (original)
+++ 
libcxx/branches/release_40/test/std/containers/sequences/array/front_back.pass.cpp
 Thu Jan 19 10:50:46 2017
@@ -9,10 +9,10 @@
 
 // 
 
-// reference front();
-// reference back();
+// reference front();   // constexpr in C++17
+// reference back();// 

[PATCH] D28905: [analyzer] Consider function call arguments while building CallGraph

2017-01-19 Thread Ivan Sidorenko via Phabricator via cfe-commits
IvanSidorenko created this revision.

Function call can appear in the arguments of another function call. This patch 
adds support for such cases.


https://reviews.llvm.org/D28905

Files:
  lib/Analysis/CallGraph.cpp
  test/Analysis/debug-CallGraph.c


Index: test/Analysis/debug-CallGraph.c
===
--- test/Analysis/debug-CallGraph.c
+++ test/Analysis/debug-CallGraph.c
@@ -1,5 +1,17 @@
 // RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCallGraph %s -fblocks 
2>&1 | FileCheck %s
 
+int get5() {
+  return 5;
+}
+
+int add(int val1, int val2) {
+  return val1 + val2;
+}
+
+int test_add() {
+  return add(10, get5());
+}
+
 static void mmm(int y) {
   if (y != 0)
   y++;
@@ -32,7 +44,7 @@
 void fff() { eee(); }
 
 // CHECK:--- Call graph Dump ---
-// CHECK-NEXT: {{Function: < root > calls: mmm foo aaa < > bbb ccc ddd eee fff 
$}}
+// CHECK-NEXT: {{Function: < root > calls: get5 add test_add mmm foo aaa < > 
bbb ccc ddd eee fff $}}
 // CHECK-NEXT: {{Function: fff calls: eee $}}
 // CHECK-NEXT: {{Function: eee calls: $}}
 // CHECK-NEXT: {{Function: ddd calls: ccc $}}
@@ -42,3 +54,6 @@
 // CHECK-NEXT: {{Function: aaa calls: foo $}}
 // CHECK-NEXT: {{Function: foo calls: mmm $}}
 // CHECK-NEXT: {{Function: mmm calls: $}}
+// CHECK-NEXT: {{Function: test_add calls: add get5 $}}
+// CHECK-NEXT: {{Function: add calls: $}}
+// CHECK-NEXT: {{Function: get5 calls: $}}
Index: lib/Analysis/CallGraph.cpp
===
--- lib/Analysis/CallGraph.cpp
+++ lib/Analysis/CallGraph.cpp
@@ -62,6 +62,7 @@
   void VisitCallExpr(CallExpr *CE) {
 if (Decl *D = getDeclFromCall(CE))
   addCalledDecl(D);
+VisitChildren(CE);
   }
 
   // Adds may-call edges for the ObjC message sends.


Index: test/Analysis/debug-CallGraph.c
===
--- test/Analysis/debug-CallGraph.c
+++ test/Analysis/debug-CallGraph.c
@@ -1,5 +1,17 @@
 // RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCallGraph %s -fblocks 2>&1 | FileCheck %s
 
+int get5() {
+  return 5;
+}
+
+int add(int val1, int val2) {
+  return val1 + val2;
+}
+
+int test_add() {
+  return add(10, get5());
+}
+
 static void mmm(int y) {
   if (y != 0)
   y++;
@@ -32,7 +44,7 @@
 void fff() { eee(); }
 
 // CHECK:--- Call graph Dump ---
-// CHECK-NEXT: {{Function: < root > calls: mmm foo aaa < > bbb ccc ddd eee fff $}}
+// CHECK-NEXT: {{Function: < root > calls: get5 add test_add mmm foo aaa < > bbb ccc ddd eee fff $}}
 // CHECK-NEXT: {{Function: fff calls: eee $}}
 // CHECK-NEXT: {{Function: eee calls: $}}
 // CHECK-NEXT: {{Function: ddd calls: ccc $}}
@@ -42,3 +54,6 @@
 // CHECK-NEXT: {{Function: aaa calls: foo $}}
 // CHECK-NEXT: {{Function: foo calls: mmm $}}
 // CHECK-NEXT: {{Function: mmm calls: $}}
+// CHECK-NEXT: {{Function: test_add calls: add get5 $}}
+// CHECK-NEXT: {{Function: add calls: $}}
+// CHECK-NEXT: {{Function: get5 calls: $}}
Index: lib/Analysis/CallGraph.cpp
===
--- lib/Analysis/CallGraph.cpp
+++ lib/Analysis/CallGraph.cpp
@@ -62,6 +62,7 @@
   void VisitCallExpr(CallExpr *CE) {
 if (Decl *D = getDeclFromCall(CE))
   addCalledDecl(D);
+VisitChildren(CE);
   }
 
   // Adds may-call edges for the ObjC message sends.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20693: [clang-tidy] New checker to replace dynamic exception specifications

2017-01-19 Thread don hinton via Phabricator via cfe-commits
hintonda updated this revision to Diff 84975.
hintonda added a comment.

- Fix diagnostic when removing throwing specs.


https://reviews.llvm.org/D20693

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseNoexceptCheck.cpp
  clang-tidy/modernize/UseNoexceptCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-noexcept.rst
  test/clang-tidy/modernize-use-noexcept-macro.cpp
  test/clang-tidy/modernize-use-noexcept-opt.cpp
  test/clang-tidy/modernize-use-noexcept.cpp

Index: test/clang-tidy/modernize-use-noexcept.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept.cpp
@@ -0,0 +1,87 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -- -std=c++11
+
+class A {};
+class B {};
+
+void foo() throw();
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]
+// CHECK-FIXES: void foo() noexcept;
+
+void bar() throw(...);
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: dynamic exception specification 'throw(...)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]
+// CHECK-FIXES: void bar() noexcept(false);
+
+void k() throw(int(int));
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: dynamic exception specification 'throw(int(int))' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]
+// CHECK-FIXES: void k() noexcept(false);
+
+void foobar() throw(A, B)
+{}
+// CHECK-MESSAGES: :[[@LINE-2]]:15: warning: dynamic exception specification 'throw(A, B)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]
+// CHECK-FIXES: void foobar() noexcept(false)
+
+void baz(int = (throw A(), 0)) throw(A, B) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: dynamic exception specification 'throw(A, B)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]
+// CHECK-FIXES: void baz(int = (throw A(), 0)) noexcept(false) {}
+
+void g(void (*fp)(void) throw());
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]
+// CHECK-FIXES: void g(void (*fp)(void) noexcept);
+
+void f(void (*fp)(void) throw(int)) throw(char);
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: dynamic exception specification 'throw(int)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]
+// CHECK-MESSAGES: :[[@LINE-2]]:37: warning: dynamic exception specification 'throw(char)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]
+// CHECK-FIXES: void f(void (*fp)(void) noexcept(false)) noexcept(false);
+
+#define THROW throw
+void h(void (*fp)(void) THROW(int)) THROW(char);
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: dynamic exception specification 'THROW(int)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]
+// CHECK-MESSAGES: :[[@LINE-2]]:37: warning: dynamic exception specification 'THROW(char)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]
+// CHECK-FIXES: void h(void (*fp)(void) noexcept(false)) noexcept(false);
+
+void j() throw(int(int) throw(void(void) throw(int)));
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]
+// CHECK-FIXES: void j() noexcept(false);
+
+class Y {
+  Y() throw() = default;
+};
+// CHECK-MESSAGES: :[[@LINE-2]]:7: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]
+// CHECK-FIXES: Y() noexcept = default;
+
+struct Z {
+  void operator delete(void *ptr) throw();
+  void operator delete[](void *ptr) throw(int);
+  ~Z() throw(int) {}
+};
+// CHECK-MESSAGES: :[[@LINE-4]]:35: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]
+// CHECK-MESSAGES: :[[@LINE-4]]:37: warning: dynamic exception specification 'throw(int)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]
+// CHECK-MESSAGES: :[[@LINE-4]]:8: warning: dynamic exception specification 'throw(int)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]
+// CHECK-FIXES: void operator delete(void *ptr) noexcept;
+// CHECK-FIXES: void operator delete[](void *ptr) noexcept(false);
+// CHECK-FIXES: ~Z() noexcept(false) {}
+
+struct S {
+  void f() throw();
+};
+void f(void (S::*)() throw());
+// CHECK-MESSAGES: :[[@LINE-3]]:12: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]
+// CHECK-MESSAGES: 

[PATCH] D28899: [clang-tidy] Do not trigger move fix for non-copy assignment operators in performance-unnecessary-value-param check

2017-01-19 Thread Felix Berger via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL292491: [clang-tidy] Do not trigger move fix for non-copy 
assignment operators in… (authored by flx).

Changed prior to commit:
  https://reviews.llvm.org/D28899?vs=84960=84967#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28899

Files:
  clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp
  
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp


Index: clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp
===
--- clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp
+++ clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp
@@ -159,7 +159,8 @@
   parmVarDecl(hasType(matchers::isReferenceToConst(;
   auto Matches = match(
   decl(hasDescendant(
-  cxxOperatorCallExpr(UsedAsConstRefArg, 
hasOverloadedOperatorName("="))
+  cxxOperatorCallExpr(UsedAsConstRefArg, 
hasOverloadedOperatorName("="),
+  
callee(cxxMethodDecl(isCopyAssignmentOperator(
   .bind("operatorCallExpr"))),
   Decl, Context);
   return !Matches.empty();
Index: 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
+++ 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -247,6 +247,17 @@
   // CHECK-FIXES: F = std::move(E);
 }
 
+struct NotCopyAssigned {
+  NotCopyAssigned =(const ExpensiveMovableType &);
+};
+
+void PositiveNoMoveForNonCopyAssigmentOperator(ExpensiveMovableType E) {
+  // CHECK-MESSAGES: [[@LINE-1]]:69: warning: the parameter 'E' is copied
+  // CHECK-FIXES: void PositiveNoMoveForNonCopyAssigmentOperator(const 
ExpensiveMovableType& E) {
+  NotCopyAssigned N;
+  N = E;
+}
+
 // The argument could be moved but is not since copy statement is inside a 
loop.
 void PositiveNoMoveInsideLoop(ExpensiveMovableType E) {
   // CHECK-MESSAGES: [[@LINE-1]]:52: warning: the parameter 'E' is copied


Index: clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp
===
--- clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp
+++ clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp
@@ -159,7 +159,8 @@
   parmVarDecl(hasType(matchers::isReferenceToConst(;
   auto Matches = match(
   decl(hasDescendant(
-  cxxOperatorCallExpr(UsedAsConstRefArg, hasOverloadedOperatorName("="))
+  cxxOperatorCallExpr(UsedAsConstRefArg, hasOverloadedOperatorName("="),
+  callee(cxxMethodDecl(isCopyAssignmentOperator(
   .bind("operatorCallExpr"))),
   Decl, Context);
   return !Matches.empty();
Index: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -247,6 +247,17 @@
   // CHECK-FIXES: F = std::move(E);
 }
 
+struct NotCopyAssigned {
+  NotCopyAssigned =(const ExpensiveMovableType &);
+};
+
+void PositiveNoMoveForNonCopyAssigmentOperator(ExpensiveMovableType E) {
+  // CHECK-MESSAGES: [[@LINE-1]]:69: warning: the parameter 'E' is copied
+  // CHECK-FIXES: void PositiveNoMoveForNonCopyAssigmentOperator(const ExpensiveMovableType& E) {
+  NotCopyAssigned N;
+  N = E;
+}
+
 // The argument could be moved but is not since copy statement is inside a loop.
 void PositiveNoMoveInsideLoop(ExpensiveMovableType E) {
   // CHECK-MESSAGES: [[@LINE-1]]:52: warning: the parameter 'E' is copied
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r292491 - [clang-tidy] Do not trigger move fix for non-copy assignment operators in performance-unnecessary-value-param check

2017-01-19 Thread Felix Berger via cfe-commits
Author: flx
Date: Thu Jan 19 09:51:10 2017
New Revision: 292491

URL: http://llvm.org/viewvc/llvm-project?rev=292491=rev
Log:
[clang-tidy] Do not trigger move fix for non-copy assignment operators in 
performance-unnecessary-value-param check

Reviewers: alexfh, sbenza, malcolm.parsons

Subscribers: JDevlieghere, cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp

clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp

Modified: clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp?rev=292491=292490=292491=diff
==
--- clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp Thu Jan 19 
09:51:10 2017
@@ -159,7 +159,8 @@ bool isCopyAssignmentArgument(const Decl
   parmVarDecl(hasType(matchers::isReferenceToConst(;
   auto Matches = match(
   decl(hasDescendant(
-  cxxOperatorCallExpr(UsedAsConstRefArg, 
hasOverloadedOperatorName("="))
+  cxxOperatorCallExpr(UsedAsConstRefArg, 
hasOverloadedOperatorName("="),
+  
callee(cxxMethodDecl(isCopyAssignmentOperator(
   .bind("operatorCallExpr"))),
   Decl, Context);
   return !Matches.empty();

Modified: 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp?rev=292491=292490=292491=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp 
(original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp 
Thu Jan 19 09:51:10 2017
@@ -247,6 +247,17 @@ void PositiveMoveOnCopyAssignment(Expens
   // CHECK-FIXES: F = std::move(E);
 }
 
+struct NotCopyAssigned {
+  NotCopyAssigned =(const ExpensiveMovableType &);
+};
+
+void PositiveNoMoveForNonCopyAssigmentOperator(ExpensiveMovableType E) {
+  // CHECK-MESSAGES: [[@LINE-1]]:69: warning: the parameter 'E' is copied
+  // CHECK-FIXES: void PositiveNoMoveForNonCopyAssigmentOperator(const 
ExpensiveMovableType& E) {
+  NotCopyAssigned N;
+  N = E;
+}
+
 // The argument could be moved but is not since copy statement is inside a 
loop.
 void PositiveNoMoveInsideLoop(ExpensiveMovableType E) {
   // CHECK-MESSAGES: [[@LINE-1]]:52: warning: the parameter 'E' is copied


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


[PATCH] D28902: [Sema] Reword unused lambda capture warning

2017-01-19 Thread Malcolm Parsons via Phabricator via cfe-commits
malcolm.parsons created this revision.

The warning doesn't know why the variable was looked up but not
odr-used, so reword it to not claim that it was used in an unevaluated
context.


https://reviews.llvm.org/D28902

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  test/SemaCXX/warn-unused-lambda-capture.cpp


Index: test/SemaCXX/warn-unused-lambda-capture.cpp
===
--- test/SemaCXX/warn-unused-lambda-capture.cpp
+++ test/SemaCXX/warn-unused-lambda-capture.cpp
@@ -22,6 +22,7 @@
 
 void test() {
   int i = 0;
+  const int k = 0;
 
   auto captures_nothing = [] {};
 
@@ -34,8 +35,9 @@
   auto explicit_by_value_used = [i] { return i + 1; };
   auto explicit_by_value_used_void = [i] { (void)i; };
   auto explicit_by_value_unused = [i] {}; // expected-warning{{lambda capture 
'i' is not used}}
-  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for use in 
an unevaluated context}}
-  auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // 
expected-warning{{lambda capture 'i' is not required to be captured for use in 
an unevaluated context}}
+  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for this 
use}}
+  auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // 
expected-warning{{lambda capture 'i' is not required to be captured for this 
use}}
+  auto explicit_by_value_unused_const = [k] { return k + 1; }; // 
expected-warning{{lambda capture 'k' is not required to be captured for this 
use}}
 
   auto explicit_by_reference_used = [] { i++; };
   auto explicit_by_reference_unused = [] {}; // expected-warning{{lambda 
capture 'i' is not used}}
@@ -70,6 +72,7 @@
 template 
 void test_templated() {
   int i = 0;
+  const int k = 0;
 
   auto captures_nothing = [] {};
 
@@ -82,8 +85,9 @@
   auto explicit_by_value_used = [i] { return i + 1; };
   auto explicit_by_value_used_void = [i] { (void)i; };
   auto explicit_by_value_unused = [i] {}; // expected-warning{{lambda capture 
'i' is not used}}
-  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for use in 
an unevaluated context}}
+  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for this 
use}}
   auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // 
expected-warning{{lambda capture 'i' is not used}}
+  auto explicit_by_value_unused_const = [k] { return k + 1; }; // 
expected-warning{{lambda capture 'k' is not required to be captured for this 
use}}
 
   auto explicit_by_reference_used = [] { i++; };
   auto explicit_by_reference_unused = [] {}; // expected-warning{{lambda 
capture 'i' is not used}}
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -320,7 +320,7 @@
 def warn_unused_private_field: Warning<"private field %0 is not used">,
   InGroup, DefaultIgnore;
 def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
-  "%select{used|required to be captured for use in an unevaluated context}1">,
+  "%select{used|required to be captured for this use}1">,
   InGroup, DefaultIgnore;
 
 def warn_parameter_size: Warning<


Index: test/SemaCXX/warn-unused-lambda-capture.cpp
===
--- test/SemaCXX/warn-unused-lambda-capture.cpp
+++ test/SemaCXX/warn-unused-lambda-capture.cpp
@@ -22,6 +22,7 @@
 
 void test() {
   int i = 0;
+  const int k = 0;
 
   auto captures_nothing = [] {};
 
@@ -34,8 +35,9 @@
   auto explicit_by_value_used = [i] { return i + 1; };
   auto explicit_by_value_used_void = [i] { (void)i; };
   auto explicit_by_value_unused = [i] {}; // expected-warning{{lambda capture 'i' is not used}}
-  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // expected-warning{{lambda capture 'i' is not required to be captured for use in an unevaluated context}}
-  auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // expected-warning{{lambda capture 'i' is not required to be captured for use in an unevaluated context}}
+  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // expected-warning{{lambda capture 'i' is not required to be captured for this use}}
+  auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // expected-warning{{lambda capture 'i' is not required to be captured for this use}}
+  auto explicit_by_value_unused_const = [k] { return k + 1; }; // expected-warning{{lambda capture 'k' is not required to be captured for this use}}
 
   auto 

[libcxx] r292490 - Mark two of the TS implementations as 'in progress'

2017-01-19 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jan 19 09:30:36 2017
New Revision: 292490

URL: http://llvm.org/viewvc/llvm-project?rev=292490=rev
Log:
Mark two of the TS implementations as 'in progress'

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=292490=292489=292490=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu Jan 19 09:30:36 2017
@@ -80,8 +80,8 @@

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/P0220R1;>P0220R1LWGAdopt Library 
Fundamentals V1 TS Components for C++17JacksonvilleIn 
Progress
+   http://wg21.link/P0218R1;>P0218R1LWGAdopt the File 
System TS for C++17JacksonvilleIn Progress
http://wg21.link/P0033R1;>P0033R1LWGRe-enabling 
shared_from_thisJacksonvilleComplete3.9
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
@@ -417,7 +417,7 @@
 
   
 
-  Last Updated: 4-Jan-2017
+  Last Updated: 19-Jan-2017
 
 
 


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


[PATCH] D28862: [compiler-rt] [test] Use approximate comparison on float types

2017-01-19 Thread Steve Canon via Phabricator via cfe-commits
scanon added a comment.

These tests should either be exact, or should have a tolerance that's 
mathematically sound. +/-1ulp is not sound; the allowed error should be 
proportional to the magnitude of the larger of the real and imaginary 
components of the result -- e.g. if one component is very small compared to the 
other, the smaller one may have *no* "correct" bits and still be acceptable.


Repository:
  rL LLVM

https://reviews.llvm.org/D28862



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


[PATCH] D28899: [clang-tidy] Do not trigger move fix for non-copy assignment operators in performance-unnecessary-value-param check

2017-01-19 Thread Malcolm Parsons via Phabricator via cfe-commits
malcolm.parsons accepted this revision.
malcolm.parsons added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rL LLVM

https://reviews.llvm.org/D28899



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


[PATCH] D27710: [analyzer] Prohibit ExplodedGraph's edges duplicating

2017-01-19 Thread Ilya Palachev via Phabricator via cfe-commits
ilya-palachev added a comment.

Thanks for review!

> As Artem points out, the checkers in tree do not create a node for every bug 
> reported - there is no reason to do that.

Yes... But why does `generateNonFatalErrorNode` return `nullptr` in case when 
the node already exists? Isn't it designed so that to prevent multiple reports 
being thrown for the same node? If so, then the code contains a lot of such 
checks.

I don't understand why the following test passes, because each of two checkers: 
`MallocChecker` and `SimpleStreamChecker` are using `generateNonFatalErrorNode` 
method:

  // RUN: %clang_cc1 -analyze 
-analyzer-checker=unix.Malloc,alpha.unix.SimpleStream -analyzer-store region 
-verify %s
  
  typedef struct _IO_FILE FILE;
  extern FILE *fopen(const char *path, const char *mode);
  extern int fclose(FILE *fp);
  
  typedef __typeof(sizeof(int)) size_t;
  void *malloc(size_t);
  void free(void *);
  
  void test() {
void *p = malloc(1);
void *r = fopen("foo", "r");
if (r) {
  (void)(p - r);
  // expected-warning@-1{{Potential leak of memory}}
  // expected-warning@-2{{Opened file is never closed}}
}
else {
  fclose(r);
  free(p);
}
  }

Maybe it's possible to invent such a testcase when two checkers begin to 
conflict for the node. Or not?


Repository:
  rL LLVM

https://reviews.llvm.org/D27710



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


[PATCH] D27257: [CodeCompletion] Ensure that ObjC root class completes instance methods from protocols and categories as well

2017-01-19 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

ping


Repository:
  rL LLVM

https://reviews.llvm.org/D27257



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


Re: [PATCH] D28467: [Sema] Add warning for unused lambda captures

2017-01-19 Thread Aaron Ballman via cfe-commits
On Thu, Jan 19, 2017 at 8:45 AM, Malcolm Parsons
 wrote:
> On 19 January 2017 at 13:16, Aaron Ballman  wrote:
>> I wasn't thinking about that kind of odr-unuse when reviewing your
>> patch, so I am starting to think that perhaps it's not worth
>> distinguishing unevaluated contexts or not in the diagnostic. :-( If
>> we could do it, then great (we seem to be able to do it for regular
>> variable use: http://coliru.stacked-crooked.com/a/4bde9b5daf48956a),
>> but if not, then I think we should just go back to the original
>> wording that says it's not required to be captured (in all cases, not
>> distinguishing odr-use) and put in a FIXME with the test cases that
>> could have an improved diagnostic (including the test case talked
>> about here, which we should add). What do you think?
>
> The warning can distinguish:
> * not looked up
> * looked up
> * looked up and used
>
> It doesn't know why a variable was looked up but not used.

Drat, though I don't think this diagnostic warrants making changes to that.

>
> You suggested the wording "not required to be captured for this use"
> earlier in this thread; is that better?

Yes, I think that wording makes sense.

~Aaron

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


[PATCH] D28899: [clang-tidy] Do not trigger move fix for non-copy assignment operators in performance-unnecessary-value-param check

2017-01-19 Thread Felix Berger via Phabricator via cfe-commits
flx created this revision.
Herald added a subscriber: JDevlieghere.

Repository:
  rL LLVM

https://reviews.llvm.org/D28899

Files:
  clang-tidy/utils/DeclRefExprUtils.cpp
  test/clang-tidy/performance-unnecessary-value-param.cpp


Index: test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- test/clang-tidy/performance-unnecessary-value-param.cpp
+++ test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -247,6 +247,17 @@
   // CHECK-FIXES: F = std::move(E);
 }
 
+struct NotCopyAssigned {
+  NotCopyAssigned =(const ExpensiveMovableType &);
+};
+
+void PositiveNoMoveForNonCopyAssigmentOperator(ExpensiveMovableType E) {
+  // CHECK-MESSAGES: [[@LINE-1]]:69: warning: the parameter 'E' is copied
+  // CHECK-FIXES: void PositiveNoMoveForNonCopyAssigmentOperator(const 
ExpensiveMovableType& E) {
+  NotCopyAssigned N;
+  N = E;
+}
+
 // The argument could be moved but is not since copy statement is inside a 
loop.
 void PositiveNoMoveInsideLoop(ExpensiveMovableType E) {
   // CHECK-MESSAGES: [[@LINE-1]]:52: warning: the parameter 'E' is copied
Index: clang-tidy/utils/DeclRefExprUtils.cpp
===
--- clang-tidy/utils/DeclRefExprUtils.cpp
+++ clang-tidy/utils/DeclRefExprUtils.cpp
@@ -159,7 +159,8 @@
   parmVarDecl(hasType(matchers::isReferenceToConst(;
   auto Matches = match(
   decl(hasDescendant(
-  cxxOperatorCallExpr(UsedAsConstRefArg, 
hasOverloadedOperatorName("="))
+  cxxOperatorCallExpr(UsedAsConstRefArg, 
hasOverloadedOperatorName("="),
+  
callee(cxxMethodDecl(isCopyAssignmentOperator(
   .bind("operatorCallExpr"))),
   Decl, Context);
   return !Matches.empty();


Index: test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- test/clang-tidy/performance-unnecessary-value-param.cpp
+++ test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -247,6 +247,17 @@
   // CHECK-FIXES: F = std::move(E);
 }
 
+struct NotCopyAssigned {
+  NotCopyAssigned =(const ExpensiveMovableType &);
+};
+
+void PositiveNoMoveForNonCopyAssigmentOperator(ExpensiveMovableType E) {
+  // CHECK-MESSAGES: [[@LINE-1]]:69: warning: the parameter 'E' is copied
+  // CHECK-FIXES: void PositiveNoMoveForNonCopyAssigmentOperator(const ExpensiveMovableType& E) {
+  NotCopyAssigned N;
+  N = E;
+}
+
 // The argument could be moved but is not since copy statement is inside a loop.
 void PositiveNoMoveInsideLoop(ExpensiveMovableType E) {
   // CHECK-MESSAGES: [[@LINE-1]]:52: warning: the parameter 'E' is copied
Index: clang-tidy/utils/DeclRefExprUtils.cpp
===
--- clang-tidy/utils/DeclRefExprUtils.cpp
+++ clang-tidy/utils/DeclRefExprUtils.cpp
@@ -159,7 +159,8 @@
   parmVarDecl(hasType(matchers::isReferenceToConst(;
   auto Matches = match(
   decl(hasDescendant(
-  cxxOperatorCallExpr(UsedAsConstRefArg, hasOverloadedOperatorName("="))
+  cxxOperatorCallExpr(UsedAsConstRefArg, hasOverloadedOperatorName("="),
+  callee(cxxMethodDecl(isCopyAssignmentOperator(
   .bind("operatorCallExpr"))),
   Decl, Context);
   return !Matches.empty();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r292484 - [docs] Tell Doxygen to expand LLVM_ALIGNAS to nothing

2017-01-19 Thread Malcolm Parsons via cfe-commits
Author: malcolm.parsons
Date: Thu Jan 19 07:38:19 2017
New Revision: 292484

URL: http://llvm.org/viewvc/llvm-project?rev=292484=rev
Log:
[docs] Tell Doxygen to expand LLVM_ALIGNAS to nothing

Summary:
Docs for clang::Decl and clang::TemplateSpecializationType have
not been generated since LLVM_ALIGNAS was added to them.

Tell Doxygen to expand LLVM_ALIGNAS to nothing as described at
https://www.stack.nl/~dimitri/doxygen/manual/preprocessing.html

Reviewers: aaron.ballman, klimek, alexfh

Subscribers: ioeric, cfe-commits

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

Modified:
clang-tools-extra/trunk/docs/doxygen.cfg.in

Modified: clang-tools-extra/trunk/docs/doxygen.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/doxygen.cfg.in?rev=292484=292483=292484=diff
==
--- clang-tools-extra/trunk/docs/doxygen.cfg.in (original)
+++ clang-tools-extra/trunk/docs/doxygen.cfg.in Thu Jan 19 07:38:19 2017
@@ -1891,7 +1891,7 @@ ENABLE_PREPROCESSING   = YES
 # The default value is: NO.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-MACRO_EXPANSION= NO
+MACRO_EXPANSION= YES
 
 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
 # the macro expansion is limited to the macros specified with the PREDEFINED 
and
@@ -1899,7 +1899,7 @@ MACRO_EXPANSION= NO
 # The default value is: NO.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-EXPAND_ONLY_PREDEF = NO
+EXPAND_ONLY_PREDEF = YES
 
 # If the SEARCH_INCLUDES tag is set to YES the includes files in the
 # INCLUDE_PATH will be searched if a #include is found.
@@ -1932,7 +1932,7 @@ INCLUDE_FILE_PATTERNS  =
 # recursively expanded use the := operator instead of the = operator.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-PREDEFINED =
+PREDEFINED = LLVM_ALIGNAS(x)=
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
 # tag can be used to specify a list of macro names that should be expanded. The
@@ -1944,7 +1944,7 @@ PREDEFINED =
 EXPAND_AS_DEFINED  =
 
 # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor 
will
-# remove all refrences to function-like macros that are alone on a line, have 
an
+# remove all references to function-like macros that are alone on a line, have 
an
 # all uppercase name, and do not end with a semicolon. Such function macros are
 # typically used for boiler-plate code, and will confuse the parser if not
 # removed.


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


Re: [PATCH] D28467: [Sema] Add warning for unused lambda captures

2017-01-19 Thread Malcolm Parsons via cfe-commits
On 19 January 2017 at 13:16, Aaron Ballman  wrote:
> I wasn't thinking about that kind of odr-unuse when reviewing your
> patch, so I am starting to think that perhaps it's not worth
> distinguishing unevaluated contexts or not in the diagnostic. :-( If
> we could do it, then great (we seem to be able to do it for regular
> variable use: http://coliru.stacked-crooked.com/a/4bde9b5daf48956a),
> but if not, then I think we should just go back to the original
> wording that says it's not required to be captured (in all cases, not
> distinguishing odr-use) and put in a FIXME with the test cases that
> could have an improved diagnostic (including the test case talked
> about here, which we should add). What do you think?

The warning can distinguish:
* not looked up
* looked up
* looked up and used

It doesn't know why a variable was looked up but not used.

You suggested the wording "not required to be captured for this use"
earlier in this thread; is that better?

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


[PATCH] D28895: [clang-move] Also move using decls which are defined in header file.

2017-01-19 Thread Eric Liu via Phabricator via cfe-commits
ioeric requested changes to this revision.
ioeric added a comment.
This revision now requires changes to proceed.

Per offline discussion, this change is not intact - we want using decls in 
headers to be moveable symbols as well since it can have references outside of 
the local TU.


https://reviews.llvm.org/D28895



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


Re: [PATCH] D28467: [Sema] Add warning for unused lambda captures

2017-01-19 Thread Aaron Ballman via cfe-commits
On Thu, Jan 19, 2017 at 7:49 AM, Aaron Ballman  wrote:
> On Thu, Jan 19, 2017 at 4:37 AM, Malcolm Parsons
>  wrote:
>> On 19 January 2017 at 03:47, Aaron Ballman  wrote:
>>> It is not used in an unevaluated context -- that is a bug.
>>
>> It is an evaluated expression, but is it odr-used?
>>
>> C++14 [basic.def.odr] p3:
>>
>> A variable x whose name appears as a potentially-evaluated expression
>> ex is odr-used by ex unless applying the lvalue-to-rvalue conversion
>> (4.1) to x yields a constant expression (5.20) that does not invoke
>> any nontrivial functions and, if x is an object, ex is an element of
>> the set of potential results of an expression e, where either the
>> lvalue-to-rvalue conversion (4.1) is applied to e, or e is a
>> discarded-value expression (Clause 5). ...
>>
>> 5.20 [expr.const] p3:
>>
>> An integral constant expression is an expression of integral or
>> unscoped enumeration type, implicitly converted to a prvalue, where
>> the converted expression is a core constant expression. [ Note: Such
>> expressions may be used as array bounds (8.3.4, 5.3.4), as bit-field
>> lengths (9.6), as enumerator initializers if the underlying type is
>> not fixed (7.2), and as alignments (7.6.2). — end note ]
>>
>> I read that as kDelta is not odr-used.
>>
>> GCC and ICC don't require kDelta to be captured either.
>
> You are correct, it is not an odr use. MSVC is wrong to require the capture.

I wasn't thinking about that kind of odr-unuse when reviewing your
patch, so I am starting to think that perhaps it's not worth
distinguishing unevaluated contexts or not in the diagnostic. :-( If
we could do it, then great (we seem to be able to do it for regular
variable use: http://coliru.stacked-crooked.com/a/4bde9b5daf48956a),
but if not, then I think we should just go back to the original
wording that says it's not required to be captured (in all cases, not
distinguishing odr-use) and put in a FIXME with the test cases that
could have an improved diagnostic (including the test case talked
about here, which we should add). What do you think?

~Aaron

>
> ~Aaron
>
>>
>> --
>> Malcolm Parsons
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D28467: [Sema] Add warning for unused lambda captures

2017-01-19 Thread Malcolm Parsons via cfe-commits
On 19 January 2017 at 12:49, Aaron Ballman  wrote:
> You are correct, it is not an odr use. MSVC is wrong to require the capture.

Should the warning be rephrased?

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


PATCH: re-enable OpenCL extensions

2017-01-19 Thread Kalle Raiskila via cfe-commits

Hi,

I noticed a change from clang 3.8 to 3.9, that it disabled all OpenCL extension 
pragmas per default.
This broke pocl on e.g. ARM for LLVM 3.9 
(https://github.com/pocl/pocl/issues/409).

Example:
$ echo "#pragma OPENCL EXTENSION cl_khr_icd: enable" > hello.cl
$ clang  -emit-llvm -x cl -o tmp.bc -c hello.cl

works fine, but:
$ clang  -emit-llvm -x cl -o tmp.bc -c hello.cl 
--target=armv7-unknown-linux-gnueabihf
hello.cl:1:26: warning: unsupported OpenCL extension 'cl_khr_icd' - ignoring 
[-Wignored-pragmas]
#pragma OPENCL EXTENSION cl_khr_icd: enable
  ^
1 warning generated.


Attached is a patch that enables OpenCL extensions for all targets per default, 
and then sets the
status quo of supported extensions for those targets that currently customize 
their settings (i.e.
NVPTX and AMDGPU).
Most generic CPUs can handle all OpenCL extensions just fine.

Please keep me as CC, I am not subscribed to the list.
thanks,
kalle

diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index 208f8e8..8b5c38e 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -1008,7 +1008,9 @@ public:
   virtual bool allowsLargerPreferedTypeAlignment() const { return true; }
 
   /// \brief Set supported OpenCL extensions and optional core features.
-  virtual void setSupportedOpenCLOpts() {}
+  virtual void setSupportedOpenCLOpts() {
+getSupportedOpenCLOpts().supportAll();
+  }
 
   /// \brief Set supported OpenCL extensions as written on command line
   virtual void setOpenCLExtensionOpts() {
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 89e3f3e..212ab99 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -1951,6 +1951,7 @@ public:
   }
   void setSupportedOpenCLOpts() override {
 auto  = getSupportedOpenCLOpts();
+Opts.supportAll(false);
 Opts.support("cl_clang_storage_class_specifiers");
 Opts.support("cl_khr_gl_sharing");
 Opts.support("cl_khr_icd");
@@ -2220,6 +2221,7 @@ public:
 
   void setSupportedOpenCLOpts() override {
 auto  = getSupportedOpenCLOpts();
+Opts.supportAll(false);
 Opts.support("cl_clang_storage_class_specifiers");
 Opts.support("cl_khr_icd");
 
@@ -2984,10 +2986,6 @@ public:
   bool hasSjLjLowering() const override {
 return true;
   }
-
-  void setSupportedOpenCLOpts() override {
-getSupportedOpenCLOpts().supportAll();
-  }
 };
 
 bool X86TargetInfo::setFPMath(StringRef Name) {
@@ -8270,12 +8268,6 @@ public:
   CallingConv getDefaultCallingConv(CallingConvMethodType MT) const override {
 return CC_SpirFunction;
   }
-
-  void setSupportedOpenCLOpts() override {
-// Assume all OpenCL extensions and optional core features are supported
-// for SPIR since it is a generic target.
-getSupportedOpenCLOpts().supportAll();
-  }
 };
 
 class SPIR32TargetInfo : public SPIRTargetInfo {

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


Re: [PATCH] D28467: [Sema] Add warning for unused lambda captures

2017-01-19 Thread Aaron Ballman via cfe-commits
On Thu, Jan 19, 2017 at 4:37 AM, Malcolm Parsons
 wrote:
> On 19 January 2017 at 03:47, Aaron Ballman  wrote:
>> It is not used in an unevaluated context -- that is a bug.
>
> It is an evaluated expression, but is it odr-used?
>
> C++14 [basic.def.odr] p3:
>
> A variable x whose name appears as a potentially-evaluated expression
> ex is odr-used by ex unless applying the lvalue-to-rvalue conversion
> (4.1) to x yields a constant expression (5.20) that does not invoke
> any nontrivial functions and, if x is an object, ex is an element of
> the set of potential results of an expression e, where either the
> lvalue-to-rvalue conversion (4.1) is applied to e, or e is a
> discarded-value expression (Clause 5). ...
>
> 5.20 [expr.const] p3:
>
> An integral constant expression is an expression of integral or
> unscoped enumeration type, implicitly converted to a prvalue, where
> the converted expression is a core constant expression. [ Note: Such
> expressions may be used as array bounds (8.3.4, 5.3.4), as bit-field
> lengths (9.6), as enumerator initializers if the underlying type is
> not fixed (7.2), and as alignments (7.6.2). — end note ]
>
> I read that as kDelta is not odr-used.
>
> GCC and ICC don't require kDelta to be captured either.

You are correct, it is not an odr use. MSVC is wrong to require the capture.

~Aaron

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


[PATCH] D28895: [clang-move] Also move using decls which are defined in header file.

2017-01-19 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.

https://reviews.llvm.org/D28895

Files:
  clang-move/ClangMove.cpp
  test/clang-move/Inputs/multiple_class_test.h
  test/clang-move/move-multiple-classes.cpp

Index: test/clang-move/move-multiple-classes.cpp
===
--- test/clang-move/move-multiple-classes.cpp
+++ test/clang-move/move-multiple-classes.cpp
@@ -11,94 +11,128 @@
 // CHECK-EMPTY: [{{[[:space:]]*}}]
 //
 // CHECK-OLD-TEST-H: namespace c {
-// CHECK-OLD-TEST-H: class NoMove {
-// CHECK-OLD-TEST-H: public:
-// CHECK-OLD-TEST-H:   int f();
-// CHECK-OLD-TEST-H: };
-// CHECK-OLD-TEST-H: } // namespace c
+// CHECK-OLD-TEST-H-NEXT: using a::Move1;
+// CHECK-OLD-TEST-H-NEXT: using namespace a;
+// CHECK-OLD-TEST-H-SAME: {{[[:space:]]}}
+// CHECK-OLD-TEST-H-NEXT: class NoMove {
+// CHECK-OLD-TEST-H-NEXT: public:
+// CHECK-OLD-TEST-H-NEXT:   int f();
+// CHECK-OLD-TEST-H-NEXT: };
+// CHECK-OLD-TEST-H-NEXT: } // namespace c
 
 // CHECK-OLD-TEST-CPP: #include "{{.*}}multiple_class_test.h"
-// CHECK-OLD-TEST-CPP: using a::Move1;
-// CHECK-OLD-TEST-CPP: using namespace a;
-// CHECK-OLD-TEST-CPP: using A = a::Move1;
-// CHECK-OLD-TEST-CPP: static int g = 0;
-// CHECK-OLD-TEST-CPP: namespace {
-// CHECK-OLD-TEST-CPP: using a::Move1;
-// CHECK-OLD-TEST-CPP: using namespace a;
-// CHECK-OLD-TEST-CPP: } // namespace
-// CHECK-OLD-TEST-CPP: namespace b {
-// CHECK-OLD-TEST-CPP: using a::Move1;
-// CHECK-OLD-TEST-CPP: using namespace a;
-// CHECK-OLD-TEST-CPP: using T = a::Move1;
-// CHECK-OLD-TEST-CPP: } // namespace b
-// CHECK-OLD-TEST-CPP: namespace c {
-// CHECK-OLD-TEST-CPP: int NoMove::f() {
-// CHECK-OLD-TEST-CPP:   static int F = 0;
-// CHECK-OLD-TEST-CPP:   return g;
-// CHECK-OLD-TEST-CPP: }
-// CHECK-OLD-TEST-CPP: } // namespace c
+// CHECK-OLD-TEST-CPP-SAME: {{[[:space:]]}}
+// CHECK-OLD-TEST-CPP-NEXT: using a::Move1;
+// CHECK-OLD-TEST-CPP-NEXT: using namespace a;
+// CHECK-OLD-TEST-CPP-NEXT: using A = a::Move1;
+// CHECK-OLD-TEST-CPP-NEXT: static int g = 0;
+// CHECK-OLD-TEST-CPP-SAME: {{[[:space:]]}}
+// CHECK-OLD-TEST-CPP-NEXT: namespace {
+// CHECK-OLD-TEST-CPP-NEXT: using a::Move1;
+// CHECK-OLD-TEST-CPP-NEXT: using namespace a;
+// CHECK-OLD-TEST-CPP-NEXT: } // namespace
+// CHECK-OLD-TEST-CPP-SAME: {{[[:space:]]}}
+// CHECK-OLD-TEST-CPP-NEXT: namespace b {
+// CHECK-OLD-TEST-CPP-NEXT: using a::Move1;
+// CHECK-OLD-TEST-CPP-NEXT: using namespace a;
+// CHECK-OLD-TEST-CPP-NEXT: using T = a::Move1;
+// CHECK-OLD-TEST-CPP-NEXT: } // namespace b
+// CHECK-OLD-TEST-CPP-SAME: {{[[:space:]]}}
+// CHECK-OLD-TEST-CPP-NEXT: namespace c {
+// CHECK-OLD-TEST-CPP-SAME: {{[[:space:]]}}
+// CHECK-OLD-TEST-CPP-NEXT: int NoMove::f() {
+// CHECK-OLD-TEST-CPP-NEXT:   static int F = 0;
+// CHECK-OLD-TEST-CPP-NEXT:   return g;
+// CHECK-OLD-TEST-CPP-NEXT: }
+// CHECK-OLD-TEST-CPP-NEXT: } // namespace c
 
 // CHECK-NEW-TEST-H: #ifndef {{.*}}NEW_MULTIPLE_CLASS_TEST_H
-// CHECK-NEW-TEST-H: #define {{.*}}NEW_MULTIPLE_CLASS_TEST_H
-// CHECK-NEW-TEST-H: namespace a {
-// CHECK-NEW-TEST-H: class Move1 {
-// CHECK-NEW-TEST-H: public:
-// CHECK-NEW-TEST-H:   int f();
-// CHECK-NEW-TEST-H: };
-// CHECK-NEW-TEST-H: } // namespace a
-// CHECK-NEW-TEST-H: namespace b {
-// CHECK-NEW-TEST-H: class Move2 {
-// CHECK-NEW-TEST-H: public:
-// CHECK-NEW-TEST-H:   int f();
-// CHECK-NEW-TEST-H: };
-// CHECK-NEW-TEST-H: } // namespace b
-// CHECK-NEW-TEST-H: namespace c {
-// CHECK-NEW-TEST-H: class Move3 {
-// CHECK-NEW-TEST-H: public:
-// CHECK-NEW-TEST-H:   int f();
-// CHECK-NEW-TEST-H: };
-// CHECK-NEW-TEST-H: class Move4 {
-// CHECK-NEW-TEST-H: public:
-// CHECK-NEW-TEST-H:   int f();
-// CHECK-NEW-TEST-H: };
-// CHECK-NEW-TEST-H: class EnclosingMove5 {
-// CHECK-NEW-TEST-H: public:
-// CHECK-NEW-TEST-H:   class Nested {
-// CHECK-NEW-TEST-H: int f();
-// CHECK-NEW-TEST-H: static int b;
-// CHECK-NEW-TEST-H:   };
-// CHECK-NEW-TEST-H:   static int a;
-// CHECK-NEW-TEST-H: };
-// CHECK-NEW-TEST-H: } // namespace c
+// CHECK-NEW-TEST-H-NEXT: #define {{.*}}NEW_MULTIPLE_CLASS_TEST_H
+// CHECK-NEW-TEST-H-SAME: {{[[:space:]]}}
+// CHECK-NEW-TEST-H-NEXT: namespace a {
+// CHECK-NEW-TEST-H-NEXT: class Move1 {
+// CHECK-NEW-TEST-H-NEXT: public:
+// CHECK-NEW-TEST-H-NEXT:   int f();
+// CHECK-NEW-TEST-H-NEXT: };
+// CHECK-NEW-TEST-H-NEXT: } // namespace a
+// CHECK-NEW-TEST-H-SAME: {{[[:space:]]}}
+// CHECK-NEW-TEST-H-NEXT: namespace b {
+// CHECK-NEW-TEST-H-NEXT: class Move2 {
+// CHECK-NEW-TEST-H-NEXT: public:
+// CHECK-NEW-TEST-H-NEXT:   int f();
+// CHECK-NEW-TEST-H-NEXT: };
+// CHECK-NEW-TEST-H-NEXT: } // namespace b
+// CHECK-NEW-TEST-H-SAME: {{[[:space:]]}}
+// CHECK-NEW-TEST-H-NEXT: namespace c {
+// CHECK-NEW-TEST-H-NEXT: using a::Move1;
+// CHECK-NEW-TEST-H-SAME: {{[[:space:]]}}
+// CHECK-NEW-TEST-H-NEXT: using namespace a;
+// CHECK-NEW-TEST-H-SAME: {{[[:space:]]}}
+// CHECK-NEW-TEST-H-NEXT: class Move3 {
+// CHECK-NEW-TEST-H-NEXT: public:
+// CHECK-NEW-TEST-H-NEXT:   int f();

r292477 - [docs] Tell Doxygen to expand LLVM_ALIGNAS to nothing

2017-01-19 Thread Malcolm Parsons via cfe-commits
Author: malcolm.parsons
Date: Thu Jan 19 03:27:45 2017
New Revision: 292477

URL: http://llvm.org/viewvc/llvm-project?rev=292477=rev
Log:
[docs] Tell Doxygen to expand LLVM_ALIGNAS to nothing

Summary:
Docs for clang::Decl and clang::TemplateSpecializationType have
not been generated since LLVM_ALIGNAS was added to them.

Tell Doxygen to expand LLVM_ALIGNAS to nothing as described at
https://www.stack.nl/~dimitri/doxygen/manual/preprocessing.html

Reviewers: aaron.ballman, klimek, alexfh

Subscribers: ioeric, cfe-commits

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

Modified:
cfe/trunk/docs/doxygen.cfg.in

Modified: cfe/trunk/docs/doxygen.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/doxygen.cfg.in?rev=292477=292476=292477=diff
==
--- cfe/trunk/docs/doxygen.cfg.in (original)
+++ cfe/trunk/docs/doxygen.cfg.in Thu Jan 19 03:27:45 2017
@@ -1885,7 +1885,7 @@ ENABLE_PREPROCESSING   = YES
 # The default value is: NO.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-MACRO_EXPANSION= NO
+MACRO_EXPANSION= YES
 
 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
 # the macro expansion is limited to the macros specified with the PREDEFINED 
and
@@ -1893,7 +1893,7 @@ MACRO_EXPANSION= NO
 # The default value is: NO.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-EXPAND_ONLY_PREDEF = NO
+EXPAND_ONLY_PREDEF = YES
 
 # If the SEARCH_INCLUDES tag is set to YES the includes files in the
 # INCLUDE_PATH will be searched if a #include is found.
@@ -1925,7 +1925,7 @@ INCLUDE_FILE_PATTERNS  =
 # recursively expanded use the := operator instead of the = operator.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-PREDEFINED =
+PREDEFINED = LLVM_ALIGNAS(x)=
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
 # tag can be used to specify a list of macro names that should be expanded. The


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


[PATCH] D28850: [docs] Tell Doxygen to expand LLVM_ALIGNAS to nothing

2017-01-19 Thread Malcolm Parsons via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL292477: [docs] Tell Doxygen to expand LLVM_ALIGNAS to 
nothing (authored by malcolm.parsons).

Changed prior to commit:
  https://reviews.llvm.org/D28850?vs=84812=84950#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28850

Files:
  cfe/trunk/docs/doxygen.cfg.in


Index: cfe/trunk/docs/doxygen.cfg.in
===
--- cfe/trunk/docs/doxygen.cfg.in
+++ cfe/trunk/docs/doxygen.cfg.in
@@ -1885,15 +1885,15 @@
 # The default value is: NO.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-MACRO_EXPANSION= NO
+MACRO_EXPANSION= YES
 
 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
 # the macro expansion is limited to the macros specified with the PREDEFINED 
and
 # EXPAND_AS_DEFINED tags.
 # The default value is: NO.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-EXPAND_ONLY_PREDEF = NO
+EXPAND_ONLY_PREDEF = YES
 
 # If the SEARCH_INCLUDES tag is set to YES the includes files in the
 # INCLUDE_PATH will be searched if a #include is found.
@@ -1925,7 +1925,7 @@
 # recursively expanded use the := operator instead of the = operator.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-PREDEFINED =
+PREDEFINED = LLVM_ALIGNAS(x)=
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
 # tag can be used to specify a list of macro names that should be expanded. The


Index: cfe/trunk/docs/doxygen.cfg.in
===
--- cfe/trunk/docs/doxygen.cfg.in
+++ cfe/trunk/docs/doxygen.cfg.in
@@ -1885,15 +1885,15 @@
 # The default value is: NO.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-MACRO_EXPANSION= NO
+MACRO_EXPANSION= YES
 
 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
 # the macro expansion is limited to the macros specified with the PREDEFINED and
 # EXPAND_AS_DEFINED tags.
 # The default value is: NO.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-EXPAND_ONLY_PREDEF = NO
+EXPAND_ONLY_PREDEF = YES
 
 # If the SEARCH_INCLUDES tag is set to YES the includes files in the
 # INCLUDE_PATH will be searched if a #include is found.
@@ -1925,7 +1925,7 @@
 # recursively expanded use the := operator instead of the = operator.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-PREDEFINED =
+PREDEFINED = LLVM_ALIGNAS(x)=
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
 # tag can be used to specify a list of macro names that should be expanded. The
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >