[clang-tools-extra] [clangd] IncludeCleaner include not found error now contains path (PR #136237)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 17 18:43:13 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangd

Author: Tongsheng Wu (tongshengw)

<details>
<summary>Changes</summary>

IncludeCleaner header not found messages now show file path.

[https://github.com/clangd/clangd/issues/2334](https://github.com/clangd/clangd/issues/2334)

New error messages:
```
E[03:32:43.219] IncludeCleaner: Failed to get an entry for resolved path '' from include <doesntexist> : No such file or directory
E[03:32:43.219] IncludeCleaner: Failed to get an entry for resolved path '' from include "doesntexist.hpp" : No such file or directory
E[03:32:43.219] IncludeCleaner: Failed to get an entry for resolved path '' from include "/path/doesnt/exist" : No such file or directory
```
Old error messages:
```
E[03:34:47.752] IncludeCleaner: Failed to get an entry for resolved path : No such file or directory
```

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


1 Files Affected:

- (modified) clang-tools-extra/clangd/IncludeCleaner.cpp (+3-2) 


``````````diff
diff --git a/clang-tools-extra/clangd/IncludeCleaner.cpp b/clang-tools-extra/clangd/IncludeCleaner.cpp
index e34706172f0bf..dc4c8fc498b1f 100644
--- a/clang-tools-extra/clangd/IncludeCleaner.cpp
+++ b/clang-tools-extra/clangd/IncludeCleaner.cpp
@@ -345,8 +345,9 @@ include_cleaner::Includes convertIncludes(const ParsedAST &AST) {
     // which is based on FileManager::getCanonicalName(ParentDir).
     auto FE = SM.getFileManager().getFileRef(Inc.Resolved);
     if (!FE) {
-      elog("IncludeCleaner: Failed to get an entry for resolved path {0}: {1}",
-           Inc.Resolved, FE.takeError());
+      elog("IncludeCleaner: Failed to get an entry for resolved path '{0}' "
+           "from include {1} : {2}",
+           Inc.Resolved, Inc.Written, FE.takeError());
       continue;
     }
     TransformedInc.Resolved = *FE;

``````````

</details>


https://github.com/llvm/llvm-project/pull/136237


More information about the cfe-commits mailing list