[PATCH] D42844: [OpenCL] Add test for atomic pointers.

2018-02-11 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon added a comment.

Yes, we don't have anything OpenCL specific for atomic pointers. 
But we have OpenCL specific in pointers and atomics separately and we have 
address spaces.
Why not to test all at once?


Repository:
  rC Clang

https://reviews.llvm.org/D42844



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


[PATCH] D41553: Support parsing double square-bracket attributes in ObjC

2018-02-11 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

No, this LGTM.


https://reviews.llvm.org/D41553



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


[PATCH] D43105: [RISCV] Enable __int128_t and uint128_t through clang flag

2018-02-11 Thread Kito Cheng via Phabricator via cfe-commits
kito-cheng added inline comments.



Comment at: lib/Basic/Targets/RISCV.h:85
+  bool hasInt128Type(const LangOptions &Opts) const override {
+return Opts.UseInt128;
+  }

efriedma wrote:
> Maybe make this a cross-platform flag, rather than riscv-specific?
+1, then we can make all other 32 bits target to able easier support float128 
too :)


Repository:
  rC Clang

https://reviews.llvm.org/D43105



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


[PATCH] D43105: [RISCV] Enable __int128_t and uint128_t through clang flag

2018-02-11 Thread Kito Cheng via Phabricator via cfe-commits
kito-cheng added a comment.

Hi Eli:

> but you want to make int128_t opt-in to avoid the possibility of someone 
> getting a link error trying to link code built with clang against libgcc.a?

Yes, that's the problem we want to avoid, and we actually get the problem if we 
built libc (newlib) with clang/llvm and used by GCC.


Repository:
  rC Clang

https://reviews.llvm.org/D43105



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


[PATCH] D43108: Support for the mno-stack-arg-probe flag

2018-02-11 Thread Ruslan Nikolaev via Phabricator via cfe-commits
nruslan added a comment.

@craig.topper, @MatzeB, @hans: Can someone take a look at this change?


Repository:
  rC Clang

https://reviews.llvm.org/D43108



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


[PATCH] D43159: Modernize: Use nullptr more.

2018-02-11 Thread Dimitry Andric via Phabricator via cfe-commits
dim added a comment.

In https://reviews.llvm.org/D43159#1004625, @EricWF wrote:

> So my main concern with this patch is that `nullptr` is actually  
> `#defined`'ed in C++03 mode. That definition comes from the `__nullptr` 
> header, and therefore we would need to add that header to each include which 
> uses it. Which kind of sucks.


Indeed, but isn't `nullptr` used in many headers already?  And as far as I can 
see, none of those includes <__nullptr> explicitly, so the definition must come 
from some transitive include.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43159



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


[PATCH] D43166: Add default C++ ABI libname and include paths for FreeBSD

