[clangd] Move non-clang base pieces into separate support/ lib. NFCI
Summary:
This enforces layering, reduces a sprawling clangd/ directory, and makes life
easier for embedders.
Reviewers: kbobyrev
Subscribers: mgorny, ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, jfb, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79014
2020-04-28 23:49:17 +08:00
|
|
|
add_subdirectory(support)
|
|
|
|
|
2019-01-16 08:24:22 +08:00
|
|
|
# Configure the Features.inc file.
|
[clangd] Move clangd tests to clangd directory. check-clangd is no longer 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
2019-04-29 16:44:01 +08:00
|
|
|
if (NOT DEFINED CLANGD_BUILD_XPC)
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
set(CLANGD_BUILD_XPC_DEFAULT ON)
|
|
|
|
else ()
|
|
|
|
set(CLANGD_BUILD_XPC_DEFAULT OFF)
|
|
|
|
endif ()
|
|
|
|
|
2019-05-03 04:32:56 +08:00
|
|
|
llvm_canonicalize_cmake_booleans(CLANGD_BUILD_XPC_DEFAULT)
|
|
|
|
|
[clangd] Move clangd tests to clangd directory. check-clangd is no longer 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
2019-04-29 16:44:01 +08:00
|
|
|
set(CLANGD_BUILD_XPC ${CLANGD_BUILD_XPC_DEFAULT} CACHE BOOL "Build XPC Support For Clangd." FORCE)
|
|
|
|
unset(CLANGD_BUILD_XPC_DEFAULT)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
llvm_canonicalize_cmake_booleans(CLANGD_BUILD_XPC)
|
2020-07-27 20:41:29 +08:00
|
|
|
llvm_canonicalize_cmake_booleans(CLANGD_ENABLE_REMOTE)
|
[clangd] Move clangd tests to clangd directory. check-clangd is no longer 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
2019-04-29 16:44:01 +08:00
|
|
|
|
2019-01-16 08:24:22 +08:00
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Features.inc.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Features.inc
|
|
|
|
)
|
|
|
|
|
2017-05-23 18:17:48 +08:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
Support
|
2019-06-26 15:39:14 +08:00
|
|
|
AllTargetsInfos
|
2020-04-08 00:26:40 +08:00
|
|
|
FrontendOpenMP
|
2020-07-14 23:03:45 +08:00
|
|
|
Option
|
2017-05-23 18:17:48 +08:00
|
|
|
)
|
|
|
|
|
2020-07-19 23:19:48 +08:00
|
|
|
if(MSVC AND NOT CLANG_CL)
|
|
|
|
set_source_files_properties(CompileCommands.cpp PROPERTIES COMPILE_FLAGS -wd4130) # disables C4130: logical operation on address of string constant
|
|
|
|
endif()
|
|
|
|
|
2017-05-23 16:12:45 +08:00
|
|
|
add_clang_library(clangDaemon
|
2018-03-09 22:00:34 +08:00
|
|
|
AST.cpp
|
2017-05-16 17:38:59 +08:00
|
|
|
ClangdLSPServer.cpp
|
|
|
|
ClangdServer.cpp
|
2017-12-04 21:49:59 +08:00
|
|
|
CodeComplete.cpp
|
2017-12-21 01:24:31 +08:00
|
|
|
CodeCompletionStrings.cpp
|
2020-03-01 23:05:12 +08:00
|
|
|
CollectMacros.cpp
|
[clangd] (take 2) Try harder to find a plausible `clang` as argv0, particularly on Mac.
Summary:
This was originally committed in 88bccded8fa169481fa367debf5ec615640635a1,
and reverted in 93f77617abba512d2861e2fc50ce385883f587b6.
This version is now much more testable: the "detect toolchain properties" part
is still not tested but also not active in tests.
All the command manipulation based on the detected properties is
directly tested, and also not active in other tests.
Fixes https://github.com/clangd/clangd/issues/211
Fixes https://github.com/clangd/clangd/issues/178
Reviewers: kbobyrev, ilya-biryukov
Subscribers: mgorny, ormris, cfe-commits, usaxena95, kadircet, arphaman, jkorous, MaskRay
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71029
2019-11-30 02:37:48 +08:00
|
|
|
CompileCommands.cpp
|
2017-12-04 21:49:59 +08:00
|
|
|
Compiler.cpp
|
2020-06-30 03:46:40 +08:00
|
|
|
Config.cpp
|
2020-06-26 07:49:53 +08:00
|
|
|
ConfigCompile.cpp
|
2020-07-01 22:30:57 +08:00
|
|
|
ConfigProvider.cpp
|
2020-06-23 23:21:56 +08:00
|
|
|
ConfigYAML.cpp
|
2018-03-12 23:28:22 +08:00
|
|
|
Diagnostics.cpp
|
2017-05-16 17:38:59 +08:00
|
|
|
DraftStore.cpp
|
2018-11-26 23:25:20 +08:00
|
|
|
ExpectedTypes.cpp
|
[clangd] Implementation of workspace/symbol request
Summary:
This is a basic implementation of the "workspace/symbol" request which is
used to find symbols by a string query. Since this is similar to code completion
in terms of result, this implementation reuses the "fuzzyFind" in order to get
matches. For now, the scoring algorithm is the same as code completion and
improvements could be done in the future.
The index model doesn't contain quite enough symbols for this to cover
common symbols like methods, enum class enumerators, functions in unamed
namespaces, etc. The index model will be augmented separately to achieve this.
Reviewers: sammccall, ilya-biryukov
Reviewed By: sammccall
Subscribers: jkorous, hokein, simark, sammccall, klimek, mgorny, ilya-biryukov, mgrang, jkorous-apple, ioeric, MaskRay, cfe-commits
Differential Revision: https://reviews.llvm.org/D44882
llvm-svn: 330637
2018-04-24 04:00:52 +08:00
|
|
|
FindSymbols.cpp
|
[clangd] Add targetDecl(), which determines what declaration an AST node refers to.
Summary:
This is the first part of an effort to "unbundle" our libIndex use into separate
concerns (AST traversal, token<->node mapping, node<->decl mapping,
decl<->decl relationshipes).
Currently, clangd relies on libIndex to associate tokens, AST nodes, and decls.
This leads to rather convoluted implementations of e.g. hover and
extract-function, which are not naturally thought of as indexing applications.
The idea is that by decoupling different concerns, we make them easier
to use, test, and combine, and more efficient when only one part is needed.
There are some synergies between e.g. traversal and finding
relationships between decls, hopefully the benefits outweight these.
Reviewers: kadircet, ilya-biryukov
Subscribers: mgorny, MaskRay, jkorous, arphaman, jfb, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66751
llvm-svn: 370746
2019-09-03 19:35:50 +08:00
|
|
|
FindTarget.cpp
|
2018-07-03 16:09:29 +08:00
|
|
|
FileDistance.cpp
|
[clangd] Revamp textDocument/onTypeFormatting.
Summary:
The existing implementation (which triggers on }) is fairly simple and
has flaws:
- doesn't trigger frequently/regularly enough (particularly in editors that type the }
for you)
- often reformats too much code around the edit
- has jarring cases that I don't have clear ideas for fixing
This implementation is designed to trigger on newline, which feels to me more
intuitive than } or ;.
It does have allow for reformatting after other characters - it has a
basic behavior and a model for adding specialized behavior for
particular characters. But at least initially I'd stick to advertising
\n in the capabilities.
This also handles comment splitting: when you insert a line break inside
a line comment, it will make the new line into an aligned line comment.
Working on tests, but want people to patch it in and try it - it's hard to
see if "feel" is right purely by looking at a test.
Reviewers: ilya-biryukov, hokein
Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60605
llvm-svn: 362939
2019-06-10 22:26:21 +08:00
|
|
|
Format.cpp
|
2018-10-02 18:43:55 +08:00
|
|
|
FS.cpp
|
2017-12-02 01:08:02 +08:00
|
|
|
FuzzyMatch.cpp
|
2017-05-16 17:38:59 +08:00
|
|
|
GlobalCompilationDatabase.cpp
|
2018-02-16 22:15:55 +08:00
|
|
|
Headers.cpp
|
2019-09-25 18:30:22 +08:00
|
|
|
HeaderSourceSwitch.cpp
|
[clangd] Untangle Hover from XRefs, move into own file.
Summary:
This is mostly mechanical, with a few exceptions:
- getDeducedType moved into AST.h where it belongs. It now takes
ASTContext instead of ParsedAST, and avoids using the preprocessor.
- hover now uses SelectionTree directly rather than via
getDeclAtPosition helper
- hover on 'auto' used to find the decl that contained the 'auto' and
use that to set Kind and documentation for the hover result.
Now we use targetDecl() to find the decl matching the deduced type instead.
This changes tests, e.g. 'variable' -> class for auto on lambdas.
I think this is better, but the motivation was to avoid depending on
the internals of DeducedTypeVisitor. This functionality is removed
from the visitor.
Reviewers: kadircet
Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70357
2019-11-17 00:00:19 +08:00
|
|
|
Hover.cpp
|
2019-01-28 22:01:55 +08:00
|
|
|
IncludeFixer.cpp
|
[clangd] Refactor JSON-over-stdin/stdout code into Transport abstraction. (re-land r344620)
Summary:
This paves the way for alternative transports (mac XPC, maybe messagepack?),
and also generally improves layering: testing ClangdLSPServer becomes less of
a pipe dream, we split up the JSONOutput monolith, etc.
This isn't a final state, much of what remains in JSONRPCDispatcher can go away,
handlers can call reply() on the transport directly, JSONOutput can be renamed
to StreamLogger and removed, etc. But this patch is sprawling already.
The main observable change (see tests) is that hitting EOF on input is now an
error: the client should send the 'exit' notification.
This is defensible: the protocol doesn't spell this case out. Reproducing the
current behavior for all combinations of shutdown/exit/EOF clutters interfaces.
We can iterate on this if desired.
Reviewers: jkorous, ioeric, hokein
Subscribers: mgorny, ilya-biryukov, MaskRay, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D53286
llvm-svn: 344672
2018-10-17 15:32:05 +08:00
|
|
|
JSONTransport.cpp
|
2020-01-07 18:28:05 +08:00
|
|
|
PathMapping.cpp
|
2017-02-07 18:28:20 +08:00
|
|
|
Protocol.cpp
|
[clangd] Extract scoring/ranking logic, and shave yaks.
Summary:
Code completion scoring was embedded in CodeComplete.cpp, which is bad:
- awkward to test. The mechanisms (extracting info from index/sema) can be
unit-tested well, the policy (scoring) should be quantitatively measured.
Neither was easily possible, and debugging was hard.
The intermediate signal struct makes this easier.
- hard to reuse. This is a bug in workspaceSymbols: it just presents the
results in the index order, which is not sorted in practice, it needs to rank
them!
Also, index implementations care about scoring (both query-dependent and
independent) in order to truncate result lists appropriately.
The main yak shaved here is the build() function that had 3 variants across
unit tests is unified in TestTU.h (rather than adding a 4th variant).
Reviewers: ilya-biryukov
Subscribers: klimek, mgorny, ioeric, MaskRay, jkorous, mgrang, cfe-commits
Differential Revision: https://reviews.llvm.org/D46524
llvm-svn: 332378
2018-05-16 01:43:27 +08:00
|
|
|
Quality.cpp
|
2019-09-04 17:46:06 +08:00
|
|
|
ParsedAST.cpp
|
2019-09-04 15:35:00 +08:00
|
|
|
Preamble.cpp
|
[clangd] Define a compact binary serialization fomat for symbol slab/index.
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
2018-09-05 00:16:50 +08:00
|
|
|
RIFF.cpp
|
[clangd] Lib to compute and represent selection under cursor.
Summary:
The primary problem this solves is to expose the codeAction selection to
AST-based refactorings in a way that makes it easy and efficient for them to
bind to the right parts of the AST.
It should also allow us to make XRefs based features (textDocument/definition)
more robust, more easily implement textDocument/typeDefinition etc.
As an example, template parameter references can be identified without special
handling.
There should be slight speedup too: we can prune most of the AST traversal
in most cases.
Elephant in the room: this is similar-but-different to Tooling/Refactoring/ASTSelection.
That captures a smaller set of AST nodes, has a slightly different way of
representing selections, and generally has mare features and does more work.
The overall shape is pretty similar, and yet I can't quite get to behave as I
expect.
Reviewers: ilya-biryukov, kadircet
Subscribers: mgorny, ioeric, MaskRay, jkorous, mgrang, arphaman
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57562
llvm-svn: 352874
2019-02-01 23:05:11 +08:00
|
|
|
Selection.cpp
|
2019-06-26 21:08:36 +08:00
|
|
|
SemanticHighlighting.cpp
|
2019-09-16 19:29:35 +08:00
|
|
|
SemanticSelection.cpp
|
2017-12-19 20:23:48 +08:00
|
|
|
SourceCode.cpp
|
2019-06-26 15:45:27 +08:00
|
|
|
QueryDriverDatabase.cpp
|
2018-01-31 16:51:16 +08:00
|
|
|
TUScheduler.cpp
|
2018-01-22 19:48:20 +08:00
|
|
|
URI.cpp
|
2017-12-20 01:06:07 +08:00
|
|
|
XRefs.cpp
|
[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 18:34:57 +08:00
|
|
|
|
[clangd] Minimal implementation of automatic static index (not enabled).
Summary:
See tinyurl.com/clangd-automatic-index for design and goals.
Lots of limitations to keep this patch smallish, TODOs everywhere:
- no serialization to disk
- no changes to dynamic index, which now has a much simpler job
- no partitioning of symbols by file to avoid duplication of header symbols
- no reindexing of edited files
- only a single worker thread
- compilation database is slurped synchronously (doesn't scale)
- uses memindex, rebuilds after every file (should be dex, periodically)
It's not hooked up to ClangdServer/ClangdLSPServer yet: the layering
isn't clear (it should really be in ClangdServer, but ClangdLSPServer
has all the CDB interactions).
Reviewers: ioeric
Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D53032
llvm-svn: 344513
2018-10-15 21:34:10 +08:00
|
|
|
index/Background.cpp
|
2019-07-19 18:18:52 +08:00
|
|
|
index/BackgroundIndexLoader.cpp
|
2018-11-16 17:03:56 +08:00
|
|
|
index/BackgroundIndexStorage.cpp
|
2019-07-11 21:34:38 +08:00
|
|
|
index/BackgroundQueue.cpp
|
|
|
|
index/BackgroundRebuild.cpp
|
2018-02-16 22:15:55 +08:00
|
|
|
index/CanonicalIncludes.cpp
|
2017-12-15 20:25:02 +08:00
|
|
|
index/FileIndex.cpp
|
[clangd] Introduce a "Symbol" class.
Summary:
* The "Symbol" class represents a C++ symbol in the codebase, containing all the
information of a C++ symbol needed by clangd. clangd will use it in clangd's
AST/dynamic index and global/static index (code completion and code
navigation).
* The SymbolCollector (another IndexAction) will be used to recollect the
symbols when the source file is changed (for ASTIndex), or to generate
all C++ symbols for the whole project.
In the long term (when index-while-building is ready), clangd should share a
same "Symbol" structure and IndexAction with index-while-building, but
for now we want to have some stuff working in clangd.
Reviewers: ioeric, sammccall, ilya-biryukov, malaperle
Reviewed By: sammccall
Subscribers: malaperle, klimek, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D40897
llvm-svn: 320486
2017-12-12 23:42:10 +08:00
|
|
|
index/Index.cpp
|
2018-09-26 04:02:36 +08:00
|
|
|
index/IndexAction.cpp
|
2017-12-14 22:50:58 +08:00
|
|
|
index/MemIndex.cpp
|
2018-01-15 20:33:00 +08:00
|
|
|
index/Merge.cpp
|
2019-02-28 21:49:25 +08:00
|
|
|
index/Ref.cpp
|
2019-06-03 12:55:46 +08:00
|
|
|
index/Relation.cpp
|
[clangd] Define a compact binary serialization fomat for symbol slab/index.
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
2018-09-05 00:16:50 +08:00
|
|
|
index/Serialization.cpp
|
2019-02-28 21:23:03 +08:00
|
|
|
index/Symbol.cpp
|
[clangd] Introduce a "Symbol" class.
Summary:
* The "Symbol" class represents a C++ symbol in the codebase, containing all the
information of a C++ symbol needed by clangd. clangd will use it in clangd's
AST/dynamic index and global/static index (code completion and code
navigation).
* The SymbolCollector (another IndexAction) will be used to recollect the
symbols when the source file is changed (for ASTIndex), or to generate
all C++ symbols for the whole project.
In the long term (when index-while-building is ready), clangd should share a
same "Symbol" structure and IndexAction with index-while-building, but
for now we want to have some stuff working in clangd.
Reviewers: ioeric, sammccall, ilya-biryukov, malaperle
Reviewed By: sammccall
Subscribers: malaperle, klimek, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D40897
llvm-svn: 320486
2017-12-12 23:42:10 +08:00
|
|
|
index/SymbolCollector.cpp
|
2019-02-28 20:31:49 +08:00
|
|
|
index/SymbolID.cpp
|
|
|
|
index/SymbolLocation.cpp
|
|
|
|
index/SymbolOrigin.cpp
|
[clangd] Merge binary + YAML serialization behind a (mostly) common interface.
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
2018-09-26 02:06:43 +08:00
|
|
|
index/YAMLSerialization.cpp
|
2017-02-07 18:28:20 +08:00
|
|
|
|
2018-09-10 16:23:53 +08:00
|
|
|
index/dex/Dex.cpp
|
2018-07-27 17:54:27 +08:00
|
|
|
index/dex/Iterator.cpp
|
2018-09-14 01:11:03 +08:00
|
|
|
index/dex/PostingList.cpp
|
[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 18:34:57 +08:00
|
|
|
index/dex/Trigram.cpp
|
|
|
|
|
2019-05-07 15:11:56 +08:00
|
|
|
refactor/Rename.cpp
|
[clangd] Interfaces for writing code tweaks
Summary:
The code tweaks are an implementation of mini-refactorings exposed
via the LSP code actions. They run in two stages:
- Stage 1. Decides whether the action is available to the user and
collects all the information required to finish the action.
Should be cheap, since this will run over all the actions known to
clangd on each textDocument/codeAction request from the client.
- Stage 2. Uses information from stage 1 to produce the actual edits
that the code action should perform. This stage can be expensive and
will only run if the user chooses to perform the specified action in
the UI.
One unfortunate consequence of this change is increased latency of
processing the textDocument/codeAction requests, which now wait for an
AST. However, we cannot avoid this with what we have available in the LSP
today.
Reviewers: kadircet, ioeric, hokein, sammccall
Reviewed By: sammccall
Subscribers: mgrang, mgorny, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D56267
llvm-svn: 352494
2019-01-29 22:17:36 +08:00
|
|
|
refactor/Tweak.cpp
|
|
|
|
|
2017-05-23 18:17:48 +08:00
|
|
|
LINK_LIBS
|
2020-06-17 02:43:55 +08:00
|
|
|
clangdSupport
|
|
|
|
clangTidy
|
|
|
|
${LLVM_PTHREAD_LIB}
|
|
|
|
${ALL_CLANG_TIDY_CHECKS}
|
2020-06-23 23:48:04 +08:00
|
|
|
|
|
|
|
DEPENDS
|
|
|
|
omp_gen
|
2020-06-17 02:43:55 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
clang_target_link_libraries(clangDaemon
|
|
|
|
PRIVATE
|
2017-05-23 21:59:37 +08:00
|
|
|
clangAST
|
2018-01-10 23:11:26 +08:00
|
|
|
clangASTMatchers
|
2017-02-07 18:28:20 +08:00
|
|
|
clangBasic
|
2018-05-24 23:54:32 +08:00
|
|
|
clangDriver
|
2017-02-07 18:28:20 +08:00
|
|
|
clangFormat
|
2017-02-15 23:04:20 +08:00
|
|
|
clangFrontend
|
2017-06-29 00:12:10 +08:00
|
|
|
clangIndex
|
2017-06-29 06:57:15 +08:00
|
|
|
clangLex
|
2017-04-05 03:42:29 +08:00
|
|
|
clangSema
|
2017-07-22 07:48:26 +08:00
|
|
|
clangSerialization
|
2017-02-15 23:04:20 +08:00
|
|
|
clangTooling
|
2017-03-02 00:23:40 +08:00
|
|
|
clangToolingCore
|
2018-06-04 17:04:28 +08:00
|
|
|
clangToolingInclusions
|
2019-05-25 08:27:19 +08:00
|
|
|
clangToolingRefactoring
|
2019-06-19 22:03:19 +08:00
|
|
|
clangToolingSyntax
|
2017-02-07 18:28:20 +08:00
|
|
|
)
|
2017-05-23 16:12:45 +08:00
|
|
|
|
[clangd] Interfaces for writing code tweaks
Summary:
The code tweaks are an implementation of mini-refactorings exposed
via the LSP code actions. They run in two stages:
- Stage 1. Decides whether the action is available to the user and
collects all the information required to finish the action.
Should be cheap, since this will run over all the actions known to
clangd on each textDocument/codeAction request from the client.
- Stage 2. Uses information from stage 1 to produce the actual edits
that the code action should perform. This stage can be expensive and
will only run if the user chooses to perform the specified action in
the UI.
One unfortunate consequence of this change is increased latency of
processing the textDocument/codeAction requests, which now wait for an
AST. However, we cannot avoid this with what we have available in the LSP
today.
Reviewers: kadircet, ioeric, hokein, sammccall
Reviewed By: sammccall
Subscribers: mgrang, mgorny, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D56267
llvm-svn: 352494
2019-01-29 22:17:36 +08:00
|
|
|
add_subdirectory(refactor/tweaks)
|
2019-04-04 21:54:01 +08:00
|
|
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
2019-04-04 08:05:53 +08:00
|
|
|
# FIXME: Make fuzzer not use linux-specific APIs, build it everywhere.
|
2017-10-26 18:03:11 +08:00
|
|
|
add_subdirectory(fuzzer)
|
|
|
|
endif()
|
2017-05-23 16:12:45 +08:00
|
|
|
add_subdirectory(tool)
|
[clangd] Rename global-symbol-builder to clangd-indexer.
Summary:
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-'.
The new name is also shorter and easier to type.
Reviewers: ioeric, sammccall, kadircet
Reviewed By: ioeric, sammccall
Subscribers: kbobyrev, ilya-biryukov, mgorny, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D51987
llvm-svn: 342123
2018-09-13 17:44:11 +08:00
|
|
|
add_subdirectory(indexer)
|
2018-09-12 15:49:44 +08:00
|
|
|
|
|
|
|
if (LLVM_INCLUDE_BENCHMARKS)
|
|
|
|
add_subdirectory(benchmarks)
|
|
|
|
endif()
|
2019-01-16 08:24:22 +08:00
|
|
|
if ( CLANGD_BUILD_XPC )
|
|
|
|
add_subdirectory(xpc)
|
|
|
|
endif ()
|
[clangd] Move clangd tests to clangd directory. check-clangd is no longer 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
2019-04-29 16:44:01 +08:00
|
|
|
|
|
|
|
if(CLANG_INCLUDE_TESTS)
|
|
|
|
add_subdirectory(test)
|
|
|
|
add_subdirectory(unittests)
|
|
|
|
endif()
|
2020-04-16 17:10:03 +08:00
|
|
|
|
|
|
|
# FIXME(kirillbobyrev): Document this in the LLVM docs once remote index is stable.
|
|
|
|
option(CLANGD_ENABLE_REMOTE "Use gRPC library to enable remote index support for Clangd" OFF)
|
|
|
|
set(GRPC_INSTALL_PATH "" CACHE PATH "Path to gRPC library manual installation.")
|
|
|
|
|
|
|
|
if (CLANGD_ENABLE_REMOTE)
|
|
|
|
include(FindGRPC)
|
|
|
|
endif()
|
2020-04-24 19:46:45 +08:00
|
|
|
add_subdirectory(index/remote)
|
|
|
|
add_subdirectory(index/dex/dexp)
|