[libcxx] r342103 - Mark LWG#3102 as complete. No code changes, but I updated a test or two

2018-09-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Sep 12 19:23:52 2018
New Revision: 342103

URL: http://llvm.org/viewvc/llvm-project?rev=342103=rev
Log:
Mark LWG#3102 as complete. No code changes, but I updated a test or two

Modified:
libcxx/trunk/test/std/containers/views/span.iterators/end.pass.cpp
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/test/std/containers/views/span.iterators/end.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/views/span.iterators/end.pass.cpp?rev=342103=342102=342103=diff
==
--- libcxx/trunk/test/std/containers/views/span.iterators/end.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/views/span.iterators/end.pass.cpp Wed Sep 
12 19:23:52 2018
@@ -32,8 +32,11 @@ constexpr bool testConstexprSpan(Span s)
 }
 else
 {
+   typename Span::const_pointer last = &*(s.cbegin() + s.size() - 1);
 ret = ret &&  ( e !=  s.begin());
 ret = ret &&  (ce != s.cbegin());
+ret = ret &&  (&*( e-1) == last);
+ret = ret &&  (&*(ce-1) == last);
 }
 
 ret = ret &&  (( e -  s.begin()) == s.size());
@@ -55,8 +58,11 @@ void testRuntimeSpan(Span s)
 }
 else
 {
+   typename Span::const_pointer last = &*(s.cbegin() + s.size() - 1);
 assert( e !=  s.begin());
 assert(ce != s.cbegin());
+assert( &*( e-1) == last);
+assert( &*(ce-1) == last);
 }
 
 assert(( e -  s.begin()) == s.size());

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=342103=342102=342103=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Wed Sep 12 19:23:52 2018
@@ -216,7 +216,7 @@
https://wg21.link/LWG3083;>3083What 
should ios::iword(-1) do?RapperswilNothing to 
do
https://wg21.link/LWG3094;>3094[time.duration.io]p4 makes 
surprising claims about encodingRapperswil
https://wg21.link/LWG3100;>3100Unnecessary and confusing 
"empty span" wordingRapperswilNothing to do
-   https://wg21.link/LWG3102;>3102Clarify 
span iterator and const_iterator behaviorRapperswil
+   https://wg21.link/LWG3102;>3102Clarify 
span iterator and const_iterator 
behaviorRapperswilComplete
https://wg21.link/LWG3104;>3104Fixing 
duration divisionRapperswilComplete
 
 


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


r342100 - [AArch64] Support reserving x1-7 registers.

2018-09-12 Thread Tri Vo via cfe-commits
Author: trong
Date: Wed Sep 12 16:45:04 2018
New Revision: 342100

URL: http://llvm.org/viewvc/llvm-project?rev=342100=rev
Log:
[AArch64] Support reserving x1-7 registers.

Summary: Reserving registers x1-7 is used to support CONFIG_ARM64_LSE_ATOMICS 
in Linux kernel. This change adds support for reserving registers x1 through x7.

Reviewers: javed.absar, efriedma, nickdesaulniers, srhines, phosek

Reviewed By: nickdesaulniers

Subscribers: manojgupta, jfb, cfe-commits, kristof.beyls

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

Added:
cfe/trunk/test/Driver/aarch64-fixed-x-register.c
Removed:
cfe/trunk/test/Driver/aarch64-fixed-x18.c
cfe/trunk/test/Driver/aarch64-fixed-x20.c
Modified:
cfe/trunk/docs/ClangCommandLineReference.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp

Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=342100=342099=342100=diff
==
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Wed Sep 12 16:45:04 2018
@@ -2298,6 +2298,34 @@ The thread model to use, e.g. posix, sin
 
 AARCH64
 ---
+.. option:: -ffixed-x1
+
+Reserve the x1 register (AArch64 only)
+
+.. option:: -ffixed-x2
+
+Reserve the x2 register (AArch64 only)
+
+.. option:: -ffixed-x3
+
+Reserve the x3 register (AArch64 only)
+
+.. option:: -ffixed-x4
+
+Reserve the x4 register (AArch64 only)
+
+.. option:: -ffixed-x5
+
+Reserve the x5 register (AArch64 only)
+
+.. option:: -ffixed-x6
+
+Reserve the x6 register (AArch64 only)
+
+.. option:: -ffixed-x7
+
+Reserve the x7 register (AArch64 only)
+
 .. option:: -ffixed-x18
 
 Reserve the x18 register (AArch64 only)

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=342100=342099=342100=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Sep 12 16:45:04 2018
@@ -2050,10 +2050,9 @@ def mfix_cortex_a53_835769 : Flag<["-"],
 def mno_fix_cortex_a53_835769 : Flag<["-"], "mno-fix-cortex-a53-835769">,
   Group,
   HelpText<"Don't workaround Cortex-A53 erratum 835769 (AArch64 only)">;
-def ffixed_x18 : Flag<["-"], "ffixed-x18">, Group,
-  HelpText<"Reserve the x18 register (AArch64 only)">;
-def ffixed_x20 : Flag<["-"], "ffixed-x20">, Group,
-  HelpText<"Reserve the x20 register (AArch64 only)">;
+foreach i = {1-7,18,20} in
+  def ffixed_x#i : Flag<["-"], "ffixed-x"#i>, Group,
+HelpText<"Reserve the "#i#" register (AArch64 only)">;
 
 def msign_return_address : Joined<["-"], "msign-return-address=">,
   Flags<[CC1Option]>, Group,

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp?rev=342100=342099=342100=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp Wed Sep 12 16:45:04 2018
@@ -198,6 +198,27 @@ void aarch64::getAArch64TargetFeatures(c
 if (A->getOption().matches(options::OPT_mno_unaligned_access))
   Features.push_back("+strict-align");
 
+  if (Args.hasArg(options::OPT_ffixed_x1))
+Features.push_back("+reserve-x1");
+
+  if (Args.hasArg(options::OPT_ffixed_x2))
+Features.push_back("+reserve-x2");
+
+  if (Args.hasArg(options::OPT_ffixed_x3))
+Features.push_back("+reserve-x3");
+
+  if (Args.hasArg(options::OPT_ffixed_x4))
+Features.push_back("+reserve-x4");
+
+  if (Args.hasArg(options::OPT_ffixed_x5))
+Features.push_back("+reserve-x5");
+
+  if (Args.hasArg(options::OPT_ffixed_x6))
+Features.push_back("+reserve-x6");
+
+  if (Args.hasArg(options::OPT_ffixed_x7))
+Features.push_back("+reserve-x7");
+
   if (Args.hasArg(options::OPT_ffixed_x18))
 Features.push_back("+reserve-x18");
 

Added: cfe/trunk/test/Driver/aarch64-fixed-x-register.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-fixed-x-register.c?rev=342100=auto
==
--- cfe/trunk/test/Driver/aarch64-fixed-x-register.c (added)
+++ cfe/trunk/test/Driver/aarch64-fixed-x-register.c Wed Sep 12 16:45:04 2018
@@ -0,0 +1,71 @@
+// RUN: %clang -target aarch64-none-gnu -ffixed-x1 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X1 < %t %s
+// CHECK-FIXED-X1: "-target-feature" "+reserve-x1"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x2 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X2 < %t %s
+// CHECK-FIXED-X2: "-target-feature" "+reserve-x2"
+
+// RUN: %clang -target aarch64-none-gnu 

[PATCH] D51333: Diagnose likely typos in include statements

2018-09-12 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

Thanks, some comments but the approach here looks great.




Comment at: include/clang/Basic/DiagnosticLexKinds.td:428-429
+def err_pp_file_not_found_typo_not_fatal
+: Error<"'%0' file not found due to leading or trailing non-alphanumeric "
+"characters">;
 def err_pp_error_opening_file : Error<

Our usual convention is to phrase this as "'%0' file not found; did you mean 
'%1'?". I don't think we need to describe the exact process we used to figure 
out the intended filename here; the user should be able to compare the names 
before and after to determine what we changed.



Comment at: lib/Lex/PPDirectives.cpp:1901
+FilenameLoc,
+LangOpts.MSVCCompat ? NormalizedPath.c_str() : Filename, false,
+LookupFrom, LookupFromFile, CurDir,

You're passing in `false` for `isAngled` here, and producing a double-quoted 
replacement below. Is that intentional? I would expect that we would preserve 
the form of the header-name (quoted or angled) and suggest a replacement with 
the same form.


https://reviews.llvm.org/D51333



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


[PATCH] D52008: [analyzer] Handle forwarding reference better in ExprMutationAnalyzer.

2018-09-12 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision.
shuaiwang added reviewers: lebedev.ri, JonasToth.
Herald added subscribers: cfe-commits, Szelethus, mikhail.ramalho, a.sidorin, 
szepet, xazax.hun.
Herald added a reviewer: george.karpenkov.

We used to treat an `Expr` mutated whenever it's passed as non-const
reference argument to a function. This results in false positives in
cases like this:

  int x;
  std::vector v;
  v.emplace_back(x); // `x` is passed as non-const reference to `emplace_back`

In theory the false positives can be suppressed with
`v.emplace_back(std::as_const(x))` but that's considered overly verbose,
inconsistent with existing code and spammy as diags.

This diff handles such cases by following into the function definition
and see whether the argument is mutated inside.


Repository:
  rC Clang

https://reviews.llvm.org/D52008

Files:
  include/clang/Analysis/Analyses/ExprMutationAnalyzer.h
  lib/Analysis/ExprMutationAnalyzer.cpp
  unittests/Analysis/ExprMutationAnalyzerTest.cpp

Index: unittests/Analysis/ExprMutationAnalyzerTest.cpp
===
--- unittests/Analysis/ExprMutationAnalyzerTest.cpp
+++ unittests/Analysis/ExprMutationAnalyzerTest.cpp
@@ -595,6 +595,68 @@
   EXPECT_FALSE(isMutated(Results, AST.get()));
 }
 
+TEST(ExprMutationAnalyzerTest, FollowFuncArgModified) {
+  auto AST =
+  tooling::buildASTFromCode("template  void g(T&& t) { t = 10; }"
+"void f() { int x; g(x); }");
+  auto Results =
+  match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
+  EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
+
+  AST = tooling::buildASTFromCode(
+  "void h(int&);"
+  "template  void g(Args&&... args) { h(args...); }"
+  "void f() { int x; g(x); }");
+  Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
+  EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
+
+  AST = tooling::buildASTFromCode(
+  "void h(int&, int);"
+  "template  void g(Args&&... args) { h(args...); }"
+  "void f() { int x, y; g(x, y); }");
+  Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
+  EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x, y)"));
+
+  AST = tooling::buildASTFromCode(
+  "void h(int, int&);"
+  "template  void g(Args&&... args) { h(args...); }"
+  "void f() { int x, y; g(y, x); }");
+  Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
+  EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(y, x)"));
+}
+
+TEST(ExprMutationAnalyzerTest, FollowFuncArgNotModified) {
+  auto AST = tooling::buildASTFromCode("template  void g(T&&) {}"
+   "void f() { int x; g(x); }");
+  auto Results =
+  match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
+  EXPECT_FALSE(isMutated(Results, AST.get()));
+
+  AST = tooling::buildASTFromCode("template  void g(T&& t) { t; }"
+  "void f() { int x; g(x); }");
+  Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
+  EXPECT_FALSE(isMutated(Results, AST.get()));
+
+  AST =
+  tooling::buildASTFromCode("template  void g(Args&&...) {}"
+"void f() { int x; g(x); }");
+  Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
+  EXPECT_FALSE(isMutated(Results, AST.get()));
+
+  AST =
+  tooling::buildASTFromCode("template  void g(Args&&...) {}"
+"void f() { int y, x; g(y, x); }");
+  Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
+  EXPECT_FALSE(isMutated(Results, AST.get()));
+
+  AST = tooling::buildASTFromCode(
+  "void h(int, int&);"
+  "template  void g(Args&&... args) { h(args...); }"
+  "void f() { int x, y; g(x, y); }");
+  Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
+  EXPECT_FALSE(isMutated(Results, AST.get()));
+}
+
 TEST(ExprMutationAnalyzerTest, ArrayElementModified) {
   const auto AST =
   tooling::buildASTFromCode("void f() { int x[2]; x[0] = 10; }");
Index: lib/Analysis/ExprMutationAnalyzer.cpp
===
--- lib/Analysis/ExprMutationAnalyzer.cpp
+++ lib/Analysis/ExprMutationAnalyzer.cpp
@@ -79,7 +79,8 @@
  ::findArrayElementMutation,
  ::findCastMutation,
  ::findRangeLoopMutation,
- ::findReferenceMutation}) {
+ ::findReferenceMutation,
+ ::findFunctionArgMutation}) {
 if (const Stmt *S = (this->*Finder)(Exp))
   return Results[Exp] = S;
   }
@@ -192,10 +193,15 @@
 
   // Used as non-const-ref argument when calling a function.
   // An argument is assumed to be non-const-ref when the function 

[PATCH] D51986: Fixes for `LLVM_LINK_LLVM_DYLIB` && Polly.

2018-09-12 Thread Chris Bieneman via Phabricator via cfe-commits
beanz added a comment.

I agree that changing the naming scheme probably makes sense, but I also think 
that you can probably make a fairly well contained change to the LLVM CMake 
module that maps components to libnames to special case Polly and make this all 
work.

I’d really like to see us avoid needing special casing for 
`LLVM_LINK_LLVM_DYLIB` as much as possible because it really shouldn’t matter 
to the tool where the LLVM library functionality comes from as long as it is 
there.


Repository:
  rC Clang

https://reviews.llvm.org/D51986



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


Buildbot numbers for the week of 9/02/2018 - 9/08/2018

2018-09-12 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 9/02/2018 - 9/08/2018.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:
buildername| was_red
---+-
 lldb-windows7-android | 81:46:56
 clang-cuda-build  | 62:46:39
 sanitizer-x86_64-linux-autoconf   | 55:59:35
 llvm-clang-x86_64-expensive-checks-win| 54:02:42
 clang-x64-ninja-win7  | 41:30:42
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions | 39:52:39
 clang-cmake-thumbv7-full-sh   | 30:29:51
 clang-x86-windows-msvc2015| 30:16:35
 libcxx-libcxxabi-x86_64-linux-debian  | 28:14:15
 clang-x86_64-linux-selfhost-modules   | 27:19:10
 clang-cmake-aarch64-full  | 25:32:32
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast  | 24:55:18
 clang-cmake-armv8-selfhost-neon   | 24:03:13
 clang-ppc64le-linux-multistage| 23:01:27
 clang-ppc64be-linux-multistage| 22:30:52
 clang-ppc64be-linux-lnt   | 22:22:35
 clang-ppc64be-linux   | 22:11:32
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast| 21:58:54
 clang-cmake-aarch64-quick | 21:34:32
 clang-cmake-armv8-lnt | 21:21:51
 clang-x86_64-linux-abi-test   | 21:19:44
 clang-lld-x86_64-2stage   | 20:29:20
 clang-cmake-aarch64-global-isel   | 20:08:01
 clang-with-lto-ubuntu | 18:28:34
 clang-cmake-armv7-lnt | 17:39:14
 clang-with-thin-lto-ubuntu| 17:24:50
 clang-cmake-armv8-full| 17:14:16
 clang-ppc64le-linux   | 16:15:58
 clang-cmake-thumbv8-full-sh   | 16:10:56
 clang-cmake-armv7-full| 16:06:58
 clang-cmake-armv8-quick   | 15:37:27
 clang-cmake-armv8-global-isel | 15:15:41
 sanitizer-x86_64-linux-bootstrap-msan | 13:50:25
 sanitizer-x86_64-linux-bootstrap  | 13:48:13
 sanitizer-x86_64-linux-bootstrap-ubsan| 13:41:54
 lld-x86_64-darwin13   | 09:55:46
 clang-cmake-x86_64-avx2-linux-perf| 07:09:52
 clang-x86_64-debian-fast  | 07:08:10
 clang-cmake-x86_64-sde-avx512-linux   | 07:00:15
 sanitizer-x86_64-linux-android| 06:45:22
 clang-cmake-x86_64-avx2-linux | 06:31:21
 llvm-hexagon-elf  | 06:12:49
 sanitizer-x86_64-linux| 06:02:07
 sanitizer-ppc64le-linux   | 05:45:30
 lldb-amd64-ninja-netbsd8  | 05:23:04
 polly-amd64-linux | 04:47:56
 lldb-x86-windows-msvc2015 | 04:32:44
 clang-hexagon-elf | 04:06:13
 sanitizer-ppc64be-linux   | 03:42:08
 sanitizer-x86_64-linux-fast   | 03:41:19
 lldb-x86_64-ubuntu-14.04-buildserver  | 01:57:12
 sanitizer-x86_64-linux-fuzzer | 01:42:39
 reverse-iteration | 01:35:23
 polly-arm-linux   | 01:23:28
 lld-x86_64-freebsd| 01:16:54
 clang-aarch64-linux-build-cache   | 01:14:55
 clang-armv7-linux-build-cache | 01:12:02
 lld-perf-testsuite| 01:00:36
 clang-ppc64le-linux-lnt   | 00:57:47
 sanitizer-windows | 00:55:24
 libcxx-sphinx-docs| 00:20:51
 lldb-amd64-ninja-freebsd11| 00:15:41
(62 rows)


"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green):
   buildername   | builds | changes
| status_change_ratio
-++-+
 libcxx-libcxxabi-x86_64-linux-debian|   

Buildbot numbers for the week of 8/26/2018 - 9/01/2018

2018-09-12 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 8/26/2018 - 9/01/2018.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:
   buildername|  was_red
--+--
 clang-cmake-aarch64-full | 112:55:51
 sanitizer-windows| 63:06:16
 clang-x64-ninja-win7 | 50:38:04
 clang-x86-windows-msvc2015   | 49:38:52
 clang-ppc64be-linux  | 45:13:08
 clang-ppc64be-linux-multistage   | 45:06:44
 clang-ppc64be-linux-lnt  | 45:03:13
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 36:51:20
 llvm-clang-x86_64-expensive-checks-win   | 35:05:44
 clang-cmake-armv8-selfhost-neon  | 31:36:21
 clang-x86_64-linux-selfhost-modules  | 30:50:52
 aosp-O3-polly-before-vectorizer-unprofitable | 25:00:10
 sanitizer-x86_64-linux-bootstrap-ubsan   | 23:40:58
 clang-cmake-thumbv8-full-sh  | 23:00:45
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11   | 22:15:31
 clang-cmake-thumbv7-full-sh  | 21:12:30
 sanitizer-x86_64-linux-bootstrap | 21:10:18
 clang-cmake-armv8-quick  | 20:46:40
 clang-cmake-armv8-global-isel| 20:23:57
 clang-cmake-armv8-full   | 20:15:53
 sanitizer-x86_64-linux-bootstrap-msan| 18:17:42
 openmp-gcc-x86_64-linux-debian   | 17:47:03
 clang-x86_64-debian-fast | 16:53:14
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan| 15:50:31
 clang-cmake-armv7-full   | 14:58:23
 clang-with-thin-lto-ubuntu   | 14:26:41
 clang-with-lto-ubuntu| 14:12:05
 clang-ppc64le-linux  | 13:22:48
 clang-cuda-build | 13:17:24
 clang-cmake-armv7-selfhost   | 13:17:14
 clang-cmake-armv7-selfhost-neon  | 13:15:09
 sanitizer-x86_64-linux-fast  | 13:14:52
 reverse-iteration| 13:09:34
 clang-ppc64le-linux-lnt  | 12:52:13
 sanitizer-x86_64-linux   | 12:10:31
 clang-ppc64le-linux-multistage   | 11:59:17
 clang-lld-x86_64-2stage  | 11:06:13
 sanitizer-ppc64le-linux  | 09:28:37
 sanitizer-ppc64be-linux  | 08:08:50
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast   | 07:46:07
 clang-cmake-aarch64-global-isel  | 07:34:49
 clang-cmake-aarch64-quick| 07:33:02
 clang-cmake-armv7-global-isel| 06:56:18
 clang-cmake-armv7-quick  | 06:50:09
 sanitizer-x86_64-linux-fuzzer| 06:38:44
 sanitizer-x86_64-linux-autoconf  | 06:36:30
 clang-cmake-x86_64-avx2-linux-perf   | 06:21:26
 lld-perf-testsuite   | 05:34:01
 sanitizer-x86_64-linux-android   | 05:19:19
 lldb-amd64-ninja-netbsd8 | 04:53:26
 libcxx-libcxxabi-x86_64-linux-ubuntu-tsan| 04:50:20
 lldb-x86_64-ubuntu-14.04-buildserver | 03:51:54
 clang-hexagon-elf| 03:32:55
 llvm-hexagon-elf | 03:19:23
 lldb-x86-windows-msvc2015| 03:16:11
 lld-x86_64-freebsd   | 03:14:17
 lldb-amd64-ninja-freebsd11   | 03:05:23
 clang-cmake-x86_64-avx2-linux| 02:27:40
 clang-cmake-x86_64-sde-avx512-linux  | 02:21:38
 lld-x86_64-darwin13  | 02:18:05
 clang-cmake-armv7-lnt| 02:16:13
 clang-x86_64-linux-abi-test  | 01:41:31
 clang-aarch64-linux-build-cache  | 01:36:19
 polly-arm-linux  | 01:36:00
 clang-cmake-armv8-lnt| 01:33:08
 clang-armv7-linux-build-cache| 01:30:37
 polly-amd64-linux| 00:42:37
(67 rows)


"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green):
  

[PATCH] D48581: [AArch64] Support reserving x1-7 registers.

