[PATCH] D39936: [OpenCL] Add extensions cl_intel_subgroups and cl_intel_subgroups_short

2017-11-10 Thread Alexey Sotkin via Phabricator via cfe-commits
AlexeySotkin created this revision.

https://reviews.llvm.org/D39936

Files:
  include/clang/Basic/OpenCLExtensions.def
  lib/Headers/opencl-c.h
  test/SemaOpenCL/extension-version.cl

Index: test/SemaOpenCL/extension-version.cl
===
--- test/SemaOpenCL/extension-version.cl
+++ test/SemaOpenCL/extension-version.cl
@@ -273,3 +273,21 @@
 #endif
 #pragma OPENCL EXTENSION cl_amd_media_ops2: enable
 
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_intel_subgroups
+#error "Missing cl_intel_subgroups define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_intel_subgroups' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_intel_subgroups : enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_intel_subgroups_short
+#error "Missing cl_intel_subgroups_short define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_intel_subgroups_short' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_intel_subgroups_short : enable
+
Index: lib/Headers/opencl-c.h
===
--- lib/Headers/opencl-c.h
+++ lib/Headers/opencl-c.h
@@ -15886,6 +15886,289 @@
 
 #endif //cl_khr_subgroups cl_intel_subgroups
 
+#if defined(cl_intel_subgroups)
+// Intel-Specific Sub Group Functions
+float   __ovld __conv intel_sub_group_shuffle( float  x, uint c );
+float2  __ovld __conv intel_sub_group_shuffle( float2 x, uint c );
+float3  __ovld __conv intel_sub_group_shuffle( float3 x, uint c );
+float4  __ovld __conv intel_sub_group_shuffle( float4 x, uint c );
+float8  __ovld __conv intel_sub_group_shuffle( float8 x, uint c );
+float16 __ovld __conv intel_sub_group_shuffle( float16 x, uint c );
+
+int __ovld __conv intel_sub_group_shuffle( int  x, uint c );
+int2__ovld __conv intel_sub_group_shuffle( int2 x, uint c );
+int3__ovld __conv intel_sub_group_shuffle( int3 x, uint c );
+int4__ovld __conv intel_sub_group_shuffle( int4 x, uint c );
+int8__ovld __conv intel_sub_group_shuffle( int8 x, uint c );
+int16   __ovld __conv intel_sub_group_shuffle( int16 x, uint c );
+
+uint__ovld __conv intel_sub_group_shuffle( uint  x, uint c );
+uint2   __ovld __conv intel_sub_group_shuffle( uint2 x, uint c );
+uint3   __ovld __conv intel_sub_group_shuffle( uint3 x, uint c );
+uint4   __ovld __conv intel_sub_group_shuffle( uint4 x, uint c );
+uint8   __ovld __conv intel_sub_group_shuffle( uint8 x, uint c );
+uint16  __ovld __conv intel_sub_group_shuffle( uint16 x, uint c );
+
+long__ovld __conv intel_sub_group_shuffle( long x, uint c );
+ulong   __ovld __conv intel_sub_group_shuffle( ulong x, uint c );
+
+float   __ovld __conv intel_sub_group_shuffle_down( float  cur, float  next, uint c );
+float2  __ovld __conv intel_sub_group_shuffle_down( float2 cur, float2 next, uint c );
+float3  __ovld __conv intel_sub_group_shuffle_down( float3 cur, float3 next, uint c );
+float4  __ovld __conv intel_sub_group_shuffle_down( float4 cur, float4 next, uint c );
+float8  __ovld __conv intel_sub_group_shuffle_down( float8 cur, float8 next, uint c );
+float16 __ovld __conv intel_sub_group_shuffle_down( float16 cur, float16 next, uint c );
+
+int __ovld __conv intel_sub_group_shuffle_down( int  cur, int  next, uint c );
+int2__ovld __conv intel_sub_group_shuffle_down( int2 cur, int2 next, uint c );
+int3__ovld __conv intel_sub_group_shuffle_down( int3 cur, int3 next, uint c );
+int4__ovld __conv intel_sub_group_shuffle_down( int4 cur, int4 next, uint c );
+int8__ovld __conv intel_sub_group_shuffle_down( int8 cur, int8 next, uint c );
+int16   __ovld __conv intel_sub_group_shuffle_down( int16 cur, int16 next, uint c );
+
+uint__ovld __conv intel_sub_group_shuffle_down( uint  cur, uint  next, uint c );
+uint2   __ovld __conv intel_sub_group_shuffle_down( uint2 cur, uint2 next, uint c );
+uint3   __ovld __conv intel_sub_group_shuffle_down( uint3 cur, uint3 next, uint c );
+uint4   __ovld __conv intel_sub_group_shuffle_down( uint4 cur, uint4 next, uint c );
+uint8   __ovld __conv intel_sub_group_shuffle_down( uint8 cur, uint8 next, uint c );
+uint16  __ovld __conv intel_sub_group_shuffle_down( uint16 cur, uint16 next, uint c );
+
+long__ovld __conv intel_sub_group_shuffle_down( long prev, long cur, uint c );
+ulong   __ovld __conv intel_sub_group_shuffle_down( ulong prev, ulong cur, uint c );
+
+float   __ovld __conv intel_sub_group_shuffle_up( float  prev, float  cur, uint c );
+float2  __ovld __conv intel_sub_group_shuffle_up( float2 prev, float2 cur, uint c );
+float3  __ovld __conv intel_sub_group_shuffle_up( float3 prev, float3 cur, uint c );
+float4  __ovld __conv intel_sub_group_shuffle_up( float4 prev, float4 cur, uint c );
+float8  __ovld __conv intel_sub_group_shuffle_up( float8 prev, float8 cur, uint c );
+float16 __ovld __conv intel_sub_group_shuffle_up( float16 prev, float16 cur, uint c );
+
+int __ovld __conv intel_sub_group_shuffle_up( int  prev, 

[PATCH] D38737: [X86] test/testn intrinsics lowering to IR. clang side

2017-11-10 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D38737



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


[PATCH] D39768: [coroutines] Promote cleanup.dest.slot allocas to registers to avoid storing it in the coroutine frame

2017-11-10 Thread Eric Niebler via Phabricator via cfe-commits
eric_niebler accepted this revision.
eric_niebler added a comment.
This revision is now accepted and ready to land.

Looks ok to me.


https://reviews.llvm.org/D39768



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


r317960 - Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission

2017-11-10 Thread Jake Ehrlich via cfe-commits
Author: jakehehrlich
Date: Fri Nov 10 17:15:41 2017
New Revision: 317960

URL: http://llvm.org/viewvc/llvm-project?rev=317960=rev
Log:
Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission

llvm-objcopy is getting to where it can be used in non-trivial ways
(such as for dwarf fission in clang). It now supports dwarf fission but
this feature hasn't been thoroughly tested yet. This change allows
people to optionally build clang to use llvm-objcopy rather than GNU
objcopy. By default GNU objcopy is still used so nothing should change.

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

Modified:
cfe/trunk/CMakeLists.txt
cfe/trunk/include/clang/Config/config.h.cmake
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=317960=317959=317960=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Fri Nov 10 17:15:41 2017
@@ -232,6 +232,9 @@ if (NOT(CLANG_DEFAULT_RTLIB STREQUAL ""
 "Default runtime library to use (\"libgcc\" or \"compiler-rt\", empty for 
platform default)" FORCE)
 endif()
 
+set(CLANG_DEFAULT_OBJCOPY "objcopy" CACHE STRING
+  "Default objcopy executable to use.")
+
 set(CLANG_DEFAULT_OPENMP_RUNTIME "libomp" CACHE STRING
   "Default OpenMP runtime used by -fopenmp.")
 
@@ -534,8 +537,8 @@ if (CLANG_ENABLE_BOOTSTRAP)
 set(NEXT_CLANG_STAGE ${NEXT_CLANG_STAGE}-instrumented)
   endif()
   message(STATUS "Setting next clang stage to: ${NEXT_CLANG_STAGE}")
-  
-  
+
+
   set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-stamps/)
   set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/)
 

Modified: cfe/trunk/include/clang/Config/config.h.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Config/config.h.cmake?rev=317960=317959=317960=diff
==
--- cfe/trunk/include/clang/Config/config.h.cmake (original)
+++ cfe/trunk/include/clang/Config/config.h.cmake Fri Nov 10 17:15:41 2017
@@ -17,6 +17,9 @@
 /* Default runtime library to use. */
 #define CLANG_DEFAULT_RTLIB "${CLANG_DEFAULT_RTLIB}"
 
+/* Default objcopy to use */
+#define CLANG_DEFAULT_OBJCOPY "${CLANG_DEFAULT_OBJCOPY}"
+
 /* Default OpenMP runtime used by -fopenmp. */
 #define CLANG_DEFAULT_OPENMP_RUNTIME "${CLANG_DEFAULT_OPENMP_RUNTIME}"
 

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=317960=317959=317960=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Nov 10 17:15:41 2017
@@ -441,7 +441,7 @@ void CodeGenModule::Release() {
   if (Context.getTargetInfo().getTriple().getArch() == llvm::Triple::x86)
 getModule().addModuleFlag(llvm::Module::Error, "NumRegisterParameters",
   CodeGenOpts.NumRegisterParameters);
-  
+
   if (CodeGenOpts.DwarfVersion) {
 // We actually want the latest version when there are conflicts.
 // We can change from Warning to Latest if such mode is supported.
@@ -770,7 +770,7 @@ StringRef CodeGenModule::getBlockMangled
   SmallString<256> Buffer;
   llvm::raw_svector_ostream Out(Buffer);
   if (!D)
-MangleCtx.mangleGlobalBlock(BD, 
+MangleCtx.mangleGlobalBlock(BD,
   dyn_cast_or_null(initializedGlobalDecl.getDecl()), Out);
   else if (const auto *CD = dyn_cast(D))
 MangleCtx.mangleCtorBlock(CD, GD.getCtorType(), BD, Out);
@@ -2010,12 +2010,12 @@ bool CodeGenModule::shouldOpportunistica
 void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD, llvm::GlobalValue *GV) 
{
   const auto *D = cast(GD.getDecl());
 
-  PrettyStackTraceDecl CrashInfo(const_cast(D), D->getLocation(), 
+  PrettyStackTraceDecl CrashInfo(const_cast(D), D->getLocation(),
  Context.getSourceManager(),
  "Generating code for declaration");
-  
+
   if (isa(D)) {
-// At -O0, don't generate IR for functions with available_externally 
+// At -O0, don't generate IR for functions with available_externally
 // linkage.
 if (!shouldEmitFunction(GD))
   return;
@@ -2041,7 +2041,7 @@ void CodeGenModule::EmitGlobalDefinition
 
   if (const auto *VD = dyn_cast(D))
 return EmitGlobalVarDefinition(VD, !VD->hasDefinition());
-  
+
   llvm_unreachable("Invalid argument to EmitGlobalDefinition()");
 }
 
@@ -2547,7 +2547,7 @@ CodeGenModule::GetAddrOfGlobal(GlobalDec
 }
 
 llvm::GlobalVariable *
-CodeGenModule::CreateOrReplaceCXXRuntimeVariable(StringRef Name, 
+CodeGenModule::CreateOrReplaceCXXRuntimeVariable(StringRef Name,
 

[PATCH] D39706: [refactor][extract] Initial implementation of variable captures

2017-11-10 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman updated this revision to Diff 122565.
arphaman marked 3 inline comments as done.
arphaman added a comment.

Address review comments


Repository:
  rL LLVM

https://reviews.llvm.org/D39706

Files:
  lib/Tooling/Refactoring/CMakeLists.txt
  lib/Tooling/Refactoring/Extract/CaptureVariables.cpp
  lib/Tooling/Refactoring/Extract/CaptureVariables.h
  lib/Tooling/Refactoring/Extract/Extract.cpp
  test/Refactor/Extract/CaptureSimpleVariables.cpp
  test/Refactor/Extract/ExtractionSemicolonPolicy.cpp
  test/Refactor/Extract/ExtractionSemicolonPolicy.m

Index: test/Refactor/Extract/ExtractionSemicolonPolicy.m
===
--- test/Refactor/Extract/ExtractionSemicolonPolicy.m
+++ test/Refactor/Extract/ExtractionSemicolonPolicy.m
@@ -10,7 +10,7 @@
   }
 }
 // CHECK: 1 'astmt' results:
-// CHECK:  static void extracted() {
+// CHECK:  static void extracted(NSArray *array) {
 // CHECK-NEXT: for (id i in array) {
 // CHECK-NEXT: int x = 0;
 // CHECK-NEXT: }{{$}}
@@ -23,7 +23,7 @@
   }
 }
 // CHECK: 1 'bstmt' results:
-// CHECK:  static void extracted() {
+// CHECK:  static void extracted(id lock) {
 // CHECK-NEXT: @synchronized(lock) {
 // CHECK-NEXT: int x = 0;
 // CHECK-NEXT: }{{$}}
Index: test/Refactor/Extract/ExtractionSemicolonPolicy.cpp
===
--- test/Refactor/Extract/ExtractionSemicolonPolicy.cpp
+++ test/Refactor/Extract/ExtractionSemicolonPolicy.cpp
@@ -6,41 +6,41 @@
   /*range adeclstmt=->+0:59*/int area = r.width * r.height;
 }
 // CHECK: 1 'adeclstmt' results:
-// CHECK:  static void extracted() {
+// CHECK:  static void extracted(const Rectangle ) {
 // CHECK-NEXT: int area = r.width * r.height;{{$}}
 // CHECK-NEXT: }{{[[:space:]].*}}
 // CHECK-NEXT: void extractStatement(const Rectangle ) {
-// CHECK-NEXT:   /*range adeclstmt=->+0:59*/extracted();{{$}}
+// CHECK-NEXT:   /*range adeclstmt=->+0:59*/extracted(r);{{$}}
 // CHECK-NEXT: }
 
 void extractStatementNoSemiIf(const Rectangle ) {
   /*range bextractif=->+2:4*/if (r.width) {
 int x = r.height;
   }
 }
 // CHECK: 1 'bextractif' results:
-// CHECK:  static void extracted() {
+// CHECK:  static void extracted(const Rectangle ) {
 // CHECK-NEXT: if (r.width) {
 // CHECK-NEXT: int x = r.height;
 // CHECK-NEXT: }{{$}}
 // CHECK-NEXT: }{{[[:space:]].*}}
 // CHECK-NEXT: void extractStatementNoSemiIf(const Rectangle ) {
-// CHECK-NEXT:   /*range bextractif=->+2:4*/extracted();{{$}}
+// CHECK-NEXT:   /*range bextractif=->+2:4*/extracted(r);{{$}}
 // CHECK-NEXT: }
 
 void extractStatementDontExtraneousSemi(const Rectangle ) {
   /*range cextractif=->+2:4*/if (r.width) {
 int x = r.height;
   } ;
 } //^ This semicolon shouldn't be extracted.
 // CHECK: 1 'cextractif' results:
-// CHECK:  static void extracted() {
+// CHECK:  static void extracted(const Rectangle ) {
 // CHECK-NEXT: if (r.width) {
 // CHECK-NEXT: int x = r.height;
 // CHECK-NEXT: }{{$}}
 // CHECK-NEXT: }{{[[:space:]].*}}
 // CHECK-NEXT: void extractStatementDontExtraneousSemi(const Rectangle ) {
-// CHECK-NEXT: extracted(); ;{{$}}
+// CHECK-NEXT: extracted(r); ;{{$}}
 // CHECK-NEXT: }
 
 void extractStatementNotSemiSwitch() {
@@ -102,12 +102,12 @@
   }
 }
 // CHECK: 1 'gextract' results:
-// CHECK:  static void extracted() {
+// CHECK:  static void extracted(XS xs) {
 // CHECK-NEXT: for (int i : xs) {
 // CHECK-NEXT: }{{$}}
 // CHECK-NEXT: }{{[[:space:]].*}}
 // CHECK-NEXT: void extractStatementNotSemiRangedFor(XS xs) {
