r269742 - [AVX512] Add parentheses around macro arguments in AVX512PF intrinsics. Remove leading underscores from macro argument names. Add explicit typecasts to all macro arguments and return values.

2016-05-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon May 16 23:41:40 2016
New Revision: 269742

URL: http://llvm.org/viewvc/llvm-project?rev=269742=rev
Log:
[AVX512] Add parentheses around macro arguments in AVX512PF intrinsics. Remove 
leading underscores from macro argument names. Add explicit typecasts to all 
macro arguments and return values. And finally reformat after all the 
adjustments.

This is a mostly mechanical change accomplished with a script. I tried to split 
out any changes to the typecasts that already existed into separate commits.

Modified:
cfe/trunk/lib/Headers/avx512pfintrin.h

Modified: cfe/trunk/lib/Headers/avx512pfintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512pfintrin.h?rev=269742=269741=269742=diff
==
--- cfe/trunk/lib/Headers/avx512pfintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512pfintrin.h Mon May 16 23:41:40 2016
@@ -31,61 +31,61 @@
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("avx512pf")))
 
-#define _mm512_mask_prefetch_i32gather_pd( index,  mask, addr,  scale, hint) 
__extension__ ({\
-__builtin_ia32_gatherpfdpd (mask, (__v8si) index, (long long const *) addr, 
scale, hint);\
-})
-
-#define _mm512_mask_prefetch_i32gather_ps( index,  mask, addr, scale,  hint) 
({\
-__builtin_ia32_gatherpfdps (mask, (__v16si) index, (int const *) addr, scale, 
hint);\
-})
-
-#define _mm512_mask_prefetch_i64gather_pd( index,  mask, addr,  scale, hint) 
__extension__ ({\
-__builtin_ia32_gatherpfqpd (mask, (__v8di) index, (long long const *) addr, 
scale, hint);\
-})
-
-#define _mm512_mask_prefetch_i64gather_ps( index,  mask, addr, scale,  hint) 
({\
-__builtin_ia32_gatherpfqps (mask, (__v8di) index, (int const *) addr, scale, 
hint);\
-})
-
-#define _mm512_prefetch_i32scatter_pd(addr,  index,  scale,  hint) 
__extension__ ({\
-__builtin_ia32_scatterpfdpd ((__mmask8) -1, (__v8si) index, \
-(void  *)addr, scale, hint);\
-})
-
-#define _mm512_mask_prefetch_i32scatter_pd(addr,  mask,  index,  scale,  hint) 
__extension__ ({\
-__builtin_ia32_scatterpfdpd (mask, (__v8si) index, (void  *) addr,\
- scale, hint);\
-})
+#define _mm512_mask_prefetch_i32gather_pd(index, mask, addr, scale, hint) 
__extension__ ({\
+  __builtin_ia32_gatherpfdpd((__mmask8)(mask), (__v8si)(__m256i)(index), \
+ (long long const *)(addr), (int)(scale), \
+ (int)(hint)); })
+
+#define _mm512_mask_prefetch_i32gather_ps(index, mask, addr, scale, hint) ({\
+  __builtin_ia32_gatherpfdps((__mmask16)(mask), \
+ (__v16si)(__m512i)(index), (int const *)(addr), \
+ (int)(scale), (int)(hint)); })
+
+#define _mm512_mask_prefetch_i64gather_pd(index, mask, addr, scale, hint) 
__extension__ ({\
+  __builtin_ia32_gatherpfqpd((__mmask8)(mask), (__v8di)(__m512i)(index), \
+ (long long const *)(addr), (int)(scale), \
+ (int)(hint)); })
+
+#define _mm512_mask_prefetch_i64gather_ps(index, mask, addr, scale, hint) ({\
+  __builtin_ia32_gatherpfqps((__mmask8)(mask), (__v8di)(__m512i)(index), \
+ (int const *)(addr), (int)(scale), (int)(hint)); 
})
+
+#define _mm512_prefetch_i32scatter_pd(addr, index, scale, hint) __extension__ 
({\
+  __builtin_ia32_scatterpfdpd((__mmask8)-1, (__v8si)(__m256i)(index), \
+  (long long *)(addr), (int)(scale), \
+  (int)(hint)); })
+
+#define _mm512_mask_prefetch_i32scatter_pd(addr, mask, index, scale, hint) 
__extension__ ({\
+  __builtin_ia32_scatterpfdpd((__mmask8)(mask), (__v8si)(__m256i)(index), \
+  (long long *)(addr), (int)(scale), \
+  (int)(hint)); })
 
 #define _mm512_prefetch_i32scatter_ps(addr, index, scale, hint) __extension__ 
({\
-__builtin_ia32_scatterpfdps ((__mmask16) -1, (__v16si) index, (void  *) addr,\
- scale, hint);\
-})
+  __builtin_ia32_scatterpfdps((__mmask16)-1, (__v16si)(__m512i)(index), \
+  (int *)(addr), (int)(scale), (int)(hint)); })
 
 #define _mm512_mask_prefetch_i32scatter_ps(addr, mask, index, scale, hint) 
__extension__ ({\
-__builtin_ia32_scatterpfdps (mask, (__v16si) index, (void  *) addr,\
- scale, hint);\
-})
+  __builtin_ia32_scatterpfdps((__mmask16)(mask), \
+  (__v16si)(__m512i)(index), (int *)(addr), \
+  (int)(scale), (int)(hint)); })
 
 #define _mm512_prefetch_i64scatter_pd(addr, index, scale, hint) __extension__ 
({\
-__builtin_ia32_scatterpfqpd ((__mmask8) -1, (__v8di) index, (void  *) addr,\
- scale, hint);\
-})
+  

r269743 - [AVX512] Add parentheses around macro arguments in AVX512VLBW intrinsics. Remove leading underscores from macro argument names. Add explicit typecasts to all macro arguments and return value

2016-05-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon May 16 23:41:42 2016
New Revision: 269743

URL: http://llvm.org/viewvc/llvm-project?rev=269743=rev
Log:
[AVX512] Add parentheses around macro arguments in AVX512VLBW intrinsics. 
Remove leading underscores from macro argument names. Add explicit typecasts to 
all macro arguments and return values. And finally reformat after all the 
adjustments.

This is a mostly mechanical change accomplished with a script. I tried to split 
out any changes to the typecasts that already existed into separate commits.

Modified:
cfe/trunk/lib/Headers/avx512vlbwintrin.h

Modified: cfe/trunk/lib/Headers/avx512vlbwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlbwintrin.h?rev=269743=269742=269743=diff
==
--- cfe/trunk/lib/Headers/avx512vlbwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlbwintrin.h Mon May 16 23:41:42 2016
@@ -2328,144 +2328,128 @@ _mm256_maskz_cvtepu8_epi16 (__mmask16 __
 
 #define _mm_cmp_epi8_mask(a, b, p) __extension__ ({ \
   (__mmask16)__builtin_ia32_cmpb128_mask((__v16qi)(__m128i)(a), \
- (__v16qi)(__m128i)(b), \
- (p), (__mmask16)-1); })
+ (__v16qi)(__m128i)(b), (int)(p), \
+ (__mmask16)-1); })
 
 #define _mm_mask_cmp_epi8_mask(m, a, b, p) __extension__ ({ \
   (__mmask16)__builtin_ia32_cmpb128_mask((__v16qi)(__m128i)(a), \
- (__v16qi)(__m128i)(b), \
- (p), (__mmask16)(m)); })
+ (__v16qi)(__m128i)(b), (int)(p), \
+ (__mmask16)(m)); })
 
 #define _mm_cmp_epu8_mask(a, b, p) __extension__ ({ \
   (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)(__m128i)(a), \
-  (__v16qi)(__m128i)(b), \
-  (p), (__mmask16)-1); })
+  (__v16qi)(__m128i)(b), (int)(p), \
+  (__mmask16)-1); })
 
 #define _mm_mask_cmp_epu8_mask(m, a, b, p) __extension__ ({ \
   (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)(__m128i)(a), \
-  (__v16qi)(__m128i)(b), \
-  (p), (__mmask16)(m)); })
+  (__v16qi)(__m128i)(b), (int)(p), \
+  (__mmask16)(m)); })
 
 #define _mm256_cmp_epi8_mask(a, b, p) __extension__ ({ \
   (__mmask32)__builtin_ia32_cmpb256_mask((__v32qi)(__m256i)(a), \
- (__v32qi)(__m256i)(b), \
- (p), (__mmask32)-1); })
+ (__v32qi)(__m256i)(b), (int)(p), \
+ (__mmask32)-1); })
 
 #define _mm256_mask_cmp_epi8_mask(m, a, b, p) __extension__ ({ \
   (__mmask32)__builtin_ia32_cmpb256_mask((__v32qi)(__m256i)(a), \
- (__v32qi)(__m256i)(b), \
- (p), (__mmask32)(m)); })
+ (__v32qi)(__m256i)(b), (int)(p), \
+ (__mmask32)(m)); })
 
 #define _mm256_cmp_epu8_mask(a, b, p) __extension__ ({ \
   (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)(__m256i)(a), \
-  (__v32qi)(__m256i)(b), \
-  (p), (__mmask32)-1); })
+  (__v32qi)(__m256i)(b), (int)(p), \
+  (__mmask32)-1); })
 
 #define _mm256_mask_cmp_epu8_mask(m, a, b, p) __extension__ ({ \
   (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)(__m256i)(a), \
-  (__v32qi)(__m256i)(b), \
-  (p), (__mmask32)(m)); })
+  (__v32qi)(__m256i)(b), (int)(p), \
+  (__mmask32)(m)); })
 
 #define _mm_cmp_epi16_mask(a, b, p) __extension__ ({ \
   (__mmask8)__builtin_ia32_cmpw128_mask((__v8hi)(__m128i)(a), \
-(__v8hi)(__m128i)(b), \
-(p), (__mmask8)-1); })
+(__v8hi)(__m128i)(b), (int)(p), \
+(__mmask8)-1); })
 
 #define _mm_mask_cmp_epi16_mask(m, a, b, p) __extension__ ({ \
   (__mmask8)__builtin_ia32_cmpw128_mask((__v8hi)(__m128i)(a), \
-(__v8hi)(__m128i)(b), \
-(p), (__mmask8)(m)); })
+(__v8hi)(__m128i)(b), (int)(p), \
+  

r269744 - [AVX512] Add parentheses around macro arguments in AVX512VLDQ intrinsics. Remove leading underscores from macro argument names. Add explicit typecasts to all macro arguments and return value

2016-05-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon May 16 23:41:46 2016
New Revision: 269744

URL: http://llvm.org/viewvc/llvm-project?rev=269744=rev
Log:
[AVX512] Add parentheses around macro arguments in AVX512VLDQ intrinsics. 
Remove leading underscores from macro argument names. Add explicit typecasts to 
all macro arguments and return values. And finally reformat after all the 
adjustments.

This is a mostly mechanical change accomplished with a script. I tried to split 
out any changes to the typecasts that already existed into separate commits.

Modified:
cfe/trunk/lib/Headers/avx512vldqintrin.h

Modified: cfe/trunk/lib/Headers/avx512vldqintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vldqintrin.h?rev=269744=269743=269744=diff
==
--- cfe/trunk/lib/Headers/avx512vldqintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vldqintrin.h Mon May 16 23:41:46 2016
@@ -852,101 +852,135 @@ _mm256_maskz_cvtepu64_ps (__mmask8 __U,
 (__mmask8) __U);
 }
 
-#define _mm_range_pd(__A, __B, __C) __extension__ ({ \
-  (__m128d) __builtin_ia32_rangepd128_mask ((__v2df) __A, (__v2df) __B, __C, \
-(__v2df) _mm_setzero_pd(), (__mmask8) -1); })
-
-#define _mm_mask_range_pd(__W, __U, __A, __B, __C) __extension__ ({  \
-  (__m128d) __builtin_ia32_rangepd128_mask ((__v2df) __A, (__v2df) __B, __C, \
-(__v2df) __W, (__mmask8) __U); })
-
-#define _mm_maskz_range_pd(__U, __A, __B, __C) __extension__ ({  \
-  (__m128d) __builtin_ia32_rangepd128_mask ((__v2df) __A, (__v2df) __B, __C, \
-(__v2df) _mm_setzero_pd(), (__mmask8) __U); })
-
-#define _mm256_range_pd(__A, __B, __C) __extension__ ({  \
-  (__m256d) __builtin_ia32_rangepd256_mask ((__v4df) __A, (__v4df) __B, __C, \
-(__v4df) _mm256_setzero_pd(), (__mmask8) -1); })
-
-#define _mm256_mask_range_pd(__W, __U, __A, __B, __C) __extension__ ({   \
-  (__m256d) __builtin_ia32_rangepd256_mask ((__v4df) __A, (__v4df) __B, __C, \
-(__v4df) __W, (__mmask8) __U); })
-
-#define _mm256_maskz_range_pd(__U, __A, __B, __C) __extension__ ({   \
-  (__m256d) __builtin_ia32_rangepd256_mask ((__v4df) __A, (__v4df) __B, __C, \
-(__v4df) _mm256_setzero_pd(), (__mmask8) __U); })
-
-#define _mm_range_ps(__A, __B, __C) __extension__ ({ \
-  (__m128) __builtin_ia32_rangeps128_mask ((__v4sf) __A, (__v4sf) __B, __C,  \
-(__v4sf) _mm_setzero_ps(), (__mmask8) -1); })
-
-#define _mm_mask_range_ps(__W, __U, __A, __B, __C) __extension__ ({  \
-  (__m128) __builtin_ia32_rangeps128_mask ((__v4sf) __A, (__v4sf) __B, __C,  \
-(__v4sf) __W, (__mmask8) __U); })
-
-#define _mm_maskz_range_ps(__U, __A, __B, __C) __extension__ ({  \
-  (__m128) __builtin_ia32_rangeps128_mask ((__v4sf) __A, (__v4sf) __B, __C,  \
-(__v4sf) _mm_setzero_ps(), (__mmask8) __U); })
-
-#define _mm256_range_ps(__A, __B, __C) __extension__ ({  \
-  (__m256) __builtin_ia32_rangeps256_mask ((__v8sf) __A, (__v8sf) __B, __C,  \
-(__v8sf) _mm256_setzero_ps(), (__mmask8) -1); })
-
-#define _mm256_mask_range_ps(__W, __U, __A, __B, __C) __extension__ ({   \
-  (__m256) __builtin_ia32_rangeps256_mask ((__v8sf) __A, (__v8sf) __B, __C,  \
-(__v8sf) __W, (__mmask8) __U); })
-
-#define _mm256_maskz_range_ps(__U, __A, __B, __C) __extension__ ({   \
-  (__m256) __builtin_ia32_rangeps256_mask ((__v8sf) __A, (__v8sf) __B, __C,  \
-(__v8sf) _mm256_setzero_ps(), (__mmask8) __U); })
-
-#define _mm_reduce_pd(__A, __B) __extension__ ({\
-  (__m128d) __builtin_ia32_reducepd128_mask ((__v2df) __A, __B, \
-(__v2df) _mm_setzero_pd(), (__mmask8) -1); })
-
-#define _mm_mask_reduce_pd(__W, __U, __A, __B) __extension__ ({ \
-  (__m128d) __builtin_ia32_reducepd128_mask ((__v2df) __A, __B, \
-(__v2df) __W, (__mmask8) __U); })
-
-#define _mm_maskz_reduce_pd(__U, __A, __B) __extension__ ({ \
-  (__m128d) __builtin_ia32_reducepd128_mask ((__v2df) __A, __B, \
-(__v2df) _mm_setzero_pd(), (__mmask8) __U); })
-
-#define _mm256_reduce_pd(__A, __B) __extension__ ({\
-  (__m256d) __builtin_ia32_reducepd256_mask ((__v4df) __A, __B,\
-(__v4df) _mm256_setzero_pd(), (__mmask8) -1); })
-
-#define _mm256_mask_reduce_pd(__W, __U, __A, __B) __extension__ ({ \
-  (__m256d) __builtin_ia32_reducepd256_mask ((__v4df) __A, __B,\
-(__v4df) __W, (__mmask8) __U); })
-
-#define _mm256_maskz_reduce_pd(__U, __A, __B) __extension__ ({ \
-  (__m256d) __builtin_ia32_reducepd256_mask ((__v4df) __A, __B,\
-(__v4df) _mm256_setzero_pd(), (__mmask8) __U); })
-
-#define _mm_reduce_ps(__A, __B) __extension__ ({   \
-  

r269741 - [AVX512] Add parentheses around macro arguments in AVX512ER intrinsics. Remove leading underscores from macro argument names. Add explicit typecasts to all macro arguments and return values.

2016-05-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon May 16 23:41:38 2016
New Revision: 269741

URL: http://llvm.org/viewvc/llvm-project?rev=269741=rev
Log:
[AVX512] Add parentheses around macro arguments in AVX512ER intrinsics. Remove 
leading underscores from macro argument names. Add explicit typecasts to all 
macro arguments and return values. And finally reformat after all the 
adjustments.

This is a mostly mechanical change accomplished with a script. I tried to split 
out any changes to the typecasts that already existed into separate commits.

Modified:
cfe/trunk/lib/Headers/avx512erintrin.h

Modified: cfe/trunk/lib/Headers/avx512erintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512erintrin.h?rev=269741=269740=269741=diff
==
--- cfe/trunk/lib/Headers/avx512erintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512erintrin.h Mon May 16 23:41:38 2016
@@ -31,66 +31,66 @@
 #define _mm512_exp2a23_round_pd(A, R) __extension__ ({ \
   (__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \
   (__v8df)_mm512_setzero_pd(), \
-  (__mmask8)-1, (R)); })
+  (__mmask8)-1, (int)(R)); })
 
 #define _mm512_mask_exp2a23_round_pd(S, M, A, R) __extension__ ({ \
   (__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \
-  (__v8df)(__m512d)(S), \
-  (__mmask8)(M), (R)); })
+  (__v8df)(__m512d)(S), (__mmask8)(M), \
+  (int)(R)); })
 
 #define _mm512_maskz_exp2a23_round_pd(M, A, R) __extension__ ({ \
   (__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \
   (__v8df)_mm512_setzero_pd(), \
-  (__mmask8)(M), (R)); })
+  (__mmask8)(M), (int)(R)); })
 
 #define _mm512_exp2a23_pd(A) \
-   _mm512_exp2a23_round_pd((A), _MM_FROUND_CUR_DIRECTION)
+  _mm512_exp2a23_round_pd((A), _MM_FROUND_CUR_DIRECTION)
 
 #define _mm512_mask_exp2a23_pd(S, M, A) \
-   _mm512_mask_exp2a23_round_pd((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
+  _mm512_mask_exp2a23_round_pd((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
 
 #define _mm512_maskz_exp2a23_pd(M, A) \
-   _mm512_maskz_exp2a23_round_pd((M), (A), _MM_FROUND_CUR_DIRECTION)
+  _mm512_maskz_exp2a23_round_pd((M), (A), _MM_FROUND_CUR_DIRECTION)
 
 #define _mm512_exp2a23_round_ps(A, R) __extension__ ({ \
   (__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \
  (__v16sf)_mm512_setzero_ps(), \
- (__mmask16)-1, (R)); })
+ (__mmask16)-1, (int)(R)); })
 
 #define _mm512_mask_exp2a23_round_ps(S, M, A, R) __extension__ ({ \
   (__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \
- (__v16sf)(__m512)(S), \
- (__mmask16)(M), (R)); })
+ (__v16sf)(__m512)(S), (__mmask16)(M), \
+ (int)(R)); })
 
 #define _mm512_maskz_exp2a23_round_ps(M, A, R) __extension__ ({ \
   (__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \
  (__v16sf)_mm512_setzero_ps(), \
- (__mmask16)(M), (R)); })
+ (__mmask16)(M), (int)(R)); })
 
 #define _mm512_exp2a23_ps(A) \
-   _mm512_exp2a23_round_ps((A), _MM_FROUND_CUR_DIRECTION)
+  _mm512_exp2a23_round_ps((A), _MM_FROUND_CUR_DIRECTION)
 
 #define _mm512_mask_exp2a23_ps(S, M, A) \
-   _mm512_mask_exp2a23_round_ps((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
+  _mm512_mask_exp2a23_round_ps((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
 
 #define _mm512_maskz_exp2a23_ps(M, A) \
-   _mm512_maskz_exp2a23_round_ps((M), (A), _MM_FROUND_CUR_DIRECTION)
+  _mm512_maskz_exp2a23_round_ps((M), (A), _MM_FROUND_CUR_DIRECTION)
 
 // rsqrt28
 #define _mm512_rsqrt28_round_pd(A, R) __extension__ ({ \
   (__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \
  (__v8df)_mm512_setzero_pd(), \
- (__mmask8)-1, (R)); })
+ (__mmask8)-1, (int)(R)); })
 
 #define _mm512_mask_rsqrt28_round_pd(S, M, A, R) __extension__ ({ \
   (__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \
- (__v8df)(__m512d)(S), \
- (__mmask8)(M), (R)); })
+ (__v8df)(__m512d)(S), (__mmask8)(M), \
+ (int)(R)); })
 
 #define _mm512_maskz_rsqrt28_round_pd(M, A, R) __extension__ ({ \
   (__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \
  

r269739 - [AVX512] Add parentheses around macro arguments in AVX512BW intrinsics. Remove leading underscores from macro argument names. Add explicit typecasts to all macro arguments and return values.

2016-05-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon May 16 23:41:33 2016
New Revision: 269739

URL: http://llvm.org/viewvc/llvm-project?rev=269739=rev
Log:
[AVX512] Add parentheses around macro arguments in AVX512BW intrinsics. Remove 
leading underscores from macro argument names. Add explicit typecasts to all 
macro arguments and return values. And finally reformat after all the 
adjustments.

This is a mostly mechanical change accomplished with a script. I tried to split 
out any changes to the typecasts that already existed into separate commits.

Modified:
cfe/trunk/lib/Headers/avx512bwintrin.h

Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=269739=269738=269739=diff
==
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Mon May 16 23:41:33 2016
@@ -1551,92 +1551,76 @@ _mm512_maskz_cvtepu8_epi16 (__mmask32 __
 
 #define _mm512_cmp_epi8_mask(a, b, p) __extension__ ({ \
   (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)(__m512i)(a), \
- (__v64qi)(__m512i)(b), \
- (p), (__mmask64)-1); })
+ (__v64qi)(__m512i)(b), (int)(p), \
+ (__mmask64)-1); })
 
 #define _mm512_mask_cmp_epi8_mask(m, a, b, p) __extension__ ({ \
   (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)(__m512i)(a), \
- (__v64qi)(__m512i)(b), \
- (p), (__mmask64)(m)); })
+ (__v64qi)(__m512i)(b), (int)(p), \
+ (__mmask64)(m)); })
 
 #define _mm512_cmp_epu8_mask(a, b, p) __extension__ ({ \
   (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)(__m512i)(a), \
-  (__v64qi)(__m512i)(b), \
-  (p), (__mmask64)-1); })
+  (__v64qi)(__m512i)(b), (int)(p), \
+  (__mmask64)-1); })
 
 #define _mm512_mask_cmp_epu8_mask(m, a, b, p) __extension__ ({ \
   (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)(__m512i)(a), \
-  (__v64qi)(__m512i)(b), \
-  (p), (__mmask64)(m)); })
+  (__v64qi)(__m512i)(b), (int)(p), \
+  (__mmask64)(m)); })
 
 #define _mm512_cmp_epi16_mask(a, b, p) __extension__ ({ \
   (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)(__m512i)(a), \
- (__v32hi)(__m512i)(b), \
- (p), (__mmask32)-1); })
+ (__v32hi)(__m512i)(b), (int)(p), \
+ (__mmask32)-1); })
 
 #define _mm512_mask_cmp_epi16_mask(m, a, b, p) __extension__ ({ \
   (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)(__m512i)(a), \
- (__v32hi)(__m512i)(b), \
- (p), (__mmask32)(m)); })
+ (__v32hi)(__m512i)(b), (int)(p), \
+ (__mmask32)(m)); })
 
 #define _mm512_cmp_epu16_mask(a, b, p) __extension__ ({ \
   (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)(__m512i)(a), \
-  (__v32hi)(__m512i)(b), \
-  (p), (__mmask32)-1); })
+  (__v32hi)(__m512i)(b), (int)(p), \
+  (__mmask32)-1); })
 
 #define _mm512_mask_cmp_epu16_mask(m, a, b, p) __extension__ ({ \
   (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)(__m512i)(a), \
-  (__v32hi)(__m512i)(b), \
-  (p), (__mmask32)(m)); })
+  (__v32hi)(__m512i)(b), (int)(p), \
+  (__mmask32)(m)); })
 
-#define _mm512_shufflehi_epi16( __A, __imm) __extension__ ({ \
-__builtin_ia32_pshufhw512_mask ((__v32hi)( __A),\
-  ( __imm),\
-   (__v32hi)\
-   _mm512_setzero_hi (),\
-   (__mmask32) -1);\
-})
-
-#define _mm512_mask_shufflehi_epi16( __W, __U, __A ,__imm) __extension__ ({ \
-__builtin_ia32_pshufhw512_mask ((__v32hi) (__A),\
-   (__imm),\
-   (__v32hi)( __W),\
-   (__mmask32)( __U));\
-})
-
-
-#define _mm512_maskz_shufflehi_epi16( __U, __A ,__imm) __extension__ ({ \
-__builtin_ia32_pshufhw512_mask ((__v32hi) (__A),\
-   (__imm),\
-   (__v32hi)\
-   _mm512_setzero_hi (),\
-   (__mmask32)( __U));\

r269737 - [AVX512] Correct types for scalar double precision FMA intrinsics and single precision getexp intrinsics.

2016-05-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon May 16 23:41:29 2016
New Revision: 269737

URL: http://llvm.org/viewvc/llvm-project?rev=269737=rev
Log:
[AVX512] Correct types for scalar double precision FMA intrinsics and single 
precision getexp intrinsics.

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=269737=269736=269737=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Mon May 16 23:41:29 2016
@@ -5135,10 +5135,10 @@ _mm_getexp_ss (__m128 __A, __m128 __B)
 (__v4sf) __B, (__v4sf)  _mm_setzero_ps(), (__mmask8) -1, 
_MM_FROUND_CUR_DIRECTION);
 }
 
-static __inline__ __m128d __DEFAULT_FN_ATTRS
-_mm_mask_getexp_ss (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) 
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_mask_getexp_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) 
 {
- return (__m128d) __builtin_ia32_getexpss128_round_mask ((__v4sf) __A,
+ return (__m128) __builtin_ia32_getexpss128_round_mask ((__v4sf) __A,
   (__v4sf) __B,
   (__v4sf) __W,
   (__mmask8) __U,
@@ -5153,10 +5153,10 @@ __builtin_ia32_getexpss128_round_mask ((
   __R);\
 })
 
-static __inline__ __m128d __DEFAULT_FN_ATTRS
-_mm_maskz_getexp_ss (__mmask8 __U, __m128d __A, __m128d __B) 
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_maskz_getexp_ss (__mmask8 __U, __m128 __A, __m128 __B) 
 {
- return (__m128d) __builtin_ia32_getexpss128_round_mask ((__v4sf) __A,
+ return (__m128) __builtin_ia32_getexpss128_round_mask ((__v4sf) __A,
   (__v4sf) __B,
   (__v4sf) _mm_setzero_pd (),
   (__mmask8) __U,
@@ -8165,10 +8165,10 @@ __builtin_ia32_vfmaddss3_mask3 (-(__v4sf
   __R);\
 })
 
-static __inline__ __m128 __DEFAULT_FN_ATTRS
-_mm_mask_fmadd_sd (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) 
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_mask_fmadd_sd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) 
 {
- return (__m128) __builtin_ia32_vfmaddsd3_mask ( (__v2df) __A,
+ return (__m128d) __builtin_ia32_vfmaddsd3_mask ( (__v2df) __A,
   (__v2df) __B,
   (__v2df) __W,
   (__mmask8) __U,
@@ -8183,10 +8183,10 @@ __builtin_ia32_vfmaddsd3_mask ( (__v2df)
   __R);\
 })
 
-static __inline__ __m128 __DEFAULT_FN_ATTRS
-_mm_maskz_fmadd_sd (__mmask8 __U, __m128 __A, __m128 __B, __m128 __C) 
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_maskz_fmadd_sd (__mmask8 __U, __m128d __A, __m128d __B, __m128d __C) 
 {
- return (__m128) __builtin_ia32_vfmaddsd3_maskz ( (__v2df) __A,
+ return (__m128d) __builtin_ia32_vfmaddsd3_maskz ( (__v2df) __A,
   (__v2df) __B,
   (__v2df) __C,
   (__mmask8) __U,
@@ -8201,10 +8201,10 @@ __builtin_ia32_vfmaddsd3_maskz ( (__v2df
   _MM_FROUND_CUR_DIRECTION);\
 })
 
-static __inline__ __m128 __DEFAULT_FN_ATTRS
-_mm_mask3_fmadd_sd (__m128 __W, __m128 __X, __m128 __Y, __mmask8 __U) 
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_mask3_fmadd_sd (__m128d __W, __m128d __X, __m128d __Y, __mmask8 __U) 
 {
- return (__m128) __builtin_ia32_vfmaddsd3_mask3 ((__v2df) __W,
+ return (__m128d) __builtin_ia32_vfmaddsd3_mask3 ((__v2df) __W,
   (__v2df) __X,
   (__v2df) __Y,
   (__mmask8) __U,
@@ -8219,10 +8219,10 @@ __builtin_ia32_vfmaddsd3_mask3 ((__v2df)
   __R);\
 })
 
-static __inline__ __m128 __DEFAULT_FN_ATTRS
-_mm_mask_fmsub_sd (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) 
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_mask_fmsub_sd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) 
 {
- return (__m128) __builtin_ia32_vfmaddsd3_mask ( (__v2df) __A,
+ return (__m128d) __builtin_ia32_vfmaddsd3_mask ( (__v2df) __A,
   -(__v2df) __B,
   (__v2df) __W,
   (__mmask8) __U,
@@ -8237,10 +8237,10 @@ __builtin_ia32_vfmaddsd3_mask ( (__v2df)
   __R);\
 })
 
-static __inline__ __m128 __DEFAULT_FN_ATTRS
-_mm_maskz_fmsub_sd (__mmask8 __U, __m128 __A, __m128 __B, __m128 __C) 
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_maskz_fmsub_sd (__mmask8 __U, __m128d __A, __m128d __B, __m128d __C) 
 {
- return (__m128) __builtin_ia32_vfmaddsd3_maskz ( (__v2df) __A,
+ return (__m128d) __builtin_ia32_vfmaddsd3_maskz ( (__v2df) __A,
   (__v2df) __B,
   -(__v2df) __C,
   (__mmask8) __U,
@@ -8255,10 +8255,10 @@ __builtin_ia32_vfmaddsd3_maskz ( (__v2df
   __R);\
 })
 
-static __inline__ __m128 __DEFAULT_FN_ATTRS
-_mm_mask3_fmsub_sd (__m128 __W, __m128 __X, __m128 __Y, __mmask8 __U) 
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_mask3_fmsub_sd (__m128d __W, __m128d __X, __m128d __Y, __mmask8 __U) 
 {
- return (__m128) __builtin_ia32_vfmaddsd3_mask3 ((__v2df) __W,
+ return (__m128d) __builtin_ia32_vfmaddsd3_mask3 ((__v2df) __W,
   

r269740 - [AVX512] Add parentheses around macro arguments in AVX512DQ intrinsics. Remove leading underscores from macro argument names. Add explicit typecasts to all macro arguments and return values.

2016-05-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon May 16 23:41:36 2016
New Revision: 269740

URL: http://llvm.org/viewvc/llvm-project?rev=269740=rev
Log:
[AVX512] Add parentheses around macro arguments in AVX512DQ intrinsics. Remove 
leading underscores from macro argument names. Add explicit typecasts to all 
macro arguments and return values. And finally reformat after all the 
adjustments.

This is a mostly mechanical change accomplished with a script. I tried to split 
out any changes to the typecasts that already existed into separate commits.

Modified:
cfe/trunk/lib/Headers/avx512dqintrin.h

Modified: cfe/trunk/lib/Headers/avx512dqintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512dqintrin.h?rev=269740=269739=269740=diff
==
--- cfe/trunk/lib/Headers/avx512dqintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512dqintrin.h Mon May 16 23:41:36 2016
@@ -261,17 +261,20 @@ _mm512_maskz_cvtpd_epi64 (__mmask8 __U,
 _MM_FROUND_CUR_DIRECTION);
 }
 
-#define _mm512_cvt_roundpd_epi64(__A, __R) __extension__ ({  \
-  (__m512i) __builtin_ia32_cvtpd2qq512_mask ((__v8df) __A,   \
-(__v8di) _mm512_setzero_si512(), (__mmask8) -1, __R);})
-
-#define _mm512_mask_cvt_roundpd_epi64(__W, __U, __A, __R) __extension__ ({ \
-  (__m512i) __builtin_ia32_cvtpd2qq512_mask ((__v8df) __A, \
-(__v8di) __W, (__mmask8) __U, __R);})
-
-#define _mm512_maskz_cvt_roundpd_epi64(__U, __A, __R) __extension__ ({   \
-  (__m512i) __builtin_ia32_cvtpd2qq512_mask ((__v8df) __A,\
-(__v8di) _mm512_setzero_si512(), (__mmask8) __U, __R); })
+#define _mm512_cvt_roundpd_epi64(A, R) __extension__ ({  \
+  (__m512i)__builtin_ia32_cvtpd2qq512_mask((__v8df)(__m512d)(A), \
+   (__v8di)_mm512_setzero_si512(), \
+   (__mmask8)-1, (int)(R)); })
+
+#define _mm512_mask_cvt_roundpd_epi64(W, U, A, R) __extension__ ({ \
+  (__m512i)__builtin_ia32_cvtpd2qq512_mask((__v8df)(__m512d)(A), \
+   (__v8di)(__m512i)(W), \
+   (__mmask8)(U), (int)(R)); })
+
+#define _mm512_maskz_cvt_roundpd_epi64(U, A, R) __extension__ ({   \
+  (__m512i)__builtin_ia32_cvtpd2qq512_mask((__v8df)(__m512d)(A), \
+   (__v8di)_mm512_setzero_si512(), \
+   (__mmask8)(U), (int)(R)); })
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_cvtpd_epu64 (__m512d __A) {
@@ -297,17 +300,20 @@ _mm512_maskz_cvtpd_epu64 (__mmask8 __U,
  _MM_FROUND_CUR_DIRECTION);
 }
 
-#define _mm512_cvt_roundpd_epu64(__A, __R) __extension__ ({   \
-  (__m512i) __builtin_ia32_cvtpd2uqq512_mask ((__v8df) __A,   \
- (__v8di) _mm512_setzero_si512(), (__mmask8) -1, __R);})
-
-#define _mm512_mask_cvt_roundpd_epu64(__W, __U, __A, __R) __extension__ ({ \
-  (__m512i) __builtin_ia32_cvtpd2uqq512_mask ((__v8df) __A,\
- (__v8di) __W, (__mmask8) __U, __R);})
-
-#define _mm512_maskz_cvt_roundpd_epu64(__U, __A, __R) __extension__ ({ \
-  (__m512i) __builtin_ia32_cvtpd2uqq512_mask ((__v8df) __A,\
- (__v8di) _mm512_setzero_si512(), (__mmask8) __U, __R);})
+#define _mm512_cvt_roundpd_epu64(A, R) __extension__ ({   \
+  (__m512i)__builtin_ia32_cvtpd2uqq512_mask((__v8df)(__m512d)(A), \
+(__v8di)_mm512_setzero_si512(), \
+(__mmask8)-1, (int)(R)); })
+
+#define _mm512_mask_cvt_roundpd_epu64(W, U, A, R) __extension__ ({ \
+  (__m512i)__builtin_ia32_cvtpd2uqq512_mask((__v8df)(__m512d)(A), \
+(__v8di)(__m512i)(W), \
+(__mmask8)(U), (int)(R)); })
+
+#define _mm512_maskz_cvt_roundpd_epu64(U, A, R) __extension__ ({ \
+  (__m512i)__builtin_ia32_cvtpd2uqq512_mask((__v8df)(__m512d)(A), \
+(__v8di)_mm512_setzero_si512(), \
+(__mmask8)(U), (int)(R)); })
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_cvtps_epi64 (__m256 __A) {
@@ -333,17 +339,20 @@ _mm512_maskz_cvtps_epi64 (__mmask8 __U,
 _MM_FROUND_CUR_DIRECTION);
 }
 
-#define _mm512_cvt_roundps_epi64(__A, __R) __extension__ ({ \
-  (__m512i) __builtin_ia32_cvtps2qq512_mask ((__v8sf) __A,  \
-(__v8di) _mm512_setzero_si512(), (__mmask8) -1, __R);})
-
-#define _mm512_mask_cvt_roundps_epi64(__W, __U, __A, __R) __extension__ ({ \
-  (__m512i) __builtin_ia32_cvtps2qq512_mask ((__v8sf) __A, \
-(__v8di) __W, (__mmask8) __U, __R);})
-
-#define 

r269738 - [AVX512] Fix return types in several test cases to match the intrinsic they're testing.

2016-05-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon May 16 23:41:32 2016
New Revision: 269738

URL: http://llvm.org/viewvc/llvm-project?rev=269738=rev
Log:
[AVX512] Fix return types in several test cases to match the intrinsic they're 
testing.

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=269738=269737=269738=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Mon May 16 23:41:32 2016
@@ -3365,19 +3365,19 @@ __m128 test_mm_roundscale_ss(__m128 __A,
   return _mm_roundscale_ss(__A, __B, 3); 
 }
 
-__m128d test_mm_mask_roundscale_ss(__m128d __W, __mmask8 __U, __m128d __A, 
__m128d __B){
+__m128 test_mm_mask_roundscale_ss(__m128d __W, __mmask8 __U, __m128d __A, 
__m128d __B){
   // CHECK-LABEL: @test_mm_mask_roundscale_ss
   // CHECK: @llvm.x86.avx512.mask.rndscale.ss
 return _mm_mask_roundscale_ss(__W,__U,__A,__B,3);
 }
 
-__m128d test_mm_maskz_roundscale_round_ss( __mmask8 __U, __m128d __A, __m128d 
__B){
+__m128 test_mm_maskz_roundscale_round_ss( __mmask8 __U, __m128d __A, __m128d 
__B){
   // CHECK-LABEL: @test_mm_maskz_roundscale_round_ss
   // CHECK: @llvm.x86.avx512.mask.rndscale.ss
 return 
_mm_maskz_roundscale_round_ss(__U,__A,__B,3,_MM_FROUND_CUR_DIRECTION);
 }
 
-__m128d test_mm_maskz_roundscale_ss(__mmask8 __U, __m128d __A, __m128d __B){
+__m128 test_mm_maskz_roundscale_ss(__mmask8 __U, __m128d __A, __m128d __B){
   // CHECK-LABEL: @test_mm_maskz_roundscale_ss
   // CHECK: @llvm.x86.avx512.mask.rndscale.ss
 return _mm_maskz_roundscale_ss(__U,__A,__B,3);


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


Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications

2016-05-16 Thread don hinton via cfe-commits
hintonda updated this revision to Diff 57432.
hintonda added a comment.

- Address additional comments.


http://reviews.llvm.org/D18575

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

Index: test/clang-tidy/modernize-use-noexcept.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept.cpp
@@ -0,0 +1,29 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -- -std=c++11
+
+class A {};
+class B {};
+
+void foo() throw();
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foo' uses dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void foo() noexcept;
+
+void bar() throw(...);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw(...)' [modernize-use-noexcept]
+// CHECK-FIXES: void bar() noexcept(false);
+
+void foobar() throw(A, B)
+{}
+// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+// CHECK-FIXES: void foobar() noexcept(false)
+
+void f(void (*fp)(void) throw()) throw(char);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'f' uses dynamic exception specification 'throw(char)' [modernize-use-noexcept]
+// CHECK-FIXES: void f(void (*fp)(void) throw()) noexcept(false);
+
+// FIXME: We can't match parameters yet.
+void g(void (*fp)(void) throw());
+
+// Should not trigger a replacement.
+void titi() noexcept {}
+void toto() noexcept(true) {}
Index: test/clang-tidy/modernize-use-noexcept-macro.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept-macro.cpp
@@ -0,0 +1,24 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \
+// RUN:   -- -std=c++11
+
+// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported. 
+#if (__has_feature(cxx_noexcept))
+#define NOEXCEPT noexcept
+#else
+#define NOEXCEPT throw()
+#endif
+
+void bar() throw() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void bar() NOEXCEPT {}
+
+// Should not trigger a FixItHint, since macros only support noexcept, and this
+// case throws.
+class A {};
+class B {};
+void foobar() throw(A, B);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+
+// Should not trigger a replacement.
+void foo() noexcept(true);
Index: docs/clang-tidy/checks/modernize-use-noexcept.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-use-noexcept.rst
@@ -0,0 +1,55 @@
+.. title:: clang-tidy - modernize-use-noexcept
+
+modernize-use-noexcept
+==
+
+The check converts dynamic exception specifications, e.g., ``throw()``,
+``throw([,...])``, or ``throw(...)`` to ``noexcept``, ``noexcept(false)``,
+or a user defined macro.
+
+Example
+---
+
+.. code-block:: c++
+
+  void foo() throw();
+	void bar() throw(int) {}
+
+transforms to:
+
+.. code-block:: c++
+
+  void foo() noexcept;
+	void bar() noexcept(false) {}
+
+
+User defined macros
+---
+
+By default this check will only replace ``throw()`` with ``noexcept``,
+and ``throw([,...])`` or ``throw(...)`` with
+``noexcept(false)``.  Additionally, users can also use
+:option:`ReplacementString` to specify a macro to use instead of
+``noexcept``.  This is useful when maintaining source code that must
+be compiled with older compilers that don't support the ``noexcept``
+keyword.  Users can define the macro to be ``noexcept`` or ``throw()``
+depending on whether or not noexcept is supported.
+
+Please note that since ``throw(int)`` is equivelent to
+``noexcept(false)`` not ``noexcept``, this check will detect, but not
+provide a FixItHint in that case.
+
+Example
+^^^
+
+.. code-block:: c++
+
+  void foo() throw() {}
+
+transforms to:
+
+.. code-block:: c++
+
+  void foo() NOEXCEPT {}
+
+if the :option:`ReplacementString` option is set to `NOEXCEPT`.
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -191,6 +191,11 @@
   Selectively replaces string literals containing escaped characters with raw
   string literals.
 
+- New 

r269734 - [X86] Add a few missing typecasts to intrinsics. Found by playing with -fno-lax-vector-conversions on the builtin tests.

2016-05-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon May 16 22:42:31 2016
New Revision: 269734

URL: http://llvm.org/viewvc/llvm-project?rev=269734=rev
Log:
[X86] Add a few missing typecasts to intrinsics. Found by playing with 
-fno-lax-vector-conversions on the builtin tests.

Modified:
cfe/trunk/lib/Headers/avx2intrin.h
cfe/trunk/lib/Headers/smmintrin.h

Modified: cfe/trunk/lib/Headers/avx2intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx2intrin.h?rev=269734=269733=269734=diff
==
--- cfe/trunk/lib/Headers/avx2intrin.h (original)
+++ cfe/trunk/lib/Headers/avx2intrin.h Mon May 16 22:42:31 2016
@@ -32,7 +32,9 @@
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("avx2")))
 
 /* SSE4 Multiple Packed Sums of Absolute Difference.  */
-#define _mm256_mpsadbw_epu8(X, Y, M) __builtin_ia32_mpsadbw256((X), (Y), (M))
+#define _mm256_mpsadbw_epu8(X, Y, M) \
+  (__m256i)__builtin_ia32_mpsadbw256((__v32qi)(__m256i)(X), \
+ (__v32qi)(__m256i)(Y), (int)(M))
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
 _mm256_abs_epi8(__m256i __a)

Modified: cfe/trunk/lib/Headers/smmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/smmintrin.h?rev=269734=269733=269734=diff
==
--- cfe/trunk/lib/Headers/smmintrin.h (original)
+++ cfe/trunk/lib/Headers/smmintrin.h Mon May 16 22:42:31 2016
@@ -220,16 +220,16 @@ _mm_max_epu32 (__m128i __V1, __m128i __V
 #define _mm_insert_epi8(X, I, N) (__extension__   \
   ({ __v16qi __a = (__v16qi)(__m128i)(X); \
  __a[(N) & 15] = (I); \
- __a;}))
+ (__m128i)__a;}))
 #define _mm_insert_epi32(X, I, N) (__extension__ \
({ __v4si __a = (__v4si)(__m128i)(X); \
   __a[(N) & 3] = (I);\
-  __a;}))
+  (__m128i)__a;}))
 #ifdef __x86_64__
 #define _mm_insert_epi64(X, I, N) (__extension__ \
({ __v2di __a = (__v2di)(__m128i)(X); \
   __a[(N) & 1] = (I);\
-  __a;}))
+  (__m128i)__a;}))
 #endif /* __x86_64__ */
 
 /* Extract int from packed integer array at index.  This returns the element


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


r269733 - [AVX512] _m512_setzero_qi/hi should return __m512i.

2016-05-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon May 16 22:42:25 2016
New Revision: 269733

URL: http://llvm.org/viewvc/llvm-project?rev=269733=rev
Log:
[AVX512] _m512_setzero_qi/hi should return __m512i.

Modified:
cfe/trunk/lib/Headers/avx512bwintrin.h
cfe/trunk/test/Headers/x86intrin-2.c

Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=269733=269732=269733=diff
==
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Mon May 16 22:42:25 2016
@@ -36,24 +36,24 @@ typedef short __v32hi __attribute__ ((__
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("avx512bw")))
 
-static  __inline __v64qi __DEFAULT_FN_ATTRS
+static  __inline __m512i __DEFAULT_FN_ATTRS
 _mm512_setzero_qi(void) {
-  return (__v64qi){ 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0 };
+  return (__m512i)(__v64qi){ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
-static  __inline __v32hi __DEFAULT_FN_ATTRS
+static  __inline __m512i __DEFAULT_FN_ATTRS
 _mm512_setzero_hi(void) {
-  return (__v32hi){ 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0 };
+  return (__m512i)(__v32hi){ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
 /* Integer compare */