2018-09-12 Thread Tri Vo via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342100: [AArch64] Support reserving x1-7 registers. 
(authored by trong, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D48581?vs=165132=165179#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D48581

Files:
  cfe/trunk/docs/ClangCommandLineReference.rst
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp
  cfe/trunk/test/Driver/aarch64-fixed-x-register.c
  cfe/trunk/test/Driver/aarch64-fixed-x18.c
  cfe/trunk/test/Driver/aarch64-fixed-x20.c

Index: cfe/trunk/docs/ClangCommandLineReference.rst
===
--- cfe/trunk/docs/ClangCommandLineReference.rst
+++ cfe/trunk/docs/ClangCommandLineReference.rst
@@ -2298,6 +2298,34 @@
 
 AARCH64
 ---
+.. option:: -ffixed-x1
+
+Reserve the x1 register (AArch64 only)
+
+.. option:: -ffixed-x2
+
+Reserve the x2 register (AArch64 only)
+
+.. option:: -ffixed-x3
+
+Reserve the x3 register (AArch64 only)
+
+.. option:: -ffixed-x4
+
+Reserve the x4 register (AArch64 only)
+
+.. option:: -ffixed-x5
+
+Reserve the x5 register (AArch64 only)
+
+.. option:: -ffixed-x6
+
+Reserve the x6 register (AArch64 only)
+
+.. option:: -ffixed-x7
+
+Reserve the x7 register (AArch64 only)
+
 .. option:: -ffixed-x18
 
 Reserve the x18 register (AArch64 only)
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -2050,10 +2050,9 @@
 def mno_fix_cortex_a53_835769 : Flag<["-"], "mno-fix-cortex-a53-835769">,
   Group,
   HelpText<"Don't workaround Cortex-A53 erratum 835769 (AArch64 only)">;
-def ffixed_x18 : Flag<["-"], "ffixed-x18">, Group,
-  HelpText<"Reserve the x18 register (AArch64 only)">;
-def ffixed_x20 : Flag<["-"], "ffixed-x20">, Group,
-  HelpText<"Reserve the x20 register (AArch64 only)">;
+foreach i = {1-7,18,20} in
+  def ffixed_x#i : Flag<["-"], "ffixed-x"#i>, Group,
+HelpText<"Reserve the "#i#" register (AArch64 only)">;
 
 def msign_return_address : Joined<["-"], "msign-return-address=">,
   Flags<[CC1Option]>, Group,
Index: cfe/trunk/test/Driver/aarch64-fixed-x-register.c
===
--- cfe/trunk/test/Driver/aarch64-fixed-x-register.c
+++ cfe/trunk/test/Driver/aarch64-fixed-x-register.c
@@ -0,0 +1,71 @@
+// RUN: %clang -target aarch64-none-gnu -ffixed-x1 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X1 < %t %s
+// CHECK-FIXED-X1: "-target-feature" "+reserve-x1"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x2 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X2 < %t %s
+// CHECK-FIXED-X2: "-target-feature" "+reserve-x2"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x3 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X3 < %t %s
+// CHECK-FIXED-X3: "-target-feature" "+reserve-x3"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x4 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X4 < %t %s
+// CHECK-FIXED-X4: "-target-feature" "+reserve-x4"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x5 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X5 < %t %s
+// CHECK-FIXED-X5: "-target-feature" "+reserve-x5"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x6 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X6 < %t %s
+// CHECK-FIXED-X6: "-target-feature" "+reserve-x6"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x7 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X7 < %t %s
+// CHECK-FIXED-X7: "-target-feature" "+reserve-x7"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x18 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s
+// CHECK-FIXED-X18: "-target-feature" "+reserve-x18"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x20 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X20 < %t %s
+// CHECK-FIXED-X20: "-target-feature" "+reserve-x20"
+
+// Test multiple of reserve-x# options together.
+// RUN: %clang -target aarch64-none-gnu \
+// RUN: -ffixed-x1 \
+// RUN: -ffixed-x2 \
+// RUN: -ffixed-x18 \
+// RUN: -### %s 2> %t
+// RUN: FileCheck \
+// RUN: --check-prefix=CHECK-FIXED-X1 \
+// RUN: --check-prefix=CHECK-FIXED-X2 \
+// RUN: --check-prefix=CHECK-FIXED-X18 \
+// RUN: < %t %s
+
+// Test all reserve-x# options together.
+// RUN: %clang -target aarch64-none-gnu \
+// RUN: -ffixed-x1 \
+// RUN: -ffixed-x2 \
+// RUN: -ffixed-x3 \
+// RUN: -ffixed-x4 \
+// RUN: -ffixed-x5 \
+// RUN: -ffixed-x6 \
+// RUN: -ffixed-x7 \
+// RUN: -ffixed-x18 \
+// RUN: -ffixed-x20 \
+// RUN: -### %s 2> %t
+// RUN: FileCheck \
+// RUN: --check-prefix=CHECK-FIXED-X1 \
+// RUN: --check-prefix=CHECK-FIXED-X2 \
+// RUN: --check-prefix=CHECK-FIXED-X3 \
+// RUN: --check-prefix=CHECK-FIXED-X4 \
+// 

[PATCH] D51997: [clang] Make sure attributes on member classes are applied properly

2018-09-12 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added inline comments.



Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:1267-1269
+  // Instantiate the attributes on both the template declaration and the 
associated record declaration.
+  SemaRef.InstantiateAttrsForDecl(TemplateArgs, Pattern, Inst, LateAttrs, 
StartingScope);
+  SemaRef.InstantiateAttrsForDecl(TemplateArgs, Pattern, RecordInst, 
LateAttrs, StartingScope);

nit: 80 chars.



Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:1268
+  // Instantiate the attributes on both the template declaration and the 
associated record declaration.
+  SemaRef.InstantiateAttrsForDecl(TemplateArgs, Pattern, Inst, LateAttrs, 
StartingScope);
+  SemaRef.InstantiateAttrsForDecl(TemplateArgs, Pattern, RecordInst, 
LateAttrs, StartingScope);

Why are you instantiating the attributes onto the ClassTemplateDecl? At the 
very least it seems wrong to instantiate attributes from the pattern to the 
ClassTemplateDecl.



Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:1498
 
+  SemaRef.InstantiateAttrsForDecl(TemplateArgs, D, Record, LateAttrs, 
StartingScope);
+

This line looks too long too.



Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:3247
   InstPartialSpec->setTypeAsWritten(WrittenTy);
 
   // Check the completed partial specialization.

ldionne wrote:
> I tried adding
> 
> ```
> SemaRef.InstantiateAttrsForDecl(TemplateArgs, 
> ClassTemplate->getTemplatedDecl(), InstPartialSpec, LateAttrs, StartingScope);
> ```
> 
> here, but just like for explicit specializations, that doesn't instantiate 
> the attributes on the `CXXRecordDecl` used to determine mangling.
> 
You mean `SemaRef.InstantiateAttrsForDecl(TemplateArgs, PartialSpec, 
InstPartialSpec, LateAttrs, StartingScope);`?



Comment at: clang/test/SemaCXX/PR38913.cpp:19
+};
+C::X* c() { return 0; } // CHECK-DAG: @_Z1cB4CTAGv
+

ldionne wrote:
> This test is failing in the current iteration of the patch.
I think the problem here is that we don't instantiate X because it's 
behind the pointer, so we're just considering the primary template. Looks like 
we do add the attribute (with the fix above) here:
```
template struct C {
  template struct X { };
  template struct __attribute__((abi_tag("CTAG"))) X { };
};
C::X c() { return 0; }
```
But we don't get the right mangling, for some reason. Note that this problem is 
present even in the non-member case. 

I don't think attributes on specializations have particularly good support 
anyways, so I wouldn't really lose any sleep if we "left this to a follow-up". 
Maybe @rsmith has some thoughts here.


Repository:
  rC Clang

https://reviews.llvm.org/D51997



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


r342098 - Remove dead code made unnecessary by r342018.

2018-09-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Sep 12 16:37:58 2018
New Revision: 342098

