[PATCH] D83099: [clangd] Store index in '.cache/clangd/index' instead of '.clangd/index'

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 02:15:46 PDT 2020


sammccall added a comment.

In D83099#2154416 <https://reviews.llvm.org/D83099#2154416>, @davidvancleve wrote:

> Thanks for the quick response! Nope, no compile_commands.json files, and they didn't previously contain .clangd files.


Well, thanks for reporting this, this seems like a really bad bug, and we'd like to get it fixed on the release branch ASAP.

(Just to check - also no compile_flags.txt or other compilation database markers?)

Our best guess is this is a fairly long-standing bug in OverlayCDB: the storage location would be ".cache/clangd/index" relative to the *working* directory in some cases.
If this theory is correct:

- you'd be using an editor/plugin that sends compile commands over LSP (such as YCM + ycm_extra_conf). What are you using?
- there should be relatively few *.idx files inside the extra directories (the ones not near your compilation database), corresponding to files you've had open rather than the whole project
- we don't know why this wouldn't also have been happenening with the old `.clangd` directories - possible they were there but masked by `.gitignore`?

If this doesn't sound likely, it'd be really useful (as we haven't reproduced this) to add a log line if you can, and capture a log.
Immediately below the llvm::sys::path::append that was changed in this patch, if you could add:

  log("BackgroundIndexStorage: File={0} SourceRoot={1} StorageDir={2}", File, PI->SourceRoot, StorageDir);

Then delete all the `.cache` directories, open clangd and open files until they come back, and grab the clangd stderr log (editors/plugins expose this in some way).
This should give us something to go on, else we'll have to keep guessing...

Cheers, Sam


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83099/new/

https://reviews.llvm.org/D83099





More information about the cfe-commits mailing list