r268213 - [Clang][BuiltIn][avx512] Adding intrinsics for vpshufd instruction set

2016-05-02 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Mon May  2 02:35:27 2016
New Revision: 268213

URL: http://llvm.org/viewvc/llvm-project?rev=268213&view=rev
Log:
[Clang][BuiltIn][avx512] Adding intrinsics for vpshufd instruction set

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



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

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=268213&r1=268212&r2=268213&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon May  2 02:35:27 2016
@@ -2230,6 +2230,9 @@ TARGET_BUILTIN(__builtin_ia32_movshdup12
 TARGET_BUILTIN(__builtin_ia32_movshdup256_mask, "V8fV8fV8fUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_movsldup128_mask, "V4fV4fV4fUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_movsldup256_mask, "V8fV8fV8fUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pshufd512_mask, "V16iV16iCsV16iUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_pshufd256_mask, "V8iV8iCsV8iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pshufd128_mask, "V4iV4iCsV4iUc","","avx512vl")
 
 #undef BUILTIN
 #undef TARGET_BUILTIN

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=268213&r1=268212&r2=268213&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Mon May  2 02:35:27 2016
@@ -7733,6 +7733,27 @@ _mm512_maskz_moveldup_ps (__mmask16 __U,
(__mmask16) __U);
 }
 
+#define _mm512_shuffle_epi32( __A, __I) __extension__ ({ \
+__builtin_ia32_pshufd512_mask ((__v16si)( __A),\
+  ( __I),\
+  (__v16si) _mm512_undefined_epi32 (),\
+  (__mmask16) -1);\
+})
+
+#define _mm512_mask_shuffle_epi32( __W, __U, __A, __I) __extension__ ({ \
+__builtin_ia32_pshufd512_mask ((__v16si)( __A),\
+  ( __I),\
+  (__v16si)( __W),\
+  (__mmask16)( __U));\
+})
+
+#define _mm512_maskz_shuffle_epi32( __U, __A, __I) __extension__ ({ \
+__builtin_ia32_pshufd512_mask ((__v16si)( __A),\
+  ( __I),\
+  (__v16si) _mm512_setzero_si512 (),\
+  (__mmask16)( __U));\
+})
+
 #undef __DEFAULT_FN_ATTRS
 
 #endif // __AVX512FINTRIN_H

Modified: cfe/trunk/lib/Headers/avx512vlintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlintrin.h?rev=268213&r1=268212&r2=268213&view=diff
==
--- cfe/trunk/lib/Headers/avx512vlintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlintrin.h Mon May  2 02:35:27 2016
@@ -9361,6 +9361,29 @@ _mm256_maskz_moveldup_ps (__mmask8 __U,
(__mmask8) __U);
 }
 
+#define _mm256_mask_shuffle_epi32( __W, __U, __A, __I) __extension__({\
+__builtin_ia32_pshufd256_mask((__v8si) (__A), (__I),\
+  (__v8si) (__W), (__mmask8) __U);\
+})
+
+#define _mm256_maskz_shuffle_epi32( __U,  __A, __I) __extension__({\
+__builtin_ia32_pshufd256_mask((__v8si) (__A), (__I),\
+  (__v8si) _mm256_setzero_si256 (),\
+  (__mmask8) (__U));\
+})
+
+#define _mm_mask_shuffle_epi32( __W, __U, __A, __I) __extension__({\
+  __builtin_ia32_pshufd128_mask ((__v4si) (__A), (__I),\
+  (__v4si) (__W), (__mmask8) __U);\
+})
+
+#define _mm_maskz_shuffle_epi32( __U,  __A, __I) __extension__({\
+  __builtin_ia32_pshufd128_mask ((__v4si) (__A), (__I),\
+  (__v4si)\
+  _mm_setzero_si128 (),\
+  (__mmask8) (__U));\
+})
+
 #undef __DEFAULT_FN_ATTRS
 #undef __DEFAULT_FN_ATTRS_BOTH
 

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=268213&r1=268212&r2=268213&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Mon May  2 02:35:27 2016
@@ -5369,3 +5369,22 @@ __m512 test_mm512_maskz_moveldup_ps(__mm
   // CHECK: @llvm.x86.avx512.mask.movsldup.512
   return _mm512_maskz_moveldup_ps(__U, __A); 
 }
+
+__m512i test_mm512_shuffle_epi32(__m512i __A) {
+  // CHECK-LABEL: @test_mm512_shuffle_epi32
+  // CHECK: @llvm.x86.avx512.mask.pshuf.d.512
+  return _mm512_shuffle_epi32(__A, 1); 
+}
+
+__m512i test_mm512_mask_shuffle_epi32(__m512i __W, __mmask16 __U, __m512i __A) 
{
+  // CHECK-LABEL: @test_mm512_mask_shuffle_epi32
+  // CHECK: @llvm.x86.avx512.mask.pshuf.d.512
+  return _mm512_mask_shuffle_epi32(__W, 

Re: [PATCH] D19183: [clang-tidy] Add modernize-make-shared check

2016-05-02 Thread Haojian Wu via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D19183



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


Re: [PATCH] D19534: [clang-tidy] new google-default-arguments check

2016-05-02 Thread Haojian Wu via cfe-commits
hokein added inline comments.


Comment at: clang-tidy/google/DefaultArgumentsCheck.cpp:31
@@ +30,3 @@
+  diag(MatchedDecl->getLocation(),
+   "default argument given for virtual or override method.");
+}

Usually, clang-tidy's warning message is not a sentence, so remove the `.` at 
the end. 

How about `default arguments on virtual or override methods are prohibited`?


Comment at: clang-tidy/google/GoogleTidyModule.cpp:40
@@ -38,1 +39,3 @@
   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
+CheckFactories.registerCheck(
+"google-default-arguments");

Please keep the alphabetical order.


Comment at: docs/ReleaseNotes.rst:92
@@ +91,3 @@
+
+  Flags default arguments in vitual methods.
+

s/vitual/virtual


Comment at: docs/clang-tidy/checks/google-default-arguments.rst:6
@@ +5,3 @@
+
+Checks that default parameters are not given for virtual methods.
+

I'm a little confused about the words here. Indeed, the 
`google-default-arguments` checks the default parameter given for virtual 
methods.



Comment at: test/clang-tidy/google-default-arguments.cpp:5
@@ +4,3 @@
+  virtual void f(int I, int J = 3);
+  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: default argument given for 
virtual or override method
+};

The the first warning message you need check the all message including the 
check name.


http://reviews.llvm.org/D19534



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


r268214 - [Clang][avx512][builtin] Adding intrinsics for vexpand{d|q|ps|pd} instrctuon set

2016-05-02 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Mon May  2 03:36:41 2016
New Revision: 268214

URL: http://llvm.org/viewvc/llvm-project?rev=268214&view=rev
Log:
[Clang][avx512][builtin] Adding intrinsics for vexpand{d|q|ps|pd} instrctuon set

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


Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=268214&r1=268213&r2=268214&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon May  2 03:36:41 2016
@@ -2233,6 +2233,14 @@ TARGET_BUILTIN(__builtin_ia32_movsldup25
 TARGET_BUILTIN(__builtin_ia32_pshufd512_mask, "V16iV16iCsV16iUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_pshufd256_mask, "V8iV8iCsV8iUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pshufd128_mask, "V4iV4iCsV4iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_expanddf512_mask, "V8dV8dV8dUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_expanddi512_mask, 
"V8LLiV8LLiV8LLiUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_expandloaddf512_mask, "V8dvC*V8dUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_expandloaddi512_mask, 
"V8LLivC*V8LLiUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_expandloadsf512_mask, 
"V16fvC*V16fUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_expandloadsi512_mask, 
"V16ivC*V16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_expandsf512_mask, "V16fV16fV16fUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_expandsi512_mask, "V16iV16iV16iUs","","avx512f")
 
 #undef BUILTIN
 #undef TARGET_BUILTIN

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=268214&r1=268213&r2=268214&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Mon May  2 03:36:41 2016
@@ -7754,6 +7754,134 @@ __builtin_ia32_pshufd512_mask ((__v16si)
   (__mmask16)( __U));\
 })
 
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_mask_expand_pd (__m512d __W, __mmask8 __U, __m512d __A)
+{
+  return (__m512d) __builtin_ia32_expanddf512_mask ((__v8df) __A,
+(__v8df) __W,
+(__mmask8) __U);
+}
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_maskz_expand_pd (__mmask8 __U, __m512d __A)
+{
+  return (__m512d) __builtin_ia32_expanddf512_mask ((__v8df) __A,
+(__v8df) _mm512_setzero_pd (),
+(__mmask8) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_expand_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
+{
+  return (__m512i) __builtin_ia32_expanddi512_mask ((__v8di) __A,
+(__v8di) __W,
+(__mmask8) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_expand_epi64 ( __mmask8 __U, __m512i __A)
+{
+  return (__m512i) __builtin_ia32_expanddi512_mask ((__v8di) __A,
+(__v8di) _mm512_setzero_pd (),
+(__mmask8) __U);
+}
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_mask_expandloadu_pd(__m512d __W, __mmask8 __U, void const *__P)
+{
+  return (__m512d) __builtin_ia32_expandloaddf512_mask ((const __v8df *)__P,
+  (__v8df) __W,
+  (__mmask8) __U);
+}
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_maskz_expandloadu_pd(__mmask8 __U, void const *__P)
+{
+  return (__m512d) __builtin_ia32_expandloaddf512_mask ((const __v8df *)__P,
+  (__v8df) _mm512_setzero_pd(),
+  (__mmask8) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_expandloadu_epi64(__m512i __W, __mmask8 __U, void const *__P)
+{
+  return (__m512i) __builtin_ia32_expandloaddi512_mask ((const __v8di *)__P,
+  (__v8di) __W,
+  (__mmask8) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_expandloadu_epi64(__mmask8 __U, void const *__P)
+{
+  return (__m512i) __builtin_ia32_expandloaddi512_mask ((const __v8di *)__P,
+  (__v8di) _mm512_setzero_pd(),
+  (__mmask8) __U);
+}
+
+static __inline__ __m512 __DEFAULT_FN_ATTRS
+_mm512_mask_expandloadu_ps(__m512 __W, __mmask16 __U, void const *__P)
+{
+  return (__m512) __builtin_ia32_expandloadsf512_mask ((const __v16sf *)__P,
+   (__v16sf) __W,
+   (__mmask16) __U);
+}
+
+static __inline__ __m512 __DEFAULT_FN_ATTRS
+_mm512_maskz_expandloadu_ps(__mmask16 __U, void const *__P)
+{
+  return (__m512) __builtin_ia32_expandloadsf512_mask ((const __v16sf *)__P,
+   (__v16sf) _mm512_setzero_ps(),
+   (__mmask16) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_m

r268217 - [Clang][AVX512][BuiltIn] Adding intrinsics for cvtps2pd instruction set

2016-05-02 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Mon May  2 04:42:31 2016
New Revision: 268217

URL: http://llvm.org/viewvc/llvm-project?rev=268217&view=rev
Log:
[Clang][AVX512][BuiltIn] Adding intrinsics for cvtps2pd instruction set

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

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=268217&r1=268216&r2=268217&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon May  2 04:42:31 2016
@@ -2241,6 +2241,7 @@ TARGET_BUILTIN(__builtin_ia32_expandload
 TARGET_BUILTIN(__builtin_ia32_expandloadsi512_mask, 
"V16ivC*V16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_expandsf512_mask, "V16fV16fV16fUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_expandsi512_mask, "V16iV16iV16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_cvtps2pd512_mask, "V8dV8fV8dUcIi","","avx512f")
 
 #undef BUILTIN
 #undef TARGET_BUILTIN

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=268217&r1=268216&r2=268217&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Mon May  2 04:42:31 2016
@@ -7882,6 +7882,55 @@ _mm512_maskz_expand_epi32 (__mmask16 __U
 (__mmask16) __U);
 }
 
+#define _mm512_cvt_roundps_pd( __A, __R) __extension__ ({ \
+__builtin_ia32_cvtps2pd512_mask ((__v8sf)( __A),\
+(__v8df)\
+_mm512_undefined_pd (),\
+(__mmask8) -1,( __R));\
+})
+
+#define _mm512_mask_cvt_roundps_pd( __W, __U, __A, __R) __extension__ ({ \
+__builtin_ia32_cvtps2pd512_mask ((__v8sf)( __A),\
+(__v8df)( __W),\
+(__mmask8)( __U),( __R));\
+})
+
+#define _mm512_maskz_cvt_roundps_pd( __U, __A, __R) __extension__ ({ \
+__builtin_ia32_cvtps2pd512_mask ((__v8sf)( __A),\
+(__v8df)\
+_mm512_setzero_pd (),\
+(__mmask8)( __U),( __R));\
+})
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_cvtps_pd (__m256 __A)
+{
+  return (__m512d) __builtin_ia32_cvtps2pd512_mask ((__v8sf) __A,
+(__v8df)
+_mm512_undefined_pd (),
+(__mmask8) -1,
+_MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_mask_cvtps_pd (__m512d __W, __mmask8 __U, __m256 __A)
+{
+  return (__m512d) __builtin_ia32_cvtps2pd512_mask ((__v8sf) __A,
+(__v8df) __W,
+(__mmask8) __U,
+_MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_maskz_cvtps_pd (__mmask8 __U, __m256 __A)
+{
+  return (__m512d) __builtin_ia32_cvtps2pd512_mask ((__v8sf) __A,
+(__v8df)
+_mm512_setzero_pd (),
+(__mmask8) __U,
+_MM_FROUND_CUR_DIRECTION);
+}
+
 #undef __DEFAULT_FN_ATTRS
 
 #endif // __AVX512FINTRIN_H

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=268217&r1=268216&r2=268217&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Mon May  2 04:42:31 2016
@@ -5470,3 +5470,38 @@ __m512i test_mm512_maskz_expand_epi32(__
   // CHECK: @llvm.x86.avx512.mask.expand.d.512
   return _mm512_maskz_expand_epi32(__U, __A); 
 }
+__m512d test_mm512_cvt_roundps_pd(__m256 __A) {
+  // CHECK-LABEL: @test_mm512_cvt_roundps_pd
+  // CHECK: @llvm.x86.avx512.mask.cvtps2pd.512
+  return _mm512_cvt_roundps_pd(__A, _MM_FROUND_CUR_DIRECTION); 
+}
+
+__m512d test_mm512_mask_cvt_roundps_pd(__m512d __W, __mmask8 __U, __m256 __A) {
+  // CHECK-LABEL: @test_mm512_mask_cvt_roundps_pd
+  // CHECK: @llvm.x86.avx512.mask.cvtps2pd.512
+  return _mm512_mask_cvt_roundps_pd(__W, __U, __A, _MM_FROUND_CUR_DIRECTION); 
+}
+
+__m512d test_mm512_maskz_cvt_roundps_pd(__mmask8 __U, __m256 __A) {
+  // CHECK-LABEL: @test_mm512_maskz_cvt_roundps_pd
+  // CHECK: @llvm.x86.avx512.mask.cvtps2pd.512
+  return _mm512_maskz_cvt_roundps_pd(__U, __A, _MM_FROUND_CUR_DIRECTION); 
+}
+
+__m512d test_mm512_cvtps_pd(__m256 __A) {
+  // CHECK-LABEL: @test_mm512_cvtps_pd
+  // CHECK: @llvm.x86.avx512.mask.cvtps2pd.512
+  return _mm512_cvtps_pd(__A); 
+}
+
+__m512d test_mm512_mask_cvtps_pd(__m512d __W, __mmask8 __U, __m256 __A) {
+  // CHECK-LABEL: @test_mm512_mask_cvtps_pd
+  // CHECK: @llvm.x86.avx512.mask.cvtps2pd.512
+  return _mm512_mask_cvtps_pd(__W, __

[PATCH] D19802: Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class that initializes itself as a base

2016-05-02 Thread Michael Miller via cfe-commits
michael_miller created this revision.
michael_miller added reviewers: hokein, alexfh, aaron.ballman.
michael_miller added a subscriber: cfe-commits.

Fix a crash when a record type initializes itself in its own base class 
initializer list.

http://reviews.llvm.org/D19802

Files:
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp

Index: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
===
--- test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
+++ test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
@@ -338,3 +338,11 @@
 
   Template F;
 };
+
+template 
+class PositiveSelfInitialization : NegativeAggregateType
+{
+  PositiveSelfInitialization() : PositiveSelfInitialization() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor does not initialize 
these bases: NegativeAggregateType
+  // CHECK-FIXES: PositiveSelfInitialization() : NegativeAggregateType(), 
PositiveSelfInitialization() {}
+};
Index: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
===
--- clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -179,7 +179,7 @@
   const auto *InitDecl =
   Init->isMemberInitializer()
   ? static_cast(Init->getMember())
-  : Init->getBaseClass()->getAs()->getDecl();
+  : Init->getBaseClass()->getAsCXXRecordDecl();
 
   // Add all fields between current field up until the next intializer.
   for (; Decl != std::end(OrderedDecls) && *Decl != InitDecl; ++Decl) {
@@ -398,7 +398,7 @@
   // Remove any bases that were explicitly written in the initializer list.
   for (const CXXCtorInitializer *Init : Ctor->inits()) {
 if (Init->isBaseInitializer() && Init->isWritten())
-  BasesToInit.erase(Init->getBaseClass()->getAs()->getDecl());
+  BasesToInit.erase(Init->getBaseClass()->getAsCXXRecordDecl());
   }
 
   if (BasesToInit.empty())


Index: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
===
--- test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
+++ test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
@@ -338,3 +338,11 @@
 
   Template F;
 };
+
+template 
+class PositiveSelfInitialization : NegativeAggregateType
+{
+  PositiveSelfInitialization() : PositiveSelfInitialization() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor does not initialize these bases: NegativeAggregateType
+  // CHECK-FIXES: PositiveSelfInitialization() : NegativeAggregateType(), PositiveSelfInitialization() {}
+};
Index: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
===
--- clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -179,7 +179,7 @@
   const auto *InitDecl =
   Init->isMemberInitializer()
   ? static_cast(Init->getMember())
-  : Init->getBaseClass()->getAs()->getDecl();
+  : Init->getBaseClass()->getAsCXXRecordDecl();
 
   // Add all fields between current field up until the next intializer.
   for (; Decl != std::end(OrderedDecls) && *Decl != InitDecl; ++Decl) {
@@ -398,7 +398,7 @@
   // Remove any bases that were explicitly written in the initializer list.
   for (const CXXCtorInitializer *Init : Ctor->inits()) {
 if (Init->isBaseInitializer() && Init->isWritten())
-  BasesToInit.erase(Init->getBaseClass()->getAs()->getDecl());
+  BasesToInit.erase(Init->getBaseClass()->getAsCXXRecordDecl());
   }
 
   if (BasesToInit.empty())
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D19796: Add new intrinsic support for MONITORX and MWAITX instructions.

2016-05-02 Thread Ganesh Gopalasubramanian via cfe-commits
GGanesh created this revision.
GGanesh added reviewers: echristo, craig.topper.
GGanesh added subscribers: cfe-commits, llvm-commits.
Herald added a subscriber: joker.eph.

This patch adds new intrinsics, new flag (-mwaitx) and flag enablement based on 
cpuid for the instructions MONITORX and MWAITX. Testcases that tests the 
intrinsics which uses the flag are also added.

These instructions provide similar capability to the MONITOR/MWAIT pair while 
adding a timer function, such that another termination of the MWAITX 
instruction occurs when the timer expires. The presence of the MONITORX and 
MWAITX instructions is indicated by CPUID 8000_0001, ECX, bit 29.

The MONITORX and MWAITX instructions are intercepted by the same bits that 
intercept MONITOR and MWAIT. MONITORX instruction establishes a range to be 
monitored. MWAITX instruction causes the processor to stop instruction 
execution and enter an implementation-dependent optimized state until 
occurrence of a class of events.

Opcode of MONITORX instruction is "0F 01 FA". Opcode of MWAITX instruction is 
"0F 01 FB". These opcode information is used in adding tests for the 
disassembler.

http://reviews.llvm.org/D19796

Files:
  include/clang/Basic/BuiltinsX86.def
  include/clang/Driver/Options.td
  lib/Basic/Targets.cpp
  lib/Headers/CMakeLists.txt
  lib/Headers/module.modulemap
  lib/Headers/mwaitxintrin.h
  lib/Headers/x86intrin.h
  test/CodeGen/builtins-x86.c

Index: test/CodeGen/builtins-x86.c
===
--- test/CodeGen/builtins-x86.c
+++ test/CodeGen/builtins-x86.c
@@ -281,6 +281,9 @@
   (void)__builtin_ia32_xsaves(tmp_vp, tmp_ULLi);
   (void)__builtin_ia32_xsaves64(tmp_vp, tmp_ULLi);
 
+  (void) __builtin_ia32_monitorx(tmp_vp, tmp_Ui, tmp_Ui);
+  (void) __builtin_ia32_mwaitx(tmp_Ui, tmp_Ui, tmp_Ui);
+
   tmp_V4f = __builtin_ia32_cvtpi2ps(tmp_V4f, tmp_V2i);
   tmp_V2i = __builtin_ia32_cvtps2pi(tmp_V4f);
   tmp_i = __builtin_ia32_cvtss2si(tmp_V4f);
Index: lib/Headers/x86intrin.h
===
--- lib/Headers/x86intrin.h
+++ lib/Headers/x86intrin.h
@@ -52,6 +52,8 @@
 
 #include 
 
+#include 
+
 /* FIXME: LWP */
 
 #endif /* __X86INTRIN_H */
Index: lib/Headers/mwaitxintrin.h
===
--- lib/Headers/mwaitxintrin.h
+++ lib/Headers/mwaitxintrin.h
@@ -0,0 +1,47 @@
+/*=== mwaitxintrin.h - MONITORX/MWAITX intrinsics --===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+
+#ifndef __X86INTRIN_H
+#error "Never use  directly; include  instead."
+#endif
+
+#ifndef _MWAITXINTRIN_H
+#define _MWAITXINTRIN_H
+
+/* Define the default attributes for the functions in this file. */
+#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__,  __target__("mwaitx")))
+static __inline__ void __DEFAULT_FN_ATTRS
+_mm_monitorx(void const * __p, unsigned __extensions, unsigned __hints)
+{
+  __builtin_ia32_monitorx((void *)__p, __extensions, __hints);
+}
+
+static __inline__ void __DEFAULT_FN_ATTRS
+_mm_mwaitx(unsigned __extensions, unsigned __hints, unsigned __clock)
+{
+  __builtin_ia32_mwaitx(__extensions, __hints, __clock);
+}
+
+#undef __DEFAULT_FN_ATTRS 
+
+#endif /* _MWAITXINTRIN_H */
Index: lib/Headers/module.modulemap
===
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -125,6 +125,10 @@
   export pclmul
 }
 
+explicit module mwaitx {
+  header "mwaitxintrin.h"
+}
+
 explicit module aes {
   header "__wmmintrin_aes.h"
 }
Index: lib/Headers/CMakeLists.txt
===
--- lib/Headers/CMakeLists.txt
+++ lib/Headers/CMakeLists.txt
@@ -78,6 +78,7 @@
   xsaveoptintrin.h
   xsavecin

Re: [PATCH] D19769: [clang-tidy] Add explicitly given array size heuristic to misc-suspicious-missing-comma check.

2016-05-02 Thread Dominik Szabó via cfe-commits
szdominik added inline comments.


Comment at: clang-tidy/misc/SuspiciousMissingCommaCheck.cpp:94
@@ -93,3 +93,3 @@
   Finder->addMatcher(StringsInitializerList.bind("list"), this);
 }
 

etienneb wrote:
> If it's working as-is,... this is neat  :)
Well, the array filler has a problematic limitation.
I forget that I used the explicit given size for reduce false positives in my 
checker.
e.g.
```
struct MusicIntervalArray {
int n;
const char* list[5];
} intervals[2] = {
{5, {"second", "third", "fourth", "fifth" "sixth"}},
{5, {"ninth", "tenth", "eleventh", "twelfth", "thir" "teenth"}},
};
```
The first is simple: has array filler, so warn because of size.
But the second one is a good initialization, it has 5 elements, which is the 
explicit size. But your implementation warns us, that there is a missing comma. 
If I work with the length (from declaration or type), I can filter these cases.


http://reviews.llvm.org/D19769



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


Re: [PATCH] D19769: [clang-tidy] Add explicitly given array size heuristic to misc-suspicious-missing-comma check.

2016-05-02 Thread Dominik Szabó via cfe-commits
szdominik marked 3 inline comments as done.


Comment at: clang-tidy/misc/SuspiciousMissingCommaCheck.cpp:106
@@ +105,3 @@
+  if (InitializerList->hasArrayFiller()) {
+  diag(InitializerList->getExprLoc(),
+   "wrong string array initialization: "

etienneb wrote:
> The error should still be reported to the missing comma (concatenated token):
>   ConcatenatedLiteral->getLocStart(),
> 
> We could add a NOTE to point to the array, stating that the size mismatch.
> 
> What do you think?
Interesting question (the first idea was that we can't decide that the comma is 
missing or the size is wrong, so report to the array, that's a more secure 
solution), but I agree that the note could be more effective.
And... it's still a suspicious-missing-comma checker, not a 
wrong-string-array-size checker :)


http://reviews.llvm.org/D19769



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


Re: [clang-tools-extra] r268140 - [Release Notes] Mention Clang-tidy cert-err34-c check.

2016-05-02 Thread Aaron Ballman via cfe-commits
On Fri, Apr 29, 2016 at 8:11 PM, Eugene Zelenko via cfe-commits
 wrote:
> Author: eugenezelenko
> Date: Fri Apr 29 19:11:10 2016
> New Revision: 268140
>
> URL: http://llvm.org/viewvc/llvm-project?rev=268140&view=rev
> Log:
> [Release Notes] Mention Clang-tidy cert-err34-c check.

Thank you for this!

~Aaron

>
> Fix order and style of Boost related notes.
>
> Modified:
> clang-tools-extra/trunk/docs/ReleaseNotes.rst
>
> Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=268140&r1=268139&r2=268140&view=diff
> ==
> --- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
> +++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Fri Apr 29 19:11:10 2016
> @@ -63,12 +63,26 @@ Improvements to clang-tidy
>  explain them more clearly, and provide more accurate fix-its for the issues
>  identified.  The improvements since the 3.8 release include:
>
> +- New Boost module containing checks for issues with Boost library.
> +
> +- New `boost-use-to-string
> +  `_ 
> check
> +
> +  Finds usages of ``boost::lexical_cast`` and changes it to
> +  ``std::to_string``.
> +
>  - New `cert-env33-c
>`_ check
>
>Flags calls to ``system()``, ``popen()``, and ``_popen()``, which execute a
>command processor.
>
> +- New `cert-err34-c
> +  `_ check
> +
> +  Flags calls to string-to-number conversion functions that do not verify the
> +  validity of the conversion.
> +
>  - New `cert-flp30-c
>`_ check
>
> @@ -217,13 +231,6 @@ identified.  The improvements since the
>
>Finds static function and variable definitions in anonymous namespace.
>
> -  - New Boost module containing checks for issues with Boost library
> -
> -- New `boost-use-to-string
> -  `_ 
> check
> -
> -  Finds usages of boost::lexical_cast and changes it to 
> std::to_string.
> -
>  Fixed bugs:
>
>  - Crash when running on compile database with relative source files paths.
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19754: Allow 'nodebug' on local variables

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


Comment at: include/clang/Basic/Attr.td:86-88
@@ -85,1 +85,5 @@
+def NonParmVar : SubsetSubjectgetKind() != Decl::ImplicitParam &&
+ S->getKind() != Decl::ParmVar &&
+ S->getKind() != Decl::NonTypeTemplateParm}]>;
 def NonBitField : SubsetSubjecthttp://reviews.llvm.org/D19754



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


Re: [PATCH] D19802: Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class that initializes itself as a base

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


Comment at: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp:342
@@ +341,3 @@
+
+template 
+class PositiveSelfInitialization : NegativeAggregateType

Is it required to be a templated class to trigger the crash?


http://reviews.llvm.org/D19802



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


Re: [PATCH] D14274: Add alloc_size attribute to clang

2016-05-02 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

Thank you for working on this! LGTM, but please wait for @rsmith to okay as 
well.



Comment at: test/SemaCXX/constant-expression-cxx11.cpp:1171
@@ -1170,3 +1170,3 @@
   int l : n3; // expected-error {{constant expression}} expected-note {{read 
of non-const variable}}
-  int m : t.n; // expected-error {{constant expression}} expected-note {{read 
of non-constexpr variable}}
+  int m : t.n; // expected-warning{{width of bit-field 'm' (42 bits)}}
 };

Thank you for the explanation!


http://reviews.llvm.org/D14274



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


[PATCH] D19804: Make clang-format cleaner remove redundant commas/colons in constructor initializer list.

2016-05-02 Thread Eric Liu via cfe-commits
ioeric created this revision.
ioeric added reviewers: djasper, klimek.
ioeric added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

Make clang-format cleaner remove redundant commas/colons in constructor 
initializer list.

http://reviews.llvm.org/D19804

Files:
  lib/Format/Format.cpp
  unittests/Format/CleanupTest.cpp

Index: unittests/Format/CleanupTest.cpp
===
--- unittests/Format/CleanupTest.cpp
+++ unittests/Format/CleanupTest.cpp
@@ -113,6 +113,116 @@
   EXPECT_EQ(Expected, Result);
 }
 
+TEST_F(CleanupTest, CtorInitializationSimpleRedundantComma) {
+  std::string Code = "class A {\nA() : , {} };";
+  std::string Expected = "class A {\nA()  {} };";
+  std::vector Ranges;
+  Ranges.push_back(tooling::Range(17, 0));
+  Ranges.push_back(tooling::Range(19, 0));
+  std::string Result = cleanup(Code, Ranges);
+  EXPECT_EQ(Expected, Result);
+
+  Code = "class A {\nA() : x(1), {} };";
+  Expected = "class A {\nA() : x(1) {} };";
+  Ranges.clear();
+  Ranges.push_back(tooling::Range(23, 0));
+  Result = cleanup(Code, Ranges);
+  EXPECT_EQ(Expected, Result);
+}
+
+TEST_F(CleanupTest, CtorInitializationBracesInParens) {
+  std::string Code = "class A {\nA() : x({1}),, {} };";
+  std::string Expected = "class A {\nA() : x({1}) {} };";
+  std::vector Ranges;
+  Ranges.push_back(tooling::Range(24, 0));
+  Ranges.push_back(tooling::Range(26, 0));
+  std::string Result = cleanup(Code, Ranges);
+  EXPECT_EQ(Expected, Result);
+}
+
+TEST_F(CleanupTest, RedundantCommaNotInAffectedRanges) {
+  std::string Code =
+  "class A {\nA() : x({1}), /* comment */, { int x = 0; } };";
+  std::string Expected =
+  "class A {\nA() : x({1}), /* comment */, { int x = 0; } };";
+  // Set the affected range to be "int x = 0", which does not intercept the
+  // constructor initialization list.
+  std::vector Ranges(1, tooling::Range(42, 9));
+  std::string Result = cleanup(Code, Ranges);
+  EXPECT_EQ(Expected, Result);
+
+  Code = "class A {\nA() : x(1), {} };";
+  Expected = "class A {\nA() : x(1), {} };";
+  // No range. Fixer should do nothing.
+  Ranges.clear();
+  Result = cleanup(Code, Ranges);
+  EXPECT_EQ(Expected, Result);
+}
+
+TEST_F(CleanupTest, CtorInitializationCommentAroundCommas) {
+  // Remove redundant commas and comment between them.
+  std::string Code = "class A {\nA() : x({1}), /* comment */, {} };";
+  std::string Expected = "class A {\nA() : x({1}) {} };";
+  std::vector Ranges;
+  Ranges.push_back(tooling::Range(25, 0));
+  Ranges.push_back(tooling::Range(40, 0));
+  std::string Result = cleanup(Code, Ranges);
+  EXPECT_EQ(Expected, Result);
+
+  // Remove trailing comma and comment.
+  Code = "class A {\nA() : x({1}), // comment\n{} };";
+  Expected = "class A {\nA() : x({1})\n{} };";
+  Ranges = std::vector(1, tooling::Range(25, 0));
+  Result = cleanup(Code, Ranges);
+  EXPECT_EQ(Expected, Result);
+
+  // Remove trailing comma, but leave the comment.
+  Code = "class A {\nA() : x({1}), // comment\n , y(1),{} };";
+  Expected = "class A {\nA() : x({1}), // comment\n  y(1){} };";
+  Ranges = std::vector(1, tooling::Range(38, 0));
+  Result = cleanup(Code, Ranges);
+  EXPECT_EQ(Expected, Result);
+
+  // Remove trailing comma and the comment before it.
+  Code = "class A {\nA() : x({1}), \n/* comment */, y(1),{} };";
+  Expected = "class A {\nA() : x({1}), \n y(1){} };";
+  Ranges = std::vector(1, tooling::Range(40, 0));
+  Result = cleanup(Code, Ranges);
+  EXPECT_EQ(Expected, Result);
+
+  // Remove trailing comma and the comment after it.
+  Code = "class A {\nA() : , // comment\n y(1),{} };";
+  Expected = "class A {\nA() : \n y(1){} };";
+  Ranges = std::vector(1, tooling::Range(17, 0));
+  Result = cleanup(Code, Ranges);
+  EXPECT_EQ(Expected, Result);
+}
+
+TEST_F(CleanupTest, SkipImbalancedParentheses) {
+  std::string Code = "class A {\nA() : x((),, {} };";
+  std::string Expected = "class A {\nA() : x((),, {} };";
+  std::vector Ranges(1, tooling::Range(0, Code.size()));
+  std::string Result = cleanup(Code, Ranges);
+  EXPECT_EQ(Expected, Result);
+}
+
+TEST_F(CleanupTest, CtorInitializerInNamespace) {
+  std::string Code = "namespace A {\n"
+ "namespace B {\n" // missing r_brace
+ "} // namespace A\n\n"
+ "namespace C {\n"
+ "class A { A() : x(0),, {} };\n"
+ "inline namespace E { namespace { } }\n"
+ "}";
+  std::string Expected = "namespace A {\n"
+ "\n\n\nnamespace C {\n"
+ "class A { A() : x(0) {} };\n   \n"
+ "}";
+  std::vector Ranges(1, tooling::Range(0, Code.size()));
+  std::string Result = cleanup(Code, Ranges);
+  EXPECT_EQ(Expected, Result);
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: lib/Format/Format.cpp
==

r268230 - [CLANG][AVX512][BUILTIN]movap{d|s}{128|256|512}

2016-05-02 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Mon May  2 09:02:01 2016
New Revision: 268230

URL: http://llvm.org/viewvc/llvm-project?rev=268230&view=rev
Log:
[CLANG][AVX512][BUILTIN]movap{d|s}{128|256|512}

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

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

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=268230&r1=268229&r2=268230&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon May  2 09:02:01 2016
@@ -2242,6 +2242,12 @@ TARGET_BUILTIN(__builtin_ia32_expandload
 TARGET_BUILTIN(__builtin_ia32_expandsf512_mask, "V16fV16fV16fUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_expandsi512_mask, "V16iV16iV16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_cvtps2pd512_mask, "V8dV8fV8dUcIi","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movapd512_mask, "V8dV8dV8dUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movaps512_mask, "V16fV16fV16fUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movapd128_mask, "V2dV2dV2dUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movapd256_mask, "V4dV4dV4dUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movaps128_mask, "V4fV4fV4fUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movaps256_mask, "V8fV8fV8fUc","","avx512vl")
 
 #undef BUILTIN
 #undef TARGET_BUILTIN

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=268230&r1=268229&r2=268230&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Mon May  2 09:02:01 2016
@@ -7931,6 +7931,41 @@ _mm512_maskz_cvtps_pd (__mmask8 __U, __m
 _MM_FROUND_CUR_DIRECTION);
 }
 
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_mask_mov_pd (__m512d __W, __mmask8 __U, __m512d __A)
+{
+  return (__m512d) __builtin_ia32_movapd512_mask ((__v8df) __A,
+  (__v8df) __W,
+  (__mmask8) __U);
+}
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_maskz_mov_pd (__mmask8 __U, __m512d __A)
+{
+  return (__m512d) __builtin_ia32_movapd512_mask ((__v8df) __A,
+  (__v8df)
+  _mm512_setzero_pd (),
+  (__mmask8) __U);
+}
+
+static __inline__ __m512 __DEFAULT_FN_ATTRS
+_mm512_mask_mov_ps (__m512 __W, __mmask16 __U, __m512 __A)
+{
+  return (__m512) __builtin_ia32_movaps512_mask ((__v16sf) __A,
+ (__v16sf) __W,
+ (__mmask16) __U);
+}
+
+static __inline__ __m512 __DEFAULT_FN_ATTRS
+_mm512_maskz_mov_ps (__mmask16 __U, __m512 __A)
+{
+  return (__m512) __builtin_ia32_movaps512_mask ((__v16sf) __A,
+ (__v16sf)
+ _mm512_setzero_ps (),
+ (__mmask16) __U);
+}
+
+
 #undef __DEFAULT_FN_ATTRS
 
 #endif // __AVX512FINTRIN_H

Modified: cfe/trunk/lib/Headers/avx512vlintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlintrin.h?rev=268230&r1=268229&r2=268230&view=diff
==
--- cfe/trunk/lib/Headers/avx512vlintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlintrin.h Mon May  2 09:02:01 2016
@@ -9384,6 +9384,76 @@ __builtin_ia32_pshufd256_mask((__v8si) (
   (__mmask8) (__U));\
 })
 
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_mask_mov_pd (__m128d __W, __mmask8 __U, __m128d __A)
+{
+  return (__m128d) __builtin_ia32_movapd128_mask ((__v2df) __A,
+  (__v2df) __W,
+  (__mmask8) __U);
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_maskz_mov_pd (__mmask8 __U, __m128d __A)
+{
+  return (__m128d) __builtin_ia32_movapd128_mask ((__v2df) __A,
+  (__v2df)
+  _mm_setzero_pd (),
+  (__mmask8) __U);
+}
+
+static __inline__ __m256d __DEFAULT_FN_ATTRS
+_mm256_mask_mov_pd (__m256d __W, __mmask8 __U, __m256d __A)
+{
+  return (__m256d) __builtin_ia32_movapd256_mask ((__v4df) __A,
+  (__v4df) __W,
+  (__mmask8) __U);
+}
+
+static __inline__ __m256d __DEFAULT_FN_ATTRS
+_mm256_maskz_mov_pd (__mmask8 __U, __m256d __A)
+{
+  return (__m256d) __builtin_ia32_movapd256_mask ((__v4df) __A,
+  (__v4df)
+  _mm256_setzero_pd (),
+  (__mmask8) __U);
+}
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_mask_mov_ps (__m128 __W, __mmask8 __U, __m128 __A)
+{
+  return (__m128) __builtin_ia32_movaps128_mask ((__v4sf) __A,
+ (__v4sf) __W,
+ (__mmask8) __U);
+}
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_maskz_mov_ps (__mmas

Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-05-02 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast updated this revision to Diff 55820.
hubert.reinterpretcast added a comment.

Replace alias template with struct and typedef member; add usage example


http://reviews.llvm.org/D19770

Files:
  include/llvm/Support/TrailingObjects.h

Index: include/llvm/Support/TrailingObjects.h
===
--- include/llvm/Support/TrailingObjects.h
+++ include/llvm/Support/TrailingObjects.h
@@ -342,6 +342,49 @@
TrailingTys, size_t>::type... Counts) {
 return sizeof(BaseTy) + ParentType::additionalSizeToAllocImpl(0, 
Counts...);
   }
+
+  /// A type where its ::with_counts template member has a ::type member
+  /// suitable for use as uninitialized storage for an object with the given
+  /// trailing object counts. The template arguments are similar to those
+  /// of additionalSizeToAlloc.
+  ///
+  /// Use with FixedSizeStorageOwner, e.g.:
+  ///
+  /// \code{.cpp}
+  ///
+  /// MyObj::FixedSizeStorage::with_counts<1u>::type myStackObjStorage;
+  /// MyObj::FixedSizeStorageOwner
+  /// myStackObjOwner(new ((void *)&myStackObjStorage) MyObj);
+  /// MyObj *const myStackObjPtr = myStackObjOwner.get();
+  ///
+  /// \endcode
+  template  struct FixedSizeStorage {
+template  struct with_counts {
+  typedef llvm::AlignedCharArray<
+  llvm::AlignOf::Alignment, totalSizeToAlloc(Counts...)
+  > type;
+};
+  };
+
+  /// A type that acts as the owner for an object placed into fixed storage.
+  class FixedSizeStorageOwner {
+  public:
+FixedSizeStorageOwner(BaseTy *p) : p(p) {}
+~FixedSizeStorageOwner() {
+  assert(p && "FixedSizeStorageOwner owns null?");
+  p->~BaseTy();
+}
+
+BaseTy *get() { return p; }
+
+  private:
+FixedSizeStorageOwner(const FixedSizeStorageOwner &) = delete;
+FixedSizeStorageOwner(FixedSizeStorageOwner &&) = delete;
+FixedSizeStorageOwner &operator=(const FixedSizeStorageOwner &) = delete;
+FixedSizeStorageOwner &operator=(FixedSizeStorageOwner &&) = delete;
+
+BaseTy *const p;
+  };
 };
 
 } // end namespace llvm


Index: include/llvm/Support/TrailingObjects.h
===
--- include/llvm/Support/TrailingObjects.h
+++ include/llvm/Support/TrailingObjects.h
@@ -342,6 +342,49 @@
TrailingTys, size_t>::type... Counts) {
 return sizeof(BaseTy) + ParentType::additionalSizeToAllocImpl(0, Counts...);
   }
