[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 9 01:04:06 PST 2017

sammccall added a comment.

In https://reviews.llvm.org/D39799#919508, @ilya-biryukov wrote:

> In https://reviews.llvm.org/D39799#919494, @sammccall wrote:
> > e.g. IIUC, things like `#include "sibling.h"` won't look for the h file next to the cc file?
> Actually, this should work as quoted includes are always searched relative to the current file before looking in the include paths. No matter what the WD is.

Right, thanks :-)

>> Ideally yes... i'm not sure this is so easy with the registry mechanism though :-(
>>  They'd have to be present at the same level, so I'm not sure this is a huge deal.
> Yeah, looks like this would require unifying `FixedCompilationDatabase` and `JSONCompilationDatabase`. This doesn't seem too crazy, though. "A class that handles reading compilation arguments from the filesystem." seems like a valid entity to me.

It's doable, but then you're fighting the infrastructure here. The same ambiguity can exist between any pair of CompilationDatabasePlugins (try dumping a compile_commands.json in a google source tree). If we want to make this an error or have well-defined priority, that should be handled by autoDetectFromDirectory I think.

(Happy to do that if you think it's important - personally I'm not convinced it will be an issue in practice)


More information about the cfe-commits mailing list