r251501 - Reflow comment.

2015-10-27 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Wed Oct 28 01:56:25 2015
New Revision: 251501

URL: http://llvm.org/viewvc/llvm-project?rev=251501&view=rev
Log:
Reflow comment.

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=251501&r1=251500&r2=251501&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Oct 28 01:56:25 2015
@@ -324,12 +324,10 @@ bool CodeGenFunction::checkBuiltinTarget
 if (ParsedAttr.second != "")
   TargetCPU = ParsedAttr.second;
 
-// Now populate the feature map, first with the TargetCPU which is
-// either
-// the default or a new one from the target attribute string. Then we'll
-// use the passed in features (FeaturesAsWritten) along with the new
-// ones
-// from the attribute.
+// Now populate the feature map, first with the TargetCPU which is either
+// the default or a new one from the target attribute string. Then we'll 
use
+// the passed in features (FeaturesAsWritten) along with the new ones from
+// the attribute.
 Target.initFeatureMap(FeatureMap, CGM.getDiags(), TargetCPU,
   ParsedAttr.first);
   } else {


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


[clang-tools-extra] r251499 - [tidy] Remove stray iostream include from test.

2015-10-27 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Wed Oct 28 00:16:37 2015
New Revision: 251499

URL: http://llvm.org/viewvc/llvm-project?rev=251499&view=rev
Log:
[tidy] Remove stray iostream include from test.

It is unused and we cannot rely on standard headers being present while
executing tests.

Modified:
clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.cpp?rev=251499&r1=251498&r2=251499&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.cpp 
Wed Oct 28 00:16:37 2015
@@ -1,6 +1,6 @@
 // RUN: %check_clang_tidy %s modernize-redundant-void-arg %t
 
-#include 
+#define NULL 0
 
 int foo();
 


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


r251496 - Refine r251469 to give better (and more localizable) diagnostics

2015-10-27 Thread John McCall via cfe-commits
Author: rjmccall
Date: Wed Oct 28 00:03:19 2015
New Revision: 251496

URL: http://llvm.org/viewvc/llvm-project?rev=251496&view=rev
Log:
Refine r251469 to give better (and more localizable) diagnostics
for all the reasons that ARC makes things implicitly unavailable.

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/SemaObjC/arc-system-header.m
cfe/trunk/test/SemaObjC/arc-unavailable-system-function.m
cfe/trunk/test/SemaObjC/mrc-no-weak.m
cfe/trunk/test/SemaObjCXX/arc-system-header.mm

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=251496&r1=251495&r2=251496&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Wed Oct 28 00:03:19 2015
@@ -132,6 +132,9 @@ def HasFunctionProto : SubsetSubject {
   string Name = name;
   bit Optional = optional;
+
+  /// A fake argument is used to store and serialize additional information
+  /// in an attribute without actually changing its parsing or pretty-printing.
   bit Fake = fake;
 }
 
@@ -1353,9 +1356,14 @@ def TransparentUnion : InheritableAttr {
 def Unavailable : InheritableAttr {
   let Spellings = [GNU<"unavailable">];
   let Args = [StringArgument<"Message", 1>,
-  EnumArgument<"ImplicitSource", "ImplicitSourceKind",
-   ["none", "forbiddenType"],
-   ["ISK_None", "ISK_ForbiddenType"], 1, /*fake*/ 1>];
+  EnumArgument<"ImplicitReason", "ImplicitReason",
+["", "", "", ""],
+["IR_None",
+ "IR_ARCForbiddenType",
+ "IR_ForbiddenWeak",
+ "IR_ARCForbiddenConversion",
+ "IR_ARCInitReturnsUnrelated",
+ "IR_ARCFieldWithOwnership"], 1, /*fake*/ 1>];
   let Documentation = [Undocumented];
 }
 

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=251496&r1=251495&r2=251496&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Oct 28 00:03:19 
2015
@@ -3992,8 +3992,6 @@ def err_unavailable_message : Error<"%0
 def warn_unavailable_fwdclass_message : Warning<
 "%0 may be unavailable because the receiver type is unknown">,
 InGroup;
-def note_unavailability_inferred_here : Note<
-"unsupported declaration here">;
 def note_availability_specified_here : Note<
   "%0 has been explicitly marked "
   "%select{unavailable|deleted|deprecated|partial}1 here">;
@@ -4555,6 +4553,21 @@ def err_arc_convesion_of_weak_unavailabl
 
 let CategoryName = "ARC Restrictions" in {
 
+def err_unavailable_in_arc : Error<
+  "%0 is unavailable in ARC">;
+def note_arc_forbidden_type : Note<
+  "declaration uses type that is ill-formed in ARC">;
+def note_performs_forbidden_arc_conversion : Note<
+  "inline function performs a conversion which is forbidden in ARC">;
+def note_arc_init_returns_unrelated : Note<
+  "init method must return a type related to its receiver type">;
+def note_arc_weak_disabled : Note<
+  "declaration uses __weak, but ARC is disabled">;
+def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
+  "the current deployment target does not support">;
+def note_arc_field_with_ownership : Note<
+  "field has non-trivial ownership qualification">;
+
 def err_arc_illegal_explicit_message : Error<
   "ARC forbids explicit message send of %0">;
 def err_arc_unused_init_message : Error<

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=251496&r1=251495&r2=251496&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Oct 28 00:03:19 2015
@@ -3498,7 +3498,7 @@ public:
bool ObjCPropertyAccess);
 
   bool makeUnavailableInSystemHeader(SourceLocation loc,
- StringRef message);
+ UnavailableAttr::ImplicitReason reason);
 
   
//======//
   // Expression Parsing Callbacks: SemaExpr.cpp.

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=251496&r1=251495&r2=251496

r251493 - Driver: support -fuse-ld= on cross windows

2015-10-27 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Tue Oct 27 23:45:58 2015
New Revision: 251493

URL: http://llvm.org/viewvc/llvm-project?rev=251493&view=rev
Log:
Driver: support -fuse-ld= on cross windows

Update the linker selection to support the `-fuse-ld=` option for selecting a
linker.

Added:
cfe/trunk/test/Driver/Inputs/Windows/ARM/8.1/usr/bin/ld.lld-link2   (with 
props)
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/windows-cross.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=251493&r1=251492&r2=251493&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Oct 27 23:45:58 2015
@@ -9750,8 +9750,7 @@ void CrossWindows::Linker::ConstructJob(
 }
   }
 
-  const std::string Linker = TC.GetProgramPath("ld");
-  Exec = Args.MakeArgString(Linker);
+  Exec = Args.MakeArgString(TC.GetLinkerPath());
 
   C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
 }

Added: cfe/trunk/test/Driver/Inputs/Windows/ARM/8.1/usr/bin/ld.lld-link2
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/Windows/ARM/8.1/usr/bin/ld.lld-link2?rev=251493&view=auto
==
(empty)

Propchange: cfe/trunk/test/Driver/Inputs/Windows/ARM/8.1/usr/bin/ld.lld-link2
--
svn:executable = *

Modified: cfe/trunk/test/Driver/windows-cross.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-cross.c?rev=251493&r1=251492&r2=251493&view=diff
==
--- cfe/trunk/test/Driver/windows-cross.c (original)
+++ cfe/trunk/test/Driver/windows-cross.c Tue Oct 27 23:45:58 2015
@@ -38,3 +38,7 @@
 
 // CHECK-LIBSTDCXX:  "-internal-isystem" "{{.*}}/usr/include/c++" 
"-internal-isystem" "{{.*}}/usr/include/c++/armv7--windows-itanium" 
"-internal-isystem" "{{.*}}/usr/include/c++/backwards"
 
+// RUN: %clang -### -target armv7-windows-itanium --sysroot 
%S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin 
-fuse-ld=lld-link2 -shared -o shared.dll -x c++ %s 2>&1 \
+// RUN:| FileCheck %s --check-prefix CHECK-FUSE-LD
+// CHECK-FUSE-LD: "{{.*}}lld-link2"
+


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


[PATCH] Bug 15109: Implement -Wdouble-promotion for clang

2015-10-27 Thread Carl Norum via cfe-commits
Hi folks,

I had need of this warning, so I cobbled something together. Can someone please 
check it out and let me know if it's reasonable? I'm certainly no expert at 
this stuff. Patch attached for review, thanks!

-- Carl



double-promotion.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] D12793: Three new overflow builtins with generic argument types

2015-10-27 Thread David Grayson via cfe-commits
DavidEGrayson added a comment.

Ping.


http://reviews.llvm.org/D12793



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


Re: [PATCH] D13874: Atomics: support __c11_* calls on _Atomic struct types

2015-10-27 Thread Saleem Abdulrasool via cfe-commits
compnerd added a subscriber: compnerd.
compnerd accepted this revision.
compnerd added a reviewer: compnerd.
This revision is now accepted and ready to land.


Comment at: lib/CodeGen/CGAtomic.cpp:782
@@ +781,3 @@
+  LValue AtomicVal = MakeAddrLValue(Ptr, AtomicTy);
+  AtomicInfo Atomics(*this, AtomicVal);
+

s/Atomics/AI/?  Or perhaps Atomic?


Comment at: lib/CodeGen/CGAtomic.cpp:1021
@@ -1010,1 +1020,3 @@
+  ResVal,
+  Builder.CreateBitCast(Dest, ResVal->getType()->getPointerTo()));
 }

It feels like it might be nice to hoist the `CreateBitCast`.


Repository:
  rL LLVM

http://reviews.llvm.org/D13874



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


r251477 - Add a test case for r251476.

2015-10-27 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Tue Oct 27 21:32:19 2015
New Revision: 251477

URL: http://llvm.org/viewvc/llvm-project?rev=251477&view=rev
Log:
Add a test case for r251476.

Added:
cfe/trunk/test/OpenMP/function-attr.cpp

Added: cfe/trunk/test/OpenMP/function-attr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/function-attr.cpp?rev=251477&view=auto
==
--- cfe/trunk/test/OpenMP/function-attr.cpp (added)
+++ cfe/trunk/test/OpenMP/function-attr.cpp Tue Oct 27 21:32:19 2015
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10  
-stack-protector 2 -emit-llvm -o - %s | FileCheck %s
+
+// Check that function attributes are added to the OpenMP runtime functions.
+
+template 
+struct S {
+  T f;
+  S(T a) : f(a) {}
+  S() : f() {}
+  operator T() { return T(); }
+  ~S() {}
+};
+
+// CHECK: define internal void @.omp.copyprivate.copy_func(i8*, i8*) 
[[ATTR0:#[0-9]+]] {
+
+void foo0();
+
+int foo1() {
+  char a;
+
+#pragma omp parallel
+  a = 2;
+#pragma omp single copyprivate(a)
+  foo0();
+
+  return 0;
+}
+
+// CHECK: define internal void @.omp_task_privates_map.({{.*}}) 
[[ATTR3:#[0-9]+]] {
+// CHECK: define internal i32 @.omp_task_entry.({{.*}}) [[ATTR0]] {
+// CHECK: define internal i32 @.omp_task_destructor.({{.*}}) [[ATTR0]] {
+
+int foo2() {
+  S s_arr[] = {1, 2};
+  S var(3);
+#pragma omp task private(s_arr, var)
+  s_arr[0] = var;
+  return 0;
+}
+
+// CHECK: define internal void @.omp.reduction.reduction_func(i8*, i8*) 
[[ATTR0]] {
+
+float foo3(int n, float *a, float *b) {
+  int i;
+  float result;
+
+#pragma omp parallel for private(i) reduction(+:result)
+  for (i=0; i < n; i++)
+result = result + (a[i] * b[i]);
+  return result;
+}
+
+// CHECK: attributes [[ATTR0]] = {{{.*}} sspstrong {{.*}}}
+// CHECK: attributes [[ATTR3]] = {{{.*}} sspstrong {{.*}}}


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


Re: [PATCH] D13928: [CodeGen] Attach function attributes to Objective-c and OpenMP functions.

2015-10-27 Thread Akira Hatanaka via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL251476: [CodeGen] Attach function attributes to Objective-C 
and OpenMP (authored by ahatanak).

Changed prior to commit:
  http://reviews.llvm.org/D13928?vs=37967&id=38619#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13928

Files:
  cfe/trunk/lib/CodeGen/CGObjC.cpp
  cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
  cfe/trunk/test/CodeGenObjCXX/property-object-reference-2.mm

Index: cfe/trunk/test/CodeGenObjCXX/property-object-reference-2.mm
===
--- cfe/trunk/test/CodeGenObjCXX/property-object-reference-2.mm
+++ cfe/trunk/test/CodeGenObjCXX/property-object-reference-2.mm
@@ -29,7 +29,7 @@
   @synthesize MyProperty1 = _cppObject1;
 @end
 
-// CHECK-LABEL: define internal void @__copy_helper_atomic_property_(
+// CHECK-LABEL: define internal void 
@__copy_helper_atomic_property_(%struct.TCPPObject*, %struct.TCPPObject*) #
 // CHECK: [[TWO:%.*]] = load %struct.TCPPObject*, %struct.TCPPObject** 
[[ADDR:%.*]], align 8
 // CHECK: [[THREE:%.*]] = load %struct.TCPPObject*, %struct.TCPPObject** 
[[ADDR1:%.*]], align 8
 // CHECK: [[CALL:%.*]] = call i32 @_Z7DEFAULTv()
@@ -43,7 +43,7 @@
 // CHECK: call void @objc_copyCppObjectAtomic(i8* [[THREE]], i8* [[TWO]], i8* 
bitcast (void (%struct.TCPPObject*, %struct.TCPPObject*)* 
@__copy_helper_atomic_property_ to i8*))
 // CHECK: ret void
 
-// CHECK-LABEL: define internal void @__assign_helper_atomic_property_(
+// CHECK-LABEL: define internal void 
@__assign_helper_atomic_property_(%struct.TCPPObject*, %struct.TCPPObject*) #
 // CHECK: [[TWO:%.*]] = load %struct.TCPPObject*, %struct.TCPPObject** 
[[ADDR:%.*]], align 8
 // CHECK: [[THREE:%.*]] = load %struct.TCPPObject*, %struct.TCPPObject** 
[[ADDR1:%.*]], align 8
 // CHECK: [[CALL:%.*]] = call dereferenceable({{[0-9]+}}) %struct.TCPPObject* 
@_ZN10TCPPObjectaSERKS_(%struct.TCPPObject* [[TWO]], %struct.TCPPObject* 
dereferenceable({{[0-9]+}}) [[THREE]])
Index: cfe/trunk/lib/CodeGen/CGObjC.cpp
===
--- cfe/trunk/lib/CodeGen/CGObjC.cpp
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp
@@ -2944,7 +2944,9 @@
 llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage,
"__assign_helper_atomic_property_",
&CGM.getModule());
-  
+
+  CGM.SetInternalFunctionAttributes(nullptr, Fn, FI);
+
   StartFunction(FD, C.VoidTy, Fn, FI, args);
   
   DeclRefExpr DstExpr(&dstDecl, false, DestTy,
@@ -3023,6 +3025,8 @@
   llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage,
  "__copy_helper_atomic_property_", &CGM.getModule());
   
+  CGM.SetInternalFunctionAttributes(nullptr, Fn, FI);
+
   StartFunction(FD, C.VoidTy, Fn, FI, args);
   
   DeclRefExpr SrcExpr(&srcDecl, false, SrcTy,
Index: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1490,7 +1490,7 @@
   auto *Fn = llvm::Function::Create(
   CGM.getTypes().GetFunctionType(CGFI), llvm::GlobalValue::InternalLinkage,
   ".omp.copyprivate.copy_func", &CGM.getModule());
-  CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, CGFI, Fn);
+  CGM.SetInternalFunctionAttributes(/*D=*/nullptr, Fn, CGFI);
   CodeGenFunction CGF(CGM);
   CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args);
   // Dest = (void*[n])(LHSArg);
@@ -2048,7 +2048,7 @@
   auto *TaskEntry =
   llvm::Function::Create(TaskEntryTy, llvm::GlobalValue::InternalLinkage,
  ".omp_task_entry.", &CGM.getModule());
-  CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, TaskEntryFnInfo, TaskEntry);
+  CGM.SetInternalFunctionAttributes(/*D=*/nullptr, TaskEntry, TaskEntryFnInfo);
   CodeGenFunction CGF(CGM);
   CGF.disableDebugInfo();
   CGF.StartFunction(GlobalDecl(), KmpInt32Ty, TaskEntry, TaskEntryFnInfo, 
Args);
@@ -2115,7 +2115,8 @@
   auto *DestructorFn =
   llvm::Function::Create(DestructorFnTy, 
llvm::GlobalValue::InternalLinkage,
  ".omp_task_destructor.", &CGM.getModule());
-  CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, DestructorFnInfo, DestructorFn);
+  CGM.SetInternalFunctionAttributes(/*D=*/nullptr, DestructorFn,
+DestructorFnInfo);
   CodeGenFunction CGF(CGM);
   CGF.disableDebugInfo();
   CGF.StartFunction(GlobalDecl(), KmpInt32Ty, DestructorFn, DestructorFnInfo,
@@ -2191,8 +2192,8 @@
   auto *TaskPrivatesMap = llvm::Function::Create(
   TaskPrivatesMapTy, llvm::GlobalValue::InternalLinkage,
   ".omp_task_privates_map.", &CGM.getModule());
-  CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, TaskPrivatesMapFnInfo,
-TaskPrivatesMap);
+  CGM.SetInternalFunctionAttributes(/*D=*/nullptr, TaskPrivatesMap,
+

r251476 - [CodeGen] Attach function attributes to Objective-C and OpenMP

2015-10-27 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Tue Oct 27 21:30:47 2015
New Revision: 251476

URL: http://llvm.org/viewvc/llvm-project?rev=251476&view=rev
Log:
[CodeGen] Attach function attributes to Objective-C and OpenMP
functions.

This commit fixes a bug in CGOpenMPRuntime.cpp and CGObjC.cpp where
some of the function attributes are not attached to newly created
functions.

rdar://problem/20828324

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

Modified:
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/test/CodeGenObjCXX/property-object-reference-2.mm

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=251476&r1=251475&r2=251476&view=diff
==
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Tue Oct 27 21:30:47 2015
@@ -2944,7 +2944,9 @@ CodeGenFunction::GenerateObjCAtomicSette
 llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage,
"__assign_helper_atomic_property_",
&CGM.getModule());
-  
+
+  CGM.SetInternalFunctionAttributes(nullptr, Fn, FI);
+
   StartFunction(FD, C.VoidTy, Fn, FI, args);
   
   DeclRefExpr DstExpr(&dstDecl, false, DestTy,
@@ -3023,6 +3025,8 @@ CodeGenFunction::GenerateObjCAtomicGette
   llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage,
  "__copy_helper_atomic_property_", &CGM.getModule());
   
+  CGM.SetInternalFunctionAttributes(nullptr, Fn, FI);
+
   StartFunction(FD, C.VoidTy, Fn, FI, args);
   
   DeclRefExpr SrcExpr(&srcDecl, false, SrcTy,

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=251476&r1=251475&r2=251476&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Tue Oct 27 21:30:47 2015
@@ -1490,7 +1490,7 @@ static llvm::Value *emitCopyprivateCopyF
   auto *Fn = llvm::Function::Create(
   CGM.getTypes().GetFunctionType(CGFI), llvm::GlobalValue::InternalLinkage,
   ".omp.copyprivate.copy_func", &CGM.getModule());
-  CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, CGFI, Fn);
+  CGM.SetInternalFunctionAttributes(/*D=*/nullptr, Fn, CGFI);
   CodeGenFunction CGF(CGM);
   CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args);
   // Dest = (void*[n])(LHSArg);
@@ -2048,7 +2048,7 @@ emitProxyTaskFunction(CodeGenModule &CGM
   auto *TaskEntry =
   llvm::Function::Create(TaskEntryTy, llvm::GlobalValue::InternalLinkage,
  ".omp_task_entry.", &CGM.getModule());
-  CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, TaskEntryFnInfo, TaskEntry);
+  CGM.SetInternalFunctionAttributes(/*D=*/nullptr, TaskEntry, TaskEntryFnInfo);
   CodeGenFunction CGF(CGM);
   CGF.disableDebugInfo();
   CGF.StartFunction(GlobalDecl(), KmpInt32Ty, TaskEntry, TaskEntryFnInfo, 
Args);
@@ -2115,7 +2115,8 @@ static llvm::Value *emitDestructorsFunct
   auto *DestructorFn =
   llvm::Function::Create(DestructorFnTy, 
llvm::GlobalValue::InternalLinkage,
  ".omp_task_destructor.", &CGM.getModule());
-  CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, DestructorFnInfo, DestructorFn);
+  CGM.SetInternalFunctionAttributes(/*D=*/nullptr, DestructorFn,
+DestructorFnInfo);
   CodeGenFunction CGF(CGM);
   CGF.disableDebugInfo();
   CGF.StartFunction(GlobalDecl(), KmpInt32Ty, DestructorFn, DestructorFnInfo,
@@ -2191,8 +2192,8 @@ emitTaskPrivateMappingFunction(CodeGenMo
   auto *TaskPrivatesMap = llvm::Function::Create(
   TaskPrivatesMapTy, llvm::GlobalValue::InternalLinkage,
   ".omp_task_privates_map.", &CGM.getModule());
-  CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, TaskPrivatesMapFnInfo,
-TaskPrivatesMap);
+  CGM.SetInternalFunctionAttributes(/*D=*/nullptr, TaskPrivatesMap,
+TaskPrivatesMapFnInfo);
   TaskPrivatesMap->addFnAttr(llvm::Attribute::AlwaysInline);
   CodeGenFunction CGF(CGM);
   CGF.disableDebugInfo();
@@ -2693,7 +2694,7 @@ static llvm::Value *emitReductionFunctio
   auto *Fn = llvm::Function::Create(
   CGM.getTypes().GetFunctionType(CGFI), llvm::GlobalValue::InternalLinkage,
   ".omp.reduction.reduction_func", &CGM.getModule());
-  CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, CGFI, Fn);
+  CGM.SetInternalFunctionAttributes(/*D=*/nullptr, Fn, CGFI);
   CodeGenFunction CGF(CGM);
   CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args);
 

Modified: cfe/trunk/test/CodeGenObjCXX/property-object-reference-2.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/property-object-reference-2.mm?rev=251476&r1=251475&r2=251476&view=diff

Re: [PATCH] D13928: [CodeGen] Attach function attributes to Objective-c and OpenMP functions.

2015-10-27 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

I'm taking incremental steps here, but I agree that we should refactor this in 
a better way later.


http://reviews.llvm.org/D13928



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


Re: [PATCH] D7639: Add readability-redundant-void-arg check to clang-tidy

2015-10-27 Thread Alexander Kornienko via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL251475: Add modernize-redundant-void-arg check to clang-tidy 
(authored by alexfh).

Changed prior to commit:
  http://reviews.llvm.org/D7639?vs=37717&id=38617#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D7639

Files:
  clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt
  clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp
  clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.h
  clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.c
  clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.cpp

