Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2025

Conversation

HighCommander4
Copy link
Collaborator

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.

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.
@HighCommander4
Copy link
Collaborator Author

Suggested in clangd/clangd#2409 (comment).

@llvmbot
Copy link
Member

llvmbot commented May 29, 2025

@llvm/pr-subscribers-clangd

Author: Nathan Ridge (HighCommander4)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/142063.diff

1 Files Affected:

  • (modified) clang-tools-extra/clangd/ConfigYAML.cpp (+2)
diff --git a/clang-tools-extra/clangd/ConfigYAML.cpp b/clang-tools-extra/clangd/ConfigYAML.cpp
index 47c6e1cd0f7e7..3cfbbe62046f7 100644
--- a/clang-tools-extra/clangd/ConfigYAML.cpp
+++ b/clang-tools-extra/clangd/ConfigYAML.cpp
@@ -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"
@@ -482,6 +483,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.

@llvmbot
Copy link
Member

llvmbot commented May 29, 2025

@llvm/pr-subscribers-clang-tools-extra

Author: Nathan Ridge (HighCommander4)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/142063.diff

1 Files Affected:

  • (modified) clang-tools-extra/clangd/ConfigYAML.cpp (+2)
diff --git a/clang-tools-extra/clangd/ConfigYAML.cpp b/clang-tools-extra/clangd/ConfigYAML.cpp
index 47c6e1cd0f7e7..3cfbbe62046f7 100644
--- a/clang-tools-extra/clangd/ConfigYAML.cpp
+++ b/clang-tools-extra/clangd/ConfigYAML.cpp
@@ -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"
@@ -482,6 +483,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.

@HighCommander4 HighCommander4 merged commit ed14e0d into llvm:main May 31, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants