2017-05-23 18:17:48 +08:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
Support
|
|
|
|
)
|
|
|
|
|
2018-04-03 17:40:07 +08:00
|
|
|
set(CLANGD_ATOMIC_LIB "")
|
|
|
|
if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
|
|
|
|
list(APPEND CLANGD_ATOMIC_LIB "atomic")
|
|
|
|
endif()
|
|
|
|
|
2017-05-23 16:12:45 +08:00
|
|
|
add_clang_library(clangDaemon
|
2018-03-09 22:00:34 +08:00
|
|
|
AST.cpp
|
2018-08-24 21:09:41 +08:00
|
|
|
Cancellation.cpp
|
2017-05-16 17:38:59 +08:00
|
|
|
ClangdLSPServer.cpp
|
|
|
|
ClangdServer.cpp
|
|
|
|
ClangdUnit.cpp
|
2017-12-04 21:49:59 +08:00
|
|
|
CodeComplete.cpp
|
2017-12-21 01:24:31 +08:00
|
|
|
CodeCompletionStrings.cpp
|
2017-12-04 21:49:59 +08:00
|
|
|
Compiler.cpp
|
2018-01-25 22:19:21 +08:00
|
|
|
Context.cpp
|
2018-03-12 23:28:22 +08:00
|
|
|
Diagnostics.cpp
|
2017-05-16 17:38:59 +08:00
|
|
|
DraftStore.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
|
2018-07-03 16:09:29 +08:00
|
|
|
FileDistance.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
|
[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
|
2017-09-20 15:24:15 +08:00
|
|
|
Logger.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
|
[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
|
2017-12-19 20:23:48 +08:00
|
|
|
SourceCode.cpp
|
2018-01-31 16:51:16 +08:00
|
|
|
Threading.cpp
|
2017-11-02 17:21:51 +08:00
|
|
|
Trace.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
|
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
|
[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
|
[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
|
[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
|
|
|
|
|
2017-05-23 18:17:48 +08:00
|
|
|
LINK_LIBS
|
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
|
2017-11-09 19:30:04 +08:00
|
|
|
clangToolingRefactor
|
2017-05-23 18:29:54 +08:00
|
|
|
${LLVM_PTHREAD_LIB}
|
2018-04-03 17:40:07 +08:00
|
|
|
${CLANGD_ATOMIC_LIB}
|
2017-02-07 18:28:20 +08:00
|
|
|
)
|
2017-05-23 16:12:45 +08:00
|
|
|
|
2017-10-26 18:03:11 +08:00
|
|
|
if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
|
|
|
|
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:32:54 +08:00
|
|
|
add_subdirectory(index/dex/dexp)
|
2018-09-12 15:49:44 +08:00
|
|
|
|
|
|
|
if (LLVM_INCLUDE_BENCHMARKS)
|
|
|
|
add_subdirectory(benchmarks)
|
|
|
|
endif()
|