Commit Graph

3508 Commits

Author SHA1 Message Date
Kirill Bobyrev d75b556c56 Revert Clangd Dex Iterators patch
This reverts two revisions:

* https://reviews.llvm.org/rL338017
* https://reviews.llvm.org/rL338028

They caused crash for Clang 3.6 & Clang 3.7 buildbots, it was
reported by Jeremy Morse.

llvm-svn: 338054
2018-07-26 18:25:48 +00:00
Ilya Biryukov 1d5e640428 [clangd] Use 'const Twine&' instead of 'Twine'. NFC
To fix clang-tidy warning

llvm-svn: 338037
2018-07-26 16:13:52 +00:00
Kirill Bobyrev 3f9758ee55 [clangd] Fix unit tests for Dex
Iterators took temporary objects in constructors, objects were
invalidated when built with recent Clang which resulted in crashes.

llvm-svn: 338028
2018-07-26 14:00:00 +00:00
Alexander Kornienko 7b6993d445 [clang-tidy] Fix llvm.org/PR38315 (support type aliases in modernize-shrink-to-fit)
llvm-svn: 338025
2018-07-26 13:13:54 +00:00
Ilya Biryukov 74f2655dc7 [clangd] Fix (most) naming warnings from clang-tidy. NFC
llvm-svn: 338021
2018-07-26 12:05:31 +00:00
Kirill Bobyrev bea258d3d7 [clangd] Proof-of-concept query iterators for Dex symbol index
This patch introduces three essential types of query iterators:
`DocumentIterator`, `AndIterator`, `OrIterator`. It provides a
convenient API for query tree generation and serves as a building block
for the next generation symbol index - Dex. Currently, many
optimizations are missed to improve code readability and to serve as the
reference implementation. Potential improvements are briefly mentioned
in `FIXME`s and will be addressed in the following patches.

Dex RFC in the mailing list:
http://lists.llvm.org/pipermail/clangd-dev/2018-July/000022.html

Iterators, their applications and potential extensions are explained in
detail in the design proposal:
https://docs.google.com/document/d/1C-A6PGT6TynyaX4PXyExNMiGmJ2jL1UwV91Kyx11gOI/edit#heading=h.903u1zon9nkj

Reviewers: ioeric, sammccall, ilya-biryukov

Subscribers: cfe-commits, klimek, jfb, mgrang, mgorny, MaskRay, jkorous,
arphaman

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

llvm-svn: 338017
2018-07-26 10:42:31 +00:00
Kirill Bobyrev f8823f3ccc [clangd] Give an example for symbol-builder usage
`global-symbol-builder` help message mentions `-executor=<string>`
option, but doesn't give any example of what the value could be

Assuming the most popular use case to be building the whole project
index, help message should probably give an example of such usage.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 338015
2018-07-26 09:41:24 +00:00
Ilya Biryukov 1720113ace [clangd] Do not rebuild AST if inputs have not changed
Summary:
If the contents are the same, the update most likely comes from the
fact that compile commands were invalidated. In that case we want to
avoid rebuilds in case the compile commands are actually the same.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: simark, javed.absar, MaskRay, jkorous, arphaman, jfb, cfe-commits

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

llvm-svn: 338012
2018-07-26 09:21:07 +00:00
Eric Liu 84bd5db209 [clangd] Use a sigmoid style function for #usages boost in symbol quality.
Summary:
This has a shape to similar logarithm function but grows much slower for
large #usages.

Metrics: https://reviews.llvm.org/P8096

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, cfe-commits, sammccall

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

llvm-svn: 337907
2018-07-25 11:26:35 +00:00
Kirill Bobyrev 5e82f05e7a [clangd] Introduce Dex symbol index search tokens
This patch introduces the core building block of the next-generation
Clangd symbol index - Dex. Search tokens are the keys in the inverted
index and represent a characteristic of a specific symbol: examples of
search token types (Token Namespaces) are

