Commit Graph

6 Commits

Author SHA1 Message Date
Christopher Di Bella 478092d331 [clangd][iwyu] explicitly includes `<atomic>`
Compiling clangd with Clang modules and libc++ revealed that
`support/Threading.h` uses `std::atomic` but wasn't including the
correct header.

Differential Revision: https://reviews.llvm.org/D105400
2021-07-04 06:00:39 +00:00
Sam McCall 3dbe471a26 [clangd] Use atomics instead of locks to track periodic memory trimming
Instead of always locking/unlocking a contended mutex, we now do one atomic read
in the common case, and one read + one exchange if the timer has expried.

Also use this for memory profiling which has similar/compatible requirements.

Differential Revision: https://reviews.llvm.org/D93726
2020-12-22 22:32:22 +01: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