[PATCH] D92663: [clangd] Add hot-reload of compile_commands.json and compile_flags.txt

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 09:23:37 PST 2020


sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: usaxena95, jfb, arphaman.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

When querying the CDB, we stat the underlying file to check it hasn't changed.
We don't do this every time, but only if we didn't check within 5 seconds.

This behavior only exists for compile_commands.json and compile_flags.txt.
The CDB plugin system doesn't expose enough information to handle others.

Slight behavior change: we now only look for `build/compile_commands.json`
rather than trying every CDB strategy under `build` subdirectories.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92663

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
  clang-tools-extra/clangd/GlobalCompilationDatabase.h
  clang-tools-extra/clangd/tool/Check.cpp
  clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
  clang/include/clang/Tooling/CompilationDatabase.h
  clang/lib/Tooling/CompilationDatabase.cpp
  clang/lib/Tooling/JSONCompilationDatabase.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92663.309552.patch
Type: text/x-patch
Size: 32778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201204/939c24c7/attachment-0001.bin>


More information about the cfe-commits mailing list