[PATCH] D32592: [Analyzer] Iterator Checker - Part 1: Minimal Checker for a Simple Test Case

2017-05-25 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Sorry, got carried away by GSoC and critical stuff...

In https://reviews.llvm.org/D32592#749613, @baloghadamsoftware wrote:

> In https://reviews.llvm.org/D32592#747132, @NoQ wrote:
>
> > Then, in methods that deal with iterator `SVal`s directly, i wish we had 
> > hints explaining what's going on in these ~7 cases. In my opinion, that'd 
> > greatly help people understand the code later, and it'd help us understand 
> > how to avoid this variety and provide checker authors with a better API as 
> > soon as we get to this, so it's the biggest concern for me about this 
> > checker.
>
>
> I am not sure which method do you mean? I think here the crucial functions 
> are the setIteratorPosition() and the getIteratorPosition() functions which 
> provide a common way to handle all these SVals.


Hmm, i think i mostly mean `evalAssume()` and the comparisons mechanism. You're 
having multiple cases, like:
(1) if the assumed value is a BinarySymExpr for which there's a stored 
comparison (good for type-II iterators),
(2) if it's a symbol that was conjured by a conservatively evaluated comparison 
operator (here you lookup the opcode from the referenced expression) for which 
there's a stored comparison (good for type-III iterators),
(3) if it's a binary symbolic expression of form ($x == 0) or ($x != 0) where 
$x is one of (1) or (2).

I believe that the whole idea behind storing comparison results should have 
high-level comments explaining how it works (being tricky but solid - 
essentially it extends the constraint manager, taking over when handling 
iterator constraints, which sounds like the right thing to do).

I think we should land after that; i only have comment-related comments now :)




Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:131
+
+// Strcutre fo recording iterator comparisons. We needed to retrieve the
+// original comparison expression in assumptions.

Strcutre -> Structure :)



Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:294-297
+// Assumption: if return value is an iterator which is not yet bound to a
+// container, then look for the first iterator argument, and
+// bind the return value to the same container. This approach
+// works for STL algorithms.

baloghadamsoftware wrote:
> NoQ wrote:
> > baloghadamsoftware wrote:
> > > NoQ wrote:
> > > > I guess this deserves a test case (we could split this out as a 
> > > > separate feature as well).
> > > > 
> > > > I'm also afraid that we can encounter false positives on functions that 
> > > > are not STL algorithms. I suggest doing this by default only for STL 
> > > > functions (or maybe for other specific classes of functions for which 
> > > > we know it works this way) and do this for other functions under a 
> > > > checker option (i.e. something like `-analyzer-config 
> > > > IteratorChecker:AggressiveAssumptions=true`, similar to 
> > > > `MallocChecker`'s "Optimistic" option).
> > > I will check whether this piece of code could be moved in a later part of 
> > > the checker. However, I suggest to first wait for the first false 
> > > positives before we introduce such an option. This far the false 
> > > positives in my initial tests had different reasons, not this one.
> > Unfortunately, we've had a poor experience with this approach in other 
> > checkers. You never know, and it seems that it's always better to have a 
> > safe fallback mode available under a flag, because if a few classes of 
> > false positives are found, and we are forced to reduce the checker to a 
> > safer behavior, it'd be hard to remember all the places where unsafe 
> > heuristics were used.
> I think this heuristic is well marked by the comment, easy to find if it 
> causes false positives. When I started working on Clang (Tidy first) 
> reviewers discouraged me to add options before experiencing false positives.
Well, it's a bit sad to say, but that's one of the things that we didn't agree 
upon with clang-tidy, i guess; historically, they started as a lint-like tool 
that produces nice-to-fix-anyway kinds of warnings (having nice bug-finding 
checks nowadays), and we always kept positioning ourselves as a "quiet" tool 
that reports only real critical bugs for users that never would be annoyed 
immensely by every single false positive (doesn't make this true though), and 
it makes us nervous about every single potential false positive class.

I guess we could leave that as a task for later, with a "FIXME: Add a more 
conservative mode".



Comment at: test/Analysis/iterator-range.cpp:1-2
+// RUN: %clang_analyze_cc1 -std=c++11 
-analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorRange 
-analyzer-eagerly-assume -analyzer-config c++-container-inlining=false %s 
-verify
+// RUN: %clang_analyze_cc1 -std=c++11 
-analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorRange 

[PATCH] D30837: [libcxx] Support for shared_ptr

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

LGTM after addressing inline comments. Sorry for the delay.




Comment at: include/memory:3663
+template 
+struct rebind
+{

This rebind isn't getting selected because it's private, but 
`std::allocator_traits` is doing the rebinding instead.

Please make the rebinding public.


https://reviews.llvm.org/D30837



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


r303844 - [OpenCL] Added regression test on invalid vector initialization.

2017-05-25 Thread Egor Churaev via cfe-commits
Author: echuraev
Date: Thu May 25 01:55:02 2017
New Revision: 303844

URL: http://llvm.org/viewvc/llvm-project?rev=303844&view=rev
Log:
[OpenCL] Added regression test on invalid vector initialization.

Summary: This patch increases code coverage.

Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: cfe-commits, bader, yaxunl

Differential Revision: https://reviews.llvm.org/D33489

Modified:
cfe/trunk/test/SemaOpenCL/vector_literals_invalid.cl

Modified: cfe/trunk/test/SemaOpenCL/vector_literals_invalid.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/vector_literals_invalid.cl?rev=303844&r1=303843&r2=303844&view=diff
==
--- cfe/trunk/test/SemaOpenCL/vector_literals_invalid.cl (original)
+++ cfe/trunk/test/SemaOpenCL/vector_literals_invalid.cl Thu May 25 01:55:02 
2017
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify %s 
+// RUN: %clang_cc1 -verify %s
 
 typedef __attribute__(( ext_vector_type(4) ))  float float4;
 typedef __attribute__(( ext_vector_type(4) ))  int int4;
@@ -10,4 +10,5 @@ void vector_literals_invalid()
   int4 b = (int4)(1,2,3,4,5); // expected-error{{excess elements in vector}}
   ((float4)(1.0f))++; // expected-error{{cannot increment value of type 
'float4'}}
   int8 d = (int8)(a,(float4)(1)); // expected-error{{initializing 'int' with 
an expression of incompatible type 'float4'}}
+  ((int4)(0)).x = 8; // expected-error{{expression is not assignable}}
 }


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


r303846 - [OpenCL] reserve_id_t cannot be used as argument to kernel function

2017-05-25 Thread Egor Churaev via cfe-commits
Author: echuraev
Date: Thu May 25 02:18:37 2017
New Revision: 303846

URL: http://llvm.org/viewvc/llvm-project?rev=303846&view=rev
Log:
[OpenCL] reserve_id_t cannot be used as argument to kernel function

Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, cfe-commits, bader

Differential Revision: https://reviews.llvm.org/D33483

Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=303846&r1=303845&r2=303846&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu May 25 02:18:37 2017
@@ -7920,10 +7920,7 @@ static OpenCLParamType getOpenCLKernelPa
   if (PT->isImageType())
 return PtrKernelParam;
 
-  if (PT->isBooleanType())
-return InvalidKernelParam;
-
-  if (PT->isEventT())
+  if (PT->isBooleanType() || PT->isEventT() || PT->isReserveIDT())
 return InvalidKernelParam;
 
   // OpenCL extension spec v1.2 s9.5:

Modified: cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl?rev=303846&r1=303845&r2=303846&view=diff
==
--- cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl (original)
+++ cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl Thu May 25 02:18:37 2017
@@ -3,6 +3,11 @@
 global pipe int gp;// expected-error {{type '__global read_only 
pipe int' can only be used as a function parameter in OpenCL}}
 global reserve_id_t rid;  // expected-error {{the '__global 
reserve_id_t' type cannot be used to declare a program scope variable}}
 
+extern pipe write_only int get_pipe(); // expected-error {{type '__global 
write_only pipe int ()' can only be used as a function parameter in OpenCL}}
+
+kernel void test_invalid_reserved_id(reserve_id_t ID) { // expected-error 
{{'reserve_id_t' cannot be used as the type of a kernel parameter}}
+}
+
 void test1(pipe int *p) {// expected-error {{pipes packet types cannot be of 
reference type}}
 }
 void test2(pipe p) {// expected-error {{missing actual type specifier for 
pipe}}


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


[PATCH] D33538: [coroutines] Support "coroutines" feature in module map requires clause

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments.



Comment at: test/Modules/requires-coroutines.mm:1
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules 
-fimplicit-module-maps -F %S/Inputs %s -verify

Should this test be called `requires-coroutines.cpp` or is using Obj-C++ a 
correct thing to do here?


https://reviews.llvm.org/D33538



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


[PATCH] D33340: [libcxx] [test] Add string nullptr asserts to erase functions.

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

Sorry for the delay reviewing such a simple change.


https://reviews.llvm.org/D33340



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


[PATCH] D33290: [libcxx] [test] Remove workaround for C1XX conversion-to-nullptr bug

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

LGTM.


https://reviews.llvm.org/D33290



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


[PATCH] D33290: [libcxx] [test] Remove workaround for C1XX conversion-to-nullptr bug

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

@CaseyCarter Changes like this are good for post-commit review (ie just commit 
it)


https://reviews.llvm.org/D33290



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


[PATCH] D33340: [libcxx] [test] Add string nullptr asserts to erase functions.

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

@BillyONeal Changes like this are good for post-commit review (ie just commit 
it). Adding clearly correct assertions and test cases is never an objectionable 
thing.


https://reviews.llvm.org/D33340



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


[PATCH] D32671: [libcxx] [test] variant: test coverage for P0602 extension

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments.



Comment at: 
test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp:389
+template
+constexpr bool triviality_test =
+  std::is_trivially_copy_assignable>::value ==

`triviality_test` should also compare to an explicitly specified expected 
result, along with checking for consistency between variant and its input types.



