diff --git a/llvm/include/llvm/Debuginfod/HTTPServer.h b/llvm/include/llvm/Debuginfod/HTTPServer.h --- a/llvm/include/llvm/Debuginfod/HTTPServer.h +++ b/llvm/include/llvm/Debuginfod/HTTPServer.h @@ -34,6 +34,16 @@ struct StreamingHTTPResponse; class HTTPServer; +class HTTPServerError : public ErrorInfo { +public: + static char ID; + HTTPServerError(const Twine &Msg); + void log(raw_ostream &OS) const override; + +private: + std::string Msg; +}; + class HTTPServerRequest { friend HTTPServer; diff --git a/llvm/lib/Debuginfod/HTTPServer.cpp b/llvm/lib/Debuginfod/HTTPServer.cpp --- a/llvm/lib/Debuginfod/HTTPServer.cpp +++ b/llvm/lib/Debuginfod/HTTPServer.cpp @@ -28,6 +28,12 @@ using namespace llvm; +char HTTPServerError::ID = 0; + +HTTPServerError::HTTPServerError(const Twine &Msg) : Msg(Msg.str()) {} + +void HTTPServerError::log(raw_ostream &OS) const { OS << Msg; } + bool llvm::streamFile(HTTPServerRequest &Request, StringRef FilePath) { Expected FDOrErr = sys::fs::openNativeFileForRead(FilePath); if (Error Err = FDOrErr.takeError()) { @@ -159,31 +165,31 @@ HTTPServer::~HTTPServer() = default; void HTTPServerRequest::setResponse(HTTPResponse Response) { - llvm_unreachable("No HTTP server implementation available"); + llvm_unreachable("no httplib"); } void HTTPServerRequest::setResponse(StreamingHTTPResponse Response) { - llvm_unreachable("No HTTP server implementation available"); + llvm_unreachable("no httplib"); } Error HTTPServer::get(StringRef UrlPathPattern, HTTPRequestHandler Handler) { - llvm_unreachable("No HTTP server implementation available"); + return Error::success(); } Error HTTPServer::bind(unsigned ListenPort, const char *HostInterface) { - llvm_unreachable("No HTTP server implementation available"); + return make_error("no httplib"); } Expected HTTPServer::bind(const char *HostInterface) { - llvm_unreachable("No HTTP server implementation available"); + return make_error("no httplib"); } Error HTTPServer::listen() { - llvm_unreachable("No HTTP server implementation available"); + return make_error("no httplib"); } void HTTPServer::stop() { - llvm_unreachable("No HTTP server implementation available"); + llvm_unreachable("no httplib"); } #endif // LLVM_ENABLE_HTTPLIB diff --git a/llvm/tools/CMakeLists.txt b/llvm/tools/CMakeLists.txt --- a/llvm/tools/CMakeLists.txt +++ b/llvm/tools/CMakeLists.txt @@ -21,10 +21,6 @@ set(LLVM_TOOL_LTO_BUILD Off) endif() -if(NOT LLVM_ENABLE_HTTPLIB) - set(LLVM_TOOL_LLVM_DEBUGINFOD_BUILD Off) -endif() - if (LLVM_TOOL_LLVM_DRIVER_BUILD) add_llvm_tool(llvm-driver) endif()