[clang-tools-extra] [clangd] IncludeCleaner include not found error now contains path (PR #136237)
Tongsheng Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 17 18:42:23 PDT 2025
https://github.com/tongshengw created https://github.com/llvm/llvm-project/pull/136237
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
```
>From f7ad18d99f42f303a8b298433f2e993cfe90f8ca Mon Sep 17 00:00:00 2001
From: Tongsheng Wu <tongshengwu0 at gmail.com>
Date: Thu, 17 Apr 2025 21:39:27 -0400
Subject: [PATCH] [clangd] IncludeCleaner include not found error now contains
path
---
clang-tools-extra/clangd/IncludeCleaner.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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;
More information about the cfe-commits
mailing list