Comment at: 
test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp:168
+void test_triviality_extension() {
+#if defined(_MSVC_STL_VER)
+  static_assert(triviality_test, "");

These tests pass with libc++ too, so please add `|| defined(_LIBCPP_VERSION)`



Comment at: 
test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp:206
+void test_triviality_extension() {
+#if defined(_MSVC_STL_VER)
+  static_assert(triviality_test, "");

These tests pass with libc++ too, so please add `|| defined(_LIBCPP_VERSION)`


https://reviews.llvm.org/D32671



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


[PATCH] D33525: [ThinLTO] Migrate ThinLTOBitcodeWriter to the new PM.

2017-05-25 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc added a comment.

(focusing on the LLVM side of this review for now)

Can you add an LLVM-based test? Can you add this to 
`lib/Passes/PassRegistry.def`?




Comment at: llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp:423
+
+class AARGetter {
+  FunctionAnalysisManager &AM;

timshen wrote:
> mehdi_amini wrote:
> > Can't you do it with a lambda?
> I can, except that AAR needs to be allocated outside of the lambda, on the 
> stack:
> 
> Optional AAR;
> auto F = [&AAR](Function &) -> AAResults& { ... };
> 
> (AAR can't be captured by value, since AAResults is not copyable) this way 
> AAR out-lives the lambda, and I feel less readable.
You don't need to keep a copy though... You can directly expose the reference 
returned from the `FunctionAnalysisManager` -- that reference will stay alive 
until the result is invalidated. So this will become something more like:

  [&FAM](Function &F) { return FAM.getResult(F); }


https://reviews.llvm.org/D33525



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


[PATCH] D33470: [clang-tidy] Add misc-default-numerics

2017-05-25 Thread Piotr Padlewski via Phabricator via cfe-commits
Prazek updated this revision to Diff 100216.
Prazek marked 8 inline comments as done.
Prazek added a comment.

- Thanks for the review Aaron, that is much better.


https://reviews.llvm.org/D33470

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/DefaultNumericsCheck.cpp
  clang-tidy/misc/DefaultNumericsCheck.h
  clang-tidy/misc/MiscTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-default-numerics.rst
  test/clang-tidy/misc-default-numerics.cpp

Index: test/clang-tidy/misc-default-numerics.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-default-numerics.cpp
@@ -0,0 +1,42 @@
+// RUN: %check_clang_tidy %s misc-default-numerics %t
+
+namespace std {
+
+template 
+struct numeric_limit {
+  static T min() { return T(); }
+  static T max() { return T(); }
+};
+
+template <>
+struct numeric_limit {
+  static int min() { return -1; }
+  static int max() { return 1; }
+};
+
+} // namespace std
+
+class MyType {};
+template 
+class MyTemplate {};
+
+void test() {
+  auto x = std::numeric_limit::min();
+
+  auto y = std::numeric_limit::min();
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: 'std::numeric_limits::min' called with type 'MyType'; no such specialization exists, so the default value for that type is returned
+
+  auto z = std::numeric_limit>::max();
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: 'std::numeric_limits::max' called with type 'MyTemplate';
+}
+
+template 
+void fun() {
+  auto x = std::numeric_limit::min();
+}
+
+void testTemplate() {
+  fun();
+  // FIXME: This should generate warning with backtrace.
+  fun;
+}
Index: docs/clang-tidy/checks/misc-default-numerics.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/misc-default-numerics.rst
@@ -0,0 +1,23 @@
+.. title:: clang-tidy - misc-default-numerics
+
+misc-default-numerics
+=
+
+This check flags usages of ``std::numeric_limits::{min,max}()`` for
+unspecialized types. It is dangerous because the calls return ``T()``
+in this case, which is unlikely to represent the minimum or maximum value for
+the type.
+
+Consider scenario:
+.. code-block:: c++
+
+  // 1. Have a:
+  typedef long long BigInt
+
+  // 2. Use
+  std::numeric_limits::min()
+
+  // 3. Replace the BigInt typedef with class implementing BigIntegers
+  class BigInt { ;;; };
+
+  // 4. Your code continues to compile, but the call to min() returns BigInt{}
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -75,6 +75,7 @@
misc-assert-side-effect
misc-bool-pointer-implicit-conversion
misc-dangling-handle
+   misc-default-numerics
misc-definitions-in-headers
misc-fold-init-type
misc-forward-declaration-namespace
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -71,7 +71,11 @@
   `_ check
 
   Allow custom memory management functions to be considered as well.
-  
+
+- New `misc-default-numerics
+  `_ check
+  Finds uses of ``std::numeric_limit`` for unspecialized types
+
 - New `misc-forwarding-reference-overload
   `_ check
 
Index: clang-tidy/misc/MiscTidyModule.cpp
===
--- clang-tidy/misc/MiscTidyModule.cpp
+++ clang-tidy/misc/MiscTidyModule.cpp
@@ -14,6 +14,7 @@
 #include "AssertSideEffectCheck.h"
 #include "BoolPointerImplicitConversionCheck.h"
 #include "DanglingHandleCheck.h"
+#include "DefaultNumericsCheck.h"
 #include "DefinitionsInHeadersCheck.h"
 #include "FoldInitTypeCheck.h"
 #include "ForwardDeclarationNamespaceCheck.h"
@@ -66,6 +67,7 @@
 CheckFactories.registerCheck("misc-argument-comment");
 CheckFactories.registerCheck(
 "misc-assert-side-effect");
+CheckFactories.registerCheck("misc-default-numerics");
 CheckFactories.registerCheck(
 "misc-forwarding-reference-overload");
 CheckFactories.registerCheck("misc-misplaced-const");
Index: clang-tidy/misc/DefaultNumericsCheck.h
===
--- /dev/null
+++ clang-tidy/misc/DefaultNumericsCheck.h
@@ -0,0 +1,37 @@
+//===--- DefaultNumericsCheck.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

[PATCH] D33353: [OpenCL] An error shall occur if any scalar operand has greater rank than the type of the vector element

2017-05-25 Thread Egor Churaev via Phabricator via cfe-commits
echuraev updated this revision to Diff 100219.
echuraev marked 2 inline comments as done.

https://reviews.llvm.org/D33353

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaExpr.cpp
  test/SemaOpenCL/arithmetic-conversions.cl
  test/SemaOpenCL/cond.cl

Index: test/SemaOpenCL/cond.cl
===
--- test/SemaOpenCL/cond.cl
+++ test/SemaOpenCL/cond.cl
@@ -89,7 +89,7 @@
 
 float2 ntest05(int2 C, int2 X, float Y)
 {
-  return C ? X : Y; // expected-error {{cannot convert between vector values of different size ('int2' (vector of 2 'int' values) and 'float')}}
+  return C ? X : Y; // expected-error {{scalar operand type has greater rank than the type of the vector element. ('int2' (vector of 2 'int' values) and 'float'}}
 }
 
 char2 ntest06(int2 C, char2 X, char2 Y)
Index: test/SemaOpenCL/arithmetic-conversions.cl
===
--- /dev/null
+++ test/SemaOpenCL/arithmetic-conversions.cl
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2
+
+typedef float float2 __attribute__((ext_vector_type(2)));
+typedef long long2 __attribute__((ext_vector_type(2)));
+typedef int int2 __attribute__((ext_vector_type(2)));
+
+kernel void foo1(float2 in, global float2 *out) { *out = in + 0.5;} // expected-error {{scalar operand type has greater rank than the type of the vector element. ('float2' (vector of 2 'float' values) and 'double')}}
+
+kernel void foo2(float2 in, global float2 *out) { *out = 0.5 + in;} // expected-error {{scalar operand type has greater rank than the type of the vector element. ('double' and 'float2' (vector of 2 'float' values))}}
+
+kernel void foo3(float2 in, global float2 *out) { *out = 0.5f + in;}
+
+kernel void foo4(long2 in, global long2 *out) { *out = 5 + in;}
+
+kernel void foo5(float2 in, global float2 *out) {
+float* f;
+*out = f + in; // expected-error{{cannot convert between vector and non-scalar values ('float *' and 'float2' (vector of 2 'float' values))}}
+}
+
+kernel void foo6(int2 in, global int2 *out) {
+int* f;
+*out = f + in; // expected-error{{cannot convert between vector and non-scalar values ('int *' and 'int2' (vector of 2 'int' values))}}
+}
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -8064,28 +8064,38 @@
 /// rank; for C, Obj-C, and C++ we allow any real scalar conversion except
 /// for float->int.
 ///
+/// OpenCL V2.0 6.2.6.p2:
+/// An error shall occur if any scalar operand type has greater rank
+/// than the type of the vector element.
+///
 /// \param scalar - if non-null, actually perform the conversions
 /// \return true if the operation fails (but without diagnosing the failure)
 static bool tryVectorConvertAndSplat(Sema &S, ExprResult *scalar,
  QualType scalarTy,
  QualType vectorEltTy,
- QualType vectorTy) {
+ QualType vectorTy,
+ unsigned &DiagID) {
   // The conversion to apply to the scalar before splatting it,
   // if necessary.
   CastKind scalarCast = CK_Invalid;
   
   if (vectorEltTy->isIntegralType(S.Context)) {
-if (!scalarTy->isIntegralType(S.Context))
+if (S.getLangOpts().OpenCL && (scalarTy->isRealFloatingType() ||
+(scalarTy->isIntegerType() &&
+ S.Context.getIntegerTypeOrder(vectorEltTy, scalarTy) < 0))) {
+  DiagID = diag::err_opencl_scalar_type_rank_greater_than_vector_type;
   return true;
-if (S.getLangOpts().OpenCL &&
-S.Context.getIntegerTypeOrder(vectorEltTy, scalarTy) < 0)
+}
+if (!scalarTy->isIntegralType(S.Context))
   return true;
 scalarCast = CK_IntegralCast;
   } else if (vectorEltTy->isRealFloatingType()) {
 if (scalarTy->isRealFloatingType()) {
   if (S.getLangOpts().OpenCL &&
-  S.Context.getFloatingTypeOrder(vectorEltTy, scalarTy) < 0)
+  S.Context.getFloatingTypeOrder(vectorEltTy, scalarTy) < 0) {
+DiagID = diag::err_opencl_scalar_type_rank_greater_than_vector_type;
 return true;
+  }
   scalarCast = CK_FloatingCast;
 }
 else if (scalarTy->isIntegralType(S.Context))
@@ -8331,10 +8341,12 @@
 
   // If there's a vector type and a scalar, try to convert the scalar to
   // the vector element type and splat.
+  unsigned DiagID = diag::err_typecheck_vector_not_convertable;
   if (!RHSVecType) {
 if (isa(LHSVecType)) {
   if (!tryVectorConvertAndSplat(*this, &RHS, RHSType,
-LHSVecType->getElementType(), LHSType))
+LHSVecType->getElementType(), LHSType,
+DiagID))
 return LHSType;
 } else {
   if (!tryGCCVectorConvertAndSplat(*this, &RHS,

[PATCH] D33448: [CodeGen] Add thumb-mode to target-features for arm/thumb triples.

2017-05-25 Thread Florian Hahn via Phabricator via cfe-commits
fhahn updated this revision to Diff 100222.
fhahn retitled this revision from "[CodeGen] Add thumb-mode to function 
target-features for arm/thumb triples." to "[CodeGen] Add thumb-mode to 
target-features for arm/thumb triples.".
fhahn edited the summary of this revision.
fhahn added a comment.

Move code to lib/Basic/Targets.cpp


https://reviews.llvm.org/D33448

Files:
  lib/Basic/Targets.cpp
  test/CodeGen/arm-long-calls.c
  test/CodeGen/arm-no-movt.c
  test/CodeGen/arm-target-features.c
  test/CodeGen/arm-thumb-mode-target-feature.c

Index: test/CodeGen/arm-thumb-mode-target-feature.c
===
--- /dev/null
+++ test/CodeGen/arm-thumb-mode-target-feature.c
@@ -0,0 +1,33 @@
+// REQUIRES: arm-registered-target
+
+// RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -emit-llvm -o - %s | FileCheck --check-prefix THUMB %s
+// RUN: %clang_cc1 -triple thumbv7eb-linux-gnueabihf -emit-llvm -o - %s | FileCheck --check-prefix THUMB %s
+// RUN: %clang -target armv7-linux-gnueabihf -mthumb -S -emit-llvm -o - %s | FileCheck --check-prefix THUMB-CLANG %s
+// RUN: %clang_cc1 -triple armv7-linux-gnueabihf -emit-llvm -o - %s | FileCheck --check-prefix ARM %s
+// RUN: %clang_cc1 -triple armv7eb-linux-gnueabihf -emit-llvm -o - %s | FileCheck --check-prefix ARM %s
+
+void t1() {}
+
+ __attribute__((target("no-thumb-mode")))
+void t2() {}
+
+ __attribute__((target("thumb-mode")))
+void t3() {}
+
+// THUMB: void @t1() [[ThumbAttr:#[0-7]]]
+// THUMB: void @t2() [[NoThumbAttr:#[0-7]]]
+// THUMB: void @t3() [[ThumbAttr:#[0-7]]]
+// THUMB: attributes [[ThumbAttr]] = { {{.*}} "target-features"="+thumb-mode"
+// THUMB: attributes [[NoThumbAttr]] = { {{.*}} "target-features"="-thumb-mode"
+//
+// THUMB-CLANG: void @t1() [[ThumbAttr:#[0-7]]]
+// THUMB-CLANG: void @t2() [[NoThumbAttr:#[0-7]]]
+// THUMB-CLANG: void @t3() [[ThumbAttr:#[0-7]]]
+// THUMB-CLANG: attributes [[ThumbAttr]] = { {{.*}} "target-features"="{{.*}}+thumb-mode
+// THUMB-CLANG: attributes [[NoThumbAttr]] = { {{.*}} "target-features"="{{.*}}-thumb-mode
+
+// ARM: void @t1() [[NoThumbAtr:#[0-7]]]
+// ARM: void @t2() [[NoThumbAttr:#[0-7]]]
+// ARM: void @t3() [[ThumbAttr:#[0-7]]]
+// ARM: attributes [[NoThumbAttr]] = { {{.*}} "target-features"="-thumb-mode"
+// ARM: attributes [[ThumbAttr]] = { {{.*}} "target-features"="+thumb-mode"
Index: test/CodeGen/arm-target-features.c
===
--- test/CodeGen/arm-target-features.c
+++ test/CodeGen/arm-target-features.c
@@ -1,65 +1,63 @@
 // REQUIRES: arm-registered-target
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a8 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3
-// CHECK-VFP3: "target-features"="+dsp,+neon,+vfp3"
-
-
-// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-a9 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-FP16
-// CHECK-VFP3-FP16: "target-features"="+dsp,+fp16,+neon,+vfp3"
+// CHECK-VFP3: "target-features"="+dsp,+neon,+thumb-mode
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a5 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4
-// CHECK-VFP4: "target-features"="+dsp,+neon,+vfp4"
+// CHECK-VFP4: "target-features"="+dsp,+neon,+thumb-mode,+vfp4"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a7 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-a12 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
-// RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a15 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
-// RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a17 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple thumbv7s-linux-gnueabi -target-cpu swift -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu krait -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
-// CHECK-VFP4-DIV: "target-features"="+dsp,+hwdiv,+hwdiv-arm,+neon,+vfp4"
+// CHECK-VFP4-DIV: "target-features"="+dsp,+hwdiv,+hwdiv-arm,+neon,+thumb-mode,+vfp4"
 
+// RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a15 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV-ARM
+// RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a17 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV-ARM
+// CHECK-VFP4-DIV-ARM: "target-features"="+dsp,+hwdiv,+hwdiv-arm,+neon,+vfp4,-thumb-mode"
 
 // RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a32 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabi

[PATCH] D33448: [CodeGen] Add thumb-mode to target-features for arm/thumb triples.

2017-05-25 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

@echristo lib/Basic/Targets.cpp is indeed a much better place to add thumb-mode 
to the target features, thanks for pointing me in the right direction!


https://reviews.llvm.org/D33448



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


[clang-tools-extra] r303849 -

2017-05-25 Thread Florian Gross via cfe-commits
Author: fgross
Date: Thu May 25 06:43:06 2017
New Revision: 303849

URL: http://llvm.org/viewvc/llvm-project?rev=303849&view=rev
Log: (empty)

Modified:

clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp?rev=303849&r1=303848&r2=303849&view=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp 
(original)
+++ 
clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp 
Thu May 25 06:43:06 2017
@@ -167,7 +167,7 @@ void BracesAroundStatementsCheck::check(
   }
 }
 
-/// Find location of right parenthesis closing condition
+/// Find location of right parenthesis closing condition.
 template 
 SourceLocation
 BracesAroundStatementsCheck::findRParenLoc(const IfOrWhileStmt *S,


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


RE: [clang-tools-extra] r303849 -

2017-05-25 Thread Florian Gross via cfe-commits
Just a commit access test with messed up log message.

- Florian

-Original Message-
From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of 
Florian Gross via cfe-commits
Sent: Thursday, May 25, 2017 1:43 PM
To: cfe-commits@lists.llvm.org
Subject: [clang-tools-extra] r303849 -

Author: fgross
Date: Thu May 25 06:43:06 2017
New Revision: 303849

URL: http://llvm.org/viewvc/llvm-project?rev=303849&view=rev
Log: (empty)

Modified:

clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp?rev=303849&r1=303848&r2=303849&view=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp 
(original)
+++ 
clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp 
Thu May 25 06:43:06 2017
@@ -167,7 +167,7 @@ void BracesAroundStatementsCheck::check(
   }
 }
 
-/// Find location of right parenthesis closing condition
+/// Find location of right parenthesis closing condition.
 template 
 SourceLocation
 BracesAroundStatementsCheck::findRParenLoc(const IfOrWhileStmt *S,


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

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


[PATCH] D33534: [coroutines] Diagnose when promise types fail to declare either return_void or return_value.

2017-05-25 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov accepted this revision.
GorNishanov added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D33534



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


[PATCH] D33536: [coroutines] Bump __cpp_coroutines version

2017-05-25 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov accepted this revision.
GorNishanov added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D33536



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


[PATCH] D33547: Updated getting started guide for visual studio + cmake

2017-05-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman created this revision.

It took me a while to track this down and I figured I'd save someone else the 
time. By default, CMake uses the 32-bit toolchain on Windows, even if 
generating a 64-bit solution. Given the size of Clang's code base, this can 
lead to quite a few link errors with the linker running out of memory. If you 
pass -Thost=x64 when generating the Visual Studio solution, then the resulting 
project files will use the 64-bit toolchain and the toolchain no longer runs 
out of memory.

The same wording is being used in https://reviews.llvm.org/D33546 for LLVM's 
side of things.


https://reviews.llvm.org/D33547

Files:
  www/get_started.html


Index: www/get_started.html
===
--- www/get_started.html
+++ www/get_started.html
@@ -196,6 +196,10 @@
 mkdir build (for building without polluting the source 
dir)
 cd build
 If you are using Visual Studio 2013:  cmake -G "Visual Studio 12" 
..\llvm
+By default, the Visual Studio project files generated by CMake use the
+ 32-bit toolset. If you are developing on a 64-bit version of Windows and
+ want to use the 64-bit toolset, pass the ``-Thost=x64`` flag when
+ generating the Visual Studio solution. This requires CMake 3.8.0 or 
later.
 See the http://www.llvm.org/docs/CMake.html";>LLVM CMake 
guide for
 more information on other configuration options for CMake.
 The above, if successful, will have created an LLVM.sln file in the


Index: www/get_started.html
===
--- www/get_started.html
+++ www/get_started.html
@@ -196,6 +196,10 @@
 mkdir build (for building without polluting the source dir)
 cd build
 If you are using Visual Studio 2013:  cmake -G "Visual Studio 12" ..\llvm
+By default, the Visual Studio project files generated by CMake use the
+ 32-bit toolset. If you are developing on a 64-bit version of Windows and
+ want to use the 64-bit toolset, pass the ``-Thost=x64`` flag when
+ generating the Visual Studio solution. This requires CMake 3.8.0 or later.
 See the http://www.llvm.org/docs/CMake.html";>LLVM CMake guide for
 more information on other configuration options for CMake.
 The above, if successful, will have created an LLVM.sln file in the
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r303851 - [CodeGen] Pessimize aliasing for member unions (and may-alias) objects

2017-05-25 Thread Krzysztof Parzyszek via cfe-commits
Author: kparzysz
Date: Thu May 25 07:55:47 2017
New Revision: 303851

URL: http://llvm.org/viewvc/llvm-project?rev=303851&view=rev
Log:
[CodeGen] Pessimize aliasing for member unions (and may-alias) objects

Use the TBAA info of the omnipotent char for these objects.

Differential Revision: https://reviews.llvm.org/D33328

Added:
cfe/trunk/test/CodeGen/union-tbaa1.c
cfe/trunk/test/CodeGenCXX/union-tbaa2.cpp
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=303851&r1=303850&r2=303851&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Thu May 25 07:55:47 2017
@@ -1432,11 +1432,12 @@ llvm::Value *CodeGenFunction::EmitLoadOf
 Load->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
   }
   if (TBAAInfo) {
-llvm::MDNode *TBAAPath = CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo,
-  TBAAOffset);
-if (TBAAPath)
-  CGM.DecorateInstructionWithTBAA(Load, TBAAPath,
-  false /*ConvertTypeToTag*/);
+bool MayAlias = BaseInfo.getMayAlias();
+llvm::MDNode *TBAA = MayAlias
+? CGM.getTBAAInfo(getContext().CharTy)
+: CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo, TBAAOffset);
+if (TBAA)
+  CGM.DecorateInstructionWithTBAA(Load, TBAA, MayAlias);
   }
 
   if (EmitScalarRangeCheck(Load, Ty, Loc)) {
@@ -1522,11 +1523,12 @@ void CodeGenFunction::EmitStoreOfScalar(
 Store->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
   }
   if (TBAAInfo) {
-llvm::MDNode *TBAAPath = CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo,
-  TBAAOffset);
-if (TBAAPath)
-  CGM.DecorateInstructionWithTBAA(Store, TBAAPath,
-  false /*ConvertTypeToTag*/);
+bool MayAlias = BaseInfo.getMayAlias();
+llvm::MDNode *TBAA = MayAlias
+? CGM.getTBAAInfo(getContext().CharTy)
+: CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo, TBAAOffset);
+if (TBAA)
+  CGM.DecorateInstructionWithTBAA(Store, TBAA, MayAlias);
   }
 }
 
@@ -3535,6 +3537,11 @@ LValue CodeGenFunction::EmitLValueForFie
 getFieldAlignmentSource(BaseInfo.getAlignmentSource());
   LValueBaseInfo FieldBaseInfo(fieldAlignSource, BaseInfo.getMayAlias());
 
+  const RecordDecl *rec = field->getParent();
+  if (rec->isUnion() || rec->hasAttr())
+FieldBaseInfo.setMayAlias(true);
+  bool mayAlias = FieldBaseInfo.getMayAlias();
+
   if (field->isBitField()) {
 const CGRecordLayout &RL =
   CGM.getTypes().getCGRecordLayout(field->getParent());
@@ -3556,11 +3563,7 @@ LValue CodeGenFunction::EmitLValueForFie
 return LValue::MakeBitfield(Addr, Info, fieldType, FieldBaseInfo);
   }
 
-  const RecordDecl *rec = field->getParent();
   QualType type = field->getType();
-
-  bool mayAlias = rec->hasAttr();
-
   Address addr = base.getAddress();
   unsigned cvr = base.getVRQualifiers();
   bool TBAAPath = CGM.getCodeGenOpts().StructPathTBAA;

Added: cfe/trunk/test/CodeGen/union-tbaa1.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/union-tbaa1.c?rev=303851&view=auto
==
--- cfe/trunk/test/CodeGen/union-tbaa1.c (added)
+++ cfe/trunk/test/CodeGen/union-tbaa1.c Thu May 25 07:55:47 2017
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 %s -triple hexagon-unknown-elf -O2 -emit-llvm -o - | 
FileCheck %s
+
+typedef union __attribute__((aligned(4))) {
+  unsigned short uh[2];
+  unsigned uw;
+} vect32;
+
+void bar(vect32 p[][2]);
+
+// CHECK-LABEL: define void @fred
+void fred(unsigned Num, int Vec[2], int *Index, int Arr[4][2]) {
+  vect32 Tmp[4][2];
+// Generate tbaa for the load of Index:
+// CHECK: load i32, i32* %Index{{.*}}tbaa
+// But no tbaa for the two stores:
+// CHECK: %uw[[UW1:[0-9]*]] = getelementptr
+// CHECK: store{{.*}}%uw[[UW1]]
+// CHECK: tbaa ![[OCPATH:[0-9]+]]
+// There will be a load after the store, and it will use tbaa. Make sure
+// the check-not above doesn't find it:
+// CHECK: load
+  Tmp[*Index][0].uw = Arr[*Index][0] * Num;
+// CHECK: %uw[[UW2:[0-9]*]] = getelementptr
+// CHECK: store{{.*}}%uw[[UW2]]
+// CHECK: tbaa ![[OCPATH]]
+  Tmp[*Index][1].uw = Arr[*Index][1] * Num;
+// Same here, don't generate tbaa for the loads:
+// CHECK: %uh[[UH1:[0-9]*]] = bitcast %union.vect32
+// CHECK: %arrayidx[[AX1:[0-9]*]] = getelementptr{{.*}}%uh[[UH1]]
+// CHECK: load i16, i16* %arrayidx[[AX1]]
+// CHECK: tbaa ![[OCPATH]]
+// CHECK: store
+  Vec[0] = Tmp[*Index][0].uh[1];
+// CHECK: %uh[[UH2:[0-9]*]] = bitcast %union.vect32
+// CHECK: %arrayidx[[AX2:[0-9]*]] = getelementptr{{.*}}%uh[[UH2]]
+// CHECK: load i16, i16* %arrayidx[[AX2]]
+// CHECK: tbaa ![[OCPATH]]
+// CHECK: store
+ 

[PATCH] D33328: [CodeGen] Pessimize aliasing for union members (and may-alias) objects

2017-05-25 Thread Krzysztof Parzyszek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303851: [CodeGen] Pessimize aliasing for member unions (and 
may-alias) objects (authored by kparzysz).

Changed prior to commit:
  https://reviews.llvm.org/D33328?vs=100142&id=100232#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33328

Files:
  cfe/trunk/lib/CodeGen/CGExpr.cpp
  cfe/trunk/test/CodeGen/union-tbaa1.c
  cfe/trunk/test/CodeGenCXX/union-tbaa2.cpp

Index: cfe/trunk/test/CodeGenCXX/union-tbaa2.cpp
===
--- cfe/trunk/test/CodeGenCXX/union-tbaa2.cpp
+++ cfe/trunk/test/CodeGenCXX/union-tbaa2.cpp
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 %s -O2 -std=c++11 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -target-feature +sse4.2 -target-feature +avx -emit-llvm -o - | FileCheck %s
+
+// Testcase from llvm.org/PR32056
+
+extern "C" int printf (const char *__restrict __format, ...);
+
+typedef double __m256d __attribute__((__vector_size__(32)));
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__,
+   __target__("avx")))
+_mm256_setr_pd(double __a, double __b, double __c, double __d) {
+  return (__m256d){ __a, __b, __c, __d };
+}
+
+struct A {
+  A () {
+// Check that the TBAA information generated for the stores to the
+// union members is based on the omnipotent char.
+// CHECK: store <4 x double>
+// CHECK: tbaa ![[OCPATH:[0-9]+]]
+// CHECK: store <4 x double>
+// CHECK: tbaa ![[OCPATH]]
+// CHECK: call
+a = _mm256_setr_pd(0.0, 1.0, 2.0, 3.0);
+b = _mm256_setr_pd(4.0, 5.0, 6.0, 7.0);
+  }
+
+  const double *begin() { return c; }
+  const double *end() { return c+8; }
+
+  union {
+struct { __m256d a, b; };
+double c[8];
+  };
+};
+
+int main(int argc, char *argv[]) {
+  A a;
+  for (double value : a)
+printf("%f ", value);
+  return 0;
+}
+
+// CHECK-DAG: ![[CHAR:[0-9]+]] = !{!"omnipotent char"
+// CHECK-DAG: ![[OCPATH]] = !{![[CHAR]], ![[CHAR]], i64 0}
Index: cfe/trunk/test/CodeGen/union-tbaa1.c
===
--- cfe/trunk/test/CodeGen/union-tbaa1.c
+++ cfe/trunk/test/CodeGen/union-tbaa1.c
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 %s -triple hexagon-unknown-elf -O2 -emit-llvm -o - | FileCheck %s
+
+typedef union __attribute__((aligned(4))) {
+  unsigned short uh[2];
+  unsigned uw;
+} vect32;
+
+void bar(vect32 p[][2]);
+
+// CHECK-LABEL: define void @fred
+void fred(unsigned Num, int Vec[2], int *Index, int Arr[4][2]) {
+  vect32 Tmp[4][2];
+// Generate tbaa for the load of Index:
+// CHECK: load i32, i32* %Index{{.*}}tbaa
+// But no tbaa for the two stores:
+// CHECK: %uw[[UW1:[0-9]*]] = getelementptr
+// CHECK: store{{.*}}%uw[[UW1]]
+// CHECK: tbaa ![[OCPATH:[0-9]+]]
+// There will be a load after the store, and it will use tbaa. Make sure
+// the check-not above doesn't find it:
+// CHECK: load
+  Tmp[*Index][0].uw = Arr[*Index][0] * Num;
+// CHECK: %uw[[UW2:[0-9]*]] = getelementptr
+// CHECK: store{{.*}}%uw[[UW2]]
+// CHECK: tbaa ![[OCPATH]]
+  Tmp[*Index][1].uw = Arr[*Index][1] * Num;
+// Same here, don't generate tbaa for the loads:
+// CHECK: %uh[[UH1:[0-9]*]] = bitcast %union.vect32
+// CHECK: %arrayidx[[AX1:[0-9]*]] = getelementptr{{.*}}%uh[[UH1]]
+// CHECK: load i16, i16* %arrayidx[[AX1]]
+// CHECK: tbaa ![[OCPATH]]
+// CHECK: store
+  Vec[0] = Tmp[*Index][0].uh[1];
+// CHECK: %uh[[UH2:[0-9]*]] = bitcast %union.vect32
+// CHECK: %arrayidx[[AX2:[0-9]*]] = getelementptr{{.*}}%uh[[UH2]]
+// CHECK: load i16, i16* %arrayidx[[AX2]]
+// CHECK: tbaa ![[OCPATH]]
+// CHECK: store
+  Vec[1] = Tmp[*Index][1].uh[1];
+  bar(Tmp);
+}
+
+// CHECK-DAG: ![[CHAR:[0-9]+]] = !{!"omnipotent char"
+// CHECK-DAG: ![[OCPATH]] = !{![[CHAR]], ![[CHAR]], i64 0}
Index: cfe/trunk/lib/CodeGen/CGExpr.cpp
===
--- cfe/trunk/lib/CodeGen/CGExpr.cpp
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp
@@ -1432,11 +1432,12 @@
 Load->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
   }
   if (TBAAInfo) {
-llvm::MDNode *TBAAPath = CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo,
-  TBAAOffset);
-if (TBAAPath)
-  CGM.DecorateInstructionWithTBAA(Load, TBAAPath,
-  false /*ConvertTypeToTag*/);
+bool MayAlias = BaseInfo.getMayAlias();
+llvm::MDNode *TBAA = MayAlias
+? CGM.getTBAAInfo(getContext().CharTy)
+: CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo, TBAAOffset);
+if (TBAA)
+  CGM.DecorateInstructionWithTBAA(Load, TBAA, MayAlias);
   }
 
   if (EmitScalarRangeCheck(Load, Ty, Loc)) {
@@ -1522,11 +1523,12 @@
 Store->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
   }
   if (TBAAInfo) {
-llvm::MDNode *TBAAPath = CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo,
-  TBAAOffset);
-

[libcxx] r303856 - Make for_each_n only avaliable on C++17

2017-05-25 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 25 08:40:57 2017
New Revision: 303856

URL: http://llvm.org/viewvc/llvm-project?rev=303856&view=rev
Log:
Make for_each_n only avaliable on C++17

Modified:
libcxx/trunk/include/algorithm

Modified: libcxx/trunk/include/algorithm
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=303856&r1=303855&r2=303856&view=diff
==
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Thu May 25 08:40:57 2017
@@ -964,6 +964,7 @@ for_each(_InputIterator __first, _InputI
 return __f;
 }
 
+#if _LIBCPP_STD_VER > 14
 // for_each_n
 
 template 
@@ -981,6 +982,7 @@ for_each_n(_InputIterator __first, _Size
 }
 return __first;
 }
+#endif
 
 // find
 
@@ -1758,7 +1760,7 @@ __unwrap_iter(_Iter __i)
 }
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,
@@ -1772,7 +1774,7 @@ __unwrap_iter(move_iterator<_Tp*> __i)
 #if _LIBCPP_DEBUG_LEVEL < 2
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,
@@ -1786,7 +1788,7 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)
 #else
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,


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


[PATCH] D33170: [X86] Adding avx512_vpopcntdq feature set and its intrinsics

2017-05-25 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303857: [X86] Adding avx512_vpopcntdq feature set and its 
intrinsics (authored by orenb).

Changed prior to commit:
  https://reviews.llvm.org/D33170?vs=99685&id=100236#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33170

Files:
  cfe/trunk/include/clang/Basic/BuiltinsX86.def
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/lib/CodeGen/CGBuiltin.cpp
  cfe/trunk/lib/Headers/CMakeLists.txt
  cfe/trunk/lib/Headers/avx512vpopcntdqintrin.h
  cfe/trunk/lib/Headers/immintrin.h
  cfe/trunk/test/CodeGen/attr-target-x86.c
  cfe/trunk/test/CodeGen/avx512vpopcntdqintrin.c

Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1741,6 +1741,7 @@
 def mno_avx2 : Flag<["-"], "mno-avx2">, Group;
 def mno_avx512f : Flag<["-"], "mno-avx512f">, Group;
 def mno_avx512cd : Flag<["-"], "mno-avx512cd">, Group;
+def mno_avx512vpopcntdq : Flag<["-"], "mno-avx512vpopcntdq">, Group;
 def mno_avx512er : Flag<["-"], "mno-avx512er">, Group;
 def mno_avx512pf : Flag<["-"], "mno-avx512pf">, Group;
 def mno_avx512dq : Flag<["-"], "mno-avx512dq">, Group;
@@ -1941,6 +1942,7 @@
 def mavx2 : Flag<["-"], "mavx2">, Group;
 def mavx512f : Flag<["-"], "mavx512f">, Group;
 def mavx512cd : Flag<["-"], "mavx512cd">, Group;
+def mavx512vpopcntdq : Flag<["-"], "mavx512vpopcntdq">, Group;
 def mavx512er : Flag<["-"], "mavx512er">, Group;
 def mavx512pf : Flag<["-"], "mavx512pf">, Group;
 def mavx512dq : Flag<["-"], "mavx512dq">, Group;
Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def
@@ -1107,6 +1107,9 @@
 TARGET_BUILTIN(__builtin_ia32_vplzcntd_512_mask, "V16iV16iV16iUs", "", "avx512cd")
 TARGET_BUILTIN(__builtin_ia32_vplzcntq_512_mask, "V8LLiV8LLiV8LLiUc", "", "avx512cd")
 
+TARGET_BUILTIN(__builtin_ia32_vpopcntd_512, "V16iV16i", "", "avx512vpopcntdq")
+TARGET_BUILTIN(__builtin_ia32_vpopcntq_512, "V8LLiV8LLi", "", "avx512vpopcntdq")
+
 TARGET_BUILTIN(__builtin_ia32_vpermi2varhi128_mask, "V8sV8sV8sV8sUc", "", "avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_vpermi2varhi256_mask, "V16sV16sV16sV16sUs", "", "avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_vpermt2varhi128_mask, "V8sV8sV8sV8sUc", "", "avx512vl,avx512bw")
Index: cfe/trunk/test/CodeGen/avx512vpopcntdqintrin.c
===
--- cfe/trunk/test/CodeGen/avx512vpopcntdqintrin.c
+++ cfe/trunk/test/CodeGen/avx512vpopcntdqintrin.c
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512vpopcntdq -emit-llvm -o - -Wall -Werror | FileCheck %s
+
+#include 
+
+__m512i test_mm512_popcnt_epi64(__m512i __A) {
+  // CHECK-LABEL: @test_mm512_popcnt_epi64
+  // CHECK: @llvm.ctpop.v8i64
+  return _mm512_popcnt_epi64(__A);
+}
+__m512i test_mm512_mask_popcnt_epi64(__m512i __W, __mmask8 __U, __m512i __A) {
+  // CHECK-LABEL: @test_mm512_mask_popcnt_epi64
+  // CHECK: @llvm.ctpop.v8i64
+  // CHECK: select <8 x i1> %{{[0-9]+}}, <8 x i64> %{{[0-9]+}}, <8 x i64> {{.*}}
+  return _mm512_mask_popcnt_epi64(__W, __U, __A);
+}
+__m512i test_mm512_maskz_popcnt_epi64(__mmask8 __U, __m512i __A) {
+  // CHECK-LABEL: @test_mm512_maskz_popcnt_epi64
+  // CHECK: @llvm.ctpop.v8i64
+  // CHECK: select <8 x i1> %{{[0-9]+}}, <8 x i64> %{{[0-9]+}}, <8 x i64> {{.*}}
+  return _mm512_maskz_popcnt_epi64(__U, __A);
+}
+__m512i test_mm512_popcnt_epi32(__m512i __A) {
+  // CHECK-LABEL: @test_mm512_popcnt_epi32
+  // CHECK: @llvm.ctpop.v16i32
+  return _mm512_popcnt_epi32(__A);
+}
+__m512i test_mm512_mask_popcnt_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
+  // CHECK-LABEL: @test_mm512_mask_popcnt_epi32
+  // CHECK: @llvm.ctpop.v16i32
+  // CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i32> %{{[0-9]+}}, <16 x i32> {{.*}}
+  return _mm512_mask_popcnt_epi32(__W, __U, __A);
+}
+__m512i test_mm512_maskz_popcnt_epi32(__mmask16 __U, __m512i __A) {
+  // CHECK-LABEL: @test_mm512_maskz_popcnt_epi32
+  // CHECK: @llvm.ctpop.v16i32
+  // CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i32> %{{[0-9]+}}, <16 x i32> {{.*}}
+  return _mm512_maskz_popcnt_epi32(__U, __A);
+}
Index: cfe/trunk/test/CodeGen/attr-target-x86.c
===
--- cfe/trunk/test/CodeGen/attr-target-x86.c
+++ cfe/trunk/test/CodeGen/attr-target-x86.c
@@ -36,7 +36,7 @@
 // CHECK: lake{{.*}} #6
 // CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87"
 // CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+aes,+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,

r303857 - [X86] Adding avx512_vpopcntdq feature set and its intrinsics

2017-05-25 Thread Oren Ben Simhon via cfe-commits
Author: orenb
Date: Thu May 25 08:44:11 2017
New Revision: 303857

URL: http://llvm.org/viewvc/llvm-project?rev=303857&view=rev
Log:
[X86] Adding avx512_vpopcntdq feature set and its intrinsics

AVX512_VPOPCNTDQ is a new feature set that was published by Intel.
The patch represents the Clang side of the addition of six intrinsics for two 
new machine instructions (vpopcntd and vpopcntq).
It also includes the addition of the new feature set.

Differential Revision: https://reviews.llvm.org/D33170


Added:
cfe/trunk/lib/Headers/avx512vpopcntdqintrin.h
cfe/trunk/test/CodeGen/avx512vpopcntdqintrin.c
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/CMakeLists.txt
cfe/trunk/lib/Headers/immintrin.h
cfe/trunk/test/CodeGen/attr-target-x86.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=303857&r1=303856&r2=303857&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Thu May 25 08:44:11 2017
@@ -1107,6 +1107,9 @@ TARGET_BUILTIN(__builtin_ia32_vpconflict
 TARGET_BUILTIN(__builtin_ia32_vplzcntd_512_mask, "V16iV16iV16iUs", "", 
"avx512cd")
 TARGET_BUILTIN(__builtin_ia32_vplzcntq_512_mask, "V8LLiV8LLiV8LLiUc", "", 
"avx512cd")
 
+TARGET_BUILTIN(__builtin_ia32_vpopcntd_512, "V16iV16i", "", "avx512vpopcntdq")
+TARGET_BUILTIN(__builtin_ia32_vpopcntq_512, "V8LLiV8LLi", "", 
"avx512vpopcntdq")
+
 TARGET_BUILTIN(__builtin_ia32_vpermi2varhi128_mask, "V8sV8sV8sV8sUc", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_vpermi2varhi256_mask, "V16sV16sV16sV16sUs", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_vpermt2varhi128_mask, "V8sV8sV8sV8sUc", "", 
"avx512vl,avx512bw")

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=303857&r1=303856&r2=303857&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu May 25 08:44:11 2017
@@ -1741,6 +1741,7 @@ def mno_avx : Flag<["-"], "mno-avx">, Gr
 def mno_avx2 : Flag<["-"], "mno-avx2">, Group;
 def mno_avx512f : Flag<["-"], "mno-avx512f">, Group;
 def mno_avx512cd : Flag<["-"], "mno-avx512cd">, Group;
+def mno_avx512vpopcntdq : Flag<["-"], "mno-avx512vpopcntdq">, 
Group;
 def mno_avx512er : Flag<["-"], "mno-avx512er">, Group;
 def mno_avx512pf : Flag<["-"], "mno-avx512pf">, Group;
 def mno_avx512dq : Flag<["-"], "mno-avx512dq">, Group;
@@ -1941,6 +1942,7 @@ def mavx : Flag<["-"], "mavx">, Group, Group;
 def mavx512f : Flag<["-"], "mavx512f">, Group;
 def mavx512cd : Flag<["-"], "mavx512cd">, Group;
+def mavx512vpopcntdq : Flag<["-"], "mavx512vpopcntdq">, 
Group;
 def mavx512er : Flag<["-"], "mavx512er">, Group;
 def mavx512pf : Flag<["-"], "mavx512pf">, Group;
 def mavx512dq : Flag<["-"], "mavx512dq">, Group;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=303857&r1=303856&r2=303857&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu May 25 08:44:11 2017
@@ -2624,6 +2624,7 @@ class X86TargetInfo : public TargetInfo
   bool HasFMA = false;
   bool HasF16C = false;
   bool HasAVX512CD = false;
+  bool HasAVX512VPOPCNTDQ = false;
   bool HasAVX512ER = false;
   bool HasAVX512PF = false;
   bool HasAVX512DQ = false;
@@ -3504,9 +3505,9 @@ void X86TargetInfo::setSSELevel(llvm::St
 LLVM_FALLTHROUGH;
   case AVX512F:
 Features["avx512f"] = Features["avx512cd"] = Features["avx512er"] =
-  Features["avx512pf"] = Features["avx512dq"] = Features["avx512bw"] =
-  Features["avx512vl"] = Features["avx512vbmi"] =
-  Features["avx512ifma"] = false;
+Features["avx512pf"] = Features["avx512dq"] = Features["avx512bw"] =
+Features["avx512vl"] = Features["avx512vbmi"] =
+Features["avx512ifma"] = Features["avx512vpopcntdq"] = false;
   }
 }
 
@@ -3616,7 +3617,8 @@ void X86TargetInfo::setFeatureEnabledImp
 setSSELevel(Features, AVX512F, Enabled);
   } else if (Name == "avx512cd" || Name == "avx512er" || Name == "avx512pf" ||
  Name == "avx512dq" || Name == "avx512bw" || Name == "avx512vl" ||
- Name == "avx512vbmi" || Name == "avx512ifma") {
+ Name == "avx512vbmi" || Name == "avx512ifma" ||
+ Name == "avx512vpopcntdq") {
 if (Enabled)
   setSSELevel(Features, AVX512F, Enabled);
 // Enable BWI instruction if VBMI is being enabled.
@@ -3700,6 +3702

[PATCH] D32592: [Analyzer] Iterator Checker - Part 1: Minimal Checker for a Simple Test Case

2017-05-25 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 100239.
baloghadamsoftware added a comment.

Comments added and fixed.


https://reviews.llvm.org/D32592

Files:
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
  lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp
  test/Analysis/Inputs/system-header-simulator-cxx.h
  test/Analysis/diagnostics/explicit-suppression.cpp
  test/Analysis/iterator-past-end.cpp
  test/Analysis/iterator-range.cpp

Index: test/Analysis/iterator-range.cpp
===
--- /dev/null
+++ test/Analysis/iterator-range.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorRange -analyzer-eagerly-assume -analyzer-config c++-container-inlining=false %s -verify
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorRange -analyzer-eagerly-assume -analyzer-config c++-container-inlining=true -DINLINE=1 %s -verify
+
+#include "Inputs/system-header-simulator-cxx.h"
+
+void clang_analyzer_warnIfReached();
+
+void simple_good_end(const std::vector &v) {
+  auto i = v.end();
+  if (i != v.end()) {
+clang_analyzer_warnIfReached();
+*i; // no-warning
+  }
+}
+
+void simple_bad_end(const std::vector &v) {
+  auto i = v.end();
+  *i; // expected-warning{{Iterator accessed outside of its range}}
+}
Index: test/Analysis/iterator-past-end.cpp
===
--- test/Analysis/iterator-past-end.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorPastEnd -analyzer-eagerly-assume -analyzer-config c++-container-inlining=false %s -verify
-// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorPastEnd -analyzer-eagerly-assume -analyzer-config c++-container-inlining=true -DINLINE=1 %s -verify
-
-#include "Inputs/system-header-simulator-cxx.h"
-
-void simple_good(const std::vector &v) {
-  auto i = v.end();
-  if (i != v.end())
-*i; // no-warning
-}
-
-void simple_good_negated(const std::vector &v) {
-  auto i = v.end();
-  if (!(i == v.end()))
-*i; // no-warning
-}
-
-void simple_bad(const std::vector &v) {
-  auto i = v.end();
-  *i; // expected-warning{{Iterator accessed past its end}}
-}
-
-void copy(const std::vector &v) {
-  auto i1 = v.end();
-  auto i2 = i1;
-  *i2; // expected-warning{{Iterator accessed past its end}}
-}
-
-void decrease(const std::vector &v) {
-  auto i = v.end();
-  --i;
-  *i; // no-warning
-}
-
-void copy_and_decrease1(const std::vector &v) {
-  auto i1 = v.end();
-  auto i2 = i1;
-  --i1;
-  *i1; // no-warning
-}
-
-void copy_and_decrease2(const std::vector &v) {
-  auto i1 = v.end();
-  auto i2 = i1;
-  --i1;
-  *i2; // expected-warning{{Iterator accessed past its end}}
-}
-
-void copy_and_increase1(const std::vector &v) {
-  auto i1 = v.begin();
-  auto i2 = i1;
-  ++i1;
-  if (i1 == v.end())
-*i2; // no-warning
-}
-
-void copy_and_increase2(const std::vector &v) {
-  auto i1 = v.begin();
-  auto i2 = i1;
-  ++i1;
-  if (i2 == v.end())
-*i2; // expected-warning{{Iterator accessed past its end}}
-}
-
-void good_find(std::vector &vec, int e) {
-  auto first = std::find(vec.begin(), vec.end(), e);
-  if (vec.end() != first)
-*first; // no-warning
-}
-
-void bad_find(std::vector &vec, int e) {
-  auto first = std::find(vec.begin(), vec.end(), e);
-  *first; // expected-warning{{Iterator accessed past its end}}
-}
-
-void good_find_end(std::vector &vec, std::vector &seq) {
-  auto last = std::find_end(vec.begin(), vec.end(), seq.begin(), seq.end());
-  if (vec.end() != last)
-*last; // no-warning
-}
-
-void bad_find_end(std::vector &vec, std::vector &seq) {
-  auto last = std::find_end(vec.begin(), vec.end(), seq.begin(), seq.end());
-  *last; // expected-warning{{Iterator accessed past its end}}
-}
-
-void good_find_first_of(std::vector &vec, std::vector &seq) {
-  auto first =
-  std::find_first_of(vec.begin(), vec.end(), seq.begin(), seq.end());
-  if (vec.end() != first)
-*first; // no-warning
-}
-
-void bad_find_first_of(std::vector &vec, std::vector &seq) {
-  auto first = std::find_end(vec.begin(), vec.end(), seq.begin(), seq.end());
-  *first; // expected-warning{{Iterator accessed past its end}}
-}
-
-bool odd(int i) { return i % 2; }
-
-void good_find_if(std::vector &vec) {
-  auto first = std::find_if(vec.begin(), vec.end(), odd);
-  if (vec.end() != first)
-*first; // no-warning
-}
-
-void bad_find_if(std::vector &vec, int e) {
-  auto first = std::find_if(vec.begin(), vec.end(), odd);
-  *first; // expected-warning{{Iterator accessed past its end}}
-}
-
-void good_find_if_not(std::vector &vec) {
-  auto first = std::find_if_not(vec.begin(), vec.end(), odd);
-  if (vec.end() != first)
-*first; // no-w

r303861 - [AMDGPU] add __builtin_amdgcn_s_getpc

2017-05-25 Thread Tim Corringham via cfe-commits
Author: timcorringham
Date: Thu May 25 09:16:11 2017
New Revision: 303861

URL: http://llvm.org/viewvc/llvm-project?rev=303861&view=rev
Log:
[AMDGPU] add __builtin_amdgcn_s_getpc

Summary: Added the builtin corresponding to the s_getpc intrinsic added in llvm 
D32862

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

Differential Revision: https://reviews.llvm.org/D33276

Modified:
cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def
cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl

Modified: cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def?rev=303861&r1=303860&r2=303861&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def Thu May 25 09:16:11 2017
@@ -36,6 +36,7 @@ BUILTIN(__builtin_amdgcn_workitem_id_z,
 // Instruction builtins.
 
//===--===//
 BUILTIN(__builtin_amdgcn_s_getreg, "UiIi", "n")
+BUILTIN(__builtin_amdgcn_s_getpc, "LUi", "n")
 BUILTIN(__builtin_amdgcn_s_waitcnt, "vIi", "n")
 BUILTIN(__builtin_amdgcn_s_sendmsg, "vIiUi", "n")
 BUILTIN(__builtin_amdgcn_s_sendmsghalt, "vIiUi", "n")

Modified: cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl?rev=303861&r1=303860&r2=303861&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl Thu May 25 09:16:11 2017
@@ -481,6 +481,13 @@ void test_fmed3_f32(global float* out, f
   *out = __builtin_amdgcn_fmed3f(a, b, c);
 }
 
+// CHECK-LABEL: @test_s_getpc
+// CHECK: call i64 @llvm.amdgcn.s.getpc()
+void test_s_getpc(global ulong* out)
+{
+  *out = __builtin_amdgcn_s_getpc();
+}
+
 // CHECK-DAG: [[WI_RANGE]] = !{i32 0, i32 1024}
 // CHECK-DAG: attributes #[[NOUNWIND_READONLY:[0-9]+]] = { nounwind readonly }
 // CHECK-DAG: attributes #[[READ_EXEC_ATTRS]] = { convergent }


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


[libcxx] r303862 - Last commit included some extra constexpr; remove them

2017-05-25 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 25 09:20:26 2017
New Revision: 303862

URL: http://llvm.org/viewvc/llvm-project?rev=303862&view=rev
Log:
Last commit included some extra constexpr; remove them

Modified:
libcxx/trunk/include/algorithm

Modified: libcxx/trunk/include/algorithm
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=303862&r1=303861&r2=303862&view=diff
==
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Thu May 25 09:20:26 2017
@@ -1760,7 +1760,7 @@ __unwrap_iter(_Iter __i)
 }
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,
@@ -1774,7 +1774,7 @@ __unwrap_iter(move_iterator<_Tp*> __i)
 #if _LIBCPP_DEBUG_LEVEL < 2
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,
@@ -1788,7 +1788,7 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)
 #else
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,


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


[PATCH] D33550: Make __wrap_iter constexpr

2017-05-25 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists created this revision.

`__wrap_iter` is an internal libc++ class that is used as an iterator type when 
(for some reason) we don't want to use raw pointers as an iterator.  It is the 
iterator type for `vector` and `string` (but not `array` - not sure why). If we 
used pointers, all the operations on the iterators would be constexpr.  With 
this patch, the corresponding operations on `__wrap_iter` are constexpr as well.

We'll have to do this when 
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#2938 is adopted.

No tests, because all the interesting constructors of `__wrap_iter` are 
private, and only accessed through friend functions.
I have written tests (after making the appropriate ctors public) and they seem 
to work.


https://reviews.llvm.org/D33550

Files:
  include/algorithm
  include/iterator

Index: include/iterator
===
--- include/iterator
+++ include/iterator
@@ -1199,32 +1199,32 @@
 template  class __wrap_iter;
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
 operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
 operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
 operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
 operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
 operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
 operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 
@@ -1236,13 +1236,13 @@
 -> decltype(__x.base() - __y.base());
 #else
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename __wrap_iter<_Iter1>::difference_type
 operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
 #endif
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 __wrap_iter<_Iter>
 operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT_DEBUG;
 
@@ -1254,7 +1254,7 @@
 #if _LIBCPP_DEBUG_LEVEL < 2
 
 template 
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,
@@ -1265,7 +1265,7 @@
 #else
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,
@@ -1288,7 +1288,8 @@
 private:
 iterator_type __i;
 public:
-_LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT_DEBUG
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+__wrap_iter() _NOEXCEPT_DEBUG
 #if _LIBCPP_STD_VER > 11
 : __i{}
 #endif
@@ -1297,7 +1298,8 @@
 __get_db()->__insert_i(this);
 #endif
 }
-template  _LIBCPP_INLINE_VISIBILITY __wrap_iter(const __wrap_iter<_Up>& __u,
+template  _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+  __wrap_iter(const __wrap_iter<_Up>& __u,
 typename enable_if::value>::type* = 0) _NOEXCEPT_DEBUG
 : __i(__u.base())
 {
@@ -1306,13 +1308,13 @@
 #endif
 }
 #if _LIBCPP_DEBUG_LEVEL >= 2
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 __wrap_iter(const __wrap_iter& __x)
 : __i(__x.base())
 {
 __get_db()->__iterator_copy(this, &__x);
 }
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 __wrap_iter& operator=(const __wrap_iter& __x)
 {
 if (this != &__x)
@@ -1328,7 +1330,8 @@
 __get_db()->__erase_i(this);
 }
 #endif
-_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT_DEBUG
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+reference operator*() const _NOEXCEPT_DEBUG
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
@@ -1336,7 +1339,8 @@
 #endif
 return *__i;
 }
-_LIBCPP_INLINE_VISIBILITY pointer  operator->() const _NOEXCEPT_DEBUG
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+pointer  operator->() const _NOEXCEPT_DEBUG
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
@@ -1344,7 +1348,8 @@
 #endif
 return (pointer)_VS

[PATCH] D33550: Make __wrap_iter constexpr

2017-05-25 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added inline comments.



Comment at: include/iterator:1409
 
-private:
+// private:
 #if _LIBCPP_DEBUG_LEVEL >= 2

This is testing debris - making the constructors public for testing.


https://reviews.llvm.org/D33550



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


r303867 - [coroutines] Bump __cpp_coroutines version

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 09:58:46 2017
New Revision: 303867

URL: http://llvm.org/viewvc/llvm-project?rev=303867&view=rev
Log:
[coroutines] Bump __cpp_coroutines version

Summary: This patch is needed so that Libc++ can actually tess if Clang 
supports coroutines, instead of just paying lip service with a partial 
implementation. Otherwise the libc++ test suite will fail against older 
versions of Clang

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D33536

Modified:
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/Lexer/cxx-features.cpp

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=303867&r1=303866&r2=303867&view=diff
==
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Thu May 25 09:58:46 2017
@@ -535,7 +535,7 @@ static void InitializeCPlusPlusFeatureTe
   if (LangOpts.ConceptsTS)
 Builder.defineMacro("__cpp_experimental_concepts", "1");
   if (LangOpts.CoroutinesTS)
-Builder.defineMacro("__cpp_coroutines", "1");
+Builder.defineMacro("__cpp_coroutines", "201703L");
 }
 
 static void InitializePredefinedMacros(const TargetInfo &TI,

Modified: cfe/trunk/test/Lexer/cxx-features.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx-features.cpp?rev=303867&r1=303866&r2=303867&view=diff
==
--- cfe/trunk/test/Lexer/cxx-features.cpp (original)
+++ cfe/trunk/test/Lexer/cxx-features.cpp Thu May 25 09:58:46 2017
@@ -235,6 +235,6 @@
 #error "wrong value for __cpp_experimental_concepts"
 #endif
 
-#if (COROUTINES && !__cpp_coroutines) || (!COROUTINES && __cpp_coroutines)
+#if defined(COROUTINES) ? check(coroutines, 201703L, 201703L, 201703L, 
201703L) : check(coroutines, 0, 0, 0, 0)
 #error "wrong value for __cpp_coroutines"
 #endif


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


r303868 - [coroutines] Diagnose when promise types fail to declare either return_void or return_value.

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 09:59:39 2017
New Revision: 303868

URL: http://llvm.org/viewvc/llvm-project?rev=303868&view=rev
Log:
[coroutines] Diagnose when promise types fail to declare either return_void or 
return_value.

Summary:
According to the PDTS it's perfectly legal to have a promise type that defines 
neither `return_value` nor `return_void`. However a coroutine that uses such a 
promise type will almost always have UB, because it can never `co_return`.

This patch changes Clang to diagnose such cases as an error. It also cleans up 
some of the diagnostic messages relating to member lookup in the promise type.

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D33534

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaCoroutine.cpp
cfe/trunk/test/SemaCXX/coreturn.cpp
cfe/trunk/test/SemaCXX/coroutines.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=303868&r1=303867&r2=303868&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu May 25 09:59:39 
2017
@@ -6303,6 +6303,8 @@ def warn_ambiguous_suitable_delete_funct
   InGroup>;
 def note_member_declared_here : Note<
   "member %0 declared here">;
+def note_member_first_declared_here : Note<
+  "member %0 first declared here">;
 def err_decrement_bool : Error<"cannot decrement expression of type bool">;
 def warn_increment_bool : Warning<
   "incrementing expression of type bool is deprecated and "
@@ -8918,8 +8920,6 @@ def err_return_in_coroutine : Error<
   "return statement not allowed in coroutine; did you mean 'co_return'?">;
 def note_declared_coroutine_here : Note<
   "function is a coroutine due to use of '%0' here">;
-def note_promise_member_declared_here : Note<
-  "'%0' is declared here">;
 def err_coroutine_objc_method : Error<
   "Objective-C methods as coroutines are not yet supported">;
 def err_coroutine_unevaluated_context : Error<
@@ -8954,8 +8954,10 @@ def err_coroutine_promise_type_incomplet
 def err_coroutine_type_missing_specialization : Error<
   "this function cannot be a coroutine: missing definition of "
   "specialization %q0">;
-def err_coroutine_promise_return_ill_formed : Error<
-  "%0 declares both 'return_value' and 'return_void'">;
+def err_coroutine_promise_incompatible_return_functions : Error<
+  "the coroutine promise type %0 declares both 'return_value' and 
'return_void'">;
+def err_coroutine_promise_requires_return_function : Error<
+  "the coroutine promise type %0 must declare either 'return_value' or 
'return_void'">;
 def note_coroutine_promise_implicit_await_transform_required_here : Note<
   "call to 'await_transform' implicitly required by 'co_await' here">;
 def note_coroutine_promise_suspend_implicitly_required : Note<

Modified: cfe/trunk/lib/Sema/SemaCoroutine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCoroutine.cpp?rev=303868&r1=303867&r2=303868&view=diff
==
--- cfe/trunk/lib/Sema/SemaCoroutine.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCoroutine.cpp Thu May 25 09:59:39 2017
@@ -23,14 +23,22 @@
 using namespace clang;
 using namespace sema;
 
-static bool lookupMember(Sema &S, const char *Name, CXXRecordDecl *RD,
- SourceLocation Loc) {
+static LookupResult lookupMember(Sema &S, const char *Name, CXXRecordDecl *RD,
+ SourceLocation Loc, bool &Res) {
   DeclarationName DN = S.PP.getIdentifierInfo(Name);
   LookupResult LR(S, DN, Loc, Sema::LookupMemberName);
   // Suppress diagnostics when a private member is selected. The same warnings
   // will be produced again when building the call.
   LR.suppressDiagnostics();
-  return S.LookupQualifiedName(LR, RD);
+  Res = S.LookupQualifiedName(LR, RD);
+  return LR;
+}
+
+static bool lookupMember(Sema &S, const char *Name, CXXRecordDecl *RD,
+ SourceLocation Loc) {
+  bool Res;
+  lookupMember(S, Name, RD, Loc, Res);
+  return Res;
 }
 
 /// Look up the std::coroutine_traits<...>::promise_type for the given
@@ -861,9 +869,8 @@ bool CoroutineStmtBuilder::makeReturnOnA
   StmtResult ReturnStmt =
   S.BuildReturnStmt(Loc, ReturnObjectOnAllocationFailure.get());
   if (ReturnStmt.isInvalid()) {
-S.Diag(Found.getFoundDecl()->getLocation(),
-   diag::note_promise_member_declared_here)
-<< DN.getAsString();
+S.Diag(Found.getFoundDecl()->getLocation(), 
diag::note_member_declared_here)
+<< DN;
 S.Diag(Fn.FirstCoroutineStmtLoc, diag::note_declared_coroutine_here)
 << Fn.getFirstCoroutineStmtKeyword();
 return false;
@@ -993,1

r303871 - Make git-clang-format python 3 compatible

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 10:24:04 2017
New Revision: 303871

URL: http://llvm.org/viewvc/llvm-project?rev=303871&view=rev
Log:
Make git-clang-format python 3 compatible

Summary: This patch attempts to make `git-clang-format` both python2 and 
python3 compatible. Currently it only works in python2.

Reviewers: modocache, compnerd, djasper, jbcoe, srhines, ddunbar

Reviewed By: jbcoe

Subscribers: kimgr, mgorny, llvm-commits, cfe-commits

Differential Revision: https://reviews.llvm.org/D30773

Modified:
cfe/trunk/tools/clang-format/git-clang-format

Modified: cfe/trunk/tools/clang-format/git-clang-format
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/git-clang-format?rev=303871&r1=303870&r2=303871&view=diff
==
--- cfe/trunk/tools/clang-format/git-clang-format (original)
+++ cfe/trunk/tools/clang-format/git-clang-format Thu May 25 10:24:04 2017
@@ -20,7 +20,7 @@ clang-format on the changes in current f
 For further details, run:  
  
 git clang-format -h
  

  
-Requires Python 2.7
  
+Requires Python 2.7 or Python 3
  
 """   
 
 from __future__ import print_function
@@ -258,7 +258,7 @@ def get_object_type(value):
   stdout, stderr = p.communicate()
   if p.returncode != 0:
 return None
-  return stdout.strip()
+  return convert_string(stdout.strip())
 
 
 def compute_diff_and_extract_lines(commits, files):
@@ -301,6 +301,7 @@ def extract_lines(patch_file):
   list of line `Range`s."""
   matches = {}
   for line in patch_file:
+line = convert_string(line)
 match = re.search(r'^\+\+\+\ [^/]+/(.*)', line)
 if match:
   filename = match.group(1).rstrip('\r\n')
@@ -385,7 +386,7 @@ def create_tree(input_lines, mode):
   with temporary_index_file():
 p = subprocess.Popen(cmd, stdin=subprocess.PIPE)
 for line in input_lines:
-  p.stdin.write('%s\0' % line)
+  p.stdin.write(to_bytes('%s\0' % line))
 p.stdin.close()
 if p.wait() != 0:
   die('`%s` failed' % ' '.join(cmd))
@@ -440,7 +441,7 @@ def clang_format_to_blob(filename, line_
 die('`%s` failed' % ' '.join(clang_format_cmd))
   if git_show and git_show.wait() != 0:
 die('`%s` failed' % ' '.join(git_show_cmd))
-  return stdout.rstrip('\r\n')
+  return convert_string(stdout).rstrip('\r\n')
 
 
 @contextlib.contextmanager
@@ -527,6 +528,10 @@ def run(*args, **kwargs):
   p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
   stdout, stderr = p.communicate(input=stdin)
+
+  stdout = convert_string(stdout)
+  stderr = convert_string(stderr)
+
   if p.returncode == 0:
 if stderr:
   if verbose:
@@ -547,5 +552,26 @@ def die(message):
   sys.exit(2)
 
 
+def to_bytes(str_input):
+# Encode to UTF-8 to get binary data.
+if isinstance(str_input, bytes):
+return str_input
+return str_input.encode('utf-8')
+
+
+def to_string(bytes_input):
+if isinstance(bytes_input, str):
+return bytes_input
+return bytes_input.encode('utf-8')
+
+
+def convert_string(bytes_input):
+try:
+return to_string(bytes_input.decode('utf-8'))
+except AttributeError: # 'str' object has no attribute 'decode'.
+return str(bytes_input)
+except UnicodeError:
+return str(bytes_input)
+
 if __name__ == '__main__':
   main()


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


[clang-tools-extra] r303872 - Disable MSVC-Compat mode for two tests that use C++Operator Names

2017-05-25 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 25 10:39:24 2017
New Revision: 303872

URL: http://llvm.org/viewvc/llvm-project?rev=303872&view=rev
Log:
Disable MSVC-Compat mode for two tests that use C++Operator Names

MSVC doesn't support C++ operator names (using 'or' instead of ||, 
'not' instead of '!', etc), so this was disabled in MSVC mode in r303798.
This fixes the regression noticed on the buildbots.

Modified:

clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp?rev=303872&r1=303871&r2=303872&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
 (original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
 Thu May 25 10:39:24 2017
@@ -2,7 +2,7 @@
 // RUN: -config='{CheckOptions: \
 // RUN:  [{key: readability-implicit-bool-cast.AllowConditionalIntegerCasts, 
value: 1}, \
 // RUN:   {key: readability-implicit-bool-cast.AllowConditionalPointerCasts, 
value: 1}]}' \
-// RUN: -- -std=c++11
+// RUN: -- -std=c++11 -fno-ms-compatibility
 
 template
 void functionTaking(T);

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp?rev=303872&r1=303871&r2=303872&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
Thu May 25 10:39:24 2017
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s readability-implicit-bool-cast %t
+// RUN: %check_clang_tidy %s -fno-ms-compatibility 
readability-implicit-bool-cast %t
 
 // We need NULL macro, but some buildbots don't like including  header
 // This is a portable way of getting it to work


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


r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu May 25 10:42:13 2017
New Revision: 303873

URL: http://llvm.org/viewvc/llvm-project?rev=303873&view=rev
Log:
Don't defer to the GCC driver for linking arm-baremetal

Also comes with a cmake cache for building the runtime bits:

 $ cmake  \
   -DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
   -C /path/to/clang/cmake/caches/BaremetalARM.cmake \
   /path/to/llvm

https://reviews.llvm.org/D33259

Added:
cfe/trunk/cmake/caches/BaremetalARM.cmake
cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
cfe/trunk/lib/Driver/ToolChains/BareMetal.h
cfe/trunk/test/Driver/Inputs/baremetal_arm/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
cfe/trunk/test/Driver/baremetal.cpp
Modified:
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/lib/Driver/ToolChains/Linux.cpp
cfe/trunk/test/Frontend/gnu-mcount.c

Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/BaremetalARM.cmake?rev=303873&view=auto
==
--- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
+++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
@@ -0,0 +1,50 @@
+set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
+
+# Builtins
+set(LLVM_BUILTIN_TARGETS "armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi" 
CACHE STRING "Builtin Targets")
+
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV6M_SYSROOT} CACHE 
STRING "armv6m-none-eabi Sysroot")
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING 
"armv6m-none-eabi System Name")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL 
"armv6m-none-eabi Baremetal build")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING 
"armv6m-none-eabi os dir")
+
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7M_SYSROOT} CACHE 
STRING "armv7m-none-eabi Sysroot")
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING 
"armv7m-none-eabi System Name")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL 
"armv7m-none-eabi Baremetal build")
+set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE STRING 
"armv7m-none-eabi C Flags")
+set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE STRING 
"armv7m-none-eabi ASM Flags")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING 
"armv7m-none-eabi os dir")
+
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7EM_SYSROOT} 
CACHE STRING "armv7em-none-eabi Sysroot")
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING 
"armv7em-none-eabi System Name")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL 
"armv7em-none-eabi Baremetal build")
+set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE STRING 
"armv7em-none-eabi C Flags")
+set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE STRING 
"armv7em-none-eabi ASM Flags")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING 
"armv7em-none-eabi os dir")
+
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+set(LLVM_TOOLCHAIN_TOOLS
+  llc
+  llvm-ar
+  llvm-cxxfilt
+  llvm-dwarfdump
+  llvm-dsymutil
+  llvm-nm
+  llvm-objdump
+  llvm-ranlib
+  llvm-readobj
+  llvm-size
+  llvm-symbolizer
+  opt
+  CACHE STRING "")
+
+set(LLVM_DISTRIBUTION_COMPONENTS
+  clang
+  lld
+  clang-headers
+  builtins-armv6m-none-eabi
+  builtins-armv7m-none-eabi
+  builtins-armv7em-none-eabi
+  runtimes
+  ${LLVM_TOOLCHAIN_TOOLS}
+  CACHE STRING "")

Modified: cfe/trunk/lib/Driver/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=303873&r1=303872&r2=303873&view=diff
==
--- cfe/trunk/lib/Driver/CMakeLists.txt (original)
+++ cfe/trunk/lib/Driver/CMakeLists.txt Thu May 25 10:42:13 2017
@@ -30,6 +30,7 @@ add_clang_library(clangDriver
   ToolChains/AMDGPU.cpp
   ToolChains/AVR.cpp
   ToolChains/Bitrig.cpp
+  ToolChains/BareMetal.cpp
   ToolChains/Clang.cpp
   ToolChains/CloudABI.cpp
   ToolChains/CommonArgs.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=303873&r1=303872&r2

[PATCH] D33259: Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs closed this revision.
jroelofs added a comment.

r303873


https://reviews.llvm.org/D33259



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


[libcxx] r303874 - Add support for shared_ptr

2017-05-25 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Thu May 25 10:43:31 2017
New Revision: 303874

URL: http://llvm.org/viewvc/llvm-project?rev=303874&view=rev
Log:
Add support for shared_ptr

Fixes PR27566.

Differential revision: https://reviews.llvm.org/D30837

Added:

libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/

libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
Modified:
libcxx/trunk/include/memory

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=303874&r1=303873&r2=303874&view=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Thu May 25 10:43:31 2017
@@ -2251,6 +2251,8 @@ void swap(__compressed_pair<_T1, _T2>& _
 
 template 
 struct _LIBCPP_TEMPLATE_VIS default_delete {
+static_assert(!is_function<_Tp>::value,
+  "default_delete cannot be instantiated for function types");
 #ifndef _LIBCPP_CXX03_LANG
   _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
 #else
@@ -3653,6 +3655,18 @@ __shared_ptr_emplace<_Tp, _Alloc>::__on_
 __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 
+struct __shared_ptr_dummy_rebind_allocator_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type>
+{
+public:
+template 
+struct rebind
+{
+typedef allocator<_Other> other;
+};
+};
+
 template class _LIBCPP_TEMPLATE_VIS enable_shared_from_this;
 
 template
@@ -3921,6 +3935,17 @@ public:
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
 private:
+template ::value>
+struct __shared_ptr_default_allocator
+{
+typedef allocator<_Yp> type;
+};
+
+template 
+struct __shared_ptr_default_allocator<_Yp, true>
+{
+typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type;
+};
 
 template 
 _LIBCPP_INLINE_VISIBILITY
@@ -3939,8 +3964,7 @@ private:
 }
 }
 
-_LIBCPP_INLINE_VISIBILITY
-void __enable_weak_this(const volatile void*, const volatile void*) 
_NOEXCEPT {}
+_LIBCPP_INLINE_VISIBILITY void __enable_weak_this(...) _NOEXCEPT {}
 
 template  friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
 template  friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
@@ -3972,8 +3996,9 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p,
 : __ptr_(__p)
 {
 unique_ptr<_Yp> __hold(__p);
-typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > 
_CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, _AllocT > 
_CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), _AllocT());
 __hold.release();
 __enable_weak_this(__p, __p);
 }
@@ -3988,8 +4013,9 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _D
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, __d, allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
 __enable_weak_this(__p, __p);
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
@@ -4010,8 +4036,9 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-typedef __shared_ptr_pointer > 
_CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, __d, allocator<_Tp>());
+typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
+typedef __shared_ptr_pointer _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
 catch (...)
@@ -4179,8 +4206,9 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_
 else
 #endif
 {
-typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), 
allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT());
 __enable_weak_this(__r.get(), __r.get());
 }
 __r.release();
@@ -4208,10 +4236,11 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_
 else
 #endif
 {
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
 typedef __shared_ptr_pointer<_Yp*,
  reference_wrapper::type>,
- all

[PATCH] D30837: [libcxx] Support for shared_ptr

2017-05-25 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303874: Add support for shared_ptr (authored 
by epilk).

Changed prior to commit:
  https://reviews.llvm.org/D30837?vs=97313&id=100251#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30837

Files:
  libcxx/trunk/include/memory
  
libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
  
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Index: libcxx/trunk/include/memory
===
--- libcxx/trunk/include/memory
+++ libcxx/trunk/include/memory
@@ -2251,6 +2251,8 @@
 
 template 
 struct _LIBCPP_TEMPLATE_VIS default_delete {
+static_assert(!is_function<_Tp>::value,
+  "default_delete cannot be instantiated for function types");
 #ifndef _LIBCPP_CXX03_LANG
   _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
 #else
@@ -3653,6 +3655,18 @@
 __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 
+struct __shared_ptr_dummy_rebind_allocator_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type>
+{
+public:
+template 
+struct rebind
+{
+typedef allocator<_Other> other;
+};
+};
+
 template class _LIBCPP_TEMPLATE_VIS enable_shared_from_this;
 
 template
@@ -3921,6 +3935,17 @@
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
 private:
+template ::value>
+struct __shared_ptr_default_allocator
+{
+typedef allocator<_Yp> type;
+};
+
+template 
+struct __shared_ptr_default_allocator<_Yp, true>
+{
+typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type;
+};
 
 template 
 _LIBCPP_INLINE_VISIBILITY
@@ -3939,8 +3964,7 @@
 }
 }
 
-_LIBCPP_INLINE_VISIBILITY
-void __enable_weak_this(const volatile void*, const volatile void*) _NOEXCEPT {}
+_LIBCPP_INLINE_VISIBILITY void __enable_weak_this(...) _NOEXCEPT {}
 
 template  friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
 template  friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
@@ -3972,8 +3996,9 @@
 : __ptr_(__p)
 {
 unique_ptr<_Yp> __hold(__p);
-typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), _AllocT());
 __hold.release();
 __enable_weak_this(__p, __p);
 }
@@ -3988,8 +4013,9 @@
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, __d, allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
 __enable_weak_this(__p, __p);
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
@@ -4010,8 +4036,9 @@
 try
 {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-typedef __shared_ptr_pointer > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, __d, allocator<_Tp>());
+typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
+typedef __shared_ptr_pointer _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
 #ifndef _LIBCPP_NO_EXCEPTIONS
 }
 catch (...)
@@ -4179,8 +4206,9 @@
 else
 #endif
 {
-typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT());
 __enable_weak_this(__r.get(), __r.get());
 }
 __r.release();
@@ -4208,10 +4236,11 @@
 else
 #endif
 {
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
 typedef __shared_ptr_pointer<_Yp*,
  reference_wrapper::type>,
- allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), allocator<_Yp>());
+ _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), _AllocT());
 __enable_weak_this(__r.get(), __r.get());
 }
 __r.release();
Index: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

[libcxx] r303876 - Mark LWG#2900 as complete - we already do this, and I checked the tests in a couple days ago (r303268 & r303824)

2017-05-25 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 25 11:05:54 2017
New Revision: 303876

URL: http://llvm.org/viewvc/llvm-project?rev=303876&view=rev
Log:
Mark LWG#2900 as complete - we already do this, and I checked the tests in a 
couple days ago (r303268 & r303824)

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=303876&r1=303875&r2=303876&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu May 25 11:05:54 2017
@@ -475,7 +475,7 @@
http://wg21.link/LWG2876";>2876shared_ptr::shared_ptr(const 
weak_ptr&) constructor should be 
constrainedKona
http://wg21.link/LWG2878";>2878Missing 
DefaultConstructible requirement for istream_iterator default 
constructorKona
http://wg21.link/LWG2890";>2890The 
definition of 'object state' applies only to class 
typesKonaComplete
-   http://wg21.link/LWG2900";>2900The copy 
and move constructors of optional are not 
constexprKona
+   http://wg21.link/LWG2900";>2900The copy 
and move constructors of optional are not 
constexprKonaComplete
http://wg21.link/LWG2903";>2903The form of 
initialization for the emplace-constructors is not 
specifiedKona
http://wg21.link/LWG2904";>2904Make 
variant move-assignment more exception safeKona
http://wg21.link/LWG2905";>2905is_constructible_v, P, D const &> should be false when D is not copy 
constructibleKonaComplete
@@ -489,7 +489,7 @@
 
   
 
-  Last Updated: 23-May-2017
+  Last Updated: 25-May-2017
 
 
 


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


[clang-tools-extra] r303877 - Clang-tidy doesn't understand -fno-ms-compatibility, so just removing 'not'

2017-05-25 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 25 11:07:19 2017
New Revision: 303877

URL: http://llvm.org/viewvc/llvm-project?rev=303877&view=rev
Log:
Clang-tidy doesn't understand -fno-ms-compatibility, so just removing 'not' 

Modified:
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp?rev=303877&r1=303876&r2=303877&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
Thu May 25 11:07:19 2017
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s -fno-ms-compatibility 
readability-implicit-bool-cast %t
+// RUN: %check_clang_tidy %s readability-implicit-bool-cast %t
 
 // We need NULL macro, but some buildbots don't like including  header
 // This is a portable way of getting it to work
@@ -264,7 +264,7 @@ void implicitCastInNegationExpressions()
   // CHECK-FIXES: bool boolComingFromNegatedChar = (character == 0);
 
   int* pointer = nullptr;
-  bool boolComingFromNegatedPointer = not pointer;
+  bool boolComingFromNegatedPointer = ! pointer;
   // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: implicit cast 'int *' -> bool
   // CHECK-FIXES: bool boolComingFromNegatedPointer = pointer == nullptr;
 }


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


[libcxx] r303878 - Fix a test that was failing in C++11 mode introduced in r303874

2017-05-25 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Thu May 25 11:16:17 2017
New Revision: 303878

URL: http://llvm.org/viewvc/llvm-project?rev=303878&view=rev
Log:
Fix a test that was failing in C++11 mode introduced in r303874

Modified:

libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp

Modified: 
libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp?rev=303878&r1=303877&r2=303878&view=diff
==
--- 
libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
 Thu May 25 11:16:17 2017
@@ -1,3 +1,5 @@
+// UNSUPPORTED: c++98, c++03
+
 #include 
 
 template  struct Tag {};
@@ -21,7 +23,9 @@ struct Deleter {
   void operator()(Tp) const {
 using RawT = typename std::remove_pointer::type;
 static_assert(std::is_function::value ||
-  std::is_null_pointer::value, "");
+  std::is_same::type,
+   std::nullptr_t>::value,
+  "");
   }
 };
 


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


RE: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Nico Weber via cfe-commits
In addition to this making clang-cl silently accept invalid code, it also
breaks existing valid code, building chromium now fails. Let's revert and
come up with something better asynchronously.

FAILED:
obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
E:\b\c\goma_client/gomacc.exe
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo
/showIncludes /FC
@obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp
/c
../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
/Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
/Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,7):
error: unknown type name 'definition' if (definition and
definition->Descriptor().LocalName() == desc.LocalName()) { ^
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,18):
error: variable declaration in condition must have an initializer if
(definition and definition->Descriptor().LocalName() == desc.LocalName()) {
^ 2 errors generated.

On May 24, 2017 4:01 PM, "Blower, Melanie"  wrote:

Thanks for the feedback, working on it…



*From:* Keane, Erich
*Sent:* Wednesday, May 24, 2017 3:47 PM
*To:* Nico Weber ; Blower, Melanie <
melanie.blo...@intel.com>

*Cc:* cfe-commits ; rnk 
*Subject:* RE: r303798 - For Microsoft compatibility, set fno_operator_names



Adding Melanie, the author of the patch.



*From:* tha...@google.com [mailto:tha...@google.com ] *On
Behalf Of *Nico Weber
*Sent:* Wednesday, May 24, 2017 12:43 PM
*To:* Keane, Erich 
*Cc:* cfe-commits ; rnk 
*Subject:* Re: r303798 - For Microsoft compatibility, set fno_operator_names



Reviewed here: https://reviews.llvm.org/D33505


Still, please make this warn.



On Wed, May 24, 2017 at 3:42 PM, Nico Weber  wrote:

Was this reviewed somewhere?



Please make it so that this emits a warning. We want clang-cl to warn on
invalid code (and in system headers warnings are suppressed).



On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

Author: erichkeane
Date: Wed May 24 14:31:19 2017
New Revision: 303798

URL: http://llvm.org/viewvc/llvm-project?rev=303798&view=rev
Log:
For Microsoft compatibility, set fno_operator_names

There's a Microsoft header in the Windows SDK which won't
compile with clang because it uses an operator name (and)
as a field name. This patch allows that file to compile by
setting the option which disables operator names.
The header which doesn't compile  C:/Program Files (x86)/
Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
error: expected member name or ';' after declaration specifiers

  /* [case()] */ NODERESTRICTION or;
   ~~~ ^

   1 error generated.

Contributed for Melanie Blower

Differential Revision:https://reviews.llvm.org/D33505

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.cpp
cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/
Frontend/CompilerInvocation.cpp?rev=303798&r1=303797&r2=303798&view=diff

==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 24 14:31:19 2017
@@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions &O
   Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
   Opts.GNUKeywords);

-  if (Args.hasArg(OPT_fno_operator_names))
+  if (Args.hasArg(OPT_fno_operator_names) || Args.hasArg(OPT_fms_
compatibility))
 Opts.CXXOperatorNames = 0;

   if (Args.hasArg(OPT_fcuda_is_device))

Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/
MicrosoftExtensions.cpp?rev=303798&r1=303797&r2=303798&view=diff

==
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Wed May 24 14:31:19 2017
@@ -261,9 +261,8 @@ int __identifier(else} = __identifier(fo
 #define identifier_weird(x) __identifier(x
 int k = identifier_weird(if)); // expected-error {{use of undeclared
identifier 'if'}}

-// This is a bit weird, but the alternative tokens aren't keywords, and
this
-// behavior matches MSVC. FIXME: Consider supporting this anyway.
-extern int __identifier(and) r; // expected-error {{cannot convert '&&'
token to an identifier}}
+// 'and' is not an operator name with Microsoft compatibility.
+extern int __identifier(and) r; // expected-error {{expected ';' after top
level declarator}}

 void f() {
   __identifier(() // expected-error {{cannot convert '(' t

RE: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Keane, Erich via cfe-commits
How does chromium compiler in CL?  It seems that it would have a similar 
problem here…

From: tha...@google.com [mailto:tha...@google.com] On Behalf Of Nico Weber
Sent: Thursday, May 25, 2017 9:16 AM
To: Blower, Melanie 
Cc: rnk ; Keane, Erich ; cfe-commits 
; Hans Wennborg 
Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

In addition to this making clang-cl silently accept invalid code, it also 
breaks existing valid code, building chromium now fails. Let's revert and come 
up with something better asynchronously.

FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
E:\b\c\goma_client/gomacc.exe 
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo 
/showIncludes /FC 
@obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp /c 
../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp 
/Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj 
/Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,7):
  error: unknown type name 'definition'
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
  ^
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,18):
  error: variable declaration in condition must have an initializer
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
 ^
2 errors generated.


On May 24, 2017 4:01 PM, "Blower, Melanie" 
mailto:melanie.blo...@intel.com>> wrote:
Thanks for the feedback, working on it…

From: Keane, Erich
Sent: Wednesday, May 24, 2017 3:47 PM
To: Nico Weber mailto:tha...@chromium.org>>; Blower, 
Melanie mailto:melanie.blo...@intel.com>>

Cc: cfe-commits 
mailto:cfe-commits@lists.llvm.org>>; rnk 
mailto:r...@chromium.org>>
Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

Adding Melanie, the author of the patch.

From: tha...@google.com [mailto:tha...@google.com] On 
Behalf Of Nico Weber
Sent: Wednesday, May 24, 2017 12:43 PM
To: Keane, Erich mailto:erich.ke...@intel.com>>
Cc: cfe-commits 
mailto:cfe-commits@lists.llvm.org>>; rnk 
mailto:r...@chromium.org>>
Subject: Re: r303798 - For Microsoft compatibility, set fno_operator_names

Reviewed here: https://reviews.llvm.org/D33505

Still, please make this warn.

On Wed, May 24, 2017 at 3:42 PM, Nico Weber 
mailto:tha...@google.com>> wrote:
Was this reviewed somewhere?

Please make it so that this emits a warning. We want clang-cl to warn on 
invalid code (and in system headers warnings are suppressed).

On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Author: erichkeane
Date: Wed May 24 14:31:19 2017
New Revision: 303798

URL: http://llvm.org/viewvc/llvm-project?rev=303798&view=rev
Log:
For Microsoft compatibility, set fno_operator_names

There's a Microsoft header in the Windows SDK which won't
compile with clang because it uses an operator name (and)
as a field name. This patch allows that file to compile by
setting the option which disables operator names.
The header which doesn't compile  C:/Program Files (x86)/
Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
error: expected member name or ';' after declaration specifiers

  /* [case()] */ NODERESTRICTION or;
   ~~~ ^

   1 error generated.

Contributed for Melanie Blower

Differential Revision:https://reviews.llvm.org/D33505

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.cpp
cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=303798&r1=303797&r2=303798&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 24 14:31:19 2017
@@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions &O
   Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
   Opts.GNUKeywords);

-  if (Args.hasArg(OPT_fno_operator_names))
+  if (Args.hasArg(OPT_fno_operator_names) || 
Args.hasArg(OPT_fms_compatibility))
 Opts.CXXOperatorNames = 0;

   if (Args.hasArg(OPT_fcuda_is_device))

Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.cpp?rev=303798&r1=303797&r2=303798&view=diff
==
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Wed May 24 14:31:19 2017
@@ -261,9 +261,8 @@ int __ident

r303880 - Relax testcase to appease buildbots

2017-05-25 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu May 25 11:20:51 2017
New Revision: 303880

URL: http://llvm.org/viewvc/llvm-project?rev=303880&view=rev
Log:
Relax testcase to appease buildbots

When lld isn't built, the tests as they were previously, were too picky about
the path to the linker.

Modified:
cfe/trunk/test/Driver/baremetal.cpp

Modified: cfe/trunk/test/Driver/baremetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/baremetal.cpp?rev=303880&r1=303879&r2=303880&view=diff
==
--- cfe/trunk/test/Driver/baremetal.cpp (original)
+++ cfe/trunk/test/Driver/baremetal.cpp Thu May 25 11:20:51 2017
@@ -10,7 +10,7 @@
 // CHECK-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]/include/c++/v1"
 // CHECk-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]/include"
 // CHECK-V6M-C-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
-// CHECK-V6M-C-NEXT: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-C-NEXT: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
 // CHECK-V6M-C-SAME: "-L[[PREFIX_DIR]]/lib/clang/[[VERSION]]/lib/baremetal"
 // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome/directory/user/asked/for"
 // CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
@@ -32,8 +32,8 @@
 // RUN: -target armv6m-none-eabi \
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-DEFAULTCXX %s
-// CHECK-V6M-DEFAULTCXX: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-DEFAULTCXX-SAME: "-L[[PREFIX_DIR]]/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
@@ -45,8 +45,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-LIBCXX %s
 // CHECK-V6M-LIBCXX-NOT: "-internal-isystem" "{{[^"]+}}/include/c++/{{[^v].*}}"
 // CHECK-V6M-LIBCXX: "-internal-isystem" "{{[^"]+}}/include/c++/v1"
-// CHECK-V6M-LIBCXX: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-LIBCXX-SAME: "-L[[PREFIX_DIR]]/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-LIBCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
 // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
 // CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o"
@@ -58,8 +58,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-LIBSTDCXX %s
 // CHECK-V6M-LIBSTDCXX-NOT: "-internal-isystem" "{{[^"]+}}/include/c++/v1"
 // CHECK-V6M-LIBSTDCXX: "-internal-isystem" "{{[^"]+}}/include/c++/6.0.0"
-// CHECK-V6M-LIBSTDCXX: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-LIBSTDCXX-SAME: "-L[[PREFIX_DIR]]/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-LIBSTDCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
@@ -69,8 +69,8 @@
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN: -nodefaultlibs \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-NDL %s
-// CHECK-V6M-NDL: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-NDL-SAME: "-L[[PREFIX_DIR]]/lib/clang/{{.*}}/lib/baremetal" "-o" 
"{{.*}}.o"
+// CHECK-V6M-NDL: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-NDL-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal" "-o" 
"{{.*}}.o"
 
 // RUN: %clangxx -target arm-none-eabi -v 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-THREAD-MODEL


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


[clang-tools-extra] r303881 - Revert 303872/303877 since the patch that caused these issues

2017-05-25 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 25 11:23:00 2017
New Revision: 303881

URL: http://llvm.org/viewvc/llvm-project?rev=303881&view=rev
Log:
Revert 303872/303877 since the patch that caused these issues 
is also being reverted.

Modified:

clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp?rev=303881&r1=303880&r2=303881&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
 (original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast-allow-conditional-casts.cpp
 Thu May 25 11:23:00 2017
@@ -2,7 +2,7 @@
 // RUN: -config='{CheckOptions: \
 // RUN:  [{key: readability-implicit-bool-cast.AllowConditionalIntegerCasts, 
value: 1}, \
 // RUN:   {key: readability-implicit-bool-cast.AllowConditionalPointerCasts, 
value: 1}]}' \
-// RUN: -- -std=c++11 -fno-ms-compatibility
+// RUN: -- -std=c++11
 
 template
 void functionTaking(T);

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp?rev=303881&r1=303880&r2=303881&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
Thu May 25 11:23:00 2017
@@ -264,7 +264,7 @@ void implicitCastInNegationExpressions()
   // CHECK-FIXES: bool boolComingFromNegatedChar = (character == 0);
 
   int* pointer = nullptr;
-  bool boolComingFromNegatedPointer = ! pointer;
+  bool boolComingFromNegatedPointer = not  pointer;
   // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: implicit cast 'int *' -> bool
   // CHECK-FIXES: bool boolComingFromNegatedPointer = pointer == nullptr;
 }


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


r303882 - Revert MSVC CXXOperatorNames patch due to issues with Chromium

2017-05-25 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 25 11:24:49 2017
New Revision: 303882

URL: http://llvm.org/viewvc/llvm-project?rev=303882&view=rev
Log:
Revert MSVC CXXOperatorNames patch due to issues with Chromium

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.cpp
cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=303882&r1=303881&r2=303882&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu May 25 11:24:49 2017
@@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions &O
   Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
   Opts.GNUKeywords);
 
-  if (Args.hasArg(OPT_fno_operator_names) || 
Args.hasArg(OPT_fms_compatibility))
+  if (Args.hasArg(OPT_fno_operator_names))
 Opts.CXXOperatorNames = 0;
 
   if (Args.hasArg(OPT_fcuda_is_device))

Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.cpp?rev=303882&r1=303881&r2=303882&view=diff
==
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Thu May 25 11:24:49 2017
@@ -261,8 +261,9 @@ int __identifier(else} = __identifier(fo
 #define identifier_weird(x) __identifier(x
 int k = identifier_weird(if)); // expected-error {{use of undeclared 
identifier 'if'}}
 
-// 'and' is not an operator name with Microsoft compatibility.
-extern int __identifier(and) r; // expected-error {{expected ';' after top 
level declarator}}
+// This is a bit weird, but the alternative tokens aren't keywords, and this
+// behavior matches MSVC. FIXME: Consider supporting this anyway.
+extern int __identifier(and) r; // expected-error {{cannot convert '&&' token 
to an identifier}}
 
 void f() {
   __identifier(() // expected-error {{cannot convert '(' token to an 
identifier}}
@@ -354,6 +355,7 @@ void TestProperty() {
   ++sp.V11;
 }
 
+//expected-warning@+1 {{C++ operator 'and' (aka '&&') used as a macro name}}
 #define and foo
 
 struct __declspec(uuid("---C000-0046")) 
__declspec(novtable) IUnknown {};

Modified: cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp?rev=303882&r1=303881&r2=303882&view=diff
==
--- cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp (original)
+++ cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp Thu May 25 11:24:49 2017
@@ -1,6 +1,5 @@
 // RUN: %clang_cc1 %s -E -verify -DOPERATOR_NAMES
 // RUN: %clang_cc1 %s -E -verify -fno-operator-names
-// RUN: %clang_cc1 %s-verify -DTESTWIN -fms-compatibility
 
 #ifndef OPERATOR_NAMES
 //expected-error@+3 {{token is not a valid binary operator in a preprocessor 
subexpression}}
@@ -30,14 +29,3 @@
 #ifdef and
 #warning and is defined
 #endif
-
-#ifdef TESTWIN
-// For cl compatibility, fno-operator-names is enabled by default.
-int and;
-int bitand;
-int bitor;
-int compl;
-int not;
-int or;
-int xor;
-#endif


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


RE: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Keane, Erich via cfe-commits
Patch and Buildbot fixes all reverted as of –r303882.  Sorry for the thrash.

From: tha...@google.com [mailto:tha...@google.com] On Behalf Of Nico Weber
Sent: Thursday, May 25, 2017 9:16 AM
To: Blower, Melanie 
Cc: rnk ; Keane, Erich ; cfe-commits 
; Hans Wennborg 
Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

In addition to this making clang-cl silently accept invalid code, it also 
breaks existing valid code, building chromium now fails. Let's revert and come 
up with something better asynchronously.

FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
E:\b\c\goma_client/gomacc.exe 
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo 
/showIncludes /FC 
@obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp /c 
../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp 
/Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj 
/Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,7):
  error: unknown type name 'definition'
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
  ^
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,18):
  error: variable declaration in condition must have an initializer
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
 ^
2 errors generated.


On May 24, 2017 4:01 PM, "Blower, Melanie" 
mailto:melanie.blo...@intel.com>> wrote:
Thanks for the feedback, working on it…

From: Keane, Erich
Sent: Wednesday, May 24, 2017 3:47 PM
To: Nico Weber mailto:tha...@chromium.org>>; Blower, 
Melanie mailto:melanie.blo...@intel.com>>

Cc: cfe-commits 
mailto:cfe-commits@lists.llvm.org>>; rnk 
mailto:r...@chromium.org>>
Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

Adding Melanie, the author of the patch.

From: tha...@google.com [mailto:tha...@google.com] On 
Behalf Of Nico Weber
Sent: Wednesday, May 24, 2017 12:43 PM
To: Keane, Erich mailto:erich.ke...@intel.com>>
Cc: cfe-commits 
mailto:cfe-commits@lists.llvm.org>>; rnk 
mailto:r...@chromium.org>>
Subject: Re: r303798 - For Microsoft compatibility, set fno_operator_names

Reviewed here: https://reviews.llvm.org/D33505

Still, please make this warn.

On Wed, May 24, 2017 at 3:42 PM, Nico Weber 
mailto:tha...@google.com>> wrote:
Was this reviewed somewhere?

Please make it so that this emits a warning. We want clang-cl to warn on 
invalid code (and in system headers warnings are suppressed).

On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Author: erichkeane
Date: Wed May 24 14:31:19 2017
New Revision: 303798

URL: http://llvm.org/viewvc/llvm-project?rev=303798&view=rev
Log:
For Microsoft compatibility, set fno_operator_names

There's a Microsoft header in the Windows SDK which won't
compile with clang because it uses an operator name (and)
as a field name. This patch allows that file to compile by
setting the option which disables operator names.
The header which doesn't compile  C:/Program Files (x86)/
Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
error: expected member name or ';' after declaration specifiers

  /* [case()] */ NODERESTRICTION or;
   ~~~ ^

   1 error generated.

Contributed for Melanie Blower

Differential Revision:https://reviews.llvm.org/D33505

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.cpp
cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=303798&r1=303797&r2=303798&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 24 14:31:19 2017
@@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions &O
   Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
   Opts.GNUKeywords);

-  if (Args.hasArg(OPT_fno_operator_names))
+  if (Args.hasArg(OPT_fno_operator_names) || 
Args.hasArg(OPT_fms_compatibility))
 Opts.CXXOperatorNames = 0;

   if (Args.hasArg(OPT_fcuda_is_device))

Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.cpp?rev=303798&r1=303797&r2=303798&view=diff
==
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Wed May 24 14:31:19 2017
@@ -261,9 +261,8 @@ int __identifier(else}

Re: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Nico Weber via cfe-commits
On Thu, May 25, 2017 at 12:18 PM, Keane, Erich 
wrote:

> How does chromium compiler in CL?  It seems that it would have a similar
> problem here…
>

That's a good question! It looks like iso646.h is included, and in MSVC
that contains something like `#define and &&`. But clang's
lib/Headers/iso646.h assumes that the compiler provides this and doesn't
define `and`. So for the reland, that header would have to check if the
operator name is disabled, and if so, define it. (Or, better, maybe we can
come up with something more targeted for the system header, similar to e.g.
http://llvm.org/viewvc/llvm-project?view=revision&revision=212238)

Thanks for the revert!


>
>
> *From:* tha...@google.com [mailto:tha...@google.com] *On Behalf Of *Nico
> Weber
> *Sent:* Thursday, May 25, 2017 9:16 AM
> *To:* Blower, Melanie 
> *Cc:* rnk ; Keane, Erich ;
> cfe-commits ; Hans Wennborg  >
>
> *Subject:* RE: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> In addition to this making clang-cl silently accept invalid code, it also
> breaks existing valid code, building chromium now fails. Let's revert and
> come up with something better asynchronously.
>
>
>
> FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
>
>
> E:\b\c\goma_client/gomacc.exe ../../third_party/llvm-build/R
> elease+Asserts/bin/clang-cl.exe /nologo /showIncludes /FC
> @obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp
> /c ../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
> /Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
> /Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
>
> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\cu
> stom\CustomElementRegistry.cpp(229,7):  error: unknown type name
> 'definition'
>
>   if (definition and definition->Descriptor().LocalName() ==
> desc.LocalName()) {
>
>   ^
>
> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\cu
> stom\CustomElementRegistry.cpp(229,18):  error: variable declaration in
> condition must have an initializer
>
>   if (definition and definition->Descriptor().LocalName() ==
> desc.LocalName()) {
>
>  ^
>
> 2 errors generated.
>
>
>
>
>
> On May 24, 2017 4:01 PM, "Blower, Melanie" 
> wrote:
>
> Thanks for the feedback, working on it…
>
>
>
> *From:* Keane, Erich
> *Sent:* Wednesday, May 24, 2017 3:47 PM
> *To:* Nico Weber ; Blower, Melanie <
> melanie.blo...@intel.com>
>
>
> *Cc:* cfe-commits ; rnk 
>
> *Subject:* RE: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> Adding Melanie, the author of the patch.
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com ] *On
> Behalf Of *Nico Weber
> *Sent:* Wednesday, May 24, 2017 12:43 PM
> *To:* Keane, Erich 
> *Cc:* cfe-commits ; rnk 
> *Subject:* Re: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> Reviewed here: https://reviews.llvm.org/D33505
>
>
> Still, please make this warn.
>
>
>
> On Wed, May 24, 2017 at 3:42 PM, Nico Weber  wrote:
>
> Was this reviewed somewhere?
>
>
>
> Please make it so that this emits a warning. We want clang-cl to warn on
> invalid code (and in system headers warnings are suppressed).
>
>
>
> On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: erichkeane
> Date: Wed May 24 14:31:19 2017
> New Revision: 303798
>
> URL: http://llvm.org/viewvc/llvm-project?rev=303798&view=rev
> Log:
> For Microsoft compatibility, set fno_operator_names
>
> There's a Microsoft header in the Windows SDK which won't
> compile with clang because it uses an operator name (and)
> as a field name. This patch allows that file to compile by
> setting the option which disables operator names.
> The header which doesn't compile  C:/Program Files (x86)/
> Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
> error: expected member name or ';' after declaration specifiers
>
>   /* [case()] */ NODERESTRICTION or;
>~~~ ^
>
>1 error generated.
>
> Contributed for Melanie Blower
>
> Differential Revision:https://reviews.llvm.org/D33505
>
> Modified:
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/test/Parser/MicrosoftExtensions.cpp
> cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/
> CompilerInvocation.cpp?rev=303798&r1=303797&r2=303798&view=diff
> 
> ==
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 24 14:31:19 2017
> @@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions &O
>Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords,
> OPT_fno_gnu_keywords,
>Opts.GNUKeywords);
>
> -  if (Args.hasArg(OPT_fno_

RE: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Blower, Melanie via cfe-commits
Sometimes it’s possible to reason with the open source community, then they 
change their code and make modifications which accommodate the various 
compilers. E.g. we could ask chromium team if they could use the operator 
symbol instead of ‘and’.

From: Nico Weber [mailto:tha...@google.com]
Sent: Thursday, May 25, 2017 12:56 PM
To: Keane, Erich 
Cc: Blower, Melanie ; rnk ; 
cfe-commits ; Hans Wennborg 
Subject: Re: r303798 - For Microsoft compatibility, set fno_operator_names

On Thu, May 25, 2017 at 12:18 PM, Keane, Erich 
mailto:erich.ke...@intel.com>> wrote:
How does chromium compiler in CL?  It seems that it would have a similar 
problem here…

That's a good question! It looks like iso646.h is included, and in MSVC that 
contains something like `#define and &&`. But clang's lib/Headers/iso646.h 
assumes that the compiler provides this and doesn't define `and`. So for the 
reland, that header would have to check if the operator name is disabled, and 
if so, define it. (Or, better, maybe we can come up with something more 
targeted for the system header, similar to e.g. 
http://llvm.org/viewvc/llvm-project?view=revision&revision=212238)

Thanks for the revert!


From: tha...@google.com 
[mailto:tha...@google.com] On Behalf Of Nico Weber
Sent: Thursday, May 25, 2017 9:16 AM
To: Blower, Melanie mailto:melanie.blo...@intel.com>>
Cc: rnk mailto:r...@chromium.org>>; Keane, Erich 
mailto:erich.ke...@intel.com>>; cfe-commits 
mailto:cfe-commits@lists.llvm.org>>; Hans Wennborg 
mailto:h...@chromium.org>>

Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

In addition to this making clang-cl silently accept invalid code, it also 
breaks existing valid code, building chromium now fails. Let's revert and come 
up with something better asynchronously.

FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
E:\b\c\goma_client/gomacc.exe 
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo 
/showIncludes /FC 
@obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp /c 
../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp 
/Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj 
/Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,7):
  error: unknown type name 'definition'
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
  ^
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,18):
  error: variable declaration in condition must have an initializer
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
 ^
2 errors generated.


On May 24, 2017 4:01 PM, "Blower, Melanie" 
mailto:melanie.blo...@intel.com>> wrote:
Thanks for the feedback, working on it…

From: Keane, Erich
Sent: Wednesday, May 24, 2017 3:47 PM
To: Nico Weber mailto:tha...@chromium.org>>; Blower, 
Melanie mailto:melanie.blo...@intel.com>>

Cc: cfe-commits 
mailto:cfe-commits@lists.llvm.org>>; rnk 
mailto:r...@chromium.org>>
Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

Adding Melanie, the author of the patch.

From: tha...@google.com [mailto:tha...@google.com] On 
Behalf Of Nico Weber
Sent: Wednesday, May 24, 2017 12:43 PM
To: Keane, Erich mailto:erich.ke...@intel.com>>
Cc: cfe-commits 
mailto:cfe-commits@lists.llvm.org>>; rnk 
mailto:r...@chromium.org>>
Subject: Re: r303798 - For Microsoft compatibility, set fno_operator_names

Reviewed here: https://reviews.llvm.org/D33505

Still, please make this warn.

On Wed, May 24, 2017 at 3:42 PM, Nico Weber 
mailto:tha...@google.com>> wrote:
Was this reviewed somewhere?

Please make it so that this emits a warning. We want clang-cl to warn on 
invalid code (and in system headers warnings are suppressed).

On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Author: erichkeane
Date: Wed May 24 14:31:19 2017
New Revision: 303798

URL: http://llvm.org/viewvc/llvm-project?rev=303798&view=rev
Log:
For Microsoft compatibility, set fno_operator_names

There's a Microsoft header in the Windows SDK which won't
compile with clang because it uses an operator name (and)
as a field name. This patch allows that file to compile by
setting the option which disables operator names.
The header which doesn't compile  C:/Program Files (x86)/
Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
error: expected member name or ';' after declaration specifiers

  /* [case()] */ NODERESTRICTION or;
   ~~~ ^

   1 error generated.

Contributed for Melanie Blower

Differential Revision:https://reviews.llvm.org/D33505

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Parser/Mic

RE: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Keane, Erich via cfe-commits
No problem, I definitely think it was the right choice.

A change that contains all of what Melanie’s original patch did, plus the 
Header changes (plus the clang-tidy fixes that came out of this) would be 
acceptable?

Also, I believe she’s working on the warning as well.  We were discussing it, 
and I was thinking that if we track down where the operator-identification is 
done (hints as to where that is is appreciated), that we could simply warn if 
the user is using one of the Operators with operators off.  The warning itself 
could then be suppressed if necessary.

Thoughts?


From: Nico Weber [mailto:tha...@google.com]
Sent: Thursday, May 25, 2017 9:56 AM
To: Keane, Erich 
Cc: Blower, Melanie ; rnk ; 
cfe-commits ; Hans Wennborg 
Subject: Re: r303798 - For Microsoft compatibility, set fno_operator_names

On Thu, May 25, 2017 at 12:18 PM, Keane, Erich 
mailto:erich.ke...@intel.com>> wrote:
How does chromium compiler in CL?  It seems that it would have a similar 
problem here…

That's a good question! It looks like iso646.h is included, and in MSVC that 
contains something like `#define and &&`. But clang's lib/Headers/iso646.h 
assumes that the compiler provides this and doesn't define `and`. So for the 
reland, that header would have to check if the operator name is disabled, and 
if so, define it. (Or, better, maybe we can come up with something more 
targeted for the system header, similar to e.g. 
http://llvm.org/viewvc/llvm-project?view=revision&revision=212238)

Thanks for the revert!


From: tha...@google.com 
[mailto:tha...@google.com] On Behalf Of Nico Weber
Sent: Thursday, May 25, 2017 9:16 AM
To: Blower, Melanie mailto:melanie.blo...@intel.com>>
Cc: rnk mailto:r...@chromium.org>>; Keane, Erich 
mailto:erich.ke...@intel.com>>; cfe-commits 
mailto:cfe-commits@lists.llvm.org>>; Hans Wennborg 
mailto:h...@chromium.org>>

Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

In addition to this making clang-cl silently accept invalid code, it also 
breaks existing valid code, building chromium now fails. Let's revert and come 
up with something better asynchronously.

FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
E:\b\c\goma_client/gomacc.exe 
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo 
/showIncludes /FC 
@obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp /c 
../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp 
/Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj 
/Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,7):
  error: unknown type name 'definition'
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
  ^
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,18):
  error: variable declaration in condition must have an initializer
  if (definition and definition->Descriptor().LocalName() == desc.LocalName()) {
 ^
2 errors generated.


On May 24, 2017 4:01 PM, "Blower, Melanie" 
mailto:melanie.blo...@intel.com>> wrote:
Thanks for the feedback, working on it…

From: Keane, Erich
Sent: Wednesday, May 24, 2017 3:47 PM
To: Nico Weber mailto:tha...@chromium.org>>; Blower, 
Melanie mailto:melanie.blo...@intel.com>>

Cc: cfe-commits 
mailto:cfe-commits@lists.llvm.org>>; rnk 
mailto:r...@chromium.org>>
Subject: RE: r303798 - For Microsoft compatibility, set fno_operator_names

Adding Melanie, the author of the patch.

From: tha...@google.com [mailto:tha...@google.com] On 
Behalf Of Nico Weber
Sent: Wednesday, May 24, 2017 12:43 PM
To: Keane, Erich mailto:erich.ke...@intel.com>>
Cc: cfe-commits 
mailto:cfe-commits@lists.llvm.org>>; rnk 
mailto:r...@chromium.org>>
Subject: Re: r303798 - For Microsoft compatibility, set fno_operator_names

Reviewed here: https://reviews.llvm.org/D33505

Still, please make this warn.

On Wed, May 24, 2017 at 3:42 PM, Nico Weber 
mailto:tha...@google.com>> wrote:
Was this reviewed somewhere?

Please make it so that this emits a warning. We want clang-cl to warn on 
invalid code (and in system headers warnings are suppressed).

On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Author: erichkeane
Date: Wed May 24 14:31:19 2017
New Revision: 303798

URL: http://llvm.org/viewvc/llvm-project?rev=303798&view=rev
Log:
For Microsoft compatibility, set fno_operator_names

There's a Microsoft header in the Windows SDK which won't
compile with clang because it uses an operator name (and)
as a field name. This patch allows that file to compile by
setting the option which disables operator names.
The header which doesn't compile  C:/Program Files (x86)/
Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
error: expected m

[PATCH] D33082: Fix Libc++ build with MinGW64

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked 6 inline comments as done.
EricWF added inline comments.



Comment at: include/__locale:370
 static const mask blank  = _ISblank;
-#elif defined(_LIBCPP_MSVCRT)
+#elif defined(_LIBCPP_WIN32API)
 typedef unsigned short mask;

compnerd wrote:
> Are these really Win32?  These are really more libc compatibility things I 
> thought?
So `_LIBCPP_MSVCRT_LIKE`?



Comment at: include/stdio.h:113
 // snprintf
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_WIN32API)
 extern "C" {

compnerd wrote:
> Again, I dont think that this is Win32 API related.  This is a libc 
> implementation detail.  If I were to build libc++ against musl and Win32, 
> these would be present, right?
Changing to `_LIBCPP_MSVCRT_LIKE`. 



Comment at: include/wchar.h:169
 
-#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT)
+#if defined(__cplusplus) && defined(_LIBCPP_WIN32API) // Needed in MinGW as 
well
 extern "C" {

compnerd wrote:
> Again not sure that this is Win32 API specific.
Changed to `_LIBCPP_MSVCRT_LIKE`.



Comment at: src/system_error.cpp:68
 
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_WIN32API)
 string do_strerror_r(int ev) {

compnerd wrote:
> I think that MSVCRT is more appropriate here.
Changed to `MSVCRT_LIKE`.


https://reviews.llvm.org/D33082



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


[PATCH] D33416: [clangd] Allow to use vfs::FileSystem for file accesses.

2017-05-25 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 100262.
ilya-biryukov added a comment.

- Fixed file comment of ClangdTests.cpp


https://reviews.llvm.org/D33416

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  clangd/ClangdUnitStore.h
  unittests/CMakeLists.txt
  unittests/clangd/CMakeLists.txt
  unittests/clangd/ClangdTests.cpp

Index: unittests/clangd/ClangdTests.cpp
===
--- /dev/null
+++ unittests/clangd/ClangdTests.cpp
@@ -0,0 +1,364 @@
+//===-- ClangdTests.cpp - Clangd unit tests -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ClangdServer.h"
+#include "clang/Basic/VirtualFileSystem.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/Config/config.h"
+#include "llvm/Support/Errc.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Regex.h"
+#include "gtest/gtest.h"
+#include 
+#include 
+#include 
+#include 
+
+namespace clang {
+namespace vfs {
+
+/// An implementation of vfs::FileSystem that only allows access to
+/// files and folders inside a set of whitelisted directories.
+///
+/// FIXME(ibiryukov): should it also emulate access to parents of whitelisted
+/// directories with only whitelisted contents?
+class FilteredFileSystem : public vfs::FileSystem {
+public:
+  /// The paths inside \p WhitelistedDirs should be absolute
+  FilteredFileSystem(std::vector WhitelistedDirs,
+ IntrusiveRefCntPtr InnerFS)
+  : WhitelistedDirs(std::move(WhitelistedDirs)), InnerFS(InnerFS) {
+assert(std::all_of(WhitelistedDirs.begin(), WhitelistedDirs.end(),
+   [](const std::string &Path) -> bool {
+ return llvm::sys::path::is_absolute(Path);
+   }) &&
+   "Not all WhitelistedDirs are absolute");
+  }
+
+  virtual llvm::ErrorOr status(const Twine &Path) {
+if (!isInsideWhitelistedDir(Path))
+  return llvm::errc::no_such_file_or_directory;
+return InnerFS->status(Path);
+  }
+
+  virtual llvm::ErrorOr>
+  openFileForRead(const Twine &Path) {
+if (!isInsideWhitelistedDir(Path))
+  return llvm::errc::no_such_file_or_directory;
+return InnerFS->openFileForRead(Path);
+  }
+
+  llvm::ErrorOr>
+  getBufferForFile(const Twine &Name, int64_t FileSize = -1,
+   bool RequiresNullTerminator = true,
+   bool IsVolatile = false) {
+if (!isInsideWhitelistedDir(Name))
+  return llvm::errc::no_such_file_or_directory;
+return InnerFS->getBufferForFile(Name, FileSize, RequiresNullTerminator,
+ IsVolatile);
+  }
+
+  virtual directory_iterator dir_begin(const Twine &Dir, std::error_code &EC) {
+if (!isInsideWhitelistedDir(Dir)) {
+  EC = llvm::errc::no_such_file_or_directory;
+  return directory_iterator();
+}
+return InnerFS->dir_begin(Dir, EC);
+  }
+
+  virtual std::error_code setCurrentWorkingDirectory(const Twine &Path) {
+return InnerFS->setCurrentWorkingDirectory(Path);
+  }
+
+  virtual llvm::ErrorOr getCurrentWorkingDirectory() const {
+return InnerFS->getCurrentWorkingDirectory();
+  }
+
+  bool exists(const Twine &Path) {
+if (!isInsideWhitelistedDir(Path))
+  return false;
+return InnerFS->exists(Path);
+  }
+
+  std::error_code makeAbsolute(SmallVectorImpl &Path) const {
+return InnerFS->makeAbsolute(Path);
+  }
+
+private:
+  bool isInsideWhitelistedDir(const Twine &InputPath) const {
+SmallString<128> Path;
+InputPath.toVector(Path);
+
+if (makeAbsolute(Path))
+  return false;
+
+for (const auto &Dir : WhitelistedDirs) {
+  if (Path.startswith(Dir))
+return true;
+}
+return false;
+  }
+
+  std::vector WhitelistedDirs;
+  IntrusiveRefCntPtr InnerFS;
+};
+
+/// Create a vfs::FileSystem that has access only to temporary directories
+/// (obtained by calling system_temp_directory).
+IntrusiveRefCntPtr getTempOnlyFS() {
+  llvm::SmallString<128> TmpDir1;
+  llvm::sys::path::system_temp_directory(/*erasedOnReboot=*/false, TmpDir1);
+  llvm::SmallString<128> TmpDir2;
+  llvm::sys::path::system_temp_directory(/*erasedOnReboot=*/true, TmpDir2);
+
+  std::vector TmpDirs;
+  TmpDirs.push_back(TmpDir1.str());
+  if (TmpDir2 != TmpDir2)
+TmpDirs.push_back(TmpDir2.str());
+  return new vfs::FilteredFileSystem(std::move(TmpDirs),
+ vfs::getRealFileSystem());
+}
+} // namespace vfs
+
+namespace clangd {
+namespace {
+
+class ErrorCheckingDiagConsumer : public DiagnosticsConsumer {
+public:
+  void onDiagnosticsReady(PathRef File,
+  std::ve

Re: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Nico Weber via cfe-commits
Among the goals of the clang-cl project are a) being able to parse MS
system headers b) helper users to write standards-compliant C++ (in
particular, if your code builds with clang-cl without warnings, it'd be
good if it also built with regular clang then).

The regular change plus header change plus warning would be one way to
achieve this, yes.

On Thu, May 25, 2017 at 1:01 PM, Keane, Erich  wrote:

> No problem, I definitely think it was the right choice.
>
>
>
> A change that contains all of what Melanie’s original patch did, plus the
> Header changes (plus the clang-tidy fixes that came out of this) would be
> acceptable?
>
>
>
> Also, I believe she’s working on the warning as well.  We were discussing
> it, and I was thinking that if we track down where the
> operator-identification is done (hints as to where that is is appreciated),
> that we could simply warn if the user is using one of the Operators with
> operators off.  The warning itself could then be suppressed if necessary.
>
>
>
> Thoughts?
>
>
>
>
>
> *From:* Nico Weber [mailto:tha...@google.com]
> *Sent:* Thursday, May 25, 2017 9:56 AM
> *To:* Keane, Erich 
> *Cc:* Blower, Melanie ; rnk ;
> cfe-commits ; Hans Wennborg  >
>
> *Subject:* Re: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> On Thu, May 25, 2017 at 12:18 PM, Keane, Erich 
> wrote:
>
> How does chromium compiler in CL?  It seems that it would have a similar
> problem here…
>
>
>
> That's a good question! It looks like iso646.h is included, and in MSVC
> that contains something like `#define and &&`. But clang's
> lib/Headers/iso646.h assumes that the compiler provides this and doesn't
> define `and`. So for the reland, that header would have to check if the
> operator name is disabled, and if so, define it. (Or, better, maybe we can
> come up with something more targeted for the system header, similar to e.g.
> http://llvm.org/viewvc/llvm-project?view=revision&revision=212238)
>
>
>
> Thanks for the revert!
>
>
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com] *On Behalf Of *Nico
> Weber
> *Sent:* Thursday, May 25, 2017 9:16 AM
> *To:* Blower, Melanie 
> *Cc:* rnk ; Keane, Erich ;
> cfe-commits ; Hans Wennborg  >
>
>
> *Subject:* RE: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> In addition to this making clang-cl silently accept invalid code, it also
> breaks existing valid code, building chromium now fails. Let's revert and
> come up with something better asynchronously.
>
>
>
> FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
>
>
> E:\b\c\goma_client/gomacc.exe ../../third_party/llvm-build/
> Release+Asserts/bin/clang-cl.exe /nologo /showIncludes /FC
> @obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp
> /c ../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
> /Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
> /Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
>
> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\
> custom\CustomElementRegistry.cpp(229,7):  error: unknown type name
> 'definition'
>
>   if (definition and definition->Descriptor().LocalName() ==
> desc.LocalName()) {
>
>   ^
>
> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\
> custom\CustomElementRegistry.cpp(229,18):  error: variable declaration in
> condition must have an initializer
>
>   if (definition and definition->Descriptor().LocalName() ==
> desc.LocalName()) {
>
>  ^
>
> 2 errors generated.
>
>
>
>
>
> On May 24, 2017 4:01 PM, "Blower, Melanie" 
> wrote:
>
> Thanks for the feedback, working on it…
>
>
>
> *From:* Keane, Erich
> *Sent:* Wednesday, May 24, 2017 3:47 PM
> *To:* Nico Weber ; Blower, Melanie <
> melanie.blo...@intel.com>
>
>
> *Cc:* cfe-commits ; rnk 
>
> *Subject:* RE: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> Adding Melanie, the author of the patch.
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com ] *On
> Behalf Of *Nico Weber
> *Sent:* Wednesday, May 24, 2017 12:43 PM
> *To:* Keane, Erich 
> *Cc:* cfe-commits ; rnk 
> *Subject:* Re: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> Reviewed here: https://reviews.llvm.org/D33505
>
>
> Still, please make this warn.
>
>
>
> On Wed, May 24, 2017 at 3:42 PM, Nico Weber  wrote:
>
> Was this reviewed somewhere?
>
>
>
> Please make it so that this emits a warning. We want clang-cl to warn on
> invalid code (and in system headers warnings are suppressed).
>
>
>
> On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: erichkeane
> Date: Wed May 24 14:31:19 2017
> New Revision: 303798
>
> URL: http://llvm.org/viewvc/llvm-project?rev=303798&view=rev
> Log:
> For Microsoft compatibility, set fno_operator_names
>
> There's a Microsoft header in the Windows SDK which won't
> compile with clang because it uses an operator name (and)
> a

[PATCH] D33537: [clang-tidy] Exception Escape Checker

2017-05-25 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment.

Please mention this check in docs/ReleaseNotes.rst (in alphabetical order).




Comment at: docs/clang-tidy/checks/misc-exception-escape.rst:7
+Finds functions which should not throw exceptions:
++ Destructors
++ Copy constructors

I think - or * is more correct.



Comment at: docs/clang-tidy/checks/misc-exception-escape.rst:10
++ Copy assignment operators
++ The main() functions
++ swap() functions

Please enclose main() in ``. Same for other functions and keywords.



Comment at: docs/clang-tidy/checks/misc-exception-escape.rst:29
+   Comma separated list containing function names which should not throw. An
+   example for using this parameter is the function WinMain in the Windows API.
+   Default vale is empty string.

Please add () to WinMain and enclose it in ``.



Comment at: docs/clang-tidy/checks/misc-exception-escape.rst:35
+   Comma separated list containing type names which are not counted as thrown
+   exceptions in the checker. Default value is empty string.

Please use check instead of checker.


https://reviews.llvm.org/D33537



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


[PATCH] D33082: Fix Libc++ build with MinGW64

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked 3 inline comments as done.
EricWF added a comment.

In https://reviews.llvm.org/D33082#760516, @martell wrote:

> I want to give some context here to dispel the confusion of what is and isn't 
> win32 api specific.
>
> First lets take `vasprintf` and `asprintf ` which are not implemented in 
> msvcrt.
>  In mingw-w64 we would just have posix implementations of both.
>  They are hidden behind the guard `_GNU_SOURCE`, we don't need to declare 
> them in `include/stdio.h` in libcxx but
>  By default gcc doesn't pass this flag for the mingw target so we should add 
> it in cmake within libc++.


Defining `_GNU_SOURCE` during the library build isn't enough, it's also has to 
be defined when people are using the headers,
and in that case we must depend on the compiler to pre-define it. Is it 
important that MinGW not define `_GNU_SOURCE` by default?

Also do you know why `asprintf` is declared by mingw-w64 but `vasprintf` isn't? 
At minimum I think we still need to declare `vasprintf` in the
headers because we can't count on `_GNU_SOURCE` being defined before 
`` is first included, but we should be able to omit
the definition.

> Next example `mbsnrtowcs` and `wcsnrtombs` above
>  There is technically a win32api specific implementation in msvc. The 
> mingw-w64 implementation or lack there of would rely on the MSVC 
> implementation.
>  This is why a custom implementation lives in libc++ in `support.cpp` that is 
> posix compliant.

Good to know.

> Unfortunately a posix implementation might not be accepted upstream into 
> mingw-w64 because they need to maintain compatibility with msvc, even with 
> some bugs eek.

I'm not personally concerned about upstreaming MinGW-w64 changes/fixes. If we 
can adequately solve it within libc++ without any terrible hacks I'm happy with 
that for now.

> It generally comes down to if a bunch of projects are using it already and we 
> should not disrupt them relying on msvc implementations/bugs.
>  This is probably not the case for these two functions but there are many 
> others already in the library that follow this guideline.

Are you suggesting that libc++ should stop declaring/defining these functions, 
at least publically?

> A good read of this specific bug is here.
>  http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20130325/077071.html
> 
> @smeenai suggestion of `_LIBCPP_MSVCRT_LIKE` makes a lot of sense here 
> because mingw-w64 is only partially posixy, this leaves room for future 
> possible targets like midipix which uses musl libc to ignore this section of 
> code where mingw and msvc opt in.




https://reviews.llvm.org/D33082



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


[clang-tools-extra] r303884 - [Documentation] Mention hicpp check group in Clang-tidy main document.

2017-05-25 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Thu May 25 12:22:29 2017
New Revision: 303884

URL: http://llvm.org/viewvc/llvm-project?rev=303884&view=rev
Log:
[Documentation] Mention hicpp check group in Clang-tidy main document.

Modified:
clang-tools-extra/trunk/docs/clang-tidy/index.rst

Modified: clang-tools-extra/trunk/docs/clang-tidy/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/index.rst?rev=303884&r1=303883&r2=303884&view=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/index.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/index.rst Thu May 25 12:22:29 2017
@@ -59,7 +59,8 @@ Name prefixDescription
 ``cert-``  Checks related to CERT Secure Coding Guidelines.
 ``cppcoreguidelines-`` Checks related to C++ Core Guidelines.
 ``clang-analyzer-``Clang Static Analyzer checks.
-``google-``Checks related to the Google coding conventions.
+``google-``Checks related to Google coding conventions.
+``hicpp-`` Checks related to High Integrity C++ Coding Standard.
 ``llvm-``  Checks related to the LLVM coding conventions.
 ``misc-``  Checks that we didn't have a better category for.
 ``modernize-`` Checks that advocate usage of modern (currently "modern"
@@ -652,7 +653,7 @@ The script provides multiple configurati
 * To restrict the files examined you can provide one or more regex arguments
   that the file names are matched against.
   ``run-clang-tidy.py clang-tidy/.*Check\.cpp`` will only analyze clang-tidy
-  checkers. It may also be necessary to restrict the header files warnings are
+  checks. It may also be necessary to restrict the header files warnings are
   displayed from using the ``-header-filter`` flag. It has the same behavior
   as the corresponding :program:`clang-tidy` flag.
 


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


[PATCH] D33082: Fix Libc++ build with MinGW64

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 100263.
EricWF added a comment.

Add `_LIBCPP_MSVCRT_LIKE` and use it to replace `_LIBCPP_WIN32API` where 
appropriate.


https://reviews.llvm.org/D33082

Files:
  include/__config
  include/__locale
  include/locale
  include/stdio.h
  include/support/win32/locale_win32.h
  include/wchar.h
  src/chrono.cpp
  src/new.cpp
  src/support/win32/locale_win32.cpp
  src/support/win32/support.cpp
  src/system_error.cpp
  src/thread.cpp

Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -34,7 +34,7 @@
 
 #if defined(_LIBCPP_WIN32API)
 #include 
-#endif // defined(_LIBCPP_WIN32API)
+#endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
Index: src/system_error.cpp
===
--- src/system_error.cpp
+++ src/system_error.cpp
@@ -65,7 +65,7 @@
 
 string do_strerror_r(int ev);
 
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 string do_strerror_r(int ev) {
   char buffer[strerror_buff_size];
   if (::strerror_s(buffer, strerror_buff_size, ev) == 0)
Index: src/support/win32/support.cpp
===
--- src/support/win32/support.cpp
+++ src/support/win32/support.cpp
@@ -16,7 +16,7 @@
 #include   // mbstate_t
 
 // Some of these functions aren't standard or if they conform, the name does not.
-
+#if defined(_LIBCPP_MSVCRT)
 int asprintf(char **sptr, const char *__restrict format, ...)
 {
 va_list ap;
@@ -26,6 +26,7 @@
 va_end(ap);
 return result;
 }
+#endif
 
 // Like sprintf, but when return value >= 0 it returns
 // a pointer to a malloc'd string in *sptr.
Index: src/support/win32/locale_win32.cpp
===
--- src/support/win32/locale_win32.cpp
+++ src/support/win32/locale_win32.cpp
@@ -34,6 +34,18 @@
 // uselocale returns the old locale_t
 return old_locale;
 }
+
+decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
+{
+#if defined(_LIBCPP_MSVCRT)
+  return ___mb_cur_max_l_func(__l);
+#else
+  __libcpp_locale_guard __current(__l);
+  return MB_CUR_MAX;
+#endif
+}
+
+
 lconv *localeconv_l( locale_t loc )
 {
 __libcpp_locale_guard __current(loc);
@@ -109,3 +121,15 @@
 __libcpp_locale_guard __current(loc);
 return vasprintf( ret, format, ap );
 }
+
+#if !defined(_LIBCPP_MSVCRT)
+float strtof_l(const char* nptr, char** endptr, locale_t loc) {
+  __libcpp_locale_guard __current(loc);
+  return strtof(nptr, endptr);
+}
+
+long double strtold_l(const char* nptr, char** endptr, locale_t loc) {
+  __libcpp_locale_guard __current(loc);
+  return strtold(nptr, endptr);
+}
+#endif
Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -183,7 +183,7 @@
 if (static_cast(alignment) < sizeof(void*))
   alignment = std::align_val_t(sizeof(void*));
 void* p;
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 while ((p = _aligned_malloc(size, static_cast(alignment))) == nullptr)
 #else
 while (::posix_memalign(&p, static_cast(alignment), size) != 0)
@@ -256,7 +256,7 @@
 operator delete(void* ptr, std::align_val_t) _NOEXCEPT
 {
 if (ptr)
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 ::_aligned_free(ptr);
 #else
 ::free(ptr);
Index: src/chrono.cpp
===
--- src/chrono.cpp
+++ src/chrono.cpp
@@ -37,7 +37,7 @@
 #if defined(_LIBCPP_WIN32API)
 #define WIN32_LEAN_AND_MEAN
 #define VC_EXTRA_LEAN
-#include 
+#include 
 #if _WIN32_WINNT >= _WIN32_WINNT_WIN8
 #include 
 #endif
Index: include/wchar.h
===
--- include/wchar.h
+++ include/wchar.h
@@ -166,7 +166,7 @@
 }
 #endif
 
-#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT)
+#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT_LIKE)
 extern "C" {
 size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
   size_t nmc, size_t len, mbstate_t *__restrict ps);
Index: include/support/win32/locale_win32.h
===
--- include/support/win32/locale_win32.h
+++ include/support/win32/locale_win32.h
@@ -52,20 +52,21 @@
  size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc);
 wint_t btowc_l( int c, locale_t loc );
 int wctob_l( wint_t c, locale_t loc );
-inline _LIBCPP_ALWAYS_INLINE
-decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
-{
-  return ___mb_cur_max_l_func(__l);
-}
+
+decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l );
 
 // the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
 #define mbtowc_l _mbtowc_l
 #define strtoll_l _strtoi64_l
 #define strtoull_l _strtoui64_l
-#define strtof_l _strtof_l
 #define strtod_l _strtod_l
+#if defined(_LIBCPP_MSVCRT)
+#define strtof_l _strtof_l
 #def

[PATCH] D33080: [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D33080#754442, @compnerd wrote:

> I think that we should sink the `min`/`max` checks into `__undef_macros`.  I 
> don't like the idea of littering that check everywhere.


I would much rather litter at the cost of the implementation than needlessly 
include `__undef_macros` in every header; Especially because
it's almost always unneeded. I realize it's ugly internally but I think it's 
worth it. I'll attempt to write some compile time tests to ensure
I'm not making a mountain out of a molehill but could you also re-consider 
@compnerd?


https://reviews.llvm.org/D33080



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


Re: r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Galina Kistanova via cfe-commits
Hello Jonathan,

This commit broke one of our builders:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2608/steps/build-unified-tree/logs/stdio

Please have a look at this?

Thanks

Galina

On Thu, May 25, 2017 at 8:42 AM, Jonathan Roelofs via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jroelofs
> Date: Thu May 25 10:42:13 2017
> New Revision: 303873
>
> URL: http://llvm.org/viewvc/llvm-project?rev=303873&view=rev
> Log:
> Don't defer to the GCC driver for linking arm-baremetal
>
> Also comes with a cmake cache for building the runtime bits:
>
>  $ cmake  \
>-DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
>-DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
>-DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
>-C /path/to/clang/cmake/caches/BaremetalARM.cmake \
>/path/to/llvm
>
> https://reviews.llvm.org/D33259
>
> Added:
> cfe/trunk/cmake/caches/BaremetalARM.cmake
> cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
> cfe/trunk/lib/Driver/ToolChains/BareMetal.h
> cfe/trunk/test/Driver/Inputs/baremetal_arm/
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
> cfe/trunk/test/Driver/baremetal.cpp
> Modified:
> cfe/trunk/lib/Driver/CMakeLists.txt
> cfe/trunk/lib/Driver/Driver.cpp
> cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
> cfe/trunk/lib/Driver/ToolChains/Linux.cpp
> cfe/trunk/test/Frontend/gnu-mcount.c
>
> Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/
> caches/BaremetalARM.cmake?rev=303873&view=auto
> 
> ==
> --- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
> +++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
> @@ -0,0 +1,50 @@
> +set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
> +
> +# Builtins
> +set(LLVM_BUILTIN_TARGETS 
> "armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi"
> CACHE STRING "Builtin Targets")
> +
> +set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV6M_SYSROOT}
> CACHE STRING "armv6m-none-eabi Sysroot")
> +set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
> "armv6m-none-eabi System Name")
> +set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
> "armv6m-none-eabi Baremetal build")
> +set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE
> STRING "armv6m-none-eabi os dir")
> +
> +set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7M_SYSROOT}
> CACHE STRING "armv7m-none-eabi Sysroot")
> +set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
> "armv7m-none-eabi System Name")
> +set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
> "armv7m-none-eabi Baremetal build")
> +set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE
> STRING "armv7m-none-eabi C Flags")
> +set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
> STRING "armv7m-none-eabi ASM Flags")
> +set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE
> STRING "armv7m-none-eabi os dir")
> +
> +set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT
> ${BAREMETAL_ARMV7EM_SYSROOT} CACHE STRING "armv7em-none-eabi Sysroot")
> +set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
> "armv7em-none-eabi System Name")
> +set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
> "armv7em-none-eabi Baremetal build")
> +set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE
> STRING "armv7em-none-eabi C Flags")
> +set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
> STRING "armv7em-none-eabi ASM Flags")
> +set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE
> STRING "armv7em-none-eabi os dir")
> +
> +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
> +set(LLVM_TOOLCHAIN_TOOLS
> +  llc
> +  llvm-ar
> +  llvm-cxxfilt
> +  llvm-dwarfdump
> +  llvm-dsymutil
> +  llvm-nm
> +  llvm-objdump
> +  llvm-ranlib
> +  llvm-readobj
> +  llvm-size
> +  llvm-symbolizer
> +  opt
> +  CACHE STRING "")
> +
> +set(LLVM_DISTRIBUTION_COMPONENTS
> +  clang
> +  lld
> +  clang-headers
> +  builtins-armv6m-none-eabi
> +  builtins-armv7m-none-eabi
> +  builtins-armv7em-none-eabi
> +  runtimes
> +  ${LLVM_TOOLCHAIN_TOOLS}
> +  CACHE STRING "")
>
> Modified: cfe/trunk/lib/Driver/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> CMakeLists.txt?rev=303873&r1=303872&r2=303873&view=diff
> ===

