[PATCH] D50171: [python] [tests] Update test_code_completion

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

Will take a closer look. Thanks for finding the offending revision.


https://reviews.llvm.org/D50171



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


[PATCH] D51628: [clangd] Implement a Proof-of-Concept tool for symbol index exploration

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

Remove artifact comment.


https://reviews.llvm.org/D51628

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  clang-tools-extra/clangd/index/dex/dexp/CMakeLists.txt
  clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp

Index: clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
===
--- /dev/null
+++ clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
@@ -0,0 +1,161 @@
+//===--- Dexp.cpp - Dex EXPloration tool *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file implements a simple interactive tool which can be used to manually
+// evaluate symbol search quality of Clangd index.
+//
+//===--===//
+
+#include "../../../index/SymbolYAML.h"
+#include "../Dex.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/LineEditor/LineEditor.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Signals.h"
+
+using clang::clangd::FuzzyFindRequest;
+using clang::clangd::loadIndex;
+using clang::clangd::Symbol;
+using clang::clangd::SymbolIndex;
+using llvm::StringRef;
+
+namespace {
+
+llvm::cl::opt
+SymbolCollection("symbol-collection-file",
+ llvm::cl::desc("Path to the file with symbol collection"),
+ llvm::cl::Positional, llvm::cl::Required);
+
+static const std::string Overview = R"(
+This is an **experimental** interactive tool to process user-provided search
+queries over given symbol collection obtained via global-symbol-builder. The
+tool can be used to evaluate search quality of existing index implementations
+and manually construct non-trivial test cases.
+
+Type use "help" request to get information about the details.
+)";
+
+void reportTime(StringRef Name, llvm::function_ref F) {
+  const auto TimerStart = std::chrono::high_resolution_clock::now();
+  F();
+  const auto TimerStop = std::chrono::high_resolution_clock::now();
+  const auto Duration = std::chrono::duration_cast(
+  TimerStop - TimerStart);
+  llvm::outs() << llvm::formatv("{0} took {1:ms+n}.\n", Name, Duration);
+}
+
+void fuzzyFind(llvm::StringRef UnqualifiedName, const SymbolIndex &Index) {
+  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 &Sym) {
+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 &Index) {
+  llvm::DenseSet IDs{clang::clangd::SymbolID{USR}};
+  clang::clangd::LookupRequest Request{IDs};
+  bool FoundSymbol = false;
+  Index.lookup(Request, [&](const Symbol &Sym) {
+if (!FoundSymbol)
+  FoundSymbol = true;
+llvm::outs() << SymbolToYAML(Sym);
+  });
+  if (!FoundSymbol)
+llvm::outs() << "not found\n";
+}
+
+// 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
+// * 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 &Index) {
+  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;
+}
+reportTime("fuzzy fin

[clang-tools-extra] r342025 - [clangd] Implement a Proof-of-Concept tool for symbol index exploration

2018-09-12 Thread Kirill Bobyrev via cfe-commits
Author: omtcyfz
Date: Wed Sep 12 00:32:54 2018
New Revision: 342025

URL: http://llvm.org/viewvc/llvm-project?rev=342025&view=rev
Log:
[clangd] Implement a Proof-of-Concept tool for symbol index exploration

Reviewed By: sammccall, ilya-biryukov

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

Added:
clang-tools-extra/trunk/clangd/index/dex/dexp/
clang-tools-extra/trunk/clangd/index/dex/dexp/CMakeLists.txt
clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp
Modified:
clang-tools-extra/trunk/clangd/CMakeLists.txt

Modified: clang-tools-extra/trunk/clangd/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CMakeLists.txt?rev=342025&r1=342024&r2=342025&view=diff
==
--- clang-tools-extra/trunk/clangd/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clangd/CMakeLists.txt Wed Sep 12 00:32:54 2018
@@ -74,3 +74,4 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_
 endif()
 add_subdirectory(tool)
 add_subdirectory(global-symbol-builder)
+add_subdirectory(index/dex/dexp)

Added: clang-tools-extra/trunk/clangd/index/dex/dexp/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/dex/dexp/CMakeLists.txt?rev=342025&view=auto
==
--- clang-tools-extra/trunk/clangd/index/dex/dexp/CMakeLists.txt (added)
+++ clang-tools-extra/trunk/clangd/index/dex/dexp/CMakeLists.txt Wed Sep 12 
00:32:54 2018
@@ -0,0 +1,15 @@
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../)
+
+set(LLVM_LINK_COMPONENTS
+  LineEditor
+  Support
+  )
+
+add_clang_executable(dexp
+  Dexp.cpp
+  )
+
+target_link_libraries(dexp
+  PRIVATE
+  clangDaemon
+  )

