[PATCH] D39947: [OpenMP] Stable sort Privates to remove non-deterministic ordering

2017-11-13 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In https://reviews.llvm.org/D39947#922922, @mgrang wrote:

> In https://reviews.llvm.org/D39947#922889, @rjmccall wrote:
>
> > In https://reviews.llvm.org/D39947#922870, @mgrang wrote:
> >
> > > Although this patches fixes the above unit test failures, the generated 
> > > code is very different from the one that the tests expect. As a result, 
> > > these tests need to be adjusted. Could the reviewers please 
> > > comment/suggest on whether it is ok to fix the tests as a result of this 
> > > change?
> > >
> > > The other way of obtaining deterministic ordering for privates with the 
> > > same alignment is to use an index for each item inserted into Privates 
> > > and use it as a tie-breaker. But even in that case the generated code is 
> > > quite different and tests still need to be adjusted.
> >
> >
> > Fixing the tests may be acceptable.  Can you give an example of the 
> > difference between the old and new test outputs?
>
>
> Please see https://www.diffchecker.com/7V2XFbk4 for the difference in output 
> for the following test before and after my change:
>
>   clang -cc1 -internal-isystem /build/llvm/lib/clang/6.0.0/include 
> -nostdsysteminc -verify -fopenmp -x c++ -triple x86_64-apple-darwin10 
> -emit-llvm 
> /src/llvm/tools/clang/test/OpenMP/task_firstprivate_codegen.cpp -o -
>


Does your diff have shuffling enabled on both sides?  Neither layout for 
%struct..kmp_privates.t.3 seems to match the test's match for 
PRIVATES_TMAIN_TY, so I'm not completely sure which is supposed to be which.  
Assuming that the right diff is with your patch, something seems quite wrong, 
because the capture for t_var is being sorted to the end, which is producing a 
really terrible layout.

I think you might actually have accidentally inverted the order: a qsort 
comparator is supposed to return positive if ``LHS > RHS``, so the fact that 
it's returning 1 when ``P1->first < P2->first`` means that it's actually a 
reversed comparison.  Would you mind fixing that and then letting us know what 
test changes remain?

Cou


https://reviews.llvm.org/D39947



___
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-13 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

Looks good to me. I (or @benhamilton) will commit the patch for you if 
@benhamilton is fine with it.




Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:22
+namespace {
+constexpr char DefaultSpecialAcronyms[] =
+"ASCII;"

nit: add a comment documenting these are from 
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE.



Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:93
+   "property '%0' is not in proper format according to property naming "
+   "convention. It should be in the format of lowerCamelCase or has "
+   "special acronyms")

nit: clang-tidy message is not a complete sentence. just `convertion; it 
should`.



Comment at: docs/clang-tidy/checks/objc-property-declaration.rst:40
+
+   Semicolon-separated list of acronys that can be used as prefix
+   of property names.

s/acronys/acronyms



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

benhamilton wrote:
> 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).
Sorry, I misread it as `CHECK-MESSAGES`. As Ben pointed out, we don't need 
explicit CHECK here (the default behavior is what we expected).


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] D39719: [X86][AVX512] lowering kunpack intrinsic - clang part

2017-11-13 Thread jina via Phabricator via cfe-commits
jina.nahias updated this revision to Diff 122617.

https://reviews.llvm.org/D39719

Files:
  lib/Headers/avx512bwintrin.h
  lib/Headers/avx512fintrin.h
  test/CodeGen/avx512bw-builtins.c
  test/CodeGen/avx512f-builtins.c


Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -6224,10 +6224,17 @@
   return _mm512_kortestz(__A, __B); 
 }
 
-__mmask16 test_mm512_kunpackb(__mmask16 __A, __mmask16 __B) {
+__mmask16 test_mm512_kunpackb(__m512i __A, __m512i __B, __m512i __C, __m512i 
__D, __m512i __E, __m512i __F) {
   // CHECK-LABEL: @test_mm512_kunpackb
-  // CHECK: @llvm.x86.avx512.kunpck.bw
-  return _mm512_kunpackb(__A, __B); 
+  // CHECK: bitcast <16 x i1> %{{.*}} to i16
+  // CHECK: bitcast <16 x i1> %{{.*}} to i16
+  // CHECK: and i32 %{{.*}}, 255
+  // CHECK: shl i32 %{{.*}}, 8
+  // CHECK: or i32 %{{.*}}, %{{.*}}
+  // CHECK: bitcast i16 %{{.*}} to <16 x i1>
+  return 
_mm512_mask_cmpneq_epu32_mask(_mm512_kunpackb(_mm512_cmpneq_epu32_mask(__A, 
__B),
+   
_mm512_cmpneq_epu32_mask(__C, __D)),
+   __E, __F);
 }
 
 __mmask16 test_mm512_kxnor(__mmask16 __A, __mmask16 __B) {
Index: test/CodeGen/avx512bw-builtins.c
===
--- test/CodeGen/avx512bw-builtins.c
+++ test/CodeGen/avx512bw-builtins.c
@@ -1626,16 +1626,26 @@
   return _mm512_maskz_set1_epi8(__M, __A); 
 }
 
-__mmask64 test_mm512_kunpackd(__mmask64 __A, __mmask64 __B) {
+__mmask64 test_mm512_kunpackd(__m512i __A, __m512i __B, __m512i __C, __m512i 
__D, __m512i __E, __m512i __F) {
   // CHECK-LABEL: @test_mm512_kunpackd
-  // CHECK: @llvm.x86.avx512.kunpck.dq
-  return _mm512_kunpackd(__A, __B); 
+  // CHECK: bitcast <64 x i1> %{{.*}} to i64
+  // CHECK: bitcast <64 x i1> %{{.*}} to i64
+  // CHECK: and i64 %{{.*}}, 4294967295
+  // CHECK: shl i64 %{{.*}}, 32
+  // CHECK: or i64 %{{.*}}, %{{.*}}
+  // CHECK: bitcast i64 %{{.*}} to <64 x i1>
+  return 
_mm512_mask_cmpneq_epu8_mask(_mm512_kunpackd(_mm512_cmpneq_epu8_mask(__B, 
__A),_mm512_cmpneq_epu8_mask(__C, __D)), __E, __F); 
 }
 
-__mmask32 test_mm512_kunpackw(__mmask32 __A, __mmask32 __B) {
+__mmask32 test_mm512_kunpackw(__m512i __A, __m512i __B, __m512i __C, __m512i 
__D, __m512i __E, __m512i __F) {
   // CHECK-LABEL: @test_mm512_kunpackw
-  // CHECK: @llvm.x86.avx512.kunpck.wd
-  return _mm512_kunpackw(__A, __B); 
+  // CHECK: bitcast <32 x i1> %{{.*}} to i32
+  // CHECK: bitcast <32 x i1> %{{.*}} to i32
+  // CHECK: and i32 %{{.*}}, 65535
+  // CHECK: shl i32 %{{.*}}, 16
+  // CHECK: or i32 %{{.*}}, %{{.*}}
+  // CHECK: bitcast i32 %{{.*}} to <32 x i1>
+  return 
_mm512_mask_cmpneq_epu16_mask(_mm512_kunpackw(_mm512_cmpneq_epu16_mask(__B, 
__A),_mm512_cmpneq_epu16_mask(__C, __D)), __E, __F); 
 }
 
 __m512i test_mm512_mask_loadu_epi16(__m512i __W, __mmask32 __U, void const 
*__P) {
Index: lib/Headers/avx512fintrin.h
===
--- lib/Headers/avx512fintrin.h
+++ lib/Headers/avx512fintrin.h
@@ -8823,7 +8823,7 @@
 static __inline__ __mmask16 __DEFAULT_FN_ATTRS
 _mm512_kunpackb (__mmask16 __A, __mmask16 __B)
 {
-  return (__mmask16) __builtin_ia32_kunpckhi ((__mmask16) __A, (__mmask16) 
__B);
+  return (__mmask16)  (( __A  & 0xFF) | ( __B << 8));
 }
 
 static __inline__ __mmask16 __DEFAULT_FN_ATTRS
Index: lib/Headers/avx512bwintrin.h
===
--- lib/Headers/avx512bwintrin.h
+++ lib/Headers/avx512bwintrin.h
@@ -1854,15 +1854,13 @@
 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
 _mm512_kunpackd (__mmask64 __A, __mmask64 __B)
 {
-  return (__mmask64) __builtin_ia32_kunpckdi ((__mmask64) __A,
-(__mmask64) __B);
+  return (__mmask64)  (( __A  & 0x) | ( __B << 32));
 }
 
 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
 _mm512_kunpackw (__mmask32 __A, __mmask32 __B)
 {
-  return (__mmask32) __builtin_ia32_kunpcksi ((__mmask32) __A,
-(__mmask32) __B);
+return (__mmask32)  (( __A  & 0x) | ( __B << 16));
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS


Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -6224,10 +6224,17 @@
   return _mm512_kortestz(__A, __B); 
 }
 
-__mmask16 test_mm512_kunpackb(__mmask16 __A, __mmask16 __B) {
+__mmask16 test_mm512_kunpackb(__m512i __A, __m512i __B, __m512i __C, __m512i __D, __m512i __E, __m512i __F) {
   // CHECK-LABEL: @test_mm512_kunpackb
-  // CHECK: @llvm.x86.avx512.kunpck.bw
-  return _mm512_kunpackb(__A, __B); 
+  // CHECK: bitcast <16 x i1> %{{.*}} to i16
+  // CHECK: bitcast <16 x i1> %{{.*}} to i16
+  // CHECK: and i32 %{{.*}}, 255
+  // CHECK: shl i32 %{{.*}}, 8
+  // CHECK: or i32 %{{.

r318025 - [x86][AVX512] Lowering shuffle i/f intrinsics to LLVM IR

2017-11-13 Thread Jina Nahias via cfe-commits
Author: jina.nahias
Date: Mon Nov 13 01:15:31 2017
New Revision: 318025

URL: http://llvm.org/viewvc/llvm-project?rev=318025&view=rev
Log:
[x86][AVX512] Lowering shuffle i/f intrinsics to LLVM IR

This patch, together with a matching llvm patch 
(https://reviews.llvm.org/D38671), implements the lowering of X86 shuffle i/f 
intrinsics to IR.

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

Change-Id: I9b3c2f2b34323bd9ccb21d0c1832f848b88ec047

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/avx512vlintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c
cfe/trunk/test/CodeGen/avx512vl-builtins.c

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=318025&r1=318024&r2=318025&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Mon Nov 13 01:15:31 2017
@@ -7006,76 +7006,100 @@ _mm512_maskz_srai_epi64(__mmask8 __U, __
 }
 
 #define _mm512_shuffle_f32x4(A, B, imm) __extension__ ({ \
-  (__m512)__builtin_ia32_shuf_f32x4_mask((__v16sf)(__m512)(A), \
- (__v16sf)(__m512)(B), (int)(imm), \
- (__v16sf)_mm512_undefined_ps(), \
- (__mmask16)-1); })
+  (__m512)__builtin_shufflevector((__v16sf)(__m512)(A), \
+  (__v16sf)(__m512)(B), \
+  0 + imm) >> 0) & 0x3) * 4), \
+  1 + imm) >> 0) & 0x3) * 4), \
+  2 + imm) >> 0) & 0x3) * 4), \
+  3 + imm) >> 0) & 0x3) * 4), \
+  0 + imm) >> 2) & 0x3) * 4), \
+  1 + imm) >> 2) & 0x3) * 4), \
+  2 + imm) >> 2) & 0x3) * 4), \
+  3 + imm) >> 2) & 0x3) * 4), \
+  16 + imm) >> 4) & 0x3) * 4), \
+  17 + imm) >> 4) & 0x3) * 4), \
+  18 + imm) >> 4) & 0x3) * 4), \
+  19 + imm) >> 4) & 0x3) * 4), \
+  16 + imm) >> 6) & 0x3) * 4), \
+  17 + imm) >> 6) & 0x3) * 4), \
+  18 + imm) >> 6) & 0x3) * 4), \
+  19 + imm) >> 6) & 0x3) * 4)); })
 
 #define _mm512_mask_shuffle_f32x4(W, U, A, B, imm) __extension__ ({ \
-  (__m512)__builtin_ia32_shuf_f32x4_mask((__v16sf)(__m512)(A), \
- (__v16sf)(__m512)(B), (int)(imm), \
- (__v16sf)(__m512)(W), \
- (__mmask16)(U)); })
+  (__m512)__builtin_ia32_selectps_512((__mmask16)(U), \
+  (__v16sf)_mm512_shuffle_f32x4((A), (B), 
(imm)), \
+  (__v16sf)(__m512)(W)); })
 
 #define _mm512_maskz_shuffle_f32x4(U, A, B, imm) __extension__ ({ \
-  (__m512)__builtin_ia32_shuf_f32x4_mask((__v16sf)(__m512)(A), \
- (__v16sf)(__m512)(B), (int)(imm), \
- (__v16sf)_mm512_setzero_ps(), \
- (__mmask16)(U)); })
+  (__m512)__builtin_ia32_selectps_512((__mmask16)(U), \
+  (__v16sf)_mm512_shuffle_f32x4((A), (B), 
(imm)), \
+  (__v16sf)_mm512_setzero_ps()); })
 
 #define _mm512_shuffle_f64x2(A, B, imm) __extension__ ({ \
-  (__m512d)__builtin_ia32_shuf_f64x2_mask((__v8df)(__m512d)(A), \
-  (__v8df)(__m512d)(B), (int)(imm), \
-  (__v8df)_mm512_undefined_pd(), \
-  (__mmask8)-1); })
+  (__m512d)__builtin_shufflevector((__v8df)(__m512d)(A), \
+   (__v8df)(__m512d)(B), \
+   0 + imm) >> 0) & 0x3) * 2), \
+   1 + imm) >> 0) & 0x3) * 2), \
+   0 + imm) >> 2) & 0x3) * 2), \
+   1 + imm) >> 2) & 0x3) * 2), \
+   8 + imm) >> 4) & 0x3) * 2), \
+   9 + imm) >> 4) & 0x3) * 2), \
+   8 + imm) >> 6) & 0x3) * 2), \
+   9 + imm) >> 6) & 0x3) * 2)); })
 
 #define _mm512_mask_shuffle_f64x2(W, U, A, B, imm) __extension__ ({ \
-  (__m512d)__builtin_ia32_shuf_f64x2_mask((__v8df)(__m512d)(A), \
-  (__v8d

[PATCH] D38672: [X86][AVX512] lowering shuffle f/i intrinsic - clang part

2017-11-13 Thread jina via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318025: [x86][AVX512] Lowering shuffle i/f intrinsics to 
LLVM IR (authored by jina.nahias).

Changed prior to commit:
  https://reviews.llvm.org/D38672?vs=121908&id=122619#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38672

Files:
  cfe/trunk/lib/Headers/avx512fintrin.h
  cfe/trunk/lib/Headers/avx512vlintrin.h
  cfe/trunk/test/CodeGen/avx512f-builtins.c
  cfe/trunk/test/CodeGen/avx512vl-builtins.c

Index: cfe/trunk/test/CodeGen/avx512f-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512f-builtins.c
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c
@@ -4484,73 +4484,81 @@
 
 __m512 test_mm512_shuffle_f32x4(__m512 __A, __m512 __B) {
   // CHECK-LABEL: @test_mm512_shuffle_f32x4
-  // CHECK: @llvm.x86.avx512.mask.shuf.f32x4
+  // CHECK: shufflevector <16 x float> %{{.*}}, <16 x float> %{{.*}}, <16 x i32> 
   return _mm512_shuffle_f32x4(__A, __B, 4); 
 }
 
 __m512 test_mm512_mask_shuffle_f32x4(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
   // CHECK-LABEL: @test_mm512_mask_shuffle_f32x4
-  // CHECK: @llvm.x86.avx512.mask.shuf.f32x4
+  // CHECK: shufflevector <16 x float> %{{.*}}, <16 x float> %{{.*}}, <16 x i32> 
+  // CHECK: select <16 x i1> %{{.*}}, <16 x float> %{{.*}}, <16 x float> %{{.*}}
   return _mm512_mask_shuffle_f32x4(__W, __U, __A, __B, 4); 
 }
 
 __m512 test_mm512_maskz_shuffle_f32x4(__mmask16 __U, __m512 __A, __m512 __B) {
   // CHECK-LABEL: @test_mm512_maskz_shuffle_f32x4
-  // CHECK: @llvm.x86.avx512.mask.shuf.f32x4
+  // CHECK: shufflevector <16 x float> %{{.*}}, <16 x float> %{{.*}}, <16 x i32> 
+  // CHECK: select <16 x i1> %{{.*}}, <16 x float> %{{.*}}, <16 x float> %{{.*}}
   return _mm512_maskz_shuffle_f32x4(__U, __A, __B, 4); 
 }
 
 __m512d test_mm512_shuffle_f64x2(__m512d __A, __m512d __B) {
   // CHECK-LABEL: @test_mm512_shuffle_f64x2
-  // CHECK: @llvm.x86.avx512.mask.shuf.f64x2
+  // CHECK: shufflevector <8 x double> %0, <8 x double> %{{.*}}, <8 x i32> 
   return _mm512_shuffle_f64x2(__A, __B, 4); 
 }
 
 __m512d test_mm512_mask_shuffle_f64x2(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
   // CHECK-LABEL: @test_mm512_mask_shuffle_f64x2
-  // CHECK: @llvm.x86.avx512.mask.shuf.f64x2
+  // CHECK: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> 
+  // CHECK: select <8 x i1> %{{.*}}, <8 x double> %{{.*}}, <8 x double> %{{.*}}
   return _mm512_mask_shuffle_f64x2(__W, __U, __A, __B, 4); 
 }
 
 __m512d test_mm512_maskz_shuffle_f64x2(__mmask8 __U, __m512d __A, __m512d __B) {
   // CHECK-LABEL: @test_mm512_maskz_shuffle_f64x2
-  // CHECK: @llvm.x86.avx512.mask.shuf.f64x2
+  // CHECK: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> 
+  // CHECK: select <8 x i1> %{{.*}}, <8 x double> %{{.*}}, <8 x double> %{{.*}}
   return _mm512_maskz_shuffle_f64x2(__U, __A, __B, 4); 
 }
 
 __m512i test_mm512_shuffle_i32x4(__m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_shuffle_i32x4
-  // CHECK: @llvm.x86.avx512.mask.shuf.i32x4
+  // CHECK: shufflevector <8 x i64> %0, <8 x i64> %{{.*}}, <8 x i32> 
   return _mm512_shuffle_i32x4(__A, __B, 4); 
 }
 
 __m512i test_mm512_mask_shuffle_i32x4(__m512i __W, __mmask16 __U, __m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_mask_shuffle_i32x4
-  // CHECK: @llvm.x86.avx512.mask.shuf.i32x4
+  // CHECK: shufflevector <8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i32> 
+  // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_mask_shuffle_i32x4(__W, __U, __A, __B, 4); 
 }
 
 __m512i test_mm512_maskz_shuffle_i32x4(__mmask16 __U, __m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_maskz_shuffle_i32x4
-  // CHECK: @llvm.x86.avx512.mask.shuf.i32x4
+  // CHECK: shufflevector <8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i32> 
+  // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_maskz_shuffle_i32x4(__U, __A, __B, 4); 
 }
 
 __m512i test_mm512_shuffle_i64x2(__m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_shuffle_i64x2
-  // CHECK: @llvm.x86.avx512.mask.shuf.i64x2
+  // CHECK: shufflevector <8 x i64> %0, <8 x i64> %{{.*}}, <8 x i32> 
   return _mm512_shuffle_i64x2(__A, __B, 4); 
 }
 
 __m512i test_mm512_mask_shuffle_i64x2(__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_mask_shuffle_i64x2
-  // CHECK: @llvm.x86.avx512.mask.shuf.i64x2
+  // CHECK: shufflevector <8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i32> 
+  // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
   return _mm512_mask_shuffle_i64x2(__W, __U, __A, __B, 4); 
 }
 
 __m512i test_mm512_maskz_shuffle_i64x2(__mmask8 __U, __m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_maskz_shuffle_i64x2
-  // CHECK: @llvm.x86.avx512.mask.shuf.i64x2
+  // CHECK: shufflevector <8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i32> 
+  // CHECK: select <8 x i1> %

[PATCH] D39953: [CodeGen] Do not lookup for cached TBAA metadata nodes twice

2017-11-13 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision.
kosarev added a project: clang.

Repository:
  rL LLVM

https://reviews.llvm.org/D39953

Files:
  lib/CodeGen/CodeGenTBAA.cpp

Index: lib/CodeGen/CodeGenTBAA.cpp
===
--- lib/CodeGen/CodeGenTBAA.cpp
+++ lib/CodeGen/CodeGenTBAA.cpp
@@ -127,7 +127,8 @@
 return getBaseTypeInfo(QTy);
 
   const Type *Ty = Context.getCanonicalType(QTy).getTypePtr();
-  if (llvm::MDNode *N = MetadataCache[Ty])
+  llvm::MDNode *&N = MetadataCache[Ty];
+  if (N)
 return N;
 
   // Handle builtin types.
@@ -160,23 +161,21 @@
 // treating wchar_t, char16_t, and char32_t as distinct from their
 // "underlying types".
 default:
-  return MetadataCache[Ty] =
-createTBAAScalarType(BTy->getName(Features), getChar());
+  return N = createTBAAScalarType(BTy->getName(Features), getChar());
 }
   }
 
   // C++1z [basic.lval]p10: "If a program attempts to access the stored value of
   // an object through a glvalue of other than one of the following types the
   // behavior is undefined: [...] a char, unsigned char, or std::byte type."
   if (Ty->isStdByteType())
-return MetadataCache[Ty] = getChar();
+return N = getChar();
 
   // Handle pointers and references.
   // TODO: Implement C++'s type "similarity" and consider dis-"similar"
   // pointers distinct.
   if (Ty->isPointerType() || Ty->isReferenceType())
-return MetadataCache[Ty] = createTBAAScalarType("any pointer",
-getChar());
+return N = createTBAAScalarType("any pointer", getChar());
 
   // Enum types are distinct types. In C++ they have "underlying types",
   // however they aren't related for TBAA.
@@ -186,16 +185,16 @@
 // TODO: Is there a way to get a program-wide unique name for a
 // decl with local linkage or no linkage?
 if (!Features.CPlusPlus || !ETy->getDecl()->isExternallyVisible())
-  return MetadataCache[Ty] = getChar();
+  return N = getChar();
 
 SmallString<256> OutName;
 llvm::raw_svector_ostream Out(OutName);
 MContext.mangleTypeName(QualType(ETy, 0), Out);
-return MetadataCache[Ty] = createTBAAScalarType(OutName, getChar());
+return N = createTBAAScalarType(OutName, getChar());
   }
 
   // For now, handle any other kind of type conservatively.
