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

2016-06-11 Thread Xiuli PAN via cfe-commits
pxli168 added a comment.

I was on a vecation. LGTM, thanks!


Repository:
  rL LLVM

http://reviews.llvm.org/D20133



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


Add support for musl-libc on Linux

2016-06-11 Thread Lei Zhang via cfe-commits
Hi,

I'm replying to this thread; sorry I wasn't subscribed to the list,
thus cannot reply to it directly.

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160606/161733.html

Joerg, thanks for your reply. Could you please tell me what kind of
test cases I should prepare?


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


r272492 - [CodeGen] Update to use an ArrayRef of uint32_t instead of int in calls to CreateShuffleVector to match llvm interface change.

2016-06-11 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sat Jun 11 19:41:24 2016
New Revision: 272492

URL: http://llvm.org/viewvc/llvm-project?rev=272492&view=rev
Log:
[CodeGen] Update to use an ArrayRef of uint32_t instead of int in calls to 
CreateShuffleVector to match llvm interface change.

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

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=272492&r1=272491&r2=272492&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Sat Jun 11 19:41:24 2016
@@ -3268,7 +3268,7 @@ Value *CodeGenFunction::EmitCommonNeonBu
   case NEON::BI__builtin_neon_vext_v:
   case NEON::BI__builtin_neon_vextq_v: {
 int CV = cast(Ops[2])->getSExtValue();
-SmallVector Indices;
+SmallVector Indices;
 for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i)
   Indices.push_back(i+CV);
 