URL: http://llvm.org/viewvc/llvm-project?rev=342098=rev
Log:
Remove dead code made unnecessary by r342018.

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

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=342098=342097=342098=diff
==
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Wed Sep 12 16:37:58 2018
@@ -1409,13 +1409,6 @@ bool Sema::hasVisibleMergedDefinition(Na
 }
 
 bool Sema::hasMergedDefinitionInCurrentModule(NamedDecl *Def) {
-  // FIXME: When not in local visibility mode, we can't tell the difference
-  // between a declaration being visible because we merged a local copy of
-  // the same declaration into it, and it being visible because its owning
-  // module is visible.
-  if (Def->getModuleOwnershipKind() == Decl::ModuleOwnershipKind::Visible &&
-  getLangOpts().ModulesLocalVisibility)
-return true;
   for (const Module *Merged : Context.getModulesWithMergedDefinition(Def))
 if (isInCurrentModule(Merged, getLangOpts()))
   return true;


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


r342097 - Track definition merging on the canonical declaration even when local

2018-09-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Sep 12 16:37:00 2018
New Revision: 342097

URL: http://llvm.org/viewvc/llvm-project?rev=342097=rev
Log:
Track definition merging on the canonical declaration even when local
submodule visibility is disabled.

Attempting to pick a specific declaration to make visible when the
module containing the merged declaration becomes visible is error-prone,
as we don't yet know which declaration we'll choose to be the definition
when we are informed of the merging.

This reinstates r342019, reverted in r342020. The regression previously
observed after this commit was fixed in r342096.

Added:
cfe/trunk/test/Modules/merge-template-pattern-visibility-3.cpp
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=342097=342096=342097=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Sep 12 16:37:00 2018
@@ -932,10 +932,7 @@ void ASTContext::mergeDefinitionIntoModu
 if (auto *Listener = getASTMutationListener())
   Listener->RedefinedHiddenDefinition(ND, M);
 
-  if (getLangOpts().ModulesLocalVisibility)
-MergedDefModules[cast(ND->getCanonicalDecl())].push_back(M);
-  else
-ND->setVisibleDespiteOwningModule();
+  MergedDefModules[cast(ND->getCanonicalDecl())].push_back(M);
 }
 
 void ASTContext::deduplicateMergedDefinitonsFor(NamedDecl *ND) {

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=342097=342096=342097=diff
==
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Wed Sep 12 16:37:00 2018
@@ -7623,8 +7623,15 @@ bool Sema::hasVisibleDefinition(NamedDec
 
 // A visible module might have a merged definition instead.
 if (D->isModulePrivate() ? hasMergedDefinitionInCurrentModule(D)
- : hasVisibleMergedDefinition(D))
+ : hasVisibleMergedDefinition(D)) {
+  if (CodeSynthesisContexts.empty() &&
+  !getLangOpts().ModulesLocalVisibility) {
+// Cache the fact that this definition is implicitly visible because
+// there is a visible merged definition.
+D->setVisibleDespiteOwningModule();
+  }
   return true;
+}
 
 return false;
   };

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=342097=342096=342097=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed Sep 12 16:37:00 2018
@@ -3780,22 +3780,15 @@ void ASTReader::makeModuleVisible(Module
 /// visible.
 void ASTReader::mergeDefinitionVisibility(NamedDecl *Def,
   NamedDecl *MergedDef) {
-  // FIXME: This doesn't correctly handle the case where MergedDef is visible
-  // in modules other than its owning module. We should instead give the
-  // ASTContext a list of merged definitions for Def.
   if (Def->isHidden()) {
 // If MergedDef is visible or becomes visible, make the definition visible.
 if (!MergedDef->isHidden())
   Def->setVisibleDespiteOwningModule();
-else if (getContext().getLangOpts().ModulesLocalVisibility) {
+else {
   getContext().mergeDefinitionIntoModule(
   Def, MergedDef->getImportedOwningModule(),
   /*NotifyListeners*/ false);
   PendingMergedDefinitionsToDeduplicate.insert(Def);
-} else {
-  auto SubmoduleID = MergedDef->getOwningModuleID();
-  assert(SubmoduleID && "hidden definition in no module");
-  HiddenNamesMap[getSubmodule(SubmoduleID)].push_back(Def);
 }
   }
 }

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=342097=342096=342097=diff
==
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Wed Sep 12 16:37:00 2018
@@ -4419,22 +4419,9 @@ void ASTDeclReader::UpdateDecl(Decl *D,
 case UPD_DECL_EXPORTED: {
   unsigned SubmoduleID = readSubmoduleID();
   auto *Exported = cast(D);
-  if (auto *TD = dyn_cast(Exported))
-Exported = TD->getDefinition();
   Module *Owner = SubmoduleID ? Reader.getSubmodule(SubmoduleID) : nullptr;
-  if (Reader.getContext().getLangOpts().ModulesLocalVisibility) {
-
Reader.getContext().mergeDefinitionIntoModule(cast(Exported),
-

[PATCH] D51986: Fixes for `LLVM_LINK_LLVM_DYLIB` && Polly.

2018-09-12 Thread Richard Diamond via Phabricator via cfe-commits
DiamondLovesYou added a comment.

In https://reviews.llvm.org/D51986#1232440, @beanz wrote:

> After line 18 in this file you could do something like:
>
>   if(WITH_POLLY)
>   list(APPEND LLVM_LINK_COMPONENTS Polly)
>   endif()
>
>
> Then you can get rid of the `target_link_libraries` call.


It turns out this can't be done. Consider the `LLVMLTO` component and its 
loadable form, `LTO`. Contrast this with Polly: `Polly` is the component and 
`LLVMPolly` is the loadable module.
This naming convention disagreement prevents Polly's use as a component while 
also not breaking LTO, I've found (Chris, is this what you were referring to?).
Specifically, CMake fails because executables can't link to a `MODULE_LIBRARY` 
target when trying to link `LLVMPolly`.

I think the Polly naming scheme should be changed to match LTO's scheme, rather 
than vice versa, but not my call.


Repository:
  rC Clang

https://reviews.llvm.org/D51986



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


r342096 - When we leave a module header, make that header visible in its

2018-09-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Sep 12 16:09:23 2018
New Revision: 342096

URL: http://llvm.org/viewvc/llvm-project?rev=342096=rev
Log:
When we leave a module header, make that header visible in its
includer's context, even if its overall module is unavailable.

Added:
cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/
cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/a.h
cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/b.h
cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/module.modulemap
cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/x.h
cfe/trunk/test/Modules/unavailable-local-visibility.test
Modified:
cfe/trunk/lib/Basic/Module.cpp

Modified: cfe/trunk/lib/Basic/Module.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Module.cpp?rev=342096=342095=342096=diff
==
--- cfe/trunk/lib/Basic/Module.cpp (original)
+++ cfe/trunk/lib/Basic/Module.cpp Wed Sep 12 16:09:23 2018
@@ -577,10 +577,6 @@ void VisibleModuleSet::setVisible(Module
   };
 
   std::function VisitModule = [&](Visiting V) {
-// Modules that aren't available cannot be made visible.
-if (!V.M->isAvailable())
-  return;
-
 // Nothing to do for a module that's already visible.
 unsigned ID = V.M->getVisibilityID();
 if (ImportLocs.size() <= ID)
@@ -594,8 +590,11 @@ void VisibleModuleSet::setVisible(Module
 // Make any exported modules visible.
 SmallVector Exports;
 V.M->getExportedModules(Exports);
-for (Module *E : Exports)
-  VisitModule({E, });
+for (Module *E : Exports) {
+  // Don't recurse to unavailable submodules.
+  if (E->isAvailable())
+VisitModule({E, });
+}
 
 for (auto  : V.M->Conflicts) {
   if (isVisible(C.Other)) {

Added: cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/a.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/a.h?rev=342096=auto
==
--- cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/a.h (added)
+++ cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/a.h Wed Sep 12 
16:09:23 2018
@@ -0,0 +1,4 @@
+#ifndef A_H
+#define A_H
+#include "x.h"
+#endif

Added: cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/b.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/b.h?rev=342096=auto
==
--- cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/b.h (added)
+++ cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/b.h Wed Sep 12 
16:09:23 2018
@@ -0,0 +1,13 @@
+#ifndef B_H
+#define B_H
+#include "a.h"
+
+#ifndef A_H
+#error where is a?
+#endif
+
+#ifndef X_H
+#error where is x?
+#endif
+X f();
+#endif

Added: 
cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/module.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/module.modulemap?rev=342096=auto
==
--- cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/module.modulemap 
(added)
+++ cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/module.modulemap 
Wed Sep 12 16:09:23 2018
@@ -0,0 +1,9 @@
+module M {
+  module a { header "a.h" export * }
+  module b { header "b.h" export * }
+  module doesnotexist { header "doesnotexist.h" }
+}
+module X {
+  header "x.h"
+  export *
+}

Added: cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/x.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/x.h?rev=342096=auto
==
--- cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/x.h (added)
+++ cfe/trunk/test/Modules/Inputs/unavailable-local-visibility/x.h Wed Sep 12 
16:09:23 2018
@@ -0,0 +1,4 @@
+#ifndef X_H
+#define X_H
+struct X {};
+#endif

Added: cfe/trunk/test/Modules/unavailable-local-visibility.test
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/unavailable-local-visibility.test?rev=342096=auto
==
--- cfe/trunk/test/Modules/unavailable-local-visibility.test (added)
+++ cfe/trunk/test/Modules/unavailable-local-visibility.test Wed Sep 12 
16:09:23 2018
@@ -0,0 +1,2 @@
+// RUN: %clang_cc1 -fmodules -I%S/Inputs/unavailable-local-visibility 
-fmodule-name=X -emit-module -x c++-module-map 
%S/Inputs/unavailable-local-visibility/module.modulemap -o %t/x.pcm
+// RUN: %clang_cc1 -fmodules -I%S/Inputs/unavailable-local-visibility 
-fmodule-name=M 
-fmodule-map-file=%S/Inputs/unavailable-local-visibility/module.modulemap 
-fmodules-local-submodule-visibility 

[PATCH] D48581: [AArch64] Support reserving x1-7 registers.

2018-09-12 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers accepted this revision.
nickdesaulniers added a comment.

Great work Tri, thank you!


https://reviews.llvm.org/D48581



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


[PATCH] D51333: Diagnose likely typos in include statements

2018-09-12 Thread Christy Lee via Phabricator via cfe-commits
christylee updated this revision to Diff 165162.
christylee edited the summary of this revision.
christylee added a comment.

Emit non-fatal error for typo if file exists.


https://reviews.llvm.org/D51333

Files:
  include/clang/Basic/DiagnosticLexKinds.td
  lib/Lex/PPDirectives.cpp


Index: lib/Lex/PPDirectives.cpp
===
--- lib/Lex/PPDirectives.cpp
+++ lib/Lex/PPDirectives.cpp
@@ -1879,12 +1879,38 @@
 Callbacks ?  : nullptr, , );
 if (File) {
   SourceRange Range(FilenameTok.getLocation(), CharEnd);
-  Diag(FilenameTok, diag::err_pp_file_not_found_not_fatal) <<
+  Diag(FilenameTok, 
diag::err_pp_file_not_found_angled_include_not_fatal) <<
 Filename <<
 FixItHint::CreateReplacement(Range, "\"" + Filename.str() + "\"");
 }
   }
 
+  // Check for likely typos due to leading or trailing non-isAlphanumeric
+  // characters
+  if (!File) {
+auto originalFilename = Filename;
+while (!isAlphanumeric(Filename.front())) {
+  Filename = Filename.drop_front();
+}
+while (!isAlphanumeric(Filename.back())) {
+  Filename = Filename.drop_back();
+}
+
+File = LookupFile(
+FilenameLoc,
+LangOpts.MSVCCompat ? NormalizedPath.c_str() : Filename, false,
+LookupFrom, LookupFromFile, CurDir,
+Callbacks ?  : nullptr,
+Callbacks ?  : nullptr, , );
+if (File) {
+  SourceRange Range(FilenameTok.getLocation(), CharEnd);
+  Diag(FilenameTok, diag::err_pp_file_not_found_typo_not_fatal)
+  << originalFilename
+  << FixItHint::CreateReplacement(Range,
+  "\"" + Filename.str() + "\"");
+}
+  }
+
   // If the file is still not found, just go with the vanilla diagnostic
   if (!File)
 Diag(FilenameTok, diag::err_pp_file_not_found) << Filename
Index: include/clang/Basic/DiagnosticLexKinds.td
===
--- include/clang/Basic/DiagnosticLexKinds.td
+++ include/clang/Basic/DiagnosticLexKinds.td
@@ -422,8 +422,11 @@
   "#pragma hdrstop filename not supported, "
   "/Fp can be used to specify precompiled header filename">,
   InGroup;
-def err_pp_file_not_found_not_fatal : Error<
+def err_pp_file_not_found_angled_include_not_fatal : Error<
   "'%0' file not found with  include; use \"quotes\" instead">;
+def err_pp_file_not_found_typo_not_fatal
+: Error<"'%0' file not found due to leading or trailing non-alphanumeric "
+"characters">;
 def err_pp_error_opening_file : Error<
   "error opening file '%0': %1">, DefaultFatal;
 def err_pp_empty_filename : Error<"empty filename">;


Index: lib/Lex/PPDirectives.cpp
===
--- lib/Lex/PPDirectives.cpp
+++ lib/Lex/PPDirectives.cpp
@@ -1879,12 +1879,38 @@
 Callbacks ?  : nullptr, , );
 if (File) {
   SourceRange Range(FilenameTok.getLocation(), CharEnd);
-  Diag(FilenameTok, diag::err_pp_file_not_found_not_fatal) <<
+  Diag(FilenameTok, diag::err_pp_file_not_found_angled_include_not_fatal) <<
 Filename <<
 FixItHint::CreateReplacement(Range, "\"" + Filename.str() + "\"");
 }
   }
 
+  // Check for likely typos due to leading or trailing non-isAlphanumeric
+  // characters
+  if (!File) {
+auto originalFilename = Filename;
+while (!isAlphanumeric(Filename.front())) {
+  Filename = Filename.drop_front();
+}
+while (!isAlphanumeric(Filename.back())) {
+  Filename = Filename.drop_back();
+}
+
+File = LookupFile(
+FilenameLoc,
+LangOpts.MSVCCompat ? NormalizedPath.c_str() : Filename, false,
+LookupFrom, LookupFromFile, CurDir,
+Callbacks ?  : nullptr,
+Callbacks ?  : nullptr, , );
+if (File) {
+  SourceRange Range(FilenameTok.getLocation(), CharEnd);
+  Diag(FilenameTok, diag::err_pp_file_not_found_typo_not_fatal)
+  << originalFilename
+  << FixItHint::CreateReplacement(Range,
+  "\"" + Filename.str() + "\"");
+}
+  }
+
   // If the file is still not found, just go with the vanilla diagnostic
   if (!File)
 Diag(FilenameTok, diag::err_pp_file_not_found) << Filename
Index: include/clang/Basic/DiagnosticLexKinds.td
===
--- include/clang/Basic/DiagnosticLexKinds.td
+++ include/clang/Basic/DiagnosticLexKinds.td
@@ -422,8 +422,11 @@
   "#pragma hdrstop filename not supported, "
   "/Fp can be used to specify precompiled header filename">,
   InGroup;
-def err_pp_file_not_found_not_fatal : Error<

[PATCH] D52004: [clangd] Allow all LSP methods to signal cancellation via $/cancelRequest

2018-09-12 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added a comment.

Wonder if we can still keep the onCancelRequest registry within 
ProtocolHandler's scope, so that it is clear that we implement it. Other than 
that seems fascinating, thanks!




Comment at: clangd/JSONRPCDispatcher.cpp:246
+  auto StrID = llvm::to_string(ID); // JSON-serialize ID for map key.
+  auto Cookie = RequestCookie++;
+  std::lock_guard Lock(CancelMutex);

Maybe we can say something about this method is actually being invoked in a 
sync manner and the reason why we have mutex below is due to context 
destruction of the thread we might spawn later on. Because it bugged me at 
first look not having this line under mutex as well, then I noticed actually 
this was still a sync function.



Comment at: clangd/JSONRPCDispatcher.cpp:248
+  std::lock_guard Lock(CancelMutex);
+  RequestCancelers[StrID] = {std::move(Task.second), Cookie};
+  // When the request ends, we can clean up the entry we just added.

maybe limit the Lock's scope just to put element into map.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52004



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


[PATCH] D51713: Support -fno-omit-frame-pointer with -pg.

2018-09-12 Thread Manoj Gupta via Phabricator via cfe-commits
manojgupta added a comment.

In https://reviews.llvm.org/D51713#1232497, @srhines wrote:

> In https://reviews.llvm.org/D51713#1232414, @manojgupta wrote:
>
> > What is the call generated with -pg for AMR32, __gnu_mcount_nc or _mount? 
> > __gnu_mcount_nc  with "-pg" is known to be broken ( 
> > https://bugs.llvm.org/show_bug.cgi?id=33845)
>
>
> I CCed myself on that issue as we are trying to do a better job of supporting 
> code coverage, but I don't think this bug is relevant for this patch.
>
> Unless there are any additional reviews, I will likely submit this patch in a 
> few hours.


Yes, Submitting this patch is totally fine, I just wanted to warn you about the 
potential issue you may run into with "-pg" and ARM32.


Repository:
  rC Clang

https://reviews.llvm.org/D51713



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


[PATCH] D51996: [clangd] Simplify cancellation public API

2018-09-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

In https://reviews.llvm.org/D51996#1232459, @kadircet wrote:

> Seems a lot cleaner now, thanks!
>
> Do you plan to have other changes like moving control to JSONRPCDispatcher 
> and recording timings for analysis on this patch?


https://reviews.llvm.org/D52004 is the JSONRPCDispatcher change.
Added a FIXME to the file comment about timings, hope to get to it soon.

> If not maybe we can add some fixme's so that we won't forget. Also the 
> somewhat "caching" of cancellation token from previous implementation might 
> still be useful in future if we really face "crowded" contexts and frequent 
> cancellation checks, so maybe keep some notes about it?

I think the best plan for frequent cancellation checks is "don't do that" ;-) 
The situation is that you're checking for cancellation to save CPU, but the 
thing you're spending the CPU on is checking for cancellation...  I don't think 
the fix is to make cancellation checking cheaper! (Obviously cheaper is always 
better, but it would make the API worse here)
So i left a note on isCancelled(). We can revisit if we find cases where 
context traversal is really hurting us.




Comment at: clangd/Cancellation.h:29
+// 2. Library code that executes long-running work, and can exit early if the
+//   result is not needed.
 //

kadircet wrote:
> Maybe also mention propagating context into long-running work. runAsync does 
> that implicitly and not sure if there will be other use cases that doesn't 
> include it, but if there might be it would be nice to point it out as well.
Yeah, added this to the caveats.
This shouldn't be a problem in practice (at least for pure open-source clangd): 
LLVM doesn't have a lot of multithreading utilities so we mostly define our 
own, and those are context aware.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51996



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


[PATCH] D51996: [clangd] Simplify cancellation public API

2018-09-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 165158.
sammccall marked 2 inline comments as done.
sammccall added a comment.

Address comments by adding comments!


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51996

Files:
  clangd/Cancellation.cpp
  clangd/Cancellation.h
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  unittests/clangd/CancellationTests.cpp

Index: unittests/clangd/CancellationTests.cpp
===
--- unittests/clangd/CancellationTests.cpp
+++ unittests/clangd/CancellationTests.cpp
@@ -13,57 +13,48 @@
 namespace {
 
 TEST(CancellationTest, CancellationTest) {
-  TaskHandle TH = Task::createHandle();
-  WithContext ContextWithCancellation(setCurrentTask(TH));
+  auto Task = cancelableTask();
+  WithContext ContextWithCancellation(std::move(Task.first));
   EXPECT_FALSE(isCancelled());
-  TH->cancel();
+  Task.second();
   EXPECT_TRUE(isCancelled());
 }
 
-TEST(CancellationTest, TaskTestHandleDiesContextLives) {
+TEST(CancellationTest, CancelerDiesContextLives) {
   llvm::Optional ContextWithCancellation;
   {
-TaskHandle TH = Task::createHandle();
-ContextWithCancellation.emplace(setCurrentTask(TH));
+auto Task = cancelableTask();
+ContextWithCancellation.emplace(std::move(Task.first));
 EXPECT_FALSE(isCancelled());
-TH->cancel();
+Task.second();
 EXPECT_TRUE(isCancelled());
   }
   EXPECT_TRUE(isCancelled());
 }
 
 TEST(CancellationTest, TaskContextDiesHandleLives) {
-  TaskHandle TH = Task::createHandle();
+  auto Task = cancelableTask();
   {
-WithContext ContextWithCancellation(setCurrentTask(TH));
+WithContext ContextWithCancellation(std::move(Task.first));
 EXPECT_FALSE(isCancelled());
-TH->cancel();
+Task.second();
 EXPECT_TRUE(isCancelled());
   }
   // Still should be able to cancel without any problems.
-  TH->cancel();
-}
-
-TEST(CancellationTest, CancellationToken) {
-  TaskHandle TH = Task::createHandle();
-  WithContext ContextWithCancellation(setCurrentTask(TH));
-  const auto  = getCurrentTask();
-  EXPECT_FALSE(CT.isCancelled());
-  TH->cancel();
-  EXPECT_TRUE(CT.isCancelled());
+  Task.second();
 }
 
 TEST(CancellationTest, AsynCancellationTest) {
   std::atomic HasCancelled(false);
   Notification Cancelled;
-  auto TaskToBeCancelled = [&](ConstTaskHandle CT) {
-WithContext ContextGuard(setCurrentTask(std::move(CT)));
+  auto TaskToBeCancelled = [&](Context Ctx) {
+WithContext ContextGuard(std::move(Ctx));
 Cancelled.wait();
 HasCancelled = isCancelled();
   };
-  TaskHandle TH = Task::createHandle();
-  std::thread AsyncTask(TaskToBeCancelled, TH);
-  TH->cancel();
+  auto Task = cancelableTask();
+  std::thread AsyncTask(TaskToBeCancelled, std::move(Task.first));
+  Task.second();
   Cancelled.notify();
   AsyncTask.join();
 
Index: clangd/ClangdServer.h
===
--- clangd/ClangdServer.h
+++ clangd/ClangdServer.h
@@ -125,9 +125,9 @@
   /// while returned future is not yet ready.
   /// A version of `codeComplete` that runs \p Callback on the processing thread
   /// when codeComplete results become available.
-  TaskHandle codeComplete(PathRef File, Position Pos,
-  const clangd::CodeCompleteOptions ,
-  Callback CB);
+  Canceler codeComplete(PathRef File, Position Pos,
+const clangd::CodeCompleteOptions ,
+Callback CB);
 
   /// Provide signature help for \p File at \p Pos.  This method should only be
   /// called for tracked files.
Index: clangd/ClangdServer.cpp
===
--- clangd/ClangdServer.cpp
+++ clangd/ClangdServer.cpp
@@ -201,16 +201,16 @@
   WorkScheduler.remove(File);
 }
 
-TaskHandle ClangdServer::codeComplete(PathRef File, Position Pos,
-  const clangd::CodeCompleteOptions ,
-  Callback CB) {
+Canceler ClangdServer::codeComplete(PathRef File, Position Pos,
+const clangd::CodeCompleteOptions ,
+Callback CB) {
   // Copy completion options for passing them to async task handler.
   auto CodeCompleteOpts = Opts;
   if (!CodeCompleteOpts.Index) // Respect overridden index.
 CodeCompleteOpts.Index = Index;
 
-  TaskHandle TH = Task::createHandle();
-  WithContext ContextWithCancellation(setCurrentTask(TH));
+  auto Cancelable = cancelableTask();
+  WithContext ContextWithCancellation(std::move(Cancelable.first));
   // Copy PCHs to avoid accessing this->PCHs concurrently
   std::shared_ptr PCHs = this->PCHs;
   auto FS = FSProvider.getFileSystem();
@@ -259,7 +259,7 @@
   // We use a potentially-stale preamble because latency is critical here.
   WorkScheduler.runWithPreamble("CodeComplete", File, 

[PATCH] D51713: Support -fno-omit-frame-pointer with -pg.

2018-09-12 Thread Stephen Hines via Phabricator via cfe-commits
srhines added a comment.

In https://reviews.llvm.org/D51713#1232414, @manojgupta wrote:

> What is the call generated with -pg for AMR32, __gnu_mcount_nc or _mount? 
> __gnu_mcount_nc  with "-pg" is known to be broken ( 
> https://bugs.llvm.org/show_bug.cgi?id=33845)


I CCed myself on that issue as we are trying to do a better job of supporting 
code coverage, but I don't think this bug is relevant for this patch.

Unless there are any additional reviews, I will likely submit this patch in a 
few hours.


Repository:
  rC Clang

https://reviews.llvm.org/D51713



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


[PATCH] D52004: [clangd] Allow all LSP methods to signal cancellation via $/cancelRequest

2018-09-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
sammccall added reviewers: ilya-biryukov, kadircet.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay, ioeric.

The cancelable scopes are managed by JSONRPCDispatcher so that all Handlers
run in cancelable contexts.
(Previously ClangdServer did this, for code completion only).

Cancellation request processing is therefore also in JSONRPCDispatcher.
(Previously it was in ClangdLSPServer).

This doesn't actually make any new commands *respect* cancellation - they'd
need to check isCancelled() and bail out. But it opens the door to doing
this incrementally, and putting such logic in common machinery like TUScheduler.

I also rewrote the ClangdServer class/threading comments because I wanted to
add to it and I got carried away.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52004

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/JSONRPCDispatcher.cpp
  clangd/JSONRPCDispatcher.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/ProtocolHandlers.cpp
  clangd/ProtocolHandlers.h

Index: clangd/ProtocolHandlers.h
===
--- clangd/ProtocolHandlers.h
+++ clangd/ProtocolHandlers.h
@@ -56,7 +56,6 @@
   virtual void onDocumentHighlight(TextDocumentPositionParams ) = 0;
   virtual void onHover(TextDocumentPositionParams ) = 0;
   virtual void onChangeConfiguration(DidChangeConfigurationParams ) = 0;
-  virtual void onCancelRequest(CancelParams ) = 0;
 };
 
 void registerCallbackHandlers(JSONRPCDispatcher ,
Index: clangd/ProtocolHandlers.cpp
===
--- clangd/ProtocolHandlers.cpp
+++ clangd/ProtocolHandlers.cpp
@@ -76,5 +76,4 @@
   Register("workspace/didChangeConfiguration",
::onChangeConfiguration);
   Register("workspace/symbol", ::onWorkspaceSymbol);
-  Register("$/cancelRequest", ::onCancelRequest);
 }
Index: clangd/Protocol.h
===
--- clangd/Protocol.h
+++ clangd/Protocol.h
@@ -886,20 +886,6 @@
 };
 bool fromJSON(const llvm::json::Value &, ReferenceParams &);
 
-struct CancelParams {
-  /// The request id to cancel.
-  /// This can be either a number or string, if it is a number simply print it
-  /// out and always use a string.
-  std::string ID;
-};
-llvm::json::Value toJSON(const CancelParams &);
-llvm::raw_ostream <<(llvm::raw_ostream &, const CancelParams &);
-bool fromJSON(const llvm::json::Value &, CancelParams &);
-
-/// Param can be either of type string or number. Returns the result as a
-/// string.
-llvm::Optional parseNumberOrString(const llvm::json::Value *Param);
-
 } // namespace clangd
 } // namespace clang
 
Index: clangd/Protocol.cpp
===
--- clangd/Protocol.cpp
+++ clangd/Protocol.cpp
@@ -623,38 +623,5 @@
   return fromJSON(Params, Base);
 }
 
-json::Value toJSON(const CancelParams ) {
-  return json::Object{{"id", CP.ID}};
-}
-
-llvm::raw_ostream <<(llvm::raw_ostream , const CancelParams ) {
-  O << toJSON(CP);
-  return O;
-}
-
-llvm::Optional parseNumberOrString(const json::Value *Params) {
-  if (!Params)
-return llvm::None;
-  // ID is either a number or a string, check for both.
-  if(const auto AsString = Params->getAsString())
-return AsString->str();
-
-  if(const auto AsNumber = Params->getAsInteger())
-return itostr(AsNumber.getValue());
-
-  return llvm::None;
-}
-
-bool fromJSON(const json::Value , CancelParams ) {
-  const auto ParamsAsObject = Params.getAsObject();
-  if (!ParamsAsObject)
-return false;
-  if (auto Parsed = parseNumberOrString(ParamsAsObject->get("id"))) {
-CP.ID = std::move(*Parsed);
-return true;
-  }
-  return false;
-}
-
 } // namespace clangd
 } // namespace clang
Index: clangd/JSONRPCDispatcher.h
===
--- clangd/JSONRPCDispatcher.h
+++ clangd/JSONRPCDispatcher.h
@@ -10,6 +10,7 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_JSONRPCDISPATCHER_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_JSONRPCDISPATCHER_H
 
+#include "Cancellation.h"
 #include "Logger.h"
 #include "Protocol.h"
 #include "Trace.h"
@@ -79,21 +80,32 @@
 /// registered Handler for the method received.
 class JSONRPCDispatcher {
 public:
-  // A handler responds to requests for a particular method name.
+  /// A handler responds to requests for a particular method name.
+  ///
+  /// JSONRPCDispatcher will mark the handler's context as cancelled if a
+  /// matching cancellation request is received. Handlers are encouraged to
+  /// check for cancellation and fail quickly in this case.
   using Handler = std::function;
 
   /// Create a new JSONRPCDispatcher. UnknownHandler is called when an unknown
   /// method is received.
-  JSONRPCDispatcher(Handler UnknownHandler)
-  : UnknownHandler(std::move(UnknownHandler)) {}

[PATCH] D51996: [clangd] Simplify cancellation public API

2018-09-12 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added a comment.

Seems a lot cleaner now, thanks!

Do you plan to have other changes like moving control to JSONRPCDispatcher and 
recording timings for analysis on this patch? If not maybe we can add some 
fixme's so that we won't forget. Also the somewhat "caching" of cancellation 
token from previous implementation might still be useful in future if we really 
face "crowded" contexts and frequent cancellation checks, so maybe keep some 
notes about it?




Comment at: clangd/Cancellation.h:29
+// 2. Library code that executes long-running work, and can exit early if the
+//   result is not needed.
 //

Maybe also mention propagating context into long-running work. runAsync does 
that implicitly and not sure if there will be other use cases that doesn't 
include it, but if there might be it would be nice to point it out as well.



Comment at: clangd/Cancellation.h:44
+//   (A real example may invoke the callback with an error on cancellation,
+//   the TaskCancelledError is provided for this purpose).
 //

s/TaskCancelledError/CancelledError


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51996



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


[PATCH] D51949: [WIP][clang-tidy] initial ideas to isolate variable declarations

2018-09-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

In https://reviews.llvm.org/D51949#1232443, @kbobyrev wrote:

> I've been thinking about corner-cases (e.g. don't split `DeclStmt`s within 
> init-statement declaration) a while and it seems that there might be many of 
> them.


It should at least diagnose these cases.
This check is really needed.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949



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


[PATCH] D51949: [WIP][clang-tidy] initial ideas to isolate variable declarations

2018-09-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added a comment.

I've been thinking about corner-cases (e.g. don't split `DeclStmt`s within 
init-statement declaration) a while and it seems that there might be many of 
them.

I didn't notice https://reviews.llvm.org/D27621 in the first place, it seems to 
have a solid test suite (and it also does some basic formatting, which is 
nice). It might be worthy to pick it up where it was left. Alternatively, you 
might want to pull the test cases from that patch if you don't want to reuse 
the code.




Comment at: clang-tidy/readability/IsolateDeclCheck.cpp:51
+
+return TypeAndName + " = " + Initializer + ";";
+  }

JonasToth wrote:
> kbobyrev wrote:
> > This seems to replace `int x = 5, y = 42;` with `int x = 5;int y = 42`. I 
> > don't think that it becomes cleaner (in fact, without spaces in between it 
> > looks cryptic). Consider formatting it or simply applying newlines (if 
> > there were no newlines inbetween before).
> I do not plan to do a lot of formatting here (maybe space or newline), 
> because that clang-format area.
While Clang-Tidy can apply Clang-Format on top of the Fix-Its, it will still 
look weird in the Fix-Its previews. While supporting proper formatting, in 
general, might be hard, it totally makes sense to do some basic formatting so 
that editor integration warnings would look better, for example.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949



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


[PATCH] D51986: Fixes for `LLVM_LINK_LLVM_DYLIB` && Polly.

2018-09-12 Thread Richard Diamond via Phabricator via cfe-commits
DiamondLovesYou added a comment.

In https://reviews.llvm.org/D51986#1232440, @beanz wrote:

> After line 18 in this file you could do something like:
>
>   if(WITH_POLLY)
>   list(APPEND LLVM_LINK_COMPONENTS Polly)
>   endif()
>
>
> Then you can get rid of the `target_link_libraries` call.


Ah, indeed, thanks. I'll update the other patch too.


Repository:
  rC Clang

https://reviews.llvm.org/D51986



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


[PATCH] D51986: Fixes for `LLVM_LINK_LLVM_DYLIB` && Polly.

2018-09-12 Thread Chris Bieneman via Phabricator via cfe-commits
beanz added a comment.

After line 18 in this file you could do something like:

  if(WITH_POLLY)
  list(APPEND LLVM_LINK_COMPONENTS Polly)
  endif()

Then you can get rid of the `target_link_libraries` call.


Repository:
  rC Clang

https://reviews.llvm.org/D51986



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


[PATCH] D51986: Fixes for `LLVM_LINK_LLVM_DYLIB` && Polly.

2018-09-12 Thread Richard Diamond via Phabricator via cfe-commits
DiamondLovesYou added a comment.

In https://reviews.llvm.org/D51986#1232419, @DiamondLovesYou wrote:

> In https://reviews.llvm.org/D51986#1232320, @beanz wrote:
>
> > I don’t think this is the right solution. The build system knows what 
> > components are in the dylib and should remove them from the list of 
> > libraries linked individually. You should be able to make Polly behave like 
> > an LLVM component, then tools don’t need to care if the dylib is used or 
> > not.
>
>
> That's not true if `target_link_libraries(${target} _whatever_ ${libs})` is 
> used. That function will pull in all of each of `${libs}`' dependencies, 
> which causes problems because then, eg, `bugpoint` will then be linked with 
> `libLLVM.so` (as expected) AND `libPolly.a` (assuming `BUILD_SHARED_MODULES` 
> is false) AND then a bunch of LLVM components. The LLVM components (including 
> Polly) will then conflict with `libLLVM.so`.
>
> Polly already enjoys status as an LLVM component. No effort was necessary to 
> include Polly in `libLLVM.so` for example.


To add: is there a why to specify optional (as in, link if present) components?


Repository:
  rC Clang

https://reviews.llvm.org/D51986



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


[PATCH] D51986: Fixes for `LLVM_LINK_LLVM_DYLIB` && Polly.

2018-09-12 Thread Richard Diamond via Phabricator via cfe-commits
DiamondLovesYou added a comment.

In https://reviews.llvm.org/D51986#1232320, @beanz wrote:

> I don’t think this is the right solution. The build system knows what 
> components are in the dylib and should remove them from the list of libraries 
> linked individually. You should be able to make Polly behave like an LLVM 
> component, then tools don’t need to care if the dylib is used or not.


That's not true if `target_link_libraries(${target} _whatever_ ${libs})` is 
used. That function will pull in all of each of `${libs}`' dependencies, which 
causes problems because then, eg, `bugpoint` will then be linked with 
`libLLVM.so` (as expected) AND `libPolly.a` (assuming `BUILD_SHARED_MODULES` is 
false) AND then a bunch of LLVM components. The LLVM components (including 
Polly) will then conflict with `libLLVM.so`.

Polly already enjoys status as an LLVM component. No effort was necessary to 
include Polly in `libLLVM.so` for example.


Repository:
  rC Clang

https://reviews.llvm.org/D51986



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


[PATCH] D49999: [Hexagon] Remove fp-contract=fast setting for at O3

2018-09-12 Thread Brendon Cahoon via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC342078: [Hexagon] Remove fp-contract=fast setting for at O3 
(authored by bcahoon, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D4?vs=158029=165143#toc

Repository:
  rC Clang

https://reviews.llvm.org/D4

Files:
  lib/Driver/ToolChains/Hexagon.cpp
  test/Driver/hexagon-toolchain-elf.c


Index: lib/Driver/ToolChains/Hexagon.cpp
===
--- lib/Driver/ToolChains/Hexagon.cpp
+++ lib/Driver/ToolChains/Hexagon.cpp
@@ -513,11 +513,6 @@
 void HexagonToolChain::addClangTargetOptions(const ArgList ,
  ArgStringList ,
  Action::OffloadKind) const {
-  if (!DriverArgs.hasArg(options::OPT_ffp_contract)) {
-unsigned OptLevel = getOptimizationLevel(DriverArgs);
-if (OptLevel >= 3)
-  CC1Args.push_back("-ffp-contract=fast");
-  }
   if (DriverArgs.hasArg(options::OPT_ffixed_r19)) {
 CC1Args.push_back("-target-feature");
 CC1Args.push_back("+reserved-r19");
Index: test/Driver/hexagon-toolchain-elf.c
===
--- test/Driver/hexagon-toolchain-elf.c
+++ test/Driver/hexagon-toolchain-elf.c
@@ -110,7 +110,7 @@
 // RUN:   -O3 \
 // RUN:   %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK026 %s
-// CHECK026: "-ffp-contract=fast"
+// CHECK026-NOT: "-ffp-contract=fast"
 // CHECK026: hexagon-link
 
 // RUN: %clang -### -target hexagon-unknown-elf \


Index: lib/Driver/ToolChains/Hexagon.cpp
===
--- lib/Driver/ToolChains/Hexagon.cpp
+++ lib/Driver/ToolChains/Hexagon.cpp
@@ -513,11 +513,6 @@
 void HexagonToolChain::addClangTargetOptions(const ArgList ,
  ArgStringList ,
  Action::OffloadKind) const {
-  if (!DriverArgs.hasArg(options::OPT_ffp_contract)) {
-unsigned OptLevel = getOptimizationLevel(DriverArgs);
-if (OptLevel >= 3)
-  CC1Args.push_back("-ffp-contract=fast");
-  }
   if (DriverArgs.hasArg(options::OPT_ffixed_r19)) {
 CC1Args.push_back("-target-feature");
 CC1Args.push_back("+reserved-r19");
Index: test/Driver/hexagon-toolchain-elf.c
===
--- test/Driver/hexagon-toolchain-elf.c
+++ test/Driver/hexagon-toolchain-elf.c
@@ -110,7 +110,7 @@
 // RUN:   -O3 \
 // RUN:   %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK026 %s
-// CHECK026: "-ffp-contract=fast"
+// CHECK026-NOT: "-ffp-contract=fast"
 // CHECK026: hexagon-link
 
 // RUN: %clang -### -target hexagon-unknown-elf \
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r342078 - [Hexagon] Remove fp-contract=fast setting for at O3

2018-09-12 Thread Brendon Cahoon via cfe-commits
Author: bcahoon
Date: Wed Sep 12 13:35:56 2018
New Revision: 342078

URL: http://llvm.org/viewvc/llvm-project?rev=342078=rev
Log:
[Hexagon] Remove fp-contract=fast setting for at O3

Change Hexagon so that the setting for fp-contract is the default setting.
This makes Hexagon consistent with all other targets.

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


Modified:
cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp
cfe/trunk/test/Driver/hexagon-toolchain-elf.c

Modified: cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp?rev=342078=342077=342078=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp Wed Sep 12 13:35:56 2018
@@ -513,11 +513,6 @@ unsigned HexagonToolChain::getOptimizati
 void HexagonToolChain::addClangTargetOptions(const ArgList ,
  ArgStringList ,
  Action::OffloadKind) const {
-  if (!DriverArgs.hasArg(options::OPT_ffp_contract)) {
-unsigned OptLevel = getOptimizationLevel(DriverArgs);
-if (OptLevel >= 3)
-  CC1Args.push_back("-ffp-contract=fast");
-  }
   if (DriverArgs.hasArg(options::OPT_ffixed_r19)) {
 CC1Args.push_back("-target-feature");
 CC1Args.push_back("+reserved-r19");

Modified: cfe/trunk/test/Driver/hexagon-toolchain-elf.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/hexagon-toolchain-elf.c?rev=342078=342077=342078=diff
==
--- cfe/trunk/test/Driver/hexagon-toolchain-elf.c (original)
+++ cfe/trunk/test/Driver/hexagon-toolchain-elf.c Wed Sep 12 13:35:56 2018
@@ -110,7 +110,7 @@
 // RUN:   -O3 \
 // RUN:   %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK026 %s
-// CHECK026: "-ffp-contract=fast"
+// CHECK026-NOT: "-ffp-contract=fast"
 // CHECK026: hexagon-link
 
 // RUN: %clang -### -target hexagon-unknown-elf \


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


[PATCH] D51713: Support -fno-omit-frame-pointer with -pg.

2018-09-12 Thread Manoj Gupta via Phabricator via cfe-commits
manojgupta added a comment.

What is the call generated with -pg for AMR32, __gnu_mcount_nc or _mount? 
__gnu_mcount_nc  with "-pg" is known to be broken ( 
https://bugs.llvm.org/show_bug.cgi?id=33845)


Repository:
  rC Clang

https://reviews.llvm.org/D51713



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


[PATCH] D51905: Front-end of the implementation of the interleaving algorithm

2018-09-12 Thread Zhaomo Yang via Phabricator via cfe-commits
zhaomo added inline comments.



Comment at: clang/lib/CodeGen/ItaniumCXXABI.cpp:1767
 
+  bool InBounds = shouldInterleaveVTables(VTableClass) ? false : true;
   return llvm::ConstantExpr::getGetElementPtr(VTable->getValueType(), VTable,

pcc wrote:
> Remind me why this needs to be here? (And the explanation needs to be in a 
> comment.)
The calculation of address point is essentially base_vtable_addr + offset, 
where offset is from the indices of gep.
In the interleaving pass, we replace base_vtable_addr with 
(addr_point_in_interleaved_layout - offset).

The LLVM language reference says that the base address of a inbounds gep must 
be an in bound address of the object. The new base address 
addr_point_in_interleaved_layout - offset, however, may not be an in bound 
address.


https://reviews.llvm.org/D51905



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


[PATCH] D52000: Feedback/direction Review for cpu-dispatch emit stage into GlobalDecl

2018-09-12 Thread Erich Keane via Phabricator via cfe-commits
erichkeane created this revision.
erichkeane added a reviewer: rsmith.
Herald added a subscriber: cfe-commits.

In the feedback in https://reviews.llvm.org/D51650 
(https://reviews.llvm.org/D51650),
@rsmith points out an implementation detail of CPU-Dispatch
is improperly done.  I'd like to fix this here before rebasing
target_clones on the patch resulting from this feedback.  
This is a first-run at making the GlobalDecl contain the index
of the multiversion version.

The other suggestion @rsmith made was to make getting the MV-type
more streamlined.  I've been thinking of ways to do that, and will
likely attempt to fix it before target_clones goes in with a rebase.

There are two big points of feedback that I'd really appreciate:
1- I suspect that something serious needs to be done on GlobalDecl.
It currently holds a 2 bit value in a PointerIntPair, which obviously
won't work for the index.  I added an unsigned, but am open to
suggestions on how to store this better.

2- CodeGenModule::getFunctionFeatureMap takes a FunctionDecl, but the
features are dependent on the GlobalDecl now. I traced usages upwards,
and many cases don't have GlobalDecl in its call-tree (since it comes
from a callee).  I'm not sure it matters, since only the emit-call should
require this info, but any suggestions are greatly appreciated.


Repository:
  rC Clang

https://reviews.llvm.org/D52000

Files:
  include/clang/AST/GlobalDecl.h
  include/clang/Basic/Attr.td
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  test/CodeGen/attr-cpuspecific.c

Index: test/CodeGen/attr-cpuspecific.c
===
--- test/CodeGen/attr-cpuspecific.c
+++ test/CodeGen/attr-cpuspecific.c
@@ -27,22 +27,25 @@
 
 __attribute__((cpu_specific(ivybridge)))
 void TwoVersions(void){}
-// CHECK: define void @TwoVersions.S() #[[S]]
+// CHECK: define void @TwoVersions.S()
+// TODO: #[[S]]
 
 __attribute__((cpu_specific(knl)))
 void TwoVersions(void){}
 // CHECK: define void @TwoVersions.Z() #[[K:[0-9]+]]
 
 __attribute__((cpu_specific(ivybridge, knl)))
 void TwoVersionsSameAttr(void){}
 // CHECK: define void @TwoVersionsSameAttr.S() #[[S]]
-// CHECK: define void @TwoVersionsSameAttr.Z() #[[K]]
+// CHECK: define void @TwoVersionsSameAttr.Z()
+// TODO: #[[K]]
 
 __attribute__((cpu_specific(atom, ivybridge, knl)))
 void ThreeVersionsSameAttr(void){}
 // CHECK: define void @ThreeVersionsSameAttr.O() #[[O:[0-9]+]]
 // CHECK: define void @ThreeVersionsSameAttr.S() #[[S]]
-// CHECK: define void @ThreeVersionsSameAttr.Z() #[[K]]
+// CHECK: define void @ThreeVersionsSameAttr.Z()
+// TODO #[[K]]
 
 void usages() {
   SingleVersion();
@@ -96,6 +99,12 @@
 // CHECK: ret void ()* @HasGeneric.A
 // CHECK-NOT: call void @llvm.trap
 
-// CHECK: attributes #[[S]] = {{.*}}"target-features"="+avx,+cmov,+f16c,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave"
-// CHECK: attributes #[[K]] = {{.*}}"target-features"="+adx,+avx,+avx2,+avx512cd,+avx512er,+avx512f,+avx512pf,+bmi,+cmov,+f16c,+fma,+lzcnt,+mmx,+movbe,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave"
-// CHECK: attributes #[[O]] = {{.*}}"target-features"="+cmov,+mmx,+movbe,+sse,+sse2,+sse3,+ssse3,+x87"
+__attribute__((cpu_specific(atom, ivybridge))) void HasGeneric(void) {}
+// CHECK: define void @HasGeneric.O()
+// TODO: #[[O]]
+// CHECK: define void @HasGeneric.S()
+// TODO: #[[S]]
+
+// XCHECK: attributes #[[S]] = {{.*}}"target-features"="+avx,+cmov,+f16c,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave"
+// XCHECK: attributes #[[K]] = {{.*}}"target-features"="+adx,+avx,+avx2,+avx512cd,+avx512er,+avx512f,+avx512pf,+bmi,+cmov,+f16c,+fma,+lzcnt,+mmx,+movbe,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave"
+// XCHECK: attributes #[[O]] = {{.*}}"target-features"="+cmov,+mmx,+movbe,+sse,+sse2,+sse3,+ssse3,+x87"
Index: lib/CodeGen/CodeGenModule.h
===
--- lib/CodeGen/CodeGenModule.h
+++ lib/CodeGen/CodeGenModule.h
@@ -1311,6 +1311,8 @@
   void EmitGlobalDefinition(GlobalDecl D, llvm::GlobalValue *GV = nullptr);
 
   void EmitGlobalFunctionDefinition(GlobalDecl GD, llvm::GlobalValue *GV);
+  void EmitMultiVersionFunctionDefinition(GlobalDecl GD, llvm::GlobalValue *GV);
+
   void EmitGlobalVarDefinition(const VarDecl *D, bool IsTentative = false);
   void EmitAliasDefinition(GlobalDecl GD);
   void emitIFuncDefinition(GlobalDecl GD);
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -877,10 +877,11 @@
 
 static void AppendCPUSpecificCPUDispatchMangling(const CodeGenModule ,
  const CPUSpecificAttr *Attr,
+ unsigned CPUIndex,
  raw_ostream ) {
   // cpu_specific gets the current name, 

[PATCH] D51955: Create infrastructure for defining and testing feature test macros

2018-09-12 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists closed this revision.
mclow.lists added a comment.

landed as revision 342073


https://reviews.llvm.org/D51955



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


[libcxx] r342073 - Implement the infrastructure for feature-test macros. Very few actual feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955

2018-09-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Sep 12 12:41:40 2018
New Revision: 342073

URL: http://llvm.org/viewvc/llvm-project?rev=342073=rev
Log:
Implement the infrastructure for feature-test macros. Very few actual feature 
test macros, though. Reviewed as: https://reviews.llvm.org/D51955

Added:

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/execution.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/memory_resource.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
Modified:
libcxx/trunk/include/algorithm
libcxx/trunk/include/any
libcxx/trunk/include/array
libcxx/trunk/include/atomic
libcxx/trunk/include/bit
libcxx/trunk/include/chrono
libcxx/trunk/include/cmath
libcxx/trunk/include/complex
libcxx/trunk/include/cstddef
libcxx/trunk/include/deque

[PATCH] D48581: [AArch64] Support reserving x1-7 registers.

2018-09-12 Thread Tri Vo via Phabricator via cfe-commits
trong updated this revision to Diff 165132.
trong added a comment.

Added test cases for combination of -ffixed flags.


https://reviews.llvm.org/D48581

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Driver/Options.td
  lib/Driver/ToolChains/Arch/AArch64.cpp
  test/Driver/aarch64-fixed-x-register.c
  test/Driver/aarch64-fixed-x18.c
  test/Driver/aarch64-fixed-x20.c

Index: test/Driver/aarch64-fixed-x20.c
===
--- test/Driver/aarch64-fixed-x20.c
+++ /dev/null
@@ -1,4 +0,0 @@
-// RUN: %clang -target aarch64-none-gnu -ffixed-x20 -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-FIXED-X20 < %t %s
-
-// CHECK-FIXED-X20: "-target-feature" "+reserve-x20"
Index: test/Driver/aarch64-fixed-x18.c
===
--- test/Driver/aarch64-fixed-x18.c
+++ /dev/null
@@ -1,4 +0,0 @@
-// RUN: %clang -target aarch64-none-gnu -ffixed-x18 -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s
-
-// CHECK-FIXED-X18: "-target-feature" "+reserve-x18"
Index: test/Driver/aarch64-fixed-x-register.c
===
--- /dev/null
+++ test/Driver/aarch64-fixed-x-register.c
@@ -0,0 +1,71 @@
+// RUN: %clang -target aarch64-none-gnu -ffixed-x1 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X1 < %t %s
+// CHECK-FIXED-X1: "-target-feature" "+reserve-x1"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x2 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X2 < %t %s
+// CHECK-FIXED-X2: "-target-feature" "+reserve-x2"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x3 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X3 < %t %s
+// CHECK-FIXED-X3: "-target-feature" "+reserve-x3"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x4 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X4 < %t %s
+// CHECK-FIXED-X4: "-target-feature" "+reserve-x4"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x5 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X5 < %t %s
+// CHECK-FIXED-X5: "-target-feature" "+reserve-x5"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x6 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X6 < %t %s
+// CHECK-FIXED-X6: "-target-feature" "+reserve-x6"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x7 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X7 < %t %s
+// CHECK-FIXED-X7: "-target-feature" "+reserve-x7"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x18 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s
+// CHECK-FIXED-X18: "-target-feature" "+reserve-x18"
+
+// RUN: %clang -target aarch64-none-gnu -ffixed-x20 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X20 < %t %s
+// CHECK-FIXED-X20: "-target-feature" "+reserve-x20"
+
+// Test multiple of reserve-x# options together.
+// RUN: %clang -target aarch64-none-gnu \
+// RUN: -ffixed-x1 \
+// RUN: -ffixed-x2 \
+// RUN: -ffixed-x18 \
+// RUN: -### %s 2> %t
+// RUN: FileCheck \
+// RUN: --check-prefix=CHECK-FIXED-X1 \
+// RUN: --check-prefix=CHECK-FIXED-X2 \
+// RUN: --check-prefix=CHECK-FIXED-X18 \
+// RUN: < %t %s
+
+// Test all reserve-x# options together.
+// RUN: %clang -target aarch64-none-gnu \
+// RUN: -ffixed-x1 \
+// RUN: -ffixed-x2 \
+// RUN: -ffixed-x3 \
+// RUN: -ffixed-x4 \
+// RUN: -ffixed-x5 \
+// RUN: -ffixed-x6 \
+// RUN: -ffixed-x7 \
+// RUN: -ffixed-x18 \
+// RUN: -ffixed-x20 \
+// RUN: -### %s 2> %t
+// RUN: FileCheck \
+// RUN: --check-prefix=CHECK-FIXED-X1 \
+// RUN: --check-prefix=CHECK-FIXED-X2 \
+// RUN: --check-prefix=CHECK-FIXED-X3 \
+// RUN: --check-prefix=CHECK-FIXED-X4 \
+// RUN: --check-prefix=CHECK-FIXED-X5 \
+// RUN: --check-prefix=CHECK-FIXED-X6 \
+// RUN: --check-prefix=CHECK-FIXED-X7 \
+// RUN: --check-prefix=CHECK-FIXED-X18 \
+// RUN: --check-prefix=CHECK-FIXED-X20 \
+// RUN: < %t %s
Index: lib/Driver/ToolChains/Arch/AArch64.cpp
===
--- lib/Driver/ToolChains/Arch/AArch64.cpp
+++ lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -198,6 +198,27 @@
 if (A->getOption().matches(options::OPT_mno_unaligned_access))
   Features.push_back("+strict-align");
 
+  if (Args.hasArg(options::OPT_ffixed_x1))
+Features.push_back("+reserve-x1");
+
+  if (Args.hasArg(options::OPT_ffixed_x2))
+Features.push_back("+reserve-x2");
+
+  if (Args.hasArg(options::OPT_ffixed_x3))
+Features.push_back("+reserve-x3");
+
+  if (Args.hasArg(options::OPT_ffixed_x4))
+Features.push_back("+reserve-x4");
+
+  if (Args.hasArg(options::OPT_ffixed_x5))
+Features.push_back("+reserve-x5");
+
+  if (Args.hasArg(options::OPT_ffixed_x6))
+Features.push_back("+reserve-x6");
+
+  if (Args.hasArg(options::OPT_ffixed_x7))
+Features.push_back("+reserve-x7");
+
   if (Args.hasArg(options::OPT_ffixed_x18))
 Features.push_back("+reserve-x18");
 
Index: 

[PATCH] D50359: Add a new library, libclang-cxx

2018-09-12 Thread Kristina Brooks via Phabricator via cfe-commits
kristina added a comment.

To elaborate, consider a scenario where a customer wants to build the clang 
driver, `diagtool` and just for the sake of the argument `change-namespace` 
from extras. Clang tools do not provide nearly the same level of control as 
most LLVM tools, so in that scenario, you'd have to maintain your own 
CMakeLists.txt for clang `tools(/extra)` to neuter unwanted artifacts like 
clang-tidy or libclang.so (the C API re-exporter) etc.

Unless I deeply misunderstand the functionality of toggles within LLVM's main 
build system, the only way of neutering those artifacts while still being able 
to use `libclang-cxx.so` would be surgery on several CMakeLists.


Repository:
  rC Clang

https://reviews.llvm.org/D50359



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


[PATCH] D51657: [CMake] Link to compiler-rt if LIBUNWIND_USE_COMPILER_RT is ON.

2018-09-12 Thread Charles Davis via Phabricator via cfe-commits
cdavis5x added a comment.

Ping.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D51657



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


[PATCH] D51986: Fixes for `LLVM_LINK_LLVM_DYLIB` && Polly.

2018-09-12 Thread Chris Bieneman via Phabricator via cfe-commits
beanz added a comment.

I don’t think this is the right solution. The build system knows what 
components are in the dylib and should remove them from the list of libraries 
linked individually. You should be able to make Polly behave like an LLVM 
component, then tools don’t need to care if the dylib is used or not.


Repository:
  rC Clang

https://reviews.llvm.org/D51986



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


[PATCH] D51921: [VFS] vfs::directory_iterator yields path and file type instead of full Status

2018-09-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments.



Comment at: include/clang/Basic/VirtualFileSystem.h:135
+  // For compatibility with old Status-based API. Prefer using Path directly.
+  StringRef getName() const { return Path; }
+};

bkramer wrote:
> sammccall wrote:
> > Backwards-compatibility notes:
> > 
> >  - Almost all users of `directory_iterator` require no source changes (with 
> > this change)
> >  - Implementations of VFS require changes if they support directory 
> > iteration and do not merely wrap other VFSes. Anecdotally, most do not 
> > require changes. 
> > 
> > So this weird API seems worth having to make out-of-tree breakages less 
> > painful.
> > Happy to update the internal uses though if that seems worthwhile.
> Can we mirror llvm::sys::fs::directory_entry's interface? I want the APIs to 
> be as close as possible. Upgrading users is not a big deal.
How much of the interface are you talking about? :-)

Making these private and calling the accessors `file()` and `type()` is easy of 
course, and consistency is nice.

Supporting status() with similar semantics+performance is both complicated 
and... not a good idea, I think. See the other patch where I added a comment 
like "this interface is wrong" and didn't fix it :-)

The other random functions on fs::directory_entry seem like random 
implementation cruft to me.


Repository:
  rC Clang

https://reviews.llvm.org/D51921



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


[libcxx] r342071 - Actually mark LWG#2953, don't just say you've done so in r342070

2018-09-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Sep 12 11:53:02 2018
New Revision: 342071

URL: http://llvm.org/viewvc/llvm-project?rev=342071=rev
Log:
Actually mark LWG#2953, don't just say you've done so in r342070

Modified:
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=342071=342070=342071=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Wed Sep 12 11:53:02 2018
@@ -148,7 +148,7 @@
https://wg21.link/LWG2948;>2948unique_ptr 
does not define operator<< for stream 
outputAlbuquerqueComplete
https://wg21.link/LWG2950;>2950std::byte 
operations are misspecifiedAlbuquerqueComplete
https://wg21.link/LWG2952;>2952iterator_traits should work 
for pointers to cv TAlbuquerqueComplete
-   https://wg21.link/LWG2953;>2953LWG 2853 
should apply to deque::erase tooAlbuquerque
+   https://wg21.link/LWG2953;>2953LWG 2853 
should apply to deque::erase tooAlbuquerqueComplete
https://wg21.link/LWG2958;>2958Moves 
improperly defined as deletedAlbuquerqueWe already do 
this
https://wg21.link/LWG2964;>2964Apparently 
redundant requirement for 
dynamic_pointer_castAlbuquerque
https://wg21.link/LWG2965;>2965Non-existing 
path::native_string() in filesystem_error::what() 
specificationAlbuquerqueNothing to do


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


[libcxx] r342070 - mark LWG#2953 as complete. No code changes required, but added a couple of extra tests.

2018-09-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Sep 12 11:51:12 2018
New Revision: 342070

URL: http://llvm.org/viewvc/llvm-project?rev=342070=rev
Log:
mark LWG#2953 as complete. No code changes required, but added a couple of 
extra tests.

Modified:

libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
libcxx/trunk/www/cxx2a_status.html

Modified: 
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp?rev=342070=342069=342070=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
 Wed Sep 12 11:51:12 2018
@@ -18,6 +18,23 @@
 #include 
 
 #include "min_allocator.h"
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct Throws {
+Throws() : v_(0) {}
+Throws(int v) : v_(v) {}
+Throws(const Throws  ) : v_(rhs.v_) { if (sThrows) throw 1; }
+Throws(  Throws &) : v_(rhs.v_) { if (sThrows) throw 1; }
+Throws& operator=(const Throws  ) { v_ = rhs.v_; return *this; }
+Throws& operator=(  Throws &) { v_ = rhs.v_; return *this; }
+int v_;
+
+static bool sThrows;
+};
+ 
+bool Throws::sThrows = false;
+#endif
 
 template 
 C
@@ -90,4 +107,19 @@ int main()
 testN> >(rng[i], rng[j]);
 }
 #endif
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+// Test for LWG2953:
+// Throws: Nothing unless an exception is thrown by the assignment operator of 
T.
+// (which includes move assignment)
+{
+Throws arr[] = {1, 2, 3};
+std::deque v(arr, arr+3);
+Throws::sThrows = true;
+v.erase(v.begin());
+v.erase(--v.end());
+v.erase(v.begin());
+assert(v.size() == 0);
+}
+#endif
 }

Modified: 
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp?rev=342070=342069=342070=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
 Wed Sep 12 11:51:12 2018
@@ -20,6 +20,24 @@
 #include 
 
 #include "min_allocator.h"
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct Throws {
+Throws() : v_(0) {}
+Throws(int v) : v_(v) {}
+Throws(const Throws  ) : v_(rhs.v_) { if (sThrows) throw 1; }
+Throws(  Throws &) : v_(rhs.v_) { if (sThrows) throw 1; }
+Throws& operator=(const Throws  ) { v_ = rhs.v_; return *this; }
+Throws& operator=(  Throws &) { v_ = rhs.v_; return *this; }
+int v_;
+
+static bool sThrows;
+};
+ 
+bool Throws::sThrows = false;
+#endif
+
 
 template 
 C
@@ -96,4 +114,18 @@ int main()
 testN> >(rng[i], rng[j]);
 }
 #endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
+// Test for LWG2953:
+// Throws: Nothing unless an exception is thrown by the assignment operator of 
T.
+// (which includes move assignment)
+{
+Throws arr[] = {1, 2, 3};
+std::deque v(arr, arr+3);
+Throws::sThrows = true;
+v.erase(v.begin(), --v.end());
+assert(v.size() == 1);
+v.erase(v.begin(), v.end());
+assert(v.size() == 0);
+}
+#endif
 }

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=342070=342069=342070=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Wed Sep 12 11:51:12 2018
@@ -73,7 +73,7 @@
https://wg21.link/P0768R1;>P0768R1CWGLibrary 
Support for the Spaceship (Comparison) 
OperatorAlbuquerque
https://wg21.link/P0777R1;>P0777R1LWGTreating 
Unnecessary 
decayAlbuquerqueComplete7.0
https://wg21.link/P0122R7;>P0122R7LWGspanJacksonvilleComplete7.0
-   https://wg21.link/P0355R7;>P0355R7LWGExtending 
chrono to Calendars and Time ZonesJacksonvilleIn 
progress
+   https://wg21.link/P0355R7;>P0355R7LWGExtending 
chrono to Calendars and Time ZonesJacksonvilleIn 
progress
https://wg21.link/P0551R3;>P0551R3LWGThou Shalt Not 
Specialize std Function 
Templates!Jacksonville
https://wg21.link/P0753R2;>P0753R2LWGManipulators 
for C++ Synchronized Buffered 
OstreamJacksonville
https://wg21.link/P0754R2;>P0754R2LWGversionJacksonvilleComplete7.0
@@ -89,7 +89,7 @@
https://wg21.link/P0476R2;>P0476R2LWGBit-casting 
object 

[PATCH] D50359: Add a new library, libclang-cxx

2018-09-12 Thread Kristina Brooks via Phabricator via cfe-commits
kristina added a comment.

I'm in support as long as it's a configuration option defaulting similar to 
LLVM's one. Should likely follow the same naming convention as LLVM, ie. 
`clang-shlib`. Clang has a lot of tools it ships with especially if you 
consider extras, I think this is one of the cases where an exception for 
`libClang-8.so` can be made as long as it's not a default. It would make builds 
of things like clang-tidy much faster without requiring a fully shared library 
build.


Repository:
  rC Clang

https://reviews.llvm.org/D50359



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


r342068 - [Diagnostic] Fix a warning typo. NFC.

2018-09-12 Thread Matt Davis via cfe-commits
Author: mattd
Date: Wed Sep 12 11:27:21 2018
New Revision: 342068

URL: http://llvm.org/viewvc/llvm-project?rev=342068=rev
Log:
[Diagnostic] Fix a warning typo. NFC.

s/aligment/alignment/


Modified:
cfe/trunk/docs/DiagnosticsReference.rst
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/Sema/Inputs/pragma-pack1.h
cfe/trunk/test/Sema/suspicious-pragma-pack.c

Modified: cfe/trunk/docs/DiagnosticsReference.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/DiagnosticsReference.rst?rev=342068=342067=342068=diff
==
--- cfe/trunk/docs/DiagnosticsReference.rst (original)
+++ cfe/trunk/docs/DiagnosticsReference.rst Wed Sep 12 11:27:21 2018
@@ -8637,9 +8637,9 @@ Also controls `-Wpragma-pack-suspicious-
 
 **Diagnostic text:**
 
-+---+
-|:warning:`warning:` |nbsp| :diagtext:`the current #pragma pack aligment value 
is modified in the included file`|
-+---+
+++
+|:warning:`warning:` |nbsp| :diagtext:`the current #pragma pack alignment 
value is modified in the included file`|
+++
 
 
+-+
 |:warning:`warning:` |nbsp| :diagtext:`unterminated '#pragma pack (push, ...)' 
at end of file`|

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=342068=342067=342068=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Sep 12 11:27:21 
2018
@@ -774,7 +774,7 @@ def warn_pragma_pack_non_default_at_incl
   "members in the included file">, InGroup,
   DefaultIgnore;
 def warn_pragma_pack_modified_after_include : Warning<
-  "the current #pragma pack aligment value is modified in the included "
+  "the current #pragma pack alignment value is modified in the included "
   "file">, InGroup;
 def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
   "'#pragma pack (push, ...)' at end of file">, InGroup;

Modified: cfe/trunk/test/Sema/Inputs/pragma-pack1.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/Inputs/pragma-pack1.h?rev=342068=342067=342068=diff
==
--- cfe/trunk/test/Sema/Inputs/pragma-pack1.h (original)
+++ cfe/trunk/test/Sema/Inputs/pragma-pack1.h Wed Sep 12 11:27:21 2018
@@ -16,7 +16,7 @@ struct ReceivesPragma { };
 #include "pragma-pack2.h"
 
 #ifdef SET_SECOND_HEADER
-// expected-warning@-3 {{the current #pragma pack aligment value is modified 
in the included file}}
+// expected-warning@-3 {{the current #pragma pack alignment value is modified 
in the included file}}
 #endif
 
 #ifdef PUSH_POP_FIRST_HEADER

Modified: cfe/trunk/test/Sema/suspicious-pragma-pack.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/suspicious-pragma-pack.c?rev=342068=342067=342068=diff
==
--- cfe/trunk/test/Sema/suspicious-pragma-pack.c (original)
+++ cfe/trunk/test/Sema/suspicious-pragma-pack.c Wed Sep 12 11:27:21 2018
@@ -38,7 +38,7 @@
 #include "pragma-pack1.h"
 
 #ifdef WARN_MODIFIED_HEADER
-// expected-warning@-3 {{the current #pragma pack aligment value is modified 
in the included file}}
+// expected-warning@-3 {{the current #pragma pack alignment value is modified 
in the included file}}
 #endif
 
 #ifdef PUSH_SET_HERE


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


[PATCH] D51997: [clang] Make sure attributes on member classes are applied properly

2018-09-12 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

This patch is missing support for partial specializations and explicit 
specializations. The part I don't understand is how to get the `CXXRecordDecl`s 
to have the right attribute below. Here's the AST dump for the test file with 
the current patch:

  TranslationUnitDecl 0x7f8a2a00a8e8 <> 
  |-TypedefDecl 0x7f8a2a00b1c0 <>  implicit 
__int128_t '__int128'
  | `-BuiltinType 0x7f8a2a00ae80 '__int128'
  |-TypedefDecl 0x7f8a2a00b228 <>  implicit 
__uint128_t 'unsigned __int128'
  | `-BuiltinType 0x7f8a2a00aea0 'unsigned __int128'
  |-TypedefDecl 0x7f8a2a00b558 <>  implicit 
__NSConstantString '__NSConstantString_tag'
  | `-RecordType 0x7f8a2a00b300 '__NSConstantString_tag'
  |   `-CXXRecord 0x7f8a2a00b278 '__NSConstantString_tag'
  |-TypedefDecl 0x7f8a28827600 <>  implicit 
__builtin_ms_va_list 'char *'
  | `-PointerType 0x7f8a2a00b5b0 'char *'
  |   `-BuiltinType 0x7f8a2a00a980 'char'
  |-TypedefDecl 0x7f8a28827928 <>  implicit 
__builtin_va_list '__va_list_tag [1]'
  | `-ConstantArrayType 0x7f8a288278d0 '__va_list_tag [1]' 1
  |   `-RecordType 0x7f8a288276e0 '__va_list_tag'
  | `-CXXRecord 0x7f8a28827650 '__va_list_tag'
  |-ClassTemplateDecl 0x7f8a28827ab8 
 col:26 A
  | |-TemplateTypeParmDecl 0x7f8a28827978  col:16 class depth 0 
index 0 T
  | |-CXXRecordDecl 0x7f8a28827a30  col:26 struct A definition
  | | |-DefinitionData empty aggregate standard_layout trivially_copyable pod 
trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
  | | | |-DefaultConstructor exists trivial constexpr needs_implicit 
defaulted_is_constexpr
  | | | |-CopyConstructor simple trivial has_const_param needs_implicit 
implicit_has_const_param
  | | | |-MoveConstructor exists simple trivial needs_implicit
  | | | |-CopyAssignment trivial has_const_param needs_implicit 
implicit_has_const_param
  | | | |-MoveAssignment exists simple trivial needs_implicit
  | | | `-Destructor simple irrelevant trivial needs_implicit
  | | |-CXXRecordDecl 0x7f8a28827d00  col:26 implicit struct A
  | | `-CXXRecordDecl 0x7f8a28827e38  col:70 struct X definition
  | |   |-DefinitionData empty aggregate standard_layout trivially_copyable pod 
trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
  | |   | |-DefaultConstructor exists trivial constexpr needs_implicit 
defaulted_is_constexpr
  | |   | |-CopyConstructor simple trivial has_const_param needs_implicit 
implicit_has_const_param
  | |   | |-MoveConstructor exists simple trivial needs_implicit
  | |   | |-CopyAssignment trivial has_const_param needs_implicit 
implicit_has_const_param
  | |   | |-MoveAssignment exists simple trivial needs_implicit
  | |   | `-Destructor simple irrelevant trivial needs_implicit
  | |   |-AbiTagAttr 0x7f8a28827f48  ATAG
  | |   `-CXXRecordDecl 0x7f8a28827fa8  col:70 implicit struct X
  | `-ClassTemplateSpecializationDecl 0x7f8a28828088  col:26 
struct A definition
  |   |-DefinitionData pass_in_registers empty aggregate standard_layout 
trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor 
can_const_default_init
  |   | |-DefaultConstructor exists trivial constexpr needs_implicit 
defaulted_is_constexpr
  |   | |-CopyConstructor simple trivial has_const_param needs_implicit 
implicit_has_const_param
  |   | |-MoveConstructor exists simple trivial needs_implicit
  |   | |-CopyAssignment trivial has_const_param needs_implicit 
implicit_has_const_param
  |   | |-MoveAssignment exists simple trivial needs_implicit
  |   | `-Destructor simple irrelevant trivial needs_implicit
  |   |-TemplateArgument type 'int'
  |   |-CXXRecordDecl 0x7f8a28828280 prev 0x7f8a28828088  
col:26 implicit struct A
  |   `-CXXRecordDecl 0x7f8a28828308  col:70 referenced struct X
  | `-AbiTagAttr 0x7f8a288283b0  ATAG
  |-FunctionDecl 0x7f8a2885a200  col:12 a 'A::X *()'
  | `-CompoundStmt 0x7f8a2885a328 
  |   `-ReturnStmt 0x7f8a2885a310 
  | `-ImplicitCastExpr 0x7f8a2885a2f8  'A::X *' 
  |   `-IntegerLiteral 0x7f8a2885a2d8  'int' 0
  |-ClassTemplateDecl 0x7f8a2885a448  col:26 B
  | |-TemplateTypeParmDecl 0x7f8a2885a340  col:16 class depth 0 
index 0 T
  | |-CXXRecordDecl 0x7f8a2885a3c0  col:26 struct B definition
  | | |-DefinitionData empty aggregate standard_layout trivially_copyable pod 
trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
  | | | |-DefaultConstructor exists trivial constexpr needs_implicit 
defaulted_is_constexpr
  | | | |-CopyConstructor simple trivial has_const_param needs_implicit 
implicit_has_const_param
  | | | |-MoveConstructor exists simple trivial needs_implicit
  | | | |-CopyAssignment trivial has_const_param needs_implicit 
implicit_has_const_param
  | | | |-MoveAssignment exists simple trivial needs_implicit
  | | | `-Destructor simple irrelevant trivial needs_implicit
  | | |-CXXRecordDecl 0x7f8a2885a690  col:26 implicit struct B
  | | `-ClassTemplateDecl 0x7f8a2885a888  col:88 X
  | |   |-TemplateTypeParmDecl 0x7f8a2885a718  col:45 class 

[PATCH] D50359: Add a new library, libclang-cxx

2018-09-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

> The motivation for this library is to
>  be used by Clang tools that use Clang's C++ api. They no longer need to
>  link against the individual static libraries.

I would personally consider that to be a regression.
It hides layering violations.
Of course, in downstream one might not care.


Repository:
  rC Clang

https://reviews.llvm.org/D50359



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


[PATCH] D51996: [clangd] Simplify cancellation public API

2018-09-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 165125.
sammccall added a comment.

Fix includes, formatting tweak.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51996

Files:
  clangd/Cancellation.cpp
  clangd/Cancellation.h
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  unittests/clangd/CancellationTests.cpp

Index: unittests/clangd/CancellationTests.cpp
===
--- unittests/clangd/CancellationTests.cpp
+++ unittests/clangd/CancellationTests.cpp
@@ -13,57 +13,48 @@
 namespace {
 
 TEST(CancellationTest, CancellationTest) {
-  TaskHandle TH = Task::createHandle();
-  WithContext ContextWithCancellation(setCurrentTask(TH));
+  auto Task = cancelableTask();
+  WithContext ContextWithCancellation(std::move(Task.first));
   EXPECT_FALSE(isCancelled());
-  TH->cancel();
+  Task.second();
   EXPECT_TRUE(isCancelled());
 }
 
-TEST(CancellationTest, TaskTestHandleDiesContextLives) {
+TEST(CancellationTest, CancelerDiesContextLives) {
   llvm::Optional ContextWithCancellation;
   {
-TaskHandle TH = Task::createHandle();
-ContextWithCancellation.emplace(setCurrentTask(TH));
+auto Task = cancelableTask();
+ContextWithCancellation.emplace(std::move(Task.first));
 EXPECT_FALSE(isCancelled());
-TH->cancel();
+Task.second();
 EXPECT_TRUE(isCancelled());
   }
   EXPECT_TRUE(isCancelled());
 }
 
 TEST(CancellationTest, TaskContextDiesHandleLives) {
-  TaskHandle TH = Task::createHandle();
+  auto Task = cancelableTask();
   {
-WithContext ContextWithCancellation(setCurrentTask(TH));
+WithContext ContextWithCancellation(std::move(Task.first));
 EXPECT_FALSE(isCancelled());
-TH->cancel();
+Task.second();
 EXPECT_TRUE(isCancelled());
   }
   // Still should be able to cancel without any problems.
-  TH->cancel();
-}
-
-TEST(CancellationTest, CancellationToken) {
-  TaskHandle TH = Task::createHandle();
-  WithContext ContextWithCancellation(setCurrentTask(TH));
-  const auto  = getCurrentTask();
-  EXPECT_FALSE(CT.isCancelled());
-  TH->cancel();
-  EXPECT_TRUE(CT.isCancelled());
+  Task.second();
 }
 
 TEST(CancellationTest, AsynCancellationTest) {
   std::atomic HasCancelled(false);
   Notification Cancelled;
-  auto TaskToBeCancelled = [&](ConstTaskHandle CT) {
-WithContext ContextGuard(setCurrentTask(std::move(CT)));
+  auto TaskToBeCancelled = [&](Context Ctx) {
+WithContext ContextGuard(std::move(Ctx));
 Cancelled.wait();
 HasCancelled = isCancelled();
   };
-  TaskHandle TH = Task::createHandle();
-  std::thread AsyncTask(TaskToBeCancelled, TH);
-  TH->cancel();
+  auto Task = cancelableTask();
+  std::thread AsyncTask(TaskToBeCancelled, std::move(Task.first));
+  Task.second();
   Cancelled.notify();
   AsyncTask.join();
 
Index: clangd/ClangdServer.h
===
--- clangd/ClangdServer.h
+++ clangd/ClangdServer.h
@@ -125,9 +125,9 @@
   /// while returned future is not yet ready.
   /// A version of `codeComplete` that runs \p Callback on the processing thread
   /// when codeComplete results become available.
-  TaskHandle codeComplete(PathRef File, Position Pos,
-  const clangd::CodeCompleteOptions ,
-  Callback CB);
+  Canceler codeComplete(PathRef File, Position Pos,
+const clangd::CodeCompleteOptions ,
+Callback CB);
 
   /// Provide signature help for \p File at \p Pos.  This method should only be
   /// called for tracked files.
Index: clangd/ClangdServer.cpp
===
--- clangd/ClangdServer.cpp
+++ clangd/ClangdServer.cpp
@@ -201,16 +201,16 @@
   WorkScheduler.remove(File);
 }
 
-TaskHandle ClangdServer::codeComplete(PathRef File, Position Pos,
-  const clangd::CodeCompleteOptions ,
-  Callback CB) {
+Canceler ClangdServer::codeComplete(PathRef File, Position Pos,
+const clangd::CodeCompleteOptions ,
+Callback CB) {
   // Copy completion options for passing them to async task handler.
   auto CodeCompleteOpts = Opts;
   if (!CodeCompleteOpts.Index) // Respect overridden index.
 CodeCompleteOpts.Index = Index;
 
-  TaskHandle TH = Task::createHandle();
-  WithContext ContextWithCancellation(setCurrentTask(TH));
+  auto Cancelable = cancelableTask();
+  WithContext ContextWithCancellation(std::move(Cancelable.first));
   // Copy PCHs to avoid accessing this->PCHs concurrently
   std::shared_ptr PCHs = this->PCHs;
   auto FS = FSProvider.getFileSystem();
@@ -259,7 +259,7 @@
   // We use a potentially-stale preamble because latency is critical here.
   WorkScheduler.runWithPreamble("CodeComplete", File, TUScheduler::Stale,
 

[PATCH] D50359: Add a new library, libclang-cxx

2018-09-12 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

As I mentioned in the discussion, we decided to carry build rules for the 
proposed library in downstream.  I've updated this to make it more general, and 
will leave it open in case there's more interest to revive it in the future.


Repository:
  rC Clang

https://reviews.llvm.org/D50359



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


[PATCH] D51921: [VFS] vfs::directory_iterator yields path and file type instead of full Status

2018-09-12 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments.



Comment at: include/clang/Basic/VirtualFileSystem.h:135
+  // For compatibility with old Status-based API. Prefer using Path directly.
+  StringRef getName() const { return Path; }
+};

sammccall wrote:
> Backwards-compatibility notes:
> 
>  - Almost all users of `directory_iterator` require no source changes (with 
> this change)
>  - Implementations of VFS require changes if they support directory iteration 
> and do not merely wrap other VFSes. Anecdotally, most do not require changes. 
> 
> So this weird API seems worth having to make out-of-tree breakages less 
> painful.
> Happy to update the internal uses though if that seems worthwhile.
Can we mirror llvm::sys::fs::directory_entry's interface? I want the APIs to be 
as close as possible. Upgrading users is not a big deal.


Repository:
  rC Clang

https://reviews.llvm.org/D51921



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


[PATCH] D51997: [clang] Make sure attributes on member classes are applied properly

2018-09-12 Thread Louis Dionne via Phabricator via cfe-commits
ldionne created this revision.
ldionne added a reviewer: rsmith.
Herald added subscribers: cfe-commits, dexonsmith.

Attributes on member classes of class templates (and other similar entities)
are not currently instantiated. This was discovered by Richard Smith here:

  http://lists.llvm.org/pipermail/cfe-dev/2018-September/059291.html

This commit makes sure that attributes are instantiated properly.

PR38913


Repository:
  rC Clang

https://reviews.llvm.org/D51997

Files:
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/SemaCXX/PR38913.cpp


Index: clang/test/SemaCXX/PR38913.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/PR38913.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | 
FileCheck %s
+
+// PR38913
+// Check that we instantiate attributes on declarations for...
+
+// ...a member class of a class template specialization
+template struct A { struct __attribute__((abi_tag("ATAG"))) X { }; };
+A::X* a() { return 0; } // CHECK-DAG: @_Z1aB4ATAGv
+
+// ...a member class template
+template struct B { template struct 
__attribute__((abi_tag("BTAG"))) X { }; };
+B::X* b() { return 0; } // CHECK-DAG: @_Z1bB4BTAGv
+
+// ...a member partial specialization
+template struct C {
+  template struct X { };
+  template struct __attribute__((abi_tag("CTAG"))) X { };
+};
+C::X* c() { return 0; } // CHECK-DAG: @_Z1cB4CTAGv
+
+// ...a member explicit specialization
+template struct D {
+  template struct X { };
+  template<> struct __attribute__((abi_tag("DTAG"))) X { };
+};
+D::X* d() { return 0; } // CHECK-DAG: @_Z1dB4DTAGv
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1264,6 +1264,10 @@
   assert(!(isFriend && Owner->isDependentContext()));
   Inst->setPreviousDecl(PrevClassTemplate);
 
+  // Instantiate the attributes on both the template declaration and the 
associated record declaration.
+  SemaRef.InstantiateAttrsForDecl(TemplateArgs, Pattern, Inst, LateAttrs, 
StartingScope);
+  SemaRef.InstantiateAttrsForDecl(TemplateArgs, Pattern, RecordInst, 
LateAttrs, StartingScope);
+
   RecordInst->setDescribedClassTemplate(Inst);
 
   if (isFriend) {
@@ -1491,6 +1495,8 @@
   if (SubstQualifier(D, Record))
 return nullptr;
 
+  SemaRef.InstantiateAttrsForDecl(TemplateArgs, D, Record, LateAttrs, 
StartingScope);
+
   Record->setImplicit(D->isImplicit());
   // FIXME: Check against AS_none is an ugly hack to work around the issue that
   // the tag decls introduced by friend class declarations don't have an access


Index: clang/test/SemaCXX/PR38913.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/PR38913.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+
+// PR38913
+// Check that we instantiate attributes on declarations for...
+
+// ...a member class of a class template specialization
+template struct A { struct __attribute__((abi_tag("ATAG"))) X { }; };
+A::X* a() { return 0; } // CHECK-DAG: @_Z1aB4ATAGv
+
+// ...a member class template
+template struct B { template struct __attribute__((abi_tag("BTAG"))) X { }; };
+B::X* b() { return 0; } // CHECK-DAG: @_Z1bB4BTAGv
+
+// ...a member partial specialization
+template struct C {
+  template struct X { };
+  template struct __attribute__((abi_tag("CTAG"))) X { };
+};
+C::X* c() { return 0; } // CHECK-DAG: @_Z1cB4CTAGv
+
+// ...a member explicit specialization
+template struct D {
+  template struct X { };
+  template<> struct __attribute__((abi_tag("DTAG"))) X { };
+};
+D::X* d() { return 0; } // CHECK-DAG: @_Z1dB4DTAGv
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1264,6 +1264,10 @@
   assert(!(isFriend && Owner->isDependentContext()));
   Inst->setPreviousDecl(PrevClassTemplate);
 
+  // Instantiate the attributes on both the template declaration and the associated record declaration.
+  SemaRef.InstantiateAttrsForDecl(TemplateArgs, Pattern, Inst, LateAttrs, StartingScope);
+  SemaRef.InstantiateAttrsForDecl(TemplateArgs, Pattern, RecordInst, LateAttrs, StartingScope);
+
   RecordInst->setDescribedClassTemplate(Inst);
 
   if (isFriend) {
@@ -1491,6 +1495,8 @@
   if (SubstQualifier(D, Record))
 return nullptr;
 
+  SemaRef.InstantiateAttrsForDecl(TemplateArgs, D, Record, LateAttrs, StartingScope);
+
   Record->setImplicit(D->isImplicit());
   // FIXME: Check against AS_none is an ugly hack to work around the issue that
   // the tag decls introduced by friend class declarations don't have an access
___
cfe-commits mailing list

[PATCH] D51996: [clangd] Simplify cancellation public API

2018-09-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
sammccall added reviewers: ilya-biryukov, kadircet.
Herald added subscribers: cfe-commits, jfb, arphaman, jkorous, MaskRay, ioeric.

Task is no longer exposed:

- task cancellation is hidden as a std::function
- task creation returns the new context directly
- checking is via free function only, with no way to avoid the context lookup

The implementation is essentially the same, but a bit terser as it's hidden.

isCancelled() is now safe to use outside any task (it returns false).
This will leave us free to sprinkle cancellation in e.g. TUScheduler without
needing elaborate test setup, and lets callers that don't cancel "just work".

Updated the docs to describe the new expected use pattern.
One thing I noticed: there's nothing async-specific about the cancellation.
Async tasks can be cancelled from any thread (typically the one that created
them), sync tasks can be cancelled from any *other* thread in the same way.
So the docs now refer to "long-running" tasks instead of async ones.

Updated usage in code complete, without any structural changes.
I didn't update all the names of the helpers in ClangdLSPServer (these will
likely be moved to JSONRPCDispatcher anyway).


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51996

Files:
  clangd/Cancellation.cpp
  clangd/Cancellation.h
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  unittests/clangd/CancellationTests.cpp

Index: unittests/clangd/CancellationTests.cpp
===
--- unittests/clangd/CancellationTests.cpp
+++ unittests/clangd/CancellationTests.cpp
@@ -13,57 +13,48 @@
 namespace {
 
 TEST(CancellationTest, CancellationTest) {
-  TaskHandle TH = Task::createHandle();
-  WithContext ContextWithCancellation(setCurrentTask(TH));
+  auto Task = cancelableTask();
+  WithContext ContextWithCancellation(std::move(Task.first));
   EXPECT_FALSE(isCancelled());
-  TH->cancel();
+  Task.second();
   EXPECT_TRUE(isCancelled());
 }
 
-TEST(CancellationTest, TaskTestHandleDiesContextLives) {
+TEST(CancellationTest, CancelerDiesContextLives) {
   llvm::Optional ContextWithCancellation;
   {
-TaskHandle TH = Task::createHandle();
-ContextWithCancellation.emplace(setCurrentTask(TH));
+auto Task = cancelableTask();
+ContextWithCancellation.emplace(std::move(Task.first));
 EXPECT_FALSE(isCancelled());
-TH->cancel();
+Task.second();
 EXPECT_TRUE(isCancelled());
   }
   EXPECT_TRUE(isCancelled());
 }
 
 TEST(CancellationTest, TaskContextDiesHandleLives) {
-  TaskHandle TH = Task::createHandle();
+  auto Task = cancelableTask();
   {
-WithContext ContextWithCancellation(setCurrentTask(TH));
+WithContext ContextWithCancellation(std::move(Task.first));
 EXPECT_FALSE(isCancelled());
-TH->cancel();
+Task.second();
 EXPECT_TRUE(isCancelled());
   }
   // Still should be able to cancel without any problems.
-  TH->cancel();
-}
-
-TEST(CancellationTest, CancellationToken) {
-  TaskHandle TH = Task::createHandle();
-  WithContext ContextWithCancellation(setCurrentTask(TH));
-  const auto  = getCurrentTask();
-  EXPECT_FALSE(CT.isCancelled());
-  TH->cancel();
-  EXPECT_TRUE(CT.isCancelled());
+  Task.second();
 }
 
 TEST(CancellationTest, AsynCancellationTest) {
   std::atomic HasCancelled(false);
   Notification Cancelled;
-  auto TaskToBeCancelled = [&](ConstTaskHandle CT) {
-WithContext ContextGuard(setCurrentTask(std::move(CT)));
+  auto TaskToBeCancelled = [&](Context Ctx) {
+WithContext ContextGuard(std::move(Ctx));
 Cancelled.wait();
 HasCancelled = isCancelled();
   };
-  TaskHandle TH = Task::createHandle();
-  std::thread AsyncTask(TaskToBeCancelled, TH);
-  TH->cancel();
+  auto Task = cancelableTask();
+  std::thread AsyncTask(TaskToBeCancelled, std::move(Task.first));
+  Task.second();
   Cancelled.notify();
   AsyncTask.join();
 
Index: clangd/ClangdServer.h
===
--- clangd/ClangdServer.h
+++ clangd/ClangdServer.h
@@ -125,9 +125,9 @@
   /// while returned future is not yet ready.
   /// A version of `codeComplete` that runs \p Callback on the processing thread
   /// when codeComplete results become available.
-  TaskHandle codeComplete(PathRef File, Position Pos,
-  const clangd::CodeCompleteOptions ,
-  Callback CB);
+  Canceler codeComplete(PathRef File, Position Pos,
+const clangd::CodeCompleteOptions ,
+Callback CB);
 
   /// Provide signature help for \p File at \p Pos.  This method should only be
   /// called for tracked files.
Index: clangd/ClangdServer.cpp
===
--- clangd/ClangdServer.cpp
+++ clangd/ClangdServer.cpp
@@ -201,16 +201,16 @@
   WorkScheduler.remove(File);
 }
 
-TaskHandle 

[PATCH] D50359: Add a new library, libclang-cxx

2018-09-12 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 165118.
pirama added a comment.
Herald added a subscriber: fedor.sergeev.

Add empty source file to silence CMake warning.
Support more platforms, similar to libLLVM.so


Repository:
  rC Clang

https://reviews.llvm.org/D50359

Files:
  CMakeLists.txt
  tools/CMakeLists.txt
  tools/libclang-cxx/CMakeLists.txt
  tools/libclang-cxx/libclang_cxx.cpp

Index: tools/libclang-cxx/libclang_cxx.cpp
===
--- /dev/null
+++ tools/libclang-cxx/libclang_cxx.cpp
@@ -0,0 +1,8 @@
+//===- libclang_cxx.cpp - libclang_cxx Shared Library ---===//
+//===--===//
+//
+// This file is empty and serves only the purpose of making CMake happy because
+// you can't define a target with no sources.
+//
+//===--===//
+
Index: tools/libclang-cxx/CMakeLists.txt
===
--- /dev/null
+++ tools/libclang-cxx/CMakeLists.txt
@@ -0,0 +1,87 @@
+set(SOURCES
+  libclang_cxx.cpp
+  )
+
+set(LIBS
+  clangBasic
+  clangCodeGen
+  clangDriver
+  clangFrontend
+  clangFrontendTool
+)
+
+if (CLANG_ENABLE_ARCMT)
+  list(APPEND LIBS clangARCMigrate)
+endif ()
+
+if (TARGET clangTidyPlugin)
+  add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
+  list(APPEND LIBS clangTidyPlugin)
+  list(APPEND LIBS clangIncludeFixerPlugin)
+  if(LLVM_ENABLE_MODULES)
+list(APPEND LLVM_COMPILE_FLAGS "-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD")
+  endif()
+endif ()
+
+find_library(DL_LIBRARY_PATH dl)
+if (DL_LIBRARY_PATH)
+  list(APPEND LIBS dl)
+endif()
+
+if( LLVM_ENABLE_PIC )
+  set(ENABLE_SHARED SHARED)
+endif()
+
+if(NOT LLVM_ENABLE_PIC AND NOT WIN32)
+  set(ENABLE_STATIC STATIC)
+endif()
+
+if(WIN32)
+  set(output_name "libclang_cxx")
+else()
+  set(output_name "clang_cxx")
+endif()
+
+if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU)
+OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
+OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
+OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
+OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")
+OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")) # FIXME: It should be "GNU ld for elf"
+  set(LIBS -Wl,--whole-archive ${LIBS} -Wl,--no-whole-archive)
+elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
+  set(LIBS -Wl,-all_load ${LIBS})
+endif()
+
+add_clang_library(libclang_cxx ${ENABLE_SHARED} ${ENABLE_STATIC}
+  OUTPUT_NAME ${output_name}
+  ${SOURCES}
+  LINK_LIBS
+  ${LIBS}
+  )
+
+if(ENABLE_SHARED)
+  if(WIN32)
+set_target_properties(libclang_cxx
+  PROPERTIES
+  VERSION ${LIBCLANG_LIBRARY_VERSION}
+  DEFINE_SYMBOL _CINDEX_LIB_)
+  elseif(APPLE)
+  set(LIBCLANG_CXX_LINK_FLAGS " -Wl,-compatibility_version -Wl,1")
+  set(LIBCLANG_CXX_LINK_FLAGS "${LIBCLANG_CXX_LINK_FLAGS} -Wl,-current_version -Wl,${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
+
+set_property(TARGET libclang_cxx APPEND_STRING PROPERTY
+LINK_FLAGS ${LIBCLANG_CXX_LINK_FLAGS})
+  else()
+set_target_properties(libclang_cxx
+  PROPERTIES
+  VERSION ${LIBCLANG_LIBRARY_VERSION}
+  DEFINE_SYMBOL _CINDEX_LIB_)
+# FIXME: _CINDEX_LIB_ affects dllexport/dllimport on Win32.
+if(LLVM_ENABLE_MODULES AND NOT WIN32)
+  target_compile_options(libclang_cxx PRIVATE
+"-fmodules-ignore-macro=_CINDEX_LIB_"
+)
+endif()
+  endif()
+endif()
Index: tools/CMakeLists.txt
===
--- tools/CMakeLists.txt
+++ tools/CMakeLists.txt
@@ -35,3 +35,4 @@
 
 # libclang may require clang-tidy in clang-tools-extra.
 add_clang_subdirectory(libclang)
+add_clang_subdirectory(libclang-cxx)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -422,7 +422,7 @@
 "Major version number that will be appended to the clang executable name")
 set(LIBCLANG_LIBRARY_VERSION
 "${CLANG_VERSION_MAJOR}" CACHE STRING
-"Major version number that will be appended to the libclang library")
+"Major version number that will be appended to the libclang, libclang_cxx libraries")
 mark_as_advanced(CLANG_EXECUTABLE_VERSION LIBCLANG_LIBRARY_VERSION)
 
 option(CLANG_INCLUDE_TESTS
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51729: [Tooling] JSONCompilationDatabasePlugin infers compile commands for missing files

2018-09-12 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

I like it


Repository:
  rC Clang

https://reviews.llvm.org/D51729



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


[PATCH] D51949: [WIP][clang-tidy] initial ideas to isolate variable declarations

2018-09-12 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added inline comments.



Comment at: clang-tidy/readability/IsolateDeclCheck.cpp:35
+
+  std::string TypeAndName =
+  VarType.getAsString(TypePrinter) + " " + D->getNameAsString();

kbobyrev wrote:
> `llvm::Twine` here? Seems like this one is used a lot for concatenation, so 
> just `.str()` when returning.
the logic already changed (but i did not update the diff, because its still 
super prototype).
Maybe i go to `Twine`, but i want it do be more a utility function that can be 
used in other checks that want to do type transformations.



Comment at: clang-tidy/readability/IsolateDeclCheck.cpp:51
+
+return TypeAndName + " = " + Initializer + ";";
+  }

kbobyrev wrote:
> This seems to replace `int x = 5, y = 42;` with `int x = 5;int y = 42`. I 
> don't think that it becomes cleaner (in fact, without spaces in between it 
> looks cryptic). Consider formatting it or simply applying newlines (if there 
> were no newlines inbetween before).
I do not plan to do a lot of formatting here (maybe space or newline), because 
that clang-format area.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949



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


[PATCH] D48896: [libcxx][c++17] P0083R5: Splicing Maps and Sets Part 2: merge

2018-09-12 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added a comment.

Ping!


https://reviews.llvm.org/D48896



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


[PATCH] D51725: Allow un-setting the compilation database path

2018-09-12 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment.

In https://reviews.llvm.org/D51725#1232092, @ilya-biryukov wrote:

> Wow, this is getting somewhat complicated.
>
> Have you considered rerunning clangd whenever someone changes an option like 
> that?
>  Would that be much more complicated on your side?
>
> Not opposed to having an option too, just want to be aware of the costs 
> involved on your end.


Since we already support changing the compilation database path at runtime, I 
don't think it's significantly more complex to support resetting that value to 
the default of empty/not-used.  If we can restart clangd when the users chooses 
to use no compilation database path, we might as well just restart it every 
time the user selects a new compilation database path.

I was assuming that restarting clangd might potentially be significantly more 
costly than just changing a setting, but maybe I'm wrong.  The point of 
switching compilation database path is usually to point to a different build 
that has different flags, so all open files will get reparsed anyway...  And 
just start clangd isn't particularly heavy.

I'll investigate how difficult it is to make our frontend (Theia 
) restart clangd when the user switches 
compilation database.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51725



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


[PATCH] D51955: Create infrastructure for defining and testing feature test macros

2018-09-12 Thread Louis Dionne via Phabricator via cfe-commits
ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

Thanks! I don't like feature test macros either, but we should still strive for 
conformance.


https://reviews.llvm.org/D51955



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


[PATCH] D51971: [clangd] Use JSON format in benchmark requests reader

2018-09-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 165110.
kbobyrev marked an inline comment as done.
kbobyrev added a comment.

@ilya-biryukov thanks! I was assuming that the `StringRef` constructor parses 
user-provided string :(

`llvm::json::Array` is used now.


https://reviews.llvm.org/D51971

Files:
  clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp
  clang-tools-extra/test/clangd/Inputs/requests.json
  clang-tools-extra/test/clangd/Inputs/requests.log
  clang-tools-extra/test/clangd/index-tools.test

Index: clang-tools-extra/test/clangd/index-tools.test
===
--- clang-tools-extra/test/clangd/index-tools.test
+++ clang-tools-extra/test/clangd/index-tools.test
@@ -1,3 +1,3 @@
 # RUN: global-symbol-builder %p/Inputs/BenchmarkSource.cpp -- -I%p/Inputs > %t.index
 # FIXME: By default, benchmarks are excluded from the list of default targets hence not built. Find a way to depend on benchmarks to run the next command.
-# RUN: if [ -f %clangd-benchmark-dir/IndexBenchmark ]; then %clangd-benchmark-dir/IndexBenchmark %t.index %p/Inputs/requests.log --benchmark_min_time=0.01 ; fi
+# RUN: if [ -f %clangd-benchmark-dir/IndexBenchmark ]; then %clangd-benchmark-dir/IndexBenchmark %t.index %p/Inputs/requests.json --benchmark_min_time=0.01 ; fi
Index: clang-tools-extra/test/clangd/Inputs/requests.log
===
--- clang-tools-extra/test/clangd/Inputs/requests.log
+++ /dev/null
@@ -1,5 +0,0 @@
-V[09:08:34.301] Code complete: fuzzyFind("s", scopes=[llvm::])
-V[09:08:34.368] Code complete: fuzzyFind("sy", scopes=[llvm::])
-V[09:08:34.442] Code complete: fuzzyFind("sys", scopes=[llvm::])
-V[09:09:12.075] Code complete: fuzzyFind("Dex", scopes=[clang::clangd::, clang::, clang::clangd::dex::])
-V[09:09:12.075] Code complete: fuzzyFind("Variable", scopes=[])
Index: clang-tools-extra/test/clangd/Inputs/requests.json
===
--- /dev/null
+++ clang-tools-extra/test/clangd/Inputs/requests.json
@@ -0,0 +1,7 @@
+[{"MaxCandidateCount":100,"ProximityPaths":["/usr/home/user/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp"],"Query":"OMP","RestrictForCodeCompletion":true,"Scopes":["clang::"]},
+{"MaxCandidateCount":100,"ProximityPaths":[],"Query":"s","RestrictForCodeCompletion":true,"Scopes":["llvm::", "::"]},
+{"MaxCandidateCount":100,"ProximityPaths":[],"Query":"sy","RestrictForCodeCompletion":true,"Scopes":["llvm::", "::"]},
+{"MaxCandidateCount":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::", "::"]},
+{"MaxCandidateCount":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::", "::"]},
+{"MaxCandidateCount":100,"ProximityPaths":[],"Query":"Dex","RestrictForCodeCompletion":true,"Scopes":["clang::clangd::", "clang::", "clang::clangd::dex::"]},
+{"MaxCandidateCount":100,"ProximityPaths":[],"Query":"Variable","RestrictForCodeCompletion":true,"Scopes":["::"]}]
Index: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp
===
--- clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp
+++ clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp
@@ -19,56 +19,37 @@
 #include 
 
 const char *IndexFilename;
-const char *LogFilename;
+const char *RequestsFilename;
 
 namespace clang {
 namespace clangd {
 namespace {
 
-std::unique_ptr buildMem() {
-  return clang::clangd::loadIndex(IndexFilename, {}, false);
+std::unique_ptr buildMem() {
+  return loadIndex(IndexFilename, {}, false);
 }
 
-std::unique_ptr buildDex() {
-  return clang::clangd::loadIndex(IndexFilename, {}, true);
+std::unique_ptr buildDex() {
+  return loadIndex(IndexFilename, {}, true);
 }
 
-// This function processes user-provided Log file with fuzzy find requests in
-// the following format:
-//
-// fuzzyFind("UnqualifiedName", scopes=["clang::", "clang::clangd::"])
-//
-// It constructs vector of FuzzyFindRequests which is later used for the
-// benchmarks.
-std::vector extractQueriesFromLogs() {
-  llvm::Regex RequestMatcher("fuzzyFind\\(\"([a-zA-Z]*)\", scopes=\\[(.*)\\]");
-  llvm::SmallVector Matches;
-  std::ifstream InputStream(LogFilename);
+// Reads JSON array of serialized FuzzyFindRequest's from user-provided file.
+std::vector extractQueriesFromLogs() {
+  std::ifstream InputStream(RequestsFilename);
   std::string Log((std::istreambuf_iterator(InputStream)),
   std::istreambuf_iterator());
-  llvm::StringRef Temporary(Log);
-  llvm::SmallVector Strings;
-  Temporary.split(Strings, '\n');
-
-  clang::clangd::FuzzyFindRequest R;
-  R.MaxCandidateCount = 100;
 
-  llvm::SmallVector CommaSeparatedValues;
-
-  std::vector RealRequests;
-  for (auto Line : Strings) {
-if (RequestMatcher.match(Line, )) {
-  R.Query = Matches[1];
-  CommaSeparatedValues.clear();
-  Line.split(CommaSeparatedValues, ',');
-  

[libcxx] r342063 - Update the failure annotations for the uncaught_exceptions test. The underlying abi library on some Mac OS versions does not support the plural uncaught_exceptions, so libc++ emulat

2018-09-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Sep 12 09:59:09 2018
New Revision: 342063

URL: http://llvm.org/viewvc/llvm-project?rev=342063=rev
Log:
Update the failure annotations for the uncaught_exceptions test. The underlying 
abi library on some Mac OS versions does not support the plural 
uncaught_exceptions, so libc++ emulates it from the singlar; this means it will 
only return 0 or 1.


Modified:

libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp

Modified: 
libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp?rev=342063=342062=342063=diff
==
--- 
libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
 Wed Sep 12 09:59:09 2018
@@ -10,11 +10,11 @@
 // UNSUPPORTED: libcpp-no-exceptions
 // XFAIL: libcpp-no-exceptions
 
-// XFAIL: availability=macosx10.7
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.11
+// XFAIL: macosx10.7
+// XFAIL: macosx10.8
+// XFAIL: macosx10.9
+// XFAIL: macosx10.10
+// XFAIL: macosx10.11
 // XFAIL: with_system_cxx_lib=macosx10.12
 // XFAIL: with_system_cxx_lib=macosx10.13
 


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


[PATCH] D51990: [DebugInfo] Fix emitting of bit offset for ObjC

2018-09-12 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:2369
+  ? CGM.getObjCRuntime().ComputeBitfieldBitOffset(CGM, ID, Field)
+  : 0;
 } else {

JDevlieghere wrote:
> JDevlieghere wrote:
> > aprantl wrote:
> > > aprantl wrote:
> > > > It might help to attempt some git blame archeology.
> > > > Judging from the comment, it sounds like the debugger is supposed to 
> > > > query the runtime for the *byte* offset and then add the bit offset 
> > > > from DWARF? Could that make sense?
> > > If that is the case, we'd need to relax llvm-dwarfdump --verify to accept 
> > > this and make sure LLDB does the right thing instead.
> > Ah I see, yeah that sounds reasonable and explains the comment which I 
> > interpreted differently. Thanks! 
> btw it was added in rL167503. 
We should check whether emitting the offsets like this violates the DWARF spec. 
If yes, it may be better to emit the static offsets like you are doing here and 
then still have LLDB ignore everything but the bit-offsets from the dynamic 
byte offset.


Repository:
  rC Clang

https://reviews.llvm.org/D51990



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


r342062 - [OPENMP] Fix PR38902: support ADL for declare reduction constructs.

2018-09-12 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Wed Sep 12 09:31:59 2018
New Revision: 342062

URL: http://llvm.org/viewvc/llvm-project?rev=342062=rev
Log:
[OPENMP] Fix PR38902: support ADL for declare reduction constructs.

Added support for argument-dependent lookup when trying to find the
required declare reduction decl.

Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/declare_reduction_ast_print.cpp

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=342062=342061=342062=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Wed Sep 12 09:31:59 2018
@@ -10068,6 +10068,79 @@ static T filterLookupForUDR(SmallVectorI
   return T();
 }
 
+static NamedDecl *findAcceptableDecl(Sema , NamedDecl *D) {
+  assert(!LookupResult::isVisible(SemaRef, D) && "not in slow case");
+
+  for (auto RD : D->redecls()) {
+// Don't bother with extra checks if we already know this one isn't 
visible.
+if (RD == D)
+  continue;
+
+auto ND = cast(RD);
+if (LookupResult::isVisible(SemaRef, ND))
+  return ND;
+  }
+
+  return nullptr;
+}
+
+static void
+argumentDependentLookup(Sema , const DeclarationNameInfo ,
+SourceLocation Loc, QualType Ty,
+SmallVectorImpl> ) {
+  // Find all of the associated namespaces and classes based on the
+  // arguments we have.
+  Sema::AssociatedNamespaceSet AssociatedNamespaces;
+  Sema::AssociatedClassSet AssociatedClasses;
+  OpaqueValueExpr OVE(Loc, Ty, VK_LValue);
+  SemaRef.FindAssociatedClassesAndNamespaces(Loc, , AssociatedNamespaces,
+ AssociatedClasses);
+
+  // C++ [basic.lookup.argdep]p3:
+  //   Let X be the lookup set produced by unqualified lookup (3.4.1)
+  //   and let Y be the lookup set produced by argument dependent
+  //   lookup (defined as follows). If X contains [...] then Y is
+  //   empty. Otherwise Y is the set of declarations found in the
+  //   namespaces associated with the argument types as described
+  //   below. The set of declarations found by the lookup of the name
+  //   is the union of X and Y.
+  //
+  // Here, we compute Y and add its members to the overloaded
+  // candidate set.
+  for (auto *NS : AssociatedNamespaces) {
+//   When considering an associated namespace, the lookup is the
+//   same as the lookup performed when the associated namespace is
+//   used as a qualifier (3.4.3.2) except that:
+//
+// -- Any using-directives in the associated namespace are
+//ignored.
+//
+// -- Any namespace-scope friend functions declared in
+//associated classes are visible within their respective
+//namespaces even if they are not visible during an ordinary
+//lookup (11.4).
+DeclContext::lookup_result R = NS->lookup(ReductionId.getName());
+for (auto *D : R) {
+  auto *Underlying = D;
+  if (auto *USD = dyn_cast(D))
+Underlying = USD->getTargetDecl();
+
+  if (!isa(Underlying))
+continue;
+
+  if (!SemaRef.isVisible(D)) {
+D = findAcceptableDecl(SemaRef, D);
+if (!D)
+  continue;
+if (auto *USD = dyn_cast(D))
+  Underlying = USD->getTargetDecl();
+  }
+  Lookups.emplace_back();
+  Lookups.back().addDecl(Underlying);
+}
+  }
+}
+
 static ExprResult
 buildDeclareReductionRef(Sema , SourceLocation Loc, SourceRange Range,
  Scope *S, CXXScopeSpec ,
@@ -10086,7 +10159,7 @@ buildDeclareReductionRef(Sema ,
   } while (S && !S->isDeclScope(D));
   if (S)
 S = S->getParent();
-  Lookups.push_back(UnresolvedSet<8>());
+  Lookups.emplace_back();
   Lookups.back().append(Lookup.begin(), Lookup.end());
   Lookup.clear();
 }
@@ -10113,6 +10186,8 @@ buildDeclareReductionRef(Sema ,
   })) {
 UnresolvedSet<8> ResSet;
 for (const UnresolvedSet<8>  : Lookups) {
+  if (Set.empty())
+continue;
   ResSet.append(Set.begin(), Set.end());
   // The last item marks the end of all declarations at the specified 
scope.
   ResSet.addDecl(Set[Set.size() - 1]);
@@ -10122,6 +10197,36 @@ buildDeclareReductionRef(Sema ,
 ReductionIdScopeSpec.getWithLocInContext(SemaRef.Context), ReductionId,
 /*ADL=*/true, /*Overloaded=*/true, ResSet.begin(), ResSet.end());
   }
+  // Lookup inside the classes.
+  // C++ [over.match.oper]p3:
+  //   For a unary operator @ with an operand of a type whose
+  //   cv-unqualified version is T1, and for a binary operator @ with
+  //   a left operand of a type whose cv-unqualified version is T1 and
+  //   a right operand of a type whose cv-unqualified version is T2,
+  //   three sets of candidate functions, designated member
+  //   candidates, non-member candidates and 

[PATCH] D50250: [clang][ubsan] Implicit Conversion Sanitizer - integer sign change - clang part

2018-09-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

Ping once again :)


Repository:
  rC Clang

https://reviews.llvm.org/D50250



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


[PATCH] D50901: [clang][ubsan] Split Implicit Integer Truncation Sanitizer into unsigned and signed checks

2018-09-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

Ping once again :)


Repository:
  rC Clang

https://reviews.llvm.org/D50901



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


[PATCH] D51989: [clangd] dexp tool uses llvm::cl to parse its flags.

2018-09-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

A small drive-by comment.

PS it'd be cool to have an interface to cl that does not rely on global state...




Comment at: clangd/index/dex/dexp/Dexp.cpp:163
+
+struct {
+  const char *Name;

Maybe use a named struct?
C++ is powerful, but looks obscure at times...


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51989



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


[PATCH] D51971: [clangd] Use JSON format in benchmark requests reader

2018-09-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

In https://reviews.llvm.org/D51971#1232064, @kbobyrev wrote:

> Apparently, the parsing seems to be wrong; I should fix that first.


Oh, yeah, just use `llvm::json::parse`


https://reviews.llvm.org/D51971



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


[PATCH] D51725: Allow un-setting the compilation database path

2018-09-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

Wow, this is getting somewhat complicated.

Have you considered rerunning clangd whenever someone changes an option like 
that?
Would that be much more complicated on your side?

Not opposed to having an option too, just want to be aware of the costs 
involved on your end.




Comment at: clangd/Protocol.h:368
+  /// both Optionals are instantiated.
+  llvm::Optional> compilationDatabasePath;
 

Not a big fan or something like this, but maybe give special meaning to empty 
path instead of wrapping an optional into an optional?

Double optionals are a real pain to write and read.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51725



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


[PATCH] D51990: [DebugInfo] Fix emitting of bit offset for ObjC

2018-09-12 Thread Jonas Devlieghere via Phabricator via cfe-commits
JDevlieghere added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:2369
+  ? CGM.getObjCRuntime().ComputeBitfieldBitOffset(CGM, ID, Field)
+  : 0;
 } else {

JDevlieghere wrote:
> aprantl wrote:
> > aprantl wrote:
> > > It might help to attempt some git blame archeology.
> > > Judging from the comment, it sounds like the debugger is supposed to 
> > > query the runtime for the *byte* offset and then add the bit offset from 
> > > DWARF? Could that make sense?
> > If that is the case, we'd need to relax llvm-dwarfdump --verify to accept 
> > this and make sure LLDB does the right thing instead.
> Ah I see, yeah that sounds reasonable and explains the comment which I 
> interpreted differently. Thanks! 
btw it was added in rL167503. 


Repository:
  rC Clang

https://reviews.llvm.org/D51990



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


[PATCH] D51990: [DebugInfo] Fix emitting of bit offset for ObjC

2018-09-12 Thread Jonas Devlieghere via Phabricator via cfe-commits
JDevlieghere added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:2369
+  ? CGM.getObjCRuntime().ComputeBitfieldBitOffset(CGM, ID, Field)
+  : 0;
 } else {

aprantl wrote:
> aprantl wrote:
> > It might help to attempt some git blame archeology.
> > Judging from the comment, it sounds like the debugger is supposed to query 
> > the runtime for the *byte* offset and then add the bit offset from DWARF? 
> > Could that make sense?
> If that is the case, we'd need to relax llvm-dwarfdump --verify to accept 
> this and make sure LLDB does the right thing instead.
Ah I see, yeah that sounds reasonable and explains the comment which I 
interpreted differently. Thanks! 


Repository:
  rC Clang

https://reviews.llvm.org/D51990



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


[PATCH] D51971: [clangd] Use JSON format in benchmark requests reader

2018-09-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev planned changes to this revision.
kbobyrev marked an inline comment as done.
kbobyrev added a comment.

Apparently, the parsing seems to be wrong; I should fix that first.


https://reviews.llvm.org/D51971



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


r342060 - [RISCV] Explicitly set an empty --sysroot in the test

2018-09-12 Thread Roger Ferrer Ibanez via cfe-commits
Author: rogfer01
Date: Wed Sep 12 08:55:14 2018
New Revision: 342060

URL: http://llvm.org/viewvc/llvm-project?rev=342060=rev
Log:
[RISCV] Explicitly set an empty --sysroot in the test

In rL341655 we added additional behaviour to the Driver for riscv32-unknown-elf
when the sysroot is empty.

The new tests that check the new behaviour expect that the absence of --sysroot
in the command-line implies that the sysroot empty. This doesn't hold if clang
is built with a non-empty DEFAULT_SYSROOT in cmake. When this is the case, this
test fails.

Since the new behaviour is triggered when the sysroot is empty, pass an empty
--sysroot to avoid using the default (if any).

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


Modified:
cfe/trunk/test/Driver/riscv32-toolchain.c

Modified: cfe/trunk/test/Driver/riscv32-toolchain.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/riscv32-toolchain.c?rev=342060=342059=342060=diff
==
--- cfe/trunk/test/Driver/riscv32-toolchain.c (original)
+++ cfe/trunk/test/Driver/riscv32-toolchain.c Wed Sep 12 08:55:14 2018
@@ -21,6 +21,7 @@
 
 // RUN: %clang %s -### -no-canonical-prefixes \
 // RUN:   -target riscv32-unknown-elf \
+// RUN:   --sysroot= \
 // RUN:   --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
 // RUN:   | FileCheck -check-prefix=C-RV32-BAREMETAL-NOSYSROOT-ILP32 %s
 
@@ -52,6 +53,7 @@
 
 // RUN: %clangxx %s -### -no-canonical-prefixes \
 // RUN:   -target riscv32-unknown-elf -stdlib=libstdc++ \
+// RUN:   --sysroot= \
 // RUN:   --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
 // RUN:   | FileCheck -check-prefix=CXX-RV32-BAREMETAL-NOSYSROOT-ILP32 %s
 


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


[PATCH] D51972: [RISCV] Explicitly set an empty --sysroot in the test

2018-09-12 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC342060: [RISCV] Explicitly set an empty --sysroot in the 
test (authored by rogfer01, committed by ).
Herald added a subscriber: jrtc27.

Repository:
  rC Clang

https://reviews.llvm.org/D51972

Files:
  test/Driver/riscv32-toolchain.c


Index: test/Driver/riscv32-toolchain.c
===
--- test/Driver/riscv32-toolchain.c
+++ test/Driver/riscv32-toolchain.c
@@ -21,6 +21,7 @@
 
 // RUN: %clang %s -### -no-canonical-prefixes \
 // RUN:   -target riscv32-unknown-elf \
+// RUN:   --sysroot= \
 // RUN:   --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
 // RUN:   | FileCheck -check-prefix=C-RV32-BAREMETAL-NOSYSROOT-ILP32 %s
 
@@ -52,6 +53,7 @@
 
 // RUN: %clangxx %s -### -no-canonical-prefixes \
 // RUN:   -target riscv32-unknown-elf -stdlib=libstdc++ \
+// RUN:   --sysroot= \
 // RUN:   --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
 // RUN:   | FileCheck -check-prefix=CXX-RV32-BAREMETAL-NOSYSROOT-ILP32 %s
 


Index: test/Driver/riscv32-toolchain.c
===
--- test/Driver/riscv32-toolchain.c
+++ test/Driver/riscv32-toolchain.c
@@ -21,6 +21,7 @@
 
 // RUN: %clang %s -### -no-canonical-prefixes \
 // RUN:   -target riscv32-unknown-elf \
+// RUN:   --sysroot= \
 // RUN:   --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
 // RUN:   | FileCheck -check-prefix=C-RV32-BAREMETAL-NOSYSROOT-ILP32 %s
 
@@ -52,6 +53,7 @@
 
 // RUN: %clangxx %s -### -no-canonical-prefixes \
 // RUN:   -target riscv32-unknown-elf -stdlib=libstdc++ \
+// RUN:   --sysroot= \
 // RUN:   --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
 // RUN:   | FileCheck -check-prefix=CXX-RV32-BAREMETAL-NOSYSROOT-ILP32 %s
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51990: [DebugInfo] Fix emitting of bit offset for ObjC

2018-09-12 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:2369
+  ? CGM.getObjCRuntime().ComputeBitfieldBitOffset(CGM, ID, Field)
+  : 0;
 } else {

aprantl wrote:
> It might help to attempt some git blame archeology.
> Judging from the comment, it sounds like the debugger is supposed to query 
> the runtime for the *byte* offset and then add the bit offset from DWARF? 
> Could that make sense?
If that is the case, we'd need to relax llvm-dwarfdump --verify to accept this 
and make sure LLDB does the right thing instead.


Repository:
  rC Clang

https://reviews.llvm.org/D51990



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


[PATCH] D51990: [DebugInfo] Fix emitting of bit offset for ObjC

2018-09-12 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl requested changes to this revision.
aprantl added inline comments.
This revision now requires changes to proceed.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:2369
+  ? CGM.getObjCRuntime().ComputeBitfieldBitOffset(CGM, ID, Field)
+  : 0;
 } else {

It might help to attempt some git blame archeology.
Judging from the comment, it sounds like the debugger is supposed to query the 
runtime for the *byte* offset and then add the bit offset from DWARF? Could 
that make sense?


Repository:
  rC Clang

https://reviews.llvm.org/D51990



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


[PATCH] D51987: [clangd] Rename global-symbol-builder to clangd-symbol-builder.

2018-09-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

Thanks for the comments everyone! 
Will land this tomorrow, since I'm buildcop this week anyway.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51987



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


[PATCH] D51987: [clangd] Rename global-symbol-builder to clangd-symbol-builder.

2018-09-12 Thread Eric Liu via Phabricator via cfe-commits
ioeric accepted this revision.
ioeric added a comment.

In https://reviews.llvm.org/D51987#1232021, @sammccall wrote:

> In https://reviews.llvm.org/D51987#1231993, @ioeric wrote:
>
> > In https://reviews.llvm.org/D51987#1231990, @ilya-biryukov wrote:
> >
> > > > You beat it to me, but I thought we didn't use indexer as it could be 
> > > > confused with the actual indexing?
> > >
> > > Sorry. Not a big deal, can revert back if needed.
> > >  Mostly like indexer since it's shorter. Also not very confusing, since 
> > > we call the thing it produces an "index", so calling it an "indexer" 
> > > seems fine.
> > >
> > > What's the index you're referring to? Building data structures for faster 
> > > search?
> >
> >
> > Yes. The current symbol builder produces *symbol table*, which can be 
> > easily confused with an index. We might have a different tool that builds 
> > the symbol index structure (e.g. serialized dex), which might be a better 
> > candidate for the name "indexer".
>
>
> Part of the reason I like "indexer" here is I don't think it should be a 
> separate tool - it'd be nice if this tool would spit out a RIFF file with Dex 
> posting lists ready to be loaded.
>  (For huge codebases, things look different - but we've been talking about 
> using a different entrypoint for those anyway due to bifurcation around 
> merge-on-the-fly etc)


I wasn't aware that we are also expanding the scope of the symbol builder. If 
being short is not the only reason here, I have no problem.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51987



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


[PATCH] D51987: [clangd] Rename global-symbol-builder to clangd-symbol-builder.

2018-09-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

In https://reviews.llvm.org/D51987#1231993, @ioeric wrote:

> In https://reviews.llvm.org/D51987#1231990, @ilya-biryukov wrote:
>
> > > You beat it to me, but I thought we didn't use indexer as it could be 
> > > confused with the actual indexing?
> >
> > Sorry. Not a big deal, can revert back if needed.
> >  Mostly like indexer since it's shorter. Also not very confusing, since we 
> > call the thing it produces an "index", so calling it an "indexer" seems 
> > fine.
> >
> > What's the index you're referring to? Building data structures for faster 
> > search?
>
>
> Yes. The current symbol builder produces *symbol table*, which can be easily 
> confused with an index. We might have a different tool that builds the symbol 
> index structure (e.g. serialized dex), which might be a better candidate for 
> the name "indexer".


Part of the reason I like "indexer" here is I don't think it should be a 
separate tool - it'd be nice if this tool would spit out a RIFF file with Dex 
posting lists ready to be loaded.
(For huge codebases, things look different - but we've been talking about using 
a different entrypoint for those anyway due to bifurcation around 
merge-on-the-fly etc)


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51987



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


[PATCH] D51340: [WIP] Add /Zc:DllexportInlines option to clang-cl

2018-09-12 Thread Takuto Ikuta via Phabricator via cfe-commits
takuto.ikuta added inline comments.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:5244
+   false))
+CmdArgs.push_back("-fvisibility-inlines-hidden");
+

rnk wrote:
> takuto.ikuta wrote:
> > hans wrote:
> > > takuto.ikuta wrote:
> > > > hans wrote:
> > > > > Huh, does this actually affect whether functions get dllexported or 
> > > > > not?
> > > > Sorry, what you want to ask?
> > > > 
> > > > This will used to not add dllexport attr in L5690 of SemaDeclCXX.cpp.
> > > > 
> > > Oops, I didn't see that. I'm glad to see this is looking so simple :-)
> > > 
> > > Actually, I don't think we should the same flag name for this, since 
> > > "hidden" is an ELF concept, not a COFF one, just that we should match the 
> > > behaviour of the flag.
> > > 
> > > Hmm, or do people use -fvisibility-inlines-hidden on MinGW or something? 
> > > Where does the hidden-dllimport.cpp file come from?
> > > 
> > > Also, is it the case that -fvisibility-inlines-hidden just ignores the 
> > > problem of static local variables? If that's the case we can probably do 
> > > it too, we just have to be sure, and document it eventually.
> > > 
> > I confirmed that -fvisibility-inlines-hidden treats local static var 
> > correctly in linux.
> > So I'm trying to export inline functions if it has local static variables.
> This sounds like it would be really hard in general, since you can hide 
> static locals almost anywhere:
> ```
> struct Foo {
>   static int foo() {
> return ([]() { static int x; return ++x; })();
>   }
> };
> ```
> Can we reuse the RecursiveASTVisitor @hans added to check if we can emit 
> dllimport inline functions as available_externally definitions? I think it 
> will find exactly the circumstances we are looking for, i.e. export all the 
> things that cannot be emitted inline in other DLLs.
Actually, StmtVisitor added dll export attribute to local static variable in 
lambda function. And static variables seems exported.

But I found other issue in current implementation, some cxx method decls passed 
to emitting function before local static variable checker adds dll export 
attributes. In such case local static variables are not exported and link 
failure happens.

So let me try to use DLLImportFunctionVisitor in 
CodeGenModule::shouldEmitFunction for exported function instead of 
processing/checking dll attribute around SemaDeclCXX.


https://reviews.llvm.org/D51340



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


[PATCH] D51972: [RISCV] Explicitly set an empty --sysroot in the test

2018-09-12 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added a comment.

Thanks I will do it shortly.


https://reviews.llvm.org/D51972



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


[PATCH] D51972: [RISCV] Explicitly set an empty --sysroot in the test

2018-09-12 Thread Lewis Revill via Phabricator via cfe-commits
lewis-revill added a comment.

Great, go ahead.


https://reviews.llvm.org/D51972



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


[PATCH] D51972: [RISCV] Explicitly set an empty --sysroot in the test

2018-09-12 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added a comment.

I can commit it.


https://reviews.llvm.org/D51972



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


[PATCH] D51725: Allow un-setting the compilation database path

2018-09-12 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment.

Not sure who should review this, please feel free to add anybody who would be 
appropriate.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51725



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


[PATCH] D51990: [DebugInfo] Fix emitting of bit offset for ObjC

2018-09-12 Thread Jonas Devlieghere via Phabricator via cfe-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, dexonsmith.

We generate incorrect values for the DW_AT_data_bit_offset for interfaces in 
Objective-C. I can only speculate as to what we were trying to achieve by 
taking the modulo of the bit size with the byte size, but given that the size 
and offset is expressed in bits, this seems wrong.


Repository:
  rC Clang

https://reviews.llvm.org/D51990

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenObjC/debug-info-ivars.m


Index: clang/test/CodeGenObjC/debug-info-ivars.m
===
--- clang/test/CodeGenObjC/debug-info-ivars.m
+++ clang/test/CodeGenObjC/debug-info-ivars.m
@@ -15,30 +15,29 @@
 }
 @end
 
-@implementation BaseClass
-@end
+@implementation BaseClass
+@end
 
-// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i"
-// CHECK-SAME:   line: 10
-// CHECK-SAME:   baseType: ![[INT:[0-9]+]]
-// CHECK-SAME:   size: 32,
-// CHECK-NOT:offset:
-// CHECK-SAME:   flags: DIFlagProtected
-// CHECK: ![[INT]] = !DIBasicType(name: "int"
-// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_1"
-// CHECK-SAME:   line: 11
-// CHECK-SAME:   baseType: ![[UNSIGNED:[0-9]+]]
-// CHECK-SAME:   size: 9,
-// CHECK-NOT:offset:
-// CHECK-SAME:   flags: DIFlagProtected
-// CHECK: ![[UNSIGNED]] = !DIBasicType(name: "unsigned int"
-// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_2"
-// CHECK-SAME:   line: 12
-// CHECK-SAME:   baseType: ![[UNSIGNED]]
-// CHECK-SAME:   size: 9, offset: 1,
-// CHECK-SAME:   flags: DIFlagProtected
-// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_3"
-// CHECK-SAME:   line: 14
-// CHECK-SAME:   baseType: ![[UNSIGNED]]
-// CHECK-SAME:   size: 9, offset: 3,
-// CHECK-SAME:   flags: DIFlagProtected
+// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i"
+// CHECK-SAME:   line: 10
+// CHECK-SAME:   baseType: ![[INT:[0-9]+]]
+// CHECK-SAME:   size: 32,
+// CHECK-NOT:offset:
+// CHECK-SAME:   flags: DIFlagProtected
+// CHECK: ![[INT]] = !DIBasicType(name: "int"
+// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_1"
+// CHECK-SAME:   line: 11
+// CHECK-SAME:   baseType: ![[UNSIGNED:[0-9]+]]
+// CHECK-SAME:   size: 9, offset: 96
+// CHECK-SAME:   flags: DIFlagProtected
+// CHECK: ![[UNSIGNED]] = !DIBasicType(name: "unsigned int"
+// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_2"
+// CHECK-SAME:   line: 12
+// CHECK-SAME:   baseType: ![[UNSIGNED]]
+// CHECK-SAME:   size: 9, offset: 105
+// CHECK-SAME:   flags: DIFlagProtected
+// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_3"
+// CHECK-SAME:   line: 14
+// CHECK-SAME:   baseType: ![[UNSIGNED]]
+// CHECK-SAME:   size: 9, offset: 115
+// CHECK-SAME:   flags: DIFlagProtected
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2363,13 +2363,10 @@
   // We don't know the runtime offset of an ivar if we're using the
   // non-fragile ABI.  For bitfields, use the bit offset into the first
   // byte of storage of the bitfield.  For other fields, use zero.
-  if (Field->isBitField()) {
-FieldOffset =
-CGM.getObjCRuntime().ComputeBitfieldBitOffset(CGM, ID, Field);
-FieldOffset %= CGM.getContext().getCharWidth();
-  } else {
-FieldOffset = 0;
-  }
+  FieldOffset =
+  Field->isBitField()
+  ? CGM.getObjCRuntime().ComputeBitfieldBitOffset(CGM, ID, Field)
+  : 0;
 } else {
   FieldOffset = RL.getFieldOffset(FieldNo);
 }


Index: clang/test/CodeGenObjC/debug-info-ivars.m
===
--- clang/test/CodeGenObjC/debug-info-ivars.m
+++ clang/test/CodeGenObjC/debug-info-ivars.m
@@ -15,30 +15,29 @@
 }
 @end
 
-@implementation BaseClass
-@end
+@implementation BaseClass
+@end
 
-// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i"
-// CHECK-SAME:   line: 10
-// CHECK-SAME:   baseType: ![[INT:[0-9]+]]
-// CHECK-SAME:   size: 32,
-// CHECK-NOT:offset:
-// CHECK-SAME:   flags: DIFlagProtected
-// CHECK: ![[INT]] = !DIBasicType(name: "int"
-// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_1"
-// CHECK-SAME:   line: 11
-// CHECK-SAME:   baseType: ![[UNSIGNED:[0-9]+]]
-// CHECK-SAME:   size: 9,
-// CHECK-NOT:offset:
-// CHECK-SAME:   flags: DIFlagProtected
-// CHECK: ![[UNSIGNED]] = !DIBasicType(name: "unsigned 

[PATCH] D51987: [clangd] Rename global-symbol-builder to clangd-symbol-builder.

2018-09-12 Thread Eric Liu via Phabricator via cfe-commits
ioeric added a comment.

In https://reviews.llvm.org/D51987#1231990, @ilya-biryukov wrote:

> > You beat it to me, but I thought we didn't use indexer as it could be 
> > confused with the actual indexing?
>
> Sorry. Not a big deal, can revert back if needed.
>  Mostly like indexer since it's shorter. Also not very confusing, since we 
> call the thing it produces an "index", so calling it an "indexer" seems fine.
>
> What's the index you're referring to? Building data structures for faster 
> search?


Yes. The current symbol builder produces *symbol table*, which can be easily 
confused with an index. We might have a different tool that builds the symbol 
index structure (e.g. serialized dex), which might be a better candidate for 
the name "indexer".


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51987



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


[PATCH] D51987: [clangd] Rename global-symbol-builder to clangd-symbol-builder.

2018-09-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added a comment.

My 2 cents: `clangd-indexer` looks great! Typing 3-token tool name is always 
sad for me :( It's also easier to remember/understand in the first place.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51987



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


[PATCH] D51987: [clangd] Rename global-symbol-builder to clangd-symbol-builder.

2018-09-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

> You beat it to me, but I thought we didn't use indexer as it could be 
> confused with the actual indexing?

Sorry. Not a big deal, can revert back if needed.
Mostly like indexer since it's shorter. Also not very confusing, since we call 
the thing it produces an "index", so calling it an "indexer" seems fine.

What's the index you're referring to? Building data structures for faster 
search?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51987



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


[PATCH] D51987: [clangd] Rename global-symbol-builder to clangd-symbol-builder.

2018-09-12 Thread Eric Liu via Phabricator via cfe-commits
ioeric added a comment.

In https://reviews.llvm.org/D51987#1231971, @ilya-biryukov wrote:

> `clangd-indexer` looks nice and short. @ioeric, WDYT?


You beat it to me, but I thought we didn't use `indexer` as it could be 
confused with the actual `indexing`?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51987



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


[PATCH] D51987: [clangd] Rename global-symbol-builder to clangd-symbol-builder.

2018-09-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 165092.
ilya-biryukov added a comment.

- Rename to clangd-indexer


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51987

Files:
  clangd/CMakeLists.txt
  clangd/global-symbol-builder/CMakeLists.txt
  clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp
  clangd/indexer/CMakeLists.txt
  clangd/indexer/IndexerMain.cpp
  test/CMakeLists.txt
  test/clangd/index-tools.test


Index: test/clangd/index-tools.test
===
--- test/clangd/index-tools.test
+++ test/clangd/index-tools.test
@@ -1,3 +1,3 @@
-# RUN: global-symbol-builder %p/Inputs/BenchmarkSource.cpp -- -I%p/Inputs > 
%t.index
+# RUN: clangd-indexer %p/Inputs/BenchmarkSource.cpp -- -I%p/Inputs > %t.index
 # FIXME: By default, benchmarks are excluded from the list of default targets 
hence not built. Find a way to depend on benchmarks to run the next command.
 # RUN: if [ -f %clangd-benchmark-dir/IndexBenchmark ]; then 
%clangd-benchmark-dir/IndexBenchmark %t.index %p/Inputs/requests.log 
--benchmark_min_time=0.01 ; fi
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -55,7 +55,7 @@
 
   # These individual tools have no tests, add them here to make them compile
   # together with check-clang-tools, so that we won't break them in the future.
-  global-symbol-builder
+  clangd-indexer
 
   # Unit tests
   ExtraToolsUnitTests
Index: clangd/indexer/IndexerMain.cpp
===
--- clangd/indexer/IndexerMain.cpp
+++ clangd/indexer/IndexerMain.cpp
@@ -225,11 +225,11 @@
   Example usage for building index for the whole project using CMake compile
   commands:
 
-  $ global-symbol-builder --executor=all-TUs compile_commands.json > index.yaml
+  $ clangd-indexer --executor=all-TUs compile_commands.json > index.yaml
 
   Example usage for file sequence index without flags:
 
-  $ global-symbol-builder File1.cpp File2.cpp ... FileN.cpp > index.yaml
+  $ clangd-indexer File1.cpp File2.cpp ... FileN.cpp > index.yaml
 
   Note: only symbols from header files will be collected.
   )";
Index: clangd/indexer/CMakeLists.txt
===
--- clangd/indexer/CMakeLists.txt
+++ clangd/indexer/CMakeLists.txt
@@ -4,11 +4,11 @@
 Support
 )
 
-add_clang_executable(global-symbol-builder
-  GlobalSymbolBuilderMain.cpp
+add_clang_executable(clangd-indexer
+  IndexerMain.cpp
   )
 
-target_link_libraries(global-symbol-builder
+target_link_libraries(clangd-indexer
   PRIVATE
   clangAST
   clangIndex
Index: clangd/CMakeLists.txt
===
--- clangd/CMakeLists.txt
+++ clangd/CMakeLists.txt
@@ -73,7 +73,7 @@
   add_subdirectory(fuzzer)
 endif()
 add_subdirectory(tool)
-add_subdirectory(global-symbol-builder)
+add_subdirectory(indexer)
 add_subdirectory(index/dex/dexp)
 
 if (LLVM_INCLUDE_BENCHMARKS)


Index: test/clangd/index-tools.test
===
--- test/clangd/index-tools.test
+++ test/clangd/index-tools.test
@@ -1,3 +1,3 @@
-# RUN: global-symbol-builder %p/Inputs/BenchmarkSource.cpp -- -I%p/Inputs > %t.index
+# RUN: clangd-indexer %p/Inputs/BenchmarkSource.cpp -- -I%p/Inputs > %t.index
 # FIXME: By default, benchmarks are excluded from the list of default targets hence not built. Find a way to depend on benchmarks to run the next command.
 # RUN: if [ -f %clangd-benchmark-dir/IndexBenchmark ]; then %clangd-benchmark-dir/IndexBenchmark %t.index %p/Inputs/requests.log --benchmark_min_time=0.01 ; fi
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -55,7 +55,7 @@
 
   # These individual tools have no tests, add them here to make them compile
   # together with check-clang-tools, so that we won't break them in the future.
-  global-symbol-builder
+  clangd-indexer
 
   # Unit tests
   ExtraToolsUnitTests
Index: clangd/indexer/IndexerMain.cpp
===
--- clangd/indexer/IndexerMain.cpp
+++ clangd/indexer/IndexerMain.cpp
@@ -225,11 +225,11 @@
   Example usage for building index for the whole project using CMake compile
   commands:
 
-  $ global-symbol-builder --executor=all-TUs compile_commands.json > index.yaml
+  $ clangd-indexer --executor=all-TUs compile_commands.json > index.yaml
 
   Example usage for file sequence index without flags:
 
-  $ global-symbol-builder File1.cpp File2.cpp ... FileN.cpp > index.yaml
+  $ clangd-indexer File1.cpp File2.cpp ... FileN.cpp > index.yaml
 
   Note: only symbols from header files will be collected.
   )";
Index: clangd/indexer/CMakeLists.txt
===
--- clangd/indexer/CMakeLists.txt

[PATCH] D51972: [RISCV] Explicitly set an empty --sysroot in the test

2018-09-12 Thread Lewis Revill via Phabricator via cfe-commits
lewis-revill added a comment.

@asb @kristina can we get this committed?


https://reviews.llvm.org/D51972



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


[PATCH] D51488: [Sema][NFC] Small cleanup - remove dead code from ActOnCallExpr() ?

2018-09-12 Thread Jan Korous via Phabricator via cfe-commits
jkorous added a comment.

I got some test failure with the patch, still investigating the issue.


Repository:
  rC Clang

https://reviews.llvm.org/D51488



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


[PATCH] D51972: [RISCV] Explicitly set an empty --sysroot in the test

2018-09-12 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added a comment.

Thanks for the review!


https://reviews.llvm.org/D51972



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


[PATCH] D51987: [clangd] Rename global-symbol-builder to clangd-symbol-builder.

2018-09-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

`clangd-indexer` looks nice and short. @ioeric, WDYT?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51987



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


[PATCH] D51987: [clangd] Rename global-symbol-builder to clangd-symbol-builder.

2018-09-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a comment.

Much better.
I think `clangd-indexer` might be **even** better, but up to you.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51987



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


[libcxx] r342057 - Implement LWG #3017. list splice functions should use addressof

2018-09-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Sep 12 07:46:17 2018
New Revision: 342057

URL: http://llvm.org/viewvc/llvm-project?rev=342057=rev
Log:
Implement LWG #3017. list splice functions should use addressof

Modified:
libcxx/trunk/include/list
libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/include/list
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/list?rev=342057=342056=342057=diff
==
--- libcxx/trunk/include/list (original)
+++ libcxx/trunk/include/list Wed Sep 12 07:46:17 2018
@@ -2208,7 +2208,7 @@ template 
 void
 list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
 {
-if (this != &__c)
+if (this != _VSTD::addressof(__c))
 {
 iterator __f1 = begin();
 iterator __e1 = end();

Modified: 
libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp?rev=342057=342056=342057=diff
==
--- libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp Wed 
Sep 12 07:46:17 2018
@@ -10,6 +10,7 @@
 // 
 
 // void merge(list& x);
+// If ((x) == this) does nothing; otherwise ...
 
 #include 
 #include 
@@ -26,7 +27,16 @@ int main()
 std::list c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
 c1.merge(c2);
 assert(c1 == std::list(a3, a3+sizeof(a3)/sizeof(a3[0])));
+assert(c2.empty());
 }
+
+{
+int a1[] = {1, 3, 7, 9, 10};
+std::list c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+c1.merge(c1);
+assert((c1 == std::list(a1, a1+sizeof(a1)/sizeof(a1[0];
+}
+
 #if TEST_STD_VER >= 11
 {
 int a1[] = {1, 3, 7, 9, 10};
@@ -36,6 +46,7 @@ int main()
 std::list> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
 c1.merge(c2);
 assert((c1 == std::list>(a3, 
a3+sizeof(a3)/sizeof(a3[0];
+assert(c2.empty());
 }
 #endif
 }

Modified: 
libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp?rev=342057=342056=342057=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp 
Wed Sep 12 07:46:17 2018
@@ -10,6 +10,7 @@
 // 
 
 // template  void merge(list& x, Compare comp);
+// If ((x) == this) does nothing; otherwise ...
 
 #include 
 #include 
@@ -27,7 +28,15 @@ int main()
 std::list c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
 c1.merge(c2, std::greater());
 assert(c1 == std::list(a3, a3+sizeof(a3)/sizeof(a3[0])));
+assert(c2.empty());
 }
+{
+int a1[] = {10, 9, 7, 3, 1};
+std::list c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+c1.merge(c1, std::greater());
+assert((c1 == std::list(a1, a1+sizeof(a1)/sizeof(a1[0];
+}
+
 #if TEST_STD_VER >= 11
 {
 int a1[] = {10, 9, 7, 3, 1};
@@ -37,6 +46,7 @@ int main()
 std::list> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
 c1.merge(c2, std::greater());
 assert((c1 == std::list>(a3, 
a3+sizeof(a3)/sizeof(a3[0];
+assert(c2.empty());
 }
 #endif
 }

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=342057=342056=342057=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Wed Sep 12 07:46:17 2018
@@ -73,7 +73,7 @@
https://wg21.link/P0768R1;>P0768R1CWGLibrary 
Support for the Spaceship (Comparison) 
OperatorAlbuquerque
https://wg21.link/P0777R1;>P0777R1LWGTreating 
Unnecessary 
decayAlbuquerqueComplete7.0
https://wg21.link/P0122R7;>P0122R7LWGspanJacksonvilleComplete7.0
-   https://wg21.link/P0355R7;>P0355R7LWGExtending 
chrono to Calendars and Time 
ZonesJacksonville
+   https://wg21.link/P0355R7;>P0355R7LWGExtending 
chrono to Calendars and Time ZonesJacksonvilleIn 
progress
https://wg21.link/P0551R3;>P0551R3LWGThou Shalt Not 
Specialize std Function 
Templates!Jacksonville
https://wg21.link/P0753R2;>P0753R2LWGManipulators 
for C++ Synchronized Buffered 
OstreamJacksonville
https://wg21.link/P0754R2;>P0754R2LWGversionJacksonvilleComplete7.0
@@ -89,7 +89,7 @@
https://wg21.link/P0476R2;>P0476R2LWGBit-casting 
object representationsRapperswil
https://wg21.link/P0528R3;>P0528R3CWGThe Curious 
Case of Padding Bits, Featuring Atomic 

[PATCH] D51986: Fixes for `LLVM_LINK_LLVM_DYLIB` && Polly.

2018-09-12 Thread Richard Diamond via Phabricator via cfe-commits
DiamondLovesYou updated this revision to Diff 165090.
DiamondLovesYou added a comment.

- Fix cmake warning


Repository:
  rC Clang

https://reviews.llvm.org/D51986

Files:
  tools/driver/CMakeLists.txt


Index: tools/driver/CMakeLists.txt
===
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -122,6 +122,6 @@
   endif()
 endif()
 
-if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)
+if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS AND NOT LLVM_LINK_LLVM_DYLIB)
   target_link_libraries(clang PRIVATE Polly)
-endif(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)
+endif()


Index: tools/driver/CMakeLists.txt
===
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -122,6 +122,6 @@
   endif()
 endif()
 
-if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)
+if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS AND NOT LLVM_LINK_LLVM_DYLIB)
   target_link_libraries(clang PRIVATE Polly)
-endif(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)
+endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51989: [clangd] dexp tool uses llvm::cl to parse its flags.

2018-09-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
sammccall added a reviewer: kbobyrev.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, MaskRay, 
ioeric, ilya-biryukov.

We can use cl::ResetCommandLineParser() to support different types of
command-lines, as long as we're careful about option lifetimes.
(I tried using subcommands, but the error messages were bad)
I found a mostly-reasonable pattern to isolate the fiddly parts.

Added -scope and -limit flags to the `find` command to demonstrate.
(Note that scope support seems to be broken in dex?)

Fixed symbol lookup to parse symbol IDs.

Caveats:

- with command help (e.g. `find -help`), you also get some spam about required 
arguments. This is a bug in llvm::cl, which prints these to errs() rather than 
the designated stream.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51989

Files:
  clangd/index/dex/dexp/Dexp.cpp

Index: clangd/index/dex/dexp/Dexp.cpp
===
--- clangd/index/dex/dexp/Dexp.cpp
+++ clangd/index/dex/dexp/Dexp.cpp
@@ -25,7 +25,7 @@
 using clang::clangd::loadIndex;
 using clang::clangd::Symbol;
 using clang::clangd::SymbolIndex;
-using llvm::StringRef;
+using namespace llvm;
 
 namespace {
 
@@ -52,92 +52,128 @@
   llvm::outs() << llvm::formatv("{0} took {1:ms+n}.\n", Name, Duration);
 }
 
-void fuzzyFind(llvm::StringRef UnqualifiedName, const SymbolIndex ) {
-  FuzzyFindRequest Request;
-  Request.MaxCandidateCount = 10;
-  Request.Query = UnqualifiedName;
-  // FIXME(kbobyrev): Print symbol final scores to see the distribution.
-  static const auto OutputFormat = "{0,-4} | {1,-40} | {2,-25}\n";
-  llvm::outs() << llvm::formatv(OutputFormat, "Rank", "Symbol ID",
-"Symbol Name");
-  size_t Rank = 0;
-  Index.fuzzyFind(Request, [&](const Symbol ) {
-llvm::outs() << llvm::formatv(OutputFormat, Rank++, Sym.ID.str(), Sym.Name);
-  });
-}
-
-static const std::string HelpMessage = R"(dexp commands:
-
-> find Name
-
-Constructs fuzzy find request given unqualified symbol name and returns top 10
-symbols retrieved from index.
-
-> lookup SymbolID
-
-Retrieves symbol names given USR.
-)";
-
-void help() { llvm::outs() << HelpMessage; }
-
-void lookup(StringRef USR, const SymbolIndex ) {
-  llvm::DenseSet IDs{clang::clangd::SymbolID{USR}};
-  clang::clangd::LookupRequest Request{IDs};
-  bool FoundSymbol = false;
-  Index.lookup(Request, [&](const Symbol ) {
-if (!FoundSymbol)
-  FoundSymbol = true;
-llvm::outs() << SymbolToYAML(Sym);
-  });
-  if (!FoundSymbol)
-llvm::outs() << "not found\n";
-}
+// REPL commands inherit from Command and contain their options as members.
+// Creating a Command populates parser options, parseAndRun() resets them.
+class Command {
+  // By resetting the parser options, we lost the standard -help flag.
+  cl::opt> Help{
+  "help", cl::desc("Display available options"), cl::ValueDisallowed,
+  cl::cat(cl::GeneralCategory)};
+  virtual void run() = 0;
+
+protected:
+  const SymbolIndex *Index;
+
+public:
+  virtual ~Command() = default;
+  virtual void parseAndRun(ArrayRef Argv, const char *Overview,
+   const SymbolIndex ) {
+std::string ParseErrs;
+llvm::raw_string_ostream OS(ParseErrs);
+bool Ok =
+cl::ParseCommandLineOptions(Argv.size(), Argv.data(), Overview, );
+if (Help.getNumOccurrences() > 0) {
+  // Avoid printing parse errors in this case.
+  // (Well, in theory. A bunch get printed to llvm::errs() regardless!)
+  cl::PrintHelpMessage();
+} else {
+  outs() << OS.str();
+  if (Ok)
+run();
+}
+cl::ResetCommandLineParser(); // must do this before opts are destroyed.
+  }
+};
 
-// FIXME(kbobyrev): Make this an actual REPL: probably use LLVM Command Line
-// library for parsing flags and arguments.
-// FIXME(kbobyrev): Ideas for commands:
-// * symbol lookup: print out symbol in YAML format given SymbolID
+// FIXME(kbobyrev): Ideas for more commands:
 // * find symbol references: print set of reference locations
 // * load/swap/reload index: this would make it possible to get rid of llvm::cl
 //   usages in the tool driver and actually use llvm::cl library in the REPL.
 // * show posting list density histogram (our dump data somewhere so that user
 //   could build one)
 // * show number of tokens of each kind
 // * print out tokens with the most dense posting lists
 // * print out tokens with least dense posting lists
-void dispatch(StringRef Request, const SymbolIndex ) {
-  llvm::SmallVector Arguments;
-  Request.split(Arguments, ' ');
-  if (Arguments.empty()) {
-llvm::outs() << "Request can not be empty.\n";
-help();
-return;
-  }
 
-  if (Arguments.front() == "find") {
-if (Arguments.size() != 2) {
-  llvm::outs() << "find request must specify unqualified symbol name.\n";
-  return;
+class FuzzyFind : public Command {
+  cl::opt Query{
+  "query",
+  

[PATCH] D51971: [clangd] Use JSON format in benchmark requests reader

2018-09-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp:21
 
+using clang::clangd::loadIndex;
+using clang::clangd::SymbolIndex;

We don't need the usings, just shorten the name on usage sites (usages are 
inside namespace clangd)



Comment at: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp:39
 
-// This function processes user-provided Log file with fuzzy find requests in
-// the following format:
-//
-// fuzzyFind("UnqualifiedName", scopes=["clang::", "clang::clangd::"])
-//
-// It constructs vector of FuzzyFindRequests which is later used for the
-// benchmarks.
-std::vector extractQueriesFromLogs() {
-  llvm::Regex RequestMatcher("fuzzyFind\\(\"([a-zA-Z]*)\", scopes=\\[(.*)\\]");
-  llvm::SmallVector Matches;
-  std::ifstream InputStream(LogFilename);
+// Reads '\n'-separated FuzzyFindRequest JSON representations from 
user-provided
+// file.

Maybe read a JSON array from the file instead?
I.e. one would have to write `[{/*request1*/}, {/*request2*/}, ..]` instead of 
putting a request per line

Pros: we get valid json, can have prettified forms too.
Cons: might be a bit harder to construct the json array. But don't think it's a 
big deal.


https://reviews.llvm.org/D51971



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


[PATCH] D51977: [clangd] Clarify and hide -index flag.

2018-09-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

+1 to making this hidden. Users (most of them) shouldn't care about it.
Is there any motivation on why we someone would want to disable it currently? 
Maybe we want to deprecate it and remove it completely at some point?
I could only think of being as close as possible to sema completions, but that 
doesn't seem like something that gives better UX (folks from Apple might be 
interested in that, but not sure).

LGTM from my side.




Comment at: clangd/tool/ClangdMain.cpp:135
+"Enable index-based features. By default, clangd maintains an index "
+"built from symbols in opened files. Static/global index support needs 
"
+"to enabled separatedly."),

Maybe replace static/global with simply "Global" or "Project-wide".
I think it's good that we don't mention "dynamic" and "static" index in the 
docs too much, users shouldn't really care about this terminology.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51977



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


[PATCH] D51972: [RISCV] Explicitly set an empty --sysroot in the test

2018-09-12 Thread Lewis Revill via Phabricator via cfe-commits
lewis-revill accepted this revision.
lewis-revill added a comment.
This revision is now accepted and ready to land.

The reasoning seems sound for this testcase change. I think the behaviour of 
`computeSysRoot()` makes sense under this condition since it follows what the 
user specified, it's just not something I thought of when writing the tests for 
the previous patch.

Thanks


https://reviews.llvm.org/D51972



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


Re: [PATCH] D51987: [clangd] Rename global-symbol-builder to clangd-symbol-builder.

2018-09-12 Thread Eric Liu via cfe-commits
I mean `clangd-symbol-builder`

On Wed, Sep 12, 2018 at 4:32 PM Eric Liu via Phabricator <
revi...@reviews.llvm.org> wrote:

> ioeric accepted this revision.
> ioeric added a comment.
> This revision is now accepted and ready to land.
>
> lgtm
>
> +1 to `clang-symbol-builder`
>
>
> Repository:
>   rCTE Clang Tools Extra
>
> https://reviews.llvm.org/D51987
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51987: [clangd] Rename global-symbol-builder to clangd-symbol-builder.

2018-09-12 Thread Eric Liu via Phabricator via cfe-commits
ioeric added a subscriber: ilya-biryukov.
ioeric added a comment.

I mean `clangd-symbol-builder`


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51987



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


  1   2   >