diff --git a/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp b/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp index 8733732f..10a8e0e4 100644 --- a/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp +++ b/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp @@ -2,6 +2,8 @@ #include "clang/Tooling/CompilationDatabase.h" #include "clang/Tooling/JSONCompilationDatabase.h" +#include "utility/logging/logging.h" +#include "utility/messaging/type/MessageStatus.h" std::vector IndexerCommandCxxCdb::getSourceFilesFromCDB(const FilePath& compilationDatabasePath) { @@ -9,6 +11,13 @@ std::vector IndexerCommandCxxCdb::getSourceFilesFromCDB(const FilePath std::shared_ptr cdb = std::shared_ptr (clang::tooling::JSONCompilationDatabase::loadFromFile(compilationDatabasePath.str(), error)); + if (!error.empty()) + { + const std::string message = "Loading Clang compilation database failed with error: \"" + error + "\""; + LOG_ERROR(message); + MessageStatus(message, true).dispatch(); + } + std::vector filePaths; if (cdb) { diff --git a/src/lib_cxx/project/SourceGroupCxx.cpp b/src/lib_cxx/project/SourceGroupCxx.cpp index 5870193f..6122f073 100644 --- a/src/lib_cxx/project/SourceGroupCxx.cpp +++ b/src/lib_cxx/project/SourceGroupCxx.cpp @@ -135,6 +135,14 @@ std::vector> SourceGroupCxx::getIndexerCommands( std::string error; std::shared_ptr cdb = std::shared_ptr (clang::tooling::JSONCompilationDatabase::loadFromFile(cdbPath.str(), error)); + + if (!error.empty()) + { + const std::string message = "Loading Clang compilation database failed with error: \"" + error + "\""; + LOG_ERROR(message); + MessageStatus(message, true).dispatch(); + } + for (clang::tooling::CompileCommand command: cdb->getAllCompileCommands()) { if (sourceFilePathsToIndex.find(FilePath(command.Filename)) != sourceFilePathsToIndex.end())