@@ -3472,7 +3472,7 @@ Value *CodeGenFunction::EmitCommonNeonBu
 Value *SV = nullptr;
 
 for (unsigned vi = 0; vi != 2; ++vi) {
-  SmallVector Indices;
+  SmallVector Indices;
   for (unsigned i = 0, e = VTy->getNumElements(); i != e; i += 2) {
 Indices.push_back(i+vi);
 Indices.push_back(i+e+vi);
@@ -3500,7 +3500,7 @@ Value *CodeGenFunction::EmitCommonNeonBu
 Value *SV = nullptr;
 
 for (unsigned vi = 0; vi != 2; ++vi) {
-  SmallVector Indices;
+  SmallVector Indices;
   for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i)
 Indices.push_back(2*i+vi);
 
@@ -3518,7 +3518,7 @@ Value *CodeGenFunction::EmitCommonNeonBu
 Value *SV = nullptr;
 
 for (unsigned vi = 0; vi != 2; ++vi) {
-  SmallVector Indices;
+  SmallVector Indices;
   for (unsigned i = 0, e = VTy->getNumElements(); i != e; i += 2) {
 Indices.push_back((i + vi*e) >> 1);
 Indices.push_back(((i + vi*e) >> 1)+e);
@@ -3573,7 +3573,7 @@ static Value *packTBLDVectorList(CodeGen
 TblOps.push_back(ExtOp);
 
   // Build a vector containing sequential number like (0, 1, 2, ..., 15)  
-  SmallVector Indices;
+  SmallVector Indices;
   llvm::VectorType *TblTy = cast(Ops[0]->getType());
   for (unsigned i = 0, e = TblTy->getNumElements(); i != e; ++i) {
 Indices.push_back(2*i);
@@ -6158,7 +6158,7 @@ Value *CodeGenFunction::EmitAArch64Built
 Value *SV = nullptr;
 
 for (unsigned vi = 0; vi != 2; ++vi) {
-  SmallVector Indices;
+  SmallVector Indices;
   for (unsigned i = 0, e = VTy->getNumElements(); i != e; i += 2) {
 Indices.push_back(i+vi);
 Indices.push_back(i+e+vi);
@@ -6177,7 +6177,7 @@ Value *CodeGenFunction::EmitAArch64Built
 Value *SV = nullptr;
 
 for (unsigned vi = 0; vi != 2; ++vi) {
-  SmallVector Indices;
+  SmallVector Indices;
   for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i)
 Indices.push_back(2*i+vi);
 
@@ -6195,7 +6195,7 @@ Value *CodeGenFunction::EmitAArch64Built
 Value *SV = nullptr;
 
 for (unsigned vi = 0; vi != 2; ++vi) {
-  SmallVector Indices;
+  SmallVector Indices;
   for (unsigned i = 0, e = VTy->getNumElements(); i != e; i += 2) {
 Indices.push_back((i + vi*e) >> 1);
 Indices.push_back(((i + vi*e) >> 1)+e);
@@ -6288,7 +6288,7 @@ static Value *getMaskVecValue(CodeGenFun
   // If we have less than 8 elements, then the starting mask was an i8 and
   // we need to extract down to the right number of elements.
   if (NumElts < 8) {
-int Indices[4];
+uint32_t Indices[4];
 for (unsigned i = 0; i != NumElts; ++i)
   Indices[i] = i;
 MaskVec = CGF.Builder.CreateShuffleVector(MaskVec, MaskVec,
@@ -6682,7 +6682,7 @@ Value *CodeGenFunction::EmitX86BuiltinEx
   Ops[0] = llvm::Constant::getNullValue(Ops[0]->getType());
 }
 
-int Indices[64];
+uint32_t Indices[64];
 // 256-bit palignr operates on 128-bit lanes so we need to handle that
 for (unsigned l = 0; l != NumElts; l += 16) {
   for (unsigned i = 0; i != 16; ++i) {


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


Re: Add support for musl-libc on Linux

2016-06-11 Thread Joerg Sonnenberger via cfe-commits
On Sat, Jun 11, 2016 at 03:14:38PM +0800, Lei Zhang via llvm-commits wrote:
> Hi,
> 
> The first patch introduces musl as a new environment type in LLVM; the
> second helps clang to find musl's dynamic linker, which has a
> different naming scheme from glibc's.
> 
> The two patches together enable clang to support targets like
> "x86_64-pc-linux-musl" and build binaries against musl-libc instead of
> glibc. This make it easy for clang to work on some musl-based systems
> like Alpine Linux and certain flavors of Gentoo.

LGTM, but needs test cases.

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


r272490 - [X86][BMI] Improved bmi intrinsics checks

2016-06-11 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Sat Jun 11 17:40:01 2016
New Revision: 272490

URL: http://llvm.org/viewvc/llvm-project?rev=272490&view=rev
Log:
[X86][BMI] Improved bmi intrinsics checks 

Ready for matching with llvm/test/CodeGen/X86/bmi-intrinsics-fast-isel.ll (to 
be added shortly)

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

Modified: cfe/trunk/test/CodeGen/bmi-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/bmi-builtins.c?rev=272490&r1=272489&r2=272490&view=diff
==
--- cfe/trunk/test/CodeGen/bmi-builtins.c (original)
+++ cfe/trunk/test/CodeGen/bmi-builtins.c Sat Jun 11 17:40:01 2016
@@ -1,164 +1,209 @@
-// RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +bmi 
-emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +bmi 
-emit-llvm -o - -Werror | FileCheck %s
 
 // Don't include mm_malloc.h, it's system specific.
 #define __MM_MALLOC_H
 
 #include 
 
-// The double underscore intrinsics are for compatibility with 
+// NOTE: This should match the tests in 
llvm/test/CodeGen/X86/bmi-intrinsics-fast-isel.ll
+
+// The double underscore intrinsics are for compatibility with
 // AMD's BMI interface. The single underscore intrinsics
 // are for compatibility with Intel's BMI interface.
 // Apart from the underscores, the interfaces are identical
-// except in one case: although the 'bextr' register-form 
-// instruction is identical in hardware, the AMD and Intel 
-// intrinsics are different! 
+// except in one case: although the 'bextr' register-form
+// instruction is identical in hardware, the AMD and Intel
+// intrinsics are different!
 
 unsigned short test__tzcnt_u16(unsigned short __X) {
-  // CHECK: @llvm.cttz.i16
+  // CHECK-LABEL: test__tzcnt_u16
+  // CHECK: zext i16 %{{.*}} to i32
+  // CHECK: icmp ne i32 %{{.*}}, 0
+  // CHECK: i16 @llvm.cttz.i16(i16 %{{.*}}, i1 true)
   return __tzcnt_u16(__X);
 }
 
 unsigned int test__andn_u32(unsigned int __X, unsigned int __Y) {
-  // CHECK: [[DEST:%.*]] = xor i32 %{{.*}}, -1
-  // CHECK-NEXT: %{{.*}} = and i32 %{{.*}}, [[DEST]]
+  // CHECK-LABEL: test__andn_u32
+  // CHECK: xor i32 %{{.*}}, -1
+  // CHECK: and i32 %{{.*}}, %{{.*}}
   return __andn_u32(__X, __Y);
 }
 
 unsigned int test__bextr_u32(unsigned int __X, unsigned int __Y) {
-  // CHECK: @llvm.x86.bmi.bextr.32
+  // CHECK-LABEL: test__bextr_u32
+  // CHECK: i32 @llvm.x86.bmi.bextr.32(i32 %{{.*}}, i32 %{{.*}})
   return __bextr_u32(__X, __Y);
 }
 
 unsigned int test__blsi_u32(unsigned int __X) {
-  // CHECK: [[DEST:%.*]] = sub i32 0, [[SRC:%.*]]
-  // CHECK-NEXT: %{{.*}} = and i32 [[SRC]], [[DEST]]
+  // CHECK-LABEL: test__blsi_u32
+  // CHECK: sub i32 0, %{{.*}}
+  // CHECK: and i32 %{{.*}}, %{{.*}}
   return __blsi_u32(__X);
 }
 
 unsigned int test__blsmsk_u32(unsigned int __X) {
-  // CHECK: [[DEST:%.*]] = add i32 [[SRC:%.*]], -1
-  // CHECK-NEXT: %{{.*}} = xor i32 [[DEST]], [[SRC]]
+  // CHECK-LABEL: test__blsmsk_u32
+  // CHECK: sub i32 %{{.*}}, 1
+  // CHECK: xor i32 %{{.*}}, %{{.*}}
   return __blsmsk_u32(__X);
 }
 
 unsigned int test__blsr_u32(unsigned int __X) {
-  // CHECK: [[DEST:%.*]] = add i32 [[SRC:%.*]], -1
-  // CHECK-NEXT: %{{.*}} = and i32 [[DEST]], [[SRC]]
+  // CHECK-LABEL: test__blsr_u32
+  // CHECK: sub i32 %{{.*}}, 1
+  // CHECK: and i32 %{{.*}}, %{{.*}}
   return __blsr_u32(__X);
 }
 
 unsigned int test__tzcnt_u32(unsigned int __X) {
-  // CHECK: @llvm.cttz.i32
+  // CHECK-LABEL: test__tzcnt_u32
+  // CHECK: icmp ne i32 %{{.*}}, 0
+  // CHECK: i32 @llvm.cttz.i32(i32 %{{.*}}, i1 true)
   return __tzcnt_u32(__X);
 }
 
 unsigned long long test__andn_u64(unsigned long __X, unsigned long __Y) {
-  // CHECK: [[DEST:%.*]] = xor i64 %{{.*}}, -1
-  // CHECK-NEXT: %{{.*}} = and i64 %{{.*}}, [[DEST]]
+  // CHECK-LABEL: test__andn_u64
+  // CHECK: xor i64 %{{.*}}, -1
+  // CHECK: and i64 %{{.*}}, %{{.*}}
   return __andn_u64(__X, __Y);
 }
 
 unsigned long long test__bextr_u64(unsigned long __X, unsigned long __Y) {
-  // CHECK: @llvm.x86.bmi.bextr.64
+  // CHECK-LABEL: test__bextr_u64
+  // CHECK: i64 @llvm.x86.bmi.bextr.64(i64 %{{.*}}, i64 %{{.*}})
   return __bextr_u64(__X, __Y);
 }
 
 unsigned long long test__blsi_u64(unsigned long long __X) {
-  // CHECK: [[DEST:%.*]] = sub i64 0, [[SRC:%.*]]
-  // CHECK-NEXT: %{{.*}} = and i64 [[SRC]], [[DEST]]
+  // CHECK-LABEL: test__blsi_u64
+  // CHECK: sub i64 0, %{{.*}}
+  // CHECK: and i64 %{{.*}}, %{{.*}}
   return __blsi_u64(__X);
 }
 
 unsigned long long test__blsmsk_u64(unsigned long long __X) {
-  // CHECK: [[DEST:%.*]] = add i64 [[SRC:%.*]], -1
-  // CHECK-NEXT: %{{.*}} = xor i64 [[DEST]], [[SRC]]
+  // CHECK-LABEL: test__blsmsk_u64
+  // CHECK: sub i64 %{{.*}}, 1
+  // CHECK: xor i64 %{{.*}}, %{{.*}}
   return __blsmsk_u64(__X);
 }
 
 unsigned long long test__blsr_u64(unsigned long long __X) {
-  // CHECK: [[DEST:%.*]] = add i64 [[SRC:%.*]], -1
-  // CHECK-NEXT: %{{.*}} = an

[PATCH] D21260: Implement variadic lock_guard.

2016-06-11 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added a reviewer: mclow.lists.
EricWF added subscribers: cfe-commits, mclow.lists.

This patch is incomplete (I think? I can't remember the exact state).

However I'm putting it up at @mclow.lists request.

http://reviews.llvm.org/D21260

Files:
  include/__config
  include/__mutex_base
  include/mutex
  include/tuple
  include/type_traits
  test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.fail.cpp
  
test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp
  
test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp
  
test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp
  
test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
  
test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp
  
test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp
  www/cxx1z_status.html

Index: www/cxx1z_status.html
===
--- www/cxx1z_status.html
+++ www/cxx1z_status.html
@@ -74,7 +74,7 @@
 	http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0006R0.html";>P0006R0LWGAdopt Type Traits Variable Templates for C++17.KonaComplete3.8
 	http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0092R1.html";>P0092R1LWGPolishing KonaComplete3.8
 	http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0007R1.html";>P0007R1LWGConstant View: A proposal for a std::as_const helper function template.KonaComplete3.8
-	http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0156R0.htm"; >P0156R0LWGVariadic lock_guard(rev 3).Kona
+	http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0156r0.html"; >P0156R0LWGVariadic lock_guard(rev 3).Kona
 	http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0074R0.html";>P0074R0LWGMaking std::owner_less more flexibleKonaComplete3.8
 	http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0013R1.html";>P0013R1LWGLogical type traits rev 2KonaComplete3.8
   	
Index: test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp
===
--- /dev/null
+++ test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp
@@ -0,0 +1,68 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// 
+
+// template 
+// class lock_guard
+// {
+// public:
+// typedef Mutex mutex_type;
+// ...
+// };
+
+#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+#include 
+#include 
+
+struct NAT {};
+
+template 
+auto test_typedef(int) -> typename LG::mutex_type;
+
+template 
+auto test_typedef(...) -> NAT;
+
+template 
+constexpr bool has_mutex_type() {
+return !std::is_same(0)), NAT>::value;
+}
+
+int main()
+{
+{
+using T = std::lock_guard<>;
+static_assert(!has_mutex_type(), "");
+}
+{
+using M1 = std::mutex;
+using M2 = std::recursive_mutex;
+using T = std::lock_guard;
+static_assert(!has_mutex_type(), "");
+}
+{
+using M1 = std::mutex;
+using M2 = std::recursive_mutex;
+using T = std::lock_guard;
+static_assert(!has_mutex_type(), "");
+}
+{
+using M1 = std::mutex;
+using T = std::lock_guard;
+static_assert(std::is_same::value, "");
+}
+{
+using M1 = std::recursive_mutex;
+using T = std::lock_guard;
+static_assert(std::is_same::value, "");
+}
+}
Index: test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp
===
--- /dev/null
+++ test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp
@@ -0,0 +1,113 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// 
+
+// template  class lock_guard;
+
+// explicit lock_guard(mutex_type& m);
+
+#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+#include 
+#include 
+
+struct TestMutex {
+bool locked = false;
+TestMutex() = default;
+~TestMutex() { assert(!locked); }
+
+void lock() { assert(!locked); locked = true; }
+bool try_lock() {

r272487 - Visual Studio Visualizers for ActionResult, LocInfoType, and and TypeSourceInfo

2016-06-11 Thread Mike Spertus via cfe-commits
Author: mps
Date: Sat Jun 11 15:15:19 2016
New Revision: 272487

URL: http://llvm.org/viewvc/llvm-project?rev=272487&view=rev
Log:
Visual Studio Visualizers for ActionResult, LocInfoType, and and TypeSourceInfo

Created a visualizer for ActionResult that displayed the validity and the 
pointer,
but many of them initially displayed poorly. It turns out that the primary 
culprit
is that LocInfoType is often passed in an action result, but it is not the same 
as other types. For example, LocInfoType is not in TypeNodes.def and 
clang::Type::TypeClass
does not have a LocInfoType enum. After adding a special visualizer for 
LocInfoType,
the display was more useful

Modified:
cfe/trunk/utils/ClangVisualizers/clang.natvis

Modified: cfe/trunk/utils/ClangVisualizers/clang.natvis
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ClangVisualizers/clang.natvis?rev=272487&r1=272486&r2=272487&view=diff
==
--- cfe/trunk/utils/ClangVisualizers/clang.natvis (original)
+++ cfe/trunk/utils/ClangVisualizers/clang.natvis Sat Jun 11 15:15:19 2016
@@ -20,6 +20,7 @@ For later versions of Visual Studio, no
containing all the gory details.
"cpp": Only occasionally used when we need to distinguish between 
an ordinary view and a C++-like view.
 -->
+LocInfoType
 {(clang::Type::TypeClass)TypeBits.TC, 
en}Type
 
 {*(clang::BuiltinType *)this}
@@ -34,6 +35,7 @@ For later versions of Visual Studio, no
 {*(clang::FunctionProtoType *)this}
 {*(clang::TemplateSpecializationType *)this}
 {*(clang::InjectedClassNameType *)this}
+{*(clang::LocInfoType *)this}
 {*this,view(poly)}
 {*this,view(cmn)} 
 {*this,view(cmn)}  {{{*this,view(poly)}}}
@@ -52,6 +54,7 @@ For later versions of Visual Studio, no
   (clang::FunctionProtoType
 *)this
   (clang::TemplateSpecializationType
 *)this
   (clang::InjectedClassNameType
 *)this
+  (clang::LocInfoType 
*)this
 
   
   
@@ -226,6 +229,16 @@ For later versions of Visual Studio, no
   *((clang::ExtQualsTypeCommonBase 
*)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 
1)))->BaseType
 
   
+  
+{*DeclInfo}
+
+  DeclInfo
+  *(clang::Type *)this, view(cmn)
+
+  
+  
+{Ty}
+  
   
 {Argument}
 
@@ -499,4 +512,30 @@ For later versions of Visual Studio, no
 {Ambiguity,en}: {Decls}
 {ResultKind,en}: {Decls}
   
+  
+Invalid
+Valid
+   
+  
+Invalid
+Valid
+  
+  
+{*this,view(packedValidity)}: {($T1 
*)(PtrWithInvalid&~1)}
+
+  (bool)(PtrWithInvalid&1)
+  ($T1 *)(PtrWithInvalid&~1)
+
+  
+  
+{*this,view(unpackedValidity)}: {Val}
+  
+  
+{*this,view(packed)}
+{*this,view(unpacked)}
+
+  *this,view(packed)
+  *this,view(unpacked)
+
+  
 


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


Re: [PATCH] D19783: Fix cv-qualification of '*this' captures (and nasty bug PR27507 introduced by commit 263921 "Implement Lambda Capture of *this by Value as [=, *this]")

2016-06-11 Thread Faisal Vali via cfe-commits
faisalv accepted this revision.
faisalv added a reviewer: faisalv.
faisalv added a comment.
This revision is now accepted and ready to land.

Committed as r272480 
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160606/161728.html


http://reviews.llvm.org/D19783



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


r272480 - Fix cv-qualification of '*this' captures and nasty bug PR27507

2016-06-11 Thread Faisal Vali via cfe-commits
Author: faisalv
Date: Sat Jun 11 11:41:54 2016
New Revision: 272480

URL: http://llvm.org/viewvc/llvm-project?rev=272480&view=rev
Log:
Fix cv-qualification of '*this' captures and nasty bug PR27507 

The bug report by Gonzalo (https://llvm.org/bugs/show_bug.cgi?id=27507 -- which 
results in clang crashing when generic lambdas that capture 'this' are 
instantiated in contexts where the Functionscopeinfo stack is not in a reliable 
state - yet getCurrentThisType expects it to be) - unearthed some additional 
bugs in regards to maintaining proper cv qualification through 'this' when 
performing by value captures of '*this'.

This patch attempts to correct those bugs and makes the following changes:

   o) when capturing 'this', we do not need to remember the type of 'this' 
within the LambdaScopeInfo's Capture - it is never really used for a this 
capture - so remove it.
   o) teach getCurrentThisType to walk the stack of lambdas (even in scenarios 
where we run out of LambdaScopeInfo's such as when instantiating call 
operators) looking for by copy captures of '*this' and resetting the type of 
'this' based on the constness of that capturing lambda's call operator.

This patch has been baking in review-hell for > 6 weeks - all the comments so 
far have been addressed and the bug (that it addresses in passing, and I regret 
not submitting as a separate patch initially) has been reported twice 
independently, so is frequent and important for us not to just sit on. I merged 
the cv qualification-fix and the PR-fix initially in one patch, since they 
resulted from my initial implementation of star-this and so were related. If 
someone really feels strongly, I can put in the time to revert this - separate 
the two out - and recommit.  I won't claim it's immunized against all bugs, but 
I feel confident enough about the fix to land it for now.

Modified:
cfe/trunk/include/clang/Sema/ScopeInfo.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/cxx1z-lambda-star-this.cpp

Modified: cfe/trunk/include/clang/Sema/ScopeInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ScopeInfo.h?rev=272480&r1=272479&r2=272480&view=diff
==
--- cfe/trunk/include/clang/Sema/ScopeInfo.h (original)
+++ cfe/trunk/include/clang/Sema/ScopeInfo.h Sat Jun 11 11:41:54 2016
@@ -500,8 +500,11 @@ public:
 /// \brief Retrieve the capture type for this capture, which is effectively
 /// the type of the non-static data member in the lambda/block structure
 /// that would store this capture.
-QualType getCaptureType() const { return CaptureType; }
-
+QualType getCaptureType() const {
+  assert(!isThisCapture());
+  return CaptureType;
+}
+
 Expr *getInitExpr() const {
   assert(!isVLATypeCapture() && "no init expression for type capture");
   return static_cast(InitExprAndCaptureKind.getPointer());
@@ -546,7 +549,10 @@ public:
/*Cpy*/ nullptr));
   }
 
-  void addThisCapture(bool isNested, SourceLocation Loc, QualType CaptureType,
+  // Note, we do not need to add the type of 'this' since that is always
+  // retrievable from Sema::getCurrentThisType - and is also encoded within the
+  // type of the corresponding FieldDecl.
+  void addThisCapture(bool isNested, SourceLocation Loc,
   Expr *Cpy, bool ByCopy);
 
   /// \brief Determine whether the C++ 'this' is captured.
@@ -868,9 +874,9 @@ void FunctionScopeInfo::recordUseOfWeak(
 
 inline void
 CapturingScopeInfo::addThisCapture(bool isNested, SourceLocation Loc,
-   QualType CaptureType, Expr *Cpy,
+   Expr *Cpy,
const bool ByCopy) {
-  Captures.push_back(Capture(Capture::ThisCapture, isNested, Loc, CaptureType,
+  Captures.push_back(Capture(Capture::ThisCapture, isNested, Loc, QualType(),
  Cpy, ByCopy));
   CXXThisCaptureIndex = Captures.size();
 }

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=272480&r1=272479&r2=272480&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Jun 11 11:41:54 2016
@@ -11177,7 +11177,7 @@ static void RebuildLambdaScopeInfo(CXXMe
 
 } else if (C.capturesThis()) {
   LSI->addThisCapture(/*Nested*/ false, C.getLocation(),
-  S.getCurrentThisType(), /*Expr*/ nullptr,
+  /*Expr*/ nullptr,
   C.getCaptureKind() == LCK_StarThis);
 } else {
   LSI->addVLATypeCapture(C.getLocation(), I->getType());

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sem

Re: [PATCH] D18470: [OPENMP] Remove unnecessary code generation of firstprivate clause for target directive in nvptx

2016-06-11 Thread Carlo Bertolli via cfe-commits
carlo.bertolli abandoned this revision.
carlo.bertolli added a comment.

Codegen of region bodies should not be specialized based on target.


Repository:
  rL LLVM

http://reviews.llvm.org/D18470



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


Add support for musl-libc on Linux

2016-06-11 Thread Lei Zhang via cfe-commits
Hi,

The first patch introduces musl as a new environment type in LLVM; the
second helps clang to find musl's dynamic linker, which has a
different naming scheme from glibc's.

The two patches together enable clang to support targets like
"x86_64-pc-linux-musl" and build binaries against musl-libc instead of
glibc. This make it easy for clang to work on some musl-based systems
like Alpine Linux and certain flavors of Gentoo.


Regards,
Lei


llvm-musl.patch
Description: Binary data


clang-musl.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21145: [Sema] Fix crash on valid where instantiation of lambda cannot access type of 'this'

2016-06-11 Thread Faisal Vali via cfe-commits
faisalv added inline comments.


Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:3922
@@ -3920,1 +3921,3 @@
+  *this, Var->getDeclContext(),
+  /*NewThisContext=*/!isLambdaCallOperator(getCurLexicalContext()));
   Init = SubstInitializer(OldVar->getInit(), TemplateArgs,

I don't think this is the right fix.  In my opinion, the fix should be to teach 
getCurrentThisType to recognize that we are in a context where a  lambda is 
being 'transformed' and correctly return the type of 'this', regardless of the 
containing-context of the lambda.  Also see the Richard-inspired FIXME to 
attempt to comprehensively handle such cases.

getCurrentThisType is broken though in some other ways currently (handling the 
cv qualification of lambda 'this' captures by value) - and i'm going to commit 
my patch to fix that later today.  Let me know if you'd like me to work on this 
next, or would prefer to take a crack at it yourself.

Thanks for looking into this - apologies for the delay in feedback.



http://reviews.llvm.org/D21145



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


r272470 - [AVX512] Use a regular expression instead of checking for a specific name in a CHECK line in test.

2016-06-11 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sat Jun 11 08:35:43 2016
New Revision: 272470

URL: http://llvm.org/viewvc/llvm-project?rev=272470&view=rev
Log:
[AVX512] Use a regular expression instead of checking for a specific name in a 
CHECK line in test.

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

Modified: cfe/trunk/test/CodeGen/avx512vl-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512vl-builtins.c?rev=272470&r1=272469&r2=272470&view=diff
==
--- cfe/trunk/test/CodeGen/avx512vl-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512vl-builtins.c Sat Jun 11 08:35:43 2016
@@ -6593,7 +6593,7 @@ __m256 test_mm256_maskz_moveldup_ps(__mm
 
 __m128i test_mm_mask_shuffle_epi32(__m128i __W, __mmask8 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_mask_shuffle_epi32
-  // CHECK: shufflevector <4 x i32> %2, <4 x i32> %4, <4 x i32> 
+  // CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> 
   // CHECK: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
   return _mm_mask_shuffle_epi32(__W, __U, __A, 1); 
 }


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


r272467 - [AVX512] Implement masked and 512-bit pshufd intrinsics directly with __builtin_shufflevector and __builtin_ia32_select.

2016-06-11 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sat Jun 11 07:50:19 2016
New Revision: 272467

URL: http://llvm.org/viewvc/llvm-project?rev=272467&view=rev
Log:
[AVX512] Implement masked and 512-bit pshufd intrinsics directly with 
__builtin_shufflevector and __builtin_ia32_select.

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

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=272467&r1=272466&r2=272467&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Sat Jun 11 07:50:19 2016
@@ -2177,9 +2177,6 @@ TARGET_BUILTIN(__builtin_ia32_movshdup12
 TARGET_BUILTIN(__builtin_ia32_movshdup256_mask, "V8fV8fV8fUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_movsldup128_mask, "V4fV4fV4fUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_movsldup256_mask, "V8fV8fV8fUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pshufd512_mask, "V16iV16iIiV16iUs","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_pshufd256_mask, "V8iV8iIiV8iUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pshufd128_mask, "V4iV4iIiV4iUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_expanddf512_mask, "V8dV8dV8dUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_expanddi512_mask, 
"V8LLiV8LLiV8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_expandloaddf512_mask, 
"V8dV8dC*V8dUc","","avx512f")

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=272467&r1=272466&r2=272467&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Sat Jun 11 07:50:19 2016
@@ -9052,19 +9052,34 @@ _mm512_maskz_moveldup_ps (__mmask16 __U,
 }
 
 #define _mm512_shuffle_epi32(A, I) __extension__ ({ \
-  (__m512i)__builtin_ia32_pshufd512_mask((__v16si)(__m512i)(A), (int)(I), \
- (__v16si)_mm512_undefined_epi32(), \
- (__mmask16)-1); })
+  (__m512i)__builtin_shufflevector((__v16si)(__m512i)(A), \
+   (__v16si)_mm512_setzero_si512(), \
+   0  + (((I) & 0x03) >> 0), \
+   0  + (((I) & 0x0c) >> 2), \
+   0  + (((I) & 0x30) >> 4), \
+   0  + (((I) & 0xc0) >> 6), \
+   4  + (((I) & 0x03) >> 0), \
+   4  + (((I) & 0x0c) >> 2), \
+   4  + (((I) & 0x30) >> 4), \
+   4  + (((I) & 0xc0) >> 6), \
+   8  + (((I) & 0x03) >> 0), \
+   8  + (((I) & 0x0c) >> 2), \
+   8  + (((I) & 0x30) >> 4), \
+   8  + (((I) & 0xc0) >> 6), \
+   12 + (((I) & 0x03) >> 0), \
+   12 + (((I) & 0x0c) >> 2), \
+   12 + (((I) & 0x30) >> 4), \
+   12 + (((I) & 0xc0) >> 6)); })
 
 #define _mm512_mask_shuffle_epi32(W, U, A, I) __extension__ ({ \
-  (__m512i)__builtin_ia32_pshufd512_mask((__v16si)(__m512i)(A), (int)(I), \
- (__v16si)(__m512i)(W), \
- (__mmask16)(U)); })
+  (__m512i)__builtin_ia32_selectd_512((__mmask16)(U), \
+  (__v16si)_mm512_shuffle_epi32((A), (I)), 
\
+  (__v16si)(__m512i)(W)); })
 
 #define _mm512_maskz_shuffle_epi32(U, A, I) __extension__ ({ \
-  (__m512i)__builtin_ia32_pshufd512_mask((__v16si)(__m512i)(A), (int)(I), \
- (__v16si)_mm512_setzero_si512(), \
- (__mmask16)(U)); })
+  (__m512i)__builtin_ia32_selectd_512((__mmask16)(U), \
+  (__v16si)_mm512_shuffle_epi32((A), (I)), 
\
+  (__v16si)_mm512_setzero_si512()); })
 
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_mask_expand_pd (__m512d __W, __mmask8 __U, __m512d __A)

Modified: cfe/trunk/lib/Headers/avx512vlintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlintrin.h?rev=272467&r1=272466&r2=272467&view=diff
==
--- cfe/trunk/lib/Headers/avx512vlintrin.h (original)
+++ cfe/trunk/lib/He

r272466 - [X86] Add explicit typecasts to some intrinsics.

2016-06-11 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sat Jun 11 07:50:12 2016
New Revision: 272466

URL: http://llvm.org/viewvc/llvm-project?rev=272466&view=rev
Log:
[X86] Add explicit typecasts to some intrinsics.

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

Modified: cfe/trunk/lib/Headers/avx512vlbwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlbwintrin.h?rev=272466&r1=272465&r2=272466&view=diff
==
--- cfe/trunk/lib/Headers/avx512vlbwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlbwintrin.h Sat Jun 11 07:50:12 2016
@@ -2428,22 +2428,24 @@ _mm256_maskz_cvtepu8_epi16 (__mmask16 __
 
 #define _mm_mask_shufflelo_epi16(W, U, A, imm) __extension__ ({ \
   (__m128i)__builtin_ia32_selectw_128((__mmask8)(U), \
-  _mm_shufflelo_epi16((A), (imm)), \
+  (__v8hi)_mm_shufflelo_epi16((A), (imm)), 
\
   (__v8hi)(__m128i)(W)); })
 
 #define _mm_maskz_shufflelo_epi16(U, A, imm) __extension__ ({ \
   (__m128i)__builtin_ia32_selectw_128((__mmask8)(U), \
-  _mm_shufflelo_epi16((A), (imm)), \
+  (__v8hi)_mm_shufflelo_epi16((A), (imm)), 
\
   (__v8hi)_mm_setzero_hi()); })
 
 #define _mm256_mask_shufflelo_epi16(W, U, A, imm) __extension__ ({ \
   (__m256i)__builtin_ia32_selectw_256((__mmask16)(U), \
-  _mm256_shufflelo_epi16((A), (imm)), \
+  (__v16hi)_mm256_shufflelo_epi16((A), \
+  (imm)), \
   (__v16hi)(__m256i)(W)); })
 
 #define _mm256_maskz_shufflelo_epi16(U, A, imm) __extension__ ({ \
   (__m256i)__builtin_ia32_selectw_256((__mmask16)(U), \
-  _mm256_shufflelo_epi16((A), (imm)), \
+  (__v16hi)_mm256_shufflelo_epi16((A), \
+  (imm)), \
   (__v16hi)_mm256_setzero_si256()); })
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS


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


Re: r271883 - [clang-format] make header guard identification stricter (with Lexer).

2016-06-11 Thread Eric Liu via cfe-commits
Hi Mehdi,

No, it is not intended... thanks for pointing that out! I have fixed it at
rL272465.

Thanks,
Eric

On Fri, Jun 10, 2016 at 10:42 PM Mehdi Amini  wrote:

> Hi Eric,
>
> > On Jun 6, 2016, at 4:00 AM, Eric Liu via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >
> > Author: ioeric
> > Date: Mon Jun  6 06:00:13 2016
> > New Revision: 271883
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=271883&view=rev
> > Log:
> > [clang-format] make header guard identification stricter (with Lexer).
> >
> > Summary: make header guard identification stricter with Lexer.
> >
> > Reviewers: djasper
> >
> > Subscribers: klimek, cfe-commits
> >
> > Differential Revision: http://reviews.llvm.org/D20959
> >
> > Modified:
> >cfe/trunk/lib/Format/Format.cpp
> >cfe/trunk/unittests/Format/CleanupTest.cpp
> >
> > Modified: cfe/trunk/lib/Format/Format.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=271883&r1=271882&r2=271883&view=diff
> >
> ==
> > --- cfe/trunk/lib/Format/Format.cpp (original)
> > +++ cfe/trunk/lib/Format/Format.cpp Mon Jun  6 06:00:13 2016
> > @@ -1436,6 +1436,49 @@ inline bool isHeaderInsertion(const tool
> >
> llvm::Regex(IncludeRegexPattern).match(Replace.getReplacementText());
> > }
> >
> > +void skipComments(Lexer &Lex, Token &Tok) {
> > +  while (Tok.is(tok::comment))
> > +if (Lex.LexFromRawLexer(Tok))
> > +  return;
> > +}
> > +
> > +// Check if a sequence of tokens is like "# ". If
> it is,
> > +// \p Tok will be the token after this directive; otherwise, it can be
> any token
> > +// after the given \p Tok (including \p Tok).
> > +bool checkAndConsumeDirectiveWithName(Lexer &Lex, StringRef Name, Token
> &Tok) {
> > +  bool Matched = Tok.is(tok::hash) && !Lex.LexFromRawLexer(Tok) &&
> > + Tok.is(tok::raw_identifier) &&
> > + Tok.getRawIdentifier() == Name &&
> !Lex.LexFromRawLexer(Tok) &&
> > + Tok.is(tok::raw_identifier);
> > +  if (Matched)
> > +Lex.LexFromRawLexer(Tok);
> > +  return Matched;
> > +}
> > +
> > +unsigned getOffsetAfterHeaderGuardsAndComments(StringRef FileName,
> > +   StringRef Code,
> > +   FormatStyle Style) {
>
>
> FormatStyle is 360B, did you really intended to pass it by value here?
>
> --
> Mehdi
>
>
> > +  std::unique_ptr Env =
> > +  Environment::CreateVirtualEnvironment(Code, FileName,
> /*Ranges=*/{});
> > +  const SourceManager &SourceMgr = Env->getSourceManager();
> > +  Lexer Lex(Env->getFileID(), SourceMgr.getBuffer(Env->getFileID()),
> SourceMgr,
> > +getFormattingLangOpts(Style));
> > +  Token Tok;
> > +  // Get the first token.
> > +  Lex.LexFromRawLexer(Tok);
> > +  skipComments(Lex, Tok);
> > +  unsigned AfterComments = SourceMgr.getFileOffset(Tok.getLocation());
> > +  if (checkAndConsumeDirectiveWithName(Lex, "ifndef", Tok)) {
> > +skipComments(Lex, Tok);
> > +if (checkAndConsumeDirectiveWithName(Lex, "define", Tok))
> > +  return SourceMgr.getFileOffset(Tok.getLocation());
> > +  }
> > +  return AfterComments;
> > +}
> > +
> > +// FIXME: we also need to insert a '\n' at the end of the code if we
> have an
> > +// insertion with offset Code.size(), and there is no '\n' at the end
> of the
> > +// code.
> > // FIXME: do not insert headers into conditional #include blocks, e.g.
> #includes
> > // surrounded by compile condition "#if...".
> > // FIXME: do not insert existing headers.
> > @@ -1469,20 +1512,6 @@ fixCppIncludeInsertions(StringRef Code,
> >   StringRef FileName = Replaces.begin()->getFilePath();
> >   IncludeCategoryManager Categories(Style, FileName);
> >
> > -  std::unique_ptr Env =
> > -  Environment::CreateVirtualEnvironment(Code, FileName,
> /*Ranges=*/{});
> > -  const SourceManager &SourceMgr = Env->getSourceManager();
> > -  Lexer Lex(Env->getFileID(), SourceMgr.getBuffer(Env->getFileID()),
> SourceMgr,
> > -getFormattingLangOpts(Style));
> > -  Token Tok;
> > -  // All new headers should be inserted after this offset.
> > -  int MinInsertOffset = Code.size();
> > -  while (!Lex.LexFromRawLexer(Tok)) {
> > -if (Tok.isNot(tok::comment)) {
> > -  MinInsertOffset = SourceMgr.getFileOffset(Tok.getLocation());
> > -  break;
> > -}
> > -  }
> >   // Record the offset of the end of the last include in each category.
> >   std::map CategoryEndOffsets;
> >   // All possible priorities.
> > @@ -1491,26 +1520,25 @@ fixCppIncludeInsertions(StringRef Code,
> >   for (const auto &Category : Style.IncludeCategories)
> > Priorities.insert(Category.Priority);
> >   int FirstIncludeOffset = -1;
> > -  bool HeaderGuardFound = false;
> > +  // All new headers should be inserted after this offset.
> > +  unsigned MinInsertOffset =
> > +  getOffsetAfterHeaderGuardsAndComments(FileName, Code, Style);
> >   StringRef Trimm

r272465 - [clang-format] pass Style by reference instead of value.

2016-06-11 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Sat Jun 11 06:45:08 2016
New Revision: 272465

URL: http://llvm.org/viewvc/llvm-project?rev=272465&view=rev
Log:
[clang-format] pass Style by reference instead of value.

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

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=272465&r1=272464&r2=272465&view=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Sat Jun 11 06:45:08 2016
@@ -1457,7 +1457,7 @@ bool checkAndConsumeDirectiveWithName(Le
 
 unsigned getOffsetAfterHeaderGuardsAndComments(StringRef FileName,
StringRef Code,
-   FormatStyle Style) {
+   const FormatStyle &Style) {
   std::unique_ptr Env =
   Environment::CreateVirtualEnvironment(Code, FileName, /*Ranges=*/{});
   const SourceManager &SourceMgr = Env->getSourceManager();


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


Re: r272413 - Strip Android version when looking up toolchain paths.

2016-06-11 Thread Josh Gao via cfe-commits
Sorry, I got some other buildbot failure emails in which the test didn't
fail, and I assumed they were all the same. I'll be more careful in the
future.

-Josh
On Jun 10, 2016 10:04 PM, "Chandler Carruth"  wrote:

> This broke several bots that have now been red most of the day. Here are
> recent builds that show the failure:
> http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/4611
> http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/6331
> http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/15622
>
> I suspect this is because using PATH in this way as part of a test doesn't
> work well, but I'll let you look at what the best option is for fixing
> this. For now I've reverted it in
>
> Please watch the bots when committing in the future.
>
> -Chandler
>
> On Fri, Jun 10, 2016 at 11:37 AM Josh Gao via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: jmgao
>> Date: Fri Jun 10 13:30:33 2016
>> New Revision: 272413
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=272413&view=rev
>> Log:
>> Strip Android version when looking up toolchain paths.
>>
>> Summary:
>> Android target triples can include a version number in the abi field
>> (e.g. 'aarch64-linux-android21'), used for checking for availability.
>> However, the driver was searching for toolchain binaries using the
>> passed in triple as a prefix.
>>
>> Reviewers: srhines, danalbert, t.p.northover
>>
>> Subscribers: t.p.northover, aemerson, tberghammer, danalbert, srhines,
>> cfe-commits
>>
>> Differential Revision: http://reviews.llvm.org/D21163
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/android_triple_version/
>> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/
>>
>> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld
>>  (with props)
>>
>> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
>>  (with props)
>> cfe/trunk/test/Driver/android-triple-version.c
>> Modified:
>> cfe/trunk/lib/Driver/Driver.cpp
>>
>> Modified: cfe/trunk/lib/Driver/Driver.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=272413&r1=272412&r2=272413&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Driver/Driver.cpp (original)
>> +++ cfe/trunk/lib/Driver/Driver.cpp Fri Jun 10 13:30:33 2016
>> @@ -2343,7 +2343,15 @@ void Driver::generatePrefixedToolNames(
>>  const char *Tool, const ToolChain &TC,
>>  SmallVectorImpl &Names) const {
>>// FIXME: Needs a better variable than DefaultTargetTriple
>> -  Names.emplace_back(DefaultTargetTriple + "-" + Tool);
>> +  StringRef Triple = DefaultTargetTriple;
>> +
>> +  // On Android, the target triple can include a version number that
>> needs to
>> +  // be stripped.
>> +  if (TC.getTriple().isAndroid()) {
>> +Triple = Triple.rtrim("0123456789");
>> +  }
>> +
>> +  Names.emplace_back((Triple + "-" + Tool).str());
>>Names.emplace_back(Tool);
>>
>>// Allow the discovery of tools prefixed with LLVM's default target
>> triple.
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld?rev=272413&view=auto
>>
>> ==
>> (empty)
>>
>> Propchange:
>> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld
>>
>> --
>> svn:executable = *
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe?rev=272413&view=auto
>>
>> ==
>> (empty)
>>
>> Propchange:
>> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
>>
>> --
>> svn:executable = *
>>
>> Added: cfe/trunk/test/Driver/android-triple-version.c
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/android-triple-version.c?rev=272413&view=auto
>>
>> ==
>> --- cfe/trunk/test/Driver/android-triple-version.c (added)
>> +++ cfe/trunk/test/Driver/android-triple-version.c Fri Jun 10 13:30:33
>> 2016
>> @@ -0,0 +1,10 @@
>> +// Android's target triples can contain a version number in the
>> environment
>> +// field (e.g. arm-linux-androideabi9).
>> +// Make sure that any version is stripped when finding toolchain
>> binaries.
>> +
>> +// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
>> +// RUN: %clang -### -target arm-linux-androideabi %s 2