summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clangd] Move clangd tests to clangd directory. check-clangd is no longer ↵Sam McCall2019-04-291-1272/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | part of check-clang-tools. Summary: Motivation: - this layout is a pain to work with - without a common root, it's painful to express things like "disable clangd" (D61122) - CMake/lit configs are a maintenance hazard, and the more the one-off hacks for various tools are entangled, the more we see apathy and non-ownership. This attempts to use the bare-minimum configuration needed (while still supporting the difficult cases: windows, standalone clang build, dynamic libs). In particular the lit.cfg.py and lit.site.cfg.py.in are merged into lit.cfg.in. The logic in these files is now minimal. (Much of clang-tools-extra's lit configs can probably be cleaned up by reusing lit.llvm.llvm_config.use_clang(), and every llvm project does its own version of LDPATH mangling. I haven't attempted to fix any of those). Docs are still in clang-tools-extra/docs, I don't have any plans to touch those. Reviewers: gribozavr Subscribers: mgorny, javed.absar, MaskRay, jkorous, arphaman, kadircet, jfb, cfe-commits, ilya-biryukov, thakis Tags: #clang Differential Revision: https://reviews.llvm.org/D61187 llvm-svn: 359424
* [clangd] Recognize "don't include me directly" pattern, and suppress include ↵Sam McCall2019-04-171-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | insertion. Summary: Typically used with umbrella headers, e.g. GTK: #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) #error "Only <gtk/gtk.h> can be included directly." #endif Heuristic is fairly conservative, a quick code search over github showed a fair number of hits and few/no false positives. (Not all were umbrella headers, but I'd be happy avoiding include insertion for all of them). We may want to relax the heuristic later to catch more cases. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60815 llvm-svn: 358605
* [clangd] Include insertion: require header guards, drop other heuristics, ↵Sam McCall2019-04-171-25/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | treat .def like .inc. Summary: We do have some reports of include insertion behaving badly in some codebases. Requiring header guards both makes sense in principle, and is likely to disable this "nice-to-have" feature in codebases where headers don't follow the expected pattern. With this we can drop some other heuristics, such as looking at file extensions to detect known non-headers - implementation files have no guards. One wrinkle here is #import - objc headers may not have guards because they're intended to be used via #import. If the header is the main file or is #included, we won't collect locations - merge should take care of this if we see the file #imported somewhere. Seems likely to be OK. Headers which have a canonicalization (stdlib, IWYU) are exempt from this check. *.inc files continue to be handled by looking up to the including file. This patch also adds *.def here - tablegen wants this pattern too. In terms of code structure, the division between SymbolCollector and CanonicalIncludes has shifted: SymbolCollector is responsible for more. This is because SymbolCollector has all the SourceManager/HeaderSearch access needed for checking for guards, and we interleave these checks with the *.def checks in a loop (potentially). We could hand all the info into CanonicalIncludes and put the logic there if that's preferable. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60316 llvm-svn: 358571
* [clangd] Fallback to OrigD when SLoc is invalidKadir Cetinkaya2019-04-151-0/+8
| | | | | | | | | | | | | | | | | Summary: Some implicit/built-in decls lack the source location information. Fallback to OrigD that we've seen in the source code instead of the canonical one in those cases. Reviewers: sammccall Subscribers: cfe-commits, arphaman, jkorous, MaskRay, ioeric, ilya-biryukov Tags: #clang Differential Revision: https://reviews.llvm.org/D60689 llvm-svn: 358413
* [clangd] Add TemplateArgumentList into SymbolKadir Cetinkaya2019-04-121-0/+68
| | | | | | | | | | | | | | | | | | | | | Summary: Part of re-landing rC356541 with D59599. Changes the way we store template arguments, previous patch was storing them inside Name field of Symbol. Which was violating the assumption: ```Symbol::Scope+Symbol::Name == clang::clangd::printQualifiedName``` which was made in multiple places inside codebase. This patch instead moves those arguments into their own field. Currently the field is meant to be human-readable, can be made structured if need be. Reviewers: ioeric, ilya-biryukov, gribozavr Subscribers: MaskRay, jkorous, arphaman, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59640 llvm-svn: 358273
* [clangd] Fix non-indexing of builtin functions like printf when the TU is CSam McCall2019-04-101-3/+11
| | | | llvm-svn: 358098
* Revert "[clangd] Print arguments in template specializations"Jordan Rupprecht2019-03-201-72/+15
| | | | | | This reverts commit 44a63f6a150dec72dea43730d2a89d292e58bd6f. It segfaults on an internal test case (will follow up off thread). llvm-svn: 356623
* [clangd] Print arguments in template specializationsKadir Cetinkaya2019-03-201-15/+72
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59354 llvm-svn: 356541
* [clangd] Store explicit template specializations in index for code ↵Kadir Cetinkaya2019-03-141-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | navigation purposes Summary: This introduces ~4k new symbols, and ~10k refs for LLVM. We need that information for providing better code navigation support: - When references for a class template is requested, we should return these specializations as well. - When children of a specialization is requested, we should be able to query for those symbols(instead of just class template) Number of symbols: 378574 -> 382784 Number of refs: 5098857 -> 5110689 Reviewers: hokein, gribozavr Reviewed By: gribozavr Subscribers: nridge, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59083 llvm-svn: 356125
* [clangd] Index UsingDeclsKadir Cetinkaya2019-02-261-3/+11
| | | | | | | | | | | | | | | | Summary: D58340 enables indexing of USRs, this makes sure test in clangd are aligned with the change Reviewers: hokein Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58341 llvm-svn: 354879
* [clangd] Drop documentation in static index if symbols are not indexed for ↵Haojian Wu2019-02-251-0/+31
| | | | | | | | | | | | | | | | | | | completion. Summary: This is a further optimization of r350803, we drop docs in static index for symbols not being indexed for completion, while keeping the docs in dynamic index (we rely on dynamic index to get docs for class members). Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D56539 llvm-svn: 354792
* [clangd] Index main-file macros (bug 39761)Haojian Wu2019-01-281-13/+19
| | | | | | | | Patch by Nathan Ridge! Differential Revision: https://reviews.llvm.org/D55739 llvm-svn: 352367
* [clangd] Workaround a test failure after r351941Ilya Biryukov2019-01-231-2/+4
| | | | | | This should fix failing buildbots. llvm-svn: 351943
* [clangd] Fix crash due to ObjCPropertyDeclIlya Biryukov2019-01-231-0/+15
| | | | | | | | | | | | With ObjCPropertyDecl, ASTNode.OrigD can be a ObjCPropertyImplDecl which is not a NamedDecl, leading to a crash since the code incorrectly assumes ASTNode.OrigD will always be a NamedDecl. Change by dgoldman (David Goldman)! Differential Revision: https://reviews.llvm.org/D56916 llvm-svn: 351941
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [clangd] Index main-file symbols (bug 39761)Sam McCall2019-01-141-23/+79
| | | | | | | | Patch by Nathan Ridge! Differential Revision: https://reviews.llvm.org/D55185 llvm-svn: 351041
* [clangd] Don't store completion info if the symbol is not used for code ↵Haojian Wu2019-01-101-4/+9
| | | | | | | | | | | | | | | | | | | | | completion. Summary: This would save us some memory and disk space: - Dex usage (261 MB vs 266 MB) - Disk (75 MB vs 76 MB) It would save more when we index the main file symbol D55185. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: nridge, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D56314 llvm-svn: 350803
* [clangd] Remove 'using namespace llvm' from .cpp files. NFCIlya Biryukov2019-01-071-15/+14
| | | | | | | | The new guideline is to qualify with 'llvm::' explicitly both in '.h' and '.cpp' files. This simplifies moving the code between header and source files and is easier to keep consistent. llvm-svn: 350531
* [clangd] clang-format everything. NFCIlya Biryukov2019-01-031-25/+21
| | | | llvm-svn: 350303
* [clangd] Cleanup syntax errors in the test, NFC.Haojian Wu2018-12-211-1/+1
| | | | llvm-svn: 349893
* [clangd] Dont provide locations for non-existent files.Kadir Cetinkaya2018-12-051-0/+12
| | | | | | | | | | | | | | Summary: We were getting assertion errors when we had bad file names, instead we should skip those. Reviewers: hokein Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55275 llvm-svn: 348359
* [clangd] Cleanup: stop passing around list of supported URI schemes.Eric Liu2018-11-221-29/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Instead of passing around a list of supported URI schemes in clangd, we expose an interface to convert a path to URI using any compatible scheme that has been registered. It favors customized schemes and falls back to "file" when no other scheme works. Changes in this patch are: - URI::create(AbsPath, URISchemes) -> URI::create(AbsPath). The new API finds a compatible scheme from the registry. - Remove URISchemes option everywhere (ClangdServer, SymbolCollecter, FileIndex etc). - Unit tests will use "unittest" by default. - Move "test" scheme from ClangdLSPServer to ClangdMain.cpp, and only register the test scheme when lit-test or enable-lit-scheme is set. (The new flag is added to make lit protocol.test work; I wonder if there is alternative here.) Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54800 llvm-svn: 347467
* [clangd] Replace StringRef in SymbolLocation with a char pointer.Haojian Wu2018-11-141-2/+4
| | | | | | | | | | | | | | | | | Summary: This would save us 8 bytes per ref, and buy us ~40MB in total for llvm index (from ~300MB to ~260 MB). The char pointer must be null-terminated, and llvm::StringSaver guarantees it. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53427 llvm-svn: 346852
* [clangd] Make TestTU build with preamble, and fix the fallout.Sam McCall2018-11-091-19/+3
| | | | | | | | | | | | | | | | | | | | Our testing didn't reflect reality: live clangd almost always uses a preamble, and sometimes the preamble behaves differently. This patch fixes a common test helper to be more realistic. Preamble doesn't preserve information about which tokens come from the command-line (this gets inlined into a source file). So remove logic that attempts to treat symbols with such names differently. A SymbolCollectorTest tries to verify that locals in headers are not indexed, with preamble enabled this is only meaningful for locals of auto-typed functions (otherwise the bodies aren't parsed). Tests were relying on the fact that the findAnyDecl helper actually did expose symbols from headers. Resolve by making all these functions consistently able to find symbols in headers/preambles. llvm-svn: 346488
* [clangd] Drop namespace references in the index.Haojian Wu2018-11-071-0/+3
| | | | | | | | | | | | | | | | | | | Summary: Namespace references is less useful compared with other symbols, and they contribute large part of the index. This patch drops them. The number of refs is reduced from 5.4 million to 4.7 million. | | Before | After | |file size | 78 MB | 71MB | |memory | 330MB | 300MB| Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54202 llvm-svn: 346319
* [clangd] Namespace style cleanup in cpp files. NFC.Sam McCall2018-10-201-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Standardize on the most common namespace setup in our *.cpp files: using namespace llvm; namespace clang { namespace clangd { void foo(StringRef) { ... } And remove redundant llvm:: qualifiers. (Except for cases like make_unique where this causes problems with std:: and ADL). This choice is pretty arbitrary, but some broad consistency is nice. This is going to conflict with everything. Sorry :-/ Squash the other configurations: A) using namespace llvm; using namespace clang; using namespace clangd; void clangd::foo(StringRef); This is in some of the older files. (It prevents accidentally defining a new function instead of one in the header file, for what that's worth). B) namespace clang { namespace clangd { void foo(llvm::StringRef) { ... } This is fine, but in practice the using directive often gets added over time. C) namespace clang { namespace clangd { using namespace llvm; // inside the namespace This was pretty common, but is a bit misleading: name lookup preferrs clang::clangd::foo > clang::foo > llvm:: foo (no matter where the using directive is). llvm-svn: 344850
* [clangd] Names that are not spelled in source code are reserved.Eric Liu2018-10-181-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | Summary: These are often not expected to be used directly e.g. ``` TEST_F(Fixture, X) { ^ // "Fixture_X_Test" expanded in the macro should be down ranked. } ``` Only doing this for sema for now, as such symbols are mostly coming from sema e.g. gtest macros expanded in the main file. We could also add a similar field for the index symbol. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53374 llvm-svn: 344736
* [clangd] Encode Line/Column as a 32-bits integer.Haojian Wu2018-10-181-15/+15
| | | | | | | | | | | | | | | | | | | | | | Summary: This would buy us more memory. Using a 32-bits integer is enough for most human-readable source code (up to 4M lines and 4K columns). Previsouly, we used 8 bytes for a position, now 4 bytes, it would save us 8 bytes for each Ref and each Symbol instance. For LLVM-project binary index file, we save ~13% memory. | Before | After | | 412MB | 355MB | Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53363 llvm-svn: 344735
* [clangd] Collect refs from headers.Haojian Wu2018-10-171-0/+11
| | | | | | | | | | | | | | | | | Summary: Add a flag to SymbolCollector to collect refs fdrom headers. Note that we collect refs from headers in static index, and we don't do it for dynamic index because of the preamble (we skip function body in preamble, collecting it will result incomplete results). Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53322 llvm-svn: 344678
* Lift VFS from clang to llvm (NFC)Jonas Devlieghere2018-10-101-3/+3
| | | | | | | | | | | | | | | | | | | This patch moves the virtual file system form clang to llvm so it can be used by more projects. Concretely the patch: - Moves VirtualFileSystem.{h|cpp} from clang/Basic to llvm/Support. - Moves the corresponding unit test from clang to llvm. - Moves the vfs namespace from clang::vfs to llvm::vfs. - Formats the lines affected by this change, mostly this is the result of the added llvm namespace. RFC on the mailing list: http://lists.llvm.org/pipermail/llvm-dev/2018-October/126657.html Differential revision: https://reviews.llvm.org/D52783 llvm-svn: 344140
* [clangd] Merge binary + YAML serialization behind a (mostly) common interface.Sam McCall2018-09-251-1/+0
| | | | | | | | | | | | | | | | | Summary: Interface is in one file, implementation in two as they have little in common. A couple of ad-hoc YAML functions left exposed: - symbol -> YAML I expect to keep for tools like dexp - YAML -> symbol is used for the MR-style indexer, I think we can eliminate this (merge-on-the-fly, else use a different serialization) Reviewers: kbobyrev Subscribers: mgorny, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52453 llvm-svn: 342999
* [clangd] Add "Deprecated" field to Symbol and CodeCompletion.Eric Liu2018-09-061-1/+14
| | | | | | | | | | | | | | Summary: Also set "deprecated" field in LSP CompletionItem. Reviewers: sammccall, kadircet Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51724 llvm-svn: 341576
* [clangd] Define a compact binary serialization fomat for symbol slab/index.Sam McCall2018-09-041-79/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is intended to replace the current YAML format for general use. It's ~10x more compact than YAML, and ~40% more compact than gzipped YAML: llvmidx.riff = 20M, llvmidx.yaml = 272M, llvmidx.yaml.gz = 32M It's also simpler/faster to read and write. The format is a RIFF container (chunks of (type, size, data)) with: - a compressed string table - simple binary encoding of symbols (with varints for compactness) It can be extended to include occurrences, Dex posting lists, etc. There's no rich backwards-compatibility scheme, but a version number is included so we can detect incompatible files and do ad-hoc back-compat. Alternatives considered: - compressed YAML or JSON: bulky and slow to load - llvm bitstream: confusing model and libraries are hard to use. My attempt produced slightly larger files, and the code was longer and slower. - protobuf or similar: would be really nice (esp for back-compat) but the dependency is a big hassle - ad-hoc binary format without a container: it seems clear we're going to add posting lists and occurrences here, and that they will benefit from sharing a string table. The container makes it easy to debug these pieces in isolation, and make them optional. Reviewers: ioeric Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51585 llvm-svn: 341375
* [clangd] SymbolOccurrences -> Refs and cleanupSam McCall2018-09-041-38/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [clangd] Support multiple #include headers in one symbol.Eric Liu2018-09-031-4/+20
| | | | | | | | | | | | | | | | | | | | 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] Flatten out Symbol::Details. It was ill-conceived, sorry.Sam McCall2018-08-311-13/+6
| | | | | | | | | | 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-311-5/+73
| | | | | | | | | | 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
* [clangd] Fix (most) naming warnings from clang-tidy. NFCIlya Biryukov2018-07-261-3/+3
| | | | llvm-svn: 338021
* [clangd] Support indexing MACROs.Eric Liu2018-07-091-0/+26
| | | | | | | | | | | | | | 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
* [clangd] Track origins of symbols (various indexes, Sema).Sam McCall2018-07-051-0/+7
| | | | | | | | | | | | Summary: Surface it in the completion items C++ API, and when a flag is set. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48938 llvm-svn: 336309
* [clangd] More precise representation of symbol names/labels in the index.Sam McCall2018-06-221-31/+28
| | | | | | | | | | | | | | | | | | | | | | Summary: Previously, the strings matched LSP completion pretty closely. The completion label was a single string, for instance. This made implementing completion itself easy but makes it hard to use the names in other way, e.g. pretty-printed name in synthesized documentation/hover. It also limits our introspection into completion items, which can only be as precise as the indexed symbols. This change is a prerequisite to improvements to overload bundling which need to inspect e.g. signature structure. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48475 llvm-svn: 335360
* [clangd] Expose 'shouldCollectSymbol' helper from SymbolCollector.Eric Liu2018-06-211-36/+81
| | | | | | | | | | | | | | Summary: This allows tools to examine symbols that would be collected in a symbol index. For example, a tool that measures index-based completion quality would be interested in references to symbols that are collected in the index. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48418 llvm-svn: 335218
* [clangd] Customizable URI schemes for dynamic index.Eric Liu2018-06-151-6/+4
| | | | | | | | | | | | | | | | | Summary: This allows dynamic index to have consistent URI schemes with the static index which can have customized URI schemes, which would make file proximity scoring based on URIs easier. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D47931 llvm-svn: 334809
* [clangd] Add "member" symbols to the indexMarc-Andre Laperle2018-06-051-37/+128
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds more symbols to the index: - member variables and functions - enum constants in scoped enums The code completion behavior should remain intact but workspace symbols should now provide much more useful symbols. Other symbols should be considered such as the ones in "main files" (files not being included) but this can be done separately as this introduces its fair share of problems. Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewers: ioeric, sammccall Reviewed By: ioeric, sammccall Subscribers: hokein, sammccall, jkorous, klimek, ilya-biryukov, jkorous-apple, ioeric, MaskRay, cfe-commits Differential Revision: https://reviews.llvm.org/D44954 llvm-svn: 334017
* [clangd] Avoid indexing decls associated with friend decls.Eric Liu2018-06-041-0/+42
| | | | | | | | | | | | | | | | | | | | Summary: These decls are sometime used as the canonical declarations (e.g. for go-to-def), which seems to be bad. - friend decls that are not definitions should be ignored for indexing purposes - this means they should never be selected as canonical decl - if the friend decl is the only decl, then the symbol should not be indexed Reviewers: sammccall Reviewed By: sammccall Subscribers: mgorny, klimek, ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D47623 llvm-svn: 333885
* [clangd] Skip .inc headers when canonicalizing header #include.Eric Liu2018-05-241-3/+67
| | | | | | | | | | | | | | | | Summary: This assumes that .inc files are supposed to be included via headers that include them. Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D47187 llvm-svn: 333188
* [clangd] Correctly handle IWYU prama with verbatim #include header.Eric Liu2018-05-221-0/+15
| | | | llvm-svn: 332959
* [clangd] Retrieve minimally formatted comment text in completion.Ilya Biryukov2018-05-161-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previous implementation used to extract brief text from doxygen comments. Brief text parsing slows down completion and is not suited for non-doxygen comments. This commit switches to providing comments that mimic the ones originally written in the source code, doing minimal reindenting and removing the comments markers to make the output more user-friendly. It means we lose support for doxygen-specific features, e.g. extracting brief text, but provide useful results for non-doxygen comments. Switching the doxygen support back is an option, but I suggest to see whether the current approach gives more useful results. Reviewers: sammccall, hokein, ioeric Reviewed By: sammccall Subscribers: klimek, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D45999 llvm-svn: 332459
* [clangd] Filter out private proto symbols in SymbolCollector.Eric Liu2018-05-161-0/+35
| | | | | | | | | | | | | | | | | Summary: This uses heuristics to identify private proto symbols. For example, top-level symbols whose name contains "_" are considered private. These symbols are not expected to be used by users. Reviewers: ilya-biryukov, malaperle Reviewed By: ilya-biryukov Subscribers: sammccall, klimek, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D46751 llvm-svn: 332456
* [clangd] Also use UTF-16 in index position.Haojian Wu2018-04-301-0/+9
| | | | | | | | | | Reviewers: sammccall Subscribers: klimek, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D46258 llvm-svn: 331168
OpenPOWER on IntegriCloud