forked from OSchip/llvm-project
Add fall-back mode for clang tools.
Run without flags if we cannot load a compilation database. This matches the behavior of clang itself when simply called with a source file. Based on a patch by Russell Wallace. llvm-svn: 254599
This commit is contained in:
parent
0f1223053c
commit
6003384ea9
|
@ -116,8 +116,7 @@ CommonOptionsParser::CommonOptionsParser(
|
|||
|
||||
cl::HideUnrelatedOptions(Category);
|
||||
|
||||
Compilations.reset(FixedCompilationDatabase::loadFromCommandLine(argc,
|
||||
argv));
|
||||
Compilations.reset(FixedCompilationDatabase::loadFromCommandLine(argc, argv));
|
||||
cl::ParseCommandLineOptions(argc, argv, Overview);
|
||||
SourcePathList = SourcePaths;
|
||||
if ((OccurrencesFlag == cl::ZeroOrMore || OccurrencesFlag == cl::Optional) &&
|
||||
|
@ -132,8 +131,12 @@ CommonOptionsParser::CommonOptionsParser(
|
|||
Compilations = CompilationDatabase::autoDetectFromSource(SourcePaths[0],
|
||||
ErrorMessage);
|
||||
}
|
||||
if (!Compilations)
|
||||
llvm::report_fatal_error(ErrorMessage);
|
||||
if (!Compilations) {
|
||||
llvm::errs() << "Error while trying to load a compilation database:\n"
|
||||
<< ErrorMessage << "Running without flags.\n";
|
||||
Compilations.reset(
|
||||
new FixedCompilationDatabase(".", std::vector<std::string>()));
|
||||
}
|
||||
}
|
||||
auto AdjustingCompilations =
|
||||
llvm::make_unique<ArgumentsAdjustingCompilations>(
|
||||
|
|
Loading…
Reference in New Issue