[Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.
authorSam McCall <sam.mccall@gmail.com>
Thu, 9 Nov 2017 10:37:39 +0000 (10:37 +0000)
committerSam McCall <sam.mccall@gmail.com>
Thu, 9 Nov 2017 10:37:39 +0000 (10:37 +0000)
commit60d74e45888e2bab27bb003193e22acbc754c67a
tree9baa5df06875c7505fdf2c80a85cf71d4d0382e7
parent26d55e0346964a46978c873b4d4bde01df4ea977
[Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

Summary:
This is an alternative to JSONCompilationDatabase for simple projects that
don't use a build system such as CMake.
(You can also drop one in ~, to make your tools use e.g. C++11 by default)

There's no facility for varying flags per-source-file or per-machine.
Possibly this could be accommodated backwards-compatibly using cpp, but even if
not the simplicity seems worthwhile for the cases that are addressed.

Tested with clangd, works great! (requires clangd restart)

Reviewers: klimek

Subscribers: ilya-biryukov, cfe-commits

Differential Revision: https://reviews.llvm.org/D39799

llvm-svn: 317777
clang/docs/JSONCompilationDatabase.rst
clang/include/clang/Tooling/CompilationDatabase.h
clang/lib/Tooling/CompilationDatabase.cpp
clang/test/Tooling/Inputs/fixed-header.h [new file with mode: 0644]
clang/test/Tooling/fixed-database.cpp [new file with mode: 0644]