-  return MetadataCache[Ty] = getChar();
+  return N = getChar();
 }
 
 TBAAAccessInfo CodeGenTBAA::getVTablePtrAccessInfo() {
@@ -244,27 +243,27 @@
   return true;
 }
 
-llvm::MDNode *
-CodeGenTBAA::getTBAAStructInfo(QualType QTy) {
+llvm::MDNode *CodeGenTBAA::getTBAAStructInfo(QualType QTy) {
   const Type *Ty = Context.getCanonicalType(QTy).getTypePtr();
-
-  if (llvm::MDNode *N = StructMetadataCache[Ty])
+  llvm::MDNode *&N = StructMetadataCache[Ty];
+  if (N)
 return N;
 
   SmallVector Fields;
   if (CollectFields(0, QTy, Fields, TypeHasMayAlias(QTy)))
 return MDHelper.createTBAAStructNode(Fields);
 
   // For now, handle any other kind of type conservatively.
-  return StructMetadataCache[Ty] = nullptr;
+  return N = nullptr;
 }
 
 llvm::MDNode *CodeGenTBAA::getBaseTypeInfo(QualType QTy) {
   if (!isValidBaseType(QTy))
 return nullptr;
 
   const Type *Ty = Context.getCanonicalType(QTy).getTypePtr();
-  if (llvm::MDNode *N = BaseTypeMetadataCache[Ty])
+  llvm::MDNode *&N = BaseTypeMetadataCache[Ty];
+  if (N)
 return N;
 
   if (const RecordType *TTy = QTy->getAs()) {
@@ -279,7 +278,7 @@
   llvm::MDNode *FieldNode = isValidBaseType(FieldQTy) ?
   getBaseTypeInfo(FieldQTy) : getTypeInfo(FieldQTy);
   if (!FieldNode)
-return BaseTypeMetadataCache[Ty] = nullptr;
+return N = nullptr;
   Fields.push_back(std::make_pair(
   FieldNode, Layout.getFieldOffset(idx) / Context.getCharWidth()));
 }
@@ -293,11 +292,10 @@
   OutName = RD->getName();
 }
 // Create the struct type node with a vector of pairs (offset, type).
-return BaseTypeMetadataCache[Ty] =
-  MDHelper.createTBAAStructTypeNode(OutName, Fields);
+return N = MDHelper.createTBAAStructTypeNode(OutName, Fields);
   }
 
-  return BaseTypeMetadataCache[Ty] = nullptr;
+  return N = nullptr;
 }
 
 llvm::MDNode *CodeGenTBAA::getAccessTagInfo(TBAAAccessInfo Info) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39886: [ASTImporter] Fix wrong conflict detections for unnamed structures

2017-11-13 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a reviewer: doug.gregor.
xazax.hun added a comment.

Doug added anonymous structure handling, added as a reviewer in case he wants 
to have a look.


https://reviews.llvm.org/D39886



___
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-13 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu added a comment.

I think this is the right thing to do, but I'd defer it to libunwind's owner to 
approve the patch.


https://reviews.llvm.org/D39918



___
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-13 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

In https://reviews.llvm.org/D39918#923059, @ruiu wrote:

> I think this is the right thing to do, but I'd defer it to libunwind's owner 
> to approve the patch.


Removing the comment that is? Yes, since it's probably impossible to implement.

Do you have any suggestion on how to handle the rest of the issue (when the 
actual name is unavailable at runtime and you only have e.g. "/4" as section 
name) for binaries built with debug info enabled?


https://reviews.llvm.org/D39918



___
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-13 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu added a comment.

Actually I don't have a strong opinion on that topic. It seems like just 
truncating the section name to ".eh_fram" at the linker is good enough, but how 
much important is the compatibility with GNU ld?


https://reviews.llvm.org/D39918



___
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-13 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

In https://reviews.llvm.org/D39918#923070, @ruiu wrote:

> Actually I don't have a strong opinion on that topic. It seems like just 
> truncating the section name to ".eh_fram" at the linker is good enough, but 
> how much important is the compatibility with GNU ld?


It's hard to say... Right now, the llvm/lld based mingw distribution is 
incompatible with GNU ld already anyway for other reasons, so doing a fix in 
lld isn't too bad, but ideally I'd like to work towards having things as 
compatible as possible of course. Doesn't feel like a very high priority right 
now though since there's quite enough with more concrete other issues to fix 
first.


https://reviews.llvm.org/D39918



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


[PATCH] D39711: [analyzer] ObjCGenerics: Don't warn on cast conversions involving explicit cast

2017-11-13 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun accepted this revision.
xazax.hun added a comment.
This revision is now accepted and ready to land.

LGTM!


https://reviews.llvm.org/D39711



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


[PATCH] D39372: Make DiagnosticIDs::getAllDiagnostics static.

2017-11-13 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun accepted this revision.
xazax.hun added a comment.
This revision is now accepted and ready to land.

LGTM!


https://reviews.llvm.org/D39372



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


[PATCH] D38921: [analyzer] LoopUnrolling: update the matched assignment operators

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

I agree it might be useful to expose this matcher to everybody.


https://reviews.llvm.org/D38921



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


r318030 - [analyzer] Document the issue hash debugging facility

2017-11-13 Thread Gabor Horvath via cfe-commits
Author: xazax
Date: Mon Nov 13 03:13:02 2017
New Revision: 318030

URL: http://llvm.org/viewvc/llvm-project?rev=318030&view=rev
Log:
[analyzer] Document the issue hash debugging facility

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

Modified:
cfe/trunk/docs/analyzer/DebugChecks.rst

Modified: cfe/trunk/docs/analyzer/DebugChecks.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/analyzer/DebugChecks.rst?rev=318030&r1=318029&r2=318030&view=diff
==
--- cfe/trunk/docs/analyzer/DebugChecks.rst (original)
+++ cfe/trunk/docs/analyzer/DebugChecks.rst Mon Nov 13 03:13:02 2017
@@ -242,6 +242,19 @@ ExprInspection checks
   clang_analyzer_printState(); // Read the stderr!
 }
 
+- ``void clang_analyzer_hashDump(int);``
+
+  The analyzer can generate a hash to identify reports. To debug what 
information
+  is used to calculate this hash it is possible to dump the hashed string as a
+  warning of an arbitrary expression using the function above.
+
+  Example usage::
+
+void foo() {
+  int x = 1;
+  clang_analyzer_hashDump(x); // expected-warning{{hashed string for x}}
+}
+
 Statistics
 ==
 


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


[PATCH] D39543: [analyzer] Document the issue hash debugging facility

2017-11-13 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318030: [analyzer] Document the issue hash debugging 
facility (authored by xazax).

Changed prior to commit:
  https://reviews.llvm.org/D39543?vs=121290&id=122630#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39543

Files:
  cfe/trunk/docs/analyzer/DebugChecks.rst


Index: cfe/trunk/docs/analyzer/DebugChecks.rst
===
--- cfe/trunk/docs/analyzer/DebugChecks.rst
+++ cfe/trunk/docs/analyzer/DebugChecks.rst
@@ -242,6 +242,19 @@
   clang_analyzer_printState(); // Read the stderr!
 }
 
+- ``void clang_analyzer_hashDump(int);``
+
+  The analyzer can generate a hash to identify reports. To debug what 
information
+  is used to calculate this hash it is possible to dump the hashed string as a
+  warning of an arbitrary expression using the function above.
+
+  Example usage::
+
+void foo() {
+  int x = 1;
+  clang_analyzer_hashDump(x); // expected-warning{{hashed string for x}}
+}
+
 Statistics
 ==
 


Index: cfe/trunk/docs/analyzer/DebugChecks.rst
===
--- cfe/trunk/docs/analyzer/DebugChecks.rst
+++ cfe/trunk/docs/analyzer/DebugChecks.rst
@@ -242,6 +242,19 @@
   clang_analyzer_printState(); // Read the stderr!
 }
 
+- ``void clang_analyzer_hashDump(int);``
+
+  The analyzer can generate a hash to identify reports. To debug what information
+  is used to calculate this hash it is possible to dump the hashed string as a
+  warning of an arbitrary expression using the function above.
+
+  Example usage::
+
+void foo() {
+  int x = 1;
+  clang_analyzer_hashDump(x); // expected-warning{{hashed string for x}}
+}
+
 Statistics
 ==
 
___
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-13 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun accepted this revision.
xazax.hun added a comment.

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] D39800: [analyzer] pr34404: Fix a crash on pointers to members in nested anonymous structures.

2017-11-13 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun accepted this revision.
xazax.hun added a comment.

LGTM!


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] D39640: [lit] Set shlibpath_var on Solaris

2017-11-13 Thread Rainer Orth via Phabricator via cfe-commits
ro added a comment.

Could someone please commit this for me?  I've no commit access.

Thanks.


https://reviews.llvm.org/D39640



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


r318031 - Change

2017-11-13 Thread Jina Nahias via cfe-commits
Author: jina.nahias
Date: Mon Nov 13 03:41:41 2017
New Revision: 318031

URL: http://llvm.org/viewvc/llvm-project?rev=318031&view=rev
Log:
Change
// CHECK: shufflevector <8 x double> %0, <8 x double> %{{.*}}, <8 x i32> 
To
// CHECK: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> 

for fixing 318025 commit warning

Change-Id: Id48a1fe1f247fe6a0b84e7189f18d2e637678e79

Modified:
cfe/trunk/test/CodeGen/avx512f-builtins.c

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=318031&r1=318030&r2=318031&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Mon Nov 13 03:41:41 2017
@@ -4504,7 +4504,7 @@ __m512 test_mm512_maskz_shuffle_f32x4(__
 
 __m512d test_mm512_shuffle_f64x2(__m512d __A, __m512d __B) {
   // CHECK-LABEL: @test_mm512_shuffle_f64x2
-  // CHECK: shufflevector <8 x double> %0, <8 x double> %{{.*}}, <8 x i32> 

+  // CHECK: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x 
i32> 
   return _mm512_shuffle_f64x2(__A, __B, 4); 
 }
 
@@ -4524,7 +4524,7 @@ __m512d test_mm512_maskz_shuffle_f64x2(_
 
 __m512i test_mm512_shuffle_i32x4(__m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_shuffle_i32x4
-  // CHECK: shufflevector <8 x i64> %0, <8 x i64> %{{.*}}, <8 x i32> 
+  // CHECK: shufflevector <8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i32> 
   return _mm512_shuffle_i32x4(__A, __B, 4); 
 }
 
@@ -4544,7 +4544,7 @@ __m512i test_mm512_maskz_shuffle_i32x4(_
 
 __m512i test_mm512_shuffle_i64x2(__m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_shuffle_i64x2
-  // CHECK: shufflevector <8 x i64> %0, <8 x i64> %{{.*}}, <8 x i32> 
+  // CHECK: shufflevector <8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i32> 
   return _mm512_shuffle_i64x2(__A, __B, 4); 
 }
 


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


[PATCH] D39886: [ASTImporter] Fix wrong conflict detections for unnamed structures

2017-11-13 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

Hello Takafumi,

Thank you for this patch. Looks like you're trying to disable lookup for 
similar structures if the structure is anonymous but there are two things I'm 
worrying about this solution.

1. Are import conflicts for anonymous structures resolved correctly?
2. Are equal structures present in both TUs imported correctly, without 
duplication?

Could you please check this and add tests if possible?




Comment at: lib/AST/ASTImporter.cpp:1634
   RecordDecl *PrevDecl = nullptr;
-  if (!DC->isFunctionOrMethod()) {
+  if (!DC->isFunctionOrMethod() && SearchName.getAsString() != "") {
 SmallVector ConflictingDecls;

D->isAnonymousStructOrUnion()?



Comment at: unittests/AST/ASTImporterTest.cpp:503
+has(
+declStmt(
+  has(

Broken indentation?


https://reviews.llvm.org/D39886



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


[PATCH] D39722: [ASTImporter] Support TypeTraitExpr Importing

2017-11-13 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

Hello Takafumi,

Thank you for this patch! I feel positive about it. You can find my comments 
inline.




Comment at: lib/AST/ASTImporter.cpp:5540
+  for(auto FromArg : E->getArgs()) {
+TypeSourceInfo *ToTI = Importer.Import(FromArg);
+ToArgVec.push_back(ToTI);

We should fail (`return nullptr`) if import fails and `ToTI` is `nullptr`.



Comment at: lib/AST/ASTImporter.cpp:5543
+  }
+  ArrayRef ToArgRef(ToArgVec);
+

No need to create an ArrayRef - SmallVector can be implicitly converted to it 
so you can just pass SmallVector to the function.



Comment at: lib/AST/ASTImporter.cpp:5545
+
+  return TypeTraitExpr::Create( Importer.getToContext(),
+ ToType,

The style looks a bit broken. Could you clang-format?



Comment at: lib/AST/ASTImporter.cpp:5551
+ Importer.Import(E->getLocEnd()),
+ E->getValue());
+}

This will assert if E is value-dependent. You need to check it explicitly.


https://reviews.llvm.org/D39722



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


[PATCH] D39886: [ASTImporter] Fix wrong conflict detections for unnamed structures

2017-11-13 Thread Takafumi Kubota via Phabricator via cfe-commits
tk1012 added a comment.






Comment at: lib/AST/ASTImporter.cpp:1634
   RecordDecl *PrevDecl = nullptr;
-  if (!DC->isFunctionOrMethod()) {
+  if (!DC->isFunctionOrMethod() && SearchName.getAsString() != "") {
 SmallVector ConflictingDecls;

According to include/clang/AST/Decl.h file, we cannot use 
"RecordDecl::isAnonymousStructOrUnion()" here because "struct { int a; } A;" is 
not an anonymous struct but is unnamed.


https://reviews.llvm.org/D39886



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


r318035 - [X86] test/testn intrinsics lowering to IR. clang side

2017-11-13 Thread Uriel Korach via cfe-commits
Author: uriel.k
Date: Mon Nov 13 04:50:52 2017
New Revision: 318035

URL: http://llvm.org/viewvc/llvm-project?rev=318035&view=rev
Log:
[X86] test/testn intrinsics lowering to IR. clang side

Change Header files of the intrinsics for lowering test and testn intrinsics to 
IR code.
Removed test and testn builtins from clang

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

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512bwintrin.h
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/avx512vlbwintrin.h
cfe/trunk/lib/Headers/avx512vlintrin.h
cfe/trunk/test/CodeGen/avx512bw-builtins.c
cfe/trunk/test/CodeGen/avx512f-builtins.c
cfe/trunk/test/CodeGen/avx512vl-builtins.c
cfe/trunk/test/CodeGen/avx512vlbw-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=318035&r1=318034&r2=318035&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon Nov 13 04:50:52 2017
@@ -931,8 +931,6 @@ TARGET_BUILTIN(__builtin_ia32_pminud512_
 TARGET_BUILTIN(__builtin_ia32_pminuq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "", 
"avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmuldq512, "V8LLiV16iV16i", "", "avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmuludq512, "V8LLiV16iV16i", "", "avx512f")
-TARGET_BUILTIN(__builtin_ia32_ptestmd512, "UsV16iV16iUs", "", "avx512f")
-TARGET_BUILTIN(__builtin_ia32_ptestmq512, "UcV8LLiV8LLiUc", "", "avx512f")
 TARGET_BUILTIN(__builtin_ia32_loaddqusi512_mask, "V16iiC*V16iUs", "", 
"avx512f")
 TARGET_BUILTIN(__builtin_ia32_loaddqudi512_mask, "V8LLiLLiC*V8LLiUc", "", 
"avx512f")
 TARGET_BUILTIN(__builtin_ia32_loadups512_mask, "V16ffC*V16fUs", "", "avx512f")
@@ -1444,28 +1442,6 @@ TARGET_BUILTIN(__builtin_ia32_vpermt2var
 TARGET_BUILTIN(__builtin_ia32_vpermt2varpd512_maskz, 
"V8dV8LLiV8dV8dUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_vpermt2varps512_maskz, 
"V16fV16iV16fV16fUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_vpermt2varq512_maskz, 
"V8LLiV8LLiV8LLiV8LLiUc","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_ptestmb512, "ULLiV64cV64cULLi","","avx512bw")
-TARGET_BUILTIN(__builtin_ia32_ptestmw512, "UiV32sV32sUi","","avx512bw")
-TARGET_BUILTIN(__builtin_ia32_ptestnmb512, "ULLiV64cV64cULLi","","avx512bw")
-TARGET_BUILTIN(__builtin_ia32_ptestnmw512, "UiV32sV32sUi","","avx512bw")
-TARGET_BUILTIN(__builtin_ia32_ptestmb128, 
"UsV16cV16cUs","","avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestmb256, 
"UiV32cV32cUi","","avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestmw128, "UcV8sV8sUc","","avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestmw256, 
"UsV16sV16sUs","","avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestnmb128, 
"UsV16cV16cUs","","avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestnmb256, 
"UiV32cV32cUi","","avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestnmw128, "UcV8sV8sUc","","avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestnmw256, 
"UsV16sV16sUs","","avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestmd128, "UcV4iV4iUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestmd256, "UcV8iV8iUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestmq128, "UcV2LLiV2LLiUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestmq256, "UcV4LLiV4LLiUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestnmd128, "UcV4iV4iUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestnmd256, "UcV8iV8iUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestnmq128, "UcV2LLiV2LLiUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestnmq256, "UcV4LLiV4LLiUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_ptestnmd512, "UsV16iV16iUs","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_ptestnmq512, "UcV8LLiV8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_rndscalesd_round_mask, 
"V2dV2dV2dV2dUcIiIi","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_rndscaless_round_mask, 
"V4fV4fV4fV4fUcIiIi","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_scalefpd512_mask, 
"V8dV8dV8dV8dUcIi","","avx512f")

Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=318035&r1=318034&r2=318035&view=diff
==
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Mon Nov 13 04:50:52 2017
@@ -1917,61 +1917,56 @@ _mm512_mask_storeu_epi8 (void *__P, __mm
 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
 _mm512_test_epi8_mask (__m512i __A, __m512i __B)
 {
-  return (__mmask64) __builtin_ia32_ptestmb512 ((__v64qi) __A,
-(__v64qi) __B,
-(__mmask64) -1);
+  return _mm512_cmpneq_epi8_mask (_mm512_and_epi32 (__A, __B),
+  _mm512_setzero_qi());
 }
 
 static __i

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

2017-11-13 Thread Uriel Korach via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318035: [X86] test/testn intrinsics lowering to IR. clang 
side (authored by uriel.k).

Changed prior to commit:
  https://reviews.llvm.org/D38737?vs=122082&id=122639#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38737

Files:
  cfe/trunk/include/clang/Basic/BuiltinsX86.def
  cfe/trunk/lib/Headers/avx512bwintrin.h
  cfe/trunk/lib/Headers/avx512fintrin.h
  cfe/trunk/lib/Headers/avx512vlbwintrin.h
  cfe/trunk/lib/Headers/avx512vlintrin.h
  cfe/trunk/test/CodeGen/avx512bw-builtins.c
  cfe/trunk/test/CodeGen/avx512f-builtins.c
  cfe/trunk/test/CodeGen/avx512vl-builtins.c
  cfe/trunk/test/CodeGen/avx512vlbw-builtins.c

Index: cfe/trunk/lib/Headers/avx512vlbwintrin.h
===
--- cfe/trunk/lib/Headers/avx512vlbwintrin.h
+++ cfe/trunk/lib/Headers/avx512vlbwintrin.h
@@ -2415,121 +2415,108 @@
 static __inline__ __mmask16 __DEFAULT_FN_ATTRS
 _mm_test_epi8_mask (__m128i __A, __m128i __B)
 {
-  return (__mmask16) __builtin_ia32_ptestmb128 ((__v16qi) __A,
-(__v16qi) __B,
-(__mmask16) -1);
+  return _mm_cmpneq_epi8_mask (_mm_and_si128(__A, __B), _mm_setzero_hi());
 }
 
 static __inline__ __mmask16 __DEFAULT_FN_ATTRS
 _mm_mask_test_epi8_mask (__mmask16 __U, __m128i __A, __m128i __B)
 {
-  return (__mmask16) __builtin_ia32_ptestmb128 ((__v16qi) __A,
-(__v16qi) __B, __U);
+  return _mm_mask_cmpneq_epi8_mask (__U, _mm_and_si128 (__A, __B),
+_mm_setzero_hi());
 }
 
 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
 _mm256_test_epi8_mask (__m256i __A, __m256i __B)
 {
-  return (__mmask32) __builtin_ia32_ptestmb256 ((__v32qi) __A,
-(__v32qi) __B,
-(__mmask32) -1);
+  return _mm256_cmpneq_epi8_mask (_mm256_and_si256(__A, __B),
+  _mm256_setzero_si256());
 }
 
 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
 _mm256_mask_test_epi8_mask (__mmask32 __U, __m256i __A, __m256i __B)
 {
-  return (__mmask32) __builtin_ia32_ptestmb256 ((__v32qi) __A,
-(__v32qi) __B, __U);
+  return _mm256_mask_cmpneq_epi8_mask (__U, _mm256_and_si256(__A, __B),
+   _mm256_setzero_si256());
 }
 
 static __inline__ __mmask8 __DEFAULT_FN_ATTRS
 _mm_test_epi16_mask (__m128i __A, __m128i __B)
 {
-  return (__mmask8) __builtin_ia32_ptestmw128 ((__v8hi) __A,
- (__v8hi) __B,
- (__mmask8) -1);
+  return _mm_cmpneq_epi16_mask (_mm_and_si128 (__A, __B), _mm_setzero_hi());
 }
 
 static __inline__ __mmask8 __DEFAULT_FN_ATTRS
 _mm_mask_test_epi16_mask (__mmask8 __U, __m128i __A, __m128i __B)
 {
-  return (__mmask8) __builtin_ia32_ptestmw128 ((__v8hi) __A,
- (__v8hi) __B, __U);
+  return _mm_mask_cmpneq_epi16_mask (__U, _mm_and_si128 (__A, __B),
+ _mm_setzero_hi());
 }
 
 static __inline__ __mmask16 __DEFAULT_FN_ATTRS
 _mm256_test_epi16_mask (__m256i __A, __m256i __B)
 {
-  return (__mmask16) __builtin_ia32_ptestmw256 ((__v16hi) __A,
-(__v16hi) __B,
-(__mmask16) -1);
+  return _mm256_cmpneq_epi16_mask (_mm256_and_si256 (__A, __B),
+   _mm256_setzero_si256 ());
 }
 
 static __inline__ __mmask16 __DEFAULT_FN_ATTRS
 _mm256_mask_test_epi16_mask (__mmask16 __U, __m256i __A, __m256i __B)
 {
-  return (__mmask16) __builtin_ia32_ptestmw256 ((__v16hi) __A,
-(__v16hi) __B, __U);
+  return _mm256_mask_cmpneq_epi16_mask (__U, _mm256_and_si256(__A, __B),
+_mm256_setzero_si256());
 }
 
 static __inline__ __mmask16 __DEFAULT_FN_ATTRS
 _mm_testn_epi8_mask (__m128i __A, __m128i __B)
 {
-  return (__mmask16) __builtin_ia32_ptestnmb128 ((__v16qi) __A,
- (__v16qi) __B,
- (__mmask16) -1);
+  return _mm_cmpeq_epi8_mask (_mm_and_si128 (__A, __B), _mm_setzero_hi());
 }
 
 static __inline__ __mmask16 __DEFAULT_FN_ATTRS
 _mm_mask_testn_epi8_mask (__mmask16 __U, __m128i __A, __m128i __B)
 {
-  return (__mmask16) __builtin_ia32_ptestnmb128 ((__v16qi) __A,
- (__v16qi) __B, __U);
+  return _mm_mask_cmpeq_epi8_mask (__U, _mm_and_si128 (__A, __B),
+  _mm_setzero_hi());
 }
 
 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
 _mm256_testn_epi8_mask (__m256i __A, __m256i __B)
 {
-  return (__mmask32) __builtin_ia32_ptestnmb256 ((__v32qi) __A,
- (__v32qi) __B,
- (__mmask32) -1);
+  return _mm256_cmpeq_epi8_mask (_mm256_and_si256 (__A, __B),
+ _mm256_setzero_si256());
 }
 
 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
 _mm256_mask_testn_epi8_mask (__mmask32 __U, __m256i __A, __m256i __B)
 {
-  return (__mmask32) __builtin_ia32_ptestnmb256 ((__v32qi) __A,
- (__v32qi) __B, __U);
+  return _mm256_mask_cmpeq_epi8_mask (__U, _mm256_and_si256 (__A, __B),
+   

[PATCH] D39955: [Driver] Add command-line flags for the new TBAA metadata format

2017-11-13 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision.
kosarev added a project: clang.

This patch starts a series of changes to add support for the new TBAA metadata 
format proposed in this llvm-dev thread:

http://lists.llvm.org/pipermail/llvm-dev/2017-November/118748.html


Repository:
  rL LLVM

https://reviews.llvm.org/D39955

Files:
  include/clang/Driver/CC1Options.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/tbaa.c

Index: test/Driver/tbaa.c
===
--- test/Driver/tbaa.c
+++ test/Driver/tbaa.c
@@ -0,0 +1,30 @@
+// Test translation of TBAA-related clang options to cc1 options.
+
+// RUN: %clang -### -target x86_64-unknown-linux \
+// RUN:   -fno-struct-path-tbaa %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=CHECK-NO_PATH %s
+// RUN: %clang -### -target x86_64-unknown-linux \
+// RUN:   -fstruct-path-tbaa -fno-struct-path-tbaa %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=CHECK-NO_PATH %s
+// RUN: %clang -### -target x86_64-unknown-linux \
+// RUN:   -fnew-struct-path-tbaa -fno-struct-path-tbaa %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=CHECK-NO_PATH %s
+// CHECK-NO_PATH: "-cc1"
+// CHECK-NO_PATH-NOT: "-new-struct-path-tbaa"
+// CHECK-NO_PATH-SAME: "-no-struct-path-tbaa"
+// CHECK-NO_PATH-NOT: "-new-struct-path-tbaa"
+
+// RUN: %clang -### -target x86_64-unknown-linux \
+// RUN:   -fstruct-path-tbaa %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=CHECK-PATH %s
+// CHECK-PATH: "-cc1"
+// CHECK-PATH-NOT: "-no-struct-path-tbaa"
+// CHECK-PATH-NOT: "-new-struct-path-tbaa"
+
+// RUN: %clang -### -target x86_64-unknown-linux \
+// RUN:   -fnew-struct-path-tbaa %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=CHECK-NEW_PATH %s
+// CHECK-NEW_PATH: "-cc1"
+// CHECK-NEW_PATH-NOT: "-no-struct-path-tbaa"
+// CHECK-NEW_PATH: "-new-struct-path-tbaa"
+// CHECK-NEW_PATH-NOT: "-no-struct-path-tbaa"
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -546,6 +546,8 @@
 OPT_fuse_register_sized_bitfield_access);
   Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing);
   Opts.StructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa);
+  Opts.NewStructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa) &&
+   Args.hasArg(OPT_new_struct_path_tbaa);
   Opts.FineGrainedBitfieldAccesses =
   Args.hasFlag(OPT_ffine_grained_bitfield_accesses,
OPT_fno_fine_grained_bitfield_accesses, false);
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -3334,9 +3334,15 @@
   if (!Args.hasFlag(options::OPT_fstrict_aliasing, StrictAliasingAliasOption,
 options::OPT_fno_strict_aliasing, TBAAOnByDefault))
 CmdArgs.push_back("-relaxed-aliasing");
-  if (!Args.hasFlag(options::OPT_fstruct_path_tbaa,
-options::OPT_fno_struct_path_tbaa))
+  bool StructPathTBAA = Args.hasFlag(options::OPT_fstruct_path_tbaa,
+ options::OPT_fno_struct_path_tbaa);
+  bool NewStructPathTBAA = Args.hasFlag(options::OPT_fnew_struct_path_tbaa,
+options::OPT_fno_struct_path_tbaa,
+false);
+  if (!StructPathTBAA && !NewStructPathTBAA)
 CmdArgs.push_back("-no-struct-path-tbaa");
+  if (NewStructPathTBAA)
+CmdArgs.push_back("-new-struct-path-tbaa");
   if (Args.hasFlag(options::OPT_fstrict_enums, options::OPT_fno_strict_enums,
false))
 CmdArgs.push_back("-fstrict-enums");
Index: include/clang/Frontend/CodeGenOptions.def
===
--- include/clang/Frontend/CodeGenOptions.def
+++ include/clang/Frontend/CodeGenOptions.def
@@ -142,6 +142,7 @@
 CODEGENOPT(RelaxAll  , 1, 0) ///< Relax all machine code instructions.
 CODEGENOPT(RelaxedAliasing   , 1, 0) ///< Set when -fno-strict-aliasing is enabled.
 CODEGENOPT(StructPathTBAA, 1, 0) ///< Whether or not to use struct-path TBAA.
+CODEGENOPT(NewStructPathTBAA , 1, 0) ///< Whether or not to use new struct-path TBAA.
 CODEGENOPT(SaveTempLabels, 1, 0) ///< Save temporary labels.
 CODEGENOPT(SanitizeAddressUseAfterScope , 1, 0) ///< Enable use-after-scope detection
 ///< in AddressSanitizer
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1272,6 +1272,7 @@
 def fno_strict_aliasing : Flag<["-"], "fno-strict-aliasing">, Group,
   Flags<[DriverOption, CoreOption]>;
 def fstruct_path_tbaa : Flag<["-"], "fstruct-path-tbaa">

[PATCH] D39886: [ASTImporter] Fix wrong conflict detections for unnamed structures

2017-11-13 Thread Takafumi Kubota via Phabricator via cfe-commits
tk1012 added a comment.

Hallo Aleksei and Gábor,

Thank you for your response.

> 1. Are import conflicts for anonymous structures resolved correctly?

In fact, this patch only fixes the unnamed structures that are not anonymous.

In https://reviews.llvm.org/D39886#923188, @tk1012 wrote:

>


I added an inline comment

> 2. Are equal structures present in both TUs imported correctly, without 
> duplication?

As far as my experience, ASTImporter cannot import without duplication when the 
same structure definition exists in the both TUs ( e.g. include the same header 
file).
Then, in some cases ( e.g. using ICmpExpr for the imported structures), LLVM 
asserts and fails in the compilation.

First, I think this situation is not considered in the usage of ASTImporter ( I 
mean ASTImporter assumes that one structure is defined only once).
But, is this not correct?

In any case, I will check both things and try to test them.


https://reviews.llvm.org/D39886



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


[PATCH] D32478: [clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set

2017-11-13 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment.

In https://reviews.llvm.org/D32478#920345, @Typz wrote:

> > Unless I'm missing something, I'd agree with Daniel; this is not a rule 
> > that's widely used, and I'd say reformatting a code base to the 
> > clang-formatted variant will not regress readability.
>
> Unfortunately coding rules are not just about readability, but also about 
> consistency at entreprise scale, thus as a general rule we should not change 
> the established rules in an organizatoin.
>  There is history in rules, we have code which already uses these rules, so 
> for consistency we must stick to the old rules (even if we would not 
> necessarily choose the same rules if we were to start from scratch).


My guess is (but I might be wrong): if your code base is large enough and you 
search your internal code base for how well these rules are obeyed, I'd expect 
there to be a large number of violations (given that there is no automation to 
detect or fix those violations). In the end, getting actual consistency will 
require effort - either changing all violations, or changing everything to a 
consistent state with automation.


https://reviews.llvm.org/D32478



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


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

2017-11-13 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments.



Comment at: lib/Headers/opencl-c.h:16128
+#define intel_sub_group_block_read_uiintel_sub_group_block_read
+#define intel_sub_group_block_read_ui2   intel_sub_group_block_read2
+#define intel_sub_group_block_read_ui4   intel_sub_group_block_read4

Any advantage to use these macros here? They will complicate understanding of 
errors because preprocessor will remove information about the original BIFs 
being called in the source code.


https://reviews.llvm.org/D39936



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


[PATCH] D39784: OpenCL: Assume inline asm is convergent

2017-11-13 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM!


https://reviews.llvm.org/D39784



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


[PATCH] D39129: [OpenCL] Fix generation of constant address space sampler in function scope

2017-11-13 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In https://reviews.llvm.org/D39129#902848, @bader wrote:

> @Anastasia, during the discussion of similar fix 
> (https://reviews.llvm.org/D34342).
>
> I found another bug in the CodeGen library. Do you have time to fix it too?
>  Here is the reproducer from the old review request:
>
>   int get_sampler_initializer(void);
>   kernel void foo() {
> const sampler_t const_smp_func_init = get_sampler_initializer();
>   }
>


I am getting an error currently: `error: internal error: could not emit 
constant value "abstractly"`. It seems very weird and also doesn't seem to be 
related to constant AS change.  I think this should be allowed to compile 
though? I can try to investigate but since I don't know the time frame yet and 
it doesn't seem to be related to constant AS I would prefer to do it as a 
separate change.


https://reviews.llvm.org/D39129



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


[PATCH] D38845: [ASTImporter] Support importing UnresolvedMemberExpr, DependentNameType, DependentScopeDeclRefExpr

2017-11-13 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

Hello Peter,

Looks mostly good, but there are some minor comments.




Comment at: lib/AST/ASTImporter.cpp:5500
+
+  TemplateArgumentListInfo ToTAInfo;
+  TemplateArgumentListInfo *ResInfo = nullptr;

xazax.hun wrote:
> szepet wrote:
> > xazax.hun wrote:
> > > According to phabricator this code is very similar to a snippet starting 
> > > from line 4524 and some code bellow. Maybe it would be worth to have a 
> > > function instead of duplicating?
> > Good point, I would do it in a separate patch and add it as a dependency if 
> > it is OK.
> Sure, that would be awesome. :)
This is a template I have prepared for a patch still non-commited yet:

```
template
bool ImportTemplateArgumentListInfo(const InContainerTy &Container,
TemplateArgumentListInfo &ToTAInfo) {
  for (const auto &FromLoc : Container) {
if (auto ToLoc = ImportTemplateArgumentLoc(FromLoc))
  ToTAInfo.addArgument(*ToLoc);
else
  return true;
  }
  return false;
}
```



Comment at: lib/AST/ASTImporter.cpp:5626
+  DeclarationName Name = Importer.Import(E->getName());
+  if(!E->getName().isEmpty() && Name.isEmpty())
+return nullptr;

Needed space after if.



Comment at: unittests/AST/ASTImporterTest.cpp:574
+ "template  void declToImport() {"
+ "S::foo;"
+ "}",

Could you please align the code as conventions require?


https://reviews.llvm.org/D38845



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


[PATCH] D37806: [analyzer] PthreadLock: Fix return values of XNU lock functions.

2017-11-13 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

Hi Artem,

Sorry for long delay for reviews. Unfortunately, hospital is a bad place to do 
a code review and broken hand is a bad review assistant. This patch looks good 
to me, I have just a minor comment nit.




Comment at: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:282
+}
+// We might want to handle the case when the mutex lock function was 
inlined
+// and returned an Unknown or Undefined value.

TODO?


https://reviews.llvm.org/D37806



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


[PATCH] D37812: [analyzer] PthreadLock: Escape the pointers.

2017-11-13 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

Hi Artem. The patch looks mostly good, but I have an inline question.




Comment at: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:588
+if (Call->isInSystemHeader())
+  IsLibraryFunction = true;
+  }

Do we think that only system headers contain library functions? Shouldn't we 
use `CheckerContext::isCLibraryFunction()` instead?


https://reviews.llvm.org/D37812



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


[PATCH] D39948: Make isDefinition matcher support ObjCMethodDecl

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

LGTM!


https://reviews.llvm.org/D39948



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


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

2017-11-13 Thread Teresa Johnson via cfe-commits
Author: tejohnson
Date: Mon Nov 13 07:38:33 2017
New Revision: 318042

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

Recommit of r317951 and r317951 along with what I believe should fix
the remaining buildbot failures - the target triple should be specified
for both the ThinLTO pre-thinlink compile and backend (post-thinlink)
compile to ensure it is consistent.

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

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=318042&r1=318041&r2=318042&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Mon Nov 13 07:38:33 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 &Mod) {

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=318042&view=auto
==
--- cfe/trunk/test/CodeGen/thinlto-debug-pm.c (added)
+++ cfe/trunk/test/CodeGen/thinlto-debug-pm.c Mon Nov 13 07:38:33 2017
@@ -0,0 +1,10 @@
+// Test to ensure -fdebug-pass-manager works when invoking the
+// ThinLTO backend path with the new PM.
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 -o %t.o -flto=thin -fexperimental-new-pass-manager -triple 
x86_64-unknown-linux-gnu -emit-llvm-bc %s
+// 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


[libcxxabi] r318043 - Remove excess whitespace from syslog message; NFC

2017-11-13 Thread Stephan Bergmann via cfe-commits
Author: sberg
Date: Mon Nov 13 07:40:31 2017
New Revision: 318043

URL: http://llvm.org/viewvc/llvm-project?rev=318043&view=rev
Log:
Remove excess whitespace from syslog message; NFC

Modified:
libcxxabi/trunk/src/private_typeinfo.cpp

Modified: libcxxabi/trunk/src/private_typeinfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/private_typeinfo.cpp?rev=318043&r1=318042&r2=318043&view=diff
==
--- libcxxabi/trunk/src/private_typeinfo.cpp (original)
+++ libcxxabi/trunk/src/private_typeinfo.cpp Mon Nov 13 07:40:31 2017
@@ -673,8 +673,8 @@ __dynamic_cast(const void *static_ptr, c
 info.path_dynamic_ptr_to_static_ptr == unknown)
 {
 syslog(LOG_ERR, "dynamic_cast error 2: One or more of the 
following type_info's "
-" has hidden visibility.  They should all have 
public visibility.  "
-" %s, %s, %s.\n", static_type->name(), 
dynamic_type->name(),
+"has hidden visibility.  They should all have 
public visibility.  "
+"%s, %s, %s.\n", static_type->name(), 
dynamic_type->name(),
 dst_type->name());
 // Redo the search comparing type_info's using strcmp
 info = {dst_type, static_ptr, static_type, src2dst_offset, 0};


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


[PATCH] D37809: [analyzer] PthreadLock: Refactor, use PostCall API. NFC.

2017-11-13 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

I like this refactoring. I wrote some things that are not clear for me inline.




Comment at: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:107
+  void TryXNULock(const CallEvent &Call, CheckerContext &C) const;
+  void AcquireLockAux(const CallEvent &Call, CheckerContext &C, unsigned ArgNo,
+  SVal lock, bool isTryLock,

In the code below `lock` is always `Call.getSVal(ArgNo)`. Should we remove it 
and put SVal acquisition into callees?



Comment at: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:108
+  void AcquireLockAux(const CallEvent &Call, CheckerContext &C, unsigned ArgNo,
+  SVal lock, bool isTryLock,
+  enum LockingSemantics semantics) const;

According to naming conventions , it should be Lock and IsTryLock. But I'm not 
sure that this corresponds to the file's code style so I do not insist.



Comment at: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:188
+if (Call.isCalled(I.Name))
+  (this->*I.Callback)(Call, C);
+  }

break?



Comment at: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:262
+CheckerContext &C) const {
+  AcquireLockAux(Call, C, 0, Call.getArgSVal(0), false, PthreadSemantics);
+}

Could you add comments describing what arguments should do? I.e. `/* ArgNo= */ 
0, /* Lock= */...? It's hard to remember what do these parameters correspond to.


https://reviews.llvm.org/D37809



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


[PATCH] D39961: [libcxx] Fix rethrow_if_nested test on Windows.

2017-11-13 Thread Andrey Khalyavin via Phabricator via cfe-commits
halyavin created this revision.

Stack overflow is caused by B copy constructor invoking default constructor of 
std::nested_exception which tries to capture current exception. Capturing 
current exception copies it and since our current exception is B, we call B's 
copy constructor and cause infinite recursion.

After fix, "throw b" no longer captures current exception (it copies it from 
B(5) object where it is empty) and so throw_if_nested terminates the test.


https://reviews.llvm.org/D39961

Files:
  
test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp


Index: 
test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
===
--- 
test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
+++ 
test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
@@ -9,9 +9,6 @@
 
 // UNSUPPORTED: libcpp-no-exceptions
 
-// This test fails due to a stack overflow
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
 // 
 
 // class nested_exception;
@@ -40,7 +37,7 @@
 {
 public:
 explicit B(int data) : A(data) {}
-B(const B& b) : A(b) {}
+B(const B& b) : std::nested_exception(b), A(b) {}
 };
 
 class C
@@ -104,7 +101,7 @@
 {
 try
 {
-throw b;
+throw B(4);
 }
 catch (const A& a)
 {


Index: test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
===
--- test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
+++ test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
@@ -9,9 +9,6 @@
 
 // UNSUPPORTED: libcpp-no-exceptions
 
-// This test fails due to a stack overflow
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
 // 
 
 // class nested_exception;
@@ -40,7 +37,7 @@
 {
 public:
 explicit B(int data) : A(data) {}
-B(const B& b) : A(b) {}
+B(const B& b) : std::nested_exception(b), A(b) {}
 };
 
 class C
@@ -104,7 +101,7 @@
 {
 try
 {
-throw b;
+throw B(4);
 }
 catch (const A& a)
 {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39962: [libcxx] Fix current_exception test on Windows.

2017-11-13 Thread Andrey Khalyavin via Phabricator via cfe-commits
halyavin created this revision.

Take extra copies in current_exception() into account.


https://reviews.llvm.org/D39962

Files:
  
test/std/language.support/support.exception/propagation/current_exception.pass.cpp

Index: test/std/language.support/support.exception/propagation/current_exception.pass.cpp
===
--- test/std/language.support/support.exception/propagation/current_exception.pass.cpp
+++ test/std/language.support/support.exception/propagation/current_exception.pass.cpp
@@ -7,10 +7,6 @@
 //
 //===--===//
 
-// This test needs to be rewritten for the Windows exception_ptr semantics
-// which copy the exception each time the exception_ptr is copied.
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
 // UNSUPPORTED: libcpp-no-exceptions
 // 
 
@@ -51,6 +47,22 @@
 }
 assert(A::constructed == 0);
 {
+try 
+{
+throw A();
+assert(false);
+}
+catch(...)
+{
+std::exception_ptr p = std::current_exception();
+int constructed_before = A::constructed;
+std::exception_ptr p2 = p;
+assert(A::constructed == constructed_before);
+assert(p == p2);
+}
+}
+assert(A::constructed == 0);
+{
 std::exception_ptr p2;
 try
 {
@@ -61,11 +73,10 @@
 catch (...)
 {
 std::exception_ptr p = std::current_exception();
-assert(A::constructed == 1);
+assert(A::constructed <= 2);
 assert(p != nullptr);
 p2 = std::current_exception();
-assert(A::constructed == 1);
-assert(p == p2);
+assert(A::constructed <= 3);
 }
 assert(A::constructed == 1);
 }
@@ -81,11 +92,10 @@
 catch (A&)
 {
 std::exception_ptr p = std::current_exception();
-assert(A::constructed == 1);
+assert(A::constructed <= 2);
 assert(p != nullptr);
 p2 = std::current_exception();
-assert(A::constructed == 1);
-assert(p == p2);
+assert(A::constructed <= 3);
 }
 assert(A::constructed == 1);
 }
@@ -101,11 +111,10 @@
 catch (A)
 {
 std::exception_ptr p = std::current_exception();
-assert(A::constructed == 2);
+assert(A::constructed <= 3);
 assert(p != nullptr);
 p2 = std::current_exception();
-assert(A::constructed == 2);
-assert(p == p2);
+assert(A::constructed <= 4);
 }
 assert(A::constructed == 1);
 }
@@ -148,7 +157,7 @@
 try
 {
 std::exception_ptr p = std::current_exception();
-assert(A::constructed == 1);
+assert(A::constructed <= 2);
 assert(p != nullptr);
 throw;
 assert(false);
@@ -181,7 +190,7 @@
 catch (...)
 {
 std::exception_ptr p = std::current_exception();
-assert(A::constructed == 1);
+assert(A::constructed <= 2);
 assert(p != nullptr);
 }
 assert(A::constructed == 1);
@@ -210,7 +219,7 @@
 assert(A::constructed == 1);
 }
 std::exception_ptr p = std::current_exception();
-assert(A::constructed == 1);
+assert(A::constructed <= 2);
 assert(p != nullptr);
 }
 assert(A::constructed == 0);
@@ -263,9 +272,9 @@
 catch (...)
 {
 p = std::current_exception();
-assert(A::constructed == 1);
+assert(A::constructed <= 2);
 }
-assert(A::constructed == 1);
+assert(A::constructed <= 2);
 }
 assert(A::constructed == 1);
 assert(p != nullptr);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39963: [RISCV][RFC] Add initial RISC-V target and driver support

2017-11-13 Thread Alex Bradbury via Phabricator via cfe-commits
asb created this revision.
Herald added subscribers: jordy.potman.lists, simoncook, johnrusso, rbar, 
mgorny.

I'm marking this as an RFC as I'd initially like to get feedback on the testing 
approach and structure of this patch (is this about the right granularity or 
would you prefer to start with something more minimal?). Follow-up patches will 
add ABI lowering and expand command line option parsing.

I wouldn't want to have the addition of RISC-V clang support gated on improving 
clang cross compilation support (e.g. config files or similar as has been 
discussed on the mailing list). However, if there's a straight-forward way I 
can reduce duplication and extend something already in-tree then of course I'd 
like to do that. One option might be to extend the BareMetal toolchain with 
RISC-V support, though I'd want the flexibility of using libgcc if preferred, 
and using the GNU linker rather than lld. What do you think Jonathan?

Please do add reviewers who may be qualified and willing to help. I'm picking 
on Chandler for kindly offering to help get this reviewed (either personally or 
pointing me to the right person), Petr for your work on the Fuchsia driver and 
Jonathan for your work on the BareMetal driver.

I'm currently reliant on the user setting up riscv32-ld or riscv64-ld symlinks. 
Is there some common code somewhere I'm missing for finding an appropriate 
linker in the GCC installation path?


https://reviews.llvm.org/D39963

Files:
  lib/Basic/CMakeLists.txt
  lib/Basic/Targets.cpp
  lib/Basic/Targets/RISCV.cpp
  lib/Basic/Targets/RISCV.h
  lib/Driver/CMakeLists.txt
  lib/Driver/Driver.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Driver/ToolChains/Clang.h
  lib/Driver/ToolChains/Gnu.cpp
  lib/Driver/ToolChains/RISCV.cpp
  lib/Driver/ToolChains/RISCV.h
  test/Driver/frame-pointer.c
  test/Driver/riscv-abi.c
  test/Driver/riscv-features.c
  test/Driver/riscv32-toolchain.c
  test/Driver/riscv64-toolchain.c
  test/Preprocessor/init.c

Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -9987,3 +9987,398 @@
 // ARM-DARWIN-BAREMETAL-64: #define __PTRDIFF_TYPE__ long int
 // ARM-DARWIN-BAREMETAL-64: #define __SIZE_TYPE__ long unsigned int
 
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=riscv32 < /dev/null \
+// RUN:   | FileCheck -match-full-lines -check-prefix=RISCV32 %s
+// RISCV32: #define _ILP32 1
+// RISCV32: #define __ATOMIC_ACQUIRE 2
+// RISCV32: #define __ATOMIC_ACQ_REL 4
+// RISCV32: #define __ATOMIC_CONSUME 1
+// RISCV32: #define __ATOMIC_RELAXED 0
+// RISCV32: #define __ATOMIC_RELEASE 3
+// RISCV32: #define __ATOMIC_SEQ_CST 5
+// RISCV32: #define __BIGGEST_ALIGNMENT__ 16
+// RISCV32: #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
+// RISCV32: #define __CHAR16_TYPE__ unsigned short
+// RISCV32: #define __CHAR32_TYPE__ unsigned int
+// RISCV32: #define __CHAR_BIT__ 8
+// RISCV32: #define __DBL_DECIMAL_DIG__ 17
+// RISCV32: #define __DBL_DENORM_MIN__ 4.9406564584124654e-324
+// RISCV32: #define __DBL_DIG__ 15
+// RISCV32: #define __DBL_EPSILON__ 2.2204460492503131e-16
+// RISCV32: #define __DBL_HAS_DENORM__ 1
+// RISCV32: #define __DBL_HAS_INFINITY__ 1
+// RISCV32: #define __DBL_HAS_QUIET_NAN__ 1
+// RISCV32: #define __DBL_MANT_DIG__ 53
+// RISCV32: #define __DBL_MAX_10_EXP__ 308
+// RISCV32: #define __DBL_MAX_EXP__ 1024
+// RISCV32: #define __DBL_MAX__ 1.7976931348623157e+308
+// RISCV32: #define __DBL_MIN_10_EXP__ (-307)
+// RISCV32: #define __DBL_MIN_EXP__ (-1021)
+// RISCV32: #define __DBL_MIN__ 2.2250738585072014e-308
+// RISCV32: #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
+// RISCV32: #define __ELF__ 1
+// RISCV32: #define __FINITE_MATH_ONLY__ 0
+// RISCV32: #define __FLT_DECIMAL_DIG__ 9
+// RISCV32: #define __FLT_DENORM_MIN__ 1.40129846e-45F
+// RISCV32: #define __FLT_DIG__ 6
+// RISCV32: #define __FLT_EPSILON__ 1.19209290e-7F
+// RISCV32: #define __FLT_EVAL_METHOD__ 0
+// RISCV32: #define __FLT_HAS_DENORM__ 1
+// RISCV32: #define __FLT_HAS_INFINITY__ 1
+// RISCV32: #define __FLT_HAS_QUIET_NAN__ 1
+// RISCV32: #define __FLT_MANT_DIG__ 24
+// RISCV32: #define __FLT_MAX_10_EXP__ 38
+// RISCV32: #define __FLT_MAX_EXP__ 128
+// RISCV32: #define __FLT_MAX__ 3.40282347e+38F
+// RISCV32: #define __FLT_MIN_10_EXP__ (-37)
+// RISCV32: #define __FLT_MIN_EXP__ (-125)
+// RISCV32: #define __FLT_MIN__ 1.17549435e-38F
+// RISCV32: #define __FLT_RADIX__ 2
+// RISCV32: #define __GCC_ATOMIC_BOOL_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_CHAR_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_INT_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_LLONG_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_LONG_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_POINTER_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_SHORT_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
+// RISCV

[PATCH] D38843: [ASTImporter] Support importing CXXPseudoDestructorExpr

2017-11-13 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

Hello Peter,

Patch is almost OK but there are some minor issues.




Comment at: lib/AST/ASTImporter.cpp:5549
+  Expr *BaseE = Importer.Import(E->getBase());
+  if (!BaseE)
+return nullptr;

szepet wrote:
> xazax.hun wrote:
> > Does `E->getBase()` guaranteed to return non-null? What happens when this 
> > node was constructed using EmptyShell? Shouldn't we check for that somehow? 
> > When can that happen?
> The import process of ArraySubscriptExpr and UnaryOperator (and probably more 
> other classes) are not prepared for this case as well. Not sure if this can 
> be encountered in a complete AST.
> However, I think a lazy evaluated && operator won't hurt the performance and 
> at least we are going to be prepared for this case.
  Expr *getBase() const { return cast(Base); }
This means it is always non-null, I guess.



Comment at: lib/AST/ASTImporter.cpp:5552
+
+  TypeSourceInfo *ScopeInfo = Importer.Import(E->getScopeTypeInfo());
+

Source ScopeInfo can be null but we still need to check the result.



Comment at: unittests/AST/ASTImporterTest.cpp:546
+ "void declToImport(int *p) {"
+ "p->T::~T();"
+ "}",

 #  Needs to be aligned.
 # Unused templates are common source of test failures on Windows (MSVC). Could 
you add a template instantiation (or check it works on Windows as expected)?


https://reviews.llvm.org/D38843



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


[PATCH] D35068: [analyzer] Detect usages of unsafe I/O functions

2017-11-13 Thread Daniel Kolozsvari via Phabricator via cfe-commits
koldaniel added inline comments.



Comment at: include/clang/StaticAnalyzer/Checkers/Checkers.td:382
+DescFile<"CheckSecuritySyntaxOnly.cpp">;
+  def DeprecatedBufferHandling : Checker<"DeprecatedBufferHandling">,
+HelpText<"Warn on uses of deprecated buffer manipulating functions">,

xazax.hun wrote:
> I do not like the naming of these two checks, It feels like one of them warns 
> for a subset of the other, however, it is not the case.
> What about removing the "deprecated" part from the first check? 
Both checker warns if a buffer handling function is deprecated 
(DeprecatedOrUnsafeBufferHandling calls DeprecatedBufferHandling), but the 
DeprecatedOrUnsafeBufferHandling checker also warns if a function is not only 
deprecated but unsafe (i.e. writes a buffer without size restrictions) too.



Comment at: lib/Driver/ToolChains/Clang.cpp:2256
+  
CmdArgs.push_back("-analyzer-checker=security.insecureAPI.DeprecatedOrUnsafeBufferHandling");
+  
CmdArgs.push_back("-analyzer-checker=security.insecureAPI.DeprecatedBufferHandling");
 }

xazax.hun wrote:
> Do we want to turn on both of these by default? Warning on every use of 
> `memset` will be very noisy for example. 
It's true that these checkers could be very noisy if they are enabled by 
default, I'm going to fix this.



Comment at: lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp:147
+.Case("sprintf", &WalkAST::checkDeprecatedOrUnsafeBufferHandling)
+.Case("vsprintf", &WalkAST::checkDeprecatedOrUnsafeBufferHandling)
+.Case("scanf", &WalkAST::checkDeprecatedOrUnsafeBufferHandling)

xazax.hun wrote:
> This is the only print-related function in this group. Is this intended? 
sprintf and vsprintf are buffer-writing functions without size restrictions, 
this is the reason why only these two are checked by 
DeprecatedOrUnsafeBufferHandling of the printf family. There are buffer-writing 
members of this family which are not unsafe (because of size restrictions) but 
have a secure version introduced in the C11 standard, and 
DeprecatedBufferHandling warns for them: swprintf, snprintf, vswprintf, 
vsnprintf. Other printf-related functions are either printing to a file or to 
the standard output.


https://reviews.llvm.org/D35068



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


[PATCH] D38694: [ASTImporter] Support importing CXXUnresolvedConstructExpr and UnresolvedLookupExpr

2017-11-13 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

Hi Peter,

Thank you for the patch. You can find some comments inline.




Comment at: lib/AST/ASTImporter.cpp:5476
+
+  for (unsigned ai = 0, ae = NumArgs; ai != ae; ++ai) {
+Expr *FromArg = CE->getArg(ai);

xazax.hun wrote:
> Use uppercase variable names. 
We have implemented ImportContainerChecked helper to avoid such routine code. 
You can use it.



Comment at: lib/AST/ASTImporter.cpp:5484
+
+  Expr **ToArgs_Copied = new (Importer.getToContext()) Expr *[NumArgs];
+

No need to allocate and copy - CXXUnresolvedConstructExpr::Create allocates the 
required amount of memory itself.



Comment at: lib/AST/ASTImporter.cpp:5510
+  UnresolvedSet<8> ToDecls;
+  for (Decl *D : E->decls()) {
+if (NamedDecl *To = cast_or_null(Importer.Import(D)))

ImportContainerChecked



Comment at: lib/AST/ASTImporter.cpp:5520
+  if (E->hasExplicitTemplateArgs()) {
+for (const auto &FromLoc : E->template_arguments()) {
+  bool Error = false;

Needs to become a common function.



Comment at: unittests/AST/ASTImporterTest.cpp:521
+ "template  void declToImport() {"
+ "C d;"
+ "d.t = T()"

Code samples need alignment.


https://reviews.llvm.org/D38694



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


[PATCH] D39964: Change code owner for Clang Static Analyzer to Devin Coughlin.

2017-11-13 Thread Anna Zaks via Phabricator via cfe-commits
zaks.anna created this revision.

I've sent the email to cfg-dev and the community is supportive of this change.


https://reviews.llvm.org/D39964

Files:
  CODE_OWNERS.TXT


Index: CODE_OWNERS.TXT
===
--- CODE_OWNERS.TXT
+++ CODE_OWNERS.TXT
@@ -25,6 +25,10 @@
 E: echri...@gmail.com
 D: Debug Information, inline assembly
 
+N: Devin Coughlin
+E: dcough...@apple.com
+D: Clang Static Analyzer
+
 N: Doug Gregor
 E: dgre...@apple.com
 D: Emeritus owner
@@ -41,10 +45,6 @@
 E: an...@korobeynikov.info
 D: Exception handling, Windows codegen, ARM EABI
 
-N: Anna Zaks
-E: ga...@apple.com
-D: Clang Static Analyzer
-
 N: John McCall
 E: rjmcc...@apple.com
 D: Clang LLVM IR generation


Index: CODE_OWNERS.TXT
===
--- CODE_OWNERS.TXT
+++ CODE_OWNERS.TXT
@@ -25,6 +25,10 @@
 E: echri...@gmail.com
 D: Debug Information, inline assembly
 
+N: Devin Coughlin
+E: dcough...@apple.com
+D: Clang Static Analyzer
+
 N: Doug Gregor
 E: dgre...@apple.com
 D: Emeritus owner
@@ -41,10 +45,6 @@
 E: an...@korobeynikov.info
 D: Exception handling, Windows codegen, ARM EABI
 
-N: Anna Zaks
-E: ga...@apple.com
-D: Clang Static Analyzer
-
 N: John McCall
 E: rjmcc...@apple.com
 D: Clang LLVM IR generation
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] r318064 - native_tan: Switch implementation to use native_sin/native_cos

2017-11-13 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Mon Nov 13 10:28:48 2017
New Revision: 318064

URL: http://llvm.org/viewvc/llvm-project?rev=318064&view=rev
Log:
native_tan: Switch implementation to use native_sin/native_cos

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

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

Modified: libclc/trunk/generic/include/clc/math/native_tan.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_tan.h?rev=318064&r1=318063&r2=318064&view=diff
==
--- libclc/trunk/generic/include/clc/math/native_tan.h (original)
+++ libclc/trunk/generic/include/clc/math/native_tan.h Mon Nov 13 10:28:48 2017
@@ -1,10 +1,9 @@
-//===-- generic/include/clc/math/native_tan.h 
-===//
+#define __CLC_BODY 
+#define __CLC_FUNCTION native_tan
+#define __FLOAT_ONLY
 
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under both the University of Illinois Open Source
-// License and the MIT license. See LICENSE.TXT for details.
-//
-//===--===//
-#define native_tan tan
+#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=318064&r1=318063&r2=318064&view=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Mon Nov 13 10:28:48 2017
@@ -128,6 +128,7 @@ math/native_log10.cl
 math/native_log2.cl
 math/native_sin.cl
 math/native_sqrt.cl
+math/native_tan.cl
 math/tables.cl
 math/clc_nextafter.cl
 math/nextafter.cl

Added: libclc/trunk/generic/lib/math/native_tan.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_tan.cl?rev=318064&view=auto
==
--- libclc/trunk/generic/lib/math/native_tan.cl (added)
+++ libclc/trunk/generic/lib/math/native_tan.cl Mon Nov 13 10:28:48 2017
@@ -0,0 +1,5 @@
+#include 
+
+#define __CLC_BODY 
+#define __FLOAT_ONLY
+#include 

Added: libclc/trunk/generic/lib/math/native_tan.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_tan.inc?rev=318064&view=auto
==
--- libclc/trunk/generic/lib/math/native_tan.inc (added)
+++ libclc/trunk/generic/lib/math/native_tan.inc Mon Nov 13 10:28:48 2017
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_tan(__CLC_GENTYPE val) {
+  return native_sin(val) / native_cos(val);
+}


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


[libclc] r318063 - math: Use precomputed constant for log2(10.0)

2017-11-13 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Mon Nov 13 10:28:45 2017
New Revision: 318063

URL: http://llvm.org/viewvc/llvm-project?rev=318063&view=rev
Log:
math: Use precomputed constant for log2(10.0)

exp10 CTS fails with or without this change

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

Modified:
libclc/trunk/generic/include/clc/float/definitions.h
libclc/trunk/generic/lib/math/exp10.inc
libclc/trunk/generic/lib/math/native_exp10.inc

Modified: libclc/trunk/generic/include/clc/float/definitions.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/float/definitions.h?rev=318063&r1=318062&r2=318063&view=diff
==
--- libclc/trunk/generic/include/clc/float/definitions.h (original)
+++ libclc/trunk/generic/include/clc/float/definitions.h Mon Nov 13 10:28:45 
2017
@@ -31,6 +31,10 @@
 #define M_SQRT2_F   0x1.6a09e6p+0f
 #define M_SQRT1_2_F 0x1.6a09e6p-1f
 
+#ifdef __CLC_INTERNAL
+#define M_LOG210_F  0x1.a934f0p+1f
+#endif
+
 #ifdef cl_khr_fp64
 
 #define HUGE_VAL__builtin_huge_val()
@@ -59,6 +63,10 @@
 #define M_SQRT2 0x1.6a09e667f3bcdp+0
 #define M_SQRT1_2   0x1.6a09e667f3bcdp-1
 
+#ifdef __CLC_INTERNAL
+#define M_LOG210   0x1.a934f0979a371p+1
+#endif
+
 #endif
 
 #ifdef cl_khr_fp16

Modified: libclc/trunk/generic/lib/math/exp10.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/exp10.inc?rev=318063&r1=318062&r2=318063&view=diff
==
--- libclc/trunk/generic/lib/math/exp10.inc (original)
+++ libclc/trunk/generic/lib/math/exp10.inc Mon Nov 13 10:28:45 2017
@@ -1,9 +1,9 @@
 _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE exp10(__CLC_GENTYPE val) {
   // exp10(x) = exp2(x * log2(10))
 #if __CLC_FPSIZE == 32
-  return exp2(val * log2(10.0f));
+  return exp2(val * M_LOG210_F);
 #elif __CLC_FPSIZE == 64
-  return exp2(val * log2(10.0));
+  return exp2(val * M_LOG210);
 #else
 #error unknown _CLC_FPSIZE
 #endif

Modified: libclc/trunk/generic/lib/math/native_exp10.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_exp10.inc?rev=318063&r1=318062&r2=318063&view=diff
==
--- libclc/trunk/generic/lib/math/native_exp10.inc (original)
+++ libclc/trunk/generic/lib/math/native_exp10.inc Mon Nov 13 10:28:45 2017
@@ -1,3 +1,3 @@
 _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_exp10(__CLC_GENTYPE val) {
-  return native_exp2(val * native_log2(10));
+  return native_exp2(val * M_LOG210_F);
 }


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


[libclc] r318065 - native_rsqrt: Switch implementation to 1 / native_sqrt

2017-11-13 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Mon Nov 13 10:28:51 2017
New Revision: 318065

URL: http://llvm.org/viewvc/llvm-project?rev=318065&view=rev
Log:
native_rsqrt: Switch implementation to 1 / native_sqrt

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

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

Modified: libclc/trunk/generic/include/clc/math/native_rsqrt.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_rsqrt.h?rev=318065&r1=318064&r2=318065&view=diff
==
--- libclc/trunk/generic/include/clc/math/native_rsqrt.h (original)
+++ libclc/trunk/generic/include/clc/math/native_rsqrt.h Mon Nov 13 10:28:51 
2017
@@ -1 +1,9 @@
-#define native_rsqrt rsqrt
+#define __CLC_BODY 
+#define __CLC_FUNCTION native_rsqrt
+#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=318065&r1=318064&r2=318065&view=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Mon Nov 13 10:28:51 2017
@@ -126,6 +126,7 @@ math/native_exp2.cl
 math/native_log.cl
 math/native_log10.cl
 math/native_log2.cl
+math/native_rsqrt.cl
 math/native_sin.cl
 math/native_sqrt.cl
 math/native_tan.cl

Added: libclc/trunk/generic/lib/math/native_rsqrt.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_rsqrt.cl?rev=318065&view=auto
==
--- libclc/trunk/generic/lib/math/native_rsqrt.cl (added)
+++ libclc/trunk/generic/lib/math/native_rsqrt.cl Mon Nov 13 10:28:51 2017
@@ -0,0 +1,5 @@
+#include 
+
+#define __CLC_BODY 
+#define __FLOAT_ONLY
+#include 

Added: libclc/trunk/generic/lib/math/native_rsqrt.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_rsqrt.inc?rev=318065&view=auto
==
--- libclc/trunk/generic/lib/math/native_rsqrt.inc (added)
+++ libclc/trunk/generic/lib/math/native_rsqrt.inc Mon Nov 13 10:28:51 2017
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_rsqrt(__CLC_GENTYPE val) {
+  return 1.0f / native_sqrt(val);
+}


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


[libclc] r318066 - native_recip: provide function implementation instead of macro

2017-11-13 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Mon Nov 13 10:28:53 2017
New Revision: 318066

URL: http://llvm.org/viewvc/llvm-project?rev=318066&view=rev
Log:
native_recip: provide function implementation instead of macro

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

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

Modified: libclc/trunk/generic/include/clc/math/native_recip.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_recip.h?rev=318066&r1=318065&r2=318066&view=diff
==
--- libclc/trunk/generic/include/clc/math/native_recip.h (original)
+++ libclc/trunk/generic/include/clc/math/native_recip.h Mon Nov 13 10:28:53 
2017
@@ -1 +1,9 @@
-#define native_recip(x) ((1) / (x))
+#define __CLC_BODY 
+#define __CLC_FUNCTION native_recip
+#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=318066&r1=318065&r2=318066&view=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Mon Nov 13 10:28:53 2017
@@ -126,6 +126,7 @@ math/native_exp2.cl
 math/native_log.cl
 math/native_log10.cl
 math/native_log2.cl
+math/native_recip.cl
 math/native_rsqrt.cl
 math/native_sin.cl
 math/native_sqrt.cl

Added: libclc/trunk/generic/lib/math/native_recip.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_recip.cl?rev=318066&view=auto
==
--- libclc/trunk/generic/lib/math/native_recip.cl (added)
+++ libclc/trunk/generic/lib/math/native_recip.cl Mon Nov 13 10:28:53 2017
@@ -0,0 +1,5 @@
+#include 
+
+#define __CLC_BODY 
+#define __FLOAT_ONLY
+#include 

Added: libclc/trunk/generic/lib/math/native_recip.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_recip.inc?rev=318066&view=auto
==
--- libclc/trunk/generic/lib/math/native_recip.inc (added)
+++ libclc/trunk/generic/lib/math/native_recip.inc Mon Nov 13 10:28:53 2017
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_recip(__CLC_GENTYPE val) {
+  return 1.0f / val;
+}


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


[libclc] r318067 - native_divide: provide function implementation instead of macro

2017-11-13 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Mon Nov 13 10:28:56 2017
New Revision: 318067

URL: http://llvm.org/viewvc/llvm-project?rev=318067&view=rev
Log:
native_divide: provide function implementation instead of macro

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

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

Added: libclc/trunk/generic/include/clc/math/binary_decl_tt.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/binary_decl_tt.inc?rev=318067&view=auto
==
--- libclc/trunk/generic/include/clc/math/binary_decl_tt.inc (added)
+++ libclc/trunk/generic/include/clc/math/binary_decl_tt.inc Mon Nov 13 
10:28:56 2017
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a, 
__CLC_GENTYPE b);

Modified: libclc/trunk/generic/include/clc/math/native_divide.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_divide.h?rev=318067&r1=318066&r2=318067&view=diff
==
--- libclc/trunk/generic/include/clc/math/native_divide.h (original)
+++ libclc/trunk/generic/include/clc/math/native_divide.h Mon Nov 13 10:28:56 
2017
@@ -1 +1,7 @@
-#define native_divide(x, y) ((x) / (y))
+#define __CLC_BODY 
+#define __CLC_FUNCTION native_divide
+
+#include 
+
+#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=318067&r1=318066&r2=318067&view=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Mon Nov 13 10:28:56 2017
@@ -120,6 +120,7 @@ math/logb.cl
 math/mad.cl
 math/modf.cl
 math/native_cos.cl
+math/native_divide.cl
 math/native_exp.cl
 math/native_exp10.cl
 math/native_exp2.cl

Added: libclc/trunk/generic/lib/math/native_divide.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_divide.cl?rev=318067&view=auto
==
--- libclc/trunk/generic/lib/math/native_divide.cl (added)
+++ libclc/trunk/generic/lib/math/native_divide.cl Mon Nov 13 10:28:56 2017
@@ -0,0 +1,5 @@
+#include 
+
+#define __CLC_BODY 
+#define __FLOAT_ONLY
+#include 

Added: libclc/trunk/generic/lib/math/native_divide.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_divide.inc?rev=318067&view=auto
==
--- libclc/trunk/generic/lib/math/native_divide.inc (added)
+++ libclc/trunk/generic/lib/math/native_divide.inc Mon Nov 13 10:28:56 2017
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_divide(__CLC_GENTYPE x, 
__CLC_GENTYPE y) {
+  return x / y;
+}


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


[PATCH] D39953: [CodeGen] Do not lookup for cached TBAA metadata nodes twice

2017-11-13 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/CodeGen/CodeGenTBAA.cpp:267
+  if (N)
 return N;
 

The main danger with persisting this kind of reference is that DenseMap doesn't 
actually guarantee stability, so if there are recursive calls that can grow the 
data structure, the reference will become dangling.  I think your patch is okay 
for the previous two functions, although I'd like you to check that, but in 
this function I'm confident that it's wrong, because you definitely recursively 
call getBaseTypeInfo below.


Repository:
  rL LLVM

https://reviews.llvm.org/D39953



___
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-13 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: include/clang/Driver/Options.td:1032
+def fno_instrument_functions_inline : Flag<["-"], 
"fno-instrument-functions-inline">, Group, Flags<[CC1Option]>,
+  HelpText<"When using -finstrument-functions, insert the calls after 
inlining">;
 

This actually describes GCC's behavior for `-finstrument-functions`. I suspect 
the current behavior is pretty useless for most people. I'd rather make the new 
behavior the default and add a flag to request the old behavior.


https://reviews.llvm.org/D39331



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


[PATCH] D39053: [Bitfield] Add more cases to making the bitfield a separate location

2017-11-13 Thread Wei Mi via Phabricator via cfe-commits
wmi added a comment.

I think it may be hard to fix the problem in backend. It will face the same 
issue of store-to-load forwarding if at some places the transformation happens 
but at some other places somehow it doesn't.

But I am not sure whether it is acceptable to add more finegrain bitfield 
access transformations in frontend. It is a tradeoff. From my experience trying 
your patch on x8664, I saw saving of some instructions because with the 
transformation we now use shorter immediate consts which can be folded into 
other instructions instead of loading them in separate moves. But the bit 
operations are not saved (I may be wrong), so I have no idea whether it is 
critical for performance (To provide some background, we introduced finegrain 
field access because the original problem introduced a serious performance 
issue in some critical libraries. But doing this kind of bitfield 
transformations in frontend can potentially harm some other applications. That 
is why it is off by default, and Hal had concern about adding more such 
transformations. ).  Do you have performance number on some benchmarks to 
justify its importance? That may help folks to make a better trade off here.


https://reviews.llvm.org/D39053



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


r318074 - [clang] Remove redundant return [NFC]

2017-11-13 Thread Mandeep Singh Grang via cfe-commits
Author: mgrang
Date: Mon Nov 13 11:29:31 2017
New Revision: 318074

URL: http://llvm.org/viewvc/llvm-project?rev=318074&view=rev
Log:
 [clang] Remove redundant return [NFC]

Reviewers: rsmith, sfantao, mcrosier

Reviewed By: mcrosier

Subscribers: jholewinski, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp?rev=318074&r1=318073&r2=318074&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp Mon Nov 13 11:29:31 2017
@@ -411,7 +411,6 @@ void CGOpenMPRuntimeNVPTX::emitSpmdKerne
   CodeGen.setAction(Action);
   emitTargetOutlinedFunctionHelper(D, ParentName, OutlinedFn, OutlinedFnID,
IsOffloadEntry, CodeGen);
-  return;
 }
 
 void CGOpenMPRuntimeNVPTX::emitSpmdEntryHeader(

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=318074&r1=318073&r2=318074&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Mon Nov 13 11:29:31 2017
@@ -598,8 +598,6 @@ void Driver::CreateOffloadingDeviceToolC
   //
   // TODO: Add support for other offloading programming models here.
   //
-
-  return;
 }
 
 Compilation *Driver::BuildCompilation(ArrayRef ArgList) {

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp?rev=318074&r1=318073&r2=318074&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp Mon Nov 
13 11:29:31 2017
@@ -107,8 +107,6 @@ void ObjCSuperDeallocChecker::checkPreOb
   }
 
   reportUseAfterDealloc(ReceiverSymbol, Desc, M.getOriginExpr(), C);
-
-  return;
 }
 
 void ObjCSuperDeallocChecker::checkPreCall(const CallEvent &Call,


___
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-13 Thread Mandeep Singh Grang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318074:  [clang] Remove redundant return [NFC] (authored by 
mgrang).

Changed prior to commit:
  https://reviews.llvm.org/D39915?vs=122494&id=122693#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39915

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


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


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


[PATCH] D38216: [C++17] Fix class template argument deduction for default constructors without an initializer

2017-11-13 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In https://reviews.llvm.org/D38216#922768, @lichray wrote:

> So deducing from default initialization is indeed allowed, but `extern`
>  could be interpreted as outlawed because similar to the case of non-
>  inline static data member, where the declaration doesn't give **the**
>  initialization of that variable.  @rsmith, comments?


That's almost right, but not all `extern` declarations are disallowed. (An 
`extern` declaration is still a defining declaration if it has an initializer.)




Comment at: lib/Sema/SemaDecl.cpp:10208
+return DeduceTemplateSpecializationFromInitializer(
+  TSI, Entity, Kind, Init ? InitsCopy : MutableArrayRef());  
   }

Please put this `?:` expression into the declaration of `DeduceInits` instead 
of here. (We should build an empty list instead of a list of one null pointer 
when there is no init.)


https://reviews.llvm.org/D38216



___
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-13 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.

LGTM


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] D38216: [C++17] Fix class template argument deduction for default constructors without an initializer

2017-11-13 Thread Nicolas Lesser via Phabricator via cfe-commits
Rakete updated this revision to Diff 122708.
Rakete added a comment.

Made `DeduceInits` empty instead of a workaround somewhere else. Is it still 
ok, @rsmith ?


https://reviews.llvm.org/D38216

Files:
  lib/Sema/SemaDecl.cpp
  test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
  test/Parser/cxx1z-class-template-argument-deduction.cpp


Index: test/Parser/cxx1z-class-template-argument-deduction.cpp
===
--- test/Parser/cxx1z-class-template-argument-deduction.cpp
+++ test/Parser/cxx1z-class-template-argument-deduction.cpp
@@ -52,7 +52,7 @@
 
   operator A(); // expected-error {{requires template arguments; argument 
deduction not allowed in conversion function type}}
 
-  static A x; // expected-error {{declaration of variable 'x' with deduced 
type 'A' requires an initializer}}
+  static A x;
   static constexpr A y = 0;
 };
 
@@ -114,7 +114,6 @@
 (void)A{n};
 (void)new A(n);
 (void)new A{n};
-// FIXME: We should diagnose the lack of an initializer here.
 (void)new A;
   }
 }
@@ -127,7 +126,7 @@
 
   auto k() -> A; // expected-error{{requires template arguments}}
 
-  A a; // expected-error {{declaration of variable 'a' with deduced type 'A' 
requires an initializer}}
+  A a;
   A b = 0;
   const A c = 0;
   A (parens) = 0; // expected-error {{cannot use parentheses when declaring 
variable with deduced class template specialization type}}
Index: test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
===
--- test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
+++ test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
@@ -5,8 +5,7 @@
 A(int) -> A;
 
 static constexpr inline const volatile A a = {}; // ok, specifiers are 
permitted
-// FIXME: There isn't really a good reason to reject this.
-A b; // expected-error {{requires an initializer}}
+A b;
 A c [[]] {};
 
 A d = {}, e = {};
@@ -13,6 +12,6 @@
 A f(0), g{}; // expected-error {{template arguments deduced as 'A' in 
declaration of 'f' and deduced as 'A' in declaration of 'g'}}
 
 struct B {
-  static A a; // expected-error {{requires an initializer}}
+  static A a;
 };
-extern A x; // expected-error {{requires an initializer}}
+extern A x;
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -10182,7 +10182,8 @@
   assert(Deduced && "deduceVarTypeFromInitializer for non-deduced type");
 
   // C++11 [dcl.spec.auto]p3
-  if (!Init) {
+  // Except for class argument deduction.
+  if (!Init && !isa(Deduced)) {
 assert(VDecl && "no init for init capture deduction?");
 Diag(VDecl->getLocation(), diag::err_auto_var_requires_init)
   << VDecl->getDeclName() << Type;
@@ -10189,7 +10190,10 @@
 return QualType();
   }
 
-  ArrayRef DeduceInits = Init;
+  ArrayRef DeduceInits;
+  if (Init)
+DeduceInits = Init;
+
   if (DirectInit) {
 if (auto *PL = dyn_cast_or_null(Init))
   DeduceInits = PL->exprs();


Index: test/Parser/cxx1z-class-template-argument-deduction.cpp
===
--- test/Parser/cxx1z-class-template-argument-deduction.cpp
+++ test/Parser/cxx1z-class-template-argument-deduction.cpp
@@ -52,7 +52,7 @@
 
   operator A(); // expected-error {{requires template arguments; argument deduction not allowed in conversion function type}}
 
-  static A x; // expected-error {{declaration of variable 'x' with deduced type 'A' requires an initializer}}
+  static A x;
   static constexpr A y = 0;
 };
 
@@ -114,7 +114,6 @@
 (void)A{n};
 (void)new A(n);
 (void)new A{n};
-// FIXME: We should diagnose the lack of an initializer here.
 (void)new A;
   }
 }
@@ -127,7 +126,7 @@
 
   auto k() -> A; // expected-error{{requires template arguments}}
 
-  A a; // expected-error {{declaration of variable 'a' with deduced type 'A' requires an initializer}}
+  A a;
   A b = 0;
   const A c = 0;
   A (parens) = 0; // expected-error {{cannot use parentheses when declaring variable with deduced class template specialization type}}
Index: test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
===
--- test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
+++ test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
@@ -5,8 +5,7 @@
 A(int) -> A;
 
 static constexpr inline const volatile A a = {}; // ok, specifiers are permitted
-// FIXME: There isn't really a good reason to reject this.
-A b; // expected-error {{requires an initializer}}
+A b;
 A c [[]] {};
 
 A d = {}, e = {};
@@ -13,6 +12,6 @@
 A f(0), g{}; // expected-error {{template arguments deduced as 'A' in declaration of 'f' and deduced as 'A' in declaration of 'g'}}
 
 struct B {
-  static A a; // expected-error {{requires an initializer}}
+  stat

[PATCH] D39793: [asan] Remove semicolon after do {} while (0)

2017-11-13 Thread Tom de Vries via Phabricator via cfe-commits
vries added a comment.

Committed.


https://reviews.llvm.org/D39793



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


[PATCH] D39963: [RISCV][RFC] Add initial RISC-V target and driver support

2017-11-13 Thread John Russo via Phabricator via cfe-commits
johnrusso added inline comments.



Comment at: lib/Driver/ToolChains/RISCV.h:42
+  : GnuTool("RISCV::Linker",
+TC.getTriple().isArch64Bit() ? "riscv64-ld" : "riscv32-ld",
+TC) {}

I wonder if we should construct the linker name based on the default triple 
value?  "riscv64-unknown-elf-ld" or "riscv32-unknown-elf-ld" as this is likely 
what is in the user's PATH if they have installed the gnu tools.  The linker 
name could be modified in ConstructJob if the triple is different from the 
default.


https://reviews.llvm.org/D39963



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


[PATCH] D39793: [asan] Remove semicolon after do {} while (0)

2017-11-13 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D39793



___
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-13 Thread Yan Zhang via Phabricator via cfe-commits
Wizard updated this revision to Diff 122714.
Wizard marked 2 inline comments as done.
Wizard added a comment.

address nits


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 [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 [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 acronyms 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
===
--- docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
+++ docs/clang-tidy/checks/google-objc-global-variable-declaration.rst

[libcxx] r318088 - Merging r312693:

2017-11-13 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Nov 13 13:27:53 2017
New Revision: 318088

URL: http://llvm.org/viewvc/llvm-project?rev=318088&view=rev
Log:
Merging r312693:


r312693 | marshall | 2017-09-06 21:19:32 -0700 (Wed, 06 Sep 2017) | 1 line

Add even more string_view tests. These found some bugs in the default parameter 
value for rfind/find_last_of/find_last_not_of


Added:

libcxx/branches/release_50/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp

libcxx/branches/release_50/test/std/strings/basic.string/string.ops/string_compare/string_view.pass.cpp

libcxx/branches/release_50/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_view_size.pass.cpp

libcxx/branches/release_50/test/std/strings/basic.string/string.ops/string_find.first.of/string_view_size.pass.cpp

libcxx/branches/release_50/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp

libcxx/branches/release_50/test/std/strings/basic.string/string.ops/string_find.last.of/string_view_size.pass.cpp

libcxx/branches/release_50/test/std/strings/basic.string/string.ops/string_find/string_view_size.pass.cpp

libcxx/branches/release_50/test/std/strings/basic.string/string.ops/string_rfind/string_view_size.pass.cpp
Modified:
libcxx/branches/release_50/include/string

Modified: libcxx/branches/release_50/include/string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_50/include/string?rev=318088&r1=318087&r2=318088&view=diff
==
--- libcxx/branches/release_50/include/string (original)
+++ libcxx/branches/release_50/include/string Mon Nov 13 13:27:53 2017
@@ -259,7 +259,7 @@ public:
 size_type find(value_type c, size_type pos = 0) const noexcept;
 
 size_type rfind(const basic_string& str, size_type pos = npos) const 
noexcept;
-size_type ffind(basic_string_view sv, size_type pos = 0) 
const noexcept;
+size_type rfind(basic_string_view sv, size_type pos = npos) 
const noexcept;
 size_type rfind(const value_type* s, size_type pos, size_type n) const 
noexcept;
 size_type rfind(const value_type* s, size_type pos = npos) const noexcept;
 size_type rfind(value_type c, size_type pos = npos) const noexcept;
@@ -271,7 +271,7 @@ public:
 size_type find_first_of(value_type c, size_type pos = 0) const noexcept;
 
 size_type find_last_of(const basic_string& str, size_type pos = npos) 
const noexcept;
-size_type find_last_of(basic_string_view sv, size_type pos 
= 0) const noexcept;
+size_type find_last_of(basic_string_view sv, size_type pos 
= npos) const noexcept;
 size_type find_last_of(const value_type* s, size_type pos, size_type n) 
const noexcept;
 size_type find_last_of(const value_type* s, size_type pos = npos) const 
noexcept;
 size_type find_last_of(value_type c, size_type pos = npos) const noexcept;
@@ -283,7 +283,7 @@ public:
 size_type find_first_not_of(value_type c, size_type pos = 0) const 
noexcept;
 
 size_type find_last_not_of(const basic_string& str, size_type pos = npos) 
const noexcept;
-size_type find_last_not_of(basic_string_view sv, size_type 
pos = 0) const noexcept;
+size_type find_last_not_of(basic_string_view sv, size_type 
pos = npos) const noexcept;
 size_type find_last_not_of(const value_type* s, size_type pos, size_type 
n) const noexcept;
 size_type find_last_not_of(const value_type* s, size_type pos = npos) 
const noexcept;
 size_type find_last_not_of(value_type c, size_type pos = npos) const 
noexcept;
@@ -1147,7 +1147,7 @@ public:
 _LIBCPP_INLINE_VISIBILITY
 size_type rfind(const basic_string& __str, size_type __pos = npos) const 
_NOEXCEPT;
 _LIBCPP_INLINE_VISIBILITY
-size_type rfind(__self_view __sv, size_type __pos = 0) const _NOEXCEPT;
+size_type rfind(__self_view __sv, size_type __pos = npos) const _NOEXCEPT;
 size_type rfind(const value_type* __s, size_type __pos, size_type __n) 
const _NOEXCEPT;
 _LIBCPP_INLINE_VISIBILITY
 size_type rfind(const value_type* __s, size_type __pos = npos) const 
_NOEXCEPT;
@@ -1166,7 +1166,7 @@ public:
 _LIBCPP_INLINE_VISIBILITY
 size_type find_last_of(const basic_string& __str, size_type __pos = npos) 
const _NOEXCEPT;
 _LIBCPP_INLINE_VISIBILITY
-size_type find_last_of(__self_view __sv, size_type __pos = 0) const 
_NOEXCEPT;
+size_type find_last_of(__self_view __sv, size_type __pos = npos) const 
_NOEXCEPT;
 size_type find_last_of(const value_type* __s, size_type __pos, size_type 
__n) const _NOEXCEPT;
 _LIBCPP_INLINE_VISIBILITY
 size_type find_last_of(const value_type* __s, size_type __pos = npos) 
const _NOEXCEPT;
@@ -1186,7 +1186,7 @@ public:
 _LIBCPP_INLINE_VISIBILITY
 size_type find_las

[PATCH] D39829: add new check for property declaration

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



Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:89
+  assert(MatchedDecl->getName().size() > 0);
+  // Skip the check of lowerCamelCase if the name has prefix of special 
acronyms
+  if (startsWithSpecialAcronyms(MatchedDecl->getName(), SpecialAcronyms)) {

For the acronyms, this means we will allow properties with names like:

  URLfoo_bar_blech

when we do not want that to be legal.

Instead, let's generate the regular expression we pass to `matchesName()` from 
the options. I will provide a suggestion shortly.



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] D39331: Add flags to control the -finstrument-functions instrumentation calls to __cyg_profile functions

2017-11-13 Thread Hans Wennborg via Phabricator via cfe-commits
hans added inline comments.



Comment at: include/clang/Driver/Options.td:1032
+def fno_instrument_functions_inline : Flag<["-"], 
"fno-instrument-functions-inline">, Group, Flags<[CC1Option]>,
+  HelpText<"When using -finstrument-functions, insert the calls after 
inlining">;
 

rnk wrote:
> This actually describes GCC's behavior for `-finstrument-functions`. I 
> suspect the current behavior is pretty useless for most people. I'd rather 
> make the new behavior the default and add a flag to request the old behavior.
At least with the GCC I tried, they do insert the calls before inlining, and 
inline them:

```
$ echo 'static void f() {} void g() { f(); }' | gcc -x c -O3 
-finstrument-functions -S -o - - | grep -A50 g:
g:
.LFB1:
.cfi_startproc
subq$8, %rsp
.cfi_def_cfa_offset 16
movl$g, %edi
movq8(%rsp), %rsi
call__cyg_profile_func_enter
movq8(%rsp), %rsi
movl$f, %edi
call__cyg_profile_func_enter
movq8(%rsp), %rsi
movl$f, %edi
call__cyg_profile_func_exit
movq8(%rsp), %rsi
movl$g, %edi
addq$8, %rsp
.cfi_def_cfa_offset 8
jmp __cyg_profile_func_exit
.cfi_endproc
```


https://reviews.llvm.org/D39331



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


r318093 - [CodeGen] fix const-ness of cbrt and fma

2017-11-13 Thread Sanjay Patel via cfe-commits
Author: spatel
Date: Mon Nov 13 14:11:49 2017
New Revision: 318093

URL: http://llvm.org/viewvc/llvm-project?rev=318093&view=rev
Log:
[CodeGen] fix const-ness of cbrt and fma

cbrt() is always constant because it can't overflow or underflow. Therefore, it 
can't set errno.

fma() is not always constant because it can overflow or underflow. Therefore, 
it can set errno.
But we know that it never sets errno on GNU / MSVC, so make it constant in 
those environments.

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

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

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=318093&r1=318092&r2=318093&view=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Mon Nov 13 14:11:49 2017
@@ -165,9 +165,9 @@ BUILTIN(__builtin_atanl, "LdLd", "Fne")
 BUILTIN(__builtin_atanh , "dd", "Fne")
 BUILTIN(__builtin_atanhf, "ff", "Fne")
 BUILTIN(__builtin_atanhl, "LdLd", "Fne")
-BUILTIN(__builtin_cbrt , "dd", "Fne")
-BUILTIN(__builtin_cbrtf, "ff", "Fne")
-BUILTIN(__builtin_cbrtl, "LdLd", "Fne")
+BUILTIN(__builtin_cbrt , "dd", "Fnc")
+BUILTIN(__builtin_cbrtf, "ff", "Fnc")
+BUILTIN(__builtin_cbrtl, "LdLd", "Fnc")
 BUILTIN(__builtin_ceil , "dd"  , "Fnc")
 BUILTIN(__builtin_ceilf, "ff"  , "Fnc")
 BUILTIN(__builtin_ceill, "LdLd", "Fnc")
@@ -1040,9 +1040,9 @@ LIBBUILTIN(atanh, "dd", "fne", "math.h",
 LIBBUILTIN(atanhf, "ff", "fne", "math.h", ALL_LANGUAGES)
 LIBBUILTIN(atanhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
 
-LIBBUILTIN(cbrt, "dd", "fne", "math.h", ALL_LANGUAGES)
-LIBBUILTIN(cbrtf, "ff", "fne", "math.h", ALL_LANGUAGES)
-LIBBUILTIN(cbrtl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(cbrt, "dd", "fnc", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(cbrtf, "ff", "fnc", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(cbrtl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
 
 LIBBUILTIN(ceil, "dd", "fnc", "math.h", ALL_LANGUAGES)
 LIBBUILTIN(ceilf, "ff", "fnc", "math.h", ALL_LANGUAGES)

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=318093&r1=318092&r2=318093&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Nov 13 14:11:49 2017
@@ -2109,15 +2109,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(
   case Builtin::BIfmal:
   case Builtin::BI__builtin_fma:
   case Builtin::BI__builtin_fmaf:
-  case Builtin::BI__builtin_fmal: {
-// Rewrite fma to intrinsic.
-Value *FirstArg = EmitScalarExpr(E->getArg(0));
-llvm::Type *ArgType = FirstArg->getType();
-Value *F = CGM.getIntrinsic(Intrinsic::fma, ArgType);
-return RValue::get(
-Builder.CreateCall(F, {FirstArg, EmitScalarExpr(E->getArg(1)),
-   EmitScalarExpr(E->getArg(2))}));
-  }
+  case Builtin::BI__builtin_fmal:
+// A constant libcall or builtin is equivalent to the LLVM intrinsic.
+if (FD->hasAttr())
+  return RValue::get(emitTernaryBuiltin(*this, E, Intrinsic::fma));
+break;
 
   case Builtin::BI__builtin_signbit:
   case Builtin::BI__builtin_signbitf:

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=318093&r1=318092&r2=318093&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Nov 13 14:11:49 2017
@@ -12838,15 +12838,33 @@ void Sema::AddKnownFunctionAttributes(Fu
   FD->getLocation()));
 }
 
-// Mark const if we don't care about errno and that is the only
-// thing preventing the function from being const. This allows
-// IRgen to use LLVM intrinsics for such functions.
-if (!getLangOpts().MathErrno &&
-Context.BuiltinInfo.isConstWithoutErrno(BuiltinID)) {
-  if (!FD->hasAttr())
+// Mark const if we don't care about errno and that is the only thing
+// preventing the function from being const. This allows IRgen to use LLVM
+// intrinsics for such functions.
+if (!getLangOpts().MathErrno && !FD->hasAttr() &&
+Context.BuiltinInfo.isConstWithoutErrno(BuiltinID))
+  FD->addAttr(ConstAttr::CreateImplicit(Context, FD->getLocation()));
+
+// We make "fma" on GNU or Windows const because we know it does not set
+// errno in those environments even though it could set errno based on the
+// C standard.
+const llvm::Triple &Trip = Context.getTargetInf

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

2017-11-13 Thread Sanjay Patel via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318093: [CodeGen] fix const-ness of cbrt and fma (authored 
by spatel).

Changed prior to commit:
  https://reviews.llvm.org/D39641?vs=122584&id=122727#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39641

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

Index: cfe/trunk/test/CodeGen/libcalls.c
===
--- cfe/trunk/test/CodeGen/libcalls.c
+++ cfe/trunk/test/CodeGen/libcalls.c
@@ -58,22 +58,22 @@
 // CHECK-YES-LABEL: define void @test_fma
 // CHECK-NO-LABEL: define void @test_fma
 void test_fma(float a0, double a1, long double a2) {
-// CHECK-YES: call float @llvm.fma.f32
+// CHECK-YES: call float @fmaf
 // CHECK-NO: call float @llvm.fma.f32
 float l0 = fmaf(a0, a0, a0);
 
-// CHECK-YES: call double @llvm.fma.f64
+// CHECK-YES: call double @fma
 // CHECK-NO: call double @llvm.fma.f64
 double l1 = fma(a1, a1, a1);
 
-// CHECK-YES: call x86_fp80 @llvm.fma.f80
+// CHECK-YES: call x86_fp80 @fmal
 // CHECK-NO: call x86_fp80 @llvm.fma.f80
 long double l2 = fmal(a2, a2, a2);
 }
 
-// CHECK-YES: declare float @llvm.fma.f32(float, float, float) [[NUW_RN:#[0-9]+]]
-// CHECK-YES: declare double @llvm.fma.f64(double, double, double) [[NUW_RN]]
-// CHECK-YES: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[NUW_RN]]
+// CHECK-YES: declare float @fmaf(float, float, float)
+// CHECK-YES: declare double @fma(double, double, double)
+// CHECK-YES: declare x86_fp80 @fmal(x86_fp80, x86_fp80, x86_fp80)
 // CHECK-NO: declare float @llvm.fma.f32(float, float, float) [[NUW_RN2:#[0-9]+]]
 // CHECK-NO: declare double @llvm.fma.f64(double, double, double) [[NUW_RN2]]
 // CHECK-NO: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[NUW_RN2]]
@@ -123,7 +123,5 @@
 // CHECK-YES-NOT: declare float @logf(float) [[NUW_RN]]
 }
 
-// CHECK-YES: attributes [[NUW_RN]] = { nounwind readnone speculatable }
-
 // CHECK-NO-DAG: attributes [[NUW_RN]] = { nounwind readnone{{.*}} }
 // CHECK-NO-DAG: attributes [[NUW_RNI]] = { nounwind readnone speculatable }
Index: cfe/trunk/test/CodeGen/math-builtins.c
===
--- cfe/trunk/test/CodeGen/math-builtins.c
+++ cfe/trunk/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]]
 // 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]]
 
   __builtin_ceil(f);   __builtin_ceilf(f);  __builtin_ceill(f);
 
@@ -274,9 +276,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]]
-// 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]]

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

2017-11-13 Thread Hans Wennborg via cfe-commits
On Sat, Nov 11, 2017 at 4:18 AM, Roman Lebedev  wrote:
> On Fri, Nov 10, 2017 at 9:14 PM, Hans Wennborg  wrote:
>> 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
> Will the https://reviews.llvm.org/D39462 address the reasons for disabling it?

Maybe..

One of the first warnings we saw was on code like:

if (static_cast(aligned_size) >
std::numeric_limits::max()) { /* raise an error */ }

From the description of your change, it sounds like it wouldn't warn
on this anymore?
___
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-13 Thread Jake Ehrlich via Phabricator via cfe-commits
jakehehrlich closed this revision.
jakehehrlich added a comment.

This has already landed, I'm not sure why it wasn't automatically closed.


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


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

2017-11-13 Thread Roman Lebedev via cfe-commits
On Tue, Nov 14, 2017 at 1:27 AM, Hans Wennborg  wrote:
> On Sat, Nov 11, 2017 at 4:18 AM, Roman Lebedev  wrote:
>> On Fri, Nov 10, 2017 at 9:14 PM, Hans Wennborg  wrote:
>>> 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
>> Will the https://reviews.llvm.org/D39462 address the reasons for disabling 
>> it?
>
> Maybe..
>
> One of the first warnings we saw was on code like:
>
> if (static_cast(aligned_size) >
> std::numeric_limits::max()) { /* raise an error */ }

> From the description of your change, it sounds like it wouldn't warn
> on this anymore?
I believe so. You have explicitly-differently-spelled types on both of
the sides.

At least that is the idea, as the review shows,
the current proposed code needs work...
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r318098 - OpenCL: Assume inline asm is convergent

2017-11-13 Thread Matt Arsenault via cfe-commits
Author: arsenm
Date: Mon Nov 13 14:40:55 2017
New Revision: 318098

URL: http://llvm.org/viewvc/llvm-project?rev=318098&view=rev
Log:
OpenCL: Assume inline asm is convergent

Already done for CUDA.

Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/test/CodeGenOpenCL/convergent.cl

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=318098&r1=318097&r2=318098&view=diff
==
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Mon Nov 13 14:40:55 2017
@@ -2149,10 +2149,11 @@ void CodeGenFunction::EmitAsmStmt(const
   llvm::ConstantAsMetadata::get(Loc)));
   }
 
-  if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) {
-// Conservatively, mark all inline asm blocks in CUDA as convergent
-// (meaning, they may call an intrinsically convergent op, such as 
bar.sync,
-// and so can't have certain optimizations applied around them).
+  if (getLangOpts().assumeFunctionsAreConvergent()) {
+// Conservatively, mark all inline asm blocks in CUDA or OpenCL as
+// convergent (meaning, they may call an intrinsically convergent op, such
+// as bar.sync, and so can't have certain optimizations applied around
+// them).
 Result->addAttribute(llvm::AttributeList::FunctionIndex,
  llvm::Attribute::Convergent);
   }

Modified: cfe/trunk/test/CodeGenOpenCL/convergent.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/convergent.cl?rev=318098&r1=318097&r2=318098&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/convergent.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/convergent.cl Mon Nov 13 14:40:55 2017
@@ -126,6 +126,13 @@ void test_not_unroll() {
 
 // CHECK: declare spir_func void @nodupfun(){{[^#]*}} #[[attr3:[0-9]+]]
 
+// CHECK-LABEL: @assume_convergent_asm
+// CHECK: tail call void asm sideeffect "s_barrier", ""() #4
+kernel void assume_convergent_asm()
+{
+  __asm__ volatile("s_barrier");
+}
+
 // CHECK: attributes #0 = { noinline norecurse nounwind "
 // CHECK: attributes #1 = { {{[^}]*}}convergent{{[^}]*}} }
 // CHECK: attributes #2 = { {{[^}]*}}convergent{{[^}]*}} }


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


[PATCH] D39784: OpenCL: Assume inline asm is convergent

2017-11-13 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm closed this revision.
arsenm added a comment.

r318098


https://reviews.llvm.org/D39784



___
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-13 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

It wasn't automatically closed because the commit 
(https://reviews.llvm.org/rL317960) referenced the wrong differential in its 
Differential Revision field. Not sure how that happened.


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


Re: [PATCH] D39622: Fix type debug information generation for enum-based template specialization

2017-11-13 Thread David Blaikie via cfe-commits
On Sun, Nov 12, 2017 at 12:53 PM Anton via Phabricator <
revi...@reviews.llvm.org> wrote:

> xgsa added a comment.
>
> In https://reviews.llvm.org/D39622#919579, @aprantl wrote:
>
> > For clarification: what is the "symbols table" you are referring to in
> the description?
>
>
> I meant the data dumped with "nm -an ./test".
>
> By the way, I haven't abandoned the patch, I have found one more case when
> my fix doesn't work and I am working on improvement. Nevertheless, it would
> be helpful to get answers to the questions in this review (about changing
> the "Indentation" field and about the test).
>

I'm confused then - nm's output uses a demangler, the file doesn't actually
have either "Impl" or "Impl<(TagType)0>" in it.

It's probably not OK/possible to ensure the type always matches lldb's
demangled form. Other produces might have another idea of what its
demangled form looks like.


>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D39622
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-11-13 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Mon Nov 13 15:01:27 2017
New Revision: 318101

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

Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/AST/Decl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=318101&r1=318100&r2=318101&view=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Mon Nov 13 15:01:27 2017
@@ -1,4 +1,4 @@
-//===--- Decl.h - Classes for representing declarations -*- C++ 
-*-===//
+//===- Decl.h - Classes for representing declarations ---*- C++ 
-*-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -18,33 +18,58 @@
 #include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclarationName.h"
 #include "clang/AST/ExternalASTSource.h"
+#include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/Redeclarable.h"
 #include "clang/AST/Type.h"
+#include "clang/Basic/AddressSpaces.h"
+#include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/IdentifierTable.h"
+#include "clang/Basic/LLVM.h"
 #include "clang/Basic/Linkage.h"
-#include "clang/Basic/Module.h"
 #include "clang/Basic/OperatorKinds.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/PragmaKinds.h"
+#include "clang/Basic/SourceLocation.h"
+#include "clang/Basic/Specifiers.h"
+#include "clang/Basic/Visibility.h"
+#include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/Optional.h"
+#include "llvm/ADT/PointerIntPair.h"
+#include "llvm/ADT/PointerUnion.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/Compiler.h"
-#include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/TrailingObjects.h"
+#include 
+#include 
+#include 
+#include 
+#include 
 
 namespace clang {
+
+class ASTContext;
 struct ASTTemplateArgumentListInfo;
-class CXXTemporary;
+class Attr;
 class CompoundStmt;
 class DependentFunctionTemplateSpecializationInfo;
+class EnumDecl;
 class Expr;
 class FunctionTemplateDecl;
 class FunctionTemplateSpecializationInfo;
 class LabelStmt;
 class MemberSpecializationInfo;
-class NestedNameSpecifier;
+class Module;
+class NamespaceDecl;
 class ParmVarDecl;
+class RecordDecl;
 class Stmt;
 class StringLiteral;
+class TagDecl;
 class TemplateArgumentList;
+class TemplateArgumentListInfo;
 class TemplateParameterList;
 class TypeAliasTemplateDecl;
 class TypeLoc;
@@ -58,13 +83,15 @@ class VarTemplateDecl;
 /// TypeLoc TL = TypeSourceInfo->getTypeLoc();
 /// TL.getStartLoc().print(OS, SrcMgr);
 /// @endcode
-///
 class TypeSourceInfo {
-  QualType Ty;
   // Contains a memory block after the class, used for type source information,
   // allocated by ASTContext.
   friend class ASTContext;
-  TypeSourceInfo(QualType ty) : Ty(ty) { }
+
+  QualType Ty;
+
+  TypeSourceInfo(QualType ty) : Ty(ty) {}
+
 public:
   /// \brief Return the type wrapped by this type source info.
   QualType getType() const { return Ty; }
@@ -78,14 +105,16 @@ public:
 
 /// TranslationUnitDecl - The top declaration context.
 class TranslationUnitDecl : public Decl, public DeclContext {
-  virtual void anchor();
   ASTContext &Ctx;
 
   /// The (most recently entered) anonymous namespace for this
   /// translation unit, if one has been created.
-  NamespaceDecl *AnonymousNamespace;
+  NamespaceDecl *AnonymousNamespace = nullptr;
 
   explicit TranslationUnitDecl(ASTContext &ctx);
+
+  virtual void anchor();
+
 public:
   ASTContext &getASTContext() const { return Ctx; }
 
@@ -93,6 +122,7 @@ public:
   void setAnonymousNamespace(NamespaceDecl *D) { AnonymousNamespace = D; }
 
   static TranslationUnitDecl *Create(ASTContext &C);
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classofKind(Kind K) { return K == TranslationUnit; }
@@ -109,18 +139,18 @@ public:
 class PragmaCommentDecl final
 : public Decl,
   private llvm::TrailingObjects {
-  virtual void anchor();
-
-  PragmaMSCommentKind CommentKind;
-
-  friend TrailingObjects;
   friend class ASTDeclReader;
   friend class ASTDeclWriter;
+  friend TrailingObjects;
+
+  PragmaMSCommentKind CommentKind;
 
   PragmaCommentDecl(TranslationUnitDecl *TU, SourceLocation CommentLoc,
 PragmaMSCommentKind CommentKind)
   : Decl(PragmaComment, TU, CommentLoc), CommentKind(CommentKind) {}
 
+  virtual void anchor();
+
 public:
   static PragmaCommentDecl *Create(const ASTContext &C, TranslationUnitDecl 
*DC,
SourceLocation CommentLoc,
@@ -143,18 +173,18 @@ public:
 class PragmaDetectMismatchDecl final
 : public Decl,
   private llvm::TrailingObjects {

[PATCH] D39829: add new check for property declaration

2017-11-13 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 122739.
benhamilton added a comment.

- Use regex to match acronym prefixes, update tests


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,12 @@
+// 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 name 'NotCamelCase' should use lowerCamelCase style, according to the Apple Coding Guidelines [objc-property-declaration]
+// CHECK-FIXES: @property(assign, nonatomic) int notCamelCase;
+@property(assign, nonatomic) int camelCase;
+@property(strong, nonatomic) NSString *URLString;
+@property(strong, nonatomic) NSString *URL_string;
+// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: property name 'URL_string' should use lowerCamelCase style, according to the Apple Coding Guidelines [objc-property-declaration]
+@end
Index: test/clang-tidy/objc-property-declaration-custom.m
===
--- /dev/null
+++ test/clang-tidy/objc-property-declaration-custom.m
@@ -0,0 +1,14 @@
+// RUN: %check_clang_tidy %s objc-property-declaration %t \
+// RUN: -config='{CheckOptions: \
+// RUN:  [{key: objc-property-declaration.Acronyms, value: "ABC;TGIF"}]}' \
+// RUN: --
+@class NSString;
+
+@interface Foo
+@property(assign, nonatomic) int AbcNotRealPrefix;
+// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 'AbcNotRealPrefix' should use lowerCamelCase style, according to the Apple Coding Guidelines [objc-property-declaration]
+// CHECK-FIXES: @property(assign, nonatomic) int abcNotRealPrefix;
+@property(assign, nonatomic) int ABCCustomPrefix;
+@property(strong, nonatomic) NSString *ABC_custom_prefix;
+// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: property name 'ABC_custom_prefix' should use lowerCamelCase style, according to the Apple Coding Guidelines [objc-property-declaration]
+@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 acronyms 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

[PATCH] D39829: add new check for property declaration

2017-11-13 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment.

OK, I updated this diff with the suggested changes. @Wizard, want to take a 
look before I land?


https://reviews.llvm.org/D39829



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


r318109 - Update a link to the old code.google.com bug tracker

2017-11-13 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Mon Nov 13 15:27:54 2017
New Revision: 318109

URL: http://llvm.org/viewvc/llvm-project?rev=318109&view=rev
Log:
Update a link to the old code.google.com bug tracker

Modified:
cfe/trunk/lib/Driver/SanitizerArgs.cpp

Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.cpp?rev=318109&r1=318108&r2=318109&view=diff
==
--- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
+++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Mon Nov 13 15:27:54 2017
@@ -832,7 +832,7 @@ void SanitizerArgs::addArgs(const ToolCh
 
   // MSan: Workaround for PR16386.
   // ASan: This is mainly to help LSan with cases such as
-  // https://code.google.com/p/address-sanitizer/issues/detail?id=373
+  // https://github.com/google/sanitizers/issues/373
   // We can't make this conditional on -fsanitize=leak, as that flag shouldn't
   // affect compilation.
   if (Sanitizers.has(Memory) || Sanitizers.has(Address))


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


r318110 - Update link to protobuf

2017-11-13 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Mon Nov 13 15:27:55 2017
New Revision: 318110

URL: http://llvm.org/viewvc/llvm-project?rev=318110&view=rev
Log:
Update link to protobuf

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=318110&r1=318109&r2=318110&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Nov 13 15:27:55 2017
@@ -869,7 +869,7 @@ public:
   return parsePreprocessorDirective();
 
 // Directly allow to 'import ' to support protocol buffer
-// definitions (code.google.com/p/protobuf) or missing "#" (either way we
+// definitions (github.com/google/protobuf) or missing "#" (either way we
 // should not break the line).
 IdentifierInfo *Info = CurrentToken->Tok.getIdentifierInfo();
 if ((Style.Language == FormatStyle::LK_Java &&


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


r318108 - Update link to the Chromium Clang page

2017-11-13 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Mon Nov 13 15:27:53 2017
New Revision: 318108

URL: http://llvm.org/viewvc/llvm-project?rev=318108&view=rev
Log:
Update link to the Chromium Clang page

Modified:
cfe/trunk/www/related.html

Modified: cfe/trunk/www/related.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/related.html?rev=318108&r1=318107&r2=318108&view=diff
==
--- cfe/trunk/www/related.html (original)
+++ cfe/trunk/www/related.html Mon Nov 13 15:27:53 2017
@@ -12,7 +12,7 @@
   
   
 Clang Related Projects
-
+
 As Clang matures, more and more projects are being built atop the Clang
   libraries and other open source projects are starting their own Clang
   related subprojects, like building their source code with Clang or 
writing
@@ -39,8 +39,8 @@
   
 
   Site:
-  http://code.google.com/p/chromium/wiki/Clang";>
-http://code.google.com/p/chromium/wiki/Clang
+  https://chromium.googlesource.com/chromium/src/+/master/docs/clang.md";>
+
https://chromium.googlesource.com/chromium/src/+/master/docs/clang.md
 
 
   Notes on using Clang to build the Chromium web browser.


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


r318112 - Revert "Update test_debuginfo.pl script to point to new tree location."

2017-11-13 Thread Zachary Turner via cfe-commits
Author: zturner
Date: Mon Nov 13 15:33:29 2017
New Revision: 318112

URL: http://llvm.org/viewvc/llvm-project?rev=318112&view=rev
Log:
Revert "Update test_debuginfo.pl script to point to new tree location."

This reverts the aforementioned patch and 2 subsequent follow-ups,
as some buildbots are still failing 2 tests because of it.
Investigation is ongoing into the cause of the failures.

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

Modified: cfe/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=318112&r1=318111&r2=318112&view=diff
==
--- cfe/trunk/test/CMakeLists.txt (original)
+++ cfe/trunk/test/CMakeLists.txt Mon Nov 13 15:33:29 2017
@@ -88,13 +88,6 @@ 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

Modified: cfe/trunk/test/lit.cfg.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg.py?rev=318112&r1=318111&r2=318112&view=diff
==
--- cfe/trunk/test/lit.cfg.py (original)
+++ cfe/trunk/test/lit.cfg.py Mon Nov 13 15:33:29 2017
@@ -58,6 +58,8 @@ 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] D39913: [ObjC] warn about availability attributes missing from a method's declaration when they're specified for a method's definition

2017-11-13 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman updated this revision to Diff 122740.
arphaman added a comment.

- formatting
- simplify checks
- support c++


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
  lib/Sema/SemaDeclCXX.cpp
  test/SemaCXX/warn-missing-method-decl-availability.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
+__attribute__((availability(macos, introduced=10.1)))
+__attribute__((availability(ios, unavailable)))
+{ }
+
+- (void)missingDeprecatedAttr
+__attribute__((depr

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

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



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

erik.pilkington wrote:
> 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())
> ```
Nice, that's much better! Updated.


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] D39829: add new check for property declaration

2017-11-13 Thread Yan Zhang via Phabricator via cfe-commits
Wizard added a comment.

LGTM


https://reviews.llvm.org/D39829



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


[clang-tools-extra] r318117 - add new check for property declaration

2017-11-13 Thread Ben Hamilton via cfe-commits
Author: benhamilton
Date: Mon Nov 13 15:54:31 2017
New Revision: 318117

URL: http://llvm.org/viewvc/llvm-project?rev=318117&view=rev
Log:
add new check for property declaration

Summary:
This check 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 or with some particular acronyms as 
prefix.

Example:
@property(nonatomic, assign) int lowerCamelCase;

@property(nonatomic, strong) NSString *URLString;

Test plan:  ninja check-clang-tools

Reviewers: benhamilton, hokein

Reviewed By: hokein

Subscribers: cfe-commits, mgorny

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

Added:
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.h
clang-tools-extra/trunk/docs/clang-tidy/checks/objc-property-declaration.rst
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
Modified:
clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/objc/ObjCTidyModule.cpp
clang-tools-extra/trunk/docs/ReleaseNotes.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Modified: clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt?rev=318117&r1=318116&r2=318117&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt Mon Nov 13 15:54:31 
2017
@@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS support)
 add_clang_library(clangTidyObjCModule
   ForbiddenSubclassingCheck.cpp
   ObjCTidyModule.cpp
+  PropertyDeclarationCheck.cpp
 
   LINK_LIBS
   clangAST

Modified: clang-tools-extra/trunk/clang-tidy/objc/ObjCTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/ObjCTidyModule.cpp?rev=318117&r1=318116&r2=318117&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/ObjCTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/objc/ObjCTidyModule.cpp Mon Nov 13 
15:54:31 2017
@@ -11,6 +11,7 @@
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
 #include "ForbiddenSubclassingCheck.h"
+#include "PropertyDeclarationCheck.h"
 
 using namespace clang::ast_matchers;
 
@@ -23,6 +24,8 @@ public:
   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
 CheckFactories.registerCheck(
 "objc-forbidden-subclassing");
+CheckFactories.registerCheck(
+"objc-property-declaration");
   }
 };
 

Added: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=318117&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Mon 
Nov 13 15:54:31 2017
@@ -0,0 +1,115 @@
+//===--- PropertyDeclarationCheck.cpp - 
clang-tidy-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "PropertyDeclarationCheck.h"
+#include "../utils/OptionsUtils.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Regex.h"
+#include 
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace objc {
+
+namespace {
+/// The acronyms are from
+/// 
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE
+constexpr char DefaultSpecialAcronyms[] =
+"ASCII;"
+"PDF;"
+"XML;"
+"HTML;"
+"URL;"
+"RTF;"
+"HTTP;"
+"TIFF;"
+"JPG;"
+"PNG;"
+"GIF;"
+"LZW;"
+"ROM;"
+"RGB;"
+"CMYK;"
+"MIDI;"
+"FTP";
+
+/// For now we will only fix 'CamelCase' property to
+/// 'camelCase'. For other cases the users need to
+/// come up with a proper name by their own.
+/// FIXME: provide fix for snake_case to snakeCase
+FixItHint generateFixItHint(const ObjCPropertyDecl *Decl) {
+  if (isupper(Decl->getName()[0])) {
+auto NewName = Decl->getName().str

[PATCH] D39829: add new check for property declaration

2017-11-13 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318117: add new check for property declaration (authored by 
benhamilton).

Repository:
  rL LLVM

https://reviews.llvm.org/D39829

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

Index: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.h
===
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.h
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.h
@@ -0,0 +1,44 @@
+//===--- PropertyDeclarationCheck.h - clang-tidy-*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_PROPERTY_DECLARATION_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_PROPERTY_DECLARATION_H
+
+#include "../ClangTidy.h"
+#include 
+#include 
+
+namespace clang {
+namespace tidy {
+namespace objc {
+
+/// Finds Objective-C property declarations which
+/// are not in Lower Camel Case.
+///
+/// The format of property should look like:
+/// @property(nonatomic) NSString *lowerCamelCase;
+///
+/// For the user-facing documentation see:
+/// http://clang.llvm.org/extra/clang-tidy/checks/objc-property-declaration.html
+class PropertyDeclarationCheck : public ClangTidyCheck {
+public:
+  PropertyDeclarationCheck(StringRef Name, ClangTidyContext *Context);
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+  void storeOptions(ClangTidyOptions::OptionMap &Options) override;
+
+private:
+const std::vector SpecialAcronyms;
+};
+
+} // namespace objc
+} // namespace tidy
+} // namespace clang
+
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_PROPERTY_DECLARATION_H
Index: clang-tools-extra/trunk/clang-tidy/objc/ObjCTidyModule.cpp
===
--- clang-tools-extra/trunk/clang-tidy/objc/ObjCTidyModule.cpp
+++ clang-tools-extra/trunk/clang-tidy/objc/ObjCTidyModule.cpp
@@ -11,6 +11,7 @@
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
 #include "ForbiddenSubclassingCheck.h"
+#include "PropertyDeclarationCheck.h"
 
 using namespace clang::ast_matchers;
 
@@ -23,6 +24,8 @@
   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
 CheckFactories.registerCheck(
 "objc-forbidden-subclassing");
+CheckFactories.registerCheck(
+"objc-property-declaration");
   }
 };
 
Index: clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt
===
--- clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt
+++ clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt
@@ -3,6 +3,7 @@
 add_clang_library(clangTidyObjCModule
   ForbiddenSubclassingCheck.cpp
   ObjCTidyModule.cpp
+  PropertyDeclarationCheck.cpp
 
   LINK_LIBS
   clangAST
Index: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
@@ -0,0 +1,115 @@
+//===--- PropertyDeclarationCheck.cpp - clang-tidy-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "PropertyDeclarationCheck.h"
+#include "../utils/OptionsUtils.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Regex.h"
+#include 
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace objc {
+
+namespace {
+/// The acronyms are from
+/// https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.ht

[libcxx] r318119 - Implement LWG2952: iterator_traits should work for pointers to cv T

2017-11-13 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Nov 13 16:03:10 2017
New Revision: 318119

URL: http://llvm.org/viewvc/llvm-project?rev=318119&view=rev
Log:
Implement LWG2952: iterator_traits should work for pointers to cv T


Added:

libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/volatile_pointer.pass.cpp
Modified:
libcxx/trunk/include/iterator
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/include/iterator
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=318119&r1=318118&r2=318119&view=diff
==
--- libcxx/trunk/include/iterator (original)
+++ libcxx/trunk/include/iterator Mon Nov 13 16:03:10 2017
@@ -37,16 +37,6 @@ struct iterator_traits
 typedef random_access_iterator_tag iterator_category;
 };
 
-template
-struct iterator_traits
-{
-typedef ptrdiff_t difference_type;
-typedef T value_type;
-typedef const T* pointer;
-typedef const T& reference;
-typedef random_access_iterator_tag iterator_category;
-};
-
 template
 struct iterator
@@ -494,7 +484,7 @@ template
 struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*>
 {
 typedef ptrdiff_t difference_type;
-typedef typename remove_const<_Tp>::type value_type;
+typedef typename remove_cv<_Tp>::type value_type;
 typedef _Tp* pointer;
 typedef _Tp& reference;
 typedef random_access_iterator_tag iterator_category;

Added: 
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/volatile_pointer.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/volatile_pointer.pass.cpp?rev=318119&view=auto
==
--- 
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/volatile_pointer.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/volatile_pointer.pass.cpp
 Mon Nov 13 16:03:10 2017
@@ -0,0 +1,28 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template
+// struct iterator_traits
+
+#include 
+#include 
+
+struct A {};
+
+int main()
+{
+typedef std::iterator_traits It;
+static_assert((std::is_same::value), 
"");
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+}

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=318119&r1=318118&r2=318119&view=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Mon Nov 13 16:03:10 2017
@@ -108,7 +108,7 @@
https://wg21.link/LWG2945";>2945Order of 
template parameters in optional 
comparisonsAlbuquerqueComplete
https://wg21.link/LWG2948";>2948unique_ptr 
does not define operator<< for stream 
outputAlbuquerque
https://wg21.link/LWG2950";>2950std::byte 
operations are misspecifiedAlbuquerque
-   https://wg21.link/LWG2952";>2952iterator_traits should work 
for pointers to cv TAlbuquerque
+   https://wg21.link/LWG2952";>2952iterator_traits should work 
for pointers to cv TAlbuquerqueComplete
https://wg21.link/LWG2953";>2953LWG 2853 
should apply to deque::erase tooAlbuquerque
https://wg21.link/LWG2958";>2958Moves 
improperly defined as deletedAlbuquerque
https://wg21.link/LWG2964";>2964Apparently 
redundant requirement for 
dynamic_pointer_castAlbuquerque


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


r318121 - [Sema] Stable sort OverloadCandidates to remove non-deterministic ordering

2017-11-13 Thread Mandeep Singh Grang via cfe-commits
Author: mgrang
Date: Mon Nov 13 16:22:24 2017
New Revision: 318121

URL: http://llvm.org/viewvc/llvm-project?rev=318121&view=rev
Log:
[Sema] Stable sort OverloadCandidates to remove non-deterministic ordering

Summary: This fixes failure in Misc/diag-template-diffing.cpp uncovered by 
D39245.

Reviewers: rjmccall, rsmith

Reviewed By: rjmccall

Subscribers: cfe-commits

Tags: #clang

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

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

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=318121&r1=318120&r2=318121&view=diff
==
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Nov 13 16:22:24 2017
@@ -10516,7 +10516,7 @@ void OverloadCandidateSet::NoteCandidate
 }
   }
 
-  std::sort(Cands.begin(), Cands.end(),
+  std::stable_sort(Cands.begin(), Cands.end(),
 CompareOverloadCandidatesForDisplay(S, OpLoc, Args.size(), Kind));
 
   bool ReportedAmbiguousConversions = false;


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


[PATCH] D39944: [Sema] Stable sort OverloadCandidates to remove non-deterministic ordering

2017-11-13 Thread Mandeep Singh Grang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318121: [Sema] Stable sort OverloadCandidates to remove 
non-deterministic ordering (authored by mgrang).

Changed prior to commit:
  https://reviews.llvm.org/D39944?vs=122598&id=122744#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39944

Files:
  cfe/trunk/lib/Sema/SemaOverload.cpp


Index: cfe/trunk/lib/Sema/SemaOverload.cpp
===
--- cfe/trunk/lib/Sema/SemaOverload.cpp
+++ cfe/trunk/lib/Sema/SemaOverload.cpp
@@ -10516,7 +10516,7 @@
 }
   }
 
-  std::sort(Cands.begin(), Cands.end(),
+  std::stable_sort(Cands.begin(), Cands.end(),
 CompareOverloadCandidatesForDisplay(S, OpLoc, Args.size(), Kind));
 
   bool ReportedAmbiguousConversions = false;


Index: cfe/trunk/lib/Sema/SemaOverload.cpp
===
--- cfe/trunk/lib/Sema/SemaOverload.cpp
+++ cfe/trunk/lib/Sema/SemaOverload.cpp
@@ -10516,7 +10516,7 @@
 }
   }
 
-  std::sort(Cands.begin(), Cands.end(),
+  std::stable_sort(Cands.begin(), Cands.end(),
 CompareOverloadCandidatesForDisplay(S, OpLoc, Args.size(), Kind));
 
   bool ReportedAmbiguousConversions = false;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39963: [RISCV][RFC] Add initial RISC-V target and driver support

2017-11-13 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang added inline comments.



Comment at: lib/Driver/ToolChains/RISCV.cpp:86
+CmdArgs.push_back("-lc");
+CmdArgs.push_back("-lgloss");
+CmdArgs.push_back("--end-group");

How about if our sysroot is linux (as opposed to elf)? There won't be any 
libgloss.a, right? Also there won't be a crt0.o (instead there will be crt1.o).



Comment at: lib/Driver/ToolChains/RISCV.h:42
+  : GnuTool("RISCV::Linker",
+TC.getTriple().isArch64Bit() ? "riscv64-ld" : "riscv32-ld",
+TC) {}

johnrusso wrote:
> I wonder if we should construct the linker name based on the default triple 
> value?  "riscv64-unknown-elf-ld" or "riscv32-unknown-elf-ld" as this is 
> likely what is in the user's PATH if they have installed the gnu tools.  The 
> linker name could be modified in ConstructJob if the triple is different from 
> the default.
I agree with @johnrusso . I always have errors: "riscv32-ld not found" and as a 
workaround I end up creating symlink pointing to the actual -ld.


https://reviews.llvm.org/D39963



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


[PATCH] D39963: [RISCV][RFC] Add initial RISC-V target and driver support

2017-11-13 Thread Ana Pazos via Phabricator via cfe-commits
apazos added inline comments.



Comment at: lib/Driver/ToolChains/RISCV.cpp:86
+CmdArgs.push_back("-lc");
+CmdArgs.push_back("-lgloss");
+CmdArgs.push_back("--end-group");

mgrang wrote:
> How about if our sysroot is linux (as opposed to elf)? There won't be any 
> libgloss.a, right? Also there won't be a crt0.o (instead there will be 
> crt1.o).
Supporting linux target is desirable early on because most of us will be using 
Qemu for running tests.


https://reviews.llvm.org/D39963



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


Buildbot numbers for the week of 10/22/2017 - 10/28/2017

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

Below are some buildbot numbers for the week of 10/22/2017 - 10/28/2017.

Please see the same data in attached csv files:

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

Thanks

Galina


The longest time each builder was red during the week:

buildername | was_red
+-
 lldb-x86_64-darwin-13.4| 57:06:25
 clang-bpf-build| 41:30:07
 reverse-iteration  | 34:30:37
 sanitizer-x86_64-linux | 31:48:17
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc-tot-cxx1z | 28:29:51
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions  | 21:41:43
 ubuntu-gcc7.1-werror   | 21:30:43
 lldb-x86_64-ubuntu-14.04-cmake | 16:49:30
 llvm-clang-x86_64-expensive-checks-win | 14:20:08
 clang-cmake-aarch64-quick  | 13:02:25
 lld-x86_64-win7| 12:40:35
 sanitizer-x86_64-linux-fast| 12:17:19
 llvm-clang-lld-x86_64-debian-fast  | 08:06:40
 aosp-O3-polly-before-vectorizer-unprofitable   | 06:24:22
 clang-x86_64-linux-selfhost-modules-2  | 06:13:09
 clang-x86_64-linux-selfhost-modules| 05:59:40
 clang-lld-x86_64-2stage| 05:38:46
 sanitizer-x86_64-linux-bootstrap-msan  | 05:31:44
 clang-with-lto-ubuntu  | 05:05:14
 clang-cmake-aarch64-full   | 04:46:23
 clang-ppc64be-linux-multistage | 04:23:41
 clang-cmake-armv7-a15-selfhost-neon| 04:18:29
 clang-with-thin-lto-ubuntu | 04:03:58
 llvm-mips-linux| 03:52:04
 clang-ppc64be-linux-lnt| 03:41:32
 clang-ppc64be-linux| 03:39:44
 clang-x64-ninja-win7   | 03:35:48
 clang-x86_64-linux-abi-test| 03:35:33
 sanitizer-ppc64be-linux| 03:34:38
 clang-with-thin-lto-windows| 03:02:41
 clang-ppc64le-linux| 03:00:57
 clang-cmake-x86_64-avx2-linux  | 02:59:49
 clang-cmake-x86_64-sde-avx512-linux| 02:58:28
 clang-x86-windows-msvc2015 | 02:55:17
 lldb-x86_64-ubuntu-14.04-android   | 02:44:33
 clang-ppc64le-linux-multistage | 02:38:59
 clang-ppc64le-linux-lnt| 02:38:35
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 02:38:26
 clang-s390x-linux-lnt  | 02:37:01
 clang-s390x-linux  | 02:35:07
 clang-cmake-aarch64-global-isel| 02:33:22
 clang-cmake-thumbv7-a15| 02:32:09
 lldb-windows7-android  | 02:15:37
 clang-cuda-build   | 02:09:15
 clang-atom-d525-fedora-rel | 02:08:49
 clang-s390x-linux-multistage   | 02:06:21
 libcxx-libcxxabi-libunwind-x86_64-linux-debian | 01:59:39
 sanitizer-x86_64-linux-bootstrap-ubsan | 01:41:16
 lldb-x86-windows-msvc2015  | 01:40:55
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 01:39:13
 sanitizer-x86_64-linux-bootstrap   | 01:37:27
 clang-cmake-x86_64-avx2-linux-perf | 01:30:57
 lld-x86_64-freebsd | 01:19:21
 sanitizer-x86_64-linux-fuzzer  | 01:17:25
 lld-x86_64-darwin13| 01:08:12
 sanitizer-x86_64-linux-android | 01:02:16
 lldb-amd64-ninja-netbsd8   | 00:58:21
 clang-x86_64-debian-fast   | 00:51:37
 clang-cmake-armv7-a15-full | 00:50:39
 llvm-hexagon-elf   | 00:48:42
 clang-cmake-armv7-a15  | 00:43:02
 clang-hexagon-elf  | 00:42:46
 lldb-x86_64-ubuntu-14.04-buildserver   | 00:40:54
 sanitizer-x86_64-linux-autoconf| 00:36:48
 polly-arm-linux| 00:32:57
 polly-amd64-linux  | 00:26:50
 sanitizer-windows  | 00:11:34
 lldb-amd64-ninja-freebs

Buildbot numbers for the last week of 11/5/2017 - 11/11/2017

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

Below are some buildbot numbers for the last week of 11/5/2017 - 11/11/2017.

Please see the same data in attached csv files:

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

Thanks

Galina


The longest time each builder was red during the week:

  buildername  |  was_red
---+--
 clang-ppc64le-linux   | 105:44:38
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc-tot-cxx1z| 70:10:09
 clang-cmake-thumbv7-a15-full-sh   | 52:37:11
 clang-cmake-armv7-a15-selfhost| 50:02:47
 clang-cmake-x86_64-sde-avx512-linux   | 49:10:11
 clang-cmake-x86_64-avx2-linux-perf| 48:34:50
 clang-cmake-x86_64-avx2-linux | 48:34:19
 clang-x86-windows-msvc2015| 46:49:23
 llvm-mips-linux   | 46:43:58
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast  | 46:24:03
 clang-cmake-aarch64-full  | 46:20:52
 clang-cmake-armv7-a15-full| 45:23:59
 clang-x64-ninja-win7  | 45:20:58
 clang-cmake-aarch64-global-isel   | 44:00:13
 clang-cmake-aarch64-quick | 42:51:07
 clang-cmake-armv7-a15-selfhost-neon   | 41:20:46
 clang-cmake-thumbv7-a15   | 40:45:23
 clang-cmake-armv7-a15 | 40:22:08
 polly-amd64-linux | 30:29:53
 polly-arm-linux   | 30:18:22
 aosp-O3-polly-before-vectorizer-unprofitable  | 24:07:02
 clang-atom-d525-fedora-rel| 10:47:23
 clang-x86_64-linux-abi-test   | 10:36:23
 ubuntu-gcc7.1-werror  | 10:20:34
 clang-s390x-linux-multistage  | 09:58:03
 libcxx-libcxxabi-libunwind-aarch64-linux-noexceptions | 09:43:35
 clang-x86_64-linux-selfhost-modules-2 | 08:45:51
 clang-x86_64-linux-selfhost-modules   | 08:36:15
 clang-s390x-linux-lnt | 07:37:46
 clang-with-thin-lto-ubuntu| 07:01:54
 clang-lld-x86_64-2stage   | 06:53:14
 sanitizer-x86_64-linux| 06:11:38
 clang-with-lto-ubuntu | 06:11:03
 lld-x86_64-darwin13   | 05:57:04
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions | 05:50:31
 clang-cmake-aarch64-lld   | 05:43:42
 sanitizer-ppc64be-linux   | 05:39:57
 clang-s390x-linux | 05:38:52
 clang-ppc64le-linux-multistage| 05:38:18
 lldb-windows7-android | 05:36:08
 libcxx-libcxxabi-libunwind-x86_64-linux-debian| 05:33:10
 clang-x86_64-debian-fast  | 04:58:16
 clang-ppc64be-linux-lnt   | 04:57:46
 llvm-clang-lld-x86_64-debian-fast | 04:33:10
 lldb-x86_64-ubuntu-14.04-android  | 04:19:54
 clang-ppc64le-linux-lnt   | 04:19:07
 llvm-clang-x86_64-expensive-checks-win| 04:17:34
 clang-with-thin-lto-windows   | 04:05:12
 sanitizer-x86_64-linux-fuzzer | 04:03:04
 sanitizer-x86_64-linux-bootstrap-msan | 03:32:52
 clang-ppc64be-linux   | 03:19:18
 clang-cuda-build  | 03:14:22
 clang-native-arm-lnt  | 03:04:31
 llvm-hexagon-elf  | 03:01:38
 clang-hexagon-elf | 03:00:48
 clang-ppc64be-linux-multistage| 02:55:48
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast| 02:53:52
 sanitizer-x86_64-linux-android| 02:51:35
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan | 02:48:16
 perf-x86_64-penryn-O3-polly-parallel-fast | 02:46:43
 sanitizer-x86_64-linux-bootstrap-ubsan| 02:46:36
 libcxx-libcxxabi-libunwind-x86_64-linux-ubuntu| 02:44:48
 libcxx-libcxxabi-libunwind-arm-linux  | 02:43:10
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11| 02:40:29
 sanitiz

Buildbot numbers for the week of 10/29/2017 - 11/4/2017

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

Below are some buildbot numbers for the week of 10/29/2017 - 11/4/2017.

Please see the same data in attached csv files:

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

Thanks

Galina


The longest time each builder was red during the week:

   buildername|  was_red
--+--
 lldb-windows7-android| 129:25:17
 perf-x86_64-penryn-O3-polly-parallel-fast| 83:15:00
 perf-x86_64-penryn-O3-polly-unprofitable | 43:41:03
 ubuntu-gcc7.1-werror | 37:47:55
 llvm-clang-x86_64-expensive-checks-win   | 31:43:18
 clang-s390x-linux-lnt| 26:03:09
 clang-with-lto-ubuntu| 25:40:23
 clang-with-thin-lto-ubuntu   | 25:25:28
 clang-s390x-linux-multistage | 22:49:01
 lldb-amd64-ninja-freebsd11   | 22:34:41
 clang-with-thin-lto-windows  | 20:30:26
 clang-s390x-linux| 20:28:29
 clang-lld-x86_64-2stage  | 20:17:14
 clang-ppc64be-linux  | 13:32:17
 clang-x86_64-debian-fast | 11:45:03
 clang-ppc64be-linux-multistage   | 11:41:30
 llvm-clang-lld-x86_64-debian-fast| 11:10:37
 sanitizer-x86_64-linux-bootstrap-ubsan   | 10:36:14
 clang-ppc64be-linux-lnt  | 10:36:08
 clang-cmake-x86_64-sde-avx512-linux  | 10:29:43
 clang-bpf-build  | 10:18:17
 clang-atom-d525-fedora-rel   | 09:54:59
 clang-cmake-x86_64-avx2-linux| 09:50:40
 sanitizer-ppc64be-linux  | 09:30:49
 sanitizer-x86_64-linux   | 09:27:43
 sanitizer-x86_64-linux-autoconf  | 07:09:04
 clang-cmake-armv7-a15-selfhost   | 06:11:00
 clang-cuda-build | 05:45:08
 clang-cmake-armv7-a15-selfhost-neon  | 05:45:07
 clang-ppc64le-linux-multistage   | 05:40:25
 clang-cmake-aarch64-lld  | 05:09:32
 clang-x86_64-linux-abi-test  | 04:53:30
 clang-cmake-thumbv7-a15-full-sh  | 04:28:07
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 03:51:32
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast   | 03:35:17
 clang-x86-windows-msvc2015   | 03:01:05
 sanitizer-x86_64-linux-bootstrap | 02:48:18
 clang-x86_64-linux-selfhost-modules-2| 02:41:17
 clang-x64-ninja-win7 | 02:40:52
 reverse-iteration| 02:36:13
 sanitizer-x86_64-linux-bootstrap-msan| 02:06:53
 clang-cmake-aarch64-full | 02:05:27
 sanitizer-x86_64-linux-fast  | 02:02:26
 clang-ppc64le-linux-lnt  | 01:55:53
 lld-x86_64-freebsd   | 01:54:04
 lld-x86_64-darwin13  | 01:50:57
 clang-ppc64le-linux  | 01:50:37
 clang-x86_64-linux-selfhost-modules  | 01:39:22
 clang-hexagon-elf| 01:14:13
 sanitizer-windows| 01:12:31
 lldb-x86_64-ubuntu-14.04-buildserver | 01:07:52
 lldb-x86_64-darwin-13.4  | 01:07:49
 lldb-amd64-ninja-netbsd8 | 01:02:29
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03   | 00:56:40
 clang-cmake-x86_64-avx2-linux-perf   | 00:54:05
 lldb-x86_64-ubuntu-14.04-cmake   | 00:53:04
 clang-cmake-armv7-a15-full   | 00:50:38
 llvm-hexagon-elf | 00:49:44
 clang-cmake-aarch64-global-isel  | 00:49:27
 clang-cmake-aarch64-quick| 00:44:16
 clang-cmake-thumbv7-a15  | 00:40:52
 clang-cmake-armv7-a15| 00:40:17
 sanitizer-x86_64-linux-android   | 00:38:29
 sanitizer-x86_64-linux-fuzzer| 00:35:35
 lldb-x86-windows-msvc2015| 00:32:47
 clang-sphinx-docs| 00:10:50
 clang-tools-sphinx-docs  | 00:10:42
(67 rows)


"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green):

   

[PATCH] D39947: [OpenMP] Stable sort Privates to remove non-deterministic ordering

2017-11-13 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang updated this revision to Diff 122751.
mgrang added a comment.

Fixed the sorting order for stable_sort.


Repository:
  rL LLVM

https://reviews.llvm.org/D39947

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp


Index: lib/CodeGen/CGOpenMPRuntime.cpp
===
--- lib/CodeGen/CGOpenMPRuntime.cpp
+++ lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4048,9 +4048,9 @@
   return TaskPrivatesMap;
 }
 
-static int array_pod_sort_comparator(const PrivateDataTy *P1,
- const PrivateDataTy *P2) {
-  return P1->first < P2->first ? 1 : (P2->first < P1->first ? -1 : 0);
+static bool stable_sort_comparator(const PrivateDataTy P1,
+   const PrivateDataTy P2) {
+  return P1.first > P2.first;
 }
 
 /// Emit initialization for private variables in task-based directives.
@@ -4278,8 +4278,7 @@
  /*PrivateElemInit=*/nullptr)));
 ++I;
   }
-  llvm::array_pod_sort(Privates.begin(), Privates.end(),
-   array_pod_sort_comparator);
+  std::stable_sort(Privates.begin(), Privates.end(), stable_sort_comparator);
   auto KmpInt32Ty = C.getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/1);
   // Build type kmp_routine_entry_t (if not built yet).
   emitKmpRoutineEntryT(KmpInt32Ty);


Index: lib/CodeGen/CGOpenMPRuntime.cpp
===
--- lib/CodeGen/CGOpenMPRuntime.cpp
+++ lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4048,9 +4048,9 @@
   return TaskPrivatesMap;
 }
 
-static int array_pod_sort_comparator(const PrivateDataTy *P1,
- const PrivateDataTy *P2) {
-  return P1->first < P2->first ? 1 : (P2->first < P1->first ? -1 : 0);
+static bool stable_sort_comparator(const PrivateDataTy P1,
+   const PrivateDataTy P2) {
+  return P1.first > P2.first;
 }
 
 /// Emit initialization for private variables in task-based directives.
@@ -4278,8 +4278,7 @@
  /*PrivateElemInit=*/nullptr)));
 ++I;
   }
-  llvm::array_pod_sort(Privates.begin(), Privates.end(),
-   array_pod_sort_comparator);
+  std::stable_sort(Privates.begin(), Privates.end(), stable_sort_comparator);
   auto KmpInt32Ty = C.getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/1);
   // Build type kmp_routine_entry_t (if not built yet).
   emitKmpRoutineEntryT(KmpInt32Ty);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39947: [OpenMP] Stable sort Privates to remove non-deterministic ordering

2017-11-13 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang added a comment.

In https://reviews.llvm.org/D39947#922987, @rjmccall wrote:

> In https://reviews.llvm.org/D39947#922922, @mgrang wrote:
>
> > In https://reviews.llvm.org/D39947#922889, @rjmccall wrote:
> >
> > > In https://reviews.llvm.org/D39947#922870, @mgrang wrote:
> > >
> > > > Although this patches fixes the above unit test failures, the generated 
> > > > code is very different from the one that the tests expect. As a result, 
> > > > these tests need to be adjusted. Could the reviewers please 
> > > > comment/suggest on whether it is ok to fix the tests as a result of 
> > > > this change?
> > > >
> > > > The other way of obtaining deterministic ordering for privates with the 
> > > > same alignment is to use an index for each item inserted into Privates 
> > > > and use it as a tie-breaker. But even in that case the generated code 
> > > > is quite different and tests still need to be adjusted.
> > >
> > >
> > > Fixing the tests may be acceptable.  Can you give an example of the 
> > > difference between the old and new test outputs?
> >
> >
> > Please see https://www.diffchecker.com/7V2XFbk4 for the difference in 
> > output for the following test before and after my change:
> >
> >   clang -cc1 -internal-isystem /build/llvm/lib/clang/6.0.0/include 
> > -nostdsysteminc -verify -fopenmp -x c++ -triple x86_64-apple-darwin10 
> > -emit-llvm 
> > /src/llvm/tools/clang/test/OpenMP/task_firstprivate_codegen.cpp -o -
> >
>
>
> Does your diff have shuffling enabled on both sides?  Neither layout for 
> %struct..kmp_privates.t.3 seems to match the test's match for 
> PRIVATES_TMAIN_TY, so I'm not completely sure which is supposed to be which.  
> Assuming that the right diff is with your patch, something seems quite wrong, 
> because the capture for t_var is being sorted to the end, which is producing 
> a really terrible layout.
>
> I think you might actually have accidentally inverted the order: a qsort 
> comparator is supposed to return positive if ``LHS > RHS``, so the fact that 
> it's returning 1 when ``P1->first < P2->first`` means that it's actually a 
> reversed comparison.  Would you mind fixing that and then letting us know 
> what test changes remain?
>
> Cou


You are correct Cou. My sorting order was indeed reversed. After fixing the 
order (with stable_sort) I see that all of the above failing tests pass and 
generate the desired output. Apologies for the false alarm.


Repository:
  rL LLVM

https://reviews.llvm.org/D39947



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


[PATCH] D39673: Toolchain: Normalize dwarf, sjlj and seh eh

2017-11-13 Thread Martell Malone via Phabricator via cfe-commits
martell added a comment.

Ping :)


Repository:
  rL LLVM

https://reviews.llvm.org/D39673



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


[libcxx] r318125 - Implement LWG2950: std::byte operations are misspecified

2017-11-13 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Nov 13 17:14:53 2017
New Revision: 318125

URL: http://llvm.org/viewvc/llvm-project?rev=318125&view=rev
Log:
Implement LWG2950: std::byte operations are misspecified

Modified:
libcxx/trunk/include/cstddef
libcxx/trunk/include/type_traits
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/include/cstddef
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstddef?rev=318125&r1=318124&r2=318125&view=diff
==
--- libcxx/trunk/include/cstddef (original)
+++ libcxx/trunk/include/cstddef Mon Nov 13 17:14:53 2017
@@ -64,23 +64,46 @@ namespace std  // purposefully not versi
 {
 enum class byte : unsigned char {};
 
-constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
-{ return __lhs = byte(static_cast(__lhs) | static_cast(__rhs)); }
 constexpr byte  operator| (byte  __lhs, byte __rhs) noexcept
-{ return byte(static_cast(__lhs) | static_cast(__rhs)); }
+{
+   return static_cast(
+ static_cast(
+static_cast(__lhs) | static_cast(__rhs)
+   ));
+}
+
+constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
+{ return __lhs = __lhs | __rhs; }
 
-constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
-{ return __lhs = byte(static_cast(__lhs) & static_cast(__rhs)); }
 constexpr byte  operator& (byte  __lhs, byte __rhs) noexcept
-{ return byte(static_cast(__lhs) & static_cast(__rhs)); }
+{
+   return static_cast(
+ static_cast(
+static_cast(__lhs) & static_cast(__rhs)
+   ));
+}
+
+constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
+{ return __lhs = __lhs & __rhs; }
 
-constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept 
-{ return __lhs = byte(static_cast(__lhs) ^ static_cast(__rhs)); }
 constexpr byte  operator^ (byte  __lhs, byte __rhs) noexcept
-{ return byte(static_cast(__lhs) ^ static_cast(__rhs)); }
+{
+   return static_cast(
+ static_cast(
+static_cast(__lhs) ^ static_cast(__rhs)
+   ));
+}
+
+constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept 
+{ return __lhs = __lhs ^ __rhs; }
 
 constexpr byte  operator~ (byte __b) noexcept
-{ return  byte(~static_cast(__b)); }
+{
+return static_cast(
+  static_cast(
+~static_cast(__b)
+));
+}
 
 }
 

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=318125&r1=318124&r2=318125&view=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Mon Nov 13 17:14:53 2017
@@ -4761,26 +4761,26 @@ namespace std  // purposefully not versi
 template 
   constexpr typename enable_if, byte>::type &
   operator<<=(byte& __lhs, _Integer __shift) noexcept
-  { return __lhs = byte(static_cast(__lhs) << __shift); }
+  { return __lhs = __lhs << __shift; }
   
 template 
   constexpr typename enable_if, byte>::type
   operator<< (byte  __lhs, _Integer __shift) noexcept
-  { return byte(static_cast(__lhs) << __shift); }
+  { return static_cast(static_cast(static_cast(__lhs) << __shift)); }
 
 template 
   constexpr typename enable_if, byte>::type &
   operator>>=(byte& __lhs, _Integer __shift) noexcept
-  { return __lhs = byte(static_cast(__lhs) >> __shift); }
+  { return __lhs = __lhs >> __shift; }
 
 template 
   constexpr typename enable_if, byte>::type
   operator>> (byte  __lhs, _Integer __shift) noexcept
-  { return byte(static_cast(__lhs) >> __shift); }
+  { return static_cast(static_cast(static_cast(__lhs) >> __shift)); }
   
 template 
   constexpr typename enable_if, _Integer>::type
-  to_integer(byte __b) noexcept { return _Integer(__b); }
+  to_integer(byte __b) noexcept { return static_cast<_Integer>(__b); }
 
 }
 #endif

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=318125&r1=318124&r2=318125&view=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Mon Nov 13 17:14:53 2017
@@ -107,7 +107,7 @@
https://wg21.link/LWG2944";>2944LWG 2905 
accidentally removed requirement that construction of the deleter doesn't throw 
an exceptionAlbuquerqueNothing to do
https://wg21.link/LWG2945";>2945Order of 
template parameters in optional 
comparisonsAlbuquerqueComplete
https://wg21.link/LWG2948";>2948unique_ptr 
does not define operator<< for stream 
outputAlbuquerque
-   https://wg21.link/LWG2950";>2950std::byte 
operations are misspecifiedAlbuquerque
+   https://wg21.link/LWG2950";>2950std::byte 
operations are misspecifiedAlbuquerqueComplete
https://wg21.link/LWG2952";>2952iterator_traits should work 
for pointers to cv TAlbuquerqueComplete
https://wg21.link