2018-02-11 Thread Dimitry Andric via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL324855: Add default C++ ABI libname and include paths for 
FreeBSD (authored by dim, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D43166

Files:
  libcxx/trunk/CMakeLists.txt


Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -136,6 +136,9 @@
   elseif (APPLE)
 set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
 set(LIBCXX_CXX_ABI_SYSTEM 1)
+  elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+set(LIBCXX_CXX_ABI_LIBNAME "libcxxrt")
+set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
   else()
 set(LIBCXX_CXX_ABI_LIBNAME "default")
   endif()


Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -136,6 +136,9 @@
   elseif (APPLE)
 set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
 set(LIBCXX_CXX_ABI_SYSTEM 1)
+  elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+set(LIBCXX_CXX_ABI_LIBNAME "libcxxrt")
+set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
   else()
 set(LIBCXX_CXX_ABI_LIBNAME "default")
   endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324855 - Add default C++ ABI libname and include paths for FreeBSD

2018-02-11 Thread Dimitry Andric via cfe-commits
Author: dim
Date: Sun Feb 11 14:31:05 2018
New Revision: 324855

URL: http://llvm.org/viewvc/llvm-project?rev=324855&view=rev
Log:
Add default C++ ABI libname and include paths for FreeBSD

Summary:
As noted in a discussion about testing the LLVM 6.0.0 release candidates
(with libc++) for FreeBSD, many tests turned out to fail with
"exception_ptr not yet implemented".  This was because libc++ did not
choose the correct C++ ABI library, and therefore it fell back to the
`exception_fallback.ipp` header.

Since FreeBSD 10.x, we have been using libcxxrt as our C++ ABI library,
and its headers have always been installed in /usr/include/c++/v1,
together with the (system) libc++ headers.  (Older versions of FreeBSD
used GNU libsupc++ by default, but these are now unsupported.)

Therefore, if we are building libc++ for FreeBSD, set:
* `LIBCXX_CXX_ABI_LIBNAME` to "libcxxrt"
* `LIBCXX_CXX_ABI_INCLUDE_PATHS` to "/usr/include/c++/v1"
by default.

Reviewers: emaste, EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: mgorny, cfe-commits, krytarowski

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

Modified:
libcxx/trunk/CMakeLists.txt

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=324855&r1=324854&r2=324855&view=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Sun Feb 11 14:31:05 2018
@@ -136,6 +136,9 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
   elseif (APPLE)
 set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
 set(LIBCXX_CXX_ABI_SYSTEM 1)
+  elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+set(LIBCXX_CXX_ABI_LIBNAME "libcxxrt")
+set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
   else()
 set(LIBCXX_CXX_ABI_LIBNAME "default")
   endif()


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


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

2018-02-11 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF closed this revision.
EricWF added a comment.

Committed as r324853.


Repository:
  rCXX libc++

https://reviews.llvm.org/D42354



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


[libcxx] r324853 - Fix libcxx MSVC C++17 redefinition of 'align_val_t'

2018-02-11 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sun Feb 11 14:00:19 2018
New Revision: 324853

URL: http://llvm.org/viewvc/llvm-project?rev=324853&view=rev
Log:
Fix libcxx MSVC C++17 redefinition of 'align_val_t'

Patch from  charli...@outlook.com

Reviewed as https://reviews.llvm.org/D42354

When the following command is used:

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

An error occurred:

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

This patch fixes that error.

Modified:
libcxx/trunk/include/new

Modified: libcxx/trunk/include/new
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=324853&r1=324852&r2=324853&view=diff
==
--- libcxx/trunk/include/new (original)
+++ libcxx/trunk/include/new Sun Feb 11 14:00:19 2018
@@ -160,6 +160,7 @@ public:
 
 #endif  // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
 
+#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME)
 #if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14
 #ifndef _LIBCPP_CXX03_LANG
 enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
@@ -167,6 +168,7 @@ enum class _LIBCPP_ENUM_VIS align_val_t
 enum align_val_t { __zero = 0, __max = (size_t)-1 };
 #endif
 #endif
+#endif
 
 }  // std
 


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


[libcxx] r324852 - Mark two issues as complete

2018-02-11 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sun Feb 11 13:57:25 2018
New Revision: 324852

URL: http://llvm.org/viewvc/llvm-project?rev=324852&view=rev
Log:
Mark two issues as complete

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=324852&r1=324851&r2=324852&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Sun Feb 11 13:57:25 2018
@@ -98,9 +98,9 @@
 
 Issue #Issue NameMeetingStatus
 https://wg21.link/LWG2412";>2412promise::set_value() 
and promise::get_future() should not 
raceJacksonvilleComplete
-https://wg21.link/LWG2682";>2682filesystem::copy()
 won't create a symlink to a directoryJacksonville
+https://wg21.link/LWG2682";>2682filesystem::copy()
 won't create a symlink to a 
directoryJacksonvilleComplete
 https://wg21.link/LWG2697";>2697[concurr.ts] 
Behavior of future/shared_future unwrapping constructor when given an 
invalid futureJacksonville
-https://wg21.link/LWG2708";>2708recursive_directory_iterator::recursion_pending()
 is incorrectly specifiedJacksonville
+https://wg21.link/LWG2708";>2708recursive_directory_iterator::recursion_pending()
 is incorrectly specifiedJacksonvilleComplete
 https://wg21.link/LWG2936";>2936Path comparison 
is defined in terms of the generic 
formatJacksonville
 
 
@@ -144,9 +144,9 @@
 Comments about the "Review" issues
 
  2412 - I think we do this already
- 2682 - Eric - don't we do this already? 
+ 2682 - We already to this 
  2697 - No concurrency TS implementation yet
- 2708 - Eric? 
+ 2708 - We already do this 
  2936 - Eric - don't we do this already?
 
 


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


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

2018-02-11 Thread Timothy VanSlyke via Phabricator via cfe-commits
tvanslyke added a comment.

Hello.  I would just like to follow up on the status of this patch.  Is there 
anything else that is needed from me?  I just want to make sure that nobody is 
waiting on me for anything; I'm still not 100% familiar with the process.  
Thanks in advance.


https://reviews.llvm.org/D41976



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


[libcxx] r324851 - Fix a typo in the synopsis comment. NFC. Thanks to K-ballo for the catch

2018-02-11 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Sun Feb 11 13:51:49 2018
New Revision: 324851

URL: http://llvm.org/viewvc/llvm-project?rev=324851&view=rev
Log:
Fix a typo in the synopsis comment. NFC. Thanks to K-ballo for the catch