+
+  /// A type where its ::with_counts template member has a ::type member
+  /// suitable for use as uninitialized storage for an object with the given
+  /// trailing object counts. The template arguments are similar to those
+  /// of additionalSizeToAlloc.
+  ///
+  /// Use with FixedSizeStorageOwner, e.g.:
+  ///
+  /// \code{.cpp}
+  ///
+  /// MyObj::FixedSizeStorage::with_counts<1u>::type myStackObjStorage;
+  /// MyObj::FixedSizeStorageOwner
+  /// myStackObjOwner(new ((void *)&myStackObjStorage) MyObj);
+  /// MyObj *const myStackObjPtr = myStackObjOwner.get();
+  ///
+  /// \endcode
+  template  struct FixedSizeStorage {
+template  struct with_counts {
+  typedef llvm::AlignedCharArray<
+  llvm::AlignOf::Alignment, totalSizeToAlloc(Counts...)
+  > type;
+};
+  };
+
+  /// A type that acts as the owner for an object placed into fixed storage.
+  class FixedSizeStorageOwner {
+  public:
+FixedSizeStorageOwner(BaseTy *p) : p(p) {}
+~FixedSizeStorageOwner() {
+  assert(p && "FixedSizeStorageOwner owns null?");
+  p->~BaseTy();
+}
+
+BaseTy *get() { return p; }
+
+  private:
+FixedSizeStorageOwner(const FixedSizeStorageOwner &) = delete;
+FixedSizeStorageOwner(FixedSizeStorageOwner &&) = delete;
+FixedSizeStorageOwner &operator=(const FixedSizeStorageOwner &) = delete;
+FixedSizeStorageOwner &operator=(FixedSizeStorageOwner &&) = delete;
+
+BaseTy *const p;
+  };
 };
 
 } // end namespace llvm
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-05-02 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast marked 5 inline comments as done.
hubert.reinterpretcast added a comment.

Responded to all comments.


http://reviews.llvm.org/D19770



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


Re: [PATCH] D19771: Rework FixedSizeTemplateParameterListStorage

2016-05-02 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast updated this revision to Diff 55825.
hubert.reinterpretcast added a comment.

Adjust for changes to http://reviews.llvm.org/D19770


http://reviews.llvm.org/D19771

Files:
  include/clang/AST/DeclTemplate.h

Index: include/clang/AST/DeclTemplate.h
===
--- include/clang/AST/DeclTemplate.h
+++ include/clang/AST/DeclTemplate.h
@@ -141,31 +141,20 @@
 
 /// \brief Stores a list of template parameters for a TemplateDecl and its
 /// derived classes. Suitable for creating on the stack.
-template  class FixedSizeTemplateParameterListStorage {
-  // This is kinda ugly: TemplateParameterList usually gets allocated
-  // in a block of memory with NamedDecls appended to it. Here, to get
-  // it stack allocated, we include the params as a separate
-  // variable. After allocation, the TemplateParameterList object
-  // treats them as part of itself.
-  TemplateParameterList List;
-  NamedDecl *Params[N];
+template 
+class FixedSizeTemplateParameterListStorage
+: public TemplateParameterList::FixedSizeStorageOwner {
+  typename TemplateParameterList::FixedSizeStorage<
+  NamedDecl *>::with_counts<
+  N>::type storage;
 
 public:
   FixedSizeTemplateParameterListStorage(SourceLocation TemplateLoc,
 SourceLocation LAngleLoc,
 ArrayRef Params,
 SourceLocation RAngleLoc)
-  : List(TemplateLoc, LAngleLoc, Params, RAngleLoc) {
-// Because we're doing an evil layout hack above, have some
-// asserts, just to double-check everything is laid out like
-// expected.
-assert(sizeof(*this) ==
-   TemplateParameterList::totalSizeToAlloc(N) &&
-   "Object layout not as expected");
-assert(this->Params == List.getTrailingObjects() &&
-   "Object layout not as expected");
-  }
-  TemplateParameterList *get() { return &List; }
+  : FixedSizeStorageOwner(new (static_cast(&storage))
+TemplateParameterList(TemplateLoc, LAngleLoc, Params, RAngleLoc)) 
{}
 };
 
 /// \brief A template argument list.


Index: include/clang/AST/DeclTemplate.h
===
--- include/clang/AST/DeclTemplate.h
+++ include/clang/AST/DeclTemplate.h
@@ -141,31 +141,20 @@
 
 /// \brief Stores a list of template parameters for a TemplateDecl and its
 /// derived classes. Suitable for creating on the stack.
-template  class FixedSizeTemplateParameterListStorage {
-  // This is kinda ugly: TemplateParameterList usually gets allocated
-  // in a block of memory with NamedDecls appended to it. Here, to get
-  // it stack allocated, we include the params as a separate
-  // variable. After allocation, the TemplateParameterList object
-  // treats them as part of itself.
-  TemplateParameterList List;
-  NamedDecl *Params[N];
+template 
+class FixedSizeTemplateParameterListStorage
+: public TemplateParameterList::FixedSizeStorageOwner {
+  typename TemplateParameterList::FixedSizeStorage<
+  NamedDecl *>::with_counts<
+  N>::type storage;
 
 public:
   FixedSizeTemplateParameterListStorage(SourceLocation TemplateLoc,
 SourceLocation LAngleLoc,
 ArrayRef Params,
 SourceLocation RAngleLoc)
-  : List(TemplateLoc, LAngleLoc, Params, RAngleLoc) {
-// Because we're doing an evil layout hack above, have some
-// asserts, just to double-check everything is laid out like
-// expected.
-assert(sizeof(*this) ==
-   TemplateParameterList::totalSizeToAlloc(N) &&
-   "Object layout not as expected");
-assert(this->Params == List.getTrailingObjects() &&
-   "Object layout not as expected");
-  }
-  TemplateParameterList *get() { return &List; }
+  : FixedSizeStorageOwner(new (static_cast(&storage))
+TemplateParameterList(TemplateLoc, LAngleLoc, Params, RAngleLoc)) {}
 };
 
 /// \brief A template argument list.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19754: Allow 'nodebug' on local variables

2016-05-02 Thread Paul Robinson via cfe-commits
probinson added inline comments.


Comment at: include/clang/Basic/Attr.td:86-88
@@ -85,1 +85,5 @@
+def NonParmVar : SubsetSubjectgetKind() != Decl::ImplicitParam &&
+ S->getKind() != Decl::ParmVar &&
+ S->getKind() != Decl::NonTypeTemplateParm}]>;
 def NonBitField : SubsetSubject Can you add tests for each of these cases to ensure that the diagnostic fires 
> on all of them?
Actually not sure how to apply an attribute to an ImplicitParam


http://reviews.llvm.org/D19754



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


Re: [PATCH] D19403: Add loop pragma for Loop Distribution

2016-05-02 Thread Adam Nemet via cfe-commits
anemet added a comment.

@rsmith, hi!  Do you have any comments on this or you're OK with this per 
Aaron's LGTM?

Thanks,
Adam


http://reviews.llvm.org/D19403



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


[PATCH] D19811: [clang-tidy] Cleaning namespaces to be more consistant across checkers.

2016-05-02 Thread Etienne Bergeron via cfe-commits
etienneb created this revision.
etienneb added a reviewer: alexfh.
etienneb added a subscriber: cfe-commits.

The goal of the patch is to bring checkers in their appropriate namespace.
This path doesn't change any behavior.

http://reviews.llvm.org/D19811

Files:
  clang-tidy/cert/CERTTidyModule.cpp
  clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
  clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h
  clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
  clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h
  clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp
  clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h
  clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h
  clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.h
  clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h
  clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h
  clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h
  clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h
  clang-tidy/misc/AssertSideEffectCheck.cpp
  clang-tidy/misc/AssertSideEffectCheck.h
  clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp
  clang-tidy/misc/IncorrectRoundings.cpp
  clang-tidy/misc/MacroParenthesesCheck.cpp
  clang-tidy/misc/MacroParenthesesCheck.h
  clang-tidy/misc/MoveConstantArgumentCheck.cpp
  clang-tidy/misc/MoveConstructorInitCheck.cpp
  clang-tidy/misc/MoveConstructorInitCheck.h
  clang-tidy/misc/NewDeleteOverloadsCheck.cpp
  clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
  clang-tidy/misc/NoexceptMoveConstructorCheck.h
  clang-tidy/misc/NonCopyableObjects.cpp
  clang-tidy/misc/NonCopyableObjects.h
  clang-tidy/misc/SizeofContainerCheck.cpp
  clang-tidy/misc/SizeofContainerCheck.h
  clang-tidy/misc/StaticAssertCheck.cpp
  clang-tidy/misc/StaticAssertCheck.h
  clang-tidy/misc/StringIntegerAssignmentCheck.cpp
  clang-tidy/misc/StringIntegerAssignmentCheck.h
  clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
  clang-tidy/misc/ThrowByValueCatchByReferenceCheck.h
  clang-tidy/misc/UndelegatedConstructor.cpp
  clang-tidy/misc/UnusedAliasDeclsCheck.cpp
  clang-tidy/misc/UnusedAliasDeclsCheck.h
  clang-tidy/misc/UnusedParametersCheck.cpp
  clang-tidy/misc/UnusedParametersCheck.h
  clang-tidy/misc/UnusedRAIICheck.cpp
  clang-tidy/modernize/RawStringLiteralCheck.h
  clang-tidy/modernize/RedundantVoidArgCheck.cpp
  clang-tidy/performance/ForRangeCopyCheck.cpp
  clang-tidy/performance/ImplicitCastInLoopCheck.cpp
  clang-tidy/readability/ImplicitBoolCastCheck.cpp
  clang-tidy/readability/ImplicitBoolCastCheck.h
  clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
  clang-tidy/readability/RedundantStringCStrCheck.cpp
  clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
  clang-tidy/readability/UniqueptrDeleteReleaseCheck.h

Index: clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
===
--- clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
+++ clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
@@ -14,6 +14,7 @@
 
 namespace clang {
 namespace tidy {
+namespace readability {
 
 /// Flag statements of the form: delete .release()
 /// and replace them with:  = nullptr
@@ -28,6 +29,7 @@
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 };
 
+} // namespace readability
 } // namespace tidy
 } // namespace clang
 
