[clang-tools-extra] [clang-tidy] treat fragment includes as main-file parts (PR #180282)

via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 15 10:42:46 PST 2026


================
@@ -53,6 +55,23 @@ struct MissingIncludeInfo {
 };
 } // namespace
 
+static llvm::SmallString<128> normalizePath(llvm::StringRef Path) {
+  namespace path = llvm::sys::path;
+
+  llvm::SmallString<128> P = Path;
+  path::remove_dots(P, /*remove_dot_dot=*/true);
+  path::native(P, path::Style::posix);
+  while (!P.empty() && P.back() == '/')
----------------
zeyi2 wrote:

Nit: not sure about this line, IIUC `llvm::sys::path::remove_dots` already handles trailing separators for most cases. Unless we explicitly want to turn a single root `/` into an empty string, this might be redundant.

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


More information about the cfe-commits mailing list