Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tooling] Use FixedCompilationDatabase when
compile_flags.txt
is fo…
…und. 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
- Loading branch information
1 parent
26d55e0
commit 60d74e4
Showing
5 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#define SECRET_SYMBOL 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RUN: rm -rf %t | ||
// RUN: mkdir -p %t/Src | ||
// RUN: cp "%s" "%t/Src/test.cpp" | ||
// RUN: mkdir -p %t/Include | ||
// RUN: cp "%S/Inputs/fixed-header.h" "%t/Include/" | ||
// -I flag is relative to %t (where compile_flags is), not Src/. | ||
// RUN: echo '-IInclude/' >> %t/compile_flags.txt | ||
// RUN: echo "-Dklazz=class" >> %t/compile_flags.txt | ||
// RUN: echo '-std=c++11' >> %t/compile_flags.txt | ||
// RUN: clang-check "%t/Src/test.cpp" 2>&1 | ||
// RUN: not clang-check "%s" 2>&1 | FileCheck "%s" -check-prefix=NODB | ||
|
||
// NODB: unknown type name 'klazz' | ||
klazz F{}; | ||
|
||
// NODB: 'fixed-header.h' file not found | ||
#include "fixed-header.h" | ||
static_assert(SECRET_SYMBOL == 1, ""); |