[libcxx] r318126 - Another test for LWG2952

2017-11-13 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Nov 13 17:18:36 2017
New Revision: 318126

URL: http://llvm.org/viewvc/llvm-project?rev=318126&view=rev
Log:
Another test for LWG2952

Added:

libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/const_volatile_pointer.pass.cpp

Added: 
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/const_volatile_pointer.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/const_volatile_pointer.pass.cpp?rev=318126&view=auto
==
--- 
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/const_volatile_pointer.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/const_volatile_pointer.pass.cpp
 Mon Nov 13 17:18:36 2017
@@ -0,0 +1,28 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template
+// struct iterator_traits
+
+#include 
+#include 
+
+struct A {};
+
+int main()
+{
+typedef std::iterator_traits It;
+static_assert((std::is_same::value), 
"");
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+}


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


r318128 - [PM] Port BoundsChecking to the new PM.

2017-11-13 Thread Chandler Carruth via cfe-commits
Author: chandlerc
Date: Mon Nov 13 17:30:04 2017
New Revision: 318128

URL: http://llvm.org/viewvc/llvm-project?rev=318128&view=rev
Log:
[PM] Port BoundsChecking to the new PM.

Registers it and everything, updates all the references, etc.

Next patch will add support to Clang's `-fexperimental-new-pass-manager`
path to actually enable BoundsChecking correctly.

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

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=318128&r1=318127&r2=318128&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Mon Nov 13 17:30:04 2017
@@ -168,7 +168,7 @@ static void addAddDiscriminatorsPass(con
 
 static void addBoundsCheckingPass(const PassManagerBuilder &Builder,
   legacy::PassManagerBase &PM) {
-  PM.add(createBoundsCheckingPass());
+  PM.add(createBoundsCheckingLegacyPass());
 }
 
 static void addSanitizerCoveragePass(const PassManagerBuilder &Builder,


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


  1   2   >