Index: clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.h
===
--- clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.h
+++ clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.h
@@ -0,0 +1,76 @@
+//===--- RedundantVoidArgCheck.h - clang-tidy *- C++-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_REDUNDANT_VOID_ARG_CHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_REDUNDANT_VOID_ARG_CHECK_H
+
+#include "../ClangTidy.h"
+#include "clang/Lex/Token.h"
+
+#include 
+
+namespace clang {
+namespace tidy {
+namespace modernize {
+
+/// \brief Find and remove redundant void argument lists.
+///
+/// Examples:
+///   `int f(void);`becomes `int f();`
+///   `int (*f(void))(void);`   becomes `int (*f())();`
+///   `typedef int (*f_t(void))(void);` becomes `typedef int (*f_t())();`
+///   `void (C::*p)(void);` becomes `void (C::*p)();`
+///   `C::C(void) {}`   becomes `C::C() {}`
+///   `C::~C(void) {}`  becomes `C::~C() {}`
+///
+class RedundantVoidArgCheck : public ClangTidyCheck {
+public:
+  RedundantVoidArgCheck(StringRef Name, ClangTidyContext *Context)
+  : ClangTidyCheck(Name, Context) {}
+
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+
+  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+
+private:
+  void processFunctionDecl(const ast_matchers::MatchFinder::MatchResult &Result,
+   const FunctionDecl *Function);
+
+  void processTypedefDecl(const ast_matchers::MatchFinder::MatchResult &Result,
+  const TypedefDecl *Typedef);
+
+  void processFieldDecl(const ast_matchers::MatchFinder::MatchResult &Result,
+const FieldDecl *Member);
+
+  void processVarDecl(const ast_matchers::MatchFinder::MatchResult &Result,
+  const VarDecl *Var);
+
+  void
+  processNamedCastExpr(const ast_matchers::MatchFinder::MatchResult &Result,
+   const CXXNamedCastExpr *NamedCast);
+
+  void
+  processExplicitCastExpr(const ast_matchers::MatchFinder::MatchResult &Result,
+  const ExplicitCastExpr *ExplicitCast);
+
+  void processLambdaExpr(const ast_matchers::MatchFinder::MatchResult &Result,
+ const LambdaExpr *Lambda);
+
+  void
+  removeVoidArgumentTokens(const ast_matchers::MatchFinder::MatchResult &Result,
+   SourceRange Range, StringRef GrammarLocation);
+
+  void removeVoidToken(Token VoidToken, StringRef Diagnostic);
+};
+
+} // namespace modernize
+} // namespace tidy
+} // namespace clang
+
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_REDUNDANT_VOID_ARG_CHECK_H
Index: clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp
@@ -0,0 +1,254 @@
+//===- RedundantVoidArgCheck.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 "RedundantVoidArgCheck.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Lex/Lexer.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+
+namespace {
+
+// Determine if the given QualType is a nullary function or pointer to same.
+bool protoTypeHasNoParms(QualType QT) {
+  if (auto PT = QT->getAs()) {
+QT = PT->getPointeeType();
+  }
+  if (auto *MPT = QT->getAs()) {
+QT = MPT->getPointeeType();
+  }
+  if 

[clang-tools-extra] r251475 - Add modernize-redundant-void-arg check to clang-tidy

2015-10-27 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Oct 27 20:36:20 2015
New Revision: 251475

URL: http://llvm.org/viewvc/llvm-project?rev=251475&view=rev
Log:
Add modernize-redundant-void-arg check to clang-tidy

This check for clang-tidy looks for function with zero arguments declared as 
(void) and removes the unnecessary void token.

  int foo(void);

becomes

  int foo();

The check performs no formatting of the surrounding context but uses the lexer 
to look for the token sequence "(", "void", ")" in the prototype text. If this 
sequence of tokens is found, a removal is issued for the void token only.


Patch by Richard Thomson!

(+fixed tests, moved the check to the modernize module)

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

Added:
clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.h
clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.c
clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.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=251475&r1=251474&r2=251475&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt Tue Oct 27 
20:36:20 2015
@@ -6,6 +6,7 @@ add_clang_library(clangTidyModernizeModu
   MakeUniqueCheck.cpp
   ModernizeTidyModule.cpp
   PassByValueCheck.cpp
+  RedundantVoidArgCheck.cpp
   ReplaceAutoPtrCheck.cpp
   ShrinkToFitCheck.cpp
   UseAutoCheck.cpp

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=251475&r1=251474&r2=251475&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp Tue 
Oct 27 20:36:20 2015
@@ -13,6 +13,7 @@
 #include "LoopConvertCheck.h"
 #include "MakeUniqueCheck.h"
 #include "PassByValueCheck.h"
+#include "RedundantVoidArgCheck.h"
 #include "ReplaceAutoPtrCheck.h"
 #include "ShrinkToFitCheck.h"
 #include "UseAutoCheck.h"
@@ -32,6 +33,8 @@ public:
 CheckFactories.registerCheck("modernize-loop-convert");
 CheckFactories.registerCheck("modernize-make-unique");
 CheckFactories.registerCheck("modernize-pass-by-value");
+CheckFactories.registerCheck(
+"modernize-redundant-void-arg");
 CheckFactories.registerCheck(
 "modernize-replace-auto-ptr");
 CheckFactories.registerCheck("modernize-shrink-to-fit");

Added: clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp?rev=251475&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp 
(added)
+++ clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp Tue 
Oct 27 20:36:20 2015
@@ -0,0 +1,254 @@
+//===- RedundantVoidArgCheck.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 "RedundantVoidArgCheck.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Lex/Lexer.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+
+namespace {
+
+// Determine if the given QualType is a nullary function or pointer to same.
+bool protoTypeHasNoParms(QualType QT) {
+  if (auto PT = QT->getAs()) {
+QT = PT->getPointeeType();
+  }
+  if (auto *MPT = QT->getAs()) {
+QT = MPT->getPointeeType();
+  }
+  if (auto FP = QT->getAs()) {
+return FP->getNumParams() == 0;
+  }
+  return false;
+}
+
+const char FunctionId[] = "function";
+const char TypedefId[] = "typedef";
+const char FieldId[] = "field";
+const char VarId[] = "var";
+const char NamedCastId[] = "named-cast";
+const char CStyleCastId[] = "c-style-cast";
+const char ExplicitCastId[] = "explicit-cast";
+const char LambdaId[] = "lambda";
+
+} // namespace
+
+namespace tidy {
+namespace modernize {
+
+void RedundantVoidArgCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(functionDecl(isExpansionInMainFile(), parameterCountIs(0),
+  unless(isImplicit()),

Re: [PATCH] D7639: Add readability-redundant-void-arg check to clang-tidy

2015-10-27 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

FYI, I had to update tests' RUN lines for some recent changes. I'm also going 
to move the check to the modernize module, where it belongs.


http://reviews.llvm.org/D7639



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


Re: [PATCH] D14105: clang-format: When a line is formatted, also format subsequence lines if their indent is off.

2015-10-27 Thread Daniel Jasper via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL251474: clang-format: When a line is formatted, also format 
subsequence lines if… (authored by djasper).

Changed prior to commit:
  http://reviews.llvm.org/D14105?vs=38497&id=38616#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14105

Files:
  cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
  cfe/trunk/test/Format/adjust-indent.cpp
  cfe/trunk/test/Format/line-ranges.cpp
  cfe/trunk/test/Format/ranges.cpp
  cfe/trunk/unittests/Format/FormatTestSelective.cpp

Index: cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
===
--- cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
+++ cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
@@ -812,13 +812,14 @@
AdditionalIndent);
   const AnnotatedLine *PreviousLine = nullptr;
   const AnnotatedLine *NextLine = nullptr;
+  bool PreviousLineFormatted = false;
   for (const AnnotatedLine *Line =
Joiner.getNextMergedLine(DryRun, IndentTracker);
Line; Line = NextLine) {
 const AnnotatedLine &TheLine = *Line;
 unsigned Indent = IndentTracker.getIndent();
-bool FixIndentation =
-FixBadIndentation && (Indent != TheLine.First->OriginalColumn);
+bool FixIndentation = (FixBadIndentation || PreviousLineFormatted) &&
+  Indent != TheLine.First->OriginalColumn;
 bool ShouldFormat = TheLine.Affected || FixIndentation;
 // We cannot format this line; if the reason is that the line had a
 // parsing error, remember that.
@@ -845,6 +846,7 @@
   else
 Penalty += OptimizingLineFormatter(Indenter, Whitespaces, Style, this)
.formatLine(TheLine, Indent, DryRun);
+  PreviousLineFormatted = true;
 } else {
   // If no token in the current line is affected, we still need to format
   // affected children.
@@ -875,6 +877,7 @@
   Whitespaces->addUntouchableToken(*Tok, TheLine.InPPDirective);
   }
   NextLine = Joiner.getNextMergedLine(DryRun, IndentTracker);
+  PreviousLineFormatted = false;
 }
 if (!DryRun)
   markFinalized(TheLine.First);
Index: cfe/trunk/unittests/Format/FormatTestSelective.cpp
===
--- cfe/trunk/unittests/Format/FormatTestSelective.cpp
+++ cfe/trunk/unittests/Format/FormatTestSelective.cpp
@@ -45,8 +45,14 @@
 }
 
 TEST_F(FormatTestSelective, FormatsCorrectRegionForLeadingWhitespace) {
-  EXPECT_EQ("int b;\nint a;", format("int b;\n   int a;", 7, 0));
-  EXPECT_EQ("int b;\n   int a;", format("int b;\n   int a;", 6, 0));
+  EXPECT_EQ("{int b;\n"
+"  int a;\n"
+"}",
+format("{int b;\n  int  a;}", 8, 0));
+  EXPECT_EQ("{\n"
+"  int b;\n"
+"  int  a;}",
+format("{int b;\n  int  a;}", 7, 0));
 
   Style.ColumnLimit = 12;
   EXPECT_EQ("#define A  \\\n"
@@ -84,11 +90,11 @@
   "template  T *getFETokenInfo() const {\n"
   "  return static_cast(FETokenInfo);\n"
   "}\n"
-  "  int a; // <- Should not be formatted",
+  "int  a; // <- Should not be formatted",
   format(
   "template\n"
   "T *getFETokenInfo() const { return static_cast(FETokenInfo); }\n"
-  "  int a; // <- Should not be formatted",
+  "int  a; // <- Should not be formatted",
   9, 5));
 }
 
@@ -142,12 +148,12 @@
 "   // is\n"
 "   // a\n"
 "\n"
-"  // This is unrelated",
+"//This is unrelated",
 format("int a; // This\n"
" // is\n"
" // a\n"
"\n"
-   "  // This is unrelated",
+   "//This is unrelated",
0, 0));
   EXPECT_EQ("int a;\n"
 "// This is\n"
@@ -310,13 +316,17 @@
   EXPECT_EQ("{\n"
 "{\n"
 "  a;\n"
-"b;\n"
+"  b;\n"
+"  c;\n"
+" d;\n"
 "}\n"
 "}",
 format("{\n"
"{\n"
" a;\n"
-   "b;\n"
+   "   b;\n"
+   "  c;\n"
+   " d;\n"
"}\n"
"}",
9, 2));
Index: cfe/trunk/test/Format/adjust-indent.cpp
===
--- cfe/trunk/test/Format/adjust-indent.cpp
+++ cfe/trunk/test/Format/adjust-indent.cpp
@@ -0,0 +1,10 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s | clang-format -lines=2:2 \
+// RUN:   | FileCheck -strict-whitespace %s
+
+void  f() {
+// CHECK: void f() {
+int i;
+// CHECK: {{^  int\ i;}}
+ int j;
+// CHECK: {{^  int\ j;}}
+}
Index: cfe/trunk/test/Format/line-ranges.cpp
===
--- cfe

r251474 - clang-format: When a line is formatted, also format subsequence lines if their indent is off.

2015-10-27 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Tue Oct 27 20:08:22 2015
New Revision: 251474

URL: http://llvm.org/viewvc/llvm-project?rev=251474&view=rev
Log:
clang-format: When a line is formatted, also format subsequence lines if their 
indent is off.

Summary: This is especially important so that if a change is solely inserting a 
block around a few statements, clang-format-diff.py will still clean up and add 
indentation to the inner parts.

Reviewers: klimek

Subscribers: cfe-commits, klimek

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

Added:
cfe/trunk/test/Format/adjust-indent.cpp
Modified:
cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
cfe/trunk/test/Format/line-ranges.cpp
cfe/trunk/test/Format/ranges.cpp
cfe/trunk/unittests/Format/FormatTestSelective.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp?rev=251474&r1=251473&r2=251474&view=diff
==
--- cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp Tue Oct 27 20:08:22 2015
@@ -812,13 +812,14 @@ UnwrappedLineFormatter::format(const Sma
AdditionalIndent);
   const AnnotatedLine *PreviousLine = nullptr;
   const AnnotatedLine *NextLine = nullptr;
+  bool PreviousLineFormatted = false;
   for (const AnnotatedLine *Line =
Joiner.getNextMergedLine(DryRun, IndentTracker);
Line; Line = NextLine) {
 const AnnotatedLine &TheLine = *Line;
 unsigned Indent = IndentTracker.getIndent();
-bool FixIndentation =
-FixBadIndentation && (Indent != TheLine.First->OriginalColumn);
+bool FixIndentation = (FixBadIndentation || PreviousLineFormatted) &&
+  Indent != TheLine.First->OriginalColumn;
 bool ShouldFormat = TheLine.Affected || FixIndentation;
 // We cannot format this line; if the reason is that the line had a
 // parsing error, remember that.
@@ -845,6 +846,7 @@ UnwrappedLineFormatter::format(const Sma
   else
 Penalty += OptimizingLineFormatter(Indenter, Whitespaces, Style, this)
.formatLine(TheLine, Indent, DryRun);
+  PreviousLineFormatted = true;
 } else {
   // If no token in the current line is affected, we still need to format
   // affected children.
@@ -875,6 +877,7 @@ UnwrappedLineFormatter::format(const Sma
   Whitespaces->addUntouchableToken(*Tok, TheLine.InPPDirective);
   }
   NextLine = Joiner.getNextMergedLine(DryRun, IndentTracker);
+  PreviousLineFormatted = false;
 }
 if (!DryRun)
   markFinalized(TheLine.First);

Added: cfe/trunk/test/Format/adjust-indent.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/adjust-indent.cpp?rev=251474&view=auto
==
--- cfe/trunk/test/Format/adjust-indent.cpp (added)
+++ cfe/trunk/test/Format/adjust-indent.cpp Tue Oct 27 20:08:22 2015
@@ -0,0 +1,10 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s | clang-format -lines=2:2 \
+// RUN:   | FileCheck -strict-whitespace %s
+
+void  f() {
+// CHECK: void f() {
+int i;
+// CHECK: {{^  int\ i;}}
+ int j;
+// CHECK: {{^  int\ j;}}
+}

Modified: cfe/trunk/test/Format/line-ranges.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/line-ranges.cpp?rev=251474&r1=251473&r2=251474&view=diff
==
--- cfe/trunk/test/Format/line-ranges.cpp (original)
+++ cfe/trunk/test/Format/line-ranges.cpp Tue Oct 27 20:08:22 2015
@@ -4,8 +4,8 @@
 // CHECK: {{^int\ \*i;$}}
   int*i;
 
-// CHECK: {{^\ \ int\ \ \*\ \ i;$}}
-  int  *  i; 
+// CHECK: {{^int\ \ \*\ \ i;$}}
+int  *  i; 
 
-// CHECK: {{^\ \ int\ \*i;$}}
-  int   *   i;
+// CHECK: {{^int\ \*i;$}}
+int   *   i;

Modified: cfe/trunk/test/Format/ranges.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/ranges.cpp?rev=251474&r1=251473&r2=251474&view=diff
==
--- cfe/trunk/test/Format/ranges.cpp (original)
+++ cfe/trunk/test/Format/ranges.cpp Tue Oct 27 20:08:22 2015
@@ -2,10 +2,10 @@
 // RUN:   | clang-format -style=LLVM -offset=2 -length=0 -offset=28 -length=0 \
 // RUN:   | FileCheck -strict-whitespace %s
 // CHECK: {{^int\ \*i;$}}
-  int*i;
+int*i;
 
-// CHECK: {{^\ \ int\ \ \*\ \ i;$}}
-  int  *  i; 
+// CHECK: {{^int\ \ \*\ \ i;$}}
+int  *  i; 
 
-// CHECK: {{^\ \ int\ \*i;$}}
-  int   *   i;
+// CHECK: {{^int\ \*i;$}}
+int   *   i;

Modified: cfe/trunk/unittests/Format/FormatTestSelective.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestSelective.cpp?rev=251474&r1=251473&r2=251474&view=diff
==
--- cfe/trunk/unittests/Format/Forma

Re: [PATCH] D14105: clang-format: When a line is formatted, also format subsequence lines if their indent is off.

2015-10-27 Thread Manuel Klimek via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

lg


http://reviews.llvm.org/D14105



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


Re: [PATCH] D7639: Add readability-redundant-void-arg check to clang-tidy

2015-10-27 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.

In http://reviews.llvm.org/D7639#276641, @LegalizeAdulthood wrote:

> I mean, look at this review.  I created it on Feb 13th 2015.  It's been 
> getting ground through the review process for 8 months.  Why can't we move 
> forward?


Yes, I know the long reviews may be annoying. And I apologize for missing the 
latest updates on this patch from June. Please feel free to ping the reviews 
when there are no updates on them for a few days.

There are still a few comments on this patch that were not completely 
addressed, but it seems fine to submit the patch at this stage and address the 
concerns after the patch is in.

I'll commit the patch for you.



Comment at: clang-tidy/readability/RedundantVoidArgCheck.cpp:51
@@ +50,3 @@
+  unless(isImplicit()),
+  unless(isExternC())).bind(FunctionId),
+ this);

I'm pretty sure the lexer is able to work on header files, if used correctly. 
If you need help figuring out what's wrong, please provide more information: 
which assert fails, call stack, and a reduced test case where the assert fails.


http://reviews.llvm.org/D7639



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


r251469 - Add the ability to define "fake" arguments on attributes.

2015-10-27 Thread John McCall via cfe-commits
Author: rjmccall
Date: Tue Oct 27 19:17:34 2015
New Revision: 251469

URL: http://llvm.org/viewvc/llvm-project?rev=251469&view=rev
Log:
Add the ability to define "fake" arguments on attributes.

Fake arguments are automatically handled for serialization, cloning,
and other representational tasks, but aren't included in pretty-printing
or parsing (should we eventually ever automate that).

This is chiefly useful for attributes that can be written by the
user, but which are also frequently synthesized by the compiler,
and which we'd like to remember details of the synthesis for.
As a simple example, use this to narrow the cases in which we were
generating a specialized note for implicitly unavailable declarations.

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/SemaObjC/arc-system-header.m
cfe/trunk/test/SemaObjCXX/arc-system-header.mm
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=251469&r1=251468&r2=251469&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Oct 27 19:17:34 2015
@@ -129,9 +129,10 @@ def HasFunctionProto : SubsetSubject(S)}]>;
 
 // A single argument to an attribute
-class Argument {
+class Argument {
   string Name = name;
   bit Optional = optional;
+  bit Fake = fake;
 }
 
 class BoolArgument : Argument;
@@ -167,7 +168,8 @@ class DefaultIntArgument values,
-   list enums, bit opt = 0> : Argument {
+   list enums, bit opt = 0, bit fake = 0>
+: Argument {
   string Type = type;
   list Values = values;
   list Enums = enums;
@@ -1350,7 +1352,10 @@ def TransparentUnion : InheritableAttr {
 
 def Unavailable : InheritableAttr {
   let Spellings = [GNU<"unavailable">];
-  let Args = [StringArgument<"Message", 1>];
+  let Args = [StringArgument<"Message", 1>,
+  EnumArgument<"ImplicitSource", "ImplicitSourceKind",
+   ["none", "forbiddenType"],
+   ["ISK_None", "ISK_ForbiddenType"], 1, /*fake*/ 1>];
   let Documentation = [Undocumented];
 }
 

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=251469&r1=251468&r2=251469&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Oct 27 19:17:34 2015
@@ -5378,7 +5378,7 @@ static void handleDelayedForbiddenType(S
   llvm::StringRef explanation;
   if (decl && isForbiddenTypeAllowed(S, decl, diag, explanation)) {
 decl->addAttr(UnavailableAttr::CreateImplicit(S.Context, explanation,
-  diag.Loc));
+UnavailableAttr::ISK_ForbiddenType, diag.Loc));
 return;
   }
   if (S.getLangOpts().ObjCAutoRefCount)
@@ -5464,7 +5464,8 @@ static void DoEmitAvailabilityWarning(Se
 
 if (!Message.empty()) {
   if (auto attr = D->getAttr())
-if (attr->isImplicit())
+if (attr->isImplicit() &&
+attr->getImplicitSource() == UnavailableAttr::ISK_ForbiddenType)
   diag_available_here = diag::note_unavailability_inferred_here;
 }
 

Modified: cfe/trunk/test/SemaObjC/arc-system-header.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-system-header.m?rev=251469&r1=251468&r2=251469&view=diff
==
--- cfe/trunk/test/SemaObjC/arc-system-header.m (original)
+++ cfe/trunk/test/SemaObjC/arc-system-header.m Tue Oct 27 19:17:34 2015
@@ -7,8 +7,8 @@
 void test(id op, void *cp) {
   cp = test0(op); // expected-error {{'test0' is unavailable: converts between 
Objective-C and C pointers in -fobjc-arc}}
   cp = *test1(&op); // expected-error {{'test1' is unavailable: converts 
between Objective-C and C pointers in -fobjc-arc}}
-// expected-note@arc-system-header.h:1 {{unsupported declaration here}}
-// expected-note@arc-system-header.h:5 {{unsupported declaration here}}
+// expected-note@arc-system-header.h:1 {{'test0' has been explicitly marked 
unavailable here}}
+// expected-note@arc-system-header.h:5 {{'test1' has been explicitly marked 
unavailable here}}
 }
 
 void test3(struct Test3 *p) {
@@ -24,7 +24,7 @@ void test4(Test4 *p) {
 
 void test5(struct Test5 *p) {
   p->field = 0; // expected-error {{'field' is unavailable: this system field 
has retaining ownership}}
-// expected-note@arc-system-header.h:25 {{unsupported 
declaration here}}
+// expected-note@arc-system-header.h:25 {{'field' has been 
explicitly marked unavailable here}}
 }
 
 id test6() {

Modified: cfe/trunk/test/SemaObjCXX/arc-sys

Re: [PATCH] D13351: [Power PC] add soft float support for ppc32

2015-10-27 Thread hfin...@anl.gov via cfe-commits
hfinkel added inline comments.


Comment at: include/clang/Basic/TargetInfo.h:688
@@ -687,1 +687,3 @@
 
+  virtual bool isSoftFloatABI() const {
+return false;

Instead of adding this function, please use the same mechanism as 
X86_32TargetCodeGenInfo and X86_32ABIInfo to feed the soft-float abi 
information through.



Comment at: lib/Basic/Targets.cpp:877
@@ -875,3 +876,3 @@
 
-
+  bool isSoftFloatABI() const override {return IsSoftFloat;}
   StringRef getABI() const override { return ABI; }

Add spaces after { and before }.


Comment at: lib/Basic/Targets.cpp:1072
@@ -1070,1 +1071,3 @@
 
+  auto Feature = std::find(Features.begin(), Features.end(), "+soft-float");
+if (Feature != Features.end()) {

This check can be part of the loop above.


Comment at: lib/Driver/Tools.cpp:1372
@@ +1371,3 @@
+  if (FloatABI != "soft" && FloatABI != "hard") {
+FloatABI = "hard";
+  }

Unless there is a good reason to consider all unknown strings equivalent to 
"hard", please produce an error (and an associated test case).



Comment at: test/Driver/ppc-features.cpp:18
@@ -15,1 +17,3 @@
+// CHECK-SOFTFLOAT: "-target-feature" "+soft-float"
+
 // CHECK: invalid argument '-faltivec' only allowed with 'ppc/ppc64/ppc64le'

Also add a test case with -mhard-float, and both -msoft-float and -mhard-float 
in different orders.
Also add test cases with -mfloat-abi=X


http://reviews.llvm.org/D13351



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


Re: [PATCH] D13304: Avoid inlining in throw statement

2015-10-27 Thread Jun Bum Lim via cfe-commits
junbuml added a comment.

I see what you mean. Now, I doubt if 
BranchProbabilityInfo::calcColdCallHeuristics() set  the Cold  before inliner. 
As far as I check, BranchProbabilityInfo is executed after inliner.

Another issue is that even if we can add the Cold in callsites in exception 
handling regions before inliner, the default ColdThreshold (225) in the inliner 
is still not tuned (r200898), so I cannot see the expected performance 
improvement only with the Cold.

If we don't have any plan to tune the ColdThreshold in near future, we may need 
to use other ways to conservatively inline in exception handling regions. So, 
for example, in this patch I simply added both Cold and NoInline.


http://reviews.llvm.org/D13304



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


r251463 - clang-format: Increase cut-off limit for number of analyzed states.

2015-10-27 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Tue Oct 27 17:55:55 2015
New Revision: 251463

URL: http://llvm.org/viewvc/llvm-project?rev=251463&view=rev
Log:
clang-format: Increase cut-off limit for number of analyzed states.

With more complex structures in C++ Lambdas and JavaScript function
literals, the old value was simply to small. However, this is a
temporary solution, I need to look at this more closely a) to find a
fundamentally better approach and b) to look at whether the more recent
usage of NoLineBreak makes us visit stuff in an unfortunate order
where clang-format waste many states in dead ends.

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

Modified: cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp?rev=251463&r1=251462&r2=251463&view=diff
==
--- cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp Tue Oct 27 17:55:55 2015
@@ -709,7 +709,7 @@ private:
 
   // Cut off the analysis of certain solutions if the analysis gets too
   // complex. See description of IgnoreStackForComparison.
-  if (Count > 1)
+  if (Count > 5)
 Node->State.IgnoreStackForComparison = true;
 
   if (!Seen.insert(&Node->State).second)


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


Re: [PATCH] D13802: [OPENMP] Make -fopenmp to turn on OpenMP support by default.

2015-10-27 Thread hfin...@anl.gov via cfe-commits
hfinkel added a comment.

In http://reviews.llvm.org/D13802#275471, @chandlerc wrote:

> In http://reviews.llvm.org/D13802#274847, @ABataev wrote:
>
> > Hi Chandler, thanks for the review.
> >
> > In http://reviews.llvm.org/D13802#272053, @chandlerc wrote:
> >
> > > I've also had one test fail, and then start passing for me on Linux 
> > > (after fixing the above). I haven't had it fail again, but I don't have a 
> > > good way of running tests repeatedly (see below, llvm-lit doesn't yet 
> > > work). It might be good to give the test suite a good 10 or 50 runs and 
> > > see if anything starts failing. I'll do that overnight and report back if 
> > > so.
> >
> >
> > Actually, these tests are written so, that they repeats about 1000 times to 
> > be sure that they are correct. But some of them might be sensible to system 
> > load.
>
>
> Hmm, so I think we need to find some way to make some of these tests more 
> reliable.
>
> With the fix from http://reviews.llvm.org/D14055 patched in (minus the flag 
> change in it) I am seeing tests fail pretty regularly:
>
>   libomp :: worksharing/for/omp_for_schedule_auto.c


Credit goes to a colleague of mine, Ray Loy, for spotting this. This test has a 
race condition. The updates to the global sum1 are not protected by any kind of 
synchronization.

  sum1 = sum0;

the for pragma is missing a private(sum1) clause?

> This test seems to fail pretty frequently for me. Maybe as much as half the 
> time.

> 

>   libomp :: worksharing/sections/omp_sections_nowait.c


In omp_testsuite.h, we have this:

  /* following times are in seconds */
  #define SLEEPTIME 0.1

and this test, and also omp_flush.c, are sensitive to this. If the machine is 
heavily loaded, or otherwise configured, so the threads involved don't all get 
scheduled within 0.1 seconds, this will certainly fail.

Also, does this test have a race condition? Specifically, should there be a

  #pragma omp flush(count)

before

  if (count == 0)

I think there should be.

> This test fails less frequently, but still have seen it a few times.

> 

>   libomp :: flush/omp_flush.c

>

> 

> I've seen this test fail just once...


This is trying to test the memory flush pragma by having one thread write and 
flush, and a second thread wait for a fixed time, flush and read. As mentioned 
above, this is sensitive to SLEEPTIME.


http://reviews.llvm.org/D13802



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


Re: [PATCH] D13920: Minor fix in ToolChainTest.cpp to allow user defined GCC toolchain.

2015-10-27 Thread Samuel Antao via cfe-commits
sfantao closed this revision.
sfantao added a comment.

Committed in r251459.

Thanks!
Samuel


http://reviews.llvm.org/D13920



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


r251459 - Minor fix in ToolChainTest.cpp to allow user defined GCC toolchain.

2015-10-27 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Tue Oct 27 17:20:26 2015
New Revision: 251459

URL: http://llvm.org/viewvc/llvm-project?rev=251459&view=rev
Log:
Minor fix in ToolChainTest.cpp to allow user defined GCC toolchain.

If the user configured clang with a custom GCC toolchain that will take 
precedence on what the ToolChainTest.cpp expects to evaluate. 
This is fixed here by passing --gcc-toolchain= to the driver, in order to 
override any user defined GCC toolchain.


Modified:
cfe/trunk/unittests/Driver/ToolChainTest.cpp

Modified: cfe/trunk/unittests/Driver/ToolChainTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Driver/ToolChainTest.cpp?rev=251459&r1=251458&r2=251459&view=diff
==
--- cfe/trunk/unittests/Driver/ToolChainTest.cpp (original)
+++ cfe/trunk/unittests/Driver/ToolChainTest.cpp Tue Oct 27 17:20:26 2015
@@ -58,8 +58,8 @@ TEST(ToolChainTest, VFSGCCInstallation)
 InMemoryFileSystem->addFile(Path, 0,
 llvm::MemoryBuffer::getMemBuffer("\n"));
 
-  std::unique_ptr C(
-  TheDriver.BuildCompilation({"-fsyntax-only", "foo.cpp"}));
+  std::unique_ptr C(TheDriver.BuildCompilation(
+  {"-fsyntax-only", "--gcc-toolchain=", "foo.cpp"}));
 
   std::string S;
   {
@@ -97,8 +97,8 @@ TEST(ToolChainTest, VFSGCCInstallationRe
 InMemoryFileSystem->addFile(Path, 0,
 llvm::MemoryBuffer::getMemBuffer("\n"));
 
-  std::unique_ptr C(
-  TheDriver.BuildCompilation({"-fsyntax-only", "foo.cpp"}));
+  std::unique_ptr C(TheDriver.BuildCompilation(
+  {"-fsyntax-only", "--gcc-toolchain=", "foo.cpp"}));
 
   std::string S;
   {


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


[PATCH] D14134: [OpenMP] Parsing and sema support for map clause

2015-10-27 Thread Kelvin Li via cfe-commits
kkwli0 created this revision.
kkwli0 added reviewers: ABataev, rsmith, hfinkel, sfantao, fraggamuffin.
kkwli0 added a subscriber: cfe-commits.

This patch is to add parsing and sema support for map clause.  This includes 
the new map types and the map type modifier added in OpenMP 4.5.


http://reviews.llvm.org/D14134

Files:
  include/clang/AST/DataRecursiveASTVisitor.h
  include/clang/AST/OpenMPClause.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/OpenMPKinds.def
  include/clang/Basic/OpenMPKinds.h
  include/clang/Sema/Sema.h
  lib/AST/OpenMPClause.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Basic/OpenMPKinds.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/OpenMP/target_map_messages.cpp
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -2171,6 +2171,9 @@
 void OMPClauseEnqueue::VisitOMPDependClause(const OMPDependClause *C) {
   VisitOMPClauseList(C);
 }
+void OMPClauseEnqueue::VisitOMPMapClause(const OMPMapClause *C) {
+  VisitOMPClauseList(C);
+}
 }
 
 void EnqueueVisitor::EnqueueChildren(const OMPClause *S) {
Index: test/OpenMP/target_map_messages.cpp
===
--- /dev/null
+++ test/OpenMP/target_map_messages.cpp
@@ -0,0 +1,119 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+
+void foo() {
+}
+
+bool foobool(int argc) {
+  return argc;
+}
+
+struct S1; // expected-note {{declared here}}
+extern S1 a;
+class S2 {
+  mutable int a;
+public:
+  S2():a(0) { }
+  S2(S2 &s2):a(s2.a) { }
+  static float S2s; // expected-note 2 {{mappable type cannot contain static members}}
+  static const float S2sc; // expected-note 2 {{mappable type cannot contain static members}}
+};
+const float S2::S2sc = 0;
+const S2 b;
+const S2 ba[5];
+class S3 {
+  int a;
+public:
+  S3():a(0) { }
+  S3(S3 &s3):a(s3.a) { }
+};
+const S3 c;
+const S3 ca[5];
+extern const int f;
+class S4 {
+  int a;
+  S4();
+  S4(const S4 &s4);
+public:
+  S4(int v):a(v) { }
+};
+class S5 {
+  int a;
+  S5():a(0) {}
+  S5(const S5 &s5):a(s5.a) { }
+public:
+  S5(int v):a(v) { }
+};
+
+S3 h;
+#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
+
+int main(int argc, char **argv) {
+  const int d = 5;
+  const int da[5] = { 0 };
+  S4 e(4);
+  S5 g(5);
+  int i;
+  int &j = i;
+  int *k = &j;
+  int x;
+  int y;
+  int to, tofrom, always;
+  const int (&l)[5] = da;
+  #pragma omp target map // expected-error {{expected '(' after 'map'}}
+  #pragma omp target map ( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
+  #pragma omp target map () // expected-error {{expected expression}}
+  #pragma omp target map (alloc) // expected-error {{use of undeclared identifier 'alloc'}}
+  #pragma omp target map (to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}}
+  #pragma omp target map (to:) // expected-error {{expected expression}}
+  #pragma omp target map (from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  #pragma omp target map (x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
+  #pragma omp target map (x)
+  foo();
+  #pragma omp target map (to: x)
+  foo();
+  #pragma omp target map (to: to)
+  foo();
+  #pragma omp target map (to)
+  foo();
+  #pragma omp target map (to, x)
+  foo();
+  #pragma omp target map (to x) // expected-error {{expected ',' or ')' in 'map' clause}}
+  #pragma omp target map (tofrom: argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}}
+  #pragma omp target map (argc)
+  #pragma omp target map (S1) // expected-error {{'S1' does not refer to a value}}
+  #pragma omp target map (a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
+  #pragma omp target map (argv[1])
+  #pragma omp target map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
+  #pragma omp target map(ca)
+  #pragma omp target map(da)
+  #pragma omp target map(S2::S2s)
+  #pragma omp target map(S2::S2sc)
+  #pragma omp target map(e, g)
+  #pragma omp target map(h) // expected-error {{threadprivate variables are not allowed in map clause}}
+  #pragma omp target map(k), map(k) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
+  #pragma omp target m

LLVM buildmaster will be restarted tonight

2015-10-27 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be restarted after 7 PM Pacific time today.

Thanks

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


Re: [PATCH] D13304: Avoid inlining in throw statement

2015-10-27 Thread hfin...@anl.gov via cfe-commits
hfinkel added a comment.

In http://reviews.llvm.org/D13304#276660, @junbuml wrote:

> Did you mean to add the Cold in the exception handling region itself instead 
> of callsite in throw statements ?


We already have BranchProbabilityInfo::calcColdCallHeuristics, and so adding it 
to the callsite should be sufficient. Existing infrastructure should take care 
of the rest.


http://reviews.llvm.org/D13304



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


Re: [PATCH] D7639: Add readability-redundant-void-arg check to clang-tidy

2015-10-27 Thread Samuel Benzaquen via cfe-commits
sbenza accepted this revision.
sbenza added a comment.
This revision is now accepted and ready to land.

Just wanted to know it was considered, and it was.
It looks good to me then.


http://reviews.llvm.org/D7639



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


Re: [PATCH] D13304: Avoid inlining in throw statement

2015-10-27 Thread Jun Bum Lim via cfe-commits
junbuml added a comment.

Did you mean to add the Cold in the exception handling region itself instead of 
callsite in throw statements ?


http://reviews.llvm.org/D13304



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


Re: [PATCH] D13304: Avoid inlining in throw statement

2015-10-27 Thread hfin...@anl.gov via cfe-commits
hfinkel added a comment.

In http://reviews.llvm.org/D13304#269049, @junbuml wrote:

> I just want to ping one more time to see if there is any objection about the 
> basic idea of this change. If the basic idea itself is acceptable, then I 
> want to find the best way to get idea in.
>
> Please let me know any new suggestion or any opinion about moving this 
> implementation back to backend (maybe in PrunceEH.cpp) with the minimum 
> callee size check to avoid blindly marking noinlines on all callsites. I will 
> be happy to hear any opinion.


It seems like we want two things here:

1. Mark the exception-handling intrinsics as cold
2. Have the inliner not inline things in cold regions

What is preventing us from doing this now?


http://reviews.llvm.org/D13304



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


Re: [PATCH] D7639: Add readability-redundant-void-arg check to clang-tidy

2015-10-27 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

I mean, look at this review.  I created it on Feb 13th 2015.  It's been getting 
ground through the review process for 8 months.  Why can't we move forward?


http://reviews.llvm.org/D7639



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


Re: [PATCH] D7639: Add readability-redundant-void-arg check to clang-tidy

2015-10-27 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

In http://reviews.llvm.org/D7639#275504, @sbenza wrote:

> Just fyi, I am looking at this diff. It is very large with a lot of rounds of 
> comments and I didn't have the context.
>  I don't know if I should giving comments at this point of the change, but 
> here it is.
>  Have you considered matching on typeLoc() instead of having a large list of 
> different cases?
>  For example, if you match `typeLoc(loc(functionType()))` it will match all 
> the places where a function type is mentioned, including things like 
> `static_cast`, variable declarations, lambda return type declarations, 
> etc. Might help remove redundancy in the check.


That occurred to me and I did an experiment and it didn't work out.  I forget 
the exact details now as it was months ago and this review has been sitting 
here languishing with a correct implementation as-is.  I really just want to 
get this committed and make incremental improvement, instead of re-evaluating 
the entire thing from scratch at this time.


http://reviews.llvm.org/D7639



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


Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-10-27 Thread David Majnemer via cfe-commits
majnemer added a comment.

No diagnostic is issued for the following C test case:

  int x __attribute__((internal_linkage));
  int x __attribute__((common));
  int *f() { return &x; }



Comment at: include/clang/Basic/Attr.td:2112
@@ +2111,3 @@
+
+def InternalLinkage : InheritableAttr {
+  let Spellings = [GCC<"internal_linkage">];

Why doesn't this use `Subjects` ?


Repository:
  rL LLVM

http://reviews.llvm.org/D13925



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


r251448 - [analyzer] Enhance FAQ with instructions on handing unused variables.

2015-10-27 Thread Anna Zaks via cfe-commits
Author: zaks
Date: Tue Oct 27 15:19:38 2015
New Revision: 251448

URL: http://llvm.org/viewvc/llvm-project?rev=251448&view=rev
Log:
[analyzer] Enhance FAQ with instructions on handing unused variables.

Modified:
cfe/trunk/www/analyzer/faq.html

Modified: cfe/trunk/www/analyzer/faq.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/faq.html?rev=251448&r1=251447&r2=251448&view=diff
==
--- cfe/trunk/www/analyzer/faq.html (original)
+++ cfe/trunk/www/analyzer/faq.html Tue Oct 27 15:19:38 2015
@@ -26,6 +26,8 @@ the bug is reached?
   The analyzer reports a null dereference, but I 
know that the
 pointer is never null. How can I tell the analyzer that a pointer can never be
 null?
+  How do I tell the static analyzer that I don't 
care about a specific dead store?
+  How do I tell the static analyzer that I don't 
care about a specific unused instance variable in Objective C?
   The analyzer assumes that a loop body is never 
entered.  How can I tell it that the loop body will be entered at least 
once?
   How can I suppress a specific analyzer 
warning?
   How can I selectively exclude code the analyzer 
examines?
@@ -64,6 +66,18 @@ int foo(int *b) {
   return *b;
 }
 
+Q: How do I tell the static analyzer that I 
don't care about a specific dead store?
+
+When the analyzer sees that a value stored into a variable is never used, 
it's going to produce a message similar to this one:
+Value stored to 'x' is never read
+You can use the (void)x; idiom to acknowledge that there is a dead 
store in your code but you do not want it to be reported in the future.
+
+Q: How do I tell the static analyzer that I 
don't care about a specific unused instance variable in Objective C?
+
+When the analyzer sees that a value stored into a variable is never used, 
it is going to produce a message similar to this one:
+Instance variable 'commonName' in class 'HappyBird' 
is never used by the methods in its @implementation
+You can add __attribute__((unused)) to the instance variable 
declaration to suppress the warning.
+
 Q: The analyzer assumes that a loop body is 
never entered.  How can I tell it that the loop body will be entered at least 
once?
 
 


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


r251449 - [analyzer] Assume escape is possible through system functions taking void*

2015-10-27 Thread Anna Zaks via cfe-commits
Author: zaks
Date: Tue Oct 27 15:19:45 2015
New Revision: 251449

URL: http://llvm.org/viewvc/llvm-project?rev=251449&view=rev
Log:
[analyzer] Assume escape is possible through system functions taking void*
The analyzer assumes that system functions will not free memory or modify the
arguments in other ways, so we assume that arguments do not escape when
those are called. However, this may lead to false positive leak errors. For
example, in code like this where the pointers added to the rb_tree are freed
later on:

struct alarm_event *e = calloc(1, sizeof(*e));


rb_tree_insert_node(&alarm_tree, e);

Add a heuristic to assume that calls to system functions taking void*
arguments allow for pointer escape.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
cfe/trunk/test/Analysis/Inputs/system-header-simulator.h
cfe/trunk/test/Analysis/malloc.c

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h?rev=251449&r1=251448&r2=251449&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h Tue 
Oct 27 15:19:45 2015
@@ -254,9 +254,16 @@ public:
   /// which the return value has already been bound to the origin expression.
   SVal getReturnValue() const;
 
+  /// \brief Returns true if the type of any of the non-null arguments 
satisfies
+  /// the condition.
+  bool hasNonNullArgumentsWithType(bool (*Condition)(QualType)) const;
+
   /// \brief Returns true if any of the arguments appear to represent 
callbacks.
   bool hasNonZeroCallbackArg() const;
 
+  /// \brief Returns true if any of the arguments is void*.
+  bool hasVoidPointerToNonConstArg() const;
+
   /// \brief Returns true if any of the arguments are known to escape to long-
   /// term storage, even if this method will not modify them.
   // NOTE: The exact semantics of this are still being defined!

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=251449&r1=251448&r2=251449&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Tue Oct 27 15:19:45 
2015
@@ -2390,7 +2390,7 @@ bool MallocChecker::mayFreeAnyEscapedMem
   if (const ObjCMethodCall *Msg = dyn_cast(Call)) {
 // If it's not a framework call, or if it takes a callback, assume it
 // can free memory.
-if (!Call->isInSystemHeader() || Call->hasNonZeroCallbackArg())
+if (!Call->isInSystemHeader() || Call->argumentsMayEscape())
   return true;
 
 // If it's a method we know about, handle it explicitly post-call.

Modified: cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp?rev=251449&r1=251448&r2=251449&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp Tue Oct 27 15:19:45 2015
@@ -50,11 +50,7 @@ QualType CallEvent::getResultType() cons
   return ResultTy;
 }
 
-static bool isCallbackArg(SVal V, QualType T) {
-  // If the parameter is 0, it's harmless.
-  if (V.isZeroConstant())
-return false;
-
+static bool isCallback(QualType T) {
   // If a parameter is a block or a callback, assume it can modify pointer.
   if (T->isBlockPointerType() ||
   T->isFunctionPointerType() ||
@@ -75,32 +71,53 @@ static bool isCallbackArg(SVal V, QualTy
 return true;
 }
   }
-
   return false;
 }
 
-bool CallEvent::hasNonZeroCallbackArg() const {
+static bool isVoidPointerToNonConst(QualType T) {
+  if (const PointerType *PT = T->getAs()) {
+QualType PointeeTy = PT->getPointeeType();
+if (PointeeTy.isConstQualified())
+  return false;
+return PointeeTy->isVoidType();
+  } else
+return false;
+}
+
+bool CallEvent::hasNonNullArgumentsWithType(bool (*Condition)(QualType)) const 
{
   unsigned NumOfArgs = getNumArgs();
 
   // If calling using a function pointer, assume the function does not
-  // have a callback. TODO: We could check the types of the arguments here.
+  // satisfy the callback.
+  // TODO: We could check the types of the arguments here.
   if (!getDecl())
 return false;
 
   unsigned Idx = 0;
   for (CallEvent::param_type_iterator I = param_type_begin(),
-   E = param_type_end();
+

[PATCH] D14130: Delete dead code in the LibcxxAndAbiBuilder

2015-10-27 Thread Jonathan Roelofs via cfe-commits
jroelofs created this revision.
jroelofs added a reviewer: EricWF.
jroelofs added a subscriber: cfe-commits.

Now that we store this information in the __config file, these aren't needed.

http://reviews.llvm.org/D14130

Files:
  zorg/buildbot/builders/LibcxxAndAbiBuilder.py

Index: zorg/buildbot/builders/LibcxxAndAbiBuilder.py
===
--- zorg/buildbot/builders/LibcxxAndAbiBuilder.py
+++ zorg/buildbot/builders/LibcxxAndAbiBuilder.py
@@ -70,18 +70,6 @@
 
 f = getLibcxxWholeTree(f, src_root)
 
-if 'libcxxabi-has-no-threads' in additional_features:
-env['CXXFLAGS'] = (env.get('CXXFLAGS', '') +
-   ' -DLIBCXXABI_HAS_NO_THREADS=1')
-
-if 'libcpp-has-no-threads' in additional_features:
-env['CXXFLAGS'] = (env.get('CXXFLAGS', '') +
-   ' -D_LIBCPP_HAS_NO_THREADS')
-
-if 'libcpp-has-no-monotonic-clock' in additional_features:
-env['CXXFLAGS'] = (env.get('CXXFLAGS', '') +
-   ' -D_LIBCPP_HAS_NO_MONOTONIC_CLOCK')
-
 # Specify the max number of threads using properties so LIT doesn't use
 # all the threads on the system.
 litTestArgs = '-sv --show-unsupported --show-xfail --threads=%(jobs)s'


Index: zorg/buildbot/builders/LibcxxAndAbiBuilder.py
===
--- zorg/buildbot/builders/LibcxxAndAbiBuilder.py
+++ zorg/buildbot/builders/LibcxxAndAbiBuilder.py
@@ -70,18 +70,6 @@
 
 f = getLibcxxWholeTree(f, src_root)
 
-if 'libcxxabi-has-no-threads' in additional_features:
-env['CXXFLAGS'] = (env.get('CXXFLAGS', '') +
-   ' -DLIBCXXABI_HAS_NO_THREADS=1')
-
-if 'libcpp-has-no-threads' in additional_features:
-env['CXXFLAGS'] = (env.get('CXXFLAGS', '') +
-   ' -D_LIBCPP_HAS_NO_THREADS')
-
-if 'libcpp-has-no-monotonic-clock' in additional_features:
-env['CXXFLAGS'] = (env.get('CXXFLAGS', '') +
-   ' -D_LIBCPP_HAS_NO_MONOTONIC_CLOCK')
-
 # Specify the max number of threads using properties so LIT doesn't use
 # all the threads on the system.
 litTestArgs = '-sv --show-unsupported --show-xfail --threads=%(jobs)s'
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13969: Tweak how -Wunused-value interacts with macros

2015-10-27 Thread Nico Weber via cfe-commits
thakis closed this revision.
thakis marked an inline comment as done.
thakis added a comment.

Done and landed in r251441, thanks!


http://reviews.llvm.org/D13969



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


r251441 - Tweak how -Wunused-value interacts with macros

2015-10-27 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Oct 27 14:47:40 2015
New Revision: 251441

URL: http://llvm.org/viewvc/llvm-project?rev=251441&view=rev
Log:
Tweak how -Wunused-value interacts with macros

1. Make the warning more strict in C mode. r172696 added code to suppress
   warnings from macro expansions in system headers, which checks
   `SourceMgr.isMacroBodyExpansion(E->IgnoreParens()->getExprLoc())`. Consider
   this snippet:

   #define FOO(x) (x)
   void f(int a) {
 FOO(a);
   }

   In C, the line `FOO(a)` is an `ImplicitCastExpr(ParenExpr(DeclRefExpr))`,
   while it's just a `ParenExpr(DeclRefExpr)` in C++. So in C++,
   `E->IgnoreParens()` returns the `DeclRefExpr` and the check tests the
   SourceLoc of `a`. In C, the `ImplicitCastExpr` has the effect of checking the
   SourceLoc of `FOO`, which is a macro body expansion, which causes the
   diagnostic to be skipped. It looks unintentional that clang does different
   things for C and C++ here, so use `IgnoreParenImpCasts` instead of
   `IgnoreParens` here. This has the effect of the warning firing more often
   than previously in C code – it now fires as often as it fires in C++ code.

2. Suppress the warning if it would warn on `UNREFERENCED_PARAMETER`.
   `UNREFERENCED_PARAMETER` is a commonly used macro on Windows and it happens
   to uselessly trigger -Wunused-value. As discussed in the thread
   "rfc: winnt.h's UNREFERENCED_PARAMETER() vs clang's -Wunused-value" on
   cfe-dev, fix this by special-casing this specific macro. (This costs a string
   comparison and some fast-path lexing per warning, but the warning is emitted
   rarely. It fires once in Windows.h itself, so this code runs at least once
   per TU including Windows.h, but it doesn't run hundreds of times.)

http://reviews.llvm.org/D13969

Modified:
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/test/Sema/unused-expr.c

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=251441&r1=251440&r2=251441&view=diff
==
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Tue Oct 27 14:47:40 2015
@@ -195,7 +195,7 @@ void Sema::DiagnoseUnusedExprResult(cons
   if (isUnevaluatedContext())
 return;
 
-  SourceLocation ExprLoc = E->IgnoreParens()->getExprLoc();
+  SourceLocation ExprLoc = E->IgnoreParenImpCasts()->getExprLoc();
   // In most cases, we don't want to warn if the expression is written in a
   // macro body, or if the macro comes from a system header. If the offending
   // expression is a call to a function with the warn_unused_result attribute,
@@ -218,6 +218,15 @@ void Sema::DiagnoseUnusedExprResult(cons
   if (isa(E) && Loc.isMacroID())
 return;
 
+  // Check if this is the UNREFERENCED_PARAMETER from the Microsoft headers.
+  // That macro is frequently used to suppress "unused parameter" warnings,
+  // but its implementation makes clang's -Wunused-value fire.  Prevent this.
+  if (isa(E->IgnoreImpCasts()) && Loc.isMacroID()) {
+SourceLocation SpellLoc = Loc;
+if (findMacroSpelling(SpellLoc, "UNREFERENCED_PARAMETER"))
+  return;
+  }
+
   // Okay, we have an unused result.  Depending on what the base expression is,
   // we might want to make a more specific diagnostic.  Check for one of these
   // cases now.

Modified: cfe/trunk/test/Sema/unused-expr.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/unused-expr.c?rev=251441&r1=251440&r2=251441&view=diff
==
--- cfe/trunk/test/Sema/unused-expr.c (original)
+++ cfe/trunk/test/Sema/unused-expr.c Tue Oct 27 14:47:40 2015
@@ -156,3 +156,11 @@ void t11(int i, int j) {
 #undef M5
 #undef M6
 #undef M7
+
+#define UNREFERENCED_PARAMETER(x) (x)
+
+void unused_parm(int a) {
+  // Don't warn if the warning is introduced by a macro that's spelled
+  // UNREFERENCED_PARAMETER, as that's a commonly used macro in Windows 
headers.
+  UNREFERENCED_PARAMETER(a);
+}


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


Re: [PATCH] D13969: Tweak how -Wunused-value interacts with macros

2015-10-27 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm, I don't feel strongly about whether -fms-compatibility matters, but I'd 
prefer that it didn't.



Comment at: lib/Sema/SemaStmt.cpp:224
@@ +223,3 @@
+  // but its implementation makes clang's -Wunused-value fire.  Prevent this.
+  if (getLangOpts().MSVCCompat && isa(E->IgnoreImpCasts()) &&
+  Loc.isMacroID()) {

I'd rather not make this conditional on -fms-compatibility. I can easily 
imagine a situation where someone has cargo-culted this pattern from windows.h 
while porting to other platforms, and silencing the unused value warning in 
that situation seems like goodness. I guess the only concern is lexer 
performance, but I think it'll be fine.


http://reviews.llvm.org/D13969



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


Re: r250470 - Fix the subtarget features required by some x86 builtins.

2015-10-27 Thread Eric Christopher via cfe-commits
OK, so I fixed this last night in r251388. I decided to go with "," means
"and" and "|" means "or" and go from there. If we need a more complicated
syntax we'll go back to the drawing board :)

-eric

On Sun, Oct 18, 2015 at 9:57 AM Craig Topper  wrote:

> Interestingly, gcc doesn't get this right either
>
> *test.cpp:7:64:* *error: *‘*__builtin_ia32_xorpd256_mask*’ needs isa
> option -m32 -mavx512dq -mavx512vl
>
>
> I'm not even sure why it bothered to list -m32.
>
> If you then give it -mavx512dq without -mavx512vl it proceeds to throw
> internal compiler errors.
>
>
>
> *test.cpp:8:1:* *error: *unrecognizable insn:
>
>  }
>
> * ^*
>
> (insn 15 14 18 2 (set (reg:V4DF 89 [ D.22466 ])
>
> (vec_merge:V4DF (xor:V4DF (reg:V4DF 92)
>
> (mem/c:V4DF (plus:DI (reg/f:DI 82 virtual-stack-vars)
>
> (const_int -96 [0xffa0])) [0 __A+0 S32
> A256]))
>
> (reg:V4DF 93)
>
> (subreg:QI (reg:SI 94) 0))) test.cpp:7 -1
>
>  (nil))
>
> *test.cpp:8:1:* *internal compiler error: *in extract_insn, at
> recog.c:2343
>
>
> *test.cpp:8:1:* *internal compiler error: *Abort trap: 6
>
> *g++:* *internal compiler error: *Abort trap: 6 (program cc1plus)
>
> On Fri, Oct 16, 2015 at 6:50 PM, Eric Christopher 
> wrote:
>
>> Sure, but if someone is planning on doing this for ARM there's some work
>> in the ARM TargetInfo that needs to be done :)
>>
>> -eric
>>
>> On Fri, Oct 16, 2015 at 3:24 PM Justin Bogner 
>> wrote:
>>
>>> Looks like we'll need "and" for ARM's builtins as well - several require
>>> things like neon+fp16 or neon+vfp4.
>>>
>>> Eric Christopher  writes:
>>> > Right. My current direction is going to be:
>>> >
>>> > "foo+bar" we can represent as "and"
>>> > "foo,bar" we'll continue to represent as "or"
>>> >
>>> > this will lead to things like (possibly):
>>> >
>>> > "foo+bar, baz" - "either foo and bar, or baz."
>>> >
>>> > -eric
>>> >
>>> > On Fri, Oct 16, 2015 at 11:41 AM Justin Bogner 
>>> > wrote:
>>> >
>>> >> Hm. Well, supporting both "and" and "or" combinations here sounds like
>>> >> an unpleasant path to go down. I guess the question is, which is
>>> >> weirder?
>>> >>
>>> >> - With fma, we have fma4 which is basically a synonym as far as
>>> >>   intrinsics go - some chips have 3-argument versions and some have 4,
>>> >>   but I don't think any of the intrinsics reflect that.
>>> >>
>>> >> - With avx512, we have combinations of features which introduce new
>>> >>   intrinsics, since the supported elements and supported vector types
>>> >>   are more or less orthogonal.
>>> >>
>>> >> I guess the fma situation is easier to special case if we want to
>>> avoid
>>> >> having to parse expressions here. Ie, we could have some kind of
>>> >> meta-feature that expands to "fma or fma4". Of course, the obvious
>>> name
>>> >> for that is "fma", which means fma3 today...
>>> >>
>>> >> Eric Christopher via cfe-commits  writes:
>>> >> > Lovely. Cc'ing Justin here. We'll need to figure out some change for
>>> >> these
>>> >> > builtins here if we need to have and as well as or.
>>> >> >
>>> >> > (Why on earth are these builtins subject to two separate features?
>>> *sigh*
>>> >> > It's ridiculous.)
>>> >> >
>>> >> > -eric
>>> >> >
>>> >> > On Thu, Oct 15, 2015 at 11:59 PM Craig Topper <
>>> craig.top...@gmail.com>
>>> >> > wrote:
>>> >> >
>>> >> >> Correct you avx512vl means it support 128 and 256-bit vectors.
>>> avx512bw
>>> >> >> means it supports byte and word elements. So you actually need
>>> both.
>>> >> >>
>>> >> >> On Thu, Oct 15, 2015 at 11:57 PM, Eric Christopher <
>>> echri...@gmail.com>
>>> >> >> wrote:
>>> >> >>
>>> >> >>> The comma separated list is currently represented as "one of
>>> these". I
>>> >> >>> couldn't parse your first sentence, for the avx512 ones are you
>>> saying
>>> >> that
>>> >> >>> it requires both and not just one of the options?
>>> >> >>>
>>> >> >>> -eric
>>> >> >>>
>>> >> >>> On Thu, Oct 15, 2015 at 11:55 PM Craig Topper <
>>> craig.top...@gmail.com>
>>> >> >>> wrote:
>>> >> >>>
>>> >>  So for the AVX512 ones that list 2 features those features are
>>> both
>>> >>  required, but for FMA you need either one of the features but not
>>> >> both.
>>> >>  What is the comma separated list currently implemented as?
>>> >> 
>>> >>  On Thu, Oct 15, 2015 at 3:46 PM, Eric Christopher via
>>> cfe-commits <
>>> >>  cfe-commits@lists.llvm.org> wrote:
>>> >> 
>>> >> > Author: echristo
>>> >> > Date: Thu Oct 15 17:46:02 2015
>>> >> > New Revision: 250470
>>> >> >
>>> >> > URL: http://llvm.org/viewvc/llvm-project?rev=250470&view=rev
>>> >> > Log:
>>> >> > Fix the subtarget features required by some x86 builtins.
>>> >> >
>>> >> > Update the fma builtins to be fma/fma4 until some we can find
>>> some
>>> >> > documentation either way.
>>> >> >
>>> >> > Update a couple of the avx intrinsics because they were in the
>>> wrong
>>> >> > category.
>

Re: [PATCH] D13891: Apply modernize-use-default to llvm.

2015-10-27 Thread Benjamin Kramer via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

Two minor comments, otherwise looks good:

1. beware of the GCC 4.7 issues and trivial class initializer issues we hit 
with this kind of changes earlier.
2. I prefer to leave utils/unittest/googletest alone as it's imported from 
google code. Changing it makes merging upstream changes harder.
3. Please leave the comments inside empty constructors or destructors.


http://reviews.llvm.org/D13891



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


Re: [PATCH] D13920: Minor fix in ToolChainTest.cpp to allow user defined GCC toolchain.

2015-10-27 Thread Benjamin Kramer via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

This should be fine. Sorry for the breakage.


http://reviews.llvm.org/D13920



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


Re: [PATCH] D13170: [CUDA] Driver changes to pass flags needed to use detected CUDA installation.

2015-10-27 Thread Artem Belevich via cfe-commits
tra updated this revision to Diff 38576.
tra added a comment.

Updated to reflect latest changes in http://reviews.llvm.org/D13913.


http://reviews.llvm.org/D13170

Files:
  include/clang/Driver/Options.td
  include/clang/Driver/ToolChain.h
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/.keep
  
test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/libdevice.compute_20.10.bc
  
test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/libdevice.compute_35.10.bc
  test/Driver/cuda-detect.cu

Index: test/Driver/cuda-detect.cu
===
--- test/Driver/cuda-detect.cu
+++ test/Driver/cuda-detect.cu
@@ -1,10 +1,54 @@
 // REQUIRES: clang-driver
 // REQUIRES: x86-registered-target
 //
+// # Check that we properly detect CUDA installation.
 // RUN: %clang -v --target=i386-unknown-linux \
 // RUN:   --sysroot=/tmp/no-cuda-there 2>&1 | FileCheck %s -check-prefix NOCUDA
 // RUN: %clang -v --target=i386-unknown-linux \
+// RUN:   --sysroot=%S/Inputs/CUDA 2>&1 | FileCheck %s
+// RUN: %clang -v --target=i386-unknown-linux \
 // RUN:   --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 | FileCheck %s
 
+// Make sure we map libdevice bitcode files to proper GPUs.
+// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_21 \
+// RUN:   --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix LIBDEVICE -check-prefix LIBDEVICE21
+// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \
+// RUN:   --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix LIBDEVICE -check-prefix LIBDEVICE35 \
+// RUN:   -check-prefix CUDAINC
+// Verify that -nocudainc prevents adding include path to CUDA headers.
+// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \
+// RUN:   -nocudainc --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix LIBDEVICE -check-prefix LIBDEVICE35 \
+// RUN:   -check-prefix NOCUDAINC
+
+// Verify that no options related to bitcode linking are passes if
+// there's no bitcode file.
+// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_30 \
+// RUN:   --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix NOLIBDEVICE
+// .. or if we explicitly passed -nocudalib
+// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \
+// RUN:   -nocudalib --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix NOLIBDEVICE
+
 // CHECK: Found CUDA installation: {{.*}}/Inputs/CUDA/usr/local/cuda
 // NOCUDA-NOT: Found CUDA installation:
+
+// LIBDEVICE: "-triple" "nvptx-nvidia-cuda"
+// LIBDEVICE-SAME: "-fcuda-is-device"
+// LIBDEVICE-SAME: "-mlink-cuda-bitcode"
+// LIBDEVICE21-SAME: libdevice.compute_20.10.bc
+// LIBDEVICE35-SAME: libdevice.compute_35.10.bc
+// LIBDEVICE-SAME: "-target-feature" "+ptx42"
+// CUDAINC-SAME: "-internal-isystem" "{{.*}}/Inputs/CUDA/usr/local/cuda/include"
+// NOCUDAINC-NOT: "-internal-isystem" "{{.*}}/Inputs/CUDA/usr/local/cuda/include"
+// LIBDEVICE-SAME: "-x" "cuda"
+
+// NOLIBDEVICE: "-triple" "nvptx-nvidia-cuda"
+// NOLIBDEVICE-SAME: "-fcuda-is-device"
+// NOLIBDEVICE-NOT: "-mlink-cuda-bitcode-file"
+// NOLIBDEVICE-NOT: libdevice.compute_{{.*}}.bc
+// NOLIBDEVICE-NOT: "-target-feature"
+// NOLIBDEVICE-SAME: "-x" "cuda"
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -57,7 +57,8 @@
const Driver &D, const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs,
const InputInfo &Output,
-   const InputInfoList &Inputs) const;
+   const InputInfoList &Inputs,
+   const ToolChain *AuxToolChain) const;
 
   void AddAArch64TargetArgs(const llvm::opt::ArgList &Args,
 llvm::opt::ArgStringList &CmdArgs) const;
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -248,7 +248,8 @@
 const Driver &D, const ArgList &Args,
 ArgStringList &CmdArgs,
 const InputInfo &Output,
-const InputInfoList &Inputs) const {
+const InputInfoList &Inputs,
+const ToolChain *AuxToolChain) const {
   Arg *A;
 
   CheckPreprocessingOptions(D, Args);
@@ -441,11 +442,20 @@
   addDirectoryList(Args, CmdArgs, "-objcxx-isystem", "OBJCPLUS_INCLUDE_PATH");
 
   // Add C++ include arguments, if

r251432 - Remove unused diagnostic. NFC.

2015-10-27 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Tue Oct 27 13:34:47 2015
New Revision: 251432

URL: http://llvm.org/viewvc/llvm-project?rev=251432&view=rev
Log:
Remove unused diagnostic. NFC.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=251432&r1=251431&r2=251432&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Oct 27 13:34:47 
2015
@@ -7858,9 +7858,6 @@ def ext_coroutine_without_co_await_co_yi
   "'co_return' used in a function "
   "that uses neither 'co_await' nor 'co_yield'">,
   InGroup>;
-def err_co_await_no_viable_function : Error<
-  "invalid co_await operand of type %0; "
-  "no viable '%1' function %select{|for awaited type %3 }2available">;
 def err_implied_std_coroutine_traits_not_found : Error<
   "you need to include  before defining a coroutine">;
 def err_malformed_std_coroutine_traits : Error<


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


Re: [PATCH] D13171: [CUDA] Added a wrapper header for inclusion of stock CUDA headers.

2015-10-27 Thread Artem Belevich via cfe-commits
tra updated this revision to Diff 38574.
tra added a comment.

Added test cases for force-including of cuda_runtime.h
Tweaked inclusion of one header due to use of default arguments.


http://reviews.llvm.org/D13171

Files:
  lib/Driver/ToolChains.cpp
  lib/Headers/CMakeLists.txt
  lib/Headers/cuda_runtime.h
  test/Driver/cuda-detect.cu
  unittests/ASTMatchers/ASTMatchersTest.h

Index: unittests/ASTMatchers/ASTMatchersTest.h
===
--- unittests/ASTMatchers/ASTMatchersTest.h
+++ unittests/ASTMatchers/ASTMatchersTest.h
@@ -178,6 +178,7 @@
   Args.push_back("-xcuda");
   Args.push_back("-fno-ms-extensions");
   Args.push_back("--cuda-host-only");
+  Args.push_back("-nocudainc");
   Args.push_back(CompileArg);
   if (!runToolOnCodeWithArgs(Factory->create(),
  CudaHeader + Code, Args)) {
Index: test/Driver/cuda-detect.cu
===
--- test/Driver/cuda-detect.cu
+++ test/Driver/cuda-detect.cu
@@ -3,7 +3,7 @@
 //
 // # Check that we properly detect CUDA installation.
 // RUN: %clang -v --target=i386-unknown-linux \
-// RUN:   --sysroot=/tmp/no-cuda-there 2>&1 | FileCheck %s -check-prefix NOCUDA
+// RUN:   --sysroot=%S/no-cuda-there 2>&1 | FileCheck %s -check-prefix NOCUDA
 // RUN: %clang -v --target=i386-unknown-linux \
 // RUN:   --sysroot=%S/Inputs/CUDA 2>&1 | FileCheck %s
 // RUN: %clang -v --target=i386-unknown-linux \
@@ -32,6 +32,11 @@
 // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \
 // RUN:   -nocudalib --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \
 // RUN:   | FileCheck %s -check-prefix NOLIBDEVICE
+// Verify that we don't add include paths, link with libdevice or
+// -include cuda_runtime without valid CUDA installation.
+// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \
+// RUN:   --cuda-path=%S/no-cuda-there %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix NOCUDAINC -check-prefix NOLIBDEVICE
 
 // CHECK: Found CUDA installation: {{.*}}/Inputs/CUDA/usr/local/cuda
 // NOCUDA-NOT: Found CUDA installation:
@@ -43,7 +48,9 @@
 // LIBDEVICE35-SAME: libdevice.compute_35.10.bc
 // LIBDEVICE-SAME: "-target-feature" "+ptx42"
 // CUDAINC-SAME: "-internal-isystem" "{{.*}}/Inputs/CUDA/usr/local/cuda/include"
+// CUDAINC-SAME: "-include" "cuda_runtime.h"
 // NOCUDAINC-NOT: "-internal-isystem" "{{.*}}/Inputs/CUDA/usr/local/cuda/include"
+// NOCUDAINC-NOT: "-include" "cuda_runtime.h"
 // LIBDEVICE-SAME: "-x" "cuda"
 
 // NOLIBDEVICE: "-triple" "nvptx-nvidia-cuda"
Index: lib/Headers/cuda_runtime.h
===
--- /dev/null
+++ lib/Headers/cuda_runtime.h
@@ -0,0 +1,155 @@
+/*=== cuda_runtime.h - CUDA runtime support ===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+
+#ifndef __CLANG_CUDA_RUNTIME_H__
+#define __CLANG_CUDA_RUNTIME_H__
+
+#if defined(__PTX__)
+
+// Include some standard headers to avoid CUDA headers including them
+// while some required macros (like __THROW) are in a weird state.
+#include 
+
+// Preserve common macros that will be changed below by us or by CUDA
+// headers.
+#pragma push_macro("__THROW")
+#pragma push_macro("__CUDA_ARCH__")
+
+// WARNING: Preprocessor hacks below are based on specific of
+// implementation of CUDA-7.x headers and are expected to break with
+// any other version of CUDA headers.
+#include "cuda.h"
+#if !defined(CUDA_VERSION)
+#error "cuda.h did not define CUDA_VERSION"
+#elif CUDA_VERSION < 7000 || CUDA_VERSION > 7050
+#error "Unsupported CUDA version!"
+#endif
+
+// Make largest subset of device functions available during host
+// compilation -- SM_35 for the time being.
+#ifndef __CUDA_ARCH__
+#define __CUDA_ARCH__ 350
+#endif
+
+#include "cuda_builtin_vars.h"
+
+

Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Renato Golin via cfe-commits
On 27 October 2015 at 18:15, Tim Northover via cfe-commits
 wrote:
> It sets the underlying platform to a Darwin one so that -arch armv7 flag
> works as expected.

Still looks weird. I don't think this should work at all, as in, the
driver should emit an error like "no such arch". But that's not
relevant here. :)


> Either way, I think the patch as it is now is fine, but we'd need to be
> careful if we wanted to remove the TY_PP_Asm check.

I think Alexandros got that one right already in his new revision, but
we need to make sure he actually did.

That's why I mentioned to duplicate the tests for EABI and Darwin
(possibly Linux, too?). But would be good if you could double check
the odd examples, too, so that he can add to the tests.

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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Tim Northover via cfe-commits
On Oct 27, 2015 11:06, "Renato Golin"  wrote:
>
> rengolin added a comment.
>
> In http://reviews.llvm.org/D14121#276389, @t.p.northover wrote:
>
> > If you're on Linux or something you need "clang -target
x86_64-apple-darwin -arch armv7 -c tmp.s".
>
>
> x86_64 + ARMv7? This doesn't make sense... What is this trying to achieve?

It sets the underlying platform to a Darwin one so that -arch armv7 flag
works as expected.

What I keep meaning to fix is that specifying " thumbv7-apple-ios" directly
hits an assertion failure.

Either way, I think the patch as it is now is fine, but we'd need to be
careful if we wanted to remove the TY_PP_Asm check.

Tim.
>
> > I suspect the reason for this hack is that we've already changed the
triple to "thumbv7-apple-iosN" by this point (because -arch armv7 compiles
to Thumb), so it needs undoing for .s files. It might be reasonably easy to
push the TY_PP_Asm check back into the Darwin codepath, or it might be
horrible. So much has changed since 2011.
>
>
> I think so. If Darwin is special, in which it treats "armv7" as Thumb,
then it needs special treatment, not the other way around.
>
> Also, Alexandros, it would be good to add the same set of tests for
Darwin, to make sure we're not messing up their side.
>
> cheers,
> --renato
>
>
> 
> Comment at: lib/Driver/ToolChain.cpp:472
> @@ -471,2 +471,3 @@
> +bool ThumbDefault = (ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
>(Suffix.startswith("v7") && getTriple().isOSBinFormatMachO());
>  // FIXME: this is invalid for WindowsCE
> 
> labrinea wrote:
> > rengolin wrote:
> > > You could cache the profile and use it here, too.
> > I don't see any checks based on profile in this line.
> Sorry, not profile, but ARMTargetParser function.
>
> You have just replaced:
> Suffix.startswith("v6m") || Suffix.startswith("v7m") ||
Suffix.startswith("v7em")
> with:
> ARM::parseArchProfile(Suffix) == ARM::PK_M
>
> You should also replace:
> Suffix.startswith("v7")
> with:
> ARM::parseArchVersion(Suffix) == 7
>
> 
> Comment at: test/Driver/arm-ias-Wa.s:75
> @@ +74,3 @@
> +
> +// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
> +// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
> 
> labrinea wrote:
> > rengolin wrote:
> > > You should also add "armv7m" and check that it defaults to Thumb, no?
> > It does default to thumb, if we are happy with this check I can add it.
> That will give people looking at your commit in the future the idea of
what you were trying to achieve.
>
>
> http://reviews.llvm.org/D14121
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11182: [OPENMP 4.0] Initial support for 'omp declare reduction' construct.

2015-10-27 Thread hfin...@anl.gov via cfe-commits
hfinkel added inline comments.


Comment at: include/clang/Basic/DiagnosticParseKinds.td:995
@@ -994,1 +994,3 @@
+def err_omp_expected_reduction_identifier : Error<
+  "expected identifier or one of the following operators: '+', '-', '*', '&', 
'|', '^', '&&' and '||'">;
 

We're not incredibly consistent here, but I think this reads better if we say:

  '&&', or '||'

instead of:

  '&&' and '||'

(adding the Oxford comma and 'and' -> 'or').


Comment at: lib/AST/Decl.cpp:1463
@@ -1461,1 +1462,3 @@
 
+  // Declare reduction are always replaceable.
+  if (OMPDeclareReductionDecl::classofKind(NewK))

are -> is


http://reviews.llvm.org/D11182



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


Re: [PATCH] D14096: [clang-tidy] add new check cppcoreguidelines-pro-type-cstyle-cast

2015-10-27 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment.

In http://reviews.llvm.org/D14096#275902, @xazax.hun wrote:

> There is already a similar check in the Google package. What are the 
> differences between those two checks? What is the reason we can not just 
> register that check into the core guidelines module?


That other check discourages c-style cast in favor of C++ style casts, even if 
it is a reinterpret_cast. It simply replaces the cstyle cast with an equivalent 
C++ one. It is basically a stylistic check.

This check will warn unsafe cstyle casts, while allowing safe ones like 
int->uint casts.
This one is a safety related check.


http://reviews.llvm.org/D14096



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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Alexandros Lamprineas via cfe-commits
labrinea added a comment.

In http://reviews.llvm.org/D14121#276389, @t.p.northover wrote:

> If you're on Linux or something you need "clang -target x86_64-apple-darwin 
> -arch armv7 -c tmp.s". Another mess I keep meaning to fix.
>
> I suspect the reason for this hack is that we've already changed the triple 
> to "thumbv7-apple-iosN" by this point (because -arch armv7 compiles to 
> Thumb), so it needs undoing for .s files. It might be reasonably easy to push 
> the TY_PP_Asm check back into the Darwin codepath, or it might be horrible. 
> So much has changed since 2011.


I just tried that and I get :
-cc1 -triple thumbv7-apple-ios5.0.0
-cc1as -triple thumbv7-apple-ios5.0.0
which means you were right.

My previosu revision gives:
-cc1 -triple thumbv7-apple-ios5.0.0
-cc1as -triple armv7-apple-ios5.0.0
so I think it should be ok.


http://reviews.llvm.org/D14121



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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Renato Golin via cfe-commits
rengolin added a comment.

In http://reviews.llvm.org/D14121#276389, @t.p.northover wrote:

> If you're on Linux or something you need "clang -target x86_64-apple-darwin 
> -arch armv7 -c tmp.s".


x86_64 + ARMv7? This doesn't make sense... What is this trying to achieve?

> I suspect the reason for this hack is that we've already changed the triple 
> to "thumbv7-apple-iosN" by this point (because -arch armv7 compiles to 
> Thumb), so it needs undoing for .s files. It might be reasonably easy to push 
> the TY_PP_Asm check back into the Darwin codepath, or it might be horrible. 
> So much has changed since 2011.


I think so. If Darwin is special, in which it treats "armv7" as Thumb, then it 
needs special treatment, not the other way around.

Also, Alexandros, it would be good to add the same set of tests for Darwin, to 
make sure we're not messing up their side.

cheers,
--renato



Comment at: lib/Driver/ToolChain.cpp:472
@@ -471,2 +471,3 @@
+bool ThumbDefault = (ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
   (Suffix.startswith("v7") && getTriple().isOSBinFormatMachO());
 // FIXME: this is invalid for WindowsCE

labrinea wrote:
> rengolin wrote:
> > You could cache the profile and use it here, too.
> I don't see any checks based on profile in this line.
Sorry, not profile, but ARMTargetParser function.

You have just replaced:
Suffix.startswith("v6m") || Suffix.startswith("v7m") || 
Suffix.startswith("v7em")
with:
ARM::parseArchProfile(Suffix) == ARM::PK_M

You should also replace:
Suffix.startswith("v7")
with:
ARM::parseArchVersion(Suffix) == 7


Comment at: test/Driver/arm-ias-Wa.s:75
@@ +74,3 @@
+
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s

labrinea wrote:
> rengolin wrote:
> > You should also add "armv7m" and check that it defaults to Thumb, no?
> It does default to thumb, if we are happy with this check I can add it.
That will give people looking at your commit in the future the idea of what you 
were trying to achieve.


http://reviews.llvm.org/D14121



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


r251430 - [mips] Separated mips specific -Wa options, so that they are not checked on other platforms.

2015-10-27 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Oct 27 13:04:42 2015
New Revision: 251430

URL: http://llvm.org/viewvc/llvm-project?rev=251430&view=rev
Log:
[mips] Separated mips specific -Wa options, so that they are not checked on 
other platforms.

Summary: This is a follow on to post review comments on revision r248276.

Patch by Scott Egerton.

Reviewers: vkalintiris, dsanders

Subscribers: joerg, rengolin, cfe-commits

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

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

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=251430&r1=251429&r2=251430&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Oct 27 13:04:42 2015
@@ -2386,6 +2386,36 @@ static void CollectArgsForIntegratedAsse
 continue;
   }
 
+  switch (C.getDefaultToolChain().getArch()) {
+  default:
+break;
+  case llvm::Triple::mips:
+  case llvm::Triple::mipsel:
+  case llvm::Triple::mips64:
+  case llvm::Triple::mips64el:
+if (Value == "--trap") {
+  CmdArgs.push_back("-target-feature");
+  CmdArgs.push_back("+use-tcc-in-div");
+  continue;
+}
+if (Value == "--break") {
+  CmdArgs.push_back("-target-feature");
+  CmdArgs.push_back("-use-tcc-in-div");
+  continue;
+}
+if (Value.startswith("-msoft-float")) {
+  CmdArgs.push_back("-target-feature");
+  CmdArgs.push_back("+soft-float");
+  continue;
+}
+if (Value.startswith("-mhard-float")) {
+  CmdArgs.push_back("-target-feature");
+  CmdArgs.push_back("-soft-float");
+  continue;
+}
+break;
+  }
+
   if (Value == "-force_cpusubtype_ALL") {
 // Do nothing, this is the default and we don't support anything else.
   } else if (Value == "-L") {
@@ -2418,18 +2448,6 @@ static void CollectArgsForIntegratedAsse
   } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") ||
  Value.startswith("-mhwdiv") || Value.startswith("-march")) {
 // Do nothing, we'll validate it later.
-  } else if (Value == "--trap") {
-CmdArgs.push_back("-target-feature");
-CmdArgs.push_back("+use-tcc-in-div");
-  } else if (Value == "--break") {
-CmdArgs.push_back("-target-feature");
-CmdArgs.push_back("-use-tcc-in-div");
-  } else if (Value.startswith("-msoft-float")) {
-CmdArgs.push_back("-target-feature");
-CmdArgs.push_back("+soft-float");
-  } else if (Value.startswith("-mhard-float")) {
-CmdArgs.push_back("-target-feature");
-CmdArgs.push_back("-soft-float");
   } else {
 D.Diag(diag::err_drv_unsupported_option_argument)
 << A->getOption().getName() << Value;


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


Re: [PATCH] D13913: Allow linking multiple bitcode files.

2015-10-27 Thread Artem Belevich via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL251427: Allow linking multiple bitcode files. (authored by 
tra).

Changed prior to commit:
  http://reviews.llvm.org/D13913?vs=38046&id=38562#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13913

Files:
  cfe/trunk/include/clang/Basic/LangOptions.def
  cfe/trunk/include/clang/CodeGen/CodeGenAction.h
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/include/clang/Frontend/CodeGenOptions.h
  cfe/trunk/lib/CodeGen/CodeGenAction.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGen/link-bitcode-file.c
  cfe/trunk/test/CodeGenCUDA/Inputs/device-code-2.ll
  cfe/trunk/test/CodeGenCUDA/link-device-bitcode.cu

Index: cfe/trunk/include/clang/Driver/CC1Options.td
===
--- cfe/trunk/include/clang/Driver/CC1Options.td
+++ cfe/trunk/include/clang/Driver/CC1Options.td
@@ -240,6 +240,9 @@
   HelpText<"Emit complete constructors and destructors as aliases when possible">;
 def mlink_bitcode_file : Separate<["-"], "mlink-bitcode-file">,
   HelpText<"Link the given bitcode file before performing optimizations.">;
+def mlink_cuda_bitcode : Separate<["-"], "mlink-cuda-bitcode">,
+  HelpText<"Link and internalize needed symbols from the given bitcode file "
+   "before performing optimizations.">;
 def vectorize_loops : Flag<["-"], "vectorize-loops">,
   HelpText<"Run the Loop vectorization passes">;
 def vectorize_slp : Flag<["-"], "vectorize-slp">,
@@ -671,8 +674,6 @@
   HelpText<"Incorporate CUDA device-side binary into host object file.">;
 def fcuda_target_overloads : Flag<["-"], "fcuda-target-overloads">,
   HelpText<"Enable function overloads based on CUDA target attributes.">;
-def fcuda_uses_libdevice : Flag<["-"], "fcuda-uses-libdevice">,
-  HelpText<"Selectively link and internalize bitcode.">;
 
 } // let Flags = [CC1Option]
 
Index: cfe/trunk/include/clang/Basic/LangOptions.def
===
--- cfe/trunk/include/clang/Basic/LangOptions.def
+++ cfe/trunk/include/clang/Basic/LangOptions.def
@@ -170,7 +170,6 @@
 LANGOPT(CUDAAllowHostCallsFromHostDevice, 1, 0, "Allow host device functions to call host functions")
 LANGOPT(CUDADisableTargetCallChecks, 1, 0, "Disable checks for call targets (host, device, etc.)")
 LANGOPT(CUDATargetOverloads, 1, 0, "Enable function overloads based on CUDA target attributes")
-LANGOPT(CUDAUsesLibDevice , 1, 0, "Selectively link and internalize bitcode.")
 
 LANGOPT(AssumeSaneOperatorNew , 1, 1, "implicit __attribute__((malloc)) for C++'s new operators")
 LANGOPT(SizedDeallocation , 1, 0, "enable sized deallocation functions")
Index: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
===
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h
@@ -130,7 +130,7 @@
   std::string LimitFloatPrecision;
 
   /// The name of the bitcode file to link before optzns.
-  std::string LinkBitcodeFile;
+  std::vector> LinkBitcodeFiles;
 
   /// The user provided name for the "main file", if non-empty. This is useful
   /// in situations where the input file name does not match the original input
Index: cfe/trunk/include/clang/CodeGen/CodeGenAction.h
===
--- cfe/trunk/include/clang/CodeGen/CodeGenAction.h
+++ cfe/trunk/include/clang/CodeGen/CodeGenAction.h
@@ -25,7 +25,9 @@
 private:
   unsigned Act;
   std::unique_ptr TheModule;
-  llvm::Module *LinkModule;
+  // Vector of {Linker::Flags, Module*} pairs to specify bitcode
+  // modules to link in using corresponding linker flags.
+  SmallVector, 4> LinkModules;
   llvm::LLVMContext *VMContext;
   bool OwnsVMContext;
 
@@ -50,7 +52,9 @@
   /// setLinkModule - Set the link module to be used by this action.  If a link
   /// module is not provided, and CodeGenOptions::LinkBitcodeFile is non-empty,
   /// the action will load it from the specified file.
-  void setLinkModule(llvm::Module *Mod) { LinkModule = Mod; }
+  void addLinkModule(llvm::Module *Mod, unsigned LinkFlags) {
+LinkModules.push_back(std::make_pair(LinkFlags, Mod));
+  }
 
   /// Take the generated LLVM module, for use after the action has been run.
   /// The result may be null on failure.
Index: cfe/trunk/test/CodeGen/link-bitcode-file.c
===
--- cfe/trunk/test/CodeGen/link-bitcode-file.c
+++ cfe/trunk/test/CodeGen/link-bitcode-file.c
@@ -1,19 +1,29 @@
 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -DBITCODE -emit-llvm-bc -o %t.bc %s
-// RUN: %clang_cc1 -triple i386-pc-linux-gnu -mlink-bitcode-file %t.bc -O3 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-NO-BC %s
-// RUN: not %clang_cc1 -triple i386-pc-linux-gnu -DBITCODE -mlink-bitcode-file %t.bc -O3 -emit-llvm -o - %s 2>&1 | FileCheck -chec

r251427 - Allow linking multiple bitcode files.

2015-10-27 Thread Artem Belevich via cfe-commits
Author: tra
Date: Tue Oct 27 12:56:59 2015
New Revision: 251427

URL: http://llvm.org/viewvc/llvm-project?rev=251427&view=rev
Log:
Allow linking multiple bitcode files.

Linking options for particular file depend on the option that specifies the 
file.
Currently there are two:

* -mlink-bitcode-file links in complete content of the specified file.
* -mlink-cuda-bitcode links in only the symbols needed by current TU.
   Linked symbols are internalized. This bitcode linking mode is used to
   link device-specific bitcode provided by CUDA.

Files are linked in order they are specified on command line.

-mlink-cuda-bitcode replaces -fcuda-uses-libdevice flag.

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

Added:
cfe/trunk/test/CodeGenCUDA/Inputs/device-code-2.ll
Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/CodeGen/CodeGenAction.h
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/link-bitcode-file.c
cfe/trunk/test/CodeGenCUDA/link-device-bitcode.cu

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=251427&r1=251426&r2=251427&view=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Tue Oct 27 12:56:59 2015
@@ -170,7 +170,6 @@ LANGOPT(CUDAIsDevice  , 1, 0, "Compi
 LANGOPT(CUDAAllowHostCallsFromHostDevice, 1, 0, "Allow host device functions 
to call host functions")
 LANGOPT(CUDADisableTargetCallChecks, 1, 0, "Disable checks for call targets 
(host, device, etc.)")
 LANGOPT(CUDATargetOverloads, 1, 0, "Enable function overloads based on CUDA 
target attributes")
-LANGOPT(CUDAUsesLibDevice , 1, 0, "Selectively link and internalize bitcode.")
 
 LANGOPT(AssumeSaneOperatorNew , 1, 1, "implicit __attribute__((malloc)) for 
C++'s new operators")
 LANGOPT(SizedDeallocation , 1, 0, "enable sized deallocation functions")

Modified: cfe/trunk/include/clang/CodeGen/CodeGenAction.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/CodeGenAction.h?rev=251427&r1=251426&r2=251427&view=diff
==
--- cfe/trunk/include/clang/CodeGen/CodeGenAction.h (original)
+++ cfe/trunk/include/clang/CodeGen/CodeGenAction.h Tue Oct 27 12:56:59 2015
@@ -25,7 +25,9 @@ class CodeGenAction : public ASTFrontend
 private:
   unsigned Act;
   std::unique_ptr TheModule;
-  llvm::Module *LinkModule;
+  // Vector of {Linker::Flags, Module*} pairs to specify bitcode
+  // modules to link in using corresponding linker flags.
+  SmallVector, 4> LinkModules;
   llvm::LLVMContext *VMContext;
   bool OwnsVMContext;
 
@@ -50,7 +52,9 @@ public:
   /// setLinkModule - Set the link module to be used by this action.  If a link
   /// module is not provided, and CodeGenOptions::LinkBitcodeFile is non-empty,
   /// the action will load it from the specified file.
-  void setLinkModule(llvm::Module *Mod) { LinkModule = Mod; }
+  void addLinkModule(llvm::Module *Mod, unsigned LinkFlags) {
+LinkModules.push_back(std::make_pair(LinkFlags, Mod));
+  }
 
   /// Take the generated LLVM module, for use after the action has been run.
   /// The result may be null on failure.

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=251427&r1=251426&r2=251427&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Tue Oct 27 12:56:59 2015
@@ -240,6 +240,9 @@ def mconstructor_aliases : Flag<["-"], "
   HelpText<"Emit complete constructors and destructors as aliases when 
possible">;
 def mlink_bitcode_file : Separate<["-"], "mlink-bitcode-file">,
   HelpText<"Link the given bitcode file before performing optimizations.">;
+def mlink_cuda_bitcode : Separate<["-"], "mlink-cuda-bitcode">,
+  HelpText<"Link and internalize needed symbols from the given bitcode file "
+   "before performing optimizations.">;
 def vectorize_loops : Flag<["-"], "vectorize-loops">,
   HelpText<"Run the Loop vectorization passes">;
 def vectorize_slp : Flag<["-"], "vectorize-slp">,
@@ -671,8 +674,6 @@ def fcuda_include_gpubinary : Separate<[
   HelpText<"Incorporate CUDA device-side binary into host object file.">;
 def fcuda_target_overloads : Flag<["-"], "fcuda-target-overloads">,
   HelpText<"Enable function overloads based on CUDA target attributes.">;
-def fcuda_uses_libdevice : Flag<["-"], "fcuda-uses-libdevice">,
-  HelpText<"Selectively link and internalize bitcode.">;
 
 } // let Flags = [CC

Re: [PATCH] D13874: Atomics: support __c11_* calls on _Atomic struct types

2015-10-27 Thread Tim Northover via cfe-commits
t.p.northover added a comment.

Ping?


Repository:
  rL LLVM

http://reviews.llvm.org/D13874



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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Tim Northover via cfe-commits
t.p.northover added a comment.

If you're on Linux or something you need "clang -target x86_64-apple-darwin 
-arch armv7 -c tmp.s". Another mess I keep meaning to fix.

I suspect the reason for this hack is that we've already changed the triple to 
"thumbv7-apple-iosN" by this point (because -arch armv7 compiles to Thumb), so 
it needs undoing for .s files. It might be reasonably easy to push the 
TY_PP_Asm check back into the Darwin codepath, or it might be horrible. So much 
has changed since 2011.


http://reviews.llvm.org/D14121



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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Alexandros Lamprineas via cfe-commits
labrinea added a comment.

Is this revision valid after all? I am confused by Tim's comment. I did not see 
any regressions locally.



Comment at: lib/Driver/ToolChain.cpp:472
@@ -471,2 +471,3 @@
+bool ThumbDefault = (ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
   (Suffix.startswith("v7") && getTriple().isOSBinFormatMachO());
 // FIXME: this is invalid for WindowsCE

rengolin wrote:
> You could cache the profile and use it here, too.
I don't see any checks based on profile in this line.


Comment at: test/Driver/arm-ias-Wa.s:75
@@ +74,3 @@
+
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s

rengolin wrote:
> You should also add "armv7m" and check that it defaults to Thumb, no?
It does default to thumb, if we are happy with this check I can add it.


http://reviews.llvm.org/D14121



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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Renato Golin via cfe-commits
rengolin added inline comments.


Comment at: lib/Driver/ToolChain.cpp:472
@@ -471,2 +471,3 @@
+bool ThumbDefault = (ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
   (Suffix.startswith("v7") && getTriple().isOSBinFormatMachO());
 // FIXME: this is invalid for WindowsCE

You could cache the profile and use it here, too.


Comment at: test/Driver/arm-ias-Wa.s:75
@@ +74,3 @@
+
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s

You should also add "armv7m" and check that it defaults to Thumb, no?


http://reviews.llvm.org/D14121



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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Alexandros Lamprineas via cfe-commits
labrinea added a comment.

It seems I missed your comments before updating the patch.
@t.p.northover: What is the exact command? "clang -arch armv7 -c tmp.s" didn't 
work for me.


http://reviews.llvm.org/D14121



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


r251419 - [ms-inline-asm] Test case for alignment directive change in LLVM r251418

2015-10-27 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Tue Oct 27 12:34:29 2015
New Revision: 251419

URL: http://llvm.org/viewvc/llvm-project?rev=251419&view=rev
Log:
[ms-inline-asm] Test case for alignment directive change in LLVM r251418

Added:
cfe/trunk/test/CodeGen/ms-inline-asm-align.c

Added: cfe/trunk/test/CodeGen/ms-inline-asm-align.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm-align.c?rev=251419&view=auto
==
--- cfe/trunk/test/CodeGen/ms-inline-asm-align.c (added)
+++ cfe/trunk/test/CodeGen/ms-inline-asm-align.c Tue Oct 27 12:34:29 2015
@@ -0,0 +1,30 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - 
| FileCheck %s --check-prefix=DARWIN
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -fasm-blocks -emit-llvm -o - | 
FileCheck %s --check-prefix=WINDOWS
+
+// On Windows, .align is in bytes, and on Darwin, .align is in log2 form. The
+// Intel inline assembly parser should rewrite to the appropriate form 
depending
+// on the platform.
+
+void align_test() {
+  __asm align 8
+  __asm align 16;
+  __asm align 128;
+  __asm ALIGN 256;
+}
+
+// DARWIN-LABEL: define void @align_test()
+// DARWIN: call void asm sideeffect inteldialect
+// DARWIN-SAME: .align 3
+// DARWIN-SAME: .align 4
+// DARWIN-SAME: .align 7
+// DARWIN-SAME: .align 8
+// DARWIN-SAME: "~{dirflag},~{fpsr},~{flags}"()
+
+// WINDOWS-LABEL: define void @align_test()
+// WINDOWS: call void asm sideeffect inteldialect
+// WINDOWS-SAME: .align 8
+// WINDOWS-SAME: .align 16
+// WINDOWS-SAME: .align 128
+// WINDOWS-SAME: .align 256
+// WINDOWS-SAME: "~{dirflag},~{fpsr},~{flags}"()


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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Alexandros Lamprineas via cfe-commits
labrinea updated this revision to Diff 38558.

http://reviews.llvm.org/D14121

Files:
  lib/Driver/ToolChain.cpp
  lib/Driver/Tools.cpp
  test/Driver/arm-ias-Wa.s

Index: test/Driver/arm-ias-Wa.s
===
--- test/Driver/arm-ias-Wa.s
+++ test/Driver/arm-ias-Wa.s
@@ -62,3 +62,17 @@
 // RUN:   | FileCheck --check-prefix=CHECK-DUP-HDIV %s
 // CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
 // CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
+
+// == Triple
+// RUN: %clang -target armv7a-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-none--eabi"
+
+// RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
+// CHECK-R-PROFILE: "-triple" "armv7r-none--eabi"
+
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-none--eabi"
+
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5561,7 +5561,7 @@
   const InputInfo &Input = Inputs[0];
 
   std::string TripleStr =
-  getToolChain().ComputeEffectiveClangTriple(Args, Input.getType());
+  getToolChain().ComputeEffectiveClangTriple(Args);
   const llvm::Triple Triple(TripleStr);
 
   // Don't warn about "clang -w -c foo.s"
Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -23,10 +23,12 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetParser.h"
 
 using namespace clang::driver;
 using namespace clang::driver::tools;
 using namespace clang;
+using namespace llvm;
 using namespace llvm::opt;
 
 static llvm::opt::Arg *GetRTTIArgument(const ArgList &Args) {
@@ -466,26 +468,24 @@
 : tools::arm::getARMTargetCPU(MCPU, MArch, Triple);
 StringRef Suffix =
   tools::arm::getLLVMArchSuffixForARM(CPU, MArch, Triple);
-bool ThumbDefault = Suffix.startswith("v6m") || Suffix.startswith("v7m") ||
-  Suffix.startswith("v7em") ||
+bool ThumbDefault = (ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
   (Suffix.startswith("v7") && getTriple().isOSBinFormatMachO());
 // FIXME: this is invalid for WindowsCE
 if (getTriple().isOSWindows())
   ThumbDefault = true;
 std::string ArchName;
-if (IsBigEndian)
-  ArchName = "armeb";
-else
-  ArchName = "arm";
 
-// Assembly files should start in ARM mode.
-if (InputType != types::TY_PP_Asm &&
-Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault))
+if (Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault))
 {
   if (IsBigEndian)
 ArchName = "thumbeb";
   else
 ArchName = "thumb";
+} else {
+  if (IsBigEndian)
+ArchName = "armeb";
+  else
+ArchName = "arm";
 }
 Triple.setArchName(ArchName + Suffix.str());
 


Index: test/Driver/arm-ias-Wa.s
===
--- test/Driver/arm-ias-Wa.s
+++ test/Driver/arm-ias-Wa.s
@@ -62,3 +62,17 @@
 // RUN:   | FileCheck --check-prefix=CHECK-DUP-HDIV %s
 // CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
 // CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
+
+// == Triple
+// RUN: %clang -target armv7a-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-none--eabi"
+
+// RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
+// CHECK-R-PROFILE: "-triple" "armv7r-none--eabi"
+
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-none--eabi"
+
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5561,7 +5561,7 @@
   const InputInfo &Input = Inputs[0];
 
   std::string TripleStr =
-  getToolChain().ComputeEffectiveClangTriple(Args, Input.getType());
+  getToolChain().ComputeEffectiveClangTriple(Args);
   const llvm::Triple Triple(TripleStr);
 
   // Don't warn about "clang -w -c foo.s"
Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -23,10 +23,12 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetParser.h"
 
 using namespace clang::driver;

Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Renato Golin via cfe-commits
rengolin added inline comments.


Comment at: lib/Driver/ToolChain.cpp:485
@@ +484,3 @@
+if ((ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
+(InputType != types::TY_PP_Asm &&
+ Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault)))

t.p.northover wrote:
> rengolin wrote:
> > labrinea wrote:
> > > Alternatively we could remove the check of InputType. I am not sure why 
> > > this and the above comment are present anyway.
> > I agree with you, this logic is inconsistent.
> > 
> > Historically, ARM assembly (especially inline assembly) is assumed ARM 
> > unless told otherwise. This is why you have to specify ".thumb" and not 
> > ".arm". However, that doesn't mean the assembly file *has* to be ARM, even 
> > if the arch name is "thumbvN" or if "-mthumb" is specified.
> > 
> > Not even GNU tools behave in such odd ways, so I think we should be 
> > consistent. If the triple is thumb, asm is thumb. If we have -mthumb, asm 
> > is thumb. If not, it's arm. Precisely how everything else works, so it's 
> > only logical that we should remove the InputType check.
> I suspect the issue is with our weirdness. When I remove the TY_PP_Asm check 
> "clang -arch armv7 -c tmp.s" defaults to Thumb-mode. I think I'd be lynched 
> by the OS-folks if that changed.
> 
> (That's basically the entire content of the Radar Chad referred to in his 
> original addition).
Well, that's clearly a bug. I'm ok with this going is as it is, but would be 
good to create a new bug to solve this mess.


http://reviews.llvm.org/D14121



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


Re: [PATCH] D13203: [Clang] - Massaging code to fix MSVS 2015 win32-release configuration

2015-10-27 Thread George Rimar via cfe-commits
grimar abandoned this revision.
grimar added a comment.

r251415 fixes this in another way.


http://reviews.llvm.org/D13203



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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Tim Northover via cfe-commits
t.p.northover added inline comments.


Comment at: lib/Driver/ToolChain.cpp:485
@@ +484,3 @@
+if ((ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
+(InputType != types::TY_PP_Asm &&
+ Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault)))

rengolin wrote:
> labrinea wrote:
> > Alternatively we could remove the check of InputType. I am not sure why 
> > this and the above comment are present anyway.
> I agree with you, this logic is inconsistent.
> 
> Historically, ARM assembly (especially inline assembly) is assumed ARM unless 
> told otherwise. This is why you have to specify ".thumb" and not ".arm". 
> However, that doesn't mean the assembly file *has* to be ARM, even if the 
> arch name is "thumbvN" or if "-mthumb" is specified.
> 
> Not even GNU tools behave in such odd ways, so I think we should be 
> consistent. If the triple is thumb, asm is thumb. If we have -mthumb, asm is 
> thumb. If not, it's arm. Precisely how everything else works, so it's only 
> logical that we should remove the InputType check.
I suspect the issue is with our weirdness. When I remove the TY_PP_Asm check 
"clang -arch armv7 -c tmp.s" defaults to Thumb-mode. I think I'd be lynched by 
the OS-folks if that changed.

(That's basically the entire content of the Radar Chad referred to in his 
original addition).


http://reviews.llvm.org/D14121



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


Re: [PATCH] D13203: [Clang] - Massaging code to fix MSVS 2015 win32-release configuration

2015-10-27 Thread Will Wilson via cfe-commits
Thanks David,

Committed as r251415.

On 27 October 2015 at 17:01, David Majnemer 
wrote:

> Looks fine Will, please commit but keep a comment and a link to the
> connect bug.  We don't want somebody to accidentally "clean-up" the code
> and break things again.
>
> On Tue, Oct 27, 2015 at 7:49 AM, Will Wilson via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> I've ended up using the simplified fix described on the MS connect bug
>> report for this issue:
>>
>> https://connect.microsoft.com/VisualStudio/feedback/details/1741530
>>
>> I’ve been able to work around this by changing ASTContext.cpp:368 from
>>
>> if (RC) {
>> Raw.setRaw(RC);
>> Raw.setKind(RawCommentAndCacheFlags::FromDecl);
>> } else
>>
>> to
>>
>> if (RC) {
>> Raw.setKind(RawCommentAndCacheFlags::FromDecl);
>> Raw.setRaw(RC);
>> } else
>>
>>
>> Since this simply swaps two orthogonal calls I've checked it passes the
>> tests and attached the patch.
>>
>> Let me know if it's okay to commit.
>>
>> Thanks,
>> Will.
>>
>> On 27 October 2015 at 11:42, Will Wilson  wrote:
>>
>>> Building latest HEAD using:
>>>
>>> cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
>>> -DLLVM_USE_CRT_RELWITHDEBINFO=MT -DLLVM_BUILD_TOOLS=OFF
>>> -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=OFF
>>> LLVM_BUILD_32_BITS=ON ..\llvm
>>>
>>>
>>> VC++ version: Microsoft (R) C/C++ Optimizing Compiler Version
>>> 19.00.23026 for x86
>>>
>>> Also produces the ICE mentioned before by grimar:
>>>
>>> [1003/1049] Building CXX object
>>> tools\...eFiles\clangAST.dir\ASTContext.cpp.obj
>>> FAILED: C:\PROGRA~2\MI0E91~1.0\VC\bin\cl.exe   /nologo /TP /DWIN32
>>> /D_WINDOWS -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345
>>> -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722
>>> -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245
>>> -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577
>>> -wd4091 -wd4324 -w14062 -we4238 /W4 /Zc:inline /Zc:sizedDealloc- /MT /Zi
>>> /O2 /Ob1 /D NDEBUG -Itools\clang\lib\AST -IW:\rec\llvm\tools\clang\lib\AST
>>> -IW:\rec\llvm\tools\clang\include -Itools\clang\include -Iinclude
>>> -IW:\rec\llvm\include /EHs-c- /GR- /showIncludes -DCLANG_ENABLE_ARCMT
>>> -DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER
>>> -DGTEST_HAS_RTTI=0 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
>>> -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE
>>> -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS
>>> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
>>> /Fotools\clang\lib\AST\CMakeFiles\clangAST.dir\ASTContext.cpp.obj
>>> /Fdtools\clang\lib\AST\CMakeFiles\clangAST.dir\ /FS -c
>>> W:\rec\llvm\tools\clang\lib\AST\ASTContext.cpp
>>> w:\rec\llvm\tools\clang\lib\ast\astcontext.cpp(334) : fatal error C1001:
>>> An internal error has occurred in the compiler.
>>> (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 246)
>>>  To work around this problem, try simplifying or changing the program
>>> near the locations listed above.
>>> Please choose the Technical Support command on the Visual C++
>>>  Help menu, or open the Technical Support help file for more information
>>>
>>> INTERNAL COMPILER ERROR in 'C:\PROGRA~2\MI0E91~1.0\VC\bin\cl.exe'
>>> Please choose the Technical Support command on the Visual C++
>>> Help menu, or open the Technical Support help file for more
>>> information
>>>
>>>
>>> Did anyone find a non-invasive workaround or is the patch still the way
>>> to go?
>>>
>>> Thanks,
>>> Will.
>>>
>>> On 5 October 2015 at 13:39, Manuel Klimek via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 klimek added a comment.

 Note: with VS Professional 14.0.23107.0 D14REL I do not get this error.


 http://reviews.llvm.org/D13203



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

>>>
>>>
>>>
>>> --
>>> *Indefiant *: http://www.indefiant.com
>>> Home of Recode : Runtime C++ Editing for VS
>>>
>>
>>
>>
>> --
>> *Indefiant *: http://www.indefiant.com
>> Home of Recode : Runtime C++ Editing for VS
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>>
>


-- 
*Indefiant *: http://www.indefiant.com
Home of Recode : Runtime C++ Editing for VS
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r251415 - [MSVC] Workaround for ICE in cl.exe when compiling ASTContext.cpp in Release Win32

2015-10-27 Thread Will Wilson via cfe-commits
Author: lantictac
Date: Tue Oct 27 12:01:10 2015
New Revision: 251415

URL: http://llvm.org/viewvc/llvm-project?rev=251415&view=rev
Log:
[MSVC] Workaround for ICE in cl.exe when compiling ASTContext.cpp in Release 
Win32

Microsoft connect bug: 
https://connect.microsoft.com/VisualStudio/feedback/details/1741530

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

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=251415&r1=251414&r2=251415&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Oct 27 12:01:10 2015
@@ -366,8 +366,10 @@ const RawComment *ASTContext::getRawComm
   OriginalDeclForRC = I;
   RawCommentAndCacheFlags Raw;
   if (RC) {
-Raw.setRaw(RC);
+// Call order swapped to work around ICE in VS2015 RTM (Release Win32)
+// https://connect.microsoft.com/VisualStudio/feedback/details/1741530
 Raw.setKind(RawCommentAndCacheFlags::FromDecl);
+Raw.setRaw(RC);
   } else
 Raw.setKind(RawCommentAndCacheFlags::NoCommentInDecl);
   Raw.setOriginalDecl(I);


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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Renato Golin via cfe-commits
rengolin added inline comments.


Comment at: lib/Driver/ToolChain.cpp:485
@@ +484,3 @@
+if ((ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
+(InputType != types::TY_PP_Asm &&
+ Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault)))

labrinea wrote:
> Alternatively we could remove the check of InputType. I am not sure why this 
> and the above comment are present anyway.
I agree with you, this logic is inconsistent.

Historically, ARM assembly (especially inline assembly) is assumed ARM unless 
told otherwise. This is why you have to specify ".thumb" and not ".arm". 
However, that doesn't mean the assembly file *has* to be ARM, even if the arch 
name is "thumbvN" or if "-mthumb" is specified.

Not even GNU tools behave in such odd ways, so I think we should be consistent. 
If the triple is thumb, asm is thumb. If we have -mthumb, asm is thumb. If not, 
it's arm. Precisely how everything else works, so it's only logical that we 
should remove the InputType check.


http://reviews.llvm.org/D14121



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


Re: r251387 - [coroutines] Creation of promise object, lookup of operator co_await, building

2015-10-27 Thread David Blaikie via cfe-commits
On Tue, Oct 27, 2015 at 9:24 AM, Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Mon, Oct 26, 2015 at 11:02 PM, Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Modified: cfe/trunk/include/clang/Sema/ScopeInfo.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ScopeInfo.h?rev=251387&r1=251386&r2=251387&view=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Sema/ScopeInfo.h (original)
>> +++ cfe/trunk/include/clang/Sema/ScopeInfo.h Tue Oct 27 01:02:45 2015
>> @@ -89,40 +89,43 @@ protected:
>>  public:
>>/// \brief What kind of scope we are describing.
>>///
>> -  ScopeKind Kind;
>> +  ScopeKind Kind : 2;
>>
>
> Nice try, Mr. Smith, but you can't outrun the long arm of MSVC! Recall
> that in MSVC, enums are always signed ints by default. Clang gives you this:
>
> ..\tools\clang\include\clang/Sema/ScopeInfo.h(616,10) :  warning: implicit
> truncation from 'clang::sema::FunctionScopeInfo::ScopeKind' to bitfield
> changes value from 3 to -1 [-Wbitfield-constant-conversion]
> Kind = SK_CapturedRegion;
>  ^ ~
> ..\tools\clang\include\clang/Sema/ScopeInfo.h(714,10) :  warning: implicit
> truncation from 'clang::sema::FunctionScopeInfo::ScopeKind' to bitfield
> changes value from 2 to -2 [-Wbitfield-constant-conversion]
> Kind = SK_Lambda;
>  ^ ~
>
> I guess I'll bump it to 3 bits.
>

Usually we workaround this by just not enum-ifying the bitfield, and
casting the raw int/unsigned int/whatever to/from the enum type in
setters/getters/etc. *shrug*


>
> ___
> 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] D12669: [libcxxabi] Fix alignment of pointers returned by fallback_malloc

2015-10-27 Thread Jonathan Roelofs via cfe-commits
jroelofs added inline comments.


Comment at: src/fallback_malloc.ipp:69
@@ -59,1 +68,3 @@
+// Size: 4
+// Alignment: 2
 struct heap_node {

EricWF wrote:
> compnerd wrote:
> > Make this a set of static_asserts?
> I was going to but I wasn't 100% sure this would be true on all platforms. 
Better to have it fail at compile time so we can at least detect this and 
decide what to do about it, no?


http://reviews.llvm.org/D12669



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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Alexandros Lamprineas via cfe-commits
labrinea added inline comments.


Comment at: lib/Driver/ToolChain.cpp:485
@@ +484,3 @@
+if ((ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
+(InputType != types::TY_PP_Asm &&
+ Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault)))

Alternatively we could remove the check of InputType. I am not sure why this 
and the above comment are present anyway.


http://reviews.llvm.org/D14121



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


Re: [PATCH] D14119: [libcxxabi] Correctly align fallback heap

2015-10-27 Thread Oliver Stannard via cfe-commits
olista01 abandoned this revision.
olista01 added a comment.

Ok, I'll abandon this patch and wait for Eric's.

I think the char* aliasing rule only works one way, i.e. any object can be 
accessed through an lvalue of type char, but not the other way round (c++11, 
3.10/10). I didn't know about the "object lifetime" rules though, maybe they 
allow it.


Repository:
  rL LLVM

http://reviews.llvm.org/D14119



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


r251412 - Widen this enum bitfield by one bit to prevent sign extension in MSVC

2015-10-27 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Tue Oct 27 11:24:03 2015
New Revision: 251412

URL: http://llvm.org/viewvc/llvm-project?rev=251412&view=rev
Log:
Widen this enum bitfield by one bit to prevent sign extension in MSVC

Modified:
cfe/trunk/include/clang/Sema/ScopeInfo.h

Modified: cfe/trunk/include/clang/Sema/ScopeInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ScopeInfo.h?rev=251412&r1=251411&r2=251412&view=diff
==
--- cfe/trunk/include/clang/Sema/ScopeInfo.h (original)
+++ cfe/trunk/include/clang/Sema/ScopeInfo.h Tue Oct 27 11:24:03 2015
@@ -89,7 +89,7 @@ protected:
 public:
   /// \brief What kind of scope we are describing.
   ///
-  ScopeKind Kind : 2;
+  ScopeKind Kind : 3;
 
   /// \brief Whether this function contains a VLA, \@try, try, C++
   /// initializer, or anything else that can't be jumped past.


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


Re: [PATCH] D14119: [libcxxabi] Correctly align fallback heap

2015-10-27 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

@t.p.northover @olista01 A char array can legally alias any other type memory 
AFAIK. Its perfectly legal to use a char array to provide raw memory. There 
shouldn't be any undefined behavior here.


Repository:
  rL LLVM

http://reviews.llvm.org/D14119



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


Re: r251387 - [coroutines] Creation of promise object, lookup of operator co_await, building

2015-10-27 Thread Reid Kleckner via cfe-commits
On Mon, Oct 26, 2015 at 11:02 PM, Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Modified: cfe/trunk/include/clang/Sema/ScopeInfo.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ScopeInfo.h?rev=251387&r1=251386&r2=251387&view=diff
>
> ==
> --- cfe/trunk/include/clang/Sema/ScopeInfo.h (original)
> +++ cfe/trunk/include/clang/Sema/ScopeInfo.h Tue Oct 27 01:02:45 2015
> @@ -89,40 +89,43 @@ protected:
>  public:
>/// \brief What kind of scope we are describing.
>///
> -  ScopeKind Kind;
> +  ScopeKind Kind : 2;
>

Nice try, Mr. Smith, but you can't outrun the long arm of MSVC! Recall that
in MSVC, enums are always signed ints by default. Clang gives you this:

..\tools\clang\include\clang/Sema/ScopeInfo.h(616,10) :  warning: implicit
truncation from 'clang::sema::FunctionScopeInfo::ScopeKind' to bitfield
changes value from 3 to -1 [-Wbitfield-constant-conversion]
Kind = SK_CapturedRegion;
 ^ ~
..\tools\clang\include\clang/Sema/ScopeInfo.h(714,10) :  warning: implicit
truncation from 'clang::sema::FunctionScopeInfo::ScopeKind' to bitfield
changes value from 2 to -2 [-Wbitfield-constant-conversion]
Kind = SK_Lambda;
 ^ ~

I guess I'll bump it to 3 bits.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Renato Golin via cfe-commits
rengolin accepted this revision.
rengolin added a comment.

I wish there was a way to get the info if a target is thumb-only, but this is 
ok as an intermediate solution. :)

LGTM too, thanks!


http://reviews.llvm.org/D14121



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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Alexandros Lamprineas via cfe-commits
labrinea updated this revision to Diff 38552.

http://reviews.llvm.org/D14121

Files:
  lib/Driver/ToolChain.cpp
  test/Driver/arm-ias-Wa.s

Index: test/Driver/arm-ias-Wa.s
===
--- test/Driver/arm-ias-Wa.s
+++ test/Driver/arm-ias-Wa.s
@@ -62,3 +62,17 @@
 // RUN:   | FileCheck --check-prefix=CHECK-DUP-HDIV %s
 // CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
 // CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
+
+// == Triple
+// RUN: %clang -target armv7a-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-none--eabi"
+
+// RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
+// CHECK-R-PROFILE: "-triple" "armv7r-none--eabi"
+
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-none--eabi"
+
Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -23,10 +23,12 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetParser.h"
 
 using namespace clang::driver;
 using namespace clang::driver::tools;
 using namespace clang;
+using namespace llvm;
 using namespace llvm::opt;
 
 static llvm::opt::Arg *GetRTTIArgument(const ArgList &Args) {
@@ -478,9 +480,10 @@
 else
   ArchName = "arm";
 
-// Assembly files should start in ARM mode.
-if (InputType != types::TY_PP_Asm &&
-Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault))
+// Assembly files should start in ARM mode, unless arch is M-profile.
+if ((ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
+(InputType != types::TY_PP_Asm &&
+ Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault)))
 {
   if (IsBigEndian)
 ArchName = "thumbeb";


Index: test/Driver/arm-ias-Wa.s
===
--- test/Driver/arm-ias-Wa.s
+++ test/Driver/arm-ias-Wa.s
@@ -62,3 +62,17 @@
 // RUN:   | FileCheck --check-prefix=CHECK-DUP-HDIV %s
 // CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
 // CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
+
+// == Triple
+// RUN: %clang -target armv7a-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-none--eabi"
+
+// RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
+// CHECK-R-PROFILE: "-triple" "armv7r-none--eabi"
+
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-none--eabi"
+
Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -23,10 +23,12 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetParser.h"
 
 using namespace clang::driver;
 using namespace clang::driver::tools;
 using namespace clang;
+using namespace llvm;
 using namespace llvm::opt;
 
 static llvm::opt::Arg *GetRTTIArgument(const ArgList &Args) {
@@ -478,9 +480,10 @@
 else
   ArchName = "arm";
 
-// Assembly files should start in ARM mode.
-if (InputType != types::TY_PP_Asm &&
-Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault))
+// Assembly files should start in ARM mode, unless arch is M-profile.
+if ((ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
+(InputType != types::TY_PP_Asm &&
+ Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault)))
 {
   if (IsBigEndian)
 ArchName = "thumbeb";
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14119: [libcxxabi] Correctly align fallback heap

2015-10-27 Thread Tim Northover via cfe-commits
t.p.northover added a comment.

Oh, and I **think** it can probably be justified under C++, though I've not 
quite joined up all the dots. The "object lifetime" rules seem to bless 
declaring a char array dead and reusing its storage for another purpose. Since 
heap_node has trivial initialization, you probably don't even need to do 
anything special to make it a heap.

I could be wrong there though.


Repository:
  rL LLVM

http://reviews.llvm.org/D14119



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


Re: [PATCH] D14119: [libcxxabi] Correctly align fallback heap

2015-10-27 Thread Eric Fiselier via cfe-commits
EricWF added a subscriber: EricWF.
EricWF added a comment.

This patch is incomplete and incorrect. The heap actually needs to be aligned 
to a 16 byte boundary, and all pointers returned from it must also be 16 byte 
aligned. I have a complete fix for this issue as http://reviews.llvm.org/D12669.

A fix for the non-fallback case can be found http://reviews.llvm.org/D12512. 
Also see https://llvm.org/bugs/show_bug.cgi?id=24604.


Repository:
  rL LLVM

http://reviews.llvm.org/D14119



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


Re: [Diffusion] rL251335: MismatchingNewDeleteDetector uses incorrect field, and finds no initializer

2015-10-27 Thread Tom Stellard via cfe-commits
tstellarAMD added a subscriber: tstellarAMD.
tstellarAMD added auditors: rsmith, 3.7-release, cfe-commits, tstellarAMD.
tstellarAMD added a comment.

Hi Richard,

Is this OK to merge to the 3.7 branch?


Users:
  ismailp (Author)
  rsmith (Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)

http://reviews.llvm.org/rL251335



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


Re: [PATCH] D14119: [libcxxabi] Correctly align fallback heap

2015-10-27 Thread Tim Northover via cfe-commits
t.p.northover added a subscriber: t.p.northover.
t.p.northover added a comment.

Using alignas(heap_node) might be a little clearer and more semantically 
correct here. Should be OK support-wise, libc++ is already using that for some 
of its bits. Otherwise, good find!

Tim.


Repository:
  rL LLVM

http://reviews.llvm.org/D14119



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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Renato Golin via cfe-commits
rengolin added inline comments.


Comment at: test/Driver/arm-ias-Wa.s:67
@@ +66,3 @@
+// == Triple
+// RUN: %clang -target armv7a-arm-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s

t.p.northover wrote:
> Is the -arm- vendor intentional (because DS-5 uses that or something)? Fine 
> if so (it could probably do with being tested actually), a bit weird 
> otherwise.
No, that seems a typo. I don't think it should stay.


http://reviews.llvm.org/D14121



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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Tim Northover via cfe-commits
t.p.northover added a subscriber: t.p.northover.
t.p.northover accepted this revision.
t.p.northover added a reviewer: t.p.northover.
t.p.northover added a comment.
This revision is now accepted and ready to land.

This looks mostly fine, just one quick question that shouldn't block anything:



Comment at: test/Driver/arm-ias-Wa.s:67
@@ +66,3 @@
+// == Triple
+// RUN: %clang -target armv7a-arm-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s

Is the -arm- vendor intentional (because DS-5 uses that or something)? Fine if 
so (it could probably do with being tested actually), a bit weird otherwise.


http://reviews.llvm.org/D14121



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


Re: [PATCH] D13203: [Clang] - Massaging code to fix MSVS 2015 win32-release configuration

2015-10-27 Thread David Majnemer via cfe-commits
Looks fine Will, please commit but keep a comment and a link to the connect
bug.  We don't want somebody to accidentally "clean-up" the code and break
things again.

On Tue, Oct 27, 2015 at 7:49 AM, Will Wilson via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> I've ended up using the simplified fix described on the MS connect bug
> report for this issue:
>
> https://connect.microsoft.com/VisualStudio/feedback/details/1741530
>
> I’ve been able to work around this by changing ASTContext.cpp:368 from
>
> if (RC) {
> Raw.setRaw(RC);
> Raw.setKind(RawCommentAndCacheFlags::FromDecl);
> } else
>
> to
>
> if (RC) {
> Raw.setKind(RawCommentAndCacheFlags::FromDecl);
> Raw.setRaw(RC);
> } else
>
>
> Since this simply swaps two orthogonal calls I've checked it passes the
> tests and attached the patch.
>
> Let me know if it's okay to commit.
>
> Thanks,
> Will.
>
> On 27 October 2015 at 11:42, Will Wilson  wrote:
>
>> Building latest HEAD using:
>>
>> cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
>> -DLLVM_USE_CRT_RELWITHDEBINFO=MT -DLLVM_BUILD_TOOLS=OFF
>> -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=OFF
>> LLVM_BUILD_32_BITS=ON ..\llvm
>>
>>
>> VC++ version: Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026
>> for x86
>>
>> Also produces the ICE mentioned before by grimar:
>>
>> [1003/1049] Building CXX object
>> tools\...eFiles\clangAST.dir\ASTContext.cpp.obj
>> FAILED: C:\PROGRA~2\MI0E91~1.0\VC\bin\cl.exe   /nologo /TP /DWIN32
>> /D_WINDOWS -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345
>> -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722
>> -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245
>> -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577
>> -wd4091 -wd4324 -w14062 -we4238 /W4 /Zc:inline /Zc:sizedDealloc- /MT /Zi
>> /O2 /Ob1 /D NDEBUG -Itools\clang\lib\AST -IW:\rec\llvm\tools\clang\lib\AST
>> -IW:\rec\llvm\tools\clang\include -Itools\clang\include -Iinclude
>> -IW:\rec\llvm\include /EHs-c- /GR- /showIncludes -DCLANG_ENABLE_ARCMT
>> -DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER
>> -DGTEST_HAS_RTTI=0 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
>> -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE
>> -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS
>> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
>> /Fotools\clang\lib\AST\CMakeFiles\clangAST.dir\ASTContext.cpp.obj
>> /Fdtools\clang\lib\AST\CMakeFiles\clangAST.dir\ /FS -c
>> W:\rec\llvm\tools\clang\lib\AST\ASTContext.cpp
>> w:\rec\llvm\tools\clang\lib\ast\astcontext.cpp(334) : fatal error C1001:
>> An internal error has occurred in the compiler.
>> (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 246)
>>  To work around this problem, try simplifying or changing the program
>> near the locations listed above.
>> Please choose the Technical Support command on the Visual C++
>>  Help menu, or open the Technical Support help file for more information
>>
>> INTERNAL COMPILER ERROR in 'C:\PROGRA~2\MI0E91~1.0\VC\bin\cl.exe'
>> Please choose the Technical Support command on the Visual C++
>> Help menu, or open the Technical Support help file for more
>> information
>>
>>
>> Did anyone find a non-invasive workaround or is the patch still the way
>> to go?
>>
>> Thanks,
>> Will.
>>
>> On 5 October 2015 at 13:39, Manuel Klimek via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> klimek added a comment.
>>>
>>> Note: with VS Professional 14.0.23107.0 D14REL I do not get this error.
>>>
>>>
>>> http://reviews.llvm.org/D13203
>>>
>>>
>>>
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
>>
>>
>> --
>> *Indefiant *: http://www.indefiant.com
>> Home of Recode : Runtime C++ Editing for VS
>>
>
>
>
> --
> *Indefiant *: http://www.indefiant.com
> Home of Recode : Runtime C++ Editing for VS
>
> ___
> 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


r251410 - Index: expose is_mutable_field

2015-10-27 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Tue Oct 27 10:50:22 2015
New Revision: 251410

URL: http://llvm.org/viewvc/llvm-project?rev=251410&view=rev
Log:
Index: expose is_mutable_field

Expose isMutable via libClang and python bindings.

Patch by Jonathan B Coe!

Modified:
cfe/trunk/bindings/python/clang/cindex.py
cfe/trunk/bindings/python/tests/cindex/test_cursor.py
cfe/trunk/include/clang-c/Index.h
cfe/trunk/test/Index/index-file.cpp
cfe/trunk/tools/c-index-test/c-index-test.c
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/libclang.exports

Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=251410&r1=251409&r2=251410&view=diff
==
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Tue Oct 27 10:50:22 2015
@@ -1170,6 +1170,12 @@ class Cursor(Structure):
 """
 return conf.lib.clang_CXXMethod_isConst(self)
 
+def is_mutable_field(self):
+"""Returns True if the cursor refers to a C++ field that is declared
+'mutable'.
+"""
+return conf.lib.clang_CXXField_isMutable(self)
+
 def is_pure_virtual_method(self):
 """Returns True if the cursor refers to a C++ member function or member
 function template that is declared pure virtual.
@@ -2897,6 +2903,10 @@ functionList = [
[Index, c_char_p],
c_object_p),
 
+  ("clang_CXXField_isMutable",
+   [Cursor],
+   bool),
+
   ("clang_CXXMethod_isConst",
[Cursor],
bool),

Modified: cfe/trunk/bindings/python/tests/cindex/test_cursor.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_cursor.py?rev=251410&r1=251409&r2=251410&view=diff
==
--- cfe/trunk/bindings/python/tests/cindex/test_cursor.py (original)
+++ cfe/trunk/bindings/python/tests/cindex/test_cursor.py Tue Oct 27 10:50:22 
2015
@@ -112,6 +112,21 @@ def test_is_const_method():
 assert foo.is_const_method()
 assert not bar.is_const_method()
 
+def test_is_mutable_field():
+"""Ensure Cursor.is_mutable_field works."""
+source = 'class X { int x_; mutable int y_; };'
+tu = get_tu(source, lang='cpp')
+
+cls = get_cursor(tu, 'X')
+x_ = get_cursor(tu, 'x_')
+y_ = get_cursor(tu, 'y_')
+assert cls is not None
+assert x_ is not None
+assert y_ is not None
+
+assert not x_.is_mutable_field()
+assert y_.is_mutable_field()
+
 def test_is_static_method():
 """Ensure Cursor.is_static_method works."""
 

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=251410&r1=251409&r2=251410&view=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Tue Oct 27 10:50:22 2015
@@ -3957,6 +3957,11 @@ CXFile clang_Module_getTopLevelHeader(CX
  */
 
 /**
+ * \brief Determine if a C++ field is declared 'mutable'.
+ */
+CINDEX_LINKAGE unsigned clang_CXXField_isMutable(CXCursor C);
+
+/**
  * \brief Determine if a C++ member function or member function template is
  * pure virtual.
  */

Modified: cfe/trunk/test/Index/index-file.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/index-file.cpp?rev=251410&r1=251409&r2=251410&view=diff
==
--- cfe/trunk/test/Index/index-file.cpp (original)
+++ cfe/trunk/test/Index/index-file.cpp Tue Oct 27 10:50:22 2015
@@ -24,6 +24,10 @@ template <> void A::meth();
 template class A;
 }
 
+class B {
+  mutable int x_;
+  int y_;
+};
 // RUN: c-index-test -index-file %s > %t
 // RUN: FileCheck %s -input-file=%t
 
@@ -31,3 +35,5 @@ template class A;
 // CHECK: [indexDeclaration]: kind: struct-template-spec | name: TS | {{.*}} | 
loc: 11:8
 // CHECK: [indexDeclaration]: kind: function-template-spec | name: tfoo | 
{{.*}} | loc: 15:6
 // CHECK: [indexDeclaration]: kind: c++-instance-method | name: meth | {{.*}} 
| loc: 23:26
+// CHECK: [indexDeclaration]: kind: field | name: x_ | USR: c:@S@B@FI@x_ | 
lang: C++ | cursor: FieldDecl=x_:28:15 (Definition) (mutable) | loc: 28:15 | 
semantic-container: [B:27:7] | lexical-container: [B:27:7] | isRedecl: 0 | 
isDef: 1 | isContainer: 0 | isImplicit: 0
+// CHECK: [indexDeclaration]: kind: field | name: y_ | USR: c:@S@B@FI@y_ | 
lang: C++ | cursor: FieldDecl=y_:29:7 (Definition) | loc: 29:7 | 
semantic-container: [B:27:7] | lexical-container: [B:27:7] | isRedecl: 0 | 
isDef: 1 | isContainer: 0 | isImplicit: 0

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=251410&r1=251409&r2=251410&view=diff
===

[PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-27 Thread Alexandros Lamprineas via cfe-commits
labrinea created this revision.
labrinea added reviewers: rengolin, cfe-commits, bsmith.
Herald added subscribers: rengolin, aemerson.

When running clang with an arm triple such as '--target=thumbv7m-arm-none-eabi' 
that has a thumb only CPU by default (cortex-m3), and when using the assembler, 
the default thumb state of the CPU does not get passed via the triple to LLVM:

```
$ clang -target thumbv7m-arm-none-eabi -c -v test.s
clang -cc1as ... -triple armv7m-arm-none-eabi ... test.s
```

http://reviews.llvm.org/D14121

Files:
  lib/Driver/ToolChain.cpp
  test/Driver/arm-ias-Wa.s

Index: test/Driver/arm-ias-Wa.s
===
--- test/Driver/arm-ias-Wa.s
+++ test/Driver/arm-ias-Wa.s
@@ -62,3 +62,17 @@
 // RUN:   | FileCheck --check-prefix=CHECK-DUP-HDIV %s
 // CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
 // CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
+
+// == Triple
+// RUN: %clang -target armv7a-arm-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-arm-none-eabi"
+
+// RUN: %clang -target armv7r-arm-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
+// CHECK-R-PROFILE: "-triple" "armv7r-arm-none-eabi"
+
+// RUN: %clang -target thumbv7m-arm-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-arm-none-eabi"
+
Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -23,10 +23,12 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetParser.h"
 
 using namespace clang::driver;
 using namespace clang::driver::tools;
 using namespace clang;
+using namespace llvm;
 using namespace llvm::opt;
 
 static llvm::opt::Arg *GetRTTIArgument(const ArgList &Args) {
@@ -478,9 +480,10 @@
 else
   ArchName = "arm";
 
-// Assembly files should start in ARM mode.
-if (InputType != types::TY_PP_Asm &&
-Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault))
+// Assembly files should start in ARM mode, unless arch is M-profile.
+if ((ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
+(InputType != types::TY_PP_Asm &&
+ Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault)))
 {
   if (IsBigEndian)
 ArchName = "thumbeb";


Index: test/Driver/arm-ias-Wa.s
===
--- test/Driver/arm-ias-Wa.s
+++ test/Driver/arm-ias-Wa.s
@@ -62,3 +62,17 @@
 // RUN:   | FileCheck --check-prefix=CHECK-DUP-HDIV %s
 // CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
 // CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
+
+// == Triple
+// RUN: %clang -target armv7a-arm-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-arm-none-eabi"
+
+// RUN: %clang -target armv7r-arm-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
+// CHECK-R-PROFILE: "-triple" "armv7r-arm-none-eabi"
+
+// RUN: %clang -target thumbv7m-arm-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-arm-none-eabi"
+
Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -23,10 +23,12 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetParser.h"
 
 using namespace clang::driver;
 using namespace clang::driver::tools;
 using namespace clang;
+using namespace llvm;
 using namespace llvm::opt;
 
 static llvm::opt::Arg *GetRTTIArgument(const ArgList &Args) {
@@ -478,9 +480,10 @@
 else
   ArchName = "arm";
 
-// Assembly files should start in ARM mode.
-if (InputType != types::TY_PP_Asm &&
-Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault))
+// Assembly files should start in ARM mode, unless arch is M-profile.
+if ((ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
+(InputType != types::TY_PP_Asm &&
+ Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault)))
 {
   if (IsBigEndian)
 ArchName = "thumbeb";
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [Diffusion] rL250657: Support linking against OpenMP runtime on FreeBSD.

2015-10-27 Thread Tom Stellard via cfe-commits
tstellarAMD added a subscriber: tstellarAMD.
tstellarAMD added auditors: rsmith.
tstellarAMD added a comment.

Hi Richard,

Is this OK to merge to the 3.7 branch?


Users:
  dim (Author)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  joerg (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL250657



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


Re: [Diffusion] rL248424: Push OpenMP linker flags after linker input on Darwin. Don't add any

2015-10-27 Thread Tom Stellard via cfe-commits
tstellarAMD added a subscriber: tstellarAMD.
tstellarAMD added auditors: rsmith.
tstellarAMD added a comment.

Hi Richard,

Is this OK to merge to the 3.7 branch?


Users:
  joerg (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL248424



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


Re: [Diffusion] rL248379: Refactor library decision for -fopenmp support from Darwin into a

2015-10-27 Thread Tom Stellard via cfe-commits
tstellarAMD added a subscriber: tstellarAMD.
tstellarAMD added auditors: rsmith.
tstellarAMD added a comment.

Hi Richard,

Is this OK to merge to the 3.7 branch?


Users:
  joerg (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL248379



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


Re: [PATCH] D13203: [Clang] - Massaging code to fix MSVS 2015 win32-release configuration

2015-10-27 Thread Will Wilson via cfe-commits
I've ended up using the simplified fix described on the MS connect bug
report for this issue:

https://connect.microsoft.com/VisualStudio/feedback/details/1741530

I’ve been able to work around this by changing ASTContext.cpp:368 from

if (RC) {
Raw.setRaw(RC);
Raw.setKind(RawCommentAndCacheFlags::FromDecl);
} else

to

if (RC) {
Raw.setKind(RawCommentAndCacheFlags::FromDecl);
Raw.setRaw(RC);
} else


Since this simply swaps two orthogonal calls I've checked it passes the
tests and attached the patch.

Let me know if it's okay to commit.

Thanks,
Will.

On 27 October 2015 at 11:42, Will Wilson  wrote:

> Building latest HEAD using:
>
> cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
> -DLLVM_USE_CRT_RELWITHDEBINFO=MT -DLLVM_BUILD_TOOLS=OFF
> -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=OFF
> LLVM_BUILD_32_BITS=ON ..\llvm
>
>
> VC++ version: Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026
> for x86
>
> Also produces the ICE mentioned before by grimar:
>
> [1003/1049] Building CXX object
> tools\...eFiles\clangAST.dir\ASTContext.cpp.obj
> FAILED: C:\PROGRA~2\MI0E91~1.0\VC\bin\cl.exe   /nologo /TP /DWIN32
> /D_WINDOWS -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345
> -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722
> -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245
> -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577
> -wd4091 -wd4324 -w14062 -we4238 /W4 /Zc:inline /Zc:sizedDealloc- /MT /Zi
> /O2 /Ob1 /D NDEBUG -Itools\clang\lib\AST -IW:\rec\llvm\tools\clang\lib\AST
> -IW:\rec\llvm\tools\clang\include -Itools\clang\include -Iinclude
> -IW:\rec\llvm\include /EHs-c- /GR- /showIncludes -DCLANG_ENABLE_ARCMT
> -DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER
> -DGTEST_HAS_RTTI=0 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
> -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE
> -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
> /Fotools\clang\lib\AST\CMakeFiles\clangAST.dir\ASTContext.cpp.obj
> /Fdtools\clang\lib\AST\CMakeFiles\clangAST.dir\ /FS -c
> W:\rec\llvm\tools\clang\lib\AST\ASTContext.cpp
> w:\rec\llvm\tools\clang\lib\ast\astcontext.cpp(334) : fatal error C1001:
> An internal error has occurred in the compiler.
> (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 246)
>  To work around this problem, try simplifying or changing the program near
> the locations listed above.
> Please choose the Technical Support command on the Visual C++
>  Help menu, or open the Technical Support help file for more information
>
> INTERNAL COMPILER ERROR in 'C:\PROGRA~2\MI0E91~1.0\VC\bin\cl.exe'
> Please choose the Technical Support command on the Visual C++
> Help menu, or open the Technical Support help file for more information
>
>
> Did anyone find a non-invasive workaround or is the patch still the way to
> go?
>
> Thanks,
> Will.
>
> On 5 October 2015 at 13:39, Manuel Klimek via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> klimek added a comment.
>>
>> Note: with VS Professional 14.0.23107.0 D14REL I do not get this error.
>>
>>
>> http://reviews.llvm.org/D13203
>>
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
>
> --
> *Indefiant *: http://www.indefiant.com
> Home of Recode : Runtime C++ Editing for VS
>



-- 
*Indefiant *: http://www.indefiant.com
Home of Recode : Runtime C++ Editing for VS


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


Re: [Diffusion] rL248426: Support linking against OpenMP runtime on NetBSD.

2015-10-27 Thread Tom Stellard via cfe-commits
tstellarAMD added a subscriber: tstellarAMD.
tstellarAMD added auditors: rsmith.
tstellarAMD added a comment.

This is OK to merge to the 3.7 branch as long as Richard approves.  Though it 
would be nice to have a *BSD code owner for these types of things.  Any 
volunteers?


Users:
  joerg (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL248426



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


[PATCH] D14119: [libcxxabi] Correctly align fallback heap

2015-10-27 Thread Oliver Stannard via cfe-commits
olista01 created this revision.
olista01 added reviewers: mclow.lists, compnerd.
olista01 added a subscriber: cfe-commits.
olista01 set the repository for this revision to rL LLVM.

The fallback malloc in libcxxabi (used to allocate space for exception
objects in out-of-memory situations) defines its heap as an array of
chars, but casts it to a struct containing shorts before accessing it.
Sometimes, the heap does not get placed on a 2-byte boundary, so
accesses to it caused unaligned access faults on targets that do not
support unaligned accesses.

The fix is to specify the alignment of the heap array, so that it will
always be sufficient for a heap_node.

This is still technically invoking undefined behaviour, as it is
accessing an object of type "char array" through an lvalue of a
different type. However, I don't think it is possible to write malloc
without violating that rule, and we have tests covering this.

Repository:
  rL LLVM

http://reviews.llvm.org/D14119

Files:
  src/fallback_malloc.ipp

Index: src/fallback_malloc.ipp
===
--- src/fallback_malloc.ipp
+++ src/fallback_malloc.ipp
@@ -51,6 +51,7 @@
 
 
 #define HEAP_SIZE   512
+__attribute((aligned(2)))
 char heap [ HEAP_SIZE ];
 
 typedef unsigned short heap_offset;


Index: src/fallback_malloc.ipp
===
--- src/fallback_malloc.ipp
+++ src/fallback_malloc.ipp
@@ -51,6 +51,7 @@
 
 
 #define HEAP_SIZE   512
+__attribute((aligned(2)))
 char heap [ HEAP_SIZE ];
 
 typedef unsigned short heap_offset;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r251407 - [analyzer] Fix lambdas that are capturing constants.

2015-10-27 Thread Gabor Horvath via cfe-commits
Author: xazax
Date: Tue Oct 27 08:46:39 2015
New Revision: 251407

URL: http://llvm.org/viewvc/llvm-project?rev=251407&view=rev
Log:
[analyzer] Fix lambdas that are capturing constants.

Modified:
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/test/Analysis/lambdas.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=251407&r1=251406&r2=251407&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Tue Oct 27 08:46:39 2015
@@ -1859,13 +1859,20 @@ void ExprEngine::VisitCommonDeclRefExpr(
   FieldDecl *LambdaThisCaptureField;
   CXXRec->getCaptureFields(LambdaCaptureFields, LambdaThisCaptureField);
   const FieldDecl *FD = LambdaCaptureFields[VD];
-  Loc CXXThis =
-  svalBuilder.getCXXThis(MD, LocCtxt->getCurrentStackFrame());
-  SVal CXXThisVal = state->getSVal(CXXThis);
-  V = state->getLValue(FD, CXXThisVal);
-  if (FD->getType()->isReferenceType() &&
-  !VD->getType()->isReferenceType())
-CaptureByReference = true;
+  if (!FD) {
+// When a constant is captured, sometimes no corresponding field is
+// created in the lambda object.
+assert(VD->getType().isConstQualified());
+V = state->getLValue(VD, LocCtxt);
+  } else {
+Loc CXXThis =
+svalBuilder.getCXXThis(MD, LocCtxt->getCurrentStackFrame());
+SVal CXXThisVal = state->getSVal(CXXThis);
+V = state->getLValue(FD, CXXThisVal);
+if (FD->getType()->isReferenceType() &&
+!VD->getType()->isReferenceType())
+  CaptureByReference = true;
+  }
 } else {
   V = state->getLValue(VD, LocCtxt);
 }

Modified: cfe/trunk/test/Analysis/lambdas.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/lambdas.cpp?rev=251407&r1=251406&r2=251407&view=diff
==
--- cfe/trunk/test/Analysis/lambdas.cpp (original)
+++ cfe/trunk/test/Analysis/lambdas.cpp Tue Oct 27 08:46:39 2015
@@ -195,6 +195,21 @@ struct DontCrash {
   }
 };
 
+
+// Capture constants
+
+void captureConstants() {
+  const int i = 5;
+  [=]() {
+if (i != 5)
+  clang_analyzer_warnIfReached();
+  }();
+  [&] {
+if (i != 5)
+  clang_analyzer_warnIfReached();
+  }();
+}
+
 // CHECK: [B2 (ENTRY)]
 // CHECK:   Succs (1): B1
 // CHECK: [B1]


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


r251406 - clang-format: Undo unwanted format change done in r251405.

2015-10-27 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Tue Oct 27 08:42:08 2015
New Revision: 251406

URL: http://llvm.org/viewvc/llvm-project?rev=251406&view=rev
Log:
clang-format: Undo unwanted format change done in r251405.

Specifically, don't wrap between the {} of an empty constructor if the
"}" falls on column 81 and ConstructorInitializerAllOnOneLineOrOnePerLine
is set.

Modified:
cfe/trunk/lib/Format/ContinuationIndenter.cpp
cfe/trunk/lib/Format/FormatToken.h
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=251406&r1=251405&r2=251406&view=diff
==
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original)
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Tue Oct 27 08:42:08 2015
@@ -95,7 +95,7 @@ bool ContinuationIndenter::canBreak(cons
   assert(&Previous == Current.Previous);
   if (!Current.CanBreakBefore &&
   !(State.Stack.back().BreakBeforeClosingBrace &&
-Current.closesBlockTypeList(Style)))
+Current.closesBlockOrBlockTypeList(Style)))
 return false;
   // The opening "{" of a braced list has to be on the same line as the first
   // element if it is nested in another braced init list or function call.
@@ -139,7 +139,7 @@ bool ContinuationIndenter::mustBreak(con
   if (Current.MustBreakBefore || Current.is(TT_InlineASMColon))
 return true;
   if (State.Stack.back().BreakBeforeClosingBrace &&
-  Current.closesBlockTypeList(Style))
+  Current.closesBlockOrBlockTypeList(Style))
 return true;
   if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
 return true;
@@ -574,7 +574,7 @@ unsigned ContinuationIndenter::getNewLin
 return Current.NestingLevel == 0 ? State.FirstIndent
  : State.Stack.back().Indent;
   if (Current.isOneOf(tok::r_brace, tok::r_square) && State.Stack.size() > 1) {
-if (Current.closesBlockTypeList(Style))
+if (Current.closesBlockOrBlockTypeList(Style))
   return State.Stack[State.Stack.size() - 2].NestedBlockIndent;
 if (Current.MatchingParen &&
 Current.MatchingParen->BlockKind == BK_BracedInit)
@@ -883,15 +883,8 @@ void ContinuationIndenter::moveStatePast
   bool BreakBeforeParameter = false;
   unsigned NestedBlockIndent = std::max(State.Stack.back().StartOfFunctionCall,
 State.Stack.back().NestedBlockIndent);
-  // Generally inherit NoLineBreak from the current scope to nested scope.
-  // However, don't do this for nested blocks, e.g. lambdas as these follow
-  // different indentation rules.
-  bool NoLineBreak = State.Stack.back().NoLineBreak ||
- (Current.is(TT_TemplateOpener) &&
-  State.Stack.back().ContainsUnwrappedBuilder);
   if (Current.isOneOf(tok::l_brace, TT_ArrayInitializerLSquare)) {
-if (Current.opensBlockTypeList(Style)) {
-  NoLineBreak = false;
+if (Current.opensBlockOrBlockTypeList(Style)) {
   NewIndent = State.Stack.back().NestedBlockIndent + Style.IndentWidth;
   NewIndent = std::min(State.Column + 2, NewIndent);
   ++NewIndentLevel;
@@ -949,6 +942,15 @@ void ContinuationIndenter::moveStatePast
   }
 }
   }
+  // Generally inherit NoLineBreak from the current scope to nested scope.
+  // However, don't do this for non-empty nested blocks, dict literals and
+  // array literals as these follow different indentation rules.
+  bool NoLineBreak =
+  Current.Children.empty() &&
+  !Current.isOneOf(TT_DictLiteral, TT_ArrayInitializerLSquare) &&
+  (State.Stack.back().NoLineBreak ||
+   (Current.is(TT_TemplateOpener) &&
+State.Stack.back().ContainsUnwrappedBuilder));
   State.Stack.push_back(ParenState(NewIndent, NewIndentLevel, LastSpace,
AvoidBinPacking, NoLineBreak));
   State.Stack.back().NestedBlockIndent = NestedBlockIndent;

Modified: cfe/trunk/lib/Format/FormatToken.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/FormatToken.h?rev=251406&r1=251405&r2=251406&view=diff
==
--- cfe/trunk/lib/Format/FormatToken.h (original)
+++ cfe/trunk/lib/Format/FormatToken.h Tue Oct 27 08:42:08 2015
@@ -412,16 +412,16 @@ struct FormatToken {
 
   /// \brief Returns \c true if this tokens starts a block-type list, i.e. a
   /// list that should be indented with a block indent.
-  bool opensBlockTypeList(const FormatStyle &Style) const {
+  bool opensBlockOrBlockTypeList(const FormatStyle &Style) const {
 return is(TT_ArrayInitializerLSquare) ||
(is(tok::l_brace) &&
 (BlockKind == BK_Block || is(TT_DictLiteral) ||
  (!Style.Cpp11BracedListStyle && NestingLevel == 0)));
   }
 
-  /// \brief Same as opensBlockTypeList, but for the closing token.
-  bo

Re: [PATCH] D10802: [mips] Interrupt attribute support.

2015-10-27 Thread Simon Dardis via cfe-commits
sdardis updated this revision to Diff 38533.
sdardis added a comment.

Updated tests along the lines of what vkalintiris did for llvm.


http://reviews.llvm.org/D10802

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  lib/CodeGen/TargetInfo.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/mips-interrupt-attr-arg.c
  test/CodeGen/mips-interrupt-attr.c
  test/Sema/mips-interrupt-attr.c

Index: test/Sema/mips-interrupt-attr.c
===
--- /dev/null
+++ test/Sema/mips-interrupt-attr.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 %s -triple mips-img-elf -verify -fsyntax-only
+
+__attribute__((interrupt("EIC"))) void foo1() {} // expected-warning {{'interrupt' attribute argument not supported: EIC}}
+
+__attribute__((interrupt("eic", 1))) void foo2() {} // expected-error {{'interrupt' attribute takes no more than 1 argument}}
+
+__attribute__((interrupt("eic"))) void foo3() {}
+__attribute__((interrupt("vector=sw0"))) void foo4() {}
+__attribute__((interrupt("vector=hw0"))) void foo5() {}
+__attribute__((interrupt("vector=hw1"))) void foo6() {}
+__attribute__((interrupt("vector=hw2"))) void foo7() {}
+__attribute__((interrupt("vector=hw3"))) void foo8() {}
+__attribute__((interrupt("vector=hw4"))) void foo9() {}
+__attribute__((interrupt("vector=hw5"))) void fooa() {}
+
+__attribute__((interrupt)) void foob() {}
+__attribute__((interrupt())) void fooc() {}
+__attribute__((interrupt(""))) void food() {}
Index: test/CodeGen/mips-interrupt-attr.c
===
--- /dev/null
+++ test/CodeGen/mips-interrupt-attr.c
@@ -0,0 +1,64 @@
+// RUN: %clang_cc1 -triple mipsel-unknown-linux -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK
+
+void __attribute__ ((interrupt("vector=sw0")))
+isr_sw0 (void)
+{
+  // CHECK: define void @isr_sw0() [[SW0:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=sw1")))
+isr_sw1 (void)
+{
+  // CHECK: define void @isr_sw1() [[SW1:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw0")))
+isr_hw0 (void)
+{
+  // CHECK: define void @isr_hw0() [[HW0:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw1")))
+isr_hw1 (void)
+{
+  // CHECK: define void @isr_hw1() [[HW1:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw2")))
+isr_hw2 (void)
+{
+  // CHECK: define void @isr_hw2() [[HW2:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw3")))
+isr_hw3 (void)
+{
+  // CHECK: define void @isr_hw3() [[HW3:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw4")))
+isr_hw4 (void)
+{
+  // CHECK: define void @isr_hw4() [[HW4:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw5")))
+isr_hw5 (void)
+{
+  // CHECK: define void @isr_hw5() [[HW5:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt))
+isr_eic (void)
+{
+  // CHECK: define void @isr_eic() [[EIC:#[0-9]+]]
+}
+// CHECK: attributes [[SW0]] = { {{.*}} "interrupt"="sw0" {{.*}} }
+// CHECK: attributes [[SW1]] = { {{.*}} "interrupt"="sw1" {{.*}} }
+// CHECK: attributes [[HW0]] = { {{.*}} "interrupt"="hw0" {{.*}} }
+// CHECK: attributes [[HW1]] = { {{.*}} "interrupt"="hw1" {{.*}} }
+// CHECK: attributes [[HW2]] = { {{.*}} "interrupt"="hw2" {{.*}} }
+// CHECK: attributes [[HW3]] = { {{.*}} "interrupt"="hw3" {{.*}} }
+// CHECK: attributes [[HW4]] = { {{.*}} "interrupt"="hw4" {{.*}} }
+// CHECK: attributes [[HW5]] = { {{.*}} "interrupt"="hw5" {{.*}} }
+// CHECK: attributes [[EIC]] = { {{.*}} "interrupt"="eic" {{.*}} }
Index: test/CodeGen/mips-interrupt-attr-arg.c
===
--- /dev/null
+++ test/CodeGen/mips-interrupt-attr-arg.c
@@ -0,0 +1,8 @@
+// RUN: not %clang_cc1 -triple mipsel-unknown-linux -emit-llvm -o - %s >2 %t
+// FileCheck %s < %t
+
+; CHECK: LLVM ERROR: Functions with the interrupt attribute cannot have arguments!
+void __attribute__ ((interrupt("vector=sw0")))
+isr_sw0 (char * a)
+{
+}
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -4251,10 +4251,44 @@
   D->addAttr(UsedAttr::CreateImplicit(S.Context));
 }
 
+static void handleMipsInterruptAttr(Sema &S, Decl *D,
+const AttributeList &Attr) {
+  // Only one optional argument permitted.
+  if (Attr.getNumArgs() > 1) {
+S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments)
+<< Attr.getName() << 1;
+return;
+  }
+
+  StringRef Str;
+  SourceLocation ArgLoc;
+
+  if (Attr.getNumArgs() == 0)
+Str = "";
+  else if (!S.checkStringLiteralArgumentAttr(Attr, 0, Str, &ArgLoc))
+return;
+
+  MipsInterruptAttr::InterruptType Kind;
+  if (!MipsInterruptAttr::ConvertStrToInterruptType(Str, Kind)) {
+S.Diag(Attr.getLoc(), diag::warn_attribute_type_not_supported)
+<< Attr.getName() << Str << ArgLoc;
+return;
+  }
+
+  unsigned Index = Attr.getAttributeSpellingListIndex();
+  D->addAttr(::new (S.Co

r251405 - clang-format: Add an additional value to AlignAfterOpenBracket: AlwaysBreak.

2015-10-27 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Tue Oct 27 07:38:37 2015
New Revision: 251405

URL: http://llvm.org/viewvc/llvm-project?rev=251405&view=rev
Log:
clang-format: Add an additional value to AlignAfterOpenBracket: AlwaysBreak.

Summary:
If this option is set, clang-format will always insert a line wrap, e.g.
before the first parameter of a function call unless all parameters fit
on the same line. This obviates the need to make a decision on the
alignment itself.

Use this style for Google's JavaScript style and add some minor tweaks
to correctly handle nested blocks etc. with it. Don't use this option
for for/while loops.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

Modified:
cfe/trunk/docs/ClangFormatStyleOptions.rst
cfe/trunk/include/clang/Format/Format.h
cfe/trunk/lib/Format/ContinuationIndenter.cpp
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/lib/Format/FormatToken.cpp
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/docs/ClangFormatStyleOptions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangFormatStyleOptions.rst?rev=251405&r1=251404&r2=251405&view=diff
==
--- cfe/trunk/docs/ClangFormatStyleOptions.rst (original)
+++ cfe/trunk/docs/ClangFormatStyleOptions.rst Tue Oct 27 07:38:37 2015
@@ -150,16 +150,37 @@ the configuration (without a prefix: ``A
 **AccessModifierOffset** (``int``)
   The extra indent or outdent of access modifiers, e.g. ``public:``.
 
-**AlignAfterOpenBracket** (``bool``)
+**AlignAfterOpenBracket** (``BracketAlignmentStyle``)
   If ``true``, horizontally aligns arguments after an open bracket.
 
   This applies to round brackets (parentheses), angle brackets and square
   brackets. This will result in formattings like
 
-  .. code-block:: c++
+  Possible values:
+
+  * ``BAS_Align`` (in configuration: ``Align``)
+Align parameters on the open bracket, e.g.:
+
+.. code-block:: c++
+
+  someLongFunction(argument1,
+   argument2);
+  * ``BAS_DontAlign`` (in configuration: ``DontAlign``)
+Don't align, instead use ``ContinuationIndentWidth``, e.g.:
+
+.. code-block:: c++
+
+  someLongFunction(argument1,
+  argument2);
+  * ``BAS_AlwaysBreak`` (in configuration: ``AlwaysBreak``)
+Always break after an open bracket, if the parameters don't fit
+on a single line, e.g.:
+
+.. code-block:: c++
+
+  someLongFunction(
+  argument1, argument2);
 
-someLongFunction(argument1,
- argument2);
 
 **AlignConsecutiveAssignments** (``bool``)
   If ``true``, aligns consecutive assignments.
@@ -287,6 +308,9 @@ the configuration (without a prefix: ``A
   * ``bool IndentBraces`` Indent the wrapped braces themselves.
 
 
+**BreakAfterJavaFieldAnnotations** (``bool``)
+  Break after each annotation on a field in Java files.
+
 **BreakBeforeBinaryOperators** (``BinaryOperatorStyle``)
   The way to wrap binary operators.
 

Modified: cfe/trunk/include/clang/Format/Format.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=251405&r1=251404&r2=251405&view=diff
==
--- cfe/trunk/include/clang/Format/Format.h (original)
+++ cfe/trunk/include/clang/Format/Format.h Tue Oct 27 07:38:37 2015
@@ -43,15 +43,34 @@ struct FormatStyle {
   /// \brief The extra indent or outdent of access modifiers, e.g. \c public:.
   int AccessModifierOffset;
 
+  /// \brief Different styles for aligning after open brackets.
+  enum BracketAlignmentStyle {
+/// \brief Align parameters on the open bracket, e.g.:
+/// \code
+///   someLongFunction(argument1,
+///argument2);
+/// \endcode
+BAS_Align,
+/// \brief Don't align, instead use \c ContinuationIndentWidth, e.g.:
+/// \code
+///   someLongFunction(argument1,
+///   argument2);
+/// \endcode
+BAS_DontAlign,
+/// \brief Always break after an open bracket, if the parameters don't fit
+/// on a single line, e.g.:
+/// \code
+///   someLongFunction(
+///   argument1, argument2);
+/// \endcode
+BAS_AlwaysBreak,
+  };
+
   /// \brief If \c true, horizontally aligns arguments after an open bracket.
   ///
   /// This applies to round brackets (parentheses), angle brackets and square
-  /// brackets. This will result in formattings like
-  /// \code
-  ///   someLongFunction(argument1,
-  ///argument2);
-  /// \endcode
-  bool AlignAfterOpenBracket;
+  /// brackets.
+  BracketAlignmentStyle AlignAfterOpenBracket;
 
   /// \brief If \c true, aligns consecutive assignments.
   ///

Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Contin

Re: [PATCH] D14104: clang-format: Add an additional value to AlignAfterOpenBracket: AlwaysBreak.

2015-10-27 Thread Daniel Jasper via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL251405: clang-format: Add an additional value to 
AlignAfterOpenBracket: AlwaysBreak. (authored by djasper).

Changed prior to commit:
  http://reviews.llvm.org/D14104?vs=38524&id=38529#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14104

Files:
  cfe/trunk/docs/ClangFormatStyleOptions.rst
  cfe/trunk/include/clang/Format/Format.h
  cfe/trunk/lib/Format/ContinuationIndenter.cpp
  cfe/trunk/lib/Format/Format.cpp
  cfe/trunk/lib/Format/FormatToken.cpp
  cfe/trunk/lib/Format/TokenAnnotator.cpp
  cfe/trunk/unittests/Format/FormatTest.cpp
  cfe/trunk/unittests/Format/FormatTestJS.cpp

Index: cfe/trunk/lib/Format/FormatToken.cpp
===
--- cfe/trunk/lib/Format/FormatToken.cpp
+++ cfe/trunk/lib/Format/FormatToken.cpp
@@ -155,7 +155,7 @@
 return;
 
   // Column format doesn't really make sense if we don't align after brackets.
-  if (!Style.AlignAfterOpenBracket)
+  if (Style.AlignAfterOpenBracket == FormatStyle::BAS_DontAlign)
 return;
 
   FormatToken *ItemBegin = Token->Next;
Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -128,6 +128,18 @@
   }
 };
 
+template <> struct ScalarEnumerationTraits {
+  static void enumeration(IO &IO, FormatStyle::BracketAlignmentStyle &Value) {
+IO.enumCase(Value, "Align", FormatStyle::BAS_Align);
+IO.enumCase(Value, "DontAlign", FormatStyle::BAS_DontAlign);
+IO.enumCase(Value, "AlwaysBreak", FormatStyle::BAS_AlwaysBreak);
+
+// For backward compatibility.
+IO.enumCase(Value, "true", FormatStyle::BAS_Align);
+IO.enumCase(Value, "false", FormatStyle::BAS_DontAlign);
+  }
+};
+
 template <> struct ScalarEnumerationTraits {
   static void enumeration(IO &IO, FormatStyle::PointerAlignmentStyle &Value) {
 IO.enumCase(Value, "Middle", FormatStyle::PAS_Middle);
@@ -425,7 +437,7 @@
   LLVMStyle.Language = FormatStyle::LK_Cpp;
   LLVMStyle.AccessModifierOffset = -2;
   LLVMStyle.AlignEscapedNewlinesLeft = false;
-  LLVMStyle.AlignAfterOpenBracket = true;
+  LLVMStyle.AlignAfterOpenBracket = FormatStyle::BAS_Align;
   LLVMStyle.AlignOperands = true;
   LLVMStyle.AlignTrailingComments = true;
   LLVMStyle.AlignConsecutiveAssignments = false;
@@ -523,7 +535,7 @@
   GoogleStyle.PenaltyBreakBeforeFirstCallParameter = 1;
 
   if (Language == FormatStyle::LK_Java) {
-GoogleStyle.AlignAfterOpenBracket = false;
+GoogleStyle.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign;
 GoogleStyle.AlignOperands = false;
 GoogleStyle.AlignTrailingComments = false;
 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty;
@@ -534,11 +546,12 @@
 GoogleStyle.SpaceAfterCStyleCast = true;
 GoogleStyle.SpacesBeforeTrailingComments = 1;
   } else if (Language == FormatStyle::LK_JavaScript) {
+GoogleStyle.AlignAfterOpenBracket = FormatStyle::BAS_AlwaysBreak;
+GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+GoogleStyle.AlwaysBreakBeforeMultilineStrings = false;
 GoogleStyle.BreakBeforeTernaryOperators = false;
 GoogleStyle.MaxEmptyLinesToKeep = 3;
 GoogleStyle.SpacesInContainerLiterals = false;
-GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
-GoogleStyle.AlwaysBreakBeforeMultilineStrings = false;
   } else if (Language == FormatStyle::LK_Proto) {
 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None;
 GoogleStyle.SpacesInContainerLiterals = false;
@@ -588,7 +601,7 @@
 FormatStyle getWebKitStyle() {
   FormatStyle Style = getLLVMStyle();
   Style.AccessModifierOffset = -4;
-  Style.AlignAfterOpenBracket = false;
+  Style.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign;
   Style.AlignOperands = false;
   Style.AlignTrailingComments = false;
   Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All;
Index: cfe/trunk/lib/Format/TokenAnnotator.cpp
===
--- cfe/trunk/lib/Format/TokenAnnotator.cpp
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp
@@ -390,12 +390,8 @@
   }
 
   void updateParameterCount(FormatToken *Left, FormatToken *Current) {
-if (Current->is(TT_LambdaLSquare) ||
-(Current->is(tok::caret) && Current->is(TT_UnaryOperator)) ||
-(Style.Language == FormatStyle::LK_JavaScript &&
- Current->is(Keywords.kw_function))) {
+if (Current->is(tok::l_brace) && !Current->is(TT_DictLiteral))
   ++Left->BlockParameterCount;
-}
 if (Current->is(tok::comma)) {
   ++Left->ParameterCount;
   if (!Left->Role)
@@ -1760,7 +1756,8 @@
   if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr))
 return Line.MightBeFunctionDecl ? 50 : 500;
 
-  if (Left.is(tok::l_paren) && InFunctionDecl && Style.AlignAfterOpenBracket)
+  if (Left.is(tok::l_paren) && 

r251404 - [analyzer] Fix another crash when analyzing lambda functions.

2015-10-27 Thread Gabor Horvath via cfe-commits
Author: xazax
Date: Tue Oct 27 07:36:26 2015
New Revision: 251404

URL: http://llvm.org/viewvc/llvm-project?rev=251404&view=rev
Log:
[analyzer] Fix another crash when analyzing lambda functions.

Modified:
cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
cfe/trunk/test/Analysis/lambdas.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp?rev=251404&r1=251403&r2=251404&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp Tue Oct 27 07:36:26 2015
@@ -1022,7 +1022,8 @@ MemRegionManager::getCXXThisRegion(QualT
   // 'this' refers to a this to the enclosing scope, there is no right region 
to
   // return.
   while (!LC->inTopFrame() &&
- (!D || PT != D->getThisType(getContext())->getAs())) {
+ (!D || D->isStatic() ||
+  PT != D->getThisType(getContext())->getAs())) {
 LC = LC->getParent();
 D = dyn_cast(LC->getDecl());
   }

Modified: cfe/trunk/test/Analysis/lambdas.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/lambdas.cpp?rev=251404&r1=251403&r2=251404&view=diff
==
--- cfe/trunk/test/Analysis/lambdas.cpp (original)
+++ cfe/trunk/test/Analysis/lambdas.cpp Tue Oct 27 07:36:26 2015
@@ -186,6 +186,12 @@ struct DontCrash {
   int x;
   void f() {
 callLambda([&](){ ++x; });
+callLambdaFromStatic([&](){ ++x; });
+  }
+  
+  template
+  static void callLambdaFromStatic(T t) {
+t();
   }
 };
 


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


Re: [PATCH] D14104: clang-format: Add an additional value to AlignAfterOpenBracket: AlwaysBreak.

2015-10-27 Thread Martin Probst via cfe-commits
mprobst accepted this revision.
mprobst added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D14104



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


Re: [PATCH] D14104: clang-format: Add an additional value to AlignAfterOpenBracket: AlwaysBreak.

2015-10-27 Thread Daniel Jasper via cfe-commits
djasper updated this revision to Diff 38524.
djasper added a comment.

Extended comment.


http://reviews.llvm.org/D14104

Files:
  docs/ClangFormatStyleOptions.rst
  include/clang/Format/Format.h
  lib/Format/ContinuationIndenter.cpp
  lib/Format/Format.cpp
  lib/Format/FormatToken.cpp
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTest.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -49,7 +49,8 @@
   static void verifyFormat(
   llvm::StringRef Code,
   const FormatStyle &Style = getGoogleStyle(FormatStyle::LK_JavaScript)) {
-EXPECT_EQ(Code.str(), format(test::messUp(Code), Style));
+std::string result = format(test::messUp(Code), Style);
+EXPECT_EQ(Code.str(), result) << "Formatted:\n" << result;
   }
 };
 
@@ -278,27 +279,28 @@
"  bbb,\n"
"  ccc\n"
"];");
-  verifyFormat("var someVariable = SomeFuntion([\n"
+  verifyFormat("var someVariable = SomeFunction([\n"
"  aaa,\n"
"  bbb,\n"
"  ccc\n"
"]);");
-  verifyFormat("var someVariable = SomeFuntion([\n"
+  verifyFormat("var someVariable = SomeFunction([\n"
"  [aa, bb],\n"
"]);",
getGoogleJSStyleWithColumns(51));
-  verifyFormat("var someVariable = SomeFuntion(, [\n"
+  verifyFormat("var someVariable = SomeFunction(, [\n"
"  aaa,\n"
"  bbb,\n"
"  ccc\n"
"]);");
-  verifyFormat("var someVariable = SomeFuntion(,\n"
-   "   [\n"
-   " aaa,\n"
-   " bbb,\n"
-   " ccc\n"
-   "   ],\n"
-   "   );");
+  verifyFormat("var someVariable = SomeFunction(\n"
+   ",\n"
+   "[\n"
+   "  aaa,\n"
+   "  bbb,\n"
+   "  ccc\n"
+   "],\n"
+   ");");
 
   verifyFormat("someFunction([], {a: a});");
 }
@@ -320,14 +322,11 @@
"style: {direction: ''}\n"
"  }\n"
"};");
-  EXPECT_EQ("abc = xyz ?\n"
-"  function() {\n"
-"return 1;\n"
-"  } :\n"
-"  function() {\n"
-"return -1;\n"
-"  };",
-format("abc=xyz?function(){return 1;}:function(){return -1;};"));
+  verifyFormat("abc = xyz ? function() {\n"
+   "  return 1;\n"
+   "} : function() {\n"
+   "  return -1;\n"
+   "};");
 
   verifyFormat("var closure = goog.bind(\n"
"function() {  // comment\n"
@@ -379,17 +378,13 @@
"  someFunction();\n"
"}, this), a);");
 
-  // FIXME: This is not ideal yet.
-  verifyFormat("someFunction(goog.bind(\n"
-   " function() {\n"
-   "   doSomething();\n"
-   "   doSomething();\n"
-   " },\n"
-   " this),\n"
-   " goog.bind(function() {\n"
-   "   doSomething();\n"
-   "   doSomething();\n"
-   " }, this));");
+  verifyFormat("someFunction(goog.bind(function() {\n"
+   "  doSomething();\n"
+   "  doSomething();\n"
+   "}, this), goog.bind(function() {\n"
+   "  doSomething();\n"
+   "  doSomething();\n"
+   "}, this));");
 
   // FIXME: This is bad, we should be wrapping before "function() {".
   verifyFormat("someFunction(function() {\n"
@@ -472,16 +467,16 @@
"  doFoo();\n"
"  doBaz();\n"
"});\n");
-  // FIXME: Here, we should probably break right after the "(" for consistency.
-  verifyFormat("promise.then([],\n"
-   " function success() {\n"
-   "   doFoo();\n"
-   "   doBar();\n"
-   " },\n"
-   " function error() {\n"
-  

  1   2   >