Added: clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp?rev=342025&view=auto
==
--- clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp (added)
+++ clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp Wed Sep 12 00:32:54 
2018
@@ -0,0 +1,161 @@
+//===--- Dexp.cpp - Dex EXPloration tool *- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file implements a simple interactive tool which can be used to manually
+// evaluate symbol search quality of Clangd index.
+//
+//===--===//
+
+#include "../../../index/SymbolYAML.h"
+#include "../Dex.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/LineEditor/LineEditor.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Signals.h"
+
+using clang::clangd::FuzzyFindRequest;
+using clang::clangd::loadIndex;
+using clang::clangd::Symbol;
+using clang::clangd::SymbolIndex;
+using llvm::StringRef;
+
+namespace {
+
+llvm::cl::opt
+SymbolCollection("symbol-collection-file",
+ llvm::cl::desc("Path to the file with symbol collection"),
+ llvm::cl::Positional, llvm::cl::Required);
+
+static const std::string Overview = R"(
+This is an **experimental** interactive tool to process user-provided search
+queries over given symbol collection obtained via global-symbol-builder. The
+tool can be used to evaluate search quality of existing index implementations
+and manually construct non-trivial test cases.
+
+Type use "help" request to get information about the details.
+)";
+
+void reportTime(StringRef Name, llvm::function_ref F) {
+  const auto TimerStart = std::chrono::high_resolution_clock::now();
+  F();
+  const auto TimerStop = std::chrono::high_resolution_clock::now();
+  const auto Duration = std::chrono::duration_cast(
+  TimerStop - TimerStart);
+  llvm::outs() << llvm::formatv("{0} took {1:ms+n}.\n", Name, Duration);
+}
+
+void fuzzyFind(llvm::StringRef UnqualifiedName, const SymbolIndex &Index) {
+  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 &Sym) {
+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

[PATCH] D51628: [clangd] Implement a Proof-of-Concept tool for symbol index exploration

2018-09-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342025: [clangd] Implement a Proof-of-Concept tool for 
symbol index exploration (authored by omtcyfz, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51628?vs=165016&id=165017#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51628

Files:
  clang-tools-extra/trunk/clangd/CMakeLists.txt
  clang-tools-extra/trunk/clangd/index/dex/dexp/CMakeLists.txt
  clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp

Index: clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp
===
--- clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp
+++ clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp
@@ -0,0 +1,161 @@
+//===--- Dexp.cpp - Dex EXPloration tool *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file implements a simple interactive tool which can be used to manually
+// evaluate symbol search quality of Clangd index.
+//
+//===--===//
+
+#include "../../../index/SymbolYAML.h"
+#include "../Dex.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/LineEditor/LineEditor.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Signals.h"
+
+using clang::clangd::FuzzyFindRequest;
+using clang::clangd::loadIndex;
+using clang::clangd::Symbol;
+using clang::clangd::SymbolIndex;
+using llvm::StringRef;
+
+namespace {
+
+llvm::cl::opt
+SymbolCollection("symbol-collection-file",
+ llvm::cl::desc("Path to the file with symbol collection"),
+ llvm::cl::Positional, llvm::cl::Required);
+
+static const std::string Overview = R"(
+This is an **experimental** interactive tool to process user-provided search
+queries over given symbol collection obtained via global-symbol-builder. The
+tool can be used to evaluate search quality of existing index implementations
+and manually construct non-trivial test cases.
+
+Type use "help" request to get information about the details.
+)";
+
+void reportTime(StringRef Name, llvm::function_ref F) {
+  const auto TimerStart = std::chrono::high_resolution_clock::now();
+  F();
+  const auto TimerStop = std::chrono::high_resolution_clock::now();
+  const auto Duration = std::chrono::duration_cast(
+  TimerStop - TimerStart);
+  llvm::outs() << llvm::formatv("{0} took {1:ms+n}.\n", Name, Duration);
+}
+
+void fuzzyFind(llvm::StringRef UnqualifiedName, const SymbolIndex &Index) {
+  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 &Sym) {
+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 &Index) {
+  llvm::DenseSet IDs{clang::clangd::SymbolID{USR}};
+  clang::clangd::LookupRequest Request{IDs};
+  bool FoundSymbol = false;
+  Index.lookup(Request, [&](const Symbol &Sym) {
+if (!FoundSymbol)
+  FoundSymbol = true;
+llvm::outs() << SymbolToYAML(Sym);
+  });
+  if (!FoundSymbol)
+llvm::outs() << "not found\n";
+}
+
+// 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
+// * 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 &Index) {
+  llvm::SmallVector Arguments;
+  Request.split(Arguments, ' ');
+  if (Arguments.emp

[clang-tools-extra] r342026 - [clangd] Add index benchmarks

2018-09-12 Thread Kirill Bobyrev via cfe-commits
Author: omtcyfz
Date: Wed Sep 12 00:49:44 2018
New Revision: 342026

URL: http://llvm.org/viewvc/llvm-project?rev=342026&view=rev
Log:
[clangd] Add index benchmarks

This patch introduces index benchmarks on top of the proposed LLVM
benchmark pull.

Reviewed By: sammccall, lebedev.ri

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

Added:
clang-tools-extra/trunk/clangd/benchmarks/
clang-tools-extra/trunk/clangd/benchmarks/CMakeLists.txt
clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp
clang-tools-extra/trunk/test/clangd/Inputs/BenchmarkHeader.h
clang-tools-extra/trunk/test/clangd/Inputs/BenchmarkSource.cpp
clang-tools-extra/trunk/test/clangd/Inputs/requests.log
clang-tools-extra/trunk/test/clangd/index-tools.test
Modified:
clang-tools-extra/trunk/clangd/CMakeLists.txt
clang-tools-extra/trunk/test/lit.cfg

Modified: clang-tools-extra/trunk/clangd/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CMakeLists.txt?rev=342026&r1=342025&r2=342026&view=diff
==
--- clang-tools-extra/trunk/clangd/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clangd/CMakeLists.txt Wed Sep 12 00:49:44 2018
@@ -75,3 +75,7 @@ endif()
 add_subdirectory(tool)
 add_subdirectory(global-symbol-builder)
 add_subdirectory(index/dex/dexp)
+
+if (LLVM_INCLUDE_BENCHMARKS)
+  add_subdirectory(benchmarks)
+endif()

Added: clang-tools-extra/trunk/clangd/benchmarks/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/benchmarks/CMakeLists.txt?rev=342026&view=auto
==
--- clang-tools-extra/trunk/clangd/benchmarks/CMakeLists.txt (added)
+++ clang-tools-extra/trunk/clangd/benchmarks/CMakeLists.txt Wed Sep 12 
00:49:44 2018
@@ -0,0 +1,9 @@
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../)
+
+add_benchmark(IndexBenchmark IndexBenchmark.cpp)
+
+target_link_libraries(IndexBenchmark
+  PRIVATE
+  clangDaemon
+  LLVMSupport
+  )

Added: clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp?rev=342026&view=auto
==
--- clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp (added)
+++ clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp Wed Sep 12 
00:49:44 2018
@@ -0,0 +1,114 @@
+//===--- IndexBenchmark.cpp - Clangd index benchmarks ---*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "../index/SymbolYAML.h"
+#include "../index/dex/Dex.h"
+#include "benchmark/benchmark.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Regex.h"
+#include 
+#include 
+#include 
+
+const char *IndexFilename;
+const char *LogFilename;
+
+namespace clang {
+namespace clangd {
+namespace {
+
+std::unique_ptr buildMem() {
+  return clang::clangd::loadIndex(IndexFilename, {}, false);
+}
+
+std::unique_ptr buildDex() {
+  return clang::clangd::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);
+  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, &Matches)) {
+  R.Query = Matches[1];
+  CommaSeparatedValues.clear();
+  Line.split(CommaSeparatedValues, ',');
+  R.Scopes.clear();
+  for (auto C : CommaSeparatedValues) {
+R.Scopes.push_back(C);
+  }
+  RealRequests.push_back(R);
+}
+  }
+  return RealRequests;
+}
+
+static void MemQueries(benchmark::State &State) {
+  const auto Mem = buildMem();
+  const auto Requests = extractQueriesFromLogs();
+  for (auto _ : State)
+for (const auto &Request : Requests)
+  Mem->fuzzyFind(Request, [](const Symbol &S) {});
+}
+BENCHMARK(MemQueries);
+
+static void DexQueries(benchmark::Sta

[PATCH] D51090: [clangd] Add index benchmarks

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

https://reviews.llvm.org/D51090

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  clang-tools-extra/clangd/benchmarks/CMakeLists.txt
  clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp
  clang-tools-extra/test/clangd/Inputs/BenchmarkHeader.h
  clang-tools-extra/test/clangd/Inputs/BenchmarkSource.cpp
  clang-tools-extra/test/clangd/Inputs/requests.log
  clang-tools-extra/test/clangd/index-tools.test
  clang-tools-extra/test/lit.cfg

Index: clang-tools-extra/test/lit.cfg
===
--- clang-tools-extra/test/lit.cfg
+++ clang-tools-extra/test/lit.cfg
@@ -137,3 +137,9 @@
 else:
 # exclude the clang-tidy test directory
 config.excludes.append('clang-tidy')
+
+clangd_benchmarks_dir = os.path.join(os.path.dirname(config.clang_tools_dir),
+ "tools", "clang", "tools", "extra",
+ "clangd", "benchmarks")
+config.substitutions.append(('%clangd-benchmark-dir',
+ '%s' % (clangd_benchmarks_dir)))
Index: clang-tools-extra/test/clangd/index-tools.test
===
--- /dev/null
+++ clang-tools-extra/test/clangd/index-tools.test
@@ -0,0 +1,2 @@
+# RUN: global-symbol-builder %p/Inputs/BenchmarkSource.cpp -- -I%p/Inputs > %t.index
+# RUN: %clangd-benchmark-dir/IndexBenchmark %t.index %p/Inputs/requests.log --benchmark_min_time=0.01
Index: clang-tools-extra/test/clangd/Inputs/requests.log
===
--- /dev/null
+++ clang-tools-extra/test/clangd/Inputs/requests.log
@@ -0,0 +1,5 @@
+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/BenchmarkSource.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clangd/Inputs/BenchmarkSource.cpp
@@ -0,0 +1 @@
+#include "BenchmarkHeader.h"
Index: clang-tools-extra/test/clangd/Inputs/BenchmarkHeader.h
===
--- /dev/null
+++ clang-tools-extra/test/clangd/Inputs/BenchmarkHeader.h
@@ -0,0 +1,19 @@
+namespace clang {
+namespace clangd {
+namespace dex {
+class Dex;
+} // namespace dex
+} // namespace clangd
+} // namespace clang
+
+namespace llvm {
+namespace sys {
+
+int getHostNumPhysicalCores();
+
+} // namespace sys
+} // namespace llvm
+
+namespace {
+int Variable;
+} // namespace
Index: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp
===
--- /dev/null
+++ clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp
@@ -0,0 +1,114 @@
+//===--- IndexBenchmark.cpp - Clangd index benchmarks ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "../index/SymbolYAML.h"
+#include "../index/dex/Dex.h"
+#include "benchmark/benchmark.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Regex.h"
+#include 
+#include 
+#include 
+
+const char *IndexFilename;
+const char *LogFilename;
+
+namespace clang {
+namespace clangd {
+namespace {
+
+std::unique_ptr buildMem() {
+  return clang::clangd::loadIndex(IndexFilename, {}, false);
+}
+
+std::unique_ptr buildDex() {
+  return clang::clangd::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);
+  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, &Matches)) {
+  R.Query = Matches[1];
+  CommaSeparatedValues.clear()

[PATCH] D51090: [clangd] Add index benchmarks

2018-09-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE342026: [clangd] Add index benchmarks (authored by 
omtcyfz, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51090?vs=165023&id=165024#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51090

Files:
  clangd/CMakeLists.txt
  clangd/benchmarks/CMakeLists.txt
  clangd/benchmarks/IndexBenchmark.cpp
  test/clangd/Inputs/BenchmarkHeader.h
  test/clangd/Inputs/BenchmarkSource.cpp
  test/clangd/Inputs/requests.log
  test/clangd/index-tools.test
  test/lit.cfg

Index: clangd/benchmarks/CMakeLists.txt
===
--- clangd/benchmarks/CMakeLists.txt
+++ clangd/benchmarks/CMakeLists.txt
@@ -0,0 +1,9 @@
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../)
+
+add_benchmark(IndexBenchmark IndexBenchmark.cpp)
+
+target_link_libraries(IndexBenchmark
+  PRIVATE
+  clangDaemon
+  LLVMSupport
+  )
Index: clangd/benchmarks/IndexBenchmark.cpp
===
--- clangd/benchmarks/IndexBenchmark.cpp
+++ clangd/benchmarks/IndexBenchmark.cpp
@@ -0,0 +1,114 @@
+//===--- IndexBenchmark.cpp - Clangd index benchmarks ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "../index/SymbolYAML.h"
+#include "../index/dex/Dex.h"
+#include "benchmark/benchmark.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Regex.h"
+#include 
+#include 
+#include 
+
+const char *IndexFilename;
+const char *LogFilename;
+
+namespace clang {
+namespace clangd {
+namespace {
+
+std::unique_ptr buildMem() {
+  return clang::clangd::loadIndex(IndexFilename, {}, false);
+}
+
+std::unique_ptr buildDex() {
+  return clang::clangd::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);
+  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, &Matches)) {
+  R.Query = Matches[1];
+  CommaSeparatedValues.clear();
+  Line.split(CommaSeparatedValues, ',');
+  R.Scopes.clear();
+  for (auto C : CommaSeparatedValues) {
+R.Scopes.push_back(C);
+  }
+  RealRequests.push_back(R);
+}
+  }
+  return RealRequests;
+}
+
+static void MemQueries(benchmark::State &State) {
+  const auto Mem = buildMem();
+  const auto Requests = extractQueriesFromLogs();
+  for (auto _ : State)
+for (const auto &Request : Requests)
+  Mem->fuzzyFind(Request, [](const Symbol &S) {});
+}
+BENCHMARK(MemQueries);
+
+static void DexQueries(benchmark::State &State) {
+  const auto Dex = buildDex();
+  const auto Requests = extractQueriesFromLogs();
+  for (auto _ : State)
+for (const auto &Request : Requests)
+  Dex->fuzzyFind(Request, [](const Symbol &S) {});
+}
+BENCHMARK(DexQueries);
+
+} // namespace
+} // namespace clangd
+} // namespace clang
+
+// FIXME(kbobyrev): Add index building time benchmarks.
+// FIXME(kbobyrev): Add memory consumption "benchmarks" by manually measuring
+// in-memory index size and reporting it as time.
+// FIXME(kbobyrev): Create a logger wrapper to suppress debugging info printer.
+int main(int argc, char *argv[]) {
+  if (argc < 3) {
+llvm::errs() << "Usage: " << argv[0]
+ << " global-symbol-index.yaml fuzzy-find-requests.log "
+"BENCHMARK_OPTIONS...\n";
+return -1;
+  }
+  IndexFilename = argv[1];
+  LogFilename = argv[2];
+  // Trim first two arguments of the benchmark invocation.
+  argv += 3;
+  argc -= 3;
+  ::benchmark::Initialize(&argc, argv);
+  ::benchmark::RunSpecifiedBenchmarks();
+}
Index: clangd/CMakeLists.txt
===
--- clangd/CMakeLists.txt
+++ clangd/CMakeLists.txt
@@ -75,3 +75,7 @@
 add_subdirectory(tool)
 add_subdirectory(global-symbol-builder)
 add_subdirectory(index/dex/dexp)
+
+if (LLVM_INCLUDE_BENCHMARKS)
+  add_subdirectory(benchmarks

[PATCH] D51090: [clangd] Add index benchmarks

2018-09-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342026: [clangd] Add index benchmarks (authored by omtcyfz, 
committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51090?vs=165023&id=165025#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51090

Files:
  clang-tools-extra/trunk/clangd/CMakeLists.txt
  clang-tools-extra/trunk/clangd/benchmarks/CMakeLists.txt
  clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp
  clang-tools-extra/trunk/test/clangd/Inputs/BenchmarkHeader.h
  clang-tools-extra/trunk/test/clangd/Inputs/BenchmarkSource.cpp
  clang-tools-extra/trunk/test/clangd/Inputs/requests.log
  clang-tools-extra/trunk/test/clangd/index-tools.test
  clang-tools-extra/trunk/test/lit.cfg

Index: clang-tools-extra/trunk/clangd/CMakeLists.txt
===
--- clang-tools-extra/trunk/clangd/CMakeLists.txt
+++ clang-tools-extra/trunk/clangd/CMakeLists.txt
@@ -75,3 +75,7 @@
 add_subdirectory(tool)
 add_subdirectory(global-symbol-builder)
 add_subdirectory(index/dex/dexp)
+
+if (LLVM_INCLUDE_BENCHMARKS)
+  add_subdirectory(benchmarks)
+endif()
Index: clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp
===
--- clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp
+++ clang-tools-extra/trunk/clangd/benchmarks/IndexBenchmark.cpp
@@ -0,0 +1,114 @@
+//===--- IndexBenchmark.cpp - Clangd index benchmarks ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "../index/SymbolYAML.h"
+#include "../index/dex/Dex.h"
+#include "benchmark/benchmark.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Regex.h"
+#include 
+#include 
+#include 
+
+const char *IndexFilename;
+const char *LogFilename;
+
+namespace clang {
+namespace clangd {
+namespace {
+
+std::unique_ptr buildMem() {
+  return clang::clangd::loadIndex(IndexFilename, {}, false);
+}
+
+std::unique_ptr buildDex() {
+  return clang::clangd::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);
+  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, &Matches)) {
+  R.Query = Matches[1];
+  CommaSeparatedValues.clear();
+  Line.split(CommaSeparatedValues, ',');
+  R.Scopes.clear();
+  for (auto C : CommaSeparatedValues) {
+R.Scopes.push_back(C);
+  }
+  RealRequests.push_back(R);
+}
+  }
+  return RealRequests;
+}
+
+static void MemQueries(benchmark::State &State) {
+  const auto Mem = buildMem();
+  const auto Requests = extractQueriesFromLogs();
+  for (auto _ : State)
+for (const auto &Request : Requests)
+  Mem->fuzzyFind(Request, [](const Symbol &S) {});
+}
+BENCHMARK(MemQueries);
+
+static void DexQueries(benchmark::State &State) {
+  const auto Dex = buildDex();
+  const auto Requests = extractQueriesFromLogs();
+  for (auto _ : State)
+for (const auto &Request : Requests)
+  Dex->fuzzyFind(Request, [](const Symbol &S) {});
+}
+BENCHMARK(DexQueries);
+
+} // namespace
+} // namespace clangd
+} // namespace clang
+
+// FIXME(kbobyrev): Add index building time benchmarks.
+// FIXME(kbobyrev): Add memory consumption "benchmarks" by manually measuring
+// in-memory index size and reporting it as time.
+// FIXME(kbobyrev): Create a logger wrapper to suppress debugging info printer.
+int main(int argc, char *argv[]) {
+  if (argc < 3) {
+llvm::errs() << "Usage: " << argv[0]
+ << " global-symbol-index.yaml fuzzy-find-requests.log "
+"BENCHMARK_OPTIONS...\n";
+return -1;
+  }
+  IndexFilename = argv[1];
+  LogFilename = argv[2];
+  // Trim first two arguments of the benchmark invocation.
+  argv += 3;
+  argc -= 3;
+  ::benchmark::Initialize(&argc, argv);
+  ::benchmark::RunSpecifiedBenchmarks();
+}
Inde

