Re: [PATCH] D12052: [X86][SSE] Add _mm_undefined_* intrinsics

2015-08-19 Thread Simon Pilgrim via cfe-commits
RKSimon updated this revision to Diff 32514.
RKSimon added a comment.

Added ia32 builtin undef intrinsics (I didn't bother with the mmx as I can't 
find any evidence of an undefined intrinsic for it). Added the avx512 
intrinsics referenced in the intel intrinsics guide.

Technically there's nothing stopping us making these builtin more general (non 
x86 specific) - I don't know if people want us to go that way though?

I'll make the tests more explicit once we're happy that this is the way to go.


Repository:
  rL LLVM

http://reviews.llvm.org/D12052

Files:
  include/clang/Basic/BuiltinsX86.def
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/avx512fintrin.h
  lib/Headers/avxintrin.h
  lib/Headers/emmintrin.h
  lib/Headers/xmmintrin.h
  test/CodeGen/sse-undefined.c

Index: test/CodeGen/sse-undefined.c
===
--- test/CodeGen/sse-undefined.c
+++ test/CodeGen/sse-undefined.c
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -o - | not grep "xmm"
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -o - | not grep "ymm"
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -o - | not grep "zmm"
+
+// Don't include mm_malloc.h, it's system specific.
+#define __MM_MALLOC_H
+
+#include 
+
+__m128 test_mm_undefined_ps() {
+  return _mm_undefined_ps();
+}
+
+__m128d test_mm_undefined_pd() {
+  return _mm_undefined_pd();
+}
+
+__m128i test_mm_undefined_si128() {
+  return _mm_undefined_si128();
+}
+
+__m256 test_mm256_undefined_ps() {
+  return _mm256_undefined_ps();
+}
+
+__m256d test_mm256_undefined_pd() {
+  return _mm256_undefined_pd();
+}
+
+__m256i test_mm256_undefined_si256() {
+  return _mm256_undefined_si256();
+}
+
+__m512 test_mm512_undefined() {
+  return _mm512_undefined();
+}
+
+__m512 test_mm512_undefined_ps() {
+  return _mm512_undefined_ps();
+}
+
+__m512d test_mm512_undefined_pd() {
+  return _mm512_undefined_pd();
+}
+
+__m512i test_mm512_undefined_epi32() {
+  return _mm512_undefined_epi32();
+}
+
Index: lib/Headers/xmmintrin.h
===
--- lib/Headers/xmmintrin.h
+++ lib/Headers/xmmintrin.h
@@ -577,6 +577,12 @@
 }
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_undefined_ps()
+{
+  return (__m128)__builtin_ia32_undef128();
+}
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
 _mm_set_ss(float __w)
 {
   return (__m128){ __w, 0, 0, 0 };
Index: lib/Headers/emmintrin.h
===
--- lib/Headers/emmintrin.h
+++ lib/Headers/emmintrin.h
@@ -523,6 +523,12 @@
 }
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_undefined_pd()
+{
+  return (__m128d)__builtin_ia32_undef128();
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
 _mm_set_sd(double __w)
 {
   return (__m128d){ __w, 0 };
@@ -1116,6 +1122,12 @@
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
+_mm_undefined_si128()
+{
+  return (__m128i)__builtin_ia32_undef128();
+}
+
+static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_set_epi64x(long long q1, long long q0)
 {
   return (__m128i){ q0, q1 };
Index: lib/Headers/avxintrin.h
===
--- lib/Headers/avxintrin.h
+++ lib/Headers/avxintrin.h
@@ -900,6 +900,24 @@
 }
 
 /* Create vectors */
+static __inline__ __m256d __DEFAULT_FN_ATTRS
+_mm256_undefined_pd()
+{
+  return (__m256d)__builtin_ia32_undef256();
+}
+
+static __inline__ __m256 __DEFAULT_FN_ATTRS
+_mm256_undefined_ps()
+{
+  return (__m256)__builtin_ia32_undef256();
+}
+
+static __inline__ __m256i __DEFAULT_FN_ATTRS
+_mm256_undefined_si256()
+{
+  return (__m256i)__builtin_ia32_undef256();
+}
+
 static __inline __m256d __DEFAULT_FN_ATTRS
 _mm256_set_pd(double __a, double __b, double __c, double __d)
 {
Index: lib/Headers/avx512fintrin.h
===
--- lib/Headers/avx512fintrin.h
+++ lib/Headers/avx512fintrin.h
@@ -57,6 +57,30 @@
   return (__m512i)(__v8di){ 0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_undefined_pd()
+{
+  return (__m512d)__builtin_ia32_undef512();
+}
+
+static __inline__ __m512 __DEFAULT_FN_ATTRS
+_mm512_undefined()
+{
+  return (__m512)__builtin_ia32_undef512();
+}
+
+static __inline__ __m512 __DEFAULT_FN_ATTRS
+_mm512_undefined_ps()
+{
+  return (__m512)__builtin_ia32_undef512();
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_undefined_epi32()
+{
+  return (__m512i)__builtin_ia32_undef512();
+}
+
 static __inline __m512i __DEFAULT_FN_ATTRS
 _mm512_maskz_set1_epi32(__mmask16 __M, int __A)
 {
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -6090,6 +6090,10 @@
 Value *F = CGM.getIntrinsic(Intrinsic::prefetch);
 return Builder.CreateCall(F, {Address, RW, Locality, Data});
   }
+  case X86::BI__builtin_ia32_undef128:
+  case X86::BI__builtin_ia3

Re: [PATCH] D9286: Insert override at the same line as the end of the function declaration

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Looks good. Thanks for the fix!


Repository:
  rL LLVM

http://reviews.llvm.org/D9286



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


Re: [PATCH] D12076: Add loop-convert check to clang-tidy.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Awesome! Thanks for converting this to a clang-tidy check!

I'll submit the patch for you.


http://reviews.llvm.org/D12076



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


Re: [PATCH] D12076: Add loop-convert check to clang-tidy.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh closed this revision.
alexfh added a comment.

Committed revision 245427.


http://reviews.llvm.org/D12076



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


Re: [PATCH] D11781: Refactored pthread usage in libcxx

2015-08-19 Thread Fulvio Esposito via cfe-commits
espositofulvio added a comment.

In http://reviews.llvm.org/D11781#227446, @EricWF wrote:

> This patch has a long way to go but it has also come a long way. Here are a 
> couple of problems I see with it.
>
> 2. This patch adds a lot of headers. libc++ has historically tried to keep 
> the number of headers to a minimum for the reason that filesystem operations 
> are expensive and its cheaper to include a few big headers as opposed to many 
> small ones.


I know but it was a request from reviewers so that platform specific decision 
were localized. I can obviously merge all of the support/mutex.h, 
support/thread.h and support/condition_variable.h in a single support/thread.h 
if that's the case.



Comment at: include/type_traits:222
@@ -221,3 +221,3 @@
 
-template 
-struct __identity { typedef _Tp type; };
+template 
+struct __identity { typedef T type; };

EricWF wrote:
> This change seems to have snuck in.
Yes, and actually I'm not sure how it did as it's something I haven't touched. 
Unfortunately I don't have time before later next week to address all the 
issues.


Comment at: src/algorithm.cpp:51
@@ -50,3 +50,3 @@
 #ifndef _LIBCPP_HAS_NO_THREADS
-static pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER;
+static mutex __rs_mut;
 #endif

EricWF wrote:
> I think this prevents __rs_mut from being initialized during constant 
> initialization. 
> (http://en.cppreference.com/w/cpp/language/constant_initialization)
I think this falls in the second case:

Static or thread-local object of class type that is initialized by a 
constructor call, if the constructor is constexpr and all constructor arguments 
(including implicit conversions) are constant expressions, and if the 
initializers in the constructor's initializer list and the brace-or-equal 
initializers of the class memebers only contain constant expressions.

but I was actually relying on the fact that we have constexpr, which now I 
understand could not be the case.


Comment at: src/memory.cpp:130
@@ -129,3 +129,1 @@
 static const std::size_t __sp_mut_count = 16;
-static pthread_mutex_t mut_back_imp[__sp_mut_count] =
-{

EricWF wrote:
> I have no idea what is going on here. Do you understand what this code was 
> trying to do?
My understanding is that this is trying to init the array during constant 
initialization and later relying on the internal layout of std::mutex to be 
equal to a pthread_mutex_t to cast it and use it as a std::mutex.

from cppreference:
Static or thread-local object (not necessarily of class type), that is not 
initialized by a constructor call, if the object is value-initialized or if 
every expression in its initializer is a constant expression.

Again, I think my change should be ok as long as constexpr is available, but I 
could be wrong.


Repository:
  rL LLVM

http://reviews.llvm.org/D11781



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


Re: [PATCH] D11781: Refactored pthread usage in libcxx

2015-08-19 Thread Fulvio Esposito via cfe-commits
espositofulvio added inline comments.


Comment at: include/__mutex_base:36
@@ -35,3 +37,3 @@
 #else
- mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
 #endif

EricWF wrote:
> Why was the cast insignificant?
The cast was significant, but it's not needed anymore. 
PTHREAD_MUTEX_INITIALIZER can be only used in initialization expression, not 
regular assignment and that's why there was the cast. But now I'm assigning an 
already-initialized mutex:

_LIBCPP_CONSTEXPR pthread_mutex_t __os_mutex_init = PTHREAD_MUTEX_INITIALIZER;

thus the cast is not needed anymore.


Repository:
  rL LLVM

http://reviews.llvm.org/D11781



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


Re: [PATCH] D12052: [X86][SSE] Add _mm_undefined_* intrinsics

2015-08-19 Thread Michael Kuperstein via cfe-commits
mkuper added a comment.

I think this is slightly less elegant than having a generic builtin, but I'm 
just fine with it, especially if David/Eric prefer it to the generic version.


Repository:
  rL LLVM

http://reviews.llvm.org/D12052



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


Re: [PATCH] D12052: [X86][SSE] Add _mm_undefined_* intrinsics

2015-08-19 Thread Michael Kuperstein via cfe-commits
mkuper added a comment.

Actually, thinking about it a bit more, a generic builtin most probably won't 
be more elegant.
LGTM.


Repository:
  rL LLVM

http://reviews.llvm.org/D12052



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


Re: [PATCH] D12081: Add use-nullptr check to clang-tidy.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Sorry for the delay. Here are some more comments.



Comment at: clang-tidy/modernize/ModernizeTidyModule.cpp:33
@@ -30,2 +32,3 @@
 Opts["modernize-pass-by-value.IncludeStyle"] = "llvm"; // Also: "google".
+Opts["modernize-use-nullptr.UserNullMacros"] = "reasonable";
 return Options;

"reasonable"? ;)


Comment at: clang-tidy/modernize/UseNullptrCheck.cpp:80
@@ +79,3 @@
+  if (isAlphanumeric(*FullSourceLoc(PreviousLocation, SM).getCharacterData())) 
{
+Check.diag(Range.getBegin(), "use nullptr")
+<< FixItHint::CreateReplacement(Range, " nullptr");

The two statements differ only in the replacement string. I'd write this 
instead:
  bool NeedsSpace = isAlphanumeric(*FullSourceLoc(PreviousLocation, 
SM).getCharacterData());
  Check.diag(...) << FixItHint::CreateReplacement(Range, NeedsSpace ? " 
nullptr" : "nullptr");



Comment at: clang-tidy/modernize/UseNullptrCheck.cpp:250
@@ +249,3 @@
+  return skipSubTree();
+} // If NullTo(Member)Pointer cast.
+

Please reverse the condition and use an early return.


Comment at: clang-tidy/modernize/UseNullptrCheck.cpp:292
@@ +291,3 @@
+
+if (ArgUsageVisitor.foundInvalid())
+  return false;

nit: `return !ArgUsageVisitor.foundInvalid();`


Comment at: clang-tidy/modernize/UseNullptrCheck.cpp:313
@@ +312,3 @@
+// Find the location of the immediate macro expansion.
+while (1) {
+  std::pair LocInfo = SM.getDecomposedLoc(ArgLoc);

`while (true)`


Comment at: clang-tidy/modernize/UseNullptrCheck.cpp:376
@@ +375,3 @@
+if (Loc.isFileID()) {
+  if (Loc == TestMacroLoc) {
+// Match made.

Replace this with `return Loc == TestMacroLoc;`.


Comment at: clang-tidy/modernize/UseNullptrCheck.cpp:390
@@ +389,3 @@
+  MacroLoc = SM.getImmediateExpansionRange(Loc).first;
+  if (MacroLoc.isFileID() && MacroLoc == TestMacroLoc)
+// Match made.

nit: Please add braces.


Comment at: clang-tidy/modernize/UseNullptrCheck.cpp:394
@@ +393,3 @@
+
+  Loc = Expansion.getSpellingLoc();
+  Loc = Expansion.getSpellingLoc().getLocWithOffset(LocInfo.second);

wat


Comment at: clang-tidy/modernize/UseNullptrCheck.cpp:396
@@ +395,3 @@
+  Loc = Expansion.getSpellingLoc().getLocWithOffset(LocInfo.second);
+  if (Loc.isFileID())
+// If we made it this far without finding a match, there is no match to

nit: Please add braces.


Comment at: clang-tidy/modernize/UseNullptrCheck.cpp:442
@@ +441,3 @@
+  Start = Parent;
+} while (1);
+

`while (true)`


Comment at: test/clang-tidy/modernize-use-nullptr-basic.cpp:2
@@ +1,3 @@
+// RUN: $(dirname %s)/check_clang_tidy.sh %s modernize-use-nullptr %t -- \
+// -std=c++98 -Wno-non-literal-null-conversion
+// REQUIRES: shell

Please either merge these lines or add `RUN:   ` (with three spaces to make the 
continuation line indented) before `-std...`.


Comment at: test/clang-tidy/modernize-use-nullptr-basic.cpp:328
@@ +327,3 @@
+
+// FIXME
+template

Please expand the comment explaining what this FIXME is about.


Comment at: test/clang-tidy/modernize-use-nullptr.cpp:1
@@ +1,2 @@
+// RUN:   $(dirname %s)/check_clang_tidy.sh %s modernize-use-nullptr %t \
+// RUN:   -config="{CheckOptions: [{key: modernize-use-nullptr.UserNullMacros, 
value: 'MY_NULL'}]}" \

The first line should not be indented. The purpose of indentation here is to 
show that the other lines relate to the same command. Sorry if I was unclear.


Comment at: test/clang-tidy/modernize-use-nullptr.cpp:4
@@ +3,3 @@
+// RUN:   -- -std=c++11
+
+// REQUIRES: shell

nit: Please remove the empty line.


http://reviews.llvm.org/D12081



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


Re: [PATCH] D10933: Add new IdentifierNaming check

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Another couple of comments (fine for a follow-up).



Comment at: test/clang-tidy/readability-identifier-naming.cpp:72
@@ +71,3 @@
+
+namespace FOO_NS {
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: invalid case style for namespace 
'FOO_NS' [readability-identifier-naming]

Please add a test (with a CHECK-FIXES or a FIXME) for the usages of a namespace 
in qualified names (e.g. ::foo_ns::inline_namespace::my_enumeration).


Comment at: test/clang-tidy/readability-identifier-naming.cpp:209
@@ +208,3 @@
+// CHECK-FIXES: {{^}}class AAbstractClass {{{$}}
+virtual ~abstract_class() = 0;
+virtual void VIRTUAL_METHOD();

Add a FIXME or a CHECK-FIXES for the class name in destructor.


http://reviews.llvm.org/D10933



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


Re: [PATCH] D11361: [OpenMP] Target directive host codegen

2015-08-19 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.


Comment at: lib/CodeGen/CGExpr.cpp:1969-1970
@@ -1945,4 +1968,4 @@
 else
-  return EmitCapturedFieldLValue(*this, CapturedStmtInfo->lookup(VD),
- CapturedStmtInfo->getContextValue());
+  return EmitCapturedValue(*this, CapturedStmtInfo->lookup(VD),
+   CapturedStmtInfo->getContextValue());
   }

Instead I would do the same thing I did for tasks.
Generate captured function as is. But also create the second function with the 
profile required for target codegen. This function must gather all its 
parameters into a single record and then call auto generated captured function. 
This captured function must be marked as AlwaysInline.
In this case you don't need to make some additional changes in Sema for 
particular processing of target directives, you will just need to generate 
simple function in codegen.
This may result in a little bit slower performance, but we may improve it 
later, when we have time to improve codegen for outlined functions for 
CapturedDecls.
I don't like the idea of reinventing of features, that are invented already, 
like capturing of VLAs, exposing some private functions (like getVLASizeMap()) 
etc.
so the code would be like this:
```
void .omp_outlined.(%captures *ptr) always_inline {
 ;
}
void .target_omp_outlined.(int* a, float* b, ...) {
  %captures rec;
  rec.a_ref = a;
  rec.b_ref = b;
  ...
  .omp_outlined.(&rec);
}
```


Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3065
@@ +3064,3 @@
+  QualType SizeArrayType = CGF.getContext().getConstantArrayType(
+  CGF.getContext().getIntTypeForBitwidth(64, /*Signed=*/true),
+  PointerNumAP, ArrayType::Normal, /*IndexTypeQuals=*/0);

Maybe CGF.getContext().getSizeType()?


Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3163
@@ +3162,3 @@
+OffloadingArgs);
+  auto Error = CGF.Builder.CreateICmpNE(Return, CGF.Builder.getInt32(0));
+  CGF.Builder.CreateCondBr(Error, OffloadFailBlock, ContBlock);

CGF.Builder.CreateIsNotNull()?


Comment at: test/OpenMP/target_codegen.cpp:1-3
@@ +1,4 @@
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple 
powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+// expected-no-diagnostics

It would be good to see the tests for 32 bit target.


http://reviews.llvm.org/D11361



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


[PATCH] D12143: [X86][AVX2] Replace avx2.pbroadcast / avx2.vbroadcast intrinsics usage in avx2intrin.h with __builtin_shufflevector

2015-08-19 Thread Simon Pilgrim via cfe-commits
RKSimon created this revision.
RKSimon added reviewers: qcolombet, craig.topper, ab, spatel, silvas.
RKSimon added a subscriber: cfe-commits.
RKSimon set the repository for this revision to rL LLVM.

Sister patch to D10555

As discussed on D10555, this patch replaces the use of the avx2.vbroadcast 
(float) and avx2.pbroadcast (integer) broadcast intrinsics in avx2intrin.h with 
generic __builtin_shufflevector calls.

At present all these changes still result in the expected 
vbroadcast/vpbroadcast instructions in debug code. I can add a test that 
ensures this if people wish but the conclusion on the discussion thread was 
that this shouldn't be considered vital.

Repository:
  rL LLVM

http://reviews.llvm.org/D12143

Files:
  lib/Headers/avx2intrin.h
  test/CodeGen/avx2-builtins.c

Index: test/CodeGen/avx2-builtins.c
===
--- test/CodeGen/avx2-builtins.c
+++ test/CodeGen/avx2-builtins.c
@@ -607,7 +607,9 @@
 }
 
 __m128 test_mm_broadcastss_ps(__m128 a) {
-  // CHECK: @llvm.x86.avx2.vbroadcast.ss.ps
+  // CHECK-LABEL: test_mm_broadcastss_ps
+  // CHECK-NOT: @llvm.x86.avx2.vbroadcast.ss.ps
+  // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> zeroinitializer
   return _mm_broadcastss_ps(a);
 }
 
@@ -617,12 +619,16 @@
 }
 
 __m256 test_mm256_broadcastss_ps(__m128 a) {
-  // CHECK: @llvm.x86.avx2.vbroadcast.ss.ps.256
+  // CHECK-LABEL: test_mm256_broadcastss_ps
+  // CHECK-NOT: @llvm.x86.avx2.vbroadcast.ss.ps.256
+  // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <8 x i32> zeroinitializer
   return _mm256_broadcastss_ps(a);
 }
 
 __m256d test_mm256_broadcastsd_pd(__m128d a) {
-  // check: @llvm.x86.avx2.vbroadcast.sd.pd.256
+  // CHECK-LABEL: test_mm256_broadcastsd_pd
+  // CHECK-NOT: @llvm.x86.avx2.vbroadcast.sd.pd.256
+  // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <4 x i32> zeroinitializer
   return _mm256_broadcastsd_pd(a);
 }
 
@@ -646,42 +652,58 @@
 }
 
 __m256i test_mm256_broadcastb_epi8(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastb.256
+  // CHECK-LABEL: test_mm256_broadcastb_epi8
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastb.256
+  // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <32 x i32> zeroinitializer
   return _mm256_broadcastb_epi8(a);
 }
 
 __m256i test_mm256_broadcastw_epi16(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastw.256
+  // CHECK-LABEL: test_mm256_broadcastw_epi16
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastw.256
+  // CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <16 x i32> zeroinitializer
   return _mm256_broadcastw_epi16(a);
 }
 
 __m256i test_mm256_broadcastd_epi32(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastd.256
+  // CHECK-LABEL: test_mm256_broadcastd_epi32
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastd.256
+  // CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <8 x i32> zeroinitializer
   return _mm256_broadcastd_epi32(a);
 }
 
 __m256i test_mm256_broadcastq_epi64(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastq.256
+  // CHECK-LABEL: test_mm256_broadcastq_epi64
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastq.256
+  // CHECK: shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <4 x i32> zeroinitializer
   return _mm256_broadcastq_epi64(a);
 }
 
 __m128i test_mm_broadcastb_epi8(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastb.128
+  // CHECK-LABEL: test_mm_broadcastb_epi8
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastb.128
+  // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i32> zeroinitializer
   return _mm_broadcastb_epi8(a);
 }
 
 __m128i test_mm_broadcastw_epi16(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastw.128
+  // CHECK-LABEL: test_mm_broadcastw_epi16
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastw.128
+  // CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i32> zeroinitializer
   return _mm_broadcastw_epi16(a);
 }
 
 __m128i test_mm_broadcastd_epi32(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastd.128
+  // CHECK-LABEL: test_mm_broadcastd_epi32
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastd.128
+  // CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> zeroinitializer
   return _mm_broadcastd_epi32(a);
 }
 
 __m128i test_mm_broadcastq_epi64(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastq.128
+  // CHECK-LABEL: test_mm_broadcastq_epi64
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastq.128
+  // CHECK: shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i32> zeroinitializer
   return _mm_broadcastq_epi64(a);
 }
 
Index: lib/Headers/avx2intrin.h
===
--- lib/Headers/avx2intrin.h
+++ lib/Headers/avx2intrin.h
@@ -760,7 +760,7 @@
 static __inline__ __m128 __DEFAULT_FN_ATTRS
 _mm_broadcastss_ps(__m128 __X)
 {
-  return (__m128)__builtin_ia32_vbroadcastss_ps((__v4sf)__X);
+  return (__m128)__builtin_shufflevector((__v4sf)__X, (__v4sf)__X, 0, 0, 0, 0);
 }
 
 static __inline__ __m128d __D

[clang-tools-extra] r245429 - [clang-tidy] Add new IdentifierNaming check

2015-08-19 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 19 06:15:36 2015
New Revision: 245429

URL: http://llvm.org/viewvc/llvm-project?rev=245429&view=rev
Log:
[clang-tidy] Add new IdentifierNaming check

This check will try to enforce coding guidelines on the identifiers naming.
It supports lower_case, UPPER_CASE, camelBack and CamelCase casing and
tries to convert from one to another if a mismatch is detected.

It also supports a fixed prefix and suffix that will be prepended or appended
to the identifiers, regardless of the casing.

Many configuration options are available, in order to be able to create
different rules for different kind of identifier. In general, the
rules are falling back to a more generic rule if the specific case is not
configured.

http://reviews.llvm.org/D10933

Patch by Beren Minor!

Added:
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.h
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp

Modified: clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt?rev=245429&r1=245428&r2=245429&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt Wed Aug 19 
06:15:36 2015
@@ -5,6 +5,7 @@ add_clang_library(clangTidyReadabilityMo
   ContainerSizeEmptyCheck.cpp
   ElseAfterReturnCheck.cpp
   FunctionSizeCheck.cpp
+  IdentifierNamingCheck.cpp
   NamedParameterCheck.cpp
   NamespaceCommentCheck.cpp
   ReadabilityTidyModule.cpp

Added: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp?rev=245429&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
(added)
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
Wed Aug 19 06:15:36 2015
@@ -0,0 +1,587 @@
+//===--- IdentifierNamingCheck.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 "IdentifierNamingCheck.h"
+
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/Format.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+#define DEBUG_TYPE "clang-tidy"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace readability {
+
+#define NAMING_KEYS(m) \
+m(Namespace) \
+m(InlineNamespace) \
+m(EnumConstant) \
+m(ConstexprVariable) \
+m(ConstantMember) \
+m(PrivateMember) \
+m(ProtectedMember) \
+m(PublicMember) \
+m(Member) \
+m(ClassConstant) \
+m(ClassMember) \
+m(GlobalConstant) \
+m(GlobalVariable) \
+m(LocalConstant) \
+m(LocalVariable) \
+m(StaticConstant) \
+m(StaticVariable) \
+m(Constant) \
+m(Variable) \
+m(ConstantParameter) \
+m(ParameterPack) \
+m(Parameter) \
+m(AbstractClass) \
+m(Struct) \
+m(Class) \
+m(Union) \
+m(Enum) \
+m(GlobalFunction) \
+m(ConstexprFunction) \
+m(Function) \
+m(ConstexprMethod) \
+m(VirtualMethod) \
+m(ClassMethod) \
+m(PrivateMethod) \
+m(ProtectedMethod) \
+m(PublicMethod) \
+m(Method) \
+m(Typedef) \
+m(TypeTemplateParameter) \
+m(ValueTemplateParameter) \
+m(TemplateTemplateParameter) \
+m(TemplateParameter) \
+
+enum StyleKind {
+#define ENUMERATE(v) SK_ ## v,
+  NAMING_KEYS(ENUMERATE)
+#undef ENUMERATE
+  SK_Count,
+  SK_Invalid
+};
+
+static StringRef const StyleNames[] = {
+#define STRINGIZE(v) #v,
+  NAMING_KEYS(STRINGIZE)
+#undef STRINGIZE
+};
+
+#undef NAMING_KEYS
+
+IdentifierNamingCheck::IdentifierNamingCheck(StringRef Name,
+ ClangTidyContext *Context)
+: ClangTidyCheck(Name, Context) {
+  auto const fromString = [](StringRef Str) {
+return llvm::StringSwitch(Str)
+.Case("lower_case", CT_LowerCase)
+.Case("UPPER_CASE", CT_UpperCase)
+.Case("camelBack", CT_CamelBack)
+.Case("CamelCase", CT_CamelCase)
+.Default(CT_AnyCase);
+  };
+
+  for (auto const &Name : StyleNames) {
+NamingStyles.push_back(
+NamingStyle(fromString(Options.get((Name + "Case").str(), "")),
+Options.get((Name + "Prefix").str()

Re: [PATCH] D10933: Add new IdentifierNaming check

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh closed this revision.
alexfh added a comment.

Committed revision 245429.


http://reviews.llvm.org/D10933



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


[PATCH] D12144: Fix 4 typos in lib/Analysis/

2015-08-19 Thread Kai Zhao via cfe-commits
loverszhaokai created this revision.
loverszhaokai added reviewers: delesley, krememek.
loverszhaokai added a subscriber: cfe-commits.

Fix 4 typos:

  "Intialize"   -> "Initialize"
  "accessable" -> "accessible"
  "modeled" ->  "modelled"

http://reviews.llvm.org/D12144

Files:
  lib/Analysis/ThreadSafetyCommon.cpp
  lib/Analysis/ThreadSafetyTIL.cpp
  lib/Analysis/UninitializedValues.cpp

Index: lib/Analysis/UninitializedValues.cpp
===
--- lib/Analysis/UninitializedValues.cpp
+++ lib/Analysis/UninitializedValues.cpp
@@ -788,7 +788,7 @@
 
 void TransferFunctions::VisitObjCMessageExpr(ObjCMessageExpr *ME) {
   // If the Objective-C message expression is an implicit no-return that
-  // is not modeled in the CFG, set the tracked dataflow values to Unknown.
+  // is not modelled in the CFG, set the tracked dataflow values to Unknown.
   if (objCNoRet.isImplicitNoReturn(ME)) {
 vals.setAllScratchValues(Unknown);
   }
Index: lib/Analysis/ThreadSafetyTIL.cpp
===
--- lib/Analysis/ThreadSafetyTIL.cpp
+++ lib/Analysis/ThreadSafetyTIL.cpp
@@ -186,8 +186,8 @@
 //
 // This sort assumes that (1) dominators have been computed, (2) there are no
 // critical edges, and (3) the entry block is reachable from the exit block
-// and no blocks are accessable via traversal of back-edges from the exit that
-// weren't accessable via forward edges from the entry.
+// and no blocks are accessible via traversal of back-edges from the exit that
+// weren't accessible via forward edges from the entry.
 int BasicBlock::topologicalFinalSort(SimpleArray& Blocks, int ID) 
{
   // Visited is assumed to have been set by the topologicalSort.  This pass
   // assumes !Visited means that we've visited this node before.
Index: lib/Analysis/ThreadSafetyCommon.cpp
===
--- lib/Analysis/ThreadSafetyCommon.cpp
+++ lib/Analysis/ThreadSafetyCommon.cpp
@@ -846,7 +846,7 @@
 
 
 void SExprBuilder::enterCFGBlock(const CFGBlock *B) {
-  // Intialize TIL basic block and add it to the CFG.
+  // Initialize TIL basic block and add it to the CFG.
   CurrentBB = lookupBlock(B);
   CurrentBB->reservePredecessors(B->pred_size());
   Scfg->add(CurrentBB);


Index: lib/Analysis/UninitializedValues.cpp
===
--- lib/Analysis/UninitializedValues.cpp
+++ lib/Analysis/UninitializedValues.cpp
@@ -788,7 +788,7 @@
 
 void TransferFunctions::VisitObjCMessageExpr(ObjCMessageExpr *ME) {
   // If the Objective-C message expression is an implicit no-return that
-  // is not modeled in the CFG, set the tracked dataflow values to Unknown.
+  // is not modelled in the CFG, set the tracked dataflow values to Unknown.
   if (objCNoRet.isImplicitNoReturn(ME)) {
 vals.setAllScratchValues(Unknown);
   }
Index: lib/Analysis/ThreadSafetyTIL.cpp
===
--- lib/Analysis/ThreadSafetyTIL.cpp
+++ lib/Analysis/ThreadSafetyTIL.cpp
@@ -186,8 +186,8 @@
 //
 // This sort assumes that (1) dominators have been computed, (2) there are no
 // critical edges, and (3) the entry block is reachable from the exit block
-// and no blocks are accessable via traversal of back-edges from the exit that
-// weren't accessable via forward edges from the entry.
+// and no blocks are accessible via traversal of back-edges from the exit that
+// weren't accessible via forward edges from the entry.
 int BasicBlock::topologicalFinalSort(SimpleArray& Blocks, int ID) {
   // Visited is assumed to have been set by the topologicalSort.  This pass
   // assumes !Visited means that we've visited this node before.
Index: lib/Analysis/ThreadSafetyCommon.cpp
===
--- lib/Analysis/ThreadSafetyCommon.cpp
+++ lib/Analysis/ThreadSafetyCommon.cpp
@@ -846,7 +846,7 @@
 
 
 void SExprBuilder::enterCFGBlock(const CFGBlock *B) {
-  // Intialize TIL basic block and add it to the CFG.
+  // Initialize TIL basic block and add it to the CFG.
   CurrentBB = lookupBlock(B);
   CurrentBB->reservePredecessors(B->pred_size());
   Scfg->add(CurrentBB);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12081: Add use-nullptr check to clang-tidy.

2015-08-19 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 32539.
angelgarcia marked 13 inline comments as done.
angelgarcia added a comment.

Fix comments.


http://reviews.llvm.org/D12081

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseNullptrCheck.cpp
  clang-tidy/modernize/UseNullptrCheck.h
  test/clang-tidy/modernize-use-nullptr-basic.cpp
  test/clang-tidy/modernize-use-nullptr.cpp

Index: test/clang-tidy/modernize-use-nullptr.cpp
===
--- test/clang-tidy/modernize-use-nullptr.cpp
+++ test/clang-tidy/modernize-use-nullptr.cpp
@@ -0,0 +1,178 @@
+// RUN: $(dirname %s)/check_clang_tidy.sh %s modernize-use-nullptr %t \
+// RUN:   -config="{CheckOptions: [{key: modernize-use-nullptr.UserNullMacros, value: 'MY_NULL'}]}" \
+// RUN:   -- -std=c++11
+// REQUIRES: shell
+
+#define NULL 0
+
+namespace std {
+
+typedef decltype(nullptr) nullptr_t;
+
+} // namespace std
+
+// Just to make sure make_null() could have side effects.
+void external();
+
+std::nullptr_t make_null() {
+  external();
+  return nullptr;
+}
+
+void func() {
+  void *CallTest = make_null();
+
+  int var = 1;
+  void *CommaTest = (var+=2, make_null());
+
+  int *CastTest = static_cast(make_null());
+}
+
+void dummy(int*) {}
+void side_effect() {}
+
+#define MACRO_EXPANSION_HAS_NULL \
+  void foo() { \
+dummy(0); \
+dummy(NULL); \
+side_effect(); \
+  }
+
+MACRO_EXPANSION_HAS_NULL;
+#undef MACRO_EXPANSION_HAS_NULL
+
+
+void test_macro_expansion1() {
+#define MACRO_EXPANSION_HAS_NULL \
+  dummy(NULL); \
+  side_effect();
+
+  MACRO_EXPANSION_HAS_NULL;
+
+#undef MACRO_EXPANSION_HAS_NULL
+}
+
+// Test macro expansion with cast sequence, PR15572.
+void test_macro_expansion2() {
+#define MACRO_EXPANSION_HAS_NULL \
+  dummy((int*)0); \
+  side_effect();
+
+  MACRO_EXPANSION_HAS_NULL;
+
+#undef MACRO_EXPANSION_HAS_NULL
+}
+
+void test_macro_expansion3() {
+#define MACRO_EXPANSION_HAS_NULL \
+  dummy(NULL); \
+  side_effect();
+
+#define OUTER_MACRO \
+  MACRO_EXPANSION_HAS_NULL; \
+  side_effect();
+
+  OUTER_MACRO;
+
+#undef OUTER_MACRO
+#undef MACRO_EXPANSION_HAS_NULL
+}
+
+void test_macro_expansion4() {
+#define MY_NULL NULL
+  int *p = MY_NULL;
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr [modernize-use-nullptr]
+  // CHECK-FIXES: int *p = nullptr;
+#undef MY_NULL
+}
+
+#define IS_EQ(x, y) if (x != y) return;
+void test_macro_args() {
+  int i = 0;
+  int *Ptr;
+
+  IS_EQ(static_cast(0), Ptr);
+  // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: use nullptr
+  // CHECK-FIXES: IS_EQ(static_cast(nullptr), Ptr);
+
+  IS_EQ(0, Ptr);// literal
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use nullptr
+  // CHECK-FIXES: IS_EQ(nullptr, Ptr);
+
+  IS_EQ(NULL, Ptr); // macro
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use nullptr
+  // CHECK-FIXES: IS_EQ(nullptr, Ptr);
+
+  // These are ok since the null literal is not spelled within a macro.
+#define myassert(x) if (!(x)) return;
+  myassert(0 == Ptr);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr
+  // CHECK-FIXES: myassert(nullptr == Ptr);
+
+  myassert(NULL == Ptr);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr
+  // CHECK-FIXES: myassert(nullptr == Ptr);
+
+  // These are bad as the null literal is buried in a macro.
+#define BLAH(X) myassert(0 == (X));
+#define BLAH2(X) myassert(NULL == (X));
+  BLAH(Ptr);
+  BLAH2(Ptr);
+
+  // Same as above but testing extra macro expansion.
+#define EXPECT_NULL(X) IS_EQ(0, X);
+#define EXPECT_NULL2(X) IS_EQ(NULL, X);
+  EXPECT_NULL(Ptr);
+  EXPECT_NULL2(Ptr);
+
+  // Almost the same as above but now null literal is not in a macro so ok
+  // to transform.
+#define EQUALS_PTR(X) IS_EQ(X, Ptr);
+  EQUALS_PTR(0);
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use nullptr
+  // CHECK-FIXES: EQUALS_PTR(nullptr);
+  EQUALS_PTR(NULL);
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use nullptr
+  // CHECK-FIXES: EQUALS_PTR(nullptr);
+
+  // Same as above but testing extra macro expansion.
+#define EQUALS_PTR_I(X) EQUALS_PTR(X)
+  EQUALS_PTR_I(0);
+  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: use nullptr
+  // CHECK-FIXES: EQUALS_PTR_I(nullptr);
+  EQUALS_PTR_I(NULL);
+  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: use nullptr
+  // CHECK-FIXES: EQUALS_PTR_I(nullptr);
+
+  // Ok since null literal not within macro. However, now testing macro
+  // used as arg to another macro.
+#define decorate(EXPR) side_effect(); EXPR;
+  decorate(IS_EQ(NULL, Ptr));
+  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: use nullptr
+  // CHECK-FIXES: decorate(IS_EQ(nullptr, Ptr));
+  decorate(IS_EQ(0, Ptr));
+  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: use nullptr
+  // CHECK-FIXES: decorate(IS_EQ(nullptr, Ptr));
+
+  // This macro causes a NullToPointer cast to happen where 0 is assigned to z
+  // but the 0 literal cannot be replaced because it is also used as an
+  // integer in the comparison.
+#define INT_AND

Re: [PATCH] D12081: Add use-nullptr check to clang-tidy.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good! I'll fix the last issue (see the comment below) and commit the 
patch for you.



Comment at: clang-tidy/modernize/UseNullptrCheck.cpp:80
@@ +79,3 @@
+  bool NeedsSpace =
+  isAlphanumeric(*FullSourceLoc(PreviousLocation, SM).getCharacterData());
+  Check.diag(Range.getBegin(), "use nullptr") << FixItHint::CreateReplacement(

`FullSourceLoc` makes things more complicated here, 
`SM.getCharacterData(PreviousLocation)` would be better and shorter.


http://reviews.llvm.org/D12081



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


Re: [PATCH] D12081: Add use-nullptr check to clang-tidy.

2015-08-19 Thread Angel Garcia via cfe-commits
angelgarcia added a comment.

Ok, thanks! :)


http://reviews.llvm.org/D12081



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


Re: [PATCH] D12081: Add use-nullptr check to clang-tidy.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh closed this revision.
alexfh added a comment.

Committed revision 245434.


http://reviews.llvm.org/D12081



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


[clang-tools-extra] r245434 - [clang-tidy] Add use-nullptr check to clang-tidy.

2015-08-19 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 19 08:13:12 2015
New Revision: 245434

URL: http://llvm.org/viewvc/llvm-project?rev=245434&view=rev
Log:
[clang-tidy] Add use-nullptr check to clang-tidy.

Move UseNullptr from clang-modernize to modernize module in clang-tidy.

http://reviews.llvm.org/D12081

Patch by Angel Garcia!

Added:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.h
clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr-basic.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp

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=245434&r1=245433&r2=245434&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt Wed Aug 19 
08:13:12 2015
@@ -5,6 +5,7 @@ add_clang_library(clangTidyModernizeModu
   LoopConvertUtils.cpp
   ModernizeTidyModule.cpp
   PassByValueCheck.cpp
+  UseNullptrCheck.cpp
 
   LINK_LIBS
   clangAST

Modified: clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp?rev=245434&r1=245433&r2=245434&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp Wed 
Aug 19 08:13:12 2015
@@ -12,6 +12,7 @@
 #include "../ClangTidyModuleRegistry.h"
 #include "LoopConvertCheck.h"
 #include "PassByValueCheck.h"
+#include "UseNullptrCheck.h"
 
 using namespace clang::ast_matchers;
 
@@ -24,6 +25,7 @@ public:
   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
 CheckFactories.registerCheck("modernize-loop-convert");
 CheckFactories.registerCheck("modernize-pass-by-value");
+CheckFactories.registerCheck("modernize-use-nullptr");
   }
 
   ClangTidyOptions getModuleOptions() override {
@@ -31,6 +33,9 @@ public:
 auto &Opts = Options.CheckOptions;
 Opts["modernize-loop-convert.MinConfidence"] = "reasonable";
 Opts["modernize-pass-by-value.IncludeStyle"] = "llvm"; // Also: "google".
+
+// Comma-separated list of user-defined macros that behave like NULL.
+Opts["modernize-use-nullptr.UserNullMacros"] = "";
 return Options;
   }
 };

Added: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=245434&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed Aug 19 
08:13:12 2015
@@ -0,0 +1,472 @@
+//===--- UseNullptrCheck.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 "UseNullptrCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
+
+using namespace clang;
+using namespace clang::ast_matchers;
+using namespace llvm;
+
+namespace clang {
+namespace tidy {
+namespace modernize {
+
+const char CastSequence[] = "sequence";
+const char NullMacroName[] = "NULL";
+
+/// \brief Matches cast expressions that have a cast kind of CK_NullToPointer
+/// or CK_NullToMemberPointer.
+///
+/// Given
+/// \code
+///   int *p = 0;
+/// \endcode
+/// implicitCastExpr(isNullToPointer()) matches the implicit cast clang adds
+/// around \c 0.
+AST_MATCHER(CastExpr, isNullToPointer) {
+  return Node.getCastKind() == CK_NullToPointer ||
+ Node.getCastKind() == CK_NullToMemberPointer;
+}
+
+AST_MATCHER(Type, sugaredNullptrType) {
+  const Type *DesugaredType = Node.getUnqualifiedDesugaredType();
+  if (const BuiltinType *BT = dyn_cast(DesugaredType))
+return BT->getKind() == BuiltinType::NullPtr;
+  return false;
+}
+
+/// \brief Create a matcher that finds implicit casts as well as the head of a
+/// sequence of zero or more nested explicit casts that have an implicit cast
+/// to null within.
+/// Finding sequences of explict casts is necessary so that an entire sequence
+/// can be replaced instead of just the inn

[PATCH] D12147: Fix typos in lib/AST

2015-08-19 Thread Kai Zhao via cfe-commits
loverszhaokai created this revision.
loverszhaokai added reviewers: gbenyei, krememek, rsmith, ABataev, majnemer.
loverszhaokai added a subscriber: cfe-commits.

Fix typos:

"modeled" ->   "modelled"
"protcol"->   "protocol"
"overriden"->   "overridden"
"endianess"  ->"endianness" 
"unmodeled" ->   "unmodelled"
"Intialize"   ->   "Initialize"

http://reviews.llvm.org/D12147

Files:
  lib/AST/ASTContext.cpp
  lib/AST/DeclObjC.cpp
  lib/AST/Expr.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/Stmt.cpp
  lib/AST/VTableBuilder.cpp

Index: lib/AST/VTableBuilder.cpp
===
--- lib/AST/VTableBuilder.cpp
+++ lib/AST/VTableBuilder.cpp
@@ -3013,7 +3013,7 @@
   }
 
   // In case we need a return adjustment, we'll add a new slot for
-  // the overrider. Mark the overriden method as shadowed by the new slot.
+  // the overrider. Mark the overridden method as shadowed by the new slot.
   OverriddenMethodInfo.Shadowed = true;
 
   // Force a special name mangling for a return-adjusting thunk
Index: lib/AST/Stmt.cpp
===
--- lib/AST/Stmt.cpp
+++ lib/AST/Stmt.cpp
@@ -38,7 +38,7 @@
   if (Initialized)
 return StmtClassInfo[E];
 
-  // Intialize the table on the first use.
+  // Initialize the table on the first use.
   Initialized = true;
 #define ABSTRACT_STMT(STMT)
 #define STMT(CLASS, PARENT) \
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -475,7 +475,7 @@
   EM_EvaluateForOverflow,
 
   /// Evaluate in any way we know how. Don't worry about side-effects that
-  /// can't be modeled.
+  /// can't be modelled.
   EM_IgnoreSideEffects,
 
   /// Evaluate as a constant expression. Stop if we find that the expression
@@ -2679,7 +2679,7 @@
   }
 
   // In C++1y, we can't safely access any mutable state when we might be
-  // evaluating after an unmodeled side effect or an evaluation failure.
+  // evaluating after an unmodelled side effect or an evaluation failure.
   //
   // FIXME: Not all local state is mutable. Allow local constant subobjects
   // to be read here (but take care with 'mutable' fields).
Index: lib/AST/Expr.cpp
===
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -967,7 +967,7 @@
 void StringLiteral::setString(const ASTContext &C, StringRef Str,
   StringKind Kind, bool IsPascal) {
   //FIXME: we assume that the string data comes from a target that uses the same
-  // code unit size and endianess for the type of string.
+  // code unit size and endianness for the type of string.
   this->Kind = Kind;
   this->IsPascal = IsPascal;
   
Index: lib/AST/DeclObjC.cpp
===
--- lib/AST/DeclObjC.cpp
+++ lib/AST/DeclObjC.cpp
@@ -1051,8 +1051,8 @@
   if (!Container)
 return;
 
-  // In categories look for overriden methods from protocols. A method from
-  // category is not "overriden" since it is considered as the "same" method
+  // In categories look for overridden methods from protocols. A method from
+  // category is not "overridden" since it is considered as the "same" method
   // (same USR) as the one from the interface.
   if (const ObjCCategoryDecl *
 Category = dyn_cast(Container)) {
Index: lib/AST/ASTContext.cpp
===
--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -1628,7 +1628,7 @@
   Align = Target->getPointerAlign(0);
   break;
 case BuiltinType::OCLSampler:
-  // Samplers are modeled as integers.
+  // Samplers are modelled as integers.
   Width = Target->getIntWidth();
   Align = Target->getIntAlign();
   break;
@@ -3743,7 +3743,7 @@
   CollectInheritedProtocols(IDecl, InheritedProtocols);
   if (InheritedProtocols.empty())
 return false;
-  // Check that if every protocol in list of id conforms to a protcol
+  // Check that if every protocol in list of id conforms to a protocol
   // of IDecl's, then bridge casting is ok.
   bool Conforms = false;
   for (auto *Proto : OPT->quals()) {
@@ -8592,7 +8592,7 @@
   ///
   /// Note that the relationship described here is purely in terms of AST
   /// traversal - there are other relationships (for example declaration context)
-  /// in the AST that are better modeled by special matchers.
+  /// in the AST that are better modelled by special matchers.
   ///
   /// FIXME: Currently only builds up the map using \c Stmt and \c Decl nodes.
   class ParentMapASTVisitor : public RecursiveASTVisitor {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r245435 - clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp: Appease targeting msvc.

2015-08-19 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Wed Aug 19 08:22:58 2015
New Revision: 245435

URL: http://llvm.org/viewvc/llvm-project?rev=245435&view=rev
Log:
clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp: Appease 
targeting msvc.

Modified:
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp?rev=245435&r1=245434&r2=245435&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp 
Wed Aug 19 08:22:58 2015
@@ -62,7 +62,7 @@
 // RUN: {key: readability-identifier-naming.VirtualMethodCase, value: 
UPPER_CASE}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodPrefix, value: 
'v_'}, \
 // RUN: {key: readability-identifier-naming.IgnoreFailedSplit, value: 0} \
-// RUN:   ]}' -- -std=c++11
+// RUN:   ]}' -- -std=c++11 -fno-delayed-template-parsing
 // REQUIRES: shell
 
 // FIXME: There should be more test cases for checking that references to class


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


[PATCH] D12148: [ARM] Allow passing/returning of __fp16 arguments

2015-08-19 Thread Oliver Stannard via cfe-commits
olista01 created this revision.
olista01 added a subscriber: cfe-commits.
olista01 set the repository for this revision to rL LLVM.
Herald added subscribers: rengolin, aemerson.

The ACLE (ARM C Language Extensions) 2.0 allows the __fp16 type to be
used as a functon argument or return type (ACLE 1.1 did not).

The current public release of the AAPCS (2.09) states that __fp16 values
should be converted to single-precision before being passed or returned,
but AAPCS 2.10 (to be released shortly) changes this, so that they are
passed in the least-significant 16 bits of either a GPR (for base AAPCS)
or a single-precision register (for AAPCS-VFP). This does not change how
arguments are passed if they get passed on the stack.

This patch brings clang up to compliance with the latest versions of
both of these specs.

We can now set the __ARM_FP16_ARGS ACLE predefine, and we have always
been able to set the __ARM_FP16_FORMAT_IEEE predefine (we do not support
the alternative format).

Repository:
  rL LLVM

http://reviews.llvm.org/D12148

Files:
  lib/Basic/Targets.cpp
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/Tools.cpp
  test/CodeGen/arm-fp16-arguments.c
  test/Preprocessor/arm-acle-6.5.c
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -5,6 +5,8 @@
 // CHECK: __ARM_FEATURE_CRC32 1
 // CHECK: __ARM_FEATURE_DIRECTED_ROUNDING 1
 // CHECK: __ARM_FEATURE_NUMERIC_MAXMIN 1
+// CHECK: __ARM_FP16_ARGS 1
+// CHECK: __ARM_FP16_FORMAT_IEEE 1
 
 // RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V7 %s
 // CHECK-V7: __ARMEL__ 1
Index: test/Preprocessor/arm-acle-6.5.c
===
--- test/Preprocessor/arm-acle-6.5.c
+++ test/Preprocessor/arm-acle-6.5.c
@@ -1,6 +1,6 @@
 // RUN: %clang -target arm-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-DEFAULT
 
-// CHECK-DEFAULT-NOT: __ARM_FP
+// CHECK-DEFAULT-NOT: __ARM_FP 0x
 
 // RUN: %clang -target arm-eabi -mfpu=vfp -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
 // RUN: %clang -target arm-eabi -mfpu=vfp3 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
Index: test/CodeGen/arm-fp16-arguments.c
===
--- /dev/null
+++ test/CodeGen/arm-fp16-arguments.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=SOFT
+// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi hard -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=HARD
+
+__fp16 g;
+
+void t1(__fp16 a) { g = a; }
+// SOFT: define void @t1(i32 [[PARAM:%.*]])
+// SOFT: [[TRUNC:%.*]] = trunc i32 [[PARAM]] to i16
+// HARD: define arm_aapcs_vfpcc void @t1(float [[PARAM:%.*]])
+// HARD: [[BITCAST:%.*]] = bitcast float [[PARAM]] to i32
+// HARD: [[TRUNC:%.*]] = trunc i32 [[BITCAST]] to i16
+// CHECK: store i16 [[TRUNC]], i16* bitcast (half* @g to i16*)
+
+__fp16 t2() { return g; }
+// SOFT: define i32 @t2()
+// HARD: define arm_aapcs_vfpcc float @t2()
+// CHECK: [[LOAD:%.*]] = load i16, i16* bitcast (half* @g to i16*)
+// CHECK: [[ZEXT:%.*]] = zext i16 [[LOAD]] to i32
+// SOFT: ret i32 [[ZEXT]]
+// HARD: [[BITCAST:%.*]] = bitcast i32 [[ZEXT]] to float
+// HARD: ret float [[BITCAST]]
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4251,7 +4251,11 @@
   }
 
   if (getToolChain().getArch() == llvm::Triple::aarch64 ||
-  getToolChain().getArch() == llvm::Triple::aarch64_be)
+  getToolChain().getArch() == llvm::Triple::aarch64_be ||
+  getToolChain().getArch() == llvm::Triple::arm ||
+  getToolChain().getArch() == llvm::Triple::armeb ||
+  getToolChain().getArch() == llvm::Triple::thumb ||
+  getToolChain().getArch() == llvm::Triple::thumbeb)
 CmdArgs.push_back("-fallow-half-arguments-and-returns");
 
   if (Arg *A = Args.getLastArg(options::OPT_mrestrict_it,
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -4714,6 +4714,15 @@
 return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
   }
 
+  // __fp16 gets passed as if it were an int or float, but with the top 32 bits
+  // unspecified.
+  if (Ty->isHalfType()) {
+llvm::Type *ResType = IsEffectivelyAAPCS_VFP ?
+  llvm::Type::getFloatTy(getVMContext()) :
+  llvm::Type::getInt32Ty(getVMContext());
+return ABIArgInfo::getDirect(ResType);
+  }
+
   if (!isAggregateTypeForABI(Ty)) {
 // Treat an enum type as i

Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Sorry for the long delay.



Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:40
@@ +39,3 @@
+  for (const auto *Ctor : CopyCtor->getParent()->ctors()) {
+if (Ctor->isMoveConstructor() &&
+Ctor->getAccess() <= AS_protected &&

clang-format?


Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:46
@@ +45,3 @@
+  //
+  // FIXME: Determine whether the move constructor is a viable candidate
+  // for the ctor-initializer, perhaps provide a fixit that suggests

This seems to be rather important to do from the beginning. Otherwise the check 
may be too noisy. BTW, did you run it over LLVM and Clang sources? Would be 
useful for some smoke testing.


Comment at: test/clang-tidy/misc-move-constructor-init.cpp:64
@@ +63,3 @@
+struct J : I {
+  // CHECK-NOT: warning:
+  J(J &&RHS) : I(RHS) {} // ok

I'd suggest using FileCheck -implicit-check-not='{{warning|error}}:' instead of 
stuffing the code with `// CHECK-NOT: warning:`. It will make the test more 
consistent with the other tests that use the clang_tidy_test.sh script.


http://reviews.llvm.org/D11784



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


[PATCH] D12152: [OPENMP] Info about OpenMP Support in Users Manual

2015-08-19 Thread Alexey Bataev via cfe-commits
ABataev created this revision.
ABataev added reviewers: hans, fraggamuffin, ejstotzer, hfinkel.
ABataev added a subscriber: cfe-commits.

http://reviews.llvm.org/D12152

Files:
  docs/UsersManual.rst

Index: docs/UsersManual.rst
===
--- docs/UsersManual.rst
+++ docs/UsersManual.rst
@@ -1852,6 +1852,32 @@
 Objective-C++ Language Features
 ===
 
+.. _openmp:
+
+OpenMP Features
+===
+
+clang fully implements all of standard OpenMP 3.1 directives and clauses + some
+features of OpenMP 4.0, including ``#pragma omp simd``,
+``#pragma omp for simd``, ``#pragma omp parallel for simd`` directives, 
extended
+set of atomic constructs, ``proc_bind`` clause for all parallel-based
+directives, ``depend`` clause for ``#pragma omp task`` directive (except for
+array sections), ``#pragma omp cancel`` and ``#pragma omp cancellation point``
+directives, and ``#pragma omp taskgroup`` directive.
+
+OpenMP support is disabled by default. Use option::`-fopenmp=libomp` to enable
+it. Support for OpenMP can be disabled with :option:`-fno-openmp`.
+
+Controlling implementation limits
+-
+
+.. option:: -fopenmp-use-tls
+
+ Controls code generation for OpenMP threadprivate variables. In presence of
+ this options all threadprivate variables are generated the same way as thread
+ local variables, using TLS support. If :option:`-fno-openmp-use-tls`
+ is provided or target does not support TLS, code generation for threadprivate
+ variables relies on OpenMP runtime library.
 
 .. _target_features:
 


Index: docs/UsersManual.rst
===
--- docs/UsersManual.rst
+++ docs/UsersManual.rst
@@ -1852,6 +1852,32 @@
 Objective-C++ Language Features
 ===
 
+.. _openmp:
+
+OpenMP Features
+===
+
+clang fully implements all of standard OpenMP 3.1 directives and clauses + some
+features of OpenMP 4.0, including ``#pragma omp simd``,
+``#pragma omp for simd``, ``#pragma omp parallel for simd`` directives, extended
+set of atomic constructs, ``proc_bind`` clause for all parallel-based
+directives, ``depend`` clause for ``#pragma omp task`` directive (except for
+array sections), ``#pragma omp cancel`` and ``#pragma omp cancellation point``
+directives, and ``#pragma omp taskgroup`` directive.
+
+OpenMP support is disabled by default. Use option::`-fopenmp=libomp` to enable
+it. Support for OpenMP can be disabled with :option:`-fno-openmp`.
+
+Controlling implementation limits
+-
+
+.. option:: -fopenmp-use-tls
+
+ Controls code generation for OpenMP threadprivate variables. In presence of
+ this options all threadprivate variables are generated the same way as thread
+ local variables, using TLS support. If :option:`-fno-openmp-use-tls`
+ is provided or target does not support TLS, code generation for threadprivate
+ variables relies on OpenMP runtime library.
 
 .. _target_features:
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [Diffusion] rL245435: clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp: Appease…

2015-08-19 Thread NAKAMURA Takumi via cfe-commits
chapuni added a subscriber: cfe-commits.
chapuni added a comment.

Targeting msvc (-triple *-win32) implies a few -f options.
You can reproduce the failure with -fdelayed-template-parsing, or -triple 
i686-win32.

Eyes might be increased if python version of check_clang_tidy.sh were 
introduced.
For now, just only my cross builder, --host=linux --target=x86_64-win32, can 
catch issues targeting msvc.


Users:
  chapuni (Author)

http://reviews.llvm.org/rL245435



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


Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-19 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:40
@@ +39,3 @@
+  for (const auto *Ctor : CopyCtor->getParent()->ctors()) {
+if (Ctor->isMoveConstructor() &&
+Ctor->getAccess() <= AS_protected &&

alexfh wrote:
> clang-format?
I thought the current formatting was an improvement over what clang-format 
produces (for those of us with debuggers that aren't as good at subexpression 
highlighting). I'm fine either way, though.


Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:46
@@ +45,3 @@
+  //
+  // FIXME: Determine whether the move constructor is a viable candidate
+  // for the ctor-initializer, perhaps provide a fixit that suggests

alexfh wrote:
> This seems to be rather important to do from the beginning. Otherwise the 
> check may be too noisy. BTW, did you run it over LLVM and Clang sources? 
> Would be useful for some smoke testing.
In order to do that, I would need access to more parts of Sema. The check, as 
it currently stands, is fairly reasonable from what I can tell. The false 
positive rate appears to be low. I ran it over Clang and LLVM and it did point 
out one debatably-true-positive (which we've since resolved) with no 
false-positives. In testing other code bases, the diagnostic was not chatty, 
but perhaps they did not make heavy use of move semantics.


Comment at: test/clang-tidy/misc-move-constructor-init.cpp:64
@@ +63,3 @@
+struct J : I {
+  // CHECK-NOT: warning:
+  J(J &&RHS) : I(RHS) {} // ok

alexfh wrote:
> I'd suggest using FileCheck -implicit-check-not='{{warning|error}}:' instead 
> of stuffing the code with `// CHECK-NOT: warning:`. It will make the test 
> more consistent with the other tests that use the clang_tidy_test.sh script.
Can do (though I am explicitly not using clang_tidy_test.sh because I am 
working on Windows and all those tests are currently disabled due to REQUIRES: 
shell :-()


http://reviews.llvm.org/D11784



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


Re: [PATCH] D11845: Properly pass through the PIC mode to the integrated assembler when doing assembly-only, and unify the Driver's PIC argument parsing.

2015-08-19 Thread James Y Knight via cfe-commits
jyknight added a comment.

Joerg said LGTM on #llvm; going ahead with commit.


http://reviews.llvm.org/D11845



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


r245445 - [ARM] Proper generic cpus handling

2015-08-19 Thread Vladimir Sukharev via cfe-commits
Author: vsukharev
Date: Wed Aug 19 09:50:18 2015
New Revision: 245445

URL: http://llvm.org/viewvc/llvm-project?rev=245445&view=rev
Log:
[ARM] Proper generic cpus handling

"generic" cpu was wrongly handled as exact real CPU name of ARMv8.1A 
architecture.

This has been fixed, now it is abstract name, suitable for any arch.

Reviewers: rengolin

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/arm-cortex-cpus.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245445&r1=245444&r2=245445&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Aug 19 09:50:18 2015
@@ -4257,21 +4257,18 @@ class ARMTargetInfo : public TargetInfo
 ArchISA= llvm::ARMTargetParser::parseArchISA(ArchName);
 DefaultCPU = getDefaultCPU(ArchName);
 
-// SubArch is specified by the target triple
-if (!DefaultCPU.empty()) 
-  setArchInfo(DefaultCPU);
-else 
-  // FIXME ArchInfo should be based on ArchName from triple, not on 
-  // a hard-coded CPU name. Doing so currently causes regressions:
-  // test/Preprocessor/init.c: __ARM_ARCH_6J__ not defined
-  setArchInfo(CPU);
+unsigned ArchKind = llvm::ARMTargetParser::parseArch(ArchName);
+if (ArchKind == llvm::ARM::AK_INVALID)
+  // set arch of the CPU, either provided explicitly or hardcoded default
+  ArchKind = llvm::ARMTargetParser::parseCPUArch(CPU);
+setArchInfo(ArchKind);
   }
 
-  void setArchInfo(StringRef CPU) {
+  void setArchInfo(unsigned Kind) {
 StringRef SubArch;
 
 // cache TargetParser info
-ArchKind= llvm::ARMTargetParser::parseCPUArch(CPU);
+ArchKind= Kind;
 SubArch = llvm::ARMTargetParser::getSubArch(ArchKind);
 ArchProfile = llvm::ARMTargetParser::parseArchProfile(SubArch);
 ArchVersion = llvm::ARMTargetParser::parseArchVersion(SubArch);
@@ -4570,10 +4567,11 @@ public:
   }
 
   bool setCPU(const std::string &Name) override {
-unsigned ArchKind = llvm::ARMTargetParser::parseCPUArch(Name);
+if (Name != "generic")
+  setArchInfo(llvm::ARMTargetParser::parseCPUArch(Name));
+
 if (ArchKind == llvm::ARM::AK_INVALID)
   return false;
-setArchInfo(Name);
 setAtomic();
 CPU = Name;
 return true;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=245445&r1=245444&r2=245445&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug 19 09:50:18 2015
@@ -6002,9 +6002,9 @@ std::string arm::getARMTargetCPU(StringR
 /// CPU  (or Arch, if CPU is generic).
 // FIXME: This is redundant with -mcpu, why does LLVM use this.
 const char *arm::getLLVMArchSuffixForARM(StringRef CPU, StringRef Arch) {
-  if (CPU == "generic" &&
-  llvm::ARMTargetParser::parseArch(Arch) == llvm::ARM::AK_ARMV8_1A)
-return "v8.1a";
+  if (CPU == "generic")
+return llvm::ARMTargetParser::getSubArch(
+llvm::ARMTargetParser::parseArch(Arch));
 
   unsigned ArchKind = llvm::ARMTargetParser::parseCPUArch(CPU);
   if (ArchKind == llvm::ARM::AK_INVALID)

Modified: cfe/trunk/test/Driver/arm-cortex-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-cortex-cpus.c?rev=245445&r1=245444&r2=245445&view=diff
==
--- cfe/trunk/test/Driver/arm-cortex-cpus.c (original)
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c Wed Aug 19 09:50:18 2015
@@ -134,6 +134,18 @@
 // RUN: %clang -target arm -mlittle-endian -march=armv8-a -mlittle-endian -### 
-c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A %s
 // CHECK-V8A: "-cc1"{{.*}} "-triple" "armv8-{{.*}}" "-target-cpu" "cortex-a53"
 
+// RUN: %clang -mcpu=generic -target armv8 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target arm -march=armv8 -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target armv8a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target arm -march=armv8a -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target arm -march=armv8-a -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target armv8 -mlittle-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target arm -march=armv8 -mlittle-endian -### -c 
%s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target armv8a -mlittle-endian -### -c %s 2>&1 | 
Fil

Re: [PATCH] D12122: [CUDA] Add appropriate host/device attribute to target-specific builtins.

2015-08-19 Thread Eli Bendersky via cfe-commits
eliben accepted this revision.
eliben added a comment.
This revision is now accepted and ready to land.

lgtm


http://reviews.llvm.org/D12122



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


Re: [PATCH] D11845: Properly pass through the PIC mode to the integrated assembler when doing assembly-only, and unify the Driver's PIC argument parsing.

2015-08-19 Thread James Y Knight via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245447: Properly pass through the PIC mode to the integrated 
assembler when (authored by jyknight).

Changed prior to commit:
  http://reviews.llvm.org/D11845?vs=32216&id=32552#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11845

Files:
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/integrated-as.s

Index: cfe/trunk/include/clang/Driver/CC1Options.td
===
--- cfe/trunk/include/clang/Driver/CC1Options.td
+++ cfe/trunk/include/clang/Driver/CC1Options.td
@@ -146,7 +146,8 @@
   HelpText<"Save temporary labels in the symbol table. "
"Note this may change .s semantics and shouldn't generally be used "
"on compiler-generated code.">;
-
+def mrelocation_model : Separate<["-"], "mrelocation-model">,
+  HelpText<"The relocation model to use">;
 }
 
 def disable_llvm_optzns : Flag<["-"], "disable-llvm-optzns">,
@@ -228,8 +229,6 @@
   HelpText<"Additional arguments to forward to LLVM backend (during code gen)">;
 def mregparm : Separate<["-"], "mregparm">,
   HelpText<"Limit the number of registers available for integer arguments">;
-def mrelocation_model : Separate<["-"], "mrelocation-model">,
-  HelpText<"The relocation model to use">;
 def munwind_tables : Flag<["-"], "munwind-tables">,
   HelpText<"Generate unwinding tables for all functions">;
 def mconstructor_aliases : Flag<["-"], "mconstructor-aliases">,
Index: cfe/trunk/test/Driver/integrated-as.s
===
--- cfe/trunk/test/Driver/integrated-as.s
+++ cfe/trunk/test/Driver/integrated-as.s
@@ -5,9 +5,6 @@
 // RUN: %clang -### -c -integrated-as -Wa,-L %s 2>&1 | FileCheck --check-prefix=OPT_L %s
 // OPT_L: msave-temp-labels
 
-// RUN: %clang -### -target x86_64-linux-gnu -c -integrated-as %s -fsanitize=address 2>&1 %s | FileCheck --check-prefix=SANITIZE %s
-// SANITIZE: argument unused during compilation: '-fsanitize=address'
-
 // Test that -I params in -Wa, and -Xassembler args are passed to integrated assembler
 // RUN: %clang -### -c -integrated-as %s -Wa,-I,foo_dir 2>&1 | FileCheck --check-prefix=WA_INCLUDE1 %s
 // WA_INCLUDE1: cc1as
@@ -46,3 +43,6 @@
 
 // RUN: %clang -### -x assembler -c -integrated-as %s -I myincludedir 2>&1 | FileCheck --check-prefix=INCLUDEPATH %s
 // INCLUDEPATH: "-I" "myincludedir"
+
+// RUN: %clang -### -x assembler -c -fPIC -integrated-as %s 2>&1 | FileCheck --check-prefix=PIC %s
+// PIC: "-mrelocation-model" "pic"
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -32,15 +32,16 @@
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
-#include "llvm/Support/TargetParser.h"
+#include "llvm/Support/CodeGen.h"
 #include "llvm/Support/Compression.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/TargetParser.h"
 
 #ifdef LLVM_ON_UNIX
 #include  // For getuid().
@@ -51,21 +52,6 @@
 using namespace clang;
 using namespace llvm::opt;
 
-static void addAssemblerKPIC(const ArgList &Args, ArgStringList &CmdArgs) {
-  Arg *LastPICArg = Args.getLastArg(options::OPT_fPIC, options::OPT_fno_PIC,
-options::OPT_fpic, options::OPT_fno_pic,
-options::OPT_fPIE, options::OPT_fno_PIE,
-options::OPT_fpie, options::OPT_fno_pie);
-  if (!LastPICArg)
-return;
-  if (LastPICArg->getOption().matches(options::OPT_fPIC) ||
-  LastPICArg->getOption().matches(options::OPT_fpic) ||
-  LastPICArg->getOption().matches(options::OPT_fPIE) ||
-  LastPICArg->getOption().matches(options::OPT_fpie)) {
-CmdArgs.push_back("-KPIC");
-  }
-}
-
 /// CheckPreprocessingOptions - Perform some validation of preprocessing
 /// arguments that is shared with gcc.
 static void CheckPreprocessingOptions(const Driver &D, const ArgList &Args) {
@@ -2939,6 +2925,159 @@
   }
 }
 
+/// Parses the various -fpic/-fPIC/-fpie/-fPIE arguments.  Then,
+/// smooshes them together with platform defaults, to decide whether
+/// this compile should be using PIC mode or not. Returns a tuple of
+/// (RelocationModel, PICLevel, IsPIE).
+static std::tuple
+ParsePICArgs(const ToolChain &ToolChain, const llvm::Triple &Triple,
+ const ArgList &Args) {
+  // FIXME: why does this code...and so much everywhere else, use both
+  // ToolChain.getTriple() and Triple?
+  bool PIE = ToolChain.isPIEDefault();
+  bool PIC = PIE || ToolChain.isPICDefault();
+  bool IsPICLevelTwo = PIC;
+
+

r245447 - Properly pass through the PIC mode to the integrated assembler when

2015-08-19 Thread James Y Knight via cfe-commits
Author: jyknight
Date: Wed Aug 19 10:12:02 2015
New Revision: 245447

URL: http://llvm.org/viewvc/llvm-project?rev=245447&view=rev
Log:
Properly pass through the PIC mode to the integrated assembler when
doing assembly-only, and unify the Driver's PIC argument parsing.

On a few architectures, parsing of assembly files annoyingly depends
on whether PIC is enabled or not. This was handled for external 'as'
already (passing -KPIC), but was missed for calls to the standalone
internal assembler.

The integrated-as.s test needed to be modified to not expect
-fsanitize=address to be unused, as now fsanitize *IS* used for
assembly, since -fsanitize=memory can sometimes imply -fPIE, which the
assembler needs to know (gack!!).

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

Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/integrated-as.s

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=245447&r1=245446&r2=245447&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Wed Aug 19 10:12:02 2015
@@ -146,7 +146,8 @@ def msave_temp_labels : Flag<["-"], "msa
   HelpText<"Save temporary labels in the symbol table. "
"Note this may change .s semantics and shouldn't generally be used "
"on compiler-generated code.">;
-
+def mrelocation_model : Separate<["-"], "mrelocation-model">,
+  HelpText<"The relocation model to use">;
 }
 
 def disable_llvm_optzns : Flag<["-"], "disable-llvm-optzns">,
@@ -228,8 +229,6 @@ def backend_option : Separate<["-"], "ba
   HelpText<"Additional arguments to forward to LLVM backend (during code 
gen)">;
 def mregparm : Separate<["-"], "mregparm">,
   HelpText<"Limit the number of registers available for integer arguments">;
-def mrelocation_model : Separate<["-"], "mrelocation-model">,
-  HelpText<"The relocation model to use">;
 def munwind_tables : Flag<["-"], "munwind-tables">,
   HelpText<"Generate unwinding tables for all functions">;
 def mconstructor_aliases : Flag<["-"], "mconstructor-aliases">,

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=245447&r1=245446&r2=245447&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug 19 10:12:02 2015
@@ -32,7 +32,7 @@
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
-#include "llvm/Support/TargetParser.h"
+#include "llvm/Support/CodeGen.h"
 #include "llvm/Support/Compression.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
@@ -41,6 +41,7 @@
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/TargetParser.h"
 
 #ifdef LLVM_ON_UNIX
 #include  // For getuid().
@@ -51,21 +52,6 @@ using namespace clang::driver::tools;
 using namespace clang;
 using namespace llvm::opt;
 
-static void addAssemblerKPIC(const ArgList &Args, ArgStringList &CmdArgs) {
-  Arg *LastPICArg = Args.getLastArg(options::OPT_fPIC, options::OPT_fno_PIC,
-options::OPT_fpic, options::OPT_fno_pic,
-options::OPT_fPIE, options::OPT_fno_PIE,
-options::OPT_fpie, options::OPT_fno_pie);
-  if (!LastPICArg)
-return;
-  if (LastPICArg->getOption().matches(options::OPT_fPIC) ||
-  LastPICArg->getOption().matches(options::OPT_fpic) ||
-  LastPICArg->getOption().matches(options::OPT_fPIE) ||
-  LastPICArg->getOption().matches(options::OPT_fpie)) {
-CmdArgs.push_back("-KPIC");
-  }
-}
-
 /// CheckPreprocessingOptions - Perform some validation of preprocessing
 /// arguments that is shared with gcc.
 static void CheckPreprocessingOptions(const Driver &D, const ArgList &Args) {
@@ -2939,6 +2925,159 @@ static void addPGOAndCoverageFlags(Compi
   }
 }
 
+/// Parses the various -fpic/-fPIC/-fpie/-fPIE arguments.  Then,
+/// smooshes them together with platform defaults, to decide whether
+/// this compile should be using PIC mode or not. Returns a tuple of
+/// (RelocationModel, PICLevel, IsPIE).
+static std::tuple
+ParsePICArgs(const ToolChain &ToolChain, const llvm::Triple &Triple,
+ const ArgList &Args) {
+  // FIXME: why does this code...and so much everywhere else, use both
+  // ToolChain.getTriple() and Triple?
+  bool PIE = ToolChain.isPIEDefault();
+  bool PIC = PIE || ToolChain.isPICDefault();
+  bool IsPICLevelTwo = PIC;
+
+  bool KernelOrKext =
+  Args.hasArg(options::OPT_mkernel, options::OPT_fapple_kext);
+
+  // Android-specific defaults for PIC/PIE
+  if (ToolCh

[libcxxabi] r245449 - [AArch64] Quick fix for cxa demangler

2015-08-19 Thread Renato Golin via cfe-commits
Author: rengolin
Date: Wed Aug 19 10:24:03 2015
New Revision: 245449

URL: http://llvm.org/viewvc/llvm-project?rev=245449&view=rev
Log:
[AArch64] Quick fix for cxa demangler

This makes all libcxxabi tests pass on AArch64. Further changes and
new tests to come.

Patch by Keith Walker.

Modified:
libcxxabi/trunk/src/cxa_demangle.cpp

Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=245449&r1=245448&r2=245449&view=diff
==
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Wed Aug 19 10:24:03 2015
@@ -156,7 +156,7 @@ constexpr const char* float_data
 template <>
 struct float_data
 {
-#if defined(__mips__) && defined(__mips_n64)
+#if defined(__mips__) && defined(__mips_n64) || defined(__aarch64__)
 static const size_t mangled_size = 32;
 #elif defined(__arm__) || defined(__mips__)
 static const size_t mangled_size = 16;


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


FunctionDecl::getBody() returning nullptr

2015-08-19 Thread Aaron Ballman via cfe-commits
When I run the following test code through clang-tidy -checks=*, I get
a crash from some relatively strange behavior with FunctionDecl.

template  struct remove_reference  {typedef T type;};
template  struct remove_reference  {typedef T type;};
template  struct remove_reference {typedef T type;};

template 
typename remove_reference::type&& move(T&& arg) {
  return static_cast::type&&>(arg);
}

AnalysisConsumer::getModeForDecl() is called, and it has code that
does: D->hasBody() ? D->getBody()->stuff : stuff;

What's strange is that hasBody() returns true, but getBody() returns
nullptr. I don't think that this should be possible. I'm wondering
whether it's purposeful that hasBody() does not check
Definition->Body?

Also, the FunctionDecl in question is for move(), which does have a
body, so I do not understand why the definition would claim there is
no body.

Ideas, or should I file a bug report?

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


Re: [PATCH] D12148: [ARM] Allow passing/returning of __fp16 arguments

2015-08-19 Thread James Molloy via cfe-commits
jmolloy added a subscriber: jmolloy.


Comment at: lib/CodeGen/TargetInfo.cpp:4717
@@ -4716,1 +4716,3 @@
 
+  // __fp16 gets passed as if it were an int or float, but with the top 32 bits
+  // unspecified.

"Top 16 bits"?


Comment at: lib/CodeGen/TargetInfo.cpp:4884
@@ -4874,1 +4883,3 @@
 
+  // __fp16 gets returned as if it were an int or float, but with the top 32
+  // bits unspecified.

"Top 16 bits" ?


Repository:
  rL LLVM

http://reviews.llvm.org/D12148



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


Re: [PATCH] D12144: Fix 4 typos in lib/Analysis/

2015-08-19 Thread Delesley Hutchins via cfe-commits
delesley added a comment.

Looks good for the thread safety stuff.


http://reviews.llvm.org/D12144



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


Re: [PATCH] D12144: Fix 4 typos in lib/Analysis/

2015-08-19 Thread Ted Kremenek via cfe-commits
krememek added a comment.

Looks fine in UninitializedValues.


http://reviews.llvm.org/D12144



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


Re: [PATCH] D12148: [ARM] Allow passing/returning of __fp16 arguments

2015-08-19 Thread Oliver Stannard via cfe-commits
olista01 updated this revision to Diff 32558.
olista01 added a comment.

Fixed typo


Repository:
  rL LLVM

http://reviews.llvm.org/D12148

Files:
  lib/Basic/Targets.cpp
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/Tools.cpp
  test/CodeGen/arm-fp16-arguments.c
  test/Preprocessor/arm-acle-6.5.c
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -5,6 +5,8 @@
 // CHECK: __ARM_FEATURE_CRC32 1
 // CHECK: __ARM_FEATURE_DIRECTED_ROUNDING 1
 // CHECK: __ARM_FEATURE_NUMERIC_MAXMIN 1
+// CHECK: __ARM_FP16_ARGS 1
+// CHECK: __ARM_FP16_FORMAT_IEEE 1
 
 // RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V7 %s
 // CHECK-V7: __ARMEL__ 1
Index: test/Preprocessor/arm-acle-6.5.c
===
--- test/Preprocessor/arm-acle-6.5.c
+++ test/Preprocessor/arm-acle-6.5.c
@@ -1,6 +1,6 @@
 // RUN: %clang -target arm-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-DEFAULT
 
-// CHECK-DEFAULT-NOT: __ARM_FP
+// CHECK-DEFAULT-NOT: __ARM_FP 0x
 
 // RUN: %clang -target arm-eabi -mfpu=vfp -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
 // RUN: %clang -target arm-eabi -mfpu=vfp3 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
Index: test/CodeGen/arm-fp16-arguments.c
===
--- /dev/null
+++ test/CodeGen/arm-fp16-arguments.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=SOFT
+// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi hard -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=HARD
+
+__fp16 g;
+
+void t1(__fp16 a) { g = a; }
+// SOFT: define void @t1(i32 [[PARAM:%.*]])
+// SOFT: [[TRUNC:%.*]] = trunc i32 [[PARAM]] to i16
+// HARD: define arm_aapcs_vfpcc void @t1(float [[PARAM:%.*]])
+// HARD: [[BITCAST:%.*]] = bitcast float [[PARAM]] to i32
+// HARD: [[TRUNC:%.*]] = trunc i32 [[BITCAST]] to i16
+// CHECK: store i16 [[TRUNC]], i16* bitcast (half* @g to i16*)
+
+__fp16 t2() { return g; }
+// SOFT: define i32 @t2()
+// HARD: define arm_aapcs_vfpcc float @t2()
+// CHECK: [[LOAD:%.*]] = load i16, i16* bitcast (half* @g to i16*)
+// CHECK: [[ZEXT:%.*]] = zext i16 [[LOAD]] to i32
+// SOFT: ret i32 [[ZEXT]]
+// HARD: [[BITCAST:%.*]] = bitcast i32 [[ZEXT]] to float
+// HARD: ret float [[BITCAST]]
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4251,7 +4251,11 @@
   }
 
   if (getToolChain().getArch() == llvm::Triple::aarch64 ||
-  getToolChain().getArch() == llvm::Triple::aarch64_be)
+  getToolChain().getArch() == llvm::Triple::aarch64_be ||
+  getToolChain().getArch() == llvm::Triple::arm ||
+  getToolChain().getArch() == llvm::Triple::armeb ||
+  getToolChain().getArch() == llvm::Triple::thumb ||
+  getToolChain().getArch() == llvm::Triple::thumbeb)
 CmdArgs.push_back("-fallow-half-arguments-and-returns");
 
   if (Arg *A = Args.getLastArg(options::OPT_mrestrict_it,
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -4714,6 +4714,15 @@
 return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
   }
 
+  // __fp16 gets passed as if it were an int or float, but with the top 16 bits
+  // unspecified.
+  if (Ty->isHalfType()) {
+llvm::Type *ResType = IsEffectivelyAAPCS_VFP ?
+  llvm::Type::getFloatTy(getVMContext()) :
+  llvm::Type::getInt32Ty(getVMContext());
+return ABIArgInfo::getDirect(ResType);
+  }
+
   if (!isAggregateTypeForABI(Ty)) {
 // Treat an enum type as its underlying type.
 if (const EnumType *EnumTy = Ty->getAs()) {
@@ -4872,6 +4881,15 @@
 return ABIArgInfo::getIndirect(0);
   }
 
+  // __fp16 gets returned as if it were an int or float, but with the top 16
+  // bits unspecified.
+  if (RetTy->isHalfType()) {
+llvm::Type *ResType = IsEffectivelyAAPCS_VFP ?
+  llvm::Type::getFloatTy(getVMContext()) :
+  llvm::Type::getInt32Ty(getVMContext());
+return ABIArgInfo::getDirect(ResType);
+  }
+
   if (!isAggregateTypeForABI(RetTy)) {
 // Treat an enum type as its underlying type.
 if (const EnumType *EnumTy = RetTy->getAs())
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4625,6 +4625,10 @@
 // ACLE predefines.
 Builder.defineMacro("__ARM_ACLE", "200");
 
+// FP16 support (we currently only support 

Re: [PATCH] D11555: [libcxx] Allow use of in C++03. Try 3.

2015-08-19 Thread Marshall Clow via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

I think this is ready to land now. Thanks, Eric.


http://reviews.llvm.org/D11555



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


Re: [PATCH] D11963: Create a __config_site file to capture configuration decisions.

2015-08-19 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D11963#227444, @EricWF wrote:

> I also just realized that this change will currently likely play havoc with 
> how libc++ and libc++abi build together. In order to build libc++ and 
> libc++abi together we would need to
>
> 1. Configure libc++ pointing to the libc++abi headers in order to generate 
> the __config_site file.
> 2. Configure libc++abi pointing it to the libc++ build directory for the 
> headers.
> 3. build libc++abi
> 4. build libc++
>
>   I'm not quite sure how this would work for an in-tree build.


This patch, combined with http://reviews.llvm.org/D11964, works the way you 
describe.

> However if we do things as I suggested above we can keep the current two step 
> build process.





http://reviews.llvm.org/D11963



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


Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-19 Thread Aaron Ballman via cfe-commits
aaron.ballman updated this revision to Diff 32559.
aaron.ballman added a comment.

Addressed review comments. I re-ran the updated patch against LLVM and Clang, 
and there were some more false positives that I would like to address if 
possible. It seems my previous run against the source base was before expanding 
the scope of the patch to include more than just base class initialization 
(sorry for the earlier misinformation).

1. SourceMgr.h:58 is an example where the checker issues a diagnostic (for 
IncludeLoc), but given the triviality of the type, I don't see a reason to 
diagnose. However, this requires support from Sema, so I think a FIXME may be 
the best I can do. Note, adding a call to std::move() in these instances is not 
wrong, it's just not particularly useful.
2. we should not be warning on anything an implicit constructor does. For 
instance LiveQueryResult is triggering this because of SlotIndex. This should 
be fixed with this patch.

Running over Clang and LLVM, there are 7 distinct false positives (repeated due 
to being in header files) and they all relate to triviality. The total false 
positive count was 832 of which two warnings (SourceMgr.h and Preprocessor.h) 
accounted for probably close to 90% of the diagnostics. This time around there 
were no true positives.


http://reviews.llvm.org/D11784

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/MoveConstructorInitCheck.cpp
  clang-tidy/misc/MoveConstructorInitCheck.h
  test/clang-tidy/misc-move-constructor-init.cpp

Index: test/clang-tidy/misc-move-constructor-init.cpp
===
--- test/clang-tidy/misc-move-constructor-init.cpp
+++ test/clang-tidy/misc-move-constructor-init.cpp
@@ -0,0 +1,79 @@
+// RUN: clang-tidy %s -checks=-*,misc-move-constructor-init -- -std=c++14 | FileCheck %s -implicit-check-not="{{warning|error}}:"
+
+template  struct remove_reference  {typedef T type;};
+template  struct remove_reference  {typedef T type;};
+template  struct remove_reference {typedef T type;};
+
+template 
+typename remove_reference::type&& move(T&& arg) {
+  return static_cast::type&&>(arg);
+}
+
+struct C {
+  C() = default;
+  C(const C&) = default;
+};
+
+struct B {
+  B() {}
+  B(const B&) {}
+  B(B &&) {}
+};
+
+struct D : B {
+  D() : B() {}
+  D(const D &RHS) : B(RHS) {}
+  // CHECK: :[[@LINE+3]]:16: warning: move constructor initializes base class by calling a copy constructor [misc-move-constructor-init]
+  // CHECK: 19:3: note: copy constructor being called
+  // CHECK: 20:3: note: candidate move constructor here
+  D(D &&RHS) : B(RHS) {}
+};
+
+struct E : B {
+  E() : B() {}
+  E(const E &RHS) : B(RHS) {}
+  E(E &&RHS) : B(move(RHS)) {} // ok
+};
+
+struct F {
+  C M;
+
+  F(F &&) : M(C()) {} // ok
+};
+
+struct G {
+  G() = default;
+  G(const G&) = default;
+  G(G&&) = delete;
+};
+
+struct H : G {
+  H() = default;
+  H(const H&) = default;
+  H(H &&RHS) : G(RHS) {} // ok
+};
+
+struct I {
+  I(const I &) = default; // suppresses move constructor creation
+};
+
+struct J : I {
+  J(J &&RHS) : I(RHS) {} // ok
+};
+
+struct K {}; // Has implicit copy and move constructors
+struct L : K {
+  // CHECK: :[[@LINE+1]]:16: warning: move constructor initializes base class by calling a copy constructor [misc-move-constructor-init]
+  L(L &&RHS) : K(RHS) {}
+};
+
+struct M {
+  B Mem;
+  // CHECK: :[[@LINE+1]]:16: warning: move constructor initializes class member by calling a copy constructor [misc-move-constructor-init]
+  M(M &&RHS) : Mem(RHS.Mem) {}
+};
+
+struct N {
+  B Mem;
+  N(N &&RHS) : Mem(move(RHS.Mem)) {}
+};
Index: clang-tidy/misc/MoveConstructorInitCheck.h
===
--- clang-tidy/misc/MoveConstructorInitCheck.h
+++ clang-tidy/misc/MoveConstructorInitCheck.h
@@ -0,0 +1,32 @@
+//===--- MoveConstructorInitCheck.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_MISC_MOVECONSTRUCTORINITCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONSTRUCTORINITCHECK_H
+
+#include "../ClangTidy.h"
+
+namespace clang {
+namespace tidy {
+
+/// \brief The check flags user-defined move constructors that have a
+/// ctor-initializer initializing a member or base class through a copy
+/// constructor instead of a move constructor.
+class MoveConstructorInitCheck : public ClangTidyCheck {
+public:
+  MoveConstructorInitCheck(StringRef Name, ClangTidyContext *Context)
+  : ClangTidyCheck(Name, Context) {}
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+};
+
+} /

Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-19 Thread Aaron Ballman via cfe-commits
aaron.ballman marked 5 inline comments as done.
aaron.ballman added a comment.

http://reviews.llvm.org/D11784



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


[PATCH] D12155: ARM: Error out on apple darwin platforms if float-abi is "hard"

2015-08-19 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision.
ahatanak added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

Error out if user provides -mfloat-abi=hard or -mhard-float on the command line 
since hard float abi isn't supported on apple platforms (except for non-darwin 
platforms).

http://reviews.llvm.org/D12155

Files:
  lib/Driver/Tools.cpp
  test/Driver/arm-float-abi.c

Index: test/Driver/arm-float-abi.c
===
--- /dev/null
+++ test/Driver/arm-float-abi.c
@@ -0,0 +1,5 @@
+// RUN: not %clang %s -target armv7-apple-ios -mfloat-abi=hard 2>&1 | 
FileCheck -check-prefix=ARMV7-HARD %s
+// RUN: %clang %s -target armv7-apple-ios -mfloat-abi=softfp -### 2>&1 | 
FileCheck -check-prefix=ARMV7-SOFTFP %s
+
+// ARMV7-HARD: unsupported option '-mfloat-abi=hard' for target 'thumbv7'
+// ARMV7-SOFTFP-NOT: unsupported option
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -582,6 +582,10 @@
 FloatABI = "soft";
   }
 }
+
+if (Triple.isOSDarwin() && FloatABI == "hard")
+  D.Diag(diag::err_drv_unsupported_opt_for_target) << A->getAsString(Args)
+   << Triple.getArchName();
   }
 
   // If unspecified, choose the default based on the platform.


Index: test/Driver/arm-float-abi.c
===
--- /dev/null
+++ test/Driver/arm-float-abi.c
@@ -0,0 +1,5 @@
+// RUN: not %clang %s -target armv7-apple-ios -mfloat-abi=hard 2>&1 | FileCheck -check-prefix=ARMV7-HARD %s
+// RUN: %clang %s -target armv7-apple-ios -mfloat-abi=softfp -### 2>&1 | FileCheck -check-prefix=ARMV7-SOFTFP %s
+
+// ARMV7-HARD: unsupported option '-mfloat-abi=hard' for target 'thumbv7'
+// ARMV7-SOFTFP-NOT: unsupported option
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -582,6 +582,10 @@
 FloatABI = "soft";
   }
 }
+
+if (Triple.isOSDarwin() && FloatABI == "hard")
+  D.Diag(diag::err_drv_unsupported_opt_for_target) << A->getAsString(Args)
+   << Triple.getArchName();
   }
 
   // If unspecified, choose the default based on the platform.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11963: Create a __config_site file to capture configuration decisions.

2015-08-19 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D11963#227441, @EricWF wrote:

> @jroelofs What do you think of an approach like this?


Having two copies of the __config_site file makes me uncomfortable, but I could 
put up with that given that they're effectively the same for 99% of people who 
will want to build this library.

That being said, @mclow.lists raised a few concerns with the overall 
strategy... I don't want to keep pushing on this patch if his plan is to 
pocket-veto it.


http://reviews.llvm.org/D11963



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


Re: r245084 - WindowsX86: long double is x87DoubleExtended on mingw

2015-08-19 Thread Hans Wennborg via cfe-commits
On Tue, Aug 18, 2015 at 6:11 PM, Richard Smith  wrote:
> On Tue, Aug 18, 2015 at 3:01 PM, Hans Wennborg  wrote:
>>
>> Richard, I tried to ping you on the review thread but I'm not sure it
>> got through. Martell requested this be merged to 3.7. What do you
>> think?
>
>
> LGTM

Thanks! r245456.

>
>>
>> On Fri, Aug 14, 2015 at 12:05 PM, Martell Malone via cfe-commits
>>  wrote:
>> > Author: martell
>> > Date: Fri Aug 14 14:05:56 2015
>> > New Revision: 245084
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=245084&view=rev
>> > Log:
>> > WindowsX86: long double is x87DoubleExtended on mingw
>> >
>> > Summary:
>> > long double on x86 mingw is 80bits and is aligned to 16bytes
>> >
>> > Fixes:
>> > https://llvm.org/bugs/show_bug.cgi?id=24398
>> >
>> > Reviewers: rnk
>> >
>> > Subscribers: cfe-commits
>> >
>> > Differential Revision: http://reviews.llvm.org/D12037
>> >
>> > Modified:
>> > cfe/trunk/lib/Basic/Targets.cpp
>> >
>> > Modified: cfe/trunk/lib/Basic/Targets.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245084&r1=245083&r2=245084&view=diff
>> >
>> > ==
>> > --- cfe/trunk/lib/Basic/Targets.cpp (original)
>> > +++ cfe/trunk/lib/Basic/Targets.cpp Fri Aug 14 14:05:56 2015
>> > @@ -3784,7 +3784,10 @@ namespace {
>> >  class MinGWX86_32TargetInfo : public WindowsX86_32TargetInfo {
>> >  public:
>> >MinGWX86_32TargetInfo(const llvm::Triple &Triple)
>> > -  : WindowsX86_32TargetInfo(Triple) {}
>> > +  : WindowsX86_32TargetInfo(Triple) {
>> > +LongDoubleWidth = LongDoubleAlign = 128;
>> > +LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
>> > +  }
>> >void getTargetDefines(const LangOptions &Opts,
>> >  MacroBuilder &Builder) const override {
>> >  WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
>> > @@ -4014,7 +4017,10 @@ public:
>> >  class MinGWX86_64TargetInfo : public WindowsX86_64TargetInfo {
>> >  public:
>> >MinGWX86_64TargetInfo(const llvm::Triple &Triple)
>> > -  : WindowsX86_64TargetInfo(Triple) {}
>> > +  : WindowsX86_64TargetInfo(Triple) {
>> > +LongDoubleWidth = LongDoubleAlign = 128;
>> > +LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
>> > +  }
>> >void getTargetDefines(const LangOptions &Opts,
>> >  MacroBuilder &Builder) const override {
>> >  WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);
>> >
>> >
>> > ___
>> > 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] D12157: Fix LoopConvertCheck bug.

2015-08-19 Thread Angel Garcia via cfe-commits
angelgarcia created this revision.
angelgarcia added a reviewer: alexfh.
angelgarcia added subscribers: klimek, cfe-commits.
angelgarcia changed the visibility of this Differential Revision from "Public 
(No Login Required)" to "All Users".

Fix LoopConvertCheck bug: StringRef to temporaries.

http://reviews.llvm.org/D12157

Files:
  clang-tidy/modernize/LoopConvertCheck.cpp
  clang-tidy/tool/ClangTidyMain.cpp

Index: clang-tidy/tool/ClangTidyMain.cpp
===
--- clang-tidy/tool/ClangTidyMain.cpp
+++ clang-tidy/tool/ClangTidyMain.cpp
@@ -359,7 +359,7 @@
 
 // This anchor is used to force the linker to link the ModernizeModule.
 extern volatile int ModernizeModuleAnchorSource;
-static int ModernizeModuleAnchorDestination = ModernizeModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination = 
ModernizeModuleAnchorSource;
 
 // This anchor is used to force the linker to link the ReadabilityModule.
 extern volatile int ReadabilityModuleAnchorSource;
Index: clang-tidy/modernize/LoopConvertCheck.cpp
===
--- clang-tidy/modernize/LoopConvertCheck.cpp
+++ clang-tidy/modernize/LoopConvertCheck.cpp
@@ -417,7 +417,7 @@
 // First, replace all usages of the array subscript expression with our new
 // variable.
 for (const auto &I : Usages) {
-  StringRef ReplaceText = I.IsArrow ? VarName + "." : VarName;
+  std::string ReplaceText = I.IsArrow ? VarName + "." : VarName;
   TUInfo->getReplacedVars().insert(std::make_pair(TheLoop, IndexVar));
   Diag << FixItHint::CreateReplacement(
   CharSourceRange::getTokenRange(I.Range), ReplaceText);
@@ -446,11 +446,9 @@
   }
 
   StringRef MaybeDereference = ContainerNeedsDereference ? "*" : "";
-  StringRef TypeString = AutoRefType.getAsString();
-  StringRef Range = ("(" + TypeString + " " + VarName + " : " +
- MaybeDereference + ContainerString + ")")
-.str();
-
+  std::string TypeString = AutoRefType.getAsString();
+  std::string Range = ("(" + TypeString + " " + VarName + " : " +
+   MaybeDereference + ContainerString + ")").str();
   Diag << FixItHint::CreateReplacement(
   CharSourceRange::getTokenRange(ParenRange), Range);
   TUInfo->getGeneratedDecls().insert(make_pair(TheLoop, VarName));


Index: clang-tidy/tool/ClangTidyMain.cpp
===
--- clang-tidy/tool/ClangTidyMain.cpp
+++ clang-tidy/tool/ClangTidyMain.cpp
@@ -359,7 +359,7 @@
 
 // This anchor is used to force the linker to link the ModernizeModule.
 extern volatile int ModernizeModuleAnchorSource;
-static int ModernizeModuleAnchorDestination = ModernizeModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination = ModernizeModuleAnchorSource;
 
 // This anchor is used to force the linker to link the ReadabilityModule.
 extern volatile int ReadabilityModuleAnchorSource;
Index: clang-tidy/modernize/LoopConvertCheck.cpp
===
--- clang-tidy/modernize/LoopConvertCheck.cpp
+++ clang-tidy/modernize/LoopConvertCheck.cpp
@@ -417,7 +417,7 @@
 // First, replace all usages of the array subscript expression with our new
 // variable.
 for (const auto &I : Usages) {
-  StringRef ReplaceText = I.IsArrow ? VarName + "." : VarName;
+  std::string ReplaceText = I.IsArrow ? VarName + "." : VarName;
   TUInfo->getReplacedVars().insert(std::make_pair(TheLoop, IndexVar));
   Diag << FixItHint::CreateReplacement(
   CharSourceRange::getTokenRange(I.Range), ReplaceText);
@@ -446,11 +446,9 @@
   }
 
   StringRef MaybeDereference = ContainerNeedsDereference ? "*" : "";
-  StringRef TypeString = AutoRefType.getAsString();
-  StringRef Range = ("(" + TypeString + " " + VarName + " : " +
- MaybeDereference + ContainerString + ")")
-.str();
-
+  std::string TypeString = AutoRefType.getAsString();
+  std::string Range = ("(" + TypeString + " " + VarName + " : " +
+   MaybeDereference + ContainerString + ")").str();
   Diag << FixItHint::CreateReplacement(
   CharSourceRange::getTokenRange(ParenRange), Range);
   TUInfo->getGeneratedDecls().insert(make_pair(TheLoop, VarName));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r245458 - [clang-tidy] Fix LoopConvertCheck bug.

2015-08-19 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 19 11:54:51 2015
New Revision: 245458

URL: http://llvm.org/viewvc/llvm-project?rev=245458&view=rev
Log:
[clang-tidy] Fix LoopConvertCheck bug.

Fix LoopConvertCheck bug: StringRef to temporaries.

Also add LLVM_ATTRIBUTE_UNUSED to ModernizeModuleAnchorDestination.

http://reviews.llvm.org/D12157

Patch by Angel Garcia!

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp?rev=245458&r1=245457&r2=245458&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp Wed Aug 
19 11:54:51 2015
@@ -417,7 +417,7 @@ void LoopConvertCheck::doConversion(
 // First, replace all usages of the array subscript expression with our new
 // variable.
 for (const auto &I : Usages) {
-  StringRef ReplaceText = I.IsArrow ? VarName + "." : VarName;
+  std::string ReplaceText = I.IsArrow ? VarName + "." : VarName;
   TUInfo->getReplacedVars().insert(std::make_pair(TheLoop, IndexVar));
   Diag << FixItHint::CreateReplacement(
   CharSourceRange::getTokenRange(I.Range), ReplaceText);
@@ -446,11 +446,9 @@ void LoopConvertCheck::doConversion(
   }
 
   StringRef MaybeDereference = ContainerNeedsDereference ? "*" : "";
-  StringRef TypeString = AutoRefType.getAsString();
-  StringRef Range = ("(" + TypeString + " " + VarName + " : " +
- MaybeDereference + ContainerString + ")")
-.str();
-
+  std::string TypeString = AutoRefType.getAsString();
+  std::string Range = ("(" + TypeString + " " + VarName + " : " +
+   MaybeDereference + ContainerString + ")").str();
   Diag << FixItHint::CreateReplacement(
   CharSourceRange::getTokenRange(ParenRange), Range);
   TUInfo->getGeneratedDecls().insert(make_pair(TheLoop, VarName));

Modified: clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp?rev=245458&r1=245457&r2=245458&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp Wed Aug 19 
11:54:51 2015
@@ -347,23 +347,28 @@ static int clangTidyMain(int argc, const
 
 // This anchor is used to force the linker to link the LLVMModule.
 extern volatile int LLVMModuleAnchorSource;
-static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination = 
LLVMModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination =
+LLVMModuleAnchorSource;
 
 // This anchor is used to force the linker to link the GoogleModule.
 extern volatile int GoogleModuleAnchorSource;
-static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination = 
GoogleModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination =
+GoogleModuleAnchorSource;
 
 // This anchor is used to force the linker to link the MiscModule.
 extern volatile int MiscModuleAnchorSource;
-static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination = 
MiscModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination =
+MiscModuleAnchorSource;
 
 // This anchor is used to force the linker to link the ModernizeModule.
 extern volatile int ModernizeModuleAnchorSource;
-static int ModernizeModuleAnchorDestination = ModernizeModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination =
+ModernizeModuleAnchorSource;
 
 // This anchor is used to force the linker to link the ReadabilityModule.
 extern volatile int ReadabilityModuleAnchorSource;
-static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination = 
ReadabilityModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination =
+ReadabilityModuleAnchorSource;
 
 } // namespace tidy
 } // namespace clang


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


Re: [PATCH] D12152: [OPENMP] Info about OpenMP Support in Users Manual

2015-08-19 Thread Hans Wennborg via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

Thanks!



Comment at: docs/UsersManual.rst:1860
@@ +1859,3 @@
+
+clang fully implements all of standard OpenMP 3.1 directives and clauses + some
+features of OpenMP 4.0, including ``#pragma omp simd``,

s/clang/Clang/ to be consistent with the rest of the manual


Comment at: docs/UsersManual.rst:1877
@@ +1876,3 @@
+ Controls code generation for OpenMP threadprivate variables. In presence of
+ this options all threadprivate variables are generated the same way as thread
+ local variables, using TLS support. If :option:`-fno-openmp-use-tls`

s/this options/this option/


http://reviews.llvm.org/D12152



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


Re: [PATCH] D12157: Fix LoopConvertCheck bug.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh closed this revision.
alexfh added a comment.

Committed revision 245458.


http://reviews.llvm.org/D12157



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


Re: [PATCH] D12143: [X86][AVX2] Replace avx2.pbroadcast / avx2.vbroadcast intrinsics usage in avx2intrin.h with __builtin_shufflevector

2015-08-19 Thread Ahmed Bougacha via cfe-commits
ab added a comment.

Heh, this is http://reviews.llvm.org/D10556, no? :P


Repository:
  rL LLVM

http://reviews.llvm.org/D12143



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


r245459 - According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.

2015-08-19 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Wed Aug 19 12:02:32 2015
New Revision: 245459

URL: http://llvm.org/viewvc/llvm-project?rev=245459&view=rev
Log:
According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.
See
 https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html


Added:
cfe/trunk/test/CodeGen/mingw-long-double-size.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245459&r1=245458&r2=245459&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Aug 19 12:02:32 2015
@@ -3785,7 +3785,8 @@ class MinGWX86_32TargetInfo : public Win
 public:
   MinGWX86_32TargetInfo(const llvm::Triple &Triple)
   : WindowsX86_32TargetInfo(Triple) {
-LongDoubleWidth = LongDoubleAlign = 128;
+LongDoubleWidth = 96;
+LongDoubleAlign = 128;
 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
   }
   void getTargetDefines(const LangOptions &Opts,

Added: cfe/trunk/test/CodeGen/mingw-long-double-size.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mingw-long-double-size.c?rev=245459&view=auto
==
--- cfe/trunk/test/CodeGen/mingw-long-double-size.c (added)
+++ cfe/trunk/test/CodeGen/mingw-long-double-size.c Wed Aug 19 12:02:32 2015
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -triple i686-pc-windows-gnu -S %s  -o - | FileCheck %s 
-check-prefix=CHECK_I686
+// CHECK_I686: lda,12
+// RUN: %clang_cc1 -triple x86_64-pc-windows-gnu -S %s  -o - | FileCheck %s 
-check-prefix=CHECK_X86_64
+// CHECK_X86_64: lda,16
+long double lda;


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


Re: [PATCH] D11682: [libcxxabi] Add "install-libcxxabi" target.

2015-08-19 Thread Chris Bieneman via cfe-commits
beanz accepted this revision.
beanz added a reviewer: beanz.
beanz added a comment.
This revision is now accepted and ready to land.

You are right, and I apparently don't know how to read documentation...

Patch LGTM as is.


http://reviews.llvm.org/D11682



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


Re: [PATCH] D11963: Create a __config_site file to capture configuration decisions.

2015-08-19 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In http://reviews.llvm.org/D11963#227951, @jroelofs wrote:

> In http://reviews.llvm.org/D11963#227441, @EricWF wrote:
>
> > @jroelofs What do you think of an approach like this?
>
>
> Having two copies of the __config_site file makes me uncomfortable, but I 
> could put up with that given that they're effectively the same for 99% of 
> people who will want to build this library.
>
> That being said, @mclow.lists raised a few concerns with the overall 
> strategy... I don't want to keep pushing on this patch if his plan is to 
> pocket-veto it.


My hackey suggestion makes me uncomfortable too.  However, as unfortunate as it 
is, we **need** a patch like this (Despite how bad I don't want it). One reason 
is that  libc++ *claims* to support using libsupc++ to provide `typeinfo` 
definition. The problem is that libc++ declares `typeinfo` with a different 
vtable layout. In order to match libsupc++ we need something like a 
`__config_site` header. I think we either need to nuke libsupc++ support or 
adopt a patch like this.


http://reviews.llvm.org/D11963



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


Re: [PATCH] D11963: Create a __config_site file to capture configuration decisions.

2015-08-19 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In http://reviews.llvm.org/D11963#227933, @jroelofs wrote:

> In http://reviews.llvm.org/D11963#227444, @EricWF wrote:
>
> > I also just realized that this change will currently likely play havoc with 
> > how libc++ and libc++abi build together. In order to build libc++ and 
> > libc++abi together we would need to
> >
> > 1. Configure libc++ pointing to the libc++abi headers in order to generate 
> > the __config_site file.
> > 2. Configure libc++abi pointing it to the libc++ build directory for the 
> > headers.
> > 3. build libc++abi
> > 4. build libc++
> >
> >   I'm not quite sure how this would work for an in-tree build.
>
>
> This patch, combined with http://reviews.llvm.org/D11964, works the way you 
> describe.


Wouldn't it still be a mess if you build both libc++ and libc++abi out-of-tree? 
The user would have to be aware of these weird requirements.


http://reviews.llvm.org/D11963



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


[libcxxabi] r245461 - [libcxxabi] Add "install-libcxxabi" target.

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Aug 19 12:17:21 2015
New Revision: 245461

URL: http://llvm.org/viewvc/llvm-project?rev=245461&view=rev
Log:
[libcxxabi] Add "install-libcxxabi" target.

Summary:
Currently you can't install libc++abi from within the LLVM tree without 
installing all of LLVM. This patch adds an install rule for libc++abi.


Reviewers: danalbert, compnerd, rengolin, beanz

Subscribers: martell, beanz, jroelofs, cfe-commits

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

Modified:
libcxxabi/trunk/src/CMakeLists.txt

Modified: libcxxabi/trunk/src/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=245461&r1=245460&r2=245461&view=diff
==
--- libcxxabi/trunk/src/CMakeLists.txt (original)
+++ libcxxabi/trunk/src/CMakeLists.txt Wed Aug 19 12:17:21 2015
@@ -119,6 +119,14 @@ endif()
 add_custom_target(cxxabi DEPENDS ${LIBCXXABI_TARGETS})
 
 install(TARGETS ${LIBCXXABI_TARGETS}
-  LIBRARY DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX}
-  ARCHIVE DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX}
+  LIBRARY DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT libcxxabi
+  ARCHIVE DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT libcxxabi
   )
+
+if (NOT CMAKE_CONFIGURATION_TYPES)
+  add_custom_target(install-libcxxabi
+DEPENDS cxxabi
+COMMAND "${CMAKE_COMMAND}"
+-DCMAKE_INSTALL_COMPONENT=libcxxabi
+-P "${LIBCXXABI_BINARY_DIR}/cmake_install.cmake")
+endif()


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


r245462 - Add REQUIRES: x86-registered-target to test since it's required.

2015-08-19 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Wed Aug 19 12:18:32 2015
New Revision: 245462

URL: http://llvm.org/viewvc/llvm-project?rev=245462&view=rev
Log:
Add REQUIRES: x86-registered-target to test since it's required.


Modified:
cfe/trunk/test/CodeGen/mingw-long-double-size.c

Modified: cfe/trunk/test/CodeGen/mingw-long-double-size.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mingw-long-double-size.c?rev=245462&r1=245461&r2=245462&view=diff
==
--- cfe/trunk/test/CodeGen/mingw-long-double-size.c (original)
+++ cfe/trunk/test/CodeGen/mingw-long-double-size.c Wed Aug 19 12:18:32 2015
@@ -1,3 +1,4 @@
+// REQUIRES: x86-registered-target
 // RUN: %clang_cc1 -triple i686-pc-windows-gnu -S %s  -o - | FileCheck %s 
-check-prefix=CHECK_I686
 // CHECK_I686: lda,12
 // RUN: %clang_cc1 -triple x86_64-pc-windows-gnu -S %s  -o - | FileCheck %s 
-check-prefix=CHECK_X86_64


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


Re: r245084 - WindowsX86: long double is x87DoubleExtended on mingw

2015-08-19 Thread Yaron Keren via cfe-commits
Sorry to notice late (just diagnosed the issue from a failing boost::math
test), according to i686 ABI, long double size on x86 is 12 bytes (the
memory allocated, not the underlying 80 bits register), see

https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html

-m128bit-long-double
Control the size of long double type. i386 application binary interface
specify the size to be 12 bytes, while modern architectures (Pentium and
newer) prefer long double aligned to 8 or 16 byte boundary. This is
impossible to reach with 12 byte long doubles in the array accesses.
Warning: if you use the -m128bit-long-double switch, the structures and
arrays containing long double will change their size as well as function
calling convention for function taking long double will be modified.

-m96bit-long-double
Set the size of long double to 96 bits as required by the i386 application
binary interface. This is the default.


You can check long double size out by running

#include 
int main() {
  long double a;
  std::cout<:

> On Tue, Aug 18, 2015 at 6:11 PM, Richard Smith 
> wrote:
> > On Tue, Aug 18, 2015 at 3:01 PM, Hans Wennborg 
> wrote:
> >>
> >> Richard, I tried to ping you on the review thread but I'm not sure it
> >> got through. Martell requested this be merged to 3.7. What do you
> >> think?
> >
> >
> > LGTM
>
> Thanks! r245456.
>
> >
> >>
> >> On Fri, Aug 14, 2015 at 12:05 PM, Martell Malone via cfe-commits
> >>  wrote:
> >> > Author: martell
> >> > Date: Fri Aug 14 14:05:56 2015
> >> > New Revision: 245084
> >> >
> >> > URL: http://llvm.org/viewvc/llvm-project?rev=245084&view=rev
> >> > Log:
> >> > WindowsX86: long double is x87DoubleExtended on mingw
> >> >
> >> > Summary:
> >> > long double on x86 mingw is 80bits and is aligned to 16bytes
> >> >
> >> > Fixes:
> >> > https://llvm.org/bugs/show_bug.cgi?id=24398
> >> >
> >> > Reviewers: rnk
> >> >
> >> > Subscribers: cfe-commits
> >> >
> >> > Differential Revision: http://reviews.llvm.org/D12037
> >> >
> >> > Modified:
> >> > cfe/trunk/lib/Basic/Targets.cpp
> >> >
> >> > Modified: cfe/trunk/lib/Basic/Targets.cpp
> >> > URL:
> >> >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245084&r1=245083&r2=245084&view=diff
> >> >
> >> >
> ==
> >> > --- cfe/trunk/lib/Basic/Targets.cpp (original)
> >> > +++ cfe/trunk/lib/Basic/Targets.cpp Fri Aug 14 14:05:56 2015
> >> > @@ -3784,7 +3784,10 @@ namespace {
> >> >  class MinGWX86_32TargetInfo : public WindowsX86_32TargetInfo {
> >> >  public:
> >> >MinGWX86_32TargetInfo(const llvm::Triple &Triple)
> >> > -  : WindowsX86_32TargetInfo(Triple) {}
> >> > +  : WindowsX86_32TargetInfo(Triple) {
> >> > +LongDoubleWidth = LongDoubleAlign = 128;
> >> > +LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
> >> > +  }
> >> >void getTargetDefines(const LangOptions &Opts,
> >> >  MacroBuilder &Builder) const override {
> >> >  WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
> >> > @@ -4014,7 +4017,10 @@ public:
> >> >  class MinGWX86_64TargetInfo : public WindowsX86_64TargetInfo {
> >> >  public:
> >> >MinGWX86_64TargetInfo(const llvm::Triple &Triple)
> >> > -  : WindowsX86_64TargetInfo(Triple) {}
> >> > +  : WindowsX86_64TargetInfo(Triple) {
> >> > +LongDoubleWidth = LongDoubleAlign = 128;
> >> > +LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
> >> > +  }
> >> >void getTargetDefines(const LangOptions &Opts,
> >> >  MacroBuilder &Builder) const override {
> >> >  WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);
> >> >
> >> >
> >> > ___
> >> > 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


[libcxx] r245463 - [libcxx] Allow use of in C++03. Try 3.

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Aug 19 12:21:46 2015
New Revision: 245463

URL: http://llvm.org/viewvc/llvm-project?rev=245463&view=rev
Log:
[libcxx] Allow use of  in C++03. Try 3.

Summary:
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.

The main change in this patch is to replace `__has_feature(cxx_atomic)`, which 
only returns true when C++ >= 11, to `__has_extension(c_atomic)` which returns 
true whenever clang supports the required atomic builtins.


This patch adds the following macros:
* `_LIBCPP_HAS_C_ATOMIC_IMP`  - Defined on clang versions which provide the 
C `_Atomic` keyword.
* `_LIBCPP_HAS_GCC_ATOMIC_IMP` - Defined on GCC > 4.7. We must use the fallback 
atomic implementation.
* `_LIBCPP_HAS_NO_ATOMIC_HEADER` - Defined when it is not safe to include 
``.

`_LIBCPP_HAS_C_ATOMIC_IMP` and `_LIBCPP_HAS_GCC_ATOMIC_IMP` are mutually 
exclusive, only one should be defined. If neither is defined then `` is 
not implemented and including `` will issue an error.

Reviewers: chandlerc, jroelofs, mclow.lists

Subscribers: cfe-commits

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

Added:
libcxx/trunk/test/std/atomics/atomics.flag/init03.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/atomic
libcxx/trunk/include/ios
libcxx/trunk/include/memory
libcxx/trunk/src/ios.cpp
libcxx/trunk/src/memory.cpp
libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp

libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
libcxx/trunk/test/std/atomics/atomics.flag/clear.pass.cpp
libcxx/trunk/test/std/atomics/atomics.flag/init.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp

libcxx/trunk/test/std/atomics

Re: FunctionDecl::getBody() returning nullptr

2015-08-19 Thread Aaron Ballman via cfe-commits
On Wed, Aug 19, 2015 at 11:33 AM, Aaron Ballman  wrote:
> When I run the following test code through clang-tidy -checks=*, I get
> a crash from some relatively strange behavior with FunctionDecl.
>
> template  struct remove_reference  {typedef T type;};
> template  struct remove_reference  {typedef T type;};
> template  struct remove_reference {typedef T type;};
>
> template 
> typename remove_reference::type&& move(T&& arg) {
>   return static_cast::type&&>(arg);
> }
>
> AnalysisConsumer::getModeForDecl() is called, and it has code that
> does: D->hasBody() ? D->getBody()->stuff : stuff;
>
> What's strange is that hasBody() returns true, but getBody() returns
> nullptr. I don't think that this should be possible. I'm wondering
> whether it's purposeful that hasBody() does not check
> Definition->Body?

Looking into this a bit further, the issue is that hasBody() checks
for Definition->Body *or* Definition->IsLateTemplateParsed when
deciding to return true. In my case, Body is null, but
IsLateTemplateParsed is true, so hasBody() returns true. However,
getBody() doesn't have any special logic for late template parsed
function bodies.

> Also, the FunctionDecl in question is for move(), which does have a
> body, so I do not understand why the definition would claim there is
> no body.
>
> Ideas, or should I file a bug report?

From my further look, I wonder if the correct solution to this is to
simply call getBody() and handle a nullptr return instead of calling
hasBody() first. It basically makes the check to ignore late parsed
template bodies an implicit one.

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


Re: [PATCH] D12002: Initial WebAssembly support in clang

2015-08-19 Thread JF Bastien via cfe-commits
jfb added a comment.

Still lgtm, with minor comments.



Comment at: lib/CodeGen/ItaniumCXXABI.cpp:364
@@ +363,3 @@
+ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true,
+  /* UseARMGuardVarABI = */ true) {}
+

It's more common to have no spaces for these comments: 
`/*UseARMMethodPtrABI=*/true,`.


Comment at: lib/Driver/Tools.cpp:1567
@@ +1566,3 @@
+
+#ifdef __wasm__
+// Handle "native" by examining the host.

Could you expand a bit on why "native" doesn't make sense if LLVM itself wasn't 
compiled for wasm?


Repository:
  rL LLVM

http://reviews.llvm.org/D12002



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


Re: [PATCH] D12128: Generating available_externally vtables bugfix

2015-08-19 Thread John McCall via cfe-commits
rjmccall added a comment.

LGTM.


http://reviews.llvm.org/D12128



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


Re: [PATCH] D12117: Replace __asan_set_error_exit_code() with __sanitizer_set_death_callback()

2015-08-19 Thread Alexey Samsonov via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245467: Replace __asan_set_error_exit_code() with 
__sanitizer_set_death_callback() (authored by samsonov).

Changed prior to commit:
  http://reviews.llvm.org/D12117?vs=32456&id=32572#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12117

Files:
  libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp

Index: libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp
===
--- libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp
+++ libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5
+
 // 
 
 // reference operator[](size_type n);
@@ -21,8 +23,11 @@
 #include "test_macros.h"
 
 #ifndef _LIBCPP_HAS_NO_ASAN
-extern "C" void __asan_set_error_exit_code(int);
+extern "C" void __sanitizer_set_death_callback(void (*callback)(void));
 
+void do_exit() {
+  exit(0);
+}
 
 int main()
 {
@@ -48,7 +53,7 @@
 assert(is_contiguous_container_asan_correct(v));
 }
 
-__asan_set_error_exit_code(0);
+__sanitizer_set_death_callback(do_exit);
 {
 typedef int T;
 typedef std::vector C;


Index: libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp
===
--- libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp
+++ libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5
+
 // 
 
 // reference operator[](size_type n);
@@ -21,8 +23,11 @@
 #include "test_macros.h"
 
 #ifndef _LIBCPP_HAS_NO_ASAN
-extern "C" void __asan_set_error_exit_code(int);
+extern "C" void __sanitizer_set_death_callback(void (*callback)(void));
 
+void do_exit() {
+  exit(0);
+}
 
 int main()
 {
@@ -48,7 +53,7 @@
 assert(is_contiguous_container_asan_correct(v));
 }
 
-__asan_set_error_exit_code(0);
+__sanitizer_set_death_callback(do_exit);
 {
 typedef int T;
 typedef std::vector C;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r245467 - Replace __asan_set_error_exit_code() with __sanitizer_set_death_callback()

2015-08-19 Thread Alexey Samsonov via cfe-commits
Author: samsonov
Date: Wed Aug 19 12:28:01 2015
New Revision: 245467

URL: http://llvm.org/viewvc/llvm-project?rev=245467&view=rev
Log:
Replace __asan_set_error_exit_code() with __sanitizer_set_death_callback()

Summary: We are going to remove the former soon.

Reviewers: EricWF

Subscribers: cfe-commits

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

Modified:
libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp

Modified: libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp?rev=245467&r1=245466&r2=245467&view=diff
==
--- libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp 
(original)
+++ libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp Wed Aug 
19 12:28:01 2015
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5
+
 // 
 
 // reference operator[](size_type n);
@@ -21,8 +23,11 @@
 #include "test_macros.h"
 
 #ifndef _LIBCPP_HAS_NO_ASAN
-extern "C" void __asan_set_error_exit_code(int);
+extern "C" void __sanitizer_set_death_callback(void (*callback)(void));
 
+void do_exit() {
+  exit(0);
+}
 
 int main()
 {
@@ -48,7 +53,7 @@ int main()
 assert(is_contiguous_container_asan_correct(v));
 }
 
-__asan_set_error_exit_code(0);
+__sanitizer_set_death_callback(do_exit);
 {
 typedef int T;
 typedef std::vector C;


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


Re: [PATCH] D11697: [libcxx] Add "install-libcxx" target.

2015-08-19 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a reviewer: EricWF.
EricWF added a comment.
This revision is now accepted and ready to land.

http://reviews.llvm.org/D11682 got accepted and this patch is almost identical. 
Accepting this patch so it can be committed.


http://reviews.llvm.org/D11697



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


[PATCH] D12162: Remove reference.

2015-08-19 Thread Angel Garcia via cfe-commits
angelgarcia created this revision.
angelgarcia added a reviewer: alexfh.
angelgarcia added subscribers: cfe-commits, klimek.
angelgarcia changed the visibility of this Differential Revision from "Public 
(No Login Required)" to "All Users".

Remove a reference where a value was intended (its being initialized with 
std::move).

http://reviews.llvm.org/D12162

Files:
  clang-tidy/modernize/UseNullptrCheck.cpp

Index: clang-tidy/modernize/UseNullptrCheck.cpp
===
--- clang-tidy/modernize/UseNullptrCheck.cpp
+++ clang-tidy/modernize/UseNullptrCheck.cpp
@@ -435,7 +435,7 @@
 private:
   SourceManager &SM;
   ASTContext &Context;
-  const SmallVector &UserNullMacros;
+  const SmallVector UserNullMacros;
   ClangTidyCheck &Check;
   Expr *FirstSubExpr;
   bool PruneSubtree;


Index: clang-tidy/modernize/UseNullptrCheck.cpp
===
--- clang-tidy/modernize/UseNullptrCheck.cpp
+++ clang-tidy/modernize/UseNullptrCheck.cpp
@@ -435,7 +435,7 @@
 private:
   SourceManager &SM;
   ASTContext &Context;
-  const SmallVector &UserNullMacros;
+  const SmallVector UserNullMacros;
   ClangTidyCheck &Check;
   Expr *FirstSubExpr;
   bool PruneSubtree;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r245468 - Remove test_atomic.h header

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Aug 19 12:37:34 2015
New Revision: 245468

URL: http://llvm.org/viewvc/llvm-project?rev=245468&view=rev
Log:
Remove test_atomic.h header

Because  can now be used in C++03 there is no need for the 
test_atomic.h header.
This commit removes the header and converts all usages to use  instead.

Removed:
libcxx/trunk/test/support/test_atomic.h
Modified:

libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp

libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp

libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp

Modified: 
libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp?rev=245468&r1=245467&r2=245468&view=diff
==
--- 
libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp
 Wed Aug 19 12:37:34 2015
@@ -16,17 +16,17 @@
 // void notify_one();
 
 #include 
+#include 
 #include 
 #include 
 #include 
 
-#include "test_atomic.h"
 
 std::condition_variable cv;
 std::mutex mut;
 
-AtomicInt test1(0);
-AtomicInt test2(0);
+std::atomic_int test1(0);
+std::atomic_int test2(0);
 
 void f1()
 {

Modified: 
libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp?rev=245468&r1=245467&r2=245468&view=diff
==
--- 
libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
 (original)
+++ 
libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
 Wed Aug 19 12:37:34 2015
@@ -56,14 +56,13 @@
 
 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
-#include "test_atomic.h"
-
 void my_terminate() {
   std::_Exit(0); // Use _Exit to prevent cleanup from taking place.
 }
@@ -76,12 +75,14 @@ bool pred_function() {
 
 class ThrowingMutex
 {
-  AtomicBool locked;
+  std::atomic_bool locked;
   unsigned state = 0;
   ThrowingMutex(const ThrowingMutex&) = delete;
   ThrowingMutex& operator=(const ThrowingMutex&) = delete;
 public:
-  ThrowingMutex() = default;
+  ThrowingMutex() {
+locked = false;
+  }
   ~ThrowingMutex() = default;
 
   void lock() {

Modified: 
libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp?rev=245468&r1=245467&r2=245468&view=diff
==
--- 
libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
 Wed Aug 19 12:37:34 2015
@@ -16,11 +16,10 @@
 // void detach();
 
 #include 
+#include 
 #include 
 
-#include "test_atomic.h"
-
-AtomicBool done(false);
+std::atomic_bool done(false);
 
 class G
 {

Removed: libcxx/trunk/test/support/test_atomic.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_atomic.h?rev=245467&view=auto
==
--- libcxx/trunk/test/support/test_atomic.h (original)
+++ libcxx/trunk/test/support/test_atomic.h (removed)
@@ -1,109 +0,0 @@
-#ifndef SUPPORT_TEST_ATOMIC_H
-#define SUPPORT_TEST_ATOMIC_H
-
-// If the atomic memory order macros are defined then assume
-// the compiler supports the required atomic builtins.
-#if !defined(__ATOMIC_SEQ_CST)
-#define TEST_HAS_NO_ATOMICS
-#endif
-
-template 
-class Atomic {
-   ValType value;
-   Atomic(Atomic const&);
-   Atomic& operator=(Atomic const&);
-   Atomic& operator=(Atomic const&) volatile;
-private:
-  enum {
-#if !defined(TEST_HAS_NO_ATOMICS)
-AO_Relaxed = __ATOMIC_RELAXED,
-AO_Seq = __ATOMIC_SEQ_CST
-#else
-AO_Relaxed,
-AO_Seq
-#endif
-  };
-  template 
-  static inline void atomic_store_imp(Tp* dest, FromType from, int order = 
AO_Seq) {
-#if !defined(TEST_HAS_NO_ATOMICS)
-  __atomic_store_n(dest, from, order);
-#else
-*dest = from;
-#endif
-  }
-
-  template 
-  static inline Tp atomic_load_imp(Tp* from, int order = AO_Seq) {
-#if !defined(TEST_HAS_NO_ATOMICS)
-return __atomic_load_n(from, order);
-#else
-return *from;
-#endif
-  }
-
-  template 
-  static inline Tp atomic_add_imp(Tp

Re: [PATCH] D12162: Remove reference.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy/modernize/UseNullptrCheck.cpp:178
@@ -177,3 +177,3 @@
   CastSequenceVisitor(ASTContext &Context,
   SmallVector UserNullMacros,
   ClangTidyCheck &check)

Please use ArrayRef here and store it in the class.


http://reviews.llvm.org/D12162



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


[libcxx] r245470 - [libcxx] Add "install-libcxx" target.

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Aug 19 12:41:53 2015
New Revision: 245470

URL: http://llvm.org/viewvc/llvm-project?rev=245470&view=rev
Log:
[libcxx] Add "install-libcxx" target.

Summary: Currently you can't install libc++ from within the LLVM tree without 
installing all of LLVM. This patch adds an install rule for libc++.

Reviewers: mclow.lists, danalbert, jroelofs, EricWF

Subscribers: cfe-commits

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

Modified:
libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
libcxx/trunk/include/CMakeLists.txt
libcxx/trunk/lib/CMakeLists.txt

Modified: libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake?rev=245470&r1=245469&r2=245470&view=diff
==
--- libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake (original)
+++ libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake Wed Aug 19 12:41:53 2015
@@ -43,6 +43,7 @@ macro(setup_abi_lib abidefines abilib ab
   )
 install(FILES "${CMAKE_BINARY_DIR}/include/${fpath}"
   DESTINATION include/c++/v1/${dstdir}
+  COMPONENT libcxx
   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
   )
 list(APPEND abilib_headers "${CMAKE_BINARY_DIR}/include/${fpath}")

Modified: libcxx/trunk/include/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/CMakeLists.txt?rev=245470&r1=245469&r2=245470&view=diff
==
--- libcxx/trunk/include/CMakeLists.txt (original)
+++ libcxx/trunk/include/CMakeLists.txt Wed Aug 19 12:41:53 2015
@@ -17,6 +17,7 @@ file(COPY .
 if (LIBCXX_INSTALL_HEADERS)
   install(DIRECTORY .
 DESTINATION include/c++/v1
+COMPONENT libcxx
 FILES_MATCHING
 ${LIBCXX_HEADER_PATTERN}
 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=245470&r1=245469&r2=245470&view=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Wed Aug 19 12:41:53 2015
@@ -134,6 +134,14 @@ set_target_properties(cxx
   )
 
 install(TARGETS cxx
-  LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX}
-  ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX}
+  LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
+  ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
   )
+
+if (NOT CMAKE_CONFIGURATION_TYPES)
+  add_custom_target(install-libcxx
+DEPENDS cxx
+COMMAND "${CMAKE_COMMAND}"
+-DCMAKE_INSTALL_COMPONENT=libcxx
+-P "${LIBCXX_BINARY_DIR}/cmake_install.cmake")
+endif()


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


[PATCH] D12163: [Patch] [Analyzer] BugReporter.cpp:2869: Assertion failed: !RemainingNodes.empty() && "No error node found in the trimmed graph" (PR 24184)

2015-08-19 Thread Ying Yi via cfe-commits
MaggieYi created this revision.
MaggieYi added a reviewer: krememek.
MaggieYi added a subscriber: cfe-commits.

Dear All,

I would like to propose a patch to solve an assertion failure reported by 
Dmitry in https://llvm.org/bugs/show_bug.cgi?id=24184.

The assertion is caused by reusing a “filler” ExplodedNode as an error node. 
The “filler” nodes are only used for intermediate processing and are not 
essential for analyzer history, so they can be reclaimed when the ExplodedGraph 
is trimmed by the “collectNode” function. When a checker finds a bug, they 
generate a new transition in the ExplodedGraph. The analyzer will try to reuse 
the existing predecessor node. If it cannot, it creates a new ExplodedNode, 
which always has a tag to uniquely identify the creation site. The assertion is 
caused when the analyzer reuses a “filler” node. 

In the test case, some “filler” nodes were reused and then reclaimed later when 
the ExplodedGraph was trimmed. This caused an assertion because the node was 
needed to generate the report. The “filler” nodes should not be reused as error 
nodes. The patch adds a constraint to prevent this happening, which solves the 
problem and makes the test cases pass. 

Please let me know if this is an acceptable patch.

Regards,

Ying Yi
SN Systems Ltd - Sony Computer Entertainment Group.

http://reviews.llvm.org/D12163

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
  test/Analysis/PR24184.cpp
  test/Analysis/malloc.c

Index: test/Analysis/malloc.c
===
--- test/Analysis/malloc.c
+++ test/Analysis/malloc.c
@@ -1386,7 +1386,8 @@
   int *s;
   char *b = realloc(a->p, size);
   char *m = realloc(a->p, size); // expected-warning {{Attempt to free released memory}}
-  return a->p;
+  //PR24184: Object "a->p" was returned at next line after being freed by calling "realloc" at previous line.
+  return a->p; // expected-warning {{Use of memory after it is freed}}
 }
 
 // We should not warn in this case since the caller will presumably free a->p in all cases.
Index: test/Analysis/PR24184.cpp
===
--- /dev/null
+++ test/Analysis/PR24184.cpp
@@ -0,0 +1,97 @@
+// RUN: %clang_cc1 -w -analyze -analyzer-eagerly-assume -fcxx-exceptions -analyzer-checker=core -analyzer-checker=alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 64 -verify %s
+// RUN: %clang_cc1 -w -analyze -analyzer-checker=core -analyzer-checker=cplusplus -fcxx-exceptions -analyzer-checker alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 63 -verify %s
+
+// These tests used to hit an assertion in the bug report. Test case from http://llvm.org/PR24184.
+typedef struct {
+  int cbData;
+  unsigned pbData;
+} CRYPT_DATA_BLOB;
+
+typedef enum { DT_NONCE_FIXED } DATA_TYPE;
+int a;
+typedef int *vcreate_t(int *, DATA_TYPE, int, int);
+void fn1(unsigned, unsigned) {
+  char b = 0;
+  for (; 1; a++, &b + a * 0) // expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}}
+;
+}
+
+vcreate_t fn2;
+struct A {
+  CRYPT_DATA_BLOB value;
+  int m_fn1() {
+int c;
+value.pbData == 0;
+fn1(0, 0);
+  }
+};
+struct B {
+  A IkeHashAlg;
+  A IkeGType;
+  A NoncePhase1_r;
+};
+class C {
+  int m_fn2(B *);
+  void m_fn3(B *, int, int, int);
+};
+int C::m_fn2(B *p1) {
+  int *d;
+  int e = p1->IkeHashAlg.m_fn1();
+  unsigned f = p1->IkeGType.m_fn1(), h;
+  int g;
+  d = fn2(0, DT_NONCE_FIXED, (char)0, p1->NoncePhase1_r.value.cbData);
+  h = 0 | 0;
+  m_fn3(p1, 0, 0, 0);
+}
+
+// case 2:
+typedef struct {
+  int cbData;
+  unsigned char *pbData;
+} CRYPT_DATA_BLOB_1;
+typedef unsigned uint32_t;
+void fn1_1(void *p1, const void *p2) { p1 != p2; }
+
+void fn2_1(uint32_t *p1, unsigned char *p2, uint32_t p3) {
+  unsigned i = 0;
+  for (0; i < p3; i++)
+fn1_1(p1 + i, p2 + i * 0);// expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}}
+}
+
+struct A_1 {
+  CRYPT_DATA_BLOB_1 value;
+  uint32_t m_fn1() {
+uint32_t a;
+if (value.pbData)
+  fn2_1(&a, value.pbData, value.cbData);
+return 0;
+  }
+};
+struct {
+  A_1 HashAlgId;
+} *b;
+void fn3() {
+  uint32_t c, d;
+  d = b->HashAlgId.m_fn1();
+  d << 0 | 0 | 0;
+  c = 0;
+  0 | 1 << 0 | 0 && b;
+}
+
+// case 3:
+struct ST {
+  char c;
+};
+char *p;
+int foo1(ST);
+int foo2() {
+  ST *p1 = (ST *)(p);  // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption}}
+  while (p1->c & 0x0F || p1->c & 0x07)
+p1 = p1 + foo1(*p1);
+}
+
+int foo3(int *node) {
+  int i = foo2();
+  if (i)
+return foo2();
+}
\ No newline at end of file
Index: include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
===
--- inc

Re: [PATCH] D11740: ABI versioning macros for libc++

2015-08-19 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Some more questions:

- Should bumping the ABI major version bump the SO version?
- Should bumping the ABI major version change the include path from 
`include/c++/v1` to `include/c++/v2`? What kind of clang support do we need to 
do this?


Repository:
  rL LLVM

http://reviews.llvm.org/D11740



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


Re: [PATCH] D12162: Remove reference.

2015-08-19 Thread Angel Garcia via cfe-commits
angelgarcia changed the visibility of this Differential Revision from "All 
Users" to "Public (No Login Required)".
angelgarcia updated this revision to Diff 32576.
angelgarcia added a comment.

Use ArrayRef.


http://reviews.llvm.org/D12162

Files:
  clang-tidy/modernize/UseNullptrCheck.cpp

Index: clang-tidy/modernize/UseNullptrCheck.cpp
===
--- clang-tidy/modernize/UseNullptrCheck.cpp
+++ clang-tidy/modernize/UseNullptrCheck.cpp
@@ -175,10 +175,10 @@
 class CastSequenceVisitor : public RecursiveASTVisitor {
 public:
   CastSequenceVisitor(ASTContext &Context,
-  SmallVector UserNullMacros,
+  ArrayRef UserNullMacros,
   ClangTidyCheck &check)
   : SM(Context.getSourceManager()), Context(Context),
-UserNullMacros(std::move(UserNullMacros)), Check(check),
+UserNullMacros(UserNullMacros), Check(check),
 FirstSubExpr(nullptr), PruneSubtree(false) {}
 
   bool TraverseStmt(Stmt *S) {
@@ -435,7 +435,7 @@
 private:
   SourceManager &SM;
   ASTContext &Context;
-  const SmallVector &UserNullMacros;
+  ArrayRef UserNullMacros;
   ClangTidyCheck &Check;
   Expr *FirstSubExpr;
   bool PruneSubtree;


Index: clang-tidy/modernize/UseNullptrCheck.cpp
===
--- clang-tidy/modernize/UseNullptrCheck.cpp
+++ clang-tidy/modernize/UseNullptrCheck.cpp
@@ -175,10 +175,10 @@
 class CastSequenceVisitor : public RecursiveASTVisitor {
 public:
   CastSequenceVisitor(ASTContext &Context,
-  SmallVector UserNullMacros,
+  ArrayRef UserNullMacros,
   ClangTidyCheck &check)
   : SM(Context.getSourceManager()), Context(Context),
-UserNullMacros(std::move(UserNullMacros)), Check(check),
+UserNullMacros(UserNullMacros), Check(check),
 FirstSubExpr(nullptr), PruneSubtree(false) {}
 
   bool TraverseStmt(Stmt *S) {
@@ -435,7 +435,7 @@
 private:
   SourceManager &SM;
   ASTContext &Context;
-  const SmallVector &UserNullMacros;
+  ArrayRef UserNullMacros;
   ClangTidyCheck &Check;
   Expr *FirstSubExpr;
   bool PruneSubtree;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r245344 - [sanitizer] Add -lutil to static runtime link flags.

2015-08-19 Thread H.J. Lu via cfe-commits
On Tue, Aug 18, 2015 at 1:36 PM, Evgeniy Stepanov via cfe-commits
 wrote:
> Author: eugenis
> Date: Tue Aug 18 15:36:11 2015
> New Revision: 245344
>
> URL: http://llvm.org/viewvc/llvm-project?rev=245344&view=rev
> Log:
> [sanitizer] Add -lutil to static runtime link flags.
>
> This is needed to prevent breakage of -Wl,-as-needed link when
> interceptors for functions in libutil are added. See PR15823.
>

This caused:

https://llvm.org/bugs/show_bug.cgi?id=24503

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


Re: [PATCH] D12162: Remove reference.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Thanks! LG


http://reviews.llvm.org/D12162



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


[clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 19 12:50:22 2015
New Revision: 245471

URL: http://llvm.org/viewvc/llvm-project?rev=245471&view=rev
Log:
[clang-tidy] Fix a bug in UseNullptrCheck.

http://reviews.llvm.org/D12162

Patch by Angel Garcia!

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=245471&r1=245470&r2=245471&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed Aug 19 
12:50:22 2015
@@ -175,10 +175,10 @@ private:
 class CastSequenceVisitor : public RecursiveASTVisitor {
 public:
   CastSequenceVisitor(ASTContext &Context,
-  SmallVector UserNullMacros,
+  ArrayRef UserNullMacros,
   ClangTidyCheck &check)
   : SM(Context.getSourceManager()), Context(Context),
-UserNullMacros(std::move(UserNullMacros)), Check(check),
+UserNullMacros(UserNullMacros), Check(check),
 FirstSubExpr(nullptr), PruneSubtree(false) {}
 
   bool TraverseStmt(Stmt *S) {
@@ -435,7 +435,7 @@ private:
 private:
   SourceManager &SM;
   ASTContext &Context;
-  const SmallVector &UserNullMacros;
+  ArrayRef UserNullMacros;
   ClangTidyCheck &Check;
   Expr *FirstSubExpr;
   bool PruneSubtree;


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


Re: [PATCH] D12162: Remove reference.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh closed this revision.
alexfh added a comment.

Committed revision 245471.


http://reviews.llvm.org/D12162



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


[PATCH] D12164: Stop treating -static as overriding -fPIC: they are distinct.

2015-08-19 Thread James Y Knight via cfe-commits
jyknight created this revision.
jyknight added a reviewer: joerg.
jyknight added subscribers: rnk, jevinskie, tberghammer, danalbert, srhines, 
cfe-commits.

For some reason, clang had been treating a command like:
 clang -static -fPIC foo.c
as if it should be compiled without the PIC relocation model.

This was incorrect: -static should be affecting only the linking
model, and -fPIC only the compilation.

This new behavior also matches GCC.

This is a follow-up from a review comment on r245447.

http://reviews.llvm.org/D12164

Files:
  lib/Driver/Tools.cpp
  test/Driver/pic.c

Index: test/Driver/pic.c
===
--- test/Driver/pic.c
+++ test/Driver/pic.c
@@ -11,6 +11,7 @@
 // CHECK-PIC2: "-mrelocation-model" "pic"
 // CHECK-PIC2: "-pic-level" "2"
 //
+// CHECK-STATIC: "-static"
 // CHECK-NO-STATIC-NOT: "-static"
 //
 // CHECK-PIE1: "-mrelocation-model" "pic"
@@ -135,8 +136,15 @@
 // Disregard any of the PIC-specific flags if we have a trump-card flag.
 // RUN: %clang -c %s -target i386-unknown-unknown -mkernel -fPIC -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
+
+// The -static argument *doesn't* override PIC: -static only affects
+// linking, and -fPIC only affects code generation.
 // RUN: %clang -c %s -target i386-unknown-unknown -static -fPIC -### 2>&1 \
-// RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang %s -target i386-linux-gnu -static -fPIC -### \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-STATIC
 //
 // On Linux, disregard -pie if we have -shared.
 // RUN: %clang %s -target i386-unknown-linux -shared -pie -### 2>&1 \
@@ -207,7 +215,7 @@
 // RUN: %clang -c %s -target armv7-apple-ios -fapple-kext 
-miphoneos-version-min=5.0.0 -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
 // RUN: %clang -c %s -target armv7-apple-ios -fapple-kext 
-miphoneos-version-min=6.0.0 -static -### 2>&1 \
-// RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
 //
 // On OpenBSD, PIE is enabled by default, but can be disabled.
 // RUN: %clang -c %s -target amd64-pc-openbsd -### 2>&1 \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3022,12 +3022,11 @@
   if (PIC && ToolChain.getTriple().isOSDarwin())
 IsPICLevelTwo |= ToolChain.isPICDefault();
 
-  // Note that these flags are trump-cards. Regardless of the order w.r.t. the
-  // PIC or PIE options above, if these show up, PIC is disabled.
+  // Note that this flag is a trump-cards. Regardless of the order
+  // w.r.t. the PIC or PIE options above, if it shows up, PIC is
+  // disabled.
   if (KernelOrKext && (!Triple.isiOS() || Triple.isOSVersionLT(6)))
 PIC = PIE = false;
-  if (Args.hasArg(options::OPT_static))
-PIC = PIE = false;
 
   if (Arg *A = Args.getLastArg(options::OPT_mdynamic_no_pic)) {
 // This is a very special mode. It trumps the other modes, almost no one


Index: test/Driver/pic.c
===
--- test/Driver/pic.c
+++ test/Driver/pic.c
@@ -11,6 +11,7 @@
 // CHECK-PIC2: "-mrelocation-model" "pic"
 // CHECK-PIC2: "-pic-level" "2"
 //
+// CHECK-STATIC: "-static"
 // CHECK-NO-STATIC-NOT: "-static"
 //
 // CHECK-PIE1: "-mrelocation-model" "pic"
@@ -135,8 +136,15 @@
 // Disregard any of the PIC-specific flags if we have a trump-card flag.
 // RUN: %clang -c %s -target i386-unknown-unknown -mkernel -fPIC -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
+
+// The -static argument *doesn't* override PIC: -static only affects
+// linking, and -fPIC only affects code generation.
 // RUN: %clang -c %s -target i386-unknown-unknown -static -fPIC -### 2>&1 \
-// RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang %s -target i386-linux-gnu -static -fPIC -### \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-STATIC
 //
 // On Linux, disregard -pie if we have -shared.
 // RUN: %clang %s -target i386-unknown-linux -shared -pie -### 2>&1 \
@@ -207,7 +215,7 @@
 // RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=5.0.0 -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
 // RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -static -### 2>&1 \
-// RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
 //
 // On OpenBSD, PIE is enabled by default, but can be disabled.
 // RUN: %clang -c %s -target amd64-pc-openbsd -### 2>&1 \
Index: lib/Driver/Tools.cpp
===
--- li

Re: [PATCH] D12164: Stop treating -static as overriding -fPIC: they are distinct.

2015-08-19 Thread Dan Albert via cfe-commits
danalbert added inline comments.


Comment at: lib/Driver/Tools.cpp:3025
@@ -3024,3 +3024,3 @@
 
-  // Note that these flags are trump-cards. Regardless of the order w.r.t. the
-  // PIC or PIE options above, if these show up, PIC is disabled.
+  // Note that this flag is a trump-cards. Regardless of the order
+  // w.r.t. the PIC or PIE options above, if it shows up, PIC is

trump-card (singular)


http://reviews.llvm.org/D12164



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


Re: [PATCH] D11963: Create a __config_site file to capture configuration decisions.

2015-08-19 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D11963#228024, @EricWF wrote:

> Wouldn't it still be a mess if you build both libc++ and libc++abi 
> out-of-tree? The user would have to be aware of these weird requirements.


Oh, yeah, true. Do we have any out-of-tree builders to make sure those 
configurations are supported?


http://reviews.llvm.org/D11963



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


Re: r245459 - According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.

2015-08-19 Thread Richard Smith via cfe-commits
On Wed, Aug 19, 2015 at 10:02 AM, Yaron Keren via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: yrnkrn
> Date: Wed Aug 19 12:02:32 2015
> New Revision: 245459
>
> URL: http://llvm.org/viewvc/llvm-project?rev=245459&view=rev
> Log:
> According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.
> See
>  https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html
>
>
> Added:
> cfe/trunk/test/CodeGen/mingw-long-double-size.c
> Modified:
> cfe/trunk/lib/Basic/Targets.cpp
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245459&r1=245458&r2=245459&view=diff
>
> ==
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Wed Aug 19 12:02:32 2015
> @@ -3785,7 +3785,8 @@ class MinGWX86_32TargetInfo : public Win
>  public:
>MinGWX86_32TargetInfo(const llvm::Triple &Triple)
>: WindowsX86_32TargetInfo(Triple) {
> -LongDoubleWidth = LongDoubleAlign = 128;
> +LongDoubleWidth = 96;
> +LongDoubleAlign = 128;
>

Is this really correct? It's deeply suspicious that the size is not a
multiple of the alignment.


>  LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
>}
>void getTargetDefines(const LangOptions &Opts,
>
> Added: cfe/trunk/test/CodeGen/mingw-long-double-size.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mingw-long-double-size.c?rev=245459&view=auto
>
> ==
> --- cfe/trunk/test/CodeGen/mingw-long-double-size.c (added)
> +++ cfe/trunk/test/CodeGen/mingw-long-double-size.c Wed Aug 19 12:02:32
> 2015
> @@ -0,0 +1,5 @@
> +// RUN: %clang_cc1 -triple i686-pc-windows-gnu -S %s  -o - | FileCheck %s
> -check-prefix=CHECK_I686
> +// CHECK_I686: lda,12
> +// RUN: %clang_cc1 -triple x86_64-pc-windows-gnu -S %s  -o - | FileCheck
> %s -check-prefix=CHECK_X86_64
> +// CHECK_X86_64: lda,16
> +long double lda;
>
>
> ___
> 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] D12128: Generating available_externally vtables bugfix

2015-08-19 Thread Piotr Padlewski via cfe-commits
Prazek updated this revision to Diff 32587.

http://reviews.llvm.org/D12128

Files:
  include/clang/AST/VTableBuilder.h
  lib/CodeGen/ItaniumCXXABI.cpp
  test/CodeGenCXX/vtable-available-externally.cpp

Index: test/CodeGenCXX/vtable-available-externally.cpp
===
--- test/CodeGenCXX/vtable-available-externally.cpp
+++ test/CodeGenCXX/vtable-available-externally.cpp
@@ -7,6 +7,10 @@
 // RUN: FileCheck --check-prefix=CHECK-TEST9 %s < %t.opt
 // RUN: FileCheck --check-prefix=CHECK-TEST10 %s < %t.opt
 // RUN: FileCheck --check-prefix=CHECK-TEST11 %s < %t.opt
+// RUN: FileCheck --check-prefix=CHECK-TEST12 %s < %t.opt
+// RUN: FileCheck --check-prefix=CHECK-TEST13 %s < %t.opt
+// RUN: FileCheck --check-prefix=CHECK-TEST14 %s < %t.opt
+// RUN: FileCheck --check-prefix=CHECK-TEST15 %s < %t.opt
 
 #include 
 
@@ -289,3 +293,76 @@
   g(d);
 }
 }  // Test 11
+
+namespace Test12 {
+
+// CHECK-TEST12: @_ZTVN6Test121AE = external unnamed_addr constant
+struct A {
+  virtual void foo();
+  virtual ~A() {}
+};
+// CHECK-TEST12: @_ZTVN6Test121BE = external unnamed_addr constant
+struct B : A {
+  void foo();
+};
+
+void g() {
+  A a;
+  a.foo();
+  B b;
+  b.foo();
+}
+}
+
+namespace Test13 {
+
+// CHECK-TEST13-DAG: @_ZTVN6Test131AE = available_externally unnamed_addr constant
+// CHECK-TEST13-DAG: @_ZTVN6Test131BE = external unnamed_addr constant
+struct A {
+  virtual ~A();
+};
+struct B : A {
+  virtual void f();
+  void operator delete(void *);
+  ~B() {}
+};
+
+void g() {
+  A *b = new B;
+}
+}
+
+namespace Test14 {
+
+// CHECK-TEST14: @_ZTVN6Test141AE = available_externally unnamed_addr constant
+struct A {
+  virtual void f();
+  void operator delete(void *);
+  ~A();
+};
+
+void g() {
+  A *b = new A;
+  delete b;
+}
+}
+
+namespace Test15 {
+// In this test D's vtable has two slots for function f(), but uses only one,
+// so the second slot is set to null.
+// CHECK-TEST15: @_ZTVN6Test151DE = available_externally unnamed_addr constant
+struct A { virtual void f() {} };
+struct B : virtual A {};
+struct C : virtual A {};
+struct D : B, C {
+  virtual void g();
+  void f();
+};
+
+void test() {
+  D * d = new D;
+  d->f();
+}
+}
+
+
Index: lib/CodeGen/ItaniumCXXABI.cpp
===
--- lib/CodeGen/ItaniumCXXABI.cpp
+++ lib/CodeGen/ItaniumCXXABI.cpp
@@ -320,17 +320,15 @@
   void emitCXXStructor(const CXXMethodDecl *MD, StructorType Type) override;
 
  private:
-  /// Checks if function has any virtual inline function.
-  bool hasAnyVirtualInlineFunction(const CXXRecordDecl *RD) const {
+   bool hasAnyUsedVirtualInlineFunction(const CXXRecordDecl *RD) const {
 const auto &VtableLayout =
 CGM.getItaniumVTableContext().getVTableLayout(RD);
 
 for (const auto &VtableComponent : VtableLayout.vtable_components()) {
-  if (VtableComponent.getKind() !=
-  VTableComponent::Kind::CK_FunctionPointer)
+  if (!VtableComponent.isUsedFunctionPointerKind())
 continue;
 
-  const auto &Method = VtableComponent.getFunctionDecl();
+  const CXXMethodDecl *Method = VtableComponent.getFunctionDecl();
   if (Method->getCanonicalDecl()->isInlined())
 return true;
 }
@@ -1536,7 +1534,7 @@
   // then we are safe to emit available_externally copy of vtable.
   // FIXME we can still emit a copy of the vtable if we
   // can emit definition of the inline functions.
-  return !hasAnyVirtualInlineFunction(RD);
+  return !hasAnyUsedVirtualInlineFunction(RD);
 }
 static llvm::Value *performTypeAdjustment(CodeGenFunction &CGF,
   llvm::Value *Ptr,
Index: include/clang/AST/VTableBuilder.h
===
--- include/clang/AST/VTableBuilder.h
+++ include/clang/AST/VTableBuilder.h
@@ -123,30 +123,50 @@
 
   const CXXRecordDecl *getRTTIDecl() const {
 assert(getKind() == CK_RTTI && "Invalid component kind!");
-
 return reinterpret_cast(getPointer());
   }
 
   const CXXMethodDecl *getFunctionDecl() const {
-assert(getKind() == CK_FunctionPointer);
-
+assert(isFunctionPointerKind() && "Invalid component kind!");
+if (isDestructorKind())
+  return getDestructorDecl();
 return reinterpret_cast(getPointer());
   }
 
   const CXXDestructorDecl *getDestructorDecl() const {
-assert((getKind() == CK_CompleteDtorPointer ||
-getKind() == CK_DeletingDtorPointer) && "Invalid component kind!");
-
+assert(isDestructorKind() && "Invalid component kind!");
 return reinterpret_cast(getPointer());
   }
 
   const CXXMethodDecl *getUnusedFunctionDecl() const {
-assert(getKind() == CK_UnusedFunctionPointer);
-
+assert(getKind() == CK_UnusedFunctionPointer && "Invalid component kind!");
 return reinterpret_cast(getPointer());
   }
 
+  bool isDestructorKind() const { return isDestructorKind(getKind()); }
+
+  bool isUsedFunctionPointerKind() co

Re: [PATCH] D12047: test/SemaObjC: Remove cruft in unused getter test

2015-08-19 Thread John McCall via cfe-commits
rjmccall added a comment.

Sure, fine to me.


http://reviews.llvm.org/D12047



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


Re: r245459 - According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.

2015-08-19 Thread Yaron Keren via cfe-commits
Yes, it looks like a legacy issue. Documentation says so:

*https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/i386-and-x86-64-Options.html
*

-m96bit-long-double-m128bit-long-doubleThese switches control the size of long
double type. The i386 application binary interface specifies the size to be
96 bits, so -m96bit-long-double is the default in 32-bit mode.

Modern architectures (Pentium and newer) prefer long double to be aligned
to an 8- or 16-byte boundary. In arrays or structures conforming to the
ABI, this is not possible. So specifying -m128bit-long-double aligns long
double to a 16-byte boundary by padding the long double with an additional
32-bit zero.

In the x86-64 compiler, -m128bit-long-double is the default choice as its
ABI specifies that long double is aligned on 16-byte boundary.

Notice that neither of these options enable any extra precision over the
x87 standard of 80 bits for a long double.

*Warning:* if you override the default value for your target ABI, this
changes the size of structures and arrays containing long double variables,
as well as modifying the function calling convention for functions taking long
double. Hence they are not binary-compatible with code compiled without
that switch.

And practical testing agrees:

sh-4.3$ cat < a.cpp
#include 
int main() {
  long double a;
  std::cout On Wed, Aug 19, 2015 at 10:02 AM, Yaron Keren via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: yrnkrn
>> Date: Wed Aug 19 12:02:32 2015
>> New Revision: 245459
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=245459&view=rev
>> Log:
>> According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.
>> See
>>  https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html
>>
>>
>> Added:
>> cfe/trunk/test/CodeGen/mingw-long-double-size.c
>> Modified:
>> cfe/trunk/lib/Basic/Targets.cpp
>>
>> Modified: cfe/trunk/lib/Basic/Targets.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245459&r1=245458&r2=245459&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Basic/Targets.cpp (original)
>> +++ cfe/trunk/lib/Basic/Targets.cpp Wed Aug 19 12:02:32 2015
>> @@ -3785,7 +3785,8 @@ class MinGWX86_32TargetInfo : public Win
>>  public:
>>MinGWX86_32TargetInfo(const llvm::Triple &Triple)
>>: WindowsX86_32TargetInfo(Triple) {
>> -LongDoubleWidth = LongDoubleAlign = 128;
>> +LongDoubleWidth = 96;
>> +LongDoubleAlign = 128;
>>
>
> Is this really correct? It's deeply suspicious that the size is not a
> multiple of the alignment.
>
>
>>  LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
>>}
>>void getTargetDefines(const LangOptions &Opts,
>>
>> Added: cfe/trunk/test/CodeGen/mingw-long-double-size.c
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mingw-long-double-size.c?rev=245459&view=auto
>>
>> ==
>> --- cfe/trunk/test/CodeGen/mingw-long-double-size.c (added)
>> +++ cfe/trunk/test/CodeGen/mingw-long-double-size.c Wed Aug 19 12:02:32
>> 2015
>> @@ -0,0 +1,5 @@
>> +// RUN: %clang_cc1 -triple i686-pc-windows-gnu -S %s  -o - | FileCheck
>> %s -check-prefix=CHECK_I686
>> +// CHECK_I686: lda,12
>> +// RUN: %clang_cc1 -triple x86_64-pc-windows-gnu -S %s  -o - | FileCheck
>> %s -check-prefix=CHECK_X86_64
>> +// CHECK_X86_64: lda,16
>> +long double lda;
>>
>>
>> ___
>> 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] D11781: Refactored pthread usage in libcxx

2015-08-19 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In http://reviews.llvm.org/D11781#227606, @espositofulvio wrote:

> In http://reviews.llvm.org/D11781#227446, @EricWF wrote:
>
> > This patch has a long way to go but it has also come a long way. Here are a 
> > couple of problems I see with it.
> >
> > 2. This patch adds a lot of headers. libc++ has historically tried to keep 
> > the number of headers to a minimum for the reason that filesystem 
> > operations are expensive and its cheaper to include a few big headers as 
> > opposed to many small ones.
>
>
> I know but it was a request from reviewers so that platform specific decision 
> were localized. I can obviously merge all of the support/mutex.h, 
> support/thread.h and support/condition_variable.h in a single 
> support/thread.h if that's the case.


Sorry for giving conflicting feedback. I'm happy with multiple headers for now. 
We can always address it later.



Comment at: src/algorithm.cpp:51
@@ -50,3 +50,3 @@
 #ifndef _LIBCPP_HAS_NO_THREADS
-static pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER;
+static mutex __rs_mut;
 #endif

espositofulvio wrote:
> EricWF wrote:
> > I think this prevents __rs_mut from being initialized during constant 
> > initialization. 
> > (http://en.cppreference.com/w/cpp/language/constant_initialization)
> I think this falls in the second case:
> 
> Static or thread-local object of class type that is initialized by a 
> constructor call, if the constructor is constexpr and all constructor 
> arguments (including implicit conversions) are constant expressions, and if 
> the initializers in the constructor's initializer list and the brace-or-equal 
> initializers of the class memebers only contain constant expressions.
> 
> but I was actually relying on the fact that we have constexpr, which now I 
> understand could not be the case.
The top of the documentation it shows the syntax that is required to get 
constant initialization. The initialization must have the form `T obj = 
`. I would be fine relying on constexpr though.


Repository:
  rL LLVM

http://reviews.llvm.org/D11781



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


Re: [PATCH] D11815: Pass subtarget feature "force-align-stack"

2015-08-19 Thread Akira Hatanaka via cfe-commits
ahatanak updated this revision to Diff 32592.
ahatanak added a comment.

This patch makes changes to record function attribute "force-align-stack" 
instead of recording it as a subtarget feature.


http://reviews.llvm.org/D11815

Files:
  include/clang/Driver/CC1Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CGCall.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp

Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -569,6 +569,8 @@
   Opts.SSPBufferSize =
   getLastArgIntValue(Args, OPT_stack_protector_buffer_size, 8, Diags);
   Opts.StackRealignment = Args.hasArg(OPT_mstackrealign);
+  Opts.ForceAlignStack = Args.hasArg(OPT_force_align_stack);
+
   if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) {
 StringRef Val = A->getValue();
 unsigned StackAlignment = Opts.StackAlignment;
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4228,10 +4228,9 @@
 
   // Translate -mstackrealign
   if (Args.hasFlag(options::OPT_mstackrealign, options::OPT_mno_stackrealign,
-   false)) {
-CmdArgs.push_back("-backend-option");
-CmdArgs.push_back("-force-align-stack");
-  }
+   false))
+CmdArgs.push_back(Args.MakeArgString("-force-align-stack"));
+
   if (!Args.hasFlag(options::OPT_mno_stackrealign, options::OPT_mstackrealign,
 false)) {
 CmdArgs.push_back(Args.MakeArgString("-mstackrealign"));
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1491,6 +1491,8 @@
 
 if (!CodeGenOpts.StackRealignment)
   FuncAttrs.addAttribute("no-realign-stack");
+else if (CodeGenOpts.ForceAlignStack)
+  FuncAttrs.addAttribute("force-align-stack");
 
 // Add target-cpu and target-features attributes to functions. If
 // we have a decl for the function and it has a target attribute then
Index: include/clang/Frontend/CodeGenOptions.def
===
--- include/clang/Frontend/CodeGenOptions.def
+++ include/clang/Frontend/CodeGenOptions.def
@@ -152,6 +152,8 @@
 
 CODEGENOPT(StackRealignment  , 1, 0) ///< Control whether to permit stack
  ///< realignment.
+CODEGENOPT(ForceAlignStack  , 1, 0) ///< Control whether to force stack
+///< realignment.
 CODEGENOPT(UseInitArray  , 1, 0) ///< Control whether to use .init_array or
  ///< .ctors.
 VALUE_CODEGENOPT(StackAlignment, 32, 0) ///< Overrides default stack 
Index: include/clang/Driver/CC1Options.td
===
--- include/clang/Driver/CC1Options.td
+++ include/clang/Driver/CC1Options.td
@@ -170,6 +170,8 @@
   HelpText<"Emit an error if a C++ static local initializer would need a guard 
variable">;
 def no_implicit_float : Flag<["-"], "no-implicit-float">,
   HelpText<"Don't generate implicit floating point instructions">;
+def force_align_stack : Flag<["-"], "force-align-stack">,
+  HelpText<"Force realign the stack at entry to every function">;
 def fdump_vtable_layouts : Flag<["-"], "fdump-vtable-layouts">,
   HelpText<"Dump the layouts of all vtables that will be emitted in a 
translation unit">;
 def fmerge_functions : Flag<["-"], "fmerge-functions">,


Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -569,6 +569,8 @@
   Opts.SSPBufferSize =
   getLastArgIntValue(Args, OPT_stack_protector_buffer_size, 8, Diags);
   Opts.StackRealignment = Args.hasArg(OPT_mstackrealign);
+  Opts.ForceAlignStack = Args.hasArg(OPT_force_align_stack);
+
   if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) {
 StringRef Val = A->getValue();
 unsigned StackAlignment = Opts.StackAlignment;
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4228,10 +4228,9 @@
 
   // Translate -mstackrealign
   if (Args.hasFlag(options::OPT_mstackrealign, options::OPT_mno_stackrealign,
-   false)) {
-CmdArgs.push_back("-backend-option");
-CmdArgs.push_back("-force-align-stack");
-  }
+   false))
+CmdArgs.push_back(Args.MakeArgString("-force-align-stack"));
+
   if (!Args.hasFlag(options::OPT_mno_stackrealign, options::OPT_mstackrealign,
 false)) {
 CmdArgs.push_back(Args.MakeArgString("-mstackrealign"));
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeG

Re: [PATCH] D12022: Refactored dtor sanitizing into EHScopeStack

2015-08-19 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

+cfe-commits


http://reviews.llvm.org/D12022



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


[clang-tools-extra] r245484 - Replacing a custom AST matcher with some builtin AST matchers; NFC, and existing tests should provide sufficient coverage.

2015-08-19 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Aug 19 14:29:23 2015
New Revision: 245484

URL: http://llvm.org/viewvc/llvm-project?rev=245484&view=rev
Log:
Replacing a custom AST matcher with some builtin AST matchers; NFC, and 
existing tests should provide sufficient coverage.

Modified:
clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp

Modified: 
clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp?rev=245484&r1=245483&r2=245484&view=diff
==
--- clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp 
(original)
+++ clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp 
Wed Aug 19 14:29:23 2015
@@ -44,19 +44,6 @@ AST_MATCHER(CXXRecordDecl, isMoveConstru
   }
   return false;
 }
-
-/// \brief Matches non-deleted copy constructors.
-///
-/// Given
-/// \code
-///   struct Foo { Foo(const Foo &) = default; };
-///   struct Bar { Bar(const Bar &) = deleted; };
-/// \endcode
-/// constructorDecl(isNonDeletedCopyConstructor())
-///   matches "Foo(const Foo &)".
-AST_MATCHER(CXXConstructorDecl, isNonDeletedCopyConstructor) {
-  return Node.isCopyConstructor() && !Node.isDeleted();
-}
 } // namespace ast_matchers
 } // namespace clang
 
@@ -87,7 +74,7 @@ DeclarationMatcher makePassByValueCtorPa
   anyOf(constRefType(), nonConstValueType()
   .bind(PassByValueParamId,
   hasDeclaration(constructorDecl(
-  isNonDeletedCopyConstructor(),
+  isCopyConstructor(), unless(isDeleted()),
   hasDeclContext(recordDecl(isMoveConstructible(
 .bind(PassByValueInitializerId)))
   .bind(PassByValueCtorId);


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


Re: [PATCH] D11194: Instantiate function declarations in instantiated functions.

2015-08-19 Thread Serge Pavlov via cfe-commits
sepavloff updated this revision to Diff 32597.
sepavloff added a comment.

Lambda functions are now treated as local classes.


http://reviews.llvm.org/D11194

Files:
  include/clang/AST/DeclBase.h
  lib/AST/DeclBase.cpp
  lib/Sema/SemaTemplateInstantiate.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp
  test/SemaTemplate/default-arguments.cpp
  test/SemaTemplate/instantiate-exception-spec-cxx11.cpp

Index: test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
===
--- test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
+++ test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
@@ -178,3 +178,11 @@
   }
 
 }
+
+namespace NondefDecls {
+  template void f1() {
+int g1(int) noexcept(T::error); // expected-error{{type 'int' cannot be used prior to '::' because it has no members}}
+  }
+  template void f1(); // expected-note{{in instantiation of function template specialization 'NondefDecls::f1' requested here}}
+}
+
Index: test/SemaTemplate/default-arguments.cpp
===
--- test/SemaTemplate/default-arguments.cpp
+++ test/SemaTemplate/default-arguments.cpp
@@ -159,3 +159,10 @@
 
   int g() { X::f(0); } // expected-note {{in instantiation of template class 'DR1635::X' requested here}}
 }
+
+namespace NondefDecls {
+  template void f1() {
+int g1(int defarg = T::error);  // expected-error{{type 'int' cannot be used prior to '::' because it has no members}}
+  }
+  template void f1();  // expected-note{{in instantiation of function template specialization 'NondefDecls::f1' requested here}}
+}
Index: test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp
===
--- test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp
+++ test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp
@@ -26,23 +26,26 @@
 };
 
 struct NoDefaultCtor {
-  NoDefaultCtor(const NoDefaultCtor&); // expected-note{{candidate constructor}}
+  NoDefaultCtor(const NoDefaultCtor&); // expected-note{{candidate constructor}} \
+   // expected-note{{candidate constructor not viable: requires 1 argument, but 0 were provided}}
   ~NoDefaultCtor();
 };
 
 template
 void defargs_in_template_unused(T t) {
-  auto l1 = [](const T& value = T()) { };
+  auto l1 = [](const T& value = T()) { };  // expected-error{{no matching constructor for initialization of 'NoDefaultCtor'}}
   l1(t);
 }
 
 template void defargs_in_template_unused(NonPOD);
-template void defargs_in_template_unused(NoDefaultCtor);
+template void defargs_in_template_unused(NoDefaultCtor);  // expected-note{{in instantiation of function template specialization 'defargs_in_template_unused' requested here}}
 
 template
 void defargs_in_template_used() {
-  auto l1 = [](const T& value = T()) { }; // expected-error{{no matching constructor for initialization of 'NoDefaultCtor'}}
-  l1(); // expected-note{{in instantiation of default function argument expression for 'operator()' required here}}
+  auto l1 = [](const T& value = T()) { }; // expected-error{{no matching constructor for initialization of 'NoDefaultCtor'}} \
+  // expected-note{{candidate function not viable: requires single argument 'value', but no arguments were provided}} \
+  // expected-note{{conversion candidate of type 'void (*)(const NoDefaultCtor &)'}}
+  l1(); // expected-error{{no matching function for call to object of type '(lambda at }}
 }
 
 template void defargs_in_template_used();
Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3246,16 +3246,11 @@
 // exception specification.
 // DR1484: Local classes and their members are instantiated along with the
 // containing function.
-bool RequireInstantiation = false;
-if (CXXRecordDecl *Cls = dyn_cast(Tmpl->getDeclContext())) {
-  if (Cls->isLocalClass())
-RequireInstantiation = true;
-}
 if (SemaRef.getLangOpts().CPlusPlus11 &&
 EPI.ExceptionSpec.Type != EST_None &&
 EPI.ExceptionSpec.Type != EST_DynamicNone &&
 EPI.ExceptionSpec.Type != EST_BasicNoexcept &&
-!RequireInstantiation) {
+!Tmpl->isLexicallyWithinFunctionOrMethod()) {
   FunctionDecl *ExceptionSpecTemplate = Tmpl;
   if (EPI.ExceptionSpec.Type == EST_Uninstantiated)
 ExceptionSpecTemplate = EPI.ExceptionSpec.SourceTemplate;
Index: lib/Sema/SemaTemplateInstantiate.cpp
===
--- lib/Sema/SemaTemplateInstantiate.cpp
+++ lib/Sema/SemaTemplateInstantiate.cpp
@@ -1682,11 +1682,10 @@
 UnparsedDefaultArgInstantiatio

Re: [PATCH] D12143: [X86][AVX2] Replace avx2.pbroadcast / avx2.vbroadcast intrinsics usage in avx2intrin.h with __builtin_shufflevector

2015-08-19 Thread Simon Pilgrim via cfe-commits
RKSimon abandoned this revision.
RKSimon added a comment.

In http://reviews.llvm.org/D12143#228006, @ab wrote:

> Heh, this is http://reviews.llvm.org/D10556, no? :P


Yes you're right (and you remembered to kill the builtin defs) - please can you 
add some more reviewers so that we can get it dealt with along with 
http://reviews.llvm.org/D10555?


Repository:
  rL LLVM

http://reviews.llvm.org/D12143



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


Re: [clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Pete Cooper via cfe-commits
Hi Alexander

We’re still getting a green dragon failure on the null ptr check test.  Mind 
taking a look?

http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/10351/consoleFull#50560140149ba4694-19c4-4d7e-bec5-911270d8a58c
 


Thanks
Pete
> On Aug 19, 2015, at 10:50 AM, Alexander Kornienko via cfe-commits 
>  wrote:
> 
> Author: alexfh
> Date: Wed Aug 19 12:50:22 2015
> New Revision: 245471
> 
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drev&d=BQIGaQ&c=eEvniauFctOgLOKGJOplqw&r=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjM&m=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQ&s=wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlg&e=
>  
> Log:
> [clang-tidy] Fix a bug in UseNullptrCheck.
> 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D12162&d=BQIGaQ&c=eEvniauFctOgLOKGJOplqw&r=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjM&m=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQ&s=YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwM&e=
>  
> 
> Patch by Angel Garcia!
> 
> Modified:
>clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
> 
> Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_clang-2Dtools-2Dextra_trunk_clang-2Dtidy_modernize_UseNullptrCheck.cpp-3Frev-3D245471-26r1-3D245470-26r2-3D245471-26view-3Ddiff&d=BQIGaQ&c=eEvniauFctOgLOKGJOplqw&r=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjM&m=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQ&s=4y-EkuMJJlcYjI15KrZY8VE3eGEhkvg9ScDcHtItY2g&e=
>  
> ==
> --- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp 
> (original)
> +++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed Aug 
> 19 12:50:22 2015
> @@ -175,10 +175,10 @@ private:
> class CastSequenceVisitor : public RecursiveASTVisitor {
> public:
>   CastSequenceVisitor(ASTContext &Context,
> -  SmallVector UserNullMacros,
> +  ArrayRef UserNullMacros,
>   ClangTidyCheck &check)
>   : SM(Context.getSourceManager()), Context(Context),
> -UserNullMacros(std::move(UserNullMacros)), Check(check),
> +UserNullMacros(UserNullMacros), Check(check),
> FirstSubExpr(nullptr), PruneSubtree(false) {}
> 
>   bool TraverseStmt(Stmt *S) {
> @@ -435,7 +435,7 @@ private:
> private:
>   SourceManager &SM;
>   ASTContext &Context;
> -  const SmallVector &UserNullMacros;
> +  ArrayRef UserNullMacros;
>   ClangTidyCheck &Check;
>   Expr *FirstSubExpr;
>   bool PruneSubtree;
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits&d=BQIGaQ&c=eEvniauFctOgLOKGJOplqw&r=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjM&m=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQ&s=UUHB6kbqbYNAr9eIu4oMQTKtxnQ37-xusL7D-UY0GR4&e=
>  

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


Re: [PATCH] D12022: Refactored dtor sanitizing into EHScopeStack

2015-08-19 Thread Naomi Musgrave via cfe-commits
nmusgrave updated this revision to Diff 32600.
nmusgrave added a comment.

- CFE test for dtor aliasing, and repression of aliasing in dtor code 
generation.


http://reviews.llvm.org/D12022

Files:
  lib/CodeGen/CGCXX.cpp
  lib/CodeGen/CGClass.cpp
  test/CodeGenCXX/sanitize-dtor-repress-aliasing.cpp

Index: test/CodeGenCXX/sanitize-dtor-repress-aliasing.cpp
===
--- /dev/null
+++ test/CodeGenCXX/sanitize-dtor-repress-aliasing.cpp
@@ -0,0 +1,26 @@
+// Test -fsanitize-memory-use-after-dtor
+// RUN: %clang_cc1 -fsanitize=memory -O0 -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fsanitize=memory -O1 -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fsanitize=memory -O2 -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
+
+// Virtual function table for the derived class only contains
+// its own destructors, with no aliasing to base class dtors.
+struct Base {
+  int x;
+  Base() { x = 5; }
+  virtual ~Base() {}
+};
+
+struct Derived : public Base {
+  int y;
+  Derived() { y = 10; }
+  ~Derived() {}
+};
+
+Derived d;
+
+// Declaration of virtual function table
+// CHECK: $_ZTV7Derived = comdat any
+
+// Definition of virtual function table
+// CHECK: @_ZTV7Derived = {{.*}}(void (%struct.Derived*)* @_ZN7DerivedD1Ev to i8*){{.*}}(void (%struct.Derived*)* @_ZN7DerivedD0Ev to i8*)
Index: lib/CodeGen/CGClass.cpp
===
--- lib/CodeGen/CGClass.cpp
+++ lib/CodeGen/CGClass.cpp
@@ -1367,52 +1367,6 @@
   return true;
 }
 
-// Generates function call for handling object poisoning, passing in
-// references to 'this' and its size as arguments.
-// Disables tail call elimination, to prevent the current stack frame from
-// disappearing from the stack trace.
-static void EmitDtorSanitizerCallback(CodeGenFunction &CGF,
-  const CXXDestructorDecl *Dtor) {
-  const ASTRecordLayout &Layout =
-  CGF.getContext().getASTRecordLayout(Dtor->getParent());
-
-  // Nothing to poison
-  if(Layout.getFieldCount() == 0)
-return;
-
-  // Construct pointer to region to begin poisoning, and calculate poison
-  // size, so that only members declared in this class are poisoned.
-  llvm::Value *OffsetPtr;
-  CharUnits::QuantityType PoisonSize;
-  ASTContext &Context = CGF.getContext();
-
-  llvm::ConstantInt *OffsetSizePtr = llvm::ConstantInt::get(
-  CGF.SizeTy, Context.toCharUnitsFromBits(Layout.getFieldOffset(0)).
-  getQuantity());
-
-  OffsetPtr = CGF.Builder.CreateGEP(CGF.Builder.CreateBitCast(
-  CGF.LoadCXXThis(), CGF.Int8PtrTy), OffsetSizePtr);
-
-  PoisonSize = Layout.getSize().getQuantity() -
-  Context.toCharUnitsFromBits(Layout.getFieldOffset(0)).getQuantity();
-
-  llvm::Value *Args[] = {
-CGF.Builder.CreateBitCast(OffsetPtr, CGF.VoidPtrTy),
-llvm::ConstantInt::get(CGF.SizeTy, PoisonSize)};
-
-  llvm::Type *ArgTypes[] = {CGF.VoidPtrTy, CGF.SizeTy};
-
-  llvm::FunctionType *FnType =
-  llvm::FunctionType::get(CGF.VoidTy, ArgTypes, false);
-  llvm::Value *Fn =
-  CGF.CGM.CreateRuntimeFunction(FnType, "__sanitizer_dtor_callback");
-
-  // Disables tail call elimination, to prevent the current stack frame from
-  // disappearing from the stack trace.
-  CGF.CurFn->addFnAttr("disable-tail-calls", "true");
-  CGF.EmitNounwindRuntimeCall(Fn, Args);
-}
-
 /// EmitDestructorBody - Emits the body of the current destructor.
 void CodeGenFunction::EmitDestructorBody(FunctionArgList &Args) {
   const CXXDestructorDecl *Dtor = cast(CurGD.getDecl());
@@ -1492,12 +1446,6 @@
 if (getLangOpts().AppleKext)
   CurFn->addFnAttr(llvm::Attribute::AlwaysInline);
 
-// Insert memory-poisoning instrumentation, before final clean ups,
-// to ensure this class's members are protected from invalid access.
-if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor
-&& SanOpts.has(SanitizerKind::Memory))
-  EmitDtorSanitizerCallback(*this, Dtor);
-
 break;
   }
 
@@ -1586,6 +1534,59 @@
   flags.isForNormalCleanup() && useEHCleanupForArray);
 }
   };
+
+class SanitizeDtor : public EHScopeStack::Cleanup {
+  const CXXDestructorDecl *Dtor;
+ public:
+  SanitizeDtor(const CXXDestructorDecl *Dtor) : Dtor(Dtor) {}
+
+  // Generate function call for handling object poisoning.
+  // Disables tail call elimination, to prevent the current stack frame
+  // from disappearing from the stack trace.
+  void Emit(CodeGenFunction &CGF, Flags flags) override {
+// Check flags to determine if allowed to emit.
+if (!CGF.CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor ||
+!CGF.SanOpts.has(SanitizerKind::Memory))
+  return;
+
+const ASTRecordLayout &Layout =
+CGF.getContext().getASTRecordLayout(Dtor->get

Re: [PATCH] D10556: [Headers][X86] Replace avx2.pbroadcast intrinsics with native IR.

2015-08-19 Thread Sanjay Patel via cfe-commits
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM.
See discussion in http://reviews.llvm.org/D10555.


http://reviews.llvm.org/D10556



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


Re: [clang-tools-extra] r245434 - [clang-tidy] Add use-nullptr check to clang-tidy.

2015-08-19 Thread Justin Bogner via cfe-commits
Alexander Kornienko via cfe-commits  writes:
> Author: alexfh
> Date: Wed Aug 19 08:13:12 2015
> New Revision: 245434
>
> URL: http://llvm.org/viewvc/llvm-project?rev=245434&view=rev
> Log:
> [clang-tidy] Add use-nullptr check to clang-tidy.
>
> Move UseNullptr from clang-modernize to modernize module in clang-tidy.
>
> http://reviews.llvm.org/D12081

The test this added has been failing tests on Darwin all morning, but it
doesn't revert cleanly. Can you fix this fairly quickly? Otherwise I'll
try harder to revert.

http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/10339/

>
> Patch by Angel Garcia!
>
> Added:
> clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
> clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.h
> clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr-basic.cpp
> clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp
> Modified:
> clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt
> clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp
>
> 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=245434&r1=245433&r2=245434&view=diff
> ==
> --- clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt (original)
> +++ clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt Wed Aug 19 
> 08:13:12 2015
> @@ -5,6 +5,7 @@ add_clang_library(clangTidyModernizeModu
>LoopConvertUtils.cpp
>ModernizeTidyModule.cpp
>PassByValueCheck.cpp
> +  UseNullptrCheck.cpp
>  
>LINK_LIBS
>clangAST
>
> Modified: clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp?rev=245434&r1=245433&r2=245434&view=diff
> ==
> --- clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp 
> (original)
> +++ clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp Wed 
> Aug 19 08:13:12 2015
> @@ -12,6 +12,7 @@
>  #include "../ClangTidyModuleRegistry.h"
>  #include "LoopConvertCheck.h"
>  #include "PassByValueCheck.h"
> +#include "UseNullptrCheck.h"
>  
>  using namespace clang::ast_matchers;
>  
> @@ -24,6 +25,7 @@ public:
>void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
>  CheckFactories.registerCheck("modernize-loop-convert");
>  
> CheckFactories.registerCheck("modernize-pass-by-value");
> +CheckFactories.registerCheck("modernize-use-nullptr");
>}
>  
>ClangTidyOptions getModuleOptions() override {
> @@ -31,6 +33,9 @@ public:
>  auto &Opts = Options.CheckOptions;
>  Opts["modernize-loop-convert.MinConfidence"] = "reasonable";
>  Opts["modernize-pass-by-value.IncludeStyle"] = "llvm"; // Also: "google".
> +
> +// Comma-separated list of user-defined macros that behave like NULL.
> +Opts["modernize-use-nullptr.UserNullMacros"] = "";
>  return Options;
>}
>  };
>
> Added: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=245434&view=auto
> ==
> --- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (added)
> +++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed Aug 
> 19 08:13:12 2015
> @@ -0,0 +1,472 @@
> +//===--- UseNullptrCheck.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 "UseNullptrCheck.h"
> +#include "clang/AST/ASTContext.h"
> +#include "clang/AST/RecursiveASTVisitor.h"
> +#include "clang/ASTMatchers/ASTMatchFinder.h"
> +#include "clang/Lex/Lexer.h"
> +
> +using namespace clang;
> +using namespace clang::ast_matchers;
> +using namespace llvm;
> +
> +namespace clang {
> +namespace tidy {
> +namespace modernize {
> +
> +const char CastSequence[] = "sequence";
> +const char NullMacroName[] = "NULL";
> +
> +/// \brief Matches cast expressions that have a cast kind of CK_NullToPointer
> +/// or CK_NullToMemberPointer.
> +///
> +/// Given
> +/// \code
> +///   int *p = 0;
> +/// \endcode
> +/// implicitCastExpr(isNullToPointer()) matches the implicit cast clang adds
> +/// around \c 0.
> +AST_MATCHER(CastExpr, isNullToPointer) {
> +  return Node.getCastKind() == CK_NullToPointer ||
> + Node.getCastKind() == CK_NullToMemberPointer;
> +}
> +
> +AST_MATCH

r245489 - Generating available_externally vtables bugfix

2015-08-19 Thread Piotr Padlewski via cfe-commits
Author: prazek
Date: Wed Aug 19 15:09:09 2015
New Revision: 245489

URL: http://llvm.org/viewvc/llvm-project?rev=245489&view=rev
Log:
Generating available_externally vtables bugfix

Bugfix revealed in r245264.

http://reviews.llvm.org/D12128

Modified:
cfe/trunk/include/clang/AST/VTableBuilder.h
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/test/CodeGenCXX/vtable-available-externally.cpp

Modified: cfe/trunk/include/clang/AST/VTableBuilder.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/VTableBuilder.h?rev=245489&r1=245488&r2=245489&view=diff
==
--- cfe/trunk/include/clang/AST/VTableBuilder.h (original)
+++ cfe/trunk/include/clang/AST/VTableBuilder.h Wed Aug 19 15:09:09 2015
@@ -123,30 +123,50 @@ public:
 
   const CXXRecordDecl *getRTTIDecl() const {
 assert(getKind() == CK_RTTI && "Invalid component kind!");
-
 return reinterpret_cast(getPointer());
   }
 
   const CXXMethodDecl *getFunctionDecl() const {
-assert(getKind() == CK_FunctionPointer);
-
+assert(isFunctionPointerKind() && "Invalid component kind!");
+if (isDestructorKind())
+  return getDestructorDecl();
 return reinterpret_cast(getPointer());
   }
 
   const CXXDestructorDecl *getDestructorDecl() const {
-assert((getKind() == CK_CompleteDtorPointer ||
-getKind() == CK_DeletingDtorPointer) && "Invalid component kind!");
-
+assert(isDestructorKind() && "Invalid component kind!");
 return reinterpret_cast(getPointer());
   }
 
   const CXXMethodDecl *getUnusedFunctionDecl() const {
-assert(getKind() == CK_UnusedFunctionPointer);
-
+assert(getKind() == CK_UnusedFunctionPointer && "Invalid component kind!");
 return reinterpret_cast(getPointer());
   }
 
+  bool isDestructorKind() const { return isDestructorKind(getKind()); }
+
+  bool isUsedFunctionPointerKind() const {
+return isUsedFunctionPointerKind(getKind());
+  }
+
+  bool isFunctionPointerKind() const {
+return isFunctionPointerKind(getKind());
+  }
+
 private:
+  static bool isFunctionPointerKind(Kind ComponentKind) {
+return isUsedFunctionPointerKind(ComponentKind) ||
+   ComponentKind == CK_UnusedFunctionPointer;
+  }
+  static bool isUsedFunctionPointerKind(Kind ComponentKind) {
+return ComponentKind == CK_FunctionPointer ||
+   isDestructorKind(ComponentKind);
+  }
+  static bool isDestructorKind(Kind ComponentKind) {
+return ComponentKind == CK_CompleteDtorPointer ||
+   ComponentKind == CK_DeletingDtorPointer;
+  }
+
   VTableComponent(Kind ComponentKind, CharUnits Offset) {
 assert((ComponentKind == CK_VCallOffset ||
 ComponentKind == CK_VBaseOffset ||
@@ -158,12 +178,8 @@ private:
   }
 
   VTableComponent(Kind ComponentKind, uintptr_t Ptr) {
-assert((ComponentKind == CK_RTTI ||
-ComponentKind == CK_FunctionPointer ||
-ComponentKind == CK_CompleteDtorPointer ||
-ComponentKind == CK_DeletingDtorPointer ||
-ComponentKind == CK_UnusedFunctionPointer) &&
-"Invalid component kind!");
+assert((ComponentKind == CK_RTTI || isFunctionPointerKind(ComponentKind)) 
&&
+   "Invalid component kind!");
 
 assert((Ptr & 7) == 0 && "Pointer not sufficiently aligned!");
 
@@ -178,11 +194,7 @@ private:
   }
 
   uintptr_t getPointer() const {
-assert((getKind() == CK_RTTI ||
-getKind() == CK_FunctionPointer ||
-getKind() == CK_CompleteDtorPointer ||
-getKind() == CK_DeletingDtorPointer ||
-getKind() == CK_UnusedFunctionPointer) &&
+assert((getKind() == CK_RTTI || isFunctionPointerKind()) &&
"Invalid component kind!");
 
 return static_cast(Value & ~7ULL);

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=245489&r1=245488&r2=245489&view=diff
==
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Wed Aug 19 15:09:09 2015
@@ -306,17 +306,15 @@ public:
   void emitCXXStructor(const CXXMethodDecl *MD, StructorType Type) override;
 
  private:
-  /// Checks if function has any virtual inline function.
-  bool hasAnyVirtualInlineFunction(const CXXRecordDecl *RD) const {
+   bool hasAnyUsedVirtualInlineFunction(const CXXRecordDecl *RD) const {
 const auto &VtableLayout =
 CGM.getItaniumVTableContext().getVTableLayout(RD);
 
 for (const auto &VtableComponent : VtableLayout.vtable_components()) {
-  if (VtableComponent.getKind() !=
-  VTableComponent::Kind::CK_FunctionPointer)
+  if (!VtableComponent.isUsedFunctionPointerKind())
 continue;
 
-  const auto &Method = VtableComponent.getFunctionDecl();
+  const CXXMethodDecl *Method = VtableComponent.getFunctionDecl();

Re: [PATCH] D11958: Add a -gmodules option to the clang driver.

2015-08-19 Thread David Blaikie via cfe-commits
On Tue, Aug 11, 2015 at 1:49 PM, Adrian Prantl  wrote:

> aprantl created this revision.
> aprantl added reviewers: dblaikie, echristo.
> aprantl added a subscriber: cfe-commits.
> aprantl set the repository for this revision to rL LLVM.
>
> This patch adds a -gmodules option to the driver and a -dwarf-ext-refs to
> cc1 to enable the use of external type references in the debug info (a.k.a.
> module debugging).
>
> The driver expands -gmodules to "-g -fmodule-format=obj -dwarf-ext-refs"
> and passes that to cc1.
> Most options that start with -g (e.g., -gdwarf-2) also turn on -g, and
> module requires object-container-wrapped modules, "-dwarf-ext-refs" been
> the actual low-level option for turning on external type references.
>
> Rationale for the choice of names (and this is really all there is to
> review in this patch):
> "-gmodules": is meant to pair nicely with "-fmodules"
> "-dwarf-ext-refs": Fits into the naming scheme of similar options like
> "-dwarf-column-info" and "-dwarf-debug-flags". Spelling out the option
> "-dwarf-external-type-references" seemed to be overkill.
>

Sounds reasonable - and the flag will be for more than just types
eventually anyway (specifically references to members (functions, etc) of
types too).


> All this does at the moment is set a flag codegenopts. Having this flag in
> place is a prerequisite for emitting debug info into modules: The debug
> info for a module needs to use external type references for types defined
> in (other) modules or we would violate the minimal deserialization
> requirements (cf. test/PCH/check-deserializations.cpp).
>

Could you explain what you mean by "violate the minimal deserialization
requirements"

Mechanically, the patch looks fine/exactly what you'd expect. Feel free to
commit whenever you're ready.


>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D11958
>
> Files:
>   docs/CommandGuide/clang.rst
>   include/clang/Driver/CC1Options.td
>   include/clang/Driver/Options.td
>   include/clang/Frontend/CodeGenOptions.def
>   lib/CodeGen/CGDebugInfo.cpp
>   lib/CodeGen/CGDebugInfo.h
>   lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>   lib/Driver/Tools.cpp
>   lib/Frontend/CompilerInvocation.cpp
>   test/Driver/debug-options.c
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r245084 - WindowsX86: long double is x87DoubleExtended on mingw

2015-08-19 Thread Hans Wennborg via cfe-commits
I assume this is a merge request?

Richard: what do you think about r245459+r245462?



On Wed, Aug 19, 2015 at 10:22 AM, Yaron Keren  wrote:
> Sorry to notice late (just diagnosed the issue from a failing boost::math
> test), according to i686 ABI, long double size on x86 is 12 bytes (the
> memory allocated, not the underlying 80 bits register), see
>
> https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html
>
> -m128bit-long-double
> Control the size of long double type. i386 application binary interface
> specify the size to be 12 bytes, while modern architectures (Pentium and
> newer) prefer long double aligned to 8 or 16 byte boundary. This is
> impossible to reach with 12 byte long doubles in the array accesses.
> Warning: if you use the -m128bit-long-double switch, the structures and
> arrays containing long double will change their size as well as function
> calling convention for function taking long double will be modified.
>
> -m96bit-long-double
> Set the size of long double to 96 bits as required by the i386 application
> binary interface. This is the default.
>
>
> You can check long double size out by running
>
> #include 
> int main() {
>   long double a;
>   std::cout< }
>
> which outputs 12 with mingw 32 bit, 16 with mingw 64 bit but always 16 with
> current clang.
> I fixed this and added test in r245459+r245462.
>
>
> 2015-08-19 19:41 GMT+03:00 Hans Wennborg via cfe-commits
> :
>>
>> On Tue, Aug 18, 2015 at 6:11 PM, Richard Smith 
>> wrote:
>> > On Tue, Aug 18, 2015 at 3:01 PM, Hans Wennborg 
>> > wrote:
>> >>
>> >> Richard, I tried to ping you on the review thread but I'm not sure it
>> >> got through. Martell requested this be merged to 3.7. What do you
>> >> think?
>> >
>> >
>> > LGTM
>>
>> Thanks! r245456.
>>
>> >
>> >>
>> >> On Fri, Aug 14, 2015 at 12:05 PM, Martell Malone via cfe-commits
>> >>  wrote:
>> >> > Author: martell
>> >> > Date: Fri Aug 14 14:05:56 2015
>> >> > New Revision: 245084
>> >> >
>> >> > URL: http://llvm.org/viewvc/llvm-project?rev=245084&view=rev
>> >> > Log:
>> >> > WindowsX86: long double is x87DoubleExtended on mingw
>> >> >
>> >> > Summary:
>> >> > long double on x86 mingw is 80bits and is aligned to 16bytes
>> >> >
>> >> > Fixes:
>> >> > https://llvm.org/bugs/show_bug.cgi?id=24398
>> >> >
>> >> > Reviewers: rnk
>> >> >
>> >> > Subscribers: cfe-commits
>> >> >
>> >> > Differential Revision: http://reviews.llvm.org/D12037
>> >> >
>> >> > Modified:
>> >> > cfe/trunk/lib/Basic/Targets.cpp
>> >> >
>> >> > Modified: cfe/trunk/lib/Basic/Targets.cpp
>> >> > URL:
>> >> >
>> >> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245084&r1=245083&r2=245084&view=diff
>> >> >
>> >> >
>> >> > ==
>> >> > --- cfe/trunk/lib/Basic/Targets.cpp (original)
>> >> > +++ cfe/trunk/lib/Basic/Targets.cpp Fri Aug 14 14:05:56 2015
>> >> > @@ -3784,7 +3784,10 @@ namespace {
>> >> >  class MinGWX86_32TargetInfo : public WindowsX86_32TargetInfo {
>> >> >  public:
>> >> >MinGWX86_32TargetInfo(const llvm::Triple &Triple)
>> >> > -  : WindowsX86_32TargetInfo(Triple) {}
>> >> > +  : WindowsX86_32TargetInfo(Triple) {
>> >> > +LongDoubleWidth = LongDoubleAlign = 128;
>> >> > +LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
>> >> > +  }
>> >> >void getTargetDefines(const LangOptions &Opts,
>> >> >  MacroBuilder &Builder) const override {
>> >> >  WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
>> >> > @@ -4014,7 +4017,10 @@ public:
>> >> >  class MinGWX86_64TargetInfo : public WindowsX86_64TargetInfo {
>> >> >  public:
>> >> >MinGWX86_64TargetInfo(const llvm::Triple &Triple)
>> >> > -  : WindowsX86_64TargetInfo(Triple) {}
>> >> > +  : WindowsX86_64TargetInfo(Triple) {
>> >> > +LongDoubleWidth = LongDoubleAlign = 128;
>> >> > +LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
>> >> > +  }
>> >> >void getTargetDefines(const LangOptions &Opts,
>> >> >  MacroBuilder &Builder) const override {
>> >> >  WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);
>> >> >
>> >> >
>> >> > ___
>> >> > 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] D11958: Add a -gmodules option to the clang driver.

2015-08-19 Thread Adrian Prantl via cfe-commits

> On Aug 19, 2015, at 1:12 PM, David Blaikie  wrote:
> 
> 
> 
> On Tue, Aug 11, 2015 at 1:49 PM, Adrian Prantl  > wrote:
> aprantl created this revision.
> aprantl added reviewers: dblaikie, echristo.
> aprantl added a subscriber: cfe-commits.
> aprantl set the repository for this revision to rL LLVM.
> 
> This patch adds a -gmodules option to the driver and a -dwarf-ext-refs to cc1 
> to enable the use of external type references in the debug info (a.k.a. 
> module debugging).
> 
> The driver expands -gmodules to "-g -fmodule-format=obj -dwarf-ext-refs" and 
> passes that to cc1.
> Most options that start with -g (e.g., -gdwarf-2) also turn on -g, and module 
> requires object-container-wrapped modules, "-dwarf-ext-refs" been the actual 
> low-level option for turning on external type references.
> 
> Rationale for the choice of names (and this is really all there is to review 
> in this patch):
> "-gmodules": is meant to pair nicely with "-fmodules"
> "-dwarf-ext-refs": Fits into the naming scheme of similar options like 
> "-dwarf-column-info" and "-dwarf-debug-flags". Spelling out the option 
> "-dwarf-external-type-references" seemed to be overkill.
> 
> Sounds reasonable - and the flag will be for more than just types eventually 
> anyway (specifically references to members (functions, etc) of types too).
>  
> All this does at the moment is set a flag codegenopts. Having this flag in 
> place is a prerequisite for emitting debug info into modules: The debug info 
> for a module needs to use external type references for types defined in 
> (other) modules or we would violate the minimal deserialization requirements 
> (cf. test/PCH/check-deserializations.cpp).
> 
> Could you explain what you mean by "violate the minimal deserialization 
> requirements”

There are tests in the testsuite to ensure that when deserializing a type from 
a module, only the bare minimum is actually deserialized. For example:

a.h
class A {};

b.h
class B { A a; };

When emitting debug info for B we need to emit an external reference for A 
instead of recursively emitting A (and thus “illegally” deserializing A from 
a.pcm).

> 
> Mechanically, the patch looks fine/exactly what you'd expect. Feel free to 
> commit whenever you're ready.

thanks,
adrian

>  
> 
> Repository:
>   rL LLVM
> 
> http://reviews.llvm.org/D11958 
> 
> 
> Files:
>   docs/CommandGuide/clang.rst
>   include/clang/Driver/CC1Options.td
>   include/clang/Driver/Options.td
>   include/clang/Frontend/CodeGenOptions.def
>   lib/CodeGen/CGDebugInfo.cpp
>   lib/CodeGen/CGDebugInfo.h
>   lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>   lib/Driver/Tools.cpp
>   lib/Frontend/CompilerInvocation.cpp
>   test/Driver/debug-options.c

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


Re: r220305 - Driver: Move crash report command mangling into Command::Print

2015-08-19 Thread David Blaikie via cfe-commits
On Wed, Aug 12, 2015 at 5:00 PM, Justin Bogner 
wrote:

> On Wed, Aug 12, 2015 at 3:09 PM, David Blaikie  wrote:
> > On Tue, Oct 21, 2014 at 10:24 AM, Justin Bogner 
> > wrote:
> >> Author: bogner
> >> Date: Tue Oct 21 12:24:44 2014
> >> New Revision: 220305
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=220305&view=rev
> >> Log:
> >> Driver: Move crash report command mangling into Command::Print
> >>
> >> This pushes the logic for generating a crash reproduction script
> >> entirely into Command::Print, instead of Command doing half of the
> >> work and then relying on textual substitution for the rest. This makes
> >> this logic much easier to read and will simplify fixing a couple of
> >> issues in this area.
> >
> >
> >> Modified:
> >> cfe/trunk/include/clang/Driver/Job.h
> >> cfe/trunk/lib/Driver/Driver.cpp
> >> cfe/trunk/lib/Driver/Job.cpp
> >>
> >> Modified: cfe/trunk/include/clang/Driver/Job.h
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Job.h?rev=220305&r1=220304&r2=220305&view=diff
> >>
> >>
> ==
> >> --- cfe/trunk/include/clang/Driver/Job.h (original)
> >> +++ cfe/trunk/include/clang/Driver/Job.h Tue Oct 21 12:24:44 2014
> >> @@ -29,6 +29,14 @@ class Tool;
> >>  // Re-export this as clang::driver::ArgStringList.
> >>  using llvm::opt::ArgStringList;
> >>
> >> +struct CrashReportInfo {
> >> +  StringRef Filename;
> >> +  StringRef VFSPath;
> >> +
> >> +  CrashReportInfo(StringRef Filename, StringRef VFSPath)
> >> +  : Filename(Filename), VFSPath(VFSPath) {}
> >> +};
> >> +
> >>  class Job {
> >>  public:
> >>enum JobClass {
> >> @@ -52,9 +60,9 @@ public:
> >>/// \param OS - The stream to print on.
> >>/// \param Terminator - A string to print at the end of the line.
> >>/// \param Quote - Should separate arguments be quoted.
> >> -  /// \param CrashReport - Whether to print for inclusion in a crash
> >> report.
> >> -  virtual void Print(llvm::raw_ostream &OS, const char *Terminator,
> >> - bool Quote, bool CrashReport = false) const = 0;
> >> +  /// \param CrashInfo - Details for inclusion in a crash report.
> >> +  virtual void Print(llvm::raw_ostream &OS, const char *Terminator,
> bool
> >> Quote,
> >> + CrashReportInfo *CrashInfo = nullptr) const = 0;
> >>  };
> >>
> >>  /// Command - An executable path/name and argument vector to
> >> @@ -102,7 +110,7 @@ public:
> >>const llvm::opt::ArgStringList &_Arguments);
> >>
> >>void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
> >> - bool CrashReport = false) const override;
> >> + CrashReportInfo *CrashInfo = nullptr) const override;
> >>
> >>virtual int Execute(const StringRef **Redirects, std::string *ErrMsg,
> >>bool *ExecutionFailed) const;
> >> @@ -141,7 +149,7 @@ public:
> >>std::unique_ptr Fallback_);
> >>
> >>void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
> >> - bool CrashReport = false) const override;
> >> + CrashReportInfo *CrashInfo = nullptr) const override;
> >>
> >>int Execute(const StringRef **Redirects, std::string *ErrMsg,
> >>bool *ExecutionFailed) const override;
> >> @@ -170,7 +178,7 @@ public:
> >>virtual ~JobList() {}
> >>
> >>void Print(llvm::raw_ostream &OS, const char *Terminator,
> >> - bool Quote, bool CrashReport = false) const override;
> >> + bool Quote, CrashReportInfo *CrashInfo = nullptr) const
> >> override;
> >>
> >>/// Add a job to the list (taking ownership).
> >>void addJob(std::unique_ptr J) { Jobs.push_back(std::move(J)); }
> >>
> >> Modified: cfe/trunk/lib/Driver/Driver.cpp
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=220305&r1=220304&r2=220305&view=diff
> >>
> >>
> ==
> >> --- cfe/trunk/lib/Driver/Driver.cpp (original)
> >> +++ cfe/trunk/lib/Driver/Driver.cpp Tue Oct 21 12:24:44 2014
> >> @@ -424,10 +424,7 @@ void Driver::generateCompilationDiagnost
> >>CCGenDiagnostics = true;
> >>
> >>// Save the original job command(s).
> >> -  std::string Cmd;
> >> -  llvm::raw_string_ostream OS(Cmd);
> >> -  FailingCommand.Print(OS, "\n", /*Quote*/ false, /*CrashReport*/
> true);
> >> -  OS.flush();
> >> +  Command Cmd = FailingCommand;
> >>
> >
> > It seems this code was/is undertested, or it would've caught the bug that
> > I believe was introduced here.
> >
> > This line of code ("Command Cmd = FailingCommand") silently slices the
> > FailingCommand object into a plain Command object, even in cases where
> > FailingCommand is a derived class. This means that later on when
> > "Cmd.Print" is called, it only prints as a plain Command, not as an
> > appropriately derived Command object.

Re: r245084 - WindowsX86: long double is x87DoubleExtended on mingw

2015-08-19 Thread Yaron Keren via cfe-commits
Yes, worth merging with Richard approval.

2015-08-19 23:16 GMT+03:00 Hans Wennborg :

> I assume this is a merge request?
>
> Richard: what do you think about r245459+r245462?
>
>
>
> On Wed, Aug 19, 2015 at 10:22 AM, Yaron Keren 
> wrote:
> > Sorry to notice late (just diagnosed the issue from a failing boost::math
> > test), according to i686 ABI, long double size on x86 is 12 bytes (the
> > memory allocated, not the underlying 80 bits register), see
> >
> > https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html
> >
> > -m128bit-long-double
> > Control the size of long double type. i386 application binary interface
> > specify the size to be 12 bytes, while modern architectures (Pentium and
> > newer) prefer long double aligned to 8 or 16 byte boundary. This is
> > impossible to reach with 12 byte long doubles in the array accesses.
> > Warning: if you use the -m128bit-long-double switch, the structures and
> > arrays containing long double will change their size as well as function
> > calling convention for function taking long double will be modified.
> >
> > -m96bit-long-double
> > Set the size of long double to 96 bits as required by the i386
> application
> > binary interface. This is the default.
> >
> >
> > You can check long double size out by running
> >
> > #include 
> > int main() {
> >   long double a;
> >   std::cout< > }
> >
> > which outputs 12 with mingw 32 bit, 16 with mingw 64 bit but always 16
> with
> > current clang.
> > I fixed this and added test in r245459+r245462.
> >
> >
> > 2015-08-19 19:41 GMT+03:00 Hans Wennborg via cfe-commits
> > :
> >>
> >> On Tue, Aug 18, 2015 at 6:11 PM, Richard Smith 
> >> wrote:
> >> > On Tue, Aug 18, 2015 at 3:01 PM, Hans Wennborg 
> >> > wrote:
> >> >>
> >> >> Richard, I tried to ping you on the review thread but I'm not sure it
> >> >> got through. Martell requested this be merged to 3.7. What do you
> >> >> think?
> >> >
> >> >
> >> > LGTM
> >>
> >> Thanks! r245456.
> >>
> >> >
> >> >>
> >> >> On Fri, Aug 14, 2015 at 12:05 PM, Martell Malone via cfe-commits
> >> >>  wrote:
> >> >> > Author: martell
> >> >> > Date: Fri Aug 14 14:05:56 2015
> >> >> > New Revision: 245084
> >> >> >
> >> >> > URL: http://llvm.org/viewvc/llvm-project?rev=245084&view=rev
> >> >> > Log:
> >> >> > WindowsX86: long double is x87DoubleExtended on mingw
> >> >> >
> >> >> > Summary:
> >> >> > long double on x86 mingw is 80bits and is aligned to 16bytes
> >> >> >
> >> >> > Fixes:
> >> >> > https://llvm.org/bugs/show_bug.cgi?id=24398
> >> >> >
> >> >> > Reviewers: rnk
> >> >> >
> >> >> > Subscribers: cfe-commits
> >> >> >
> >> >> > Differential Revision: http://reviews.llvm.org/D12037
> >> >> >
> >> >> > Modified:
> >> >> > cfe/trunk/lib/Basic/Targets.cpp
> >> >> >
> >> >> > Modified: cfe/trunk/lib/Basic/Targets.cpp
> >> >> > URL:
> >> >> >
> >> >> >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245084&r1=245083&r2=245084&view=diff
> >> >> >
> >> >> >
> >> >> >
> ==
> >> >> > --- cfe/trunk/lib/Basic/Targets.cpp (original)
> >> >> > +++ cfe/trunk/lib/Basic/Targets.cpp Fri Aug 14 14:05:56 2015
> >> >> > @@ -3784,7 +3784,10 @@ namespace {
> >> >> >  class MinGWX86_32TargetInfo : public WindowsX86_32TargetInfo {
> >> >> >  public:
> >> >> >MinGWX86_32TargetInfo(const llvm::Triple &Triple)
> >> >> > -  : WindowsX86_32TargetInfo(Triple) {}
> >> >> > +  : WindowsX86_32TargetInfo(Triple) {
> >> >> > +LongDoubleWidth = LongDoubleAlign = 128;
> >> >> > +LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
> >> >> > +  }
> >> >> >void getTargetDefines(const LangOptions &Opts,
> >> >> >  MacroBuilder &Builder) const override {
> >> >> >  WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
> >> >> > @@ -4014,7 +4017,10 @@ public:
> >> >> >  class MinGWX86_64TargetInfo : public WindowsX86_64TargetInfo {
> >> >> >  public:
> >> >> >MinGWX86_64TargetInfo(const llvm::Triple &Triple)
> >> >> > -  : WindowsX86_64TargetInfo(Triple) {}
> >> >> > +  : WindowsX86_64TargetInfo(Triple) {
> >> >> > +LongDoubleWidth = LongDoubleAlign = 128;
> >> >> > +LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
> >> >> > +  }
> >> >> >void getTargetDefines(const LangOptions &Opts,
> >> >> >  MacroBuilder &Builder) const override {
> >> >> >  WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);
> >> >> >
> >> >> >
> >> >> > ___
> >> >> > 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
> >
> >
>
___

Fwd: [PATCH] Have clang list the imported modules in the debug info

2015-08-19 Thread David Blaikie via cfe-commits
(add the right list)
-- Forwarded message --
From: David Blaikie 
Date: Wed, Aug 19, 2015 at 1:20 PM
Subject: Re: [PATCH] Have clang list the imported modules in the debug info
To: Adrian Prantl 
Cc: Eric Christopher , Zachary Turner <
ztur...@google.com>, "Robinson, Paul" ,
Richard Smith , llvm cfe ,
Greg Clayton , Sean Callanan 




On Mon, Aug 10, 2015 at 5:00 PM, Adrian Prantl  wrote:

>
> On Jul 24, 2015, at 12:33 PM, David Blaikie  wrote:
>
> *reads back through the thread*
>
>
> appreciated, it’s long :-)
>
> So what I originally had in mind about a year ago when we discussed this,
> was that the module data could have an extra table from type hash to
> whatever useful internal representation to find the type in the PCM.
>
>
> It turned out that the most useful internal type representation to find a
> type in a PCM is the type’s DeclContext+Name; this is how (surprise!) clang
> looks up types in a PCM and the format is supposed to be fast for these
> kind of lookups.
>

Still, I would imagine there would be some kind of direct access (the
offset in the file, or somesuch) rather than actually having to go through
hashtables, etc. No? (how does one module refer to types in another module?
Really by name?)


>
> Everything else would just be DWARF with type units and fission (with the
> slight wrinkle of type units that aren't resolvable within a single object
> file - they could reference cross-object/dwo file) - emitting a fission CU
> for each referenced module.
>
> Needing modules to disambiguate/avoid collisions/support non-odr languages
> wasn't something I understood/had considered back then. That explains the
> need to add module references to the CU, so the debugger can know which
> modules to search for the types in (& doesn't just go loading all of them,
> etc).
>
> I would still picture this as "normal type units + a table in the module
> to resolve types", but if you guys particularly like using the mangled
> string name (or other identifier) in the DWARF that may avoid the need for
> an intermediate table (but it doesn't sound like you are avoiding an
> intermediate table - you said something about having an
> accelerator-table-like thing to aid in the DWARF->AST mapping? So could
> that be key'd of the type hash/signature we're using, thus keeping the
> DWARF more plain/vanilla DWARF5 (type units + fission)?)
>
>
> I originally disliked type signatures and favored using mangled names
> because the mangled names contained the DeclContext necessary to find types
> in the PCM. But if we can squeeze the DeclContext somewhere else, that’s
> fine.
>
> From the discussion we had on FlagExternalTypeRef I got the impression
> that long-form forward declarations are starting to look more attractive:
> If every external type reference is a reference to a forward declaration
> that has a complete decl context,
>

While that's conveniently what we output currently, I'm not sure it's a
great idea to rely on it. We might one day optimize type references (&
we'll certainly need to optimize non-type references like member functions,
etc - since emitting a stub for those would start to, more visibly, reduce
the benefit of doing this work in the first place, I would imagine) so that
when there's no contents (which will be more common once we can reference
members directly with Bag O DWARF) we just have a DW_AT_type encoded as a
DW_FORM_ref_sig8 directly.

with a DW_TAG_module at the root of the decl context chain,
>

This ^ is something I didn't have in mind and would complicate things
somewhat. I'd really like to keep things as close to the existing standard
type unit + split dwarf standards as possible except where necessary to do
otherwise.


> and a DW_AT_name+DW_AT_signature at the other end, we would have all the
> information we need without introducing any further LLVM-specific DWARF
> extensions. To look up an external type from the PCM, the consumer imports
> the DW_TAG_module and deserializes the type found by declcontext+name. To
> load the type from DWARF, the consumer grabs the signature from the forward
> declaration and magically (1) finds the PCM and looks up the type by
> signature (2).
>
> (1) My suggestion is to extend LLVM so it can put the DW_TAG_module with
> the forward declaration inside the skeleton compile unit (which has the
> path to the PCM and its DWOid).
> (2) On ELF with type units this works out of the box,
>

Not necessarily - the use of DW_TAG_modules in the scope chain might
confuse/break things. It's pretty unprecedented/non-standard, I would think?


> on MachO without type units we need some kind of index mapping signature
> -> DIE (bag of DWARF style?).
>

I was rather hoping you guys would implement type units (since they'll be a
step towards Bag O DWARF anyway) on MachO... - at least for this case. They
wouldn't have to be COMDAt'd or each in their own section, they'd just be
in a debug_types section one after the other in the module .o file.


>
>

[clang-tools-extra] r245492 - Replacing a custom AST matcher with some builtin AST matchers; NFC, and existing tests should provide sufficient coverage.

2015-08-19 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Aug 19 15:26:22 2015
New Revision: 245492

URL: http://llvm.org/viewvc/llvm-project?rev=245492&view=rev
Log:
Replacing a custom AST matcher with some builtin AST matchers; NFC, and 
existing tests should provide sufficient coverage.

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp?rev=245492&r1=245491&r2=245492&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp Wed Aug 
19 15:26:22 2015
@@ -45,19 +45,6 @@ AST_MATCHER(CXXRecordDecl, isMoveConstru
   return false;
 }
 
-/// \brief Matches non-deleted copy constructors.
-///
-/// Given
-/// \code
-///   struct Foo { Foo(const Foo &) = default; };
-///   struct Bar { Bar(const Bar &) = deleted; };
-/// \endcode
-/// constructorDecl(isNonDeletedCopyConstructor())
-///   matches "Foo(const Foo &)".
-AST_MATCHER(CXXConstructorDecl, isNonDeletedCopyConstructor) {
-  return Node.isCopyConstructor() && !Node.isDeleted();
-}
-
 static TypeMatcher constRefType() {
   return lValueReferenceType(pointee(isConstQualified()));
 }
@@ -158,7 +145,7 @@ void PassByValueCheck::registerMatchers(
   anyOf(constRefType(), nonConstValueType()
   .bind("Param",
   hasDeclaration(constructorDecl(
-  isNonDeletedCopyConstructor(),
+  isCopyConstructor(), unless(isDeleted()),
   
hasDeclContext(recordDecl(isMoveConstructible(
   .bind("Initializer")))
   .bind("Ctor"),


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


  1   2   >