llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clangd Author: Li-Zheng-Rong <details> <summary>Changes</summary> When checking for multiple source files declaring the same module, the comparison used raw string equality on file paths. This causes false positives when the same file is represented by different but equivalent path strings. Use pathEqual(normalizePath(...), normalizePath(...)) instead to compare canonical paths, consistent with how clangd handles path comparisons elsewhere. --- Full diff: https://github.com/llvm/llvm-project/pull/199343.diff 1 Files Affected: - (modified) clang-tools-extra/clangd/ProjectModules.cpp (+2-1) ``````````diff diff --git a/clang-tools-extra/clangd/ProjectModules.cpp b/clang-tools-extra/clangd/ProjectModules.cpp index d3727171bff12..33cbc715e9659 100644 --- a/clang-tools-extra/clangd/ProjectModules.cpp +++ b/clang-tools-extra/clangd/ProjectModules.cpp @@ -247,7 +247,8 @@ ModuleDependencyScanner::scan(PathRef FilePath, auto [Iter, Inserted] = ModuleNameToSource.try_emplace( ScanningResult->Provides->ModuleName, FilePath); - if (!Inserted && Iter->second != FilePath) { + if (!Inserted && + !pathEqual(normalizePath(Iter->second), normalizePath(FilePath))) { elog("Detected multiple source files ({0}, {1}) declaring the same " "module: '{2}'. " "Now clangd may find the wrong source in such case.", `````````` </details> https://github.com/llvm/llvm-project/pull/199343 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
