ilya-golovenko updated this revision to Diff 279233. ilya-golovenko added a comment.
Consistent naming: hasDriveLetter => isWindowsPath Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84150/new/ https://reviews.llvm.org/D84150 Files: clang-tools-extra/clangd/URI.cpp Index: clang-tools-extra/clangd/URI.cpp =================================================================== --- clang-tools-extra/clangd/URI.cpp +++ 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);
Index: clang-tools-extra/clangd/URI.cpp =================================================================== --- clang-tools-extra/clangd/URI.cpp +++ 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);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits