Re: r290399 - When merging two deduced non-type template arguments for the same parameter,

2016-12-23 Thread Richard Smith via cfe-commits
On 22 Dec 2016 9:32 pm, "Chandler Carruth via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

On Thu, Dec 22, 2016 at 5:41 PM Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> 
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Dec 22
> 19:30:39 2016
> @@ -3343,6 +3343,10 @@ def note_ovl_candidate_incomplete_deduct
>  def note_ovl_candidate_inconsistent_deduction : Note<
>  "candidate template ignored: deduced conflicting
> %select{types|values|"
>  "templates}0 for parameter %1%diff{ ($ vs. $)|}2,3">;
> +def note_ovl_candidate_inconsistent_deduction_types : Note<
> +"candidate template ignored: deduced values %diff{"
> +"of conflicting types for parameter %0 (%1 of type $ vs. %3 of type
> $)|"
> +"%1 and %3 of conflicting types for parameter %0|}2,4">;
>

So, this new diagnostic isn't actually covered by any test. Not just is the
wording not covered, literally it isn't emitted. There is a bug in the
format that we didn't defend against -- having too many '|'s in the %diff
alternatives. I added an assert to try to catch this in r290417 and it
didn't trigger here because we never process this format.

Could you add a test covering this?


Both tests changed in this commit produce this diagnostic. We don't have
coverage for the tree-format diagnostic here, though; is that what you're
referring to?

I went ahead and fixed the %diff format syntax by inspection in r290417.


Thanks!

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


Re: r290399 - When merging two deduced non-type template arguments for the same parameter,

2016-12-23 Thread Chandler Carruth via cfe-commits
On Fri, Dec 23, 2016 at 12:32 AM Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On 22 Dec 2016 9:32 pm, "Chandler Carruth via cfe-commits" <
> cfe-commits@lists.llvm.org> wrote:
>
> On Thu, Dec 22, 2016 at 5:41 PM Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Dec 22
> 19:30:39 2016
> @@ -3343,6 +3343,10 @@ def note_ovl_candidate_incomplete_deduct
>  def note_ovl_candidate_inconsistent_deduction : Note<
>  "candidate template ignored: deduced conflicting
> %select{types|values|"
>  "templates}0 for parameter %1%diff{ ($ vs. $)|}2,3">;
> +def note_ovl_candidate_inconsistent_deduction_types : Note<
> +"candidate template ignored: deduced values %diff{"
> +"of conflicting types for parameter %0 (%1 of type $ vs. %3 of type
> $)|"
> +"%1 and %3 of conflicting types for parameter %0|}2,4">;
>
>
> So, this new diagnostic isn't actually covered by any test. Not just is
> the wording not covered, literally it isn't emitted. There is a bug in the
> format that we didn't defend against -- having too many '|'s in the %diff
> alternatives. I added an assert to try to catch this in r290417 and it
> didn't trigger here because we never process this format.
>
> Could you add a test covering this?
>
>
> Both tests changed in this commit produce this diagnostic. We don't have
> coverage for the tree-format diagnostic here, though; is that what you're
> referring to?
>

I mean, it is possible I messed something up, but i put a bunch of garbage
text into the message and all tests passed.

And I put an extra '|' into other messages with %diff and tests assert
failed. I don't think they were doing tree-format anything.

But the diagnostic I changed here passed even with my added assert
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28077: [PM] Introduce options to enable the (still experimental) new pass manager, and a code path to use it.

2016-12-23 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc created this revision.
chandlerc added reviewers: rsmith, mehdi_amini.
chandlerc added a subscriber: cfe-commits.
chandlerc added a dependency: D28076: [PM] Add support for building a default 
AA pipeline to the PassBuilder..
Herald added a subscriber: mcrosier.

The option is actually a top-level option but does contain
'experimental' in the name. This is the compromise suggested by Richard
in discussions. We expect this option will be around long enough and
have enough users towards the end that it merits not being relegated to
CC1, but it still needs to be clear that this option will go away at
some point.

The backend code is a fresh codepath dedicated to handling the flow with
the new pass manager. This was also Richard's suggested code structuring
to essentially leave a clean path for development rather than carrying
complexity or idiosyncracies of how we do things just to share code with
the parts of this in common with the legacy pass manager. And it turns
out, not much is really in common even though we use the legacy pass
manager for codegen at this point.

I've switched a couple of tests to run with the new pass manager, and
they appear to work. There are still plenty of bugs that need squashing
(just with basic experiments I've found two already!) but they aren't in
this code, and the whole point is to expose the necessary hooks to start
experimenting with the pass manager in more realistic scenarios.

That said, I want to *strongly caution* anyone itching to play with
this: it is still *very shaky*. Several large components have not yet
been shaken down. For example I have bugs in both the always inliner and
inliner that I have already spotted and will be fixing independently.

Still, this is a fun milestone. =D

One thing not in this patch (but that might be very reasonable to add)
is some level of support for raw textual pass pipelines such as what
Sean had a patch for some time ago. I'm mostly interested in the more
traditional flow of getting the IR out of Clang and then running it
through opt, but I can see other use cases so someone may want to add
it.

And of course, *many* features are not yet supported!

- https://reviews.llvm.org/owners/package/1/ is currently more like 
https://reviews.llvm.org/owners/package/2/
- None of the sanitizers are wired up
- ObjC ARC optimizer isn't wired up
- ...

So plenty of stuff still lef to do!

Depends on https://reviews.llvm.org/D28076.


https://reviews.llvm.org/D28077

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/BackendUtil.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/arm64_crypto.c
  test/CodeGen/inline-optim.c
  test/Driver/clang_f_opts.c

Index: test/Driver/clang_f_opts.c
===
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -469,3 +469,11 @@
 // CHECK-WCHAR2: -fshort-wchar
 // CHECK-WCHAR2-NOT: -fno-short-wchar
 // DELIMITERS: {{^ *"}}
+
+// RUN: %clang -### -fno-experimental-new-pass-manager -fexperimental-new-pass-manager %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NEW-PM %s
+// RUN: %clang -### -fexperimental-new-pass-manager -fno-experimental-new-pass-manager %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NO-NEW-PM %s
+// CHECK-NOT: argument unused
+// CHECK-NEW-PM: -fexperimental-new-pass-manager
+// CHECK-NEW-PM-NOT: -fno-experimental-new-pass-manager
+// CHECK-NO-NEW-PM: -fno-experimental-new-pass-manager
+// CHECK-NO-NEW-PM-NOT: -fexperimental-new-pass-manager
Index: test/CodeGen/inline-optim.c
===
--- test/CodeGen/inline-optim.c
+++ test/CodeGen/inline-optim.c
@@ -1,9 +1,13 @@
 // Make sure -finline-functions family flags are behaving correctly.
 
 // RUN: %clang_cc1 -triple i686-pc-win32 -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -fno-inline-functions -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager -O3 -fno-inline-functions -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -finline-hint-functions -emit-llvm %s -o - | FileCheck -check-prefix=HINT %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager -O3 -finline-hint-functions -emit-llvm %s -o - | FileCheck -check-prefix=HINT %s
 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -finline-functions -emit-llvm %s -o - | FileCheck -check-prefix=INLINE %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager -O3 -finline-functions -emit-llvm %s -o - | FileCheck -check-prefix=INLINE %s
 
 inline int inline_hint(int a, int b) { return(a+b); }
 
Index: test/Code

[PATCH] D27898: [compiler-rt] [builtins] Implement __floattitf() & __floatuntitf()

2016-12-23 Thread Michał Górny via Phabricator via cfe-commits
mgorny added inline comments.



Comment at: lib/builtins/floattitf.c:65
+if (a & ((tu_int)1 << LDBL_MANT_DIG)) {
+a >>= 1;
+++e;

scanon wrote:
> Strictly speaking there's no need to adjust `a` here. If we rounded up into a 
> new binade, then `a` is necessarily `0b1000...0`, and the leading 1 bit will 
> get killed by the mask when we assemble `fb.u.high.all` regardless of its 
> position. Same comment applies to floatuntitf.
I'm sorry but I don't feel confident changing that. AFAIU if the 
LDBL_MANT_DIG+1 bit is set, this code shifts it lower, so it won't actually be 
killed by the mask.


https://reviews.llvm.org/D27898



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


[PATCH] D21298: [Clang-tidy] delete null check

2016-12-23 Thread Gergely Angeli via Phabricator via cfe-commits
SilverGeri updated this revision to Diff 82401.
SilverGeri added a comment.

remove brackets


https://reviews.llvm.org/D21298

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/DeleteNullPointerCheck.cpp
  clang-tidy/readability/DeleteNullPointerCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-delete-null-pointer.rst
  test/clang-tidy/readability-delete-null-pointer.cpp

Index: test/clang-tidy/readability-delete-null-pointer.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-delete-null-pointer.cpp
@@ -0,0 +1,73 @@
+// RUN: %check_clang_tidy %s readability-delete-null-pointer %t
+
+#define NULL 0
+
+void f() {
+  int *p = 0;
+  // CHECK-FIXES: // comment that should not be deleted
+  if (p) {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
+// comment that should not be deleted
+delete p;
+  }
+  // CHECK-FIXES-NOT: if (p) {
+  // CHECK-FIXES: delete p;
+
+
+  int *p2 = new int[3];
+  // CHECK-FIXES: // another comment to keep
+  if (p2)
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary;
+// another comment to keep
+delete[] p2;
+  // CHECK-FIXES-NOT: if (p2)
+  // CHECK-FIXES: delete[] p2;
+
+  int *p3 = 0;
+  if (NULL != p3) {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary;
+delete p3;
+  }
+  // CHECK-FIXES-NOT: if (NULL != p3) {
+  // CHECK-FIXES: delete p3;
+
+  int *p4 = nullptr;
+  if (p4 != nullptr) {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary;
+delete p4;
+  }
+  // CHECK-FIXES-NOT: if (p4 != nullptr) {
+  // CHECK-FIXES: delete p4;
+
+  char *c;
+  if (c != 0) {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary;
+delete c;
+  }
+  // CHECK-FIXES-NOT: if (c != 0) {
+  // CHECK-FIXES: delete c;
+
+  char *c2;
+  if (c2) {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary;
+// CHECK-FIXES: } else {
+// CHECK-FIXES: c2 = c;
+delete c2;
+  } else {
+c2 = c;
+  }
+}
+
+void g() {
+  int *p5, *p6;
+  if (p5)
+delete p6;
+
+  if (p5 && p6)
+delete p5;
+
+  if (p6) {
+int x = 5;
+delete p6;
+  }
+}
Index: docs/clang-tidy/checks/readability-delete-null-pointer.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/readability-delete-null-pointer.rst
@@ -0,0 +1,12 @@
+.. title:: clang-tidy - readability-delete-null-pointer
+
+readability-delete-null-pointer
+===
+
+Checks the 'if' statements where a pointer's existence is checked and then deletes the pointer.
+The check is unnecessary as deleting a nullpointer has no effect.
+
+.. code:: c++
+  int *p;
+  if (p)
+delete p;
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -127,6 +127,7 @@
readability-avoid-const-params-in-decls
readability-braces-around-statements
readability-container-size-empty
+   readability-delete-null-pointer
readability-deleted-default
readability-else-after-return
readability-function-size
Index: clang-tidy/readability/ReadabilityTidyModule.cpp
===
--- clang-tidy/readability/ReadabilityTidyModule.cpp
+++ clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -13,6 +13,7 @@
 #include "AvoidConstParamsInDecls.h"
 #include "BracesAroundStatementsCheck.h"
 #include "ContainerSizeEmptyCheck.h"
+#include "DeleteNullPointerCheck.h"
 #include "DeletedDefaultCheck.h"
 #include "ElseAfterReturnCheck.h"
 #include "FunctionSizeCheck.h"
@@ -45,6 +46,8 @@
 "readability-braces-around-statements");
 CheckFactories.registerCheck(
 "readability-container-size-empty");
+CheckFactories.registerCheck(
+"readability-delete-null-pointer");
 CheckFactories.registerCheck(
 "readability-deleted-default");
 CheckFactories.registerCheck(
Index: clang-tidy/readability/DeleteNullPointerCheck.h
===
--- /dev/null
+++ clang-tidy/readability/DeleteNullPointerCheck.h
@@ -0,0 +1,35 @@
+//===--- DeleteNullPointerCheck.h - clang-tidy---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_DELETE_NULL_POINTER_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_DELETE_NULL_POINTER_

[PATCH] D28078: [tests] Add missing "int_lib.h" includes and extend guards

2016-12-23 Thread Michał Górny via Phabricator via cfe-commits
mgorny created this revision.
mgorny added reviewers: dschuff, kledzik, rengolin.
mgorny added a subscriber: cfe-commits.
Herald added a subscriber: aemerson.

Fix missing "int_lib.h" includes in ARM negdf2vfp and subdf3vfp tests.
Additionally, extend the __arm__ guard to cover the builtin definition
in the former. This is mostly intended to prevent build failures
and allow those tests to be properly skipped on other targets.


https://reviews.llvm.org/D28078

Files:
  test/builtins/Unit/negdf2vfp_test.c
  test/builtins/Unit/subdf3vfp_test.c


Index: test/builtins/Unit/subdf3vfp_test.c
===
--- test/builtins/Unit/subdf3vfp_test.c
+++ test/builtins/Unit/subdf3vfp_test.c
@@ -11,6 +11,7 @@
 //
 
//===--===//
 
+#include "int_lib.h"
 #include 
 #include 
 #include 
Index: test/builtins/Unit/negdf2vfp_test.c
===
--- test/builtins/Unit/negdf2vfp_test.c
+++ test/builtins/Unit/negdf2vfp_test.c
@@ -11,14 +11,15 @@
 //
 
//===--===//
 
+#include "int_lib.h"
 #include 
 #include 
 #include 
 
 
+#if __arm__
 extern COMPILER_RT_ABI double __negdf2vfp(double a);
 
-#if __arm__
 int test__negdf2vfp(double a)
 {
 double actual = __negdf2vfp(a);


Index: test/builtins/Unit/subdf3vfp_test.c
===
--- test/builtins/Unit/subdf3vfp_test.c
+++ test/builtins/Unit/subdf3vfp_test.c
@@ -11,6 +11,7 @@
 //
 //===--===//
 
+#include "int_lib.h"
 #include 
 #include 
 #include 
Index: test/builtins/Unit/negdf2vfp_test.c
===
--- test/builtins/Unit/negdf2vfp_test.c
+++ test/builtins/Unit/negdf2vfp_test.c
@@ -11,14 +11,15 @@
 //
 //===--===//
 
+#include "int_lib.h"
 #include 
 #include 
 #include 
 
 
+#if __arm__
 extern COMPILER_RT_ABI double __negdf2vfp(double a);
 
-#if __arm__
 int test__negdf2vfp(double a)
 {
 double actual = __negdf2vfp(a);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28052: [change-namespace] consider namespace aliases to shorten qualified names.

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

LGTM.


https://reviews.llvm.org/D28052



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


[clang-tools-extra] r290421 - [change-namespace] consider namespace aliases to shorten qualified names.

2016-12-23 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Fri Dec 23 04:47:09 2016
New Revision: 290421

URL: http://llvm.org/viewvc/llvm-project?rev=290421&view=rev
Log:
[change-namespace] consider namespace aliases to shorten qualified names.

Reviewers: hokein

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
clang-tools-extra/trunk/change-namespace/ChangeNamespace.h
clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp

Modified: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp?rev=290421&r1=290420&r2=290421&view=diff
==
--- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp (original)
+++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp Fri Dec 23 
04:47:09 2016
@@ -306,6 +306,11 @@ void ChangeNamespaceTool::registerMatche
 IsVisibleInNewNs)
  .bind("using_namespace"),
  this);
+  // Match namespace alias declarations.
+  Finder->addMatcher(namespaceAliasDecl(isExpansionInFileMatching(FilePattern),
+IsVisibleInNewNs)
+ .bind("namespace_alias"),
+ this);
 
   // Match old namespace blocks.
   Finder->addMatcher(
@@ -429,6 +434,10 @@ void ChangeNamespaceTool::run(
  Result.Nodes.getNodeAs(
  "using_namespace")) {
 UsingNamespaceDecls.insert(UsingNamespace);
+  } else if (const auto *NamespaceAlias =
+ Result.Nodes.getNodeAs(
+ "namespace_alias")) {
+NamespaceAliasDecls.insert(NamespaceAlias);
   } else if (const auto *NsDecl =
  Result.Nodes.getNodeAs("old_ns")) {
 moveOldNamespace(Result, NsDecl);
@@ -687,6 +696,38 @@ void ChangeNamespaceTool::replaceQualifi
 ReplaceName = FromDeclNameRef;
 }
   }
+  // Checks if there is any namespace alias declarations that can shorten the
+  // qualified name.
+  for (const auto *NamespaceAlias : NamespaceAliasDecls) {
+if (!isDeclVisibleAtLocation(*Result.SourceManager, NamespaceAlias, 
DeclCtx,
+ Start))
+  continue;
+StringRef FromDeclNameRef = FromDeclName;
+if (FromDeclNameRef.consume_front(
+NamespaceAlias->getNamespace()->getQualifiedNameAsString() +
+"::")) {
+  std::string AliasName = NamespaceAlias->getNameAsString();
+  std::string AliasQualifiedName =
+  NamespaceAlias->getQualifiedNameAsString();
+  // We only consider namespace aliases define in the global namepspace or
+  // in namespaces that are directly visible from the reference, i.e.
+  // ancestor of the `OldNs`. Note that declarations in ancestor namespaces
+  // but not visible in the new namespace is filtered out by
+  // "IsVisibleInNewNs" matcher.
+  if (AliasQualifiedName != AliasName) {
+// The alias is defined in some namespace.
+assert(StringRef(AliasQualifiedName).endswith("::" + AliasName));
+llvm::StringRef AliasNs =
+StringRef(AliasQualifiedName).drop_back(AliasName.size() + 2);
+if (!llvm::StringRef(OldNs).startswith(AliasNs))
+  continue;
+  }
+  std::string NameWithAliasNamespace =
+  (AliasName + "::" + FromDeclNameRef).str();
+  if (NameWithAliasNamespace.size() < ReplaceName.size())
+ReplaceName = NameWithAliasNamespace;
+}
+  }
   // Checks if there is any using shadow declarations that can shorten the
   // qualified name.
   bool Matched = false;

Modified: clang-tools-extra/trunk/change-namespace/ChangeNamespace.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/change-namespace/ChangeNamespace.h?rev=290421&r1=290420&r2=290421&view=diff
==
--- clang-tools-extra/trunk/change-namespace/ChangeNamespace.h (original)
+++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.h Fri Dec 23 
04:47:09 2016
@@ -154,6 +154,9 @@ private:
   // Records all using namespace declarations, which can be used to shorten
   // namespace specifiers.
   llvm::SmallPtrSet UsingNamespaceDecls;
+  // Records all namespace alias declarations, which can be used to shorten
+  // namespace specifiers.
+  llvm::SmallPtrSet NamespaceAliasDecls;
   // TypeLocs of CXXCtorInitializer. Types of CXXCtorInitializers do not need 
to
   // be fixed.
   llvm::SmallVector BaseCtorInitializerTypeLocs;

Modified: 
clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp?rev=290421&r1=290420&r2=290421&view=diff
==

[PATCH] D28052: [change-namespace] consider namespace aliases to shorten qualified names.

2016-12-23 Thread Eric Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL290421: [change-namespace] consider namespace aliases to 
shorten qualified names. (authored by ioeric).

Changed prior to commit:
  https://reviews.llvm.org/D28052?vs=82345&id=82405#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28052

Files:
  clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
  clang-tools-extra/trunk/change-namespace/ChangeNamespace.h
  clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp

Index: clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
===
--- clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
+++ clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
@@ -825,6 +825,114 @@
   EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
 }
 
+TEST_F(ChangeNamespaceTest, NamespaceAliasInGlobal) {
+  std::string Code = "namespace glob {\n"
+ "class Glob {};\n"
+ "}\n"
+ "namespace glob2 { class Glob2 {}; }\n"
+ "namespace gl = glob;\n"
+ "namespace gl2 = ::glob2;\n"
+ "namespace na {\n"
+ "namespace nb {\n"
+ "void f() { gl::Glob g; gl2::Glob2 g2; }\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+
+  std::string Expected =
+  "namespace glob {\n"
+  "class Glob {};\n"
+  "}\n"
+  "namespace glob2 { class Glob2 {}; }\n"
+  "namespace gl = glob;\n"
+  "namespace gl2 = ::glob2;\n"
+  "\n"
+  "namespace x {\n"
+  "namespace y {\n"
+  "void f() { gl::Glob g; gl2::Glob2 g2; }\n"
+  "} // namespace y\n"
+  "} // namespace x\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
+TEST_F(ChangeNamespaceTest, NamespaceAliasInNamespace) {
+  std::string Code = "namespace glob {\n"
+ "class Glob {};\n"
+ "}\n"
+ "namespace na {\n"
+ "namespace nb {\n"
+ "namespace gl = glob;\n"
+ "void f() { gl::Glob g; }\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+
+  std::string Expected = "namespace glob {\n"
+ "class Glob {};\n"
+ "}\n"
+ "\n"
+ "namespace x {\n"
+ "namespace y {\n"
+ "namespace gl = glob;\n"
+ "void f() { gl::Glob g; }\n"
+ "} // namespace y\n"
+ "} // namespace x\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
+TEST_F(ChangeNamespaceTest, NamespaceAliasInAncestorNamespace) {
+  NewNamespace = "na::nx";
+  std::string Code = "namespace glob {\n"
+ "class Glob {};\n"
+ "}\n"
+ "namespace other { namespace gl = glob; }\n"
+ "namespace na {\n"
+ "namespace ga = glob;\n"
+ "namespace nb {\n"
+ "void f() { ga::Glob g; }\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+
+  std::string Expected = "namespace glob {\n"
+ "class Glob {};\n"
+ "}\n"
+ "namespace other { namespace gl = glob; }\n"
+ "namespace na {\n"
+ "namespace ga = glob;\n"
+ "\n"
+ "namespace nx {\n"
+ "void f() { ga::Glob g; }\n"
+ "} // namespace nx\n"
+ "} // namespace na\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
+TEST_F(ChangeNamespaceTest, NamespaceAliasInOtherNamespace) {
+  std::string Code = "namespace glob {\n"
+ "class Glob {};\n"
+ "}\n"
+ "namespace other { namespace gl = glob; }\n"
+ "namespace na {\n"
+ "namespace ga = glob;\n"
+ "namespace nb {\n"
+ "void f() { glob::Glob g; }\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+
+  std::string Expected = "namespace glob {\n"
+ "class Glob {};\n"
+ "}\n"
+ "namespace other { namespace gl = glob; }\n"
+ "namespace na {\n"
+ "namespace ga = glob;\n"
+ "\n"
+ "} // namespace na\n"
+ "namespace x {\n"
+ 

[PATCH] D28078: [compiler-rt] [tests] Add missing "int_lib.h" includes and extend guards

2016-12-23 Thread Renato Golin via Phabricator via cfe-commits
rengolin accepted this revision.
rengolin added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


https://reviews.llvm.org/D28078



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


[PATCH] D28078: [compiler-rt] [tests] Add missing "int_lib.h" includes and extend guards

2016-12-23 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL290422: [tests] Add missing "int_lib.h" includes and extend 
guards (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D28078?vs=82402&id=82407#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28078

Files:
  compiler-rt/trunk/test/builtins/Unit/negdf2vfp_test.c
  compiler-rt/trunk/test/builtins/Unit/subdf3vfp_test.c


Index: compiler-rt/trunk/test/builtins/Unit/subdf3vfp_test.c
===
--- compiler-rt/trunk/test/builtins/Unit/subdf3vfp_test.c
+++ compiler-rt/trunk/test/builtins/Unit/subdf3vfp_test.c
@@ -11,6 +11,7 @@
 //
 
//===--===//
 
+#include "int_lib.h"
 #include 
 #include 
 #include 
Index: compiler-rt/trunk/test/builtins/Unit/negdf2vfp_test.c
===
--- compiler-rt/trunk/test/builtins/Unit/negdf2vfp_test.c
+++ compiler-rt/trunk/test/builtins/Unit/negdf2vfp_test.c
@@ -11,14 +11,15 @@
 //
 
//===--===//
 
+#include "int_lib.h"
 #include 
 #include 
 #include 
 
 
+#if __arm__
 extern COMPILER_RT_ABI double __negdf2vfp(double a);
 
-#if __arm__
 int test__negdf2vfp(double a)
 {
 double actual = __negdf2vfp(a);


Index: compiler-rt/trunk/test/builtins/Unit/subdf3vfp_test.c
===
--- compiler-rt/trunk/test/builtins/Unit/subdf3vfp_test.c
+++ compiler-rt/trunk/test/builtins/Unit/subdf3vfp_test.c
@@ -11,6 +11,7 @@
 //
 //===--===//
 
+#include "int_lib.h"
 #include 
 #include 
 #include 
Index: compiler-rt/trunk/test/builtins/Unit/negdf2vfp_test.c
===
--- compiler-rt/trunk/test/builtins/Unit/negdf2vfp_test.c
+++ compiler-rt/trunk/test/builtins/Unit/negdf2vfp_test.c
@@ -11,14 +11,15 @@
 //
 //===--===//
 
+#include "int_lib.h"
 #include 
 #include 
 #include 
 
 
+#if __arm__
 extern COMPILER_RT_ABI double __negdf2vfp(double a);
 
-#if __arm__
 int test__negdf2vfp(double a)
 {
 double actual = __negdf2vfp(a);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r290424 - Use after move bug fixes

2016-12-23 Thread Piotr Padlewski via cfe-commits
Author: prazek
Date: Fri Dec 23 05:40:44 2016
New Revision: 290424

URL: http://llvm.org/viewvc/llvm-project?rev=290424&view=rev
Log:
Use after move bug fixes

Summary: Bunch of fixed bugs in Clang after running misc-use-after-move in 
clang-tidy.

Reviewers: rsmith, mboehme

Subscribers: cfe-commits, klimek

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

Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/lib/Format/SortJavaScriptImports.cpp
cfe/trunk/lib/Format/WhitespaceManager.cpp
cfe/trunk/lib/Lex/ModuleMap.cpp
cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=290424&r1=290423&r2=290424&view=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Fri Dec 23 05:40:44 2016
@@ -844,9 +844,10 @@ private:
   Env.getSourceManager(), Start, Length, ReplacementText));
   // FIXME: handle error. For now, print error message and skip the
   // replacement for release version.
-  if (Err)
+  if (Err) {
 llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-  assert(!Err);
+assert(false);
+  }
 };
 Replace(Start, 1, IsSingle ? "'" : "\"");
 Replace(FormatTok->Tok.getEndLoc().getLocWithOffset(-1), 1,
@@ -1193,9 +1194,10 @@ private:
   Fixes.add(tooling::Replacement(Env.getSourceManager(), SR, ""));
   // FIXME: better error handling. for now just print error message and 
skip
   // for the release version.
-  if (Err)
+  if (Err) {
 llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-  assert(!Err && "Fixes must not conflict!");
+assert(false && "Fixes must not conflict!");
+  }
   Idx = End + 1;
 }
 
@@ -1327,9 +1329,10 @@ static void sortCppIncludes(const Format
   FileName, Includes.front().Offset, IncludesBlockSize, result));
   // FIXME: better error handling. For now, just skip the replacement for the
   // release version.
-  if (Err)
+  if (Err) {
 llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-  assert(!Err);
+assert(false);
+  }
 }
 
 namespace {

Modified: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/SortJavaScriptImports.cpp?rev=290424&r1=290423&r2=290424&view=diff
==
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp (original)
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp Fri Dec 23 05:40:44 2016
@@ -197,9 +197,10 @@ public:
 ReferencesText));
 // FIXME: better error handling. For now, just print error message and skip
 // the replacement for the release version.
-if (Err)
+if (Err) {
   llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-assert(!Err);
+  assert(false);
+}
 
 return Result;
   }

Modified: cfe/trunk/lib/Format/WhitespaceManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/WhitespaceManager.cpp?rev=290424&r1=290423&r2=290424&view=diff
==
--- cfe/trunk/lib/Format/WhitespaceManager.cpp (original)
+++ cfe/trunk/lib/Format/WhitespaceManager.cpp Fri Dec 23 05:40:44 2016
@@ -501,9 +501,10 @@ void WhitespaceManager::storeReplacement
   SourceMgr, CharSourceRange::getCharRange(Range), Text));
   // FIXME: better error handling. For now, just print an error message in the
   // release version.
-  if (Err)
+  if (Err) {
 llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-  assert(!Err);
+assert(false);
+  }
 }
 
 void WhitespaceManager::appendNewlineText(std::string &Text,

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=290424&r1=290423&r2=290424&view=diff
==
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Fri Dec 23 05:40:44 2016
@@ -827,7 +827,7 @@ void ModuleMap::addHeader(Module *Mod, M
   return;
 
   HeaderList.push_back(KH);
-  Mod->Headers[headerRoleToKind(Role)].push_back(std::move(Header));
+  Mod->Headers[headerRoleToKind(Role)].push_back(Header);
 
   bool isCompilingModuleHeader =
   LangOpts.isCompilingModule() && Mod->getTopLevelModule() == SourceModule;

Modified: cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp?rev=290424&r1=290423&r2=290424&view=diff
==
--- cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp (original)
+++ cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp Fri Dec 23 05:4

[PATCH] D27752: [clang] Use after move bug fixes

2016-12-23 Thread Piotr Padlewski via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL290424: Use after move bug fixes (authored by Prazek).

Changed prior to commit:
  https://reviews.llvm.org/D27752?vs=81369&id=82408#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27752

Files:
  cfe/trunk/lib/Format/Format.cpp
  cfe/trunk/lib/Format/SortJavaScriptImports.cpp
  cfe/trunk/lib/Format/WhitespaceManager.cpp
  cfe/trunk/lib/Lex/ModuleMap.cpp
  cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp

Index: cfe/trunk/lib/Lex/ModuleMap.cpp
===
--- cfe/trunk/lib/Lex/ModuleMap.cpp
+++ cfe/trunk/lib/Lex/ModuleMap.cpp
@@ -827,7 +827,7 @@
   return;
 
   HeaderList.push_back(KH);
-  Mod->Headers[headerRoleToKind(Role)].push_back(std::move(Header));
+  Mod->Headers[headerRoleToKind(Role)].push_back(Header);
 
   bool isCompilingModuleHeader =
   LangOpts.isCompilingModule() && Mod->getTopLevelModule() == SourceModule;
Index: cfe/trunk/lib/Format/WhitespaceManager.cpp
===
--- cfe/trunk/lib/Format/WhitespaceManager.cpp
+++ cfe/trunk/lib/Format/WhitespaceManager.cpp
@@ -501,9 +501,10 @@
   SourceMgr, CharSourceRange::getCharRange(Range), Text));
   // FIXME: better error handling. For now, just print an error message in the
   // release version.
-  if (Err)
+  if (Err) {
 llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-  assert(!Err);
+assert(false);
+  }
 }
 
 void WhitespaceManager::appendNewlineText(std::string &Text,
Index: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
===
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp
@@ -197,9 +197,10 @@
 ReferencesText));
 // FIXME: better error handling. For now, just print error message and skip
 // the replacement for the release version.
-if (Err)
+if (Err) {
   llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-assert(!Err);
+  assert(false);
+}
 
 return Result;
   }
Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -844,9 +844,10 @@
   Env.getSourceManager(), Start, Length, ReplacementText));
   // FIXME: handle error. For now, print error message and skip the
   // replacement for release version.
-  if (Err)
+  if (Err) {
 llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-  assert(!Err);
+assert(false);
+  }
 };
 Replace(Start, 1, IsSingle ? "'" : "\"");
 Replace(FormatTok->Tok.getEndLoc().getLocWithOffset(-1), 1,
@@ -1193,9 +1194,10 @@
   Fixes.add(tooling::Replacement(Env.getSourceManager(), SR, ""));
   // FIXME: better error handling. for now just print error message and skip
   // for the release version.
-  if (Err)
+  if (Err) {
 llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-  assert(!Err && "Fixes must not conflict!");
+assert(false && "Fixes must not conflict!");
+  }
   Idx = End + 1;
 }
 
@@ -1327,9 +1329,10 @@
   FileName, Includes.front().Offset, IncludesBlockSize, result));
   // FIXME: better error handling. For now, just skip the replacement for the
   // release version.
-  if (Err)
+  if (Err) {
 llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-  assert(!Err);
+assert(false);
+  }
 }
 
 namespace {
Index: cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
===
--- cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
+++ cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
@@ -45,9 +45,10 @@
 CharSourceRange::getTokenRange(FromMatch->getSourceRange()), ToText));
 // FIXME: better error handling. For now, just print error message in the
 // release version.
-if (Err)
+if (Err) {
   llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-assert(!Err);
+  assert(false);
+}
   }
 }
 
@@ -63,9 +64,10 @@
 replaceStmtWithStmt(*Result.SourceManager, *FromMatch, *ToMatch));
 // FIXME: better error handling. For now, just print error message in the
 // release version.
-if (Err)
+if (Err) {
   llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-assert(!Err);
+  assert(false);
+}
   }
 }
 
@@ -82,19 +84,21 @@
   Replace.add(replaceStmtWithStmt(*Result.SourceManager, *Node, *Body));
   // FIXME: better error handling. For now, just print error message in the
   // release version.
