[PATCH] D83621: [clang][Tooling] Try to avoid file system access if there is no record for the file in compile_commads.json

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 14 15:07:34 PDT 2020


sammccall added a comment.

In D83621#2146750 <https://reviews.llvm.org/D83621#2146750>, @ArcsinX wrote:

> > - don't scan for equivalences if the set of candidates exceeds some size threshold (10 or so)
> > - don't scan for equivalences if the node we'd scan under is the root
>
> After such fixes `JSONCompilationDatabase::getCompileCommands()` will return other results than before in some cases.


Can you elaborate on this - do you think there are reasonable cases where it will give the wrong answer?
I can certainly imagine cases where this changes behaviour, e.g. project/foo.cc is a symlink to project/bar.cc, compile_commands contains an entry for foo.cc, we query for bar.cc.
But I don't think this was ever really intended to handle arbitrary symlinks that change the names of files, and I do think this is OK to break.

>   For my experience InterpolatingCompilationDatabase works pretty well for symlinks cases.

This sounds reasonable but is a bit anecdotal - people use different build systems/source layouts, some of them use symlinks heavily and some not at all.
InterpolatingCompilationDatabase often works well but it's very fuzzy/heuristic, and there are layouts where it really doesn't work well.
(At the same time I feel uncomfortable because I'm not sure what would be sufficient evidence to remove the filematchtrie)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83621





More information about the cfe-commits mailing list