Modified:
libcxx/trunk/include/utility

Modified: libcxx/trunk/include/utility
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=324851&r1=324850&r2=324851&view=diff
==
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Sun Feb 11 13:51:49 2018
@@ -52,7 +52,7 @@ template 
 >::type
 move_if_noexcept(T& x) noexcept; // constexpr in C++14
 
-template  constexpr add_const_t& as_const(T& t) noexcept;  // 
C++17
+template  constexpr add_const_t& as_const(T& t) noexcept;  // 
C++17
 template   void as_const(const T&&) = delete; // 
C++17
 
 template  typename add_rvalue_reference::type declval() noexcept;


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


[PATCH] D43159: Modernize: Use nullptr more.

2018-02-11 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

So my main concern with this patch is that `nullptr` is actually  `#defined`'ed 
in C++03 mode. That definition comes from the `__nullptr` header, and therefore 
we would need to add that header to each include which uses it. Which kind of 
sucks.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43159



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


[PATCH] D43166: Add default C++ ABI libname and include paths for FreeBSD

2018-02-11 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments.



Comment at: CMakeLists.txt:141
+set(LIBCXX_CXX_ABI_LIBNAME "libcxxrt")
+set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
   else()

EricWF wrote:
> Actually, I'm not sure how much I love having other libc++ header on the 
> include path... I'm not sure how well this works especially with out 
> forwarding header. Maybe what would be appropriate would be to copy the 
> cxxabi.h header into the build directory?
Nevermind... That's what this already does. My bad.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43166



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


[PATCH] D43166: Add default C++ ABI libname and include paths for FreeBSD

2018-02-11 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments.



Comment at: CMakeLists.txt:141
+set(LIBCXX_CXX_ABI_LIBNAME "libcxxrt")
+set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
   else()

Actually, I'm not sure how much I love having other libc++ header on the 
include path... I'm not sure how well this works especially with out forwarding 
header. Maybe what would be appropriate would be to copy the cxxabi.h header 
into the build directory?


Repository:
  rCXX libc++

https://reviews.llvm.org/D43166



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


[PATCH] D43159: Modernize: Use nullptr more.

2018-02-11 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added a comment.

Is it worth adding `-Werror=zero-as-null-pointer-constant` to the build?


Repository:
  rCXX libc++

https://reviews.llvm.org/D43159



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


[PATCH] D43171: [AMDGPU] Change constant addr space to 4 for clang

2018-02-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added reviewers: t-tye, b-sumner, arsenm.
Herald added subscribers: tpr, dstuttard, nhaehnle, wdng, kzhuravl.

https://reviews.llvm.org/D43171

Files:
  include/clang/Basic/BuiltinsAMDGPU.def
  lib/Basic/Targets/AMDGPU.cpp
  test/CodeGen/target-data.c
  test/CodeGenOpenCL/address-space-constant-initializers.cl
  test/CodeGenOpenCL/address-spaces.cl
  test/CodeGenOpenCL/amdgpu-debug-info-variable-expression.cl
  test/CodeGenOpenCL/amdgpu-env-amdgiz.cl
  test/CodeGenOpenCL/amdgpu-nullptr.cl
  test/CodeGenOpenCL/builtins-amdgcn.cl
  test/CodeGenOpenCL/cast_image.cl
  test/CodeGenOpenCL/opencl_types.cl
  test/CodeGenOpenCL/size_t.cl
  test/CodeGenOpenCL/vla.cl

Index: test/CodeGenOpenCL/vla.cl
===
--- test/CodeGenOpenCL/vla.cl
+++ test/CodeGenOpenCL/vla.cl
@@ -1,13 +1,14 @@
 // RUN: %clang_cc1 -emit-llvm -triple "spir-unknown-unknown" -O0 -cl-std=CL2.0 -o - %s | FileCheck -check-prefixes=CHECK,SPIR %s
-// RUN: %clang_cc1 -emit-llvm -triple amdgcn-amd-amdhsa-opencl -O0 -cl-std=CL2.0 -o - %s | FileCheck -check-prefixes=CHECK,SPIR %s
-// RUN: %clang_cc1 -emit-llvm -triple amdgcn-amd-amdhsa-amdgizcl -O0 -cl-std=CL2.0 -o - %s | FileCheck -check-prefixes=CHECK,GIZ %s
+// RUN: %clang_cc1 -emit-llvm -triple amdgcn-amd-amdhsa -O0 -cl-std=CL2.0 -o - %s | FileCheck -check-prefixes=CHECK,AMD %s
 
 constant int sz0 = 5;
