Commit Graph

11 Commits

Author SHA1 Message Date
Sam McCall ecf93a716c [clangd] Only allow remote index to be enabled from user config.
Differential Revision: https://reviews.llvm.org/D100542
2021-04-15 14:51:23 +02:00
Kadir Cetinkaya 6329ce75da
[clangd] Expose absoluteParent helper
Will be used in other components that need ancestor traversal.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D96123
2021-02-19 13:40:21 +01:00
Nathan James 4a0528e4a0
[clangd][NFC] Small tweak to combined provider
This should address the FIXME about clang3.9 dervied to base unique_ptr constructor not working.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D91925
2020-12-08 17:12:56 +00:00
Sam McCall 2542ef83ed [clangd] Fix windows slashes in project config diagnostics 2020-12-07 12:54:38 +01:00
Sam McCall d99da80841 [clangd] Fix path edge-case condition. 2020-11-29 13:40:29 +01:00
Sam McCall d95db1693c [clangd] Extract common file-caching logic from ConfigProvider.
The plan is to use this to use this for .clang-format, .clang-tidy, and
compile_commands.json. (Currently the former two are reparsed every
time, and the latter is cached forever and changes are never seen).

Differential Revision: https://reviews.llvm.org/D88172
2020-11-25 12:09:13 +01:00
Kadir Cetinkaya 7f059a258a
[clangd] Handle absolute/relative path specifications in Config
This introduces a mechanism for providers to interpret paths specified
in a fragment either as absolute or relative to fragment location.
This information should be used during compile stage to handle blocks correctly.

Differential Revision: https://reviews.llvm.org/D90270
2020-11-03 21:45:35 +01:00
Michael Spencer 7fcc1bb4b6 [clangd] Fix the build with clang <3.9.
In clang <3.9 the `unique_ptr` constructor that is supposed to allow
for Derived to Base conversion does not work. Remove this if we drop
support for such configurations.

This is the same fix as in fda901a987, and it updates the comments
to better reflect the actual issue. The same thing reproduces with
libc++ with older clangs.
2020-07-17 16:12:31 -06:00
Sam McCall f88ce078f7 [clangd] Make config::Provider::combine non-owning. NFC
This is a prerequisite for having ClangdLSPServer inject its own.
2020-07-14 20:45:02 +02:00
Sam McCall ff616f74c3 [clangd] Cache config files for 5 seconds, without revalidating with stat.
Summary:
This is motivated by:
 - code completion: nice to do no i/o on the request path
 - background index: deciding whether to enqueue each file would stat the config
   file thousands of times in quick succession.

Currently it's applied uniformly to all requests though.

This gives up on performing stat() outside the lock, all this achieves is
letting multiple threads stat concurrently (and thus finish without contention
for nonexistent files).
The ability to finish without IO (just mutex lock + integer check) should
outweigh this, and is less sensitive to platform IO characteristics.

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D83755
2020-07-14 17:00:41 +02:00
Sam McCall 8bd000a65f [clangd] Config: loading and caching config from disk.
Summary:
The Provider extension point is designed to also be implemented by
ClangdLSPServer (to inject config-over-lsp) and likely by embedders.

Reviewers: kadircet

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, jfb, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82964
2020-07-04 10:48:31 +02:00