Index: clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
===
--- clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
+++ clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
@@ -16,6 +16,7 @@
 
 namespace clang {
 namespace tidy {
+namespace readability {
 
 void UniqueptrDeleteReleaseCheck::registerMatchers(MatchFinder *Finder) {
   auto IsSusbstituted = qualType(anyOf(
@@ -64,6 +65,7 @@
  " = nullptr");
 }
 
+} // namespace readability
 } // namespace tidy
 } // namespace clang
 
Index: clang-tidy/readability/RedundantStringCStrCheck.cpp
===
--- clang-tidy/readability/RedundantStringCStrCheck.cpp
+++ clang-tidy/readability/RedundantStringCStrCheck.cpp
@@ -14,9 +14,11 @@
 #include "RedundantStringCStrCheck.h"
 #include "clang/Lex/Lexer.h"
 
-namespace clang {
+using namespace clang::ast_matchers;
 
-using namespace ast_matchers;
+namespace clang {
+namespace tidy {
+namespace readability {
 
 namespace {
 
@@ -67,9 +69,6 @@
 
 } // end namespace
 
-namespace tidy {
-namespace readability {
-
 void RedundantStringCStrCheck::registerMatcher

Re: [PATCH] D19625: [libc++] Void-cast runtime-unused variables.

2016-05-02 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT added a comment.

No problem! With these changes, my test runs are currently clean wrt "warning 
C4100: unreferenced formal parameter" and "warning C4101: unreferenced local 
variable", but note that (1) Clang may emit unused-variable warnings in 
somewhat different situations, and (2) I've still got 25% of the tests failing 
to compile, which may be hiding further warnings.


http://reviews.llvm.org/D19625



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


Re: [PATCH] D19811: [clang-tidy] Cleaning namespaces to be more consistant across checkers.

2016-05-02 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG. Thanks!


http://reviews.llvm.org/D19811



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


[PATCH] D19812: [OpenMP] Check for associated statements with hasAssociatedStmt() when scanning for device code.

2016-05-02 Thread Samuel Antao via cfe-commits
sfantao created this revision.
sfantao added reviewers: ABataev, hfinkel, carlo.bertolli, arpith-jacob, kkwli0.
sfantao added subscribers: caomhin, cfe-commits.

`getAssociatedStmt()` contains an assertion that assumes the statement always 
exists. In device code scanning, we need to look into the associated statement 
therefore we check its existence. This patch replaces  `getAssociatedStmt` by 
`hasAssociatedStmt` so that we do not trigger the assertion for directives that 
happen not to have an associated statement (e.g target enter/exit data).

http://reviews.llvm.org/D19812

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  test/OpenMP/target_enter_data_codegen.cpp

Index: test/OpenMP/target_enter_data_codegen.cpp
===
--- test/OpenMP/target_enter_data_codegen.cpp
+++ test/OpenMP/target_enter_data_codegen.cpp
@@ -218,4 +218,32 @@
   {++arg;}
 }
 #endif
+///==///
+// RUN: %clang_cc1 -DCK4 -verify -fopenmp 
-fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple 
powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix 
CK4 --check-prefix CK4-64
+// RUN: %clang_cc1 -DCK4 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x 
c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ 
-triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s 
-emit-llvm -o - | FileCheck %s  --check-prefix CK4 --check-prefix CK4-64
+// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x 
c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s  
--check-prefix CK4 --check-prefix CK4-32
+// RUN: %clang_cc1 -DCK4 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ 
-std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// 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 CK4 --check-prefix CK4-32
+
+// RUN: %clang_cc1 -DCK4 -verify -fopenmp -x c++ -triple 
powerpc64le-unknown-unknown -fomptargets=powerpc64le-ibm-linux-gnu 
-emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -DCK4 -verify -fopenmp -x c++ -triple 
powerpc64le-unknown-unknown -fomptargets=powerpc64le-ibm-linux-gnu -emit-llvm 
%s -fopenmp-is-device -fomp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck 
%s --check-prefix TCK4 --check-prefix TCK4-64
+// RUN: %clang_cc1 -DCK4 -fopenmp -x c++ -std=c++11 -triple 
powerpc64le-unknown-unknown -fomptargets=powerpc64le-ibm-linux-gnu -emit-pch 
-fopenmp-is-device -fomp-host-ir-file-path %t-ppc-host.bc -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-fomptargets=powerpc64le-ibm-linux-gnu -std=c++11 -fopenmp-is-device 
-fomp-host-ir-file-path %t-ppc-host.bc -include-pch %t -verify %s -emit-llvm -o 
- | FileCheck %s --check-prefix TCK4 --check-prefix TCK4-64
+// RUN: %clang_cc1 -DCK4 -verify -fopenmp -x c++ -triple i386-unknown-unknown 
-fomptargets=i386-pc-linux-gnu -emit-llvm-bc %s -o %t-x86-host.bc
+// RUN: %clang_cc1 -DCK4 -verify -fopenmp -x c++ -triple i386-unknown-unknown 
-fomptargets=i386-pc-linux-gnu -emit-llvm %s -fopenmp-is-device 
-fomp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix TCK4 
--check-prefix TCK4-32
+// RUN: %clang_cc1 -DCK4 -fopenmp -x c++ -std=c++11 -triple 
i386-unknown-unknown -fomptargets=i386-pc-linux-gnu -emit-pch 
-fopenmp-is-device -fomp-host-ir-file-path %t-x86-host.bc -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c++ -triple i386-unknown-unknown 
-fomptargets=i386-pc-linux-gnu -std=c++11 -fopenmp-is-device 
-fomp-host-ir-file-path %t-x86-host.bc -include-pch %t -verify %s -emit-llvm -o 
- | FileCheck %s --check-prefix TCK4 --check-prefix TCK4-32
+#ifdef CK4
+
+// CK4-LABEL: device_side_scan
+void device_side_scan(int arg) {
+  // CK4: tgt_target_data_begin
+  // CK4: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  // CK4: ret
+  // TCK4-NOT: tgt_target_data_begin
+  #pragma omp target enter data map(to: arg) if(arg) device(4)
+  {++arg;}
+}
+#endif
 #endif
Index: lib/CodeGen/CGOpenMPRuntime.cpp
===
--- lib/CodeGen/CGOpenMPRuntime.cpp
+++ lib/CodeGen/CGOpenMPRuntime.cpp
@@ -5583,7 +5583,7 @@
   }
 
   if (const OMPExecutableDirective *E = dyn_cast(S)) {
-if (!E->getAssociatedStmt())
+if (!E->hasAssociatedStmt())
   return;
 
 scanForTargetRegionsFunctions(


Index: test/OpenMP/target_enter_data_codegen.cpp
===
--- test/OpenMP/target_enter_data_codegen.cpp
+++ test/OpenMP/target_enter_data_codegen.cpp
@@ -218,4 +218,32 @@
   {++arg;}
 }
 #endif
+///==///
+// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -

[clang-tools-extra] r268253 - [clang-tidy] Add modernize-make-shared check

2016-05-02 Thread Piotr Padlewski via cfe-commits
Author: prazek
Date: Mon May  2 11:56:39 2016
New Revision: 268253

URL: http://llvm.org/viewvc/llvm-project?rev=268253&view=rev
Log:
[clang-tidy] Add modernize-make-shared check

Because modernize-make-shared do almost the same job as
modernize-make-unique, I refactored common code to MakeSmartPtrCheck.

http://reviews.llvm.org/D19183

Added:
clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.h
clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp
  - copied, changed from r268140, 
clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.h
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-make-shared.rst
clang-tools-extra/trunk/test/clang-tidy/modernize-make-shared.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.h
clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp
clang-tools-extra/trunk/docs/ReleaseNotes.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Modified: clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt?rev=268253&r1=268252&r2=268253&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt Mon May  2 
11:56:39 2016
@@ -4,6 +4,8 @@ add_clang_library(clangTidyModernizeModu
   DeprecatedHeadersCheck.cpp
   LoopConvertCheck.cpp
   LoopConvertUtils.cpp
+  MakeSmartPtrCheck.cpp
+  MakeSharedCheck.cpp
   MakeUniqueCheck.cpp
   ModernizeTidyModule.cpp
   PassByValueCheck.cpp

Added: clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.cpp?rev=268253&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.cpp Mon May  2 
11:56:39 2016
@@ -0,0 +1,31 @@
+//===--- MakeSharedCheck.cpp - 
clang-tidy--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "MakeSharedCheck.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace modernize {
+
+MakeSharedCheck::MakeSharedCheck(StringRef Name, ClangTidyContext *Context)
+: MakeSmartPtrCheck(Name, Context, "std::make_shared") {}
+
+MakeSharedCheck::SmartPtrTypeMatcher
+MakeSharedCheck::getSmartPointerTypeMatcher() const {
+  return qualType(hasDeclaration(classTemplateSpecializationDecl(
+  matchesName("::std::shared_ptr"), templateArgumentCountIs(1),
+  hasTemplateArgument(
+  0, templateArgument(refersToType(qualType().bind(PointerType)));
+}
+
+} // namespace modernize
+} // namespace tidy
+} // namespace clang

Added: clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.h?rev=268253&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.h (added)
+++ clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.h Mon May  2 
11:56:39 2016
@@ -0,0 +1,43 @@
+//===--- MakeSharedCheck.h - clang-tidy--*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_SHARED_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_SHARED_H
+
+#include "MakeSmartPtrCheck.h"
+
+namespace clang {
+namespace tidy {
+namespace modernize {
+
+/// Replace the pattern:
+/// \code
+///   std::shared_ptr(new type(args...))
+/// \endcode
+///
+/// With the safer version:
+/// \code
+///   std::make_shared(args...)
+/// \endcode
+///
+/// For the user-facing documentation see:
+/// http://clang.llvm.org/extra/clang-tidy/checks/modernize-make-shared.html
+class MakeSharedCheck : public MakeSmartPtrCheck {
+public:
+  MakeSharedCheck(StringRef Name, ClangTidyContext *Context);
+
+protected:
+  SmartPtrType

Re: [PATCH] D19484: [OpenCL] Add supported OpenCL extensions to target info.

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


Comment at: test/CodeGenOpenCL/builtins-r600.cl:2
@@ -1,3 +1,3 @@
 // REQUIRES: amdgpu-registered-target
-// RUN: %clang_cc1 -triple r600-unknown-unknown -S -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -triple r600-unknown-unknown -target-cpu rv670 -S 
-emit-llvm -o - %s | FileCheck %s
 

Anastasia wrote:
> Just triple is not sufficient here? 
This test requires fp64 support. Some GPUs of r600 target does not support 
fp64. Need to specify a GPU supporting fp64.


Comment at: test/SemaOpenCL/extensions.cl:14
@@ +13,3 @@
+#ifdef NOFP64
+// expected-warning@-2{{unknown OpenCL extension 'cl_khr_fp64' - ignoring}}
+#endif

Anastasia wrote:
> I was just wondering whether renaming to "unsupported" instead of "unknown" 
> would make more sense?
Agree.


http://reviews.llvm.org/D19484



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


Re: [PATCH] D19484: [OpenCL] Add supported OpenCL extensions to target info.

2016-05-02 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 55839.
yaxunl marked 2 inline comments as done.
yaxunl added a comment.

Add comments about macros for enumerating extensions.
Improve diagnostics about extensions.


http://reviews.llvm.org/D19484

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

Index: test/SemaOpenCL/optional-core-fp64-cl2.0.cl
===
--- test/SemaOpenCL/optional-core-fp64-cl2.0.cl
+++ /dev/null
@@ -1,20 +0,0 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
-// expected-no-diagnostics
-
-void f1(double da) {
-  double d;
-  (void) 1.0;
-}
-
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-
-void f2(void) {
-  double d;
-  (void) 1.0;
-}
-
-#pragma OPENCL EXTENSION cl_khr_fp64 : disable
-
-void f3(void) {
-  double d;
-}
Index: test/SemaOpenCL/optional-core-fp64-cl1.2.cl
===
--- test/SemaOpenCL/optional-core-fp64-cl1.2.cl
+++ /dev/null
@@ -1,20 +0,0 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2
-// expected-no-diagnostics
-
-void f1(double da) {
-  double d;
-  (void) 1.0;
-}
-
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-
-void f2(void) {
-  double d;
-  (void) 1.0;
-}
-
-#pragma OPENCL EXTENSION cl_khr_fp64 : disable
-
-void f3(void) {
-  double d;
-}
Index: test/SemaOpenCL/invalid-logical-ops-1.2.cl
===
--- test/SemaOpenCL/invalid-logical-ops-1.2.cl
+++ test/SemaOpenCL/invalid-logical-ops-1.2.cl
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 %s -verify -cl-std=CL1.2 -triple x86_64-unknown-linux-gnu
 
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable // expected-warning{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}}
+
 typedef __attribute__((ext_vector_type(4))) float float4;
 typedef __attribute__((ext_vector_type(4))) double double4;
 typedef __attribute__((ext_vector_type(4))) int int4;
Index: test/SemaOpenCL/invalid-kernel-parameters.cl
===
--- test/SemaOpenCL/invalid-kernel-parameters.cl
+++ test/SemaOpenCL/invalid-kernel-parameters.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple spir-unknown-unknown
 
 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
 
Index: test/SemaOpenCL/half.cl
===
--- test/SemaOpenCL/half.cl
+++ test/SemaOpenCL/half.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-unused-value
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-unused-value -triple spir-unknown-unknown
 
 #pragma OPENCL EXTENSION cl_khr_fp16 : disable
 constant float f = 1.0h; // expected-error{{half precision constant requires cl_khr_fp16}}
Index: test/SemaOpenCL/extensions.cl
===
--- /dev/null
+++ test/SemaOpenCL/extensions.cl
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=CL1.1
+
+// Test with a target not supporting fp64.
+// RUN: %clang_cc1 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -DNOFP64
+
+void f1(double da) { // expected-error {{type 'double' requires cl_khr_fp64 extension}}
+  double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}}
+  (void) 1.0; // expected-warning {{double precision constant requires cl_khr_fp64}}
+}
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#ifdef NOFP64
+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp64' - ignoring}}
+#endif
+
+void f2(void) {
+  double d;
+#ifdef NOFP64
+// expected-error@-2{{use of type 'double' requires cl_khr_fp64 extension to be enabled}}
+#endif
+
+  (void) 1.0;
+#ifdef NOFP64

r268256 - [WebAssembly] Rename memory_size intrinsic to current_memory

2016-05-02 Thread Derek Schuff via cfe-commits
Author: dschuff
Date: Mon May  2 12:26:19 2016
New Revision: 268256

URL: http://llvm.org/viewvc/llvm-project?rev=268256&view=rev
Log:
[WebAssembly] Rename memory_size intrinsic to current_memory

This follows the recent change in the wasm spec.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/builtins-wasm.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def?rev=268256&r1=268255&r2=268256&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def Mon May  2 12:26:19 
2016
@@ -16,9 +16,9 @@
 
 // The format of this database matches clang/Basic/Builtins.def.
 
-// Note that memory_size is not "c" (readnone) because it must be sequenced 
with
+// Note that current_memory is not "c" (readnone) because it must be sequenced 
with
 // respect to grow_memory calls.
-BUILTIN(__builtin_wasm_memory_size, "z", "n")
+BUILTIN(__builtin_wasm_current_memory, "z", "n")
 BUILTIN(__builtin_wasm_grow_memory, "vz", "n")
 
 #undef BUILTIN

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=268256&r1=268255&r2=268256&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon May  2 12:26:19 2016
@@ -7441,9 +7441,9 @@ Value *CodeGenFunction::EmitNVPTXBuiltin
 Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID,
const CallExpr *E) {
   switch (BuiltinID) {
-  case WebAssembly::BI__builtin_wasm_memory_size: {
+  case WebAssembly::BI__builtin_wasm_current_memory: {
 llvm::Type *ResultType = ConvertType(E->getType());
-Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_memory_size, ResultType);
+Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_current_memory, 
ResultType);
 return Builder.CreateCall(Callee);
   }
   case WebAssembly::BI__builtin_wasm_grow_memory: {

Modified: cfe/trunk/test/CodeGen/builtins-wasm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-wasm.c?rev=268256&r1=268255&r2=268256&view=diff
==
--- cfe/trunk/test/CodeGen/builtins-wasm.c (original)
+++ cfe/trunk/test/CodeGen/builtins-wasm.c Mon May  2 12:26:19 2016
@@ -4,9 +4,9 @@
 // RUN:   | FileCheck %s -check-prefix=WEBASSEMBLY64
 
 __SIZE_TYPE__ f1(void) {
-  return __builtin_wasm_memory_size();
-// WEBASSEMBLY32: call {{i.*}} @llvm.wasm.memory.size.i32()
-// WEBASSEMBLY64: call {{i.*}} @llvm.wasm.memory.size.i64()
+  return __builtin_wasm_current_memory();
+// WEBASSEMBLY32: call {{i.*}} @llvm.wasm.current.memory.i32()
+// WEBASSEMBLY64: call {{i.*}} @llvm.wasm.current.memory.i64()
 }
 
 void f2(long delta) {


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


[PATCH] D19815: Support '#pragma once' in headers when using PCH

2016-05-02 Thread Warren Ristow via cfe-commits
wristow created this revision.
wristow added a reviewer: rsmith.
wristow added a subscriber: cfe-commits.

The '#pragma once' directive was erroneously ignored when encountered
in the header-file specified in generate-PCH-mode.  This resulted in
compile-time errors in some cases with legal code, and also a misleading
warning being produced.

This fixes PR24387.

http://reviews.llvm.org/D19815

Files:
  include/clang/Lex/PreprocessorOptions.h
  lib/Frontend/InitPreprocessor.cpp
  lib/Lex/Pragma.cpp
  test/PCH/pragma-once.c
  test/PCH/pragma-once.h

Index: test/PCH/pragma-once.h
===
--- /dev/null
+++ test/PCH/pragma-once.h
@@ -0,0 +1,5 @@
+#pragma once
+
+/* For use with the pragma-once.c test */
+
+int x = 3;
Index: test/PCH/pragma-once.c
===
--- /dev/null
+++ test/PCH/pragma-once.c
@@ -0,0 +1,13 @@
+// Test this without pch.
+// RUN: %clang_cc1 -include %S/pragma-once.h -fsyntax-only -verify %s
+
+// Test with pch.
+// RUN: %clang_cc1 -emit-pch -o %t %S/pragma-once.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
+
+// expected-no-diagnostics
+
+// Including "pragma-once.h" twice, to verify the 'once' aspect is honored.
+#include "pragma-once.h"
+#include "pragma-once.h"
+int foo(void) { return 0; }
Index: lib/Lex/Pragma.cpp
===
--- lib/Lex/Pragma.cpp
+++ lib/Lex/Pragma.cpp
@@ -19,6 +19,7 @@
 #include "clang/Lex/LexDiagnostic.h"
 #include "clang/Lex/LiteralSupport.h"
 #include "clang/Lex/MacroInfo.h"
+#include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Lex/Preprocessor.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringSwitch.h"
@@ -354,7 +355,9 @@
 /// HandlePragmaOnce - Handle \#pragma once.  OnceTok is the 'once'.
 ///
 void Preprocessor::HandlePragmaOnce(Token &OnceTok) {
-  if (isInPrimaryFile()) {
+  // Don't honor the 'once' when handling the primary source file, unless
+  // we're generating a PCH file.
+  if (isInPrimaryFile() && !getPreprocessorOpts().GeneratePCHMode) {
 Diag(OnceTok, diag::pp_pragma_once_in_main_file);
 return;
   }
Index: lib/Frontend/InitPreprocessor.cpp
===
--- lib/Frontend/InitPreprocessor.cpp
+++ lib/Frontend/InitPreprocessor.cpp
@@ -1021,6 +1021,10 @@
   if (!InitOpts.ImplicitPTHInclude.empty())
 AddImplicitIncludePTH(Builder, PP, InitOpts.ImplicitPTHInclude);
 
+  // Instruct the preprocessor that we're generating a PCH file.
+  if (FEOpts.ProgramAction == frontend::GeneratePCH)
+PP.getPreprocessorOpts().GeneratePCHMode = true;
+
   // Process -include directives.
   for (unsigned i = 0, e = InitOpts.Includes.size(); i != e; ++i) {
 const std::string &Path = InitOpts.Includes[i];
Index: include/clang/Lex/PreprocessorOptions.h
===
--- include/clang/Lex/PreprocessorOptions.h
+++ include/clang/Lex/PreprocessorOptions.h
@@ -61,6 +61,9 @@
   /// \brief Headers that will be converted to chained PCHs in memory.
   std::vector ChainedIncludes;
 
+  /// \brief When true, we are generating a pre-compiled header.
+  bool GeneratePCHMode;
+
   /// \brief When true, disables most of the normal validation performed on
   /// precompiled headers.
   bool DisablePCHValidation;
@@ -141,6 +144,7 @@
 
 public:
   PreprocessorOptions() : UsePredefines(true), DetailedRecord(false),
+  GeneratePCHMode(false),
   DisablePCHValidation(false),
   AllowPCHWithCompilerErrors(false),
   DumpDeserializedPCHDecls(false),


Index: test/PCH/pragma-once.h
===
--- /dev/null
+++ test/PCH/pragma-once.h
@@ -0,0 +1,5 @@
+#pragma once
+
+/* For use with the pragma-once.c test */
+
+int x = 3;
Index: test/PCH/pragma-once.c
===
--- /dev/null
+++ test/PCH/pragma-once.c
@@ -0,0 +1,13 @@
+// Test this without pch.
+// RUN: %clang_cc1 -include %S/pragma-once.h -fsyntax-only -verify %s
+
+// Test with pch.
+// RUN: %clang_cc1 -emit-pch -o %t %S/pragma-once.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
+
+// expected-no-diagnostics
+
+// Including "pragma-once.h" twice, to verify the 'once' aspect is honored.
+#include "pragma-once.h"
+#include "pragma-once.h"
+int foo(void) { return 0; }
Index: lib/Lex/Pragma.cpp
===
--- lib/Lex/Pragma.cpp
+++ lib/Lex/Pragma.cpp
@@ -19,6 +19,7 @@
 #include "clang/Lex/LexDiagnostic.h"
 #include "clang/Lex/LiteralSupport.h"
 #include "clang/Lex/MacroInfo.h"
+#include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Lex/Preprocessor.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringSwitch.h"
@@ -354,7 +355,9

Re: [PATCH] D19815: Support '#pragma once' in headers when using PCH

2016-05-02 Thread Warren Ristow via cfe-commits
wristow added a comment.

To check for whether we're in "generate a PCH file mode", I added a new flag 
(`GeneratePCHMode`) to `PreprocessorOptions`.  If the `CompilerInstance` had 
been visible in lexical analysis, it would have been easy to do this without 
adding a new flag.  Is there a better way to determine whether Clang is 
generating a PCH file?  One alternative approach considered was to put a 
reference to `FrontendOptions` into the `Preprocessor` class (it already 
includes a reference to `LangOpts`, for example).


http://reviews.llvm.org/D19815



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


Re: [PATCH] D19756: Expand aggregate arguments more often on 32-bit Windows

2016-05-02 Thread Reid Kleckner via cfe-commits
rnk marked an inline comment as done.
rnk added a comment.

In http://reviews.llvm.org/D19756#417718, @hans wrote:

> This is awesome! lgtm


Great!

> Want to reference PR27522 in the patch description?

> 

> Also in the description:

> 

> > I also expanded the workaround handle C++ records with constructors on

> 

> 

> is missing a "to".


Done.



Comment at: lib/CodeGen/TargetInfo.cpp:1151
@@ +1150,3 @@
+} else {
+  // Don't do this for dynamic classes.
+  if (CXXRD->isDynamicClass())

hans wrote:
> Why not for dynamic classes or non-empty bases? Is it just that they hold 
> more data than the immediate fields, or is there some other reason?
These are the two main cases that "isCLike" was probably defending against. 
Ultimately the sizeof check below would detect non-empty bases and dynamic 
classes as padding bytes that didn't come from fields, but I felt like we 
should try to be safe up front.

Eventually it might be worth making this algorithm work recursively so that 
this gets passed as two i32s:
  struct A { int a; };
  struct B : A { int b; };


Comment at: lib/CodeGen/TargetInfo.cpp:1177
@@ +1176,3 @@
+
+  // We can do this if there was no alignment padding.
+  return Size == getContext().getTypeSize(Ty);

hans wrote:
> Could there be a situation where the struct is packed, but there would be 
> padding when we expand it?
> 
> I suppose it won't happen in practice since we only allow 32/64-bit members..
Stack arguments usually only get 4 byte alignment regardless of type. The 
purpose of the 32/64 check is to detect when expanding arguments would create 
padding. Maybe I should write that down in a comment here.


Comment at: lib/CodeGen/TargetInfo.cpp:1397
@@ -1397,1 +1396,3 @@
  bool &NeedsPadding) const {
+  // On Windows, aggregates other than HFAs are never passed in registers, and
+  // they do not consume register slots. HFAs have already been dealt with at

hans wrote:
> Silly question: what's an HFA? (Also for the patch description)
"homogenous floating-point aggregate". I'll expand it here.


Comment at: test/CodeGen/windows-struct-abi.c:13
@@ -12,3 +12,3 @@
 
-// CHECK: define void @receive_f1(%struct.f1* byval align 4 %a0)
+// CHECK: define void @receive_f1(float %a0.0)
 

hans wrote:
> we're sure this float won't end up in a register right?
Yep


http://reviews.llvm.org/D19756



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


r268261 - Expand aggregate arguments more often on 32-bit Windows

2016-05-02 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Mon May  2 12:41:07 2016
New Revision: 268261

URL: http://llvm.org/viewvc/llvm-project?rev=268261&view=rev
Log:
Expand aggregate arguments more often on 32-bit Windows

Before this change, we would pass all non-HFA record arguments on
Windows with byval. Byval often blocks optimizations and results in bad
code generation. Windows now uses the existing workaround that other
x86_32 platforms use.

I also expanded the workaround to handle C++ records with constructors
on Windows. On non-Windows platforms, we have to keep generating the
same LLVM IR prototypes if we want our bitcode to be ABI compatible.
Otherwise we will encounter mismatch issues like PR21573.

Essentially fixes PR27522 in Clang instead of LLVM.

Reviewers: hans

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

Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/vectorcall.c
cfe/trunk/test/CodeGen/windows-struct-abi.c
cfe/trunk/test/CodeGen/x86_32-arguments-win32.c
cfe/trunk/test/CodeGenCXX/microsoft-abi-cdecl-method-sret.cpp
cfe/trunk/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=268261&r1=268260&r2=268261&view=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon May  2 12:41:07 2016
@@ -503,72 +503,6 @@ static const Type *isSingleElementStruct
   return Found;
 }
 
-static bool is32Or64BitBasicType(QualType Ty, ASTContext &Context) {
-  // Treat complex types as the element type.
-  if (const ComplexType *CTy = Ty->getAs())
-Ty = CTy->getElementType();
-
-  // Check for a type which we know has a simple scalar argument-passing
-  // convention without any padding.  (We're specifically looking for 32
-  // and 64-bit integer and integer-equivalents, float, and double.)
-  if (!Ty->getAs() && !Ty->hasPointerRepresentation() &&
-  !Ty->isEnumeralType() && !Ty->isBlockPointerType())
-return false;
-
-  uint64_t Size = Context.getTypeSize(Ty);
-  return Size == 32 || Size == 64;
-}
-
-/// canExpandIndirectArgument - Test whether an argument type which is to be
-/// passed indirectly (on the stack) would have the equivalent layout if it was
-/// expanded into separate arguments. If so, we prefer to do the latter to 
avoid
-/// inhibiting optimizations.
-///
-// FIXME: This predicate is missing many cases, currently it just follows
-// llvm-gcc (checks that all fields are 32-bit or 64-bit primitive types). We
-// should probably make this smarter, or better yet make the LLVM backend
-// capable of handling it.
-static bool canExpandIndirectArgument(QualType Ty, ASTContext &Context) {
-  // We can only expand structure types.
-  const RecordType *RT = Ty->getAs();
-  if (!RT)
-return false;
-
-  // We can only expand (C) structures.
-  //
-  // FIXME: This needs to be generalized to handle classes as well.
-  const RecordDecl *RD = RT->getDecl();
-  if (!RD->isStruct())
-return false;
-
-  // We try to expand CLike CXXRecordDecl.
-  if (const CXXRecordDecl *CXXRD = dyn_cast(RD)) {
-if (!CXXRD->isCLike())
-  return false;
-  }
-
-  uint64_t Size = 0;
-
-  for (const auto *FD : RD->fields()) {
-if (!is32Or64BitBasicType(FD->getType(), Context))
-  return false;
-
-// FIXME: Reject bit-fields wholesale; there are two problems, we don't 
know
-// how to expand them yet, and the predicate for telling if a bitfield 
still
-// counts as "basic" is more complicated than what we were doing 
previously.
-if (FD->isBitField())
-  return false;
-
-Size += Context.getTypeSize(FD->getType());
-  }
-
-  // Make sure there are not any holes in the struct.
-  if (Size != Context.getTypeSize(Ty))
-return false;
-
-  return true;
-}
-
 namespace {
 Address EmitVAArgInstr(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
const ABIArgInfo &AI) {
@@ -959,6 +893,8 @@ class X86_32ABIInfo : public SwiftABIInf
 bool &NeedsPadding) const;
   bool shouldPrimitiveUseInReg(QualType Ty, CCState &State) const;
 
+  bool canExpandIndirectArgument(QualType Ty) const;
+
   /// \brief Rewrite the function info so that all memory arguments use
   /// inalloca.
   void rewriteWithInAlloca(CGFunctionInfo &FI) const;
@@ -1179,6 +1115,72 @@ bool X86_32ABIInfo::shouldReturnTypeInRe
   return true;
 }
 
+static bool is32Or64BitBasicType(QualType Ty, ASTContext &Context) {
+  // Treat complex types as the element type.
+  if (const ComplexType *CTy = Ty->getAs())
+Ty = CTy->getElementType();
+
+  // Check for a type which we know has a simple scalar argument-passing
+  // convention without any padding.  (We're specifically looking for 32
+  // and 64-bit integer and integer-equivalents, float, and double.)
+  if (!Ty->getAs() && !Ty->hasPoin

Re: [PATCH] D19756: Expand aggregate arguments more often on 32-bit Windows

2016-05-02 Thread Reid Kleckner via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL268261: Expand aggregate arguments more often on 32-bit 
Windows (authored by rnk).

Changed prior to commit:
  http://reviews.llvm.org/D19756?vs=55695&id=55845#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19756

Files:
  cfe/trunk/lib/CodeGen/TargetInfo.cpp
  cfe/trunk/test/CodeGen/vectorcall.c
  cfe/trunk/test/CodeGen/windows-struct-abi.c
  cfe/trunk/test/CodeGen/x86_32-arguments-win32.c
  cfe/trunk/test/CodeGenCXX/microsoft-abi-cdecl-method-sret.cpp
  cfe/trunk/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp

Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp
===
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp
@@ -503,72 +503,6 @@
   return Found;
 }
 
-static bool is32Or64BitBasicType(QualType Ty, ASTContext &Context) {
-  // Treat complex types as the element type.
-  if (const ComplexType *CTy = Ty->getAs())
-Ty = CTy->getElementType();
-
-  // Check for a type which we know has a simple scalar argument-passing
-  // convention without any padding.  (We're specifically looking for 32
-  // and 64-bit integer and integer-equivalents, float, and double.)
-  if (!Ty->getAs() && !Ty->hasPointerRepresentation() &&
-  !Ty->isEnumeralType() && !Ty->isBlockPointerType())
-return false;
-
-  uint64_t Size = Context.getTypeSize(Ty);
-  return Size == 32 || Size == 64;
-}
-
-/// canExpandIndirectArgument - Test whether an argument type which is to be
-/// passed indirectly (on the stack) would have the equivalent layout if it was
-/// expanded into separate arguments. If so, we prefer to do the latter to avoid
-/// inhibiting optimizations.
-///
-// FIXME: This predicate is missing many cases, currently it just follows
-// llvm-gcc (checks that all fields are 32-bit or 64-bit primitive types). We
-// should probably make this smarter, or better yet make the LLVM backend
-// capable of handling it.
-static bool canExpandIndirectArgument(QualType Ty, ASTContext &Context) {
-  // We can only expand structure types.
-  const RecordType *RT = Ty->getAs();
-  if (!RT)
-return false;
-
-  // We can only expand (C) structures.
-  //
-  // FIXME: This needs to be generalized to handle classes as well.
-  const RecordDecl *RD = RT->getDecl();
-  if (!RD->isStruct())
-return false;
-
-  // We try to expand CLike CXXRecordDecl.
-  if (const CXXRecordDecl *CXXRD = dyn_cast(RD)) {
-if (!CXXRD->isCLike())
-  return false;
-  }
-
-  uint64_t Size = 0;
-
-  for (const auto *FD : RD->fields()) {
-if (!is32Or64BitBasicType(FD->getType(), Context))
-  return false;
-
-// FIXME: Reject bit-fields wholesale; there are two problems, we don't know
-// how to expand them yet, and the predicate for telling if a bitfield still
-// counts as "basic" is more complicated than what we were doing previously.
-if (FD->isBitField())
-  return false;
-
-Size += Context.getTypeSize(FD->getType());
-  }
-
-  // Make sure there are not any holes in the struct.
-  if (Size != Context.getTypeSize(Ty))
-return false;
-
-  return true;
-}
-
 namespace {
 Address EmitVAArgInstr(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
const ABIArgInfo &AI) {
@@ -959,6 +893,8 @@
 bool &NeedsPadding) const;
   bool shouldPrimitiveUseInReg(QualType Ty, CCState &State) const;
 
+  bool canExpandIndirectArgument(QualType Ty) const;
+
   /// \brief Rewrite the function info so that all memory arguments use
   /// inalloca.
   void rewriteWithInAlloca(CGFunctionInfo &FI) const;
@@ -1179,6 +1115,72 @@
   return true;
 }
 
+static bool is32Or64BitBasicType(QualType Ty, ASTContext &Context) {
+  // Treat complex types as the element type.
+  if (const ComplexType *CTy = Ty->getAs())
+Ty = CTy->getElementType();
+
+  // Check for a type which we know has a simple scalar argument-passing
+  // convention without any padding.  (We're specifically looking for 32
+  // and 64-bit integer and integer-equivalents, float, and double.)
+  if (!Ty->getAs() && !Ty->hasPointerRepresentation() &&
+  !Ty->isEnumeralType() && !Ty->isBlockPointerType())
+return false;
+
+  uint64_t Size = Context.getTypeSize(Ty);
+  return Size == 32 || Size == 64;
+}
+
+/// Test whether an argument type which is to be passed indirectly (on the
+/// stack) would have the equivalent layout if it was expanded into separate
+/// arguments. If so, we prefer to do the latter to avoid inhibiting
+/// optimizations.
+bool X86_32ABIInfo::canExpandIndirectArgument(QualType Ty) const {
+  // We can only expand structure types.
+  const RecordType *RT = Ty->getAs();
+  if (!RT)
+return false;
+  const RecordDecl *RD = RT->getDecl();
+  if (const CXXRecordDecl *CXXRD = dyn_cast(RD)) {
+if (!IsWin32StructABI ) {
+  // On non-Windows, we have to conservatively match our old bitcode

Re: [PATCH] D19755: [include-fixer] Fix Clang-tidy modernize-use-override and some Include What You Use warnings

2016-05-02 Thread Haojian Wu via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


Repository:
  rL LLVM

http://reviews.llvm.org/D19755



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


[clang-tools-extra] r268262 - [include-fixer] Fix Clang-tidy modernize-use-override and some Include What You Use warnings.

2016-05-02 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Mon May  2 12:49:00 2016
New Revision: 268262

URL: http://llvm.org/viewvc/llvm-project?rev=268262&view=rev
Log:
[include-fixer] Fix Clang-tidy modernize-use-override and some Include What You 
Use warnings.

Differential revision: http://reviews.llvm.org/D19755

Modified:
clang-tools-extra/trunk/include-fixer/IncludeFixer.h

clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp

clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Modified: clang-tools-extra/trunk/include-fixer/IncludeFixer.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/IncludeFixer.h?rev=268262&r1=268261&r2=268262&view=diff
==
--- clang-tools-extra/trunk/include-fixer/IncludeFixer.h (original)
+++ clang-tools-extra/trunk/include-fixer/IncludeFixer.h Mon May  2 12:49:00 
2016
@@ -11,11 +11,18 @@
 #define LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_INCLUDEFIXER_H
 
 #include "XrefsDB.h"
-#include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "clang/Tooling/Tooling.h"
+#include 
+#include 
 
 namespace clang {
+
+class CompilerInvocation;
+class DiagnosticConsumer;
+class FileManager;
+class PCHContainerOperations;
+
 namespace include_fixer {
 
 class IncludeFixerActionFactory : public clang::tooling::ToolAction {
@@ -26,7 +33,7 @@ public:
   IncludeFixerActionFactory(
   XrefsDB &Xrefs, std::vector &Replacements,
   bool MinimizeIncludePaths = true);
-  ~IncludeFixerActionFactory();
+  ~IncludeFixerActionFactory() override;
 
   bool
   runInvocation(clang::CompilerInvocation *Invocation,

Modified: 
clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp?rev=268262&r1=268261&r2=268262&view=diff
==
--- 
clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
 (original)
+++ 
clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
 Mon May  2 12:49:00 2016
@@ -8,16 +8,24 @@
 
//===--===//
 
 #include "FindAllSymbols.h"
+#include "SymbolInfo.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
-#include "clang/ASTMatchers/ASTMatchers.h"
-#include "clang/Frontend/FrontendActions.h"
 #include "clang/Tooling/CommonOptionsParser.h"
 #include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/ThreadPool.h"
+#include "llvm/Support/raw_ostream.h"
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 
 using namespace clang::tooling;
@@ -52,7 +60,7 @@ namespace find_all_symbols {
 class YamlReporter
 : public clang::find_all_symbols::FindAllSymbols::ResultReporter {
 public:
-  ~YamlReporter() {}
+  ~YamlReporter() override {}
 
   void reportResult(StringRef FileName, const SymbolInfo &Symbol) override {
 Symbols[FileName].insert(Symbol);

Modified: 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp?rev=268262&r1=268261&r2=268262&view=diff
==
--- 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
 (original)
+++ 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
 Mon May  2 12:49:00 2016
@@ -8,9 +8,20 @@
 
//===--===//
 
 #include "FindAllSymbols.h"
+#include "SymbolInfo.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/FileSystemOptions.h"
+#include "clang/Basic/VirtualFileSystem.h"
+#include "clang/Frontend/PCHContainerOperations.h"
 #include "clang/Tooling/Tooling.h"
-#include "llvm/Support/YAMLTraits.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "gtest/gtest.h"
+#include 
+#include 
+#include 
 
 namespace clang {
 namespace find_all_symbols {
@@ -20,7 +31,7 @@ static const char HeaderName[] = "symbol
 class MockReporter
 : public clang::find_all_symbols::FindAllSymbols::ResultReporter {
 public:
-  ~MockReporter() {}
+  ~MockReporter() override {}
 
   void reportResult(llvm::StringRef FileName,
 const SymbolInfo &Symbol) override {


Re: [PATCH] D19755: [include-fixer] Fix Clang-tidy modernize-use-override and some Include What You Use warnings

2016-05-02 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL268262: [include-fixer] Fix Clang-tidy 
modernize-use-override and some Include What… (authored by eugenezelenko).

Changed prior to commit:
  http://reviews.llvm.org/D19755?vs=55694&id=55849#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19755

Files:
  clang-tools-extra/trunk/include-fixer/IncludeFixer.h
  
clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
  
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Index: clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
===
--- clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
+++ clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
@@ -8,9 +8,20 @@
 //===--===//
 
 #include "FindAllSymbols.h"
+#include "SymbolInfo.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/FileSystemOptions.h"
+#include "clang/Basic/VirtualFileSystem.h"
+#include "clang/Frontend/PCHContainerOperations.h"
 #include "clang/Tooling/Tooling.h"
-#include "llvm/Support/YAMLTraits.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "gtest/gtest.h"
+#include 
+#include 
+#include 
 
 namespace clang {
 namespace find_all_symbols {
@@ -20,7 +31,7 @@
 class MockReporter
 : public clang::find_all_symbols::FindAllSymbols::ResultReporter {
 public:
-  ~MockReporter() {}
+  ~MockReporter() override {}
 
   void reportResult(llvm::StringRef FileName,
 const SymbolInfo &Symbol) override {
Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
===
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
@@ -8,16 +8,24 @@
 //===--===//
 
 #include "FindAllSymbols.h"
+#include "SymbolInfo.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
-#include "clang/ASTMatchers/ASTMatchers.h"
-#include "clang/Frontend/FrontendActions.h"
 #include "clang/Tooling/CommonOptionsParser.h"
 #include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/ThreadPool.h"
+#include "llvm/Support/raw_ostream.h"
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 
 using namespace clang::tooling;
@@ -52,7 +60,7 @@
 class YamlReporter
 : public clang::find_all_symbols::FindAllSymbols::ResultReporter {
 public:
-  ~YamlReporter() {}
+  ~YamlReporter() override {}
 
   void reportResult(StringRef FileName, const SymbolInfo &Symbol) override {
 Symbols[FileName].insert(Symbol);
Index: clang-tools-extra/trunk/include-fixer/IncludeFixer.h
===
--- clang-tools-extra/trunk/include-fixer/IncludeFixer.h
+++ clang-tools-extra/trunk/include-fixer/IncludeFixer.h
@@ -11,11 +11,18 @@
 #define LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_INCLUDEFIXER_H
 
 #include "XrefsDB.h"
-#include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "clang/Tooling/Tooling.h"
+#include 
+#include 
 
 namespace clang {
+
+class CompilerInvocation;
+class DiagnosticConsumer;
+class FileManager;
+class PCHContainerOperations;
+
 namespace include_fixer {
 
 class IncludeFixerActionFactory : public clang::tooling::ToolAction {
@@ -26,7 +33,7 @@
   IncludeFixerActionFactory(
   XrefsDB &Xrefs, std::vector &Replacements,
   bool MinimizeIncludePaths = true);
-  ~IncludeFixerActionFactory();
+  ~IncludeFixerActionFactory() override;
 
   bool
   runInvocation(clang::CompilerInvocation *Invocation,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19802: Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class that initializes itself as a base

2016-05-02 Thread Haojian Wu via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!



Comment at: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp:342
@@ +341,3 @@
+
+template 
+class PositiveSelfInitialization : NegativeAggregateType

aaron.ballman wrote:
> Is it required to be a templated class to trigger the crash?
Yes, it's required.


http://reviews.llvm.org/D19802



___
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-02 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast updated this revision to Diff 55850.
hubert.reinterpretcast added a comment.

Address Faisal's comment; supercedes http://reviews.llvm.org/D19771

Replaces the custom FixedSizeTemplateParameterListStorage implementation with 
one that follows the interface provided by llvm::TrailingObjects.


http://reviews.llvm.org/D19322

Files:
  include/clang/AST/DeclTemplate.h
  lib/AST/DeclTemplate.cpp
  lib/Sema/SemaTemplateDeduction.cpp

Index: lib/Sema/SemaTemplateDeduction.cpp
===
--- lib/Sema/SemaTemplateDeduction.cpp
+++ lib/Sema/SemaTemplateDeduction.cpp
@@ -4022,8 +4022,8 @@
  nullptr, false, false);
   QualType TemplArg = QualType(TemplParam->getTypeForDecl(), 0);
   NamedDecl *TemplParamPtr = TemplParam;
-  FixedSizeTemplateParameterListStorage<1> TemplateParamsSt(
-  Loc, Loc, TemplParamPtr, Loc);
+  FixedSizeTemplateParameterListStorage<1, false> TemplateParamsSt(
+  Loc, Loc, TemplParamPtr, Loc, nullptr);
 
   QualType FuncParam = SubstituteAutoTransform(*this, TemplArg).Apply(Type);
   assert(!FuncParam.isNull() &&
Index: lib/AST/DeclTemplate.cpp
===
--- lib/AST/DeclTemplate.cpp
+++ lib/AST/DeclTemplate.cpp
@@ -31,9 +31,11 @@
 TemplateParameterList::TemplateParameterList(SourceLocation TemplateLoc,
  SourceLocation LAngleLoc,
  ArrayRef Params,
- SourceLocation RAngleLoc)
+ SourceLocation RAngleLoc,
+ Expr *RequiresClause)
   : TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc), RAngleLoc(RAngleLoc),
-NumParams(Params.size()), ContainsUnexpandedParameterPack(false) {
+NumParams(Params.size()), ContainsUnexpandedParameterPack(false),
+HasRequiresClause(static_cast(RequiresClause)) {
   assert(this->NumParams == NumParams && "Too many template parameters");
   for (unsigned Idx = 0; Idx < NumParams; ++Idx) {
 NamedDecl *P = Params[Idx];
@@ -52,15 +54,21 @@
   // template parameter list does too.
 }
   }
+  if (RequiresClause) {
+*getTrailingObjects() = RequiresClause;
+  }
 }
 
-TemplateParameterList *TemplateParameterList::Create(
-const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc,
-ArrayRef Params, SourceLocation RAngleLoc) {
-  void *Mem = C.Allocate(totalSizeToAlloc(Params.size()),
+TemplateParameterList *
+TemplateParameterList::Create(const ASTContext &C, SourceLocation TemplateLoc,
+  SourceLocation LAngleLoc,
+  ArrayRef Params,
+  SourceLocation RAngleLoc, Expr *RequiresClause) {
+  void *Mem = C.Allocate(totalSizeToAlloc(
+ Params.size(), RequiresClause ? 1u : 0u),
  llvm::alignOf());
   return new (Mem) TemplateParameterList(TemplateLoc, LAngleLoc, Params,
- RAngleLoc);
+ RAngleLoc, RequiresClause);
 }
 
 unsigned TemplateParameterList::getMinRequiredArguments() const {
Index: include/clang/AST/DeclTemplate.h
===
--- include/clang/AST/DeclTemplate.h
+++ include/clang/AST/DeclTemplate.h
@@ -46,7 +46,8 @@
 /// \brief Stores a list of template parameters for a TemplateDecl and its
 /// derived classes.
 class TemplateParameterList final
-: private llvm::TrailingObjects {
+: private llvm::TrailingObjects {
 
   /// The location of the 'template' keyword.
   SourceLocation TemplateLoc;
@@ -56,26 +57,36 @@
 
   /// The number of template parameters in this template
   /// parameter list.
-  unsigned NumParams : 31;
+  unsigned NumParams : 30;
 
   /// Whether this template parameter list contains an unexpanded parameter
   /// pack.
   unsigned ContainsUnexpandedParameterPack : 1;
 
+  /// Whether this template parameter list has an associated requires-clause
+  unsigned HasRequiresClause : 1;
+
 protected:
   size_t numTrailingObjects(OverloadToken) const {
 return NumParams;
   }
 
+  size_t numTrailingObjects(OverloadToken) const {
+return HasRequiresClause;
+  }
+
   TemplateParameterList(SourceLocation TemplateLoc, SourceLocation LAngleLoc,
-ArrayRef Params, SourceLocation RAngleLoc);
+ArrayRef Params, SourceLocation RAngleLoc,
+Expr *RequiresClause);
 
 public:
+  // FIXME: remove default argument for RequiresClause
   static TemplateParameterList *Create(const ASTContext &C,
SourceLocation TemplateLoc,
SourceLocation LAngleLoc,
ArrayRef Params,
-   

Re: [PATCH] D19815: Support '#pragma once' in headers when using PCH

2016-05-02 Thread Reid Kleckner via cfe-commits
rnk added a subscriber: rnk.
rnk added a comment.

I think threading this through PP options is reasonable.



Comment at: test/PCH/pragma-once.h:1
@@ +1,2 @@
+#pragma once
+

This should be in test/PCH/Inputs


http://reviews.llvm.org/D19815



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


[clang-tools-extra] r268264 - [clang-tidy] Cleaning namespaces to be more consistant across checkers.

2016-05-02 Thread Etienne Bergeron via cfe-commits
Author: etienneb
Date: Mon May  2 13:00:29 2016
New Revision: 268264

URL: http://llvm.org/viewvc/llvm-project?rev=268264&view=rev
Log:
[clang-tidy] Cleaning namespaces to be more consistant across checkers.

Summary:
The goal of the patch is to bring checkers in their appropriate namespace.
This path doesn't change any behavior.

Reviewers: alexfh

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.h

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h
clang-tools-extra/trunk/clang-tidy/misc/AssertSideEffectCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/AssertSideEffectCheck.h

clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.cpp
clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.h
clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.h
clang-tools-extra/trunk/clang-tidy/misc/NewDeleteOverloadsCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.h
clang-tools-extra/trunk/clang-tidy/misc/NonCopyableObjects.cpp
clang-tools-extra/trunk/clang-tidy/misc/NonCopyableObjects.h
clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.h
clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.h
clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.h

clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.h
clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp
clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.h
clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.h
clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.h
clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp
clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp
clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.h

clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp

clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h

Modified: clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-

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

2016-05-02 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast marked 2 inline comments as done.
hubert.reinterpretcast added a comment.

@rsmith; I've addressed Faisal's comment. Please let me know if this patch (and 
http://reviews.llvm.org/D19770) is good to go. If it isn't ready yet, I'd like 
your opinion on http://reviews.llvm.org/D19770+http://reviews.llvm.org/D19771.


http://reviews.llvm.org/D19322



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


Re: [PATCH] D19802: Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class that initializes itself as a base

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

LGTM with a commenting request.



Comment at: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp:342
@@ +341,3 @@
+
+template 
+class PositiveSelfInitialization : NegativeAggregateType

hokein wrote:
> aaron.ballman wrote:
> > Is it required to be a templated class to trigger the crash?
> Yes, it's required.
Then some comments in this test would be good, I would assume otherwise from 
just looking at the test.


http://reviews.llvm.org/D19802



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


Re: [PATCH] D19567: PR21823: 'nodebug' attribute on global/static variables

2016-05-02 Thread David Blaikie via cfe-commits
dblaikie added a comment.

In http://reviews.llvm.org/D19567#414906, @probinson wrote:

> Huh.  There are strange interactions here, which makes me even more nervous 
> about testing fewer cases.


Generally this sort of thing makes me more interested in testing fewer cases so 
we can see/make sure they're properly covering, as you just did by the sounds 
of it. It's hard to see if everything's really covered if there's lots of 
redundant coverage that adds noise to the test case.

> As it happens, the test as written did not exercise all 3 modified paths. 
> Because 'struct S2' had all its members marked with nodebug, none of the 
> static-member references caused debug info for the class as a whole to be 
> attempted.


Not sure I quite follow. Even without nodebug:

  struct foo { static const int x = 3; int y; };
  int i = foo::x;

doesn't produce any debug info for 'foo', x, etc. Just for 'i'.

>   I needed to add a variable of type S2 (without 'nodebug') in order to 
> exercise that path.  Once that was done, then the modification to 
> CollectRecordFields became necessary.

> Even in an unmodified compiler, "static_const_member" never 
> shows up as a DIGlobalVariable, although the other cases all do.  So, testing 
> only for DIGlobalVariable wouldn't be sufficient to show that it gets 
> suppressed by 'nodebug'.


Have you tested cases where the static member is ODR used and/or defined:

  struct foo { static const int x = 3; };
  const int foo::x; // defined
  void sink(void*);
  void use() { sink(&foo::x); } // ODR used

I'm guessing that the out of line definition will create the DIGlobalVariable 
you're not seeing. But probably through a common codepath you've already 
corrected for.

The ODR use probably doesn't cause anything interesting to happen.

>   "static_member" shows up unless we have modified both 
> EmitGlobalVariable(VarDecl case) and CollectRecordFields, given that the test 
> actually tries to emit debug info for S2 as a whole.


I would imagine this could still boil down to: check-not DIGlobalVariable, 
check-not DIFlagStaticMember ?

But once the test is smaller/more targeted, checking the extra details of the 
member list of a composite type, etc, seems OK.

> So, the genuinely most-minimal did-this-change-do-anything test would need 
> only "static_member" and "const_global_int_def" to show that each path had 
> some effect.  This approach does not fill me with warm fuzzies, or the 
> feeling that future changes in this area will not break the intended 
> behavior.  What do you think?

> --paulr



Repository:
  rL LLVM

http://reviews.llvm.org/D19567



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


[PATCH] D19819: [clang-tidy] Cleanup namespace in utils folder.

2016-05-02 Thread Etienne Bergeron via cfe-commits
etienneb created this revision.
etienneb added a reviewer: alexfh.
etienneb added a subscriber: cfe-commits.

This is a step forward cleaning up the namespaces in clang-tidy/utils.
There is no behavior change.

http://reviews.llvm.org/D19819

Files:
  clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
  clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  clang-tidy/llvm/HeaderGuardCheck.h
  clang-tidy/misc/MoveConstructorInitCheck.cpp
  clang-tidy/misc/MoveConstructorInitCheck.h
  clang-tidy/misc/SuspiciousSemicolonCheck.cpp
  clang-tidy/modernize/PassByValueCheck.cpp
  clang-tidy/modernize/PassByValueCheck.h
  clang-tidy/modernize/ReplaceAutoPtrCheck.cpp
  clang-tidy/modernize/ReplaceAutoPtrCheck.h
  clang-tidy/performance/ForRangeCopyCheck.cpp
  clang-tidy/performance/UnnecessaryCopyInitialization.cpp
  clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  clang-tidy/utils/DeclRefExprUtils.cpp
  clang-tidy/utils/DeclRefExprUtils.h
  clang-tidy/utils/FixItHintUtils.cpp
  clang-tidy/utils/FixItHintUtils.h
  clang-tidy/utils/HeaderGuard.cpp
  clang-tidy/utils/HeaderGuard.h
  clang-tidy/utils/IncludeInserter.cpp
  clang-tidy/utils/IncludeInserter.h
  clang-tidy/utils/IncludeSorter.cpp
  clang-tidy/utils/IncludeSorter.h
  clang-tidy/utils/LexerUtils.cpp
  clang-tidy/utils/LexerUtils.h

Index: clang-tidy/utils/LexerUtils.h
===
--- clang-tidy/utils/LexerUtils.h
+++ clang-tidy/utils/LexerUtils.h
@@ -15,14 +15,16 @@
 
 namespace clang {
 namespace tidy {
-namespace lexer_utils {
+namespace utils {
+namespace lexer {
 
 // Returns previous non-comment token skipping over any comment text or
 // tok::unknown if not found.
 Token getPreviousNonCommentToken(const ASTContext &Context,
  SourceLocation Location);
 
-} // namespace lexer_utils
+} // namespace lexer
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 
Index: clang-tidy/utils/LexerUtils.cpp
===
--- clang-tidy/utils/LexerUtils.cpp
+++ clang-tidy/utils/LexerUtils.cpp
@@ -11,7 +11,8 @@
 
 namespace clang {
 namespace tidy {
-namespace lexer_utils {
+namespace utils {
+namespace lexer {
 
 Token getPreviousNonCommentToken(const ASTContext &Context,
  SourceLocation Location) {
@@ -34,6 +35,7 @@
   return Token;
 }
 
-} // namespace lexer_utils
+} // namespace lexer
+} // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/utils/IncludeSorter.h
===
--- clang-tidy/utils/IncludeSorter.h
+++ clang-tidy/utils/IncludeSorter.h
@@ -15,6 +15,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {  
 
 // Class used by IncludeSorterCallback and IncludeInserterCallback to record the
 // names of the inclusions in a given source file being processed and generate
@@ -83,6 +84,7 @@
   SmallVector IncludeBucket[IK_InvalidInclude];
 };
 
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDESORTER_H
Index: clang-tidy/utils/IncludeSorter.cpp
===
--- clang-tidy/utils/IncludeSorter.cpp
+++ clang-tidy/utils/IncludeSorter.cpp
@@ -12,6 +12,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {  
 
 namespace {
 
@@ -291,5 +292,6 @@
   return Style == IS_LLVM ? "llvm" : "google";
 }
 
+} // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/utils/IncludeInserter.h
===
--- clang-tidy/utils/IncludeInserter.h
+++ clang-tidy/utils/IncludeInserter.h
@@ -20,6 +20,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 
 // IncludeInserter can be used by ClangTidyChecks in the following fashion:
 // class MyCheck : public ClangTidyCheck {
@@ -70,6 +71,7 @@
   friend class IncludeInserterCallback;
 };
 
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDEINSERTER_H
Index: clang-tidy/utils/IncludeInserter.cpp
===
--- clang-tidy/utils/IncludeInserter.cpp
+++ clang-tidy/utils/IncludeInserter.cpp
@@ -12,6 +12,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 
 class IncludeInserterCallback : public PPCallbacks {
 public:
@@ -80,5 +81,6 @@
   end_location);
 }
 
+} // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/utils/HeaderGuard.h
===
--- clang-tidy/utils/HeaderGuard.h
+++ clang-tidy/utils/HeaderGuard.h
@@ -14,6 +14,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 
 /// Finds and fixes header 

Re: [PATCH] D19754: Allow 'nodebug' on local variables

2016-05-02 Thread David Blaikie via cfe-commits
dblaikie added inline comments.


Comment at: test/CodeGenCXX/debug-info-nodebug.cpp:50
@@ -49,1 +49,3 @@
   NODEBUG static int static_local = 6;
+  NODEBUG const  int const_local = 7;
+  NODEBUGint normal_local = 8;

Doesn't look like the const case is any different from the non-const case, is 
it?


Comment at: test/CodeGenObjC/debug-info-nodebug.m:17
@@ +16,3 @@
+  // CHECK-NOT: !DILocalVariable(name: "strongSelf"
+  __attribute__((nodebug)) __typeof(self) weakSelf = self;
+  Block = [^{

Is this case outside of the block interesting in some way? It doesn't look like 
it.


http://reviews.llvm.org/D19754



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


Re: [PATCH] D19819: [clang-tidy] Cleanup namespace in utils folder.

2016-05-02 Thread Etienne Bergeron via cfe-commits
etienneb updated this revision to Diff 55858.
etienneb added a comment.

add missing case


http://reviews.llvm.org/D19819

Files:
  clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
  clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  clang-tidy/llvm/HeaderGuardCheck.h
  clang-tidy/misc/MoveConstructorInitCheck.cpp
  clang-tidy/misc/MoveConstructorInitCheck.h
  clang-tidy/misc/SuspiciousSemicolonCheck.cpp
  clang-tidy/modernize/PassByValueCheck.cpp
  clang-tidy/modernize/PassByValueCheck.h
  clang-tidy/modernize/ReplaceAutoPtrCheck.cpp
  clang-tidy/modernize/ReplaceAutoPtrCheck.h
  clang-tidy/performance/ForRangeCopyCheck.cpp
  clang-tidy/performance/UnnecessaryCopyInitialization.cpp
  clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  clang-tidy/utils/DeclRefExprUtils.cpp
  clang-tidy/utils/DeclRefExprUtils.h
  clang-tidy/utils/FixItHintUtils.cpp
  clang-tidy/utils/FixItHintUtils.h
  clang-tidy/utils/HeaderGuard.cpp
  clang-tidy/utils/HeaderGuard.h
  clang-tidy/utils/IncludeInserter.cpp
  clang-tidy/utils/IncludeInserter.h
  clang-tidy/utils/IncludeSorter.cpp
  clang-tidy/utils/IncludeSorter.h
  clang-tidy/utils/LexerUtils.cpp
  clang-tidy/utils/LexerUtils.h
  clang-tidy/utils/Matchers.h
  clang-tidy/utils/TypeTraits.cpp
  clang-tidy/utils/TypeTraits.h

Index: clang-tidy/utils/TypeTraits.h
===
--- clang-tidy/utils/TypeTraits.h
+++ clang-tidy/utils/TypeTraits.h
@@ -15,6 +15,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 namespace type_traits {
 
 // \brief Returns true If \c Type is expensive to copy.
@@ -28,6 +29,7 @@
const ASTContext &Context);
 
 } // type_traits
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 
Index: clang-tidy/utils/TypeTraits.cpp
===
--- clang-tidy/utils/TypeTraits.cpp
+++ clang-tidy/utils/TypeTraits.cpp
@@ -13,6 +13,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 namespace type_traits {
 
 namespace {
@@ -106,6 +107,7 @@
   return false;
 }
 
-} // type_traits
+} // namespace type_traits
+} // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/utils/Matchers.h
===
--- clang-tidy/utils/Matchers.h
+++ clang-tidy/utils/Matchers.h
@@ -31,12 +31,12 @@
 
 AST_MATCHER(QualType, isExpensiveToCopy) {
   llvm::Optional IsExpensive =
-  type_traits::isExpensiveToCopy(Node, Finder->getASTContext());
+  utils::type_traits::isExpensiveToCopy(Node, Finder->getASTContext());
   return IsExpensive && *IsExpensive;
 }
 
 AST_MATCHER(RecordDecl, isTriviallyDefaultConstructible) {
-  return type_traits::recordIsTriviallyDefaultConstructible(
+  return utils::type_traits::recordIsTriviallyDefaultConstructible(
   Node, Finder->getASTContext());
 }
 
Index: clang-tidy/utils/LexerUtils.h
===
--- clang-tidy/utils/LexerUtils.h
+++ clang-tidy/utils/LexerUtils.h
@@ -15,14 +15,16 @@
 
 namespace clang {
 namespace tidy {
-namespace lexer_utils {
+namespace utils {
+namespace lexer {
 
 // Returns previous non-comment token skipping over any comment text or
 // tok::unknown if not found.
 Token getPreviousNonCommentToken(const ASTContext &Context,
  SourceLocation Location);
 
-} // namespace lexer_utils
+} // namespace lexer
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 
Index: clang-tidy/utils/LexerUtils.cpp
===
--- clang-tidy/utils/LexerUtils.cpp
+++ clang-tidy/utils/LexerUtils.cpp
@@ -11,7 +11,8 @@
 
 namespace clang {
 namespace tidy {
-namespace lexer_utils {
+namespace utils {
+namespace lexer {
 
 Token getPreviousNonCommentToken(const ASTContext &Context,
  SourceLocation Location) {
@@ -34,6 +35,7 @@
   return Token;
 }
 
-} // namespace lexer_utils
+} // namespace lexer
+} // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/utils/IncludeSorter.h
===
--- clang-tidy/utils/IncludeSorter.h
+++ clang-tidy/utils/IncludeSorter.h
@@ -15,6 +15,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {  
 
 // Class used by IncludeSorterCallback and IncludeInserterCallback to record the
 // names of the inclusions in a given source file being processed and generate
@@ -83,6 +84,7 @@
   SmallVector IncludeBucket[IK_InvalidInclude];
 };
 
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDESORTER_H
Index: clang-tidy/utils/IncludeSorter.cpp
===
--- clang-tidy/utils/Include

Re: [PATCH] D19758: [libcxx] [test] Replace non-Standard "atomic_flag f(false); " with Standard "atomic_flag f = ATOMIC_FLAG_INIT; ".

2016-05-02 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

This is a small problem. We actually provide  in C++03 minus 
`ATOMIC_FLAG_INIT` since it requires C++11.
I'll come up with a way to fix these tests so they keep working in C++03.


http://reviews.llvm.org/D19758



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


Re: [PATCH] D18919: [Clang-tidy] Add check "modernize use using"

2016-05-02 Thread Krystyna via cfe-commits
krystyna marked 8 inline comments as done.
krystyna added a comment.

Repository:
  rL LLVM

http://reviews.llvm.org/D18919



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


[libcxx] r268284 - Void cast runtime-unused variables. Patch from s...@microsoft.com

2016-05-02 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon May  2 14:15:48 2016
New Revision: 268284

URL: http://llvm.org/viewvc/llvm-project?rev=268284&view=rev
Log:
Void cast runtime-unused variables. Patch from s...@microsoft.com

Modified:
libcxx/trunk/test/std/depr/depr.c.headers/setjmp_h.pass.cpp
libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp
libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp

libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp

libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/bidirectional_iterator_tag.pass.cpp

libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/forward_iterator_tag.pass.cpp

libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/input_iterator_tag.pass.cpp

libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/output_iterator_tag.pass.cpp

libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/random_access_iterator_tag.pass.cpp

libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp

libcxx/trunk/test/std/language.support/support.exception/propagation/current_exception.pass.cpp
libcxx/trunk/test/std/language.support/support.runtime/csetjmp.pass.cpp
libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp
libcxx/trunk/test/std/localization/c.locales/clocale.pass.cpp

libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
libcxx/trunk/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp
libcxx/trunk/test/std/numerics/rand/rand.device/eval.pass.cpp
libcxx/trunk/test/std/re/re.alg/re.alg.search/grep.pass.cpp
libcxx/trunk/test/std/strings/c.strings/cwchar.pass.cpp

libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp

libcxx/trunk/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp
libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp
libcxx/trunk/test/std/utilities/utility/forward/forward.pass.cpp

Modified: libcxx/trunk/test/std/depr/depr.c.headers/setjmp_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/setjmp_h.pass.cpp?rev=268284&r1=268283&r2=268284&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/setjmp_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/setjmp_h.pass.cpp Mon May  2 
14:15:48 2016
@@ -19,6 +19,7 @@
 int main()
 {
 jmp_buf jb;
+((void)jb); // Prevent unused warning
 static_assert((std::is_same::value),
   "std::is_same::value");
 }

Modified: libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp?rev=268284&r1=268283&r2=268284&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp Mon May  2 
14:15:48 2016
@@ -108,10 +108,16 @@ int main()
 {
 FILE* fp = 0;
 fpos_t fpos = {0};
-size_t s = 0; ((void)s);
+size_t s = 0;
 char* cp = 0;
 char arr[] = {'a', 'b'};
 va_list va;
+((void)fp); // Prevent unused warning
+((void)fpos); // Prevent unused warning
+((void)s); // Prevent unused warning
+((void)cp); // Prevent unused warning
+((void)arr); // Prevent unused warning
+((void)va); // Prevent unused warning
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");

Modified: 
libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp?rev=268284&r1=268283&r2=268284&view=diff
==
--- libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp 
(original)
+++ libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp Mon 
May  2 14:15:48 2016
@@ -91,6 +91,11 @@ int main()
 std::size_t s = 0;
 char* cp = 0;
 std::va_list va;
+((void)fp); // Prevent unused warning
+((void)fpos); // Prevent unused warning
+((void)s); // Prevent unused warning
+((void)cp); // Prevent unused warning
+((void)va); // Prevent unused warning
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), 
"");

Modified: 
libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic

Re: [PATCH] D19625: [libc++] Void-cast runtime-unused variables.

2016-05-02 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r268284.

In http://reviews.llvm.org/D19625#418697, @STL_MSFT wrote:

> No problem! With these changes, my test runs are currently clean wrt "warning 
> C4100: unreferenced formal parameter" and "warning C4101: unreferenced local 
> variable", but note that (1) Clang may emit unused-variable warnings in 
> somewhat different situations, and (2) I've still got 25% of the tests 
> failing to compile, which may be hiding further warnings.


I'm hoping Clang is pretty similar. I guess we will see. I'm going to hold off 
setting up a bot for a while still.


http://reviews.llvm.org/D19625



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


Re: [PATCH] D19623: [libcxx] [test] Initialize local doubles to NaN.

2016-05-02 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

I have no objections to this change. Howard seems to agree.


http://reviews.llvm.org/D19623



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


Re: [PATCH] D19758: [libcxx] [test] Replace non-Standard "atomic_flag f(false); " with Standard "atomic_flag f = ATOMIC_FLAG_INIT; ".

2016-05-02 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT added a comment.

Since you control the definition of ATOMIC_FLAG_INIT, can you make it something 
like __secret_tag_type() in C++03?  That would allow you to continue to provide 
the atomic_flag(bool) extension in C++03.


http://reviews.llvm.org/D19758



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


[libcxx] r268285 - Initialize local doubles to NaN. Patch from s...@microsoft.com

2016-05-02 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon May  2 14:20:16 2016
New Revision: 268285

URL: http://llvm.org/viewvc/llvm-project?rev=268285&view=rev
Log:
Initialize local doubles to NaN. Patch from s...@microsoft.com

Modified:

libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp

libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp

Modified: 
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp?rev=268285&r1=268284&r2=268285&view=diff
==
--- 
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
 Mon May  2 14:20:16 2016
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 template 
 inline
@@ -60,10 +61,10 @@ int main()
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = std::numeric_limits::quiet_NaN();
+double m = std::numeric_limits::quiet_NaN();
+double bk = std::numeric_limits::quiet_NaN();
+double c = std::numeric_limits::quiet_NaN();
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
@@ -110,10 +111,10 @@ int main()
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = std::numeric_limits::quiet_NaN();
+double m = std::numeric_limits::quiet_NaN();
+double bk = std::numeric_limits::quiet_NaN();
+double c = std::numeric_limits::quiet_NaN();
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
@@ -160,10 +161,10 @@ int main()
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = std::numeric_limits::quiet_NaN();
+double m = std::numeric_limits::quiet_NaN();
+double bk = std::numeric_limits::quiet_NaN();
+double c = std::numeric_limits::quiet_NaN();
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
@@ -210,10 +211,10 @@ int main()
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = std::numeric_limits::quiet_NaN();
+double m = std::numeric_limits::quiet_NaN();
+double bk = std::numeric_limits::quiet_NaN();
+double c = std::numeric_limits::quiet_NaN();
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
@@ -260,10 +261,10 @@ int main()
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = std::numeric_limits::quiet_NaN();
+double m = std::numeric_limits::quiet_NaN();
+double bk = std::numeric_limits::quiet_NaN();
+double c = std::numeric_limits::quiet_NaN();
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
@@ -310,10 +311,10 @@ int main()
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = std::numeric_limits::quiet_NaN();
+double m = std::numeric_limits::quiet_NaN();
+double bk = std::numeric_limits::quiet_NaN();
+double c = std::numeric_limits::quiet_NaN();
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)

Modified: 
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp?rev=268285&r1=268284&r2=268285&view=diff
==
--- 
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
 Mon May  2 14:20:16 2016
@@ -22,6 +22,7 @@
 #include 
 #include// for sort
 #include 
+#include 
 
 template 
 inline
@@ -59,10 +60,10 @@ int main()
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;

Re: [PATCH] D19623: [libcxx] [test] Initialize local doubles to NaN.

2016-05-02 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r268285.


http://reviews.llvm.org/D19623



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


Re: [PATCH] D19758: [libcxx] [test] Replace non-Standard "atomic_flag f(false); " with Standard "atomic_flag f = ATOMIC_FLAG_INIT; ".

2016-05-02 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

I actually want this form of initialization to break in C++03, From the 
original review:

> After putting this question up on cfe-dev I have decided that it would be 
> best to allow the use of  in C++03. Although static initialization is 
> a concern the syntax required to get it is C++11 only. Meaning that C++11 
> constant static initialization cannot silently break in C++03, it will always 
> cause a syntax error. Furthermore ATOMIC_VAR_INIT and ATOMIC_FLAG_INIT remain 
> defined in C++03 even though they cannot be used because C++03 usages will 
> cause better error messages.


I think I'll just hack up these tests, or make them require C++11 or greater 
and add C++03 specific tests elsewhere.


http://reviews.llvm.org/D19758



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


Re: [PATCH] D19758: [libcxx] [test] Replace non-Standard "atomic_flag f(false); " with Standard "atomic_flag f = ATOMIC_FLAG_INIT; ".

2016-05-02 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT added a comment.

Makes sense. MSVC will never have C++03 or C++11 modes (only 14/17/future) so 
anything you do in C++03 mode is fine by me.


http://reviews.llvm.org/D19758



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


Re: [PATCH] D18919: [Clang-tidy] Add check "modernize use using"

2016-05-02 Thread Krystyna via cfe-commits
krystyna added a comment.

hide done comments


Repository:
  rL LLVM

http://reviews.llvm.org/D18919



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


Re: [PATCH] D18919: [Clang-tidy] Add check "modernize use using"

2016-05-02 Thread Krystyna via cfe-commits
krystyna updated this revision to Diff 55867.

Repository:
  rL LLVM

http://reviews.llvm.org/D18919

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseUsingCheck.cpp
  clang-tidy/modernize/UseUsingCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-using.rst
  test/clang-tidy/modernize-use-using.cpp

Index: test/clang-tidy/modernize-use-using.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-using.cpp
@@ -0,0 +1,79 @@
+// RUN: %check_clang_tidy %s modernize-use-using %t
+
+typedef int Type;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef [modernize-use-using]
+// CHECK-FIXES: using Type = int;
+
+typedef long LL;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef
+// CHECK-FIXES: using LL = long;
+
+typedef int Bla;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef
+// CHECK-FIXES: using Bla = int;
+
+typedef Bla Bla2;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef
+// CHECK-FIXES: using Bla2 = Bla;
+
+typedef void (*type)(int);
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef
+// CHECK-FIXES: using type = void (*)(int);
+
+typedef void (*type2)();
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef
+// CHECK-FIXES: using type2 = void (*)();
+
+class Class {
+typedef long long Type;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use using instead of typedef
+	// CHECK-FIXES: using Type = long long;
+};
+
+typedef void (Class::* MyPtrType)(Bla) const;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef
+// CHECK-FIXES: using MyPtrType = void (Class::*)(Bla) const;
+
+class Iterable {
+public:
+	class Iterator {};
+};
+
+template
+class Test {
+typedef typename T::iterator Iter;
+	// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use using instead of typedef
+	// CHECK-FIXES: using Iter = typename T::iterator;
+};
+
+using balba = long long;
+
+union A {};
+
+typedef void (A::*PtrType)(int, int) const;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef
+// CHECK-FIXES: using PtrType = void (A::*)(int, int) const;
+
+typedef Class some_class;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef
+// CHECK-FIXES: using some_class = Class;
+
+typedef Class Cclass;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef
+// CHECK-FIXES: using Cclass = Class;
+
+typedef Cclass cclass2;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef
+// CHECK-FIXES: using cclass2 = Cclass;
+
+class cclass {};
+
+typedef void (cclass::* MyPtrType3)(Bla);
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef
+// CHECK-FIXES: using MyPtrType3 = void (cclass::*)(Bla);
+
+using my_class = int;
+
+typedef Test another;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use using instead of typedef
+// CHECK-FIXES: using another = Test;
Index: docs/clang-tidy/checks/modernize-use-using.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-use-using.rst
@@ -0,0 +1,24 @@
+.. title:: clang-tidy - modernize-use-using
+
+modernize-use-using
+===
+
+Use C++11's ``using`` instead of ``typedef``.
+
+Before:
+
+.. code:: c++
+
+  typedef int variable;
+
+  class Class{};
+  typedef void (Class::* MyPtrType)() const;
+
+After:
+
+.. code:: c++
+
+  using varible = int;
+
+  class Class{};
+  using MyPtrType = void (Class::*)() const;
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -96,6 +96,7 @@
modernize-use-default
modernize-use-nullptr
modernize-use-override
+   modernize-use-using
performance-faster-string-find
performance-for-range-copy
performance-implicit-cast-in-loop
Index: clang-tidy/modernize/UseUsingCheck.h
===
--- /dev/null
+++ clang-tidy/modernize/UseUsingCheck.h
@@ -0,0 +1,35 @@
+//===--- UseUsingCheck.h - clang-tidy*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_USING_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_USING_H
+
+#include "../ClangTidy.h"
+
+namespace clang {
+namespace tidy {
+namespace modernize {
+
+/// Check finds typedefs and replaces it with usings.
+///
+/// For the user-facing documentation see:
+/// http://clang.llvm.org/extra/clang-tidy/checks/mode

Re: [PATCH] D18919: [Clang-tidy] Add check "modernize use using"

2016-05-02 Thread Krystyna via cfe-commits
krystyna marked 4 inline comments as done.
krystyna added a comment.

Repository:
  rL LLVM

http://reviews.llvm.org/D18919



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


Re: [PATCH] D19819: [clang-tidy] Cleanup namespace in utils folder.

2016-05-02 Thread Etienne Bergeron via cfe-commits
etienneb updated this revision to Diff 55876.
etienneb added a comment.

fix unittests


http://reviews.llvm.org/D19819

Files:
  clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
  clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  clang-tidy/llvm/HeaderGuardCheck.h
  clang-tidy/misc/MoveConstructorInitCheck.cpp
  clang-tidy/misc/MoveConstructorInitCheck.h
  clang-tidy/misc/SuspiciousSemicolonCheck.cpp
  clang-tidy/modernize/PassByValueCheck.cpp
  clang-tidy/modernize/PassByValueCheck.h
  clang-tidy/modernize/ReplaceAutoPtrCheck.cpp
  clang-tidy/modernize/ReplaceAutoPtrCheck.h
  clang-tidy/performance/ForRangeCopyCheck.cpp
  clang-tidy/performance/UnnecessaryCopyInitialization.cpp
  clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  clang-tidy/utils/DeclRefExprUtils.cpp
  clang-tidy/utils/DeclRefExprUtils.h
  clang-tidy/utils/FixItHintUtils.cpp
  clang-tidy/utils/FixItHintUtils.h
  clang-tidy/utils/HeaderGuard.cpp
  clang-tidy/utils/HeaderGuard.h
  clang-tidy/utils/IncludeInserter.cpp
  clang-tidy/utils/IncludeInserter.h
  clang-tidy/utils/IncludeSorter.cpp
  clang-tidy/utils/IncludeSorter.h
  clang-tidy/utils/LexerUtils.cpp
  clang-tidy/utils/LexerUtils.h
  clang-tidy/utils/Matchers.h
  clang-tidy/utils/TypeTraits.cpp
  clang-tidy/utils/TypeTraits.h
  unittests/clang-tidy/IncludeInserterTest.cpp

Index: unittests/clang-tidy/IncludeInserterTest.cpp
===
--- unittests/clang-tidy/IncludeInserterTest.cpp
+++ unittests/clang-tidy/IncludeInserterTest.cpp
@@ -33,9 +33,10 @@
   : ClangTidyCheck(CheckName, Context) {}
 
   void registerPPCallbacks(CompilerInstance &Compiler) override {
-Inserter.reset(new IncludeInserter(Compiler.getSourceManager(),
-   Compiler.getLangOpts(),
-   IncludeSorter::IS_Google));
+Inserter.reset(new utils::IncludeInserter(
+Compiler.getSourceManager(),
+Compiler.getLangOpts(),
+utils::IncludeSorter::IS_Google));
 Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
   }
 
@@ -58,7 +59,7 @@
   virtual std::vector HeadersToInclude() const = 0;
   virtual bool IsAngledInclude() const = 0;
 
-  std::unique_ptr Inserter;
+  std::unique_ptr Inserter;
 };
 
 class NonSystemHeaderInserterCheck : public IncludeInserterCheckBase {
Index: clang-tidy/utils/TypeTraits.h
===
--- clang-tidy/utils/TypeTraits.h
+++ clang-tidy/utils/TypeTraits.h
@@ -15,6 +15,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 namespace type_traits {
 
 // \brief Returns true If \c Type is expensive to copy.
@@ -28,6 +29,7 @@
const ASTContext &Context);
 
 } // type_traits
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 
Index: clang-tidy/utils/TypeTraits.cpp
===
--- clang-tidy/utils/TypeTraits.cpp
+++ clang-tidy/utils/TypeTraits.cpp
@@ -13,6 +13,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 namespace type_traits {
 
 namespace {
@@ -106,6 +107,7 @@
   return false;
 }
 
-} // type_traits
+} // namespace type_traits
+} // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/utils/Matchers.h
===
--- clang-tidy/utils/Matchers.h
+++ clang-tidy/utils/Matchers.h
@@ -31,12 +31,12 @@
 
 AST_MATCHER(QualType, isExpensiveToCopy) {
   llvm::Optional IsExpensive =
-  type_traits::isExpensiveToCopy(Node, Finder->getASTContext());
+  utils::type_traits::isExpensiveToCopy(Node, Finder->getASTContext());
   return IsExpensive && *IsExpensive;
 }
 
 AST_MATCHER(RecordDecl, isTriviallyDefaultConstructible) {
-  return type_traits::recordIsTriviallyDefaultConstructible(
+  return utils::type_traits::recordIsTriviallyDefaultConstructible(
   Node, Finder->getASTContext());
 }
 
Index: clang-tidy/utils/LexerUtils.h
===
--- clang-tidy/utils/LexerUtils.h
+++ clang-tidy/utils/LexerUtils.h
@@ -15,14 +15,16 @@
 
 namespace clang {
 namespace tidy {
-namespace lexer_utils {
+namespace utils {
+namespace lexer {
 
 // Returns previous non-comment token skipping over any comment text or
 // tok::unknown if not found.
 Token getPreviousNonCommentToken(const ASTContext &Context,
  SourceLocation Location);
 
-} // namespace lexer_utils
+} // namespace lexer
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 
Index: clang-tidy/utils/LexerUtils.cpp
===
--- clang-tidy/utils/LexerUtils.cpp
+++ clang-tidy/utils/LexerUtils.cpp
@@ -11,7 +11,8 @@
 
 namespace clang {
 namespace tidy {
-n

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

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


Comment at: lib/Headers/opencl-c.h:4872
@@ +4871,3 @@
+
+#ifdef cl_khr_fp64
+char __const_func __attribute__((overloadable)) convert_char(double);

Anastasia wrote:
> Interesting, macro has the same name as an extension?
The spec requires a macro to be defined with the same name as the supported 
extension, so it is natural to use it here.


Comment at: lib/Headers/opencl-c.h:14056
@@ +14055,3 @@
+#ifdef _CL20_AND_ABOVE
+#define ATOMIC_VAR_INIT(x) (x)
+

Anastasia wrote:
> I am not sure this implementation of macro is generic enough!
This macro is for initializing global variables with atomic type. In SPIR it is 
represented as usual initializer the same way as a non-atomic type. OpenCL 
runtime initializes it the same way as a non-atomic type before kernel 
execution. I don't think there is need to define this macro another way.


http://reviews.llvm.org/D18369



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


[libcxx] r268294 - Cleanup warnings and remove use of __builtin_va_list in depr.c.headers

2016-05-02 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon May  2 15:08:16 2016
New Revision: 268294

URL: http://llvm.org/viewvc/llvm-project?rev=268294&view=rev
Log:
Cleanup warnings and remove use of __builtin_va_list in depr.c.headers

Modified:
libcxx/trunk/test/std/depr/depr.c.headers/fenv_h.pass.cpp
libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp
libcxx/trunk/test/std/depr/depr.c.headers/time_h.pass.cpp
libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp

Modified: libcxx/trunk/test/std/depr/depr.c.headers/fenv_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/fenv_h.pass.cpp?rev=268294&r1=268293&r2=268294&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/fenv_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/fenv_h.pass.cpp Mon May  2 
15:08:16 2016
@@ -60,7 +60,7 @@
 
 int main()
 {
-fenv_t fenv = {0};
+fenv_t fenv = {};
 fexcept_t fex = 0;
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");

Modified: libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp?rev=268294&r1=268293&r2=268294&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp Mon May  2 
15:08:16 2016
@@ -917,7 +917,7 @@ int main()
 uintmax_t i4 = 0;
 }
 {
-imaxdiv_t  i1 = {0};
+imaxdiv_t  i1 = {};
 }
 intmax_t i = 0;
 static_assert((std::is_same::value), "");

Modified: libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp?rev=268294&r1=268293&r2=268294&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp Mon May  2 
15:08:16 2016
@@ -107,7 +107,7 @@
 int main()
 {
 FILE* fp = 0;
-fpos_t fpos = {0};
+fpos_t fpos = {};
 size_t s = 0;
 char* cp = 0;
 char arr[] = {'a', 'b'};

Modified: libcxx/trunk/test/std/depr/depr.c.headers/time_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/time_h.pass.cpp?rev=268294&r1=268293&r2=268294&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/time_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/time_h.pass.cpp Mon May  2 
15:08:16 2016
@@ -25,7 +25,7 @@ int main()
 clock_t c = 0; ((void)c);
 size_t s = 0;
 time_t t = 0;
-tm tmv = {0};
+tm tmv = {};
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");

Modified: libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp?rev=268294&r1=268293&r2=268294&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp Mon May  2 
15:08:16 2016
@@ -10,6 +10,7 @@
 // 
 
 #include 
+#include 
 #include 
 
 #ifndef NULL
@@ -31,27 +32,15 @@
 int main()
 {
 // mbstate_t comes from the underlying C library; it is defined (in C99) as:
-//a complete object type other than an array type that can hold the 
conversion 
-//state information necessary to convert between sequences of multibyte 
+//a complete object type other than an array type that can hold the 
conversion
+//state information necessary to convert between sequences of multibyte
 //characters and wide characters
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wmissing-braces"
-#endif
-mbstate_t mb = {0};
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
+mbstate_t mb = {};
 size_t s = 0;
 tm *tm = 0;
 wint_t w = 0;
 ::FILE* fp = 0;
-#ifdef __APPLE__
-__darwin_va_list va;
-#else
-__builtin_va_list va;
-#endif
+::va_list va;
 char* ns = 0;
 wchar_t* ws = 0;
 static_assert((std::is_same::value), "");


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


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

2016-05-02 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.

typo. saved 300KB space.


http://reviews.llvm.org/D18369



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


[PATCH] D19827: Do not disable completely loop unroll according to optimization level.

2016-05-02 Thread Marianne Mailhot-Sarrasin via cfe-commits
mamai created this revision.
mamai added a reviewer: chandlerc.
mamai added a subscriber: cfe-commits.
mamai set the repository for this revision to rL LLVM.

By disabling completely the loop unroll at some optimization levels (e.g. /Os), 
the #pragma unroll have no effect at those optimization levels.

This contradicts the paragraph in an llvm blog post about the loop pragmas 
(http://blog.llvm.org/2014/11/loop-vectorization-diagnostics-and.html) saying 
the following:

> For example, when compiling for size (-Os) it's a good idea to vectorize the 
> hot loops of the application to improve performance. Vectorization, 
> interleaving, and unrolling can be explicitly specified using the #pragma 
> clang loop directive prior to any for, while, do-while, or c++11 range-based 
> for loop.

Also, as explained in a previous commit, the  loop unroll pass already have the 
logic to unroll loop are not according to optimization level 
(http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20130805/085399.html).

Repository:
  rL LLVM

http://reviews.llvm.org/D19827

Files:
  lib/Frontend/CompilerInvocation.cpp

Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -511,9 +511,7 @@
 Args.hasArg(OPT_ffreestanding));
   if (Opts.SimplifyLibCalls)
 getAllNoBuiltinFuncValues(Args, Opts.NoBuiltinFuncs);
-  Opts.UnrollLoops =
-  Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops,
-   (Opts.OptimizationLevel > 1 && !Opts.OptimizeSize));
+  Opts.UnrollLoops = Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops);
   Opts.RerollLoops = Args.hasArg(OPT_freroll_loops);
 
   Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as);


Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -511,9 +511,7 @@
 Args.hasArg(OPT_ffreestanding));
   if (Opts.SimplifyLibCalls)
 getAllNoBuiltinFuncValues(Args, Opts.NoBuiltinFuncs);
-  Opts.UnrollLoops =
-  Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops,
-   (Opts.OptimizationLevel > 1 && !Opts.OptimizeSize));
+  Opts.UnrollLoops = Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops);
   Opts.RerollLoops = Args.hasArg(OPT_freroll_loops);
 
   Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19708: [CGDebugInfo] Generate debug info for member calls in the context of the callee expression

2016-05-02 Thread Hal Finkel via cfe-commits
- Original Message -
> From: "David Blaikie" 
> To: reviews+d19708+public+e9ddc42503732...@reviews.llvm.org, "Hal Finkel" 
> 
> Cc: "Richard Smith" , "Adrian Prantl" 
> , "Duncan P. N. Exon Smith"
> , "Eric Christopher" , "Jun Bum 
> Lim" ,
> "cfe-commits" 
> Sent: Friday, April 29, 2016 4:52:26 PM
> Subject: Re: [PATCH] D19708: [CGDebugInfo] Generate debug info for member 
> calls in the context of the callee
> expression
> 
> 
> You could simplify the test case further, down to just:
> 
> struct foo { void bar(); };
> void f(foo *f) {
> f->bar();
> }
> 
> and check that the call instruction has the desired column (or if you
> want a test that doesn't depend on column info (you can force it on
> with a flag, but we might vary whether it's on by default based on
> target, etc, I'm not sure) you could put 'bar();' on a separate line
> from 'f->' and check the call was on the second line and not the
> first).

Certainly. I'm not sure much we want to reduce the test case, however, because 
I particularly want to cover the case of two calls on the same line with column 
info. Given that this is still pretty simple, I think that covering it directly 
seems reasonable.

> 
> Richard might be able to tell us whether there's a preferred place
> for a test for a change like this - should it be a debug info test,
> a diagnostic test,

At least for the test you suggested in a previous e-mail, this patch has no 
effect on the output diagnostics (although it certainly does have the desired 
effect on the debug info). Specifically, even with this patch, we still have:

  $ cat /tmp/loc.cpp 
  struct foo {
const foo *x() const;
void y();
  };
  
  void f(const foo *g) {
g->x()->y();
g->x()->x()->y();
  }

$ clang /tmp/loc.cpp -fsyntax-only
  /tmp/loc.cpp:7:3: error: member function 'y' not viable: 'this' argument has 
type 'const foo', but function is not marked const
g->x()->y();
^~
  /tmp/loc.cpp:3:8: note: 'y' declared here
void y();
 ^
  /tmp/loc.cpp:8:3: error: member function 'y' not viable: 'this' argument has 
type 'const foo', but function is not marked const
g->x()->x()->y();
^~~
  /tmp/loc.cpp:3:8: note: 'y' declared here
void y();
 ^
  2 errors generated.

Thanks again,
Hal

> or perhaps just an ast dump test?
> 
> Perhaps a test for the case where there is no valid callee would be
> good? Where does that come up - call through a member function
> pointer?
> 
> 
> On Fri, Apr 29, 2016 at 9:19 AM, Hal Finkel via cfe-commits <
> cfe-commits@lists.llvm.org > wrote:
> 
> 
> hfinkel updated this revision to Diff 55610.
> hfinkel added a comment.
> 
> Use David's suggested approach: Modify the preferred expression
> location for member calls. If the callee has a valid location (not
> all do), then use that. Otherwise, fall back to the starting
> location. This seems to cleanly fix the debug-info problem.
> 
> 
> http://reviews.llvm.org/D19708
> 
> Files:
> include/clang/AST/ExprCXX.h
> 
> 
> test/CodeGenCXX/debug-info-member-call.cpp
> 
> Index: test/CodeGenCXX/debug-info-member-call.cpp
> ===
> --- /dev/null
> +++ test/CodeGenCXX/debug-info-member-call.cpp
> @@ -0,0 +1,24 @@
> +// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm
> -debug-info-kind=standalone -dwarf-column-info %s -o - | FileCheck
> %s
> +void ext();
> +
> +struct Bar {
> + void bar() { ext(); }
> +};
> +
> +struct Foo {
> + Bar *b;
> +
> + Bar *foo() { return b; }
> +};
> +
> +void test(Foo *f) {
> + f->foo()->bar();
> +}
> +
> +// CHECK-LABEL: @_Z4testP3Foo
> +// CHECK: call {{.*}} @_ZN3Foo3fooEv{{.*}}, !dbg ![[CALL1LOC:.*]]
> +// CHECK: call void @_ZN3Bar3barEv{{.*}}, !dbg ![[CALL2LOC:.*]]
> +
> +// CHECK: ![[CALL1LOC]] = !DILocation(line: [[LINE:[0-9]+]], column:
> 6,
> +// CHECK: ![[CALL2LOC]] = !DILocation(line: [[LINE]], column: 13,
> +
> Index: include/clang/AST/ExprCXX.h
> ===
> --- include/clang/AST/ExprCXX.h
> +++ include/clang/AST/ExprCXX.h
> @@ -145,6 +145,14 @@
> /// FIXME: Returns 0 for member pointer call exprs.
> CXXRecordDecl *getRecordDecl() const;
> 
> + SourceLocation getExprLoc() const LLVM_READONLY {
> + SourceLocation CLoc = getCallee()->getExprLoc();
> + if (CLoc.isValid())
> + return CLoc;
> +
> + return getLocStart();
> + }
> +
> static bool classof(const Stmt *T) {
> return T->getStmtClass() == CXXMemberCallExprClass;
> }
> 
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 
> 
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r268297 - Revert "[Driver] Quote clang full version in dwarf producer when invoking cc1as"

2016-05-02 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Mon May  2 15:20:49 2016
New Revision: 268297

URL: http://llvm.org/viewvc/llvm-project?rev=268297&view=rev
Log:
Revert "[Driver] Quote clang full version in dwarf producer when invoking cc1as"

This reverts commit r264813 / 6484b95d634f53dd929c75265ef3c4decf397584.

While using it in the shell is fine, this a problem when cc1as is
invoked directly by the driver because single quoting the clang full
version makes cc1as write out the version with the quotes in the final
binary.

If the user wants to copy-n-pastable output, it could use either -###
or CC_PRINT_OPTIONS=1 clang -v ...

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Misc/cc1as-asm.s

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=268297&r1=268296&r2=268297&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon May  2 15:20:49 2016
@@ -6251,8 +6251,7 @@ void ClangAs::ConstructJob(Compilation &
 // Set the AT_producer to the clang version when using the integrated
 // assembler on assembly source files.
 CmdArgs.push_back("-dwarf-debug-producer");
-std::string QuotedClangVersion("'" + getClangFullVersion() + "'");
-CmdArgs.push_back(Args.MakeArgString(QuotedClangVersion));
+CmdArgs.push_back(Args.MakeArgString(getClangFullVersion()));
 
 // And pass along -I options
 Args.AddAllArgs(CmdArgs, options::OPT_I);

Modified: cfe/trunk/test/Misc/cc1as-asm.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/cc1as-asm.s?rev=268297&r1=268296&r2=268297&view=diff
==
--- cfe/trunk/test/Misc/cc1as-asm.s (original)
+++ cfe/trunk/test/Misc/cc1as-asm.s Mon May  2 15:20:49 2016
@@ -1,5 +1,3 @@
 // Run cc1as asm output path just to make sure it works
 // REQUIRES: x86-registered-target
 // RUN: %clang -cc1as -triple x86_64-apple-macosx10.10.0 -filetype asm %s -o 
/dev/null
-// Test that cc1as is able to consume a quoted clang full version
-// RUN: %clang -cc1as -triple x86_64-apple-macosx10.10.0 -dwarf-debug-producer 
'clang dummy version' -filetype asm %s -o /dev/null


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


[PATCH] D19829: [scan-build] fix dead store warnings emitted on clang code base

2016-05-02 Thread Apelete Seketeli via cfe-commits
apelete created this revision.
apelete added reviewers: rjmccall, rtrieu, rsmith.
apelete added a subscriber: cfe-commits.

This fixes dead store warnings of the type "dead assignment" reported
by CLang Static Analyzer on the following files:

- lib/Sema/SemaDeclCXX.cpp,
- lib/Sema/SemaExpr.cpp,
- lib/Sema/SemaLookup.cpp,
- lib/Sema/SemaTemplate.cpp.

Signed-off-by: Apelete Seketeli 

http://reviews.llvm.org/D19829

Files:
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaTemplate.cpp

Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -6243,8 +6243,6 @@
 SourceRange(TemplateParams->getTemplateLoc(),
 TemplateParams->getRAngleLoc()))
 << SourceRange(LAngleLoc, RAngleLoc);
-else
-  isExplicitSpecialization = true;
   } else {
 assert(TUK == TUK_Friend && "should have a 'template<>' for this decl");
   }
Index: lib/Sema/SemaLookup.cpp
===
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -4907,12 +4907,6 @@
  bool NeedDefinition, bool Recover) {
   assert(!isVisible(Decl) && "missing import for non-hidden decl?");
 
-  // Suggest importing a module providing the definition of this entity, if
-  // possible.
-  NamedDecl *Def = getDefinitionToImport(Decl);
-  if (!Def)
-Def = Decl;
-
   // FIXME: Add a Fix-It that imports the corresponding module or includes
   // the header.
   Module *Owner = getOwningModule(Decl);
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -9634,6 +9634,7 @@
   while (true) {
 IsDereference = NextIsDereference;
 NextIsDereference = false;
+(void) NextIsDereference;
 
 E = E->IgnoreParenImpCasts();
 if (const MemberExpr *ME = dyn_cast(E)) {
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -12396,6 +12396,7 @@
   Diag(TemplateParams->getTemplateLoc(), diag::err_template_tag_noparams)
 << TypeWithKeyword::getTagTypeKindName(Kind) << Name;
   isExplicitSpecialization = true;
+  (void) isExplicitSpecialization;
 }
   }
 


Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -6243,8 +6243,6 @@
 SourceRange(TemplateParams->getTemplateLoc(),
 TemplateParams->getRAngleLoc()))
 << SourceRange(LAngleLoc, RAngleLoc);
-else
-  isExplicitSpecialization = true;
   } else {
 assert(TUK == TUK_Friend && "should have a 'template<>' for this decl");
   }
Index: lib/Sema/SemaLookup.cpp
===
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -4907,12 +4907,6 @@
  bool NeedDefinition, bool Recover) {
   assert(!isVisible(Decl) && "missing import for non-hidden decl?");
 
-  // Suggest importing a module providing the definition of this entity, if
-  // possible.
-  NamedDecl *Def = getDefinitionToImport(Decl);
-  if (!Def)
-Def = Decl;
-
   // FIXME: Add a Fix-It that imports the corresponding module or includes
   // the header.
   Module *Owner = getOwningModule(Decl);
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -9634,6 +9634,7 @@
   while (true) {
 IsDereference = NextIsDereference;
 NextIsDereference = false;
+(void) NextIsDereference;
 
 E = E->IgnoreParenImpCasts();
 if (const MemberExpr *ME = dyn_cast(E)) {
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -12396,6 +12396,7 @@
   Diag(TemplateParams->getTemplateLoc(), diag::err_template_tag_noparams)
 << TypeWithKeyword::getTagTypeKindName(Kind) << Name;
   isExplicitSpecialization = true;
+  (void) isExplicitSpecialization;
 }
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D19830: [scan-build] fix dead store warnings emitted on clang code base

2016-05-02 Thread Apelete Seketeli via cfe-commits
apelete created this revision.
apelete added a reviewer: doug.gregor.
apelete added a subscriber: cfe-commits.

This fixes dead store warnings of the type "dead assignment" reported
by CLang Static Analyzer on the following files:

- lib/Lex/Lexer.cpp,
- lib/Lex/ModuleMap.cpp.

Signed-off-by: Apelete Seketeli 

http://reviews.llvm.org/D19830

Files:
  lib/Lex/Lexer.cpp
  lib/Lex/ModuleMap.cpp

Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -2197,6 +2197,7 @@
 if (Framework) {
   Diags.Report(StarLoc, diag::err_mmap_inferred_framework_submodule);
   Framework = false;
+  (void) Framework;
 }
   } else if (Explicit) {
 Diags.Report(StarLoc, diag::err_mmap_explicit_inferred_framework);
Index: lib/Lex/Lexer.cpp
===
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -672,6 +672,7 @@
   // directive or it was one that can't occur in the preamble at this
   // point. Roll back the current token to the location of the '#'.
   InPreprocessorDirective = false;
+  (void) InPreprocessorDirective;
   TheTok = HashTok;
 }
 


Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -2197,6 +2197,7 @@
 if (Framework) {
   Diags.Report(StarLoc, diag::err_mmap_inferred_framework_submodule);
   Framework = false;
+  (void) Framework;
 }
   } else if (Explicit) {
 Diags.Report(StarLoc, diag::err_mmap_explicit_inferred_framework);
Index: lib/Lex/Lexer.cpp
===
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -672,6 +672,7 @@
   // directive or it was one that can't occur in the preamble at this
   // point. Roll back the current token to the location of the '#'.
   InPreprocessorDirective = false;
+  (void) InPreprocessorDirective;
   TheTok = HashTok;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19748: [CUDA] Make sure device-side __global__ functions are always visible.

2016-05-02 Thread Artem Belevich via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL268299: [CUDA] Make sure device-side __global__ functions 
are always visible. (authored by tra).

Changed prior to commit:
  http://reviews.llvm.org/D19748?vs=55674&id=55885#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19748

Files:
  cfe/trunk/lib/AST/ASTContext.cpp
  cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu

Index: cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
===
--- cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
+++ cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
@@ -19,8 +19,17 @@
 
 // Make sure host-instantiated kernels are preserved on device side.
 template  __global__ void templated_kernel(T param) {}
-// CHECK-LABEL: define weak_odr void @_Z16templated_kernelIiEvT_
-void host_function() { templated_kernel<<<0,0>>>(0); }
+// CHECK-DAG: define weak_odr void @_Z16templated_kernelIiEvT_(
+
+namespace {
+__global__ void anonymous_ns_kernel() {}
+// CHECK-DAG: define weak_odr void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
+}
+
+void host_function() {
+  templated_kernel<<<0, 0>>>(0);
+  anonymous_ns_kernel<<<0,0>>>();
+}
 
 // CHECK: !{{[0-9]+}} = !{void ()* @global_function, !"kernel", i32 1}
 // CHECK: !{{[0-9]+}} = !{void (i32)* @_Z16templated_kernelIiEvT_, !"kernel", 
i32 1}
Index: cfe/trunk/lib/AST/ASTContext.cpp
===
--- cfe/trunk/lib/AST/ASTContext.cpp
+++ cfe/trunk/lib/AST/ASTContext.cpp
@@ -8418,22 +8418,29 @@
   return GVA_DiscardableODR;
 }
 
-static GVALinkage adjustGVALinkageForAttributes(GVALinkage L, const Decl *D) {
+static GVALinkage adjustGVALinkageForAttributes(const ASTContext &Context,
+GVALinkage L, const Decl *D) {
   // See http://msdn.microsoft.com/en-us/library/xa0d9ste.aspx
   // dllexport/dllimport on inline functions.
   if (D->hasAttr()) {
 if (L == GVA_DiscardableODR || L == GVA_StrongODR)
   return GVA_AvailableExternally;
-  } else if (D->hasAttr() || D->hasAttr()) {
+  } else if (D->hasAttr()) {
 if (L == GVA_DiscardableODR)
   return GVA_StrongODR;
+  } else if (Context.getLangOpts().CUDA && Context.getLangOpts().CUDAIsDevice 
&&
+ D->hasAttr()) {
+// Device-side functions with __global__ attribute must always be
+// visible externally so they can be launched from host.
+if (L == GVA_DiscardableODR || L == GVA_Internal)
+  return GVA_StrongODR;
   }
   return L;
 }
 
 GVALinkage ASTContext::GetGVALinkageForFunction(const FunctionDecl *FD) const {
-  return adjustGVALinkageForAttributes(basicGVALinkageForFunction(*this, FD),
-   FD);
+  return adjustGVALinkageForAttributes(
+  *this, basicGVALinkageForFunction(*this, FD), FD);
 }
 
 static GVALinkage basicGVALinkageForVariable(const ASTContext &Context,
@@ -8490,8 +8497,8 @@
 }
 
 GVALinkage ASTContext::GetGVALinkageForVariable(const VarDecl *VD) {
-  return adjustGVALinkageForAttributes(basicGVALinkageForVariable(*this, VD),
-   VD);
+  return adjustGVALinkageForAttributes(
+  *this, basicGVALinkageForVariable(*this, VD), VD);
 }
 
 bool ASTContext::DeclMustBeEmitted(const Decl *D) {


Index: cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
===
--- cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
+++ cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
@@ -19,8 +19,17 @@
 
 // Make sure host-instantiated kernels are preserved on device side.
 template  __global__ void templated_kernel(T param) {}
-// CHECK-LABEL: define weak_odr void @_Z16templated_kernelIiEvT_
-void host_function() { templated_kernel<<<0,0>>>(0); }
+// CHECK-DAG: define weak_odr void @_Z16templated_kernelIiEvT_(
+
+namespace {
+__global__ void anonymous_ns_kernel() {}
+// CHECK-DAG: define weak_odr void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
+}
+
+void host_function() {
+  templated_kernel<<<0, 0>>>(0);
+  anonymous_ns_kernel<<<0,0>>>();
+}
 
 // CHECK: !{{[0-9]+}} = !{void ()* @global_function, !"kernel", i32 1}
 // CHECK: !{{[0-9]+}} = !{void (i32)* @_Z16templated_kernelIiEvT_, !"kernel", i32 1}
Index: cfe/trunk/lib/AST/ASTContext.cpp
===
--- cfe/trunk/lib/AST/ASTContext.cpp
+++ cfe/trunk/lib/AST/ASTContext.cpp
@@ -8418,22 +8418,29 @@
   return GVA_DiscardableODR;
 }
 
-static GVALinkage adjustGVALinkageForAttributes(GVALinkage L, const Decl *D) {
+static GVALinkage adjustGVALinkageForAttributes(const ASTContext &Context,
+GVALinkage L, const Decl *D) {
   // See http://msdn.microsoft.com/en-us/library/xa0d9ste.aspx
   // dllexport/dllimport on inline functions.
   if (D->hasAttr()) {
 if (L == GVA_DiscardableODR || L == GVA_StrongODR)
   return GVA_AvailableExternally;
-  } else if (D->hasAttr() || D->hasA

r268299 - [CUDA] Make sure device-side __global__ functions are always visible.

2016-05-02 Thread Artem Belevich via cfe-commits
Author: tra
Date: Mon May  2 15:30:03 2016
New Revision: 268299

URL: http://llvm.org/viewvc/llvm-project?rev=268299&view=rev
Log:
[CUDA] Make sure device-side __global__ functions are always visible.

__global__ functions are a special case in CUDA.

Even when the symbol would normally not be externally
visible according to C++ rules, they still must be visible
in CUDA GPU object so host-side stub can launch them.

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

Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=268299&r1=268298&r2=268299&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon May  2 15:30:03 2016
@@ -8418,22 +8418,29 @@ static GVALinkage basicGVALinkageForFunc
   return GVA_DiscardableODR;
 }
 
-static GVALinkage adjustGVALinkageForAttributes(GVALinkage L, const Decl *D) {
+static GVALinkage adjustGVALinkageForAttributes(const ASTContext &Context,
+GVALinkage L, const Decl *D) {
   // See http://msdn.microsoft.com/en-us/library/xa0d9ste.aspx
   // dllexport/dllimport on inline functions.
   if (D->hasAttr()) {
 if (L == GVA_DiscardableODR || L == GVA_StrongODR)
   return GVA_AvailableExternally;
-  } else if (D->hasAttr() || D->hasAttr()) {
+  } else if (D->hasAttr()) {
 if (L == GVA_DiscardableODR)
   return GVA_StrongODR;
+  } else if (Context.getLangOpts().CUDA && Context.getLangOpts().CUDAIsDevice 
&&
+ D->hasAttr()) {
+// Device-side functions with __global__ attribute must always be
+// visible externally so they can be launched from host.
+if (L == GVA_DiscardableODR || L == GVA_Internal)
+  return GVA_StrongODR;
   }
   return L;
 }
 
 GVALinkage ASTContext::GetGVALinkageForFunction(const FunctionDecl *FD) const {
-  return adjustGVALinkageForAttributes(basicGVALinkageForFunction(*this, FD),
-   FD);
+  return adjustGVALinkageForAttributes(
+  *this, basicGVALinkageForFunction(*this, FD), FD);
 }
 
 static GVALinkage basicGVALinkageForVariable(const ASTContext &Context,
@@ -8490,8 +8497,8 @@ static GVALinkage basicGVALinkageForVari
 }
 
 GVALinkage ASTContext::GetGVALinkageForVariable(const VarDecl *VD) {
-  return adjustGVALinkageForAttributes(basicGVALinkageForVariable(*this, VD),
-   VD);
+  return adjustGVALinkageForAttributes(
+  *this, basicGVALinkageForVariable(*this, VD), VD);
 }
 
 bool ASTContext::DeclMustBeEmitted(const Decl *D) {

Modified: cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu?rev=268299&r1=268298&r2=268299&view=diff
==
--- cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu (original)
+++ cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu Mon May  2 15:30:03 2016
@@ -19,8 +19,17 @@ __global__ void global_function() {
 
 // Make sure host-instantiated kernels are preserved on device side.
 template  __global__ void templated_kernel(T param) {}
-// CHECK-LABEL: define weak_odr void @_Z16templated_kernelIiEvT_
-void host_function() { templated_kernel<<<0,0>>>(0); }
+// CHECK-DAG: define weak_odr void @_Z16templated_kernelIiEvT_(
+
+namespace {
+__global__ void anonymous_ns_kernel() {}
+// CHECK-DAG: define weak_odr void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
+}
+
+void host_function() {
+  templated_kernel<<<0, 0>>>(0);
+  anonymous_ns_kernel<<<0,0>>>();
+}
 
 // CHECK: !{{[0-9]+}} = !{void ()* @global_function, !"kernel", i32 1}
 // CHECK: !{{[0-9]+}} = !{void (i32)* @_Z16templated_kernelIiEvT_, !"kernel", 
i32 1}


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


[PATCH] D19831: [scan-build] fix dead store warnings emitted on clang code base

2016-05-02 Thread Apelete Seketeli via cfe-commits
apelete created this revision.
apelete added a reviewer: akyrtzi.
apelete added a subscriber: cfe-commits.

This fixes dead store warnings of the type "dead assignment" reported
by CLang Static Analyzer on the following file:

- tools/c-index-test/c-index-test.c.

Signed-off-by: Apelete Seketeli 

http://reviews.llvm.org/D19831

Files:
  tools/c-index-test/c-index-test.c

Index: tools/c-index-test/c-index-test.c
===
--- tools/c-index-test/c-index-test.c
+++ tools/c-index-test/c-index-test.c
@@ -1436,6 +1436,7 @@
 unsigned RecordIsAnonymous = 0;
 if (clang_getCursorKind(cursor) == CXCursor_FieldDecl) {
   Record = Parent = p;
+  (void) Record;
   do {
 Record = Parent;
 Parent = clang_getCursorSemanticParent(Record);


Index: tools/c-index-test/c-index-test.c
===
--- tools/c-index-test/c-index-test.c
+++ tools/c-index-test/c-index-test.c
@@ -1436,6 +1436,7 @@
 unsigned RecordIsAnonymous = 0;
 if (clang_getCursorKind(cursor) == CXCursor_FieldDecl) {
   Record = Parent = p;
+  (void) Record;
   do {
 Record = Parent;
 Parent = clang_getCursorSemanticParent(Record);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19831: [scan-build] fix dead store warnings emitted on clang code base

2016-05-02 Thread David Blaikie via cfe-commits
Any reason not to remove the story instead?

On Mon, May 2, 2016 at 1:36 PM, Apelete Seketeli via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> apelete created this revision.
> apelete added a reviewer: akyrtzi.
> apelete added a subscriber: cfe-commits.
>
> This fixes dead store warnings of the type "dead assignment" reported
> by CLang Static Analyzer on the following file:
>
> - tools/c-index-test/c-index-test.c.
>
> Signed-off-by: Apelete Seketeli 
>
> http://reviews.llvm.org/D19831
>
> Files:
>   tools/c-index-test/c-index-test.c
>
> Index: tools/c-index-test/c-index-test.c
> ===
> --- tools/c-index-test/c-index-test.c
> +++ tools/c-index-test/c-index-test.c
> @@ -1436,6 +1436,7 @@
>  unsigned RecordIsAnonymous = 0;
>  if (clang_getCursorKind(cursor) == CXCursor_FieldDecl) {
>Record = Parent = p;
> +  (void) Record;
>do {
>  Record = Parent;
>  Parent = clang_getCursorSemanticParent(Record);
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D19835: Tolerate incorrect return type for 'isinf' and 'isnan' it tests.

2016-05-02 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: rsmith, mclow.lists.
EricWF added a subscriber: cfe-commits.

GLIBC recently removed the incorrect `int isinf(double)` and `int 
isnan(double)` overloads in C++11 and greater. This causes previously `XFAIL: 
linux`  tests to start passing.

Since there is no longer a way to 'XFAIL' the tests I choose to simply tolerate 
this bug.

See https://sourceware.org/bugzilla/show_bug.cgi?id=19439


http://reviews.llvm.org/D19835

Files:
  test/std/depr/depr.c.headers/math_h.pass.cpp
  test/std/depr/depr.c.headers/math_h_isinf.pass.cpp
  test/std/depr/depr.c.headers/math_h_isnan.pass.cpp
  test/std/numerics/c.math/cmath.pass.cpp
  test/std/numerics/c.math/cmath_isinf.pass.cpp
  test/std/numerics/c.math/cmath_isnan.pass.cpp

Index: test/std/numerics/c.math/cmath_isnan.pass.cpp
===
--- test/std/numerics/c.math/cmath_isnan.pass.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-
-// 
-
-// isnan
-
-// XFAIL: linux
-
-#include 
-#include 
-#include 
-
-int main()
-{
-#ifdef isnan
-#error isnan defined
-#endif
-static_assert((std::is_same::value), "");
-static_assert((std::is_same::value), "");
-static_assert((std::is_same::value), "");
-static_assert((std::is_same::value), "");
-assert(std::isnan(-1.0) == false);
-}
Index: test/std/numerics/c.math/cmath_isinf.pass.cpp
===
--- test/std/numerics/c.math/cmath_isinf.pass.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-
-// 
-
-// isinf
-
-// XFAIL: linux
-
-#include 
-#include 
-#include 
-
-int main()
-{
-#ifdef isinf
-#error isinf defined
-#endif
-static_assert((std::is_same::value), "");
-static_assert((std::is_same::value), "");
-static_assert((std::is_same::value), "");
-static_assert((std::is_same::value), "");
-assert(std::isinf(-1.0) == false);
-}
\ No newline at end of file
Index: test/std/numerics/c.math/cmath.pass.cpp
===
--- test/std/numerics/c.math/cmath.pass.cpp
+++ test/std/numerics/c.math/cmath.pass.cpp
@@ -9,9 +9,6 @@
 
 // 
 
-// NOTE: isinf and isnan are tested separately because they are expected to fail
-// on linux. We don't want their expected failure to hide other failures in this file.
-
 #include 
 #include 
 #include 
@@ -631,6 +628,29 @@
 assert(std::isgreaterequal(-1.0, 0.F) == false);
 }
 
+void test_isinf()
+{
+#ifdef isinf
+#error isinf defined
+#endif
+static_assert((std::is_same::value), "");
+
+typedef decltype(std::isinf((double)0)) DoubleRetType;
+#ifndef __linux__
+static_assert((std::is_same::value), "");
+#else
+// GLIBC < 2.26 defines 'isinf(double)' with a return type of 'int' in
+// all C++ dialects. The test should tolerate this.
+// See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
+static_assert((std::is_same::value
+|| std::is_same::value), "");
+#endif
+
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+assert(std::isinf(-1.0) == false);
+}
+
 void test_isless()
 {
 #ifdef isless
@@ -688,6 +708,29 @@
 assert(std::islessgreater(-1.0, 0.F) == true);
 }
 
+void test_isnan()
+{
+#ifdef isnan
+#error isnan defined
+#endif
+static_assert((std::is_same::value), "");
+
+typedef decltype(std::isnan((double)0)) DoubleRetType;
+#ifndef __linux__
+static_assert((std::is_same::value), "");
+#else
+// GLIBC < 2.26 defines 'isnan(double)' with a return type of 'int' in
+// all C++ dialects. The test should tolerate this.
+// See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
+static_assert((std::is_same::value
+|| std::is_same::value), "");
+#endif
+
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+assert(std::isnan(-1.0) == false);
+}
+
 void test_isunordered()
 {
 #ifdef isunordered
@@ -1443,9 +1486,11 @@
 test_isnormal();
 test_isgreater();
 test_isgreaterequal();
+test_isinf();
 test_isless();
 test_islessequal();
 test_islessgreater();
+test_isnan();
 test_isunordered();
 test_acosh();
 test_asinh();
Index: test/std/d

Re: [PATCH] D19835: Tolerate incorrect return type for 'isinf' and 'isnan' in tests.

2016-05-02 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.
jroelofs added a comment.

I think you could lean on the linker to cause the test to fail when the type is 
wrong:

  bool isinf(double);
  
  typedef int (*expected_signature)(double);
  
  void assert_via_linker(decltype(isinf) blah);
  void assert_via_linker(expected_signature blah) {}
  
  void foo() {
assert_via_linker(isinf);
  }


http://reviews.llvm.org/D19835



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


Re: [PATCH] D18919: [Clang-tidy] Add check "modernize use using"

2016-05-02 Thread Piotr Padlewski via cfe-commits
Prazek added a comment.

lgtm, but I'd rather see Hokein acceptance.


Repository:
  rL LLVM

http://reviews.llvm.org/D18919



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


Re: [PATCH] D18919: [Clang-tidy] Add check "modernize use using"

2016-05-02 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

Check is still not mentioned in docs/ReleaseNotes.rst.


Repository:
  rL LLVM

http://reviews.llvm.org/D18919



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


Re: [PATCH] D19835: Tolerate incorrect return type for 'isinf' and 'isnan' in tests.

2016-05-02 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In http://reviews.llvm.org/D19835#419211, @jroelofs wrote:

> I think you could lean on the linker to cause the test to fail when the type 
> is wrong:
>
>   bool isinf(double);
>  
>   typedef int (*expected_signature)(double);
>  
>   void assert_via_linker(decltype(isinf) blah);
>   void assert_via_linker(expected_signature blah) {}
>  
>   void foo() {
> assert_via_linker(isinf);
>   }
>  
>


Alternatively `static_assert(std::is_same::value);` :-P

Testing the return type isn't the problem. The problem is telling LIT *when* we 
expect the test to fail using the `XFAIL` directive.

The test will pass for:

- non-linux systems
- GLIBC >= 2.26 and C++ >= 11.

The test will fail for:

- GLIBC < 2.26
- GLIBC >= 2.26 and C++ < 11.

Trying to encode that within 'XFAIL' is currently not possible and


http://reviews.llvm.org/D19835



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


r268314 - [CodeGenObjCXX] Don't rematerialize default arguments of function

2016-05-02 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Mon May  2 16:52:57 2016
New Revision: 268314

URL: http://llvm.org/viewvc/llvm-project?rev=268314&view=rev
Log:
[CodeGenObjCXX] Don't rematerialize default arguments of function
parameters in the body of a block.

This fixes a bug where clang would materialize the default argument
inside the body of a block instead of passing the value via the block
descriptor.

For example, in the code below, foo1 would always print 42 regardless
of the value of argument "a" passed to foo1.

void foo1(const int a = 42 ) {
  auto block = ^{
printf("%d\n", a);
  };
  block();
}

rdar://problem/24449235

Added:
cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm
Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=268314&r1=268313&r2=268314&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Mon May  2 16:52:57 2016
@@ -262,6 +262,11 @@ static bool isSafeForCXXConstantCapture(
 static llvm::Constant *tryCaptureAsConstant(CodeGenModule &CGM,
 CodeGenFunction *CGF,
 const VarDecl *var) {
+  // Don't rematerialize default arguments of function parameters.
+  if (auto *PD = dyn_cast(var))
+if (PD->hasDefaultArg())
+  return nullptr;
+
   QualType type = var->getType();
 
   // We can only do this if the variable is const.

Added: cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm?rev=268314&view=auto
==
--- cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm (added)
+++ cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm Mon May  2 16:52:57 2016
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s 
-std=c++11 -fblocks -fobjc-arc | FileCheck  %s
+
+// CHECK: define internal void @___Z16test_default_argi_block_invoke(i8* 
%[[BLOCK_DESCRIPTOR:.*]])
+// CHECK: %[[BLOCK:.*]] = bitcast i8* %[[BLOCK_DESCRIPTOR]] to <{ i8*, i32, 
i32, i8*, %struct.__block_descriptor*, i32 }>*
+// CHECK: %[[BLOCK_CAPTURE_ADDR:.*]] = getelementptr inbounds <{ i8*, i32, 
i32, i8*, %struct.__block_descriptor*, i32 }>, <{ i8*, i32, i32, i8*, 
%struct.__block_descriptor*, i32 }>* %[[BLOCK]], i32 0, i32 5
+// CHECK: %[[V0:.*]] = load i32, i32* %[[BLOCK_CAPTURE_ADDR]]
+// CHECK: call void @_Z4foo1i(i32 %[[V0]])
+
+void foo1(int);
+
+void test_default_arg(const int a = 42) {
+  auto block = ^{
+foo1(a);
+  };
+  block();
+}


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


Re: [PATCH] D19831: [scan-build] fix dead store warnings emitted on clang code base

2016-05-02 Thread Apelete Seketeli via cfe-commits
apelete added a comment.

In http://reviews.llvm.org/D19831#419140, @dblaikie wrote:

> Any reason not to remove the story instead?


What do you mean by "remove the story" ?


http://reviews.llvm.org/D19831



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


Re: r268314 - [CodeGenObjCXX] Don't rematerialize default arguments of function

2016-05-02 Thread Richard Smith via cfe-commits
On Mon, May 2, 2016 at 2:52 PM, Akira Hatanaka via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ahatanak
> Date: Mon May  2 16:52:57 2016
> New Revision: 268314
>
> URL: http://llvm.org/viewvc/llvm-project?rev=268314&view=rev
> Log:
> [CodeGenObjCXX] Don't rematerialize default arguments of function
> parameters in the body of a block.
>
> This fixes a bug where clang would materialize the default argument
> inside the body of a block instead of passing the value via the block
> descriptor.
>
> For example, in the code below, foo1 would always print 42 regardless
> of the value of argument "a" passed to foo1.
>
> void foo1(const int a = 42 ) {
>   auto block = ^{
> printf("%d\n", a);
>   };
>   block();
> }
>
> rdar://problem/24449235
>
> Added:
> cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm
> Modified:
> cfe/trunk/lib/CodeGen/CGBlocks.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=268314&r1=268313&r2=268314&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Mon May  2 16:52:57 2016
> @@ -262,6 +262,11 @@ static bool isSafeForCXXConstantCapture(
>  static llvm::Constant *tryCaptureAsConstant(CodeGenModule &CGM,
>  CodeGenFunction *CGF,
>  const VarDecl *var) {
> +  // Don't rematerialize default arguments of function parameters.
> +  if (auto *PD = dyn_cast(var))
> +if (PD->hasDefaultArg())
>

I don't think you need this test, and I think it somewhat confuses the
intent here. (A reader would wonder why you want to keep going for
ParmVarDecls that don't have default arguments.)


> +  return nullptr;
> +
>QualType type = var->getType();
>
>// We can only do this if the variable is const.
>
> Added: cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm?rev=268314&view=auto
>
> ==
> --- cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm (added)
> +++ cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm Mon May  2 16:52:57
> 2016
> @@ -0,0 +1,16 @@
> +// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s
> -std=c++11 -fblocks -fobjc-arc | FileCheck  %s
> +
> +// CHECK: define internal void @___Z16test_default_argi_block_invoke(i8*
> %[[BLOCK_DESCRIPTOR:.*]])
> +// CHECK: %[[BLOCK:.*]] = bitcast i8* %[[BLOCK_DESCRIPTOR]] to <{ i8*,
> i32, i32, i8*, %struct.__block_descriptor*, i32 }>*
> +// CHECK: %[[BLOCK_CAPTURE_ADDR:.*]] = getelementptr inbounds <{ i8*,
> i32, i32, i8*, %struct.__block_descriptor*, i32 }>, <{ i8*, i32, i32, i8*,
> %struct.__block_descriptor*, i32 }>* %[[BLOCK]], i32 0, i32 5
> +// CHECK: %[[V0:.*]] = load i32, i32* %[[BLOCK_CAPTURE_ADDR]]
> +// CHECK: call void @_Z4foo1i(i32 %[[V0]])
> +
> +void foo1(int);
> +
> +void test_default_arg(const int a = 42) {
> +  auto block = ^{
> +foo1(a);
> +  };
> +  block();
> +}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r268314 - [CodeGenObjCXX] Don't rematerialize default arguments of function

2016-05-02 Thread Akira Hatanaka via cfe-commits
I see. Perhaps this should be an assert?

> On May 2, 2016, at 3:05 PM, Richard Smith  wrote:
> 
> On Mon, May 2, 2016 at 2:52 PM, Akira Hatanaka via cfe-commits 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> Author: ahatanak
> Date: Mon May  2 16:52:57 2016
> New Revision: 268314
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=268314&view=rev 
> 
> Log:
> [CodeGenObjCXX] Don't rematerialize default arguments of function
> parameters in the body of a block.
> 
> This fixes a bug where clang would materialize the default argument
> inside the body of a block instead of passing the value via the block
> descriptor.
> 
> For example, in the code below, foo1 would always print 42 regardless
> of the value of argument "a" passed to foo1.
> 
> void foo1(const int a = 42 ) {
>   auto block = ^{
> printf("%d\n", a);
>   };
>   block();
> }
> 
> rdar://problem/24449235
> 
> Added:
> cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm 
> 
> Modified:
> cfe/trunk/lib/CodeGen/CGBlocks.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=268314&r1=268313&r2=268314&view=diff
>  
> 
> ==
> --- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Mon May  2 16:52:57 2016
> @@ -262,6 +262,11 @@ static bool isSafeForCXXConstantCapture(
>  static llvm::Constant *tryCaptureAsConstant(CodeGenModule &CGM,
>  CodeGenFunction *CGF,
>  const VarDecl *var) {
> +  // Don't rematerialize default arguments of function parameters.
> +  if (auto *PD = dyn_cast(var))
> +if (PD->hasDefaultArg())
> 
> I don't think you need this test, and I think it somewhat confuses the intent 
> here. (A reader would wonder why you want to keep going for ParmVarDecls that 
> don't have default arguments.)
>  
> +  return nullptr;
> +
>QualType type = var->getType();
> 
>// We can only do this if the variable is const.
> 
> Added: cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm 
> 
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm?rev=268314&view=auto
>  
> 
> ==
> --- cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm 
>  (added)
> +++ cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm 
>  Mon May  2 16:52:57 2016
> @@ -0,0 +1,16 @@
> +// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s 
> -std=c++11 -fblocks -fobjc-arc | FileCheck  %s
> +
> +// CHECK: define internal void @___Z16test_default_argi_block_invoke(i8* 
> %[[BLOCK_DESCRIPTOR:.*]])
> +// CHECK: %[[BLOCK:.*]] = bitcast i8* %[[BLOCK_DESCRIPTOR]] to <{ i8*, i32, 
> i32, i8*, %struct.__block_descriptor*, i32 }>*
> +// CHECK: %[[BLOCK_CAPTURE_ADDR:.*]] = getelementptr inbounds <{ i8*, i32, 
> i32, i8*, %struct.__block_descriptor*, i32 }>, <{ i8*, i32, i32, i8*, 
> %struct.__block_descriptor*, i32 }>* %[[BLOCK]], i32 0, i32 5
> +// CHECK: %[[V0:.*]] = load i32, i32* %[[BLOCK_CAPTURE_ADDR]]
> +// CHECK: call void @_Z4foo1i(i32 %[[V0]])
> +
> +void foo1(int);
> +
> +void test_default_arg(const int a = 42) {
> +  auto block = ^{
> +foo1(a);
> +  };
> +  block();
> +}
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org 
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits 
> 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r268314 - [CodeGenObjCXX] Don't rematerialize default arguments of function

2016-05-02 Thread Akira Hatanaka via cfe-commits
It looks like turning it to an assert wouldn’t be correct, I’ll probably just 
remove it.

> On May 2, 2016, at 3:12 PM, Akira Hatanaka via cfe-commits 
>  wrote:
> 
> I see. Perhaps this should be an assert?
> 
>> On May 2, 2016, at 3:05 PM, Richard Smith > > wrote:
>> 
>> On Mon, May 2, 2016 at 2:52 PM, Akira Hatanaka via cfe-commits 
>> mailto:cfe-commits@lists.llvm.org>> wrote:
>> Author: ahatanak
>> Date: Mon May  2 16:52:57 2016
>> New Revision: 268314
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=268314&view=rev 
>> 
>> Log:
>> [CodeGenObjCXX] Don't rematerialize default arguments of function
>> parameters in the body of a block.
>> 
>> This fixes a bug where clang would materialize the default argument
>> inside the body of a block instead of passing the value via the block
>> descriptor.
>> 
>> For example, in the code below, foo1 would always print 42 regardless
>> of the value of argument "a" passed to foo1.
>> 
>> void foo1(const int a = 42 ) {
>>   auto block = ^{
>> printf("%d\n", a);
>>   };
>>   block();
>> }
>> 
>> rdar://problem/24449235 
>> 
>> Added:
>> cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm 
>> 
>> Modified:
>> cfe/trunk/lib/CodeGen/CGBlocks.cpp
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=268314&r1=268313&r2=268314&view=diff
>>  
>> 
>> ==
>> --- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Mon May  2 16:52:57 2016
>> @@ -262,6 +262,11 @@ static bool isSafeForCXXConstantCapture(
>>  static llvm::Constant *tryCaptureAsConstant(CodeGenModule &CGM,
>>  CodeGenFunction *CGF,
>>  const VarDecl *var) {
>> +  // Don't rematerialize default arguments of function parameters.
>> +  if (auto *PD = dyn_cast(var))
>> +if (PD->hasDefaultArg())
>> 
>> I don't think you need this test, and I think it somewhat confuses the 
>> intent here. (A reader would wonder why you want to keep going for 
>> ParmVarDecls that don't have default arguments.)
>>  
>> +  return nullptr;
>> +
>>QualType type = var->getType();
>> 
>>// We can only do this if the variable is const.
>> 
>> Added: cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm 
>> 
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm?rev=268314&view=auto
>>  
>> 
>> ==
>> --- cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm 
>>  (added)
>> +++ cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm 
>>  Mon May  2 16:52:57 2016
>> @@ -0,0 +1,16 @@
>> +// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s 
>> -std=c++11 -fblocks -fobjc-arc | FileCheck  %s
>> +
>> +// CHECK: define internal void @___Z16test_default_argi_block_invoke(i8* 
>> %[[BLOCK_DESCRIPTOR:.*]])
>> +// CHECK: %[[BLOCK:.*]] = bitcast i8* %[[BLOCK_DESCRIPTOR]] to <{ i8*, i32, 
>> i32, i8*, %struct.__block_descriptor*, i32 }>*
>> +// CHECK: %[[BLOCK_CAPTURE_ADDR:.*]] = getelementptr inbounds <{ i8*, i32, 
>> i32, i8*, %struct.__block_descriptor*, i32 }>, <{ i8*, i32, i32, i8*, 
>> %struct.__block_descriptor*, i32 }>* %[[BLOCK]], i32 0, i32 5
>> +// CHECK: %[[V0:.*]] = load i32, i32* %[[BLOCK_CAPTURE_ADDR]]
>> +// CHECK: call void @_Z4foo1i(i32 %[[V0]])
>> +
>> +void foo1(int);
>> +
>> +void test_default_arg(const int a = 42) {
>> +  auto block = ^{
>> +foo1(a);
>> +  };
>> +  block();
>> +}
>> 
>> 
>> ___
>> 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

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


Re: [PATCH] D19802: Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class that initializes itself as a base

2016-05-02 Thread Michael Miller via cfe-commits
michael_miller added inline comments.


Comment at: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp:342
@@ +341,3 @@
+
+template 
+class PositiveSelfInitialization : NegativeAggregateType

aaron.ballman wrote:
> hokein wrote:
> > aaron.ballman wrote:
> > > Is it required to be a templated class to trigger the crash?
> > Yes, it's required.
> Then some comments in this test would be good, I would assume otherwise from 
> just looking at the test.
It's a little bit of a pathological example. Without the template, the code 
won't compile at all due to an error. The check doesn't crash in that case 
(error: constructor for 'PositiveSelfInitialization' creates a delegation cycle 
[clang-diagnostic-delegating-ctor-cycles]). With the template in the mix, 
apparently PositiveSelfInitialization doesn't have a valid RecordDecl. If you 
instantiate the template, though, the code again fails to compile.


http://reviews.llvm.org/D19802



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


r268318 - Remove unneeded test in tryCaptureAsConstant.

2016-05-02 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Mon May  2 17:29:40 2016
New Revision: 268318

URL: http://llvm.org/viewvc/llvm-project?rev=268318&view=rev
Log:
Remove unneeded test in tryCaptureAsConstant.

It isn't necessary to call hasDefaultArg because we can't rematerialize
a captured variable that is a function parameter, regardless of whether
or not it has a default argument. NFC.

Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=268318&r1=268317&r2=268318&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Mon May  2 17:29:40 2016
@@ -262,10 +262,10 @@ static bool isSafeForCXXConstantCapture(
 static llvm::Constant *tryCaptureAsConstant(CodeGenModule &CGM,
 CodeGenFunction *CGF,
 const VarDecl *var) {
-  // Don't rematerialize default arguments of function parameters.
-  if (auto *PD = dyn_cast(var))
-if (PD->hasDefaultArg())
-  return nullptr;
+  // Return if this is a function paramter. We shouldn't try to
+  // rematerialize default arguments of function parameters.
+  if (isa(var))
+return nullptr;
 
   QualType type = var->getType();
 


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


Re: [PATCH] D19536: [CodeGenObjCXX] Fix handling of blocks in lambda

2016-05-02 Thread Akira Hatanaka via cfe-commits
ahatanak added inline comments.


Comment at: lib/CodeGen/CGBlocks.cpp:806
@@ -792,1 +805,3 @@
+  }
+  src = Builder.CreateStructGEP(Addr, Idx, Offset, FD->getName());
 } else {

rjmccall wrote:
> Hmm.  It's become increasingly clear that my original decision to expand the 
> decl-ref logic here was a mistake.  Please just turn this entire block of 
> conditions into:
> 
>   if (blockDecl->isConversionFromLambda()) {
> // The lambda capture in a lambda's conversion-to-block-pointer is
> // special; we'll simply emit it directly.
> src = Address::invalid();
>   } else {
> DeclRefExpr declRef(
> const_cast(variable),
> /*RefersToEnclosingVariableOrCapture*/ CI.isNested(), type,
> VK_LValue, SourceLocation());
> src = EmitDeclRefLValue(&declRef).getAddress();
>   }
Seems like a lot of regression tests fail if I try the code above. Currently 
investigating.


http://reviews.llvm.org/D19536



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


Re: [PATCH] D19802: Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class that initializes itself as a base

2016-05-02 Thread Michael Miller via cfe-commits
michael_miller marked 4 inline comments as done.


Comment at: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp:342
@@ +341,3 @@
+
+// This pathological template fails to compile if actually instantiated. It
+// results in the check seeing a null RecordDecl when examining the base class

Added a comment explaining why the check is there.


http://reviews.llvm.org/D19802



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


Re: [PATCH] D19802: Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class that initializes itself as a base

2016-05-02 Thread Michael Miller via cfe-commits
michael_miller updated this revision to Diff 55904.
michael_miller added a comment.

Added a comment explaining the new test added.


http://reviews.llvm.org/D19802

Files:
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp

Index: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
===
--- test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
+++ test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
@@ -338,3 +338,14 @@
 
   Template F;
 };
+
+// This pathological template fails to compile if actually instantiated. It
+// results in the check seeing a null RecordDecl when examining the base class
+// initializer list.
+template 
+class PositiveSelfInitialization : NegativeAggregateType
+{
+  PositiveSelfInitialization() : PositiveSelfInitialization() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor does not initialize 
these bases: NegativeAggregateType
+  // CHECK-FIXES: PositiveSelfInitialization() : NegativeAggregateType(), 
PositiveSelfInitialization() {}
+};
Index: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
===
--- clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -179,7 +179,7 @@
   const auto *InitDecl =
   Init->isMemberInitializer()
   ? static_cast(Init->getMember())
-  : Init->getBaseClass()->getAs()->getDecl();
+  : Init->getBaseClass()->getAsCXXRecordDecl();
 
   // Add all fields between current field up until the next intializer.
   for (; Decl != std::end(OrderedDecls) && *Decl != InitDecl; ++Decl) {
@@ -398,7 +398,7 @@
   // Remove any bases that were explicitly written in the initializer list.
   for (const CXXCtorInitializer *Init : Ctor->inits()) {
 if (Init->isBaseInitializer() && Init->isWritten())
-  BasesToInit.erase(Init->getBaseClass()->getAs()->getDecl());
+  BasesToInit.erase(Init->getBaseClass()->getAsCXXRecordDecl());
   }
 
   if (BasesToInit.empty())


Index: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
===
--- test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
+++ test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
@@ -338,3 +338,14 @@
 
   Template F;
 };
+
+// This pathological template fails to compile if actually instantiated. It
+// results in the check seeing a null RecordDecl when examining the base class
+// initializer list.
+template 
+class PositiveSelfInitialization : NegativeAggregateType
+{
+  PositiveSelfInitialization() : PositiveSelfInitialization() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor does not initialize these bases: NegativeAggregateType
+  // CHECK-FIXES: PositiveSelfInitialization() : NegativeAggregateType(), PositiveSelfInitialization() {}
+};
Index: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
===
--- clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -179,7 +179,7 @@
   const auto *InitDecl =
   Init->isMemberInitializer()
   ? static_cast(Init->getMember())
-  : Init->getBaseClass()->getAs()->getDecl();
+  : Init->getBaseClass()->getAsCXXRecordDecl();
 
   // Add all fields between current field up until the next intializer.
   for (; Decl != std::end(OrderedDecls) && *Decl != InitDecl; ++Decl) {
@@ -398,7 +398,7 @@
   // Remove any bases that were explicitly written in the initializer list.
   for (const CXXCtorInitializer *Init : Ctor->inits()) {
 if (Init->isBaseInitializer() && Init->isWritten())
-  BasesToInit.erase(Init->getBaseClass()->getAs()->getDecl());
+  BasesToInit.erase(Init->getBaseClass()->getAsCXXRecordDecl());
   }
 
   if (BasesToInit.empty())
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19835: Tolerate incorrect return type for 'isinf' and 'isnan' in tests.

2016-05-02 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.



> Alternatively `static_assert(std::is_same bool>::value);` :-P

> 

> Testing the return type isn't the problem. The problem is telling LIT *when* 
> we expect the test to fail using the `XFAIL` directive.


O. I see.


http://reviews.llvm.org/D19835



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


Re: r268314 - [CodeGenObjCXX] Don't rematerialize default arguments of function

2016-05-02 Thread Akira Hatanaka via cfe-commits
Thanks, fixed in r268318.

> On May 2, 2016, at 3:05 PM, Richard Smith  wrote:
> 
> On Mon, May 2, 2016 at 2:52 PM, Akira Hatanaka via cfe-commits 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> Author: ahatanak
> Date: Mon May  2 16:52:57 2016
> New Revision: 268314
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=268314&view=rev 
> 
> Log:
> [CodeGenObjCXX] Don't rematerialize default arguments of function
> parameters in the body of a block.
> 
> This fixes a bug where clang would materialize the default argument
> inside the body of a block instead of passing the value via the block
> descriptor.
> 
> For example, in the code below, foo1 would always print 42 regardless
> of the value of argument "a" passed to foo1.
> 
> void foo1(const int a = 42 ) {
>   auto block = ^{
> printf("%d\n", a);
>   };
>   block();
> }
> 
> rdar://problem/24449235
> 
> Added:
> cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm 
> 
> Modified:
> cfe/trunk/lib/CodeGen/CGBlocks.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=268314&r1=268313&r2=268314&view=diff
>  
> 
> ==
> --- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Mon May  2 16:52:57 2016
> @@ -262,6 +262,11 @@ static bool isSafeForCXXConstantCapture(
>  static llvm::Constant *tryCaptureAsConstant(CodeGenModule &CGM,
>  CodeGenFunction *CGF,
>  const VarDecl *var) {
> +  // Don't rematerialize default arguments of function parameters.
> +  if (auto *PD = dyn_cast(var))
> +if (PD->hasDefaultArg())
> 
> I don't think you need this test, and I think it somewhat confuses the intent 
> here. (A reader would wonder why you want to keep going for ParmVarDecls that 
> don't have default arguments.)
>  
> +  return nullptr;
> +
>QualType type = var->getType();
> 
>// We can only do this if the variable is const.
> 
> Added: cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm 
> 
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm?rev=268314&view=auto
>  
> 
> ==
> --- cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm 
>  (added)
> +++ cfe/trunk/test/CodeGenObjCXX/block-default-arg.mm 
>  Mon May  2 16:52:57 2016
> @@ -0,0 +1,16 @@
> +// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s 
> -std=c++11 -fblocks -fobjc-arc | FileCheck  %s
> +
> +// CHECK: define internal void @___Z16test_default_argi_block_invoke(i8* 
> %[[BLOCK_DESCRIPTOR:.*]])
> +// CHECK: %[[BLOCK:.*]] = bitcast i8* %[[BLOCK_DESCRIPTOR]] to <{ i8*, i32, 
> i32, i8*, %struct.__block_descriptor*, i32 }>*
> +// CHECK: %[[BLOCK_CAPTURE_ADDR:.*]] = getelementptr inbounds <{ i8*, i32, 
> i32, i8*, %struct.__block_descriptor*, i32 }>, <{ i8*, i32, i32, i8*, 
> %struct.__block_descriptor*, i32 }>* %[[BLOCK]], i32 0, i32 5
> +// CHECK: %[[V0:.*]] = load i32, i32* %[[BLOCK_CAPTURE_ADDR]]
> +// CHECK: call void @_Z4foo1i(i32 %[[V0]])
> +
> +void foo1(int);
> +
> +void test_default_arg(const int a = 42) {
> +  auto block = ^{
> +foo1(a);
> +  };
> +  block();
> +}
> 
> 
> ___
> 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


r268319 - [CMake] Adding clang-headers to the Apple-stage2 distribution

2016-05-02 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Mon May  2 17:38:06 2016
New Revision: 268319

URL: http://llvm.org/viewvc/llvm-project?rev=268319&view=rev
Log:
[CMake] Adding clang-headers to the Apple-stage2 distribution

This installs the clang headers as part of the install-distribution target.

Modified:
cfe/trunk/cmake/caches/Apple-stage2.cmake

Modified: cfe/trunk/cmake/caches/Apple-stage2.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/Apple-stage2.cmake?rev=268319&r1=268318&r2=268319&view=diff
==
--- cfe/trunk/cmake/caches/Apple-stage2.cmake (original)
+++ cfe/trunk/cmake/caches/Apple-stage2.cmake Mon May  2 17:38:06 2016
@@ -54,6 +54,7 @@ set(LLVM_DISTRIBUTION_COMPONENTS
   clang
   LTO
   clang-format
+  clang-headers
   ${LLVM_TOOLCHAIN_TOOLS}
   CACHE STRING "")
 


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


r268321 - Fix argument expansion of reference fields of structs

2016-05-02 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Mon May  2 17:42:34 2016
New Revision: 268321

URL: http://llvm.org/viewvc/llvm-project?rev=268321&view=rev
Log:
Fix argument expansion of reference fields of structs

r268261 made Clang "expand" more struct arguments on Windows. It removed
the check for 'RD->isCLike()', which was preventing us from attempting
to expand structs with reference type fields.

Our expansion code was attempting to load and pass each field of the
type in turn. We were accidentally doing one to many loads on reference
type fields.

On the function prologue side, we can use
EmitLValueForFieldInitialization, which obviously gets the address of
the field. On the call side, I tweaked EmitRValueForField directly,
since this is the only use of this method.

Fixes PR27607

Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=268321&r1=268320&r2=268321&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon May  2 17:42:34 2016
@@ -948,7 +948,7 @@ void CodeGenFunction::ExpandTypeFromArgs
 }
 for (auto FD : RExp->Fields) {
   // FIXME: What are the right qualifiers here?
-  LValue SubLV = EmitLValueForField(LV, FD);
+  LValue SubLV = EmitLValueForFieldInitialization(LV, FD);
   ExpandTypeFromArgs(FD->getType(), SubLV, AI);
 }
   } else if (isa(Exp.get())) {

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=268321&r1=268320&r2=268321&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon May  2 17:42:34 2016
@@ -3667,6 +3667,10 @@ RValue CodeGenFunction::EmitRValueForFie
   case TEK_Aggregate:
 return FieldLV.asAggregateRValue();
   case TEK_Scalar:
+// This routine is used to load fields one-by-one to perform a copy, so
+// don't load reference fields.
+if (FD->getType()->isReferenceType())
+  return RValue::get(FieldLV.getPointer());
 return EmitLoadOfLValue(FieldLV, Loc);
   }
   llvm_unreachable("bad evaluation kind");

Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp?rev=268321&r1=268320&r2=268321&view=diff
==
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp Mon May  2 
17:42:34 2016
@@ -217,6 +217,28 @@ void big_arg(Big s) {}
 // WIN32: define void @"\01?big_arg@@YAXUBig@@@Z"(%struct.Big* byval align 4 
%s)
 // WIN64: define void @"\01?big_arg@@YAXUBig@@@Z"(%struct.Big* %s)
 
+// PR27607: We would attempt to load i32 value out of the reference instead of
+// just loading the pointer from the struct during argument expansion.
+struct RefField {
+  RefField(int &x);
+  int &x;
+};
+void takes_ref_field(RefField s) {}
+// LINUX-LABEL: define void @_Z15takes_ref_field8RefField(%struct.RefField* 
byval align 4 %s)
+// WIN32: define void @"\01?takes_ref_field@@YAXURefField@@@Z"(i32* %s.0)
+// WIN64: define void @"\01?takes_ref_field@@YAXURefField@@@Z"(i64 %s.coerce)
+
+void pass_ref_field() {
+  int x;
+  takes_ref_field(RefField(x));
+}
+// LINUX-LABEL: define void @_Z14pass_ref_fieldv()
+// LINUX: call void @_Z15takes_ref_field8RefField(%struct.RefField* byval 
align 4 %{{.*}})
+// WIN32-LABEL: define void @"\01?pass_ref_field@@YAXXZ"()
+// WIN32: call void @"\01?takes_ref_field@@YAXURefField@@@Z"(i32* %{{.*}})
+// WIN64-LABEL: define void @"\01?pass_ref_field@@YAXXZ"()
+// WIN64: call void @"\01?takes_ref_field@@YAXURefField@@@Z"(i64 %{{.*}})
+
 class Class {
  public:
   Small thiscall_method_small() { return Small(); }


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


r268320 - [CMake] Install libcxx-headers as part of the Apple-stage2 distribution

2016-05-02 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Mon May  2 17:42:09 2016
New Revision: 268320

URL: http://llvm.org/viewvc/llvm-project?rev=268320&view=rev
Log:
[CMake] Install libcxx-headers as part of the Apple-stage2 distribution

This installs the clang headers as part of the install-distribution target.

Modified:
cfe/trunk/cmake/caches/Apple-stage2.cmake

Modified: cfe/trunk/cmake/caches/Apple-stage2.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/Apple-stage2.cmake?rev=268320&r1=268319&r2=268320&view=diff
==
--- cfe/trunk/cmake/caches/Apple-stage2.cmake (original)
+++ cfe/trunk/cmake/caches/Apple-stage2.cmake Mon May  2 17:42:09 2016
@@ -55,6 +55,7 @@ set(LLVM_DISTRIBUTION_COMPONENTS
   LTO
   clang-format
   clang-headers
+  libcxx-headers
   ${LLVM_TOOLCHAIN_TOOLS}
   CACHE STRING "")
 


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


r268322 - [CMake] Enable LIBCXX HEADERS in Apple-Stage2.cmake

2016-05-02 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Mon May  2 17:43:23 2016
New Revision: 268322

URL: http://llvm.org/viewvc/llvm-project?rev=268322&view=rev
Log:
[CMake] Enable LIBCXX HEADERS in Apple-Stage2.cmake

This enables installing the libcxx headers.

Modified:
cfe/trunk/cmake/caches/Apple-stage2.cmake

Modified: cfe/trunk/cmake/caches/Apple-stage2.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/Apple-stage2.cmake?rev=268322&r1=268321&r2=268322&view=diff
==
--- cfe/trunk/cmake/caches/Apple-stage2.cmake (original)
+++ cfe/trunk/cmake/caches/Apple-stage2.cmake Mon May  2 17:43:23 2016
@@ -34,7 +34,7 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2
 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
 
 set(LIBCXX_INSTALL_LIBRARY OFF CACHE BOOL "")
-set(LIBCXX_INSTALL_HEADERS OFF CACHE BOOL "")
+set(LIBCXX_INSTALL_HEADERS ON CACHE BOOL "")
 set(LIBCXX_INCLUDE_TESTS OFF CACHE BOOL "")
 set(LLVM_LTO_VERSION_OFFSET 3000 CACHE STRING "")
 


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


Re: [PATCH] D19678: Annotated-source optimization reports (a.k.a. "listing" files)

2016-05-02 Thread Hal Finkel via cfe-commits
hfinkel updated this revision to Diff 55907.
hfinkel added a comment.

Renamed the option from -flisting to -foptimization-report as suggested. Moved 
I/O-related and formatting-related code into Frontend.


http://reviews.llvm.org/D19678

Files:
  include/clang/Driver/CC1Options.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CompilerInstance.h
  include/clang/Frontend/CompilerInvocation.h
  include/clang/Frontend/FrontendActions.h
  include/clang/Frontend/OptReport.h
  lib/CodeGen/CodeGenAction.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CMakeLists.txt
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/OptReport.cpp
  lib/FrontendTool/ExecuteCompilerInvocation.cpp
  test/CodeGen/opt-report.c
  test/Driver/opt-report.c

Index: test/Driver/opt-report.c
===
--- /dev/null
+++ test/Driver/opt-report.c
@@ -0,0 +1,9 @@
+// RUN: %clang -### -S -o FOO -foptimization-report %s 2>&1 | FileCheck %s
+// RUN: %clang -### -S -o FOO -foptimization-report=BAR.txt %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ
+
+// CHECK: "-cc1"
+// CHECK: "-opt-report-file" "opt-report.lst"
+
+// CHECK-EQ: "-cc1"
+// CHECK-EQ: "-opt-report-file" "BAR.txt"
+
Index: test/CodeGen/opt-report.c
===
--- /dev/null
+++ test/CodeGen/opt-report.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -dwarf-column-info -opt-report-file %t.lst -emit-obj
+// RUN: cat %t.lst | FileCheck %s
+// REQUIRES: x86-registered-target
+
+void bar();
+void foo() { bar(); }
+
+void Test(int *res, int *c, int *d, int *p, int n) {
+  int i;
+
+#pragma clang loop vectorize(assume_safety)
+  for (i = 0; i < 1600; i++) {
+res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
+  }
+
+// CHECK: {{[0-9]+}} | #pragma clang loop vectorize(assume_safety)
+// CHECK: {{[0-9]+}}   V |   for (i = 0; i < 1600; i++) {
+
+  for (i = 0; i < 16; i++) {
+res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
+  }
+
+  foo();
+// CHECK: {{[0-9]+}} I   |   foo();
+
+  foo(); bar(); foo();
+// CHECK: {{[0-9]+}} |   foo(); bar(); foo();
+// CHECK-NEXT:   I   |   ^
+// CHECK-NEXT:   I   | ^
+}
+
Index: lib/FrontendTool/ExecuteCompilerInvocation.cpp
===
--- lib/FrontendTool/ExecuteCompilerInvocation.cpp
+++ lib/FrontendTool/ExecuteCompilerInvocation.cpp
@@ -165,6 +165,10 @@
 Act = llvm::make_unique(std::move(Act),
 FEOpts.ASTMergeFiles);
 
+  // If an optimization report is requested, generate this after compilation.
+  if (!CI.getOptReportInfo().FileName.empty())
+Act = llvm::make_unique(std::move(Act));
+
   return Act;
 }
 
Index: lib/Frontend/OptReport.cpp
===
--- /dev/null
+++ lib/Frontend/OptReport.cpp
@@ -0,0 +1,123 @@
+//=== OptReport.cpp ---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/FrontendDiagnostic.h"
+#include "clang/Frontend/OptReport.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Format.h"
+
+using namespace clang;
+
+void OptReportAction::EndSourceFileAction() {
+  GenerateReportFile();
+  WrapperFrontendAction::EndSourceFileAction();
+}
+
+void OptReportAction::GenerateReportFile() {
+  CompilerInstance &CI = getCompilerInstance();
+  DiagnosticsEngine &Diags = CI.getDiagnostics();
+  OptReportInfo &OptReport = CI.getOptReportInfo();
+  if (OptReport.FileName.empty())
+return;
+
+  std::error_code EC;
+  llvm::raw_fd_ostream OS(OptReport.FileName, EC,
+  llvm::sys::fs::F_Text);
+  if (EC) {
+Diags.Report(diag::err_fe_error_opening) << OptReport.FileName <<
+EC.message();
+return;
+  }
+
+  SourceManager &SourceMgr = CI.getSourceManager();
+  std::set FileIDs;
+  for (auto &I : OptReport.LocationInfo)
+FileIDs.insert(SourceMgr.getFileID(I.first));
+
+  for (auto &FID : FileIDs) {
+SourceLocation FirstLoc = SourceMgr.getLocForStartOfFile(FID);
+OS << "< " << SourceMgr.getFilename(FirstLoc) << "\n";
+
+auto I = OptReport.LocationInfo.lower_bound(FirstLoc);
+StringRef MB = SourceMgr.getBufferData(FID);
+const SrcMgr::ContentCache *
+  Content = SourceMgr.getSLocEntry(FID).getFile().getContentCache();
+unsigned LNDigits = llvm::utostr(Content->NumLines).size();
+for (unsigned L = 0; L < Content->NumLines - 1; ++L) {
+  unsigned LStartOff = Content->SourceLineCache[L];
+  unsigned LEndOff = (L == Content->NumLine

Re: [PATCH] D19802: Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class that initializes itself as a base

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


Comment at: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp:342
@@ +341,3 @@
+
+// This pathological template fails to compile if actually instantiated. It
+// results in the check seeing a null RecordDecl when examining the base class

michael_miller wrote:
> Added a comment explaining why the check is there.
Thank you, the comment is excellent.


http://reviews.llvm.org/D19802



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


Re: [PATCH] D19678: Annotated-source optimization reports (a.k.a. "listing" files)

2016-05-02 Thread Hal Finkel via cfe-commits
hfinkel added a comment.

In http://reviews.llvm.org/D19678#416127, @rcox2 wrote:

> Actually, the Intel compiler distinguishes between an optimization report 
> (-qopt-report) and an annotated listing (-qopt-report-annotate).  The 
> optimization report lists the info for optimizations in a hierarchical 
> fashion.  To use you example,
>
>   icc -c -O3 -qopt-report=1 -qopt-report-file=stderr v.c 
>
> yields:


Robert, John, (et al.), do you think I should change this to have an 
-foptimization-report-file= and -foptimization-report, instead of 
-foptimization-report=? In the future, when we have multiple kinds of 
reports (a detailed inlining report, for example), maybe we want to use 
-foptimization-report=inlining,somethingelse,andmore?


http://reviews.llvm.org/D19678



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


Re: [PATCH] D19678: Annotated-source optimization reports (a.k.a. "listing" files)

2016-05-02 Thread Sean Silva via cfe-commits
On Mon, May 2, 2016 at 4:14 PM, Hal Finkel via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> hfinkel added a comment.
>
> In http://reviews.llvm.org/D19678#416127, @rcox2 wrote:
>
> > Actually, the Intel compiler distinguishes between an optimization
> report (-qopt-report) and an annotated listing (-qopt-report-annotate).
> The optimization report lists the info for optimizations in a hierarchical
> fashion.  To use you example,
> >
> >   icc -c -O3 -qopt-report=1 -qopt-report-file=stderr v.c
> >
> > yields:
>
>
> Robert, John, (et al.), do you think I should change this to have an
> -foptimization-report-file= and -foptimization-report, instead of
> -foptimization-report=? In the future, when we have multiple
> kinds of reports (a detailed inlining report, for example), maybe we want
> to use -foptimization-report=inlining,somethingelse,andmore?
>

If we have `-foptimization-report=foo,bar`, would we want them to share the
same output file? Or maybe `-foptimization-report-file=` would result
in `.foo` and `.bar` for the different reports?

-- Sean Silva


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


[PATCH] D19841: [clang-tidy] Lift common matchers to utils namespace

2016-05-02 Thread Etienne Bergeron via cfe-commits
etienneb created this revision.
etienneb added a reviewer: alexfh.
etienneb added a subscriber: cfe-commits.

This patch is lifting matchers used by more than one checkers
to the common namespace.

http://reviews.llvm.org/D19841

Files:
  clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp
  clang-tidy/modernize/UseNullptrCheck.cpp
  clang-tidy/performance/FasterStringFindCheck.cpp
  clang-tidy/readability/ImplicitBoolCastCheck.cpp
  clang-tidy/readability/RedundantStringInitCheck.cpp
  clang-tidy/utils/Matchers.h

Index: clang-tidy/utils/Matchers.h
===
--- clang-tidy/utils/Matchers.h
+++ clang-tidy/utils/Matchers.h
@@ -17,6 +17,19 @@
 namespace tidy {
 namespace matchers {
 
+AST_MATCHER_P(StringLiteral, lengthIs, unsigned, N) {
+  return Node.getLength() == N;
+}
+
+AST_MATCHER_P(Expr, ignoringImplicit,
+  ast_matchers::internal::Matcher, InnerMatcher) {
+  return InnerMatcher.matches(*Node.IgnoreImplicit(), Finder, Builder);
+}
+
+AST_MATCHER_P(CastExpr, hasCastKind, CastKind, Kind) {
+  return Node.getCastKind() == Kind;
+}
+
 AST_MATCHER(BinaryOperator, isRelationalOperator) {
   return Node.isRelationalOp();
 }
Index: clang-tidy/readability/RedundantStringInitCheck.cpp
===
--- clang-tidy/readability/RedundantStringInitCheck.cpp
+++ clang-tidy/readability/RedundantStringInitCheck.cpp
@@ -8,25 +8,16 @@
 //===--===//
 
 #include "RedundantStringInitCheck.h"
+#include "../utils/Matchers.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 
 using namespace clang::ast_matchers;
+using namespace clang::tidy::matchers;
 
 namespace clang {
 namespace tidy {
 namespace readability {
 
-namespace {
-
-AST_MATCHER(StringLiteral, lengthIsZero) { return Node.getLength() == 0; }
-
-AST_MATCHER_P(Expr, ignoringImplicit,
-  ast_matchers::internal::Matcher, InnerMatcher) {
-  return InnerMatcher.matches(*Node.IgnoreImplicit(), Finder, Builder);
-}
-
-} // namespace
-
 void RedundantStringInitCheck::registerMatchers(MatchFinder *Finder) {
   if (!getLangOpts().CPlusPlus)
 return;
@@ -45,7 +36,7 @@
   const auto EmptyStringCtorExpr =
   cxxConstructExpr(StringConstructorExpr,
   hasArgument(0, ignoringParenImpCasts(
- stringLiteral(lengthIsZero();
+ stringLiteral(lengthIs(0);
 
   const auto EmptyStringCtorExprWithTemporaries =
   expr(ignoringImplicit(
Index: clang-tidy/readability/ImplicitBoolCastCheck.cpp
===
--- clang-tidy/readability/ImplicitBoolCastCheck.cpp
+++ clang-tidy/readability/ImplicitBoolCastCheck.cpp
@@ -8,22 +8,20 @@
 //===--===//
 
 #include "ImplicitBoolCastCheck.h"
+#include "../utils/Matchers.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Lex/Lexer.h"
 
 using namespace clang::ast_matchers;
+using namespace clang::tidy::matchers;
 
 namespace clang {
 namespace tidy {
 namespace readability {
 
 namespace {
 
-AST_MATCHER_P(CastExpr, hasCastKind, CastKind, Kind) {
-  return Node.getCastKind() == Kind;
-}
-
 AST_MATCHER(Stmt, isMacroExpansion) {
   SourceManager &SM = Finder->getASTContext().getSourceManager();
   SourceLocation Loc = Node.getLocStart();
Index: clang-tidy/performance/FasterStringFindCheck.cpp
===
--- clang-tidy/performance/FasterStringFindCheck.cpp
+++ clang-tidy/performance/FasterStringFindCheck.cpp
@@ -8,12 +8,14 @@
 //===--===//
 
 #include "FasterStringFindCheck.h"
+#include "../utils/Matchers.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang::ast_matchers;
+using namespace clang::tidy::matchers;
 
 namespace clang {
 namespace tidy {
@@ -51,8 +53,6 @@
   return Result;
 }
 
-AST_MATCHER(StringLiteral, lengthIsOne) { return Node.getLength() == 1; }
-
 AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher,
  hasSubstitutedType) {
   return hasType(qualType(anyOf(substTemplateTypeParmType(),
@@ -79,7 +79,7 @@
 return;
 
   const auto SingleChar =
-  expr(ignoringParenCasts(stringLiteral(lengthIsOne()).bind("literal")));
+  expr(ignoringParenCasts(stringLiteral(lengthIs(1)).bind("literal")));
 
   const auto StringFindFunctions =
   anyOf(hasName("find"), hasName("rfind"), hasName("find_first_of"),
Index: clang-tidy/modernize/UseNullptrCheck.cpp
===
--- clang-tidy/modernize/UseNullptrCheck.cpp
+++ clang-tidy/modernize/UseNullptrCheck.cpp
@@ -8,13

Re: [PATCH] D19758: [libcxx] [test] Replace non-Standard "atomic_flag f(false); " with Standard "atomic_flag f = ATOMIC_FLAG_INIT; ".

2016-05-02 Thread Eric Fiselier via cfe-commits
EricWF commandeered this revision.
EricWF edited reviewers, added: STL_MSFT; removed: EricWF.
EricWF added a comment.

Stealing this review from STL.


http://reviews.llvm.org/D19758



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


Re: [PATCH] D19758: [libcxx] [test] Replace non-Standard "atomic_flag f(false); " with Standard "atomic_flag f; "

2016-05-02 Thread Eric Fiselier via cfe-commits
EricWF retitled this revision from "[libcxx] [test] Replace non-Standard 
"atomic_flag f(false);" with Standard "atomic_flag f = ATOMIC_FLAG_INIT;"." to 
"[libcxx] [test] Replace non-Standard "atomic_flag f(false);" with Standard 
"atomic_flag f;" ".
EricWF updated the summary for this revision.
EricWF updated this revision to Diff 55920.
EricWF added a comment.

@STL_MSFT Does this work for you? I simply removed the initializer and call the 
default constructor instead. This leaves 'f' in an unspecified state but that 
shouldn't matter because we always call 'f.test_and_set()' before testing the 
clear operation.


http://reviews.llvm.org/D19758

Files:
  include/atomic
  test/libcxx/atomics/atomics.flag/init_bool.pass.cpp
  test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp
  test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
  test/std/atomics/atomics.flag/clear.pass.cpp
  test/std/atomics/atomics.flag/init03.pass.cpp

Index: test/std/atomics/atomics.flag/init03.pass.cpp
===
--- test/std/atomics/atomics.flag/init03.pass.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-//
-// UNSUPPORTED: libcpp-has-no-threads
-
-// 
-
-// struct atomic_flag
-
-// TESTING EXTENSION atomic_flag(bool)
-
-#include 
-#include 
-
-int main()
-{
-std::atomic_flag f(false);
-assert(f.test_and_set() == 0);
-}
Index: test/std/atomics/atomics.flag/clear.pass.cpp
===
--- test/std/atomics/atomics.flag/clear.pass.cpp
+++ test/std/atomics/atomics.flag/clear.pass.cpp
@@ -22,49 +22,49 @@
 int main()
 {
 {
-std::atomic_flag f(false);
+std::atomic_flag f;
 f.test_and_set();
 f.clear();
 assert(f.test_and_set() == 0);
 }
 {
-std::atomic_flag f(false);
+std::atomic_flag f;
 f.test_and_set();
 f.clear(std::memory_order_relaxed);
 assert(f.test_and_set() == 0);
 }
 {
-std::atomic_flag f(false);
+std::atomic_flag f;
 f.test_and_set();
 f.clear(std::memory_order_release);
 assert(f.test_and_set() == 0);
 }
 {
-std::atomic_flag f(false);
+std::atomic_flag f;
 f.test_and_set();
 f.clear(std::memory_order_seq_cst);
 assert(f.test_and_set() == 0);
 }
 {
-volatile std::atomic_flag f(false);
+volatile std::atomic_flag f;
 f.test_and_set();
 f.clear();
 assert(f.test_and_set() == 0);
 }
 {
-volatile std::atomic_flag f(false);
+volatile std::atomic_flag f;
 f.test_and_set();
 f.clear(std::memory_order_relaxed);
 assert(f.test_and_set() == 0);
 }
 {
-volatile std::atomic_flag f(false);
+volatile std::atomic_flag f;
 f.test_and_set();
 f.clear(std::memory_order_release);
 assert(f.test_and_set() == 0);
 }
 {
-volatile std::atomic_flag f(false);
+volatile std::atomic_flag f;
 f.test_and_set();
 f.clear(std::memory_order_seq_cst);
 assert(f.test_and_set() == 0);
Index: test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
===
--- test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
+++ test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
@@ -22,37 +22,37 @@
 int main()
 {
 {
-std::atomic_flag f(false);
+std::atomic_flag f;
 f.test_and_set();
 atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
 assert(f.test_and_set() == 0);
 }
 {
-std::atomic_flag f(false);
+std::atomic_flag f;
 f.test_and_set();
 atomic_flag_clear_explicit(&f, std::memory_order_release);
 assert(f.test_and_set() == 0);
 }
 {
-std::atomic_flag f(false);
+std::atomic_flag f;
 f.test_and_set();
 atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
 assert(f.test_and_set() == 0);
 }
 {
-volatile std::atomic_flag f(false);
+volatile std::atomic_flag f;
 f.test_and_set();
 atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
 assert(f.test_and_set() == 0);
 }
 {
-volatile std::atomic_flag f(false);
+volatile std::atomic_flag f;
 f.test_and_set();
 atomic_flag_clear_explicit(&f, std::memory_order_release);
 assert(f.test_and_set() == 0);
 }
 {
-volatile std:

  1   2   >