Modified: cfe/trunk/test/Headers/x86intrin-2.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/x86intrin-2.c?rev=269733=269732=269733=diff
==
--- cfe/trunk/test/Headers/x86intrin-2.c (original)
+++ cfe/trunk/test/Headers/x86intrin-2.c Mon May 16 22:42:25 2016
@@ -72,7 +72,7 @@ __mmask8 __attribute__((__target__("avx5
   return _mm_cmpeq_epi32_mask(a, b);
 }
 
-__v64qi __attribute__((__target__("avx512bw"))) mm512_setzero_qi_wrap(void) {
+__m512i __attribute__((__target__("avx512bw"))) mm512_setzero_qi_wrap(void) {
   return _mm512_setzero_qi();
 }
 


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


r269732 - [AVX512] Fix odd formatting in intrinsic header.

2016-05-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon May 16 22:42:15 2016
New Revision: 269732

URL: http://llvm.org/viewvc/llvm-project?rev=269732=rev
Log:
[AVX512] Fix odd formatting in intrinsic header.

Modified:
cfe/trunk/lib/Headers/avx512bwintrin.h

Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=269732=269731=269732=diff
==
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Mon May 16 22:42:15 2016
@@ -39,21 +39,21 @@ typedef short __v32hi __attribute__ ((__
 static  __inline __v64qi __DEFAULT_FN_ATTRS
 _mm512_setzero_qi(void) {
   return (__v64qi){ 0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0 };
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
 static  __inline __v32hi __DEFAULT_FN_ATTRS
 _mm512_setzero_hi(void) {
   return (__v32hi){ 0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0 };
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
 /* Integer compare */


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


r269735 - [X86] Fix a few intrinsic tests to use the return type that matches the intrinsic they're testing.

2016-05-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon May 16 22:42:37 2016
New Revision: 269735

URL: http://llvm.org/viewvc/llvm-project?rev=269735=rev
Log:
[X86] Fix a few intrinsic tests to use the return type that matches the 
intrinsic they're testing.

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

Modified: cfe/trunk/test/CodeGen/sse-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sse-builtins.c?rev=269735=269734=269735=diff
==
--- cfe/trunk/test/CodeGen/sse-builtins.c (original)
+++ cfe/trunk/test/CodeGen/sse-builtins.c Mon May 16 22:42:37 2016
@@ -454,25 +454,25 @@ __m128d test_mm_cmpnge_pd(__m128d __a, _
   return _mm_cmpnge_pd(__a, __b);
 }
 
-__m128 test_mm_slli_si128(__m128 a) {
+__m128i test_mm_slli_si128(__m128 a) {
   // CHECK-LABEL: @test_mm_slli_si128
   // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <16 x i32> 
   return _mm_slli_si128(a, 5);
 }
 
-__m128 test_mm_bslli_si128(__m128 a) {
+__m128i test_mm_bslli_si128(__m128 a) {
   // CHECK-LABEL: @test_mm_bslli_si128
   // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <16 x i32> 
   return _mm_bslli_si128(a, 5);
 }
 
-__m128 test_mm_srli_si128(__m128 a) {
+__m128i test_mm_srli_si128(__m128 a) {
   // CHECK-LABEL: @test_mm_srli_si128
   // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <16 x i32> 
   return _mm_srli_si128(a, 5);
 }
 
-__m128 test_mm_bsrli_si128(__m128 a) {
+__m128i test_mm_bsrli_si128(__m128 a) {
   // CHECK-LABEL: @test_mm_bsrli_si128
   // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <16 x i32> 
   return _mm_bsrli_si128(a, 5);


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


r269730 - Modules: set SystemHeader to true if we are building a system module.

2016-05-16 Thread Manman Ren via cfe-commits
Author: mren
Date: Mon May 16 21:15:12 2016
New Revision: 269730

URL: http://llvm.org/viewvc/llvm-project?rev=269730=rev
Log:
Modules: set SystemHeader to true if we are building a system module.

If we are processing a #include from a module build, we should treat it
as a system header if we're building a system module. Passing an optional
flag to HeaderSearch::LookupFile.

Before this, the testing case will crash when accessing a freed FileEntry.

rdar://26214027

Added:
cfe/trunk/test/Modules/Inputs/UseAfterFree/
cfe/trunk/test/Modules/Inputs/UseAfterFree/UseAfterFreePrivate.h
cfe/trunk/test/Modules/Inputs/UseAfterFree/UseAfterFreePublic.h
cfe/trunk/test/Modules/Inputs/UseAfterFree/module.map
cfe/trunk/test/Modules/Inputs/UseAfterFree/module_private.map
cfe/trunk/test/Modules/use-after-free.m
Modified:
cfe/trunk/include/clang/Lex/HeaderSearch.h
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp

Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=269730=269729=269730=diff
==
--- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderSearch.h Mon May 16 21:15:12 2016
@@ -381,7 +381,7 @@ public:
   ArrayRef Includers,
   SmallVectorImpl *SearchPath, SmallVectorImpl *RelativePath,
   Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule,
-  bool SkipCache = false);
+  bool SkipCache = false, bool BuildSystemModule = false);
 
   /// \brief Look up a subframework for the specified \#include file.
   ///

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=269730=269729=269730=diff
==
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Mon May 16 21:15:12 2016
@@ -565,7 +565,7 @@ const FileEntry *HeaderSearch::LookupFil
 ArrayRef Includers,
 SmallVectorImpl *SearchPath, SmallVectorImpl *RelativePath,
 Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule,
-bool SkipCache) {
+bool SkipCache, bool BuildSystemModule) {
   if (SuggestedModule)
 *SuggestedModule = ModuleMap::KnownHeader();
 
@@ -613,11 +613,12 @@ const FileEntry *HeaderSearch::LookupFil
   // getFileAndSuggestModule, because it's a reference to an element of
   // a container that could be reallocated across this call.
   //
-  // FIXME: If we have no includer, that means we're processing a #include
+  // If we have no includer, that means we're processing a #include
   // from a module build. We should treat this as a system header if we're
   // building a [system] module.
   bool IncluderIsSystemHeader =
-  Includer && getFileInfo(Includer).DirInfo != SrcMgr::C_User;
+  (Includer && getFileInfo(Includer).DirInfo != SrcMgr::C_User) ||
+  (!Includer && BuildSystemModule);
   if (const FileEntry *FE = getFileAndSuggestModule(
   TmpDir, IncluderAndDir.second, IncluderIsSystemHeader,
   RequestingModule, SuggestedModule)) {

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=269730=269729=269730=diff
==
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Mon May 16 21:15:12 2016
@@ -671,6 +671,7 @@ const FileEntry *Preprocessor::LookupFil
   // stack, record the parent #includes.
   SmallVector
   Includers;
+  bool BuildSystemModule = false;
   if (!FromDir && !FromFile) {
 FileID FID = getCurrentFileLexer()->getFileID();
 const FileEntry *FileEnt = SourceMgr.getFileEntryForID(FID);
@@ -688,9 +689,10 @@ const FileEntry *Preprocessor::LookupFil
 // come from header declarations in the module map) relative to the module
 // map file.
 if (!FileEnt) {
-  if (FID == SourceMgr.getMainFileID() && MainFileDir)
+  if (FID == SourceMgr.getMainFileID() && MainFileDir) {
 Includers.push_back(std::make_pair(nullptr, MainFileDir));
-  else if ((FileEnt =
+BuildSystemModule = getCurrentModule()->IsSystem;
+  } else if ((FileEnt =
 SourceMgr.getFileEntryForID(SourceMgr.getMainFileID(
 Includers.push_back(std::make_pair(FileEnt, 
FileMgr.getDirectory(".")));
 } else {
@@ -736,7 +738,8 @@ const FileEntry *Preprocessor::LookupFil
   // Do a standard file entry lookup.
   const FileEntry *FE = HeaderInfo.LookupFile(
   Filename, FilenameLoc, isAngled, FromDir, CurDir, Includers, SearchPath,
-  RelativePath, RequestingModule, SuggestedModule, SkipCache);
+ 

[PATCH] D20313: [Mips] Set mips32 as default CPU for MIPS32 Android

2016-05-16 Thread Petar Jovanovic via cfe-commits
petarj created this revision.
petarj added a reviewer: atanasyan.
petarj added a subscriber: cfe-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

Change default CPU for MIPS32 Android. Now it is mips32 (rev1).

http://reviews.llvm.org/D20313

Files:
  lib/Driver/Tools.cpp
  test/Driver/clang-translation.c

Index: test/Driver/clang-translation.c
===
--- test/Driver/clang-translation.c
+++ test/Driver/clang-translation.c
@@ -245,7 +245,7 @@
 // RUN: FileCheck -check-prefix=MIPSEL-ANDROID %s
 // MIPSEL-ANDROID: clang
 // MIPSEL-ANDROID: "-cc1"
-// MIPSEL-ANDROID: "-target-cpu" "mips32r2"
+// MIPSEL-ANDROID: "-target-cpu" "mips32"
 // MIPSEL-ANDROID: "-mfloat-abi" "hard"
 
 // RUN: %clang -target mips64-linux-gnu -### -S %s 2>&1 | \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1183,8 +1183,10 @@
   }
 
   // MIPS64r6 is the default for Android MIPS64 (mips64el-linux-android).
-  if (Triple.isAndroid())
+  if (Triple.isAndroid()) {
+DefMips32CPU = "mips32";
 DefMips64CPU = "mips64r6";
+  }
 
   // MIPS3 is the default for mips64*-unknown-openbsd.
   if (Triple.getOS() == llvm::Triple::OpenBSD)


Index: test/Driver/clang-translation.c
===
--- test/Driver/clang-translation.c
+++ test/Driver/clang-translation.c
@@ -245,7 +245,7 @@
 // RUN: FileCheck -check-prefix=MIPSEL-ANDROID %s
 // MIPSEL-ANDROID: clang
 // MIPSEL-ANDROID: "-cc1"
-// MIPSEL-ANDROID: "-target-cpu" "mips32r2"
+// MIPSEL-ANDROID: "-target-cpu" "mips32"
 // MIPSEL-ANDROID: "-mfloat-abi" "hard"
 
 // RUN: %clang -target mips64-linux-gnu -### -S %s 2>&1 | \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1183,8 +1183,10 @@
   }
 
   // MIPS64r6 is the default for Android MIPS64 (mips64el-linux-android).
-  if (Triple.isAndroid())
+  if (Triple.isAndroid()) {
+DefMips32CPU = "mips32";
 DefMips64CPU = "mips64r6";
+  }
 
   // MIPS3 is the default for mips64*-unknown-openbsd.
   if (Triple.getOS() == llvm::Triple::OpenBSD)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20112: [OpenMP] Add support for the 'private pointer' flag to signal variables captured in target regions and used in first-private clauses.

2016-05-16 Thread Samuel Antao via cfe-commits
sfantao marked 2 inline comments as done.
sfantao added a comment.

Hi Alexey,

Thanks for the review!



Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:5452
@@ +5451,3 @@
+  // in there.
+  for (const auto *C : D.getClausesOfKind()) {
+for (const auto *D : C->varlists()) {

ABataev wrote:
> I think this is too greedy. You're rescanning list of firstprivates 
> clauses/variables for each variable.
Ok, I'm now saving the extracted first private info in the mappable expression 
handler so it can be reused for different captures.


Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:5458
@@ +5457,3 @@
+  // 'private ptr' and 'map to' flag.
+  if (CurVD == VD)
+return MappableExprsHandler::OMP_MAP_PRIVATE_PTR |

ABataev wrote:
> What if the variable is also referenced in lastprivate clause?
The directives with `target` only take `firstprivate` or `private`. So, we 
disregard `lastprivate` in this code.


http://reviews.llvm.org/D20112



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


Re: [PATCH] D20112: [OpenMP] Add support for the 'private pointer' flag to signal variables captured in target regions and used in first-private clauses.

2016-05-16 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 57420.
sfantao added a comment.

- Move the flags adjustment for first private declarations to the mappable 
expressions handler.


http://reviews.llvm.org/D20112

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  test/OpenMP/target_firstprivate_codegen.cpp
  test/OpenMP/target_map_codegen.cpp

Index: test/OpenMP/target_map_codegen.cpp
===
--- test/OpenMP/target_map_codegen.cpp
+++ test/OpenMP/target_map_codegen.cpp
@@ -4281,8 +4281,17 @@
 // CK27: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
 // CK27: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
 
-// CK27-LABEL: zero_size_section_maps
-void zero_size_section_maps (int ii){
+// CK27: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
+// CK27: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
+
+// CK27: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
+// CK27: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 288]
+
+// CK27: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 40]
+// CK27: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 161]
+
+// CK27-LABEL: zero_size_section_and_private_maps
+void zero_size_section_and_private_maps (int ii){
 
   // Map of a pointer.
   int *pa;
@@ -4367,12 +4376,99 @@
   {
 pa[50]++;
   }
+
+  int *pvtPtr;
+  int pvtScl;
+  int pvtArr[10];
+
+  // Region 04
+  // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
+  // CK27: call void [[CALL04:@.+]]()
+  #pragma omp target private(pvtPtr)
+  {
+pvtPtr[5]++;
+  }
+
+  // Region 05
+  // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
+  // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
+  // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
+  // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
+  // CK27-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
+
+  // CK27: call void [[CALL05:@.+]](i32* {{[^,]+}})
+  #pragma omp target firstprivate(pvtPtr)
+  {
+pvtPtr[5]++;
+  }
+
+  // Region 06
+  // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
+  // CK27: call void [[CALL06:@.+]]()
+  #pragma omp target private(pvtScl)
+  {
+pvtScl++;
+  }
+
+  // Region 07
+  // CK27-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZE07]]{{.+}}, {{.+}}[[MTYPE07]]{{.+}})
+  // CK27-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
+  // CK27-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
+  // CK27-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
+  // CK27-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
+  // CK27-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
+  // CK27-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
+  // CK27-DAG: [[VALBP]] = inttoptr i[[Z]] [[VAL:%.+]] to i8*
+  // CK27-DAG: [[VALP]] = inttoptr i[[Z]] [[VAL:%.+]] to i8*
+  // CK27-DAG: [[VAL]] = load i[[Z]], i[[Z]]* [[ADDR:%.+]],
+  // CK27-64-DAG: [[CADDR:%.+]] = bitcast i[[Z]]* [[ADDR]] to i32*
+  // CK27-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
+
+  // CK27: call void [[CALL07:@.+]](i[[Z]] [[VAL]])
+  #pragma omp target firstprivate(pvtScl)
+  {
+pvtScl++;
+  }
+
+  // Region 08
+  // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
+  // CK27: call void [[CALL08:@.+]]()
+  #pragma omp target private(pvtArr)
+  {
+pvtArr[5]++;
+  }
+
+  // Region 09
+  // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
+  // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
+  // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
+  // CK27-DAG: [[CBPVAL0]] = bitcast [10 x i32]* [[VAR0:%.+]] to i8*
+  // CK27-DAG: [[CPVAL0]] = bitcast [10 x i32]* [[VAR0]] to i8*
+
+  // CK27: call 

Re: [PATCH] D20111: [OpenMP] Adjust map type bits according to latest spec and use zero size array sections for pointers.

2016-05-16 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 57419.
sfantao added a comment.

- Rebase.


http://reviews.llvm.org/D20111

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  test/OpenMP/target_codegen.cpp
  test/OpenMP/target_codegen_registration.cpp
  test/OpenMP/target_data_codegen.cpp
  test/OpenMP/target_enter_data_codegen.cpp
  test/OpenMP/target_exit_data_codegen.cpp
  test/OpenMP/target_firstprivate_codegen.cpp
  test/OpenMP/target_map_codegen.cpp

Index: test/OpenMP/target_map_codegen.cpp
===
--- test/OpenMP/target_map_codegen.cpp
+++ test/OpenMP/target_map_codegen.cpp
@@ -16,8 +16,8 @@
 #ifdef CK1
 
 // CK1-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
-// Map types: OMP_MAP_BYCOPY = 128
-// CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 128]
+// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
+// CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
 
 // CK1-LABEL: implicit_maps_integer
 void implicit_maps_integer (int a){
@@ -61,8 +61,8 @@
 #ifdef CK2
 
 // CK2-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
-// Map types: OMP_MAP_BYCOPY = 128
-// CK2-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 128]
+// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
+// CK2-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
 
 // CK2-LABEL: implicit_maps_integer_reference
 void implicit_maps_integer_reference (int a){
@@ -110,8 +110,8 @@
 #ifdef CK3
 
 // CK3-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
-// Map types: OMP_MAP_BYCOPY = 128
-// CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 128]
+// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
+// CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
 
 // CK3-LABEL: implicit_maps_parameter
 void implicit_maps_parameter (int a){
@@ -154,8 +154,8 @@
 #ifdef CK4
 
 // CK4-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
-// Map types: OMP_MAP_BYCOPY = 128
-// CK4-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 128]
+// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
+// CK4-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
 
 // CK4-LABEL: implicit_maps_nested_integer
 void implicit_maps_nested_integer (int a){
@@ -210,8 +210,8 @@
 #ifdef CK5
 
 // CK5-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
-// Map types: OMP_MAP_BYCOPY = 128
-// CK5-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 128]
+// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
+// CK5-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
 
 // CK5-LABEL: implicit_maps_nested_integer_and_enum
 void implicit_maps_nested_integer_and_enum (int a){
@@ -261,8 +261,8 @@
 #ifdef CK6
 // CK6-DAG: [[GBL:@Gi]] = global i32 0
 // CK6-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
-// Map types: OMP_MAP_BYCOPY = 128
-// CK6-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 128]
+// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
+// CK6-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
 
 // CK6-LABEL: implicit_maps_host_global
 int Gi;
@@ -310,10 +310,10 @@
 // therefore it is passed by reference with a map 'to' specification.
 
 // CK7-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
-// Map types: OMP_MAP_BYCOPY = 128
-// CK7-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 128]
-// Map types: OMP_MAP_TO = 1
-// CK7-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 1]
+// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
+// CK7-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
+// Map types: OMP_MAP_TO  | OMP_MAP_IS_FIRST = 33
+// CK7-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 33]
 
 // CK7-LABEL: implicit_maps_double
 void implicit_maps_double (int a){
@@ -369,8 +369,8 @@
 #ifdef CK8
 
 // CK8-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
-// Map types: OMP_MAP_BYCOPY = 128
-// CK8-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 128]
+// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
+// CK8-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
 
 // CK8-LABEL: implicit_maps_float
 void implicit_maps_float (int a){
@@ -413,8 +413,8 @@
 #ifdef CK9
 
 // CK9-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
-// Map types: OMP_MAP_TO + OMP_MAP_FROM = 2 + 1
-// CK9-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 3]
+// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
+// CK9-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 35]
 
 // CK9-LABEL: implicit_maps_array
 void implicit_maps_array (int a){
@@ -453,9 +453,9 @@
 // RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK10
 #ifdef CK10
 
-// CK10-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x 

Re: r269309 - [ubsan] Add -fsanitize-undefined-strip-path-components=N

2016-05-16 Thread Sean Silva via cfe-commits
On Fri, May 13, 2016 at 12:01 AM, Filipe Cabecinhas  wrote:

>
> > On 13 May 2016, at 07:03, Sean Silva  wrote:
> >
> >
> >
> > On Thu, May 12, 2016 at 9:51 AM, Filipe Cabecinhas via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> > Author: filcab
> > Date: Thu May 12 11:51:36 2016
> > New Revision: 269309
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=269309=rev
> > Log:
> > [ubsan] Add -fsanitize-undefined-strip-path-components=N
> >
> > Summary:
> > This option allows the user to control how much of the file name is
> > emitted by UBSan. Tuning this option allows one to save space in the
> > resulting binary, which is helpful for restricted execution
> > environments.
> >
> > With a positive N, UBSan skips the first N path components.
> > With a negative N, UBSan only keeps the last N path components.
> >
> > Reviewers: rsmith
> >
> > Subscribers: cfe-commits
> >
> > Differential Revision: http://reviews.llvm.org/D19666
> >
> > Added:
> > cfe/trunk/test/CodeGen/ubsan-strip-path-components.cpp
> > cfe/trunk/test/Driver/fubsan-strip-path-components.cpp
> > Modified:
> > cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
> > cfe/trunk/include/clang/Driver/Options.td
> > cfe/trunk/include/clang/Frontend/CodeGenOptions.def
> > cfe/trunk/lib/CodeGen/CGExpr.cpp
> > cfe/trunk/lib/Driver/Tools.cpp
> > cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> >
> > Modified: cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UndefinedBehaviorSanitizer.rst?rev=269309=269308=269309=diff
> >
> ==
> > --- cfe/trunk/docs/UndefinedBehaviorSanitizer.rst (original)
> > +++ cfe/trunk/docs/UndefinedBehaviorSanitizer.rst Thu May 12 11:51:36
> 2016
> > @@ -228,6 +228,26 @@ UndefinedBehaviorSanitizer is available
> >  3.3. The test suite is integrated into the CMake build and can be run
> with
> >  ``check-ubsan`` command.
> >
> > +Additional Configuration
> > +
> > +
> > +UndefinedBehaviorSanitizer adds static check data for each check unless
> it is
> > +in trap mode. This check data includes the full file name. The option
> > +``-fsanitize-undefined-strip-path-components=N`` can be used to trim
> this
> > +information. If ``N`` is positive, file information emitted by
> > +UndefinedBehaviorSanitizer will drop the first ``N`` components from
> the file
> > +path. If ``N`` is negative, the last ``N`` components will be kept.
> > +
> > +Example
> > +---
> > +
> > +For a file called ``/code/library/file.cpp``, here is what would be
> emitted:
> > +* Default (No flag, or
> ``-fsanitize-undefined-strip-path-components=0``):
> ``/code/library/file.cpp``
> > +* ``-fsanitize-undefined-strip-path-components=1``:
> ``code/library/file.cpp``
> > +* ``-fsanitize-undefined-strip-path-components=2``: ``library/file.cpp``
> > +* ``-fsanitize-undefined-strip-path-components=-1``: ``file.cpp``
> > +* ``-fsanitize-undefined-strip-path-components=-2``:
> ``library/file.cpp``
> >
> > How are drive letters handled?
> >
> > -- Sean Silva
>
> Same way as Path iterator:
> ///   /  => /
> ///   /foo   => /,foo
> ///   foo/   => foo,.
> ///   /foo/bar   => /,foo,bar
> ///   ../=> ..,.
> ///   C:\foo\bar => C:,/,foo,bar
>
>
Please mention this in the user-facing documentation.

-- Sean Silva



>   Filipe
>
> >
> > +
> >  More Information
> >  
> >
> >
> > Modified: cfe/trunk/include/clang/Driver/Options.td
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=269309=269308=269309=diff
> >
> ==
> > --- cfe/trunk/include/clang/Driver/Options.td (original)
> > +++ cfe/trunk/include/clang/Driver/Options.td Thu May 12 11:51:36 2016
> > @@ -677,6 +677,10 @@ def fsanitize_stats : Flag<["-"], "fsani
> >  def fno_sanitize_stats : Flag<["-"], "fno-sanitize-stats">,
> >   Group,
> Flags<[CC1Option]>,
> >   HelpText<"Disable sanitizer statistics
> gathering.">;
> > +def fsanitize_undefined_strip_path_components_EQ : Joined<["-"],
> "fsanitize-undefined-strip-path-components=">,
> > +  Group, Flags<[CC1Option]>, MetaVarName<"">,
> > +  HelpText<"Strip (or keep only, if negative) a given number of path
> components "
> > +   "when emitting check metadata.">;
> >  def funsafe_math_optimizations : Flag<["-"],
> "funsafe-math-optimizations">,
> >Group;
> >  def fno_unsafe_math_optimizations : Flag<["-"],
> "fno-unsafe-math-optimizations">,
> >
> > Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=269309=269308=269309=diff
> >
> 

r269721 - Less broken fix for buildbot breakage.

2016-05-16 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon May 16 18:07:58 2016
New Revision: 269721

URL: http://llvm.org/viewvc/llvm-project?rev=269721=rev
Log:
Less broken fix for buildbot breakage.

Modified:
cfe/trunk/include/clang/AST/AttrIterator.h

Modified: cfe/trunk/include/clang/AST/AttrIterator.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/AttrIterator.h?rev=269721=269720=269721=diff
==
--- cfe/trunk/include/clang/AST/AttrIterator.h (original)
+++ cfe/trunk/include/clang/AST/AttrIterator.h Mon May 16 18:07:58 2016
@@ -27,7 +27,13 @@ namespace llvm {
   // Explicitly opt into 4 byte alignment for Attr*, to avoid the need to
   // include the heavyweight Attr.h to use a TinyPtrVector.
   template <>
-  struct PointerLikeTypeTraits : PointerLikeTypeTraits {};
+  struct PointerLikeTypeTraits {
+static void *getAsVoidPointer(clang::Attr *P) { return P; }
+static clang::Attr *getFromVoidPointer(void *P) {
+  return static_cast(P);
+}
+enum { NumLowBitsAvailable = 2 };
+  };
 }
 
 // Defined in ASTContext.h


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


Re: r269214 - Relax -Wcalling-convention-cast when casting to the default convention (cdecl)

2016-05-16 Thread Nico Weber via cfe-commits
After this tweak, Chromium builds cleanly with the new warning enabled.
Maybe it's time to turn it on by default.

On Wed, May 11, 2016 at 1:43 PM, Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rnk
> Date: Wed May 11 12:43:13 2016
> New Revision: 269214
>
> URL: http://llvm.org/viewvc/llvm-project?rev=269214=rev
> Log:
> Relax -Wcalling-convention-cast when casting to the default convention
> (cdecl)
>
> Modified:
> cfe/trunk/lib/Sema/SemaCast.cpp
> cfe/trunk/test/Sema/callingconv-cast.c
>
> Modified: cfe/trunk/lib/Sema/SemaCast.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=269214=269213=269214=diff
>
> ==
> --- cfe/trunk/lib/Sema/SemaCast.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaCast.cpp Wed May 11 12:43:13 2016
> @@ -1760,7 +1760,15 @@ static void DiagnoseCallingConvCast(Sema
>if (!FD || !FD->hasBody(Definition))
>  return;
>
> -  // The source expression is a pointer to a known function defined in
> this TU.
> +  // Only warn if we are casting from the default convention to a
> non-default
> +  // convention. This can happen when the programmer forgot to apply the
> calling
> +  // convention to the function definition and then inserted this cast to
> +  // satisfy the type system.
> +  CallingConv DefaultCC =
> Self.getASTContext().getDefaultCallingConvention(
> +  FD->isVariadic(), FD->isCXXInstanceMember());
> +  if (DstCC == DefaultCC || SrcCC != DefaultCC)
> +return;
> +
>// Diagnose this cast, as it is probably bad.
>StringRef SrcCCName = FunctionType::getNameForCallConv(SrcCC);
>StringRef DstCCName = FunctionType::getNameForCallConv(DstCC);
>
> Modified: cfe/trunk/test/Sema/callingconv-cast.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/callingconv-cast.c?rev=269214=269213=269214=diff
>
> ==
> --- cfe/trunk/test/Sema/callingconv-cast.c (original)
> +++ cfe/trunk/test/Sema/callingconv-cast.c Wed May 11 12:43:13 2016
> @@ -21,6 +21,10 @@ void mismatched(int x) {}
>  typedef void (WINAPI *callback_t)(int);
>  void take_callback(callback_t callback);
>
> +void WINAPI mismatched_stdcall(int x) {}
> +
> +void take_opaque_fn(void (*callback)(int));
> +
>  int main() {
>// expected-warning@+1 {{cast between incompatible calling conventions
> 'cdecl' and 'stdcall'}}
>take_callback((callback_t)mismatched);
> @@ -44,6 +48,11 @@ int main() {
>
>// Another way to suppress the warning.
>take_callback((callback_t)(void*)mismatched);
> +
> +  // Don't warn, because we're casting from stdcall to cdecl. Usually
> that means
> +  // the programmer is rinsing the function pointer through some kind of
> opaque
> +  // API.
> +  take_opaque_fn((void (*)(int))mismatched_stdcall);
>  }
>
>  // MSFIXIT: fix-it:"{{.*}}callingconv-cast.c":{19:6-19:6}:"WINAPI "
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r269720 - Try to make the buildbots green again: avoid the need for class Attr to be

2016-05-16 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon May 16 18:03:40 2016
New Revision: 269720

URL: http://llvm.org/viewvc/llvm-project?rev=269720=rev
Log:
Try to make the buildbots green again: avoid the need for class Attr to be
complete for users of AttrVec.

Modified:
cfe/trunk/include/clang/AST/AttrIterator.h

Modified: cfe/trunk/include/clang/AST/AttrIterator.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/AttrIterator.h?rev=269720=269719=269720=diff
==
--- cfe/trunk/include/clang/AST/AttrIterator.h (original)
+++ cfe/trunk/include/clang/AST/AttrIterator.h Mon May 16 18:03:40 2016
@@ -23,6 +23,13 @@ namespace clang {
   class Attr;
 }
 
+namespace llvm {
+  // Explicitly opt into 4 byte alignment for Attr*, to avoid the need to
+  // include the heavyweight Attr.h to use a TinyPtrVector.
+  template <>
+  struct PointerLikeTypeTraits : PointerLikeTypeTraits {};
+}
+
 // Defined in ASTContext.h
 void *operator new(size_t Bytes, const clang::ASTContext ,
size_t Alignment = 8);


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


r269718 - Doxygen comments for avxintrin.h.

2016-05-16 Thread Ekaterina Romanova via cfe-commits
Author: kromanova
Date: Mon May 16 17:54:45 2016
New Revision: 269718

URL: http://llvm.org/viewvc/llvm-project?rev=269718=rev
Log:
Doxygen comments for avxintrin.h.

Added doxygen comments to avxintrin.h's intrinsics. As of now, only around 50% 
of the intrinsics in this file are documented here. The patches for the other 
half will be sent out later.

Updated bmiintrin.h to fix an incorrect section name.
Updated f16cintrin.h to fix incorect parameter names.


The doxygen comments are automatically generated based on Sony's intrinsics 
document.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.



Modified:
cfe/trunk/lib/Headers/avxintrin.h
cfe/trunk/lib/Headers/bmiintrin.h
cfe/trunk/lib/Headers/f16cintrin.h

Modified: cfe/trunk/lib/Headers/avxintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avxintrin.h?rev=269718=269717=269718=diff
==
--- cfe/trunk/lib/Headers/avxintrin.h (original)
+++ cfe/trunk/lib/Headers/avxintrin.h Mon May 16 17:54:45 2016
@@ -167,8 +167,8 @@ _mm256_addsub_ps(__m256 __a, __m256 __b)
 ///A 256-bit vector of [4 x double] containing the dividend.
 /// \param __b
 ///A 256-bit vector of [4 x double] containing the divisor.
-/// \returns A 256-bit vector of [4 x double] containing the quotients between
-///both operands.
+/// \returns A 256-bit vector of [4 x double] containing the quotients of both
+///operands.
 static __inline __m256d __DEFAULT_FN_ATTRS
 _mm256_div_pd(__m256d __a, __m256d __b)
 {
@@ -185,8 +185,8 @@ _mm256_div_pd(__m256d __a, __m256d __b)
 ///A 256-bit vector of [8 x float] containing the dividend.
 /// \param __b
 ///A 256-bit vector of [8 x float] containing the divisor.
-/// \returns A 256-bit vector of [8 x float] containing the quotients between
-///both operands.
+/// \returns A 256-bit vector of [8 x float] containing the quotients of both
+///operands.
 static __inline __m256 __DEFAULT_FN_ATTRS
 _mm256_div_ps(__m256 __a, __m256 __b)
 {
@@ -279,8 +279,8 @@ _mm256_min_ps(__m256 __a, __m256 __b)
 ///A 256-bit vector of [4 x double] containing one of the operands.
 /// \param __b
 ///A 256-bit vector of [4 x double] containing one of the operands.
-/// \returns A 256-bit vector of [4 x double] containing the products between
-///both operands.
+/// \returns A 256-bit vector of [4 x double] containing the products of both
+///operands.
 static __inline __m256d __DEFAULT_FN_ATTRS
 _mm256_mul_pd(__m256d __a, __m256d __b)
 {
@@ -297,16 +297,16 @@ _mm256_mul_pd(__m256d __a, __m256d __b)
 ///A 256-bit vector of [8 x float] containing one of the operands.
 /// \param __b
 ///A 256-bit vector of [8 x float] containing one of the operands.
-/// \returns A 256-bit vector of [8 x float] containing the products between
-///both operands.
+/// \returns A 256-bit vector of [8 x float] containing the products of both
+///operands.
 static __inline __m256 __DEFAULT_FN_ATTRS
 _mm256_mul_ps(__m256 __a, __m256 __b)
 {
   return (__m256)((__v8sf)__a * (__v8sf)__b);
 }
 
-/// \brief Calculates the square roots of the values stored in a 256-bit vector
-///of [4 x double].
+/// \brief Calculates the square roots of the values in a 256-bit vector of
+///[4 x double].
 ///
 /// \headerfile 
 ///
@@ -322,8 +322,8 @@ _mm256_sqrt_pd(__m256d __a)
   return (__m256d)__builtin_ia32_sqrtpd256((__v4df)__a);
 }
 
-/// \brief Calculates the square roots of the values stored in a 256-bit vector
-///of [8 x float].
+/// \brief Calculates the square roots of the values in a 256-bit vector of
+///[8 x float].
 ///
 /// \headerfile 
 ///
@@ -339,8 +339,8 @@ _mm256_sqrt_ps(__m256 __a)
   return (__m256)__builtin_ia32_sqrtps256((__v8sf)__a);
 }
 
-/// \brief Calculates the reciprocal square roots of the values stored in a
-///256-bit vector of [8 x float].
+/// \brief Calculates the reciprocal square roots of the values in a 256-bit
+///vector of [8 x float].
 ///
 /// \headerfile 
 ///
@@ -356,8 +356,8 @@ _mm256_rsqrt_ps(__m256 __a)
   return (__m256)__builtin_ia32_rsqrtps256((__v8sf)__a);
 }
 
-/// \brief Calculates the reciprocals of the values stored in a 256-bit vector
-///of [8 x float].
+/// \brief Calculates the reciprocals of the values in a 256-bit vector of
+///[8 x float].
 ///
 /// \headerfile 
 ///
@@ -373,9 +373,9 @@ _mm256_rcp_ps(__m256 __a)
   return (__m256)__builtin_ia32_rcpps256((__v8sf)__a);
 }
 
-/// \brief Rounds the values stored in a 256-bit vector of [4 x double] as
-///specified by the byte operand. The source values are rounded to integer
-///values and returned as 64-bit double-precision floating-point values.
+/// \brief Rounds the values in a 256-bit vector of [4 x double] as specified
+///by the byte operand. The source values are rounded to integer values and
+///returned as 64-bit double-precision 

r269717 - Switch from SmallVector to TinyPtrVector for the list of attributes on a declaration. This removes a memory allocation for the common case where the declaration has only one attribute.

2016-05-16 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon May 16 17:53:19 2016
New Revision: 269717

URL: http://llvm.org/viewvc/llvm-project?rev=269717=rev
Log:
Switch from SmallVector to TinyPtrVector for the list of attributes on a 
declaration. This removes a memory allocation for the common case where the 
declaration has only one attribute.

Modified:
cfe/trunk/include/clang/AST/AttrIterator.h

Modified: cfe/trunk/include/clang/AST/AttrIterator.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/AttrIterator.h?rev=269717=269716=269717=diff
==
--- cfe/trunk/include/clang/AST/AttrIterator.h (original)
+++ cfe/trunk/include/clang/AST/AttrIterator.h Mon May 16 17:53:19 2016
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_AST_ATTRITERATOR_H
 
 #include "clang/Basic/LLVM.h"
+#include "llvm/ADT/TinyPtrVector.h"
 #include 
 
 namespace clang {
@@ -39,8 +40,8 @@ void operator delete[](void *Ptr, const
 namespace clang {
 
 /// AttrVec - A vector of Attr, which is how they are stored on the AST.
-typedef SmallVector AttrVec;
-typedef SmallVector ConstAttrVec;
+typedef llvm::TinyPtrVector AttrVec;
+typedef llvm::TinyPtrVector ConstAttrVec;
 
 /// specific_attr_iterator - Iterates over a subrange of an AttrVec, only
 /// providing attributes that are of a specific type.


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


r269716 - Avoid O(n^2) string analysis when handling GNU __asm__ statements.

2016-05-16 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon May 16 17:52:23 2016
New Revision: 269716

URL: http://llvm.org/viewvc/llvm-project?rev=269716=rev
Log:
Avoid O(n^2) string analysis when handling GNU __asm__ statements.

Modified:
cfe/trunk/lib/AST/Stmt.cpp

Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=269716=269715=269716=diff
==
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Mon May 16 17:52:23 2016
@@ -503,6 +503,9 @@ unsigned GCCAsmStmt::AnalyzeAsmString(Sm
 
   bool HasVariants = !C.getTargetInfo().hasNoAsmVariants();
 
+  unsigned LastAsmStringToken = 0;
+  unsigned LastAsmStringOffset = 0;
+
   while (1) {
 // Done with the string?
 if (CurPtr == StrEnd) {
@@ -589,10 +592,12 @@ unsigned GCCAsmStmt::AnalyzeAsmString(Sm
 
   // (BeginLoc, EndLoc) represents the range of the operand we are 
currently
   // processing. Unlike Str, the range includes the leading '%'.
-  SourceLocation BeginLoc =
-  getAsmString()->getLocationOfByte(Percent - StrStart, SM, LO, TI);
-  SourceLocation EndLoc =
-  getAsmString()->getLocationOfByte(CurPtr - StrStart, SM, LO, TI);
+  SourceLocation BeginLoc = getAsmString()->getLocationOfByte(
+  Percent - StrStart, SM, LO, TI, ,
+  );
+  SourceLocation EndLoc = getAsmString()->getLocationOfByte(
+  CurPtr - StrStart, SM, LO, TI, ,
+  );
 
   Pieces.emplace_back(N, std::move(Str), BeginLoc, EndLoc);
   continue;
@@ -623,10 +628,12 @@ unsigned GCCAsmStmt::AnalyzeAsmString(Sm
 
   // (BeginLoc, EndLoc) represents the range of the operand we are 
currently
   // processing. Unlike Str, the range includes the leading '%'.
-  SourceLocation BeginLoc =
-  getAsmString()->getLocationOfByte(Percent - StrStart, SM, LO, TI);
-  SourceLocation EndLoc =
-  getAsmString()->getLocationOfByte(NameEnd + 1 - StrStart, SM, LO, 
TI);
+  SourceLocation BeginLoc = getAsmString()->getLocationOfByte(
+  Percent - StrStart, SM, LO, TI, ,
+  );
+  SourceLocation EndLoc = getAsmString()->getLocationOfByte(
+  NameEnd + 1 - StrStart, SM, LO, TI, ,
+  );
 
   Pieces.emplace_back(N, std::move(Str), BeginLoc, EndLoc);
 


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


Re: [PATCH] D20302: Remove LazyDefinitionDataPtr and rely on getMostRecentDecl. Fixes PR27754.

2016-05-16 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: include/clang/AST/DeclCXX.h:522
@@ -545,7 +521,3 @@
 
-  typedef LazyDefinitionDataPtr
-  DefinitionDataPtr;
-  friend class LazyDefinitionDataPtr;
-
-  mutable DefinitionDataPtr DefinitionData;
+  mutable DefinitionData* DefinitionData;
 

Does this still need to be `mutable`?

Also, you need to use `struct DefinitionData *DefinitionData;` here or this is 
ill-formed (no diagnostic required) by [basic.scope.class]p1 rule 2.


Comment at: include/clang/AST/DeclCXX.h:672
@@ -698,3 +671,3 @@
   CXXRecordDecl *getDefinition() const {
-auto *DD = DefinitionData.get();
+auto *DD = DefinitionData;
 return DD ? DD->Definition : nullptr;

This also needs to perform an update. Maybe factor out a function for this and 
`data()` to call?


Comment at: include/clang/AST/DeclCXX.h:676
@@ -702,3 +675,3 @@
 
-  bool hasDefinition() const { return DefinitionData.get(); }
+  bool hasDefinition() const { return DefinitionData; }
 

Likewise, we need an update here if `DefinitionData` is null.


Repository:
  rL LLVM

http://reviews.llvm.org/D20302



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


[PATCH] D20302: Remove LazyDefinitionDataPtr and rely on getMostRecentDecl. Fixes PR27754.

2016-05-16 Thread Vassil Vassilev via cfe-commits
v.g.vassilev created this revision.
v.g.vassilev added a reviewer: rsmith.
v.g.vassilev added a subscriber: cfe-commits.
v.g.vassilev set the repository for this revision to rL LLVM.

Repository:
  rL LLVM

http://reviews.llvm.org/D20302

Files:
  include/clang/AST/DeclCXX.h
  lib/AST/DeclCXX.cpp
  lib/Serialization/ASTReaderDecl.cpp
  test/Modules/Inputs/PR27754/RConversionRuleParser.h
  test/Modules/Inputs/PR27754/TMetaUtils.h
  test/Modules/Inputs/PR27754/TSchemaType.h
  test/Modules/Inputs/PR27754/map
  test/Modules/Inputs/PR27754/module.modulemap
  test/Modules/pr27754.cpp

Index: test/Modules/pr27754.cpp
===
--- /dev/null
+++ test/Modules/pr27754.cpp
@@ -0,0 +1,7 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR27754 -verify %s
+// RUN: %clang_cc1 -std=c++11 -fmodules -fmodule-map-file=%S/Inputs/PR27754/module.modulemap -fmodules-cache-path=%t -I%S/Inputs/PR27754/ -verify %s
+
+#include "TMetaUtils.h"
+
+// expected-no-diagnostics
Index: test/Modules/Inputs/PR27754/module.modulemap
===
--- /dev/null
+++ test/Modules/Inputs/PR27754/module.modulemap
@@ -0,0 +1,3 @@
+module "RConversionRuleParser.h" { header "RConversionRuleParser.h" }
+module "TMetaUtils.h" { header "TMetaUtils.h" }
+module "TSchemaType.h" { header "TSchemaType.h" }
Index: test/Modules/Inputs/PR27754/map
===
--- /dev/null
+++ test/Modules/Inputs/PR27754/map
@@ -0,0 +1,3 @@
+class _Rb_tree {
+  _Rb_tree() { true_type(); }
+};
Index: test/Modules/Inputs/PR27754/TSchemaType.h
===
--- /dev/null
+++ test/Modules/Inputs/PR27754/TSchemaType.h
@@ -0,0 +1,4 @@
+#ifndef _STL_ALGOBASE_H
+template  struct integral_constant {};
+struct A : integral_constant {};
+#endif
Index: test/Modules/Inputs/PR27754/TMetaUtils.h
===
--- /dev/null
+++ test/Modules/Inputs/PR27754/TMetaUtils.h
@@ -0,0 +1,2 @@
+#include "RConversionRuleParser.h"
+void fn1() { true_type(); }
Index: test/Modules/Inputs/PR27754/RConversionRuleParser.h
===
--- /dev/null
+++ test/Modules/Inputs/PR27754/RConversionRuleParser.h
@@ -0,0 +1,7 @@
+#define _STL_ALGOBASE_H
+template < typename _Tp, _Tp > struct integral_constant
+{
+};
+typedef integral_constant < bool, true > true_type;
+#include 
+#include "TSchemaType.h"
Index: lib/Serialization/ASTReaderDecl.cpp
===
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -1540,9 +1540,9 @@
 
 void ASTDeclReader::MergeDefinitionData(
 CXXRecordDecl *D, struct CXXRecordDecl::DefinitionData &) {
-  assert(D->DefinitionData.getNotUpdated() &&
+  assert(D->DefinitionData &&
  "merging class definition into non-definition");
-  auto  = *D->DefinitionData.getNotUpdated();
+  auto  = *D->DefinitionData;
 
   if (DD.Definition != MergeDD.Definition) {
 // Track that we merged the definitions.
@@ -1665,7 +1665,7 @@
   // because we're reading an update record, or because we've already done some
   // merging. Either way, just merge into it.
   CXXRecordDecl *Canon = D->getCanonicalDecl();
-  if (Canon->DefinitionData.getNotUpdated()) {
+  if (Canon->DefinitionData) {
 MergeDefinitionData(Canon, std::move(*DD));
 D->DefinitionData = Canon->DefinitionData;
 return;
@@ -2001,8 +2001,8 @@
 
 // This declaration might be a definition. Merge with any existing
 // definition.
-if (auto *DDD = D->DefinitionData.getNotUpdated()) {
-  if (CanonSpec->DefinitionData.getNotUpdated())
+if (auto *DDD = D->DefinitionData) {
+  if (CanonSpec->DefinitionData)
 MergeDefinitionData(CanonSpec, std::move(*DDD));
   else
 CanonSpec->DefinitionData = D->DefinitionData;
@@ -2326,8 +2326,8 @@
 // FIXME: This is duplicated in several places. Refactor.
 auto *ExistingClass =
 cast(ExistingPattern)->getCanonicalDecl();
-if (auto *DDD = DClass->DefinitionData.getNotUpdated()) {
-  if (ExistingClass->DefinitionData.getNotUpdated()) {
+if (auto *DDD = DClass->DefinitionData) {
+  if (ExistingClass->DefinitionData) {
 MergeDefinitionData(ExistingClass, std::move(*DDD));
   } else {
 ExistingClass->DefinitionData = DClass->DefinitionData;
@@ -2765,9 +2765,9 @@
 
   if (CXXRecordDecl *RD = dyn_cast(DC)) {
 // Try to dig out the definition.
-auto *DD = RD->DefinitionData.getNotUpdated();
+auto *DD = RD->DefinitionData;
 if (!DD)
-  DD = RD->getCanonicalDecl()->DefinitionData.getNotUpdated();
+  DD = RD->getCanonicalDecl()->DefinitionData;
 
 // If there's no definition yet, then DC's definition is added 

r269709 - [PS4] Tighten up a test (noticed in passing)

2016-05-16 Thread Paul Robinson via cfe-commits
Author: probinson
Date: Mon May 16 16:25:15 2016
New Revision: 269709

URL: http://llvm.org/viewvc/llvm-project?rev=269709=rev
Log:
[PS4] Tighten up a test (noticed in passing)

Modified:
cfe/trunk/test/Driver/ps4-linker-win.c

Modified: cfe/trunk/test/Driver/ps4-linker-win.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ps4-linker-win.c?rev=269709=269708=269709=diff
==
--- cfe/trunk/test/Driver/ps4-linker-win.c (original)
+++ cfe/trunk/test/Driver/ps4-linker-win.c Mon May 16 16:25:15 2016
@@ -22,5 +22,5 @@
 // RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4  %s -shared \
 // RUN: -fuse-ld=ps4 -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-LINKER 
%s
 
-// CHECK-PS4-GOLD: \\orbis-ld.gold
-// CHECK-PS4-LINKER: \\orbis-ld
+// CHECK-PS4-GOLD: \\orbis-ld.gold.exe"
+// CHECK-PS4-LINKER: \\orbis-ld.exe"


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


Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications

2016-05-16 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: test/clang-tidy/modernize-use-noexcept-macro.cpp:11
@@ +10,3 @@
+
+// Should not trigger a FixItHint
+class A {};

hintonda wrote:
> aaron.ballman wrote:
> > I may have missed some context in the discussion, but why shouldn't this 
> > trigger a FixItHint?
> Because the user provided a macro.  The only reason you would do that is if 
> you want the macro to expand to something different depending on whether or 
> not 'noexcept' is supported.  
> 
> Perhaps this can be done more elegantly, but the use case for this entire 
> checker was libcxx.  It defines _NOEXCEPT as either noexcept or throw() 
> depending on whether or not noexcept is supported.  I don't see a good way of 
> doing that, other than removing it completely, so I just reported it without 
> supplying a FixItHint.
> 
Ah, thank you for the context! That information should probably go in the user 
facing documentation somewhere.


http://reviews.llvm.org/D18575



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


Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications

2016-05-16 Thread don hinton via cfe-commits
hintonda added inline comments.


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:46
@@ +45,3 @@
+   const SmallVector ) {
+  // Find throw token -- it's a keyword, so there can't be more than one.  
Also,
+  // it should be near the end of the declaration, so search from the end.

aaron.ballman wrote:
> hintonda wrote:
> > aaron.ballman wrote:
> > > Pathologically terrible counter-case: `void func() throw(decltype(throw 
> > > 12) *)`
> > Good point, looks like I need a full fledged parser to catch 100% or the 
> > cases -- or we could ignore these corner cases.
> At the very least, we should have test cases showing what the behavior is 
> with a big FIXME around this code, should you decide to keep it. I'm not keen 
> on the idea of this being part of a fixit that may destroy well-defined user 
> code. Same for the assumptions about the location of right parens. That code 
> looks equally broken even without multiple `throw` tokens in the stream. 
> Consider:
> `void func() throw(int(int));`
Had thought about adding paren parsing, but wasn't sure it was needed -- thanks 
for pointing out that it is.  Of course, I'll have to parse from the beginning 
to do this correctly, but that's not a big deal.


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:49
@@ +48,3 @@
+  int TokenIndex;
+  for (TokenIndex = Tokens.size() - 1; TokenIndex != -1; --TokenIndex) {
+if (Tokens[TokenIndex].is(tok::kw_throw))

aaron.ballman wrote:
> Can we use `>= 0` instead of `!= -1`? It makes it more immediately obvious 
> that the array index will not underflow.
Sure.


Comment at: test/clang-tidy/modernize-use-noexcept-macro.cpp:11
@@ +10,3 @@
+
+// Should not trigger a FixItHint
+class A {};

aaron.ballman wrote:
> I may have missed some context in the discussion, but why shouldn't this 
> trigger a FixItHint?
Because the user provided a macro.  The only reason you would do that is if you 
want the macro to expand to something different depending on whether or not 
'noexcept' is supported.  

Perhaps this can be done more elegantly, but the use case for this entire 
checker was libcxx.  It defines _NOEXCEPT as either noexcept or throw() 
depending on whether or not noexcept is supported.  I don't see a good way of 
doing that, other than removing it completely, so I just reported it without 
supplying a FixItHint.



http://reviews.llvm.org/D18575



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


Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications

2016-05-16 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:21
@@ +20,3 @@
+
+static StringRef
+makeDynamicExceptionString(const SourceManager ,

hintonda wrote:
> aaron.ballman wrote:
> > Instead of a bunch of static functions, would an unnamed namespace make 
> > more sense?
> Just following the pattern established in other checkers so as to minimize 
> the number of changes, but will change to namespace.
I don't have strong opinions; I think the usual rule of thumb boils down to 
whether the code fits on a page or not (if it does, use an unnamed namespace, 
if not, use static functions).


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:46
@@ +45,3 @@
+   const SmallVector ) {
+  // Find throw token -- it's a keyword, so there can't be more than one.  
Also,
+  // it should be near the end of the declaration, so search from the end.

hintonda wrote:
> aaron.ballman wrote:
> > Pathologically terrible counter-case: `void func() throw(decltype(throw 12) 
> > *)`
> Good point, looks like I need a full fledged parser to catch 100% or the 
> cases -- or we could ignore these corner cases.
At the very least, we should have test cases showing what the behavior is with 
a big FIXME around this code, should you decide to keep it. I'm not keen on the 
idea of this being part of a fixit that may destroy well-defined user code. 
Same for the assumptions about the location of right parens. That code looks 
equally broken even without multiple `throw` tokens in the stream. Consider:
`void func() throw(int(int));`


http://reviews.llvm.org/D18575



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


Re: [PATCH] D19322: Concepts: Create space for requires-clause in TemplateParameterList; NFC

2016-05-16 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added a comment.

Ping (#2).


http://reviews.llvm.org/D19322



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


Buildbot numbers for the last week of 5/08/2016 - 5/14/2016

2016-05-16 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 5/08/2016 - 5/14/2016.

Thanks

Galina


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

 buildername| builds |
changes | status change ratio
++-+-
 lldb-windows7-android  |123 |
42 |34.1
 perf-x86_64-penryn-O3-polly| 50 |
15 |30.0
 clang-cmake-mipsel | 21
|   6 |28.6
 clang-ppc64le-linux-lnt|134 |
34 |25.4
 clang-ppc64le-linux-multistage | 85 |
18 |21.2
 lldb-x86_64-darwin-13.4|130 |
26 |20.0
 libcxx-libcxxabi-x86_64-linux-debian   |  5
|   1 |20.0
 perf-x86_64-penryn-O3-polly-fast   | 23
|   4 |17.4
 sanitizer-x86_64-linux-bootstrap   | 49
|   8 |16.3
 clang-x86-win2008-selfhost | 90 |
13 |14.4
 clang-cmake-armv7-a15-selfhost | 30
|   4 |13.3
 clang-native-aarch64-full  | 16
|   2 |12.5
 perf-x86_64-penryn-O3  | 49
|   6 |12.2
 sanitizer-ppc64le-linux| 52
|   6 |11.5
 clang-x64-ninja-win7   |168 |
19 |11.3
 llvm-mips-linux| 54
|   5 | 9.3
 clang-cmake-thumbv7-a15-full-sh| 23
|   2 | 8.7
 clang-cmake-mips   | 71
|   6 | 8.5
 clang-cmake-armv7-a15-selfhost-neon| 24
|   2 | 8.3
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   |364 |
29 | 8.0
 clang-cmake-aarch64-full   | 52
|   4 | 7.7
 clang-x86_64-linux-selfhost-modules|214 |
16 | 7.5
 sanitizer-x86_64-linux-fast|173 |
12 | 6.9
 clang-bpf-build|386 |
26 | 6.7
 llvm-clang-lld-x86_64-debian-fast  |167 |
11 | 6.6
 clang-hexagon-elf  |261 |
17 | 6.5
 sanitizer-ppc64be-linux| 93
|   6 | 6.5
 clang-ppc64le-linux|220 |
14 | 6.4
 clang-cmake-armv7-a15  |156 |
10 | 6.4
 lldb-x86_64-ubuntu-14.04-buildserver   |128
|   8 | 6.3
 clang-s390x-linux  |316 |
20 | 6.3
 clang-ppc64be-linux|347 |
20 | 5.8
 lldb-x86_64-ubuntu-14.04-android   |126
|   7 | 5.6
 clang-ppc64be-linux-multistage |111
|   6 | 5.4
 clang-ppc64be-linux-lnt|262 |
14 | 5.3
 lldb-x86_64-ubuntu-14.04-cmake |277 |
13 | 4.7
 llvm-hexagon-elf   |259 |
12 | 4.6
 clang-cmake-armv7-a15-full | 90
|   4 | 4.4
 lldb-amd64-ninja-netbsd7   |139
|   6 | 4.3
 polly-amd64-linux  |235 |
10 | 4.3
 clang-cmake-thumbv7-a15|192
|   8 | 4.2
 lld-x86_64-freebsd |190
|   8 | 4.2
 perf-x86_64-penryn-O3-polly-unprofitable   |249 |
10 | 4.0
 clang-cmake-aarch64-42vma  |150
|   6 | 4.0
 llvm-sphinx-docs   |100
|   4 | 4.0
 sanitizer-x86_64-linux | 77
|   3 | 3.9
 

r269701 - Revert "Reapply^2 "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC""

2016-05-16 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Mon May 16 16:04:19 2016
New Revision: 269701

URL: http://llvm.org/viewvc/llvm-project?rev=269701=rev
Log:
Revert "Reapply^2 "[ProfileData] (clang) Use Error in InstrProf and Coverage, 
NFC""

This reverts commit r269695. The llvm commit does not pass the MSVC bot.

Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=269701=269700=269701=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon May 16 16:04:19 2016
@@ -141,13 +141,11 @@ CodeGenModule::CodeGenModule(ASTContext
   if (CodeGenOpts.hasProfileClangUse()) {
 auto ReaderOrErr = llvm::IndexedInstrProfReader::create(
 CodeGenOpts.ProfileInstrumentUsePath);
-if (auto E = ReaderOrErr.takeError()) {
+if (std::error_code EC = ReaderOrErr.getError()) {
   unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
   "Could not read profile %0: %1");
-  llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase ) {
-getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
-  << EI.message();
-  });
+  getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
+<< EC.message();
 } else
   PGOReader = std::move(ReaderOrErr.get());
   }

Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=269701=269700=269701=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Mon May 16 16:04:19 2016
@@ -800,21 +800,20 @@ void CodeGenPGO::loadRegionCounts(llvm::
   bool IsInMainFile) {
   CGM.getPGOStats().addVisited(IsInMainFile);
   RegionCounts.clear();
-  llvm::Expected RecordExpected =
+  llvm::ErrorOr RecordErrorOr =
   PGOReader->getInstrProfRecord(FuncName, FunctionHash);
-  if (auto E = RecordExpected.takeError()) {
-auto IPE = llvm::InstrProfError::take(std::move(E));
-if (IPE == llvm::instrprof_error::unknown_function)
+  if (std::error_code EC = RecordErrorOr.getError()) {
+if (EC == llvm::instrprof_error::unknown_function)
   CGM.getPGOStats().addMissing(IsInMainFile);
-else if (IPE == llvm::instrprof_error::hash_mismatch)
+else if (EC == llvm::instrprof_error::hash_mismatch)
   CGM.getPGOStats().addMismatched(IsInMainFile);
-else if (IPE == llvm::instrprof_error::malformed)
+else if (EC == llvm::instrprof_error::malformed)
   // TODO: Consider a more specific warning for this case.
   CGM.getPGOStats().addMismatched(IsInMainFile);
 return;
   }
   ProfRecord =
-  
llvm::make_unique(std::move(RecordExpected.get()));
+  llvm::make_unique(std::move(RecordErrorOr.get()));
   RegionCounts = ProfRecord->Counts;
 }
 

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=269701=269700=269701=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon May 16 16:04:19 2016
@@ -403,8 +403,7 @@ static void setPGOUseInstrumentor(CodeGe
   const std::string ProfileName) {
   auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName);
   // In error, return silently and let Clang PGOUse report the error message.
-  if (auto E = ReaderOrErr.takeError()) {
-llvm::consumeError(std::move(E));
+  if (ReaderOrErr.getError()) {
 Opts.setProfileUse(CodeGenOptions::ProfileClangInstr);
 return;
   }


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


r269695 - Reapply^2 "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"

2016-05-16 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Mon May 16 15:50:13 2016
New Revision: 269695

URL: http://llvm.org/viewvc/llvm-project?rev=269695=rev
Log:
Reapply^2 "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"

Sync up with "(llvm) Use Error in InstrProf and Coverage".

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

Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=269695=269694=269695=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon May 16 15:50:13 2016
@@ -141,11 +141,13 @@ CodeGenModule::CodeGenModule(ASTContext
   if (CodeGenOpts.hasProfileClangUse()) {
 auto ReaderOrErr = llvm::IndexedInstrProfReader::create(
 CodeGenOpts.ProfileInstrumentUsePath);
-if (std::error_code EC = ReaderOrErr.getError()) {
+if (auto E = ReaderOrErr.takeError()) {
   unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
   "Could not read profile %0: %1");
-  getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
-<< EC.message();
+  llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase ) {
+getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
+  << EI.message();
+  });
 } else
   PGOReader = std::move(ReaderOrErr.get());
   }

Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=269695=269694=269695=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Mon May 16 15:50:13 2016
@@ -800,20 +800,21 @@ void CodeGenPGO::loadRegionCounts(llvm::
   bool IsInMainFile) {
   CGM.getPGOStats().addVisited(IsInMainFile);
   RegionCounts.clear();
-  llvm::ErrorOr RecordErrorOr =
+  llvm::Expected RecordExpected =
   PGOReader->getInstrProfRecord(FuncName, FunctionHash);
-  if (std::error_code EC = RecordErrorOr.getError()) {
-if (EC == llvm::instrprof_error::unknown_function)
+  if (auto E = RecordExpected.takeError()) {
+auto IPE = llvm::InstrProfError::take(std::move(E));
+if (IPE == llvm::instrprof_error::unknown_function)
   CGM.getPGOStats().addMissing(IsInMainFile);
-else if (EC == llvm::instrprof_error::hash_mismatch)
+else if (IPE == llvm::instrprof_error::hash_mismatch)
   CGM.getPGOStats().addMismatched(IsInMainFile);
-else if (EC == llvm::instrprof_error::malformed)
+else if (IPE == llvm::instrprof_error::malformed)
   // TODO: Consider a more specific warning for this case.
   CGM.getPGOStats().addMismatched(IsInMainFile);
 return;
   }
   ProfRecord =
-  llvm::make_unique(std::move(RecordErrorOr.get()));
+  
llvm::make_unique(std::move(RecordExpected.get()));
   RegionCounts = ProfRecord->Counts;
 }
 

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=269695=269694=269695=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon May 16 15:50:13 2016
@@ -403,7 +403,8 @@ static void setPGOUseInstrumentor(CodeGe
   const std::string ProfileName) {
   auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName);
   // In error, return silently and let Clang PGOUse report the error message.
-  if (ReaderOrErr.getError()) {
+  if (auto E = ReaderOrErr.takeError()) {
+llvm::consumeError(std::move(E));
 Opts.setProfileUse(CodeGenOptions::ProfileClangInstr);
 return;
   }


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


r269693 - Added support to the ASTImporter for C++ constructor initializers.

2016-05-16 Thread Sean Callanan via cfe-commits
Author: spyffe
Date: Mon May 16 15:48:03 2016
New Revision: 269693

URL: http://llvm.org/viewvc/llvm-project?rev=269693=rev
Log:
Added support to the ASTImporter for C++ constructor initializers.
Also added named casts and propagation of "implicit" to fix the LLDB testsuite.
This is a fixed commit of r269546, which was reverted by r269575.

Thanks to Aleksei Sidorin for review and advice.

Added:
cfe/trunk/test/ASTMerge/Inputs/init-ctors-classes.cpp
cfe/trunk/test/ASTMerge/init-ctors.cpp
Modified:
cfe/trunk/include/clang/AST/ASTImporter.h
cfe/trunk/lib/AST/ASTImporter.cpp

Modified: cfe/trunk/include/clang/AST/ASTImporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTImporter.h?rev=269693=269692=269693=diff
==
--- cfe/trunk/include/clang/AST/ASTImporter.h (original)
+++ cfe/trunk/include/clang/AST/ASTImporter.h Mon May 16 15:48:03 2016
@@ -23,6 +23,7 @@
 
 namespace clang {
   class ASTContext;
+  class CXXCtorInitializer;
   class Decl;
   class DeclContext;
   class DiagnosticsEngine;
@@ -204,6 +205,14 @@ namespace clang {
 /// \returns the equivalent file ID in the source manager of the "to"
 /// context.
 FileID Import(FileID);
+
+/// \brief Import the given C++ constructor initializer from the "from"
+/// context into the "to" context.
+///
+/// \returns the equivalent initializer in the "to" context.
+CXXCtorInitializer *Import(CXXCtorInitializer *FromInit);
+
+
 
 /// \brief Import the definition of the given declaration, including all of
 /// the declarations it contains.

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=269693=269692=269693=diff
==
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Mon May 16 15:48:03 2016
@@ -252,6 +252,8 @@ namespace clang {
 Expr *VisitMemberExpr(MemberExpr *E);
 Expr *VisitCallExpr(CallExpr *E);
 Expr *VisitInitListExpr(InitListExpr *E);
+Expr *VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E);
+Expr *VisitCXXNamedCastExpr(CXXNamedCastExpr *E);
 
 template
 void ImportArray(IIter Ibegin, IIter Iend, OIter Obegin) {
@@ -3029,6 +3031,22 @@ Decl *ASTNodeImporter::VisitFunctionDecl
 D->isInlineSpecified(), 
 D->isImplicit(),
 D->isConstexpr());
+if (unsigned NumInitializers = FromConstructor->getNumCtorInitializers()) {
+  SmallVector CtorInitializers;
+  for (CXXCtorInitializer *I : FromConstructor->inits()) {
+CXXCtorInitializer *ToI =
+cast_or_null(Importer.Import(I));
+if (!ToI && I)
+  return nullptr;
+CtorInitializers.push_back(ToI);
+  }
+  CXXCtorInitializer **Memory =
+  new (Importer.getToContext()) CXXCtorInitializer *[NumInitializers];
+  std::copy(CtorInitializers.begin(), CtorInitializers.end(), Memory);
+  CXXConstructorDecl *ToCtor = llvm::cast(ToFunction);
+  ToCtor->setCtorInitializers(Memory);
+  ToCtor->setNumCtorInitializers(NumInitializers);
+}
   } else if (isa(D)) {
 ToFunction = CXXDestructorDecl::Create(Importer.getToContext(),
cast(DC),
@@ -5779,12 +5797,12 @@ Expr *ASTNodeImporter::VisitCXXConstruct
 return nullptr;
 
   NamedDecl *ToFound =
-dyn_cast(Importer.Import(E->getFoundDecl()));
+dyn_cast_or_null(Importer.Import(E->getFoundDecl()));
   if (!ToFound)
 return nullptr;
 
   CXXConstructorDecl *ToCCD =
-dyn_cast(Importer.Import(E->getConstructor()));
+dyn_cast_or_null(Importer.Import(E->getConstructor()));
   if (!ToCCD)
 return nullptr;
 
@@ -5955,6 +5973,50 @@ Expr *ASTNodeImporter::VisitInitListExpr
   return To;
 }
 
+Expr *ASTNodeImporter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *DIE) {
+  FieldDecl *ToField = llvm::dyn_cast_or_null(
+  Importer.Import(DIE->getField()));
+  if (!ToField && DIE->getField())
+return nullptr;
+
+  return CXXDefaultInitExpr::Create(
+  Importer.getToContext(), Importer.Import(DIE->getLocStart()), ToField);
+}
+
+Expr *ASTNodeImporter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
+  QualType ToType = Importer.Import(E->getType());
+  if (ToType.isNull() && !E->getType().isNull())
+return nullptr;
+  ExprValueKind VK = E->getValueKind();
+  CastKind CK = E->getCastKind();
+  Expr *ToOp = Importer.Import(E->getSubExpr());
+  if (!ToOp && E->getSubExpr())
+return nullptr;
+  CXXCastPath BasePath;
+  if (ImportCastPath(E, BasePath))
+return nullptr;
+  TypeSourceInfo *ToWritten = Importer.Import(E->getTypeInfoAsWritten());
+  SourceLocation ToOperatorLoc = Importer.Import(E->getOperatorLoc());
+  SourceLocation 

Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications

2016-05-16 Thread don hinton via cfe-commits
hintonda added inline comments.


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:21
@@ +20,3 @@
+
+static StringRef
+makeDynamicExceptionString(const SourceManager ,

aaron.ballman wrote:
> Instead of a bunch of static functions, would an unnamed namespace make more 
> sense?
Just following the pattern established in other checkers so as to minimize the 
number of changes, but will change to namespace.


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:34
@@ +33,3 @@
+
+static CharSourceRange makeMoveRange(const SourceManager ,
+ const LangOptions ,

aaron.ballman wrote:
> Since this function is only called one time and is a one-liner, perhaps it 
> makes more sense to inline the body at the call site?
Was a bit more involved, but last round of changes simplified it.  Will 
simplify even more.


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:46
@@ +45,3 @@
+   const SmallVector ) {
+  // Find throw token -- it's a keyword, so there can't be more than one.  
Also,
+  // it should be near the end of the declaration, so search from the end.

aaron.ballman wrote:
> Pathologically terrible counter-case: `void func() throw(decltype(throw 12) 
> *)`
Good point, looks like I need a full fledged parser to catch 100% or the cases 
-- or we could ignore these corner cases.


Comment at: clang-tidy/modernize/UseNoexceptCheck.h:22
@@ +21,3 @@
+/// \brief Replace dynamic exception specifications, with
+/// `noexcept` (or user-defined macro) or `noexcept(true)`.
+/// \code

aaron.ballman wrote:
> I think this comment means `noexcept(false)` instead? Or is there a reason to 
> replace with `noexcept(true)` instead of just `noexcept`?
Typo, should just be noexcept.


http://reviews.llvm.org/D18575



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


Does anyone need these zorg modules?

2016-05-16 Thread Galina Kistanova via cfe-commits
Hello everyone,

I am cleaning zorg a little and going to remove the next builder modules
since they are not in use for a long time now:
If anyone have plans for any of them please speak up!

ChrootSetup.py
DragonEggBuilder.py
KLEEBuilder.py
ScriptedBuilder.py
gccSuiteBuilder.py

Thanks

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


Re: [PATCH] D20133: [OpenCL] Fix __builtin_astype for vec3 types.

2016-05-16 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 57393.
yaxunl added a comment.

Update test.


http://reviews.llvm.org/D20133

Files:
  lib/CodeGen/CGExprScalar.cpp
  test/CodeGenOpenCL/as_type.cl

Index: test/CodeGenOpenCL/as_type.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/as_type.cl
@@ -0,0 +1,64 @@
+// RUN: %clang_cc1 %s -emit-llvm -triple spir-unknown-unknown -o - | FileCheck %s
+
+typedef __attribute__(( ext_vector_type(3) )) char char3;
+typedef __attribute__(( ext_vector_type(4) )) char char4;
+typedef __attribute__(( ext_vector_type(16) )) char char16;
+typedef __attribute__(( ext_vector_type(3) )) int int3;
+
+//CHECK: define spir_func <3 x i8> @f1(<4 x i8> %[[x:.*]])
+//CHECK: %[[astype:.*]] = shufflevector <4 x i8> %[[x]], <4 x i8> undef, <3 x i32> 
+//CHECK: ret <3 x i8> %[[astype]]
+char3 f1(char4 x) {
+  return  __builtin_astype(x, char3);
+}
+
+//CHECK: define spir_func <4 x i8> @f2(<3 x i8> %[[x:.*]])
+//CHECK: %[[astype:.*]] = shufflevector <3 x i8> %[[x]], <3 x i8> undef, <4 x i32> 
+//CHECK: ret <4 x i8> %[[astype]]
+char4 f2(char3 x) {
+  return __builtin_astype(x, char4);
+}
+
+//CHECK: define spir_func <3 x i8> @f3(i32 %[[x:.*]])
+//CHECK: %[[cast:.*]] = bitcast i32 %[[x]] to <4 x i8>
+//CHECK: %[[astype:.*]] = shufflevector <4 x i8> %[[cast]], <4 x i8> undef, <3 x i32> 
+//CHECK: ret <3 x i8> %[[astype]]
+char3 f3(int x) {
+  return __builtin_astype(x, char3);
+}
+
+//CHECK: define spir_func <4 x i8> @f4(i32 %[[x:.*]])
+//CHECK: %[[astype:.*]] = bitcast i32 %[[x]] to <4 x i8>
+//CHECK: ret <4 x i8> %[[astype]]
+char4 f4(int x) {
+  return __builtin_astype(x, char4);
+}
+
+//CHECK: define spir_func i32 @f5(<3 x i8> %[[x:.*]])
+//CHECK: %[[shuffle:.*]] = shufflevector <3 x i8> %[[x]], <3 x i8> undef, <4 x i32> 
+//CHECK: %[[astype:.*]] = bitcast <4 x i8> %[[shuffle]] to i32
+//CHECK: ret i32 %[[astype]]
+int f5(char3 x) {
+  return __builtin_astype(x, int);
+}
+
+//CHECK: define spir_func i32 @f6(<4 x i8> %[[x:.*]])
+//CHECK: %[[astype]] = bitcast <4 x i8> %[[x]] to i32
+//CHECK: ret i32 %[[astype]]
+int f6(char4 x) {
+  return __builtin_astype(x, int);
+}
+
+//CHECK: define spir_func <3 x i8> @f7(<3 x i8> %[[x:.*]])
+//CHECK: ret <3 x i8> %[[x]]
+char3 f7(char3 x) {
+  return __builtin_astype(x, char3);
+}
+
+//CHECK: define spir_func <3 x i32> @f8(<16 x i8> %[[x:.*]])
+//CHECK: %[[cast:.*]] = bitcast <16 x i8> %[[x]] to <4 x i32>
+//CHECK: %[[astype:.*]] = shufflevector <4 x i32> %[[cast]], <4 x i32> undef, <3 x i32> 
+//CHECK: ret <3 x i32> %[[astype]]
+int3 f8(char16 x) {
+  return __builtin_astype(x, int3);
+}
Index: lib/CodeGen/CGExprScalar.cpp
===
--- lib/CodeGen/CGExprScalar.cpp
+++ lib/CodeGen/CGExprScalar.cpp
@@ -3398,50 +3398,48 @@
   return CGF.EmitBlockLiteral(block);
 }
 
+// Convert a vec3 to vec4, or vice versa.
+static Value *ConvertVec3AndVec4(CGBuilderTy , CodeGenFunction ,
+  Value *Src, unsigned numElementsDst) {
+  llvm::Value *UnV = llvm::UndefValue::get(Src->getType());
+  SmallVector Args;
+  Args.push_back(Builder.getInt32(0));
+  Args.push_back(Builder.getInt32(1));
+  Args.push_back(Builder.getInt32(2));
+  if (numElementsDst == 4)
+Args.push_back(llvm::UndefValue::get(CGF.Int32Ty));
+  llvm::Constant *Mask = llvm::ConstantVector::get(Args);
+  return Builder.CreateShuffleVector(Src, UnV, Mask);
+}
+
 Value *ScalarExprEmitter::VisitAsTypeExpr(AsTypeExpr *E) {
   Value *Src  = CGF.EmitScalarExpr(E->getSrcExpr());
   llvm::Type *DstTy = ConvertType(E->getType());
 
-  // Going from vec4->vec3 or vec3->vec4 is a special case and requires
-  // a shuffle vector instead of a bitcast.
   llvm::Type *SrcTy = Src->getType();
-  if (isa(DstTy) && isa(SrcTy)) {
-unsigned numElementsDst = cast(DstTy)->getNumElements();
-unsigned numElementsSrc = cast(SrcTy)->getNumElements();
-if ((numElementsDst == 3 && numElementsSrc == 4)
-|| (numElementsDst == 4 && numElementsSrc == 3)) {
-
-
-  // In the case of going from int4->float3, a bitcast is needed before
-  // doing a shuffle.
-  llvm::Type *srcElemTy =
-  cast(SrcTy)->getElementType();
-  llvm::Type *dstElemTy =
-  cast(DstTy)->getElementType();
-
-  if ((srcElemTy->isIntegerTy() && dstElemTy->isFloatTy())
-  || (srcElemTy->isFloatTy() && dstElemTy->isIntegerTy())) {
-// Create a float type of the same size as the source or destination.
-llvm::VectorType *newSrcTy = llvm::VectorType::get(dstElemTy,
- numElementsSrc);
-
-Src = Builder.CreateBitCast(Src, newSrcTy, "astypeCast");
-  }
-
-  llvm::Value *UnV = llvm::UndefValue::get(Src->getType());
-
-  SmallVector Args;
-  Args.push_back(Builder.getInt32(0));
-  Args.push_back(Builder.getInt32(1));
-  Args.push_back(Builder.getInt32(2));
-
-  if 

Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications

2016-05-16 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:21
@@ +20,3 @@
+
+static StringRef
+makeDynamicExceptionString(const SourceManager ,

Instead of a bunch of static functions, would an unnamed namespace make more 
sense?


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:34
@@ +33,3 @@
+
+static CharSourceRange makeMoveRange(const SourceManager ,
+ const LangOptions ,

Since this function is only called one time and is a one-liner, perhaps it 
makes more sense to inline the body at the call site?


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:46
@@ +45,3 @@
+   const SmallVector ) {
+  // Find throw token -- it's a keyword, so there can't be more than one.  
Also,
+  // it should be near the end of the declaration, so search from the end.

Pathologically terrible counter-case: `void func() throw(decltype(throw 12) *)`


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:49
@@ +48,3 @@
+  int TokenIndex;
+  for (TokenIndex = Tokens.size() - 1; TokenIndex != -1; --TokenIndex) {
+if (Tokens[TokenIndex].is(tok::kw_throw))

Can we use `>= 0` instead of `!= -1`? It makes it more immediately obvious that 
the array index will not underflow.


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:100
@@ +99,3 @@
+
+  auto FileMoveRange = createReplacementRange(SM, getLangOpts(), Tokens);
+

Please don't use `auto` here; I have no idea what type `FileMoveRange` will 
have from inspecting the code.


Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:108
@@ +107,3 @@
+
+  diag(FuncDecl->getLocation(), "function '%0' uses dynamic exception "
+"specification '%1'")

No need to quote %0, the diagnostics engine will already do it when passed a 
NamedDecl, so this will improperly double-quote the diagnostic.


Comment at: clang-tidy/modernize/UseNoexceptCheck.h:22
@@ +21,3 @@
+/// \brief Replace dynamic exception specifications, with
+/// `noexcept` (or user-defined macro) or `noexcept(true)`.
+/// \code

I think this comment means `noexcept(false)` instead? Or is there a reason to 
replace with `noexcept(true)` instead of just `noexcept`?


Comment at: test/clang-tidy/modernize-use-noexcept-macro.cpp:11
@@ +10,3 @@
+
+// Should not trigger a FixItHint
+class A {};

I may have missed some context in the discussion, but why shouldn't this 
trigger a FixItHint?


http://reviews.llvm.org/D18575



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


Re: [PATCH] D20133: [OpenCL] Fix __builtin_astype for vec3 types.

2016-05-16 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 57392.
yaxunl added a comment.

Add a test for casting char16 to i3 as Alexey suggested.


http://reviews.llvm.org/D20133

Files:
  lib/CodeGen/CGExprScalar.cpp
  test/CodeGenOpenCL/as_type.cl

Index: test/CodeGenOpenCL/as_type.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/as_type.cl
@@ -0,0 +1,63 @@
+// RUN: %clang_cc1 %s -emit-llvm -triple spir-unknown-unknown -o - | FileCheck %s
+
+typedef __attribute__(( ext_vector_type(3) )) char char3;
+typedef __attribute__(( ext_vector_type(4) )) char char4;
+
+//CHECK: define spir_func <3 x i8> @f1(<4 x i8> %[[x:.*]])
+//CHECK: %[[astype:.*]] = shufflevector <4 x i8> %[[x]], <4 x i8> undef, <3 x i32> 
+//CHECK: ret <3 x i8> %[[astype]]
+char3 f1(char4 x) {
+  return  __builtin_astype(x, char3);
+}
+
+//CHECK: define spir_func <4 x i8> @f2(<3 x i8> %[[x:.*]])
+//CHECK: %[[astype:.*]] = shufflevector <3 x i8> %[[x]], <3 x i8> undef, <4 x i32> 
+//CHECK: ret <4 x i8> %[[astype]]
+char4 f2(char3 x) {
+  return __builtin_astype(x, char4);
+}
+
+//CHECK: define spir_func <3 x i8> @f3(i32 %[[x:.*]])
+//CHECK: %[[cast:.*]] = bitcast i32 %[[x]] to <4 x i8>
+//CHECK: %[[astype:.*]] = shufflevector <4 x i8> %[[cast]], <4 x i8> undef, <3 x i32> 
+//CHECK: ret <3 x i8> %[[astype]]
+char3 f3(int x) {
+  return __builtin_astype(x, char3);
+}
+
+//CHECK: define spir_func <4 x i8> @f4(i32 %[[x:.*]])
+//CHECK: %[[astype:.*]] = bitcast i32 %[[x]] to <4 x i8>
+//CHECK: ret <4 x i8> %[[astype]]
+char4 f4(int x) {
+  return __builtin_astype(x, char4);
+}
+
+//CHECK: define spir_func i32 @f5(<3 x i8> %[[x:.*]])
+//CHECK: %[[shuffle:.*]] = shufflevector <3 x i8> %[[x]], <3 x i8> undef, <4 x i32> 
+//CHECK: %[[astype:.*]] = bitcast <4 x i8> %[[shuffle]] to i32
+//CHECK: ret i32 %[[astype]]
+int f5(char3 x) {
+  return __builtin_astype(x, int);
+}
+
+//CHECK: define spir_func i32 @f6(<4 x i8> %[[x:.*]])
+//CHECK: %[[astype]] = bitcast <4 x i8> %[[x]] to i32
+//CHECK: ret i32 %[[astype]]
+int f6(char4 x) {
+  return __builtin_astype(x, int);
+}
+
+//CHECK: define spir_func <3 x i8> @f7(<3 x i8> %[[x:.*]])
+//CHECK: ret <3 x i8> %[[x]]
+char3 f7(char3 x) {
+  return __builtin_astype(x, char3);
+}
+
+//CHECK: define spir_func <3 x i32> @f3(<16 x i8> %[[x:.*]])
+//CHECK: %[[cast:.*]] = bitcast <16 x i8> %[[x]] to <4 x i32>
+//CHECK: %[[astype:.*]] = shufflevector <4 x i32> %[[cast]], <4 x i32> undef, <3 x i32> 
+//CHECK: ret <3 x i32> %[[astype]]
+int3 f8(char16 x) {
+  return __builtin_astype(x, int3);
+}
+}
Index: lib/CodeGen/CGExprScalar.cpp
===
--- lib/CodeGen/CGExprScalar.cpp
+++ lib/CodeGen/CGExprScalar.cpp
@@ -3398,50 +3398,48 @@
   return CGF.EmitBlockLiteral(block);
 }
 
+// Convert a vec3 to vec4, or vice versa.
+static Value *ConvertVec3AndVec4(CGBuilderTy , CodeGenFunction ,
+  Value *Src, unsigned numElementsDst) {
+  llvm::Value *UnV = llvm::UndefValue::get(Src->getType());
+  SmallVector Args;
+  Args.push_back(Builder.getInt32(0));
+  Args.push_back(Builder.getInt32(1));
+  Args.push_back(Builder.getInt32(2));
+  if (numElementsDst == 4)
+Args.push_back(llvm::UndefValue::get(CGF.Int32Ty));
+  llvm::Constant *Mask = llvm::ConstantVector::get(Args);
+  return Builder.CreateShuffleVector(Src, UnV, Mask);
+}
+
 Value *ScalarExprEmitter::VisitAsTypeExpr(AsTypeExpr *E) {
   Value *Src  = CGF.EmitScalarExpr(E->getSrcExpr());
   llvm::Type *DstTy = ConvertType(E->getType());
 
-  // Going from vec4->vec3 or vec3->vec4 is a special case and requires
-  // a shuffle vector instead of a bitcast.
   llvm::Type *SrcTy = Src->getType();
-  if (isa(DstTy) && isa(SrcTy)) {
-unsigned numElementsDst = cast(DstTy)->getNumElements();
-unsigned numElementsSrc = cast(SrcTy)->getNumElements();
-if ((numElementsDst == 3 && numElementsSrc == 4)
-|| (numElementsDst == 4 && numElementsSrc == 3)) {
-
-
-  // In the case of going from int4->float3, a bitcast is needed before
-  // doing a shuffle.
-  llvm::Type *srcElemTy =
-  cast(SrcTy)->getElementType();
-  llvm::Type *dstElemTy =
-  cast(DstTy)->getElementType();
-
-  if ((srcElemTy->isIntegerTy() && dstElemTy->isFloatTy())
-  || (srcElemTy->isFloatTy() && dstElemTy->isIntegerTy())) {
-// Create a float type of the same size as the source or destination.
-llvm::VectorType *newSrcTy = llvm::VectorType::get(dstElemTy,
- numElementsSrc);
-
-Src = Builder.CreateBitCast(Src, newSrcTy, "astypeCast");
-  }
-
-  llvm::Value *UnV = llvm::UndefValue::get(Src->getType());
-
-  SmallVector Args;
-  Args.push_back(Builder.getInt32(0));
-  Args.push_back(Builder.getInt32(1));
-  Args.push_back(Builder.getInt32(2));
-
-  if (numElementsDst == 4)
-

r269687 - [Lex] inferModuleFromLocation should do no work if there are no modules

2016-05-16 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Mon May 16 15:30:03 2016
New Revision: 269687

URL: http://llvm.org/viewvc/llvm-project?rev=269687=rev
Log:
[Lex] inferModuleFromLocation should do no work if there are no modules

getModuleContainingLocation ends up on the hot-path for typical C code
which can lead to calls to getFileIDSlow.

To speed this up, short circuit inferModuleFromLocation when there
aren't any modules, implicit or otherwise.

This shaves 4-5% build time when building the linux kernel.

Modified:
cfe/trunk/lib/Lex/ModuleMap.cpp

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=269687=269686=269687=diff
==
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Mon May 16 15:30:03 2016
@@ -917,6 +917,9 @@ Module *ModuleMap::inferModuleFromLocati
   if (Loc.isInvalid())
 return nullptr;
 
+  if (UmbrellaDirs.empty() && Headers.empty())
+return nullptr;
+
   // Use the expansion location to determine which module we're in.
   FullSourceLoc ExpansionLoc = Loc.getExpansionLoc();
   if (!ExpansionLoc.isFileID())


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


Re: [PATCH] D19909: [Attr] Add support for the `ms_hook_prologue` attribute.

2016-05-16 Thread Charles Davis via cfe-commits
cdavis5x marked an inline comment as done.


Comment at: include/clang/Basic/Attr.td:2032
@@ -2031,1 +2031,3 @@
 
+def MSHookPrologue : InheritableAttr {
+  let Spellings = [GCC<"ms_hook_prologue">];

aaron.ballman wrote:
> Does this attribute appertain to all targets, or only targets that MSVC 
> supports?
Only to //CPUs// that MSVC supports, but it works on all OSes--even non-Windows 
ones.

I should mention that this attribute was specifically added to GCC so Wine 
could use it.


http://reviews.llvm.org/D19909



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


Re: [PATCH] D19909: [Attr] Add support for the `ms_hook_prologue` attribute.

2016-05-16 Thread Charles Davis via cfe-commits
cdavis5x updated this revision to Diff 57389.
cdavis5x added a comment.

- Use Sanjoy's `patchable-function` attribute.
- Add documentation for this new attribute.


http://reviews.llvm.org/D19909

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

Index: test/CodeGen/function-attributes.c
===
--- test/CodeGen/function-attributes.c
+++ test/CodeGen/function-attributes.c
@@ -108,11 +108,18 @@
   _setjmp(0);
 }
 
+// CHECK-LABEL: define void @f21
+// CHECK: [[HOTPATCH:#[0-9]+]]
+// CHECK: {
+void __attribute__((ms_hook_prologue)) f21(void) {
+}
+
 // CHECK: attributes [[NUW]] = { nounwind optsize{{.*}} }
 // CHECK: attributes [[AI]] = { alwaysinline nounwind optsize{{.*}} }
 // CHECK: attributes [[NUW_OS_RN]] = { nounwind optsize readnone{{.*}} }
 // CHECK: attributes [[ALIGN]] = { nounwind optsize alignstack=16{{.*}} }
 // CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} }
+// CHECK: attributes [[HOTPATCH]] = { nounwind optsize{{.*}}"patchable-function"="ms-hotpatch"{{.*}} }
 // CHECK: attributes [[NR]] = { noreturn optsize }
 // CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone }
 // CHECK: attributes [[RT_CALL]] = { optsize returns_twice }
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -5748,6 +5748,9 @@
 break;
 
   // Microsoft attributes:
+  case AttributeList::AT_MSHookPrologue:
+handleSimpleAttribute(S, D, Attr);
+break;
   case AttributeList::AT_MSNoVTable:
 handleSimpleAttribute(S, D, Attr);
 break;
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -1749,6 +1749,10 @@
   llvm::Function *Fn = cast(GV);
   Fn->setCallingConv(llvm::CallingConv::X86_INTR);
 }
+if (FD->hasAttr()) {
+  llvm::Function *Fn = cast(GV);
+  Fn->addFnAttr("patchable-function", "ms-hotpatch");
+}
   }
 }
 
@@ -2079,6 +2083,10 @@
 llvm::Function *Fn = cast(GV);
 Fn->setCallingConv(llvm::CallingConv::X86_INTR);
   }
+  if (FD->hasAttr()) {
+llvm::Function *Fn = cast(GV);
+Fn->addFnAttr("patchable-function", "ms-hotpatch");
+  }
 }
   }
 };
Index: include/clang/Basic/AttrDocs.td
===
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -494,6 +494,19 @@
   }];
 }
 
+def MSHookPrologueDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+The ``ms_hook_prologue`` attribute marks a function as "hotpatchable" according
+to conventions used on Windows. Specifically, enough space will be ensured
+in the prologue for a short jump, and an architecturally dependently sized
+patch space will be reserved prior to the entry point. See the documentation
+for the `/HOTPATCH`_ switch on MSDN.
+
+.. _`/HOTPATCH/: https://msdn.microsoft.com/en-us/library/ms173507.aspx
+  }];
+}
+
 def NoDebugDocs : Documentation {
   let Category = DocCatVariable;
   let Content = [{
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -2029,6 +2029,12 @@
 
 // Microsoft-related attributes
 
+def MSHookPrologue : InheritableAttr {
+  let Spellings = [GCC<"ms_hook_prologue">];
+  let Subjects = SubjectList<[Function]>;
+  let Documentation = [MSHookPrologueDocs];
+}
+
 def MSNoVTable : InheritableAttr, TargetSpecificAttr {
   let Spellings = [Declspec<"novtable">];
   let Subjects = SubjectList<[CXXRecord]>;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20277: [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved.

2016-05-16 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments.


Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:83
@@ +82,3 @@
+  if (!IsConstQualified) {
+auto Matches = utils::decl_ref_expr::allDeclRefExprs(
+*Param, *Function->getBody(), *Result.Context);

We should not call this more than once as it is a potentially expensive 
operation.
That is, isOnlyUsedAsConst will do it too.
Also, in this case we don't care about _all_. We only care about != 1.


Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:144
@@ +143,3 @@
+  Diag << FixItHint::CreateReplacement(
+  CopyArgument.getSourceRange(),
+  (Twine("std::move(") + Var.getName() + ")").str());

Prefer two additions over a replacement.
They usually behave better in some conditions.


Comment at: clang-tidy/utils/DeclRefExprUtils.cpp:102
@@ +101,3 @@
+  auto Matches =
+  match(findAll(cxxConstructExpr(
+UsedAsConstRefArg,

why findAll() ?
You only care about one.

same as below.


Comment at: clang-tidy/utils/TypeTraits.cpp:131
@@ +130,3 @@
+  for (const auto *Constructor : Record->ctors()) {
+if (Constructor->isMoveConstructor() && !Constructor->isDeleted())
+  return true;

maybe also check that it is not trivial?

below too.


Repository:
  rL LLVM

http://reviews.llvm.org/D20277



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


[PATCH] D20296: clang-rename: avoid StringRef members in USRLocFindingASTVisitor

2016-05-16 Thread Miklos Vajna via cfe-commits
vmiklos created this revision.
vmiklos added reviewers: klimek, cfe-commits.

Even if this is defined in the .cpp file and only used as part of the
function (so here it's safe), usually storing StringRefs in the class is
dangerous, so don't do so.

http://reviews.llvm.org/D20296

Files:
  clang-rename/USRLocFinder.cpp

Index: clang-rename/USRLocFinder.cpp
===
--- clang-rename/USRLocFinder.cpp
+++ clang-rename/USRLocFinder.cpp
@@ -123,9 +123,9 @@
   }
 
   // All the locations of the USR were found.
-  StringRef USR;
+  const std::string USR;
   // Old name that is renamed.
-  StringRef PrevName;
+  const std::string PrevName;
   std::vector LocationsFound;
 };
 } // namespace


Index: clang-rename/USRLocFinder.cpp
===
--- clang-rename/USRLocFinder.cpp
+++ clang-rename/USRLocFinder.cpp
@@ -123,9 +123,9 @@
   }
 
   // All the locations of the USR were found.
-  StringRef USR;
+  const std::string USR;
   // Old name that is renamed.
-  StringRef PrevName;
+  const std::string PrevName;
   std::vector LocationsFound;
 };
 } // namespace
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r269680 - [Clang][AVX512] completing missing intrinsics for [vpabs] instruction set

2016-05-16 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Mon May 16 13:57:24 2016
New Revision: 269680

URL: http://llvm.org/viewvc/llvm-project?rev=269680=rev
Log:
[Clang][AVX512] completing missing intrinsics for [vpabs] instruction set

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

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

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=269680=269679=269680=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Mon May 16 13:57:24 2016
@@ -1631,6 +1631,23 @@ _mm512_abs_epi64(__m512i __A)
  (__mmask8) -1);
 }
 
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_abs_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
+{
+  return (__m512i) __builtin_ia32_pabsq512_mask ((__v8di) __A,
+  (__v8di) __W,
+  (__mmask8) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_abs_epi64 (__mmask8 __U, __m512i __A)
+{
+  return (__m512i) __builtin_ia32_pabsq512_mask ((__v8di) __A,
+  (__v8di)
+  _mm512_setzero_si512 (),
+  (__mmask8) __U);
+}
+
 static __inline __m512i __DEFAULT_FN_ATTRS
 _mm512_abs_epi32(__m512i __A)
 {
@@ -1640,6 +1657,23 @@ _mm512_abs_epi32(__m512i __A)
  (__mmask16) -1);
 }
 
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_abs_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
+{
+  return (__m512i) __builtin_ia32_pabsd512_mask ((__v16si) __A,
+  (__v16si) __W,
+  (__mmask16) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_abs_epi32 (__mmask16 __U, __m512i __A)
+{
+  return (__m512i) __builtin_ia32_pabsd512_mask ((__v16si) __A,
+  (__v16si)
+  _mm512_setzero_si512 (),
+  (__mmask16) __U);
+}
+
 static __inline__ __m128 __DEFAULT_FN_ATTRS
 _mm_mask_add_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) {
   return (__m128) __builtin_ia32_addss_round_mask ((__v4sf) __A,

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=269680=269679=269680=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Mon May 16 13:57:24 2016
@@ -6574,3 +6574,30 @@ __m512 test_mm512_set_ps (float __A, flo
   __I, __J, __K, __L, __M, __N, __O, __P);
 }
 
+__m512i test_mm512_mask_abs_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
+{
+  // CHECK-LABEL: @test_mm512_mask_abs_epi64 
+  // CHECK: @llvm.x86.avx512.mask.pabs.q.512
+  return _mm512_mask_abs_epi64 (__W,__U,__A);
+}
+
+__m512i test_mm512_maskz_abs_epi64 (__mmask8 __U, __m512i __A)
+{
+  // CHECK-LABEL: @test_mm512_maskz_abs_epi64 
+  // CHECK: @llvm.x86.avx512.mask.pabs.q.512
+  return _mm512_maskz_abs_epi64 (__U,__A);
+}
+
+__m512i test_mm512_mask_abs_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
+{
+  // CHECK-LABEL: @test_mm512_mask_abs_epi32 
+  // CHECK: @llvm.x86.avx512.mask.pabs.d.512
+  return _mm512_mask_abs_epi32 (__W,__U,__A);
+}
+
+__m512i test_mm512_maskz_abs_epi32 (__mmask16 __U, __m512i __A)
+{
+  // CHECK-LABEL: @test_mm512_maskz_abs_epi32 
+  // CHECK: @llvm.x86.avx512.mask.pabs.d.512
+  return _mm512_maskz_abs_epi32 (__U,__A);
+}


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


Re: [patch] Don't use appending linkage for embeded bitcode

2016-05-16 Thread Steven Wu via cfe-commits
Thanks! Committed in r269679

Steven

> On May 16, 2016, at 11:54 AM, Rafael EspĂ­ndola  
> wrote:
> 
> LGTM
> 
> On 16 May 2016 at 14:03, Steven Wu  wrote:
>> 
>>> On May 16, 2016, at 6:52 AM, Rafael EspĂ­ndola  
>>> wrote:
>>> 
>>> +  auto Used = collectUsedGlobalVariables(*M, UsedGlobals, true);
>>> 
>>> Please use an explicit type instead of auto.
>> 
>> Sure.
>> 
>>> 
>>> You deleted the assert
>> 
>> Are you referring to the assertion that llvm.embedded.module has no uses. I 
>> added it back to check it has exactly one use.
>> 
>> Attach the final patch with testcase.
>> 
>> Steven
>> 
>> 
>> 
>> 
>>> 
>>> I think this is fine otherwise.
>>> 
>>> Cheers,
>>> Rafael
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On 13 May 2016 at 20:00, Steven Wu  wrote:
 
> On May 13, 2016, at 3:56 PM, Duncan P. N. Exon Smith 
>  wrote:
> 
> Is this something that you need the linker to treat as "used", or just 
> something you don't want the compiler to drop?  If the latter, 
> @llvm.compiler.used seems more appropriate.
 
 Bitcode is actually not really used by the compiler during compilation and 
 shouldn't really used by any part of the code. llvm.compiler.used then.
 
 New patch.
 
 
 
 
 Steven
 
> 
>> On 2016-May-13, at 14:01, Steven Wu  wrote:
>> 
>> Attach a patch using private linkage type and adding to llvm.used. I 
>> have to recreate llvm.used when embedding bitcode. I don't really like 
>> it but I don't have better solutions.
>> Few other options:
>> 1. Not allowing re-embedded bitcode will simplify the code a bit but not 
>> a lot.
>> 2. Create a new "llvm.*.used" variable in llvm.metadata section.
>> 3. Teach optimizer do not optimize away llvm.* variables.
>> 
>> <0001-Fix-embed-bitcode-linkage-type.patch>
>> 
>> Steven
>> 
>>> On May 13, 2016, at 10:10 AM, Rafael EspĂ­ndola 
>>>  wrote:
>>> 
>>> On 13 May 2016 at 13:02, Steven Wu  wrote:
 Hi Rafael
 
 Thanks for notice this! That would definitely cause duplicated symbol 
 error and I should definitely change that.
 Here is some background:
 ld64 in Xcode 7+ knows how to handle the embedded bitcode correctly 
 but not the ones in earlier Xcode. The old ld64 will simply 
 concatenate the bitcode files which is not the right thing to do. So 
 there is a symbol generated at the place to prevent user to link the 
 bitcode object file with old ld64 because older ld64 will fail and 
 report duplicated symbols.
 I have a radar tracking to change the linkage type when upstream but I 
 dropped the ball on that one. The correct thing to do is to make it 
 internal and add to llvm.used. I will come up with a patch.
>>> 
>>> Thank you so much!
>>> 
>>> Cheers,
>>> Rafael
>> 
> 
 
 
>> 
>> 

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


Re: [patch] Don't use appending linkage for embeded bitcode

2016-05-16 Thread Rafael EspĂ­ndola via cfe-commits
LGTM

On 16 May 2016 at 14:03, Steven Wu  wrote:
>
>> On May 16, 2016, at 6:52 AM, Rafael EspĂ­ndola  
>> wrote:
>>
>> +  auto Used = collectUsedGlobalVariables(*M, UsedGlobals, true);
>>
>> Please use an explicit type instead of auto.
>
> Sure.
>
>>
>> You deleted the assert
>
> Are you referring to the assertion that llvm.embedded.module has no uses. I 
> added it back to check it has exactly one use.
>
> Attach the final patch with testcase.
>
> Steven
>
>
>
>
>>
>> I think this is fine otherwise.
>>
>> Cheers,
>> Rafael
>>
>>
>>
>>
>>
>> On 13 May 2016 at 20:00, Steven Wu  wrote:
>>>
 On May 13, 2016, at 3:56 PM, Duncan P. N. Exon Smith 
  wrote:

 Is this something that you need the linker to treat as "used", or just 
 something you don't want the compiler to drop?  If the latter, 
 @llvm.compiler.used seems more appropriate.
>>>
>>> Bitcode is actually not really used by the compiler during compilation and 
>>> shouldn't really used by any part of the code. llvm.compiler.used then.
>>>
>>> New patch.
>>>
>>>
>>>
>>>
>>> Steven
>>>

> On 2016-May-13, at 14:01, Steven Wu  wrote:
>
> Attach a patch using private linkage type and adding to llvm.used. I have 
> to recreate llvm.used when embedding bitcode. I don't really like it but 
> I don't have better solutions.
> Few other options:
> 1. Not allowing re-embedded bitcode will simplify the code a bit but not 
> a lot.
> 2. Create a new "llvm.*.used" variable in llvm.metadata section.
> 3. Teach optimizer do not optimize away llvm.* variables.
>
> <0001-Fix-embed-bitcode-linkage-type.patch>
>
> Steven
>
>> On May 13, 2016, at 10:10 AM, Rafael EspĂ­ndola 
>>  wrote:
>>
>> On 13 May 2016 at 13:02, Steven Wu  wrote:
>>> Hi Rafael
>>>
>>> Thanks for notice this! That would definitely cause duplicated symbol 
>>> error and I should definitely change that.
>>> Here is some background:
>>> ld64 in Xcode 7+ knows how to handle the embedded bitcode correctly but 
>>> not the ones in earlier Xcode. The old ld64 will simply concatenate the 
>>> bitcode files which is not the right thing to do. So there is a symbol 
>>> generated at the place to prevent user to link the bitcode object file 
>>> with old ld64 because older ld64 will fail and report duplicated 
>>> symbols.
>>> I have a radar tracking to change the linkage type when upstream but I 
>>> dropped the ball on that one. The correct thing to do is to make it 
>>> internal and add to llvm.used. I will come up with a patch.
>>
>> Thank you so much!
>>
>> Cheers,
>> Rafael
>

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


Re: [PATCH] D20192: [Sema] Fix bug to do with lookup of template friend function in namespace

2016-05-16 Thread Meador Inge via cfe-commits
meadori added a comment.

Hmmm, it works on trunk r269671.  Not sure what happened before.


http://reviews.llvm.org/D20192



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


[PATCH] clang-tidy: Bug 27731 - modernize-pass-by-value suggest using std::move for types that perform copies on move

2016-05-16 Thread Mads Ravn via cfe-commits
Hi,

I hereby attach a patch to fix bug no. 27731:
https://llvm.org/bugs/show_bug.cgi?id=27731

Best regards,
Mads Ravn
Index: clang-tidy/modernize/PassByValueCheck.cpp
===
--- clang-tidy/modernize/PassByValueCheck.cpp	(revision 269603)
+++ clang-tidy/modernize/PassByValueCheck.cpp	(working copy)
@@ -181,6 +181,11 @@
   if (!paramReferredExactlyOnce(Ctor, ParamDecl))
 return;
 
+  // If the parameter is trivial to copy, don't move it. Moving a trivivally
+  // copyable type will cause a problem with modernize-pass-by-value
+  if (ParamDecl->getType().isTriviallyCopyableType(*Result.Context)) 
+return;
+
   auto Diag = diag(ParamDecl->getLocStart(), "pass by value and use std::move");
 
   // Iterate over all declarations of the constructor.
Index: test/clang-tidy/modernize-pass-by-value.cpp
===
--- test/clang-tidy/modernize-pass-by-value.cpp	(revision 269603)
+++ test/clang-tidy/modernize-pass-by-value.cpp	(working copy)
@@ -194,3 +194,9 @@
   Movable M;
 };
 
+// Test that types that are trivially copyable will not use std::move. This will
+// cause problems with misc-move-const-arg, as it will revert it.
+struct T {
+  std::array a_;
+  T(std::array a) : a_(a) {}
+};
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20291: [ms] Reintroduce feature guards in intrinsic headers in Microsoft mode

2016-05-16 Thread Nico Weber via cfe-commits
thakis closed this revision.
thakis added a comment.

r269675, thanks!


http://reviews.llvm.org/D20291



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


r269675 - [ms] Reintroduce feature guards in intrinsic headers in Microsoft mode

2016-05-16 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon May 16 13:14:07 2016
New Revision: 269675

URL: http://llvm.org/viewvc/llvm-project?rev=269675=rev
Log:
[ms] Reintroduce feature guards in intrinsic headers in Microsoft mode

Visual Studio's C++ standard library headers include intrin.h, so the intrinsic
headers get included a lot more often in Microsoft mode than elsewhere. The
AVX512 intrinsics are a lot of code (0.7 MB, causing 30% compile time overhead
for small programs including e.g.  and 6% compile time overhead for
larger projects like e.g. v8). Since multiversioning can't be relied on in
Microsoft mode (cl.exe doesn't support it), having faster compiles seems like
the much better tradeoff until we have a better intrinsic story going forward
(which we'll need for e.g. PR19898).

Actually using intrinsics on Windows already requires the right /arch:
settings, so this patch should have no big behavior change.

See also thread "The intrinsics headers (especially avx512) are too big. What
to do about it?" on cfe-dev.

http://reviews.llvm.org/D20291

Modified:
cfe/trunk/lib/Headers/immintrin.h
cfe/trunk/lib/Headers/x86intrin.h
cfe/trunk/test/CodeGen/ms-mm-align.c

Modified: cfe/trunk/lib/Headers/immintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/immintrin.h?rev=269675=269674=269675=diff
==
--- cfe/trunk/lib/Headers/immintrin.h (original)
+++ cfe/trunk/lib/Headers/immintrin.h Mon May 16 13:14:07 2016
@@ -24,22 +24,41 @@
 #ifndef __IMMINTRIN_H
 #define __IMMINTRIN_H
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__MMX__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE2__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE3__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSSE3__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+(defined(__SSE4_2__) || defined(__SSE4_1__))
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+(defined(__AES__) || defined(__PCLMUL__))
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX2__)
 #include 
 
 /* The 256-bit versions of functions in f16cintrin.h.
@@ -54,45 +73,90 @@ _mm256_cvtph_ps(__m128i __a)
 {
   return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a);
 }
+#endif /* __AVX2__ */
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI2__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__LZCNT__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512F__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VL__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512BW__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512CD__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512DQ__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+(defined(__AVX512VL__) && defined(__AVX512BW__))
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+(defined(__AVX512VL__) && defined(__AVX512CD__))
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+(defined(__AVX512VL__) && defined(__AVX512DQ__))
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512ER__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512IFMA__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+(defined(__AVX512IFMA__) && defined(__AVX512VL__))
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VBMI__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+(defined(__AVX512VBMI__) && defined(__AVX512VL__))
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512PF__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__PKU__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDRND__)
 static __inline__ int __attribute__((__always_inline__, __nodebug__, 
__target__("rdrnd")))
 _rdrand16_step(unsigned short *__p)
 {
@@ -112,7 +176,9 @@ _rdrand64_step(unsigned long long *__p)
   return __builtin_ia32_rdrand64_step(__p);
 }
 #endif
+#endif /* __RDRND__ */
 
+#if 

Re: [PATCH] D20291: [ms] Reintroduce feature guards in intrinsic headers in Microsoft mode

2016-05-16 Thread Hans Wennborg via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm


http://reviews.llvm.org/D20291



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


Re: [patch] Don't use appending linkage for embeded bitcode

2016-05-16 Thread Steven Wu via cfe-commits

> On May 16, 2016, at 6:52 AM, Rafael EspĂ­ndola  
> wrote:
> 
> +  auto Used = collectUsedGlobalVariables(*M, UsedGlobals, true);
> 
> Please use an explicit type instead of auto.

Sure.

> 
> You deleted the assert

Are you referring to the assertion that llvm.embedded.module has no uses. I 
added it back to check it has exactly one use.

Attach the final patch with testcase.

Steven



0001-Change-embed-bitcode-linkage-type.patch
Description: Binary data


> 
> I think this is fine otherwise.
> 
> Cheers,
> Rafael
> 
> 
> 
> 
> 
> On 13 May 2016 at 20:00, Steven Wu  wrote:
>> 
>>> On May 13, 2016, at 3:56 PM, Duncan P. N. Exon Smith  
>>> wrote:
>>> 
>>> Is this something that you need the linker to treat as "used", or just 
>>> something you don't want the compiler to drop?  If the latter, 
>>> @llvm.compiler.used seems more appropriate.
>> 
>> Bitcode is actually not really used by the compiler during compilation and 
>> shouldn't really used by any part of the code. llvm.compiler.used then.
>> 
>> New patch.
>> 
>> 
>> 
>> 
>> Steven
>> 
>>> 
 On 2016-May-13, at 14:01, Steven Wu  wrote:
 
 Attach a patch using private linkage type and adding to llvm.used. I have 
 to recreate llvm.used when embedding bitcode. I don't really like it but I 
 don't have better solutions.
 Few other options:
 1. Not allowing re-embedded bitcode will simplify the code a bit but not a 
 lot.
 2. Create a new "llvm.*.used" variable in llvm.metadata section.
 3. Teach optimizer do not optimize away llvm.* variables.
 
 <0001-Fix-embed-bitcode-linkage-type.patch>
 
 Steven
 
> On May 13, 2016, at 10:10 AM, Rafael EspĂ­ndola 
>  wrote:
> 
> On 13 May 2016 at 13:02, Steven Wu  wrote:
>> Hi Rafael
>> 
>> Thanks for notice this! That would definitely cause duplicated symbol 
>> error and I should definitely change that.
>> Here is some background:
>> ld64 in Xcode 7+ knows how to handle the embedded bitcode correctly but 
>> not the ones in earlier Xcode. The old ld64 will simply concatenate the 
>> bitcode files which is not the right thing to do. So there is a symbol 
>> generated at the place to prevent user to link the bitcode object file 
>> with old ld64 because older ld64 will fail and report duplicated symbols.
>> I have a radar tracking to change the linkage type when upstream but I 
>> dropped the ball on that one. The correct thing to do is to make it 
>> internal and add to llvm.used. I will come up with a patch.
> 
> Thank you so much!
> 
> Cheers,
> Rafael
 
>>> 
>> 
>> 

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


Re: [PATCH] D20137: [PCH] Fixed bugs with preamble invalidation when files change (on Windows)

2016-05-16 Thread Cameron via cfe-commits
cameron314 updated the summary for this revision.
cameron314 updated this revision to Diff 57367.
cameron314 added a comment.

This version of the patch takes into account potential changes between 
filenames and their unique IDs between parses.


http://reviews.llvm.org/D20137

Files:
  lib/Frontend/ASTUnit.cpp

Index: lib/Frontend/ASTUnit.cpp
===
--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -1378,7 +1378,7 @@
   
   // First, make a record of those files that have been overridden via
   // remapping or unsaved_files.
-  llvm::StringMap OverriddenFiles;
+  std::map OverriddenFiles;
   for (const auto  : PreprocessorOpts.RemappedFiles) {
 if (AnyFileChanged)
   break;
@@ -1391,24 +1391,38 @@
   break;
 }
 
-OverriddenFiles[R.first] = PreambleFileHash::createForFile(
+OverriddenFiles[Status.getUniqueID()] = 
PreambleFileHash::createForFile(
 Status.getSize(), Status.getLastModificationTime().toEpochTime());
   }
 
   for (const auto  : PreprocessorOpts.RemappedFileBuffers) {
 if (AnyFileChanged)
   break;
-OverriddenFiles[RB.first] =
+
+vfs::Status Status;
+if (FileMgr->getNoncachedStatValue(RB.first, Status)) {
+  AnyFileChanged = true;
+  break;
+}
+
+OverriddenFiles[Status.getUniqueID()] =
 PreambleFileHash::createForMemoryBuffer(RB.second);
   }

   // Check whether anything has changed.
-  for (llvm::StringMap::iterator 
+  for (llvm::StringMap::iterator
  F = FilesInPreamble.begin(), FEnd = FilesInPreamble.end();
!AnyFileChanged && F != FEnd; 
++F) {
-llvm::StringMap::iterator Overridden
-  = OverriddenFiles.find(F->first());
+vfs::Status Status;
+if (FileMgr->getNoncachedStatValue(F->first(), Status)) {
+  // If we can't stat the file, assume that something horrible 
happened.
+  AnyFileChanged = true;
+  break;
+}
+
+std::map::iterator 
Overridden
+  = OverriddenFiles.find(Status.getUniqueID());
 if (Overridden != OverriddenFiles.end()) {
   // This file was remapped; check whether the newly-mapped file 
   // matches up with the previous mapping.
@@ -1418,11 +1432,7 @@
 }
 
 // The file was not remapped; check whether it has changed on disk.
-vfs::Status Status;
-if (FileMgr->getNoncachedStatValue(F->first(), Status)) {
-  // If we can't stat the file, assume that something horrible 
happened.
-  AnyFileChanged = true;
-} else if (Status.getSize() != uint64_t(F->second.Size) ||
+if (Status.getSize() != uint64_t(F->second.Size) ||
Status.getLastModificationTime().toEpochTime() !=
uint64_t(F->second.ModTime))
   AnyFileChanged = true;


Index: lib/Frontend/ASTUnit.cpp
===
--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -1378,7 +1378,7 @@
   
   // First, make a record of those files that have been overridden via
   // remapping or unsaved_files.
-  llvm::StringMap OverriddenFiles;
+  std::map OverriddenFiles;
   for (const auto  : PreprocessorOpts.RemappedFiles) {
 if (AnyFileChanged)
   break;
@@ -1391,24 +1391,38 @@
   break;
 }
 
-OverriddenFiles[R.first] = PreambleFileHash::createForFile(
+OverriddenFiles[Status.getUniqueID()] = PreambleFileHash::createForFile(
 Status.getSize(), Status.getLastModificationTime().toEpochTime());
   }
 
   for (const auto  : PreprocessorOpts.RemappedFileBuffers) {
 if (AnyFileChanged)
   break;
-OverriddenFiles[RB.first] =
+
+vfs::Status Status;
+if (FileMgr->getNoncachedStatValue(RB.first, Status)) {
+  AnyFileChanged = true;
+  break;
+}
+
+OverriddenFiles[Status.getUniqueID()] =
 PreambleFileHash::createForMemoryBuffer(RB.second);
   }

   // Check whether anything has changed.
-  for (llvm::StringMap::iterator 
+  for (llvm::StringMap::iterator
  F = FilesInPreamble.begin(), FEnd = FilesInPreamble.end();
!AnyFileChanged && F != FEnd; 
++F) {
-llvm::StringMap::iterator Overridden
-  = OverriddenFiles.find(F->first());
+vfs::Status Status;
+if (FileMgr->getNoncachedStatValue(F->first(), Status)) {
+  // If we can't stat the file, assume that something horrible happened.
+  AnyFileChanged = true;
+  break;
+}
+
+

[PATCH] D20291: [ms] Reintroduce feature guards in intrinsic headers in Microsoft mode

2016-05-16 Thread Nico Weber via cfe-commits
thakis created this revision.
thakis added a reviewer: hans.
thakis added a subscriber: cfe-commits.

Visual Studio's C++ standard library headers include intrin.h, so the intrinsic 
headers get included a lot more often in Microsoft mode then elsewhere. The 
AVX512 intrinsics are a lot of code (0.7 MB, causing 30% compile time overhead 
for small programs including e.g. `` and 6% compile time overhead for 
larger projects like e.g. v8). Since multiversioning can't be relied on in 
Microsoft mode (cl.exe doesn't support it), having faster compiles seems like 
the much better tradeoff until we have a better intrinsic story going forward 
(which we'll need for e.g. PR19898).

Actually using intrinsics on Windows already requires the right /arch: 
settings, so this patch should have no big behavior change.

See also thread "The intrinsics headers (especially avx512) are too big. What 
to do about it?" on cfe-dev.

http://reviews.llvm.org/D20291

Files:
  lib/Headers/immintrin.h
  lib/Headers/x86intrin.h
  test/CodeGen/ms-mm-align.c

Index: lib/Headers/x86intrin.h
===
--- lib/Headers/x86intrin.h
+++ lib/Headers/x86intrin.h
@@ -28,29 +28,53 @@
 
 #include 
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__3dNOW__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI2__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__LZCNT__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__POPCNT__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDSEED__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__PRFCHW__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE4A__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA4__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XOP__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__TBM__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__F16C__)
 #include 
+#endif
 
 /* FIXME: LWP */
 
Index: lib/Headers/immintrin.h
===
--- lib/Headers/immintrin.h
+++ lib/Headers/immintrin.h
@@ -24,22 +24,41 @@
 #ifndef __IMMINTRIN_H
 #define __IMMINTRIN_H
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__MMX__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE2__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE3__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSSE3__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+(defined(__SSE4_2__) || defined(__SSE4_1__))
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+(defined(__AES__) || defined(__PCLMUL__))
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX2__)
 #include 
 
 /* The 256-bit versions of functions in f16cintrin.h.
@@ -54,45 +73,90 @@
 {
   return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a);
 }
+#endif /* __AVX2__ */
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI2__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__LZCNT__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512F__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VL__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512BW__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512CD__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512DQ__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+(defined(__AVX512VL__) && defined(__AVX512BW__))
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+(defined(__AVX512VL__) && defined(__AVX512CD__))
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+(defined(__AVX512VL__) && defined(__AVX512DQ__))
 #include 
+#endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512ER__)
 #include 
+#endif
 
+#if !defined(_MSC_VER) || 

Re: r269572 - Warn when a reference is bound to an empty l-value (dereferenced null pointer).

2016-05-16 Thread Hans Wennborg via cfe-commits
On Mon, May 16, 2016 at 10:03 AM, Nick Lewycky  wrote:
> Hans Wennborg wrote:
>>
>> On Sat, May 14, 2016 at 10:44 AM, Nick Lewycky via cfe-commits
>>   wrote:
>>>
>>>
>>> Author: nicholas
>>> Date: Sat May 14 12:44:14 2016
>>> New Revision: 269572
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=269572=rev
>>> Log:
>>> Warn when a reference is bound to an empty l-value (dereferenced null
>>> pointer).
>>
>>
>> Could this be made to handle return values too? The warning fired on
>> some code in pdfium, and nearby I found this:
>>
>>TYPE&  ElementAt(int nIndex) {
>>  if (nIndex<  0 || nIndex>= m_nSize) {
>>return *(TYPE*)NULL;<-- Ooops
>>  }
>>  return ((TYPE*)m_pData)[nIndex];
>>}
>>
>> where the warning doesn't fire.
>
>
> That looks like a bug, we should already catch that case:
>
>   int () {
> return *(int*)nullptr;
>   }
>   struct TYPE {};
>   TYPE () {
> return *(TYPE*)nullptr;
>   }
>
>   clang ref.cc -std=c++11
>   ref.cc:2:10: warning: binding dereferenced null pointer to reference has
> undefined behavior [-Wnull-dereference]
> return *(int*)nullptr;
>^~
>   ref.cc:6:10: warning: binding dereferenced null pointer to reference has
>   undefined behavior [-Wnull-dereference]
> return *(TYPE*)nullptr;
>^~~
>   2 warnings generated.
>
> Could you produce a testcase for it?

D'oh, the code I was looking at is a template. As it turns out, it's
never actually used, which I suppose is why there was no diagnostic.
If I instantiate it, the warning works fine.

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


Re: [PATCH] D20192: [Sema] Fix bug to do with lookup of template friend function in namespace

2016-05-16 Thread Erik Pilkington via cfe-commits
erik.pilkington added a comment.

Very weird, the test suite runs fine on my machine. Looks like the expected 
line for the diagnostics on your run is always one more than the line of the 
actual diagnostic. Could you please update your build to top-of-trunk, reapply 
the patch, and run the suite again?
If that doesn't work, maybe trying running the test on this file:
https://gist.github.com/EPilkington/662b516d2448919aaeebe1e4dce9d92b

Thanks for pointing this out, and please let me know what happens!


http://reviews.llvm.org/D20192



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


Re: [PATCH] D20287: [Coverage] Ensure that the hash for a used function is non-zero.

2016-05-16 Thread David Li via cfe-commits
davidxl added a comment.

Strictly speaking, this patch requires a version bump of the indexed format. 
The profile reader also needs to adjust the FunctionHash computation (either 
using 0 or simple function hash) based on the version of the profile data.

Check with Justin/vsk to see if it is important to keep backward compatability 
for these simple functions in older profile data.

On the other hand, I wonder what is the real root cause of the problem.  The 
dummy function record does not have its 'own' profile counts, so

if (std::error_code EC = ProfileReader.getFunctionCounts(

  Record.FunctionName, Record.FunctionHash, Counts)) {

call in CoverageMapping::load (..)

method should return the the counts of the used  function even with zero 
functionhash.  What did I miss?


http://reviews.llvm.org/D20287



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


Re: [PATCH] D17416: [libcxx] Reorganize locale extension fallbacks. NFCI

2016-05-16 Thread Dan Albert via cfe-commits
danalbert accepted this revision.
danalbert added a comment.
This revision is now accepted and ready to land.

LGTM. Sorry for the delay in response.


http://reviews.llvm.org/D17416



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


Re: [PATCH] D18369: [OpenCL] Upstreaming khronos OpenCL header file.

2016-05-16 Thread Yaxun Liu via cfe-commits
yaxunl added inline comments.


Comment at: lib/Headers/opencl-c.h:17051
@@ +17050,3 @@
+#define CLK_SUCCESS 0
+#define CLK_ENQUEUE_FAILURE -101
+#define CLK_INVALID_QUEUE   -102

jprice wrote:
> yaxunl wrote:
> > Anastasia wrote:
> > > Are those arbitrary taken values I am guessing?
> > How about this?
> > 
> >   // The value are defined according to their order in the spec.
> >   #define CLK_SUCCESS 0
> >   #define CLK_ENQUEUE_FAILURE -1
> >   #define CLK_INVALID_QUEUE   -2
> >   #define CLK_INVALID_NDRANGE -3
> >   #define CLK_INVALID_EVENT_WAIT_LIST -4
> >   #define CLK_DEVICE_QUEUE_FULL   -5
> >   #define CLK_INVALID_ARG_SIZE-6
> >   #define CLK_EVENT_ALLOCATION_FAILURE-8
> >   #define CLK_OUT_OF_RESOURCES-9
> > 
> These values were taken from the table in section 2.10.6.1 in the SPIR 2.0 
> provisional spec. Some of the choices seem arbitrary, while others were 
> chosen to match the value of the equivalent runtime API error.
> 
> I imagine changing these values now might cause incompatibilities with 
> existing SPIR consumers?
Then I guess we'd better keep it as is.


http://reviews.llvm.org/D18369



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


r269670 - [OpenCL] Add supported OpenCL extensions to target info.

2016-05-16 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Mon May 16 12:06:34 2016
New Revision: 269670

URL: http://llvm.org/viewvc/llvm-project?rev=269670=rev
Log:
[OpenCL] Add supported OpenCL extensions to target info.

Add supported OpenCL extensions to target info. It serves as default values to 
save the users of the burden setting each supported extensions and optional 
core features in command line.

Re-commit after fixing build error due to missing override attribute.

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

Added:
cfe/trunk/include/clang/Basic/OpenCLOptions.h
cfe/trunk/test/SemaOpenCL/extensions.cl
Removed:
cfe/trunk/test/SemaOpenCL/extension-fp64-cl1.1.cl
cfe/trunk/test/SemaOpenCL/extension-fp64.cl
cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl1.2.cl
cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl2.0.cl
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/include/clang/Basic/OpenCLExtensions.def
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/include/clang/Basic/TargetOptions.h
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl
cfe/trunk/test/CodeGenOpenCL/fpmath.cl
cfe/trunk/test/CodeGenOpenCL/half.cl
cfe/trunk/test/Lexer/opencl-half-literal.cl
cfe/trunk/test/Misc/languageOptsOpenCL.cl
cfe/trunk/test/PCH/opencl-extensions.cl
cfe/trunk/test/Parser/opencl-astype.cl
cfe/trunk/test/Parser/opencl-atomics-cl20.cl
cfe/trunk/test/Parser/opencl-pragma.cl
cfe/trunk/test/Parser/opencl-storage-class.cl
cfe/trunk/test/SemaOpenCL/half.cl
cfe/trunk/test/SemaOpenCL/invalid-kernel-parameters.cl
cfe/trunk/test/SemaOpenCL/invalid-logical-ops-1.2.cl

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=269670=269669=269670=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Mon May 16 12:06:34 
2016
@@ -926,6 +926,10 @@ def warn_pragma_expected_enable_disable
   "expected 'enable' or 'disable' - ignoring">, InGroup;
 def warn_pragma_unknown_extension : Warning<
   "unknown OpenCL extension %0 - ignoring">, InGroup;
+def warn_pragma_unsupported_extension : Warning<
+  "unsupported OpenCL extension %0 - ignoring">, InGroup;
+def warn_pragma_extension_is_core : Warning<
+  "OpenCL extension %0 is core feature or supported optional core feature - 
ignoring">, InGroup;
 
 // OpenCL errors.
 def err_opencl_taking_function_address_parser : Error<

Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=269670=269669=269670=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Mon May 16 12:06:34 2016
@@ -160,18 +160,6 @@ public:
 fp_contract(LangOpts.DefaultFPContract) {}
 };
 
-/// \brief OpenCL volatile options
-class OpenCLOptions {
-public:
-#define OPENCLEXT(nm)  unsigned nm : 1;
-#include "clang/Basic/OpenCLExtensions.def"
-
-  OpenCLOptions() {
-#define OPENCLEXT(nm)   nm = 0;
-#include "clang/Basic/OpenCLExtensions.def"
-  }
-};
-
 /// \brief Describes the kind of translation unit being processed.
 enum TranslationUnitKind {
   /// \brief The translation unit is a complete translation unit.

Modified: cfe/trunk/include/clang/Basic/OpenCLExtensions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenCLExtensions.def?rev=269670=269669=269670=diff
==
--- cfe/trunk/include/clang/Basic/OpenCLExtensions.def (original)
+++ cfe/trunk/include/clang/Basic/OpenCLExtensions.def Mon May 16 12:06:34 2016
@@ -11,25 +11,67 @@
 //
 
//===--===//
 
+// Macro OPENCLEXT or OPENCLEXT_INTERNAL can be defined to enumerate the
+// OpenCL extensions listed in this file.
+//
+// If the extensions are to be enumerated without the supported OpenCL version,
+// define OPENCLEXT(ext) where ext is the name of the extension.
+//
+// If the extensions are to be enumerated with supported OpenCL version,
+// define OPENCLEXT_INTERNAL(ext, avail, core) where
+//   ext - name of the extension or optional core feature.
+//   avail - minimum OpenCL version supporting it.
+//   core - minimum OpenCL version when the extension becomes optional core
+//  feature or core feature. ~0U indicates not a core feature or an
+//  optional core feature.
+
+#ifndef OPENCLEXT_INTERNAL
+#ifndef 

Re: r269572 - Warn when a reference is bound to an empty l-value (dereferenced null pointer).

2016-05-16 Thread Nick Lewycky via cfe-commits

Hans Wennborg wrote:

On Sat, May 14, 2016 at 10:44 AM, Nick Lewycky via cfe-commits
  wrote:


Author: nicholas
Date: Sat May 14 12:44:14 2016
New Revision: 269572

URL: http://llvm.org/viewvc/llvm-project?rev=269572=rev
Log:
Warn when a reference is bound to an empty l-value (dereferenced null pointer).


Could this be made to handle return values too? The warning fired on
some code in pdfium, and nearby I found this:

   TYPE&  ElementAt(int nIndex) {
 if (nIndex<  0 || nIndex>= m_nSize) {
   return *(TYPE*)NULL;<-- Ooops
 }
 return ((TYPE*)m_pData)[nIndex];
   }

where the warning doesn't fire.


That looks like a bug, we should already catch that case:

  int () {
return *(int*)nullptr;
  }
  struct TYPE {};
  TYPE () {
return *(TYPE*)nullptr;
  }

  clang ref.cc -std=c++11
  ref.cc:2:10: warning: binding dereferenced null pointer to reference has
undefined behavior [-Wnull-dereference]
return *(int*)nullptr;
   ^~
  ref.cc:6:10: warning: binding dereferenced null pointer to reference has
  undefined behavior [-Wnull-dereference]
return *(TYPE*)nullptr;
   ^~~
  2 warnings generated.

Could you produce a testcase for it?

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


[libcxx] r269665 - Add a test for uniqueptr having either NULL and nullptr

2016-05-16 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon May 16 11:57:15 2016
New Revision: 269665

URL: http://llvm.org/viewvc/llvm-project?rev=269665=rev
Log:
Add a test for uniqueptr having either NULL and nullptr

Modified:

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

Modified: 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp?rev=269665=269664=269665=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
 Mon May 16 11:57:15 2016
@@ -40,4 +40,10 @@ int main()
 assert(s.get_deleter().state() == 0);
 }
 assert(A::count == 0);
+
+{ // LWG#2520 says that nullptr is a valid input as well as null
+std::unique_ptr > s1(NULL, Deleter());
+std::unique_ptr > s2(nullptr, Deleter());
+}
+assert(A::count == 0);
 }


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


Re: [PATCH] D20137: [PCH] Fixed bugs with preamble invalidation when files change (on Windows)

2016-05-16 Thread Cameron via cfe-commits
cameron314 added inline comments.


Comment at: lib/Frontend/ASTUnit.cpp:1402-1406
@@ +1401,7 @@
+
+vfs::Status Status;
+if (FileMgr->getNoncachedStatValue(RB.first, Status)) {
+  AnyFileChanged = true;
+  break;
+}
+

rsmith wrote:
> Suppose file names A and B refer to file (inode) X, and the map contains X -> 
> (A, hash). If B is deleted (and maybe recreated pointing at a new inode), 
> this approach won't detect that anything has changed.
Ah, I understand. The problem isn't really with the overridden file map, which 
still has to be by inode in order for lookups to find the right file regardless 
of name, but with the FilesInPreamble map, which needs to stay as a list of 
independent filenames in case the inodes associated to those filenames changes 
in between parses.

I'll make the change, thanks!


http://reviews.llvm.org/D20137



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


[libcxx] r269663 - Add a couple of _LIBCPP_ASSERT calls. No functional change.

2016-05-16 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon May 16 11:55:32 2016
New Revision: 269663

URL: http://llvm.org/viewvc/llvm-project?rev=269663=rev
Log:
Add a couple of _LIBCPP_ASSERT calls. No functional change.

Modified:
libcxx/trunk/include/future

Modified: libcxx/trunk/include/future
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/future?rev=269663=269662=269663=diff
==
--- libcxx/trunk/include/future (original)
+++ libcxx/trunk/include/future Mon May 16 11:55:32 2016
@@ -1482,6 +1482,7 @@ template 
 void
 promise<_Rp>::set_exception(exception_ptr __p)
 {
+_LIBCPP_ASSERT( __p != nullptr, "promise::set_exception: received nullptr" 
);
 if (__state_ == nullptr)
 __throw_future_error(future_errc::no_state);
 __state_->set_exception(__p);
@@ -1629,6 +1630,7 @@ template 
 void
 promise<_Rp&>::set_exception(exception_ptr __p)
 {
+_LIBCPP_ASSERT( __p != nullptr, "promise::set_exception: received nullptr" 
);
 if (__state_ == nullptr)
 __throw_future_error(future_errc::no_state);
 __state_->set_exception(__p);


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


Re: [PATCH] D20119: [libunwind] Improve unwinder stack usage

2016-05-16 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

Ping.


http://reviews.llvm.org/D20119



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


Re: [PATCH] D20052: Add new ASTMatcher that matches dynamic exception specifications.

2016-05-16 Thread Aaron Ballman via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Thank you for the work on this! I've commit in r269662


http://reviews.llvm.org/D20052



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


r269662 - Add the hasDynamicExceptionSpec() AST matcher to match function declarations that have a dynamic exception specification.

2016-05-16 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Mon May 16 11:49:01 2016
New Revision: 269662

URL: http://llvm.org/viewvc/llvm-project?rev=269662=rev
Log:
Add the hasDynamicExceptionSpec() AST matcher to match function declarations 
that have a dynamic exception specification.

Patch by Don Hinton.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=269662=269661=269662=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Mon May 16 11:49:01 2016
@@ -2388,6 +2388,22 @@ Usable as: Matcherhttp://cl
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclhasDynamicExceptionSpec
+Matches 
functions that have a dynamic exception specification.
+
+Given:
+  void f();
+  void g() noexcept;
+  void h() noexcept(true);
+  void i() noexcept(false);
+  void j() throw();
+  void k() throw(int);
+  void l() throw(...);
+functionDecl(hasDynamicExceptionSpec())
+  matches the declarations of j, k, and l, but not f, g, h, or i.
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclhasOverloadedOperatorNameStringRef
 Name
 Matches 
overloaded operator names.
 

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=269662=269661=269662=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Mon May 16 11:49:01 2016
@@ -3215,6 +3215,26 @@ AST_MATCHER(FunctionDecl, isDefaulted) {
   return Node.isDefaulted();
 }
 
+/// \brief Matches functions that have a dynamic exception specification.
+///
+/// Given:
+/// \code
+///   void f();
+///   void g() noexcept;
+///   void h() noexcept(true);
+///   void i() noexcept(false);
+///   void j() throw();
+///   void k() throw(int);
+///   void l() throw(...);
+/// \endcode
+/// functionDecl(hasDynamicExceptionSpec())
+///   matches the declarations of j, k, and l, but not f, g, h, or i.
+AST_MATCHER(FunctionDecl, hasDynamicExceptionSpec) {
+  if (const auto *FnTy = Node.getType()->getAs())
+return FnTy->hasDynamicExceptionSpec();
+  return false;
+}
+
 /// \brief Matches functions that have a non-throwing exception specification.
 ///
 /// Given:

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=269662=269661=269662=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Mon May 16 11:49:01 2016
@@ -219,6 +219,7 @@ RegistryMaps::RegistryMaps() {
   REGISTER_MATCHER(hasDeducedType);
   REGISTER_MATCHER(hasDescendant);
   REGISTER_MATCHER(hasDestinationType);
+  REGISTER_MATCHER(hasDynamicExceptionSpec);
   REGISTER_MATCHER(hasEitherOperand);
   REGISTER_MATCHER(hasElementType);
   REGISTER_MATCHER(hasElse);

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=269662=269661=269662=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Mon May 16 11:49:01 2016
@@ -3571,6 +3571,22 @@ TEST(HasDestinationType, MatchesSimpleCa
   pointsTo(TypeMatcher(anything()));
 }
 
+TEST(hasDynamicExceptionSpec, MatchesDynamicExceptionSpecifications) {
+  EXPECT_TRUE(notMatches("void f();", 
functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(notMatches("void g() noexcept;",
+ functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(notMatches("void h() noexcept(true);",
+ functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(notMatches("void i() noexcept(false);",
+ functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(
+  matches("void j() throw();", functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(
+  matches("void k() throw(int);", 
functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(
+  matches("void l() throw(...);", 
functionDecl(hasDynamicExceptionSpec(;
+}
+
 TEST(HasImplicitDestinationType, MatchesSimpleCase) {
   // This test creates an implicit const cast.
   EXPECT_TRUE(matches("int x; const int i = x;",



Re: r269572 - Warn when a reference is bound to an empty l-value (dereferenced null pointer).

2016-05-16 Thread Hans Wennborg via cfe-commits
On Sat, May 14, 2016 at 10:44 AM, Nick Lewycky via cfe-commits
 wrote:
>
> Author: nicholas
> Date: Sat May 14 12:44:14 2016
> New Revision: 269572
>
> URL: http://llvm.org/viewvc/llvm-project?rev=269572=rev
> Log:
> Warn when a reference is bound to an empty l-value (dereferenced null 
> pointer).

Could this be made to handle return values too? The warning fired on
some code in pdfium, and nearby I found this:

  TYPE& ElementAt(int nIndex) {
if (nIndex < 0 || nIndex >= m_nSize) {
  return *(TYPE*)NULL; <-- Ooops
}
return ((TYPE*)m_pData)[nIndex];
  }

where the warning doesn't fire.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r269661 - [Modules] Use vfs for (recursive) directory iteration

2016-05-16 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Mon May 16 11:46:01 2016
New Revision: 269661

URL: http://llvm.org/viewvc/llvm-project?rev=269661=rev
Log:
[Modules] Use vfs for (recursive) directory iteration

Clang performs directory walk while searching headers inside modules by
using the ::sys::fs instead of ::vfs. This prevents any code that uses
the VFS (e.g, reproducer scripts) to actually find such headers, since
the VFS will never be searched for those.

Change these places to use vfs::recursive_directory_iterator and
vfs::directory_iterator instead.

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

rdar://problem/25880368

Modified:
cfe/trunk/lib/Frontend/FrontendActions.cpp
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/ModuleMap.cpp
cfe/trunk/test/Modules/crash-vfs-umbrella-frameworks.m

Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=269661=269660=269661=diff
==
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Mon May 16 11:46:01 2016
@@ -209,17 +209,18 @@ collectModuleHeaderIncludes(const LangOp
 std::error_code EC;
 SmallString<128> DirNative;
 llvm::sys::path::native(UmbrellaDir.Entry->getName(), DirNative);
-for (llvm::sys::fs::recursive_directory_iterator Dir(DirNative, EC), 
- DirEnd;
- Dir != DirEnd && !EC; Dir.increment(EC)) {
+
+vfs::FileSystem  = *FileMgr.getVirtualFileSystem();
+for (vfs::recursive_directory_iterator Dir(FS, DirNative, EC), End;
+ Dir != End && !EC; Dir.increment(EC)) {
   // Check whether this entry has an extension typically associated with 
   // headers.
-  if (!llvm::StringSwitch(llvm::sys::path::extension(Dir->path()))
+  if (!llvm::StringSwitch(llvm::sys::path::extension(Dir->getName()))
   .Cases(".h", ".H", ".hh", ".hpp", true)
   .Default(false))
 continue;
 
-  const FileEntry *Header = FileMgr.getFile(Dir->path());
+  const FileEntry *Header = FileMgr.getFile(Dir->getName());
   // FIXME: This shouldn't happen unless there is a file system race. Is
   // that worth diagnosing?
   if (!Header)
@@ -232,7 +233,7 @@ collectModuleHeaderIncludes(const LangOp
 
   // Compute the relative path from the directory to this file.
   SmallVector Components;
-  auto PathIt = llvm::sys::path::rbegin(Dir->path());
+  auto PathIt = llvm::sys::path::rbegin(Dir->getName());
   for (int I = 0; I != Dir.level() + 1; ++I, ++PathIt)
 Components.push_back(*PathIt);
   SmallString<128> RelativeHeader(UmbrellaDir.NameAsWritten);

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=269661=269660=269661=diff
==
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Mon May 16 11:46:01 2016
@@ -1341,19 +1341,20 @@ void HeaderSearch::collectAllModules(Sma
 DirNative);
 
 // Search each of the ".framework" directories to load them as modules.
-for (llvm::sys::fs::directory_iterator Dir(DirNative, EC), DirEnd;
+vfs::FileSystem  = *FileMgr.getVirtualFileSystem();
+for (vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC), DirEnd;
  Dir != DirEnd && !EC; Dir.increment(EC)) {
-  if (llvm::sys::path::extension(Dir->path()) != ".framework")
+  if (llvm::sys::path::extension(Dir->getName()) != ".framework")
 continue;
 
   const DirectoryEntry *FrameworkDir =
-  FileMgr.getDirectory(Dir->path());
+  FileMgr.getDirectory(Dir->getName());
   if (!FrameworkDir)
 continue;
 
   // Load this framework module.
-  loadFrameworkModule(llvm::sys::path::stem(Dir->path()), FrameworkDir,
-  IsSystem);
+  loadFrameworkModule(llvm::sys::path::stem(Dir->getName()),
+  FrameworkDir, IsSystem);
 }
 continue;
   }
@@ -1408,11 +1409,13 @@ void HeaderSearch::loadSubdirectoryModul
   std::error_code EC;
   SmallString<128> DirNative;
   llvm::sys::path::native(SearchDir.getDir()->getName(), DirNative);
-  for (llvm::sys::fs::directory_iterator Dir(DirNative, EC), DirEnd;
+  vfs::FileSystem  = *FileMgr.getVirtualFileSystem();
+  for (vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC), DirEnd;
Dir != DirEnd && !EC; Dir.increment(EC)) {
-bool IsFramework = llvm::sys::path::extension(Dir->path()) == ".framework";
+bool IsFramework =
+llvm::sys::path::extension(Dir->getName()) == ".framework";
 if (IsFramework == 

Re: [PATCH] D18369: [OpenCL] Upstreaming khronos OpenCL header file.

2016-05-16 Thread James Price via cfe-commits
jprice added inline comments.


Comment at: lib/Headers/opencl-c.h:17051
@@ +17050,3 @@
+#define CLK_SUCCESS 0
+#define CLK_ENQUEUE_FAILURE -101
+#define CLK_INVALID_QUEUE   -102

yaxunl wrote:
> Anastasia wrote:
> > Are those arbitrary taken values I am guessing?
> How about this?
> 
>   // The value are defined according to their order in the spec.
>   #define CLK_SUCCESS 0
>   #define CLK_ENQUEUE_FAILURE -1
>   #define CLK_INVALID_QUEUE   -2
>   #define CLK_INVALID_NDRANGE -3
>   #define CLK_INVALID_EVENT_WAIT_LIST -4
>   #define CLK_DEVICE_QUEUE_FULL   -5
>   #define CLK_INVALID_ARG_SIZE-6
>   #define CLK_EVENT_ALLOCATION_FAILURE-8
>   #define CLK_OUT_OF_RESOURCES-9
> 
These values were taken from the table in section 2.10.6.1 in the SPIR 2.0 
provisional spec. Some of the choices seem arbitrary, while others were chosen 
to match the value of the equivalent runtime API error.

I imagine changing these values now might cause incompatibilities with existing 
SPIR consumers?


http://reviews.llvm.org/D18369



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


Re: [PATCH] D17416: [libcxx] Reorganize locale extension fallbacks. NFCI

2016-05-16 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

A couple of packaging comments.   In general, this looks fine to me - still 
waiting on someone from Android to chime in. -- I'll ping Dan.



Comment at: include/support/xlocale/__posix_l_fallback.h:13
@@ +12,3 @@
+// extended locale support for libc's that normally don't have any (like
+// Android's bionic, and Newlib).
+//===--===//

extra comma


Comment at: include/support/xlocale/__posix_l_fallback.h:23
@@ +22,3 @@
+
+static inline int isalnum_l(int c, locale_t) {
+  return isalnum(c);

Instead of `static inline`, how about you mark these as `_LIBCPP_ALWAYS_INLINE`?

Also, do you want to write them as `return ::isalnum(c);`  
(I don't know the answer here, but they're definitely not in namespace `std`)



Comment at: include/support/xlocale/__strtonum_fallback.h:22
@@ +21,3 @@
+#endif
+static inline long double strtold_l(const char *nptr, char **endptr, locale_t) 
{
+  return strtold(nptr, endptr);

Again with the inline and `::` bits.



http://reviews.llvm.org/D17416



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


Re: [PATCH] D20052: Add new ASTMatcher that matches dynamic exception specifications.

2016-05-16 Thread don hinton via cfe-commits
hintonda added a comment.

Great, thanks again.  This has been a great learning experience.


http://reviews.llvm.org/D20052



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


Re: [PATCH] D18369: [OpenCL] Upstreaming khronos OpenCL header file.

2016-05-16 Thread Yaxun Liu via cfe-commits
yaxunl added inline comments.


Comment at: lib/Headers/opencl-c.h:17051
@@ +17050,3 @@
+#define CLK_SUCCESS 0
+#define CLK_ENQUEUE_FAILURE -101
+#define CLK_INVALID_QUEUE   -102

Anastasia wrote:
> Are those arbitrary taken values I am guessing?
How about this?

  // The value are defined according to their order in the spec.
  #define CLK_SUCCESS 0
  #define CLK_ENQUEUE_FAILURE -1
  #define CLK_INVALID_QUEUE   -2
  #define CLK_INVALID_NDRANGE -3
  #define CLK_INVALID_EVENT_WAIT_LIST -4
  #define CLK_DEVICE_QUEUE_FULL   -5
  #define CLK_INVALID_ARG_SIZE-6
  #define CLK_EVENT_ALLOCATION_FAILURE-8
  #define CLK_OUT_OF_RESOURCES-9



http://reviews.llvm.org/D18369



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


Re: [PATCH] D20287: [Coverage] Ensure that the hash for a used function is non-zero.

2016-05-16 Thread Igor Kudrin via cfe-commits
ikudrin added a comment.

Does anyone known, why we need dummy coverage mapping records for unused 
functions? How are they used? Isn't it better to remove these dummy records to 
prevent confusion with the real ones?


http://reviews.llvm.org/D20287



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


Re: [PATCH] D20192: [Sema] Fix bug to do with lookup of template friend function in namespace

2016-05-16 Thread Meador Inge via cfe-commits
meadori added a subscriber: meadori.
meadori added a comment.

I see failure when running the Clang test suite with this patch:

  Command Output (stderr):
  --
  error: 'error' diagnostics expected but not seen: 
File 
/Users/meadori/Code/src/llvm/llvm-mainline/tools/clang/test/SemaTemplate/friend-template.cpp
 Line 80: template non-type parameter has a different type 'long' in template 
redeclaration
File 
/Users/meadori/Code/src/llvm/llvm-mainline/tools/clang/test/SemaTemplate/friend-template.cpp
 Line 304: different type 'char' in template redeclaration
  error: 'error' diagnostics seen but not expected: 
File 
/Users/meadori/Code/src/llvm/llvm-mainline/tools/clang/test/SemaTemplate/friend-template.cpp
 Line 79: template non-type parameter has a different type 'long' in template 
redeclaration
File 
/Users/meadori/Code/src/llvm/llvm-mainline/tools/clang/test/SemaTemplate/friend-template.cpp
 Line 303: template non-type parameter has a different type 'char' in template 
redeclaration
  error: 'note' diagnostics expected but not seen: 
File 
/Users/meadori/Code/src/llvm/llvm-mainline/tools/clang/test/SemaTemplate/friend-template.cpp
 Line 73: previous non-type template parameter with type 'int' is here
File 
/Users/meadori/Code/src/llvm/llvm-mainline/tools/clang/test/SemaTemplate/friend-template.cpp
 Line 300: previous non-type template parameter with type 'int' is here
  error: 'note' diagnostics seen but not expected: 
File 
/Users/meadori/Code/src/llvm/llvm-mainline/tools/clang/test/SemaTemplate/friend-template.cpp
 Line 72: previous non-type template parameter with type 'int' is here
File 
/Users/meadori/Code/src/llvm/llvm-mainline/tools/clang/test/SemaTemplate/friend-template.cpp
 Line 299: previous non-type template parameter with type 'int' is here
  8 errors generated.


http://reviews.llvm.org/D20192



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


Re: [PATCH] D20287: [Coverage] Ensure that the hash for a used function is non-zero.

2016-05-16 Thread Igor Kudrin via cfe-commits
ikudrin added a comment.

The motivation sample (using llvm-cov with http://reviews.llvm.org/D20286 
applied):

  $ cat > sample.h << EOF
  inline int sample_func(int A) {
return A;
  }
  EOF
  $ cat > dummy.cpp << EOF
  #include "sample.h"
  EOF
  $ cat > sample.cpp << EOF
  #include "sample.h"
  
  int main() {
return sample_func(5);
  }
  EOF
  $ clang++ -fprofile-instr-generate -fcoverage-mapping dummy.cpp sample.cpp
  $ ./a.out
  $ llvm-profdata merge -o default.profdata default.profraw
  $ llvm-cov show a.out -instr-profile default.profdata
  sample.h:
0|1|inline int sample_func(int A) {
0|2|  return A;
0|3|}
  
  sample.cpp:
 |1|#include "sample.h"
 |2|
1|3|int main() {
1|4|  return sample_func(5);
1|5|}

And if this patch is applied:

  $ clang++ -fprofile-instr-generate -fcoverage-mapping dummy.cpp sample.cpp
  $ ./a.out
  $ llvm-profdata merge -o default.profdata default.profraw
  $ llvm-cov show a.out -instr-profile default.profdata
  sample.h:
1|1|inline int sample_func(int A) {
1|2|  return A;
1|3|}
  
  sample.cpp:
 |1|#include "sample.h"
 |2|
1|3|int main() {
1|4|  return sample_func(5);
1|5|}


http://reviews.llvm.org/D20287



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


Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications

2016-05-16 Thread don hinton via cfe-commits
hintonda updated this revision to Diff 57357.
hintonda added a comment.

- Revert back to previous version of the matcher and use Aaron's syntax with 
allOf and unless to achieve the same results -- much simpler.


http://reviews.llvm.org/D18575

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

Index: test/clang-tidy/modernize-use-noexcept.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept.cpp
@@ -0,0 +1,22 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -- -std=c++11
+
+class A {};
+class B {};
+
+void foo() throw();
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function ''foo'' uses dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void foo() noexcept;
+
+void bar() throw(...);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function ''bar'' uses dynamic exception specification 'throw(...)' [modernize-use-noexcept]
+// CHECK-FIXES: void bar() noexcept(false);
+
+void foobar() throw(A, B)
+{}
+// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function ''foobar'' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+// CHECK-FIXES: void foobar() noexcept(false)
+
+// Should not trigger a replacement.
+void titi() noexcept {}
+void toto() noexcept(true) {}
Index: test/clang-tidy/modernize-use-noexcept-macro.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept-macro.cpp
@@ -0,0 +1,18 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \
+// RUN:   -- -std=c++11
+
+#define NOEXCEPT noexcept
+
+void bar() throw() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function ''bar'' uses dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void bar() NOEXCEPT {}
+
+// Should not trigger a FixItHint
+class A {};
+class B {};
+void foobar() throw(A, B);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function ''foobar'' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+
+// Should not trigger a replacement.
+void foo() noexcept(true);
Index: docs/clang-tidy/checks/modernize-use-noexcept.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-use-noexcept.rst
@@ -0,0 +1,50 @@
+.. title:: clang-tidy - modernize-use-noexcept
+
+modernize-use-noexcept
+==
+
+The check converts dynamic exception specifications, e.g., ``throw()``,
+``throw([,...])``, or ``throw(...)`` to ``noexcept``, ``noexcept(false)``,
+or a user defined macro.
+
+Example
+---
+
+.. code-block:: c++
+
+  void foo() throw();
+	void bar() throw(int) {}
+
+transforms to:
+
+.. code-block:: c++
+
+  void foo() noexcept;
+	void bar() noexcept(false) {}
+
+
+User defined macros
+---
+
+By default this check will only replace ``throw()`` with ``noexcept``,
+and ``throw([,...])`` or ``throw(...)`` with
+``noexcept(false)``.  Additionally, users can also use
+:option:`ReplacementString` to specify a macro to use instead of
+``noexcept``.  This is useful when maintaining source code that must
+be compiled with older compilers that don't support the ``noexcept``
+keyword.
+
+Example
+^^^
+
+.. code-block:: c++
+
+  void foo() throw() {}
+
+transforms to:
+
+.. code-block:: c++
+
+  void foo() NOEXCEPT {}
+
+if the :option:`ReplacementString` option is set to `NOEXCEPT`.
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -191,6 +191,11 @@
   Selectively replaces string literals containing escaped characters with raw
   string literals.
 
+- New `modernize-use-noexcept
+  `_ check
+
+  Replaces dynamic exception specifications with ``noexcept`` or a user defined macro.
+
 - New `performance-faster-string-find
   `_ check
 
Index: clang-tidy/utils/LexerUtils.h
===
--- clang-tidy/utils/LexerUtils.h
+++ clang-tidy/utils/LexerUtils.h
@@ -12,6 +12,7 @@
 
 #include "clang/AST/ASTContext.h"
 #include "clang/Lex/Lexer.h"
+#include "llvm/ADT/SmallVector.h"
 
 namespace clang {
 namespace tidy {
@@ -23,6 +24,10 @@
 Token getPreviousNonCommentToken(const 

Re: [PATCH] D20052: Add new ASTMatcher that matches dynamic exception specifications.

2016-05-16 Thread don hinton via cfe-commits
hintonda updated this revision to Diff 57356.
hintonda added a comment.

Revert back to previous version.


http://reviews.llvm.org/D20052

Files:
  docs/LibASTMatchersReference.html
  include/clang/ASTMatchers/ASTMatchers.h
  lib/ASTMatchers/Dynamic/Registry.cpp
  unittests/ASTMatchers/ASTMatchersTest.cpp

Index: unittests/ASTMatchers/ASTMatchersTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -3552,6 +3552,22 @@
   pointsTo(TypeMatcher(anything()));
 }
 
+TEST(hasDynamicExceptionSpec, MatchesDynamicExceptionSpecifications) {
+  EXPECT_TRUE(notMatches("void f();", 
functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(notMatches("void g() noexcept;",
+ functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(notMatches("void h() noexcept(true);",
+ functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(notMatches("void i() noexcept(false);",
+ functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(
+  matches("void j() throw();", functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(
+  matches("void k() throw(int);", 
functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(
+  matches("void l() throw(...);", 
functionDecl(hasDynamicExceptionSpec(;
+}
+
 TEST(HasImplicitDestinationType, MatchesSimpleCase) {
   // This test creates an implicit const cast.
   EXPECT_TRUE(matches("int x; const int i = x;",
Index: lib/ASTMatchers/Dynamic/Registry.cpp
===
--- lib/ASTMatchers/Dynamic/Registry.cpp
+++ lib/ASTMatchers/Dynamic/Registry.cpp
@@ -218,6 +218,7 @@
   REGISTER_MATCHER(hasDeducedType);
   REGISTER_MATCHER(hasDescendant);
   REGISTER_MATCHER(hasDestinationType);
+  REGISTER_MATCHER(hasDynamicExceptionSpec);
   REGISTER_MATCHER(hasEitherOperand);
   REGISTER_MATCHER(hasElementType);
   REGISTER_MATCHER(hasElse);
Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -3212,6 +3212,26 @@
   return Node.isDefaulted();
 }
 
+/// \brief Matches functions that have a dynamic exception specification.
+///
+/// Given:
+/// \code
+///   void f();
+///   void g() noexcept;
+///   void h() noexcept(true);
+///   void i() noexcept(false);
+///   void j() throw();
+///   void k() throw(int);
+///   void l() throw(...);
+/// \endcode
+/// functionDecl(hasDynamicExceptionSpec())
+///   matches the declarations of j, k, and l, but not f, g, h, or i.
+AST_MATCHER(FunctionDecl, hasDynamicExceptionSpec) {
+  if (const auto *FnTy = Node.getType()->getAs())
+return FnTy->hasDynamicExceptionSpec();
+  return false;
+}
+
 /// \brief Matches functions that have a non-throwing exception specification.
 ///
 /// Given:
Index: docs/LibASTMatchersReference.html
===
--- docs/LibASTMatchersReference.html
+++ docs/LibASTMatchersReference.html
@@ -2371,6 +2371,22 @@
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclhasDynamicExceptionSpec
+Matches 
functions that have a dynamic exception specification.
+
+Given:
+  void f();
+  void g() noexcept;
+  void h() noexcept(true);
+  void i() noexcept(false);
+  void j() throw();
+  void k() throw(int);
+  void l() throw(...);
+functionDecl(hasDynamicExceptionSpec())
+  matches the declarations of j, k, and l, but not f, g, h, or i.
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclhasOverloadedOperatorNameStringRef
 Name
 Matches 
overloaded operator names.
 


Index: unittests/ASTMatchers/ASTMatchersTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -3552,6 +3552,22 @@
   pointsTo(TypeMatcher(anything()));
 }
 
+TEST(hasDynamicExceptionSpec, MatchesDynamicExceptionSpecifications) {
+  EXPECT_TRUE(notMatches("void f();", functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(notMatches("void g() noexcept;",
+ functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(notMatches("void h() noexcept(true);",
+ functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(notMatches("void i() noexcept(false);",
+ functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(
+  matches("void j() throw();", functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(
+  matches("void k() throw(int);", functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(
+  matches("void l() throw(...);", functionDecl(hasDynamicExceptionSpec(;
+}
+
 

Re: [PATCH] D20254: [Clang] Fix some Clang-tidy modernize-use-bool-literals warnings; other minor fixes.

2016-05-16 Thread Hans Wennborg via cfe-commits
hans added a comment.

I'd leave out the blank lines between DEF_TRAVERSE_STMTs, but the rest looks 
good.



Comment at: include/clang/AST/RecursiveASTVisitor.h:2014
@@ -2002,2 +2013,3 @@
 DEF_TRAVERSE_STMT(ObjCAutoreleasePoolStmt, {})
+
 DEF_TRAVERSE_STMT(CXXForRangeStmt, {

I'm not sure about the blank lines in these DEF_TRAVERSE_STMTs. I don't really 
see what the logic is.


Repository:
  rL LLVM

http://reviews.llvm.org/D20254



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


Re: [PATCH] D20052: Add new ASTMatcher that matches dynamic exception specifications.

2016-05-16 Thread don hinton via cfe-commits
hintonda added a comment.

Great, that's exactly what I needed.  I'll revert back to the previous version.


http://reviews.llvm.org/D20052



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


Re: [PATCH] D20052: Add new ASTMatcher that matches dynamic exception specifications.

2016-05-16 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

In http://reviews.llvm.org/D20052#430903, @hintonda wrote:

> Great, unless() was what I was missing.  I'll refactor along those lines.
>
> As for what I'm trying to achieve, I want a set containing "throw()" and 
> another set containing "throw(something)".  If there's a cleaner way to 
> achieve that with an existing matcher, please let me know.


`allOf(hasDynamicExceptionSpecification(), isNoThrow())` gets you "throw()" and 
`allOf(hasDynamicExceptionSpecification(), unless(isNoThrow())` gets you 
"throw(something)", doesn't it?


http://reviews.llvm.org/D20052



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


Re: [PATCH] D20266: [Modules] Use vfs for (recursive) directory iteration

2016-05-16 Thread Ben Langmuir via cfe-commits
benlangmuir accepted this revision.
benlangmuir added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D20266



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


Re: [PATCH] D20052: Add new ASTMatcher that matches dynamic exception specifications.

2016-05-16 Thread don hinton via cfe-commits
hintonda added a comment.

Great, unless() was what I was missing.  I'll refactor along those lines.

As for what I'm trying to achieve, I want a set containing "throw()" and 
another set containing "throw(something)".  If there's a cleaner way to achieve 
that with an existing matcher, please let me know.


http://reviews.llvm.org/D20052



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


Re: [PATCH] D20052: Add new ASTMatcher that matches dynamic exception specifications.

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

I'm not keen on the new direction this patch has taken. 
`hasDynamicExceptionSpec(isThrow())` is quite novel. What is the problem you 
are trying to solve with this?



Comment at: include/clang/ASTMatchers/ASTMatchers.h:3251
@@ +3250,3 @@
+///   matches the declarations of f, i, and j but not g or h.
+AST_MATCHER(FunctionDecl, isThrow) {
+  if (const auto *FnTy = Node.getType()->getAs())

I'm not comfortable with this matcher; users can use `unless(isNoThrow())` to 
get this behavior already.


http://reviews.llvm.org/D20052



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


Re: [PATCH] D19667: [ubsan] Minimize size of data for type_mismatch

2016-05-16 Thread Filipe Cabecinhas via cfe-commits
filcab updated this revision to Diff 57350.
filcab added a comment.

Added a version field.


http://reviews.llvm.org/D19667

Files:
  lib/CodeGen/CGExpr.cpp
  test/CodeGen/catch-undef-behavior.c

Index: test/CodeGen/catch-undef-behavior.c
===
--- test/CodeGen/catch-undef-behavior.c
+++ test/CodeGen/catch-undef-behavior.c
@@ -6,16 +6,16 @@
 // CHECK-UBSAN: @[[INT:.*]] = private unnamed_addr constant { i16, i16, [6 x 
i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
 
 // FIXME: When we only emit each type once, use [[INT]] more below.
-// CHECK-UBSAN: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 
100, i32 5 {{.*}} @[[INT]], i64 4, i8 1
-// CHECK-UBSAN: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 10 {{.*}}, i64 4, i8 0
+// CHECK-UBSAN: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 
100, i32 5 {{.*}} @[[INT]], i8 2, i8 2, i8 1
+// CHECK-UBSAN: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 10 {{.*}}, i8 2, i8 2, 
i8 0
 // CHECK-UBSAN: @[[LINE_300:.*]] = {{.*}}, i32 300, i32 12 {{.*}} @{{.*}}, 
{{.*}} @{{.*}}
 // CHECK-UBSAN: @[[LINE_400:.*]] = {{.*}}, i32 400, i32 12 {{.*}} @{{.*}}, 
{{.*}} @{{.*}}
-// CHECK-UBSAN: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 10 {{.*}} @{{.*}}, i64 
4, i8 0 }
-// CHECK-UBSAN: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 3 {{.*}} @{{.*}}, i64 
4, i8 1 }
+// CHECK-UBSAN: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 10 {{.*}} @{{.*}}, i8 
2, i8 2, i8 0 }
+// CHECK-UBSAN: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 3 {{.*}} @{{.*}}, i8 
2, i8 2, i8 1 }
 
 // CHECK-UBSAN: @[[STRUCT_S:.*]] = private unnamed_addr constant { i16, i16, 
[11 x i8] } { i16 -1, i16 0, [11 x i8] c"'struct S'\00" }
 
-// CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} 
@[[STRUCT_S]], i64 4, i8 3 }
+// CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} 
@[[STRUCT_S]], i8 2, i8 2, i8 3 }
 // CHECK-UBSAN: @[[LINE_800:.*]] = {{.*}}, i32 800, i32 12 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LINE_900:.*]] = {{.*}}, i32 900, i32 11 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LINE_1000:.*]] = {{.*}}, i32 1000, i32 10 {{.*}} @{{.*}} }
Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -583,12 +583,15 @@
   }
 
   if (Checks.size() > 0) {
+// Make sure we're not losing information. Alignment needs to be a power of
+// 2
+assert(!AlignVal || (uint64_t)1 << llvm::Log2_64(AlignVal) == AlignVal);
+const unsigned TypeMismatchDataVersion = 2;
 llvm::Constant *StaticData[] = {
- EmitCheckSourceLocation(Loc),
-  EmitCheckTypeDescriptor(Ty),
-  llvm::ConstantInt::get(SizeTy, AlignVal),
-  llvm::ConstantInt::get(Int8Ty, TCK)
-};
+EmitCheckSourceLocation(Loc), EmitCheckTypeDescriptor(Ty),
+llvm::ConstantInt::get(Int8Ty, TypeMismatchDataVersion),
+llvm::ConstantInt::get(Int8Ty, AlignVal ? llvm::Log2_64(AlignVal) : 1),
+llvm::ConstantInt::get(Int8Ty, TCK)};
 EmitCheck(Checks, "type_mismatch", StaticData, Ptr);
   }
 


Index: test/CodeGen/catch-undef-behavior.c
===
--- test/CodeGen/catch-undef-behavior.c
+++ test/CodeGen/catch-undef-behavior.c
@@ -6,16 +6,16 @@
 // CHECK-UBSAN: @[[INT:.*]] = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
 
 // FIXME: When we only emit each type once, use [[INT]] more below.
-// CHECK-UBSAN: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 100, i32 5 {{.*}} @[[INT]], i64 4, i8 1
-// CHECK-UBSAN: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 10 {{.*}}, i64 4, i8 0
+// CHECK-UBSAN: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 100, i32 5 {{.*}} @[[INT]], i8 2, i8 2, i8 1
+// CHECK-UBSAN: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 10 {{.*}}, i8 2, i8 2, i8 0
 // CHECK-UBSAN: @[[LINE_300:.*]] = {{.*}}, i32 300, i32 12 {{.*}} @{{.*}}, {{.*}} @{{.*}}
 // CHECK-UBSAN: @[[LINE_400:.*]] = {{.*}}, i32 400, i32 12 {{.*}} @{{.*}}, {{.*}} @{{.*}}
-// CHECK-UBSAN: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 10 {{.*}} @{{.*}}, i64 4, i8 0 }
-// CHECK-UBSAN: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 3 {{.*}} @{{.*}}, i64 4, i8 1 }
+// CHECK-UBSAN: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 10 {{.*}} @{{.*}}, i8 2, i8 2, i8 0 }
+// CHECK-UBSAN: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 3 {{.*}} @{{.*}}, i8 2, i8 2, i8 1 }
 
 // CHECK-UBSAN: @[[STRUCT_S:.*]] = private unnamed_addr constant { i16, i16, [11 x i8] } { i16 -1, i16 0, [11 x i8] c"'struct S'\00" }
 
-// CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} @[[STRUCT_S]], i64 4, i8 3 }
+// CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} @[[STRUCT_S]], i8 2, i8 2, i8 3 }
 // CHECK-UBSAN: @[[LINE_800:.*]] = {{.*}}, i32 800, i32 12 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LINE_900:.*]] = {{.*}}, i32 900, i32 11 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LINE_1000:.*]] = {{.*}}, i32 

[clang-tools-extra] r269656 - [clang-tidy] Cleanups utils files

2016-05-16 Thread Etienne Bergeron via cfe-commits
Author: etienneb
Date: Mon May 16 09:34:20 2016
New Revision: 269656

URL: http://llvm.org/viewvc/llvm-project?rev=269656=rev
Log:
[clang-tidy] Cleanups utils files

Summary:
Cleanup some code by using appropriate APIs.
Some coding style cleanups.

There is no behavior changes.

 - Function `IncludeSorter::CreateFixIt` can be replaced by 
`FixItHint::CreateReplacement`.
 - Function `cleanPath` is a wrapper for `llvm::sys::path::remove_dots`.

Reviewers: alexfh

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp
clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.cpp
clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.h
clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp
clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.h
clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp
clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.h
clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp

Modified: clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp?rev=269656=269655=269656=diff
==
--- clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp Mon May 16 
09:34:20 2016
@@ -15,7 +15,7 @@
 
 namespace clang {
 namespace tidy {
-namespace utils {  
+namespace utils {
 namespace decl_ref_expr {
 
 using namespace ::clang::ast_matchers;

Modified: clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.cpp?rev=269656=269655=269656=diff
==
--- clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.cpp Mon 
May 16 09:34:20 2016
@@ -9,6 +9,7 @@
 
 #include "HeaderFileExtensionsUtils.h"
 #include "clang/Basic/CharInfo.h"
+#include "llvm/Support/Path.h"
 
 namespace clang {
 namespace tidy {

Modified: clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.h?rev=269656=269655=269656=diff
==
--- clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.h 
(original)
+++ clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.h Mon 
May 16 09:34:20 2016
@@ -10,13 +10,10 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADER_FILE_EXTENSIONS_UTILS_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADER_FILE_EXTENSIONS_UTILS_H
 
-#include 
-
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/SmallSet.h"
-#include "llvm/Support/Path.h"
 
 namespace clang {
 namespace tidy {

Modified: clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp?rev=269656=269655=269656=diff
==
--- clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp Mon May 16 
09:34:20 2016
@@ -19,29 +19,16 @@ namespace tidy {
 namespace utils {
 
 /// \brief canonicalize a path by removing ./ and ../ components.
-// FIXME: Consider moving this to llvm::sys::path.
 static std::string cleanPath(StringRef Path) {
-  SmallString<256> NewPath;
-  for (auto I = llvm::sys::path::begin(Path), E = llvm::sys::path::end(Path);
-   I != E; ++I) {
-if (*I == ".")
-  continue;
-if (*I == "..") {
-  // Drop the last component.
-  NewPath.resize(llvm::sys::path::parent_path(NewPath).size());
-} else {
-  if (!NewPath.empty() && !NewPath.endswith("/"))
-NewPath += '/';
-  NewPath += *I;
-}
-  }
-  return NewPath.str();
+  SmallString<256> Result =  Path;
+  llvm::sys::path::remove_dots(Result, true);
+  return Result.str();
 }
 
 namespace {
 class HeaderGuardPPCallbacks : public PPCallbacks {
 public:
-  explicit HeaderGuardPPCallbacks(Preprocessor *PP, HeaderGuardCheck *Check)
+  HeaderGuardPPCallbacks(Preprocessor *PP, HeaderGuardCheck *Check)
   : PP(PP), Check(Check) {}
 
   void FileChanged(SourceLocation Loc, FileChangeReason Reason,

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

Re: [PATCH] D20196: [clang-tidy] Inefficient string operation

2016-05-16 Thread Bittner Barni via cfe-commits
bittnerbarni updated this revision to Diff 57346.

http://reviews.llvm.org/D20196

Files:
  clang-tidy/performance/CMakeLists.txt
  clang-tidy/performance/InefficientStringAdditionCheck.cpp
  clang-tidy/performance/InefficientStringAdditionCheck.h
  clang-tidy/performance/PerformanceTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/performance-inefficient-string-addition.rst
  test/clang-tidy/performance-inefficient-string-addition.cpp

Index: test/clang-tidy/performance-inefficient-string-addition.cpp
===
--- /dev/null
+++ test/clang-tidy/performance-inefficient-string-addition.cpp
@@ -0,0 +1,44 @@
+// RUN: %check_clang_tidy %s performance-inefficient-string-addition %t
+
+namespace std {
+template 
+class basic_string {
+public:
+  basic_string() {}
+  ~basic_string() {}
+  basic_string *operator+=(const basic_string &) {}
+  friend basic_string operator+(const basic_string &, const basic_string &) {}
+};
+typedef basic_string string;
+typedef basic_string wstring;
+}
+
+void f(std::string) {}
+std::string g(std::string) {}
+
+int main() {
+  std::string mystr1, mystr2;
+  std::wstring mywstr1, mywstr2;
+
+  for (int i = 0; i < 10; ++i) {
+f(mystr1 + mystr2 + mystr1);
+// CHECK-MESSAGES: :[[@LINE-1]]:23: warning: Inefficient string concatenation
+mystr1 = mystr1 + mystr2;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: Ineff
+mystr1 = mystr2 + mystr2 + mystr2;
+// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: Ineff
+mystr1 = mystr2 + mystr1;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: Ineff
+mywstr1 = mywstr2 + mywstr1;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: Ineff
+mywstr1 = mywstr2 + mywstr2 + mywstr2;
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: Ineff
+
+mywstr1 = mywstr2 + mywstr2;
+mystr1 = mystr2 + mystr2;
+mystr1 += mystr2;
+f(mystr2 + mystr1);
+mystr1 = g(mystr1);
+  }
+  return 0;
+}
Index: docs/clang-tidy/checks/performance-inefficient-string-addition.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/performance-inefficient-string-addition.rst
@@ -0,0 +1,55 @@
+.. title:: clang-tidy - performance-inefficient-string-addition
+
+performance-inefficient-string-addition
+===
+
+The problem
+---
+This check is to warn about the performance overhead arising from concatenating strings, using the ``operator+``, for instance:
+
+.. code:: c++
+
+std::string a("Foo"), b("Bar");
+a = a + b;
+
+Instead of this structure you should use ``operator+=`` or std::string's (std::basic_string) class member function ``append``. For instance:
+   
+.. code:: c++
+
+   std::string a("Foo"), b("Baz");
+   for(int i = 0; i < 2; ++i)
+   {
+   a = a + "Bar" + b;
+   }
+
+Could be rewritten in a greatly more efficient way like:
+
+.. code:: c++
+
+   std::string a("Foo"), b("Baz");
+   for(int i = 0; i < 2; ++i)
+   {
+   a.append("Bar").append(b);
+   } 
+
+And this can be rewritten too:
+ 
+ .. code:: c++
+  
+   void f(const std::string&){}
+   std::string a("Foo"), b("Baz");
+   void g()
+   {
+   f(a + "Bar" + b);
+   }
+
+In a slightly more efficient way like:
+
+.. code:: c++
+
+   void f(const std::string&){}
+   std::string a("Foo"), b("Baz");
+   void g()
+   {
+   f(std::string(a).append("Bar").append(b));
+   }
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -102,6 +102,7 @@
performance-faster-string-find
performance-for-range-copy
performance-implicit-cast-in-loop
+   performance-inefficient-string-addition
performance-unnecessary-copy-initialization
performance-unnecessary-value-param
readability-avoid-const-params-in-decls
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -184,6 +184,12 @@
   Warns about range-based loop with a loop variable of const ref type where the
   type of the variable does not match the one returned by the iterator.
 
+- New `performance-inefficient-string-addition
+  `_ check
+
+  This check is to warn about the performance overhead arising from concatenating 
+  strings, using the operator+, instead of operator+=.
+  
 - New `performance-unnecessary-value-param
   `_ check
 
Index: clang-tidy/performance/PerformanceTidyModule.cpp
===
--- clang-tidy/performance/PerformanceTidyModule.cpp
+++ clang-tidy/performance/PerformanceTidyModule.cpp
@@ -10,6 +10,7 @@
 #include 

Re: [patch] Don't use appending linkage for embeded bitcode

2016-05-16 Thread Rafael EspĂ­ndola via cfe-commits
+  auto Used = collectUsedGlobalVariables(*M, UsedGlobals, true);

Please use an explicit type instead of auto.

You deleted the assert

I think this is fine otherwise.

Cheers,
Rafael





On 13 May 2016 at 20:00, Steven Wu  wrote:
>
>> On May 13, 2016, at 3:56 PM, Duncan P. N. Exon Smith  
>> wrote:
>>
>> Is this something that you need the linker to treat as "used", or just 
>> something you don't want the compiler to drop?  If the latter, 
>> @llvm.compiler.used seems more appropriate.
>
> Bitcode is actually not really used by the compiler during compilation and 
> shouldn't really used by any part of the code. llvm.compiler.used then.
>
> New patch.
>
>
>
>
> Steven
>
>>
>>> On 2016-May-13, at 14:01, Steven Wu  wrote:
>>>
>>> Attach a patch using private linkage type and adding to llvm.used. I have 
>>> to recreate llvm.used when embedding bitcode. I don't really like it but I 
>>> don't have better solutions.
>>> Few other options:
>>> 1. Not allowing re-embedded bitcode will simplify the code a bit but not a 
>>> lot.
>>> 2. Create a new "llvm.*.used" variable in llvm.metadata section.
>>> 3. Teach optimizer do not optimize away llvm.* variables.
>>>
>>> <0001-Fix-embed-bitcode-linkage-type.patch>
>>>
>>> Steven
>>>
 On May 13, 2016, at 10:10 AM, Rafael EspĂ­ndola 
  wrote:

 On 13 May 2016 at 13:02, Steven Wu  wrote:
> Hi Rafael
>
> Thanks for notice this! That would definitely cause duplicated symbol 
> error and I should definitely change that.
> Here is some background:
> ld64 in Xcode 7+ knows how to handle the embedded bitcode correctly but 
> not the ones in earlier Xcode. The old ld64 will simply concatenate the 
> bitcode files which is not the right thing to do. So there is a symbol 
> generated at the place to prevent user to link the bitcode object file 
> with old ld64 because older ld64 will fail and report duplicated symbols.
> I have a radar tracking to change the linkage type when upstream but I 
> dropped the ball on that one. The correct thing to do is to make it 
> internal and add to llvm.used. I will come up with a patch.

 Thank you so much!

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


Re: [PATCH] D20171: Support for MSVS default calling convention options (/Gd, /Gz, /Gv, /Gr)

2016-05-16 Thread Alexander Makarov via cfe-commits
a.makarov updated this revision to Diff 57344.
a.makarov added a comment.

I've updated the patch. Please take a look.


http://reviews.llvm.org/D20171

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Basic/LangOptions.h
  include/clang/Driver/CC1Options.td
  include/clang/Driver/CLCompatOptions.td
  lib/AST/ASTContext.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGenCXX/default_calling_conv.cpp

Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3954,7 +3954,7 @@
   }
 
   if (Args.hasFlag(options::OPT_mrtd, options::OPT_mno_rtd, false))
-CmdArgs.push_back("-mrtd");
+CmdArgs.push_back("-fdefault-calling-conv=stdcall");
 
   if (shouldUseFramePointer(Args, getToolChain().getTriple()))
 CmdArgs.push_back("-mdisable-fp-elim");
@@ -6140,6 +6140,15 @@
   CmdArgs.push_back("-fms-memptr-rep=virtual");
   }
 
+  if (Args.getLastArg(options::OPT__SLASH_Gd))
+ CmdArgs.push_back("-fdefault-calling-conv=cdecl");
+  else if (Args.getLastArg(options::OPT__SLASH_Gr))
+ CmdArgs.push_back("-fdefault-calling-conv=fastcall");
+  else if (Args.getLastArg(options::OPT__SLASH_Gz))
+ CmdArgs.push_back("-fdefault-calling-conv=stdcall");
+  else if (Args.getLastArg(options::OPT__SLASH_Gv))
+ CmdArgs.push_back("-fdefault-calling-conv=vectorcall");
+
   if (Arg *A = Args.getLastArg(options::OPT_vtordisp_mode_EQ))
 A->render(Args, CmdArgs);
 
Index: lib/AST/ASTContext.cpp
===
--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -8605,8 +8605,25 @@
   if (IsCXXMethod)
 return ABI->getDefaultMethodCallConv(IsVariadic);
 
-  if (LangOpts.MRTD && !IsVariadic) return CC_X86StdCall;
-
+  switch (LangOpts.getDefaultCallingConv()) {
+  case LangOptions::DCC_None:
+break;
+  case LangOptions::DCC_CDecl:
+return CC_C;
+  case LangOptions::DCC_FastCall:
+if (getTargetInfo().hasFeature("sse2"))
+  return CC_X86FastCall;
+break;
+  case LangOptions::DCC_StdCall:
+if (!IsVariadic)
+  return CC_X86StdCall;
+break;
+  case LangOptions::DCC_VectorCall:
+// __vectorcall cannot be applied to variadic functions.
+if (!IsVariadic)
+  return CC_X86VectorCall;
+break;
+  }
   return Target->getDefaultCallingConv(TargetInfo::CCMT_Unknown);
 }
 
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -3895,11 +3895,12 @@
 
 // This convention is not valid for the target. Use the default function or
 // method calling convention.
-TargetInfo::CallingConvMethodType MT = TargetInfo::CCMT_Unknown;
-if (FD)
-  MT = FD->isCXXInstanceMember() ? TargetInfo::CCMT_Member : 
-TargetInfo::CCMT_NonMember;
-CC = TI.getDefaultCallingConv(MT);
+bool IsCXXMethod = false, IsVariadic = false;
+if (FD) {
+  IsCXXMethod = FD->isCXXInstanceMember();
+  IsVariadic = FD->isVariadic();
+}
+CC = Context.getDefaultCallingConvention(IsVariadic, IsCXXMethod);
   }
 
   attr.setProcessingCache((unsigned) CC);
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1772,7 +1772,6 @@
   Opts.NoBitFieldTypeAlign = Args.hasArg(OPT_fno_bitfield_type_align);
   Opts.SinglePrecisionConstants = Args.hasArg(OPT_cl_single_precision_constant);
   Opts.FastRelaxedMath = Args.hasArg(OPT_cl_fast_relaxed_math);
-  Opts.MRTD = Args.hasArg(OPT_mrtd);
   Opts.HexagonQdsp6Compat = Args.hasArg(OPT_mqdsp6_compat);
   Opts.FakeAddressSpaceMap = Args.hasArg(OPT_ffake_address_space_map);
   Opts.ParseUnknownAnytype = Args.hasArg(OPT_funknown_anytype);
@@ -1849,6 +1848,49 @@
 Opts.setMSPointerToMemberRepresentationMethod(InheritanceModel);
   }
 
+  // Check for MS default calling conventions being specified.
+  if (Arg *A = Args.getLastArg(OPT_fdefault_calling_conv_EQ)) {
+LangOptions::DefaultCallingConvention DefaultCC =
+llvm::StringSwitch(
+A->getValue())
+.Case("cdecl", LangOptions::DCC_CDecl)
+.Case("fastcall", LangOptions::DCC_FastCall)
+.Case("stdcall", LangOptions::DCC_StdCall)
+.Case("vectorcall", LangOptions::DCC_VectorCall)
+.Default(LangOptions::DCC_None);
+if (DefaultCC == LangOptions::DCC_None)
+  Diags.Report(diag::err_drv_invalid_value)
+  << "-fdefault-calling-conv=" << A->getValue();
+
+llvm::Triple T(TargetOpts.Triple);
+llvm::Triple::ArchType Arch = T.getArch();
+bool emitError = (DefaultCC == LangOptions::DCC_FastCall ||
+  DefaultCC == LangOptions::DCC_StdCall) &&
+ Arch != llvm::Triple::x86;
+

Re: [PATCH] D19667: [ubsan] Minimize size of data for type_mismatch

2016-05-16 Thread Filipe Cabecinhas via cfe-commits
filcab updated this revision to Diff 57342.
filcab added a comment.

Minor update which never sets an AlignVal to 0.


http://reviews.llvm.org/D19667

Files:
  lib/CodeGen/CGExpr.cpp
  test/CodeGen/catch-undef-behavior.c

Index: test/CodeGen/catch-undef-behavior.c
===
--- test/CodeGen/catch-undef-behavior.c
+++ test/CodeGen/catch-undef-behavior.c
@@ -6,16 +6,16 @@
 // CHECK-UBSAN: @[[INT:.*]] = private unnamed_addr constant { i16, i16, [6 x 
i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
 
 // FIXME: When we only emit each type once, use [[INT]] more below.
-// CHECK-UBSAN: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 
100, i32 5 {{.*}} @[[INT]], i64 4, i8 1
-// CHECK-UBSAN: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 10 {{.*}}, i64 4, i8 0
+// CHECK-UBSAN: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 
100, i32 5 {{.*}} @[[INT]], i8 2, i8 1
+// CHECK-UBSAN: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 10 {{.*}}, i8 2, i8 0
 // CHECK-UBSAN: @[[LINE_300:.*]] = {{.*}}, i32 300, i32 12 {{.*}} @{{.*}}, 
{{.*}} @{{.*}}
 // CHECK-UBSAN: @[[LINE_400:.*]] = {{.*}}, i32 400, i32 12 {{.*}} @{{.*}}, 
{{.*}} @{{.*}}
-// CHECK-UBSAN: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 10 {{.*}} @{{.*}}, i64 
4, i8 0 }
-// CHECK-UBSAN: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 3 {{.*}} @{{.*}}, i64 
4, i8 1 }
+// CHECK-UBSAN: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 10 {{.*}} @{{.*}}, i8 
2, i8 0 }
+// CHECK-UBSAN: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 3 {{.*}} @{{.*}}, i8 
2, i8 1 }
 
 // CHECK-UBSAN: @[[STRUCT_S:.*]] = private unnamed_addr constant { i16, i16, 
[11 x i8] } { i16 -1, i16 0, [11 x i8] c"'struct S'\00" }
 
-// CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} 
@[[STRUCT_S]], i64 4, i8 3 }
+// CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} 
@[[STRUCT_S]], i8 2, i8 3 }
 // CHECK-UBSAN: @[[LINE_800:.*]] = {{.*}}, i32 800, i32 12 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LINE_900:.*]] = {{.*}}, i32 900, i32 11 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LINE_1000:.*]] = {{.*}}, i32 1000, i32 10 {{.*}} @{{.*}} }
Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -583,12 +583,13 @@
   }
 
   if (Checks.size() > 0) {
+// Make sure we're not losing information. Alignment needs to be a power of
+// 2
+assert(!AlignVal || (uint64_t)1 << llvm::Log2_64(AlignVal) == AlignVal);
 llvm::Constant *StaticData[] = {
- EmitCheckSourceLocation(Loc),
-  EmitCheckTypeDescriptor(Ty),
-  llvm::ConstantInt::get(SizeTy, AlignVal),
-  llvm::ConstantInt::get(Int8Ty, TCK)
-};
+EmitCheckSourceLocation(Loc), EmitCheckTypeDescriptor(Ty),
+llvm::ConstantInt::get(Int8Ty, AlignVal ? llvm::Log2_64(AlignVal) : 1),
+llvm::ConstantInt::get(Int8Ty, TCK)};
 EmitCheck(Checks, "type_mismatch", StaticData, Ptr);
   }
 


Index: test/CodeGen/catch-undef-behavior.c
===
--- test/CodeGen/catch-undef-behavior.c
+++ test/CodeGen/catch-undef-behavior.c
@@ -6,16 +6,16 @@
 // CHECK-UBSAN: @[[INT:.*]] = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
 
 // FIXME: When we only emit each type once, use [[INT]] more below.
-// CHECK-UBSAN: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 100, i32 5 {{.*}} @[[INT]], i64 4, i8 1
-// CHECK-UBSAN: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 10 {{.*}}, i64 4, i8 0
+// CHECK-UBSAN: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 100, i32 5 {{.*}} @[[INT]], i8 2, i8 1
+// CHECK-UBSAN: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 10 {{.*}}, i8 2, i8 0
 // CHECK-UBSAN: @[[LINE_300:.*]] = {{.*}}, i32 300, i32 12 {{.*}} @{{.*}}, {{.*}} @{{.*}}
 // CHECK-UBSAN: @[[LINE_400:.*]] = {{.*}}, i32 400, i32 12 {{.*}} @{{.*}}, {{.*}} @{{.*}}
-// CHECK-UBSAN: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 10 {{.*}} @{{.*}}, i64 4, i8 0 }
-// CHECK-UBSAN: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 3 {{.*}} @{{.*}}, i64 4, i8 1 }
+// CHECK-UBSAN: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 10 {{.*}} @{{.*}}, i8 2, i8 0 }
+// CHECK-UBSAN: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 3 {{.*}} @{{.*}}, i8 2, i8 1 }
 
 // CHECK-UBSAN: @[[STRUCT_S:.*]] = private unnamed_addr constant { i16, i16, [11 x i8] } { i16 -1, i16 0, [11 x i8] c"'struct S'\00" }
 
-// CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} @[[STRUCT_S]], i64 4, i8 3 }
+// CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} @[[STRUCT_S]], i8 2, i8 3 }
 // CHECK-UBSAN: @[[LINE_800:.*]] = {{.*}}, i32 800, i32 12 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LINE_900:.*]] = {{.*}}, i32 900, i32 11 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LINE_1000:.*]] = {{.*}}, i32 1000, i32 10 {{.*}} @{{.*}} }
Index: lib/CodeGen/CGExpr.cpp
===
--- 

Re: [PATCH] D20037: Make __FreeBSD_cc_version predefined macro configurable at build time

2016-05-16 Thread Dimitry Andric via cfe-commits
dim added a subscriber: cfe-commits.
dim added a comment.

Belatedly adding cfe-commits.


http://reviews.llvm.org/D20037



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


Re: [PATCH] D17815: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.

2016-05-16 Thread Igor Kudrin via cfe-commits
ikudrin added a comment.

Ping?..


http://reviews.llvm.org/D17815



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


RE: r269411 - [mips] Consult triple's vendor field before using musl's interpreter.

2016-05-16 Thread Vasileios Kalintiris via cfe-commits
Thanks for pointing that out. Test Added in r269651.

- Vasileios

From: Daniel Sanders
Sent: 13 May 2016 17:33
To: Vasileios Kalintiris; cfe-commits@lists.llvm.org
Subject: RE: r269411 - [mips] Consult triple's vendor field before using musl's 
interpreter.

Hi,

This change makes sense but it needs a test case.

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Vasileios Kalintiris via cfe-commits
> Sent: 13 May 2016 13:13
> To: cfe-commits@lists.llvm.org
> Subject: r269411 - [mips] Consult triple's vendor field before using musl's
> interpreter.
>
> Author: vkalintiris
> Date: Fri May 13 07:13:13 2016
> New Revision: 269411
>
> URL: http://llvm.org/viewvc/llvm-project?rev=269411=rev
> Log:
> [mips] Consult triple's vendor field before using musl's interpreter.
>
> This should affect only the mips-mti-linux toolchain.
>
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/Driver/Tools.cpp?rev=269411=269410=269411&
> view=diff
> ==
> 
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Fri May 13 07:13:13 2016
> @@ -8991,7 +8991,9 @@ static std::string getLinuxDynamicLinker
>  bool IsNaN2008 = mips::isNaN2008(Args, ToolChain.getTriple());
>  if (mips::isUCLibc(Args))
>LibName = IsNaN2008 ? "ld-uClibc-mipsn8.so.0" : "ld-uClibc.so.0";
> -else if (!ToolChain.getTriple().hasEnvironment()) {
> +else if (!ToolChain.getTriple().hasEnvironment() &&
> + ToolChain.getTriple().getVendor() ==
> + llvm::Triple::VendorType::MipsTechnologies) {
>bool LE = (ToolChain.getTriple().getArch() == llvm::Triple::mipsel) ||
>  (ToolChain.getTriple().getArch() == llvm::Triple::mips64el);
>LibName = LE ? "ld-musl-mipsel.so.1" : "ld-musl-mips.so.1";
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r269651 - [mips] Add test for the dynamic linker when using the mips64el-fedora-linux triple.

2016-05-16 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Mon May 16 06:53:51 2016
New Revision: 269651

URL: http://llvm.org/viewvc/llvm-project?rev=269651=rev
Log:
[mips] Add test for the dynamic linker when using the mips64el-fedora-linux 
triple.

We should use the musl linker only when there's no environment specified and
the vendor is MTI. The new test verifies this behaviour and is a follow-up to
the r269411 commit that added the vendor field check.

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

Modified: cfe/trunk/test/Driver/linux-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=269651=269650=269651=diff
==
--- cfe/trunk/test/Driver/linux-ld.c (original)
+++ cfe/trunk/test/Driver/linux-ld.c Mon May 16 06:53:51 2016
@@ -762,6 +762,14 @@
 // CHECK-MIPS64EL-N32-NAN2008: "-dynamic-linker" 
"{{.*}}/lib32/ld-linux-mipsn8.so.1"
 // CHECK-MIPS64EL-N32-NAN2008-NOT: "--hash-style={{gnu|both}}"
 //
+// RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-redhat-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS64EL-REDHAT %s
+// CHECK-MIPS64EL-REDHAT: "{{.*}}ld{{(.exe)?}}"
+// CHECK-MIPS64EL-REDHAT: "-m" "elf64ltsmip"
+// CHECK-MIPS64EL-REDHAT: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
+// CHECK-MIPS64EL-REDHAT-NOT: "-dynamic-linker" 
"{{.*}}/lib64/ld-musl-mipsel.so.1"
+// CHECK-MIPS64EL-REDHAT-NOT: "--hash-style={{gnu|both}}"
+//
 // RUN: %clang %s -### -o %t.o 2>&1 \
 // RUN: --target=sparc-unknown-linux-gnu \
 // RUN:   | FileCheck --check-prefix=CHECK-SPARCV8 %s


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


Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-05-16 Thread Serge Pavlov via cfe-commits
Any feedback?

Thanks,
--Serge

2016-05-03 22:40 GMT+06:00 Serge Pavlov :

> 2016-04-26 0:55 GMT+06:00 Richard Smith :
>
>> rsmith added inline comments.
>>
>> 
>> Comment at: lib/Sema/SemaDecl.cpp:8611-8612
>> @@ -8609,3 +8610,4 @@
>>  } else {
>> -  // This needs to happen first so that 'inline' propagates.
>> -  NewFD->setPreviousDeclaration(cast(OldDecl));
>> +  if (NewFD->isOutOfLine() &&
>> +  NewFD->getLexicalDeclContext()->isDependentContext() &&
>> +  IsDefinition)
>> 
>> Please factor this check out into a suitably-named function,
>> `shouldLinkDependentDeclWithPrevious` or similar, and pass in `OldDecl` as
>> well. I imagine we'll want to call this from multiple places (for instance,
>> when handling `VarDecl`s), and I can see a few ways of making it return
>> `true` in more cases, which would allow us to provide more precise
>> diagnostics in a few more cases.
>>
>> (For instance, if the old and new declarations are in the same lexical
>> context, we can mark them as redeclarations, and more generally I think we
>> can do so if the new declaration has no more template parameters in scope
>> than the old one did and the old declaration is declared within the current
>> instantiation of the new declaration).
>>
>>
> Done. The content of `shouldLinkDependentDeclWithPrevious` now supports
> only the case of friend functions, more elaborated implementation will be
> made latter in separate changes.
>
>
>> 
>> Comment at: lib/Sema/SemaDecl.cpp:8613
>> @@ +8612,3 @@
>> +  NewFD->getLexicalDeclContext()->isDependentContext() &&
>> +  IsDefinition)
>> +// Do not put friend function definitions found in template
>> classes to
>> 
>> I don't think it makes sense to check whether the template declaration is
>> a definition. It should not be added to the redeclaration chain regardless
>> of whether it's a definition.
>>
>
> Indeed, without tracking of whether the declaration is a definition, the
> implementation becomes simpler.
>
>
>> 
>> Comment at: lib/Sema/SemaDecl.cpp:10951-10956
>> @@ -10941,1 +10950,8 @@
>> SkipBodyInfo *SkipBody) {
>> +  // Don't complain if the given declaration corresponds to the friend
>> function
>> +  // declared in a template class. Such declaration defines the function
>> only if
>> +  // the template is instantiated, in the latter case the definition
>> must be
>> +  // found in corresponding class instantiation.
>> +  if (FD->isOutOfLine() &&
>> FD->getLexicalDeclContext()->isDependentContext())
>> +return;
>> +
>> 
>> Is this change necessary? If we're not putting dependent templates into
>> redeclaration chains any more, we shouldn't find an existing definition ...
>>
>
> Removed.
>
>
>>
>> 
>> Comment at: lib/Sema/SemaDecl.cpp:10962
>> @@ -10945,3 +10961,3 @@
>>if (!Definition)
>>  if (!FD->isDefined(Definition))
>>return;
>> 
>> ... down here.
>>
>> 
>> Comment at: lib/Sema/SemaDeclCXX.cpp:12663-12673
>> @@ -12662,1 +12662,13 @@
>>
>> +  // If a friend non-dependent function is declared in a dependent
>> context, do
>> +  // not put it into redeclaration chain of corresponding file level
>> +  // declarations. Such function will be available when the template
>> will be
>> +  // instantiated.
>> +  } else if (CurContext->isDependentContext() &&
>> + (D.getName().getKind() != UnqualifiedId::IK_TemplateId) &&
>> + (SS.isInvalid() || !SS.isSet())) {
>> +DC = CurContext;
>> +while (!DC->isFileContext())
>> +  DC = DC->getParent();
>> +LookupName(Previous, S);
>> +
>> 
>> What do these changes have to do with avoiding putting the declaration
>> into the redeclaration chain? This looks equivalent to what the following
>> `if` block will do, except that (a) it uses `LookupName` instead of
>> `LookupQualifiedName` (which might be a bug fix but doesn't seem related to
>> whether the context was dependent), and (b) it forgets to set `DCScope`
>> (which looks like a bug).
>>
>>
> Removed. All job now is done by `shouldLinkDependentDeclWithPrevious`.
>
> http://reviews.llvm.org/D16989
>
>>
>>
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20089: Adding a TargetParser for AArch64

2016-05-16 Thread jojo.ma via cfe-commits
jojo added a comment.

Dear  Bradley,Renato

Sorry for late reply,I have been on leave the last three days.
Thank you very much for your review and suggestons.I will re pondering the 
changes.


Repository:
  rL LLVM

http://reviews.llvm.org/D20089



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


Re: r269398 - Add support for derived class special members hiding functions brought in from

2016-05-16 Thread Vassil Vassilev via cfe-commits

The reduced reproducer: https://llvm.org/bugs/show_bug.cgi?id=27754
On 14/05/16 01:23, Richard Smith wrote:
Update: Vassil and I have dug into this a bit offline. It looks like 
the root cause is a likely-pre-existing bug where we somehow import a 
default constructor for a class from a module but don't set the "has a 
default constructor" flag on the class definition.


On Fri, May 13, 2016 at 2:54 AM, Vassil Vassilev 
> wrote:


Hi Richard,
  I believe this broke our modules builds. Last successful one was
with r269388 and the current with r269389 fails with:


/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/type_traits:69:12:
 error: constructor cannot be redeclared
 struct integral_constant
^

/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/type_traits:69:12:
 note: previous implicit declaration is here
 struct integral_constant
^

/mnt/build/workspace/root-nightly-master-cxxmodules/BUILDTYPE/Release/COMPILER/native/LABEL/sft-fedora-1/clang_build_269398/ROOT/src/core/meta/src/TGenericClassInfo.cxx:18:10:
 fatal error: could not build module 'TCollectionProxyInfo.h'
#include "TCollectionProxyInfo.h"
  ^~~~
2 errors generated.

and


/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/new:99:10: 
error: multiple overloads of 'nothrow_t' instantiate to the same signature 
'void ()'
   struct nothrow_t { };
  ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/bits/alloc_traits.h:253:8: note: in 
instantiation of function template specialization '__gnu_cxx::new_allocator 
>::construct, const std::pair &>' requested here
 { __a.construct(__p, std::forward<_Args>(__args)...); }
   ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/bits/alloc_traits.h:399:4: note: in 
instantiation of function template specialization 'std::allocator_traits 
> >::_S_construct, const std::pair &>' requested here
 { _S_construct(__a, __p, std::forward<_Args>(__args)...); }
   ^
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/bits/stl_vector.h:917:21: note: in 
instantiation of function template specialization 'std::allocator_traits 
> >::construct, const std::pair &>' requested here
 _Alloc_traits::construct(this->_M_impl, 
this->_M_impl._M_finish,
^

/mnt/build/workspace/root-nightly-master-cxxmodules/BUILDTYPE/Release/COMPILER/native/LABEL/sft-fedora-1/clang_build_269398/ROOT/src/core/meta/src/TSchemaRule.cxx:873:21:
 note: in instantiation of member function 'std::vector, 
std::allocator > >::push_back' requested here
   fVersionVect->push_back( verpair );
 ^

/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/new:99:10: 
note: previous implicit declaration is here
   struct nothrow_t { };

Shall I start reducing the issues one by one or we can revert this
patch? Vassil On 13/05/16 08:47, Richard Smith via cfe-commits wrote:

Author: rsmith
Date: Fri May 13 01:47:56 2016
New Revision: 269398

URL:http://llvm.org/viewvc/llvm-project?rev=269398=rev
Log:
Add support for derived class special members hiding functions brought in 
from
a base class via a using-declaration. If a class has a using-declaration
declaring either a constructor or an assignment operator, eagerly declare 
its
special members in case they need to displace a shadow declaration from a
using-declaration.

Modified:
 cfe/trunk/include/clang/AST/DeclCXX.h
 cfe/trunk/include/clang/Sema/Sema.h
 cfe/trunk/lib/AST/ASTImporter.cpp
 cfe/trunk/lib/AST/DeclCXX.cpp
 cfe/trunk/lib/Sema/SemaDeclCXX.cpp
 cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
 cfe/trunk/lib/Serialization/ASTWriter.cpp
 cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp
 cfe/trunk/test/SemaCUDA/implicit-member-target.cu 

 cfe/trunk/test/SemaCXX/constructor-recovery.cpp

Modified: cfe/trunk/include/clang/AST/DeclCXX.h

URL:http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=269398=269397=269398=diff

==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Fri May 13 01:47:56 2016
@@ -382,6 +382,14 @@ class CXXRecordDecl : public RecordDecl
  /// provided 

  1   2   >