kadircet wrote: > In my case I am using my build system (bazel) to generate the > compile_commands.json file as part of the build. At this point given bazel's > sandboxing / hermiticity model, the user's checkout PWD is unknown. This file > is then copied somewhere and used by clangd. Today to make that work it > requires post processing the directory field, replacing some sentinel with > the real value.
thanks for the details! I don't think that value can be arbitrary though. bazel still runs its builds from a certain directory (called [execution_root](https://bazel.build/docs/user-manual#:~:text=below%20this%20directory.-,execution_root,-%3A%20the%20absolute%20path)) and the rest of the compile flags you have (unless you're also modifying the flags) are only guaranteed to work when combined with this `execution_root`. as any relative paths in the compile flags are relative to this path. > I was actually surprised by the limitation of only supporting absolute paths > today given that from the user perspective I provided the tools a totally > valid path, where my source files relative to ., VSCode launches clangd from > the root of the repo, and then the paths didn't work. I guess such convenience features doesn't really matter for json compilation databases most of the time, as it's usually generated by build systems and not humans. https://github.com/llvm/llvm-project/pull/127734 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits