Commit Graph

10 Commits

Author SHA1 Message Date
Sam McCall a3684dfc45 Revert "[clangd] Config: config struct propagated through Context"
This reverts commit 9963d93b07.

Fails on mac/win:
http://45.33.8.238/win/18704/step_9.txt
http://45.33.8.238/mac/16341/step_9.txt
2020-06-29 21:41:57 +02:00
Sam McCall 9963d93b07 [clangd] Config: config struct propagated through Context
Summary:
This introduces the "semantic form" of config exposed to features,
contrasted with the "syntactic form" exposed to users in e9fb1506b8.

The two are not connected, CompiledFragment and Provider will bridge that gap.
Nor is configuration actually set: that needs changes to ClangdServer,
TUScheduler, and BackgroundQueue.

Reviewers: hokein, kadircet

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

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82606
2020-06-29 20:18:48 +02:00
Sam McCall a3b7934012 [clangd] Don't mangle workdir-relevant driver path in compile commands
Summary:
We can't resolve this (if it's a symlink) without further refactoring, but the
current behaviour is just incorrect.

Reviewers: kadircet

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

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82011
2020-06-19 13:46:55 +02:00
Sam McCall 2a3ac01b68 Reland [clangd] Resolve driver symlinks, and look up unknown relative drivers in PATH.
This reverts commit f25e3c2d0e.
Added workaround for tempdir being a symlink on mac.
2020-06-09 23:07:28 +02:00
Nico Weber f25e3c2d0e Revert "[clangd] Resolve driver symlinks, and look up unknown relative drivers in PATH."
This reverts commit 806342b8ef.
Breaks check-clangd on macOS, https://reviews.llvm.org/D75414#2080076
2020-06-08 15:20:16 -04:00
Sam McCall 806342b8ef [clangd] Resolve driver symlinks, and look up unknown relative drivers in PATH.
Summary:
This fixes a reported bug: if clang and libc++ are installed under
/usr/lib/llvm-11/...  but there'- a symlink /usr/bin/clang++-11, then a
compile_commands.json with "/usr/bin/clang++-11 -stdlib=libc++" would previously
look for libc++ under /usr/include instead of /usr/lib/llvm-11/include.
The PATH change makes this work if the compiler is just "clang++-11" too.

As this is now doing IO potentially on every getCompileCommand(), we cache
the results for each distinct driver.

While here:
- Added a Memoize helper for this as multithreaded caching is a bit noisy.
- Used this helper to simplify QueryDriverDatabase and reduce blocking there.
  (This makes use of the fact that llvm::Regex is now threadsafe)

Reviewers: kadircet

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

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75414
2020-06-08 17:24:52 +02:00
Sam McCall ad97ccf6b2 [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-29 15:57:12 +02:00
Benjamin Kramer adcd026838 Make llvm::StringRef to std::string conversions explicit.
This is how it should've been and brings it more in line with
std::string_view. There should be no functional change here.

This is mostly mechanical from a custom clang-tidy check, with a lot of
manual fixups. It uncovers a lot of minor inefficiencies.

This doesn't actually modify StringRef yet, I'll do that in a follow-up.
2020-01-28 23:25:25 +01:00
David Goldman ea9888b8f6 [clangd] Respect `--sysroot` argument if it is set
Summary:
- Since `--sysroot` is a superset of the `-isysroot` argument, we
  shouldn't add the `-isysroot` if we detect a `--sysroot` flag.

Reviewers: sammccall

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

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72415
2020-01-09 11:02:58 -05:00
Sam McCall 99768b243c [clangd] (take 2) Try harder to find a plausible `clang` as argv0, particularly on Mac.
Summary:
This was originally committed in 88bccded8f,
and reverted in 93f77617ab.

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-12-06 09:47:03 +01:00