-// CHECK-NEXT: extracted();{{$}}
+// CHECK-NEXT: extracted(xs);{{$}}
 // CHECK-NEXT: }
 
 void extractStatementNotSemiRangedTryCatch() {
Index: test/Refactor/Extract/CaptureSimpleVariables.cpp
===
--- /dev/null
+++ test/Refactor/Extract/CaptureSimpleVariables.cpp
@@ -0,0 +1,40 @@
+// RUN: clang-refactor extract -selection=test:%s %s -- 2>&1 | grep -v CHECK | FileCheck %s
+
+void captureStaticVars() {
+  static int x;
+  /*range astaticvar=->+0:39*/int y = x;
+  x += 1;
+}
+// CHECK: 1 'astaticvar' results:
+// CHECK:  static void extracted(int x) {
+// CHECK-NEXT: int y = x;{{$}}
+// CHECK-NEXT: }{{[[:space:]].*}}
+// CHECK-NEXT: void captureStaticVars() {
+// CHECK-NEXT: static int x;
+// CHECK-NEXT: extracted(x);{{$}}
+
+typedef struct {
+  int width, height;
+} Rectangle;
+
+void basicTypes(int i, float f, char c, const int *ip, float *fp, const Rectangle *structPointer) {
+  /*range basictypes=->+0:73*/basicTypes(i, f, c, ip, fp, structPointer);
+}
+// CHECK: 1 'basictypes' results:
+// CHECK:  static void extracted(char c, float f, float *fp, int i, const int *ip, const Rectangle *structPointer) {
+// CHECK-NEXT: basicTypes(i, f, c, ip, fp, structPointer);{{$}}
+// CHECK-NEXT: }{{[[:space:]].*}}
+// CHECK-NEXT: void basicTypes(int i, float f, char c, const int *ip, float *fp, const Rectangle *structPointer) {
+// CHECK-NEXT: 

[PATCH] D39706: [refactor][extract] Initial implementation of variable captures

2017-11-10 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added inline comments.



Comment at: lib/Tooling/Refactoring/Extract/CaptureVariables.h:36
+  explicit CapturedExtractedEntity(const VarDecl *VD)
+  : Kind(CapturedVarDecl), VD(VD) {}
+

ioeric wrote:
> arphaman wrote:
> > ioeric wrote:
> > > Maybe a `FIXME` here for `Kind`?
> > I think this constructor will always set the same kind.
> Then why do you need `Kind`? Is it changed somewhere else? Please document 
> the behavior,
The kind will be set to a different value by the other constructors that will 
be added later
I added docs to the enum


Repository:
  rL LLVM

https://reviews.llvm.org/D39706



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


[PATCH] D39050: Add index-while-building support to Clang

2017-11-10 Thread Argyrios Kyrtzidis via Phabricator via cfe-commits
akyrtzi added a comment.

Hey Eric,

In https://reviews.llvm.org/D39050#921748, @ioeric wrote:

> >> - I think the implementation of the index output logic (e.g. 
> >> `IndexUnitWriter` and bit format file) can be abstracted away (and split 
> >> into separate patches) so that you can unit-test the action with a 
> >> custom/mock unit writer; this would also make the action reusable with 
> >> (potentially) other storage formats.
> > 
> > The added IndexRecordAction and existing IndexAction use the same 
> > functionality from libIndex to collect the indexing data, so I'm not sure 
> > mocking the unit writer to unit test IndexRecordAction would add very much 
> > value – writing the index data out is the new behavior. The existing tests 
> > for IndexAction (under test/Index/Core) are already covering the 
> > correctness of the majority of the collected indexing info and the tests 
> > coming in the follow-up patch (seen in the original version of this patch) 
> > test it's still correct after the write/read round trip.
>
> Thanks for the clarification! I still think it's useful to decouple the 
> IndexAction from the bit format file so that it could be reusable elsewhere. 
> For example, I can see the index action be useful to clangd for building 
> in-memory index.


As Nathan mentioned, we believe the indexing action, as it exists in the trunk, 
is decoupled enough to be useful, for example Marc was already able to use it 
and write out the indexing data in a completely different format for his fork 
of clangd. Of course, we are definitely interested in any additional 
refactorings that would structure things better and we are eager to see and 
discuss follow-up patches from anyone that is interested in improving the code, 
but could we treat this as potential follow-up improvements ?

We are eager to provide the functionality so others can start experimenting 
with it; I'd propose that we discuss ideas for refactoring of the code as 
follow-up, what do you think ? Getting the initial functionality in and 
iterating on it, while getting more experience with applying it on various 
use-cases, is a common operating mindset of the llvm/clang projects.

> I also tried applying your original patch locally but couldn't get it to work 
> mostly due to portability issues (e.g. `blocks` and `if (APPLE)` in make 
> files). AFAIK, many folks compile clang with GCC and/or without APPLE, so 
> it's important that you get the portability right from the very beginning. 
> Thanks!

Nathan will look into making using blocks optional, providing additional 
function pointer+context APIs where appropriate and having the common 
implementation using lambdas.
For the APPLE specific parts it, the only specific darwin-specific part is the 
part using FSEvents, the other 'if (APPLE)' checks can likely be removed. We 
would generally need help from people with linux expertise to provide the 
'FSEvents' equivalent functionality but this is a small part of the overall 
feature, it's not important for getting the index-while-building data.

But these things are not part of the current patch, we can discuss again with 
the follow-up patches that will contain those things.

> Index-while-build is awesome! I'm looking forward to your patches!


https://reviews.llvm.org/D39050



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


[PATCH] D39818: [CUDA] [test-suite] Test std::min and std::max with C++11.

2017-11-10 Thread Justin Lebar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL317962: [CUDA] [test-suite] Test std::min and std::max with 
C++11. (authored by jlebar).

Repository:
  rL LLVM

https://reviews.llvm.org/D39818

Files:
  test-suite/trunk/External/CUDA/algorithm.cu


Index: test-suite/trunk/External/CUDA/algorithm.cu
===
--- test-suite/trunk/External/CUDA/algorithm.cu
+++ test-suite/trunk/External/CUDA/algorithm.cu
@@ -7,39 +7,42 @@
 // we can successfully compile and run the standard library's implementations
 // of these functions.
 
-#if __cplusplus >= 201402L
+#if __cplusplus >= 201103L
 
 #include 
 #include 
 #include 
 #include 
 
-__device__ void greater() {
-  assert(std::greater()(1, 0));
-}
-
 __device__ void min() {
   assert(std::min(0, 1) == 0);
-  assert(std::min({5, 1, 10}) == 1);
 }
 
 __device__ void max() {
   assert(std::max(0, 1) == 1);
-  assert(std::max({5, 1, 10}, std::less()) == 10);
 }
 
-__device__ void minmax() {
+// Clang has device-side shims implementing std::min and std::max for scalars
+// starting in C++11, but doesn't implement minimax or std::min/max on
+// initializer_lists until C++14, when it gets these for free from the standard
+// library (because they're constexpr).
+__device__ void cpp14_tests() {
+#if __cplusplus >= 201402L
+  assert(std::greater()(1, 0));
+  assert(std::min({5, 1, 10}) == 1);
+  assert(std::max({5, 1, 10}, std::less()) == 10);
+
   assert(std::minmax(1, 0).first == 0);
   assert(std::minmax(1, 0).second == 1);
   assert(std::minmax({0, 10, -10, 100}, std::less()).first == -10);
   assert(std::minmax({0, 10, -10, 100}, std::less()).second == 100);
+#endif
 }
 
 __global__ void kernel() {
-  greater();
   min();
   max();
-  minmax();
+  cpp14_tests();
 }
 
 int main() {


Index: test-suite/trunk/External/CUDA/algorithm.cu
===
--- test-suite/trunk/External/CUDA/algorithm.cu
+++ test-suite/trunk/External/CUDA/algorithm.cu
@@ -7,39 +7,42 @@
 // we can successfully compile and run the standard library's implementations
 // of these functions.
 
-#if __cplusplus >= 201402L
+#if __cplusplus >= 201103L
 
 #include 
 #include 
 #include 
 #include 
 
-__device__ void greater() {
-  assert(std::greater()(1, 0));
-}
-
 __device__ void min() {
   assert(std::min(0, 1) == 0);
-  assert(std::min({5, 1, 10}) == 1);
 }
 
 __device__ void max() {
   assert(std::max(0, 1) == 1);
-  assert(std::max({5, 1, 10}, std::less()) == 10);
 }
 
-__device__ void minmax() {
+// Clang has device-side shims implementing std::min and std::max for scalars
+// starting in C++11, but doesn't implement minimax or std::min/max on
+// initializer_lists until C++14, when it gets these for free from the standard
+// library (because they're constexpr).
+__device__ void cpp14_tests() {
+#if __cplusplus >= 201402L
+  assert(std::greater()(1, 0));
+  assert(std::min({5, 1, 10}) == 1);
+  assert(std::max({5, 1, 10}, std::less()) == 10);
+
   assert(std::minmax(1, 0).first == 0);
   assert(std::minmax(1, 0).second == 1);
   assert(std::minmax({0, 10, -10, 100}, std::less()).first == -10);
   assert(std::minmax({0, 10, -10, 100}, std::less()).second == 100);
+#endif
 }
 
 __global__ void kernel() {
-  greater();
   min();
   max();
-  minmax();
+  cpp14_tests();
 }
 
 int main() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39817: [CUDA] Fix std::min on device side to return the min, not the max.

2017-11-10 Thread Justin Lebar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL317961: [CUDA] Fix std::min on device side to return the 
min, not the max. (authored by jlebar).

Changed prior to commit:
  https://reviews.llvm.org/D39817?vs=122151=122563#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39817

Files:
  cfe/trunk/lib/Headers/cuda_wrappers/algorithm


Index: cfe/trunk/lib/Headers/cuda_wrappers/algorithm
===
--- cfe/trunk/lib/Headers/cuda_wrappers/algorithm
+++ cfe/trunk/lib/Headers/cuda_wrappers/algorithm
@@ -80,7 +80,7 @@
 template 
 inline __device__ const __T &
 min(const __T &__a, const __T &__b) {
-  return __a < __b ? __b : __a;
+  return __a < __b ? __a : __b;
 }
 
 #ifdef _LIBCPP_END_NAMESPACE_STD


Index: cfe/trunk/lib/Headers/cuda_wrappers/algorithm
===
--- cfe/trunk/lib/Headers/cuda_wrappers/algorithm
+++ cfe/trunk/lib/Headers/cuda_wrappers/algorithm
@@ -80,7 +80,7 @@
 template 
 inline __device__ const __T &
 min(const __T &__a, const __T &__b) {
-  return __a < __b ? __b : __a;
+  return __a < __b ? __a : __b;
 }
 
 #ifdef _LIBCPP_END_NAMESPACE_STD
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r317961 - [CUDA] Fix std::min on device side to return the min, not the max.

2017-11-10 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Fri Nov 10 17:25:44 2017
New Revision: 317961

URL: http://llvm.org/viewvc/llvm-project?rev=317961=rev
Log:
[CUDA] Fix std::min on device side to return the min, not the max.

Summary:
How embarrassing.

This is tested in the test-suite -- fix to come there in a separate
patch.

Reviewers: tra

Subscribers: sanjoy, cfe-commits

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

Modified:
cfe/trunk/lib/Headers/cuda_wrappers/algorithm

Modified: cfe/trunk/lib/Headers/cuda_wrappers/algorithm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/cuda_wrappers/algorithm?rev=317961=317960=317961=diff
==
--- cfe/trunk/lib/Headers/cuda_wrappers/algorithm (original)
+++ cfe/trunk/lib/Headers/cuda_wrappers/algorithm Fri Nov 10 17:25:44 2017
@@ -80,7 +80,7 @@ min(const __T &__a, const __T &__b, __Cm
 template 
 inline __device__ const __T &
 min(const __T &__a, const __T &__b) {
-  return __a < __b ? __b : __a;
+  return __a < __b ? __a : __b;
 }
 
 #ifdef _LIBCPP_END_NAMESPACE_STD


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


[PATCH] D39930: [CMake] Use libc++ and compiler-rt as default libraries in Fuchsia toolchain

2017-11-10 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr added a comment.

In principle this should be OK since we're unconditionally building the 
runtimes for `default`.
However, this means that any dynamically-linked host builds will assume our 
toolchain-provided shared libraries are available on the runtime host in 
standard library places.
I don't think we want that.  Perhaps we could make `-static-libstdc++` default 
in our host targets.  But that's not really enough, since compiler-rt has some 
too.  Probably better to just disable building the shared libraries altogether 
for the host targets.


Repository:
  rL LLVM

https://reviews.llvm.org/D39930



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


r317959 - Revert "[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang"

2017-11-10 Thread Teresa Johnson via cfe-commits
Author: tejohnson
Date: Fri Nov 10 17:06:41 2017
New Revision: 317959

URL: http://llvm.org/viewvc/llvm-project?rev=317959=rev
Log:
Revert "[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang"

This reverts commit r317951 and r317952. The new test is aborting on
some bots and I'll need to investigate later.

Removed:
cfe/trunk/test/CodeGen/thinlto-debug-pm.c
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=317959=317958=317959=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Nov 10 17:06:41 2017
@@ -1073,7 +1073,6 @@ static void runThinLTOBackend(ModuleSumm
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
   Conf.UseNewPM = CGOpts.ExperimentalNewPassManager;
-  Conf.DebugPassManager = CGOpts.DebugPassManager;
   switch (Action) {
   case Backend_EmitNothing:
 Conf.PreCodeGenModuleHook = [](size_t Task, const Module ) {

Removed: cfe/trunk/test/CodeGen/thinlto-debug-pm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto-debug-pm.c?rev=317958=auto
==
--- cfe/trunk/test/CodeGen/thinlto-debug-pm.c (original)
+++ cfe/trunk/test/CodeGen/thinlto-debug-pm.c (removed)
@@ -1,10 +0,0 @@
-// Test to ensure -fdebug-pass-manager works when invoking the
-// ThinLTO backend path with the new PM.
-// REQUIRES: x86-registered-target
-// RUN: %clang -O2 %s -flto=thin -c -o %t.o
-// RUN: llvm-lto -thinlto -o %t %t.o
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s
-// CHECK: Running pass:
-
-void foo() {
-}


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


r317957 - Handle lambda captures of variable length arrays in profiling and printing.

2017-11-10 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Fri Nov 10 16:54:25 2017
New Revision: 317957

URL: http://llvm.org/viewvc/llvm-project?rev=317957=rev
Log:
Handle lambda captures of variable length arrays in profiling and printing.

From http://reviews.llvm.org/D4368 these cases were thought to not be reachable
and the checks removed before the rest of the code was committed in r216649.
However, these cases are reachable and the checks are added back.

Modified:
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp

Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=317957=317956=317957=diff
==
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Fri Nov 10 16:54:25 2017
@@ -2232,6 +2232,9 @@ void StmtPrinter::VisitLambdaExpr(Lambda
  CEnd = Node->explicit_capture_end();
C != CEnd;
++C) {
+if (C->capturesVLAType())
+  continue;
+
 if (NeedComma)
   OS << ", ";
 NeedComma = true;

Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=317957=317956=317957=diff
==
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Fri Nov 10 16:54:25 2017
@@ -1590,6 +1590,9 @@ StmtProfiler::VisitLambdaExpr(const Lamb
   for (LambdaExpr::capture_iterator C = S->explicit_capture_begin(),
  CEnd = S->explicit_capture_end();
C != CEnd; ++C) {
+if (C->capturesVLAType())
+  continue;
+
 ID.AddInteger(C->getCaptureKind());
 switch (C->getCaptureKind()) {
 case LCK_StarThis:

Modified: cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp?rev=317957=317956=317957=diff
==
--- cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp Fri Nov 10 16:54:25 2017
@@ -55,4 +55,8 @@ struct B : A {
 ;
 // CHECK-NOT: ;
 
+void g(int n) {
+  int buffer[n]; // CHECK: int buffer[n];
+  []() {}();  // CHECK: []
+}
 


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


[PATCH] D39930: [CMake] Use libc++ and compiler-rt as default libraries in Fuchsia toolchain

2017-11-10 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
Herald added subscribers: mgorny, dberris.
Herald added a reviewer: EricWF.

Fuchsia already defaults to libc++ and compiler-rt, but we want to use
these as default runtimes even on the host platform.


Repository:
  rL LLVM

https://reviews.llvm.org/D39930

Files:
  cmake/caches/Fuchsia-stage2.cmake


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -17,6 +17,8 @@
   set(LLVM_ENABLE_LLD ON CACHE BOOL "")
   set(CLANG_DEFAULT_LINKER lld CACHE STRING "")
 endif()
+set(CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "")
+set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "")
 
 # This is a "Does your linker support it?" option that only applies
 # to x86-64 ELF targets.  All Fuchsia target linkers do support it.


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -17,6 +17,8 @@
   set(LLVM_ENABLE_LLD ON CACHE BOOL "")
   set(CLANG_DEFAULT_LINKER lld CACHE STRING "")
 endif()
+set(CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "")
+set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "")
 
 # This is a "Does your linker support it?" option that only applies
 # to x86-64 ELF targets.  All Fuchsia target linkers do support it.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39331: Add flags to control the -finstrument-functions instrumentation calls to __cyg_profile functions

2017-11-10 Thread Hans Wennborg via Phabricator via cfe-commits
hans updated this revision to Diff 122557.
hans added a comment.

Updating to match the LLVM-side: https://reviews.llvm.org/D39287#inline-348143


https://reviews.llvm.org/D39331

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/instrument-functions.c
  test/CodeGen/mcount.c
  test/CodeGen/x86_64-instrument-functions.c
  test/CodeGenCXX/instrument-functions.cpp
  test/Frontend/gnu-mcount.c

Index: test/Frontend/gnu-mcount.c
===
--- test/Frontend/gnu-mcount.c
+++ test/Frontend/gnu-mcount.c
@@ -43,36 +43,36 @@
 
 // CHECK-LABEL: f
 // TODO: add profiling support for arm-baremetal
-// CHECK-ARM-BAREMETAL-EABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01mcount"{{.*}} }
-// CHECK-ARM-BAREMETAL-EABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM64-BAREMETAL-EABI: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} }
-// CHECK-ARM64-BAREMETAL-EABI-MEABI-GNU: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01_mcount"{{.*}} }
-// CHECK-ARM-IOS-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="_mcount"{{.*}} }
-// CHECK-ARM-IOS-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM-EABI: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01mcount"{{.*}} }
-// CHECK-ARM-EABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM64-EABI: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} }
-// CHECK-ARM64-EABI-MEABI-GNU: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01_mcount"{{.*}} }
-// CHECK-ARM64-EABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM64-EABI-LINUX: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01_mcount"{{.*}} }
-// CHECK-ARM-EABI-FREEBSD: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="__mcount"{{.*}} }
-// CHECK-ARM-EABI-FREEBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM64-EABI-FREEBSD: attributes #{{[0-9]+}} = { {{.*}}"counting-function"=".mcount"{{.*}} }
-// CHECK-ARM64-EABI-FREEBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM-EABI-NETBSD: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="_mcount"{{.*}} }
-// CHECK-ARM-EABI-NETBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM-EABI-OPENBSD: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="__mcount"{{.*}} }
-// CHECK-ARM-EABI-OPENBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM64-EABI-OPENBSD: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="__mcount"{{.*}} }
-// CHECK-ARM64-EABI-OPENBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM-EABI-MEABI-GNU-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} }
-// CHECK-ARM-EABI-MEABI-GNU: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM-EABI-RTEMS: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} }
-// CHECK-ARM-EABI-RTEMS-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM64-EABI-RTEMS: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} }
-// CHECK-ARM64-EABI-RTEMS-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM-EABI-CLOUDABI: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} }
-// CHECK-ARM-EABI-CLOUDABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM64-EABI-CLOUDABI: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="mcount"{{.*}} }
-// CHECK-ARM64-EABI-CLOUDABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
+// CHECK-ARM-BAREMETAL-EABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01mcount"{{.*}} }
+// CHECK-ARM-BAREMETAL-EABI-NOT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01__gnu_mcount_nc"{{.*}} }
+// CHECK-ARM64-BAREMETAL-EABI: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="mcount"{{.*}} }
+// CHECK-ARM64-BAREMETAL-EABI-MEABI-GNU: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01_mcount"{{.*}} }
+// CHECK-ARM-IOS-NOT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="_mcount"{{.*}} }
+// CHECK-ARM-IOS-NOT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01__gnu_mcount_nc"{{.*}} }
+// CHECK-ARM-EABI: attributes 

[PATCH] D39829: add new check for property declaration

2017-11-10 Thread Yan Zhang via Phabricator via cfe-commits
Wizard marked 2 inline comments as done.
Wizard added inline comments.



Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:27
+FixItHint generateFixItHint(const ObjCPropertyDecl *Decl) {
+  if (isupper(Decl->getName()[0])) {
+auto NewName = Decl->getName().str();

hokein wrote:
> nit: I would add an assert to make sure the name is not empty.
Added it to the line before generating the warning message.



Comment at: docs/clang-tidy/checks/google-objc-global-variable-declaration.rst:1
 .. title:: clang-tidy - google-objc-global-variable-declaration
 

benhamilton wrote:
> Let's remove "google-" everywhere and mention only Apple's style guide.
Discussed offline. The change here is for another doc. Irrelevant to the new 
check.


https://reviews.llvm.org/D39829



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


[PATCH] D39829: add new check for property declaration

2017-11-10 Thread Yan Zhang via Phabricator via cfe-commits
Wizard updated this revision to Diff 122552.
Wizard marked 9 inline comments as done.
Wizard added a comment.

add custom options


https://reviews.llvm.org/D39829

Files:
  clang-tidy/objc/CMakeLists.txt
  clang-tidy/objc/ObjCTidyModule.cpp
  clang-tidy/objc/PropertyDeclarationCheck.cpp
  clang-tidy/objc/PropertyDeclarationCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/objc-property-declaration.rst
  test/clang-tidy/objc-property-declaration-custom.m
  test/clang-tidy/objc-property-declaration.m

Index: test/clang-tidy/objc-property-declaration.m
===
--- /dev/null
+++ test/clang-tidy/objc-property-declaration.m
@@ -0,0 +1,10 @@
+// RUN: %check_clang_tidy %s objc-property-declaration %t
+@class NSString;
+
+@interface Foo
+@property(assign, nonatomic) int NotCamelCase;
+// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property 'NotCamelCase' is not in proper format according to property naming convention. It should be in the format of lowerCamelCase or has special acronyms [objc-property-declaration]
+// CHECK-FIXES: @property(assign, nonatomic) int notCamelCase;
+@property(assign, nonatomic) int camelCase;
+@property(strong, nonatomic) NSString *URLString;
+@end
Index: test/clang-tidy/objc-property-declaration-custom.m
===
--- /dev/null
+++ test/clang-tidy/objc-property-declaration-custom.m
@@ -0,0 +1,11 @@
+// RUN: %check_clang_tidy %s objc-property-declaration %t \
+// RUN: -config='{CheckOptions: \
+// RUN:  [{key: objc-property-declaration.Acronyms, value: "ABC;TGIF"}]}' \
+// RUN: --
+
+@interface Foo
+@property(assign, nonatomic) int AbcNotRealPrefix;
+// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property 'AbcNotRealPrefix' is not in proper format according to property naming convention. It should be in the format of lowerCamelCase or has special acronyms [objc-property-declaration]
+// CHECK-FIXES: @property(assign, nonatomic) int abcNotRealPrefix;
+@property(assign, nonatomic) int ABCCustomPrefix;
+@end
Index: docs/clang-tidy/checks/objc-property-declaration.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/objc-property-declaration.rst
@@ -0,0 +1,43 @@
+.. title:: clang-tidy - objc-property-declaration
+
+objc-property-declaration
+=
+
+Finds property declarations in Objective-C files that do not follow the pattern
+of property names in Apple's programming guide. The property name should be
+in the format of Lower Camel Case.
+
+For code:
+
+.. code-block:: objc
+
+@property(nonatomic, assign) int LowerCamelCase;
+
+The fix will be:
+
+.. code-block:: objc
+
+@property(nonatomic, assign) int lowerCamelCase;
+
+The check will only fix 'CamelCase' to 'camelCase'. In some other cases we will
+only provide warning messages since the property name could be complicated.
+Users will need to come up with a proper name by their own.
+
+This check also accepts special acronyms as prefix. Such prefix will suppress
+the check of Lower Camel Case according to the guide:
+https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html#//apple_ref/doc/uid/20001281-1002931-BBCFHEAB
+
+For a full list of well-known acronyms:
+https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE
+
+The corresponding style rule: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-1001757
+
+Options
+---
+
+.. option:: Acronyms
+
+   Semicolon-separated list of acronys that can be used as prefix
+   of property names.
+
+   Defaults to ``ASCII;PDF;XML;HTML;URL;RTF;HTTP;TIFF;JPG;PNG;GIF;LZW;ROM;RGB;CMYK;MIDI;FTP``.
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -173,15 +173,16 @@
modernize-use-using
mpi-buffer-deref
mpi-type-mismatch
+   objc-forbidden-subclassing
+   objc-property-declaration
performance-faster-string-find
performance-for-range-copy
performance-implicit-conversion-in-loop
performance-inefficient-string-concatenation
performance-inefficient-vector-operation
performance-type-promotion-in-math-fn
performance-unnecessary-copy-initialization
performance-unnecessary-value-param
-   objc-forbidden-subclassing
readability-avoid-const-params-in-decls
readability-braces-around-statements
readability-container-size-empty
Index: docs/clang-tidy/checks/google-objc-global-variable-declaration.rst

[PATCH] D36790: [ObjC] Messages to 'self' in class methods that return 'instancetype' should use the pointer to the class as the result type of the message

2017-11-10 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

ping


Repository:
  rL LLVM

https://reviews.llvm.org/D36790



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


[PATCH] D39641: [CodeGen] make cbrt and fma constant (never set errno)

2017-11-10 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: lib/Sema/SemaDecl.cpp:12853
+  const llvm::Triple  = Context.getTargetInfo().getTriple();
+  if ((Trip.isGNUEnvironment() || Trip.isKnownWindowsMSVCEnvironment()) &&
+  (Name->isStr("fma") || Name->isStr("fmaf") || Name->isStr("fmal") ||

isOSMSVCRT().

Please check the BuiltinID rather than using string compares.


https://reviews.llvm.org/D39641



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


r317953 - [Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

2017-11-10 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Fri Nov 10 16:08:50 2017
New Revision: 317953

URL: http://llvm.org/viewvc/llvm-project?rev=317953=rev
Log:
[Serialization] Fix some Clang-tidy modernize and Include What You Use 
warnings; other minor fixes (NFC).

Modified:
cfe/trunk/include/clang/Serialization/ASTWriter.h
cfe/trunk/include/clang/Serialization/ModuleManager.h
cfe/trunk/lib/Serialization/ASTReaderInternals.h
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/lib/Serialization/ModuleManager.cpp

Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=317953=317952=317953=diff
==
--- cfe/trunk/include/clang/Serialization/ASTWriter.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTWriter.h Fri Nov 10 16:08:50 2017
@@ -1,4 +1,4 @@
-//===--- ASTWriter.h - AST File Writer --*- C++ 
-*-===//
+//===- ASTWriter.h - AST File Writer *- C++ 
-*-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -11,67 +11,89 @@
 //  containing a serialized representation of a translation unit.
 //
 
//===--===//
+
 #ifndef LLVM_CLANG_SERIALIZATION_ASTWRITER_H
 #define LLVM_CLANG_SERIALIZATION_ASTWRITER_H
 
 #include "clang/AST/ASTMutationListener.h"
 #include "clang/AST/Decl.h"
+#include "clang/AST/DeclarationName.h"
+#include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/TemplateBase.h"
+#include "clang/AST/TemplateName.h"
+#include "clang/AST/Type.h"
+#include "clang/AST/TypeLoc.h"
+#include "clang/Basic/LLVM.h"
+#include "clang/Basic/SourceLocation.h"
 #include "clang/Frontend/PCHContainerOperations.h"
 #include "clang/Sema/SemaConsumer.h"
 #include "clang/Serialization/ASTBitCodes.h"
 #include "clang/Serialization/ASTDeserializationListener.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Bitcode/BitstreamWriter.h"
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
 #include 
 
 namespace llvm {
-  class APFloat;
-  class APInt;
-}
+
+class APFloat;
+class APInt;
+class APSInt;
+
+} // namespace llvm
 
 namespace clang {
 
-class DeclarationName;
 class ASTContext;
+class ASTReader;
+class ASTUnresolvedSet;
 class Attr;
-class NestedNameSpecifier;
 class CXXBaseSpecifier;
 class CXXCtorInitializer;
+class CXXRecordDecl;
+class CXXTemporary;
 class FileEntry;
 class FPOptions;
+class FunctionDecl;
 class HeaderSearch;
 class HeaderSearchOptions;
 class IdentifierResolver;
+class LangOptions;
 class MacroDefinitionRecord;
-class MacroDirective;
 class MacroInfo;
-class OpaqueValueExpr;
-class OpenCLOptions;
-class ASTReader;
 class MemoryBufferCache;
 class Module;
 class ModuleFileExtension;
 class ModuleFileExtensionWriter;
-class PreprocessedEntity;
+class NamedDecl;
+class NestedNameSpecifier;
+class ObjCInterfaceDecl;
 class PreprocessingRecord;
 class Preprocessor;
+struct QualifierInfo;
 class RecordDecl;
 class Sema;
 class SourceManager;
+class Stmt;
 struct StoredDeclsList;
 class SwitchCase;
-class TargetInfo;
+class TemplateParameterList;
 class Token;
+class TypeSourceInfo;
 class VersionTuple;
-class ASTUnresolvedSet;
-
-namespace SrcMgr { class SLocEntry; }
 
 /// \brief Writes an AST file containing the contents of a translation unit.
 ///
@@ -82,14 +104,15 @@ namespace SrcMgr { class SLocEntry; }
 class ASTWriter : public ASTDeserializationListener,
   public ASTMutationListener {
 public:
-  typedef SmallVector RecordData;
-  typedef SmallVectorImpl RecordDataImpl;
-  typedef ArrayRef RecordDataRef;
-
   friend class ASTDeclWriter;
+  friend class ASTRecordWriter;
   friend class ASTStmtWriter;
   friend class ASTTypeWriter;
-  friend class ASTRecordWriter;
+
+  using RecordData = SmallVector;
+  using RecordDataImpl = SmallVectorImpl;
+  using RecordDataRef = ArrayRef;
+
 private:
   /// \brief Map that provides the ID numbers of each type within the
   /// output stream, plus those deserialized from a chained PCH.
@@ -100,9 +123,8 @@ private:
   /// allow for the const/volatile qualifiers.
   ///
   /// Keys in the map never have const/volatile qualifiers.
-  typedef llvm::DenseMap
-TypeIdxMap;
+  using TypeIdxMap = llvm::DenseMap;
 
   /// \brief The bitstream writer used to emit this precompiled header.
   llvm::BitstreamWriter 
@@ -152,8 +174,8 @@ private:
   /// \brief 

r317952 - Add x86-registered-target to REQUIRES for new test

2017-11-10 Thread Teresa Johnson via cfe-commits
Author: tejohnson
Date: Fri Nov 10 16:05:39 2017
New Revision: 317952

URL: http://llvm.org/viewvc/llvm-project?rev=317952=rev
Log:
Add x86-registered-target to REQUIRES for new test

Should fix test added in r317951.

Modified:
cfe/trunk/test/CodeGen/thinlto-debug-pm.c

Modified: cfe/trunk/test/CodeGen/thinlto-debug-pm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto-debug-pm.c?rev=317952=317951=317952=diff
==
--- cfe/trunk/test/CodeGen/thinlto-debug-pm.c (original)
+++ cfe/trunk/test/CodeGen/thinlto-debug-pm.c Fri Nov 10 16:05:39 2017
@@ -1,5 +1,6 @@
 // Test to ensure -fdebug-pass-manager works when invoking the
 // ThinLTO backend path with the new PM.
+// REQUIRES: x86-registered-target
 // RUN: %clang -O2 %s -flto=thin -c -o %t.o
 // RUN: llvm-lto -thinlto -o %t %t.o
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s


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


[PATCH] D39446: [PGO] Detect more structural changes with the stable hash

2017-11-10 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

ok, sgtm


https://reviews.llvm.org/D39446



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


[PATCH] D39446: [PGO] Detect more structural changes with the stable hash

2017-11-10 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added inline comments.



Comment at: lib/CodeGen/CodeGenPGO.cpp:244
+  DEFINE_NESTABLE_TRAVERSAL(CXXTryStmt)
+  DEFINE_NESTABLE_TRAVERSAL(CXXCatchStmt)
+

arphaman wrote:
> What about `ObjCAtTryStmt`?
I thought about this, but: we don't place a counter on ObjC at-try's, so it 
seems a bit moot to invalidate the profile if we see one change.



Comment at: lib/CodeGen/CodeGenPGO.cpp:321
+return PGOHash::ReturnStmt;
+  case Stmt::CXXThrowExprClass:
+return PGOHash::ThrowExpr;

arphaman wrote:
> Might as well include the `ObjCAtThrowStmt` as well.
If profiling at-try isn't very important, I'm not sure the hash should be 
sensitive to at-throw either. I do see situations where it could be helpful, 
but IMO the potential benefit is outweighed by having extra invalidations.


https://reviews.llvm.org/D39446



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


[PATCH] D39446: [PGO] Detect more structural changes with the stable hash

2017-11-10 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

Generally it LG




Comment at: lib/CodeGen/CodeGenPGO.cpp:244
+  DEFINE_NESTABLE_TRAVERSAL(CXXTryStmt)
+  DEFINE_NESTABLE_TRAVERSAL(CXXCatchStmt)
+

What about `ObjCAtTryStmt`?



Comment at: lib/CodeGen/CodeGenPGO.cpp:321
+return PGOHash::ReturnStmt;
+  case Stmt::CXXThrowExprClass:
+return PGOHash::ThrowExpr;

Might as well include the `ObjCAtThrowStmt` as well.


https://reviews.llvm.org/D39446



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


[PATCH] D39641: [CodeGen] make cbrt and fma constant (never set errno)

2017-11-10 Thread Sanjay Patel via Phabricator via cfe-commits
spatel updated this revision to Diff 122545.
spatel added a comment.

Patch updated:
cbrt() is always const. fma() is always const with GNU or Win+MSVC.


https://reviews.llvm.org/D39641

Files:
  include/clang/Basic/Builtins.def
  lib/CodeGen/CGBuiltin.cpp
  lib/Sema/SemaDecl.cpp
  test/CodeGen/libcalls.c
  test/CodeGen/math-builtins.c
  test/CodeGen/math-libcalls.c

Index: test/CodeGen/math-libcalls.c
===
--- test/CodeGen/math-libcalls.c
+++ test/CodeGen/math-libcalls.c
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm  %s | FileCheck %s -check-prefix=NO__ERRNO
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm  %s | FileCheck %s --check-prefix=NO__ERRNO
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
+// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and builtin codegen of math library calls.
 
@@ -145,9 +147,9 @@
 // NO__ERRNO: declare double @cbrt(double) [[READNONE]]
 // NO__ERRNO: declare float @cbrtf(float) [[READNONE]]
 // NO__ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]]
-// HAS_ERRNO: declare double @cbrt(double) [[NOT_READNONE]]
-// HAS_ERRNO: declare float @cbrtf(float) [[NOT_READNONE]]
-// HAS_ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[NOT_READNONE]]
+// HAS_ERRNO: declare double @cbrt(double) [[READNONE]]
+// HAS_ERRNO: declare float @cbrtf(float) [[READNONE]]
+// HAS_ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]]
 
   ceil(f);   ceilf(f);  ceill(f);
 
@@ -244,9 +246,20 @@
 // NO__ERRNO: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC]]
 // NO__ERRNO: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
 // NO__ERRNO: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
-// HAS_ERRNO: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
-// HAS_ERRNO: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
-// HAS_ERRNO: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare double @fma(double, double, double) [[NOT_READNONE]]
+// HAS_ERRNO: declare float @fmaf(float, float, float) [[NOT_READNONE]]
+// HAS_ERRNO: declare x86_fp80 @fmal(x86_fp80, x86_fp80, x86_fp80) [[NOT_READNONE]]
+
+// On GNU or Win, fma never sets errno, so we can convert to the intrinsic.
+
+// HAS_ERRNO_GNU: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
+// HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
+
+// HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
+// HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
+// Long double is just double on win, so no f80 use/declaration.
+// HAS_ERRNO_WIN-NOT: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80)
 
   fmax(f,f);   fmaxf(f,f);  fmaxl(f,f);
 
@@ -528,5 +541,6 @@
 // HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
 // HAS_ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} }
-// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 
+// HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
+// HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
Index: test/CodeGen/math-builtins.c
===
--- test/CodeGen/math-builtins.c
+++ test/CodeGen/math-builtins.c
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm  %s | FileCheck %s -check-prefix=NO__ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
+// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and codegen of math builtins.
 
@@ -175,9 +177,9 @@
 // NO__ERRNO: declare double @cbrt(double) [[READNONE]]
 // NO__ERRNO: declare float @cbrtf(float) [[READNONE]]
 // 

r317951 - [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang

2017-11-10 Thread Teresa Johnson via cfe-commits
Author: tejohnson
Date: Fri Nov 10 15:37:39 2017
New Revision: 317951

URL: http://llvm.org/viewvc/llvm-project?rev=317951=rev
Log:
[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang

Summary:
The LTO Config field wasn't being set when invoking a ThinLTO backend
via clang (i.e. for distributed builds).

Reviewers: danielcdh

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

Added:
cfe/trunk/test/CodeGen/thinlto-debug-pm.c
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=317951=317950=317951=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Nov 10 15:37:39 2017
@@ -1073,6 +1073,7 @@ static void runThinLTOBackend(ModuleSumm
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
   Conf.UseNewPM = CGOpts.ExperimentalNewPassManager;
+  Conf.DebugPassManager = CGOpts.DebugPassManager;
   switch (Action) {
   case Backend_EmitNothing:
 Conf.PreCodeGenModuleHook = [](size_t Task, const Module ) {

Added: cfe/trunk/test/CodeGen/thinlto-debug-pm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto-debug-pm.c?rev=317951=auto
==
--- cfe/trunk/test/CodeGen/thinlto-debug-pm.c (added)
+++ cfe/trunk/test/CodeGen/thinlto-debug-pm.c Fri Nov 10 15:37:39 2017
@@ -0,0 +1,9 @@
+// Test to ensure -fdebug-pass-manager works when invoking the
+// ThinLTO backend path with the new PM.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s
+// CHECK: Running pass:
+
+void foo() {
+}


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


[PATCH] D39923: [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang

2017-11-10 Thread Teresa Johnson via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL317951: [ThinLTO] Handle -fdebug-pass-manager for backend 
invocations via clang (authored by tejohnson).

Repository:
  rL LLVM

https://reviews.llvm.org/D39923

Files:
  cfe/trunk/lib/CodeGen/BackendUtil.cpp
  cfe/trunk/test/CodeGen/thinlto-debug-pm.c


Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp
===
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp
@@ -1073,6 +1073,7 @@
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
   Conf.UseNewPM = CGOpts.ExperimentalNewPassManager;
+  Conf.DebugPassManager = CGOpts.DebugPassManager;
   switch (Action) {
   case Backend_EmitNothing:
 Conf.PreCodeGenModuleHook = [](size_t Task, const Module ) {
Index: cfe/trunk/test/CodeGen/thinlto-debug-pm.c
===
--- cfe/trunk/test/CodeGen/thinlto-debug-pm.c
+++ cfe/trunk/test/CodeGen/thinlto-debug-pm.c
@@ -0,0 +1,9 @@
+// Test to ensure -fdebug-pass-manager works when invoking the
+// ThinLTO backend path with the new PM.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s
+// CHECK: Running pass:
+
+void foo() {
+}


Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp
===
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp
@@ -1073,6 +1073,7 @@
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
   Conf.UseNewPM = CGOpts.ExperimentalNewPassManager;
+  Conf.DebugPassManager = CGOpts.DebugPassManager;
   switch (Action) {
   case Backend_EmitNothing:
 Conf.PreCodeGenModuleHook = [](size_t Task, const Module ) {
Index: cfe/trunk/test/CodeGen/thinlto-debug-pm.c
===
--- cfe/trunk/test/CodeGen/thinlto-debug-pm.c
+++ cfe/trunk/test/CodeGen/thinlto-debug-pm.c
@@ -0,0 +1,9 @@
+// Test to ensure -fdebug-pass-manager works when invoking the
+// ThinLTO backend path with the new PM.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s
+// CHECK: Running pass:
+
+void foo() {
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38425: [clangd] Document highlights for clangd

2017-11-10 Thread William Enright via Phabricator via cfe-commits
Nebiroth added a comment.

This updated patch still does not handle highlighting macro references 
correctly. I will make another patch at a later time for this issue.

In https://reviews.llvm.org/D38425#922408, @ioeric wrote:

> Drive-by comment: in general, have you considered reusing the existing 
> declarations and occurrences finding functionalities in clang-rename? AFAIK, 
> it deals with templates and macros pretty well.
>
> o 
> https://github.com/llvm-mirror/clang/blob/master/include/clang/Tooling/Refactoring/Rename/USRFinder.h
>  
>  o 
> https://github.com/llvm-mirror/clang/blob/master/include/clang/Tooling/Refactoring/Rename/USRLocFinder.h


I'll take a look at it later. Thanks!


https://reviews.llvm.org/D38425



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


[PATCH] D38425: [clangd] Document highlights for clangd

2017-11-10 Thread Eric Liu via Phabricator via cfe-commits
ioeric added a comment.

Drive-by comment: in general, have you considered reusing the existing 
declarations and occurrences finding functionalities in clang-rename? AFAIK, it 
deals with templates and macros pretty well.

o 
https://github.com/llvm-mirror/clang/blob/master/include/clang/Tooling/Refactoring/Rename/USRFinder.h
 
o 
https://github.com/llvm-mirror/clang/blob/master/include/clang/Tooling/Refactoring/Rename/USRLocFinder.h


https://reviews.llvm.org/D38425



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


r317944 - Remove declaration of EmitMCountInstrumentation(). NFC

2017-11-10 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Fri Nov 10 14:34:23 2017
New Revision: 317944

URL: http://llvm.org/viewvc/llvm-project?rev=317944=rev
Log:
Remove declaration of EmitMCountInstrumentation(). NFC

The definition was removed in r280355.

Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=317944=317943=317944=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Fri Nov 10 14:34:23 2017
@@ -1785,9 +1785,6 @@ public:
   /// function instrumentation is enabled.
   void EmitFunctionInstrumentation(const char *Fn);
 
-  /// EmitMCountInstrumentation - Emit call to .mcount.
-  void EmitMCountInstrumentation();
-
   /// Encode an address into a form suitable for use in a function prologue.
   llvm::Constant *EncodeAddrForUseInPrologue(llvm::Function *F,
  llvm::Constant *Addr);


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


LLVM buildmaster will be unavailable for a short time today

2017-11-10 Thread Galina Kistanova via cfe-commits
Hello everyone,

We will be installing some network hardware in the Lab today. Most likely
everything will go well, but there is a chance of network outage around
4:00 PM PST. Thanks for your patience and understanding.

Thanks

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


[PATCH] D38425: [clangd] Document highlights for clangd

2017-11-10 Thread William Enright via Phabricator via cfe-commits
Nebiroth updated this revision to Diff 122529.
Nebiroth added a comment.

Decls and MacroInfos vectors are now private and passed by reference instead of 
copied.
DeclarationLocationsFinder does not store Locations anymore, instead the vector 
is filled in their respective methods in ClangdUnit.cpp
Refactored if condition
Removed redundant newlines at end of test file.


https://reviews.llvm.org/D38425

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/ProtocolHandlers.cpp
  clangd/ProtocolHandlers.h
  test/clangd/documenthighlight.test
  test/clangd/initialize-params-invalid.test
  test/clangd/initialize-params.test

Index: test/clangd/initialize-params.test
===
--- test/clangd/initialize-params.test
+++ test/clangd/initialize-params.test
@@ -20,6 +20,7 @@
 # CHECK-NEXT:  },
 # CHECK-NEXT:  "definitionProvider": true,
 # CHECK-NEXT:  "documentFormattingProvider": true,
+# CHECK-NEXT:	   "documentHighlightProvider": true,
 # CHECK-NEXT:  "documentOnTypeFormattingProvider": {
 # CHECK-NEXT:"firstTriggerCharacter": "}",
 # CHECK-NEXT:"moreTriggerCharacter": []
Index: test/clangd/initialize-params-invalid.test
===
--- test/clangd/initialize-params-invalid.test
+++ test/clangd/initialize-params-invalid.test
@@ -20,6 +20,7 @@
 # CHECK-NEXT:  },
 # CHECK-NEXT:  "definitionProvider": true,
 # CHECK-NEXT:  "documentFormattingProvider": true,
+# CHECK-NEXT:	   "documentHighlightProvider": true,
 # CHECK-NEXT:  "documentOnTypeFormattingProvider": {
 # CHECK-NEXT:"firstTriggerCharacter": "}",
 # CHECK-NEXT:"moreTriggerCharacter": []
@@ -40,6 +41,7 @@
 # CHECK-NEXT:  "textDocumentSync": 1
 # CHECK-NEXT:}
 # CHECK-NEXT:  }
+
 Content-Length: 44
 
 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
Index: test/clangd/documenthighlight.test
===
--- /dev/null
+++ test/clangd/documenthighlight.test
@@ -0,0 +1,37 @@
+# RUN: clangd -run-synchronously < %s | FileCheck %s
+# It is absolutely vital that this file has CRLF line endings.
+#
+Content-Length: 125
+
+{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
+
+Content-Length: 455
+
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"#define MACRO 1\nnamespace ns1 {\nstruct MyClass {\nint xasd;\nvoid anotherOperation() {\n}\nstatic int foo(MyClass*) {\nreturn 0;\n}\n\n};\nstruct Foo {\nint xasd;\n};\n}\nint main() {\nint bonjour;\nbonjour = 2;\nns1::Foo bar = { xasd : 1};\nbar.xasd = 3;\nns1::MyClass* Params;\nParams->anotherOperation();}\n"}}}
+
+Content-Length: 156
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":17,"character":2}}}
+# Go to local variable
+# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":12,"line":16},"start":{"character":4,"line":16}}},{"kind":0,"range":{"end":{"character":7,"line":17},"start":{"character":0,"line":17}}}]}
+
+
+Content-Length: 157
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":18,"character":17}}}
+# Go to local variable
+# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":9,"line":12},"start":{"character":4,"line":12}}},{"kind":1,"range":{"end":{"character":21,"line":18},"start":{"character":17,"line":18}}},{"kind":216,"range":{"end":{"character":21,"line":18},"start":{"character":17,"line":18}}},{"kind":220,"range":{"end":{"character":8,"line":19},"start":{"character":4,"line":19}}}]}
+
+Content-Length: 157
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":21,"character":10}}}
+# Go to local variable
+# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":22,"line":4},"start":{"character":5,"line":4}}},{"kind":0,"range":{"end":{"character":25,"line":21},"start":{"character":8,"line":21}}}]}
+
+Content-Length: 48
+
+{"jsonrpc":"2.0","id":1,"method":"shutdown"}
+
+Content-Length: 33
+
+{"jsonrpc":"2.0":"method":"exit"}			
\ No newline at end of file
Index: clangd/ProtocolHandlers.h
===
--- clangd/ProtocolHandlers.h
+++ clangd/ProtocolHandlers.h
@@ -31,7 +31,6 @@
 public:
   using Ctx = RequestContext;
   virtual ~ProtocolCallbacks() = default;
-
   virtual void onInitialize(Ctx C, InitializeParams ) = 0;
   virtual void onShutdown(Ctx C, 

[libclc] r317940 - native_sqrt: Switch implementation to llvm intrinsic

2017-11-10 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Nov 10 14:16:39 2017
New Revision: 317940

URL: http://llvm.org/viewvc/llvm-project?rev=317940=rev
Log:
native_sqrt: Switch implementation to llvm intrinsic

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely 

Added:
libclc/trunk/generic/lib/math/native_sqrt.cl
Modified:
libclc/trunk/generic/include/clc/math/native_sqrt.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/math/native_sqrt.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_sqrt.h?rev=317940=317939=317940=diff
==
--- libclc/trunk/generic/include/clc/math/native_sqrt.h (original)
+++ libclc/trunk/generic/include/clc/math/native_sqrt.h Fri Nov 10 14:16:39 2017
@@ -1 +1,9 @@
-#define native_sqrt sqrt
+#define __CLC_BODY 
+#define __CLC_FUNCTION native_sqrt
+#define __FLOAT_ONLY
+
+#include 
+
+#undef __FLOAT_ONLY
+#undef __CLC_BODY
+#undef __CLC_FUNCTION

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=317940=317939=317940=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Nov 10 14:16:39 2017
@@ -126,6 +126,7 @@ math/native_log.cl
 math/native_log10.cl
 math/native_log2.cl
 math/native_sin.cl
+math/native_sqrt.cl
 math/tables.cl
 math/clc_nextafter.cl
 math/nextafter.cl

Added: libclc/trunk/generic/lib/math/native_sqrt.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_sqrt.cl?rev=317940=auto
==
--- libclc/trunk/generic/lib/math/native_sqrt.cl (added)
+++ libclc/trunk/generic/lib/math/native_sqrt.cl Fri Nov 10 14:16:39 2017
@@ -0,0 +1,7 @@
+#include 
+
+#define __CLC_NATIVE_INTRINSIC sqrt
+
+#define __CLC_BODY 
+#define __FLOAT_ONLY
+#include 


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


[libclc] r317941 - native_exp10: Switch implementation to llvm intrinsic

2017-11-10 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Nov 10 14:16:41 2017
New Revision: 317941

URL: http://llvm.org/viewvc/llvm-project?rev=317941=rev
Log:
native_exp10: Switch implementation to llvm intrinsic

v2: Use native_log2 instead of wrong constant

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely 

Added:
libclc/trunk/generic/lib/math/native_exp10.cl
libclc/trunk/generic/lib/math/native_exp10.inc
Modified:
libclc/trunk/generic/include/clc/math/native_exp10.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/math/native_exp10.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_exp10.h?rev=317941=317940=317941=diff
==
--- libclc/trunk/generic/include/clc/math/native_exp10.h (original)
+++ libclc/trunk/generic/include/clc/math/native_exp10.h Fri Nov 10 14:16:41 
2017
@@ -1 +1,9 @@
-#define native_exp10 exp10
+#define __CLC_BODY 
+#define __CLC_FUNCTION native_exp10
+#define __FLOAT_ONLY
+
+#include 
+
+#undef __FLOAT_ONLY
+#undef __CLC_BODY
+#undef __CLC_FUNCTION

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=317941=317940=317941=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Nov 10 14:16:41 2017
@@ -121,6 +121,7 @@ math/mad.cl
 math/modf.cl
 math/native_cos.cl
 math/native_exp.cl
+math/native_exp10.cl
 math/native_exp2.cl
 math/native_log.cl
 math/native_log10.cl

Added: libclc/trunk/generic/lib/math/native_exp10.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_exp10.cl?rev=317941=auto
==
--- libclc/trunk/generic/lib/math/native_exp10.cl (added)
+++ libclc/trunk/generic/lib/math/native_exp10.cl Fri Nov 10 14:16:41 2017
@@ -0,0 +1,5 @@
+#include 
+
+#define __CLC_BODY 
+#define __FLOAT_ONLY
+#include 

Added: libclc/trunk/generic/lib/math/native_exp10.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_exp10.inc?rev=317941=auto
==
--- libclc/trunk/generic/lib/math/native_exp10.inc (added)
+++ libclc/trunk/generic/lib/math/native_exp10.inc Fri Nov 10 14:16:41 2017
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_exp10(__CLC_GENTYPE val) {
+  return native_exp2(val * native_log2(10));
+}


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


[libclc] r317937 - native_exp2: Switch implementation to llvm intrinsic

2017-11-10 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Nov 10 14:16:31 2017
New Revision: 317937

URL: http://llvm.org/viewvc/llvm-project?rev=317937=rev
Log:
native_exp2: Switch implementation to llvm intrinsic

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely 

Added:
libclc/trunk/generic/lib/math/native_exp2.cl
Modified:
libclc/trunk/generic/include/clc/math/native_exp2.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/math/native_exp2.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_exp2.h?rev=317937=317936=317937=diff
==
--- libclc/trunk/generic/include/clc/math/native_exp2.h (original)
+++ libclc/trunk/generic/include/clc/math/native_exp2.h Fri Nov 10 14:16:31 2017
@@ -1 +1,9 @@
-#define native_exp2 exp2
+#define __CLC_BODY 
+#define __CLC_FUNCTION native_exp2
+#define __FLOAT_ONLY
+
+#include 
+
+#undef __FLOAT_ONLY
+#undef __CLC_BODY
+#undef __CLC_FUNCTION

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=317937=317936=317937=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Nov 10 14:16:31 2017
@@ -120,6 +120,7 @@ math/logb.cl
 math/mad.cl
 math/modf.cl
 math/native_exp.cl
+math/native_exp2.cl
 math/native_log.cl
 math/native_log10.cl
 math/native_log2.cl

Added: libclc/trunk/generic/lib/math/native_exp2.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_exp2.cl?rev=317937=auto
==
--- libclc/trunk/generic/lib/math/native_exp2.cl (added)
+++ libclc/trunk/generic/lib/math/native_exp2.cl Fri Nov 10 14:16:31 2017
@@ -0,0 +1,7 @@
+#include 
+
+#define __CLC_NATIVE_INTRINSIC exp2
+
+#define __CLC_BODY 
+#define __FLOAT_ONLY
+#include 


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


[libclc] r317938 - native_cos: Switch implementation to llvm intrinsic

2017-11-10 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Nov 10 14:16:33 2017
New Revision: 317938

URL: http://llvm.org/viewvc/llvm-project?rev=317938=rev
Log:
native_cos: Switch implementation to llvm intrinsic

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely 

Added:
libclc/trunk/generic/lib/math/native_cos.cl
Modified:
libclc/trunk/generic/include/clc/math/native_cos.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/math/native_cos.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_cos.h?rev=317938=317937=317938=diff
==
--- libclc/trunk/generic/include/clc/math/native_cos.h (original)
+++ libclc/trunk/generic/include/clc/math/native_cos.h Fri Nov 10 14:16:33 2017
@@ -1 +1,9 @@
-#define native_cos cos
+#define __CLC_BODY 
+#define __CLC_FUNCTION native_cos
+#define __FLOAT_ONLY
+
+#include 
+
+#undef __FLOAT_ONLY
+#undef __CLC_BODY
+#undef __CLC_FUNCTION

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=317938=317937=317938=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Nov 10 14:16:33 2017
@@ -119,6 +119,7 @@ math/log2.cl
 math/logb.cl
 math/mad.cl
 math/modf.cl
+math/native_cos.cl
 math/native_exp.cl
 math/native_exp2.cl
 math/native_log.cl

Added: libclc/trunk/generic/lib/math/native_cos.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_cos.cl?rev=317938=auto
==
--- libclc/trunk/generic/lib/math/native_cos.cl (added)
+++ libclc/trunk/generic/lib/math/native_cos.cl Fri Nov 10 14:16:33 2017
@@ -0,0 +1,7 @@
+#include 
+
+#define __CLC_NATIVE_INTRINSIC cos
+
+#define __CLC_BODY 
+#define __FLOAT_ONLY
+#include 


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


[libclc] r317939 - native_sin: Switch implementation to llvm intrinsic

2017-11-10 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Nov 10 14:16:36 2017
New Revision: 317939

URL: http://llvm.org/viewvc/llvm-project?rev=317939=rev
Log:
native_sin: Switch implementation to llvm intrinsic

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely 

Added:
libclc/trunk/generic/lib/math/native_sin.cl
Modified:
libclc/trunk/generic/include/clc/math/native_sin.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/math/native_sin.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_sin.h?rev=317939=317938=317939=diff
==
--- libclc/trunk/generic/include/clc/math/native_sin.h (original)
+++ libclc/trunk/generic/include/clc/math/native_sin.h Fri Nov 10 14:16:36 2017
@@ -1 +1,9 @@
-#define native_sin sin
+#define __CLC_BODY 
+#define __CLC_FUNCTION native_sin
+#define __FLOAT_ONLY
+
+#include 
+
+#undef __FLOAT_ONLY
+#undef __CLC_BODY
+#undef __CLC_FUNCTION

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=317939=317938=317939=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Nov 10 14:16:36 2017
@@ -125,6 +125,7 @@ math/native_exp2.cl
 math/native_log.cl
 math/native_log10.cl
 math/native_log2.cl
+math/native_sin.cl
 math/tables.cl
 math/clc_nextafter.cl
 math/nextafter.cl

Added: libclc/trunk/generic/lib/math/native_sin.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_sin.cl?rev=317939=auto
==
--- libclc/trunk/generic/lib/math/native_sin.cl (added)
+++ libclc/trunk/generic/lib/math/native_sin.cl Fri Nov 10 14:16:36 2017
@@ -0,0 +1,7 @@
+#include 
+
+#define __CLC_NATIVE_INTRINSIC sin
+
+#define __CLC_BODY 
+#define __FLOAT_ONLY
+#include 


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


[libclc] r317936 - native_exp: Switch implementation to llvm intrinsic

2017-11-10 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Nov 10 14:16:28 2017
New Revision: 317936

URL: http://llvm.org/viewvc/llvm-project?rev=317936=rev
Log:
native_exp: Switch implementation to llvm intrinsic

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely 

Added:
libclc/trunk/generic/lib/math/native_exp.cl
Modified:
libclc/trunk/generic/include/clc/math/native_exp.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/math/native_exp.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_exp.h?rev=317936=317935=317936=diff
==
--- libclc/trunk/generic/include/clc/math/native_exp.h (original)
+++ libclc/trunk/generic/include/clc/math/native_exp.h Fri Nov 10 14:16:28 2017
@@ -1 +1,9 @@
-#define native_exp exp
+#define __CLC_BODY 
+#define __CLC_FUNCTION native_exp
+#define __FLOAT_ONLY
+
+#include 
+
+#undef __FLOAT_ONLY
+#undef __CLC_BODY
+#undef __CLC_FUNCTION

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=317936=317935=317936=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Nov 10 14:16:28 2017
@@ -119,6 +119,7 @@ math/log2.cl
 math/logb.cl
 math/mad.cl
 math/modf.cl
+math/native_exp.cl
 math/native_log.cl
 math/native_log10.cl
 math/native_log2.cl

Added: libclc/trunk/generic/lib/math/native_exp.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_exp.cl?rev=317936=auto
==
--- libclc/trunk/generic/lib/math/native_exp.cl (added)
+++ libclc/trunk/generic/lib/math/native_exp.cl Fri Nov 10 14:16:28 2017
@@ -0,0 +1,7 @@
+#include 
+
+#define __CLC_NATIVE_INTRINSIC exp
+
+#define __CLC_BODY 
+#define __FLOAT_ONLY
+#include 


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


[libclc] r317935 - amdgpu: Add workaround for unimplemented llvm.exp intrinsic

2017-11-10 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Nov 10 14:16:25 2017
New Revision: 317935

URL: http://llvm.org/viewvc/llvm-project?rev=317935=rev
Log:
amdgpu: Add workaround for unimplemented llvm.exp intrinsic

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely 

Added:
libclc/trunk/amdgpu/lib/math/native_exp.cl
libclc/trunk/amdgpu/lib/math/native_exp.inc
Modified:
libclc/trunk/amdgpu/lib/SOURCES

Modified: libclc/trunk/amdgpu/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/SOURCES?rev=317935=317934=317935=diff
==
--- libclc/trunk/amdgpu/lib/SOURCES (original)
+++ libclc/trunk/amdgpu/lib/SOURCES Fri Nov 10 14:16:25 2017
@@ -1,3 +1,4 @@
+math/native_exp.cl
 math/native_log.cl
 math/native_log10.cl
 math/nextafter.cl

Added: libclc/trunk/amdgpu/lib/math/native_exp.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/math/native_exp.cl?rev=317935=auto
==
--- libclc/trunk/amdgpu/lib/math/native_exp.cl (added)
+++ libclc/trunk/amdgpu/lib/math/native_exp.cl Fri Nov 10 14:16:25 2017
@@ -0,0 +1,5 @@
+#include 
+
+#define __CLC_BODY 
+#define __FLOAT_ONLY
+#include 

Added: libclc/trunk/amdgpu/lib/math/native_exp.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/math/native_exp.inc?rev=317935=auto
==
--- libclc/trunk/amdgpu/lib/math/native_exp.inc (added)
+++ libclc/trunk/amdgpu/lib/math/native_exp.inc Fri Nov 10 14:16:25 2017
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_exp(__CLC_GENTYPE val) {
+  return native_exp2(val * M_LOG2E_F);
+}


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


[PATCH] D38425: [clangd] Document highlights for clangd

2017-11-10 Thread William Enright via Phabricator via cfe-commits
Nebiroth updated this revision to Diff 122528.
Nebiroth added a comment.

- Decls and MacroInfos vectors are now private and passed by reference instead 
of copied.


https://reviews.llvm.org/D38425

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/ProtocolHandlers.cpp
  clangd/ProtocolHandlers.h
  test/clangd/documenthighlight.test
  test/clangd/initialize-params-invalid.test
  test/clangd/initialize-params.test

Index: test/clangd/initialize-params.test
===
--- test/clangd/initialize-params.test
+++ test/clangd/initialize-params.test
@@ -20,6 +20,7 @@
 # CHECK-NEXT:  },
 # CHECK-NEXT:  "definitionProvider": true,
 # CHECK-NEXT:  "documentFormattingProvider": true,
+# CHECK-NEXT:	   "documentHighlightProvider": true,
 # CHECK-NEXT:  "documentOnTypeFormattingProvider": {
 # CHECK-NEXT:"firstTriggerCharacter": "}",
 # CHECK-NEXT:"moreTriggerCharacter": []
Index: test/clangd/initialize-params-invalid.test
===
--- test/clangd/initialize-params-invalid.test
+++ test/clangd/initialize-params-invalid.test
@@ -20,6 +20,7 @@
 # CHECK-NEXT:  },
 # CHECK-NEXT:  "definitionProvider": true,
 # CHECK-NEXT:  "documentFormattingProvider": true,
+# CHECK-NEXT:	   "documentHighlightProvider": true,
 # CHECK-NEXT:  "documentOnTypeFormattingProvider": {
 # CHECK-NEXT:"firstTriggerCharacter": "}",
 # CHECK-NEXT:"moreTriggerCharacter": []
@@ -40,6 +41,7 @@
 # CHECK-NEXT:  "textDocumentSync": 1
 # CHECK-NEXT:}
 # CHECK-NEXT:  }
+
 Content-Length: 44
 
 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
Index: test/clangd/documenthighlight.test
===
--- /dev/null
+++ test/clangd/documenthighlight.test
@@ -0,0 +1,37 @@
+# RUN: clangd -run-synchronously < %s | FileCheck %s
+# It is absolutely vital that this file has CRLF line endings.
+#
+Content-Length: 125
+
+{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
+
+Content-Length: 455
+
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"#define MACRO 1\nnamespace ns1 {\nstruct MyClass {\nint xasd;\nvoid anotherOperation() {\n}\nstatic int foo(MyClass*) {\nreturn 0;\n}\n\n};\nstruct Foo {\nint xasd;\n};\n}\nint main() {\nint bonjour;\nbonjour = 2;\nns1::Foo bar = { xasd : 1};\nbar.xasd = 3;\nns1::MyClass* Params;\nParams->anotherOperation();}\n"}}}
+
+Content-Length: 156
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":17,"character":2}}}
+# Go to local variable
+# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":12,"line":16},"start":{"character":4,"line":16}}},{"kind":0,"range":{"end":{"character":7,"line":17},"start":{"character":0,"line":17}}}]}
+
+
+Content-Length: 157
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":18,"character":17}}}
+# Go to local variable
+# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":9,"line":12},"start":{"character":4,"line":12}}},{"kind":1,"range":{"end":{"character":21,"line":18},"start":{"character":17,"line":18}}},{"kind":216,"range":{"end":{"character":21,"line":18},"start":{"character":17,"line":18}}},{"kind":220,"range":{"end":{"character":8,"line":19},"start":{"character":4,"line":19}}}]}
+
+Content-Length: 157
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":21,"character":10}}}
+# Go to local variable
+# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":22,"line":4},"start":{"character":5,"line":4}}},{"kind":0,"range":{"end":{"character":25,"line":21},"start":{"character":8,"line":21}}}]}
+
+Content-Length: 48
+
+{"jsonrpc":"2.0","id":1,"method":"shutdown"}
+
+Content-Length: 33
+
+{"jsonrpc":"2.0":"method":"exit"}			
\ No newline at end of file
Index: clangd/ProtocolHandlers.h
===
--- clangd/ProtocolHandlers.h
+++ clangd/ProtocolHandlers.h
@@ -31,7 +31,6 @@
 public:
   using Ctx = RequestContext;
   virtual ~ProtocolCallbacks() = default;
-
   virtual void onInitialize(Ctx C, InitializeParams ) = 0;
   virtual void onShutdown(Ctx C, ShutdownParams ) = 0;
   virtual void onExit(Ctx C, ExitParams ) = 0;
@@ -54,6 +53,8 @@
   virtual void onFileEvent(Ctx C, DidChangeWatchedFilesParams ) = 0;
   virtual void onCommand(Ctx C, 

[libclc] r317934 - native_log10: Switch to generic native intrinsic inc file

2017-11-10 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Nov 10 14:16:22 2017
New Revision: 317934

URL: http://llvm.org/viewvc/llvm-project?rev=317934=rev
Log:
native_log10: Switch to generic native intrinsic inc file

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely 

Removed:
libclc/trunk/generic/lib/math/native_log10.inc
Modified:
libclc/trunk/generic/lib/math/native_log10.cl

Modified: libclc/trunk/generic/lib/math/native_log10.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log10.cl?rev=317934=317933=317934=diff
==
--- libclc/trunk/generic/lib/math/native_log10.cl (original)
+++ libclc/trunk/generic/lib/math/native_log10.cl Fri Nov 10 14:16:22 2017
@@ -1,10 +1,7 @@
 #include 
 
-#define __CLC_FUNCTION __clc_native_log10
-#define __CLC_INTRINSIC "llvm.log10"
-#undef cl_khr_fp64
-#include 
+#define __CLC_NATIVE_INTRINSIC log10
 
-#define __CLC_BODY 
+#define __CLC_BODY 
 #define __FLOAT_ONLY
 #include 

Removed: libclc/trunk/generic/lib/math/native_log10.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log10.inc?rev=317933=auto
==
--- libclc/trunk/generic/lib/math/native_log10.inc (original)
+++ libclc/trunk/generic/lib/math/native_log10.inc (removed)
@@ -1,3 +0,0 @@
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log10(__CLC_GENTYPE val) {
-  return __clc_native_log10(val);
-}


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


[libclc] r317933 - native_log: Switch to generic native intrinsic inc file

2017-11-10 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Nov 10 14:16:20 2017
New Revision: 317933

URL: http://llvm.org/viewvc/llvm-project?rev=317933=rev
Log:
native_log: Switch to generic native intrinsic inc file

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely 

Removed:
libclc/trunk/generic/lib/math/native_log.inc
Modified:
libclc/trunk/generic/lib/math/native_log.cl

Modified: libclc/trunk/generic/lib/math/native_log.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log.cl?rev=317933=317932=317933=diff
==
--- libclc/trunk/generic/lib/math/native_log.cl (original)
+++ libclc/trunk/generic/lib/math/native_log.cl Fri Nov 10 14:16:20 2017
@@ -22,11 +22,8 @@
 
 #include 
 
-#define __CLC_FUNCTION __clc_native_log
-#define __CLC_INTRINSIC "llvm.log"
-#undef cl_khr_fp64
-#include 
+#define __CLC_NATIVE_INTRINSIC log
 
-#define __CLC_BODY 
+#define __CLC_BODY 
 #define __FLOAT_ONLY
 #include 

Removed: libclc/trunk/generic/lib/math/native_log.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log.inc?rev=317932=auto
==
--- libclc/trunk/generic/lib/math/native_log.inc (original)
+++ libclc/trunk/generic/lib/math/native_log.inc (removed)
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2014,2015 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to 
deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log(__CLC_GENTYPE val) {
-  return __clc_native_log(val);
-}


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


[libclc] r317932 - native_log2: Switch to generic native intrinsic inc file

2017-11-10 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Nov 10 14:16:15 2017
New Revision: 317932

URL: http://llvm.org/viewvc/llvm-project?rev=317932=rev
Log:
native_log2: Switch to generic native intrinsic inc file

v2: Add __CLC_XCONCAT instead of function name redirection
Use __CLC_XCONCAT for intrinsic functions as well

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely 

Added:
libclc/trunk/generic/include/utils.h
libclc/trunk/generic/lib/math/native_unary_intrinsic.inc
  - copied, changed from r317260, 
libclc/trunk/generic/lib/math/native_log2.inc
Removed:
libclc/trunk/generic/lib/math/native_log2.inc
Modified:
libclc/trunk/generic/lib/math/native_log2.cl

Added: libclc/trunk/generic/include/utils.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/utils.h?rev=317932=auto
==
--- libclc/trunk/generic/include/utils.h (added)
+++ libclc/trunk/generic/include/utils.h Fri Nov 10 14:16:15 2017
@@ -0,0 +1,10 @@
+#ifndef __CLC_UTILS_H_
+#define __CLC_UTILS_H_
+
+#define __CLC_CONCAT(x, y) x ## y
+#define __CLC_XCONCAT(x, y) __CLC_CONCAT(x, y)
+
+#define __CLC_STR(x) #x
+#define __CLC_XSTR(x) __CLC_STR(x)
+
+#endif

Modified: libclc/trunk/generic/lib/math/native_log2.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log2.cl?rev=317932=317931=317932=diff
==
--- libclc/trunk/generic/lib/math/native_log2.cl (original)
+++ libclc/trunk/generic/lib/math/native_log2.cl Fri Nov 10 14:16:15 2017
@@ -22,11 +22,7 @@
 
 #include 
 
-#define __CLC_FUNCTION __clc_native_log2
-#define __CLC_INTRINSIC "llvm.log2"
-#undef cl_khr_fp64
-#include 
-
-#define __CLC_BODY 
+#define __CLC_NATIVE_INTRINSIC log2
+#define __CLC_BODY 
 #define __FLOAT_ONLY
 #include 

Removed: libclc/trunk/generic/lib/math/native_log2.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log2.inc?rev=317931=auto
==
--- libclc/trunk/generic/lib/math/native_log2.inc (original)
+++ libclc/trunk/generic/lib/math/native_log2.inc (removed)
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2014,2015 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to 
deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log2(__CLC_GENTYPE val) {
-  return __clc_native_log2(val);
-}

Copied: libclc/trunk/generic/lib/math/native_unary_intrinsic.inc (from r317260, 
libclc/trunk/generic/lib/math/native_log2.inc)
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_unary_intrinsic.inc?p2=libclc/trunk/generic/lib/math/native_unary_intrinsic.inc=libclc/trunk/generic/lib/math/native_log2.inc=317260=317932=317932=diff
==
--- libclc/trunk/generic/lib/math/native_log2.inc (original)
+++ libclc/trunk/generic/lib/math/native_unary_intrinsic.inc Fri Nov 10 
14:16:15 2017
@@ -20,6 +20,21 @@
  * THE SOFTWARE.
  */
 
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log2(__CLC_GENTYPE val) {
-  return __clc_native_log2(val);
+#include 
+
+#ifdef __CLC_SCALAR
+#define __CLC_FUNCTION __CLC_XCONCAT(__clc_native_, __CLC_NATIVE_INTRINSIC)
+#define __CLC_INTRINSIC "llvm." __CLC_XSTR(__CLC_NATIVE_INTRINSIC)
+
+#undef cl_khr_fp64
+#include 
+
+#endif
+
+#define __CLC_FUNCTION __CLC_XCONCAT(native_, __CLC_NATIVE_INTRINSIC)
+
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE val) {
+  return __CLC_XCONCAT(__clc_native_, __CLC_NATIVE_INTRINSIC)(val);
 }
+
+#undef __CLC_FUNCTION


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


[PATCH] D39923: [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang

2017-11-10 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh accepted this revision.
danielcdh added a comment.
This revision is now accepted and ready to land.

Thanks for the fix.


https://reviews.llvm.org/D39923



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


r317931 - Fix for skipped CMake configuration on debuginfo-tests.

2017-11-10 Thread Zachary Turner via cfe-commits
Author: zturner
Date: Fri Nov 10 14:12:04 2017
New Revision: 317931

URL: http://llvm.org/viewvc/llvm-project?rev=317931=rev
Log:
Fix for skipped CMake configuration on debuginfo-tests.

This should have been part of the change to debuginfo-tests, but
it was left out.  This should get the buildbots green.

Modified:
cfe/trunk/test/CMakeLists.txt

Modified: cfe/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=317931=317930=317931=diff
==
--- cfe/trunk/test/CMakeLists.txt (original)
+++ cfe/trunk/test/CMakeLists.txt Fri Nov 10 14:12:04 2017
@@ -88,6 +88,13 @@ set(CLANG_TEST_PARAMS
   clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
   )
 
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt")
+  # This is a hack to keep existing build build infrastructure working while we
+  # can migrate to the new standard workflow of checking out debuginfo-tests 
into
+  # llvm/projects or using it in a mono-repo
+  add_subdirectory(debuginfo-tests)
+endif()
+
 if( NOT CLANG_BUILT_STANDALONE )
   list(APPEND CLANG_TEST_DEPS
 llvm-config


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


[PATCH] D39923: [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang

2017-11-10 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson created this revision.
Herald added subscribers: eraman, inglorion, mehdi_amini.

The LTO Config field wasn't being set when invoking a ThinLTO backend
via clang (i.e. for distributed builds).


https://reviews.llvm.org/D39923

Files:
  lib/CodeGen/BackendUtil.cpp
  test/CodeGen/thinlto-debug-pm.c


Index: test/CodeGen/thinlto-debug-pm.c
===
--- /dev/null
+++ test/CodeGen/thinlto-debug-pm.c
@@ -0,0 +1,9 @@
+// Test to ensure -fdebug-pass-manager works when invoking the
+// ThinLTO backend path with the new PM.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s
+// CHECK: Running pass:
+
+void foo() {
+}
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -1073,6 +1073,7 @@
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
   Conf.UseNewPM = CGOpts.ExperimentalNewPassManager;
+  Conf.DebugPassManager = CGOpts.DebugPassManager;
   switch (Action) {
   case Backend_EmitNothing:
 Conf.PreCodeGenModuleHook = [](size_t Task, const Module ) {


Index: test/CodeGen/thinlto-debug-pm.c
===
--- /dev/null
+++ test/CodeGen/thinlto-debug-pm.c
@@ -0,0 +1,9 @@
+// Test to ensure -fdebug-pass-manager works when invoking the
+// ThinLTO backend path with the new PM.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s
+// CHECK: Running pass:
+
+void foo() {
+}
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -1073,6 +1073,7 @@
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
   Conf.UseNewPM = CGOpts.ExperimentalNewPassManager;
+  Conf.DebugPassManager = CGOpts.DebugPassManager;
   switch (Action) {
   case Backend_EmitNothing:
 Conf.PreCodeGenModuleHook = [](size_t Task, const Module ) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39913: [ObjC] warn about availability attributes missing from a method's declaration when they're specified for a method's definition

2017-11-10 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added a comment.

Any thoughts on having this for regular functions and C++ member functions? 
Seems just as useful there.




Comment at: include/clang/Sema/Sema.h:2406
+  /// This will warn on any missing clauses in the declaration.
+  void checkMissingAvailabilityClausesInDeclaration(NamedDecl *Original, 
NamedDecl *Implementation);
+

Looks longer than 80 chars!



Comment at: lib/Sema/SemaDeclAttr.cpp:2300
+  };
+
+  llvm::SmallPtrSet MissingPlatformAttributes;

I hate to rewrite your function, but have you considered just doing the second 
loop over the attrs inline instead of hidden in the lambda? I think it would 
make the function more simple to avoid all the lambdas and callbacks:
```
for (auto *A : Implementation->specific_attrs()) {
  for (auto *B : Original->specific_attrs()) {
if (A->getPlatform() != B->getPlatform()) continue;
if (A->getIntroduced() != B->getIntroduced() || ...) {
  Diag();
}
  }
}
```
You can do the deprecated check outside of the loop like:
```
if (Impl->hasAttr() && !Original->hasAttr())
```


Repository:
  rL LLVM

https://reviews.llvm.org/D39913



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


[PATCH] D39438: [analyzer] Diagnose stack leaks via block captures

2017-11-10 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap updated this revision to Diff 122507.
alexshap added a comment.

Address the comments


Repository:
  rL LLVM

https://reviews.llvm.org/D39438

Files:
  lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
  test/Analysis/stack-capture-leak-arc.mm
  test/Analysis/stack-capture-leak-no-arc.mm

Index: test/Analysis/stack-capture-leak-no-arc.mm
===
--- test/Analysis/stack-capture-leak-no-arc.mm
+++ test/Analysis/stack-capture-leak-no-arc.mm
@@ -0,0 +1,37 @@
+// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core -fblocks -verify %s
+
+typedef struct dispatch_queue_s *dispatch_queue_t;
+typedef void (^dispatch_block_t)(void);
+void dispatch_async(dispatch_queue_t queue, dispatch_block_t block);
+extern dispatch_queue_t queue;
+
+void test_block_inside_block_async_no_leak() {
+  int x = 123;
+  int *p = 
+  void (^inner)(void) = ^void(void) {
+int y = x;
+++y; 
+  };
+  // Block_copy(...) copies the captured block ("inner") too,
+  // there is no leak in this case.
+  dispatch_async(queue, ^void(void) {
+int z = x;
+++z;
+inner(); 
+  }); // no-warning
+}
+
+dispatch_block_t test_block_inside_block_async_leak() {
+  int x = 123;
+  void (^inner)(void) = ^void(void) {
+int y = x;
+++y; 
+  };
+  void (^outer)(void) = ^void(void) {
+int z = x;
+++z;
+inner(); 
+  }; 
+  return outer; // expected-warning-re{{Address of stack-allocated block declared on line {{.+}} is captured by a returned block}}
+}
+
Index: test/Analysis/stack-capture-leak-arc.mm
===
--- test/Analysis/stack-capture-leak-arc.mm
+++ test/Analysis/stack-capture-leak-arc.mm
@@ -0,0 +1,175 @@
+// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core -fblocks -fobjc-arc -verify %s
+
+typedef struct dispatch_queue_s *dispatch_queue_t;
+typedef void (^dispatch_block_t)(void);
+void dispatch_async(dispatch_queue_t queue, dispatch_block_t block);
+typedef long dispatch_once_t;
+void dispatch_once(dispatch_once_t *predicate, dispatch_block_t block);
+typedef long dispatch_time_t;
+void dispatch_after(dispatch_time_t when, dispatch_queue_t queue, dispatch_block_t block);
+
+extern dispatch_queue_t queue;
+extern dispatch_once_t *predicate;
+extern dispatch_time_t when;
+
+void test_block_expr_async() {
+  int x = 123;
+  int *p = 
+
+  dispatch_async(queue, ^{
+*p = 321;
+  });
+  // expected-warning@-3 {{Address of stack memory associated with local variable 'x' \
+is captured by an asynchronously-executed block}}
+}
+
+void test_block_expr_once_no_leak() {
+  int x = 123;
+  int *p = 
+  // synchronous, no warning
+  dispatch_once(predicate, ^{
+*p = 321;
+  });
+}
+
+void test_block_expr_after() {
+  int x = 123;
+  int *p = 
+  dispatch_after(when, queue, ^{
+*p = 321;
+  });
+  // expected-warning@-3 {{Address of stack memory associated with local variable 'x' \
+is captured by an asynchronously-executed block}}
+}
+
+void test_block_expr_async_no_leak() {
+  int x = 123;
+  int *p = 
+  // no leak
+  dispatch_async(queue, ^{
+int y = x;
+++y;
+  });
+}
+
+void test_block_var_async() {
+  int x = 123;
+  int *p = 
+  void (^b)(void) = ^void(void) {
+*p = 1; 
+  };
+  dispatch_async(queue, b);
+  // expected-warning@-1 {{Address of stack memory associated with local variable 'x' \
+is captured by an asynchronously-executed block}}
+}
+
+void test_block_with_ref_async() {
+  int x = 123;
+  int  = x;
+  void (^b)(void) = ^void(void) {
+r = 1; 
+  };
+  dispatch_async(queue, b);
+  // expected-warning@-1 {{Address of stack memory associated with local variable 'x' \
+is captured by an asynchronously-executed block}}
+}
+
+dispatch_block_t get_leaking_block() {
+  int leaked_x = 791;
+  int *p = _x;
+  return ^void(void) {
+*p = 1; 
+  };
+  // expected-warning@-3 {{Address of stack memory associated with local variable 'leaked_x' \
+is captured by a returned block}}
+}
+
+void test_returned_from_func_block_async() {
+  dispatch_async(queue, get_leaking_block());
+  // expected-warning@-1 {{Address of stack memory associated with local variable 'leaked_x' \
+is captured by an asynchronously-executed block}}
+}
+
+// synchronous, no leak
+void test_block_var_once() {
+  int x = 123;
+  int *p = 
+  void (^b)(void) = ^void(void) {
+*p = 1; 
+  };
+  dispatch_once(predicate, b); // no-warning
+}
+
+void test_block_var_after() {
+  int x = 123;
+  int *p = 
+  void (^b)(void) = ^void(void) {
+*p = 1; 
+  };
+  dispatch_after(when, queue, b);
+  // expected-warning@-1 {{Address of stack memory associated with local variable 'x' \
+is captured by an asynchronously-executed block}}
+}
+
+void test_block_var_async_no_leak() {
+  int x = 123;
+  int *p = 
+  void (^b)(void) = ^void(void) {
+int y = x;
+++y; 
+  };
+  dispatch_async(queue, b); // no-warning
+}
+
+void 

r317925 - [debuginfo-tests] Make debuginfo-tests work in a standard configuration.

2017-11-10 Thread Zachary Turner via cfe-commits
Author: zturner
Date: Fri Nov 10 12:57:57 2017
New Revision: 317925

URL: http://llvm.org/viewvc/llvm-project?rev=317925=rev
Log:
[debuginfo-tests] Make debuginfo-tests work in a standard configuration.

Previously, debuginfo-tests was expected to be checked out into
clang/test and then the tests would automatically run as part of
check-clang.  This is not a standard workflow for handling
external projects, and it brings with it some serious drawbacks
such as the inability to depend on things other than clang, which
we will need going forward.

The goal of this patch is to migrate towards a more standard
workflow.  To ease the transition for build bot maintainers,
this patch tries not to break the existing workflow, but instead
simply deprecate it to give maintainers a chance to update
the build infrastructure.

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

Modified:
cfe/trunk/test/lit.cfg.py

Modified: cfe/trunk/test/lit.cfg.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg.py?rev=317925=317924=317925=diff
==
--- cfe/trunk/test/lit.cfg.py (original)
+++ cfe/trunk/test/lit.cfg.py Fri Nov 10 12:57:57 2017
@@ -58,8 +58,6 @@ tool_dirs = [config.clang_tools_dir, con
 
 tools = [
 'c-index-test', 'clang-check', 'clang-diff', 'clang-format', 'opt',
-ToolSubst('%test_debuginfo', command=os.path.join(
-config.llvm_src_root, 'utils', 'test_debuginfo.pl')),
 ToolSubst('%clang_func_map', command=FindTool(
 'clang-func-mapping'), unresolved='ignore'),
 ]


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


[PATCH] D39918: [libunwind] Remove a FIXME about truncated section names

2017-11-10 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo created this revision.
Herald added a subscriber: aprantl.

If the linker chose to store the full section name instead of truncating it, 
this field doesn't contain a truncated name, but an offset into the string 
table of the binary. The string table isn't loaded/mapped into memory during 
runtime though, so it's not possible to read the full section name, unless we 
try to locate the DLL/EXE on disk that the HMODULE corresponds to and load that 
manually.

This also has the practical consequence that with the current LLD, we must not 
enable debug info (i.e. must link with -s with the mingw frontend). If debug 
info is enabled, the full ".eh_frame" name is written into the string table and 
the the section name itself is just an offset, e.g. "/4".

Alternatives to fixing this consequence are:

- Making LLD always output a truncated ".eh_fram" (maybe only when -lldmingw is 
specified?), even if debug info is enabled. (GNU ld doesn't do this, so this 
approach in libunwind won't work with binaries built with that.)
- Switch to statically registering the .eh_frame sections on startup, instead 
of dynamically enumerating them when needed. This is what libgcc does. This 
doesn't match what libunwind does on other platforms though. This only works as 
long as libunwind is linked dynamically so that all involved DLLs register 
their sections to the same instance of libunwind. (I haven't succeeded in 
building a shared libcxx/libcxxabi/libunwind yet for mingw though.)


https://reviews.llvm.org/D39918

Files:
  src/AddressSpace.hpp


Index: src/AddressSpace.hpp
===
--- src/AddressSpace.hpp
+++ src/AddressSpace.hpp
@@ -382,8 +382,6 @@
   found_obj = true;
   } else if (!strncmp((const char *)pish->Name, ".eh_frame",
   IMAGE_SIZEOF_SHORT_NAME)) {
-// FIXME: This section name actually is truncated, ideally we
-// should locate and check the full long name instead.
 info.dwarf_section = begin;
 info.dwarf_section_length = pish->Misc.VirtualSize;
 found_hdr = true;


Index: src/AddressSpace.hpp
===
--- src/AddressSpace.hpp
+++ src/AddressSpace.hpp
@@ -382,8 +382,6 @@
   found_obj = true;
   } else if (!strncmp((const char *)pish->Name, ".eh_frame",
   IMAGE_SIZEOF_SHORT_NAME)) {
-// FIXME: This section name actually is truncated, ideally we
-// should locate and check the full long name instead.
 info.dwarf_section = begin;
 info.dwarf_section_length = pish->Misc.VirtualSize;
 found_hdr = true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39915: [clang] Remove redundant return [NFC]

2017-11-10 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang created this revision.
mgrang added a project: clang.
Herald added a subscriber: jholewinski.

https://reviews.llvm.org/D39915

Files:
  lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
  lib/Driver/Driver.cpp
  lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp


Index: lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp
@@ -107,8 +107,6 @@
   }
 
   reportUseAfterDealloc(ReceiverSymbol, Desc, M.getOriginExpr(), C);
-
-  return;
 }
 
 void ObjCSuperDeallocChecker::checkPreCall(const CallEvent ,
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -598,8 +598,6 @@
   //
   // TODO: Add support for other offloading programming models here.
   //
-
-  return;
 }
 
 Compilation *Driver::BuildCompilation(ArrayRef ArgList) {
Index: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
===
--- lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
+++ lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
@@ -409,7 +409,6 @@
   CodeGen.setAction(Action);
   emitTargetOutlinedFunctionHelper(D, ParentName, OutlinedFn, OutlinedFnID,
IsOffloadEntry, CodeGen);
-  return;
 }
 
 void CGOpenMPRuntimeNVPTX::emitSpmdEntryHeader(


Index: lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp
@@ -107,8 +107,6 @@
   }
 
   reportUseAfterDealloc(ReceiverSymbol, Desc, M.getOriginExpr(), C);
-
-  return;
 }
 
 void ObjCSuperDeallocChecker::checkPreCall(const CallEvent ,
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -598,8 +598,6 @@
   //
   // TODO: Add support for other offloading programming models here.
   //
-
-  return;
 }
 
 Compilation *Driver::BuildCompilation(ArrayRef ArgList) {
Index: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
===
--- lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
+++ lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
@@ -409,7 +409,6 @@
   CodeGen.setAction(Action);
   emitTargetOutlinedFunctionHelper(D, ParentName, OutlinedFn, OutlinedFnID,
IsOffloadEntry, CodeGen);
-  return;
 }
 
 void CGOpenMPRuntimeNVPTX::emitSpmdEntryHeader(
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39641: [CodeGen] make cbrt and fma constant (never set errno)

2017-11-10 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

cbrt() can't underflow; that's not how cube roots work.  If 0 x. 
 See also the definition of rootn() in IEEE 754 (which specifies no exceptions 
for n=3).

For fma(), sure, I guess we could whitelist glibc and msvcrt, if you're worried 
there's some unknown implementation which sets ERANGE.


https://reviews.llvm.org/D39641



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


[PATCH] D39913: [ObjC] warn about availability attributes missing from a method's declaration when they're specified for a method's definition

2017-11-10 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman created this revision.
Herald added a subscriber: javed.absar.

This patch extends the -Wavailability warning to warn about cases where a 
method declaration is missing an availability attribute clause that's present 
in the method's definition. We also warn about missing `deprecated` attributes 
as well.

rdar://15540962


Repository:
  rL LLVM

https://reviews.llvm.org/D39913

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/SemaObjC/method-attributes.m
  test/SemaObjC/unguarded-availability.m
  test/SemaObjC/warn-missing-method-decl-availability.m

Index: test/SemaObjC/warn-missing-method-decl-availability.m
===
--- /dev/null
+++ test/SemaObjC/warn-missing-method-decl-availability.m
@@ -0,0 +1,139 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9.0.0 -fsyntax-only -verify -Wno-objc-root-class %s
+
+// Warn about availability attribute when they're specified in the definition
+// of the method instead of the declaration.
+// rdar://15540962
+
+@interface MissingAvailabilityThingsInInterface
+
+- (void)missingIDO; // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}}
+
+- (void)missingDO __attribute__((availability(macos, introduced=10.1))); // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}}
+
+- (void)missingD __attribute__((availability(macos, introduced=10.1))); // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}}
+
+- (void)missingIx2; // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}}
+// expected-warning@-1 {{method declaration is missing an availability attribute for iOS that is specified in the definition}}
+
+- (void)missingIDOiOS __attribute__((availability(macos, introduced=10.1))); // expected-warning {{method declaration is missing an availability attribute for iOS that is specified in the definition}}
+
+- (void)differentIMissingD __attribute__((availability(macos, introduced=10.1))); // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}}
+// expected-note@-1 {{previous attribute is here}}
+
+- (void)missingUnavailable; // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}}
+
+- (void)same
+__attribute__((availability(macos, introduced=10.1)))
+__attribute__((availability(ios, unavailable)));
+
+- (void)missingDeprecatedAttr; // expected-warning {{method declaration is missing a deprecated attribute that is specified in the definition}}
+
+- (void)sameDeprecatedAttr __attribute__((deprecated("y")));
+
+@end
+
+@interface MissingAvailabilityThingsInInterface()
+
+- (void)missingInClassExtension; // expected-warning {{method declaration is missing an availability attribute for macOS that is specified in the definition}}
+
+@end
+
+@implementation MissingAvailabilityThingsInInterface
+
+- (void)missingIDO
+__attribute__((availability(macos, introduced=10.1, deprecated=10.2, obsoleted=10.3))) // expected-note {{definition with macOS availability attribute is here}}
+{ }
+
+- (void)missingDO
+__attribute__((availability(macos, introduced=10.1)))
+__attribute__((availability(macos, deprecated=10.2, obsoleted=10.3))) // expected-note {{definition with macOS availability attribute is here}}
+{ }
+
+- (void)missingD
+__attribute__((availability(macos, introduced=10.1, deprecated=10.2))) // expected-note {{definition with macOS availability attribute is here}}
+{ }
+
+- (void)missingIx2
+__attribute__((availability(ios, introduced=10))) // expected-note {{definition with iOS availability attribute is here}}
+__attribute__((availability(macos, introduced=10.1))) // expected-note {{definition with macOS availability attribute is here}}
+{ }
+
+- (void)missingIDOiOS
+__attribute__((availability(ios, introduced=10, deprecated=11, obsoleted=11.1))) // expected-note {{definition with iOS availability attribute is here}}
+__attribute__((availability(macOS, introduced=10.1)))
+{ }
+
+- (void)differentIMissingD __attribute__((availability(macos, introduced=10.2, deprecated=10.3))) // expected-note {{definition with macOS availability attribute is here}}
+{ } // expected-warning@-1{{availability does not match previous declaration}}
+
+- (void)missingInClassExtension
+__attribute__((availability(macos, introduced=10.1, deprecated=10.2))) // expected-note {{definition with macOS availability attribute is here}}
+{ }
+
+- (void)missingUnavailable
+__attribute__((availability(macos, unavailable))); // expected-note {{definition with macOS availability attribute is here}}
+{ }
+
+- (void)same

[PATCH] D39878: AMDGPU: Add -mxnack/-mno-xnack options that set +/-xnack feature

2017-11-10 Thread Konstantin Zhuravlyov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL317917: AMDGPU: Add -mxnack/-mno-xnack options that set 
+/-xnack feature (authored by kzhuravl).

Changed prior to commit:
  https://reviews.llvm.org/D39878?vs=122355=122489#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39878

Files:
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/test/Driver/amdgpu-features.c


Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1822,7 +1822,6 @@
 
 def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, 
Group,
   HelpText<"Generate code which only uses the general purpose registers 
(AArch64 only)">;
-
 def mfix_cortex_a53_835769 : Flag<["-"], "mfix-cortex-a53-835769">,
   Group,
   HelpText<"Workaround Cortex-A53 erratum 835769 (AArch64 only)">;
@@ -1840,6 +1839,10 @@
   Group,
   HelpText<"Generate additional code for specified  of debugger ABI 
(AMDGPU only)">,
   MetaVarName<"">;
+def mxnack : Flag<["-"], "mxnack">, Group,
+  HelpText<"Enable XNACK (AMDGPU only)">;
+def mno_xnack : Flag<["-"], "mno-xnack">, Group,
+  HelpText<"Disable XNACK (AMDGPU only)">;
 
 def faltivec : Flag<["-"], "faltivec">, Group, Flags<[DriverOption]>;
 def fno_altivec : Flag<["-"], "fno-altivec">, Group, 
Flags<[DriverOption]>;
Index: cfe/trunk/test/Driver/amdgpu-features.c
===
--- cfe/trunk/test/Driver/amdgpu-features.c
+++ cfe/trunk/test/Driver/amdgpu-features.c
@@ -5,3 +5,9 @@
 // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri 
-mamdgpu-debugger-abi=1.0 %s -o - 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s
 // CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" 
"+amdgpu-debugger-insert-nops" "-target-feature" 
"+amdgpu-debugger-reserve-regs" "-target-feature" 
"+amdgpu-debugger-emit-prologue"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mxnack %s 2>&1 | FileCheck 
--check-prefix=XNACK %s
+// XNACK: "-target-feature" "+xnack"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-xnack %s 2>&1 | FileCheck 
--check-prefix=NO-XNACK %s
+// NO-XNACK: "-target-feature" "-xnack"


Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1822,7 +1822,6 @@
 
 def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group,
   HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">;
-
 def mfix_cortex_a53_835769 : Flag<["-"], "mfix-cortex-a53-835769">,
   Group,
   HelpText<"Workaround Cortex-A53 erratum 835769 (AArch64 only)">;
@@ -1840,6 +1839,10 @@
   Group,
   HelpText<"Generate additional code for specified  of debugger ABI (AMDGPU only)">,
   MetaVarName<"">;
+def mxnack : Flag<["-"], "mxnack">, Group,
+  HelpText<"Enable XNACK (AMDGPU only)">;
+def mno_xnack : Flag<["-"], "mno-xnack">, Group,
+  HelpText<"Disable XNACK (AMDGPU only)">;
 
 def faltivec : Flag<["-"], "faltivec">, Group, Flags<[DriverOption]>;
 def fno_altivec : Flag<["-"], "fno-altivec">, Group, Flags<[DriverOption]>;
Index: cfe/trunk/test/Driver/amdgpu-features.c
===
--- cfe/trunk/test/Driver/amdgpu-features.c
+++ cfe/trunk/test/Driver/amdgpu-features.c
@@ -5,3 +5,9 @@
 // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-abi=1.0 %s -o - 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s
 // CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" "+amdgpu-debugger-insert-nops" "-target-feature" "+amdgpu-debugger-reserve-regs" "-target-feature" "+amdgpu-debugger-emit-prologue"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mxnack %s 2>&1 | FileCheck --check-prefix=XNACK %s
+// XNACK: "-target-feature" "+xnack"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-xnack %s 2>&1 | FileCheck --check-prefix=NO-XNACK %s
+// NO-XNACK: "-target-feature" "-xnack"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r317917 - AMDGPU: Add -mxnack/-mno-xnack options that set +/-xnack feature

2017-11-10 Thread Konstantin Zhuravlyov via cfe-commits
Author: kzhuravl
Date: Fri Nov 10 11:28:25 2017
New Revision: 317917

URL: http://llvm.org/viewvc/llvm-project?rev=317917=rev
Log:
AMDGPU: Add -mxnack/-mno-xnack options that set +/-xnack feature

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

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/test/Driver/amdgpu-features.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=317917=317916=317917=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Nov 10 11:28:25 2017
@@ -1822,7 +1822,6 @@ def mno_neg_immediates: Flag<["-"], "mno
 
 def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, 
Group,
   HelpText<"Generate code which only uses the general purpose registers 
(AArch64 only)">;
-
 def mfix_cortex_a53_835769 : Flag<["-"], "mfix-cortex-a53-835769">,
   Group,
   HelpText<"Workaround Cortex-A53 erratum 835769 (AArch64 only)">;
@@ -1840,6 +1839,10 @@ def mamdgpu_debugger_abi : Joined<["-"],
   Group,
   HelpText<"Generate additional code for specified  of debugger ABI 
(AMDGPU only)">,
   MetaVarName<"">;
+def mxnack : Flag<["-"], "mxnack">, Group,
+  HelpText<"Enable XNACK (AMDGPU only)">;
+def mno_xnack : Flag<["-"], "mno-xnack">, Group,
+  HelpText<"Disable XNACK (AMDGPU only)">;
 
 def faltivec : Flag<["-"], "faltivec">, Group, Flags<[DriverOption]>;
 def fno_altivec : Flag<["-"], "fno-altivec">, Group, 
Flags<[DriverOption]>;

Modified: cfe/trunk/test/Driver/amdgpu-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/amdgpu-features.c?rev=317917=317916=317917=diff
==
--- cfe/trunk/test/Driver/amdgpu-features.c (original)
+++ cfe/trunk/test/Driver/amdgpu-features.c Fri Nov 10 11:28:25 2017
@@ -5,3 +5,9 @@
 // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri 
-mamdgpu-debugger-abi=1.0 %s -o - 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s
 // CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" 
"+amdgpu-debugger-insert-nops" "-target-feature" 
"+amdgpu-debugger-reserve-regs" "-target-feature" 
"+amdgpu-debugger-emit-prologue"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mxnack %s 2>&1 | FileCheck 
--check-prefix=XNACK %s
+// XNACK: "-target-feature" "+xnack"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-xnack %s 2>&1 | FileCheck 
--check-prefix=NO-XNACK %s
+// NO-XNACK: "-target-feature" "-xnack"


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


[PATCH] D38801: [analyzer] In getSVal() API, disable auto-detection of void type as char type.

2017-11-10 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin accepted this revision.
dcoughlin added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!

In https://reviews.llvm.org/D38801#910524, @NoQ wrote:

> Also the overload between `getSVal(Ex, LC)` and `getSVal(R, Ty)`, when they 
> do completely different things, seems confusing.


Yes! I think we should change this (possibly rename them both?). I think it is 
a big barrier to entry -- I certainly found it super confusing when first 
getting started on the analyzer code base.


https://reviews.llvm.org/D38801



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


[PATCH] D39803: [analyzer] pr34766: Fix a crash on explicit construction of std::initializer_list.

2017-11-10 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin accepted this revision.
dcoughlin added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D39803



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


[PATCH] D39877: AMDGPU/NFC: Move getAMDGPUTargetFeatures to AMDGPU toolchain

2017-11-10 Thread Konstantin Zhuravlyov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL317909: AMDGPU/NFC: Move getAMDGPUTargetFeatures to AMDGPU 
toolchain (authored by kzhuravl).

Changed prior to commit:
  https://reviews.llvm.org/D39877?vs=122354=122487#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39877

Files:
  cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp
  cfe/trunk/lib/Driver/ToolChains/AMDGPU.h
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp

Index: cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp
+++ cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp
@@ -11,6 +11,7 @@
 #include "CommonArgs.h"
 #include "InputInfo.h"
 #include "clang/Driver/Compilation.h"
+#include "clang/Driver/DriverDiagnostic.h"
 #include "llvm/Option/ArgList.h"
 
 using namespace clang::driver;
@@ -35,6 +36,24 @@
   CmdArgs, Inputs));
 }
 
+void amdgpu::getAMDGPUTargetFeatures(const Driver ,
+ const llvm::opt::ArgList ,
+ std::vector ) {
+  if (const Arg *dAbi = Args.getLastArg(options::OPT_mamdgpu_debugger_abi)) {
+StringRef value = dAbi->getValue();
+if (value == "1.0") {
+  Features.push_back("+amdgpu-debugger-insert-nops");
+  Features.push_back("+amdgpu-debugger-reserve-regs");
+  Features.push_back("+amdgpu-debugger-emit-prologue");
+} else {
+  D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args);
+}
+  }
+
+  handleTargetFeaturesGroup(
+Args, Features, options::OPT_m_amdgpu_Features_Group);
+}
+
 /// AMDGPU Toolchain
 AMDGPUToolChain::AMDGPUToolChain(const Driver , const llvm::Triple ,
  const ArgList )
Index: cfe/trunk/lib/Driver/ToolChains/AMDGPU.h
===
--- cfe/trunk/lib/Driver/ToolChains/AMDGPU.h
+++ cfe/trunk/lib/Driver/ToolChains/AMDGPU.h
@@ -19,7 +19,6 @@
 namespace clang {
 namespace driver {
 namespace tools {
-
 namespace amdgpu {
 
 class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
@@ -33,6 +32,9 @@
 const char *LinkingOutput) const override;
 };
 
+void getAMDGPUTargetFeatures(const Driver , const llvm::opt::ArgList ,
+ std::vector );
+
 } // end namespace amdgpu
 } // end namespace tools
 
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -15,6 +15,7 @@
 #include "Arch/Sparc.h"
 #include "Arch/SystemZ.h"
 #include "Arch/X86.h"
+#include "AMDGPU.h"
 #include "CommonArgs.h"
 #include "Hexagon.h"
 #include "InputInfo.h"
@@ -278,23 +279,6 @@
   handleTargetFeaturesGroup(Args, Features, options::OPT_m_wasm_Features_Group);
 }
 
-static void getAMDGPUTargetFeatures(const Driver , const ArgList ,
-std::vector ) {
-  if (const Arg *dAbi = Args.getLastArg(options::OPT_mamdgpu_debugger_abi)) {
-StringRef value = dAbi->getValue();
-if (value == "1.0") {
-  Features.push_back("+amdgpu-debugger-insert-nops");
-  Features.push_back("+amdgpu-debugger-reserve-regs");
-  Features.push_back("+amdgpu-debugger-emit-prologue");
-} else {
-  D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args);
-}
-  }
-
-  handleTargetFeaturesGroup(
-Args, Features, options::OPT_m_amdgpu_Features_Group);
-}
-
 static void getTargetFeatures(const ToolChain , const llvm::Triple ,
   const ArgList , ArgStringList ,
   bool ForAS) {
@@ -347,7 +331,7 @@
 break;
   case llvm::Triple::r600:
   case llvm::Triple::amdgcn:
-getAMDGPUTargetFeatures(D, Args, Features);
+amdgpu::getAMDGPUTargetFeatures(D, Args, Features);
 break;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r317909 - AMDGPU/NFC: Move getAMDGPUTargetFeatures to AMDGPU toolchain

2017-11-10 Thread Konstantin Zhuravlyov via cfe-commits
Author: kzhuravl
Date: Fri Nov 10 11:09:57 2017
New Revision: 317909

URL: http://llvm.org/viewvc/llvm-project?rev=317909=rev
Log:
AMDGPU/NFC: Move getAMDGPUTargetFeatures to AMDGPU toolchain

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

Modified:
cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp
cfe/trunk/lib/Driver/ToolChains/AMDGPU.h
cfe/trunk/lib/Driver/ToolChains/Clang.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp?rev=317909=317908=317909=diff
==
--- cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp Fri Nov 10 11:09:57 2017
@@ -11,6 +11,7 @@
 #include "CommonArgs.h"
 #include "InputInfo.h"
 #include "clang/Driver/Compilation.h"
+#include "clang/Driver/DriverDiagnostic.h"
 #include "llvm/Option/ArgList.h"
 
 using namespace clang::driver;
@@ -35,6 +36,24 @@ void amdgpu::Linker::ConstructJob(Compil
   CmdArgs, Inputs));
 }
 
+void amdgpu::getAMDGPUTargetFeatures(const Driver ,
+ const llvm::opt::ArgList ,
+ std::vector ) {
+  if (const Arg *dAbi = Args.getLastArg(options::OPT_mamdgpu_debugger_abi)) {
+StringRef value = dAbi->getValue();
+if (value == "1.0") {
+  Features.push_back("+amdgpu-debugger-insert-nops");
+  Features.push_back("+amdgpu-debugger-reserve-regs");
+  Features.push_back("+amdgpu-debugger-emit-prologue");
+} else {
+  D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args);
+}
+  }
+
+  handleTargetFeaturesGroup(
+Args, Features, options::OPT_m_amdgpu_Features_Group);
+}
+
 /// AMDGPU Toolchain
 AMDGPUToolChain::AMDGPUToolChain(const Driver , const llvm::Triple ,
  const ArgList )

Modified: cfe/trunk/lib/Driver/ToolChains/AMDGPU.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/AMDGPU.h?rev=317909=317908=317909=diff
==
--- cfe/trunk/lib/Driver/ToolChains/AMDGPU.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/AMDGPU.h Fri Nov 10 11:09:57 2017
@@ -19,7 +19,6 @@
 namespace clang {
 namespace driver {
 namespace tools {
-
 namespace amdgpu {
 
 class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
@@ -33,6 +32,9 @@ public:
 const char *LinkingOutput) const override;
 };
 
+void getAMDGPUTargetFeatures(const Driver , const llvm::opt::ArgList ,
+ std::vector );
+
 } // end namespace amdgpu
 } // end namespace tools
 

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=317909=317908=317909=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri Nov 10 11:09:57 2017
@@ -15,6 +15,7 @@
 #include "Arch/Sparc.h"
 #include "Arch/SystemZ.h"
 #include "Arch/X86.h"
+#include "AMDGPU.h"
 #include "CommonArgs.h"
 #include "Hexagon.h"
 #include "InputInfo.h"
@@ -278,23 +279,6 @@ static void getWebAssemblyTargetFeatures
   handleTargetFeaturesGroup(Args, Features, 
options::OPT_m_wasm_Features_Group);
 }
 
-static void getAMDGPUTargetFeatures(const Driver , const ArgList ,
-std::vector ) {
-  if (const Arg *dAbi = Args.getLastArg(options::OPT_mamdgpu_debugger_abi)) {
-StringRef value = dAbi->getValue();
-if (value == "1.0") {
-  Features.push_back("+amdgpu-debugger-insert-nops");
-  Features.push_back("+amdgpu-debugger-reserve-regs");
-  Features.push_back("+amdgpu-debugger-emit-prologue");
-} else {
-  D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args);
-}
-  }
-
-  handleTargetFeaturesGroup(
-Args, Features, options::OPT_m_amdgpu_Features_Group);
-}
-
 static void getTargetFeatures(const ToolChain , const llvm::Triple ,
   const ArgList , ArgStringList ,
   bool ForAS) {
@@ -347,7 +331,7 @@ static void getTargetFeatures(const Tool
 break;
   case llvm::Triple::r600:
   case llvm::Triple::amdgcn:
-getAMDGPUTargetFeatures(D, Args, Features);
+amdgpu::getAMDGPUTargetFeatures(D, Args, Features);
 break;
   }
 


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


[PATCH] D39641: [CodeGen] make cbrt and fma constant (never set errno)

2017-11-10 Thread Sanjay Patel via Phabricator via cfe-commits
spatel added a comment.

Based on the comments in https://reviews.llvm.org/D39611, I think we have to 
change this (although I'd be happy to be wrong).

1. cbrt() can underflow and could set errno to ERANGE.
2. fma() can overflow or underflow and set errno to ERANGE.

We could still make an exception for a GNU environment (as was drafted in 
https://reviews.llvm.org/D39611) if we're confident that that implementation 
guarantees that it won't ever set errno for these 2 functions?


https://reviews.llvm.org/D39641



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


[PATCH] D39800: [analyzer] pr34404: Fix a crash on pointers to members in nested anonymous structures.

2017-11-10 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin accepted this revision.
dcoughlin added a comment.

LGTM.

I suppose we could move the logic that constructs pointers to members for 
fields here (right now that logic is in ExprEngine::VisitUnaryOperator()'s 
handling of '&'). However, since the AST's DeclRefExpr for the field is marked 
as an lvalue this would be slightly odd -- we would have the value of an lvalue 
expression be a non-Loc.


https://reviews.llvm.org/D39800



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


[PATCH] D39821: Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission

2017-11-10 Thread Jake Ehrlich via Phabricator via cfe-commits
jakehehrlich added a comment.

> Another option would be to restrict `CLANG_DEFAULT_OBJCOPY` to contain 
> `objcopy` or even to only allow `objcopy` or `llvm-objcopy`. I don't know if 
> that's sensible though...

I think there are some other strip/objcopy like implementations out there but I 
think objcopy and llvm-objcopy are the only ones that support --extract-dwo and 
--strip-dwo right now but more could come. I think objcopy and llvm-objcopy are 
the only ones that have "objcopy" in the name so the current test kind of 
enforces that one of them must be used. Also the user might want to pull 
objcopy or llvm-objcopy from a specific place on their system (not just from 
PATH) so however we restrict this, it will have to be much more general than 
just allowing "objcopy" or "llvm-objcopy". That said restricting the set of 
program names seems reasonable to me since you should in theory be able to add 
your program to the CMakeList.txt check on CLANG_DEFAULT_OBJCOPY if you want 
clang to support it. I don't think any other implementation of objcopy is 
likely to exist anytime soon though so it seems kind of moot to me.


Repository:
  rL LLVM

https://reviews.llvm.org/D39821



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


[PATCH] D39611: [CodeGen] change const-ness of complex calls

2017-11-10 Thread Sanjay Patel via Phabricator via cfe-commits
spatel updated this revision to Diff 122474.
spatel added a comment.

Patch updated:
Except for cimag, cproj, conj, and creal, everything in  is marked 'e' 
- the functions are not const if we might set errno.


https://reviews.llvm.org/D39611

Files:
  include/clang/Basic/Builtins.def
  test/CodeGen/complex-builtins.c
  test/CodeGen/complex-libcalls.c
  test/CodeGen/libcall-declarations.c

Index: test/CodeGen/libcall-declarations.c
===
--- test/CodeGen/libcall-declarations.c
+++ test/CodeGen/libcall-declarations.c
@@ -569,50 +569,50 @@
 // CHECK-ERRNO: declare double @trunc(double) [[NUWRN]]
 // CHECK-ERRNO: declare float @truncf(float) [[NUWRN]]
 // CHECK-ERRNO: declare x86_fp80 @truncl(x86_fp80) [[NUWRN]]
-// CHECK-ERRNO: declare double @cabs(double, double) [[NUWRN]]
-// CHECK-ERRNO: declare float @cabsf(<2 x float>) [[NUWRN]]
-// CHECK-ERRNO: declare { double, double } @cacos(double, double) [[NUWRN]]
-// CHECK-ERRNO: declare <2 x float> @cacosf(<2 x float>) [[NUWRN]]
-// CHECK-ERRNO: declare { double, double } @cacosh(double, double) [[NUWRN]]
-// CHECK-ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[NUWRN]]
-// CHECK-ERRNO: declare double @carg(double, double) [[NUWRN]]
-// CHECK-ERRNO: declare float @cargf(<2 x float>) [[NUWRN]]
-// CHECK-ERRNO: declare { double, double } @casin(double, double) [[NUWRN]]
-// CHECK-ERRNO: declare <2 x float> @casinf(<2 x float>) [[NUWRN]]
-// CHECK-ERRNO: declare { double, double } @casinh(double, double) [[NUWRN]]
-// CHECK-ERRNO: declare <2 x float> @casinhf(<2 x float>) [[NUWRN]]
-// CHECK-ERRNO: declare { double, double } @catan(double, double) [[NUWRN]]
-// CHECK-ERRNO: declare <2 x float> @catanf(<2 x float>) [[NUWRN]]
-// CHECK-ERRNO: declare { double, double } @catanh(double, double) [[NUWRN]]
-// CHECK-ERRNO: declare <2 x float> @catanhf(<2 x float>) [[NUWRN]]
-// CHECK-ERRNO: declare { double, double } @ccos(double, double) [[NUWRN]]
-// CHECK-ERRNO: declare <2 x float> @ccosf(<2 x float>) [[NUWRN]]
-// CHECK-ERRNO: declare { double, double } @ccosh(double, double) [[NUWRN]]
-// CHECK-ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[NUWRN]]
-// CHECK-ERRNO: declare { double, double } @cexp(double, double) [[NUWRN]]
-// CHECK-ERRNO: declare <2 x float> @cexpf(<2 x float>) [[NUWRN]]
+// CHECK-ERRNO: declare double @cabs(double, double) [[NONCONST]]
+// CHECK-ERRNO: declare float @cabsf(<2 x float>) [[NONCONST]]
+// CHECK-ERRNO: declare { double, double } @cacos(double, double) [[NONCONST]]
+// CHECK-ERRNO: declare <2 x float> @cacosf(<2 x float>) [[NONCONST]]
+// CHECK-ERRNO: declare { double, double } @cacosh(double, double) [[NONCONST]]
+// CHECK-ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[NONCONST]]
+// CHECK-ERRNO: declare double @carg(double, double) [[NONCONST]]
+// CHECK-ERRNO: declare float @cargf(<2 x float>) [[NONCONST]]
+// CHECK-ERRNO: declare { double, double } @casin(double, double) [[NONCONST]]
+// CHECK-ERRNO: declare <2 x float> @casinf(<2 x float>) [[NONCONST]]
+// CHECK-ERRNO: declare { double, double } @casinh(double, double) [[NONCONST]]
+// CHECK-ERRNO: declare <2 x float> @casinhf(<2 x float>) [[NONCONST]]
+// CHECK-ERRNO: declare { double, double } @catan(double, double) [[NONCONST]]
+// CHECK-ERRNO: declare <2 x float> @catanf(<2 x float>) [[NONCONST]]
+// CHECK-ERRNO: declare { double, double } @catanh(double, double) [[NONCONST]]
+// CHECK-ERRNO: declare <2 x float> @catanhf(<2 x float>) [[NONCONST]]
+// CHECK-ERRNO: declare { double, double } @ccos(double, double) [[NONCONST]]
+// CHECK-ERRNO: declare <2 x float> @ccosf(<2 x float>) [[NONCONST]]
+// CHECK-ERRNO: declare { double, double } @ccosh(double, double) [[NONCONST]]
+// CHECK-ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[NONCONST]]
+// CHECK-ERRNO: declare { double, double } @cexp(double, double) [[NONCONST]]
+// CHECK-ERRNO: declare <2 x float> @cexpf(<2 x float>) [[NONCONST]]
 // CHECK-ERRNO: declare double @cimag(double, double) [[NUWRN]]
 // CHECK-ERRNO: declare float @cimagf(<2 x float>) [[NUWRN]]
 // CHECK-ERRNO: declare { double, double } @conj(double, double) [[NUWRN]]
 // CHECK-ERRNO: declare <2 x float> @conjf(<2 x float>) [[NUWRN]]
-// CHECK-ERRNO: declare { double, double } @clog(double, double) [[NUWRN]]
-// CHECK-ERRNO: declare <2 x float> @clogf(<2 x float>) [[NUWRN]]
+// CHECK-ERRNO: declare { double, double } @clog(double, double) [[NONCONST]]
+// CHECK-ERRNO: declare <2 x float> @clogf(<2 x float>) [[NONCONST]]
 // CHECK-ERRNO: declare { double, double } @cproj(double, double) [[NUWRN]]
 // CHECK-ERRNO: declare <2 x float> @cprojf(<2 x float>) [[NUWRN]]
-// CHECK-ERRNO: declare { double, double } @cpow(double, double, double, double) [[NUWRN]]
-// CHECK-ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x float>) [[NUWRN]]
+// CHECK-ERRNO: declare { double, double } @cpow(double, double, double, double) [[NONCONST]]
+// CHECK-ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x 

[PATCH] D39821: Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission

2017-11-10 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

In https://reviews.llvm.org/D39821#922026, @jakehehrlich wrote:

> In https://reviews.llvm.org/D39821#921703, @Hahnfeld wrote:
>
> > I think the current tests will only pass iff the executable name ends with 
> > `objcopy` - can we make this more reliable?
>
>
> If I read the tests (split-debug.h, split-debug.c, and split-debug.s) 
> correctly they check for the existence of the word "objcopy" somewhere in the 
> executables name. I'm not sure how to make it anymore flexible than that. The 
> right thing to do would be to somehow get the string from CMake and use that 
> in this test. I'm not sure of llvm-lit supports any kind of find and replace 
> like that however.


Right you are, I must have missed `{{.*}}` at the end. Another option would be 
to restrict `CLANG_DEFAULT_OBJCOPY` to contain `objcopy` or even to only allow 
`objcopy` or `llvm-objcopy`. I don't know if that's sensible though...


Repository:
  rL LLVM

https://reviews.llvm.org/D39821



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


[PATCH] D39730: Enabling constructor code completion

2017-11-10 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

Also,




Comment at: lib/Sema/SemaCodeComplete.cpp:980
+  if (isa(R.Declaration)
+  && dyn_cast(CurContext) == nullptr
+  && dyn_cast(CurContext) == nullptr

arphaman wrote:
> You can use `!isa`
Have you checked if this check works correctly in cases like this:

```
// main tu
int x = foo::
foo bar;
int x = bar.
```

I suspect the scope will be `TranslationUnitDecl` there as well.



https://reviews.llvm.org/D39730



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


[PATCH] D39821: Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission

2017-11-10 Thread Jake Ehrlich via Phabricator via cfe-commits
jakehehrlich added a comment.

In https://reviews.llvm.org/D39821#921703, @Hahnfeld wrote:

> I think the current tests will only pass iff the executable name ends with 
> `objcopy` - can we make this more reliable?


If I read the tests (split-debug.h, split-debug.c, and split-debug.s) correctly 
they check for the existence of the word "objcopy" somewhere in the executables 
name. I'm not sure how to make it anymore flexible than that. The right thing 
to do would be to somehow get the string from CMake and use that in this test. 
I'm not sure of llvm-lit supports any kind of find and replace like that 
however.


Repository:
  rL LLVM

https://reviews.llvm.org/D39821



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


[PATCH] D39730: Enabling constructor code completion

2017-11-10 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

It doesn't look like this works in the body of the class (at least there's no 
test for it). For that you might have to inject these kind results by 
performing another lookup when completing inside the body of the class.




Comment at: lib/Sema/SemaCodeComplete.cpp:980
+  if (isa(R.Declaration)
+  && dyn_cast(CurContext) == nullptr
+  && dyn_cast(CurContext) == nullptr

You can use `!isa`


https://reviews.llvm.org/D39730



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


[PATCH] D39730: Enabling constructor code completion

2017-11-10 Thread Jan Korous via Phabricator via cfe-commits
jkorous-apple updated this revision to Diff 122470.
jkorous-apple added a comment.

I am able to enable ctor completion selectively in translate unit scope and 
namespace scope so ctor completion does not appear in dot access context. I 
haven't figured out how to explicitly specify that completion context needs to 
be qualified id though.


https://reviews.llvm.org/D39730

Files:
  lib/Sema/SemaCodeComplete.cpp
  test/CodeCompletion/ctor.cpp


Index: test/CodeCompletion/ctor.cpp
===
--- /dev/null
+++ test/CodeCompletion/ctor.cpp
@@ -0,0 +1,50 @@
+struct foo {
+  foo();
+  ~foo();
+
+  foo(const foo&) = delete;
+  foo(foo&&) = delete;
+  foo& operator=(const foo&) = delete;
+  foo& operator=(foo&&) = delete;
+
+  static bool faz;
+  int far;
+};
+
+foo::foo() { }
+// RUN: c-index-test -code-completion-at=%s:14:7 %s | FileCheck 
-check-prefix=CHECK-TRANSLATION-UNIT %s
+// CHECK-TRANSLATION-UNIT:CXXConstructor:{TypedText foo}{LeftParen 
(}{RightParen )} (35)
+// CHECK-TRANSLATION-UNIT:CXXConstructor:{TypedText foo}{LeftParen 
(}{Placeholder const foo &}{RightParen )} (35) (unavailable)
+// CHECK-TRANSLATION-UNIT:CXXConstructor:{TypedText foo}{LeftParen 
(}{Placeholder foo &&}{RightParen )} (35) (unavailable)
+
+namespace ns_foo {
+struct foo {
+  foo();
+  ~foo();
+
+  foo(const foo&) = delete;
+  foo(foo&&) = delete;
+  foo& operator=(const foo&) = delete;
+  foo& operator=(foo&&) = delete;
+
+  static bool faz;
+  int far;
+};
+
+foo::foo() { }
+// RUN: c-index-test -code-completion-at=%s:34:7 %s | FileCheck 
-check-prefix=CHECK-NAMESPACE %s
+// CHECK-NAMESPACE: CXXConstructor:{TypedText foo}{LeftParen (}{RightParen )} 
(35)
+// CHECK-NAMESPACE: CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder 
const ns_foo::foo &}{RightParen )} (35) (unavailable)
+// CHECK-NAMESPACE: CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder 
ns_foo::foo &&}{RightParen )} (35) (unavailable)
+
+}
+
+int main() {
+  foo baz;
+  baz.far = 5;
+  foo::faz = 42;
+}
+// RUN: c-index-test -code-completion-at=%s:44:7 %s | not grep "CXXConstructor"
+// RUN: c-index-test -code-completion-at=%s:44:8 %s | not grep "CXXConstructor"
+// RUN: c-index-test -code-completion-at=%s:45:8 %s | not grep "CXXConstructor"
+// RUN: c-index-test -code-completion-at=%s:45:9 %s | not grep "CXXConstructor"
Index: lib/Sema/SemaCodeComplete.cpp
===
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -975,9 +975,11 @@
   bool AsNestedNameSpecifier = false;
   if (!isInterestingDecl(R.Declaration, AsNestedNameSpecifier))
 return;
-  
-  // C++ constructors are never found by name lookup.
-  if (isa(R.Declaration))
+
+  if (isa(R.Declaration)
+  && dyn_cast(CurContext) == nullptr
+  && dyn_cast(CurContext) == nullptr
+)
 return;
 
   if (Hiding && CheckHiddenResult(R, CurContext, Hiding))


Index: test/CodeCompletion/ctor.cpp
===
--- /dev/null
+++ test/CodeCompletion/ctor.cpp
@@ -0,0 +1,50 @@
+struct foo {
+  foo();
+  ~foo();
+
+  foo(const foo&) = delete;
+  foo(foo&&) = delete;
+  foo& operator=(const foo&) = delete;
+  foo& operator=(foo&&) = delete;
+
+  static bool faz;
+  int far;
+};
+
+foo::foo() { }
+// RUN: c-index-test -code-completion-at=%s:14:7 %s | FileCheck -check-prefix=CHECK-TRANSLATION-UNIT %s
+// CHECK-TRANSLATION-UNIT:CXXConstructor:{TypedText foo}{LeftParen (}{RightParen )} (35)
+// CHECK-TRANSLATION-UNIT:CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder const foo &}{RightParen )} (35) (unavailable)
+// CHECK-TRANSLATION-UNIT:CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder foo &&}{RightParen )} (35) (unavailable)
+
+namespace ns_foo {
+struct foo {
+  foo();
+  ~foo();
+
+  foo(const foo&) = delete;
+  foo(foo&&) = delete;
+  foo& operator=(const foo&) = delete;
+  foo& operator=(foo&&) = delete;
+
+  static bool faz;
+  int far;
+};
+
+foo::foo() { }
+// RUN: c-index-test -code-completion-at=%s:34:7 %s | FileCheck -check-prefix=CHECK-NAMESPACE %s
+// CHECK-NAMESPACE: CXXConstructor:{TypedText foo}{LeftParen (}{RightParen )} (35)
+// CHECK-NAMESPACE: CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder const ns_foo::foo &}{RightParen )} (35) (unavailable)
+// CHECK-NAMESPACE: CXXConstructor:{TypedText foo}{LeftParen (}{Placeholder ns_foo::foo &&}{RightParen )} (35) (unavailable)
+
+}
+
+int main() {
+  foo baz;
+  baz.far = 5;
+  foo::faz = 42;
+}
+// RUN: c-index-test -code-completion-at=%s:44:7 %s | not grep "CXXConstructor"
+// RUN: c-index-test -code-completion-at=%s:44:8 %s | not grep "CXXConstructor"
+// RUN: c-index-test -code-completion-at=%s:45:8 %s | not grep "CXXConstructor"
+// RUN: c-index-test -code-completion-at=%s:45:9 %s | not grep "CXXConstructor"
Index: lib/Sema/SemaCodeComplete.cpp
===
--- 

[PATCH] D39611: [CodeGen] change const-ness of complex calls

2017-11-10 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment.

In https://reviews.llvm.org/D39611#921923, @spatel wrote:

> Thanks for the clarification!
>
> If I'm reading this properly, we should make the same kind of change as in 
> https://reviews.llvm.org/D39481 ('c' -> 'e') for most of complex.h. Ie, the 
> standard allows errno-setting, and it's (unfortunately for optimization) even 
> more clearly stated in the newer additions to the standards.
>
> We can leave these functions as always constant ('c') because they don't 
> actually do any math and therefore won't set errno:
>  cimag ( http://en.cppreference.com/w/c/numeric/complex/cimag )
>  creal ( http://en.cppreference.com/w/c/numeric/complex/creal )
>  cproj ( http://en.cppreference.com/w/c/numeric/complex/cproj )
>  conj (http://en.cppreference.com/w/c/numeric/complex/conj )


Sounds right to me.


https://reviews.llvm.org/D39611



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


Re: r315614 - [Sema] Diagnose tautological comparison with type's min/max values

2017-11-10 Thread Hans Wennborg via cfe-commits
On Thu, Oct 12, 2017 at 2:33 PM, Roman Lebedev via cfe-commits
 wrote:
> On Fri, Oct 13, 2017 at 12:12 AM, Nico Weber  wrote:
>> Huh, I consider clang not warning on this a feature, not a bug. Why are we
>> trying to match what gcc does here?
> Because i have been bitten by this more than once.
> It did result in big amount of wasted time, and this "thread":
> https://lists.llvm.org/pipermail/llvm-dev/2017-August/116390.html
>
> As with all the clang diagnostics, you can disable them
> I personally don't have any opinion on comparisons with
> std::numeric_limits<...>::{min,max}()

To disable the new warning but keep the ones we used to have enabled,
we now need to pass -Wno-tautological-constant-compare
-Wtautological-unsigned-zero-compare
-Wtautological-constant-out-of-range-compare, which is quite a
mouthful. It would perhaps be better if the new warning could have
been behind a flag that could be disabled separately.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39706: [refactor][extract] Initial implementation of variable captures

2017-11-10 Thread Eric Liu via Phabricator via cfe-commits
ioeric added inline comments.



Comment at: lib/Tooling/Refactoring/Extract/CaptureVariables.cpp:97
+  }
+  llvm_unreachable("invalid kind!");
+}

A more informative message would be better.



Comment at: lib/Tooling/Refactoring/Extract/CaptureVariables.h:36
+  explicit CapturedExtractedEntity(const VarDecl *VD)
+  : Kind(CapturedVarDecl), VD(VD) {}
+

arphaman wrote:
> ioeric wrote:
> > Maybe a `FIXME` here for `Kind`?
> I think this constructor will always set the same kind.
Then why do you need `Kind`? Is it changed somewhere else? Please document the 
behavior,



Comment at: lib/Tooling/Refactoring/Extract/CaptureVariables.h:28
+/// passed to the extracted function as an argument.
+class CapturedExtractedEntity {
+  enum EntityKind {

The name is a bit hard to parse. Maybe just `CapturedEntity` or simply 
`CapturedVar`? 


Repository:
  rL LLVM

https://reviews.llvm.org/D39706



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


[PATCH] D39161: [bindings] remove unique_external test failure

2017-11-10 Thread Masud Rahman via Phabricator via cfe-commits
frutiger added a comment.

Thanks for the note, I'll wait.


https://reviews.llvm.org/D39161



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


[PATCH] D39611: [CodeGen] change const-ness of complex calls

2017-11-10 Thread Sanjay Patel via Phabricator via cfe-commits
spatel added a comment.

Thanks for the clarification!

If I'm reading this properly, we should make the same kind of change as in 
https://reviews.llvm.org/D39481 ('c' -> 'e') for most of complex.h. Ie, the 
standard allows errno-setting, and it's (unfortunately for optimization) even 
more clearly stated in the newer additions to the standards.

We can leave these functions as always constant ('c') because they don't 
actually do any math and therefore won't set errno:
cimag ( http://en.cppreference.com/w/c/numeric/complex/cimag )
creal ( http://en.cppreference.com/w/c/numeric/complex/creal )
cproj ( http://en.cppreference.com/w/c/numeric/complex/cproj )
conj (http://en.cppreference.com/w/c/numeric/complex/conj )


https://reviews.llvm.org/D39611



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


[PATCH] D39478: [clang-format] Handle leading comments in using declaration

2017-11-10 Thread Daniel Jasper via Phabricator via cfe-commits
djasper closed this revision.
djasper added a comment.

Submitted as r317901.


https://reviews.llvm.org/D39478



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


r317901 - [clang-format] Handle leading comments in using declaration

2017-11-10 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Fri Nov 10 09:11:18 2017
New Revision: 317901

URL: http://llvm.org/viewvc/llvm-project?rev=317901=rev
Log:
[clang-format] Handle leading comments in using declaration

This fixes clang-format internal assertion for the following code:

  /* override */ using std::string;

Patch by Igor Sugak. Thank you.

Modified:
cfe/trunk/lib/Format/UsingDeclarationsSorter.cpp
cfe/trunk/unittests/Format/UsingDeclarationsSorterTest.cpp

Modified: cfe/trunk/lib/Format/UsingDeclarationsSorter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UsingDeclarationsSorter.cpp?rev=317901=317900=317901=diff
==
--- cfe/trunk/lib/Format/UsingDeclarationsSorter.cpp (original)
+++ cfe/trunk/lib/Format/UsingDeclarationsSorter.cpp Fri Nov 10 09:11:18 2017
@@ -172,15 +172,17 @@ std::pair UsingDeclarations;
   for (size_t I = 0, E = AnnotatedLines.size(); I != E; ++I) {
+const auto *FirstTok = AnnotatedLines[I]->First;
 if (AnnotatedLines[I]->InPPDirective ||
-!AnnotatedLines[I]->startsWith(tok::kw_using) ||
-AnnotatedLines[I]->First->Finalized) {
+!AnnotatedLines[I]->startsWith(tok::kw_using) || FirstTok->Finalized) {
   endUsingDeclarationBlock(, SourceMgr, );
   continue;
 }
-if (AnnotatedLines[I]->First->NewlinesBefore > 1)
+if (FirstTok->NewlinesBefore > 1)
   endUsingDeclarationBlock(, SourceMgr, );
-std::string Label = computeUsingDeclarationLabel(AnnotatedLines[I]->First);
+const auto *UsingTok =
+FirstTok->is(tok::comment) ? FirstTok->getNextNonComment() : FirstTok;
+std::string Label = computeUsingDeclarationLabel(UsingTok);
 if (Label.empty()) {
   endUsingDeclarationBlock(, SourceMgr, );
   continue;

Modified: cfe/trunk/unittests/Format/UsingDeclarationsSorterTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/UsingDeclarationsSorterTest.cpp?rev=317901=317900=317901=diff
==
--- cfe/trunk/unittests/Format/UsingDeclarationsSorterTest.cpp (original)
+++ cfe/trunk/unittests/Format/UsingDeclarationsSorterTest.cpp Fri Nov 10 
09:11:18 2017
@@ -348,6 +348,13 @@ TEST_F(UsingDeclarationsSorterTest, Sort
   {tooling::Range(19, 1)}));
 }
 
+TEST_F(UsingDeclarationsSorterTest, 
SortsUsingDeclarationsWithLeadingkComments) {
+  EXPECT_EQ("/* comment */ using a;\n"
+"/* comment */ using b;",
+sortUsingDeclarations("/* comment */ using b;\n"
+  "/* comment */ using a;"));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang


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


[PATCH] D39161: [bindings] remove unique_external test failure

2017-11-10 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

I've rewritten the tests to use `unittest`, so this patch needs to be updated 
now. However, you may want to wait a while since @compnerd promised to look at 
it and he might have a way to get `uniqueExternal()` linkage.


https://reviews.llvm.org/D39161



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


[PATCH] D39900: Refactor ContinuationIndenter's breakProtrudingToken logic into slightly moreorthogonal pieces.

2017-11-10 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir accepted this revision.
krasimir added a comment.
This revision is now accepted and ready to land.

Maybe we should further refactor `getRawStringStyle` into 
`llvm::Optional> getRawStringStyleAndDelimiter` and 
that would nicely take care of the duplicated effort?


https://reviews.llvm.org/D39900



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


r317898 - [NFC] Pacify bbot for OpenMP 'teams distribute parallel for'

2017-11-10 Thread Carlo Bertolli via cfe-commits
Author: cbertol
Date: Fri Nov 10 08:49:09 2017
New Revision: 317898

URL: http://llvm.org/viewvc/llvm-project?rev=317898=rev
Log:
[NFC] Pacify bbot for OpenMP 'teams distribute parallel for'

Modified:
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_messages.cpp

Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_messages.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_messages.cpp?rev=317898=317897=317898=diff
==
--- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_messages.cpp Fri Nov 10 
08:49:09 2017
@@ -94,7 +94,7 @@ L1:
   }
 
 #pragma omp target
-#pragma omp teams distribute parallel for copyin(pvt) // expected-error 
{{unexpected OpenMP clause 'copyin' in directive '#pragma omp teams distribute 
parallel for'}}
+#pragma omp teams distribute parallel for copyin(pvt)
   for (int n = 0; n < 100; ++n) {}
 
   return 0;


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


[PATCH] D39829: add new check for property declaration

2017-11-10 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments.



Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:41
+  objcPropertyDecl(
+  // the property name should be in Lower Camel Case like
+  // 'lowerCamelCase'

benhamilton wrote:
> There are some exceptions we should special case. Acronyms like `URL` and 
> `HTTP` and `HTML` are allowed at the beginning of method names (and property 
> names—although that is not explicitly mentioned, property names follow the 
> same guidelines as method names):
> 
> https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html#//apple_ref/doc/uid/20001281-1002931-BBCFHEAB
> 
> > For method names, start with a lowercase letter and capitalize the first 
> > letter of embedded words. Don’t use prefixes.
> > `fileExistsAtPath:isDirectory:`
> >
> > An exception to this guideline is method names that start with a well-known 
> > acronym, for example, `TIFFRepresentation` (NSImage).
> 
> There is a list of well-known acronyms listed here:
> 
> https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE
> 
> ```
> ASCII
> PDF
> XML
> HTML
> URL
> RTF
> HTTP
> TIFF
> JPG
> PNG
> GIF
> LZW
> ROM
> RGB
> CMYK
> MIDI
> FTP
> ```
> 
Probably the right thing to do is make this a configuration option, the same 
way I did with `objc-forbidden-subclassing`, and default to the above list.

https://github.com/llvm-mirror/clang-tools-extra/blob/master/clang-tidy/objc/ForbiddenSubclassingCheck.cpp#L25
https://github.com/llvm-mirror/clang-tools-extra/blob/master/clang-tidy/objc/ForbiddenSubclassingCheck.cpp#L74
https://github.com/llvm-mirror/clang-tools-extra/blob/master/clang-tidy/objc/ForbiddenSubclassingCheck.cpp#L110

 


https://reviews.llvm.org/D39829



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


[PATCH] D39829: add new check for property declaration

2017-11-10 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments.



Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:41
+  objcPropertyDecl(
+  // the property name should be in Lower Camel Case like
+  // 'lowerCamelCase'

There are some exceptions we should special case. Acronyms like `URL` and 
`HTTP` and `HTML` are allowed at the beginning of method names (and property 
names—although that is not explicitly mentioned, property names follow the same 
guidelines as method names):

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html#//apple_ref/doc/uid/20001281-1002931-BBCFHEAB

> For method names, start with a lowercase letter and capitalize the first 
> letter of embedded words. Don’t use prefixes.
> `fileExistsAtPath:isDirectory:`
>
> An exception to this guideline is method names that start with a well-known 
> acronym, for example, `TIFFRepresentation` (NSImage).

There is a list of well-known acronyms listed here:

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE

```
ASCII
PDF
XML
HTML
URL
RTF
HTTP
TIFF
JPG
PNG
GIF
LZW
ROM
RGB
CMYK
MIDI
FTP
```




Comment at: docs/clang-tidy/checks/google-objc-global-variable-declaration.rst:1
 .. title:: clang-tidy - google-objc-global-variable-declaration
 

Let's remove "google-" everywhere and mention only Apple's style guide.



Comment at: docs/clang-tidy/checks/objc-property-declaration.rst:7
+Finds property declarations in Objective-C files that do not follow the pattern
+of property names in Google's Objective-C Style Guide. The property name should
+be in the format of Lower Camel Case.

hokein wrote:
> benhamilton wrote:
> > hokein wrote:
> > > Google style? but the link you provided is Apple.
> > Google's Objective-C style guide is a list of additions on top of Apple's 
> > Objective-C style guide.
> > 
> > Property naming standards are defined in Apple's style guide, and not 
> > changed by Google's.
> I see, thanks for the clarification, I think the "Apple" would be clearer.
Yeah, we don't want to mention Google here. Apple is good.



Comment at: test/clang-tidy/objc-property-declaration.m:8
+@property(assign, nonatomic) int camelCase;
+// CHECK-MESSAGES-NOT: :[[@LINE-1]]:34: warning: property 'camelCase' is not 
in proper format according to property naming convention 
[objc-property-declaration]
+@end

Wizard wrote:
> hokein wrote:
> > Why does the check catch this case? Isn't `camelCase` a correct name?
> This is CHECK-MESSAGES-NOT
I think in that case you don't need an explicit CHECK (there is implicitly a 
"CHECK-MESSAGES-NOT" on every line for all warnings which fails the test if a 
warning is raised).


https://reviews.llvm.org/D39829



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


[PATCH] D39763: [clang] [python] [tests] Rewrite to use standard unittest module

2017-11-10 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

Thanks. I'll update it to incorporate the lately committed test fixes, and push 
it later today.


Repository:
  rL LLVM

https://reviews.llvm.org/D39763



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


[PATCH] D39902: [OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'

2017-11-10 Thread Carlo Bertolli via Phabricator via cfe-commits
carlo.bertolli closed this revision.
carlo.bertolli added a comment.

Committed revision 317893.


Repository:
  rL LLVM

https://reviews.llvm.org/D39902



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


r317893 - [OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'

2017-11-10 Thread Carlo Bertolli via cfe-commits
Author: cbertol
Date: Fri Nov 10 08:05:00 2017
New Revision: 317893

URL: http://llvm.org/viewvc/llvm-project?rev=317893=rev
Log:
[OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'

https://reviews.llvm.org/D39902

Simply leverage existing implementation and verify correct functioning with two 
regression tests.


Added:
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_copyin_messages.cpp
Modified:
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp

Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=317893=317892=317893=diff
==
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Fri Nov 10 08:05:00 2017
@@ -748,6 +748,7 @@ OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLA
 OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(linear)
 OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(num_teams)
 OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(thread_limit)
+OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(copyin)
 
 // Clauses allowed for OpenMP directive 'target teams'.
 OPENMP_TARGET_TEAMS_CLAUSE(if)

Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp?rev=317893=317892=317893=diff
==
--- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp Fri Nov 
10 08:05:00 2017
@@ -8,6 +8,9 @@
 
 void foo() {}
 
+int x;
+#pragma omp threadprivate(x)
+
 struct S {
   S(): a(0) {}
   S(int v) : a(v) {}
@@ -40,7 +43,7 @@ public:
   void foo() {
 int b, argv, d, c, e, f;
 #pragma omp target
-#pragma omp teams distribute parallel for default(none), private(b) 
firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) 
thread_limit(d)
+#pragma omp teams distribute parallel for default(none), private(b) 
firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) 
thread_limit(d) copyin(x)
 for (int k = 0; k < a.a; ++k)
   ++a.a;
   }
@@ -50,7 +53,7 @@ public:
 // CHECK: #pragma omp target
 // CHECK-NEXT: #pragma omp teams distribute parallel for private(this->a) 
private(this->a)
 // CHECK: #pragma omp target
-// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) 
private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) 
num_teams(f) thread_limit(d)
+// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) 
private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) 
num_teams(f) thread_limit(d) copyin(x)
 
 class S8 : public S7 {
   S8() {}
@@ -74,7 +77,7 @@ public:
   void bar() {
 int b, argv, d, c, e, f8;
 #pragma omp target
-#pragma omp teams distribute parallel for default(none), private(b) 
firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f8) 
thread_limit(d)
+#pragma omp teams distribute parallel for default(none), private(b) 
firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f8) 
thread_limit(d) copyin(x)
 for (int k = 0; k < a.a; ++k)
   ++a.a;
   }
@@ -86,7 +89,7 @@ public:
 // CHECK: #pragma omp target
 // CHECK-NEXT: #pragma omp teams distribute parallel for private(this->a) 
private(this->a)
 // CHECK: #pragma omp target
-// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) 
private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) 
num_teams(f8) thread_limit(d)
+// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) 
private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) 
num_teams(f8) thread_limit(d) copyin(x)
 
 template 
 T tmain(T argc) {
@@ -127,11 +130,11 @@ T tmain(T argc) {
 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
 // CHECK-NEXT: foo();  
 #pragma omp target
-#pragma omp teams distribute parallel for default(none), private(b) 
firstprivate(argc) shared(d) reduction(+:c) reduction(max:e) num_teams(f) 
thread_limit(d)
+#pragma omp teams distribute parallel for default(none), private(b) 
firstprivate(argc) shared(d) reduction(+:c) reduction(max:e) num_teams(f) 
thread_limit(d) copyin(x)
 for (int k = 0; k < 10; ++k)
   e += d + argc;
 // CHECK: #pragma omp target
-// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) 
private(b) firstprivate(argc) shared(d) reduction(+: c) reduction(max: e) 
num_teams(f) thread_limit(d)
+// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) 
private(b) firstprivate(argc) shared(d) reduction(+: c) reduction(max: e) 
num_teams(f) thread_limit(d) copyin(x)
 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
 // CHECK-NEXT: 

[PATCH] D39902: [OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'

2017-11-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rL LLVM

https://reviews.llvm.org/D39902



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


[PATCH] D39902: [OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'

2017-11-10 Thread Carlo Bertolli via Phabricator via cfe-commits
carlo.bertolli created this revision.

Simply leverage existing implementation and verify correct functioning with two 
regression tests.


Repository:
  rL LLVM

https://reviews.llvm.org/D39902

Files:
  include/clang/Basic/OpenMPKinds.def
  test/OpenMP/teams_distribute_parallel_for_ast_print.cpp
  test/OpenMP/teams_distribute_parallel_for_copyin_messages.cpp

Index: test/OpenMP/teams_distribute_parallel_for_copyin_messages.cpp
===
--- /dev/null
+++ test/OpenMP/teams_distribute_parallel_for_copyin_messages.cpp
@@ -0,0 +1,113 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s
+
+void foo() {
+}
+
+bool foobool(int argc) {
+  return argc;
+}
+
+struct S1; // expected-note {{declared here}}
+class S2 {
+  mutable int a;
+
+public:
+  S2() : a(0) {}
+  S2 =(S2 ) { return *this; }
+};
+class S3 {
+  int a;
+
+public:
+  S3() : a(0) {}
+  S3 =(S3 ) { return *this; }
+};
+class S4 {
+  int a;
+  S4();
+  S4 =(const S4 ); // expected-note {{implicitly declared private here}}
+
+public:
+  S4(int v) : a(v) {}
+};
+class S5 {
+  int a;
+  S5() : a(0) {}
+  S5 =(const S5 ) { return *this; } // expected-note {{implicitly declared private here}}
+
+public:
+  S5(int v) : a(v) {}
+};
+template 
+class ST {
+public:
+  static T s;
+};
+
+S2 k;
+S3 h;
+S4 l(3);
+S5 m(4);
+#pragma omp threadprivate(h, k, l, m)
+
+namespace A {
+double x;
+#pragma omp threadprivate(x)
+}
+namespace B {
+using A::x;
+}
+
+int main(int argc, char **argv) {
+  int i;
+#pragma omp target
+#pragma omp teams distribute parallel for copyin // expected-error {{expected '(' after 'copyin'}}
+  for (i = 0; i < argc; ++i)
+foo();
+#pragma omp target
+#pragma omp teams distribute parallel for copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  for (i = 0; i < argc; ++i)
+foo();
+#pragma omp target
+#pragma omp teams distribute parallel for copyin() // expected-error {{expected expression}}
+  for (i = 0; i < argc; ++i)
+foo();
+#pragma omp target
+#pragma omp teams distribute parallel for copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}}
+  for (i = 0; i < argc; ++i)
+foo();
+#pragma omp target
+#pragma omp teams distribute parallel for copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  for (i = 0; i < argc; ++i)
+foo();
+#pragma omp target
+#pragma omp teams distribute parallel for copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
+  for (i = 0; i < argc; ++i)
+foo();
+#pragma omp target
+#pragma omp teams distribute parallel for copyin(l) // expected-error {{'operator=' is a private member of 'S4'}}
+  for (i = 0; i < argc; ++i)
+foo();
+#pragma omp target
+#pragma omp teams distribute parallel for copyin(S1) // expected-error {{'S1' does not refer to a value}}
+  for (i = 0; i < argc; ++i)
+foo();
+#pragma omp target
+#pragma omp teams distribute parallel for copyin(argv[1]) // expected-error {{expected variable name}}
+  for (i = 0; i < argc; ++i)
+foo();
+#pragma omp target
+#pragma omp teams distribute parallel for copyin(i) // expected-error {{copyin variable must be threadprivate}}
+  for (i = 0; i < argc; ++i)
+foo();
+#pragma omp target
+#pragma omp teams distribute parallel for copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}
+  for (i = 0; i < argc; ++i)
+foo();
+#pragma omp target
+#pragma omp teams distribute parallel for copyin(ST::s, B::x) // expected-error {{copyin variable must be threadprivate}}
+  for (i = 0; i < argc; ++i)
+foo();
+
+  return 0;
+}
Index: test/OpenMP/teams_distribute_parallel_for_ast_print.cpp
===
--- test/OpenMP/teams_distribute_parallel_for_ast_print.cpp
+++ test/OpenMP/teams_distribute_parallel_for_ast_print.cpp
@@ -8,6 +8,9 @@
 
 void foo() {}
 
+int x;
+#pragma omp threadprivate(x)
+
 struct S {
   S(): a(0) {}
   S(int v) : a(v) {}
@@ -40,7 +43,7 @@
   void foo() {
 int b, argv, d, c, e, f;
 #pragma omp target
-#pragma omp teams distribute parallel for default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d)
+#pragma omp teams distribute parallel for default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) copyin(x)
 for (int k = 0; k < a.a; ++k)
   ++a.a;
   }
@@ -50,7 +53,7 @@
 // CHECK: #pragma omp target
 // CHECK-NEXT: #pragma omp teams distribute parallel for private(this->a) private(this->a)
 // CHECK: #pragma omp target
-// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d)
+// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) 

[PATCH] D39859: [OpenMP] diagnose assign to firstprivate const

2017-11-10 Thread Alexey Bataev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL317891: [OpenMP] diagnose assign to firstprivate const, 
patch by Joel E. Denny (authored by ABataev).

Changed prior to commit:
  https://reviews.llvm.org/D39859?vs=122329=122434#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39859

Files:
  cfe/trunk/lib/Sema/SemaExpr.cpp
  cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp


Index: cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp
===
--- cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp
+++ cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp
@@ -56,7 +56,7 @@
 }
 
 int main(int argc, char **argv) {
-  const int d = 5;
+  const int d = 5; // expected-note {{variable 'd' declared const here}}
   const int da[5] = { 0 };
   S4 e(4);
   S5 g(5);
@@ -72,6 +72,8 @@
   #pragma omp parallel firstprivate (argc)
   #pragma omp parallel firstprivate (S1) // expected-error {{'S1' does not 
refer to a value}}
   #pragma omp parallel firstprivate (a, b, c, d, f) // expected-error 
{{firstprivate variable with incomplete type 'S1'}}
+  #pragma omp parallel firstprivate (d)
+d = 5; // expected-error {{cannot assign to variable 'd' with 
const-qualified type}}
   #pragma omp parallel firstprivate (argv[1]) // expected-error {{expected 
variable name}}
   #pragma omp parallel firstprivate(ba)
   #pragma omp parallel firstprivate(ca)
Index: cfe/trunk/lib/Sema/SemaExpr.cpp
===
--- cfe/trunk/lib/Sema/SemaExpr.cpp
+++ cfe/trunk/lib/Sema/SemaExpr.cpp
@@ -14352,8 +14352,13 @@
   bool ByRef = true;
   // Using an LValue reference type is consistent with Lambdas (see below).
   if (S.getLangOpts().OpenMP && RSI->CapRegionKind == CR_OpenMP) {
-if (S.IsOpenMPCapturedDecl(Var))
+if (S.IsOpenMPCapturedDecl(Var)) {
+  bool HasConst = DeclRefType.isConstQualified();
   DeclRefType = DeclRefType.getUnqualifiedType();
+  // Don't lose diagnostics about assignments to const.
+  if (HasConst)
+DeclRefType.addConst();
+}
 ByRef = S.IsOpenMPCapturedByRef(Var, RSI->OpenMPLevel);
   }
 


Index: cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp
===
--- cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp
+++ cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp
@@ -56,7 +56,7 @@
 }
 
 int main(int argc, char **argv) {
-  const int d = 5;
+  const int d = 5; // expected-note {{variable 'd' declared const here}}
   const int da[5] = { 0 };
   S4 e(4);
   S5 g(5);
@@ -72,6 +72,8 @@
   #pragma omp parallel firstprivate (argc)
   #pragma omp parallel firstprivate (S1) // expected-error {{'S1' does not refer to a value}}
   #pragma omp parallel firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}}
+  #pragma omp parallel firstprivate (d)
+d = 5; // expected-error {{cannot assign to variable 'd' with const-qualified type}}
   #pragma omp parallel firstprivate (argv[1]) // expected-error {{expected variable name}}
   #pragma omp parallel firstprivate(ba)
   #pragma omp parallel firstprivate(ca)
Index: cfe/trunk/lib/Sema/SemaExpr.cpp
===
--- cfe/trunk/lib/Sema/SemaExpr.cpp
+++ cfe/trunk/lib/Sema/SemaExpr.cpp
@@ -14352,8 +14352,13 @@
   bool ByRef = true;
   // Using an LValue reference type is consistent with Lambdas (see below).
   if (S.getLangOpts().OpenMP && RSI->CapRegionKind == CR_OpenMP) {
-if (S.IsOpenMPCapturedDecl(Var))
+if (S.IsOpenMPCapturedDecl(Var)) {
+  bool HasConst = DeclRefType.isConstQualified();
   DeclRefType = DeclRefType.getUnqualifiedType();
+  // Don't lose diagnostics about assignments to const.
+  if (HasConst)
+DeclRefType.addConst();
+}
 ByRef = S.IsOpenMPCapturedByRef(Var, RSI->OpenMPLevel);
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r317891 - [OpenMP] diagnose assign to firstprivate const, patch by Joel E. Denny

2017-11-10 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Nov 10 07:39:50 2017
New Revision: 317891

URL: http://llvm.org/viewvc/llvm-project?rev=317891=rev
Log:
[OpenMP] diagnose assign to firstprivate const, patch by Joel E. Denny

Summary:
[OpenMP] diagnose assign to firstprivate const

Clang does not diagnose assignments to const variables declared
firstprivate.  Furthermore, codegen is broken such that, at run time,
such assignments simply have no effect.  For example, the following
prints 0 not 1:

int main() {
  const int i = 0;
  #pragma omp parallel firstprivate(i)
  { i=1; printf("%d\n", i); }
  return 0;
}

This commit makes these assignments a compile error, which is
consistent with other OpenMP compilers I've tried (pgcc 17.4-0, gcc
6.3.0).

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=317891=317890=317891=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Nov 10 07:39:50 2017
@@ -14352,8 +14352,13 @@ static bool captureInCapturedRegion(Capt
   bool ByRef = true;
   // Using an LValue reference type is consistent with Lambdas (see below).
   if (S.getLangOpts().OpenMP && RSI->CapRegionKind == CR_OpenMP) {
-if (S.IsOpenMPCapturedDecl(Var))
+if (S.IsOpenMPCapturedDecl(Var)) {
+  bool HasConst = DeclRefType.isConstQualified();
   DeclRefType = DeclRefType.getUnqualifiedType();
+  // Don't lose diagnostics about assignments to const.
+  if (HasConst)
+DeclRefType.addConst();
+}
 ByRef = S.IsOpenMPCapturedByRef(Var, RSI->OpenMPLevel);
   }
 

Modified: cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp?rev=317891=317890=317891=diff
==
--- cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_firstprivate_messages.cpp Fri Nov 10 
07:39:50 2017
@@ -56,7 +56,7 @@ using A::x;
 }
 
 int main(int argc, char **argv) {
-  const int d = 5;
+  const int d = 5; // expected-note {{variable 'd' declared const here}}
   const int da[5] = { 0 };
   S4 e(4);
   S5 g(5);
@@ -72,6 +72,8 @@ int main(int argc, char **argv) {
   #pragma omp parallel firstprivate (argc)
   #pragma omp parallel firstprivate (S1) // expected-error {{'S1' does not 
refer to a value}}
   #pragma omp parallel firstprivate (a, b, c, d, f) // expected-error 
{{firstprivate variable with incomplete type 'S1'}}
+  #pragma omp parallel firstprivate (d)
+d = 5; // expected-error {{cannot assign to variable 'd' with 
const-qualified type}}
   #pragma omp parallel firstprivate (argv[1]) // expected-error {{expected 
variable name}}
   #pragma omp parallel firstprivate(ba)
   #pragma omp parallel firstprivate(ca)


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


[PATCH] D39900: Refactor ContinuationIndenter's breakProtrudingToken logic into slightly moreorthogonal pieces.

2017-11-10 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added inline comments.



Comment at: lib/Format/ContinuationIndenter.cpp:1028
+  unsigned Penalty =
+  handleEndOfLine(Current, State, DryRun, AllowBreak);
 

krasimir wrote:
> Why `handleEndOfLine`? Is it guaranteed that here we've reached the end of 
> the line?
No, this is used to do things in case we have reached the end of the line, as 
that's hard to check. I also wanted a better name, but wasn't able to come up 
with one (and we do similar things in other places here, where checking a 
condition is equivalent to running through all the code to do the things 
necessary).



Comment at: lib/Format/ContinuationIndenter.cpp:1284
+  unsigned StartColumn = State.Column - Current.ColumnWidth;
+  auto Delimiter = *getRawStringDelimiter(Current.TokenText);
   // The text of a raw string is between the leading 'R"delimiter(' and the

krasimir wrote:
> At this point, we compute `getRawStringDelimiter` twice: once here, and once 
> in `getRawStringStyle` in the caller side. Ideally, we'd only like to compute 
> it once. That's why it was a parameter before.
I got that, but I think passing around the delimiter is super awkward, and 
computing it is cheap. If computing it is the problem we should store it in the 
FormatToken.



Comment at: lib/Format/ContinuationIndenter.cpp:1408
+std::unique_ptr ContinuationIndenter::createBreakableToken(
+const FormatToken , LineState , bool AllowBreak) {
   unsigned StartColumn = State.Column - Current.ColumnWidth;

krasimir wrote:
> If `AllowBreak == false`, in which cases will this return a non-`nullptr`?
Only for string literals, as AllowBreak is really about whether we can break in 
the token space, but for comments (or raw strings, but those are handled 
differently anyway) we break in the comment space.



Comment at: unittests/Format/FormatTest.cpp:6322
"#include \"some long include\" // with a comment\n"
-   "#include \"some very long include 
paaath\"",
+   "#include \"some very long include path\"\n"
+   "#include \n",

krasimir wrote:
> What happened to the old test line?
It was unnecessarily long. I found it weird that it went out of its way to add 
more a's over the line limit.


https://reviews.llvm.org/D39900



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


[PATCH] D39900: Refactor ContinuationIndenter's breakProtrudingToken logic into slightly moreorthogonal pieces.

2017-11-10 Thread Manuel Klimek via Phabricator via cfe-commits
klimek updated this revision to Diff 122433.
klimek marked an inline comment as done.
klimek added a comment.

- Add test.

Updating D39900: Refactor ContinuationIndenter's breakProtrudingToken logic 
into slightly more
==

orthogonal pieces.


https://reviews.llvm.org/D39900

Files:
  lib/Format/BreakableToken.cpp
  lib/Format/ContinuationIndenter.cpp
  lib/Format/ContinuationIndenter.h
  unittests/Format/FormatTest.cpp
  unittests/Format/FormatTestComments.cpp

Index: unittests/Format/FormatTestComments.cpp
===
--- unittests/Format/FormatTestComments.cpp
+++ unittests/Format/FormatTestComments.cpp
@@ -680,15 +680,26 @@
   EXPECT_EQ("{\n"
 "  //\n"
 "  //\\\n"
-"  // long 1 2 3 4\n"
-"  // 5\n"
+"  // long 1 2 3 4 5\n"
 "}",
 format("{\n"
"  //\n"
"  //\\\n"
"  // long 1 2 3 4 5\n"
"}",
getLLVMStyleWithColumns(20)));
+  EXPECT_EQ("{\n"
+"  //\n"
+"  //\\\n"
+"  // long 1 2 3 4 5\n"
+"  // 6\n"
+"}",
+format("{\n"
+   "  //\n"
+   "  //\\\n"
+   "  // long 1 2 3 4 5 6\n"
+   "}",
+   getLLVMStyleWithColumns(20)));
 }
 
 TEST_F(FormatTestComments, PreservesHangingIndentInCxxComments) {
Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -6319,7 +6319,8 @@
"#include_next "
"#include \"abc.h\" // this is included for ABC\n"
"#include \"some long include\" // with a comment\n"
-   "#include \"some very long include paaath\"",
+   "#include \"some very long include path\"\n"
+   "#include \n",
getLLVMStyleWithColumns(35));
   EXPECT_EQ("#include \"a.h\"", format("#include  \"a.h\""));
   EXPECT_EQ("#include ", format("#include"));
Index: lib/Format/ContinuationIndenter.h
===
--- lib/Format/ContinuationIndenter.h
+++ lib/Format/ContinuationIndenter.h
@@ -29,6 +29,7 @@
 namespace format {
 
 class AnnotatedLine;
+class BreakableToken;
 struct FormatToken;
 struct LineState;
 struct ParenState;
@@ -105,11 +106,20 @@
   /// 
   /// \returns An extra penalty induced by reformatting the token.
   unsigned reformatRawStringLiteral(const FormatToken ,
-unsigned StartColumn, LineState ,
-StringRef Delimiter,
+LineState ,
 const FormatStyle ,
 bool DryRun);
 
+  /// \brief If the current token is at the end of the current line, handle
+  /// the transition to the next line.
+  unsigned handleEndOfLine(const FormatToken , LineState ,
+   bool DryRun, bool AllowBreak);
+
+  /// \brief If \p Current is a raw string that is configured to be reformatted,
+  /// return the style to be used.
+  llvm::Optional getRawStringStyle(const FormatToken ,
+const LineState );
+
   /// \brief If the current token sticks out over the end of the line, break
   /// it if possible.
   ///
@@ -120,7 +130,13 @@
   /// penalty for the column limit violation in the last line (and in single
   /// line tokens) is handled in \c addNextStateToQueue.
   unsigned breakProtrudingToken(const FormatToken , LineState ,
-bool DryRun);
+bool AllowBreak, bool DryRun);
+
+  /// \brief Returns the \c BreakableToken starting at \p Current, or nullptr
+  /// if the current token cannot be broken.
+  std::unique_ptr
+  createBreakableToken(const FormatToken , LineState ,
+   bool AllowBreak);
 
   /// \brief Appends the next token to \p State and updates information
   /// necessary for indentation.
Index: lib/Format/ContinuationIndenter.cpp
===
--- lib/Format/ContinuationIndenter.cpp
+++ lib/Format/ContinuationIndenter.cpp
@@ -1008,8 +1008,8 @@
 
   moveStatePastFakeLParens(State, Newline);
   moveStatePastScopeCloser(State);
-  bool CanBreakProtrudingToken = !State.Stack.back().NoLineBreak &&
- !State.Stack.back().NoLineBreakInOperand;
+  bool AllowBreak = !State.Stack.back().NoLineBreak &&
+!State.Stack.back().NoLineBreakInOperand;
   moveStatePastScopeOpener(State, Newline);
   moveStatePastFakeRParens(State);
 
@@ -1023,13 

[PATCH] D39842: Allow to store precompiled preambles in memory.

2017-11-10 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added inline comments.



Comment at: include/clang/Frontend/PrecompiledPreamble.h:99
   /// Changes options inside \p CI to use PCH from this preamble. Also remaps
-  /// main file to \p MainFileBuffer.
+  /// main file to \p MainFileBuffer and updates \p VFS to ensure preamble is
+  /// accessible.

...ensure *the* preamble...



Comment at: lib/Frontend/ASTUnit.cpp:1028
+IntrusiveRefCntPtr OldVFS = VFS;
+Preamble->AddImplicitPreamble(*CCInvocation, /*ref*/ VFS,
+  OverrideMainBuffer.get());

Since when are we using the /*ref*/ annotation?



Comment at: lib/Frontend/PrecompiledPreamble.cpp:206
+  std::unique_ptr Storage;
+  if (InMemStorage) {
+OS = llvm::make_unique(*InMemStorage);

It looks like we should pass in the output stream, not the storage?



Comment at: lib/Frontend/PrecompiledPreamble.cpp:490
   PreprocessorOpts.DisablePCHValidation = true;
+  if (Storage.getKind() == PCHStorage::Kind::TempFile) {
+const TempPCHFile  = Storage.asFile();

This looks a bit like we should push it into the PCHStorage.


https://reviews.llvm.org/D39842



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


[PATCH] D39900: Refactor ContinuationIndenter's breakProtrudingToken logic into slightly moreorthogonal pieces.

2017-11-10 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added inline comments.



Comment at: lib/Format/ContinuationIndenter.cpp:1028
+  unsigned Penalty =
+  handleEndOfLine(Current, State, DryRun, AllowBreak);
 

Why `handleEndOfLine`? Is it guaranteed that here we've reached the end of the 
line?



Comment at: lib/Format/ContinuationIndenter.cpp:1284
+  unsigned StartColumn = State.Column - Current.ColumnWidth;
+  auto Delimiter = *getRawStringDelimiter(Current.TokenText);
   // The text of a raw string is between the leading 'R"delimiter(' and the

At this point, we compute `getRawStringDelimiter` twice: once here, and once in 
`getRawStringStyle` in the caller side. Ideally, we'd only like to compute it 
once. That's why it was a parameter before.



Comment at: lib/Format/ContinuationIndenter.cpp:1408
+std::unique_ptr ContinuationIndenter::createBreakableToken(
+const FormatToken , LineState , bool AllowBreak) {
   unsigned StartColumn = State.Column - Current.ColumnWidth;

If `AllowBreak == false`, in which cases will this return a non-`nullptr`?



Comment at: unittests/Format/FormatTest.cpp:6322
"#include \"some long include\" // with a comment\n"
-   "#include \"some very long include 
paaath\"",
+   "#include \"some very long include path\"\n"
+   "#include \n",

What happened to the old test line?



Comment at: unittests/Format/FormatTestComments.cpp:683
 "  //\\\n"
-"  // long 1 2 3 4\n"
-"  // 5\n"
+"  // long 1 2 3 4 5\n"
 "}",

Please also add a test case adding a ` 6`, which actually gets broken.


https://reviews.llvm.org/D39900



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


[PATCH] D39859: [OpenMP] diagnose assign to firstprivate const

2017-11-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In https://reviews.llvm.org/D39859#921780, @jdenny wrote:

> Alexey: Thanks for accepting.  I do not have commit privileges.  Would you 
> please commit for me?


Sure, no problems.


https://reviews.llvm.org/D39859



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


[PATCH] D39859: [OpenMP] diagnose assign to firstprivate const

2017-11-10 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny added a comment.

Alexey: Thanks for accepting.  I do not have commit privileges.  Would you 
please commit for me?


https://reviews.llvm.org/D39859



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


[PATCH] D37554: [libclang] Allow crash recovery with LIBCLANG_NOTHREADS

2017-11-10 Thread Manuel Klimek via Phabricator via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

LG.


https://reviews.llvm.org/D37554



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


[PATCH] D39900: Refactor ContinuationIndenter's breakProtrudingToken logic into slightly moreorthogonal pieces.

2017-11-10 Thread Manuel Klimek via Phabricator via cfe-commits
klimek created this revision.

This patch allowed me to experiment with various alternatives to 
https://reviews.llvm.org/D33589.


https://reviews.llvm.org/D39900

Files:
  lib/Format/BreakableToken.cpp
  lib/Format/ContinuationIndenter.cpp
  lib/Format/ContinuationIndenter.h
  unittests/Format/FormatTest.cpp
  unittests/Format/FormatTestComments.cpp

Index: unittests/Format/FormatTestComments.cpp
===
--- unittests/Format/FormatTestComments.cpp
+++ unittests/Format/FormatTestComments.cpp
@@ -680,8 +680,7 @@
   EXPECT_EQ("{\n"
 "  //\n"
 "  //\\\n"
-"  // long 1 2 3 4\n"
-"  // 5\n"
+"  // long 1 2 3 4 5\n"
 "}",
 format("{\n"
"  //\n"
Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -6319,7 +6319,8 @@
"#include_next "
"#include \"abc.h\" // this is included for ABC\n"
"#include \"some long include\" // with a comment\n"
-   "#include \"some very long include paaath\"",
+   "#include \"some very long include path\"\n"
+   "#include \n",
getLLVMStyleWithColumns(35));
   EXPECT_EQ("#include \"a.h\"", format("#include  \"a.h\""));
   EXPECT_EQ("#include ", format("#include"));
Index: lib/Format/ContinuationIndenter.h
===
--- lib/Format/ContinuationIndenter.h
+++ lib/Format/ContinuationIndenter.h
@@ -29,6 +29,7 @@
 namespace format {
 
 class AnnotatedLine;
+class BreakableToken;
 struct FormatToken;
 struct LineState;
 struct ParenState;
@@ -105,11 +106,20 @@
   /// 
   /// \returns An extra penalty induced by reformatting the token.
   unsigned reformatRawStringLiteral(const FormatToken ,
-unsigned StartColumn, LineState ,
-StringRef Delimiter,
+LineState ,
 const FormatStyle ,
 bool DryRun);
 
+  /// \brief If the current token is at the end of the current line, handle
+  /// the transition to the next line.
+  unsigned handleEndOfLine(const FormatToken , LineState ,
+   bool DryRun, bool AllowBreak);
+
+  /// \brief If \p Current is a raw string that is configured to be reformatted,
+  /// return the style to be used.
+  llvm::Optional getRawStringStyle(const FormatToken ,
+const LineState );
+
   /// \brief If the current token sticks out over the end of the line, break
   /// it if possible.
   ///
@@ -120,7 +130,13 @@
   /// penalty for the column limit violation in the last line (and in single
   /// line tokens) is handled in \c addNextStateToQueue.
   unsigned breakProtrudingToken(const FormatToken , LineState ,
-bool DryRun);
+bool AllowBreak, bool DryRun);
+
+  /// \brief Returns the \c BreakableToken starting at \p Current, or nullptr
+  /// if the current token cannot be broken.
+  std::unique_ptr
+  createBreakableToken(const FormatToken , LineState ,
+   bool AllowBreak);
 
   /// \brief Appends the next token to \p State and updates information
   /// necessary for indentation.
Index: lib/Format/ContinuationIndenter.cpp
===
--- lib/Format/ContinuationIndenter.cpp
+++ lib/Format/ContinuationIndenter.cpp
@@ -1008,8 +1008,8 @@
 
   moveStatePastFakeLParens(State, Newline);
   moveStatePastScopeCloser(State);
-  bool CanBreakProtrudingToken = !State.Stack.back().NoLineBreak &&
- !State.Stack.back().NoLineBreakInOperand;
+  bool AllowBreak = !State.Stack.back().NoLineBreak &&
+!State.Stack.back().NoLineBreakInOperand;
   moveStatePastScopeOpener(State, Newline);
   moveStatePastFakeRParens(State);
 
@@ -1023,13 +1023,9 @@
 
   State.Column += Current.ColumnWidth;
   State.NextToken = State.NextToken->Next;
-  unsigned Penalty = 0;
-  if (CanBreakProtrudingToken)
-Penalty = breakProtrudingToken(Current, State, DryRun);
-  if (State.Column > getColumnLimit(State)) {
-unsigned ExcessCharacters = State.Column - getColumnLimit(State);
-Penalty += Style.PenaltyExcessCharacter * ExcessCharacters;
-  }
+
+  unsigned Penalty =
+  handleEndOfLine(Current, State, DryRun, AllowBreak);
 
   if (Current.Role)
 Current.Role->formatFromToken(State, this, DryRun);
@@ -1282,8 +1278,10 @@
 }
 
 unsigned ContinuationIndenter::reformatRawStringLiteral(
-const FormatToken , unsigned StartColumn, LineState ,
-StringRef Delimiter, const FormatStyle , bool DryRun) {
+

[PATCH] D39859: [OpenMP] diagnose assign to firstprivate const

2017-11-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


https://reviews.llvm.org/D39859



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


[PATCH] D34030: Fix the postorder visting of the ClassTemplateSpecializationDecl nodes in the RecursiveASTVisitor.

2017-11-10 Thread Peter Siket via Phabricator via cfe-commits
MontyKutyi added a comment.

Ping.


https://reviews.llvm.org/D34030



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


[PATCH] D39050: Add index-while-building support to Clang

2017-11-10 Thread Eric Liu via Phabricator via cfe-commits
ioeric added a comment.

>> - I think the implementation of the index output logic (e.g. 
>> `IndexUnitWriter` and bit format file) can be abstracted away (and split 
>> into separate patches) so that you can unit-test the action with a 
>> custom/mock unit writer; this would also make the action reusable with 
>> (potentially) other storage formats.
> 
> The added IndexRecordAction and existing IndexAction use the same 
> functionality from libIndex to collect the indexing data, so I'm not sure 
> mocking the unit writer to unit test IndexRecordAction would add very much 
> value – writing the index data out is the new behavior. The existing tests 
> for IndexAction (under test/Index/Core) are already covering the correctness 
> of the majority of the collected indexing info and the tests coming in the 
> follow-up patch (seen in the original version of this patch) test it's still 
> correct after the write/read round trip.

Thanks for the clarification! I still think it's useful to decouple the 
IndexAction from the bit format file so that it could be reusable elsewhere. 
For example, I can see the index action be useful to clangd for building 
in-memory index.

I also tried applying your original patch locally but couldn't get it to work 
mostly due to portability issues (e.g. `blocks` and `if (APPLE)` in make 
files). AFAIK, many folks compile clang with GCC and/or without APPLE, so it's 
important that you get the portability right from the very beginning. Thanks!

Index-while-build is awesome! I'm looking forward to your patches!


https://reviews.llvm.org/D39050



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


[PATCH] D39763: [clang] [python] [tests] Rewrite to use standard unittest module

2017-11-10 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

I can't really check if all the tests are equivalent to the old ones, but not 
having to install nose is a major usability improvement. Let's ship this.

We should totally fix the existing failures. I assume this is because nobody 
ever runs the tests.


Repository:
  rL LLVM

https://reviews.llvm.org/D39763



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


[PATCH] D39821: Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission

2017-11-10 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

I think the current tests will only pass iff the executable name ends with 
`objcopy` - can we make this more reliable?


Repository:
  rL LLVM

https://reviews.llvm.org/D39821



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


  1   2   >