r342028 - [Tooling] Wait for all threads to finish before resetting CWD.

2018-09-12 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Wed Sep 12 01:29:47 2018
New Revision: 342028

URL: http://llvm.org/viewvc/llvm-project?rev=342028&view=rev
Log:
[Tooling] Wait for all threads to finish before resetting CWD.

Modified:
cfe/trunk/lib/Tooling/AllTUsExecution.cpp

Modified: cfe/trunk/lib/Tooling/AllTUsExecution.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/AllTUsExecution.cpp?rev=342028&r1=342027&r2=342028&view=diff
==
--- cfe/trunk/lib/Tooling/AllTUsExecution.cpp (original)
+++ cfe/trunk/lib/Tooling/AllTUsExecution.cpp Wed Sep 12 01:29:47 2018
@@ -129,6 +129,8 @@ llvm::Error AllTUsToolExecutor::execute(
   },
   File);
 }
+// Make sure all tasks have finished before resetting the working 
directory.
+Pool.wait();
 if (!InitialWorkingDir.empty()) {
   if (auto EC = llvm::sys::fs::set_current_path(InitialWorkingDir))
 llvm::errs() << "Error while restoring working directory: "


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


r342031 - Fix Check test to avoid output string mismatch

2018-09-12 Thread Christian Bruel via cfe-commits
Author: chrib
Date: Wed Sep 12 01:59:17 2018
New Revision: 342031

URL: http://llvm.org/viewvc/llvm-project?rev=342031&view=rev
Log:
Fix Check test to avoid output string mismatch

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


Modified:
cfe/trunk/test/Driver/print-multi-directory.c

Modified: cfe/trunk/test/Driver/print-multi-directory.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-multi-directory.c?rev=342031&r1=342030&r2=342031&view=diff
==
--- cfe/trunk/test/Driver/print-multi-directory.c (original)
+++ cfe/trunk/test/Driver/print-multi-directory.c Wed Sep 12 01:59:17 2018
@@ -2,21 +2,19 @@
 // RUN: -target i386-none-linux \
 // RUN: -B%S/Inputs/multilib_64bit_linux_tree/usr \
 // RUN: -print-multi-directory \
-// RUN:   | FileCheck --check-prefix=CHECK-X86-MULTILIBS %s
+// RUN:   | FileCheck --match-full-lines --check-prefix=CHECK-X86-MULTILIBS %s
 
 // CHECK-X86-MULTILIBS:  32
-// CHECK-X86-MULTILIBS-NOT:  x32
-// CHECK-X86-MULTILIBS-NOT:  .
+// CHECK-X86-MULTILIBS-NOT:  {{^.+$}}
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>/dev/null \
 // RUN: -target i386-none-linux -m64 \
 // RUN: -B%S/Inputs/multilib_64bit_linux_tree/usr \
 // RUN: -print-multi-directory \
-// RUN:   | FileCheck --check-prefix=CHECK-X86_64-MULTILIBS %s
+// RUN:   | FileCheck --match-full-lines --check-prefix=CHECK-X86_64-MULTILIBS 
%s
 
 // CHECK-X86_64-MULTILIBS:  .
-// CHECK-X86_64-MULTILIBS-NOT:  x32
-// CHECK-X86_64-MULTILIBS-NOT:  32
+// CHECK-X86_64-MULTILIBS-NOT:  {{^.+$}}
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>/dev/null \
 // RUN: -target arm-linux-androideabi21 \
@@ -24,7 +22,7 @@
 // RUN: -B%S/Inputs/basic_android_ndk_tree \
 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
 // RUN: -print-multi-directory \
-// RUN:   | FileCheck  --check-prefix=CHECK-ARM-MULTILIBS %s
+// RUN:   | FileCheck --match-full-lines --check-prefix=CHECK-ARM-MULTILIBS %s
 
 // CHECK-ARM-MULTILIBS:  thumb
-// CHECK-ARM-MULTILIBS-NOT:  .
+// CHECK-ARM-MULTILIBS-NOT:  {{^.+$}}


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


r342034 - [CodeGen][ARM] Coerce FP16 vectors to integer vectors when needed

2018-09-12 Thread Mikhail Maltsev via cfe-commits
Author: miyuki
Date: Wed Sep 12 02:19:19 2018
New Revision: 342034

URL: http://llvm.org/viewvc/llvm-project?rev=342034&view=rev
Log:
[CodeGen][ARM] Coerce FP16 vectors to integer vectors when needed

Summary:
On targets that do not support FP16 natively LLVM currently legalizes
vectors of FP16 values by scalarizing them and promoting to FP32. This
causes problems for the following code:

  void foo(int, ...);

  typedef __attribute__((neon_vector_type(4))) __fp16 float16x4_t;
  void bar(float16x4_t x) {
foo(42, x);
  }

According to the AAPCS (appendix A.2) float16x4_t is a containerized
vector fundamental type, so 'foo' expects that the 4 16-bit FP values
are packed into 2 32-bit registers, but instead bar promotes them to
4 single precision values.

Since we already handle scalar FP16 values in the frontend by
bitcasting them to/from integers, this patch adds similar handling for
vector types and homogeneous FP16 vector aggregates.

One existing test required some adjustments because we now generate
more bitcasts (so the patch changes the test to target a machine with
native FP16 support).

Reviewers: eli.friedman, olista01, SjoerdMeijer, javed.absar, efriedma

Reviewed By: javed.absar, efriedma

Subscribers: efriedma, kristof.beyls, cfe-commits, chrib

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

Added:
cfe/trunk/test/CodeGen/arm-vfp16-arguments.c
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/arm_neon_intrinsics.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=342034&r1=342033&r2=342034&view=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Sep 12 02:19:19 2018
@@ -5549,6 +5549,9 @@ public:
 private:
   ABIArgInfo classifyReturnType(QualType RetTy, bool isVariadic) const;
   ABIArgInfo classifyArgumentType(QualType RetTy, bool isVariadic) const;
+  ABIArgInfo classifyHomogeneousAggregate(QualType Ty, const Type *Base,
+  uint64_t Members) const;
+  ABIArgInfo coerceIllegalVector(QualType Ty) const;
   bool isIllegalVectorType(QualType Ty) const;
 
   bool isHomogeneousAggregateBaseType(QualType Ty) const override;
@@ -5723,6 +5726,41 @@ void ARMABIInfo::setCCs() {
 RuntimeCC = abiCC;
 }
 
+ABIArgInfo ARMABIInfo::coerceIllegalVector(QualType Ty) const {
+  uint64_t Size = getContext().getTypeSize(Ty);
+  if (Size <= 32) {
+llvm::Type *ResType =
+llvm::Type::getInt32Ty(getVMContext());
+return ABIArgInfo::getDirect(ResType);
+  }
+  if (Size == 64 || Size == 128) {
+llvm::Type *ResType = llvm::VectorType::get(
+llvm::Type::getInt32Ty(getVMContext()), Size / 32);
+return ABIArgInfo::getDirect(ResType);
+  }
+  return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
+}
+
+ABIArgInfo ARMABIInfo::classifyHomogeneousAggregate(QualType Ty,
+const Type *Base,
+uint64_t Members) const {
+  assert(Base && "Base class should be set for homogeneous aggregate");
+  // Base can be a floating-point or a vector.
+  if (const VectorType *VT = Base->getAs()) {
+// FP16 vectors should be converted to integer vectors
+if (!getTarget().hasLegalHalfType() &&
+(VT->getElementType()->isFloat16Type() ||
+  VT->getElementType()->isHalfType())) {
+  uint64_t Size = getContext().getTypeSize(VT);
+  llvm::Type *NewVecTy = llvm::VectorType::get(
+  llvm::Type::getInt32Ty(getVMContext()), Size / 32);
+  llvm::Type *Ty = llvm::ArrayType::get(NewVecTy, Members);
+  return ABIArgInfo::getDirect(Ty, 0, nullptr, false);
+}
+  }
+  return ABIArgInfo::getDirect(nullptr, 0, nullptr, false);
+}
+
 ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty,
 bool isVariadic) const {
   // 6.1.2.1 The following argument types are VFP CPRCs:
@@ -5737,25 +5775,8 @@ ABIArgInfo ARMABIInfo::classifyArgumentT
   Ty = useFirstFieldIfTransparentUnion(Ty);
 
   // Handle illegal vector types here.
-  if (isIllegalVectorType(Ty)) {
-uint64_t Size = getContext().getTypeSize(Ty);
-if (Size <= 32) {
-  llvm::Type *ResType =
-  llvm::Type::getInt32Ty(getVMContext());
-  return ABIArgInfo::getDirect(ResType);
-}
-if (Size == 64) {
-  llvm::Type *ResType = llvm::VectorType::get(
-  llvm::Type::getInt32Ty(getVMContext()), 2);
-  return ABIArgInfo::getDirect(ResType);
-}
-if (Size == 128) {
-  llvm::Type *ResType = llvm::VectorType::get(
-  llvm::Type::getInt32Ty(getVMContext()), 4);
-  return ABIArgInfo::getDirect(ResType);
-}
-return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
-  }
+  if (isIllegalVectorType(Ty))
+return coerceIllegalVector(Ty);
 
  

[PATCH] D50507: [CodeGen][ARM] Coerce FP16 vectors to integer vectors when needed

2018-09-12 Thread Mikhail Maltsev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC342034: [CodeGen][ARM] Coerce FP16 vectors to integer 
vectors when needed (authored by miyuki, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D50507

Files:
  lib/CodeGen/TargetInfo.cpp
  test/CodeGen/arm-vfp16-arguments.c
  test/CodeGen/arm_neon_intrinsics.c

Index: test/CodeGen/arm_neon_intrinsics.c
===
--- test/CodeGen/arm_neon_intrinsics.c
+++ test/CodeGen/arm_neon_intrinsics.c
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 -triple thumbv7s-apple-darwin -target-abi apcs-gnu\
-// RUN:  -target-cpu swift -fallow-half-arguments-and-returns -ffreestanding \
+// RUN:  -target-cpu swift -fallow-half-arguments-and-returns \
+// RUN:  -target-feature +fullfp16 -ffreestanding \
 // RUN:  -disable-O0-optnone -emit-llvm -o - %s \
 // RUN:  | opt -S -mem2reg | FileCheck %s
 
@@ -3896,9 +3897,8 @@
 
 // CHECK-LABEL: @test_vld1q_f16(
 // CHECK:   [[TMP0:%.*]] = bitcast half* %a to i8*
-// CHECK:   [[VLD1:%.*]] = call <8 x i16> @llvm.arm.neon.vld1.v8i16.p0i8(i8* [[TMP0]], i32 2)
-// CHECK:   [[TMP1:%.*]] = bitcast <8 x i16> [[VLD1]] to <8 x half>
-// CHECK:   ret <8 x half> [[TMP1]]
+// CHECK:   [[VLD1:%.*]] = call <8 x half> @llvm.arm.neon.vld1.v8f16.p0i8(i8* [[TMP0]], i32 2)
+// CHECK:   ret <8 x half> [[VLD1]]
 float16x8_t test_vld1q_f16(float16_t const * a) {
   return vld1q_f16(a);
 }
@@ -3990,9 +3990,8 @@
 
 // CHECK-LABEL: @test_vld1_f16(
 // CHECK:   [[TMP0:%.*]] = bitcast half* %a to i8*
-// CHECK:   [[VLD1:%.*]] = call <4 x i16> @llvm.arm.neon.vld1.v4i16.p0i8(i8* [[TMP0]], i32 2)
-// CHECK:   [[TMP1:%.*]] = bitcast <4 x i16> [[VLD1]] to <4 x half>
-// CHECK:   ret <4 x half> [[TMP1]]
+// CHECK:   [[VLD1:%.*]] = call <4 x half> @llvm.arm.neon.vld1.v4f16.p0i8(i8* [[TMP0]], i32 2)
+// CHECK:   ret <4 x half> [[VLD1]]
 float16x4_t test_vld1_f16(float16_t const * a) {
   return vld1_f16(a);
 }
@@ -4106,12 +4105,11 @@
 
 // CHECK-LABEL: @test_vld1q_dup_f16(
 // CHECK:   [[TMP0:%.*]] = bitcast half* %a to i8*
-// CHECK:   [[TMP1:%.*]] = bitcast i8* [[TMP0]] to i16*
-// CHECK:   [[TMP2:%.*]] = load i16, i16* [[TMP1]], align 2
-// CHECK:   [[TMP3:%.*]] = insertelement <8 x i16> undef, i16 [[TMP2]], i32 0
-// CHECK:   [[LANE:%.*]] = shufflevector <8 x i16> [[TMP3]], <8 x i16> [[TMP3]], <8 x i32> zeroinitializer
-// CHECK:   [[TMP4:%.*]] = bitcast <8 x i16> [[LANE]] to <8 x half>
-// CHECK:   ret <8 x half> [[TMP4]]
+// CHECK:   [[TMP1:%.*]] = bitcast i8* [[TMP0]] to half*
+// CHECK:   [[TMP2:%.*]] = load half, half* [[TMP1]], align 2
+// CHECK:   [[TMP3:%.*]] = insertelement <8 x half> undef, half [[TMP2]], i32 0
+// CHECK:   [[LANE:%.*]] = shufflevector <8 x half> [[TMP3]], <8 x half> [[TMP3]], <8 x i32> zeroinitializer
+// CHECK:   ret <8 x half> [[LANE]]
 float16x8_t test_vld1q_dup_f16(float16_t const * a) {
   return vld1q_dup_f16(a);
 }
@@ -4233,12 +4231,11 @@
 
 // CHECK-LABEL: @test_vld1_dup_f16(
 // CHECK:   [[TMP0:%.*]] = bitcast half* %a to i8*
-// CHECK:   [[TMP1:%.*]] = bitcast i8* [[TMP0]] to i16*
-// CHECK:   [[TMP2:%.*]] = load i16, i16* [[TMP1]], align 2
-// CHECK:   [[TMP3:%.*]] = insertelement <4 x i16> undef, i16 [[TMP2]], i32 0
-// CHECK:   [[LANE:%.*]] = shufflevector <4 x i16> [[TMP3]], <4 x i16> [[TMP3]], <4 x i32> zeroinitializer
-// CHECK:   [[TMP4:%.*]] = bitcast <4 x i16> [[LANE]] to <4 x half>
-// CHECK:   ret <4 x half> [[TMP4]]
+// CHECK:   [[TMP1:%.*]] = bitcast i8* [[TMP0]] to half*
+// CHECK:   [[TMP2:%.*]] = load half, half* [[TMP1]], align 2
+// CHECK:   [[TMP3:%.*]] = insertelement <4 x half> undef, half [[TMP2]], i32 0
+// CHECK:   [[LANE:%.*]] = shufflevector <4 x half> [[TMP3]], <4 x half> [[TMP3]], <4 x i32> zeroinitializer
+// CHECK:   ret <4 x half> [[LANE]]
 float16x4_t test_vld1_dup_f16(float16_t const * a) {
   return vld1_dup_f16(a);
 }
@@ -4365,12 +4362,11 @@
 // CHECK-LABEL: @test_vld1q_lane_f16(
 // CHECK:   [[TMP0:%.*]] = bitcast half* %a to i8*
 // CHECK:   [[TMP1:%.*]] = bitcast <8 x half> %b to <16 x i8>
-// CHECK:   [[TMP2:%.*]] = bitcast <16 x i8> [[TMP1]] to <8 x i16>
-// CHECK:   [[TMP3:%.*]] = bitcast i8* [[TMP0]] to i16*
-// CHECK:   [[TMP4:%.*]] = load i16, i16* [[TMP3]], align 2
-// CHECK:   [[VLD1_LANE:%.*]] = insertelement <8 x i16> [[TMP2]], i16 [[TMP4]], i32 7
-// CHECK:   [[TMP5:%.*]] = bitcast <8 x i16> [[VLD1_LANE]] to <8 x half>
-// CHECK:   ret <8 x half> [[TMP5]]
+// CHECK:   [[TMP2:%.*]] = bitcast <16 x i8> [[TMP1]] to <8 x half>
+// CHECK:   [[TMP3:%.*]] = bitcast i8* [[TMP0]] to half*
+// CHECK:   [[TMP4:%.*]] = load half, half* [[TMP3]], align 2
+// CHECK:   [[VLD1_LANE:%.*]] = insertelement <8 x half> [[TMP2]], half [[TMP4]], i32 7
+// CHECK:   ret <8 x half> [[VLD1_LANE]]
 float16x8_t test_vld1q_lane_f16(float16_t const * a, float16x8_t b) {
   return vld1q_lane_f16(a, b, 7);
 }
@@ -4498,12 +4494,11 @@
 // CHECK-LABEL: @test_vld1_lane_f16(
 // CHECK:   [[TMP0:%.*]] = bitcast hal

[PATCH] D51597: [ASTImporter] Fix import of VarDecl init

2018-09-12 Thread Gabor Marton via Phabricator via cfe-commits
martong marked 3 inline comments as done.
martong added inline comments.



Comment at: lib/AST/ASTImporter.cpp:1441
+  To->setInit(ToInit);
+  if (From->isInitKnownICE()) {
+EvaluatedStmt *Eval = To->ensureEvaluatedStmt();

a_sidorin wrote:
> I see that this is only a code move but I realized that ASTReader and 
> ASTImporter handle this case differently. ASTReader code says:
> 
> ```
> if (Val > 1) { // IsInitKnownICE = 1, IsInitNotICE = 2, IsInitICE = 3
>   EvaluatedStmt *Eval = VD->ensureEvaluatedStmt();
>   Eval->CheckedICE = true;
>   Eval->IsICE = Val == 3;
> }
> ```
> but ASTimporter sets these bits only if `isInitKnownICE()` is `true`. This 
> looks strange.
The comment in ASTReader seems to be wrong and misleading.
I checked the correspondent code in ASTWriter:
```
Record.push_back(!D->isInitKnownICE() ? 1 : (D->isInitICE() ? 3 : 2));
```
Thus, the comment in ASTReader should be:
```
if (Val > 1) { // IsInitNOTKnownICE = 1, IsInitNotICE = 2, IsInitICE = 3
```
So, `Val > 1` means that the original init expression written by the ASTWriter 
had the ICE-ness already determined.
Thus the ASTImporter code seems correct to me. 


Repository:
  rC Clang

https://reviews.llvm.org/D51597



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


[PATCH] D51597: [ASTImporter] Fix import of VarDecl init

2018-09-12 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 165039.
martong marked an inline comment as done.
martong added a comment.

- Fix formatting and typo


Repository:
  rC Clang

https://reviews.llvm.org/D51597

Files:
  lib/AST/ASTImporter.cpp
  unittests/AST/ASTImporterTest.cpp

Index: unittests/AST/ASTImporterTest.cpp
===
--- unittests/AST/ASTImporterTest.cpp
+++ unittests/AST/ASTImporterTest.cpp
@@ -1828,13 +1828,62 @@
   {
 Decl *FromTU =
 getTuDecl("extern int x; int f() { return x; }", Lang_CXX, "input2.cc");
-auto *FromD =
-FirstDeclMatcher().match(FromTU, functionDecl());
+auto *FromD = FirstDeclMatcher().match(
+FromTU, functionDecl(hasName("f")));
 Import(FromD, Lang_CXX);
   }
   EXPECT_TRUE(Imported2->isUsed(false));
 }
 
+TEST_P(ASTImporterTestBase, ImportDoesUpdateUsedFlag2) {
+  auto Pattern = varDecl(hasName("x"));
+  VarDecl *ExistingD;
+  {
+Decl *ToTU = getToTuDecl("int x = 1;", Lang_CXX);
+ExistingD = FirstDeclMatcher().match(ToTU, Pattern);
+  }
+  EXPECT_FALSE(ExistingD->isUsed(false));
+  {
+Decl *FromTU = getTuDecl(
+"int x = 1; int f() { return x; }", Lang_CXX, "input1.cc");
+auto *FromD = FirstDeclMatcher().match(
+FromTU, functionDecl(hasName("f")));
+Import(FromD, Lang_CXX);
+  }
+  EXPECT_TRUE(ExistingD->isUsed(false));
+}
+
+TEST_P(ASTImporterTestBase, ImportDoesUpdateUsedFlag3) {
+  auto Pattern = varDecl(hasName("a"));
+  VarDecl *ExistingD;
+  {
+Decl *ToTU = getToTuDecl(
+R"(
+struct A {
+  static const int a = 1;
+};
+)", Lang_CXX);
+ExistingD = FirstDeclMatcher().match(ToTU, Pattern);
+  }
+  EXPECT_FALSE(ExistingD->isUsed(false));
+  {
+Decl *FromTU = getTuDecl(
+R"(
+struct A {
+  static const int a = 1;
+};
+const int *f() { return &A::a; } // requires storage,
+ // thus used flag will be set
+)", Lang_CXX, "input1.cc");
+auto *FromFunD = FirstDeclMatcher().match(
+FromTU, functionDecl(hasName("f")));
+auto *FromD = FirstDeclMatcher().match(FromTU, Pattern);
+ASSERT_TRUE(FromD->isUsed(false));
+Import(FromFunD, Lang_CXX);
+  }
+  EXPECT_TRUE(ExistingD->isUsed(false));
+}
+
 TEST_P(ASTImporterTestBase, ReimportWithUsedFlag) {
   auto Pattern = varDecl(hasName("x"));
 
@@ -3244,6 +3293,94 @@
   EXPECT_TRUE(ToInitExpr->isGLValue());
 }
 
+struct ImportVariables : ASTImporterTestBase {};
+
+TEST_P(ImportVariables, ImportOfOneDeclBringsInTheWholeChain) {
+  Decl *FromTU = getTuDecl(
+  R"(
+  struct A {
+static const int a = 1 + 2;
+  };
+  const int A::a;
+  )", Lang_CXX, "input1.cc");
+
+  auto *FromDWithInit = FirstDeclMatcher().match(
+  FromTU, varDecl(hasName("a"))); // Decl with init
+  auto *FromDWithDef = LastDeclMatcher().match(
+  FromTU, varDecl(hasName("a"))); // Decl with definition
+  ASSERT_NE(FromDWithInit, FromDWithDef);
+  ASSERT_EQ(FromDWithDef->getPreviousDecl(), FromDWithInit);
+
+  auto *ToD0 = cast(Import(FromDWithInit, Lang_CXX11));
+  auto *ToD1 = cast(Import(FromDWithDef, Lang_CXX11));
+  ASSERT_TRUE(ToD0);
+  ASSERT_TRUE(ToD1);
+  EXPECT_NE(ToD0, ToD1);
+  EXPECT_EQ(ToD1->getPreviousDecl(), ToD0);
+}
+
+TEST_P(ImportVariables, InitAndDefinitionAreInDifferentTUs) {
+  auto StructA =
+  R"(
+  struct A {
+static const int a = 1 + 2;
+  };
+  )";
+  Decl *ToTU = getToTuDecl(StructA, Lang_CXX);
+  Decl *FromTU = getTuDecl(std::string(StructA) + "const int A::a;", Lang_CXX,
+   "input1.cc");
+
+  auto *FromDWithInit = FirstDeclMatcher().match(
+  FromTU, varDecl(hasName("a"))); // Decl with init
+  auto *FromDWithDef = LastDeclMatcher().match(
+  FromTU, varDecl(hasName("a"))); // Decl with definition
+  ASSERT_EQ(FromDWithInit, FromDWithDef->getPreviousDecl());
+  ASSERT_TRUE(FromDWithInit->getInit());
+  ASSERT_FALSE(FromDWithInit->isThisDeclarationADefinition());
+  ASSERT_TRUE(FromDWithDef->isThisDeclarationADefinition());
+  ASSERT_FALSE(FromDWithDef->getInit());
+
+  auto *ToD = FirstDeclMatcher().match(
+  ToTU, varDecl(hasName("a"))); // Decl with init
+  ASSERT_TRUE(ToD->getInit());
+  ASSERT_FALSE(ToD->getDefinition());
+
+  auto *ImportedD = cast(Import(FromDWithDef, Lang_CXX11));
+  EXPECT_TRUE(ImportedD->getAnyInitializer());
+  EXPECT_TRUE(ImportedD->getDefinition());
+}
+
+TEST_P(ImportVariables, InitAndDefinitionAreInTheFromContext) {
+  auto StructA =
+  R"(
+  struct A {
+static const int a;
+  };
+  )";
+  Decl *ToTU = getToTuDecl(StructA, Lang_CXX);
+  Decl *FromTU = getTuDecl(std::string(StructA) + "const int A::a = 1 + 2;",
+   Lang_CXX, "input1.cc");
+
+  auto *FromDDeclarationOnly = FirstDeclMatcher().match(
+  FromTU, varDecl(hasName("a")));
+  auto *FromDWithDef = LastDeclMatcher().match(
+   

[clang-tools-extra] r342036 - Fix buildbots after r342027

2018-09-12 Thread Kirill Bobyrev via cfe-commits
Author: omtcyfz
Date: Wed Sep 12 02:27:55 2018
New Revision: 342036

URL: http://llvm.org/viewvc/llvm-project?rev=342036&view=rev
Log:
Fix buildbots after r342027

Modified:
clang-tools-extra/trunk/test/clangd/index-tools.test

Modified: clang-tools-extra/trunk/test/clangd/index-tools.test
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clangd/index-tools.test?rev=342036&r1=342035&r2=342036&view=diff
==
--- clang-tools-extra/trunk/test/clangd/index-tools.test (original)
+++ clang-tools-extra/trunk/test/clangd/index-tools.test Wed Sep 12 02:27:55 
2018
@@ -1,2 +1,3 @@
 # RUN: global-symbol-builder %p/Inputs/BenchmarkSource.cpp -- -I%p/Inputs > 
%t.index
-# RUN: %clangd-benchmark-dir/IndexBenchmark %t.index %p/Inputs/requests.log 
--benchmark_min_time=0.01
+# 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


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


[clang-tools-extra] r342037 - [clangd] Add missing clangBasic target_link_libraries

2018-09-12 Thread Heejin Ahn via cfe-commits
Author: aheejin
Date: Wed Sep 12 02:40:13 2018
New Revision: 342037

URL: http://llvm.org/viewvc/llvm-project?rev=342037&view=rev
Log:
[clangd] Add missing clangBasic target_link_libraries

Without this, builds with `-DSHARED_LIB=ON` fail.

Modified:
clang-tools-extra/trunk/clangd/index/dex/dexp/CMakeLists.txt

Modified: clang-tools-extra/trunk/clangd/index/dex/dexp/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/dex/dexp/CMakeLists.txt?rev=342037&r1=342036&r2=342037&view=diff
==
--- clang-tools-extra/trunk/clangd/index/dex/dexp/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clangd/index/dex/dexp/CMakeLists.txt Wed Sep 12 
02:40:13 2018
@@ -11,5 +11,6 @@ add_clang_executable(dexp
 
 target_link_libraries(dexp
   PRIVATE
+  clangBasic
   clangDaemon
   )


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


[clang-tools-extra] r342041 - [clang-tidy] Abseil: Add more directories that are slated for future absl expansion.

2018-09-12 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Wed Sep 12 03:04:16 2018
New Revision: 342041

URL: http://llvm.org/viewvc/llvm-project?rev=342041&view=rev
Log:
[clang-tidy] Abseil: Add more directories that are slated for future absl 
expansion.

Modified:
clang-tools-extra/trunk/clang-tidy/abseil/AbseilMatcher.h

Modified: clang-tools-extra/trunk/clang-tidy/abseil/AbseilMatcher.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/abseil/AbseilMatcher.h?rev=342041&r1=342040&r2=342041&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/abseil/AbseilMatcher.h (original)
+++ clang-tools-extra/trunk/clang-tidy/abseil/AbseilMatcher.h Wed Sep 12 
03:04:16 2018
@@ -49,9 +49,10 @@ AST_POLYMORPHIC_MATCHER(
 return false;
   Path = Path.drop_front(PrefixPosition + AbslPrefix.size());
   static const char *AbseilLibraries[] = {
-  "algorithm", "base",  "container", "debugging", "flags",
-  "memory","meta",  "numeric",   "strings",   "synchronization",
-  "time",  "types", "utility"};
+  "algorithm", "base", "container",   "debugging", "flags",
+  "hash",  "iterator", "memory",  "meta",  "numeric",
+  "random","strings",  "synchronization", "time",  "types",
+  "utility"};
   return std::any_of(
   std::begin(AbseilLibraries), std::end(AbseilLibraries),
   [&](const char *Library) { return Path.startswith(Library); });


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


[PATCH] D51847: Print correctly dependency paths on Windows

2018-09-12 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 updated this revision to Diff 165052.
xbolva00 added a comment.

- Fixed failing test


https://reviews.llvm.org/D51847

Files:
  lib/Frontend/DependencyFile.cpp
  test/Frontend/dependency-gen-escaping.c


Index: test/Frontend/dependency-gen-escaping.c
===
--- test/Frontend/dependency-gen-escaping.c
+++ test/Frontend/dependency-gen-escaping.c
@@ -21,7 +21,7 @@
 // Backslash followed by # or space should escape both characters, because
 // that's what GNU Make wants.  GCC does the right thing with space, but not
 // #, so Clang does too. (There should be 3 backslashes before the #.)
-// SEP2F: a\b\\#c\\\ d.h
+// SEP2F: a{{[/\\]}}b{{[/\\]}}\#c{{/|}}\ d.h
 // With -fms-compatibility, Backslashes in #include are treated as path 
separators.
 // Backslashes are given in the emission for special characters, like 0x20 or 
0x23.
 // SEP5C: a{{[/\\]}}b{{[/\\]}}\#c{{/|}}\ d.h
Index: lib/Frontend/DependencyFile.cpp
===
--- lib/Frontend/DependencyFile.cpp
+++ lib/Frontend/DependencyFile.cpp
@@ -386,28 +386,32 @@
 /// for Windows file-naming info.
 static void PrintFilename(raw_ostream &OS, StringRef Filename,
   DependencyOutputFormat OutputFormat) {
+  // Convert filename to platform native path
+  llvm::SmallString<256> NativePath;
+  llvm::sys::path::native(Filename.str(), NativePath);
+
   if (OutputFormat == DependencyOutputFormat::NMake) {
 // Add quotes if needed. These are the characters listed as "special" to
 // NMake, that are legal in a Windows filespec, and that could cause
 // misinterpretation of the dependency string.
-if (Filename.find_first_of(" #${}^!") != StringRef::npos)
-  OS << '\"' << Filename << '\"';
+if (NativePath.find_first_of(" #${}^!") != StringRef::npos)
+  OS << '\"' << NativePath << '\"';
 else
-  OS << Filename;
+  OS << NativePath;
 return;
   }
   assert(OutputFormat == DependencyOutputFormat::Make);
-  for (unsigned i = 0, e = Filename.size(); i != e; ++i) {
-if (Filename[i] == '#') // Handle '#' the broken gcc way.
+  for (unsigned i = 0, e = NativePath.size(); i != e; ++i) {
+if (NativePath[i] == '#') // Handle '#' the broken gcc way.
   OS << '\\';
-else if (Filename[i] == ' ') { // Handle space correctly.
+else if (NativePath[i] == ' ') { // Handle space correctly.
   OS << '\\';
   unsigned j = i;
-  while (j > 0 && Filename[--j] == '\\')
+  while (j > 0 && NativePath[--j] == '\\')
 OS << '\\';
-} else if (Filename[i] == '$') // $ is escaped by $$.
+} else if (NativePath[i] == '$') // $ is escaped by $$.
   OS << '$';
-OS << Filename[i];
+OS << NativePath[i];
   }
 }
 


Index: test/Frontend/dependency-gen-escaping.c
===
--- test/Frontend/dependency-gen-escaping.c
+++ test/Frontend/dependency-gen-escaping.c
@@ -21,7 +21,7 @@
 // Backslash followed by # or space should escape both characters, because
 // that's what GNU Make wants.  GCC does the right thing with space, but not
 // #, so Clang does too. (There should be 3 backslashes before the #.)
-// SEP2F: a\b\\#c\\\ d.h
+// SEP2F: a{{[/\\]}}b{{[/\\]}}\#c{{/|}}\ d.h
 // With -fms-compatibility, Backslashes in #include are treated as path separators.
 // Backslashes are given in the emission for special characters, like 0x20 or 0x23.
 // SEP5C: a{{[/\\]}}b{{[/\\]}}\#c{{/|}}\ d.h
Index: lib/Frontend/DependencyFile.cpp
===
--- lib/Frontend/DependencyFile.cpp
+++ lib/Frontend/DependencyFile.cpp
@@ -386,28 +386,32 @@
 /// for Windows file-naming info.
 static void PrintFilename(raw_ostream &OS, StringRef Filename,
   DependencyOutputFormat OutputFormat) {
+  // Convert filename to platform native path
+  llvm::SmallString<256> NativePath;
+  llvm::sys::path::native(Filename.str(), NativePath);
+
   if (OutputFormat == DependencyOutputFormat::NMake) {
 // Add quotes if needed. These are the characters listed as "special" to
 // NMake, that are legal in a Windows filespec, and that could cause
 // misinterpretation of the dependency string.
-if (Filename.find_first_of(" #${}^!") != StringRef::npos)
-  OS << '\"' << Filename << '\"';
+if (NativePath.find_first_of(" #${}^!") != StringRef::npos)
+  OS << '\"' << NativePath << '\"';
 else
-  OS << Filename;
+  OS << NativePath;
 return;
   }
   assert(OutputFormat == DependencyOutputFormat::Make);
-  for (unsigned i = 0, e = Filename.size(); i != e; ++i) {
-if (Filename[i] == '#') // Handle '#' the broken gcc way.
+  for (unsigned i = 0, e = NativePath.size(); i != e; ++i) {
+if (NativePath[i] == '#') // Handle '#' the broken gcc way.
   OS << '\\';
-else if (Filename[i] == ' ') { // Handle space c

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

2018-09-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev created this revision.
kbobyrev added reviewers: ioeric, ilya-biryukov.
kbobyrev added a project: clang-tools-extra.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay.

After `FuzzyFindRequest` JSON (de)serialization was introduced, it should 
replace ad-hoc fuzzy-find request parsing implemented in the IndexBenchmark 
driver.


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
@@ -18,57 +18,42 @@
 #include 
 #include 
 
+using clang::clangd::loadIndex;
+using clang::clangd::SymbolIndex;
+
 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 '\n'-separated FuzzyFindRequest JSON representations 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;
+  llvm::SmallVector Lines;
+  Temporar

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

2018-09-12 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 created this revision.
rogfer01 added reviewers: lewis-revill, asb, simoncook, kristina.
Herald added subscribers: jocewei, PkmX, rkruppe, the_o, brucehoult, 
MartinMosbeck, mgrang, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, 
sabuasal, apazos, johnrusso, rbar.

In https://reviews.llvm.org/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).


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] D51949: [WIP][clang-tidy] initial ideas to isolate variable declarations

2018-09-12 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

I knew there was something already but I couldn't find it. Thank you for
pointing me there :)

I will inspect the code and then decide, maybe I will incorporate some
of his stuff into mine or take his one over.

Am 12.09.2018 um 08:04 schrieb Roman Lebedev via Phabricator:

> lebedev.ri added a comment.
> 
> Thank you for working on this! I really miss this check.
>  To be noted, there is preexisting, almost finished version - 
> https://reviews.llvm.org/D27621.
>  I'm not sure in what state it really is, but it might be simpler to take 
> that over and finish it.
> 
> Repository:
> 
>   rCTE Clang Tools Extra
> 
> https://reviews.llvm.org/D51949


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] D51977: [clangd] Clarify and hide -index flag.

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

The wording implies global index support, which is confusing.
As most users shouldn't care about this flag, also make it hidden to avoid
further confusion.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51977

Files:
  clangd/tool/ClangdMain.cpp


Index: clangd/tool/ClangdMain.cpp
===
--- clangd/tool/ClangdMain.cpp
+++ clangd/tool/ClangdMain.cpp
@@ -130,10 +130,11 @@
 
 static llvm::cl::opt EnableIndex(
 "index",
-llvm::cl::desc("Enable index-based features such as global code completion 
"
-   "and searching for symbols. "
-   "Clang uses an index built from symbols in opened files"),
-llvm::cl::init(true));
+llvm::cl::desc(
+"Enable index-based features. By default, clangd maintains an index "
+"built from symbols in opened files. Static/global index support needs 
"
+"to enabled separatedly."),
+llvm::cl::init(true), llvm::cl::Hidden);
 
 static llvm::cl::opt
 ShowOrigins("debug-origin",


Index: clangd/tool/ClangdMain.cpp
===
--- clangd/tool/ClangdMain.cpp
+++ clangd/tool/ClangdMain.cpp
@@ -130,10 +130,11 @@
 
 static llvm::cl::opt EnableIndex(
 "index",
-llvm::cl::desc("Enable index-based features such as global code completion "
-   "and searching for symbols. "
-   "Clang uses an index built from symbols in opened files"),
-llvm::cl::init(true));
+llvm::cl::desc(
+"Enable index-based features. By default, clangd maintains an index "
+"built from symbols in opened files. Static/global index support needs "
+"to enabled separatedly."),
+llvm::cl::init(true), llvm::cl::Hidden);
 
 static llvm::cl::opt
 ShowOrigins("debug-origin",
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r342052 - Fix MSVC "not all control paths return a value" warnings. NFCI.

2018-09-12 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Wed Sep 12 05:56:58 2018
New Revision: 342052

URL: http://llvm.org/viewvc/llvm-project?rev=342052&view=rev
Log:
Fix MSVC "not all control paths return a value" warnings. NFCI.

Modified:
clang-tools-extra/trunk/clang-doc/MDGenerator.cpp

Modified: clang-tools-extra/trunk/clang-doc/MDGenerator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/MDGenerator.cpp?rev=342052&r1=342051&r2=342052&view=diff
==
--- clang-tools-extra/trunk/clang-doc/MDGenerator.cpp (original)
+++ clang-tools-extra/trunk/clang-doc/MDGenerator.cpp Wed Sep 12 05:56:58 2018
@@ -32,6 +32,7 @@ std::string getAccess(AccessSpecifier AS
   case AccessSpecifier::AS_none:
 return {};
   }
+  llvm_unreachable("Unknown AccessSpecifier");
 }
 
 std::string getTagType(TagTypeKind AS) {
@@ -47,6 +48,7 @@ std::string getTagType(TagTypeKind AS) {
   case TagTypeKind::TTK_Enum:
 return "enum";
   }
+  llvm_unreachable("Unknown TagTypeKind");
 }
 
 // Markdown generation


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


[PATCH] D51429: [AArch64] Return Address Signing B Key Support

2018-09-12 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added inline comments.



Comment at: test/CodeGen/aarch64-sign-return-address.c:3
 // RUN: %clang -target aarch64-arm-none-eabi -S -emit-llvm -o - 
-msign-return-address=non-leaf %s | FileCheck %s --check-prefix=CHECK-PARTIAL
 // RUN: %clang -target aarch64-arm-none-eabi -S -emit-llvm -o - 
-msign-return-address=all %s | FileCheck %s --check-prefix=CHECK-ALL
+// RUN: %clang -target aarch64-arm-none-eabi -S -emit-llvm -o - 
-msign-return-address=all+a_key %s | FileCheck %s --check-prefix=CHECK-A-KEY

If the default is the a_key, does this test need to check the a_key attribute?


Repository:
  rC Clang

https://reviews.llvm.org/D51429



___
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 inline comments.



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

`llvm::Twine` here? Seems like this one is used a lot for concatenation, so 
just `.str()` when returning.



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

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).



Comment at: clang-tidy/readability/IsolateDeclCheck.cpp:71
+  auto Diag =
+  diag(WholeDecl->getBeginLoc(), "make only one declaration per 
statement");
+

Maybe it's just me: this doesn't seem like a very clear diagnostic message, 
probably needs better wording (can't think of anything in particular ATM, 
though).



Comment at: clang-tidy/readability/IsolateDeclCheck.h:1
+//===--- IsolateDeclCheck.h - clang-tidy-*- C++ 
-*-===//
+//

nit: space between clang-tidy (also, in .cpp file)


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


Re: [PATCH] D51847: Print correctly dependency paths on Windows

2018-09-12 Thread Zachary Turner via cfe-commits
Lgtm
On Wed, Sep 12, 2018 at 3:23 AM Dávid Bolvanský via Phabricator <
revi...@reviews.llvm.org> wrote:

> xbolva00 updated this revision to Diff 165052.
> xbolva00 added a comment.
>
> - Fixed failing test
>
>
> https://reviews.llvm.org/D51847
>
> Files:
>   lib/Frontend/DependencyFile.cpp
>   test/Frontend/dependency-gen-escaping.c
>
>
> Index: test/Frontend/dependency-gen-escaping.c
> ===
> --- test/Frontend/dependency-gen-escaping.c
> +++ test/Frontend/dependency-gen-escaping.c
> @@ -21,7 +21,7 @@
>  // Backslash followed by # or space should escape both characters, because
>  // that's what GNU Make wants.  GCC does the right thing with space, but
> not
>  // #, so Clang does too. (There should be 3 backslashes before the #.)
> -// SEP2F: a\b\\#c\\\ d.h
> +// SEP2F: a{{[/\\]}}b{{[/\\]}}\#c{{/|}}\ d.h
>  // With -fms-compatibility, Backslashes in #include are treated as path
> separators.
>  // Backslashes are given in the emission for special characters, like
> 0x20 or 0x23.
>  // SEP5C: a{{[/\\]}}b{{[/\\]}}\#c{{/|}}\ d.h
> Index: lib/Frontend/DependencyFile.cpp
> ===
> --- lib/Frontend/DependencyFile.cpp
> +++ lib/Frontend/DependencyFile.cpp
> @@ -386,28 +386,32 @@
>  /// for Windows file-naming info.
>  static void PrintFilename(raw_ostream &OS, StringRef Filename,
>DependencyOutputFormat OutputFormat) {
> +  // Convert filename to platform native path
> +  llvm::SmallString<256> NativePath;
> +  llvm::sys::path::native(Filename.str(), NativePath);
> +
>if (OutputFormat == DependencyOutputFormat::NMake) {
>  // Add quotes if needed. These are the characters listed as "special"
> to
>  // NMake, that are legal in a Windows filespec, and that could cause
>  // misinterpretation of the dependency string.
> -if (Filename.find_first_of(" #${}^!") != StringRef::npos)
> -  OS << '\"' << Filename << '\"';
> +if (NativePath.find_first_of(" #${}^!") != StringRef::npos)
> +  OS << '\"' << NativePath << '\"';
>  else
> -  OS << Filename;
> +  OS << NativePath;
>  return;
>}
>assert(OutputFormat == DependencyOutputFormat::Make);
> -  for (unsigned i = 0, e = Filename.size(); i != e; ++i) {
> -if (Filename[i] == '#') // Handle '#' the broken gcc way.
> +  for (unsigned i = 0, e = NativePath.size(); i != e; ++i) {
> +if (NativePath[i] == '#') // Handle '#' the broken gcc way.
>OS << '\\';
> -else if (Filename[i] == ' ') { // Handle space correctly.
> +else if (NativePath[i] == ' ') { // Handle space correctly.
>OS << '\\';
>unsigned j = i;
> -  while (j > 0 && Filename[--j] == '\\')
> +  while (j > 0 && NativePath[--j] == '\\')
>  OS << '\\';
> -} else if (Filename[i] == '$') // $ is escaped by $$.
> +} else if (NativePath[i] == '$') // $ is escaped by $$.
>OS << '$';
> -OS << Filename[i];
> +OS << NativePath[i];
>}
>  }
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51847: Print correctly dependency paths on Windows

2018-09-12 Thread Mailing List "cfe-commits" via Phabricator via cfe-commits
cfe-commits added a comment.

Lgtm

- F7184192: msg-6991-166.txt 


https://reviews.llvm.org/D51847



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


[PATCH] D51982: [clangd] Introduce PostingList interface

2018-09-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev created this revision.
kbobyrev added reviewers: ioeric, ilya-biryukov, sammccall.
kbobyrev added a project: clang-tools-extra.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay, mgorny.

This patch introduces `PostingList` interface which is helpful for experiments 
with Sparse and Dense (will be introduced in the next few patches) posting list 
representation.

No functionality change is introduced, this patch is mostly refactoring so that 
the following patches could focus on functionality while not being too hard to 
review.


https://reviews.llvm.org/D51982

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  clang-tools-extra/clangd/index/dex/Dex.cpp
  clang-tools-extra/clangd/index/dex/Dex.h
  clang-tools-extra/clangd/index/dex/Iterator.cpp
  clang-tools-extra/clangd/index/dex/Iterator.h
  clang-tools-extra/clangd/index/dex/PostingList.cpp
  clang-tools-extra/clangd/index/dex/PostingList.h
  clang-tools-extra/unittests/clangd/DexTests.cpp

Index: clang-tools-extra/unittests/clangd/DexTests.cpp
===
--- clang-tools-extra/unittests/clangd/DexTests.cpp
+++ clang-tools-extra/unittests/clangd/DexTests.cpp
@@ -47,8 +47,8 @@
 }
 
 TEST(DexIterators, DocumentIterator) {
-  const PostingList L = {4, 7, 8, 20, 42, 100};
-  auto DocIterator = create(L);
+  const SparsePostingList L({4, 7, 8, 20, 42, 100});
+  auto DocIterator = L.iterator();
 
   EXPECT_EQ(DocIterator->peek(), 4U);
   EXPECT_FALSE(DocIterator->reachedEnd());
@@ -70,28 +70,28 @@
 }
 
 TEST(DexIterators, AndWithEmpty) {
-  const PostingList L0;
-  const PostingList L1 = {0, 5, 7, 10, 42, 320, 9000};
+  const SparsePostingList L0({});
+  const SparsePostingList L1({0, 5, 7, 10, 42, 320, 9000});
 
-  auto AndEmpty = createAnd(create(L0));
+  auto AndEmpty = createAnd(L0.iterator());
   EXPECT_TRUE(AndEmpty->reachedEnd());
 
-  auto AndWithEmpty = createAnd(create(L0), create(L1));
+  auto AndWithEmpty = createAnd(L0.iterator(), L1.iterator());
   EXPECT_TRUE(AndWithEmpty->reachedEnd());
 
   EXPECT_THAT(consumeIDs(*AndWithEmpty), ElementsAre());
 }
 
 TEST(DexIterators, AndTwoLists) {
-  const PostingList L0 = {0, 5, 7, 10, 42, 320, 9000};
-  const PostingList L1 = {0, 4, 7, 10, 30, 60, 320, 9000};
+  const SparsePostingList L0({0, 5, 7, 10, 42, 320, 9000});
+  const SparsePostingList L1({0, 4, 7, 10, 30, 60, 320, 9000});
 
-  auto And = createAnd(create(L1), create(L0));
+  auto And = createAnd(L1.iterator(), L0.iterator());
 
   EXPECT_FALSE(And->reachedEnd());
   EXPECT_THAT(consumeIDs(*And), ElementsAre(0U, 7U, 10U, 320U, 9000U));
 
-  And = createAnd(create(L0), create(L1));
+  And = createAnd(L0.iterator(), L1.iterator());
 
   And->advanceTo(0);
   EXPECT_EQ(And->peek(), 0U);
@@ -107,11 +107,11 @@
 }
 
 TEST(DexIterators, AndThreeLists) {
-  const PostingList L0 = {0, 5, 7, 10, 42, 320, 9000};
-  const PostingList L1 = {0, 4, 7, 10, 30, 60, 320, 9000};
-  const PostingList L2 = {1, 4, 7, 11, 30, 60, 320, 9000};
+  const SparsePostingList L0({0, 5, 7, 10, 42, 320, 9000});
+  const SparsePostingList L1({0, 4, 7, 10, 30, 60, 320, 9000});
+  const SparsePostingList L2({1, 4, 7, 11, 30, 60, 320, 9000});
 
-  auto And = createAnd(create(L0), create(L1), create(L2));
+  auto And = createAnd(L0.iterator(), L1.iterator(), L2.iterator());
   EXPECT_EQ(And->peek(), 7U);
   And->advanceTo(300);
   EXPECT_EQ(And->peek(), 320U);
@@ -121,24 +121,24 @@
 }
 
 TEST(DexIterators, OrWithEmpty) {
-  const PostingList L0;
-  const PostingList L1 = {0, 5, 7, 10, 42, 320, 9000};
+  const SparsePostingList L0({});
+  const SparsePostingList L1({0, 5, 7, 10, 42, 320, 9000});
 
-  auto OrEmpty = createOr(create(L0));
+  auto OrEmpty = createOr(L0.iterator());
   EXPECT_TRUE(OrEmpty->reachedEnd());
 
-  auto OrWithEmpty = createOr(create(L0), create(L1));
+  auto OrWithEmpty = createOr(L0.iterator(), L1.iterator());
   EXPECT_FALSE(OrWithEmpty->reachedEnd());
 
   EXPECT_THAT(consumeIDs(*OrWithEmpty),
   ElementsAre(0U, 5U, 7U, 10U, 42U, 320U, 9000U));
 }
 
 TEST(DexIterators, OrTwoLists) {
-  const PostingList L0 = {0, 5, 7, 10, 42, 320, 9000};
-  const PostingList L1 = {0, 4, 7, 10, 30, 60, 320, 9000};
+  const SparsePostingList L0({0, 5, 7, 10, 42, 320, 9000});
+  const SparsePostingList L1({0, 4, 7, 10, 30, 60, 320, 9000});
 
-  auto Or = createOr(create(L0), create(L1));
+  auto Or = createOr(L0.iterator(), L1.iterator());
 
   EXPECT_FALSE(Or->reachedEnd());
   EXPECT_EQ(Or->peek(), 0U);
@@ -161,18 +161,18 @@
   Or->advanceTo(9001);
   EXPECT_TRUE(Or->reachedEnd());
 
-  Or = createOr(create(L0), create(L1));
+  Or = createOr(L0.iterator(), L1.iterator());
 
   EXPECT_THAT(consumeIDs(*Or),
   ElementsAre(0U, 4U, 5U, 7U, 10U, 30U, 42U, 60U, 320U, 9000U));
 }
 
 TEST(DexIterators, OrThreeLists) {
-  const PostingList L0 = {0, 5, 7, 10, 42, 320, 9000};
-  const PostingList L1 = {0, 4, 7, 10, 30, 60, 320, 9000};
-  const PostingList L2 = {1, 4, 7, 11, 30, 60, 

[PATCH] D51982: [clangd] Introduce PostingList interface

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

There is not enough documentation right now, I should fix that before patch 
could be reviewed. This is a preview mode.

Also, Index size estimation is incorrect now and will be fixed in the next diff.


https://reviews.llvm.org/D51982



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


[PATCH] D51416: [RTTI] Align rtti types to prevent over-alignment

2018-09-12 Thread Dave Green via Phabricator via cfe-commits
dmgreen added a comment.

That sounds like a good idea. Thanks for the help on this one.


https://reviews.llvm.org/D51416



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


r342053 - [CodeGen] Align rtti and vtable data

2018-09-12 Thread David Green via cfe-commits
Author: dmgreen
Date: Wed Sep 12 07:09:06 2018
New Revision: 342053

URL: http://llvm.org/viewvc/llvm-project?rev=342053&view=rev
Log:
[CodeGen] Align rtti and vtable data

Previously the alignment on the newly created rtti/typeinfo data was largely
not set, meaning that DataLayout::getPreferredAlignment was free to overalign
it to 16 bytes. This causes unnecessary code bloat.

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

Modified:
cfe/trunk/lib/CodeGen/CGVTT.cpp
cfe/trunk/lib/CodeGen/CGVTables.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
cfe/trunk/test/CodeGenCXX/microsoft-abi-vbtables.cpp
cfe/trunk/test/CodeGenCXX/vtable-align.cpp
cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp

Modified: cfe/trunk/lib/CodeGen/CGVTT.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTT.cpp?rev=342053&r1=342052&r2=342053&view=diff
==
--- cfe/trunk/lib/CodeGen/CGVTT.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTT.cpp Wed Sep 12 07:09:06 2018
@@ -119,10 +119,10 @@ llvm::GlobalVariable *CodeGenVTables::Ge
 
   llvm::ArrayType *ArrayType =
 llvm::ArrayType::get(CGM.Int8PtrTy, Builder.getVTTComponents().size());
+  unsigned Align = CGM.getDataLayout().getABITypeAlignment(CGM.Int8PtrTy);
 
-  llvm::GlobalVariable *GV =
-CGM.CreateOrReplaceCXXRuntimeVariable(Name, ArrayType,
-  llvm::GlobalValue::ExternalLinkage);
+  llvm::GlobalVariable *GV = CGM.CreateOrReplaceCXXRuntimeVariable(
+  Name, ArrayType, llvm::GlobalValue::ExternalLinkage, Align);
   GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
   return GV;
 }

Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=342053&r1=342052&r2=342053&view=diff
==
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Wed Sep 12 07:09:06 2018
@@ -756,9 +756,11 @@ CodeGenVTables::GenerateConstructionVTab
   if (Linkage == llvm::GlobalVariable::AvailableExternallyLinkage)
 Linkage = llvm::GlobalVariable::InternalLinkage;
 
+  unsigned Align = CGM.getDataLayout().getABITypeAlignment(VTType);
+
   // Create the variable that will hold the construction vtable.
   llvm::GlobalVariable *VTable =
-CGM.CreateOrReplaceCXXRuntimeVariable(Name, VTType, Linkage);
+  CGM.CreateOrReplaceCXXRuntimeVariable(Name, VTType, Linkage, Align);
   CGM.setGVProperties(VTable, RD);
 
   // V-tables are always unnamed_addr.

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=342053&r1=342052&r2=342053&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Sep 12 07:09:06 2018
@@ -3099,10 +3099,9 @@ CodeGenModule::GetAddrOfGlobal(GlobalDec
   IsForDefinition);
 }
 
-llvm::GlobalVariable *
-CodeGenModule::CreateOrReplaceCXXRuntimeVariable(StringRef Name,
-  llvm::Type *Ty,
-  llvm::GlobalValue::LinkageTypes Linkage) 
{
+llvm::GlobalVariable *CodeGenModule::CreateOrReplaceCXXRuntimeVariable(
+StringRef Name, llvm::Type *Ty, llvm::GlobalValue::LinkageTypes Linkage,
+unsigned Alignment) {
   llvm::GlobalVariable *GV = getModule().getNamedGlobal(Name);
   llvm::GlobalVariable *OldGV = nullptr;
 
@@ -3138,6 +3137,8 @@ CodeGenModule::CreateOrReplaceCXXRuntime
   !GV->hasAvailableExternallyLinkage())
 GV->setComdat(TheModule.getOrInsertComdat(GV->getName()));
 
+  GV->setAlignment(Alignment);
+
   return GV;
 }
 

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=342053&r1=342052&r2=342053&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Wed Sep 12 07:09:06 2018
@@ -764,7 +764,8 @@ public:
   /// bitcast to the new variable.
   llvm::GlobalVariable *
   CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty,
-llvm::GlobalValue::LinkageTypes Linkage);
+llvm::GlobalValue::LinkageTypes Linkage,
+unsigned Alignment);
 
   llvm::Function *
   CreateGlobalInitOrDestructFunction(llvm::FunctionType *ty, const Twine &name,

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=34205

[PATCH] D51416: [RTTI] Align rtti types to prevent over-alignment

2018-09-12 Thread Dave Green via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342053: [CodeGen] Align rtti and vtable data (authored by 
dmgreen, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51416?vs=164693&id=165077#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51416

Files:
  cfe/trunk/lib/CodeGen/CGVTT.cpp
  cfe/trunk/lib/CodeGen/CGVTables.cpp
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
  cfe/trunk/lib/CodeGen/CodeGenModule.h
  cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
  cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
  cfe/trunk/test/CodeGenCXX/microsoft-abi-vbtables.cpp
  cfe/trunk/test/CodeGenCXX/vtable-align.cpp
  cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp

Index: cfe/trunk/test/CodeGenCXX/vtable-align.cpp
===
--- cfe/trunk/test/CodeGenCXX/vtable-align.cpp
+++ cfe/trunk/test/CodeGenCXX/vtable-align.cpp
@@ -10,5 +10,8 @@
 void A::f() {}
 
 // CHECK-32: @_ZTV1A = unnamed_addr constant { [5 x i8*] } { [5 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTI1A to i8*), i8* bitcast (void (%struct.A*)* @_ZN1A1fEv to i8*), i8* bitcast (void (%struct.A*)* @_ZN1A1gEv to i8*), i8* bitcast (void (%struct.A*)* @_ZN1A1hEv to i8*)] }, align 4
-
+// CHECK-32: @_ZTS1A = constant [3 x i8] c"1A\00", align 1
+// CHECK-32: @_ZTI1A = constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv117__class_type_infoE, i32 2) to i8*), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1A, i32 0, i32 0) }, align 4
 // CHECK-64: @_ZTV1A = unnamed_addr constant { [5 x i8*] } { [5 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTI1A to i8*), i8* bitcast (void (%struct.A*)* @_ZN1A1fEv to i8*), i8* bitcast (void (%struct.A*)* @_ZN1A1gEv to i8*), i8* bitcast (void (%struct.A*)* @_ZN1A1hEv to i8*)] }, align 8
+// CHECK-64: @_ZTS1A = constant [3 x i8] c"1A\00", align 1
+// CHECK-64: @_ZTI1A = constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1A, i32 0, i32 0) }, align 8
Index: cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp
===
--- cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp
+++ cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp
@@ -98,10 +98,10 @@
 
 // C has no key function, so its vtable should have weak_odr linkage
 // and hidden visibility (rdar://problem/7523229).
-// CHECK-DAG: @_ZTV1C = linkonce_odr unnamed_addr constant {{.*}}, comdat,
-// CHECK-DAG: @_ZTS1C = linkonce_odr constant {{.*}}, comdat{{$}}
-// CHECK-DAG: @_ZTI1C = linkonce_odr constant {{.*}}, comdat{{$}}
-// CHECK-DAG: @_ZTT1C = linkonce_odr unnamed_addr constant {{.*}}, comdat{{$}}
+// CHECK-DAG: @_ZTV1C = linkonce_odr unnamed_addr constant {{.*}}, comdat, align 8{{$}}
+// CHECK-DAG: @_ZTS1C = linkonce_odr constant {{.*}}, comdat, align 1{{$}}
+// CHECK-DAG: @_ZTI1C = linkonce_odr constant {{.*}}, comdat, align 8{{$}}
+// CHECK-DAG: @_ZTT1C = linkonce_odr unnamed_addr constant {{.*}}, comdat, align 8{{$}}
 
 // D has a key function that is defined in this translation unit so its vtable is
 // defined in the translation unit.
@@ -120,27 +120,27 @@
 // defined in this translation unit, so its vtable should have
 // weak_odr linkage.
 // CHECK-DAG: @_ZTV1EIsE = weak_odr unnamed_addr constant {{.*}}, comdat,
-// CHECK-DAG: @_ZTS1EIsE = weak_odr constant {{.*}}, comdat{{$}}
-// CHECK-DAG: @_ZTI1EIsE = weak_odr constant {{.*}}, comdat{{$}}
+// CHECK-DAG: @_ZTS1EIsE = weak_odr constant {{.*}}, comdat, align 1{{$}}
+// CHECK-DAG: @_ZTI1EIsE = weak_odr constant {{.*}}, comdat, align 8{{$}}
 
 // F is an explicit template instantiation without a key
 // function, so its vtable should have weak_odr linkage
 // CHECK-DAG: @_ZTV1FIsE = weak_odr unnamed_addr constant {{.*}}, comdat,
-// CHECK-DAG: @_ZTS1FIsE = weak_odr constant {{.*}}, comdat{{$}}
-// CHECK-DAG: @_ZTI1FIsE = weak_odr constant {{.*}}, comdat{{$}}
+// CHECK-DAG: @_ZTS1FIsE = weak_odr constant {{.*}}, comdat, align 1{{$}}
+// CHECK-DAG: @_ZTI1FIsE = weak_odr constant {{.*}}, comdat, align 8{{$}}
 
 // E is an implicit template instantiation with a key function
 // defined in this translation unit, so its vtable should have
 // linkonce_odr linkage.
 // CHECK-DAG: @_ZTV1EIlE = linkonce_odr unnamed_addr constant {{.*}}, comdat,
-// CHECK-DAG: @_ZTS1EIlE = linkonce_odr constant {{.*}}, comdat{{$}}
-// CHECK-DAG: @_ZTI1EIlE = linkonce_odr constant {{.*}}, comdat{{$}}
+// CHECK-DAG: @_ZTS1EIlE = linkonce_odr constant {{.*}}, comdat, align 1{{$}}
+// CHECK-DAG: @_ZTI1EIlE = linkonce_odr constant {{.*}}, comdat, align 8{{$}}
 
 // F is an implicit template instantiation with no key function,
 // so its vtable should have linkonce_odr linkage.
 // CHECK-DAG: @_ZTV1FIlE = linkonce_odr unnamed_addr constant {{.*}}, comdat,
-// CHECK-DAG: @_ZTS1FIlE = linkonce

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

2018-09-12 Thread Richard Diamond via Phabricator via cfe-commits
DiamondLovesYou created this revision.
DiamondLovesYou added a reviewer: beanz.
Herald added subscribers: cfe-commits, mgorny.
Herald added a reviewer: bollu.

clang doesn't need to link Polly when built with `LLVM_LINK_LLVM_DYLIB`.


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)


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)
___
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 created this revision.
ilya-biryukov added reviewers: ioeric, sammccall, kadircet.
Herald added subscribers: arphaman, jkorous, MaskRay, mgorny.

Given that the indexer binary is put directly into ./bin directory
when built, 'clangd-' prefix seems to provide better context to the
reader than 'global-'.


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/symbol-builder/CMakeLists.txt
  clangd/symbol-builder/SymbolBuilderMain.cpp
  test/CMakeLists.txt


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-symbol-builder
 
   # Unit tests
   ExtraToolsUnitTests
Index: clangd/symbol-builder/SymbolBuilderMain.cpp
===
--- clangd/symbol-builder/SymbolBuilderMain.cpp
+++ clangd/symbol-builder/SymbolBuilderMain.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-symbol-builder --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-symbol-builder File1.cpp File2.cpp ... FileN.cpp > index.yaml
 
   Note: only symbols from header files will be collected.
   )";
Index: clangd/symbol-builder/CMakeLists.txt
===
--- clangd/symbol-builder/CMakeLists.txt
+++ clangd/symbol-builder/CMakeLists.txt
@@ -4,11 +4,11 @@
 Support
 )
 
-add_clang_executable(global-symbol-builder
-  GlobalSymbolBuilderMain.cpp
+add_clang_executable(clangd-symbol-builder
+  SymbolBuilderMain.cpp
   )
 
-target_link_libraries(global-symbol-builder
+target_link_libraries(clangd-symbol-builder
   PRIVATE
   clangAST
   clangIndex
Index: clangd/CMakeLists.txt
===
--- clangd/CMakeLists.txt
+++ clangd/CMakeLists.txt
@@ -73,4 +73,4 @@
   add_subdirectory(fuzzer)
 endif()
 add_subdirectory(tool)
-add_subdirectory(global-symbol-builder)
+add_subdirectory(symbol-builder)


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-symbol-builder
 
   # Unit tests
   ExtraToolsUnitTests
Index: clangd/symbol-builder/SymbolBuilderMain.cpp
===
--- clangd/symbol-builder/SymbolBuilderMain.cpp
+++ clangd/symbol-builder/SymbolBuilderMain.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-symbol-builder --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-symbol-builder File1.cpp File2.cpp ... FileN.cpp > index.yaml
 
   Note: only symbols from header files will be collected.
   )";
Index: clangd/symbol-builder/CMakeLists.txt
===
--- clangd/symbol-builder/CMakeLists.txt
+++ clangd/symbol-builder/CMakeLists.txt
@@ -4,11 +4,11 @@
 Support
 )
 
-add_clang_executable(global-symbol-builder
-  GlobalSymbolBuilderMain.cpp
+add_clang_executable(clangd-symbol-builder
+  SymbolBuilderMain.cpp
   )
 
-target_link_libraries(global-symbol-builder
+target_link_libraries(clangd-symbol-builder
   PRIVATE
   clangAST
   clangIndex
Index: clangd/CMakeLists.txt
===
--- clangd/CMakeLists.txt
+++ clangd/CMakeLists.txt
@@ -73,4 +73,4 @@
   add_subdirectory(fuzzer)
 endif()
 add_subdirectory(tool)
-add_subdirectory(global-symbol-builder)
+add_subdirectory(symbol-builder)
___
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 165085.
ilya-biryukov added a comment.

- Rebase, updated the added test


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/symbol-builder/CMakeLists.txt
  clangd/symbol-builder/SymbolBuilderMain.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-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
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-symbol-builder
 
   # Unit tests
   ExtraToolsUnitTests
Index: clangd/symbol-builder/SymbolBuilderMain.cpp
===
--- clangd/symbol-builder/SymbolBuilderMain.cpp
+++ clangd/symbol-builder/SymbolBuilderMain.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-symbol-builder --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-symbol-builder File1.cpp File2.cpp ... FileN.cpp > index.yaml
 
   Note: only symbols from header files will be collected.
   )";
Index: clangd/symbol-builder/CMakeLists.txt
===
--- clangd/symbol-builder/CMakeLists.txt
+++ clangd/symbol-builder/CMakeLists.txt
@@ -4,11 +4,11 @@
 Support
 )
 
-add_clang_executable(global-symbol-builder
-  GlobalSymbolBuilderMain.cpp
+add_clang_executable(clangd-symbol-builder
+  SymbolBuilderMain.cpp
   )
 
-target_link_libraries(global-symbol-builder
+target_link_libraries(clangd-symbol-builder
   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(symbol-builder)
 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-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
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-symbol-builder
 
   # Unit tests
   ExtraToolsUnitTests
Index: clangd/symbol-builder/SymbolBuilderMain.cpp
===
--- clangd/symbol-builder/SymbolBuilderMain.cpp
+++ clangd/symbol-builder/SymbolBuilderMain.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-symbol-builder --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-symbol-builder File1.cpp File2.cpp ... FileN.cpp > index.yaml
 

[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.

We've used the new name internally before and now that we're testing this, we 
need to be consistent.
The 'clangd-symbol-builder' looks like a better choice, so I'm pitching 
changing upstream first.


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.
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


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


[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


[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] 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] 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 &Index) {
-  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 &Sym) {
-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 &Index) {
-  llvm::DenseSet IDs{clang::clangd::SymbolID{USR}};
-  clang::clangd::LookupRequest Request{IDs};
-  bool FoundSymbol = false;
-  Index.lookup(Request, [&](const Symbol &Sym) {
-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 &Index) {
+std::string ParseErrs;
+llvm::raw_string_ostream OS(ParseErrs);
+bool Ok =
+cl::ParseCommandLineOptions(Argv.size(), Argv.data(), Overview, &OS);
+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 &Index) {
-  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 {
+ 

[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


[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&view=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&r1=342056&r2=342057&view=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&r1=342056&r2=342057&view=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 (&addressof(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&r1=342056&r2=342057&view=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 (&addressof(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&r1=342056&r2=342057&view=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";>P0122R7LWGJacksonvilleComplete7.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";>P0754R2LWGJacksonvilleComplete7.0
@@ -89,7 +89,7 @@
https://wg21.link/P0476R2";>P0476R2LWGBit-casting 
object representationsRapperswil
https://wg21.link

[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


[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] 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] 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 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] 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] 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 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 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 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] 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] 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] 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] 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.

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] 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] 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] 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 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] 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] 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


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&view=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&r1=342059&r2=342060&view=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] 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


[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] 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] 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] 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] 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] 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] 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


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&view=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&r1=342061&r2=342062&view=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 &SemaRef, 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 &SemaRef, const DeclarationNameInfo &ReductionId,
+SourceLocation Loc, QualType Ty,
+SmallVectorImpl> &Lookups) {
+  // 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, &OVE, 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 &SemaRef, SourceLocation Loc, SourceRange Range,
  Scope *S, CXXScopeSpec &ReductionIdScopeSpec,
@@ -10086,7 +10159,7 @@ buildDeclareReductionRef(Sema &SemaRef,
   } 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 &SemaRef,
   })) {
 UnresolvedSet<8> ResSet;
 for (const UnresolvedSet<8> &Set : 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 &SemaRef,
 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,
+

[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


[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&view=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&r1=342062&r2=342063&view=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] 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, &Matches)) {
-  R.Query = Matches[1];
-  CommaSeparatedValues.clear();
-  Line.split(CommaSeparatedValues, ',');
- 

[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] 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] 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] 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] 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] 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] 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 &CT = 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 &Opts,
-  Callback CB);
+  Canceler codeComplete(PathRef File, Position Pos,
+const clangd::CodeCompleteOptions &Opts,
+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 ClangdS

[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
cfe

[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] 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] 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 &CT = 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 &Opts,
-  Callback CB);
+  Canceler codeComplete(PathRef File, Position Pos,
+const clangd::CodeCompleteOptions &Opts,
+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 &Opts,
-  Callback CB) {
+Canceler ClangdServer::codeComplete(PathRef File, Position Pos,
+const clangd::CodeCompleteOptions &Opts,
+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 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] 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 
depth

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&view=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&r1=342067&r2=342068&view=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&r1=342067&r2=342068&view=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&r1=342067&r2=342068&view=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&r1=342067&r2=342068&view=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] 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


[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&view=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&r1=342069&r2=342070&view=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  &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+Throws(  Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+Throws& operator=(const Throws  &rhs) { v_ = rhs.v_; return *this; }
+Throws& operator=(  Throws &&rhs) { 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&r1=342069&r2=342070&view=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  &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+Throws(  Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+Throws& operator=(const Throws  &rhs) { v_ = rhs.v_; return *this; }
+Throws& operator=(  Throws &&rhs) { 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&r1=342069&r2=342070&view=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";>P0122R7LWGJacksonvilleComplete7.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";>P0754R2LWGJacksonvilleComplete7.0
@@ -89,7 +89,7 @@
   

[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&view=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&r1=342070&r2=342071&view=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


[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


[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] 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


  1   2   >