-// CHECK: @sz0 = addrspace(2) constant i32 5
+// SPIR: @sz0 = addrspace(2) constant i32 5
+// AMD: @sz0 = addrspace(4) constant i32 5
 const global int sz1 = 16;
 // CHECK: @sz1 = addrspace(1) constant i32 16
 const constant int sz2 = 8;
-// CHECK: @sz2 = addrspace(2) constant i32 8
+// SPIR: @sz2 = addrspace(2) constant i32 8
+// AMD: @sz2 = addrspace(4) constant i32 8
 // CHECK: @testvla.vla2 = internal addrspace(3) global [8 x i16] undef
 
 kernel void testvla()
Index: test/CodeGenOpenCL/size_t.cl
===
--- test/CodeGenOpenCL/size_t.cl
+++ test/CodeGenOpenCL/size_t.cl
@@ -23,8 +23,10 @@
 
 //SZ32: define{{.*}} i32 @test_ptrtoint_constant(i8 addrspace(2)* %x)
 //SZ32: ptrtoint i8 addrspace(2)* %{{.*}} to i32
-//SZ64: define{{.*}} i64 @test_ptrtoint_constant(i8 addrspace(2)* %x)
-//SZ64: ptrtoint i8 addrspace(2)* %{{.*}} to i64
+//SZ64ONLY: define{{.*}} i64 @test_ptrtoint_constant(i8 addrspace(2)* %x)
+//SZ64ONLY: ptrtoint i8 addrspace(2)* %{{.*}} to i64
+//AMDGCN: define{{.*}} i64 @test_ptrtoint_constant(i8 addrspace(4)* %x)
+//AMDGCN: ptrtoint i8 addrspace(4)* %{{.*}} to i64
 uintptr_t test_ptrtoint_constant(constant char* x) {
   return (uintptr_t)x;
 }
Index: test/CodeGenOpenCL/opencl_types.cl
===
--- test/CodeGenOpenCL/opencl_types.cl
+++ test/CodeGenOpenCL/opencl_types.cl
@@ -11,35 +11,36 @@
 
 void fnc1(image1d_t img) {}
 // CHECK-SPIR: @fnc1(%opencl.image1d_ro_t addrspace(1)*
-// CHECK-AMDGCN: @fnc1(%opencl.image1d_ro_t addrspace(2)*
+// CHECK-AMDGCN: @fnc1(%opencl.image1d_ro_t addrspace(4)*
 
 void fnc1arr(image1d_array_t img) {}
 // CHECK-SPIR: @fnc1arr(%opencl.image1d_array_ro_t addrspace(1)*
-// CHECK-AMDGCN: @fnc1arr(%opencl.image1d_array_ro_t addrspace(2)*
+// CHECK-AMDGCN: @fnc1arr(%opencl.image1d_array_ro_t addrspace(4)*
 
 void fnc1buff(image1d_buffer_t img) {}
 // CHECK-SPIR: @fnc1buff(%opencl.image1d_buffer_ro_t addrspace(1)*
-// CHECK-AMDGCN: @fnc1buff(%opencl.image1d_buffer_ro_t addrspace(2)*
+// CHECK-AMDGCN: @fnc1buff(%opencl.image1d_buffer_ro_t addrspace(4)*
 
 void fnc2(image2d_t img) {}
 // CHECK-SPIR: @fnc2(%opencl.image2d_ro_t addrspace(1)*
-// CHECK-AMDGCN: @fnc2(%opencl.image2d_ro_t addrspace(2)*
+// CHECK-AMDGCN: @fnc2(%opencl.image2d_ro_t addrspace(4)*
 
 void fnc2arr(image2d_array_t img) {}
 // CHECK-SPIR: @fnc2arr(%opencl.image2d_array_ro_t addrspace(1)*
-// CHECK-AMDGCN: @fnc2arr(%opencl.image2d_array_ro_t addrspace(2)*
+// CHECK-AMDGCN: @fnc2arr(%opencl.image2d_array_ro_t addrspace(4)*
 
 void fnc3(image3d_t img) {}
 // CHECK-SPIR: @fnc3(%opencl.image3d_ro_t addrspace(1)*
-// CHECK-AMDGCN: @fnc3(%opencl.image3d_ro_t addrspace(2)*
+// CHECK-AMDGCN: @fnc3(%opencl.image3d_ro_t addrspace(4)*
 
 void fnc4smp(sampler_t s) {}
 // CHECK-SPIR-LABEL: define {{.*}}void @fnc4smp(%opencl.sampler_t addrspace(2)*