[libcxx] r303888 - [test] Workaround C1XX bug in uses_allocator_types.hpp

2017-05-25 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu May 25 12:42:17 2017
New Revision: 303888

URL: http://llvm.org/viewvc/llvm-project?rev=303888&view=rev
Log:
[test] Workaround C1XX bug in uses_allocator_types.hpp

VSO#109062 "Explicit template argument specification with empty template 
parameter pack expansion does not imply further empty pack expansion"

Differential Revision: https://reviews.llvm.org/D33214

Added:

libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
Modified:

libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
libcxx/trunk/test/support/test_workarounds.h
libcxx/trunk/test/support/uses_alloc_types.hpp

Modified: 
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp?rev=303888&r1=303887&r2=303888&view=diff
==
--- 
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
 Thu May 25 12:42:17 2017
@@ -39,6 +39,7 @@ void test_no_inner_alloc()
 using SA = std::scoped_allocator_adaptor;
 static_assert(std::uses_allocator >::value, 
"");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Alloc CA(P);
 SA A(CA);
 A.construct(ptr);
@@ -61,6 +62,7 @@ void test_no_inner_alloc()
 using SA = std::scoped_allocator_adaptor;
 static_assert(std::uses_allocator >::value, 
"");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Alloc CA(P);
 SA A(CA);
 A.construct(ptr);