* Trigrams -  these are essential for unqualified symbol name fuzzy
search * Scopes for filtering the symbols by the namespace * Paths, e.g.
these can be used to uprank symbols defined close to the edited file

This patch outlines the generic for such token namespaces, but only
implements trigram generation.

The intuition behind trigram generation algorithm is that each extracted
trigram is a valid sequence for Fuzzy Matcher jumps, proposed
implementation utilize existing FuzzyMatcher API for segmentation and
trigram extraction.

However, trigrams generation algorithm for the query string is different
from the previous one: it simply yields sequences of 3 consecutive
lowercased valid characters (letters, digits).

Dex RFC in the mailing list:
http://lists.llvm.org/pipermail/clangd-dev/2018-July/000022.html

The trigram generation techniques are described in detail in the
proposal:
https://docs.google.com/document/d/1C-A6PGT6TynyaX4PXyExNMiGmJ2jL1UwV91Kyx11gOI/edit#heading=h.903u1zon9nkj

Reviewers: sammccall, ioeric, ilya-biryukovA

Subscribers: cfe-commits, klimek, mgorny, MaskRay, jkorous, arphaman

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

llvm-svn: 337901
2018-07-25 10:34:57 +00:00
Benjamin Kramer 11eef3b3e9 [clangd] Guard fuzzer against empty inputs.
llvm-svn: 337860
2018-07-24 21:50:06 +00:00
Eric Liu d7de81172e [clangd] Tune down quality score for class constructors so that it's ranked after class types.
Summary:
Currently, class constructors have the same score as the class types, and they
are often ranked before class types. This is often not desireable and can
be annoying when snippet is enabled and constructor signatures are added.

Metrics:

```
==================================================================================================
                                        OVERALL
==================================================================================================
  Total measurements: 111117 (+0)
  All measurements:
	MRR: 64.06 (+0.20)	Top-5: 75.73% (+0.14%)	Top-100: 93.71% (+0.01%)
  Full identifiers:
	MRR: 98.25 (+0.55)	Top-5: 99.04% (+0.03%)	Top-100: 99.16% (+0.00%)
  Filter length 0-5:
	MRR:      15.23 (+0.02)		50.50 (-0.02)		65.04 (+0.11)		70.75 (+0.19)		74.37 (+0.25)		79.43 (+0.32)
	Top-5:    40.90% (+0.03%)		74.52% (+0.03%)		87.23% (+0.15%)		91.68% (+0.08%)		93.68% (+0.14%)		95.87% (+0.12%)
	Top-100:  68.21% (+0.02%)		96.28% (+0.07%)		98.43% (+0.00%)		98.72% (+0.00%)		98.74% (+0.01%)		98.81% (+0.00%)
==================================================================================================
                                        DEFAULT
==================================================================================================
  Total measurements: 57535 (+0)
  All measurements:
	MRR: 58.07 (+0.37)	Top-5: 69.94% (+0.26%)	Top-100: 90.14% (+0.03%)
  Full identifiers:
	MRR: 97.13 (+1.05)	Top-5: 98.14% (+0.06%)	Top-100: 98.34% (+0.00%)
  Filter length 0-5:
	MRR:      13.91 (+0.00)		38.53 (+0.01)		55.58 (+0.21)		63.63 (+0.30)		69.23 (+0.47)		72.87 (+0.60)
	Top-5:    24.99% (+0.00%)		62.70% (+0.06%)		82.80% (+0.30%)		88.66% (+0.16%)		92.02% (+0.27%)		93.53% (+0.21%)
	Top-100:  51.56% (+0.05%)		93.19% (+0.13%)		97.30% (+0.00%)		97.81% (+0.00%)		97.85% (+0.01%)		97.79% (+0.00%)
```

Remark:
- The full-id completions have +1.05 MRR improvement.
- There is no noticeable impact on EXPLICIT_MEMBER_ACCESS and WANT_LOCAL.

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 337816
2018-07-24 08:51:52 +00:00
Jonas Toth ad2524f9fc [clang-tidy] fix PR36489 - respect deduced pointer types from auto as well
Summary:
The cppcoreguidelines-pro-bounds-pointer-arithmetic warns on all occassion where
pointer arithmetic is used, but does not check values where the pointer types
is deduced via `auto`. This patch adjusts this behaviour and solved
PR36489.
I accidentally commited a wrong patch, this Differential is meant to have a
correct revision description and code attached to it.
Because the patch was accepted by aaron.ballman already, i will just commit
it.
See https://reviews.llvm.org/D48717 for the old differntial (contains wrong
code from the mixup)

Subscribers: nemanjai, xazax.hun, kbarton, cfe-commits

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

llvm-svn: 337716
2018-07-23 17:46:17 +00:00
Jonas Toth 966b5203bd Revert "[clang-tidy] fix PR36489 - respect deduced pointer types from auto as well"
I applied the wrong patch.

llvm-svn: 337712
2018-07-23 17:34:25 +00:00
Jonas Toth 369e4fd353 [clang-tidy] fix PR36489 - respect deduced pointer types from auto as well
Summary:
The cppcoreguidelines-pro-bounds-pointer-arithmetic warns on all occassion where
pointer arithmetic is used, but does not check values where the pointer types
is deduced via ``auto``. This patch adjusts this behaviour and solved
PR36489.

Reviewers: alexfh, aaron.ballman, hokein, ilya-biryukov

Reviewed By: alexfh, aaron.ballman

Subscribers: nemanjai, xazax.hun, kbarton, cfe-commits

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

llvm-svn: 337710
2018-07-23 17:13:06 +00:00
Jonas Toth e8217f6a1f [clang-tidy] remove private decltypeType in TrailingReturnType
Summary:
This patch removes a private matcher in fuchsia/TrailingReturnType check because
the matcher is now in ASTMatchers

Reviewers: aaron.ballman, alexfh, hokein

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 337707
2018-07-23 16:30:13 +00:00
Simon Marchi 802a685b72 [clangd] Fix category in clangd-vscode's package.json
Summary:
When opening package.json, vscode shows:

  Use 'Programming  Languages' instead

Replacing "Languages" with this fixes it.

Reviewers: ilya-biryukov

Subscribers: arphaman, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 337697
2018-07-23 14:32:12 +00:00
Eric Liu 5d2a807f25 [clangd] Penalize non-instance members when accessed via class instances.
Summary:
The following are metrics for explicit member access completions. There is no
noticeable impact on other completion types.

Before:
EXPLICIT_MEMBER_ACCESS
  Total measurements: 24382
  All measurements: MRR: 62.27	Top10: 80.21%	Top-100: 94.48%
  Full identifiers: MRR: 98.81	Top10: 99.89%	Top-100: 99.95%
  0-5 filter len:
	MRR:  13.25	46.31	62.47	67.77	70.40	81.91
	Top-10:  29%	74%	84%	91%	91%	97%
	Top-100:  67%	99%	99%	99%	99%	100%

After:
EXPLICIT_MEMBER_ACCESS
  Total measurements: 24382
  All measurements: MRR: 63.18	Top10: 80.58%	Top-100: 95.07%
  Full identifiers: MRR: 98.79	Top10: 99.89%	Top-100: 99.95%
  0-5 filter len:
	MRR:  13.84	48.39	63.55	68.83	71.28	82.64
	Top-10:  30%	75%	84%	91%	91%	97%
	Top-100:  70%	99%	99%	99%	99%	100%

* Top-N: wanted result is found in the first N completion results.
* MRR: Mean reciprocal rank.

Remark: the change seems to have minor positive impact. Although the improvement
is relatively small, down-ranking non-instance members in instance member access
should reduce noise in the completion results.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 337681
2018-07-23 10:56:37 +00:00
Benjamin Kramer 7f288269f0 [clangd] Unbreak fuzzer build.
llvm-svn: 337655
2018-07-22 15:55:57 +00:00
Julie Hockett b218069826 [clang-doc] Create a script to generate tests
Upstreaming the script I use to generate clang-doc tests (and updating
the existing tests to use it)

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

llvm-svn: 337632
2018-07-20 23:00:34 +00:00
Julie Hockett eb50a2e8d4 [clang-doc] Adding PublicOnly flag
Submitted on behalf of Annie Cherkaev (@anniecherk)

Added a flag which, when enabled, documents only those methods and
fields which have a Public attribute.

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

llvm-svn: 337602
2018-07-20 18:49:55 +00:00
Benjamin Kramer 1434b81601 [clangd] Fix racy use-after-scope in unittest
This only shows up with asan when the stars align in a bad way.

llvm-svn: 337601
2018-07-20 18:45:25 +00:00
Sam McCall f7d1805171 [clangd] FuzzyMatch exposes an API for its word segmentation. NFC
Summary: This is intended to be used for indexing, e.g. in D49417

Reviewers: ioeric, omtcyfz

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 337527
2018-07-20 08:01:37 +00:00
Eric Liu f433c2dab7 [clangd] Also get scope for RK_pattern completion results.
For exmaple, clas field candidates in constructor initializers can be
RK_Pattern, but they can still have scopes.

llvm-svn: 337396
2018-07-18 15:31:14 +00:00
Idriss Riouak deb8c7d396 [clang-tidy: modernize] Fix modernize-use-equals-default with {} brackets list initialization: patch
Summary:
Hello, i would like to suggest a fix for one of the checks in clang-tidy. 
The bug was reported in https://bugs.llvm.org/show_bug.cgi?id=38039 where you can find more information.

```
struct UOB{
	UOB(const UOB &Other):j{Other.j}{}
	int j;
};
```
In this case the check modernize-use-equals-default does not detect copy constructors that can be defaulted; that should be:

```
struct UOB{
	UOB(const UOB &Other) = default;
	int j;
};
```

Reviewers: aaron.ballman, hokein, alexfh

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 337286
2018-07-17 14:35:15 +00:00
Benjamin Kramer a60dadde15 [clang-tidy] Force exceptions to be enabled in test
For targets that have them off by default.

llvm-svn: 337091
2018-07-14 10:48:06 +00:00
Eugene Zelenko 415a1506ed [Documentation] Add missing description for bugprone-exception-escape in Release Notes.
llvm-svn: 337069
2018-07-13 22:53:05 +00:00
Adam Balogh e0e5b4cf2e [clang-tidy] Exception Escape Checker
Finds functions which may throw an exception directly or indirectly, but they
should not: Destructors, move constructors, move assignment operators, the
main() function, swap() functions, functions marked with throw() or noexcept
and functions given as option to the checker.

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

llvm-svn: 336997
2018-07-13 13:09:40 +00:00
Sam McCall 57b66c8ba3 [clang-tidy] readability-inconsistent-declaration-parameter-name: accept approximate name matches.
Summary:
The goal is to reduce false positives when the difference is intentional, like:

foo(StringRef name);
foo(StringRef name_ref) {
  string name = cleanup(name_ref);
  ...
}

Or semantically unimportant, like:
foo(StringRef full_name);
foo(StringRef name) { ... }

There are other matching names we won't recognise (e.g. syns vs synonyms) but
this catches many that we see in practice, and gives people a systematic
workaround.

The old behavior is available as a 'Strict' option.

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 336992
2018-07-13 11:41:56 +00:00
Ben Hamilton 13af794726 [clang-tidy/ObjC] Add SQL to list of acronyms
Summary: SQL is a common acronym.

Reviewers: Wizard, hokein

Reviewed By: Wizard, hokein

Subscribers: cfe-commits

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

llvm-svn: 336919
2018-07-12 17:32:55 +00:00
Sam McCall 6316e0d322 [clangd] Extract FileSystemProvider into a separate header. NFC
Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 336909
2018-07-12 14:49:52 +00:00
Sam McCall 8d7760cb7c [clangd] log request/response messages with method/ID/error at INFO level
Summary: Bodies are logged at VERBOSE level (since r336785), tweak the formatting.

Reviewers: hokein

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 336899
2018-07-12 11:52:18 +00:00
Sam McCall b34565ec7a [clangd] Simplify logging wrapper after r336888
llvm-svn: 336890
2018-07-12 08:00:21 +00:00
Eugene Zelenko 8027bb3330 [Documentation] Fix incorrect documentation references, new checks order in Release Notes
llvm-svn: 336850
2018-07-11 20:56:26 +00:00
Eugene Zelenko 3b71c2c98d [Documentation] Link format and order of Clang-tidy changes in Release Notes
llvm-svn: 336849
2018-07-11 20:41:16 +00:00
Kirill Bobyrev 47d7f52dea [clangd] Uprank delcarations when "using q::name" is present in the main file
Having `using qualified::name;` for some symbol is an important signal
for clangd code completion as the user is more likely to use such
symbol.  This patch helps to uprank the relevant symbols by saving
UsingShadowDecl in the new field of CodeCompletionResult and checking
whether the corresponding UsingShadowDecl is located in the main file
later in ClangD code completion routine. While the relative importance
of such signal is a subject to change in the future, this patch simply
bumps DeclProximity score to the value of 1.0 which should be enough for
now.

The patch was tested using

`$ ninja check-clang check-clang-tools`

No unexpected failures were noticed after running the relevant testsets.

Reviewers: sammccall, ioeric

Subscribers: MaskRay, jkorous, cfe-commits

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

llvm-svn: 336810
2018-07-11 14:49:49 +00:00
Eric Liu 485074f987 [clangd] Ignore sema code complete callback with recovery context.
Summary:
Sema code complete in the recovery mode is generally useless. For many
cases, sema first completes in recovery context and then recovers to more useful
context, in which it's favorable to ignore results from recovery (as results are
often bad e.g. all builtin symbols and top-level symbols). There is also case
where only sema would fail to recover e.g. completions in excluded #if block.
Sema would try to give results, but the results are often useless (see the updated
excluded #if block test).

Reviewers: sammccall, ilya-biryukov

Subscribers: MaskRay, jkorous, cfe-commits

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

llvm-svn: 336801
2018-07-11 13:15:31 +00:00
Sam McCall bed5885d9e [clangd] Upgrade logging facilities with levels and formatv.
Summary:
log() is split into four functions:
 - elog()/log()/vlog() have different severity levels, allowing filtering
 - dlog() is a lazy macro which uses LLVM_DEBUG - it logs to the logger, but
   conditionally based on -debug-only flag and is omitted in release builds

All logging functions use formatv-style format strings now, e.g:
  log("Could not resolve URI {0}: {1}", URI, Result.takeError());

Existing log sites have been split between elog/log/vlog by best guess.

This includes a workaround for passing Error to formatv that can be
simplified when D49170 or similar lands.

Subscribers: ilya-biryukov, javed.absar, ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 336785
2018-07-11 10:35:11 +00:00
Shuai Wang 0ed0febb3e Use ExprMutationAnalyzer in performance-for-range-copy
Summary:
This gives better coverage to the check as ExprMutationAnalyzer is more
accurate comparing to isOnlyUsedAsConst.

Majority of wins come from const usage of member field, e.g.:
for (auto widget : container) { // copy of loop variable
  if (widget.type == BUTTON) { // const usage only recognized by ExprMutationAnalyzer
    // ...
  }
}

Reviewers: george.karpenkov

Subscribers: a.sidorin, cfe-commits

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

llvm-svn: 336737
2018-07-10 22:51:06 +00:00
Eric Liu a62c9d62a3 [clangd] Make sure macro information exists before increasing usage count.
llvm-svn: 336581
2018-07-09 18:54:51 +00:00
Eric Liu 48db19e95a [clangd] Support indexing MACROs.
Summary: This is not enabled in the global-symbol-builder or dynamic index yet.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits

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

llvm-svn: 336553
2018-07-09 15:31:07 +00:00
Marc-Andre Laperle 3ff329f629 [clangd] Mark "Document Symbols" as implemented in the docs
Summary: Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 336550
2018-07-09 14:34:07 +00:00
Sam McCall d20d7989c6 [clangd] Remove JSON library in favor of llvm/Support/JSON
Summary:
The library has graduated from clangd to llvm/Support.
This is a mechanical change to move to the new API and remove the old one.

Main API changes:
 - namespace clang::clangd::json --> llvm::json
 - json::Expr --> json::Value
 - Expr::asString() etc --> Value::getAsString() etc
 - unsigned longs need a cast (due to r336541 adding lossless integer support)

Reviewers: ilya-biryukov

Subscribers: mgorny, ioeric, MaskRay, jkorous, omtcyfz, cfe-commits

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

llvm-svn: 336549
2018-07-09 14:25:59 +00:00
Ilya Biryukov 6f33b330ae [clangd] Do not write comments into Preamble PCH
Summary:
To avoid wasting time deserializing them on code completion and
further reparses.

We do not use the comments anyway, because we cannot rely on the file
contents staying the same for reparses that reuse the prebuilt
preamble PCH.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 336540
2018-07-09 11:33:31 +00:00
Ilya Biryukov 4a9312079a [clangd] Wait for first preamble before code completion
Summary:
To avoid doing extra work of processing headers in the preamble
mutilple times in parallel.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: javed.absar, ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 336538
2018-07-09 10:45:33 +00:00
Ilya Biryukov 3703551135 [clangd] Added a test for preambles and -isystem
Summary:
Checks that preambles are properly invalidated when headers from
-isystem paths change.

Reviewers: sammccall, ioeric

Reviewed By: sammccall

Subscribers: MaskRay, jkorous, cfe-commits

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

llvm-svn: 336530
2018-07-09 09:10:22 +00:00
Sam McCall 4e5742a479 [clangd] Make SymbolOrigin an enum class, rather than a plain enum.
I never intended to define namespace pollution like clangd::AST, clangd::Unknown
etc. Oops!

llvm-svn: 336431
2018-07-06 11:50:49 +00:00
Marc-Andre Laperle 1be69701c3 [clangd] Implementation of textDocument/documentSymbol
Summary:
An AST-based approach is used to retrieve the document symbols rather than an
in-memory index query. The index is not an ideal fit to achieve this because of
the file-centric query being done here whereas the index is suited for
project-wide queries. Document symbols also includes more symbols and need to
keep the order as seen in the file.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>

Subscribers: tomgr, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 336386
2018-07-05 19:35:01 +00:00
Simon Marchi 8395323392 [clang-move] ClangMoveTests: Remove dots in output paths
Summary:
Following D48903 ([VirtualFileSystem] InMemoryFileSystem::status: Return
a Status with the requested name), the paths output by clang-move in the
FileToReplacements map may contain leading "./".  For example, where we
would get "foo.h", we'll now get "./foo.h".  This breaks the tests,
because we are doing exact string lookups in the FileToFileID and
Results maps (they contain "foo.h", but we search for "./foo.h").

To mitigate this, try to normalize a little bit the paths output by
clang-move to remove that leading "./".

This patch should be safe to merge before D48903, remove_dots will just
be a no-op.

Reviewers: ilya-biryukov, hokein

Reviewed By: hokein

Subscribers: ioeric, cfe-commits

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

llvm-svn: 336358
2018-07-05 14:53:17 +00:00
Kirill Bobyrev 7cf29bc028 [NFS] Wipe trailing whitespaces
This patch is a preparation for another one containing meaningful
changes. This patch simply removes trailing whitespaces in few files
affected by the upcoming patch and reformats

llvm-svn: 336330
2018-07-05 09:37:26 +00:00