-  if (Err)
+  if (Err) {
 llvm::errs() << llvm::toString(std::move(Err)) << "\n";
-  assert(!Err);
+assert(false);
+  }
 } else if (!PickTrueBranch) {
 

[PATCH] D27898: [compiler-rt] [builtins] Implement __floattitf() & __floatuntitf()

2016-12-23 Thread Steve Canon via Phabricator via cfe-commits
scanon added inline comments.



Comment at: lib/builtins/floattitf.c:65
+if (a & ((tu_int)1 << LDBL_MANT_DIG)) {
+a >>= 1;
+++e;

mgorny wrote:
> scanon wrote:
> > Strictly speaking there's no need to adjust `a` here. If we rounded up into 
> > a new binade, then `a` is necessarily `0b1000...0`, and the leading 1 bit 
> > will get killed by the mask when we assemble `fb.u.high.all` regardless of 
> > its position. Same comment applies to floatuntitf.
> I'm sorry but I don't feel confident changing that. AFAIU if the 
> LDBL_MANT_DIG+1 bit is set, this code shifts it lower, so it won't actually 
> be killed by the mask.
In binary128, as in all IEEE 754 binary interchange format encodings, the 
leading bit of the significand is implicit. The only way to end up in this code 
path is `0b111...1` rounding up to `0b100...00`, meaning that the significand 
is 1.0, which is stored as all-zeros (i.e. the leading bit is necessarily 
masked).

To be more explicit, LDBL_MANT_DIG is 113. If this shift happens, after the 
shift bit 112 is set, and bits 111:0 are zero. The mask `((a >> 64) & 
0xLL)` discards bit 112 (= 64 + 48).


https://reviews.llvm.org/D27898



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


[PATCH] D27898: [compiler-rt] [builtins] Implement __floattitf() & __floatuntitf()

2016-12-23 Thread Steve Canon via Phabricator via cfe-commits
scanon requested changes to this revision.
scanon added a reviewer: scanon.
scanon added a comment.
This revision now requires changes to proceed.

I don't particularly care about the shift, since the code is completely 
equivalent either way, though it would be nice to clean up. However, please 
replace "mantissa" with "significand" before committing.


https://reviews.llvm.org/D27898



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


[PATCH] D28080: [Docs][OpenCL] Added OpenCL feature description to user manual.

2016-12-23 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia created this revision.
Anastasia added reviewers: yaxunl, pekka.jaaskelainen, bader.
Anastasia added subscribers: cfe-commits, rsmith.

Adding information on OpenCL to Clang documentation. This currently contain the 
main features only. I am hoping we can improve it with time documenting more 
features.

Can be build by:

  make  -DLLVM_ENABLE_SPHINX=ON -DLLVM_BUILD_DOCS=ON ...
  make sphinx


https://reviews.llvm.org/D28080

Files:
  docs/UsersManual.rst
  www/index.html

Index: www/index.html
===
--- www/index.html
+++ www/index.html
@@ -15,10 +15,10 @@
   clang: a C language family frontend for LLVM
   
   
-  The goal of the Clang project is to create a new C, C++, Objective C and
-  Objective C++ front-end for the http://www.llvm.org/";>LLVM
-  compiler.  You can get and build the source
-  today.
+  The goal of the Clang project is to create a new C based language
+  front-end: C, C++, Objective C/C++, OpenCL and others for the
+  http://www.llvm.org/";>LLVM compiler.  You can
+  get and build the source  today.
   
   
   Features and Goals
Index: docs/UsersManual.rst
===
--- docs/UsersManual.rst
+++ docs/UsersManual.rst
@@ -41,6 +41,7 @@
variants depending on base language.
 -  :ref:`C++ Language `
 -  :ref:`Objective C++ Language `
+-  :ref:`OpenCL Language `: v1.0, v1.1, v1.2, v2.0.
 
 In addition to these base languages and their dialects, Clang supports a
 broad variety of language extensions, which are documented in the
@@ -1973,6 +1974,348 @@
  is provided or target does not support TLS, code generation for threadprivate
  variables relies on OpenMP runtime library.
 
+.. _opencl:
+
+OpenCL Features
+===
+
+Clang can be used to compile OpenCL kernels for execution on a device
+(e.g. GPU). It is possible to compile the kernel into a binary (e.g. for AMD or
+Nvidia targets) that can be uploaded to run directly on a device (e.g. using
+`clCreateProgramWithBinary
+`_) or
+into generic bitcode files loadable into other toolchains.
+
+Compiling to a binary using the default target from the installation can be done
+as follows:
+
+   .. code-block:: console
+
+ $ echo "kernel void k(){}" > test.cl
+ $ clang test.cl
+
+Compiling for a specific target can be done by specifying the triple corresponding
+to the target, for example:
+
+   .. code-block:: console
+
+ $ clang -target nvptx64-unknown-unknown test.cl
+ $ clang -target amdgcn-unknown-amdhsa test.cl
+
+Compiling to bitcode can be done as follows:
+
+   .. code-block:: console
+
+ $ clang test.cl -c -emit-llvm
+
+This will produce a generic test.bc file that can be used in vendor toolchains
+to perform machine code generation.
+
+Clang currently supports OpenCL standards up to v2.0.
+
+OpenCL Specific Options
+---
+
+Most of the OpenCL build options from `the specification v2.0 section 5.8.4
+`_ are available.
+
+Examples:
+
+   .. code-block:: console
+
+ $ clang -cl-std=CL2.0 -cl-single-precision-constant test.cl
+
+Some extra options are available to support special OpenCL features.
+
+.. option:: -finclude-default-header
+
+Loads standard includes during compilations. By default OpenCL headers are not
+loaded and therefore standard library includes are not available. To load them
+automatically a flag has been added to the frontend (see also OpenCL Header
+section):
+
+   .. code-block:: console
+
+ $ clang -Xclang -finclude-default-header test.cl
+
+Alternatively ``-include`` or ``-I`` followed by the path to the header location
+can be given manually.
+
+   .. code-block:: console
+
+ $ clang -I/lib/Headers/opencl-c.h test.cl
+
+In this case the kernel code should contain ``#include `` just as a
+regular C include.
+
+.. option:: -cl-ext
+
+Disables standard target extensions. All OpenCL targets provide a list
+of extensions that they support. Clang allows to amend this using the ``-cl-ext``
+flag with a comma-separated list of extensions prefixed with ``'+'`` or ``'-'``.
+The syntax: ``-cl-ext=<(['-'|'+'][,])+>``,  where extensions
+can be either one of `the OpenCL specification extensions
+`_
+or any known vendor extension. Alternatively, ``'all'`` can be used to enable or disable
+all known extensions.
+Example disabling double support for the 64-bit SPIR target:
+
+   .. code-block:: console
+
+ $ clang -cc1 -triple spir64-unknown-unknown -cl-ext=-cl_khr_fp64 test.cl
+
+Enabling all extensions except double support in R600 AMD GPU can be done using:
+
+   .. code-block:: console
+
+ $ clang -cc1 -triple r600-unknown-unknown -cl-ext=-all,+cl_khr_fp16 test.cl
+
+.. _opencl_fake_address_space_map:
+
+.. option:: -ffake-ad

[PATCH] D27917: [OpenCL] Improve diagnostics for double type

2016-12-23 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments.



Comment at: test/SemaOpenCL/unknown_type.cl:1
+// RUN: %clang_cc1 -cl-std=CL1.1 -fsyntax-only -verify %s
+typedef double double2 __attribute__((ext_vector_type(2)));   // 
expected-error {{use of type 'double' requires cl_khr_fp64 extension to be 
enabled}}

Could this be merged with similar test in test/SemaOpenCL/extensions.cl 
instyead of adding a new file?


https://reviews.llvm.org/D27917



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


[PATCH] D28048: [OpenCL] Align fake address space map with the SPIR target maps.

2016-12-23 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.

Excellent! Thanks!


https://reviews.llvm.org/D28048



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


[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name

2016-12-23 Thread Firat Kasmis via Phabricator via cfe-commits
firolino marked 18 inline comments as done.
firolino added a comment.

Addressed suggestions from @aaron.ballman Thanks!




Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:22
+
+const internal::VariadicDynCastAllOfMatcher tagDecl;
+

aaron.ballman wrote:
> We may want to consider adding this to ASTMatchers.h at some point (can be 
> done in a future patch).
Is there a `// FIXME: Once I am in AstMatcher.h, remove me.` OK?



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:25
+static bool isWhitespaceExceptNL(unsigned char C);
+static std::string removeMultiLineComments(std::string Str);
+static std::string getCurrentLineIndent(SourceLocation Loc,

aaron.ballman wrote:
> This should accept by `const std::string &`.
Since I need a copy, it is more efficient to pass-by-value instead 
pass-by-reference + copy.  So, I get a benefit for rvalues and move will be 
applied. Search for "want speed? pass by value!" articles.



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:34
+  // a tag declaration (e.g. struct, class etc.):
+  // class A { } Object1, Object2;  <-- won't be matched
+  Finder->addMatcher(

aaron.ballman wrote:
> Why do we not want to match this?
If we decide, whether we transform 
```
class A { 
} Object1, Object2;
``` 
to
```
class A { 
} Object1, 
Object2;
``` 
or
```
class A { 
} 
Object1, 
Object2;
``` 
I might consider adding support for it. Moreover, this kind of definition is 
usually seen globally and I don't know how to handle globals yet. See 
http://lists.llvm.org/pipermail/cfe-dev/2015-November/046262.html



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:53
+  const LangOptions &LangOpts = getLangOpts();
+  const auto DeclGroup = DeclStatement->getDeclGroup();
+

aaron.ballman wrote:
> Please don't use `auto` as the type is not spelled out explicitly in the 
> initialization. Same elsewhere, though it is fine with `diag()` and in for 
> loop initializers.
Alright. What about:
```
const auto FirstVarIt = DeclStmt->getDeclGroup().begin();
const auto DL = SM.getDecomposedLoc(Loc);
```




Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:61
+  DeclStmtStart,
+  "declaration statement can be split up into single line declarations");
+

aaron.ballman wrote:
> This reads a bit awkwardly since it doesn't explain why the code is 
> problematic. Perhaps: "multiple declarations should be split into individual 
> declarations to improve readability" or something like that?
Yes. Sounds better.



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:83
+  if (AnyTokenBetweenCommaAndVarName.front() == '#')
+AnyTokenBetweenCommaAndVarName.insert(0, "\n");
+

aaron.ballman wrote:
> Will this (and the below `\n`) be converted into a CRLF automatically on 
> platforms where that is the newline character sequence in the source?
Actually, I was thinking about this but I don't have a Windows etc. with a 
running llvm environment. Is it OK, if I leave a FIXME for now?



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:101
+  QualType Type;
+  if (const auto *FirstVar = dyn_cast(*FirstVarIt)) {
+Location = FirstVar->getLocation();

aaron.ballman wrote:
> You can drop the `const` from the `dyn_cast`, here and elsewhere.
Alright, but can you explain why?



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:107
+Type = FirstVar->getTypeSourceInfo()->getType();
+while (Type->isLValueReferenceType()) {
+  Type = Type->getPointeeType();

aaron.ballman wrote:
> Why references and not pointers? Perhaps this needs a comment.
`// Typedefs on function pointers are covered into LValueReferenceType's` ?



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:137
+while (Type->isAnyPointerType() || Type->isArrayType())
+  Type = Type->getPointeeOrArrayElementType()->getCanonicalTypeInternal();
+  }

aaron.ballman wrote:
> Why are you calling the Internal version of this function?
Because I need its QualType.



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:160
+
+static bool isWhitespaceExceptNL(unsigned char C) {
+  switch (C) {

aaron.ballman wrote:
> Instead of adding yet another custom check for whether something is 
> whitespace, can you use `isWhitespace()` from CharInfo.h, and special case 
> `\n`? Also, why `unsigned char` instead of `char`?
CharInfo, nice! `unsigned char` because there is no negative ASCII. Even 
isWhitespace has `unsigned char`.



Comment at: clang-tidy/readability/ReadabilityTidyModule.cpp:64
+CheckFactories.registerCheck(
+"readability-one-na

Re: r290169 - Revert r290149: Add the alloc_size attribute to clang.

2016-12-23 Thread Dimitry Andric via cfe-commits
I can confirm that r290169 indeed fixes the three test failures I got earlier.  
Thanks George!

-Dimitry

> On 23 Dec 2016, at 02:29, George Burgess IV  
> wrote:
> 
> It looks like the root of this is that we're treating calls to `allocsize` 
> functions as AllocLike (e.g. any allocation function type except realloc) 
> functions, which caused us to perform invalid optimizations. For example, in 
> ReallocFreedPointerTest, EarlyCSE DCE'd the realloc because 
> llvm::isInstructionTriviallyDead calls llvm::isAllocLikeFn, and isAllocLikeFn 
> would return true if it saw the allocsize attribute. It really shouldn't do 
> that.
> 
> r290397 should fix this behavior by making allocsize alone insufficient to 
> consider a function an allocation function.
> 
> Thanks for your help!
> 
> On Thu, Dec 22, 2016 at 1:10 PM, George Burgess IV 
> mailto:george.burgess...@gmail.com>> wrote:
> Okay, I'm seeing this failure now if I tag my system's `realloc` declaration 
> with `alloc_size`. (Which FreeBSD seems to do in their headers). Because all 
> that clang does with `alloc_size` is use it to answer `__builtin_object_size` 
> queries and lower it to LLVM's `allocsize` attribute, this is presumably a 
> latent bug in LLVM's `allocsize` attribute.
> 
> Let me mess around for a bit and see what I can dig up. :)
> 
> On Thu, Dec 22, 2016 at 11:59 AM, Dimitry Andric  > wrote:
> This is when running "ninja check-all", in a tree with llvm, clang and 
> compiler-rt checked out.  The first program that shows a failure is 
> projects/compiler-rt/lib/asan/tests/default/Asan-i386-inline-Test:
> 
> [==] Running 92 tests from 3 test cases.
> [--] Global test environment set-up.
> [--] 14 tests from AddressSanitizerInterface
> ...
> [ RUN  ] AddressSanitizer.ReallocFreedPointerTest
> /share/dim/src/llvm/trunk/projects/compiler-rt/lib/asan/tests/asan_test.cc:377:
>  Failure
> Death test: ptr = realloc(ptr, 77)
> Result: failed to die.
>  Error msg:
> [  DEATH   ]
> [  FAILED  ] AddressSanitizer.ReallocFreedPointerTest (48 ms)
> 
> A similar failure shows when running 
> projects/compiler-rt/lib/asan/tests/default/Asan-i386-with-calls-Test:
> 
> [==] Running 92 tests from 3 test cases.
> [--] Global test environment set-up.
> [--] 14 tests from AddressSanitizerInterface
> ...
> [ RUN  ] AddressSanitizer.ReallocFreedPointerTest
> /share/dim/src/llvm/trunk/projects/compiler-rt/lib/asan/tests/asan_test.cc:377:
>  Failure
> Death test: ptr = realloc(ptr, 77)
> Result: failed to die.
>  Error msg:
> [  DEATH   ]
> [  FAILED  ] AddressSanitizer.ReallocFreedPointerTest (55 ms)
> 
> Interestingly, the Asan-i386-inline-Noinst-Test and 
> Asan-i386-with-calls-Noinst-Test do not show this particular failure.
> 
> The other test that fails is 
> projects/compiler-rt/test/asan/I386FreeBSDConfig/TestCases/Posix/Output/free_hook_realloc.cc.tmp,
>  which simply returns 1 without printing any output. Debugging the program 
> shows that it seems to be skipping completely over the realloc() call, and 
> jumping directly to the _exit(1), but this may be due to optimization.
> 
> -Dimitry
> 
> > On 22 Dec 2016, at 20:27, George Burgess IV  > > wrote:
> >
> > Yes, this was reapplied in r290297 with fixes for the msan issue we caught; 
> > these asan unit test failures are news to me. Can you give me the command 
> > that you're using to run these tests, please?
> >
> > On Thu, Dec 22, 2016 at 11:10 AM, Dimitry Andric  > > wrote:
> > On 20 Dec 2016, at 09:28, Chandler Carruth via cfe-commits 
> > mailto:cfe-commits@lists.llvm.org>> wrote:
> > > Author: chandlerc
> > > Date: Tue Dec 20 02:28:19 2016
> > > New Revision: 290169
> > >
> > > URL: http://llvm.org/viewvc/llvm-project?rev=290169&view=rev 
> > > 
> > > Log:
> > > Revert r290149: Add the alloc_size attribute to clang.
> > >
> > > This commit fails MSan when running test/CodeGen/object-size.c in
> > > a confusing way. After some discussion with George, it isn't really
> > > clear what is going on here. We can make the MSan failure go away by
> > > testing for the invalid bit, but *why* things are invalid isn't clear.
> > > And yet, other code in the surrounding area is doing precisely this and
> > > testing for invalid.
> > >
> > > George is going to take a closer look at this to better understand the
> > > nature of the failure and recommit it, for now backing it out to clean
> > > up MSan builds.
> >
> > Hmm, was this reapplied later on?  I'm still getting the following 
> > AddressSanitizer failures on FreeBSD, and bisecting has pointed to r290149 
> > as the cause:
> >
> > FAIL: AddressSanitizer-Unit :: 
> > Asan-i386-inline-Test/AddressSanitizer.ReallocFreedPointerTest (2124 of 
> > 30204)
> >  TEST 'AddressSanitizer-Unit :: 
> > Asan-i386-inline-Test/AddressSanitizer.

[PATCH] D28058: [OpenCL] Correct ndrange_t implementation

2016-12-23 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments.



Comment at: lib/CodeGen/CGBuiltin.cpp:2491
+llvm::Value *Range = NDRangeL.getAddress().getPointer();
+llvm::Type *RangeTy = NDRangeL.getAddress().getType();
 

I think following standard Clang CodeGen convention we should add byval 
attribute for structs. 

However, I am not sure if the best approach would be to use classifyType(...) 
of ABIInfo and then check what type of argument passing ABIArgInfo returns 
(direct/indirect/byval). Based on this we could add an attr 
llvm::Attribute::ByVal to the argument. Perhaps, this should be done with all 
arguments then. Or I am wondering if better approach would be to just use 
GetOrCreateLLVMFunction() helper from CodeGen!

Does anyone have any suggestion here?



https://reviews.llvm.org/D28058



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


r290431 - Fix problems in "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand."

2016-12-23 Thread Egor Churaev via cfe-commits
Author: echuraev
Date: Fri Dec 23 08:55:49 2016
New Revision: 290431

URL: http://llvm.org/viewvc/llvm-project?rev=290431&view=rev
Log:
Fix problems in "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare 
operand."

Summary: Fixed warnings in commit: https://reviews.llvm.org/rL290171

Reviewers: djasper, Anastasia

Subscribers: yaxunl, cfe-commits, bader

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

Added:
cfe/trunk/test/CodeGenOpenCL/null_queue.cl
cfe/trunk/test/SemaOpenCL/null_queue.cl
cfe/trunk/test/SemaOpenCL/queue_t_overload.cl
Modified:
cfe/trunk/include/clang/AST/OperationKinds.def
cfe/trunk/include/clang/Sema/Initialization.h
cfe/trunk/include/clang/Sema/Overload.h
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/CodeGen/CGExprComplex.cpp
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp

Modified: cfe/trunk/include/clang/AST/OperationKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OperationKinds.def?rev=290431&r1=290430&r2=290431&view=diff
==
--- cfe/trunk/include/clang/AST/OperationKinds.def (original)
+++ cfe/trunk/include/clang/AST/OperationKinds.def Fri Dec 23 08:55:49 2016
@@ -321,6 +321,9 @@ CAST_OPERATION(BuiltinFnToFnPtr)
 // Convert a zero value for OpenCL event_t initialization.
 CAST_OPERATION(ZeroToOCLEvent)
 
+// Convert a zero value for OpenCL queue_t initialization.
+CAST_OPERATION(ZeroToOCLQueue)
+
 // Convert a pointer to a different address space.
 CAST_OPERATION(AddressSpaceConversion)
 

Modified: cfe/trunk/include/clang/Sema/Initialization.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Initialization.h?rev=290431&r1=290430&r2=290431&view=diff
==
--- cfe/trunk/include/clang/Sema/Initialization.h (original)
+++ cfe/trunk/include/clang/Sema/Initialization.h Fri Dec 23 08:55:49 2016
@@ -751,6 +751,8 @@ public:
 SK_StdInitializerListConstructorCall,
 /// \brief Initialize an OpenCL sampler from an integer.
 SK_OCLSamplerInit,
+/// \brief Initialize queue_t from 0.
+SK_OCLZeroQueue,
 /// \brief Passing zero to a function where OpenCL event_t is expected.
 SK_OCLZeroEvent
   };
@@ -1148,6 +1150,9 @@ public:
   /// constant.
   void AddOCLZeroEventStep(QualType T);
 
+  /// \brief Add a step to initialize an OpenCL queue_t from 0.
+  void AddOCLZeroQueueStep(QualType T);
+
   /// \brief Add steps to unwrap a initializer list for a reference around a
   /// single element and rewrap it at the end.
   void RewrapReferenceInitList(QualType T, InitListExpr *Syntactic);

Modified: cfe/trunk/include/clang/Sema/Overload.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Overload.h?rev=290431&r1=290430&r2=290431&view=diff
==
--- cfe/trunk/include/clang/Sema/Overload.h (original)
+++ cfe/trunk/include/clang/Sema/Overload.h Fri Dec 23 08:55:49 2016
@@ -83,6 +83,7 @@ namespace clang {
 ICK_TransparentUnionConversion, ///< Transparent Union Conversions
 ICK_Writeback_Conversion,  ///< Objective-C ARC writeback conversion
 ICK_Zero_Event_Conversion, ///< Zero constant to event (OpenCL1.2 6.12.10)
+ICK_Zero_Queue_Conversion, ///< Zero constant to queue
 ICK_C_Only_Conversion, ///< Conversions allowed in C, but not C++
 ICK_Incompatible_Pointer_Conversion, ///< C-only conversion between 
pointers
  ///  with incompatible types

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=290431&r1=290430&r2=290431&view=diff
==
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Fri Dec 23 08:55:49 2016
@@ -1603,6 +1603,7 @@ bool CastExpr::CastConsistency() const {
   case CK_ARCReclaimReturnedObject:
   case CK_ARCExtendBlockObject:
   case CK_ZeroToOCLEvent:
+  case CK_ZeroToOCLQueue:
   case CK_IntToOCLSampler:
 assert(!getType()->isBooleanType() && "unheralded conversion to bool");
 goto CheckNoBasePath;

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=290431&r1=290430&r2=290431&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/

[clang-tools-extra] r290434 - [clang-tidy] Flag implicit conversion operators.

2016-12-23 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Dec 23 09:03:12 2016
New Revision: 290434

URL: http://llvm.org/viewvc/llvm-project?rev=290434&view=rev
Log:
[clang-tidy] Flag implicit conversion operators.

Modified:
clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp
clang-tools-extra/trunk/docs/ReleaseNotes.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-explicit-constructor.rst
clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp

Modified: clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp?rev=290434&r1=290433&r2=290434&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp Fri 
Dec 23 09:03:12 2016
@@ -22,9 +22,12 @@ namespace google {
 void ExplicitConstructorCheck::registerMatchers(MatchFinder *Finder) {
   // Only register the matchers for C++; the functionality currently does not
   // provide any benefit to other languages, despite being benign.
-  if (getLangOpts().CPlusPlus)
-Finder->addMatcher(
-cxxConstructorDecl(unless(isInstantiated())).bind("ctor"), this);
+  if (!getLangOpts().CPlusPlus)
+return;
+  Finder->addMatcher(cxxConstructorDecl(unless(isInstantiated())).bind("ctor"),
+ this);
+  
Finder->addMatcher(cxxConversionDecl(unless(isExplicit())).bind("conversion"),
+ this);
 }
 
 // Looks for the token matching the predicate and returns the range of the 
found
@@ -75,6 +78,17 @@ static bool isStdInitializerList(QualTyp
 }
 
 void ExplicitConstructorCheck::check(const MatchFinder::MatchResult &Result) {
+  constexpr char WarningMessage[] =
+  "%0 must be marked explicit to avoid unintentional implicit conversions";
+
+  if (const auto *Conversion =
+  Result.Nodes.getNodeAs("conversion")) {
+SourceLocation Loc = Conversion->getLocation();
+diag(Loc, WarningMessage)
+<< Conversion << FixItHint::CreateInsertion(Loc, "explicit ");
+return;
+  }
+
   const auto *Ctor = Result.Nodes.getNodeAs("ctor");
   // Do not be confused: isExplicit means 'explicit' keyword is present,
   // isImplicit means that it's a compiler-generated constructor.
@@ -101,10 +115,9 @@ void ExplicitConstructorCheck::check(con
 else
   ConstructorDescription = "initializer-list";
 
-DiagnosticBuilder Diag =
-diag(Ctor->getLocation(),
- "%0 constructor should not be declared explicit")
-<< ConstructorDescription;
+auto Diag = diag(Ctor->getLocation(),
+ "%0 constructor should not be declared explicit")
+<< ConstructorDescription;
 if (ExplicitTokenRange.isValid()) {
   Diag << FixItHint::CreateRemoval(
   CharSourceRange::getCharRange(ExplicitTokenRange));
@@ -119,8 +132,7 @@ void ExplicitConstructorCheck::check(con
   bool SingleArgument =
   Ctor->getNumParams() == 1 && !Ctor->getParamDecl(0)->isParameterPack();
   SourceLocation Loc = Ctor->getLocation();
-  diag(Loc,
-   "%0 must be marked explicit to avoid unintentional implicit 
conversions")
+  diag(Loc, WarningMessage)
   << (SingleArgument
   ? "single-argument constructors"
   : "constructors that are callable with a single argument")

Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=290434&r1=290433&r2=290434&view=diff
==
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Fri Dec 23 09:03:12 2016
@@ -183,6 +183,10 @@ Improvements to clang-tidy
   
`_
 check
   now warns about redundant calls to data() too.
 
+- The `google-explicit-constructor
+  
`_
 check
+  now warns about conversion operators not marked explicit.
+
 Fixed bugs:
 
 - `modernize-make-unique

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-explicit-constructor.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/google-explicit-constructor.rst?rev=290434&r1=290433&r2=290434&view=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-explicit-constructor.rst 
(original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-explicit-constructor.rst 
Fri Dec 23 09:03:12 2016
@@ -4,6 +4,53 @@ google-explicit-constructor
 ===
 
 
-Checks that all single-argu

[PATCH] D27806: [clang-tidy] Add obvious-invalid-range

2016-12-23 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added inline comments.



Comment at: clang-tidy/obvious/InvalidRangeCheck.cpp:38
+
+const auto CXX11_AlgorithmNames =
+CXX_AlgorithmNames + "; "

No global `auto` variables, please. In this case `auto` just isn't buying you 
anything, but in other cases it may be highly misleading.



Comment at: clang-tidy/obvious/InvalidRangeCheck.cpp:58
+  // Not so small vector. 80 because there are about that many algorithms.
+  const auto Names =
+  SmallVector(AlgorithmNames.begin(), AlgorithmNames.end());

Two nits here:
1. 80 is hardly "small" and this code is run once per analyzed file, so you're 
not saving much. Consider just using std::vector.
2. I think, `SmallVector<...> Names(AlgorithmNames.begin(), 
AlgorithmNames.end());` would be much easier to read.



Comment at: clang-tidy/obvious/InvalidRangeCheck.cpp:62
+  auto CallsAlgorithm = hasDeclaration(
+  functionDecl(Names.size() > 0 ? hasAnyName(Names) : anything()));
+

 Does this check make sense without the names whitelist? What will is the use 
case?



Comment at: clang-tidy/obvious/InvalidRangeCheck.cpp:67
+hasDeclaration(cxxMethodDecl(hasName(MethodName))),
+onImplicitObjectArgument(declRefExpr().bind(BindThisName)));
+  };

Why should this be a `declRefExpr`? This will miss cases with a more complex 
expression, e.g. `std::count(x.y().begin(), x.z().end(), ...)`. Considering 
`y()` and `z()` are simple getters, this might be a quite common code.



Comment at: clang-tidy/obvious/InvalidRangeCheck.cpp:82
+  const auto *SecondArg = Result.Nodes.getNodeAs("second_arg");
+  if (FirstArg->getNameInfo().getAsString() ==
+  SecondArg->getNameInfo().getAsString())

Is there a less wasteful way of doing this? E.g. compare pointers to canonical 
declarations?



Comment at: docs/ReleaseNotes.rst:120
+  code.
+- New `obvious-invalid-range
+  `_ 
check

The idea of the `obvious` module is interesting, but I'm not sure this check 
belongs here. At least, I would like to run it on our code and see whether it 
finds anything before calling this "obvious" ;)


https://reviews.llvm.org/D27806



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


r290436 - [OpenCL] Align fake address space map with the SPIR target maps.

2016-12-23 Thread Egor Churaev via cfe-commits
Author: echuraev
Date: Fri Dec 23 10:11:25 2016
New Revision: 290436

URL: http://llvm.org/viewvc/llvm-project?rev=290436&view=rev
Log:
[OpenCL] Align fake address space map with the SPIR target maps.

Summary:
We compile user opencl kernel code with spir triple. But built-ins are written 
in OpenCL and we compile it with triple x86_64 to be able to use x86 
intrinsics. And we need address spaces to match in both cases. So, we change 
fake address space map in OpenCL for matching with spir.

On CPU address spaces are not really important but we'd like to preserve 
address space information in order to perform optimizations relying on this 
info like enhanced alias analysis.

Reviewers: pekka.jaaskelainen, Anastasia

Subscribers: pekka.jaaskelainen, yaxunl, bader, cfe-commits

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

Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/CodeGen/blocks-opencl.cl
cfe/trunk/test/CodeGenOpenCL/address-space-constant-initializers.cl
cfe/trunk/test/CodeGenOpenCL/address-spaces-mangling.cl
cfe/trunk/test/CodeGenOpenCL/address-spaces.cl
cfe/trunk/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
cfe/trunk/test/CodeGenOpenCL/const-str-array-decay.cl
cfe/trunk/test/CodeGenOpenCL/constant-addr-space-globals.cl
cfe/trunk/test/CodeGenOpenCL/local-initializer-undef.cl
cfe/trunk/test/CodeGenOpenCL/local.cl
cfe/trunk/test/CodeGenOpenCL/memcpy.cl
cfe/trunk/test/CodeGenOpenCL/str_literals.cl
cfe/trunk/test/SemaOpenCL/extern.cl

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=290436&r1=290435&r2=290436&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Dec 23 10:11:25 2016
@@ -704,8 +704,8 @@ static const LangAS::Map *getAddressSpac
 // language-specific address space.
 static const unsigned FakeAddrSpaceMap[] = {
   1, // opencl_global
-  2, // opencl_local
-  3, // opencl_constant
+  3, // opencl_local
+  2, // opencl_constant
   4, // opencl_generic
   5, // cuda_device
   6, // cuda_constant

Modified: cfe/trunk/test/CodeGen/blocks-opencl.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/blocks-opencl.cl?rev=290436&r1=290435&r2=290436&view=diff
==
--- cfe/trunk/test/CodeGen/blocks-opencl.cl (original)
+++ cfe/trunk/test/CodeGen/blocks-opencl.cl Fri Dec 23 10:11:25 2016
@@ -5,7 +5,7 @@
 void dummy(float (^const op)(float)) {
 }
 
-// CHECK: i8 addrspace(3)* getelementptr inbounds ([9 x i8], [9 x i8] 
addrspace(3)* @.str, i32 0, i32 0)
+// CHECK: i8 addrspace(2)* getelementptr inbounds ([9 x i8], [9 x i8] 
addrspace(2)* @.str, i32 0, i32 0)
 
 kernel void test_block()
 {

Modified: cfe/trunk/test/CodeGenOpenCL/address-space-constant-initializers.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/address-space-constant-initializers.cl?rev=290436&r1=290435&r2=290436&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/address-space-constant-initializers.cl 
(original)
+++ cfe/trunk/test/CodeGenOpenCL/address-space-constant-initializers.cl Fri Dec 
23 10:11:25 2016
@@ -11,8 +11,8 @@ typedef struct {
 __constant float* constant_float_ptr;
 } ConstantArrayPointerStruct;
 
-// CHECK: %struct.ConstantArrayPointerStruct = type { float addrspace(3)* }
-// CHECK: addrspace(3) constant %struct.ConstantArrayPointerStruct { float 
addrspace(3)* bitcast (i8 addrspace(3)* getelementptr (i8, i8 addrspace(3)* 
bitcast (%struct.ArrayStruct addrspace(3)* @constant_array_struct to i8 
addrspace(3)*), i64 4) to float addrspace(3)*) }
+// CHECK: %struct.ConstantArrayPointerStruct = type { float addrspace(2)* }
+// CHECK: addrspace(2) constant %struct.ConstantArrayPointerStruct { float 
addrspace(2)* bitcast (i8 addrspace(2)* getelementptr (i8, i8 addrspace(2)* 
bitcast (%struct.ArrayStruct addrspace(2)* @constant_array_struct to i8 
addrspace(2)*), i64 4) to float addrspace(2)*) }
 // Bug  18567
 __constant ConstantArrayPointerStruct constant_array_pointer_struct = {
 &constant_array_struct.f

Modified: cfe/trunk/test/CodeGenOpenCL/address-spaces-mangling.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/address-spaces-mangling.cl?rev=290436&r1=290435&r2=290436&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/address-spaces-mangling.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/address-spaces-mangling.cl Fri Dec 23 10:11:25 
2016
@@ -31,14 +31,14 @@ void f(global int *arg) { }
 
 __attribute__((overloadable))
 void f(local int *arg) { }
-// ASMANG: @_Z1fPU3AS2i
+// ASMANG: @_Z1fPU3AS3i
 // NOASMANG: @_Z1fPU7CLlocali
-// OC

[PATCH] D27898: [compiler-rt] [builtins] Implement __floattitf() & __floatuntitf()

2016-12-23 Thread Michał Górny via Phabricator via cfe-commits
mgorny updated the summary for this revision.
mgorny updated this revision to Diff 82414.
mgorny added a comment.

Changed mantissa -> significand.


https://reviews.llvm.org/D27898

Files:
  lib/builtins/CMakeLists.txt
  lib/builtins/floattitf.c
  lib/builtins/floatuntitf.c
  test/builtins/Unit/floattitf_test.c
  test/builtins/Unit/floatuntitf_test.c

Index: test/builtins/Unit/floatuntitf_test.c
===
--- /dev/null
+++ test/builtins/Unit/floatuntitf_test.c
@@ -0,0 +1,220 @@
+//===-- floatuntitf.c - Test __floatuntitf ===//
+//
+// 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.
+//
+//===--===//
+//
+// This file tests __floatuntitf for the compiler_rt library.
+//
+//===--===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+#include "int_lib.h"
+#include 
+#include 
+
+#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT)
+
+/* Returns: convert a tu_int to a fp_t, rounding toward even. */
+
+/* Assumption: fp_t is a IEEE 128 bit floating point type
+ * tu_int is a 128 bit integral type
+ */
+
+/* seee        |         |
+ *         |        
+ */
+
+COMPILER_RT_ABI fp_t __floatuntitf(tu_int a);
+
+int test__floatuntitf(tu_int a, fp_t expected) {
+fp_t x = __floatuntitf(a);
+if (x != expected) {
+utwords at;
+at.all = a;
+printf("error in __floatuntitf(0x%.16llX%.16llX) = %LA, expected %LA\n",
+   at.s.high, at.s.low, x, expected);
+}
+return x != expected;
+}
+
+char assumption_1[sizeof(tu_int) == 2*sizeof(du_int)] = {0};
+char assumption_2[sizeof(tu_int)*CHAR_BIT == 128] = {0};
+char assumption_3[sizeof(fp_t)*CHAR_BIT == 128] = {0};
+
+#endif
+
+int main() {
+#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT)
+if (test__floatuntitf(0, 0.0))
+return 1;
+
+if (test__floatuntitf(1, 1.0))
+return 1;
+if (test__floatuntitf(2, 2.0))
+return 1;
+if (test__floatuntitf(20, 20.0))
+return 1;
+
+if (test__floatuntitf(0x7F80ULL, 0x1.FEp+62))
+return 1;
+if (test__floatuntitf(0x7800ULL, 0x1.Ep+62))
+return 1;
+if (test__floatuntitf(0x7F00ULL, 0x1.FCp+62))
+return 1;
+if (test__floatuntitf(0x7000ULL, 0x1.Cp+62))
+return 1;
+if (test__floatuntitf(0x7FFFULL, 0xF.FFEp+59L))
+return 1;
+if (test__floatuntitf(0xFFFEULL, 0xF.FFEp+60L))
+return 1;
+if (test__floatuntitf(0xULL, 0xF.FFFp+60L))
+return 1;
+
+if (test__floatuntitf(0x8080ULL, 0x8.08p+60))
+return 1;
+if (test__floatuntitf(0x8800ULL, 0x8.8p+60))
+return 1;
+if (test__floatuntitf(0x8100ULL, 0x8.1p+60))
+return 1;
+if (test__floatuntitf(0x80001000ULL, 0x8.0001p+60))
+return 1;
+
+if (test__floatuntitf(0x8000ULL, 0x8p+60))
+return 1;
+if (test__floatuntitf(0x8001ULL, 0x8.001p+60L))
+return 1;
+
+if (test__floatuntitf(0x0007FB72E800LL, 0x1.FEDCBAp+50))
+return 1;
+
+if (test__floatuntitf(0x0007FB72EA00LL, 0x1.FEDCBA8p+50))
+return 1;
+if (test__floatuntitf(0x0007FB72EB00LL, 0x1.FEDCBACp+50))
+return 1;
+if (test__floatuntitf(0x0007FB72EBFFLL, 0x1.FEDCBAFFCp+50))
+return 1;
+if (test__floatuntitf(0x0007FB72EC00LL, 0x1.FEDCBBp+50))
+return 1;
+if (test__floatuntitf(0x0007FB72E801LL, 0x1.FEDCBA004p+50))
+return 1;
+
+if (test__floatuntitf(0x0007FB72E600LL, 0x1.FEDCB98p+50))
+return 1;
+if (test__floatuntitf(0x0007FB72E700LL, 0x1.FEDCB9Cp+50))
+return 1;
+if (test__floatuntitf(0x0007FB72E7FFLL, 0x1.FEDCB9FFCp+50))
+return 1;
+if (test__floatuntitf(0x0007FB72E401LL, 0x1.FEDCB9004p+50))
+return 1;
+if (test__floatuntitf(0x0007FB72E400LL, 0x1.FEDCB9p+50))
+return 1;
+
+if (test__floatuntitf(0x023479FD0E092DC0LL, 0x1.1A3CFE870496Ep+57))
+return 1;
+if (test__floatuntitf(0x023479FD0E092DA1LL, 0x1.1A3CFE870496D08p+57L))
+return 1;
+if (test__floatuntitf(0x023479FD0E092DB0LL, 0x1.1A3CFE870496D8p+57L))
+return 1;
+if (test__floatuntitf(0x023479FD0E092DB8LL, 0x1.1A3CFE870496DCp+57L))
+return 1;
+if (test__floatuntitf(0x023479F

[PATCH] D28077: [PM] Introduce options to enable the (still experimental) new pass manager, and a code path to use it.

2016-12-23 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini accepted this revision.
mehdi_amini added a comment.
This revision is now accepted and ready to land.

LGTM! Exciting to see the new PM arriving in clang :)




Comment at: lib/CodeGen/BackendUtil.cpp:757
+  setCommandLineOpts();
+  cl::PrintOptionValues();
+

This is different from the legacy path, why?



Comment at: lib/CodeGen/BackendUtil.cpp:762
+  CreateTargetMachine(/*MustCreateTM*/ true);
+  TheModule->setDataLayout(TM->createDataLayout());
+

The legacy path accounts for the possibility of failing to create the TM

```
  CreateTargetMachine(UsesCodeGen);

  if (UsesCodeGen && !TM)
return;
```



Comment at: lib/CodeGen/BackendUtil.cpp:831
+  // Now that we have all of the passes ready, run them.
+  MPM.run(*TheModule, MAM);
+

No need to wrap in a block with a `PrettyStackTraceString` like the legacy PM?



Comment at: test/Driver/clang_f_opts.c:475
+// RUN: %clang -### -fexperimental-new-pass-manager 
-fno-experimental-new-pass-manager %s 2>&1 | FileCheck --check-prefix=CHECK 
--check-prefix=CHECK-NO-NEW-PM %s
+// CHECK-NOT: argument unused
+// CHECK-NEW-PM: -fexperimental-new-pass-manager

Not critical, but using the "CHECK" prefix isn't nice in a file intended to be 
shared for multiple tests.


https://reviews.llvm.org/D28077



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


[PATCH] D27850: [libcxx] add missing constexpr to optional::value_or

2016-12-23 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF requested changes to this revision.
EricWF added a comment.
This revision now requires changes to proceed.

Tests please! They should be somewhere under 
`test/std/utilities/optional/optional.object/optional.object.observe`


https://reviews.llvm.org/D27850



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


[libcxx] r290440 - Add apple-clang-8 to list of XFAILS for some variant tests. Patch from Michael Park

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 13:07:54 2016
New Revision: 290440

URL: http://llvm.org/viewvc/llvm-project?rev=290440&view=rev
Log:
Add apple-clang-8 to list of XFAILS for some variant tests. Patch from Michael 
Park

Modified:

libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp

libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp

Modified: 
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp?rev=290440&r1=290439&r2=290440&view=diff
==
--- 
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
 Fri Dec 23 13:07:54 2016
@@ -11,7 +11,7 @@
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 
 // Clang 3.8 doesn't generate constexpr special members correctly.
-// XFAIL: clang-3.8, apple-clang-7
+// XFAIL: clang-3.8, apple-clang-7, apple-clang-8
 
 // 
 

Modified: 
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp?rev=290440&r1=290439&r2=290440&view=diff
==
--- 
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp
 Fri Dec 23 13:07:54 2016
@@ -11,7 +11,7 @@
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 
 // Clang 3.8 doesn't generate constexpr special members correctly.
-// XFAIL: clang-3.8, apple-clang-7
+// XFAIL: clang-3.8, apple-clang-7, apple-clang-8
 
 
 // 

Modified: 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp?rev=290440&r1=290439&r2=290440&view=diff
==
--- 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp
 Fri Dec 23 13:07:54 2016
@@ -11,7 +11,7 @@
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 
 // Clang 3.8 doesn't allow constexpr variables of non-literal type
-// XFAIL: clang-3.8, apple-clang-7
+// XFAIL: clang-3.8, apple-clang-7, apple-clang-8
 
 // 
 

Modified: 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp?rev=290440&r1=290439&r2=290440&view=diff
==
--- 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp
 Fri Dec 23 13:07:54 2016
@@ -11,7 +11,7 @@
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 
 // Clang 3.8 doesn't allow constexpr variables of non-literal type
-// XFAIL: clang-3.8, apple-clang-7
+// XFAIL: clang-3.8, apple-clang-7, apple-clang-8
 
 // 
 


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


[libcxx] r290441 - Update TestingLibcxx doc to reflect the use_system_cxx_lib flag. Patch from Michael Park

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 13:09:14 2016
New Revision: 290441

URL: http://llvm.org/viewvc/llvm-project?rev=290441&view=rev
Log:
Update TestingLibcxx doc to reflect the use_system_cxx_lib flag. Patch from 
Michael Park

Modified:
libcxx/trunk/docs/TestingLibcxx.rst

Modified: libcxx/trunk/docs/TestingLibcxx.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/TestingLibcxx.rst?rev=290441&r1=290440&r2=290441&view=diff
==
--- libcxx/trunk/docs/TestingLibcxx.rst (original)
+++ libcxx/trunk/docs/TestingLibcxx.rst Fri Dec 23 13:09:14 2016
@@ -130,7 +130,7 @@ configuration. Passing the option on the
 
   Specify the directory of the libc++ library to be tested. By default the
   library folder of the build directory is used. This option cannot be used
-  when use_system_lib is provided.
+  when use_system_cxx_lib is provided.
 
 
 .. option:: cxx_runtime_root=
@@ -139,9 +139,9 @@ configuration. Passing the option on the
   is not added to the linkers search path. This can be used to compile tests
   against one version of libc++ and run them using another. The default value
   for this option is `cxx_library_root`. This option cannot be used
-  when use_system_lib is provided.
+  when use_system_cxx_lib is provided.
 
-.. option:: use_system_lib=
+.. option:: use_system_cxx_lib=
 
   **Default**: False
 


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


r290443 - Extend the tests for -Wmissing-variable-declarations.

2016-12-23 Thread Ed Schouten via cfe-commits
Author: ed
Date: Fri Dec 23 13:20:07 2016
New Revision: 290443

URL: http://llvm.org/viewvc/llvm-project?rev=290443&view=rev
Log:
Extend the tests for -Wmissing-variable-declarations.

We shouldn't throw a warning when the static keyword is not present in
an anonymous namespace, just like we do for -Wmissing-prototypes.

Modified:
cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp

Modified: cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp?rev=290443&r1=290442&r2=290443&view=diff
==
--- cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp Fri Dec 23 
13:20:07 2016
@@ -47,3 +47,8 @@ class C {
 static int x = 0; // no-warn
   }
 };
+
+// There is also no need to use static in anonymous namespaces.
+namespace {
+  int vgood4;
+}


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


[libcxx] r290444 - Add release update instructions for libc++

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 13:30:24 2016
New Revision: 290444

URL: http://llvm.org/viewvc/llvm-project?rev=290444&view=rev
Log:
Add release update instructions for libc++

Added:
libcxx/trunk/RELEASE.TXT

Added: libcxx/trunk/RELEASE.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/RELEASE.TXT?rev=290444&view=auto
==
--- libcxx/trunk/RELEASE.TXT (added)
+++ libcxx/trunk/RELEASE.TXT Fri Dec 23 13:30:24 2016
@@ -0,0 +1,11 @@
+//===-===//
+// Post-Release TODO
+//===-===//
+
+These notes contain a list of things that must be done after branching for
+an LLVM release.
+
+1. Update _LIBCPP_VERSION in `__config`
+2. Update the __libcpp_version file.
+3. Update the version number in `docs/conf.py`
+4. Create ABI lists for the previous release under `lib/abi`


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


[libcxx] r290445 - Add test that _LIBCPP_VERSION matches __libcpp_version

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 13:38:43 2016
New Revision: 290445

URL: http://llvm.org/viewvc/llvm-project?rev=290445&view=rev
Log:
Add test that _LIBCPP_VERSION matches __libcpp_version

Added:
libcxx/trunk/test/libcxx/libcpp_version.pass.cpp

Added: libcxx/trunk/test/libcxx/libcpp_version.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/libcpp_version.pass.cpp?rev=290445&view=auto
==
--- libcxx/trunk/test/libcxx/libcpp_version.pass.cpp (added)
+++ libcxx/trunk/test/libcxx/libcpp_version.pass.cpp Fri Dec 23 13:38:43 2016
@@ -0,0 +1,28 @@
+// -*- 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 the __libcpp_version file matches the value of _LIBCPP_VERSION
+
+#include <__config>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION must be defined
+#endif
+
+static const int libcpp_version =
+#include <__libcpp_version>
+;
+
+static_assert(_LIBCPP_VERSION == libcpp_version,
+  "_LIBCPP_VERSION doesn't match __libcpp_version");
+
+int main() {
+
+}


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


[libcxx] r290446 - Update doc and various cleanup

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 14:00:13 2016
New Revision: 290446

URL: http://llvm.org/viewvc/llvm-project?rev=290446&view=rev
Log:
Update doc and various cleanup

Added:
libcxx/trunk/NOTES.TXT
Removed:
libcxx/trunk/RELEASE.TXT
Modified:
libcxx/trunk/TODO.TXT
libcxx/trunk/test/libcxx/double_include.sh.cpp

Added: libcxx/trunk/NOTES.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/NOTES.TXT?rev=290446&view=auto
==
--- libcxx/trunk/NOTES.TXT (added)
+++ libcxx/trunk/NOTES.TXT Fri Dec 23 14:00:13 2016
@@ -0,0 +1,28 @@
+//===-===//
+// Notes relating to various libc++ tasks
+//===-===//
+
+This file contains notes about various libc++ tasks and processes.
+
+//===-===//
+// Post-Release TODO
+//===-===//
+
+These notes contain a list of things that must be done after branching for
+an LLVM release.
+
+1. Update _LIBCPP_VERSION in `__config`
+2. Update the __libcpp_version file.
+3. Update the version number in `docs/conf.py`
+4. Create ABI lists for the previous release under `lib/abi`
+
+//===-===//
+// Adding a new header TODO
+//===-===//
+
+These notes contain a list of things that must be done upon adding a new header
+to libc++.
+
+1. Add a test under `test/libcxx` that the header defines `_LIBCPP_VERSION`.
+2. Update `test/libcxx/double_include.sh.cpp` to include the new header.
+3. Create a submodule in `include/module.modulemap` for the new header.

Removed: libcxx/trunk/RELEASE.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/RELEASE.TXT?rev=290445&view=auto
==
--- libcxx/trunk/RELEASE.TXT (original)
+++ libcxx/trunk/RELEASE.TXT (removed)
@@ -1,11 +0,0 @@
-//===-===//
-// Post-Release TODO
-//===-===//
-
-These notes contain a list of things that must be done after branching for
-an LLVM release.
-
-1. Update _LIBCPP_VERSION in `__config`
-2. Update the __libcpp_version file.
-3. Update the version number in `docs/conf.py`
-4. Create ABI lists for the previous release under `lib/abi`

Modified: libcxx/trunk/TODO.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/TODO.TXT?rev=290446&r1=290445&r2=290446&view=diff
==
--- libcxx/trunk/TODO.TXT (original)
+++ libcxx/trunk/TODO.TXT Fri Dec 23 14:00:13 2016
@@ -1,10 +1,5 @@
 This is meant to be a general place to list things that should be done 
"someday"
 
-
-ABI Related Tasks
-=
-* Explicitly manage and verify symbols exported from the dylib.
-
 CXX Runtime Library Tasks
 =
 * Fix that CMake always link to /usr/lib/libc++abi.dylib on OS X.
@@ -19,7 +14,6 @@ Atomic Related Tasks
 
 Test Suite Tasks
 
-* Move all libc++ specific tests from test/std into test/libcxx.
 * Improve the quality and portability of the locale test data.
 * Convert failure tests to use Clang Verify.
 
@@ -29,6 +23,4 @@ Misc Tasks
 * run clang-tidy on libc++
 * Document the "conditionally-supported" bits of libc++
 * Look at basic_string's move assignment operator, re LWG 2063 and POCMA
-* libc++ is missing try_emplace
 * Put a static_assert in std::allocator to deny const/volatile types (LWG 2447)
-

Modified: libcxx/trunk/test/libcxx/double_include.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/double_include.sh.cpp?rev=290446&r1=290445&r2=290446&view=diff
==
--- libcxx/trunk/test/libcxx/double_include.sh.cpp (original)
+++ libcxx/trunk/test/libcxx/double_include.sh.cpp Fri Dec 23 14:00:13 2016
@@ -15,14 +15,18 @@
 // RUN: %cxx -o %t.exe %t.first.o %t.second.o %flags %link_flags
 // RUN: %run
 
-
 // Prevent  from generating deprecated warnings for this test.
 #if defined(__DEPRECATED)
 #undef __DEPRECATED
 #endif
 
+// Top level headers
 #include 
+#include 
 #include 
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -51,25 +55,21 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
 #include 
 #include 
 #include 
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include 
+#endif
 #include 
+#include 
 #include 
 #include 

[libcxx] r290447 - Fix PR31440: Make __sanitizer_annotate_contigious_container always visible. Fix from Jan Beich

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 14:03:52 2016
New Revision: 290447

URL: http://llvm.org/viewvc/llvm-project?rev=290447&view=rev
Log:
Fix PR31440: Make __sanitizer_annotate_contigious_container always visible. Fix 
from Jan Beich

Modified:
libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=290447&r1=290446&r2=290447&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Dec 23 14:03:52 2016
@@ -826,7 +826,7 @@ template  struct __static_asse
 #endif
 
 #ifndef _LIBCPP_HAS_NO_ASAN
-extern "C" void __sanitizer_annotate_contiguous_container(
+_LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
   const void *, const void *, const void *, const void *);
 #endif
 


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


[libcxx] r290448 - Don't use posix_memalign on Windows platforms

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 14:17:23 2016
New Revision: 290448

URL: http://llvm.org/viewvc/llvm-project?rev=290448&view=rev
Log:
Don't use posix_memalign on Windows platforms

Modified:
libcxx/trunk/src/new.cpp

Modified: libcxx/trunk/src/new.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.cpp?rev=290448&r1=290447&r2=290448&view=diff
==
--- libcxx/trunk/src/new.cpp (original)
+++ libcxx/trunk/src/new.cpp Fri Dec 23 14:17:23 2016
@@ -70,7 +70,11 @@ operator new(std::size_t size, std::alig
 if (static_cast(alignment) < sizeof(void*))
   alignment = std::align_val_t(sizeof(void*));
 void* p;
+#if defined(_WIN32)
+while ((p = _aligned_malloc(size, static_cast(alignment))) == 
nullptr)
+#else
 while (::posix_memalign(&p, static_cast(alignment), size) != 0)
+#endif
 {
 // If posix_memalign fails and there is a new_handler,
 // call it to try free up memory.


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


[PATCH] D27785: [libcxx] [test] Fix recently introduced warnings emitted by MSVC.

2016-12-23 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 about that. I'm working to turn on -Wunused-parameter and others to avoid 
these issues.


https://reviews.llvm.org/D27785



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


[PATCH] D28077: [PM] Introduce options to enable the (still experimental) new pass manager, and a code path to use it.

2016-12-23 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc marked 4 inline comments as done.
chandlerc added a comment.

Thanks for the review, will land shortly with suggested fixes.




Comment at: lib/CodeGen/BackendUtil.cpp:757
+  setCommandLineOpts();
+  cl::PrintOptionValues();
+

mehdi_amini wrote:
> This is different from the legacy path, why?
Stale line. Meant to nuke it, we have it in the correct location below already.



Comment at: lib/CodeGen/BackendUtil.cpp:762
+  CreateTargetMachine(/*MustCreateTM*/ true);
+  TheModule->setDataLayout(TM->createDataLayout());
+

mehdi_amini wrote:
> The legacy path accounts for the possibility of failing to create the TM
> 
> ```
>   CreateTargetMachine(UsesCodeGen);
> 
>   if (UsesCodeGen && !TM)
> return;
> ```
Good catch, done. I was too focused on the fact that TM was optional before.



Comment at: lib/CodeGen/BackendUtil.cpp:831
+  // Now that we have all of the passes ready, run them.
+  MPM.run(*TheModule, MAM);
+

mehdi_amini wrote:
> No need to wrap in a block with a `PrettyStackTraceString` like the legacy PM?
No, we should wrap it up similarly.



Comment at: test/Driver/clang_f_opts.c:475
+// RUN: %clang -### -fexperimental-new-pass-manager 
-fno-experimental-new-pass-manager %s 2>&1 | FileCheck --check-prefix=CHECK 
--check-prefix=CHECK-NO-NEW-PM %s
+// CHECK-NOT: argument unused
+// CHECK-NEW-PM: -fexperimental-new-pass-manager

mehdi_amini wrote:
> Not critical, but using the "CHECK" prefix isn't nice in a file intended to 
> be shared for multiple tests.
Good point!


https://reviews.llvm.org/D28077



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


r290450 - [PM] Introduce options to enable the (still experimental) new pass

2016-12-23 Thread Chandler Carruth via cfe-commits
Author: chandlerc
Date: Fri Dec 23 14:44:01 2016
New Revision: 290450

URL: http://llvm.org/viewvc/llvm-project?rev=290450&view=rev
Log:
[PM] Introduce options to enable the (still experimental) new pass
manager, and a code path to use it.

The option is actually a top-level option but does contain
'experimental' in the name. This is the compromise suggested by Richard
in discussions. We expect this option will be around long enough and
have enough users towards the end that it merits not being relegated to
CC1, but it still needs to be clear that this option will go away at
some point.

The backend code is a fresh codepath dedicated to handling the flow with
the new pass manager. This was also Richard's suggested code structuring
to essentially leave a clean path for development rather than carrying
complexity or idiosyncracies of how we do things just to share code with
the parts of this in common with the legacy pass manager. And it turns
out, not much is really in common even though we use the legacy pass
manager for codegen at this point.

I've switched a couple of tests to run with the new pass manager, and
they appear to work. There are still plenty of bugs that need squashing
(just with basic experiments I've found two already!) but they aren't in
this code, and the whole point is to expose the necessary hooks to start
experimenting with the pass manager in more realistic scenarios.

That said, I want to *strongly caution* anyone itching to play with
this: it is still *very shaky*. Several large components have not yet
been shaken down. For example I have bugs in both the always inliner and
inliner that I have already spotted and will be fixing independently.

Still, this is a fun milestone. =D

One thing not in this patch (but that might be very reasonable to add)
is some level of support for raw textual pass pipelines such as what
Sean had a patch for some time ago. I'm mostly interested in the more
traditional flow of getting the IR out of Clang and then running it
through opt, but I can see other use cases so someone may want to add
it.

And of course, *many* features are not yet supported!
- O1 is currently more like O2
- None of the sanitizers are wired up
- ObjC ARC optimizer isn't wired up
- ...

So plenty of stuff still lef to do!

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

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/arm64_crypto.c
cfe/trunk/test/CodeGen/inline-optim.c
cfe/trunk/test/Driver/clang_f_opts.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=290450&r1=290449&r2=290450&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Dec 23 14:44:01 2016
@@ -823,6 +823,9 @@ def finline_functions : Flag<["-"], "fin
 def finline_hint_functions: Flag<["-"], "finline-hint-functions">, 
Group, Flags<[CC1Option]>,
   HelpText<"Inline functions wich are (explicitly or implicitly) marked 
inline">;
 def finline : Flag<["-"], "finline">, Group;
+def fexperimental_new_pass_manager : Flag<["-"], 
"fexperimental-new-pass-manager">,
+  Group, Flags<[CC1Option]>,
+  HelpText<"Enables an experimental new pass manager in LLVM.">;
 def finput_charset_EQ : Joined<["-"], "finput-charset=">, Group;
 def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group;
 def finstrument_functions : Flag<["-"], "finstrument-functions">, 
Group, Flags<[CC1Option]>,
@@ -1000,6 +1003,9 @@ def fno_exceptions : Flag<["-"], "fno-ex
 def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group, 
Flags<[CC1Option]>;
 def fno_inline_functions : Flag<["-"], "fno-inline-functions">, 
Group, Flags<[CC1Option]>;
 def fno_inline : Flag<["-"], "fno-inline">, Group, 
Flags<[CC1Option]>;
+def fno_experimental_new_pass_manager : Flag<["-"], 
"fno-experimental-new-pass-manager">,
+  Group, Flags<[CC1Option]>,
+  HelpText<"Disables an experimental new pass manager in LLVM.">;
 def fveclib : Joined<["-"], "fveclib=">, Group, Flags<[CC1Option]>,
 HelpText<"Use the given vector functions library">;
 def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, 
Group,

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=290450&r1=290449&r2=290450&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Fri Dec 23 14:44:01 2016
@@ -52,6 +52,8 @@ CODEGENOPT(DisableGCov   , 1, 0) ///
 CODEGENOPT(D

[PATCH] D28077: [PM] Introduce options to enable the (still experimental) new pass manager, and a code path to use it.

2016-12-23 Thread Chandler Carruth via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
chandlerc marked 4 inline comments as done.
Closed by commit rL290450: [PM] Introduce options to enable the (still 
experimental) new pass (authored by chandlerc).

Changed prior to commit:
  https://reviews.llvm.org/D28077?vs=82400&id=82418#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28077

Files:
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/Frontend/CodeGenOptions.def
  cfe/trunk/lib/CodeGen/BackendUtil.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGen/arm64_crypto.c
  cfe/trunk/test/CodeGen/inline-optim.c
  cfe/trunk/test/Driver/clang_f_opts.c

Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -823,6 +823,9 @@
 def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group, Flags<[CC1Option]>,
   HelpText<"Inline functions wich are (explicitly or implicitly) marked inline">;
 def finline : Flag<["-"], "finline">, Group;
+def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">,
+  Group, Flags<[CC1Option]>,
+  HelpText<"Enables an experimental new pass manager in LLVM.">;
 def finput_charset_EQ : Joined<["-"], "finput-charset=">, Group;
 def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group;
 def finstrument_functions : Flag<["-"], "finstrument-functions">, Group, Flags<[CC1Option]>,
@@ -1000,6 +1003,9 @@
 def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group, Flags<[CC1Option]>;
 def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group, Flags<[CC1Option]>;
 def fno_inline : Flag<["-"], "fno-inline">, Group, Flags<[CC1Option]>;
+def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">,
+  Group, Flags<[CC1Option]>,
+  HelpText<"Disables an experimental new pass manager in LLVM.">;
 def fveclib : Joined<["-"], "fveclib=">, Group, Flags<[CC1Option]>,
 HelpText<"Use the given vector functions library">;
 def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group,
Index: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
===
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def
@@ -52,6 +52,8 @@
 CODEGENOPT(DisableLLVMPasses , 1, 0) ///< Don't run any LLVM IR passes to get
  ///< the pristine IR generated by the
  ///< frontend.
+CODEGENOPT(ExperimentalNewPassManager, 1, 0) ///< Enables the new, experimental
+ ///< pass manager.
 CODEGENOPT(DisableRedZone, 1, 0) ///< Set when -mno-red-zone is enabled.
 CODEGENOPT(DisableTailCalls  , 1, 0) ///< Do not emit tail calls.
 CODEGENOPT(EmitDeclMetadata  , 1, 0) ///< Emit special metadata indicating what
Index: cfe/trunk/test/CodeGen/inline-optim.c
===
--- cfe/trunk/test/CodeGen/inline-optim.c
+++ cfe/trunk/test/CodeGen/inline-optim.c
@@ -1,9 +1,13 @@
 // Make sure -finline-functions family flags are behaving correctly.
 
 // RUN: %clang_cc1 -triple i686-pc-win32 -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -fno-inline-functions -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager -O3 -fno-inline-functions -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -finline-hint-functions -emit-llvm %s -o - | FileCheck -check-prefix=HINT %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager -O3 -finline-hint-functions -emit-llvm %s -o - | FileCheck -check-prefix=HINT %s
 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -finline-functions -emit-llvm %s -o - | FileCheck -check-prefix=INLINE %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager -O3 -finline-functions -emit-llvm %s -o - | FileCheck -check-prefix=INLINE %s
 
 inline int inline_hint(int a, int b) { return(a+b); }
 
Index: cfe/trunk/test/CodeGen/arm64_crypto.c
===
--- cfe/trunk/test/CodeGen/arm64_crypto.c
+++ cfe/trunk/test/CodeGen/arm64_crypto.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-feature +neon -target-feature +crypto -ffreestanding -Os -S -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-feature +neon -target-feature +crypto -ffreestanding -fexperimental-new-pass-manager -Os -S -o - %s 

r290451 - [PM] Fix up from r290449 to start requiring the x86 target to be

2016-12-23 Thread Chandler Carruth via cfe-commits
Author: chandlerc
Date: Fri Dec 23 15:19:16 2016
New Revision: 290451

URL: http://llvm.org/viewvc/llvm-project?rev=290451&view=rev
Log:
[PM] Fix up from r290449 to start requiring the x86 target to be
available.

It doesn't seem terribly important to test this with a specific target
triple but without that target available.

Modified:
cfe/trunk/test/CodeGen/inline-optim.c

Modified: cfe/trunk/test/CodeGen/inline-optim.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/inline-optim.c?rev=290451&r1=290450&r2=290451&view=diff
==
--- cfe/trunk/test/CodeGen/inline-optim.c (original)
+++ cfe/trunk/test/CodeGen/inline-optim.c Fri Dec 23 15:19:16 2016
@@ -1,5 +1,7 @@
 // Make sure -finline-functions family flags are behaving correctly.
-
+//
+// REQUIRES: x86-registered-target
+//
 // RUN: %clang_cc1 -triple i686-pc-win32 -emit-llvm %s -o - | FileCheck 
-check-prefix=NOINLINE %s
 // RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager 
-emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -fno-inline-functions -emit-llvm 
%s -o - | FileCheck -check-prefix=NOINLINE %s


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


[PATCH] D28080: [Docs][OpenCL] Added OpenCL feature description to user manual.

2016-12-23 Thread Mats Petersson via Phabricator via cfe-commits
Leporacanthicus added inline comments.



Comment at: docs/UsersManual.rst:2083
+space is represented by the absence of an address space attribute in the IR 
(see
+also :ref:`the section on address space attribute `).
+

Should this be `opencl_addrsp` (two d's)?



Comment at: docs/UsersManual.rst:2242
+
+ my_sub_group_shuffle() __attribute((convergent));
+

Shouldn't that be `__attribute__`?



Comment at: docs/UsersManual.rst:2259
+
+ for (int i=0; i<3; i++)
+   my_sub_group_shuffle()

Compared to the unrolled code below, this should probably say `i < 4` rather 
than `i  < 3`?



Comment at: docs/UsersManual.rst:2278
+
+.. _opencl_adrsp:
+

Obviously, change this as well to `opencl_addrsp`...


https://reviews.llvm.org/D28080



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


[PATCH] D27680: [CodeGen] Move lifetime.start of a variable when goto jumps back past its declaration

2016-12-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 82421.
ahatanak added a comment.

When compiling for C, insert lifetime.start at the beginning of the current 
lexical scope, rather than moving it retroactively when a goto jumps backwards 
over the variable declaration.

Also, insert lifetime.start at a more precise location, rather than always 
inserting it at the beginning of a basic block. This enables keeping the live 
ranges disjoint in some cases. For example, in the following code, the live 
ranges of a and b would overlap if the lifetime.starts were moved to the 
beginning of the basic block, but would be disjoint if moved to the beginning 
of their lexical scopes:

void foo1() {

  {
int a[5];
foo2(a);
  }
  {
int b[5];
foo2(b);
  }

}


https://reviews.llvm.org/D27680

Files:
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGen/cleanup-destslot-simple.c
  test/CodeGen/lifetime2.c
  test/CodeGenObjC/arc-blocks.m
  test/CodeGenObjC/arc-bridged-cast.m
  test/CodeGenObjC/arc-precise-lifetime.m
  test/CodeGenObjC/arc-ternary-op.m
  test/CodeGenObjC/arc.m

Index: test/CodeGenObjC/arc.m
===
--- test/CodeGenObjC/arc.m
+++ test/CodeGenObjC/arc.m
@@ -46,10 +46,10 @@
 id test1(id x) {
   // CHECK:  [[X:%.*]] = alloca i8*
   // CHECK-NEXT: [[Y:%.*]] = alloca i8*
-  // CHECK-NEXT: [[PARM:%.*]] = call i8* @objc_retain(i8* {{%.*}})
-  // CHECK-NEXT: store i8* [[PARM]], i8** [[X]]
   // CHECK-NEXT: [[YPTR1:%.*]] = bitcast i8** [[Y]] to i8*
   // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[YPTR1]])
+  // CHECK-NEXT: [[PARM:%.*]] = call i8* @objc_retain(i8* {{%.*}})
+  // CHECK-NEXT: store i8* [[PARM]], i8** [[X]]
   // CHECK-NEXT: store i8* null, i8** [[Y]]
   // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[Y]]
   // CHECK-NEXT: [[RET:%.*]] = call i8* @objc_retain(i8* [[T0]])
@@ -308,11 +308,11 @@
   // CHECK-LABEL:  define void @test10()
   // CHECK:  [[X:%.*]] = alloca [[TEST10:%.*]]*, align
   // CHECK-NEXT: [[Y:%.*]] = alloca i8*, align
+  // CHECK-NEXT: [[YPTR1:%.*]] = bitcast i8** [[Y]] to i8*
+  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[YPTR1]])
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast [[TEST10]]** [[X]] to i8*
   // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
   // CHECK-NEXT: store [[TEST10]]* null, [[TEST10]]** [[X]]
-  // CHECK-NEXT: [[YPTR1:%.*]] = bitcast i8** [[Y]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[YPTR1]])
   // CHECK-NEXT: load [[TEST10]]*, [[TEST10]]** [[X]], align
   // CHECK-NEXT: load i8*, i8** @OBJC_SELECTOR_REFERENCES_{{[0-9]*}}
   // CHECK-NEXT: bitcast
@@ -346,9 +346,9 @@
   // CHECK-LABEL:  define void @test11(
   // CHECK:  [[F:%.*]] = alloca i8* ()*, align
   // CHECK-NEXT: [[X:%.*]] = alloca i8*, align
-  // CHECK-NEXT: store i8* ()* {{%.*}}, i8* ()** [[F]], align
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
   // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+  // CHECK-NEXT: store i8* ()* {{%.*}}, i8* ()** [[F]], align
   // CHECK-NEXT: [[T0:%.*]] = load i8* ()*, i8* ()** [[F]], align
   // CHECK-NEXT: [[T1:%.*]] = call i8* [[T0]]()
   // CHECK-NEXT: store i8* [[T1]], i8** [[X]], align
@@ -366,10 +366,12 @@
   // CHECK-LABEL:  define void @test12()
   // CHECK:  [[X:%.*]] = alloca i8*, align
   // CHECK-NEXT: [[Y:%.*]] = alloca i8*, align
-
-  __weak id x = test12_helper();
+  // CHECK-NEXT: [[YPTR1:%.*]] = bitcast i8** [[Y]] to i8*
+  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[YPTR1]])
   // CHECK-NEXT: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
   // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
+
+  __weak id x = test12_helper();
   // CHECK-NEXT: [[T0:%.*]] = call i8* @test12_helper()
   // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]])
   // CHECK-NEXT: call i8* @objc_initWeak(i8** [[X]], i8* [[T1]])
@@ -382,8 +384,6 @@
   // CHECK-NEXT: call void @objc_release(i8* [[T1]])
 
   id y = x;
-  // CHECK-NEXT: [[YPTR1:%.*]] = bitcast i8** [[Y]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[YPTR1]])
   // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_loadWeakRetained(i8** [[X]])
   // CHECK-NEXT: store i8* [[T2]], i8** [[Y]], align
 
@@ -897,11 +897,11 @@
   // CHECK-NEXT: [[TEMP1:%.*]] = alloca [[A_T]]*
   // CHECK-NEXT: [[TEMP2:%.*]] = alloca [[A_T]]*
   // CHECK-NEXT: bitcast
+  // CHECK-NEXT: call void @llvm.lifetime.start
+  // CHECK-NEXT: bitcast
   // CHECK-NEXT: objc_retain
   // CHECK-NEXT: bitcast
   // CHECK-NEXT: store
-  // CHECK-NEXT: bitcast
-  // CHECK-NEXT: call void @llvm.lifetime.start
   // CHECK-NEXT: store [[A_T]]* null, [[A_T]]** [[A]]
 
   // CHECK-NEXT: load [[TEST33]]*, [[TEST33]]** [[PTR]]
@@ -1338,6 +1338,8 @@
 void test61(void) {
   // CHECK-LABEL:define void @test61()
   // CHECK:  [[Y:%.*]] = alloca i8*, align 8
+  // CHECK-NEXT: [[

[PATCH] D27806: [clang-tidy] Add obvious-invalid-range

2016-12-23 Thread Piotr Padlewski via Phabricator via cfe-commits
Prazek added inline comments.



Comment at: clang-tidy/obvious/InvalidRangeCheck.cpp:62
+  auto CallsAlgorithm = hasDeclaration(
+  functionDecl(Names.size() > 0 ? hasAnyName(Names) : anything()));
+

alexfh wrote:
>  Does this check make sense without the names whitelist? What will is the use 
> case?
I would guess most of the functions that would be called like
foo(v.begin(), v2.end(), ...) would take range as 2 first arguments. at least I 
never saw code that this would be valid 
(other case is something like foo(v.begin(), v2.begin(), ...), but I look only 
for ranges [begin, end())



Comment at: clang-tidy/obvious/InvalidRangeCheck.cpp:67
+hasDeclaration(cxxMethodDecl(hasName(MethodName))),
+onImplicitObjectArgument(declRefExpr().bind(BindThisName)));
+  };

alexfh wrote:
> Why should this be a `declRefExpr`? This will miss cases with a more complex 
> expression, e.g. `std::count(x.y().begin(), x.z().end(), ...)`. Considering 
> `y()` and `z()` are simple getters, this might be a quite common code.
good point



Comment at: clang-tidy/obvious/InvalidRangeCheck.cpp:82
+  const auto *SecondArg = Result.Nodes.getNodeAs("second_arg");
+  if (FirstArg->getNameInfo().getAsString() ==
+  SecondArg->getNameInfo().getAsString())

alexfh wrote:
> Is there a less wasteful way of doing this? E.g. compare pointers to 
> canonical declarations?
maybe there is. I firstly wanted to make it simple and working and see what 
people think about these kind of checks.



Comment at: docs/ReleaseNotes.rst:120
+  code.
+- New `obvious-invalid-range
+  `_ 
check

alexfh wrote:
> The idea of the `obvious` module is interesting, but I'm not sure this check 
> belongs here. At least, I would like to run it on our code and see whether it 
> finds anything before calling this "obvious" ;)
I runned it on LLVM and clang and as expected it didn't find anything (the code 
would crash or would be dead)


https://reviews.llvm.org/D27806



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


r290455 - [DOXYGEN] Improved doxygen comments for tmmintrin.h intrinsics.

2016-12-23 Thread Ekaterina Romanova via cfe-commits
Author: kromanova
Date: Fri Dec 23 16:47:16 2016
New Revision: 290455

URL: http://llvm.org/viewvc/llvm-project?rev=290455&view=rev
Log:
[DOXYGEN] Improved doxygen comments for tmmintrin.h intrinsics.

Tagged parameter names with \a doxygen command to display parameters in italics.
Added \n commands to insert a line break to make the documentation more 
readable. 
Formatted comments to fit into 80 chars.


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

Modified: cfe/trunk/lib/Headers/tmmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/tmmintrin.h?rev=290455&r1=290454&r2=290455&view=diff
==
--- cfe/trunk/lib/Headers/tmmintrin.h (original)
+++ cfe/trunk/lib/Headers/tmmintrin.h Fri Dec 23 16:47:16 2016
@@ -483,15 +483,15 @@ _mm_hsubs_pi16(__m64 __a, __m64 __b)
 /// \param __b
 ///A 128-bit integer vector containing the second source operand.
 /// \returns A 128-bit integer vector containing the sums of products of both
-///operands:
-///R0 := (__a0 * __b0) + (__a1 * __b1)
-///R1 := (__a2 * __b2) + (__a3 * __b3)
-///R2 := (__a4 * __b4) + (__a5 * __b5)
-///R3 := (__a6 * __b6) + (__a7 * __b7)
-///R4 := (__a8 * __b8) + (__a9 * __b9)
-///R5 := (__a10 * __b10) + (__a11 * __b11)
-///R6 := (__a12 * __b12) + (__a13 * __b13)
-///R7 := (__a14 * __b14) + (__a15 * __b15)
+///operands: \n
+///\a R0 := (\a __a0 * \a __b0) + (\a __a1 * \a __b1) \n
+///\a R1 := (\a __a2 * \a __b2) + (\a __a3 * \a __b3) \n
+///\a R2 := (\a __a4 * \a __b4) + (\a __a5 * \a __b5) \n
+///\a R3 := (\a __a6 * \a __b6) + (\a __a7 * \a __b7) \n
+///\a R4 := (\a __a8 * \a __b8) + (\a __a9 * \a __b9) \n
+///\a R5 := (\a __a10 * \a __b10) + (\a __a11 * \a __b11) \n
+///\a R6 := (\a __a12 * \a __b12) + (\a __a13 * \a __b13) \n
+///\a R7 := (\a __a14 * \a __b14) + (\a __a15 * \a __b15)
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_maddubs_epi16(__m128i __a, __m128i __b)
 {
@@ -516,11 +516,11 @@ _mm_maddubs_epi16(__m128i __a, __m128i _
 /// \param __b
 ///A 64-bit integer vector containing the second source operand.
 /// \returns A 64-bit integer vector containing the sums of products of both
-///operands:
-///R0 := (__a0 * __b0) + (__a1 * __b1)
-///R1 := (__a2 * __b2) + (__a3 * __b3)
-///R2 := (__a4 * __b4) + (__a5 * __b5)
-///R3 := (__a6 * __b6) + (__a7 * __b7)
+///operands: \n
+///\a R0 := (\a __a0 * \a __b0) + (\a __a1 * \a __b1) \n
+///\a R1 := (\a __a2 * \a __b2) + (\a __a3 * \a __b3) \n
+///\a R2 := (\a __a4 * \a __b4) + (\a __a5 * \a __b5) \n
+///\a R3 := (\a __a6 * \a __b6) + (\a __a7 * \a __b7)
 static __inline__ __m64 __DEFAULT_FN_ATTRS
 _mm_maddubs_pi16(__m64 __a, __m64 __b)
 {


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


LLVM buildmaster will be restarted tonight

2016-12-23 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 5 PM Pacific time
today.

Thanks

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


r290458 - [DOXYGEN] Improved doxygen comments for tmmintrin.h intrinsics.

2016-12-23 Thread Ekaterina Romanova via cfe-commits
Author: kromanova
Date: Fri Dec 23 17:36:26 2016
New Revision: 290458

URL: http://llvm.org/viewvc/llvm-project?rev=290458&view=rev
Log:
[DOXYGEN] Improved doxygen comments for tmmintrin.h intrinsics.

Added \n commands to insert a line breaks where necessary to make the 
documentation more readable. 
Formatted comments to fit into 80 chars.


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

Modified: cfe/trunk/lib/Headers/avxintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avxintrin.h?rev=290458&r1=290457&r2=290458&view=diff
==
--- cfe/trunk/lib/Headers/avxintrin.h (original)
+++ cfe/trunk/lib/Headers/avxintrin.h Fri Dec 23 17:36:26 2016
@@ -397,16 +397,16 @@ _mm256_rcp_ps(__m256 __a)
 ///An integer value that specifies the rounding operation. \n
 ///Bits [7:4] are reserved. \n
 ///Bit [3] is a precision exception value: \n
-///0: A normal PE exception is used. \n
-///1: The PE field is not updated. \n
+///  0: A normal PE exception is used. \n
+///  1: The PE field is not updated. \n
 ///Bit [2] is the rounding control source: \n
-///0: Use bits [1:0] of \a M. \n
-///1: Use the current MXCSR setting. \n
+///  0: Use bits [1:0] of \a M. \n
+///  1: Use the current MXCSR setting. \n
 ///Bits [1:0] contain the rounding control definition: \n
-///00: Nearest. \n
-///01: Downward (toward negative infinity). \n
-///10: Upward (toward positive infinity). \n
-///11: Truncated. 
+///  00: Nearest. \n
+///  01: Downward (toward negative infinity). \n
+///  10: Upward (toward positive infinity). \n
+///  11: Truncated.
 /// \returns A 256-bit vector of [4 x double] containing the rounded values.
 #define _mm256_round_pd(V, M) __extension__ ({ \
 (__m256d)__builtin_ia32_roundpd256((__v4df)(__m256d)(V), (M)); })
@@ -438,7 +438,7 @@ _mm256_rcp_ps(__m256 __a)
 ///  00: Nearest. \n
 ///  01: Downward (toward negative infinity). \n
 ///  10: Upward (toward positive infinity). \n
-///  11: Truncated. \n
+///  11: Truncated.
 /// \returns A 256-bit vector of [8 x float] containing the rounded values.
 #define _mm256_round_ps(V, M) __extension__ ({ \
   (__m256)__builtin_ia32_roundps256((__v8sf)(__m256)(V), (M)); })
@@ -767,18 +767,18 @@ _mm256_hsub_ps(__m256 __a, __m256 __b)
 /// \param __a
 ///A 128-bit vector of [2 x double].
 /// \param __c
-///\li A 128-bit integer vector operand specifying how the values are to be
-///copied.
-///\li Bit [1]:
-///\li 0: Bits [63:0] of the source are copied to bits [63:0] of the
-///returned vector.
-///\li 1: Bits [127:64] of the source are copied to bits [63:0] of the
-///returned vector.
-///\li Bit [65]:
-///\li 0: Bits [63:0] of the source are copied to bits [127:64] of the
-///returned vector.
-///\li 1: Bits [127:64] of the source are copied to bits [127:64] of the
-///returned vector.
+///A 128-bit integer vector operand specifying how the values are to be
+///copied. \n
+///Bit [1]: \n
+///  0: Bits [63:0] of the source are copied to bits [63:0] of the returned
+/// vector. \n
+///  1: Bits [127:64] of the source are copied to bits [63:0] of the
+/// returned vector. \n
+///Bit [65]: \n
+///  0: Bits [63:0] of the source are copied to bits [127:64] of the
+/// returned vector. \n
+///  1: Bits [127:64] of the source are copied to bits [127:64] of the
+/// returned vector.
 /// \returns A 128-bit vector of [2 x double] containing the copied values.
 static __inline __m128d __DEFAULT_FN_ATTRS
 _mm_permutevar_pd(__m128d __a, __m128i __c)
@@ -786,8 +786,8 @@ _mm_permutevar_pd(__m128d __a, __m128i _
   return (__m128d)__builtin_ia32_vpermilvarpd((__v2df)__a, (__v2di)__c);
 }
 
-/// \brief Copies the values in a 256-bit vector of [4 x double] as
-///specified by the 256-bit integer vector operand.
+/// \brief Copies the values in a 256-bit vector of [4 x double] as specified
+///by the 256-bit integer vector operand.
 ///
 /// \headerfile 
 ///
@@ -799,24 +799,24 @@ _mm_permutevar_pd(__m128d __a, __m128i _
 ///A 256-bit integer vector operand specifying how the values are to be
 ///copied. \n
 ///Bit [1]: \n
-///\li 0: Bits [63:0] of the source are copied to bits [63:0] of the
-///returned vector.
-///\li 1: Bits [127:64] of the source are copied to bits [63:0] of the
-///returned vector.
+///  0: Bits [63:0] of the source are copied to bits [63:0] of the returned
+/// vector. \n
+///  1: Bits [127:64] of the source are copied to bits [63:0] of the
+/// returned vector. \n
 ///Bit [65]: \n
-///\li 0: Bits [63:0] of the source are copied to bits [127:64] of the
-///returned vector.
-///\li 1: Bits [127:64] of the source are copied to bits [127:64] of the
-///returned vector.
-///Bit 

Re: r290417 - Add an assert to catch improperly constructed %diff sequences in

2016-12-23 Thread Richard Smith via cfe-commits
On 22 December 2016 at 21:19, Chandler Carruth via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: chandlerc
> Date: Thu Dec 22 23:19:47 2016
> New Revision: 290417
>
> URL: http://llvm.org/viewvc/llvm-project?rev=290417&view=rev
> Log:
> Add an assert to catch improperly constructed %diff sequences in
> diagnostics and fix one such diagnostic.
>
> Sadly, this assert doesn't catch this bug because we have no tests that
> emit this diagnostic! Doh! I'm following up on the commit that
> introduces it to get that fixed. Then this assert will help in a more
> direct way.
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/Basic/Diagnostic.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/
> DiagnosticSemaKinds.td?rev=290417&r1=290416&r2=290417&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Dec 22
> 23:19:47 2016
> @@ -3346,7 +3346,7 @@ def note_ovl_candidate_inconsistent_dedu
>  def note_ovl_candidate_inconsistent_deduction_types : Note<
>  "candidate template ignored: deduced values %diff{"
>  "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type
> $)|"
> -"%1 and %3 of conflicting types for parameter %0|}2,4">;
> +"%1 and %3 of conflicting types for parameter %0}2,4">;
>  def note_ovl_candidate_explicit_arg_mismatch_named : Note<
>  "candidate template ignored: invalid explicitly-specified argument "
>  "for template parameter %0">;
>
> Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/
> Diagnostic.cpp?rev=290417&r1=290416&r2=290417&view=diff
> 
> ==
> --- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
> +++ cfe/trunk/lib/Basic/Diagnostic.cpp Thu Dec 22 23:19:47 2016
> @@ -742,7 +742,10 @@ FormatDiagnostic(const char *DiagStr, co
>  //   "%diff{compare $ to $|other text}1,2"
>  // treat it as:
>  //   "compare %1 to %2"
> -const char *Pipe = ScanFormat(Argument, Argument + ArgumentLen,
> '|');
> +const char *ArgumentEnd = Argument + ArgumentLen;
> +const char *Pipe = ScanFormat(Argument, ArgumentEnd, '|');
> +assert(ScanFormat(Pipe + 1, ArgumentEnd, '|') == ArgumentEnd &&
> +   "Found too many '|'s in a %diff modifier!");
>

This is the fallback path for the case where the types being diffed turn
out to not both be types after all; your assert is unreachable for
properly-emitted diagnostics. Perhaps we should instead replace this whole
block with an llvm_unreachable and fix any cases where we're passing
non-types into a %diff...

 const char *FirstDollar = ScanFormat(Argument, Pipe, '$');
>  const char *SecondDollar = ScanFormat(FirstDollar + 1, Pipe, '$');
>  const char ArgStr1[] = { '%', static_cast('0' + ArgNo) };
>
>
> ___
> 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


r290461 - ArrayRefize lists of TemplateArguments in template argument deduction.

2016-12-23 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Dec 23 17:46:56 2016
New Revision: 290461

URL: http://llvm.org/viewvc/llvm-project?rev=290461&view=rev
Log:
ArrayRefize lists of TemplateArguments in template argument deduction.

Modified:
cfe/trunk/include/clang/AST/TemplateBase.h
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp

Modified: cfe/trunk/include/clang/AST/TemplateBase.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=290461&r1=290460&r2=290461&view=diff
==
--- cfe/trunk/include/clang/AST/TemplateBase.h (original)
+++ cfe/trunk/include/clang/AST/TemplateBase.h Fri Dec 23 17:46:56 2016
@@ -330,8 +330,8 @@ public:
 
   /// \brief Iterator range referencing all of the elements of a template
   /// argument pack.
-  llvm::iterator_range pack_elements() const {
-return llvm::make_range(pack_begin(), pack_end());
+  ArrayRef pack_elements() const {
+return llvm::makeArrayRef(pack_begin(), pack_end());
   }
 
   /// \brief The number of template arguments in the given template argument

Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=290461&r1=290460&r2=290461&view=diff
==
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Fri Dec 23 17:46:56 2016
@@ -105,8 +105,8 @@ DeduceTemplateArgumentsByTypeMatch(Sema
 
 static Sema::TemplateDeductionResult
 DeduceTemplateArguments(Sema &S, TemplateParameterList *TemplateParams,
-const TemplateArgument *Params, unsigned NumParams,
-const TemplateArgument *Args, unsigned NumArgs,
+ArrayRef Params,
+ArrayRef Args,
 TemplateDeductionInfo &Info,
 SmallVectorImpl &Deduced,
 bool NumberOfArgumentsMustMatch);
@@ -520,9 +520,9 @@ DeduceTemplateArguments(Sema &S,
 // Perform template argument deduction on each template
 // argument. Ignore any missing/extra arguments, since they could be
 // filled in by default arguments.
-return DeduceTemplateArguments(S, TemplateParams, Param->getArgs(),
-   Param->getNumArgs(), SpecArg->getArgs(),
-   SpecArg->getNumArgs(), Info, Deduced,
+return DeduceTemplateArguments(S, TemplateParams,
+   Param->template_arguments(),
+   SpecArg->template_arguments(), Info, 
Deduced,
/*NumberOfArgumentsMustMatch=*/false);
   }
 
@@ -554,10 +554,9 @@ DeduceTemplateArguments(Sema &S,
 return Result;
 
   // Perform template argument deduction for the template arguments.
-  return DeduceTemplateArguments(
-  S, TemplateParams, Param->getArgs(), Param->getNumArgs(),
-  SpecArg->getTemplateArgs().data(), SpecArg->getTemplateArgs().size(),
-  Info, Deduced, /*NumberOfArgumentsMustMatch=*/true);
+  return DeduceTemplateArguments(S, TemplateParams, 
Param->template_arguments(),
+ SpecArg->getTemplateArgs().asArray(), Info,
+ Deduced, /*NumberOfArgumentsMustMatch=*/true);
 }
 
 /// \brief Determines whether the given type is an opaque type that
@@ -1864,45 +1863,34 @@ DeduceTemplateArguments(Sema &S,
 ///
 /// \returns true if there is another template argument (which will be at
 /// \c Args[ArgIdx]), false otherwise.
-static bool hasTemplateArgumentForDeduction(const TemplateArgument *&Args,
-unsigned &ArgIdx,
-unsigned &NumArgs) {
-  if (ArgIdx == NumArgs)
+static bool hasTemplateArgumentForDeduction(ArrayRef &Args,
+unsigned &ArgIdx) {
+  if (ArgIdx == Args.size())
 return false;
 
   const TemplateArgument &Arg = Args[ArgIdx];
   if (Arg.getKind() != TemplateArgument::Pack)
 return true;
 
-  assert(ArgIdx == NumArgs - 1 && "Pack not at the end of argument list?");
-  Args = Arg.pack_begin();
-  NumArgs = Arg.pack_size();
+  assert(ArgIdx == Args.size() - 1 && "Pack not at the end of argument list?");
+  Args = Arg.pack_elements();
   ArgIdx = 0;
-  return ArgIdx < NumArgs;
+  return ArgIdx < Args.size();
 }
 
 /// \brief Determine whether the given set of template arguments has a pack
 /// expansion that is not the last template argument.
-static bool hasPackExpansionBeforeEnd(const TemplateArgument *Args,
-  unsigned NumArgs) {
-  unsigned ArgIdx = 0;
-  while (ArgIdx < NumArgs) {
-const TemplateArgument &Arg = Args[ArgIdx];
-
-// Unwrap argument packs.
-if (Args[ArgIdx].getKind() == TemplateArgument::Pack) {
- 

[PATCH] D27785: [libcxx] [test] Fix recently introduced warnings emitted by MSVC.

2016-12-23 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

Alright. The unused parameter parts of this patch are no longer needed. 
`-Wunused-parameter` and `-Wunused-variable` have been enabled within libc++.

Just working on `-Wsign-compare` now.


https://reviews.llvm.org/D27785



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


[libcxx] r290469 - fix sign comparison warnings

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 18:24:44 2016
New Revision: 290469

URL: http://llvm.org/viewvc/llvm-project?rev=290469&view=rev
Log:
fix sign comparison warnings

Modified:
libcxx/trunk/include/__bit_reference
libcxx/trunk/include/deque
libcxx/trunk/include/istream
libcxx/trunk/include/random
libcxx/trunk/include/regex
libcxx/trunk/test/libcxx/test/config.py

Modified: libcxx/trunk/include/__bit_reference
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__bit_reference?rev=290469&r1=290468&r2=290469&view=diff
==
--- libcxx/trunk/include/__bit_reference (original)
+++ libcxx/trunk/include/__bit_reference Fri Dec 23 18:24:44 2016
@@ -163,7 +163,7 @@ __find_bool_true(__bit_iterator<_Cp, _Is
 {
 typedef __bit_iterator<_Cp, _IsConst> _It;
 typedef typename _It::__storage_type __storage_type;
-static const unsigned __bits_per_word = _It::__bits_per_word;
+static const int __bits_per_word = _It::__bits_per_word;
 // do first partial word
 if (__first.__ctz_ != 0)
 {
@@ -199,7 +199,7 @@ __find_bool_false(__bit_iterator<_Cp, _I
 {
 typedef __bit_iterator<_Cp, _IsConst> _It;
 typedef typename _It::__storage_type __storage_type;
-static const unsigned __bits_per_word = _It::__bits_per_word;
+const int __bits_per_word = _It::__bits_per_word;
 // do first partial word
 if (__first.__ctz_ != 0)
 {
@@ -251,7 +251,7 @@ __count_bool_true(__bit_iterator<_Cp, _I
 typedef __bit_iterator<_Cp, _IsConst> _It;
 typedef typename _It::__storage_type __storage_type;
 typedef typename _It::difference_type difference_type;
-static const unsigned __bits_per_word = _It::__bits_per_word;
+const int __bits_per_word = _It::__bits_per_word;
 difference_type __r = 0;
 // do first partial word
 if (__first.__ctz_ != 0)
@@ -282,7 +282,7 @@ __count_bool_false(__bit_iterator<_Cp, _
 typedef __bit_iterator<_Cp, _IsConst> _It;
 typedef typename _It::__storage_type __storage_type;
 typedef typename _It::difference_type difference_type;
-static const unsigned __bits_per_word = _It::__bits_per_word;
+const int __bits_per_word = _It::__bits_per_word;
 difference_type __r = 0;
 // do first partial word
 if (__first.__ctz_ != 0)
@@ -324,7 +324,7 @@ __fill_n_false(__bit_iterator<_Cp, false
 {
 typedef __bit_iterator<_Cp, false> _It;
 typedef typename _It::__storage_type __storage_type;
-static const unsigned __bits_per_word = _It::__bits_per_word;
+const int __bits_per_word = _It::__bits_per_word;
 // do first partial word
 if (__first.__ctz_ != 0)
 {
@@ -354,7 +354,7 @@ __fill_n_true(__bit_iterator<_Cp, false>
 {
 typedef __bit_iterator<_Cp, false> _It;
 typedef typename _It::__storage_type __storage_type;
-static const unsigned __bits_per_word = _It::__bits_per_word;
+const int __bits_per_word = _It::__bits_per_word;
 // do first partial word
 if (__first.__ctz_ != 0)
 {
@@ -412,7 +412,7 @@ __copy_aligned(__bit_iterator<_Cp, _IsCo
 typedef __bit_iterator<_Cp, _IsConst> _In;
 typedef  typename _In::difference_type difference_type;
 typedef typename _In::__storage_type __storage_type;
-static const unsigned __bits_per_word = _In::__bits_per_word;
+const int __bits_per_word = _In::__bits_per_word;
 difference_type __n = __last - __first;
 if (__n > 0)
 {
@@ -461,7 +461,7 @@ __copy_unaligned(__bit_iterator<_Cp, _Is
 typedef __bit_iterator<_Cp, _IsConst> _In;
 typedef  typename _In::difference_type difference_type;
 typedef typename _In::__storage_type __storage_type;
-static const unsigned __bits_per_word = _In::__bits_per_word;
+static const int __bits_per_word = _In::__bits_per_word;
 difference_type __n = __last - __first;
 if (__n > 0)
 {
@@ -551,7 +551,7 @@ __copy_backward_aligned(__bit_iterator<_
 typedef __bit_iterator<_Cp, _IsConst> _In;
 typedef  typename _In::difference_type difference_type;
 typedef typename _In::__storage_type __storage_type;
-static const unsigned __bits_per_word = _In::__bits_per_word;
+const int __bits_per_word = _In::__bits_per_word;
 difference_type __n = __last - __first;
 if (__n > 0)
 {
@@ -600,7 +600,7 @@ __copy_backward_unaligned(__bit_iterator
 typedef __bit_iterator<_Cp, _IsConst> _In;
 typedef  typename _In::difference_type difference_type;
 typedef typename _In::__storage_type __storage_type;
-static const unsigned __bits_per_word = _In::__bits_per_word;
+const int __bits_per_word = _In::__bits_per_word;
 difference_type __n = __last - __first;
 if (__n > 0)
 {
@@ -718,7 +718,7 @@ __swap_ranges_aligned(__bit_iterator<__C
 typedef __bit_iterator<__C1, false> _I1;
 typedef  typename _I1::difference_type difference_type;
 typedef typename _I1::__storage_type __storage_type;
-static const un

[libcxx] r290470 - Fix another unused warning

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 18:28:19 2016
New Revision: 290470

URL: http://llvm.org/viewvc/llvm-project?rev=290470&view=rev
Log:
Fix another unused warning

Modified:
libcxx/trunk/test/support/test.support/test_demangle.pass.cpp

Modified: libcxx/trunk/test/support/test.support/test_demangle.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test.support/test_demangle.pass.cpp?rev=290470&r1=290469&r2=290470&view=diff
==
--- libcxx/trunk/test/support/test.support/test_demangle.pass.cpp (original)
+++ libcxx/trunk/test/support/test.support/test_demangle.pass.cpp Fri Dec 23 
18:28:19 2016
@@ -30,6 +30,7 @@ int main() {
 const char* expect = TestCases[i].expect;
 #ifdef TEST_HAS_NO_DEMANGLE
 assert(demangle(raw) == raw);
+((void)expect);
 #else
 assert(demangle(raw) == expect);
 #endif


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


[libcxxabi] r290471 - Fix warnings in libc++abi tests

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 18:37:13 2016
New Revision: 290471

URL: http://llvm.org/viewvc/llvm-project?rev=290471&view=rev
Log:
Fix warnings in libc++abi tests

Modified:
libcxxabi/trunk/test/backtrace_test.pass.cpp
libcxxabi/trunk/test/cxa_bad_cast.pass.cpp
libcxxabi/trunk/test/test_aux_runtime.pass.cpp
libcxxabi/trunk/test/test_aux_runtime_op_array_new.pass.cpp
libcxxabi/trunk/test/test_exception_storage.pass.cpp
libcxxabi/trunk/test/test_fallback_malloc.pass.cpp
libcxxabi/trunk/test/test_guard.pass.cpp
libcxxabi/trunk/test/test_vector1.pass.cpp
libcxxabi/trunk/test/test_vector2.pass.cpp
libcxxabi/trunk/test/test_vector3.pass.cpp
libcxxabi/trunk/test/unwind_06.pass.cpp

Modified: libcxxabi/trunk/test/backtrace_test.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/backtrace_test.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==
--- libcxxabi/trunk/test/backtrace_test.pass.cpp (original)
+++ libcxxabi/trunk/test/backtrace_test.pass.cpp Fri Dec 23 18:37:13 2016
@@ -14,7 +14,7 @@
 #include 
 
 extern "C" _Unwind_Reason_Code
-trace_function(struct _Unwind_Context* context, void* ntraced) {
+trace_function(struct _Unwind_Context*, void* ntraced) {
   (*reinterpret_cast(ntraced))++;
   // We should never have a call stack this deep...
   assert(*reinterpret_cast(ntraced) < 20);

Modified: libcxxabi/trunk/test/cxa_bad_cast.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/cxa_bad_cast.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==
--- libcxxabi/trunk/test/cxa_bad_cast.pass.cpp (original)
+++ libcxxabi/trunk/test/cxa_bad_cast.pass.cpp Fri Dec 23 18:37:13 2016
@@ -40,6 +40,7 @@ int main ()
 #endif
 Derived &d = test_bad_cast(gB);
 assert(false);
+((void)d);
 #ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
 } catch (std::bad_cast) {
 // success

Modified: libcxxabi/trunk/test/test_aux_runtime.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_aux_runtime.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==
--- libcxxabi/trunk/test/test_aux_runtime.pass.cpp (original)
+++ libcxxabi/trunk/test/test_aux_runtime.pass.cpp Fri Dec 23 18:37:13 2016
@@ -28,8 +28,8 @@ bool bad_typeid_test () {
 class B { virtual void g() {}}; 
 
 B *bp = NULL;
-try {bool b = typeid(*bp) == typeid (A); }
-catch ( const std::bad_typeid &bc ) { return true; }
+try {bool b = typeid(*bp) == typeid (A); ((void)b); }
+catch ( const std::bad_typeid &) { return true; }
 return false;
 }
 
@@ -44,12 +44,12 @@ bool bad_cast_test () {
 
 D d;
 B *bp = (B*)&d; // cast needed to break protection
-try { D &dr = dynamic_cast (*bp); }
-catch ( const std::bad_cast &bc ) { return true; }
+try { D &dr = dynamic_cast (*bp); ((void)dr); }
+catch ( const std::bad_cast & ) { return true; }
 return false;
 }
 
-int main ( int argc, char *argv [] ) {
+int main ( ) {
 int ret_val = 0;
 
 if ( !bad_typeid_test ()) {

Modified: libcxxabi/trunk/test/test_aux_runtime_op_array_new.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_aux_runtime_op_array_new.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==
--- libcxxabi/trunk/test/test_aux_runtime_op_array_new.pass.cpp (original)
+++ libcxxabi/trunk/test/test_aux_runtime_op_array_new.pass.cpp Fri Dec 23 
18:37:13 2016
@@ -28,7 +28,7 @@ bool bad_array_new_length_test() {
 return false;
 }
 
-int main(int argc, char *argv []) {
+int main() {
 int ret_val = 0;
 
 if ( !bad_array_new_length_test ()) {

Modified: libcxxabi/trunk/test/test_exception_storage.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_exception_storage.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==
--- libcxxabi/trunk/test/test_exception_storage.pass.cpp (original)
+++ libcxxabi/trunk/test/test_exception_storage.pass.cpp Fri Dec 23 18:37:13 
2016
@@ -42,7 +42,7 @@ size_t thread_globals [
 __libcxxabi_thread_t   threads[ NUMTHREADS ];
 #endif
 
-int main ( int argc, char *argv [] ) {
+int main () {
 int retVal = 0;
 
 #ifndef _LIBCXXABI_HAS_NO_THREADS

Modified: libcxxabi/trunk/test/test_fallback_malloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_fallback_malloc.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==
--- libcxxabi/trunk/test/test_fallback_malloc.pass.cpp (original)
+++ libcxxabi/trunk/test/test_fallback_malloc.pass.cpp Fri D

[libcxx] r290472 - fix newly failing c++03 tests

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 18:40:45 2016
New Revision: 290472

URL: http://llvm.org/viewvc/llvm-project?rev=290472&view=rev
Log:
fix newly failing c++03 tests

Modified:

libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp

libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp

Modified: 
libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp?rev=290472&r1=290471&r2=290472&view=diff
==
--- 
libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp
 Fri Dec 23 18:40:45 2016
@@ -44,8 +44,9 @@ int test1 = 0;
 int test2 = 0;
 
 int runs = 0;
+bool expect_result = false;
 
-void f(bool expect_result)
+void f()
 {
 typedef std::chrono::system_clock Clock;
 typedef std::chrono::milliseconds milliseconds;
@@ -73,8 +74,9 @@ void f(bool expect_result)
 int main()
 {
 {
+expect_result = true;
 L1 lk(m0);
-std::thread t(f, /*expect_result*/true);
+std::thread t(f);
 assert(test1 == 0);
 while (test1 == 0)
 cv.wait(lk);
@@ -87,8 +89,9 @@ int main()
 test1 = 0;
 test2 = 0;
 {
+expect_result = false;
 L1 lk(m0);
-std::thread t(f, /*expect_result*/false);
+std::thread t(f);
 assert(test1 == 0);
 while (test1 == 0)
 cv.wait(lk);

Modified: 
libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp?rev=290472&r1=290471&r2=290472&view=diff
==
--- 
libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp
 Fri Dec 23 18:40:45 2016
@@ -57,6 +57,7 @@ constexpr decltype(std::placeholders::_1
 #endif // TEST_STD_VER >= 11
 
 void use_placeholders_to_prevent_unused_warning() {
+#if TEST_STD_VER >= 11
   ((void)cp1);
   ((void)cp2);
   ((void)cp3);
@@ -77,6 +78,7 @@ void use_placeholders_to_prevent_unused_
   ((void)default8);
   ((void)default9);
   ((void)default10);
+#endif
 }
 
 int main()


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


[libcxx] r290473 - Fix missed sign-compare warning

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 18:44:20 2016
New Revision: 290473

URL: http://llvm.org/viewvc/llvm-project?rev=290473&view=rev
Log:
Fix missed sign-compare warning

Modified:

libcxx/trunk/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp

Modified: 
libcxx/trunk/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp?rev=290473&r1=290472&r2=290473&view=diff
==
--- 
libcxx/trunk/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp
 Fri Dec 23 18:44:20 2016
@@ -27,7 +27,7 @@ int main()
 // interesting state.
 Myconv myconv;
 myconv.from_bytes("\xF1\x80\x80\x83");
-const int old_converted = myconv.converted();
+const auto old_converted = myconv.converted();
 assert(myconv.converted() == 4);
 // move construct a new converter and make sure the state is the same.
 Myconv myconv2(std::move(myconv));


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


[libcxx] r290474 - fix warnings only produced by apple-clang

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 19:07:54 2016
New Revision: 290474

URL: http://llvm.org/viewvc/llvm-project?rev=290474&view=rev
Log:
fix warnings only produced by apple-clang

Modified:
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/list.cons/size_type.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector.bool/construct_size.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp

libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp

libcxx/trunk/test/std/re/re.submatch/re.submatch.members/compare_string_type.pass.cpp

libcxx/trunk/test/std/re/re.submatch/re.submatch.members/compare_value_type_ptr.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size.pass.cpp?rev=290474&r1=290473&r2=290474&view=diff
==
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size.pass.cpp 
Fri Dec 23 19:07:54 2016
@@ -33,12 +33,12 @@ test2(unsigned n)
 assert(static_cast(DefaultOnly::count) == n);
 assert(d.size() == n);
 assert(static_cast(distance(d.begin(), d.end())) == d.size());
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
 assert(*i == T());
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }
 assert(DefaultOnly::count == 0);
+#else
+((void)n);
 #endif
 }
 
@@ -54,10 +54,10 @@ test1(unsigned n)
 assert(static_cast(DefaultOnly::count) == n);
 assert(d.size() == n);
 assert(static_cast(distance(d.begin(), d.end())) == d.size());
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
 for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
 assert(*i == T());
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
 }
 assert(DefaultOnly::count == 0);
 }
@@ -74,6 +74,9 @@ test3(unsigned n, Allocator const &alloc
 assert(d.size() == n);
 assert(d.get_allocator() == alloc);
 }
+#else
+((void)n);
+((void)alloc);
 #endif
 }
 

Modified: 
libcxx/trunk/test/std/containers/sequences/list/list.cons/size_type.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/size_type.pass.cpp?rev=290474&r1=290473&r2=290474&view=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/list/list.cons/size_type.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/containers/sequences/list/list.cons/size_type.pass.cpp 
Fri Dec 23 19:07:54 2016
@@ -32,6 +32,9 @@ test3(unsigned n, Allocator const &alloc
 assert(static_cast(std::distance(d.begin(), d.end())) == n);
 assert(d.get_allocator() == alloc);
 }
+#else
+((void)n);
+((void)alloc);
 #endif
 }
 
@@ -76,14 +79,12 @@ int main()
 test3> (3);
 }
 #endif
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
 {
 std::list l(3);
 assert(l.size() == 3);
 assert(std::distance(l.begin(), l.end()) == 3);
 }
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if TEST_STD_VER >= 11
 {
 std::list> l(3);
 assert(l.size() == 3);
@@ -95,12 +96,10 @@ int main()
 ++i;
 assert(*i == 0);
 }
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 {
 std::list> l(3);
 assert(l.size() == 3);
 assert(std::distance(l.begin(), l.end()) == 3);
 }
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 #endif
 }

Modified: 
libcxx/trunk/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector.bool/construct_size.pass.cpp?rev=290474&r1=290473&r2=290474&view=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/vector.bool/construct_size.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/containers/sequences/vector.bool/construct_size.pass.cpp 
Fri Dec 23 19:07:54 2016
@@ -31,6 +31,9 @@ test2(typename C::size_type n,
 assert(c.get_allocator() == a);
 for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
 assert(*i == typename C::value_type());
+#else
+  ((void)n);
+  ((void)a);
 #endif
 }
 

Modified: 
libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.cons/c

[libcxx] r290475 - Fix unused warning which only triggers in C++11

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 19:12:28 2016
New Revision: 290475

URL: http://llvm.org/viewvc/llvm-project?rev=290475&view=rev
Log:
Fix unused warning which only triggers in C++11

Modified:

libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp

Modified: 
libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp?rev=290475&r1=290474&r2=290475&view=diff
==
--- 
libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
 Fri Dec 23 19:12:28 2016
@@ -113,4 +113,7 @@ int main()
 static_assert(it1->get() == gC.get(), "");
 }
 #endif
+{
+((void)gC);
+}
 }


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


[PATCH] D27785: [libcxx] [test] Fix recently introduced warnings emitted by MSVC.

2016-12-23 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

`-Wsign-compare` has also landed :-) Now just `-Wconversion` to go (but that 
will likely take a while).


https://reviews.llvm.org/D27785



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


[libcxx] r290476 - Fix yet another missed -Wunused warning. Hopefully this is the last one

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 19:29:27 2016
New Revision: 290476

URL: http://llvm.org/viewvc/llvm-project?rev=290476&view=rev
Log:
Fix yet another missed -Wunused warning. Hopefully this is the last one

Modified:

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp?rev=290476&r1=290475&r2=290476&view=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
 Fri Dec 23 19:29:27 2016
@@ -28,6 +28,9 @@ void check_allocator(unsigned n, Allocat
 C d(n, alloc);
 assert(d.get_allocator() == alloc);
 assert(static_cast(std::distance(d.begin(), d.end())) == n);
+#else
+((void)n);
+((void)alloc);
 #endif
 }
 
@@ -39,12 +42,14 @@ int main()
 unsigned N = 10;
 C c(N);
 unsigned n = 0;
-for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) {
+#if TEST_STD_VER >= 11
 assert(*i == T());
 #else
-;
+((void)0);
 #endif
+}
 assert(n == N);
 }
 #if TEST_STD_VER >= 11
@@ -55,11 +60,7 @@ int main()
 C c(N);
 unsigned n = 0;
 for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 assert(*i == T());
-#else
-;
-#endif
 assert(n == N);
 check_allocator> ( 0 );
 check_allocator> ( 3 );


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


[PATCH] D27614: Mark tests as unsupported under libcpp-no-exceptions

2016-12-23 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.

I'm OK with this change. Although I'm not 100% sure it's needed, since the 
XFAIL seems to work for these tests. However using UNSUPPORTED is more 
consistent with other tests.


https://reviews.llvm.org/D27614



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


[libcxx] r290477 - Fix warning caused by platforms providing a signed wint_t

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 19:43:54 2016
New Revision: 290477

URL: http://llvm.org/viewvc/llvm-project?rev=290477&view=rev
Log:
Fix warning caused by platforms providing a signed wint_t

Modified:

libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp

Modified: 
libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp?rev=290477&r1=290476&r2=290477&view=diff
==
--- 
libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
 Fri Dec 23 19:43:54 2016
@@ -112,6 +112,7 @@ int main()
 assert(f.egptr() - f.gptr() == 1);
 }
 {
+typedef std::char_traits Traits;
 test_buf f;
 f.pubimbue(std::locale(LOCALE_en_US_UTF_8));
 assert(f.open("underflow_utf8.dat", std::ios_base::in) != 0);
@@ -119,6 +120,6 @@ int main()
 assert(f.sbumpc() == 0x4E51);
 assert(f.sbumpc() == 0x4E52);
 assert(f.sbumpc() == 0x4E53);
-assert(f.sbumpc() == static_cast(-1));
+assert(f.sbumpc() == static_cast(-1));
 }
 }


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


[PATCH] D27429: [Chrono][Darwin] On Darwin use CLOCK_UPTIME_RAW instead of CLOCK_MONOTONIC

2016-12-23 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF requested changes to this revision.
EricWF added a comment.
This revision now requires changes to proceed.

Marking as changes requested.

Please make sure we fall back to the old implementation on Apple platforms when 
`CLOCK_UPTIME_RAW` isn't available.


https://reviews.llvm.org/D27429



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


r290478 - clangCodeGen: Add LLVMPasses to libdeps. r290450 introduced it.

2016-12-23 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Fri Dec 23 19:55:12 2016
New Revision: 290478

URL: http://llvm.org/viewvc/llvm-project?rev=290478&view=rev
Log:
clangCodeGen: Add LLVMPasses to libdeps. r290450 introduced it.

Modified:
cfe/trunk/lib/CodeGen/CMakeLists.txt

Modified: cfe/trunk/lib/CodeGen/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CMakeLists.txt?rev=290478&r1=290477&r2=290478&view=diff
==
--- cfe/trunk/lib/CodeGen/CMakeLists.txt (original)
+++ cfe/trunk/lib/CodeGen/CMakeLists.txt Fri Dec 23 19:55:12 2016
@@ -14,6 +14,7 @@ set(LLVM_LINK_COMPONENTS
   MC
   ObjCARCOpts
   Object
+  Passes
   ProfileData
   ScalarOpts
   Support


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


[libcxx] r290479 - Avoid unused warning in __throw_future_error w/o exceptions enabled

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 19:56:25 2016
New Revision: 290479

URL: http://llvm.org/viewvc/llvm-project?rev=290479&view=rev
Log:
Avoid unused warning in __throw_future_error w/o exceptions enabled

Modified:
libcxx/trunk/include/future

Modified: libcxx/trunk/include/future
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/future?rev=290479&r1=290478&r2=290479&view=diff
==
--- libcxx/trunk/include/future (original)
+++ libcxx/trunk/include/future Fri Dec 23 19:56:25 2016
@@ -520,6 +520,7 @@ void __throw_future_error(future_errc _E
 #ifndef _LIBCPP_NO_EXCEPTIONS
 throw future_error(make_error_code(_Ev));
 #else
+((void)_Ev);
 _VSTD::abort();
 #endif
 }


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


[libcxx] r290480 - Fix sign-compare warnings on ARM platforms caused by wchar_t being unsigned

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 21:09:00 2016
New Revision: 290480

URL: http://llvm.org/viewvc/llvm-project?rev=290480&view=rev
Log:
Fix sign-compare warnings on ARM platforms caused by wchar_t being unsigned

Modified:
libcxx/trunk/test/std/re/re.traits/value.pass.cpp

Modified: libcxx/trunk/test/std/re/re.traits/value.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.traits/value.pass.cpp?rev=290480&r1=290479&r2=290480&view=diff
==
--- libcxx/trunk/test/std/re/re.traits/value.pass.cpp (original)
+++ libcxx/trunk/test/std/re/re.traits/value.pass.cpp Fri Dec 23 21:09:00 2016
@@ -82,15 +82,15 @@ int main()
 }
 for (wchar_t c = '0'; c < '8'; ++c)
 {
-assert(t.value(c, 8) == c - '0');
-assert(t.value(c, 10) == c - '0');
-assert(t.value(c, 16) == c - '0');
+assert(t.value(c, 8) ==  static_cast(c - '0'));
+assert(t.value(c, 10) == static_cast(c - '0'));
+assert(t.value(c, 16) == static_cast(c - '0'));
 }
 for (wchar_t c = '8'; c < ':'; ++c)
 {
 assert(t.value(c, 8) == -1);
-assert(t.value(c, 10) == c - '0');
-assert(t.value(c, 16) == c - '0');
+assert(t.value(c, 10) == static_cast(c - '0'));
+assert(t.value(c, 16) == static_cast(c - '0'));
 }
 for (wchar_t c = ':'; c < 'A'; ++c)
 {
@@ -102,7 +102,7 @@ int main()
 {
 assert(t.value(c, 8) == -1);
 assert(t.value(c, 10) == -1);
-assert(t.value(c, 16) == c - 'A' +10);
+assert(t.value(c, 16) == static_cast(c - 'A' +10));
 }
 for (wchar_t c = 'G'; c < 'a'; ++c)
 {
@@ -114,7 +114,7 @@ int main()
 {
 assert(t.value(c, 8) == -1);
 assert(t.value(c, 10) == -1);
-assert(t.value(c, 16) == c - 'a' +10);
+assert(t.value(c, 16) == static_cast(c - 'a' +10));
 }
 for (wchar_t c = 'g'; c < 0x; ++c)
 {


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


[libcxx] r290481 - Fix -Wsign-compare warnings in re tests that only run on OS X

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 21:20:53 2016
New Revision: 290481

URL: http://llvm.org/viewvc/llvm-project?rev=290481&view=rev
Log:
Fix -Wsign-compare warnings in re tests that only run on OS X

Modified:
libcxx/trunk/test/std/re/re.alg/re.alg.match/basic.pass.cpp
libcxx/trunk/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
libcxx/trunk/test/std/re/re.alg/re.alg.match/extended.pass.cpp
libcxx/trunk/test/std/re/re.alg/re.alg.search/awk.pass.cpp
libcxx/trunk/test/std/re/re.alg/re.alg.search/basic.pass.cpp
libcxx/trunk/test/std/re/re.alg/re.alg.search/ecma.pass.cpp
libcxx/trunk/test/std/re/re.alg/re.alg.search/extended.pass.cpp

Modified: libcxx/trunk/test/std/re/re.alg/re.alg.match/basic.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.alg/re.alg.match/basic.pass.cpp?rev=290481&r1=290480&r2=290481&view=diff
==
--- libcxx/trunk/test/std/re/re.alg/re.alg.match/basic.pass.cpp (original)
+++ libcxx/trunk/test/std/re/re.alg/re.alg.match/basic.pass.cpp Fri Dec 23 
21:20:53 2016
@@ -387,7 +387,7 @@ int main()
 assert(!m.suffix().matched);
 assert(m.suffix().first == m[0].second);
 assert(m.suffix().second == m[0].second);
-assert(m.length(0) == std::char_traits::length(s));
+assert(m.length(0) >= 0 && static_cast(m.length(0)) == 
std::char_traits::length(s));
 assert(m.position(0) == 0);
 assert(m.str(0) == s);
 assert(m.length(1) == 2);
@@ -405,7 +405,7 @@ int main()
 assert(!m.suffix().matched);
 assert(m.suffix().first == m[0].second);
 assert(m.suffix().second == m[0].second);
-assert(m.length(0) == std::char_traits::length(s));
+assert(m.length(0) >= 0 && static_cast(m.length(0)) == 
std::char_traits::length(s));
 assert(m.position(0) == 0);
 assert(m.str(0) == s);
 assert(m.length(1) == 3);
@@ -430,7 +430,7 @@ int main()
 assert(!m.suffix().matched);
 assert(m.suffix().first == m[0].second);
 assert(m.suffix().second == m[0].second);
-assert(m.length(0) == std::char_traits::length(s));
+assert(m.length(0) >= 0 && static_cast(m.length(0)) == 
std::char_traits::length(s));
 assert(m.position(0) == 0);
 assert(m.str(0) == s);
 assert(m.length(1) == 3);
@@ -525,7 +525,7 @@ int main()
 assert(!m.suffix().matched);
 assert(m.suffix().first == m[0].second);
 assert(m.suffix().second == m[0].second);
-assert(m.length(0) == std::char_traits::length(s));
+assert(m.length(0) >= 0 && static_cast(m.length(0)) == 
std::char_traits::length(s));
 assert(m.position(0) == 0);
 assert(m.str(0) == s);
 }
@@ -548,7 +548,7 @@ int main()
 assert(!m.suffix().matched);
 assert(m.suffix().first == m[0].second);
 assert(m.suffix().second == m[0].second);
-assert(m.length(0) == std::char_traits::length(s));
+assert(m.length(0) >= 0 && static_cast(m.length(0)) == 
std::char_traits::length(s));
 assert(m.position(0) == 0);
 assert(m.str(0) == s);
 }
@@ -578,7 +578,7 @@ int main()
 assert(!m.suffix().matched);
 assert(m.suffix().first == m[0].second);
 assert(m.suffix().second == m[0].second);
-assert(m.length(0) == std::char_traits::length(s));
+assert(m.length(0) >= 0 && static_cast(m.length(0)) == 
std::char_traits::length(s));
 assert(m.position(0) == 0);
 assert(m.str(0) == s);
 }
@@ -594,7 +594,7 @@ int main()
 assert(!m.suffix().matched);
 assert(m.suffix().first == m[0].second);
 assert(m.suffix().second == m[0].second);
-assert(m.length(0) == std::char_traits::length(s));
+assert(m.length(0) >= 0 && static_cast(m.length(0)) == 
std::char_traits::length(s));
 assert(m.position(0) == 0);
 assert(m.str(0) == s);
 }
@@ -610,7 +610,7 @@ int main()
 assert(!m.suffix().matched);
 assert(m.suffix().first == m[0].second);
 assert(m.suffix().second == m[0].second);
-assert(m.length(0) == std::char_traits::length(s));
+assert(m.length(0) >= 0 && static_cast(m.length(0)) == 
std::char_traits::length(s));
 assert(m.position(0) == 0);
 assert(m.str(0) == s);
 }
@@ -634,7 +634,7 @@ int main()
 assert(!m.suffix().matched);
 assert(m.suffix().first == m[0].second);
 assert(m.suffix().second == m[0].second);
-assert(m.length(0) == std::char_traits::length(s));
+assert(m.length(0) >= 0 && static_cast(m.length(0)) == 
std::char_traits::length(s));
 assert(m.position(0) == 0);
 assert(m.str(0) == s);
 }
@@ -650,7 +650,7 @@ int main()
 assert(!m.suffix().matched);
 assert(m.suffix().first == m[0].second);
 assert(m.suffix().second == m[0].second);
-   

[libcxx] r290482 - Fix ASAN test failure

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 21:27:52 2016
New Revision: 290482

URL: http://llvm.org/viewvc/llvm-project?rev=290482&view=rev
Log:
Fix ASAN test failure

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

Modified: libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp?rev=290482&r1=290481&r2=290482&view=diff
==
--- libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp 
(original)
+++ libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp Fri Dec 
23 21:27:52 2016
@@ -38,7 +38,8 @@ int main()
 const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
 C c(std::begin(t), std::end(t));
 c.reserve(2*c.size());
-T foo = c[c.size()];// bad, but not caught by ASAN
+volatile T foo = c[c.size()];// bad, but not caught by ASAN
+((void)foo);
 }
 #endif
 
@@ -64,6 +65,7 @@ int main()
 assert(!__sanitizer_verify_contiguous_container( c.data(), c.data() + 
1, c.data() + c.capacity()));
 volatile T foo = c[c.size()]; // should trigger ASAN. Use volatile to 
prevent being optimized away.
 assert(false);  // if we got here, ASAN didn't trigger
+((void)foo);
 }
 }
 #else


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


[PATCH] D27575: [libcxxabi] Introduce an externally threaded libc++abi variant (take-2)

2016-12-23 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. I'll re-review the mutexor changes post-commit.




Comment at: CMakeLists.txt:121
 option(LIBCXXABI_HAS_PTHREAD_API "Ignore auto-detection and force use of 
pthread API" OFF)
+option(LIBCXXABI_HAS_EXTERNAL_THREAD_API
+  "Build libc++abi with an externalized threading API.

rmaprath wrote:
> EricWF wrote:
> > Maybe use a dependent option that sets it to the value of 
> > `LIBCXX_ENABLE_THREADS` when it is defined?
> Are you referring to `CMAKE_DEPENDENT_OPTION` macro? I don't see this macro 
> used anywhere else in llvm, but I suppose that's not a concern?
> 
> Although, it would have to be something like:
> 
> ```
> CMAKE_DEPENDENT_OPTION(LIBCXXABI_HAS_EXTERNAL_THREAD_API "Externally Threaded 
> libcxxabi" OFF  "LIBCXX_ENABLE_THREADS" OFF)
> ```
> 
> Because, `LIBCXX_ENABLE_THREADS=ON` should not mean 
> `LIBCXXABI_HAS_EXTERNAL_THREAD_API=ON`.
> 
Ah OK. This looks good as is then.

Although it would be really nice if `LIBCXX_HAS_EXTERNAL_THREAD_API=ON` also 
enabled this option unless otherwise specified, but I don't see an easy way to 
do that. 



Comment at: src/fallback_malloc.cpp:37
 class mutexor {
 public:

rmaprath wrote:
> EricWF wrote:
> > Can't we replace this class with `std::mutex` directly?
> Again, I should've included more context to the patch :(
> 
> The `mutexor` here is supposed to degrade to a nop when threading is 
> disabled. I think we cannot use `std::mutex` without threading support.
> 
> Will update the patch with more context.
We cannot use `std::mutex` without threading support but I would still rather 
use it.

I would `typedef std::lock_guard mutexor` when threading is enabled 
and otherwise I would just `#ifdef` all usages away.

Also please add `_LIBCPP_SAFE_STATIC` to the heap_mutex declaration.


https://reviews.llvm.org/D27575



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


[PATCH] D27576: [libcxx] libc++ changes necessary for the externally threaded libcxxabi variant

2016-12-23 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.




Comment at: test/CMakeLists.txt:58
 
 if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
+  set(LIBCXX_TEST_DEPS cxx_experimental)

I always prefer `set(LIBCXX_TEST_DEPS "")` to initialize an empty list. Then 
`list(APPEND LIBCXX_TEST_DEPS cxx_experimental)` to add new items.


https://reviews.llvm.org/D27576



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


r290483 - When producing a name of a partial specialization in a diagnostic, use the

2016-12-23 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Dec 23 22:09:05 2016
New Revision: 290483

URL: http://llvm.org/viewvc/llvm-project?rev=290483&view=rev
Log:
When producing a name of a partial specialization in a diagnostic, use the
template arguments as written rather than the canonical template arguments,
so we print more user-friendly names for template parameters.

Modified:
cfe/trunk/include/clang/AST/TemplateBase.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/DeclTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp
cfe/trunk/test/Modules/cxx-templates.cpp
cfe/trunk/test/SemaTemplate/deduction.cpp
cfe/trunk/test/SemaTemplate/instantiation-default-1.cpp
cfe/trunk/test/SemaTemplate/ms-class-specialization-class-scope.cpp

Modified: cfe/trunk/include/clang/AST/TemplateBase.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=290483&r1=290482&r2=290483&view=diff
==
--- cfe/trunk/include/clang/AST/TemplateBase.h (original)
+++ cfe/trunk/include/clang/AST/TemplateBase.h Fri Dec 23 22:09:05 2016
@@ -596,6 +596,10 @@ public:
 return getTrailingObjects();
   }
 
+  llvm::ArrayRef arguments() const {
+return llvm::makeArrayRef(getTemplateArgs(), NumTemplateArgs);
+  }
+
   const TemplateArgumentLoc &operator[](unsigned I) const {
 return getTemplateArgs()[I];
   }

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=290483&r1=290482&r2=290483&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Dec 23 22:09:05 
2016
@@ -4103,9 +4103,9 @@ def note_template_class_instantiation_wa
 def note_template_class_explicit_specialization_was_here : Note<
   "class template %0 was explicitly specialized here">;
 def note_template_class_instantiation_here : Note<
-  "in instantiation of template class %0 requested here">;
+  "in instantiation of template class %q0 requested here">;
 def note_template_member_class_here : Note<
-  "in instantiation of member class %0 requested here">;
+  "in instantiation of member class %q0 requested here">;
 def note_template_member_function_here : Note<
   "in instantiation of member function %q0 requested here">;
 def note_function_template_spec_here : Note<

Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=290483&r1=290482&r2=290483&view=diff
==
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Fri Dec 23 22:09:05 2016
@@ -725,9 +725,16 @@ void ClassTemplateSpecializationDecl::ge
 raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const {
   NamedDecl::getNameForDiagnostic(OS, Policy, Qualified);
 
-  const TemplateArgumentList &TemplateArgs = getTemplateArgs();
-  TemplateSpecializationType::PrintTemplateArgumentList(
-  OS, TemplateArgs.asArray(), Policy);
+  auto *PS = dyn_cast(this);
+  if (const ASTTemplateArgumentListInfo *ArgsAsWritten =
+  PS ? PS->getTemplateArgsAsWritten() : nullptr) {
+TemplateSpecializationType::PrintTemplateArgumentList(
+OS, ArgsAsWritten->arguments(), Policy);
+  } else {
+const TemplateArgumentList &TemplateArgs = getTemplateArgs();
+TemplateSpecializationType::PrintTemplateArgumentList(
+OS, TemplateArgs.asArray(), Policy);
+  }
 }
 
 ClassTemplateDecl *
@@ -1057,9 +1064,16 @@ void VarTemplateSpecializationDecl::getN
 raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const {
   NamedDecl::getNameForDiagnostic(OS, Policy, Qualified);
 
-  const TemplateArgumentList &TemplateArgs = getTemplateArgs();
-  TemplateSpecializationType::PrintTemplateArgumentList(
-  OS, TemplateArgs.asArray(), Policy);
+  auto *PS = dyn_cast(this);
+  if (const ASTTemplateArgumentListInfo *ArgsAsWritten =
+  PS ? PS->getTemplateArgsAsWritten() : nullptr) {
+TemplateSpecializationType::PrintTemplateArgumentList(
+OS, ArgsAsWritten->arguments(), Policy);
+  } else {
+const TemplateArgumentList &TemplateArgs = getTemplateArgs();
+TemplateSpecializationType::PrintTemplateArgumentList(
+OS, TemplateArgs.asArray(), Policy);
+  }
 }
 
 VarTemplateDecl *VarTemplateSpecializationDecl::getSpecializedTemplate() const 
{

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=290483&r1=290482&r2=290483&view=diff

r290484 - Fix crash if substitution fails during deduction of variable template partial specialization arguments.

2016-12-23 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Dec 23 22:20:31 2016
New Revision: 290484

URL: http://llvm.org/viewvc/llvm-project?rev=290484&view=rev
Log:
Fix crash if substitution fails during deduction of variable template partial 
specialization arguments.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/test/SemaTemplate/deduction.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=290484&r1=290483&r2=290484&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Dec 23 22:20:31 
2016
@@ -4145,9 +4145,9 @@ def note_explicit_template_arg_substitut
 def note_function_template_deduction_instantiation_here : Note<
   "while substituting deduced template arguments into function template %0 "
   "%1">;
-def note_partial_spec_deduct_instantiation_here : Note<
-  "during template argument deduction for class template partial "
-  "specialization %0 %1">;
+def note_deduced_template_arg_substitution_here : Note<
+  "during template argument deduction for %select{class|variable}0 template "
+  "partial specialization %1 %2">;
 def note_prior_template_arg_substitution : Note<
   "while substituting prior template arguments into 
%select{non-type|template}0"
   " template parameter%1 %2">;

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=290484&r1=290483&r2=290484&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Dec 23 22:20:31 2016
@@ -6749,7 +6749,7 @@ public:
   /// We are substituting template argument determined as part of
   /// template argument deduction for either a class template
   /// partial specialization or a function template. The
-  /// Entity is either a ClassTemplatePartialSpecializationDecl or
+  /// Entity is either a {Class|Var}TemplatePartialSpecializationDecl or
   /// a FunctionTemplateDecl.
   DeducedTemplateArgumentSubstitution,
 

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=290484&r1=290483&r2=290484&view=diff
==
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Fri Dec 23 22:20:31 2016
@@ -484,29 +484,40 @@ void Sema::PrintInstantiationStack() {
   break;
 }
 
-case ActiveTemplateInstantiation::DeducedTemplateArgumentSubstitution:
-  if (ClassTemplatePartialSpecializationDecl *PartialSpec =
-dyn_cast(Active->Entity)) {
+case ActiveTemplateInstantiation::DeducedTemplateArgumentSubstitution: {
+  if (FunctionTemplateDecl *FnTmpl =
+  dyn_cast(Active->Entity)) {
 Diags.Report(Active->PointOfInstantiation,
- diag::note_partial_spec_deduct_instantiation_here)
-  << PartialSpec
-  << getTemplateArgumentBindingsText(
- PartialSpec->getTemplateParameters(), 
+ diag::note_function_template_deduction_instantiation_here)
+  << FnTmpl
+  << getTemplateArgumentBindingsText(FnTmpl->getTemplateParameters(), 
  Active->TemplateArgs, 
  Active->NumTemplateArgs)
   << Active->InstantiationRange;
   } else {
-FunctionTemplateDecl *FnTmpl
-  = cast(Active->Entity);
+bool IsVar = isa(Active->Entity) ||
+ isa(Active->Entity);
+TemplateParameterList *Params;
+if (auto *D = dyn_cast(
+   Active->Entity)) {
+  Params = D->getTemplateParameters();
+} else if (auto *D = dyn_cast(
+   Active->Entity)) {
+  Params = D->getTemplateParameters();
+} else {
+  llvm_unreachable("unexpected template kind");
+}
+
+  //<< Context.getTypeDeclType(PartialSpec)
 Diags.Report(Active->PointOfInstantiation,
- diag::note_function_template_deduction_instantiation_here)
-  << FnTmpl
-  << getTemplateArgumentBindingsText(FnTmpl->getTemplateParameters(), 
- Active->TemplateArgs, 
+ diag::note_deduced_template_arg_substitution_here)
+  << IsVar << cast(Active->Entity)
+  << getTemplateArgumentBindingsText(Params, Active->TemplateArgs, 
  

r290485 - Remove accidentally-left-behind commented out code.

2016-12-23 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Dec 23 22:22:52 2016
New Revision: 290485

URL: http://llvm.org/viewvc/llvm-project?rev=290485&view=rev
Log:
Remove accidentally-left-behind commented out code.

Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=290485&r1=290484&r2=290485&view=diff
==
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Fri Dec 23 22:22:52 2016
@@ -508,7 +508,6 @@ void Sema::PrintInstantiationStack() {
   llvm_unreachable("unexpected template kind");
 }
 
-  //<< Context.getTypeDeclType(PartialSpec)
 Diags.Report(Active->PointOfInstantiation,
  diag::note_deduced_template_arg_substitution_here)
   << IsVar << cast(Active->Entity)


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


[libcxx] r290486 - Enable -Wunreachable-code and fix duplicate warning flags

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 22:34:33 2016
New Revision: 290486

URL: http://llvm.org/viewvc/llvm-project?rev=290486&view=rev
Log:
Enable -Wunreachable-code and fix duplicate warning flags

Modified:
libcxx/trunk/test/libcxx/compiler.py
libcxx/trunk/test/libcxx/test/config.py
libcxx/trunk/test/std/thread/futures/futures.async/async.pass.cpp

Modified: libcxx/trunk/test/libcxx/compiler.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/compiler.py?rev=290486&r1=290485&r2=290486&view=diff
==
--- libcxx/trunk/test/libcxx/compiler.py (original)
+++ libcxx/trunk/test/libcxx/compiler.py Fri Dec 23 22:34:33 2016
@@ -147,9 +147,6 @@ class CXXCompiler(object):
 cmd += flags
 return cmd
 
-def _getWarningFlags(self):
-return self.warning_flags if self.use_warnings else []
-
 def preprocessCmd(self, source_files, out=None, flags=[]):
 return self._basicCmd(source_files, out, flags=flags,
  mode=self.CM_PreProcess,
@@ -277,22 +274,21 @@ class CXXCompiler(object):
 another error is triggered during compilation.
 """
 assert isinstance(flag, str)
+assert flag.startswith('-W')
 if not flag.startswith('-Wno-'):
-if self.hasCompileFlag(flag):
-self.warning_flags += [flag]
-return True
-return False
+return self.hasCompileFlag(flag)
 flags = ['-Werror', flag]
 old_use_warnings = self.use_warnings
 self.useWarnings(False)
 cmd = self.compileCmd('-', os.devnull, flags)
-self.useWarnings(True)
+self.useWarnings(old_use_warnings)
 # Remove '-v' because it will cause the command line invocation
 # to be printed as part of the error output.
 # TODO(EricWF): Are there other flags we need to worry about?
 if '-v' in cmd:
 cmd.remove('-v')
 out, err, rc = lit.util.executeCommand(cmd, input='#error\n')
+
 assert rc != 0
 if flag in err:
 return False
@@ -300,6 +296,7 @@ class CXXCompiler(object):
 
 def addWarningFlagIfSupported(self, flag):
 if self.hasWarningFlag(flag):
+assert flag not in self.warning_flags
 self.warning_flags += [flag]
 return True
 return False

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=290486&r1=290485&r2=290486&view=diff
==
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Fri Dec 23 22:34:33 2016
@@ -646,6 +646,7 @@ class Configuration(object):
 enable_warnings = self.get_lit_bool('enable_warnings',
 default_enable_warnings)
 if enable_warnings:
+self.cxx.useWarnings(True)
 self.cxx.warning_flags += [
 '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER',
 '-Wall', '-Wextra', '-Werror'
@@ -662,6 +663,7 @@ class Configuration(object):
 self.cxx.addWarningFlagIfSupported('-Wsign-compare')
 self.cxx.addWarningFlagIfSupported('-Wunused-variable')
 self.cxx.addWarningFlagIfSupported('-Wunused-parameter')
+self.cxx.addWarningFlagIfSupported('-Wunreachable-code')
 # FIXME: Enable the two warnings below.
 self.cxx.addWarningFlagIfSupported('-Wno-conversion')
 self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')

Modified: libcxx/trunk/test/std/thread/futures/futures.async/async.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/futures/futures.async/async.pass.cpp?rev=290486&r1=290485&r2=290486&view=diff
==
--- libcxx/trunk/test/std/thread/futures/futures.async/async.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/futures/futures.async/async.pass.cpp Fri Dec 
23 22:34:33 2016
@@ -72,7 +72,8 @@ std::unique_ptr f4(std::unique_ptr<
 void f5(int j)
 {
 std::this_thread::sleep_for(ms(200));
-TEST_THROW(j); ((void)j);
+((void)j);
+TEST_THROW(j);
 }
 
 template 


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


[libcxxabi] r290487 - Suppress unreachable code warning in unwind tests

2016-12-23 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Dec 23 23:01:55 2016
New Revision: 290487

URL: http://llvm.org/viewvc/llvm-project?rev=290487&view=rev
Log:
Suppress unreachable code warning in unwind tests

Modified:
libcxxabi/trunk/test/unwind_01.pass.cpp
libcxxabi/trunk/test/unwind_02.pass.cpp
libcxxabi/trunk/test/unwind_03.pass.cpp
libcxxabi/trunk/test/unwind_04.pass.cpp
libcxxabi/trunk/test/unwind_05.pass.cpp

Modified: libcxxabi/trunk/test/unwind_01.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/unwind_01.pass.cpp?rev=290487&r1=290486&r2=290487&view=diff
==
--- libcxxabi/trunk/test/unwind_01.pass.cpp (original)
+++ libcxxabi/trunk/test/unwind_01.pass.cpp Fri Dec 23 23:01:55 2016
@@ -11,6 +11,10 @@
 
 #include 
 
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunreachable-code"
+#endif
+
 struct A
 {
 static int count;

Modified: libcxxabi/trunk/test/unwind_02.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/unwind_02.pass.cpp?rev=290487&r1=290486&r2=290487&view=diff
==
--- libcxxabi/trunk/test/unwind_02.pass.cpp (original)
+++ libcxxabi/trunk/test/unwind_02.pass.cpp Fri Dec 23 23:01:55 2016
@@ -11,6 +11,10 @@
 
 #include 
 
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunreachable-code"
+#endif
+
 struct A
 {
 static int count;

Modified: libcxxabi/trunk/test/unwind_03.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/unwind_03.pass.cpp?rev=290487&r1=290486&r2=290487&view=diff
==
--- libcxxabi/trunk/test/unwind_03.pass.cpp (original)
+++ libcxxabi/trunk/test/unwind_03.pass.cpp Fri Dec 23 23:01:55 2016
@@ -13,6 +13,10 @@
 #include 
 #include 
 
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunreachable-code"
+#endif
+
 struct A
 {
 static int count;

Modified: libcxxabi/trunk/test/unwind_04.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/unwind_04.pass.cpp?rev=290487&r1=290486&r2=290487&view=diff
==
--- libcxxabi/trunk/test/unwind_04.pass.cpp (original)
+++ libcxxabi/trunk/test/unwind_04.pass.cpp Fri Dec 23 23:01:55 2016
@@ -13,6 +13,10 @@
 #include 
 #include 
 
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunreachable-code"
+#endif
+
 struct A
 {
 static int count;

Modified: libcxxabi/trunk/test/unwind_05.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/unwind_05.pass.cpp?rev=290487&r1=290486&r2=290487&view=diff
==
--- libcxxabi/trunk/test/unwind_05.pass.cpp (original)
+++ libcxxabi/trunk/test/unwind_05.pass.cpp Fri Dec 23 23:01:55 2016
@@ -13,6 +13,10 @@
 #include 
 #include 
 
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunreachable-code"
+#endif
+
 struct A
 {
 static int count;


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


[PATCH] D28081: Make GetStyle return Expected instead of FormatStyle

2016-12-23 Thread Antonio Maiorano via Phabricator via cfe-commits
amaiorano added inline comments.



Comment at: unittests/Format/FormatTestObjC.cpp:72
 TEST_F(FormatTestObjC, DetectsObjCInHeaders) {
-  Style = getStyle("LLVM", "a.h", "none", "@interface\n"
+  Style = *getStyle("LLVM", "a.h", "none", "@interface\n"
   "- (id)init;");

In these tests, I'm assuming getStyle returns a valid FormatSyle. I could add 
the same types of validation as in the FormatStyle.GetStyleOfFile tests.


https://reviews.llvm.org/D28081



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


[PATCH] D13289: [libc++] Provide additional templates for valarray transcendentals that satisfy the standard synopsis

2016-12-23 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

wow this is old. I'll try and re-review before the new year.


https://reviews.llvm.org/D13289



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


[PATCH] D27513: Move clang's ParseHelper into Support (clang part)

2016-12-23 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF resigned from this revision.
EricWF removed a reviewer: EricWF.
EricWF added a comment.

Resigning as a reviewer since I don't feel comfortable reviewing generic LLVM 
patches.


Repository:
  rL LLVM

https://reviews.llvm.org/D27513



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


[PATCH] D27658: [libcxx] Fix all occurrences of -Wsign-compare in the headers

2016-12-23 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF abandoned this revision.
EricWF added a comment.

Another fix was applied for this.


https://reviews.llvm.org/D27658



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


[PATCH] D27153: [libc++] Make __num_get_float hidden

2016-12-23 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

LGTM.


https://reviews.llvm.org/D27153



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


[PATCH] D27402: [libc++] Implement pmr::monotonic_buffer_resource

2016-12-23 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a reviewer: EricWF.
EricWF added a comment.
This revision is now accepted and ready to land.

This review hasn't generated any interest in ~3 weeks. Accepting for 
post-commit review.


https://reviews.llvm.org/D27402



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