-// CHECK-AMDGCN-LABEL: define {{.*}}void @fnc4smp(%opencl.sampler_t addrspace(2)*
+// CHECK-AMDGCN-LABEL: define {{.*}}void @fnc4smp(%opencl.sampler_t addrspace(4)*
 
 kernel void foo(image1d_t img) {
   sampler_t smp = CLK_ADDRESS_CLAMP_TO_EDGE|CLK_NORMALIZED_COORDS_TRUE|CLK_FILTER_LINEAR;
-  // CHECK-COM: alloca %opencl.sampler_t addrspace(2)*
+  // CHECK-SPIR: alloca %opencl.sampler_t addrspace(2)*
+  // CHECK-AMDGCN: alloca %opencl.sampler_t addrspace(4)*
   event_t evt;
   // CHECK-SPIR: alloca %opencl.event_t*
   // CHECK-AMDGCN: alloca %opencl.event_t addrspace(5)*
@@ -52,17 +53,20 @@
   reserve_id_t rid;
   // CHECK-SPIR: alloca %opencl.reserve

[PATCH] D41217: [Concepts] Concept Specialization Expressions

2018-02-11 Thread Saar Raz via Phabricator via cfe-commits
saar.raz updated this revision to Diff 133799.
saar.raz added a comment.

- Addressed comments: Added semantic tests for value and template concepts, 
removed extra period and modified CSE ctor to fit in nicer.


Repository:
  rC Clang

https://reviews.llvm.org/D41217

Files:
  include/clang/AST/DeclTemplate.h
  include/clang/AST/ExprCXX.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/StmtNodes.td
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/Expr.cpp
  lib/AST/ExprCXX.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/Parse/ParseExpr.cpp
  lib/Parse/ParseTemplate.cpp
  lib/Sema/CMakeLists.txt
  lib/Sema/SemaConcept.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp
  test/Parser/cxx-concept-declaration.cpp
  tools/libclang/CXCursor.cpp

Index: tools/libclang/CXCursor.cpp
===
--- tools/libclang/CXCursor.cpp
+++ tools/libclang/CXCursor.cpp
@@ -231,6 +231,7 @@
   case Stmt::TypeTraitExprClass:
   case Stmt::CoroutineBodyStmtClass:
   case Stmt::CoawaitExprClass:
+  case Stmt::ConceptSpecializationExprClass:
   case Stmt::DependentCoawaitExprClass:
   case Stmt::CoreturnStmtClass:
   case Stmt::CoyieldExprClass:
Index: test/Parser/cxx-concept-declaration.cpp
===
--- test/Parser/cxx-concept-declaration.cpp
+++ test/Parser/cxx-concept-declaration.cpp
@@ -9,8 +9,6 @@
 
 template concept D1 = true; // expected-error {{expected template parameter}}
 
-template concept C2 = 0.f; // expected-error {{constraint expression must be 'bool'}}
-
 struct S1 {
   template concept C1 = true; // expected-error {{concept declarations may only appear in global or namespace scope}}
 };
@@ -29,3 +27,12 @@
 
 // TODO: Add test to prevent explicit specialization, partial specialization
 // and explicit instantiation of concepts.
+
+template concept C7 = 2; // expected-error {{atomic constraint '2' must be of type 'bool' (found 'int')}}
+template concept C8 = 2 && x; // expected-error {{atomic constraint '2' must be of type 'bool' (found 'int')}}
+template concept C9 = x || 2 || x; // expected-error {{atomic constraint '2' must be of type 'bool' (found 'int')}}
+template concept C10 = 8ull && x || x; // expected-error {{atomic constraint '8ULL' must be of type 'bool' (found 'unsigned long long')}}
+template concept C11 = sizeof(T); // expected-error {{atomic constraint 'sizeof(T)' must be of type 'bool' (found 'unsigned long')}}
+template concept C12 = T{};
+template concept C13 = (bool&&)true;
+template concept C14 = (const bool&)true;
Index: test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp
===
--- test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp
+++ test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp
@@ -1,5 +1,69 @@
 // RUN:  %clang_cc1 -std=c++2a -fconcepts-ts -verify %s
-// expected-no-diagnostics
 
-template concept C = true;
-static_assert(C);
+template concept C1 = true;
+static_assert(C1);
+
+template concept C2 = sizeof(T) == 4;
+static_assert(C2);
+static_assert(!C2);
+static_assert(C2);
+static_assert(!C2);
+
+template concept C3 = sizeof(*T{}) == 4;
+static_assert(C3);
+static_assert(!C3);
+
+struct A {
+static constexpr int add(int a, int b) {
+return a + b;
+}
+};
+struct B {
+static int add(int a, int b) {
+return a + b;
+}
+};
+template
+concept C4 = U::add(1, 2) == 3;
+static_assert(C4);
+static_assert(!C4); // expected-error {{concept specialization 'C4' resulted in a non-constant expression 'B::add(1, 2) == 3'}}
+
+template
+constexpr bool is_same_v = false;
+
+template
+constexpr bool is_same_v = true;
+
+template
+concept Same = is_same_v;
+
+static_assert(Same);
+static_assert(Same);
+static_assert(!Same);
+static_assert(!Same);
+static_assert(Same);
+
+static_assert(Same)>);
+static_assert(Same)>);
+static_assert(Same)>);
+static_assert(Same)>);
+
+template concept C5 = T{}; // expected-error {{atomic constraint 'int{}' must be of type 'bool' (found 'int')}}
+constexpr bool x = C5; // expected-note {{in concept specialization 'C5'}}
+
+template
+concept IsEven = (x % 2) == 0;
+
+static_assert(IsEven<20>);
+static_assert(!IsEven<11>);
+
+template typename P>
+concept IsTypePredicate = is_same_v::value), const bool>
+  && is_same_v::value), const bool>
+  && is_same_v::value), const bool>;
+
+template struct T1 {};
+template struct T2 { static constexpr bool value

[PATCH] D43159: Modernize: Use nullptr more.

2018-02-11 Thread Dimitry Andric via Phabricator via cfe-commits
dim added a comment.

LGTM minus a few nits, though it would be nice if you can verify that all the 
changed headers still compile in `-std=c++98` and/or `-std=gnu++98` mode.




Comment at: include/functional:1573
 return &__f_.first();
-return (const void*)0;
+return (const void*)nullptr;
 }

The cast can be removed now.



Comment at: include/valarray:805
 _LIBCPP_INLINE_VISIBILITY
-valarray() : __begin_(0), __end_(0) {}
+valarray() : __begin_(nullptr), __end_(0) {}
 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY

Missed `__end` here?


Repository:
  rCXX libc++

https://reviews.llvm.org/D43159



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


r324824 - Fix test clang-diff-json.cpp

2018-02-11 Thread Aaron Smith via cfe-commits
Author: asmith
Date: Sat Feb 10 13:28:55 2018
New Revision: 324824

URL: http://llvm.org/viewvc/llvm-project?rev=324824&view=rev
Log:
Fix test clang-diff-json.cpp

Summary:
This test would fail if the python path had spaces. Add a quote around the path 
to fix this problem and update some test values changed by the addition of 
quotes around the path.

Tested on Windows and Linux with Python 3.x

Reviewers: zturner, llvm-commits

Subscribers: klimek, cfe-commits

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

Modified:
cfe/trunk/test/Tooling/clang-diff-json.cpp

Modified: cfe/trunk/test/Tooling/clang-diff-json.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/clang-diff-json.cpp?rev=324824&r1=324823&r2=324824&view=diff
==
--- cfe/trunk/test/Tooling/clang-diff-json.cpp (original)
+++ cfe/trunk/test/Tooling/clang-diff-json.cpp Sat Feb 10 13:28:55 2018
@@ -1,10 +1,10 @@
 // RUN: clang-diff -ast-dump-json %s -- \
-// RUN: | %python -c 'import json, sys; 
json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN: | '%python' -c 'import json, sys; 
json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
 // RUN: | FileCheck %s
 
-// CHECK: "begin": 299,
+// CHECK: "begin": 301,
 // CHECK: "type": "FieldDecl",
