llvm-project
41cfdef0 - [Tooling] Resolve relative "directory" against the compilation database (#235400)

Commit
9 days ago
[Tooling] Resolve relative "directory" against the compilation database (#235400) JSONCompilationDatabase does not resolve a relative "directory", e.g. `{"directory": ".", "command": "cc ../src/a.c", "file": "../src/a.c"}`. getCompileCommands finds nothing, so clang-check reports "Compile command not found" and clangd uses a fallback command. getAllCompileCommands returns the directory verbatim, so each consumer resolves it against its own working directory. Resolve it against the directory containing compile_commands.json, without resolving symlinks, so that paths keep the spelling clangd receives from the editor. A compile_commands.json symlinked into the source root is therefore relative to the source root. Since loadFromBuffer has no file path, it takes the base directory as a new first parameter. LLM-aided
Author
Parents
Loading