[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 8 08:56:45 PST 2017
ilya-biryukov added a comment.
In https://reviews.llvm.org/D39799#919415, @sammccall wrote:
> Currently the working directory is always the parent of `compile_flags.txt` as you suggest.
> Maybe this isn't great though - sometimes it might be important that the WD is the parent of the source file?
Parent of the source file seems rather inconvenient most of the time. Even when reading the contents of `compile_flags.txt` one would have to consider it the contexts of every source file.
I'm looking at CompilationDatabase.cpp:321 <https://reviews.llvm.org/diffusion/L/browse/cfe/trunk/lib/Tooling/CompilationDatabase.cpp;317699$321> and don't see the `CompileCommand::Directory` being set at all. Maybe I'm missing something.
A few ideas for tests:
1. Test relative include paths (`-Irelpath/to/include`) work.
2. What happens if both `compile_commands.json` and `compile_flags.txt` are present? Should we test and document it? I'd expect the first one to take priority and the second one to come into play only if the input file is not found in the first one.
More information about the cfe-commits