[clang-tools-extra] 4fb1adc - [clangd] Log directory when a CDB is loaded

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 30 03:15:11 PST 2020


Author: Kadir Cetinkaya
Date: 2020-01-30T12:15:04+01:00
New Revision: 4fb1adcde22c06d421598ed1925ee3c7c835abc4

URL: https://github.com/llvm/llvm-project/commit/4fb1adcde22c06d421598ed1925ee3c7c835abc4
DIFF: https://github.com/llvm/llvm-project/commit/4fb1adcde22c06d421598ed1925ee3c7c835abc4.diff

LOG: [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

Added: 
    

Modified: 
    clang-tools-extra/clangd/GlobalCompilationDatabase.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
index f2a6083b77e3..aa6727fc20f5 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -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;
 }


        


More information about the cfe-commits mailing list