@@ -127,6 +127,7 @@ struct BrowserDiagnosticClient : clang::DiagnosticConsumer {
127127 switch (DiagLevel) {
128128 case clang::DiagnosticsEngine::Fatal:
129129 std::cerr << " FATAL " ;
130+ LLVM_FALLTHROUGH;
130131 case clang::DiagnosticsEngine::Error:
131132 std::cerr << " Error: " << locationToString (Info.getLocation (), annotator.getSourceMgr ())
132133 << " : " << diag.c_str () << std::endl;
@@ -304,8 +305,17 @@ static bool proceedCommand(std::vector<std::string> command, llvm::StringRef Dir
304305}
305306
306307int main (int argc, const char **argv) {
308+ std::string ErrorMessage;
307309 std::unique_ptr<clang::tooling::CompilationDatabase> Compilations (
308- clang::tooling::FixedCompilationDatabase::loadFromCommandLine (argc, argv));
310+ clang::tooling::FixedCompilationDatabase::loadFromCommandLine (argc, argv
311+ #if CLANG_VERSION_MAJOR >= 5
312+ , ErrorMessage
313+ #endif
314+ ));
315+ if (!ErrorMessage.empty ()) {
316+ std::cerr << ErrorMessage << std::endl;
317+ ErrorMessage = {};
318+ }
309319
310320 llvm::cl::ParseCommandLineOptions (argc, argv);
311321
@@ -341,7 +351,6 @@ int main(int argc, const char **argv) {
341351
342352
343353 if (!Compilations && llvm::sys::fs::exists (BuildPath)) {
344- std::string ErrorMessage;
345354 if (llvm::sys::fs::is_directory (BuildPath)) {
346355 Compilations = std::unique_ptr<clang::tooling::CompilationDatabase>(
347356 clang::tooling::CompilationDatabase::loadFromDirectory (BuildPath, ErrorMessage));
0 commit comments