kbobyrev created this revision. kbobyrev added a reviewer: kadircet. Herald added subscribers: cfe-commits, usaxena95, arphaman, jkorous. Herald added a project: clang. kbobyrev requested review of this revision. Herald added subscribers: MaskRay, ilya-biryukov.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D85502 Files: clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp Index: clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp =================================================================== --- clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp +++ clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp @@ -23,6 +23,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/Path.h" #include "llvm/Support/StringSaver.h" @@ -303,7 +304,8 @@ if (RelativePath.empty()) return makeStringError("Empty relative path."); if (llvm::sys::path::is_absolute(RelativePath)) - return makeStringError("RelativePath is absolute."); + return makeStringError( + llvm::formatv("RelativePath {0} is absolute.", RelativePath).str()); llvm::SmallString<256> FullPath = llvm::StringRef(*LocalIndexRoot); llvm::sys::path::append(FullPath, RelativePath); auto Result = URI::createFile(FullPath); @@ -316,10 +318,16 @@ if (!ParsedURI) return ParsedURI.takeError(); if (ParsedURI->scheme() != "file") - return makeStringError("Can not use URI schemes other than file."); + return makeStringError( + llvm::formatv("Can not use URI schemes other than file, given: {0}.", + URI) + .str()); llvm::SmallString<256> Result = ParsedURI->body(); if (!llvm::sys::path::replace_path_prefix(Result, *RemoteIndexRoot, "")) - return makeStringError("File path doesn't start with RemoteIndexRoot."); + return makeStringError( + llvm::formatv("File path {0} doesn't start with RemoteIndexRoot.", + Result.str()) + .str()); // Make sure the result has UNIX slashes. return llvm::sys::path::convert_to_slash(Result, llvm::sys::path::Style::posix);
Index: clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp =================================================================== --- clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp +++ clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp @@ -23,6 +23,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/Path.h" #include "llvm/Support/StringSaver.h" @@ -303,7 +304,8 @@ if (RelativePath.empty()) return makeStringError("Empty relative path."); if (llvm::sys::path::is_absolute(RelativePath)) - return makeStringError("RelativePath is absolute."); + return makeStringError( + llvm::formatv("RelativePath {0} is absolute.", RelativePath).str()); llvm::SmallString<256> FullPath = llvm::StringRef(*LocalIndexRoot); llvm::sys::path::append(FullPath, RelativePath); auto Result = URI::createFile(FullPath); @@ -316,10 +318,16 @@ if (!ParsedURI) return ParsedURI.takeError(); if (ParsedURI->scheme() != "file") - return makeStringError("Can not use URI schemes other than file."); + return makeStringError( + llvm::formatv("Can not use URI schemes other than file, given: {0}.", + URI) + .str()); llvm::SmallString<256> Result = ParsedURI->body(); if (!llvm::sys::path::replace_path_prefix(Result, *RemoteIndexRoot, "")) - return makeStringError("File path doesn't start with RemoteIndexRoot."); + return makeStringError( + llvm::formatv("File path {0} doesn't start with RemoteIndexRoot.", + Result.str()) + .str()); // Make sure the result has UNIX slashes. return llvm::sys::path::convert_to_slash(Result, llvm::sys::path::Style::posix);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits