summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] SymbolOccurrences -> Refs and cleanupSam McCall2018-09-0419-388/+328
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A few things that I noticed while merging the SwapIndex patch: - SymbolOccurrences and particularly SymbolOccurrenceSlab are unwieldy names, and these names appear *a lot*. Ref, RefSlab, etc seem clear enough and read/format much better. - The asymmetry between SymbolSlab and RefSlab (build() vs freeze()) is confusing and irritating, and doesn't even save much code. Avoiding RefSlab::Builder was my idea, but it was a bad one; add it. - DenseMap<SymbolID, ArrayRef<Ref>> seems like a reasonable compromise for constructing MemIndex - and means many less wasted allocations than the current DenseMap<SymbolID, vector<Ref*>> for FileIndex, and none for slabs. - RefSlab::find() is not actually used for anything, so we can throw away the DenseMap and keep the representation much more compact. - A few naming/consistency fixes: e.g. Slabs,Refs -> Symbols,Refs. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51605 llvm-svn: 341368
* Remove lambda default parameter to silence -Wpedantic warning. NFCI.Simon Pilgrim2018-09-041-3/+3
| | | | llvm-svn: 341362
* [clangd] Fix index-twice regression from r341242Sam McCall2018-09-031-1/+0
| | | | llvm-svn: 341337
* [clangd] Some nitpicking around the new split (preamble/main) dynamic indexSam McCall2018-09-0310-63/+88
| | | | | | | | | | | | | | | | | | | | | | Summary: - DynamicIndex doesn't implement ParsingCallbacks, to make its role clearer. ParsingCallbacks is a separate object owned by the receiving TUScheduler. (I tried to get rid of the "index-like-object that doesn't implement index" but it was too messy). - Clarified(?) docs around DynamicIndex - fewer details up front, more details inside. - Exposed dynamic index from ClangdServer for memory monitoring and more direct testing of its contents (actual tests not added here, wanted to get this out for review) - Removed a redundant and sligthly confusing filename param in a callback Reviewers: ilya-biryukov Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51221 llvm-svn: 341325
* [clangd] Avoid crashes in override completionsIlya Biryukov2018-09-032-3/+18
| | | | | | | | | | | | | | Summary: NamedDecl::getName cannot be called on non-identifier names. Reviewers: kadircet, ioeric, hokein, sammccall Reviewed By: ioeric Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51598 llvm-svn: 341322
* [clangd] Fix ambiguous make_unique with c++17. NFCSam McCall2018-09-031-5/+5
| | | | llvm-svn: 341321
* [clangd] Handle errors before checking for cancelltionIlya Biryukov2018-09-031-3/+2
| | | | | | To avoid hitting assertions in llvm::Expected destructor. llvm-svn: 341319
* [clangd] Factor out the data-swapping functionality from MemIndex/DexIndex.Sam McCall2018-09-0313-517/+375
| | | | | | | | | | | | | | | | | | | | | | | Summary: This is now handled by a wrapper class SwapIndex, so MemIndex/DexIndex can be immutable and focus on their job. Old and busted: I have a MemIndex, which holds a shared_ptr<vector<Symbol*>>, which keeps the symbol slab alive. I update by calling build(shared_ptr<vector<Symbol*>>). New hotness: I have a SwapIndex, which holds a unique_ptr<SymbolIndex>, which holds a MemIndex, which holds a shared_ptr<void>, which keeps backing data alive. I update by building a new MemIndex and calling SwapIndex::reset(). Reviewers: kbobyrev, ioeric Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51422 llvm-svn: 341318
* [clangd] Support multiple #include headers in one symbol.Eric Liu2018-09-0311-65/+262
| | | | | | | | | | | | | | | | | | | | Summary: Currently, a symbol can have only one #include header attached, which might not work well if the symbol can be imported via different #includes depending on where it's used. This patch stores multiple #include headers (with # references) for each symbol, so that CodeCompletion can decide which include to insert. In this patch, code completion simply picks the most popular include as the default inserted header. We also return all possible includes and their edits in the `CodeCompletion` results. Reviewers: sammccall Reviewed By: sammccall Subscribers: mgrang, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51291 llvm-svn: 341304
* [clangd] Fix many typos. NFCFangrui Song2018-09-019-10/+10
| | | | llvm-svn: 341273
* [clangd] Implement findOccurrences interface in dynamic index.Haojian Wu2018-08-3112-56/+361
| | | | | | | | | | | | | | | | | | | | Summary: Implement the interface in - FileIndex - MemIndex - MergeIndex Depends on https://reviews.llvm.org/D50385. Reviewers: sammccall, ilya-biryukov Reviewed By: sammccall Subscribers: mgrang, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51279 llvm-svn: 341242
* [clangd] Flatten out Symbol::Details. It was ill-conceived, sorry.Sam McCall2018-08-3113-169/+67
| | | | | | | | | | Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51504 llvm-svn: 341211
* [clangd] Collect symbol occurrences in SymbolCollector.Haojian Wu2018-08-315-27/+265
| | | | | | | | | | SymbolCollector will be used for two cases: - collect Symbol type only, used for indexing preamble AST. - collect Symbol and SymbolOccurrences, used for indexing main AST. For finding local references from the AST, we will implement it in other ways. llvm-svn: 341208
* [NFC] Cleanup DexKirill Bobyrev2018-08-314-30/+33
| | | | | | | | | | | | | * Use consistent assertion messages in iterators implementations * Silence a bunch of clang-tidy warnings: use `emplace_back` instead of `push_back` where possible, make sure arguments have the same name in header and implementation file, use for loop over ranges where possible Reviewed by: ioeric Differential Revision: https://reviews.llvm.org/D51528 llvm-svn: 341190
* NFC: Fix build failure after rL341182Kirill Bobyrev2018-08-311-1/+1
| | | | | | Didn't rename another variable reference. llvm-svn: 341184
* [NFC] Use LLVM naming conventions within FileDistanceKirill Bobyrev2018-08-312-5/+5
| | | | | | | | Reviewed by: sammccall Differential Revision: https://reviews.llvm.org/D51527 llvm-svn: 341182
* [clang-move] Explicitly ignore implicit UsingDirectiveDecls instead of ↵Argyrios Kyrtzidis2018-08-311-1/+2
| | | | | | | | | depending on them missing source locations This is adjustment to allow the logic to work even if implicit UsingDirectiveDecls get actual source locations. There should be no functionality change. llvm-svn: 341161
* Import lit.llvm after rL341130Fangrui Song2018-08-311-1/+1
| | | | llvm-svn: 341152
* Add preload option to clang-queryStephen Kelly2018-08-301-0/+15
| | | | | | | | | | Summary: This allows loading a file with pre-defined let commands for example. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51261 llvm-svn: 341145
* Extract runCommandsInFile methodStephen Kelly2018-08-301-12/+19
| | | | | | | | Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51260 llvm-svn: 341144
* Remove LIT_SITE_CFG_IN_FOOTER, clang-tools-extraNico Weber2018-08-301-1/+2
| | | | | | | | | | It's always replaced with the same (short) static string, so just put that there directly. No intended behavior change. https://reviews.llvm.org/D51357 llvm-svn: 341130
* [clangd] Run SignatureHelp using an up-to-date preamble, waiting if needed.Sam McCall2018-08-304-33/+158
| | | | | | | | | | | | | | Summary: After code completion inserts a header, running signature help using the old preamble will usually fail. So we add support for consistent preamble reads. Reviewers: ilya-biryukov Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51438 llvm-svn: 341076
* [clangd] Remove UB introduced in rL341057Kirill Bobyrev2018-08-301-1/+0
| | | | llvm-svn: 341066
* [clangd] Report position of opening paren in singature helpIlya Biryukov2018-08-303-5/+74
| | | | | | | | | | | | | | Summary: Only accessible via the C++ API at the moment. Reviewers: sammccall Reviewed By: sammccall Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51437 llvm-svn: 341065
* [clang-tidy] Use simple string matching instead of RegexKirill Bobyrev2018-08-301-10/+20
| | | | | | | | | | | Instead of parsing and compiling the `llvm::Regex` each time, it's faster to use basic string matching for filename prefix check. Reviewed by: hokein Differential Revision: https://reviews.llvm.org/D51360 llvm-svn: 341061
* [clangd] Fix tests after rL341057Kirill Bobyrev2018-08-301-1/+1
| | | | | | | Since OR iterator children are not longer sorted by the estimated size, string representation should be different. llvm-svn: 341060
* [clangd] Implement iterator costKirill Bobyrev2018-08-303-5/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces iterator cost concept to improve the performance of Dex query iterators (mainly, AND iterator). Benchmarks show that the queries become ~10% faster. Before ``` ------------------------------------------------------- Benchmark Time CPU Iteration ------------------------------------------------------- DexAdHocQueries 5883074 ns 5883018 ns 117 DexRealQ 959904457 ns 959898507 ns 1 ``` After ``` ------------------------------------------------------- Benchmark Time CPU Iteration ------------------------------------------------------- DexAdHocQueries 5238403 ns 5238361 ns 130 DexRealQ 873275207 ns 873269453 ns 1 ``` Reviewed by: sammccall Differential Revision: https://reviews.llvm.org/D51310 llvm-svn: 341057
* [clang-tidy] fix check_clang_tidy to forbid mixing of CHECK-NOTES and ↵Jonas Toth2018-08-301-0/+3
| | | | | | | | | | | | | | | | | | | CHECK-MESSAGES Summary: The check_clang_tidy.py script would allow mixing of `CHECK-NOTES` and `CHECK-MESSAGES` but running `FileCheck` for that would implicitly fail, because `CHECK-NOTES` bails out if there is a warning. That means a clang-tidy test can not mix these constructs to check warnings with `CHECK-MESSAGES` and notes with `CHECK-NOTES`. The script gives now a clear error if that happens. Reviewers: alexfh, aaron.ballman, lebedev.ri, hokein Reviewed By: lebedev.ri Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D51381 llvm-svn: 341039
* [clang-tidy] Add abseil-no-internal-dependencies checkJonas Toth2018-08-2910-2/+196
| | | | | | | | | | | Finds instances where the user depends on internal details and warns them against doing so. Should not be run on internal Abseil files or Abseil source code. Patch by hugoeg! Differential Revision: https://reviews.llvm.org/D50542 llvm-svn: 340928
* Introduce the abseil-redundant-strcat-calls check.Aaron Ballman2018-08-298-0/+404
| | | | | | This flags redundant calls to absl::StrCat where the result is being passed to another call to absl::StrCat or absl::StrAppend. Patch by Hugo Gonzalez and Samuel Benzaquen. llvm-svn: 340918
* Introduce the abseil-str-cat-append check.Aaron Ballman2018-08-298-0/+295
| | | | | | This flags uses of absl::StrCat when absl::StrAppend should be used instead. Patch by Hugo Gonzalez and Benjamin Kramer. llvm-svn: 340915
* [clangd] Switch to Dex by default for the static indexKirill Bobyrev2018-08-281-1/+2
| | | | | | | | | | | | Dex is now mature enough to be used as the default static index. This patch performs the switch but introduces a hidden flag to allow users fallback to Mem in case something happens. Reviewed by: ioeric Differential Revision: https://reviews.llvm.org/D51352 llvm-svn: 340828
* [clangd] Use buffered llvm::errs() in the clangd binary.Eric Liu2018-08-281-0/+3
| | | | | | | | | | | | Summary: Unbuffered stream can cause significant (non-deterministic) latency for the logger. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51349 llvm-svn: 340822
* [clangd] Remove unused parameter. NFCIlya Biryukov2018-08-281-6/+5
| | | | llvm-svn: 340816
* [clangd] Add some trace::Spans. NFCIlya Biryukov2018-08-282-0/+2
| | | | llvm-svn: 340815
* [clang-tidy] Abseil: no namepsace checkHaojian Wu2018-08-2811-0/+186
| | | | | | | | | | This check ensures that users of Abseil do not open namespace absl in their code, as that violates our compatibility guidelines. AbseilMatcher.h written by Hugo Gonzalez. Patch by Deanna Garcia! llvm-svn: 340800
* Cleanup after rL340729Kirill Bobyrev2018-08-271-13/+12
| | | | llvm-svn: 340759
* [docs] Mention clangd-dev in clangd documentationKirill Bobyrev2018-08-271-1/+4
| | | | | | | | | | | | Since the clangd-dev is intended to be the place for clangd-related discussions, we should point new users to this mailing list while probably mentioning cfe-dev, too. Reviewed by: ioeric Differential Revision: https://reviews.llvm.org/D51293 llvm-svn: 340749
* [clangd] Use TRUE iterator instead of complete posting listKirill Bobyrev2018-08-271-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stop using `$$$` (empty) trigram and generating a posting list with all items. Since TRUE iterator is already implemented and correctly inserted when there are no real trigram posting lists, this is a valid transformation. Benchmarks show that this simple change allows ~30% speedup on dataset of real completion queries. Before ``` ------------------------------------------------------- Benchmark Time CPU Iterations ------------------------------------------------------- DexAdHocQueries 5640321 ns 5640265 ns 120 DexRealQ 939835603 ns 939830296 ns 1 ``` After ``` ------------------------------------------------------- Benchmark Time CPU Iterations ------------------------------------------------------- DexAdHocQueries 3452014 ns 3451987 ns 203 DexRealQ 667455912 ns 667455750 ns 1 ``` Reviewed by: ilya-biryukov Differential Revision: https://reviews.llvm.org/D51287 llvm-svn: 340729
* [clang-doc] Fix memory leaksJulie Hockett2018-08-242-5/+7
| | | | | | | | Adds a virtual destructor to the base Info class. Differential Revision: https://reviews.llvm.org/D51137 llvm-svn: 340620
* [clangd] Initial cancellation mechanism for LSP requests.Kadir Cetinkaya2018-08-2415-29/+431
| | | | | | | | | | | | Reviewers: ilya-biryukov, ioeric, hokein Reviewed By: ilya-biryukov Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50502 llvm-svn: 340607
* [clangd] Implement LIMIT iteratorKirill Bobyrev2018-08-244-60/+101
| | | | | | | | | | | | | This patch introduces LIMIT iterator, which is very important for improving the quality of search query. LIMIT iterators can be applied on top of BOOST iterators to prevent populating query request with a huge number of low-quality symbols. Reviewed by: sammccall Differential Revision: https://reviews.llvm.org/D51029 llvm-svn: 340605
* [clangd] Speculative code completion index request before Sema is run.Eric Liu2018-08-248-19/+274
| | | | | | | | | | | | | | | | | | | | | | | | Summary: For index-based code completion, send an asynchronous speculative index request, based on the index request for the last code completion on the same file and the filter text typed before the cursor, before sema code completion is invoked. This can reduce the code completion latency (by roughly latency of sema code completion) if the speculative request is the same as the one generated for the ongoing code completion from sema. As a sequence of code completions often have the same scopes and proximity paths etc, this should be effective for a number of code completions. Trace with speculative index request:{F6997544} Reviewers: hokein, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: javed.absar, jfb, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D50962 llvm-svn: 340604
* [clangd] Log memory usage of DexIndex and MemIndexKirill Bobyrev2018-08-249-0/+52
| | | | | | | | | | | | This patch prints information about built index size estimation to verbose logs. This is useful for optimizing memory usage of DexIndex and comparisons with MemIndex. Reviewed by: sammccall Differential Revision: https://reviews.llvm.org/D51154 llvm-svn: 340601
* [clangd] Allow to merge symbols on-the-fly in global-symbol-builderIlya Biryukov2018-08-241-35/+108
| | | | | | | | | | | | | | | | | | | | | | Summary: The new mode avoids serializing and deserializing YAML. This results in better performance and less memory usage. Reduce phase is now almost instant. The default is to use the old mode going through YAML serialization to allow migrating MapReduce clients that require the old mode to operate properly. After we migrate the clients, we can switch the default to the new mode. Reviewers: hokein, ioeric, kbobyrev, sammccall Reviewed By: ioeric Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51155 llvm-svn: 340600
* [clangd] Check for include overlapping looks for only the line now.Kadir Cetinkaya2018-08-232-3/+5
| | | | | | | | | | | | | | | | Summary: Currently we match an include only if we are inside filename, with this patch we will match whenever we are on the starting line of the include. Reviewers: ilya-biryukov, hokein, ioeric Reviewed By: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51163 llvm-svn: 340539
* [clangd] Suggest code-completions for overriding base class virtual methods.Kadir Cetinkaya2018-08-232-9/+125
| | | | | | | | | | | | | | | | | Summary: Whenever a code-completion is triggered within a class/struct/union looks at base classes and figures out non-overriden virtual functions. Than suggests completions for those. Reviewers: ilya-biryukov, hokein, ioeric Reviewed By: hokein Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D50898 llvm-svn: 340530
* [clangd] Move function argument snippet disable mechanism from LSP rendering ↵Kadir Cetinkaya2018-08-232-57/+38
| | | | | | | | | | | | | | | | | | | to internal clangd reprensentation. Summary: We were handling the EnableFunctionArgSnippets only when we are producing LSP response. Move that code into CompletionItem generation so that internal clients can benefit from that as well. Reviewers: ilya-biryukov, ioeric, hokein Reviewed By: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51102 llvm-svn: 340527
* [clangd] Increase the timeouts in TUScheduler tests to 10 seconds.Ilya Biryukov2018-08-231-9/+9
| | | | | | | | Some of them timeout on our buildbots in certain configurations. The timeouts are there to avoid hanging indefinitely on deadlocks, so the exact number we put there does not matter. llvm-svn: 340523
* [clangd] send diagnostic categories only when 'categorySupport'Alex Lorenz2018-08-2213-13/+57
| | | | | | | | | | | | capability was given by the client After r339738 Clangd started sending categories with each diagnostic, but that broke the eglot client. This commit puts the categories behind a capability to fix that breakage. Differential Revision: https://reviews.llvm.org/D51077 llvm-svn: 340449
OpenPOWER on IntegriCloud