diff --git a/clang-tools-extra/clangd/URI.cpp b/clang-tools-extra/clangd/URI.cpp --- a/clang-tools-extra/clangd/URI.cpp +++ b/clang-tools-extra/clangd/URI.cpp @@ -26,13 +26,13 @@ llvm::inconvertibleErrorCode()); } -bool hasDriveLetter(llvm::StringRef Path) { +bool isWindowsPath(llvm::StringRef Path) { return Path.size() > 1 && llvm::isAlpha(Path[0]) && Path[1] == ':'; } -bool isNetworkPath(llvm::StringRef Name) { +bool isNetworkPath(llvm::StringRef Path) { llvm::StringRef Sep = llvm::sys::path::get_separator(); - return Name.consume_front(Sep) && Name.consume_front(Sep) && !Name.empty(); + return Path.consume_front(Sep) && Path.consume_front(Sep) && !Path.empty(); } /// This manages file paths in the file system. All paths in the scheme @@ -53,7 +53,7 @@ if (!Authority.empty()) ("//" + Authority).toVector(Path); // For Windows paths e.g. /X: - if (hasDriveLetter(Body.substr(1))) + if (isWindowsPath(Body.substr(1))) Body.consume_front("/"); Path.append(Body); llvm::sys::path::native(Path); @@ -71,7 +71,7 @@ AbsolutePath.consume_front(Root); } // For Windows paths e.g. X: - if (hasDriveLetter(Root)) + if (isWindowsPath(Root)) Body = "/"; Body += llvm::sys::path::convert_to_slash(AbsolutePath); return URI("file", Authority, Body);