-// CHECK: "end": 319,
+// CHECK: "end": 321,
 // CHECK: "type": "CXXRecordDecl",
 class A {
   int x;


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


[PATCH] D41553: Support parsing double square-bracket attributes in ObjC

2018-02-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman updated this revision to Diff 133791.
aaron.ballman added a comment.

Added the remaining ObjC, NS, and CF attributes. I think that's the last of the 
Apple-related attributes (I plan to continue to work on the other attributes as 
well, but in separate patches). @rjmccall, do you see any remaining issues?


https://reviews.llvm.org/D41553

Files:
  include/clang/Basic/Attr.td
  include/clang/Parse/Parser.h
  lib/Parse/ParseObjc.cpp
  lib/Parse/Parser.cpp
  test/Misc/ast-dump-attr.m
  test/Parser/objc-attr.m

Index: test/Parser/objc-attr.m
===
--- test/Parser/objc-attr.m
+++ test/Parser/objc-attr.m
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 -verify %s
+// expected-no-diagnostics
+
+@interface NSObject
+@end
+
+[[clang::objc_exception]]
+@interface Foo {
+  [[clang::iboutlet]] NSObject *h;
+}
+@property (readonly) [[clang::objc_returns_inner_pointer]] void *i, *j;
+@property (readonly) [[clang::iboutlet]] NSObject *k;
+@end
+
+[[clang::objc_runtime_name("name")]] @protocol Bar;
+
+[[clang::objc_protocol_requires_explicit_implementation]] 
+@protocol Baz
+@end
+
+@interface Quux
+-(void)g1 [[clang::ns_consumes_self]];
+-(void)g2 __attribute__((ns_consumes_self));
+-(void)h1: (int)x [[clang::ns_consumes_self]];
+-(void)h2: (int)x __attribute__((ns_consumes_self));
+-(void) [[clang::ns_consumes_self]] i1;
+-(void) __attribute__((ns_consumes_self)) i2;
+@end
Index: test/Misc/ast-dump-attr.m
===
--- test/Misc/ast-dump-attr.m
+++ test/Misc/ast-dump-attr.m
@@ -0,0 +1,57 @@
+// RUN: %clang_cc1 -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 -ast-dump -ast-dump-filter Test %s | FileCheck --strict-whitespace %s
+
+@interface NSObject
+@end
+
+[[clang::objc_exception]]
+@interface Test1 {
+// CHECK: ObjCInterfaceDecl{{.*}} Test1
+// CHECK-NEXT: ObjCExceptionAttr{{.*}}
+  [[clang::iboutlet]] NSObject *Test2;
+// CHECK: ObjCIvarDecl{{.*}} Test2
+// CHECK-NEXT: IBOutletAttr
+}
+@property (readonly) [[clang::objc_returns_inner_pointer]] void *Test3, *Test4;
+// CHECK: ObjCPropertyDecl{{.*}} Test3 'void *' readonly
+// CHECK-NEXT: ObjCReturnsInnerPointerAttr
+// CHECK-NEXT: ObjCPropertyDecl{{.*}} Test4 'void *' readonly
+// CHECK-NEXT: ObjCReturnsInnerPointerAttr
+
+@property (readonly) [[clang::iboutlet]] NSObject *Test5;
+// CHECK: ObjCPropertyDecl{{.*}} Test5 'NSObject *' readonly
+// CHECK-NEXT: IBOutletAttr
+
+// CHECK: ObjCMethodDecl{{.*}} implicit{{.*}} Test3
+// CHECK-NEXT: ObjCReturnsInnerPointerAttr
+// CHECK: ObjCMethodDecl{{.*}} implicit{{.*}} Test4
+// CHECK-NEXT: ObjCReturnsInnerPointerAttr
+// CHECK: ObjCMethodDecl{{.*}} implicit{{.*}} Test5
+// CHECK-NOT: IBOutletAttr
+@end
+
+[[clang::objc_runtime_name("name")]] @protocol Test6;
+// CHECK: ObjCProtocolDecl{{.*}} Test6
+// CHECK-NEXT: ObjCRuntimeNameAttr{{.*}} "name"
+
+[[clang::objc_protocol_requires_explicit_implementation]]
+@protocol Test7
+// CHECK: ObjCProtocolDecl{{.*}} Test7
+// CHECK-NEXT: ObjCExplicitProtocolImplAttr
+@end
+
+@interface Test8
+// CHECK: ObjCInterfaceDecl{{.*}} Test8
+-(void)Test9 [[clang::ns_consumes_self]];
+// CHECK: ObjCMethodDecl{{.*}} Test9 'void'
+// CHECK-NEXT: NSConsumesSelfAttr
+-(void) [[clang::ns_consumes_self]] Test10: (int)Test11;
+// CHECK: ObjCMethodDecl{{.*}} Test10: 'void'
+// CHECK-NEXT: |-ParmVarDecl{{.*}} Test11 'int'
+// CHECK-NEXT: `-NSConsumesSelfAttr
+-(void)Test12: (int *) [[clang::noescape]] Test13  to:(int)Test14 [[clang::ns_consumes_self]];
+// CHECK: ObjCMethodDecl{{.*}} Test12:to: 'void'
+// CHECK-NEXT: |-ParmVarDecl{{.*}} Test13 'int *'
+// CHECK-NEXT: | `-NoEscapeAttr
+// CHECK-NEXT: |-ParmVarDecl{{.*}} Test14 'int'
+// CHECK-NEXT: `-NSConsumesSelfAttr
+@end
Index: lib/Parse/Parser.cpp
===
--- lib/Parse/Parser.cpp
+++ lib/Parse/Parser.cpp
@@ -741,7 +741,7 @@
 break;
   }
   case tok::at:
-return ParseObjCAtDirectives();
+return ParseObjCAtDirectives(attrs);
   case tok::minus:
   case tok::plus:
 if (!getLangOpts().ObjC1) {
Index: lib/Parse/ParseObjc.cpp
===
--- lib/Parse/ParseObjc.cpp
+++ lib/Parse/ParseObjc.cpp
@@ -45,7 +45,8 @@
 /// [OBJC]  objc-protocol-definition
 /// [OBJC]  objc-method-definition
 /// [OBJC]  '@' 'end'
-Parser::DeclGroupPtrTy Parser::ParseObjCAtDirectives() {
+Parser::DeclGroupPtrTy
+Parser::ParseObjCAtDirectives(ParsedAttributesWithRange &Attrs) {
   SourceLocation AtLoc = ConsumeToken(); // the "@"
 
   if (Tok.is(tok::code_completion)) {
@@ -58,15 +59,11 @@
   switch (Tok.getObjCKeywordID()) {
   case tok::objc_class:
 return ParseObjCAtClassDeclaration(AtLoc);
-  case tok::objc_interface: {
-ParsedAttributes attrs(AttrFactory);
-SingleDecl = ParseObjCAtInterfaceDeclaration(AtLoc, a

[PATCH] D43095: Make attribute-target on a Definition-after-use update the LLVM attributes

2018-02-11 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.

This looks reasonable to me, but you should wait a few days to commit in case 
someone more into CodeGen has comments.

Your choice on updating the code you factored into a function; those changes 
are just style nits.




Comment at: lib/CodeGen/CodeGenModule.cpp:1258
+  std::vector Features;
+  const FunctionDecl *FD = dyn_cast_or_null(D);
+  FD = FD ? FD->getMostRecentDecl() : FD;

Could use `const auto *` here.



Comment at: lib/CodeGen/CodeGenModule.cpp:1266-1268
+for (llvm::StringMap::const_iterator it = FeatureMap.begin(),
+   ie = FeatureMap.end();
+ it != ie; ++it)

Could switch this to a range-base for loop?



Comment at: lib/CodeGen/CodeGenModule.cpp:1275
+// the function.
+const auto *TD = FD->getAttr();
+TargetAttr::ParsedTargetAttr ParsedAttr = TD->parse();

Could hoist this out of the `if` statement so we don't do a has/get operation.


Repository:
  rC Clang

https://reviews.llvm.org/D43095



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


[PATCH] D42730: [clang-tidy]] Add check for use of types/classes/functions from header which are deprecated and removed in C++17

2018-02-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/modernize/DeprecatedFunctionalCheck.cpp:26
+.bind("base")),
+  anyOf(isClass(), ast_matchers::isStruct()),
+  ast_matchers::isDefinition()))

You can drop the `ast_matchers::` here because of the using declaration above.

Actually, do we need the `isClass()` and `isStruct()` check at all? What else 
would match `isDerivedFrom()`?



Comment at: clang-tidy/modernize/DeprecatedFunctionalCheck.cpp:30
+  this);
+  Finder->addMatcher(callExpr(callee(functionDecl(hasName("std::ptr_fun"
+ .bind("ptr_fun_call"),

::std::ptr_fun



Comment at: clang-tidy/modernize/DeprecatedFunctionalCheck.cpp:33
+ this);
+  Finder->addMatcher(callExpr(callee(functionDecl(hasName("std::mem_fun"
+ .bind("mem_fun_call"),

::std::mem_fun

Why not `::std::mem_fun_ref`? Or the _t variants of these APIs?



Comment at: clang-tidy/modernize/DeprecatedFunctionalCheck.cpp:48-54
+  } else if (const auto *const Call =
+ Result.Nodes.getNodeAs("ptr_fun_call")) {
+diag(Call->getLocStart(), Message) << "'std::ptr_fun'";
+  } else if (const auto *const Call =
+ Result.Nodes.getNodeAs("mem_fun_call")) {
+diag(Call->getLocStart(), Message) << "'std::mem_fun'";
+  }

I think that this code should be generalized (same with the matchers) so that 
you match on `hasAnyName()` for the function calls and use 
`CallExpr::getCalleeDecl()` to get the declaration. e.g.,
```
if (const auto *Call = Result.Nodes.getNodeAs("blech")) {
  if (const Decl *Callee = Call->getCalleeDecl())
diag(Call->getLocStart(), Message) << Calleee;
}
```
This way you can add more named without having to add extra logic for the 
diagnostics.



Comment at: docs/ReleaseNotes.rst:95
+
+  Warns if types, classes, and functions from '' header which are
+  deprecated in C++11 and removed in C++17 are used.

Please use backticks for ``. Also, should say "and functions from 
the  header".



Comment at: docs/clang-tidy/checks/modernize-deprecated-functional.rst:6
+
+Warns if types, classes, and functions from '' header which are 
deprecated in C++11 and removed in C++17 are used.
+In particular, this check warns if one of the following deprecated objects is

Same comments here as above.


https://reviews.llvm.org/D42730



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