[clangd] Log the paths of loaded config files without --log=verbose (#142063)

Users sometimes forget about configuration they've placed in the user
config file, or an ancestor directory of their project.

Logging the paths of loaded config files by default (without
--log=verbose) surfaces more readily where clangd is getting its
configuration from.
This commit is contained in:
Nathan Ridge
2025-05-30 22:31:12 -04:00
committed by GitHub
parent c979d1f812
commit ed14e0da77

View File

@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
#include "ConfigFragment.h"
#include "support/Logger.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
@@ -486,6 +487,7 @@ std::vector<Fragment> Fragment::parseYAML(llvm::StringRef YAML,
DiagnosticCallback Diags) {
// The YAML document may contain multiple conditional fragments.
// The SourceManager is shared for all of them.
log("Loading config file at {0}", BufferName);
auto SM = std::make_shared<llvm::SourceMgr>();
auto Buf = llvm::MemoryBuffer::getMemBufferCopy(YAML, BufferName);
// Adapt DiagnosticCallback to function-pointer interface.