[clangd] Log directory when a CDB is loaded

Summary: Fixes https://github.com/clangd/clangd/issues/268

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73628
This commit is contained in:
Kadir Cetinkaya 2020-01-29 11:54:22 +01:00
parent df8a986f53
commit 4fb1adcde2
No known key found for this signature in database
GPG Key ID: E39E36B8D2057ED6
1 changed files with 3 additions and 1 deletions

View File

@ -115,9 +115,11 @@ DirectoryBasedGlobalCompilationDatabase::getCDBInDirLocked(PathRef Dir) const {
auto R = CompilationDatabases.try_emplace(Key);
if (R.second) { // Cache miss, try to load CDB.
CachedCDB &Entry = R.first->second;
std::string Error = "";
std::string Error;
Entry.CDB = tooling::CompilationDatabase::loadFromDirectory(Dir, Error);
Entry.Path = std::string(Dir);
if (Entry.CDB)
log("Loaded compilation database from {0}", Dir);
}
return R.first->second;
}