summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clangd] Use expansion location when the ref is inside macros.Haojian Wu2019-12-091-0/+23
| | | | | | | | | | | | | | | | | | | | | Summary: Previously, xrefs has inconsistent behavior when the reference is inside macro body: - AST-based xrefs (for main file) uses the expansion location; - our index uses the spelling location; This patch makes our index use file locations for references, which is consistent with AST-based xrefs, and kythe as well. After this patch, memory usage of static index on LLVM increases ~5%. Reviewers: ilya-biryukov Subscribers: merge_guards_bot, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70480
* [clangd] Add xref for macro to static index.Utkarsh Saxena2019-12-051-18/+97
| | | | | | | | | | | | | | Summary: This adds the references for macros to the SymbolCollector (used for static index). Enabled if `CollectMacro` option is set. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70489
* [clangd] Replace getLangOpts().isHeaderFile usage with isHeaderFile helper.Haojian Wu2019-11-151-0/+11
| | | | | | | | | | | | | | | | Summary: The helper is more correct to detect header file, this would fix our issues caused by false positive before. Reviewers: sammccall Reviewed By: sammccall Subscribers: merge_guards_bot, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70299
* [clangd] Collect name references in the index.Haojian Wu2019-10-241-0/+17
| | | | | | | | | | | | | | Summary: This is used for cross-file rename. When renaming a class, we expect to rename all related constructors/destructors. Reviewers: kadircet, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69338
* [clangd] Use our own relation kind.Haojian Wu2019-10-171-2/+1
| | | | | | | | | | | | | | | | Summary: Move the RelationKind from Serialization.h to Relation.h. This patch doesn't introduce any breaking changes. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68981 llvm-svn: 375117
* [clangd] Use pre-populated mappings for standard symbolsIlya Biryukov2019-09-091-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: This takes ~5% of time when running clangd unit tests. To achieve this, move mapping of system includes out of CanonicalIncludes and into a separate class Reviewers: sammccall, hokein Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67172 llvm-svn: 371408
* [clang][Index][NFC] Put IndexingOptions to a separate headerJan Korous2019-09-061-0/+1
| | | | llvm-svn: 371250
* Changed FrontendActionFactory::create to return a std::unique_ptrDmitri Gribenko2019-08-291-2/+3
| | | | | | | | | | Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66947 llvm-svn: 370379
* [Index] Stopped wrapping FrontendActions in libIndex and its usersDmitri Gribenko2019-08-291-11/+10
| | | | | | | | | Exposed a new function, createIndexingASTConsumer, that creates an ASTConsumer. ASTConsumers compose well. Removed wrapping functionality from createIndexingAction. llvm-svn: 370337
* [clang-tools-extra] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-1/+1
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368944
* [clangd] cleanup: unify the implemenation of checking a location is inside ↵Haojian Wu2019-07-191-2/+1
| | | | | | | | | | | | | | | | main file. Summary: We have variant implementations in the codebase, this patch unifies them. Reviewers: ilya-biryukov, kadircet Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64915 llvm-svn: 366541
* [clangd] Collect the refs when the main file is header.Haojian Wu2019-07-021-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, we only collect refs of the symbols which are declared in the preamble and referenced in the main file, it works well when the main file is .cpp file. However, when the main file is .h file (when opening a .h file in the editor), we don't collect refs of the symbol declared in this file, so we miss these refs in our dynamic index. A typical scenario: 1. Open Foo.h (which contains class Foo) 2. Open Foo.cpp, call find references for Foo And we only get refs from Foo.cpp. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63818 llvm-svn: 364893
* [clangd] Add include-mapping for C symbols.Haojian Wu2019-06-211-1/+3
| | | | | | | | | | | | | | | | | | | Summary: This resolves the issue of introducing c++-style includes for C files. - refactor the gen_std.py, make it reusable for parsing C symbols. - add a language mode to the mapping method to use different mapping for C and C++ files. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63270 llvm-svn: 364044
* [clangd] SymbolCollector support for relationsNathan Ridge2019-06-041-8/+23
| | | | | | | | | | | | | | | | | | | Summary: The only relation currently collected is RelationBaseOf, because this is all we need for type hierarchy subtypes. Additional relations can be collected in the future as the need arises. This patch builds on D59407 and D62459. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62471 llvm-svn: 362467
* [clangd] Add SourceManager accessor to ParsedAST. NFCSam McCall2019-05-281-3/+2
| | | | llvm-svn: 361883
* [clangd] Qualify uses of ::testing everywhere. NFCIlya Biryukov2019-05-061-29/+25
| | | | | | | | | Add an initial '::' qualifier to all usages of 'testing' namespace that did not have one. The goal is to make our code style in tests more consistent. llvm-svn: 360026
* [clangd] Fix header-guard check for include insertion, and don't index ↵Sam McCall2019-05-031-1/+22
| | | | | | | | | | | | | | | | | | | | | header guards. Summary: Both of these attempt to check whether a header guard exists while parsing the file. However the file is only marked as guarded once clang finishes processing it. We defer the checks and work until SymbolCollector::finish(). This is ugly and ad-hoc, deferring *all* work might be cleaner. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61442 llvm-svn: 359880
* [clangd] Add separate unit tests for CanonicalIncludes. NFCSam McCall2019-04-291-35/+3
| | | | llvm-svn: 359455
* [clangd] Move clangd tests to clangd directory. check-clangd is no longer ↵Sam McCall2019-04-291-0/+1272
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
OpenPOWER on IntegriCloud