@@ -77,7 +79,6 @@ void test_no_inner_alloc()
 
 void test_with_inner_alloc()
 {
-using VoidAlloc1 = CountingAllocator;
 using VoidAlloc2 = CountingAllocator;
 
 AllocController POuter;
@@ -93,6 +94,7 @@ void test_with_inner_alloc()
 static_assert(!std::uses_allocator::value, "");
 static_assert(std::uses_allocator::value, "");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Outer O(POuter);
 Inner I(PInner);
 SA A(O, I);
@@ -119,6 +121,7 @@ void test_with_inner_alloc()
 static_assert(!std::uses_allocator::value, "");
 static_assert(std::uses_allocator::value, "");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Outer O(POuter);
 Inner I(PInner);
 SA A(O, I);

Added: 
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp?rev=303888&view=auto
==
--- 
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
 (added)
+++ 
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
 Thu May 25 12:42:17 2017
@@ -0,0 +1,49 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+// Verify TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION.
+
+#include 
+
+#include "test_workarounds.h"
+
+template
+struct identity {
+using type = T;
+};
+
+template struct list {};
+
+// C1XX believes this function template is not viable when LArgs is an empty
+// parameter pack.
+template 
+int f2(typename identity::type..., int i) {
+return i;
+}
+
+#ifdef TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+// C1XX believes this function template *is* viable when LArgs is an empty
+// parameter pack. Conforming compilers believe the two overloads are
+// ambiguous when LArgs is an empty pack.
+template 
+int f2(int i) {
+return i;
+}
+#endif
+
+template 
+int f1(list, Args&&... args) {
+return f2(args...);
+}
+
+int main() {
+f1(list<>{}, 42);
+}

Modified: libcxx/trunk/test/support/test_workarounds.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_workarounds.h?rev=303888&r1=303887&r2=303888&view=diff
==
--- libcxx/trunk/test/support/test_workarounds.h (original)
+++ libcxx/trunk/test/support/test_workarounds.h Thu May 25 12:42:17 2017
@@ -20,6 +20,7 @@
 #if defined(TEST_COMPILER_C1XX)
 # define TEST_WORKAROUND_C1XX_BROKEN_NULLP

[libcxx] r303889 - [test] Remove workaround for C1XX conversion-to-nullptr bug

2017-05-25 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu May 25 12:42:21 2017
New Revision: 303889

URL: http://llvm.org/viewvc/llvm-project?rev=303889&view=rev
Log:
[test] Remove workaround for C1XX conversion-to-nullptr bug

VSO#391542 "Types can't be convertible to nullptr_t"

Also put internal bug numbers on the workarounds in test_workarounds.h for 
correlation.

Differential Revision: https://reviews.llvm.org/D33290

Removed:

libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
Modified:
libcxx/trunk/test/support/poisoned_hash_helper.hpp
libcxx/trunk/test/support/test_workarounds.h

Modified: libcxx/trunk/test/support/poisoned_hash_helper.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/poisoned_hash_helper.hpp?rev=303889&r1=303888&r2=303889&view=diff
==
--- libcxx/trunk/test/support/poisoned_hash_helper.hpp (original)
+++ libcxx/trunk/test/support/poisoned_hash_helper.hpp Thu May 25 12:42:21 2017
@@ -50,11 +50,9 @@ namespace PoisonedHashDetail {
 // specializations of hash for nullptr t and all cv-unqualified
 // arithmetic, enumeration, and pointer types.
 using LibraryHashTypes = TypeList<
-#if !defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
 #if TEST_STD_VER > 14
   decltype(nullptr),
 #endif
-#endif
   bool,
   char,
   signed char,

Removed: 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp?rev=303888&view=auto
==
--- 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
 (original)
+++ 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
 (removed)
@@ -1,29 +0,0 @@
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-
-// UNSUPPORTED: c++98, c++03
-
-// Verify TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR.
-
-#include 
-
-#include "test_workarounds.h"
-
-struct ConvertsToNullptr {
-  using DestType = decltype(nullptr);
-  operator DestType() const { return nullptr; }
-};
-
-int main() {
-#if defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
-  static_assert(!std::is_convertible::value, "");
-#else
-  static_assert(std::is_convertible::value, "");
-#endif
-}

Modified: libcxx/trunk/test/support/test_workarounds.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_workarounds.h?rev=303889&r1=303888&r2=303889&view=diff
==
--- libcxx/trunk/test/support/test_workarounds.h (original)
+++ libcxx/trunk/test/support/test_workarounds.h Thu May 25 12:42:21 2017
@@ -14,15 +14,14 @@
 #include "test_macros.h"
 
 #if defined(TEST_COMPILER_EDG)
-# define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR
+# define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR // VSO#424280
 #endif
 
 #if defined(TEST_COMPILER_C1XX)
-# define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
-# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
-# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE // VSO#117743
+# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION // VSO#109062
 # ifndef _MSC_EXTENSIONS
-#  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
+#  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK // VSO#119998
 # endif
 #endif
 


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


[PATCH] D33214: [libcxx] [test] Workaround C1XX bug in uses_allocator_types.hpp

2017-05-25 Thread Casey Carter via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303888: [test] Workaround C1XX bug in 
uses_allocator_types.hpp (authored by CaseyCarter).

Changed prior to commit:
  https://reviews.llvm.org/D33214?vs=99086&id=100264#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33214

Files:
  
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
  
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
  libcxx/trunk/test/support/test_workarounds.h
  libcxx/trunk/test/support/uses_alloc_types.hpp

Index: libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
===
--- libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
+++ libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
@@ -0,0 +1,49 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+// Verify TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION.
+
+#include 
+
+#include "test_workarounds.h"
+
+template
+struct identity {
+using type = T;
+};
+
+template struct list {};
+
+// C1XX believes this function template is not viable when LArgs is an empty
+// parameter pack.
+template 
+int f2(typename identity::type..., int i) {
+return i;
+}
+
+#ifdef TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+// C1XX believes this function template *is* viable when LArgs is an empty
+// parameter pack. Conforming compilers believe the two overloads are
+// ambiguous when LArgs is an empty pack.
+template 
+int f2(int i) {
+return i;
+}
+#endif
+
+template 
+int f1(list, Args&&... args) {
+return f2(args...);
+}
+
+int main() {
+f1(list<>{}, 42);
+}
Index: libcxx/trunk/test/support/uses_alloc_types.hpp
===
--- libcxx/trunk/test/support/uses_alloc_types.hpp
+++ libcxx/trunk/test/support/uses_alloc_types.hpp
@@ -15,6 +15,7 @@
 #include 
 
 #include "test_macros.h"
+#include "test_workarounds.h"
 #include "type_id.h"
 
 // There are two forms of uses-allocator construction:
@@ -256,6 +257,13 @@
 return alloc;
 }
 
+#ifdef TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+template 
+static CtorAlloc getAllocatorFromPackImp(CtorAlloc const& alloc) {
+return alloc;
+}
+#endif
+
 bool has_alloc() const { return alloc_store.get_allocator() != nullptr; }
 const CtorAlloc *get_alloc() const { return alloc_store.get_allocator(); }
 public:
Index: libcxx/trunk/test/support/test_workarounds.h
===
--- libcxx/trunk/test/support/test_workarounds.h
+++ libcxx/trunk/test/support/test_workarounds.h
@@ -20,6 +20,7 @@
 #if defined(TEST_COMPILER_C1XX)
 # define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
 # define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
+# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
 # ifndef _MSC_EXTENSIONS
 #  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
 # endif
Index: libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
===
--- libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
+++ libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
@@ -39,6 +39,7 @@
 using SA = std::scoped_allocator_adaptor;
 static_assert(std::uses_allocator >::value, "");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Alloc CA(P);
 SA A(CA);
 A.construct(ptr);
@@ -61,6 +62,7 @@
 using SA = std::scoped_allocator_adaptor;
 static_assert(std::uses_allocator >::value, "");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Alloc CA(P);
 SA A(CA);
 A.construct(ptr);
@@ -77,7 +79,6 @@
 
 void test_with_inner_alloc()
 {
-using VoidAlloc1 = CountingAllocator;
 using VoidAlloc2 = CountingAllocator;
 
 AllocController POuter;
@@ -93,6 +94,7 @@
 static_assert(!std::uses_allocator::value, "");
 static_assert(std::uses_allocator::value, "");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Outer O(POuter);
 Inner I(PInner);
 SA A(O, I);
@@ -119,6 +121,7 @@
 static_assert(!std::uses_allocator::value, "");
 static_assert(

[PATCH] D33290: [libcxx] [test] Remove workaround for C1XX conversion-to-nullptr bug

2017-05-25 Thread Casey Carter via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
CaseyCarter marked an inline comment as done.
Closed by commit rL303889: [test] Remove workaround for C1XX 
conversion-to-nullptr bug (authored by CaseyCarter).

Changed prior to commit:
  https://reviews.llvm.org/D33290?vs=99336&id=100265#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33290

Files:
  libcxx/trunk/test/support/poisoned_hash_helper.hpp
  
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
  libcxx/trunk/test/support/test_workarounds.h


Index: 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
===
--- 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
+++ 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
@@ -1,29 +0,0 @@
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-
-// UNSUPPORTED: c++98, c++03
-
-// Verify TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR.
-
-#include 
-
-#include "test_workarounds.h"
-
-struct ConvertsToNullptr {
-  using DestType = decltype(nullptr);
-  operator DestType() const { return nullptr; }
-};
-
-int main() {
-#if defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
-  static_assert(!std::is_convertible::value, "");
-#else
-  static_assert(std::is_convertible::value, "");
-#endif
-}
Index: libcxx/trunk/test/support/test_workarounds.h
===
--- libcxx/trunk/test/support/test_workarounds.h
+++ libcxx/trunk/test/support/test_workarounds.h
@@ -14,15 +14,14 @@
 #include "test_macros.h"
 
 #if defined(TEST_COMPILER_EDG)
-# define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR
+# define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR // VSO#424280
 #endif
 
 #if defined(TEST_COMPILER_C1XX)
-# define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
-# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
-# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE // VSO#117743
+# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION // VSO#109062
 # ifndef _MSC_EXTENSIONS
-#  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
+#  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK // VSO#119998
 # endif
 #endif
 
Index: libcxx/trunk/test/support/poisoned_hash_helper.hpp
===
--- libcxx/trunk/test/support/poisoned_hash_helper.hpp
+++ libcxx/trunk/test/support/poisoned_hash_helper.hpp
@@ -50,11 +50,9 @@
 // specializations of hash for nullptr t and all cv-unqualified
 // arithmetic, enumeration, and pointer types.
 using LibraryHashTypes = TypeList<
-#if !defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
 #if TEST_STD_VER > 14
   decltype(nullptr),
 #endif
-#endif
   bool,
   char,
   signed char,


Index: libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
===
--- libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
+++ libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
@@ -1,29 +0,0 @@
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-
-// UNSUPPORTED: c++98, c++03
-
-// Verify TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR.
-
-#include 
-
-#include "test_workarounds.h"
-
-struct ConvertsToNullptr {
-  using DestType = decltype(nullptr);
-  operator DestType() const { return nullptr; }
-};
-
-int main() {
-#if defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
-  static_assert(!std::is_convertible::value, "");
-#else
-  static_assert(std::is_convertible::value, "");
-#endif
-}
Index: libcxx/trunk/test/support/test_workarounds.h
===
--- libcxx/trunk/test/support/test_workarounds.h
+++ libcxx/trunk/test/support/test_workarounds.h
@@ -14,15 +14,14 @@
 #include "test_macros.h"
 
 #if defined(TEST_COMPILER_EDG)
-# define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR
+# define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR // VSO#424280
 #endif
 
 #if defined(TEST_COMPI

[PATCH] D33080: [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 100269.
EricWF added a comment.

- Remove the external include guards for `__undef_macros` as requested by 
@compnerd.

I couldn't come up with a easy test case that showed any notable difference 
having the external guards.


https://reviews.llvm.org/D33080

Files:
  include/__bit_reference
  include/__config
  include/__hash_table
  include/__mutex_base
  include/__split_buffer
  include/__std_stream
  include/__string
  include/__threading_support
  include/__tree
  include/__undef_macros
  include/__undef_min_max
  include/algorithm
  include/array
  include/bitset
  include/chrono
  include/deque
  include/experimental/algorithm
  include/experimental/dynarray
  include/experimental/functional
  include/experimental/memory_resource
  include/experimental/numeric
  include/experimental/optional
  include/experimental/string_view
  include/forward_list
  include/fstream
  include/istream
  include/limits
  include/list
  include/locale
  include/memory
  include/module.modulemap
  include/mutex
  include/numeric
  include/optional
  include/random
  include/ratio
  include/regex
  include/shared_mutex
  include/sstream
  include/streambuf
  include/string
  include/string_view
  include/thread
  include/valarray
  include/vector
  src/condition_variable.cpp
  src/ios.cpp
  src/locale.cpp
  src/mutex.cpp
  src/strstream.cpp
  test/libcxx/min_max_macros.sh.cpp

Index: test/libcxx/min_max_macros.sh.cpp
===
--- /dev/null
+++ test/libcxx/min_max_macros.sh.cpp
@@ -0,0 +1,298 @@
+// -*- C++ -*-
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// Test that we can include each header in two TU's and link them together.
+
+// RUN: %compile -fsyntax-only
+
+// Prevent  from generating deprecated warnings for this test.
+#if defined(__DEPRECATED)
+#undef __DEPRECATED
+#endif
+
+#define TEST_MACROS() static_assert(min() == true && max() == true, "")
+#define min() true
+#define max() true
+
+// Top level headers
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+TEST_MACROS();
+#endif
+#include 
+TEST_MACROS();
+#include 
+TEST_MACROS();
+#include 
+TE

[PATCH] D33550: Make __wrap_iter constexpr

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

@mclow.lists Could you update this diff with more context?


https://reviews.llvm.org/D33550



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


[libcxx] r303895 - Update coroutine_handle::promise to reflect N4663.

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 13:52:34 2017
New Revision: 303895

URL: http://llvm.org/viewvc/llvm-project?rev=303895&view=rev
Log:
Update coroutine_handle::promise to reflect N4663.

This patch updates the promise() member to match the current spec.
Specifically it removes the non-const overload and make the return
type of the const overload non-const.

This patch also makes the ASSERT_NOT_NOEXCEPT tests libc++ specific,
since other implementations may be free to strengthen the specification.

Modified:
libcxx/trunk/include/experimental/coroutine

libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp

Modified: libcxx/trunk/include/experimental/coroutine
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/coroutine?rev=303895&r1=303894&r2=303895&view=diff
==
--- libcxx/trunk/include/experimental/coroutine (original)
+++ libcxx/trunk/include/experimental/coroutine Thu May 25 13:52:34 2017
@@ -194,15 +194,9 @@ public:
 return *this;
 }
 
-  _LIBCPP_INLINE_VISIBILITY
-_Promise& promise() {
-return *reinterpret_cast<_Promise*>(
-__builtin_coro_promise(this->__handle_, alignof(_Promise), false));
-}
-
 _LIBCPP_INLINE_VISIBILITY
-_Promise const& promise() const {
-return *reinterpret_cast<_Promise const*>(
+_Promise& promise() const {
+return *reinterpret_cast<_Promise*>(
 __builtin_coro_promise(this->__handle_, alignof(_Promise), false));
 }
 

Modified: 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp?rev=303895&r1=303894&r2=303895&view=diff
==
--- 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
 Thu May 25 13:52:34 2017
@@ -39,12 +39,12 @@ void do_test(coro::coroutine_handlehttp://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r303898 - Appease more buildbots about r303873

2017-05-25 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu May 25 13:55:22 2017
New Revision: 303898

URL: http://llvm.org/viewvc/llvm-project?rev=303898&view=rev
Log:
Appease more buildbots about r303873

Modified:
cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp?rev=303898&r1=303897&r2=303898&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp Thu May 25 13:55:22 2017
@@ -136,6 +136,7 @@ std::string BareMetal::findLibCxxInclude
 return Dir.str();
   }
   }
+  llvm_unreachable("unhandled LibType");
 }
 
 void BareMetal::AddClangCXXStdlibIncludeArgs(


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


Re: r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Jonathan Roelofs via cfe-commits



On 5/25/17 11:39 AM, Galina Kistanova wrote:

Hello Jonathan,

This commit broke one of our builders:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2608/steps/build-unified-tree/logs/stdio

Please have a look at this?


r303898 should take care of that.


Jon



Thanks

Galina

On Thu, May 25, 2017 at 8:42 AM, Jonathan Roelofs via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:


Author: jroelofs
Date: Thu May 25 10:42:13 2017
New Revision: 303873

URL: http://llvm.org/viewvc/llvm-project?rev=303873&view=rev

Log:
Don't defer to the GCC driver for linking arm-baremetal

Also comes with a cmake cache for building the runtime bits:

 $ cmake  \
   -DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
   -C /path/to/clang/cmake/caches/BaremetalARM.cmake \
   /path/to/llvm

https://reviews.llvm.org/D33259 

Added:
cfe/trunk/cmake/caches/BaremetalARM.cmake
cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
cfe/trunk/lib/Driver/ToolChains/BareMetal.h
cfe/trunk/test/Driver/Inputs/baremetal_arm/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
cfe/trunk/test/Driver/baremetal.cpp
Modified:
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/lib/Driver/ToolChains/Linux.cpp
cfe/trunk/test/Frontend/gnu-mcount.c

Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/BaremetalARM.cmake?rev=303873&view=auto



==
--- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
+++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
@@ -0,0 +1,50 @@
+set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
+
+# Builtins
+set(LLVM_BUILTIN_TARGETS
"armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi" CACHE STRING
"Builtin Targets")
+
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT
${BAREMETAL_ARMV6M_SYSROOT} CACHE STRING "armv6m-none-eabi Sysroot")
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE
STRING "armv6m-none-eabi System Name")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON
CACHE BOOL "armv6m-none-eabi Baremetal build")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal"
CACHE STRING "armv6m-none-eabi os dir")
+
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT
${BAREMETAL_ARMV7M_SYSROOT} CACHE STRING "armv7m-none-eabi Sysroot")
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE
STRING "armv7m-none-eabi System Name")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON
CACHE BOOL "armv7m-none-eabi Baremetal build")
+set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8"
CACHE STRING "armv7m-none-eabi C Flags")
+set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8"
CACHE STRING "armv7m-none-eabi ASM Flags")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal"
CACHE STRING "armv7m-none-eabi os dir")
+
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT
${BAREMETAL_ARMV7EM_SYSROOT} CACHE STRING "armv7em-none-eabi Sysroot")
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE
STRING "armv7em-none-eabi System Name")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON
CACHE BOOL "armv7em-none-eabi Baremetal build")
+set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8"
CACHE STRING "armv7em-none-eabi C Flags")
+set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8"
CACHE STRING "armv7em-none-eabi ASM Flags")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal"
CACHE STRING "armv7em-none-eabi os dir")
+
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+set(LLVM_TOOLCHAIN_TOOLS
+  llc
+  llvm-ar
+  llvm-cxxfilt
+  llvm-dwarfdump
+  llvm-dsymutil
+  llvm-nm
+  llvm-objdump
+  llvm-ranlib
+  llvm-readobj
+  llvm-s

[libcxx] r303899 - Add asserts that the nullptr is maintained in string erase operations.

2017-05-25 Thread Billy Robert O'Neal III via cfe-commits
Author: bion
Date: Thu May 25 14:01:14 2017
New Revision: 303899

URL: http://llvm.org/viewvc/llvm-project?rev=303899&view=rev
Log:
Add asserts that the nullptr is maintained in string erase operations.

Modified:

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp?rev=303899&r1=303898&r2=303899&view=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
 Thu May 25 14:01:14 2017
@@ -24,6 +24,7 @@ test(S s, typename S::difference_type po
 typename S::const_iterator p = s.begin() + pos;
 typename S::iterator i = s.erase(p);
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 assert(i - s.begin() == pos);
 }

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp?rev=303899&r1=303898&r2=303899&view=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
 Thu May 25 14:01:14 2017
@@ -25,6 +25,7 @@ test(S s, typename S::difference_type po
 typename S::const_iterator last = s.cbegin() + pos + n;
 typename S::iterator i = s.erase(first, last);
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 assert(i - s.begin() == pos);
 }

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp?rev=303899&r1=303898&r2=303899&view=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
 Thu May 25 14:01:14 2017
@@ -23,6 +23,7 @@ test(S s, S expected)
 {
 s.pop_back();
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 }
 

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp?rev=303899&r1=303898&r2=303899&view=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
 Thu May 25 14:01:14 2017
@@ -29,6 +29,7 @@ test(S s, typename S::size_type pos, typ
 {
 s.erase(pos, n);
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 }
 #ifndef TEST_HAS_NO_EXCEPTIONS
@@ -58,6 +59,7 @@ test(S s, typename S::size_type pos, S e
 {
 s.erase(pos);
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 }
 #ifndef TEST_HAS_NO_EXCEPTIONS
@@ -83,6 +85,7 @@ test(S s, S expected)
 {
 s.erase();
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 }
 


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


[PATCH] D33340: [libcxx] [test] Add string nullptr asserts to erase functions.

2017-05-25 Thread Billy Robert O'Neal III via Phabricator via cfe-commits
BillyONeal closed this revision.
BillyONeal added a comment.

In https://reviews.llvm.org/D33340#764206, @EricWF wrote:

> Sorry for the delay reviewing such a simple change.


No problem! Their simplicity also means no likely merge conflicts :)

In https://reviews.llvm.org/D33340#764213, @EricWF wrote:

> @BillyONeal Changes like this are good for post-commit review (ie just commit 
> it). Adding clearly correct assertions and test cases is never an 
> objectionable thing.


Sounds good, thanks!


https://reviews.llvm.org/D33340



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


[libcxx] r303900 - Update more coroutine_handle signatures to reflect N4663.

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 14:04:55 2017
New Revision: 303900

URL: http://llvm.org/viewvc/llvm-project?rev=303900&view=rev
Log:
Update more coroutine_handle signatures to reflect N4663.

Thanks to Casey Carter for pointing out the out-of-date tests and
implementation.

Modified:
libcxx/trunk/include/experimental/coroutine

libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp

libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp

libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.sh.cpp

Modified: libcxx/trunk/include/experimental/coroutine
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/coroutine?rev=303900&r1=303899&r2=303900&view=diff
==
--- libcxx/trunk/include/experimental/coroutine (original)
+++ libcxx/trunk/include/experimental/coroutine Thu May 25 14:04:55 2017
@@ -112,10 +112,10 @@ public:
 constexpr explicit operator bool() const noexcept { return __handle_; }
 
 _LIBCPP_ALWAYS_INLINE
-void operator()() const { resume(); }
+void operator()() { resume(); }
 
 _LIBCPP_ALWAYS_INLINE
-void resume() const {
+void resume() {
   _LIBCPP_ASSERT(__is_suspended(),
  "resume() can only be called on suspended coroutines");
   _LIBCPP_ASSERT(!done(),
@@ -124,7 +124,7 @@ public:
 }
 
 _LIBCPP_ALWAYS_INLINE
-void destroy() const {
+void destroy() {
   _LIBCPP_ASSERT(__is_suspended(),
  "destroy() can only be called on suspended coroutines");
   __builtin_coro_destroy(__handle_);

Modified: 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp?rev=303900&r1=303899&r2=303900&view=diff
==
--- 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
 Thu May 25 14:04:55 2017
@@ -19,8 +19,7 @@
 // template 
 // struct coroutine_handle;
 
-// Promise& promise()
-// Promise const& promise() const
+// Promise& promise() const
 
 #include 
 #include 

Modified: 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp?rev=303900&r1=303899&r2=303900&view=diff
==
--- 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp
 Thu May 25 14:04:55 2017
@@ -19,7 +19,7 @@
 // template 
 // struct coroutine_handle;
 
-// void destroy() const
+// void destroy()
 
 #include 
 #include 
@@ -32,12 +32,29 @@
 
 namespace coro = std::experimental;
 
+template 
+auto has_destroy_imp(H&& h, int) -> decltype(h.destroy(), std::true_type{});
+template 
+auto has_destroy_imp(H&&, long) -> std::false_type;
+
+template 
+constexpr bool has_destroy() {
+  return decltype(has_destroy_imp(std::declval(), 0))::value;
+}
+
 template 
-void do_test(coro::coroutine_handle const& H) {
+void do_test(coro::coroutine_handle&& H) {
+  using HType = coro::coroutine_handle;
   // FIXME Add a runtime test
   {
 ASSERT_SAME_TYPE(decltype(H.destroy()), void);
-ASSERT_NOT_NOEXCEPT(H.destroy());
+LIBCPP_ASSERT_NOT_NOEXCEPT(H.destroy());
+static_assert(has_destroy(), "");
+static_assert(has_destroy(), "");
+  }
+  {
+static_assert(!has_destroy(), "");
+static_assert(!has_destroy(), "");
   }
 }
 

Modified: 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.sh.cpp?rev=303900&r1=303899&r2=303900&view=diff
==
--- 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/res

[PATCH] D33525: [ThinLTO] Migrate ThinLTOBitcodeWriter to the new PM.

2017-05-25 Thread Tim Shen via Phabricator via cfe-commits
timshen added a comment.

In https://reviews.llvm.org/D33525#764251, @chandlerc wrote:

> (focusing on the LLVM side of this review for now)
>
> Can you add an LLVM-based test? Can you add this to 
> `lib/Passes/PassRegistry.def`?


I see that not all passes are registered (BitcodeWriterPass). Is it an 
oversight?

Does a pass have to be default constructible, in order to be registered easily?


https://reviews.llvm.org/D33525



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


[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-05-25 Thread Leo Li via Phabricator via cfe-commits
aoli created this revision.
Herald added a subscriber: mgorny.

Thoes files are used to build Android toolchain. 
https://reviews.llvm.org/D32816 makes it possible to build runtimes for targets.


https://reviews.llvm.org/D33561

Files:
  cmake/caches/Android-stage2.cmake
  cmake/caches/Android.cmake


Index: cmake/caches/Android.cmake
===
--- /dev/null
+++ cmake/caches/Android.cmake
@@ -0,0 +1,31 @@
+# This file sets up a CMakeCache for an Android toolchain build.
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_BUILD_RUNTIME OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
+set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  if (Android_${target}_C_FLAGS)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_C_FLAGS=${Android_${target}_C_FLAGS})
+  endif()
+  if (Android_${target}_SYSROOT)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_SYSROOT=${Android_${target}_SYSROOT})
+  endif()
+  if (Android_${target}_CXX_FLAGS)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_CXX_FLAGS=${Android_${target}_CXX_FLAGS})
+  endif()
+endforeach()
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS "${EXTRA_ARGS} 
-C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake" CACHE STRING "")
Index: cmake/caches/Android-stage2.cmake
===
--- /dev/null
+++ cmake/caches/Android-stage2.cmake
@@ -0,0 +1,21 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+set(CMAKE_BUILT_TYPE RELEASE CACHE STRING "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+
+set(LLVM_RUNTIME_TARGETS 
"i686-linux-android;x86_64-linux-android;aarch64-linux-android;armv7-linux-android"
 CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  set(RUNTIMES_${target}-linux-android_ANDROID 1 CACHE STRING "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_ASM_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_C_FLAGS 
${Android_${target}_CXX_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_CXX_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_SYSROOT 
${Android_${target}_SYSROOT} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_ENABLE_WERROR ON CACHE BOOL 
"")
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_INCLUDE_TESTS OFF CACHE 
BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+endforeach()


Index: cmake/caches/Android.cmake
===
--- /dev/null
+++ cmake/caches/Android.cmake
@@ -0,0 +1,31 @@
+# This file sets up a CMakeCache for an Android toolchain build.
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_BUILD_RUNTIME OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
+set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  if (Android_${target}_C_FLAGS)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_C_FLAGS=${Android_${target}_C_FLAGS})
+  endif()
+  if (Android_${target}_SYSROOT)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_SYSROOT=${Android_${target}_SYSROOT})
+  endif()
+  if (Android_${target}_CXX_FLAGS)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_CXX_FLAGS=${Android_${target}_CXX_FLAGS})
+  endif()
+endforeach()
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS "${EXTRA_ARGS} -C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake" CACHE STRING "")
Index: cmake/caches/Android-stage2.cmake
===
--- /dev/null
+++ cmake/caches/Android-stage2.cmake
@@ -0,0 +1,21 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+set(CMAKE_BUILT_TYPE RELEASE CACHE STRING "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+
+set(LLVM_RUNTIME_TARGETS "i686-linux

[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-05-25 Thread Leo Li via Phabricator via cfe-commits
aoli updated this revision to Diff 100282.
aoli added a comment.

Fix wrong flags.


https://reviews.llvm.org/D33561

Files:
  cmake/caches/Android-stage2.cmake
  cmake/caches/Android.cmake


Index: cmake/caches/Android.cmake
===
--- /dev/null
+++ cmake/caches/Android.cmake
@@ -0,0 +1,31 @@
+# This file sets up a CMakeCache for an Android toolchain build.
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_BUILD_RUNTIME OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
+set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  if (Android_${target}_C_FLAGS)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_C_FLAGS=${Android_${target}_C_FLAGS})
+  endif()
+  if (Android_${target}_SYSROOT)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_SYSROOT=${Android_${target}_SYSROOT})
+  endif()
+  if (Android_${target}_CXX_FLAGS)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_CXX_FLAGS=${Android_${target}_CXX_FLAGS})
+  endif()
+endforeach()
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS "${EXTRA_ARGS} 
-C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake" CACHE STRING "")
Index: cmake/caches/Android-stage2.cmake
===
--- /dev/null
+++ cmake/caches/Android-stage2.cmake
@@ -0,0 +1,21 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+set(CMAKE_BUILT_TYPE RELEASE CACHE STRING "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+
+set(LLVM_RUNTIME_TARGETS 
"i686-linux-android;x86_64-linux-android;aarch64-linux-android;armv7-linux-android"
 CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  set(RUNTIMES_${target}-linux-android_ANDROID 1 CACHE STRING "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_ASM_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_C_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_CXX_FLAGS 
${Android_${target}_CXX_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_SYSROOT 
${Android_${target}_SYSROOT} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_ENABLE_WERROR ON CACHE BOOL 
"")
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_INCLUDE_TESTS OFF CACHE 
BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+endforeach()


Index: cmake/caches/Android.cmake
===
--- /dev/null
+++ cmake/caches/Android.cmake
@@ -0,0 +1,31 @@
+# This file sets up a CMakeCache for an Android toolchain build.
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_BUILD_RUNTIME OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
+set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  if (Android_${target}_C_FLAGS)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_C_FLAGS=${Android_${target}_C_FLAGS})
+  endif()
+  if (Android_${target}_SYSROOT)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_SYSROOT=${Android_${target}_SYSROOT})
+  endif()
+  if (Android_${target}_CXX_FLAGS)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_CXX_FLAGS=${Android_${target}_CXX_FLAGS})
+  endif()
+endforeach()
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS "${EXTRA_ARGS} -C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake" CACHE STRING "")
Index: cmake/caches/Android-stage2.cmake
===
--- /dev/null
+++ cmake/caches/Android-stage2.cmake
@@ -0,0 +1,21 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+set(CMAKE_BUILT_TYPE RELEASE CACHE STRING "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+
+set(LLVM_RUNTIME_TARGETS "i686-linux-android;x86_64-linux-android;aarch64-linux-android;armv7-linux-android" CACHE STRING "")
+
+foreach(target i686

[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-05-25 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added a comment.

what about the builtins?


https://reviews.llvm.org/D33561



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


[PATCH] D33525: [ThinLTO] Migrate ThinLTOBitcodeWriter to the new PM.

2017-05-25 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added inline comments.



Comment at: clang/test/CodeGen/thin_link_bitcode.c:5
+// RUN: %clang_cc1 -o %t -flto=thin -fexperimental-new-pass-manager 
-fthin-link-bitcode=%t.newpm -triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
+// RUN: llvm-bcanalyzer -dump %t.newpm | FileCheck %s --check-prefix=NEW_PM
 int main (void) {

`s/NEW_PM/NO_DEBUG/` and remove line 12.

I think you also want to test the contents of `%t` here.


https://reviews.llvm.org/D33525



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


Re: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Reid Kleckner via cfe-commits
I agree with Nico in retrospect. Setting -fno-operator-names is too big a
hammer. Instead we should add some MSVCCompat hacks to pretend we saw an
identifier token instead of a keyword token when these keywords are used as
declarators.

On Thu, May 25, 2017 at 10:14 AM, Nico Weber  wrote:

> Among the goals of the clang-cl project are a) being able to parse MS
> system headers b) helper users to write standards-compliant C++ (in
> particular, if your code builds with clang-cl without warnings, it'd be
> good if it also built with regular clang then).
>
> The regular change plus header change plus warning would be one way to
> achieve this, yes.
>
> On Thu, May 25, 2017 at 1:01 PM, Keane, Erich 
> wrote:
>
>> No problem, I definitely think it was the right choice.
>>
>>
>>
>> A change that contains all of what Melanie’s original patch did, plus the
>> Header changes (plus the clang-tidy fixes that came out of this) would be
>> acceptable?
>>
>>
>>
>> Also, I believe she’s working on the warning as well.  We were discussing
>> it, and I was thinking that if we track down where the
>> operator-identification is done (hints as to where that is is appreciated),
>> that we could simply warn if the user is using one of the Operators with
>> operators off.  The warning itself could then be suppressed if necessary.
>>
>>
>>
>> Thoughts?
>>
>>
>>
>>
>>
>> *From:* Nico Weber [mailto:tha...@google.com]
>> *Sent:* Thursday, May 25, 2017 9:56 AM
>> *To:* Keane, Erich 
>> *Cc:* Blower, Melanie ; rnk ;
>> cfe-commits ; Hans Wennborg <
>> h...@chromium.org>
>>
>> *Subject:* Re: r303798 - For Microsoft compatibility, set
>> fno_operator_names
>>
>>
>>
>> On Thu, May 25, 2017 at 12:18 PM, Keane, Erich 
>> wrote:
>>
>> How does chromium compiler in CL?  It seems that it would have a similar
>> problem here…
>>
>>
>>
>> That's a good question! It looks like iso646.h is included, and in MSVC
>> that contains something like `#define and &&`. But clang's
>> lib/Headers/iso646.h assumes that the compiler provides this and doesn't
>> define `and`. So for the reland, that header would have to check if the
>> operator name is disabled, and if so, define it. (Or, better, maybe we can
>> come up with something more targeted for the system header, similar to e.g.
>> http://llvm.org/viewvc/llvm-project?view=revision&revision=212238)
>>
>>
>>
>> Thanks for the revert!
>>
>>
>>
>>
>>
>> *From:* tha...@google.com [mailto:tha...@google.com] *On Behalf Of *Nico
>> Weber
>> *Sent:* Thursday, May 25, 2017 9:16 AM
>> *To:* Blower, Melanie 
>> *Cc:* rnk ; Keane, Erich ;
>> cfe-commits ; Hans Wennborg <
>> h...@chromium.org>
>>
>>
>> *Subject:* RE: r303798 - For Microsoft compatibility, set
>> fno_operator_names
>>
>>
>>
>> In addition to this making clang-cl silently accept invalid code, it also
>> breaks existing valid code, building chromium now fails. Let's revert and
>> come up with something better asynchronously.
>>
>>
>>
>> FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
>>
>>
>> E:\b\c\goma_client/gomacc.exe ../../third_party/llvm-build/R
>> elease+Asserts/bin/clang-cl.exe /nologo /showIncludes /FC
>> @obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp
>> /c ../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
>> /Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
>> /Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
>>
>> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\cu
>> stom\CustomElementRegistry.cpp(229,7):  error: unknown type name
>> 'definition'
>>
>>   if (definition and definition->Descriptor().LocalName() ==
>> desc.LocalName()) {
>>
>>   ^
>>
>> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\cu
>> stom\CustomElementRegistry.cpp(229,18):  error: variable declaration in
>> condition must have an initializer
>>
>>   if (definition and definition->Descriptor().LocalName() ==
>> desc.LocalName()) {
>>
>>  ^
>>
>> 2 errors generated.
>>
>>
>>
>>
>>
>> On May 24, 2017 4:01 PM, "Blower, Melanie" 
>> wrote:
>>
>> Thanks for the feedback, working on it…
>>
>>
>>
>> *From:* Keane, Erich
>> *Sent:* Wednesday, May 24, 2017 3:47 PM
>> *To:* Nico Weber ; Blower, Melanie <
>> melanie.blo...@intel.com>
>>
>>
>> *Cc:* cfe-commits ; rnk 
>>
>> *Subject:* RE: r303798 - For Microsoft compatibility, set
>> fno_operator_names
>>
>>
>>
>> Adding Melanie, the author of the patch.
>>
>>
>>
>> *From:* tha...@google.com [mailto:tha...@google.com ] *On
>> Behalf Of *Nico Weber
>> *Sent:* Wednesday, May 24, 2017 12:43 PM
>> *To:* Keane, Erich 
>> *Cc:* cfe-commits ; rnk 
>> *Subject:* Re: r303798 - For Microsoft compatibility, set
>> fno_operator_names
>>
>>
>>
>> Reviewed here: https://reviews.llvm.org/D33505
>>
>>
>> Still, please make this warn.
>>
>>
>>
>> On Wed, May 24, 2017 at 3:42 PM, Nico Weber  wrote:
>>
>> Was this reviewed somewhere?
>>
>>
>>
>> Please make it so that this emits a warning. We want clang-cl t

[PATCH] D33563: Track whether a unary operation can overflow

2017-05-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman created this revision.

We do not explicitly model integer promotions on unary operators even though 
those promotions happen in practice. This patch tracks the most important piece 
of information about the promotion on the AST node: whether the operator can 
overflow or not. It then pulls this logic out from various places and instead 
uses what's calculated on the AST node.

This is effectively a NFC patch, however, it does help out-of-tree builds that 
need to know about the integral promotions.


https://reviews.llvm.org/D33563

Files:
  include/clang/AST/Expr.h
  lib/AST/ASTDumper.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/ExprConstant.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/Misc/ast-dump-stmt.c

Index: test/Misc/ast-dump-stmt.c
===
--- test/Misc/ast-dump-stmt.c
+++ test/Misc/ast-dump-stmt.c
@@ -33,3 +33,35 @@
 // CHECK-NEXT:   OpaqueValueExpr
 // CHECK-NEXT: IntegerLiteral
 // CHECK-NEXT:   IntegerLiteral
+
+void TestUnaryOperatorExpr(void) {
+  char T1 = 1;
+  int T2 = 1;
+
+  T1++;
+  T2++;
+  // CHECK:  UnaryOperator{{.*}}postfix '++' cannot overflow
+  // CHECK-NEXT:   DeclRefExpr{{.*}}'T1' 'char'
+  // CHECK-NOT:  UnaryOperator{{.*}}postfix '++' cannot overflow
+  // CHECK:DeclRefExpr{{.*}}'T2' 'int'
+
+  -T1;
+  -T2;
+  // CHECK:  UnaryOperator{{.*}}prefix '-' cannot overflow
+  // CHECK-NEXT:   ImplicitCastExpr
+  // CHECK-NEXT: ImplicitCastExpr
+  // CHECK-NEXT:   DeclRefExpr{{.*}}'T1' 'char'
+  // CHECK-NOT:  UnaryOperator{{.*}}prefix '-' cannot overflow
+  // CHECK:ImplicitCastExpr
+  // CHECK:  DeclRefExpr{{.*}}'T2' 'int'
+
+  ~T1;
+  ~T2;
+  // CHECK:  UnaryOperator{{.*}}prefix '~' cannot overflow
+  // CHECK-NEXT:   ImplicitCastExpr
+  // CHECK-NEXT: ImplicitCastExpr
+  // CHECK-NEXT:   DeclRefExpr{{.*}}'T1' 'char'
+  // CHECK-NOT:  UnaryOperator{{.*}}prefix '~' cannot overflow
+  // CHECK:ImplicitCastExpr
+  // CHECK:  DeclRefExpr{{.*}}'T2' 'int'
+}
Index: lib/Serialization/ASTWriterStmt.cpp
===
--- lib/Serialization/ASTWriterStmt.cpp
+++ lib/Serialization/ASTWriterStmt.cpp
@@ -490,6 +490,7 @@
   Record.AddStmt(E->getSubExpr());
   Record.push_back(E->getOpcode()); // FIXME: stable encoding
   Record.AddSourceLocation(E->getOperatorLoc());
+  Record.push_back(E->canOverflow());
   Code = serialization::EXPR_UNARY_OPERATOR;
 }
 
Index: lib/Serialization/ASTReaderStmt.cpp
===
--- lib/Serialization/ASTReaderStmt.cpp
+++ lib/Serialization/ASTReaderStmt.cpp
@@ -536,6 +536,7 @@
   E->setSubExpr(Record.readSubExpr());
   E->setOpcode((UnaryOperator::Opcode)Record.readInt());
   E->setOperatorLoc(ReadSourceLocation());
+  E->setCanOverflow(Record.readInt());
 }
 
 void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
Index: lib/Sema/SemaPseudoObject.cpp
===
--- lib/Sema/SemaPseudoObject.cpp
+++ lib/Sema/SemaPseudoObject.cpp
@@ -527,9 +527,12 @@
   (result.get()->isTypeDependent() || CanCaptureValue(result.get(
 setResultToLastSemantic();
 
-  UnaryOperator *syntactic =
-new (S.Context) UnaryOperator(syntacticOp, opcode, resultType,
-  VK_LValue, OK_Ordinary, opcLoc);
+  UnaryOperator *syntactic = new (S.Context) UnaryOperator(
+  syntacticOp, opcode, resultType, VK_LValue, OK_Ordinary, opcLoc,
+  !resultType->isDependentType()
+  ? S.Context.getTypeSize(resultType) >=
+S.Context.getTypeSize(S.Context.IntTy)
+  : false);
   return complete(syntactic);
 }
 
@@ -1639,9 +1642,9 @@
   Expr *syntax = E->getSyntacticForm();
   if (UnaryOperator *uop = dyn_cast(syntax)) {
 Expr *op = stripOpaqueValuesFromPseudoObjectRef(*this, uop->getSubExpr());
-return new (Context) UnaryOperator(op, uop->getOpcode(), uop->getType(),
-   uop->getValueKind(), uop->getObjectKind(),
-   uop->getOperatorLoc());
+return new (Context) UnaryOperator(
+op, uop->getOpcode(), uop->getType(), uop->getValueKind(),
+uop->getObjectKind(), uop->getOperatorLoc(), uop->canOverflow());
   } else if (CompoundAssignOperator *cop
= dyn_cast(syntax)) {
 Expr *lhs = stripOpaqueValuesFromPseudoObjectRef(*this, cop->getLHS());
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -11860,6 +11860,16 @@
   return CreateBuiltinBinOp(OpLoc, Opc, LHSExpr, RHSExpr);
 }
 
+static bool isOverflowingIntegerType(ASTContext &Ct

r303908 - Revert "[AMDGPU] add __builtin_amdgcn_s_getpc"

2017-05-25 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Thu May 25 15:28:26 2017
New Revision: 303908

URL: http://llvm.org/viewvc/llvm-project?rev=303908&view=rev
Log:
Revert "[AMDGPU] add __builtin_amdgcn_s_getpc"

This reverts commit r303861, the LLVM intrinsic was reverted.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def
cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl

Modified: cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def?rev=303908&r1=303907&r2=303908&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def Thu May 25 15:28:26 2017
@@ -36,7 +36,6 @@ BUILTIN(__builtin_amdgcn_workitem_id_z,
 // Instruction builtins.
 
//===--===//
 BUILTIN(__builtin_amdgcn_s_getreg, "UiIi", "n")
-BUILTIN(__builtin_amdgcn_s_getpc, "LUi", "n")
 BUILTIN(__builtin_amdgcn_s_waitcnt, "vIi", "n")
 BUILTIN(__builtin_amdgcn_s_sendmsg, "vIiUi", "n")
 BUILTIN(__builtin_amdgcn_s_sendmsghalt, "vIiUi", "n")

Modified: cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl?rev=303908&r1=303907&r2=303908&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl Thu May 25 15:28:26 2017
@@ -481,13 +481,6 @@ void test_fmed3_f32(global float* out, f
   *out = __builtin_amdgcn_fmed3f(a, b, c);
 }
 
-// CHECK-LABEL: @test_s_getpc
-// CHECK: call i64 @llvm.amdgcn.s.getpc()
-void test_s_getpc(global ulong* out)
-{
-  *out = __builtin_amdgcn_s_getpc();
-}
-
 // CHECK-DAG: [[WI_RANGE]] = !{i32 0, i32 1024}
 // CHECK-DAG: attributes #[[NOUNWIND_READONLY:[0-9]+]] = { nounwind readonly }
 // CHECK-DAG: attributes #[[READ_EXEC_ATTRS]] = { convergent }


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


[clang-tools-extra] r303909 - Earlier revert introduced an extra space, remove it.

2017-05-25 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 25 15:29:17 2017
New Revision: 303909

URL: http://llvm.org/viewvc/llvm-project?rev=303909&view=rev
Log:
Earlier revert introduced an extra space, remove it.

Modified:
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp?rev=303909&r1=303908&r2=303909&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-cast.cpp 
Thu May 25 15:29:17 2017
@@ -264,7 +264,7 @@ void implicitCastInNegationExpressions()
   // CHECK-FIXES: bool boolComingFromNegatedChar = (character == 0);
 
   int* pointer = nullptr;
-  bool boolComingFromNegatedPointer = not  pointer;
+  bool boolComingFromNegatedPointer = not pointer;
   // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: implicit cast 'int *' -> bool
   // CHECK-FIXES: bool boolComingFromNegatedPointer = pointer == nullptr;
 }


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


r303910 - Make test/Driver/baremetal.cpp pass on Windows

2017-05-25 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu May 25 15:39:52 2017
New Revision: 303910

URL: http://llvm.org/viewvc/llvm-project?rev=303910&view=rev
Log:
Make test/Driver/baremetal.cpp pass on Windows

Modified:
cfe/trunk/test/Driver/baremetal.cpp

Modified: cfe/trunk/test/Driver/baremetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/baremetal.cpp?rev=303910&r1=303909&r2=303910&view=diff
==
--- cfe/trunk/test/Driver/baremetal.cpp (original)
+++ cfe/trunk/test/Driver/baremetal.cpp Thu May 25 15:39:52 2017
@@ -4,15 +4,15 @@
 // RUN: -L some/directory/user/asked/for \
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-C %s
-// CHECK-V6M-C: "[[PREFIX_DIR:.*]]/bin/clang" "-cc1" "-triple" 
"thumbv6m-none--eabi"
-// CHECK-V6M-C-SAME: "-resource-dir" 
"[[PREFIX_DIR]]/lib/clang/[[VERSION:[^"]*]]"
+// CHECK-V6M-C: "[[PREFIX_DIR:.*]]{{[/\\]+}}bin{{[/\\]+}}clang{{.*}}" "-cc1" 
"-triple" "thumbv6m-none--eabi"
+// CHECK-V6M-C-SAME: "-resource-dir" 
"[[PREFIX_DIR]]{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}[[VERSION:[^"]*]]"
 // CHECK-V6M-C-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
-// CHECK-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]/include/c++/v1"
-// CHECk-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]/include"
+// CHECK-V6M-C-SAME: "-internal-isystem" 
"[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
+// CHECk-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include"
 // CHECK-V6M-C-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
 // CHECK-V6M-C-NEXT: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-C-SAME: "-L[[PREFIX_DIR]]/lib/clang/[[VERSION]]/lib/baremetal"
-// CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome/directory/user/asked/for"
+// CHECK-V6M-C-SAME: 
"-L[[PREFIX_DIR]]{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}[[VERSION]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
+// CHECK-V6M-C-SAME: "-T" "semihosted.lds" 
"-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
 // CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-C-SAME: "-o" "{{.*}}.o"
 
@@ -33,7 +33,7 @@
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-DEFAULTCXX %s
 // CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-DEFAULTCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
@@ -43,10 +43,10 @@
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN: -stdlib=libc++ \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-LIBCXX %s
-// CHECK-V6M-LIBCXX-NOT: "-internal-isystem" "{{[^"]+}}/include/c++/{{[^v].*}}"
-// CHECK-V6M-LIBCXX: "-internal-isystem" "{{[^"]+}}/include/c++/v1"
+// CHECK-V6M-LIBCXX-NOT: "-internal-isystem" 
"{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}{{[^v].*}}"
+// CHECK-V6M-LIBCXX: "-internal-isystem" 
"{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
 // CHECK-V6M-LIBCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-LIBCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
 // CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o"
@@ -56,10 +56,10 @@
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN: -stdlib=libstdc++ \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-LIBSTDCXX %s
-// CHECK-V6M-LIBSTDCXX-NOT: "-internal-isystem" "{{[^"]+}}/include/c++/v1"
-// CHECK-V6M-LIBSTDCXX: "-internal-isystem" "{{[^"]+}}/include/c++/6.0.0"
+// CHECK-V6M-LIBSTDCXX-NOT: "-internal-isystem" 
"{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
+// CHECK-V6M-LIBSTDCXX: "-internal-isystem" 
"{{[^"]+}}{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}6.0.0"
 // CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-LIBSTDCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-LIBSTDCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
