Skip to content

Commit 9934f15

Browse files
committed
Disable inferring compile commands for missing files
See https://reviews.llvm.org/D51729 for more details
1 parent 1fced7d commit 9934f15

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/src/fetchers/FetcherUtils.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ void ClangToolRunner::run(const fs::path &file,
5757
if (!Paths::isSourceFile(file) && (!Paths::isHeaderFile(file) || onlySource)) {
5858
return;
5959
}
60+
if (onlySource) {
61+
if (!CollectionUtils::contains(compilationDatabase->getAllFiles(), file)) {
62+
throw CompilationDatabaseException(
63+
"compile_commands.json doesn't contain a command for source file " + file.string());
64+
}
65+
}
6066
auto clangTool = std::make_unique<clang::tooling::ClangTool>(
6167
compilationDatabase->getClangCompilationDatabase(), file.string());
6268
if (ignoreDiagnostics) {

0 commit comments

Comments
 (0)