[clangd] Log directory when a CDB is loaded
authorKadir Cetinkaya <kadircet@google.com>
Wed, 29 Jan 2020 10:54:22 +0000 (11:54 +0100)
committerKadir Cetinkaya <kadircet@google.com>
Thu, 30 Jan 2020 11:15:04 +0000 (12:15 +0100)
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

clang-tools-extra/clangd/GlobalCompilationDatabase.cpp

index f2a6083..aa6727f 100644 (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;
 }