@@ -70,7 +70,7 @@
 // RUN: -nodefaultlibs \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-NDL %s
 // CHECK-V6M-NDL: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-NDL-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal" "-o" 
"{{.*}}.o"
+// CHECK-V6M-NDL-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 "-o" "{{.*}}.o"
 
 // RUN: %clang

Re: r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Hans Wennborg via cfe-commits
The test was failing on Windows; r303910 for that.

On Thu, May 25, 2017 at 11:55 AM, Jonathan Roelofs via cfe-commits
 wrote:
>
>
> On 5/25/17 11:39 AM, Galina Kistanova wrote:
>
> Hello Jonathan,
>
> This commit broke one of our builders:
>
> http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2608/steps/build-unified-tree/logs/stdio
>
> Please have a look at this?
>
>
> r303898 should take care of that.
>
>
> Jon
>
>
>
> Thanks
>
> Galina
>
> On Thu, May 25, 2017 at 8:42 AM, Jonathan Roelofs via cfe-commits
>  wrote:
>>
>> Author: jroelofs
>> Date: Thu May 25 10:42:13 2017
>> New Revision: 303873
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=303873&view=rev
>> Log:
>> Don't defer to the GCC driver for linking arm-baremetal
>>
>> Also comes with a cmake cache for building the runtime bits:
>>
>>  $ cmake  \
>>-DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
>>-DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
>>-DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
>>-C /path/to/clang/cmake/caches/BaremetalARM.cmake \
>>/path/to/llvm
>>
>> https://reviews.llvm.org/D33259
>>
>> Added:
>> cfe/trunk/cmake/caches/BaremetalARM.cmake
>> cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
>> cfe/trunk/lib/Driver/ToolChains/BareMetal.h
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
>> cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
>> cfe/trunk/test/Driver/baremetal.cpp
>> Modified:
>> cfe/trunk/lib/Driver/CMakeLists.txt
>> cfe/trunk/lib/Driver/Driver.cpp
>> cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
>> cfe/trunk/lib/Driver/ToolChains/Linux.cpp
>> cfe/trunk/test/Frontend/gnu-mcount.c
>>
>> Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/BaremetalARM.cmake?rev=303873&view=auto
>>
>> ==
>> --- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
>> +++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
>> @@ -0,0 +1,50 @@
>> +set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
>> +
>> +# Builtins
>> +set(LLVM_BUILTIN_TARGETS
>> "armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi" CACHE STRING "Builtin
>> Targets")
>> +
>> +set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV6M_SYSROOT}
>> CACHE STRING "armv6m-none-eabi Sysroot")
>> +set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
>> "armv6m-none-eabi System Name")
>> +set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
>> "armv6m-none-eabi Baremetal build")
>> +set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING
>> "armv6m-none-eabi os dir")
>> +
>> +set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7M_SYSROOT}
>> CACHE STRING "armv7m-none-eabi Sysroot")
>> +set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
>> "armv7m-none-eabi System Name")
>> +set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
>> "armv7m-none-eabi Baremetal build")
>> +set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE STRING
>> "armv7m-none-eabi C Flags")
>> +set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
>> STRING "armv7m-none-eabi ASM Flags")
>> +set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING
>> "armv7m-none-eabi os dir")
>> +
>> +set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7EM_SYSROOT}
>> CACHE STRING "armv7em-none-eabi Sysroot")
>> +set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
>> "armv7em-none-eabi System Name")
>> +set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
>> "armv7em-none-eabi Baremetal build")
>> +set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE
>> STRING "armv7em-none-eabi C Flags")
>> +set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
>> STRING "armv7em-none-eabi ASM Flags")
>> +set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE
>> STRING "armv7em-none-eabi os dir")
>> +
>> +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
>> +set(LLVM_TOOLCHAIN_TOOLS
>> +  llc
>> +  llvm-ar
>> +  llvm-cxxfilt
>> +  llvm-dwarfdump
>> +  llvm-dsymutil
>> +  llvm-nm
>> +  llvm-objdump
>> +  llvm-ranlib
>> +  llvm-readobj
>> +  llvm-size
>> +  llvm-symbolizer
>> +  opt
>> +  CACHE STRING "")
>> +
>> +set(LLVM_DISTRIBUTION_COMPONENTS
>> +  clang
>> +  lld
>> +  clang-headers
>> +  builtin

[PATCH] D33537: [clang-tidy] Exception Escape Checker

2017-05-25 Thread Piotr Padlewski via Phabricator via cfe-commits
Prazek added a comment.

How is that compared to https://reviews.llvm.org/D19201 and the clang patch 
mentioned in this patch?


Repository:
  rL LLVM

https://reviews.llvm.org/D33537



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


[PATCH] D33470: [clang-tidy] Add misc-default-numerics

2017-05-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

Once you fix the typo in the check, can you run it over some large C++ code 
bases to see if it finds any results?




Comment at: clang-tidy/misc/DefaultNumericsCheck.cpp:30
+  ofClass(classTemplateSpecializationDecl(
+  hasName("::std::numeric_limit"),
+  unless(isExplicitTemplateSpecialization()),

This should be checking for `::std::numeric_limits` (plural).



Comment at: docs/ReleaseNotes.rst:77
+  `_ 
check
+  Finds uses of ``std::numeric_limit`` for unspecialized types
+

numeric_limits



Comment at: test/clang-tidy/misc-default-numerics.cpp:6
+template 
+struct numeric_limit {
+  static T min() { return T(); }

numeric_limits (same elsewhere in this file).


https://reviews.llvm.org/D33470



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


[PATCH] D33470: [clang-tidy] Add misc-default-numerics

2017-05-25 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap added inline comments.



Comment at: clang-tidy/misc/DefaultNumericsCheck.h:20
+/// This check flags usages of ``std::numeric_limits::{min,max}()`` for
+/// unspecialized types. It is dangerous because it returns T(), which might is
+/// rarely minimum or maximum for this type.

nit: (feel free to correct me) 
replace 
"which might is ..." 
with 
"which rarely might be minimum or maximum for this type" 


https://reviews.llvm.org/D33470



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


r303913 - Update the getting started documentation to match the corresponding LLVM commit in r303912.

2017-05-25 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Thu May 25 16:02:49 2017
New Revision: 303913

URL: http://llvm.org/viewvc/llvm-project?rev=303913&view=rev
Log:
Update the getting started documentation to match the corresponding LLVM commit 
in r303912.

Modified:
cfe/trunk/www/get_started.html

Modified: cfe/trunk/www/get_started.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/get_started.html?rev=303913&r1=303912&r2=303913&view=diff
==
--- cfe/trunk/www/get_started.html (original)
+++ cfe/trunk/www/get_started.html Thu May 25 16:02:49 2017
@@ -196,6 +196,10 @@ Visual Studio:
 mkdir build (for building without polluting the source 
dir)
 cd build
 If you are using Visual Studio 2013:  cmake -G "Visual Studio 12" 
..\llvm
+By default, the Visual Studio project files generated by CMake use the
+ 32-bit toolset. If you are developing on a 64-bit version of Windows and
+ want to use the 64-bit toolset, pass the ``-Thost=x64`` flag when
+ generating the Visual Studio solution. This requires CMake 3.8.0 or 
later.
 See the http://www.llvm.org/docs/CMake.html";>LLVM CMake 
guide for
 more information on other configuration options for CMake.
 The above, if successful, will have created an LLVM.sln file in the


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


[PATCH] D33547: Updated getting started guide for visual studio + cmake

2017-05-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Commit in r303913


https://reviews.llvm.org/D33547



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


[PATCH] D28404: IRGen: Add optnone attribute on function during O0

2017-05-25 Thread Matthias Braun via Phabricator via cfe-commits
MatzeB added a comment.

FWIW, I think this makes sense.
Moving O0 and optnone get closer seems sensible. Even though -O3 with an 
optnone function indeed gives you different results today.
We are basically maintaining two things for the same "do not optimize" goal.
This obviously won't make O0 and optnone being the same in todays pass 
managers, but it is a step in the right direction.


https://reviews.llvm.org/D28404



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


[PATCH] D33568: Fix crash when evaluating constant expressions involving nullptr

2017-05-25 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover created this revision.
Herald added a subscriber: mcrosier.

For the simple casts in the test, we were crashing because the 
ZeroInitialization function created an LValue with an unexpected 
SubobjectDesignator: it was valid but didn't actually refer to a valid 
MostDerivedType.

Since PointerExprEvaluator actually creates an LValue based notionally on what 
you'd get if you dereferenced the pointer (I think), the MostDerivedType should 
be set by stripping the pointer from the type as in this patch.

The theoretically simpler solution of providing an invalid SubobjectDesignator 
(as happens for an int to pointer cast) is incorrect because nullptr has more 
possible uses in constexprs than other casts of integers.

Does my reasoning look sound? I've been all over that file before I finally 
thought I knew what was going on and I'm still not entirely confident.


https://reviews.llvm.org/D33568

Files:
  clang/lib/AST/ExprConstant.cpp
  clang/test/SemaCXX/null-cast.cpp


Index: clang/test/SemaCXX/null-cast.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/null-cast.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct A {};
+struct B : virtual A {};
+
+void foo() {
+  (void)static_cast(*(B *)0); // expected-warning {{binding dereferenced 
null pointer to reference has undefined behavior}}
+}
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -5496,6 +5496,8 @@
   bool ZeroInitialization(const Expr *E) {
 auto Offset = Info.Ctx.getTargetNullPointerValue(E->getType());
 Result.set((Expr*)nullptr, 0, false, true, Offset);
+Result.getLValueDesignator() =
+SubobjectDesignator(E->getType()->getPointeeType());
 return true;
   }
 


Index: clang/test/SemaCXX/null-cast.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/null-cast.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct A {};
+struct B : virtual A {};
+
+void foo() {
+  (void)static_cast(*(B *)0); // expected-warning {{binding dereferenced null pointer to reference has undefined behavior}}
+}
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -5496,6 +5496,8 @@
   bool ZeroInitialization(const Expr *E) {
 auto Offset = Info.Ctx.getTargetNullPointerValue(E->getType());
 Result.set((Expr*)nullptr, 0, false, true, Offset);
+Result.getLValueDesignator() =
+SubobjectDesignator(E->getType()->getPointeeType());
 return true;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D33568: Fix crash when evaluating constant expressions involving nullptr

2017-05-25 Thread Richard Smith via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:5498-5500
 Result.set((Expr*)nullptr, 0, false, true, Offset);
+Result.getLValueDesignator() =
+SubobjectDesignator(E->getType()->getPointeeType());

This is the only caller of `set()` that passes more than three arguments (that 
is, the only caller that passes `true` as `IsNullPtr_`). It seems that such 
calls would always be unsafe / wrong, so I think we can do better than this.

How about this: split `set()` into two functions: for one of them, remove the 
last two parameters (`IsNullPtr_` and `Offset_`), and for the other one, rename 
to `setNull()` and just pass a `QualType` and offset.


https://reviews.llvm.org/D33568



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


Re: r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Jonathan Roelofs via cfe-commits



On 5/25/17 2:41 PM, Hans Wennborg wrote:

The test was failing on Windows; r303910 for that.


Oh yuk.. thanks for fixing that.


Jon



On Thu, May 25, 2017 at 11:55 AM, Jonathan Roelofs via cfe-commits
 wrote:


On 5/25/17 11:39 AM, Galina Kistanova wrote:

Hello Jonathan,

This commit broke one of our builders:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2608/steps/build-unified-tree/logs/stdio

Please have a look at this?


r303898 should take care of that.


Jon



Thanks

Galina

On Thu, May 25, 2017 at 8:42 AM, Jonathan Roelofs via cfe-commits
 wrote:

Author: jroelofs
Date: Thu May 25 10:42:13 2017
New Revision: 303873

URL: http://llvm.org/viewvc/llvm-project?rev=303873&view=rev
Log:
Don't defer to the GCC driver for linking arm-baremetal

Also comes with a cmake cache for building the runtime bits:

  $ cmake  \
-DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
-DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
-DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
-C /path/to/clang/cmake/caches/BaremetalARM.cmake \
/path/to/llvm

https://reviews.llvm.org/D33259

Added:
 cfe/trunk/cmake/caches/BaremetalARM.cmake
 cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
 cfe/trunk/lib/Driver/ToolChains/BareMetal.h
 cfe/trunk/test/Driver/Inputs/baremetal_arm/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
 cfe/trunk/test/Driver/baremetal.cpp
Modified:
 cfe/trunk/lib/Driver/CMakeLists.txt
 cfe/trunk/lib/Driver/Driver.cpp
 cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
 cfe/trunk/lib/Driver/ToolChains/Linux.cpp
 cfe/trunk/test/Frontend/gnu-mcount.c

Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/BaremetalARM.cmake?rev=303873&view=auto

==
--- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
+++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
@@ -0,0 +1,50 @@
+set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
+
+# Builtins
+set(LLVM_BUILTIN_TARGETS
"armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi" CACHE STRING "Builtin
Targets")
+
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV6M_SYSROOT}
CACHE STRING "armv6m-none-eabi Sysroot")
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
"armv6m-none-eabi System Name")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
"armv6m-none-eabi Baremetal build")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING
"armv6m-none-eabi os dir")
+
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7M_SYSROOT}
CACHE STRING "armv7m-none-eabi Sysroot")
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
"armv7m-none-eabi System Name")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
"armv7m-none-eabi Baremetal build")
+set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE STRING
"armv7m-none-eabi C Flags")
+set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
STRING "armv7m-none-eabi ASM Flags")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING
"armv7m-none-eabi os dir")
+
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7EM_SYSROOT}
CACHE STRING "armv7em-none-eabi Sysroot")
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
"armv7em-none-eabi System Name")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
"armv7em-none-eabi Baremetal build")
+set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE
STRING "armv7em-none-eabi C Flags")
+set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
STRING "armv7em-none-eabi ASM Flags")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE
STRING "armv7em-none-eabi os dir")
+
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+set(LLVM_TOOLCHAIN_TOOLS
+  llc
+  llvm-ar
+  llvm-cxxfilt
+  llvm-dwarfdump
+  llvm-dsymutil
+  llvm-nm
+  llvm-objdump
+  llvm-ranlib
+  llvm-readobj
+  llvm-size
+  llvm-symbolizer
+  opt
+  CACHE STRING "")
+
+set(LLVM_DISTRIBUTION_COMPONENTS
+  clang
+  lld
+  clang-headers
+  builtins-armv6m-none-eabi
+  builtins-armv7m-none-eabi
+  builtins-armv7em-none-eabi
+  runtimes
+  ${LLVM_TOOLCHAIN_TOOLS}
+  CACHE STRING "")

Modified: cfe/trunk/lib/Driver/CMakeLists.txt
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLi

[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-05-25 Thread Leo Li via Phabricator via cfe-commits
aoli updated this revision to Diff 100308.
aoli added a comment.

Add builtin configurations.


https://reviews.llvm.org/D33561

Files:
  cmake/caches/Android-stage2.cmake
  cmake/caches/Android.cmake


Index: cmake/caches/Android.cmake
===
--- /dev/null
+++ cmake/caches/Android.cmake
@@ -0,0 +1,31 @@
+# This file sets up a CMakeCache for an Android toolchain build.
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_BUILD_RUNTIME OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
+set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  if (Android_${target}_C_FLAGS)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_C_FLAGS=${Android_${target}_C_FLAGS})
+  endif()
+  if (Android_${target}_SYSROOT)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_SYSROOT=${Android_${target}_SYSROOT})
+  endif()
+  if (Android_${target}_CXX_FLAGS)
+list(APPEND EXTRA_ARGS 
-DAndroid_${target}_CXX_FLAGS=${Android_${target}_CXX_FLAGS})
+  endif()
+endforeach()
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS "${EXTRA_ARGS} 
-C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake" CACHE STRING "")
Index: cmake/caches/Android-stage2.cmake
===
--- /dev/null
+++ cmake/caches/Android-stage2.cmake
@@ -0,0 +1,30 @@
+set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+set(CMAKE_BUILT_TYPE RELEASE CACHE STRING "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+
+
+set(LLVM_BUILTIN_TARGETS 
"i686-linux-android;x86_64-linux-android;aarch64-linux-android;armv7-linux-android"
 CACHE STRING "")
+foreach(target i686;x86_64;aarch64;armv7)
+  set(BUILTINS_${target}-linux-android_ANDROID 1 CACHE STRING "")
+  set(BUILTINS_${target}-linux-android_CMAKE_ASM_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(BUILTINS_${target}-linux-android_CMAKE_C_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(BUILTINS_${target}-linux-android_CMAKE_SYSROOT 
${Android_${target}_SYSROOT} CACHE PATH "")
+endforeach()
+
+
+set(LLVM_RUNTIME_TARGETS 
"i686-linux-android;x86_64-linux-android;aarch64-linux-android;armv7-linux-android"
 CACHE STRING "")
+foreach(target i686;x86_64;aarch64;armv7)
+  set(RUNTIMES_${target}-linux-android_ANDROID 1 CACHE STRING "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_ASM_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_C_FLAGS 
${Android_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_CXX_FLAGS 
${Android_${target}_CXX_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_SYSROOT 
${Android_${target}_SYSROOT} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_ENABLE_WERROR ON CACHE BOOL 
"")
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_INCLUDE_TESTS OFF CACHE 
BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+endforeach()


Index: cmake/caches/Android.cmake
===
--- /dev/null
+++ cmake/caches/Android.cmake
@@ -0,0 +1,31 @@
+# This file sets up a CMakeCache for an Android toolchain build.
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+
+set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+set(LLVM_BUILD_RUNTIME OFF CACHE BOOL "")
+set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(LLVM_ENABLE_THREADS OFF CACHE BOOL "")
+set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "")
+set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "")
+
+set(CLANG_VENDOR Android CACHE STRING "")
+
+foreach(target i686;x86_64;aarch64;armv7)
+  if (Android_${target}_C_FLAGS)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_C_FLAGS=${Android_${target}_C_FLAGS})
+  endif()
+  if (Android_${target}_SYSROOT)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_SYSROOT=${Android_${target}_SYSROOT})
+  endif()
+  if (Android_${target}_CXX_FLAGS)
+list(APPEND EXTRA_ARGS -DAndroid_${target}_CXX_FLAGS=${Android_${target}_CXX_FLAGS})
+  endif()
+endforeach()
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS "${EXTRA_ARGS} -C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake" CACHE STRING "")
Inde

[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-05-25 Thread Leo Li via Phabricator via cfe-commits
aoli added a comment.

@jroelofs we are not building builtins currently but we are planning to do so. 
I just added some basic configurations for builtins.


https://reviews.llvm.org/D33561



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


[libcxx] r303928 - libcxx: fix bootstrapping for mingw-w64

2017-05-25 Thread Martell Malone via cfe-commits
Author: martell
Date: Thu May 25 17:37:15 2017
New Revision: 303928

URL: http://llvm.org/viewvc/llvm-project?rev=303928&view=rev
Log:
libcxx: fix bootstrapping for mingw-w64

Differential Revision: https://reviews.llvm.org/D33388

Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/include/__threading_support
libcxx/trunk/lib/CMakeLists.txt

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=303928&r1=303927&r2=303928&view=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Thu May 25 17:37:15 2017
@@ -41,7 +41,15 @@ if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
   if (MINGW)
 # Mingw64 requires quite a few "C" runtime libraries in order for basic
 # programs to link successfully with -nodefaultlibs.
-list(APPEND CMAKE_REQUIRED_LIBRARIES mingw32 gcc gcc_eh mingwex msvcrt gcc)
+if (LIBCXX_USE_COMPILER_RT)
+  set(MINGW_RUNTIME ${LIBCXXABI_BUILTINS_LIBRARY})
+else ()
+  set(MINGW_RUNTIME gcc_s gcc)
+endif()
+set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt 
advapi32
+shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME}
+moldname mingwex msvcrt)
+list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
   endif()
   if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")

Modified: libcxx/trunk/include/__threading_support
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=303928&r1=303927&r2=303928&view=diff
==
--- libcxx/trunk/include/__threading_support (original)
+++ libcxx/trunk/include/__threading_support Thu May 25 17:37:15 2017
@@ -27,7 +27,7 @@
 # include 
 # include 
 #elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
-#include 
+#include 
 #include 
 #include 
 #include <__undef_min_max>

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=303928&r1=303927&r2=303928&view=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Thu May 25 17:37:15 2017
@@ -242,14 +242,11 @@ endif()
 if (LIBCXX_ENABLE_STATIC)
   add_library(cxx_static STATIC $)
   target_link_libraries(cxx_static ${LIBCXX_LIBRARIES})
-  set(STATIC_OUTPUT_NAME "c++")
-  if (WIN32)
-set(STATIC_OUTPUT_NAME "libc++")
-  endif()
+  set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
   set_target_properties(cxx_static
 PROPERTIES
   LINK_FLAGS"${LIBCXX_LINK_FLAGS}"
-  OUTPUT_NAME   "${STATIC_OUTPUT_NAME}"
+  OUTPUT_NAME   "c++"
   )
 
   list(APPEND LIBCXX_TARGETS "cxx_static")


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


[libcxx] r303929 - Correct typo: LIBCXXABI_BUILTINS_LIBRARY -> LIBCXX_BUILTINS_LIBRARY

2017-05-25 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 25 17:43:42 2017
New Revision: 303929

URL: http://llvm.org/viewvc/llvm-project?rev=303929&view=rev
Log:
Correct typo: LIBCXXABI_BUILTINS_LIBRARY -> LIBCXX_BUILTINS_LIBRARY

Modified:
libcxx/trunk/cmake/config-ix.cmake

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=303929&r1=303928&r2=303929&view=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Thu May 25 17:43:42 2017
@@ -42,7 +42,7 @@ if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
 # Mingw64 requires quite a few "C" runtime libraries in order for basic
 # programs to link successfully with -nodefaultlibs.
 if (LIBCXX_USE_COMPILER_RT)
-  set(MINGW_RUNTIME ${LIBCXXABI_BUILTINS_LIBRARY})
+  set(MINGW_RUNTIME ${LIBCXX_BUILTINS_LIBRARY})
 else ()
   set(MINGW_RUNTIME gcc_s gcc)
 endif()


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


r303930 - Switch from using a DiagnosticTrap and a note for "while defining a special

2017-05-25 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu May 25 17:47:05 2017
New Revision: 303930

URL: http://llvm.org/viewvc/llvm-project?rev=303930&view=rev
Log:
Switch from using a DiagnosticTrap and a note for "while defining a special
member function" context notes to registering an entry on the context stack.

Also reorder the steps within defining special members to be consistent.

This has a few benefits: if multiple diagnostics are produced while checking
such a member, the note is now attached to the first such diagnostic rather
than the last, this prepares us for persisting these diagnostics between the
point at which we require the implicit instantiation of a template and the
point at which that instantiation is actually performed, and this fixes some
cases where we would fail to produce a full note stack leading back to user
code in the case of such a diagnostic.

The reordering exposed a case where we could recursively attempt to define a
defaulted destructor while we're already defining one (and other such cases
also appear to be possible, with or without this change), so this change also
reuses the "willHaveBody" flag on function declarations to track that we're in
the middle of synthesizing a body for the function and bails out if we try to
define a function that we're already defining.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/test/CXX/class.access/p4.cpp
cfe/trunk/test/SemaCXX/default-assignment-operator.cpp
cfe/trunk/test/SemaCXX/deprecated.cpp
cfe/trunk/test/SemaCXX/uninitialized.cpp
cfe/trunk/test/SemaCXX/virtual-base-used.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=303930&r1=303929&r2=303930&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu May 25 17:47:05 
2017
@@ -1554,9 +1554,9 @@ def note_ivar_decl : Note<"instance vari
 def note_bitfield_decl : Note<"bit-field is declared here">;
 def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
 def note_member_synthesized_at : Note<
-  "implicit %select{default constructor|copy constructor|move constructor|copy 
"
-  "assignment operator|move assignment operator|destructor}0 for %1 first "
-  "required here">;
+  "in implicit %select{default constructor|copy constructor|move constructor|"
+  "copy assignment operator|move assignment operator|destructor}0 for %1 "
+  "first required here">;
 def note_inhctor_synthesized_at : Note<
   "inherited constructor for %0 first required here">;
 def err_missing_default_ctor : Error<

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=303930&r1=303929&r2=303930&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu May 25 17:47:05 2017
@@ -689,17 +689,37 @@ public:
   class SynthesizedFunctionScope {
 Sema &S;
 Sema::ContextRAII SavedContext;
+bool PushedCodeSynthesisContext = false;
 
   public:
 SynthesizedFunctionScope(Sema &S, DeclContext *DC)
-  : S(S), SavedContext(S, DC)
-{
+: S(S), SavedContext(S, DC) {
   S.PushFunctionScope();
   S.PushExpressionEvaluationContext(
   Sema::ExpressionEvaluationContext::PotentiallyEvaluated);
+  if (auto *FD = dyn_cast(DC))
+FD->setWillHaveBody(true);
+  else
+assert(isa(DC));
+}
+
+void addContextNote(SourceLocation UseLoc) {
+  assert(!PushedCodeSynthesisContext);
+
+  Sema::CodeSynthesisContext Ctx;
+  Ctx.Kind = Sema::CodeSynthesisContext::DefiningSynthesizedFunction;
+  Ctx.PointOfInstantiation = UseLoc;
+  Ctx.Entity = cast(S.CurContext);
+  S.pushCodeSynthesisContext(Ctx);
+
+  PushedCodeSynthesisContext = true;
 }
 
 ~SynthesizedFunctionScope() {
+  if (PushedCodeSynthesisContext)
+S.popCodeSynthesisContext();
+  if (auto *FD = dyn_cast(S.CurContext))
+FD->setWillHaveBody(false);
   S.PopExpressionEvaluationContext();
   S.PopFunctionScopeInfo();
 }
@@ -6974,6 +6994,10 @@ public:
 
   /// We are declaring an implicit special member function.
   DeclaringSpecialMember,
+
+  /// We are defining a synthesized function (such as a defaulted special
+  /// member).
+  DefiningSynthesizedFunction,
 } Kind;
 
 /// \brief Was the enclosing context a non-instantiation SFINAE context?

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=303930&r1=303929&r2=3

[PATCH] D33538: [coroutines] Support "coroutines" feature in module map requires clause

2017-05-25 Thread Richard Smith via Phabricator via cfe-commits
rsmith added a comment.

Do we need to conditionalize this part of libc++? Nothing in the  
header appears to need compiler support.


https://reviews.llvm.org/D33538



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


[PATCH] D32842: Specify which sanitizers are covered by a sanitizer blacklist

2017-05-25 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov added a comment.

@vsk Looks reasonable to me, although I would say such a change should probably 
require more tests.
However, I am not a C++ expert, and I am still not overly familiar with a 
codebase, so I'm not sure whether I should be a single reviewer.


https://reviews.llvm.org/D32842



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


[PATCH] D33538: [coroutines] Support "coroutines" feature in module map requires clause

2017-05-25 Thread Richard Smith via Phabricator via cfe-commits
rsmith added a comment.

In https://reviews.llvm.org/D33538#765045, @rsmith wrote:

> Do we need to conditionalize this part of libc++? Nothing in the  
> header appears to need compiler support.


Oh wait, I see what's going on. You're not testing for whether coroutines is 
enabled, you're testing for whether the `__builtin_coro_*` builtins exist. Are 
we sufficiently confident that those aren't going to change that we're prepared 
to make libc++ rely on this? (If we change the signature of those builtins in 
the future, then new versions of clang would stop being able to build old 
versions of the libc++ module.)

If we're not confident of that, how about calling the new feature something 
ugly like experimental_coroutines_builtins_20170525 or similar? That way, 
future versions of Clang can stop advertising that feature if we change the 
design of the builtins, and we can add a feature 'coroutines' later in a 
non-disruptive way if/when we decide we're happy with them as-is.




Comment at: test/Modules/requires-coroutines.mm:1
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules 
-fimplicit-module-maps -F %S/Inputs %s -verify

EricWF wrote:
> Should this test be called `requires-coroutines.cpp` or is using Obj-C++ a 
> correct thing to do here?
You can use a .cpp extension and the Modules TS `import` keyword if you prefer 
(add `-fmodules-ts` to the clang arguments), or use a .cpp extension and 
`#pragma clang module import` if you don't want to depend on a second TS in 
this test.


https://reviews.llvm.org/D33538



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


r303932 - Make test/Driver/baremetal.cpp work when output directory isn't named 'bin'.

2017-05-25 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Thu May 25 18:03:08 2017
New Revision: 303932

URL: http://llvm.org/viewvc/llvm-project?rev=303932&view=rev
Log:
Make test/Driver/baremetal.cpp work when output directory isn't named 'bin'.


Modified:
cfe/trunk/test/Driver/baremetal.cpp

Modified: cfe/trunk/test/Driver/baremetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/baremetal.cpp?rev=303932&r1=303931&r2=303932&view=diff
==
--- cfe/trunk/test/Driver/baremetal.cpp (original)
+++ cfe/trunk/test/Driver/baremetal.cpp Thu May 25 18:03:08 2017
@@ -4,7 +4,7 @@
 // RUN: -L some/directory/user/asked/for \
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-C %s
-// CHECK-V6M-C: "[[PREFIX_DIR:.*]]{{[/\\]+}}bin{{[/\\]+}}clang{{.*}}" "-cc1" 
"-triple" "thumbv6m-none--eabi"
+// CHECK-V6M-C: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]*}}{{[/\\]+}}clang{{.*}}" 
"-cc1" "-triple" "thumbv6m-none--eabi"
 // CHECK-V6M-C-SAME: "-resource-dir" 
"[[PREFIX_DIR]]{{[/\\]+}}lib{{[/\\]+}}clang{{[/\\]+}}[[VERSION:[^"]*]]"
 // CHECK-V6M-C-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
 // CHECK-V6M-C-SAME: "-internal-isystem" 
"[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"


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


  1   2   >