[PATCH] D155323: [CMake] Don't exclude llvm-debuginfod if httplib isn't available
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 14 12:16:47 PDT 2023
phosek updated this revision to Diff 540531.
Herald added a subscriber: hiraditya.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155323/new/
https://reviews.llvm.org/D155323
Files:
llvm/include/llvm/Debuginfod/HTTPServer.h
llvm/lib/Debuginfod/HTTPServer.cpp
llvm/tools/CMakeLists.txt
Index: llvm/tools/CMakeLists.txt
===================================================================
--- llvm/tools/CMakeLists.txt
+++ 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()
Index: llvm/lib/Debuginfod/HTTPServer.cpp
===================================================================
--- llvm/lib/Debuginfod/HTTPServer.cpp
+++ 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<sys::fs::file_t> 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<HTTPServerError>("no httplib");
}
Expected<unsigned> HTTPServer::bind(const char *HostInterface) {
- llvm_unreachable("No HTTP server implementation available");
+ return make_error<HTTPServerError>("no httplib");
}
Error HTTPServer::listen() {
- llvm_unreachable("No HTTP server implementation available");
+ return make_error<HTTPServerError>("no httplib");
}
void HTTPServer::stop() {
- llvm_unreachable("No HTTP server implementation available");
+ llvm_unreachable("no httplib");
}
#endif // LLVM_ENABLE_HTTPLIB
Index: llvm/include/llvm/Debuginfod/HTTPServer.h
===================================================================
--- llvm/include/llvm/Debuginfod/HTTPServer.h
+++ llvm/include/llvm/Debuginfod/HTTPServer.h
@@ -34,6 +34,16 @@
struct StreamingHTTPResponse;
class HTTPServer;
+class HTTPServerError : public ErrorInfo<HTTPServerError, ECError> {
+public:
+ static char ID;
+ HTTPServerError(const Twine &Msg);
+ void log(raw_ostream &OS) const override;
+
+private:
+ std::string Msg;
+};
+
class HTTPServerRequest {
friend HTTPServer;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155323.540531.patch
Type: text/x-patch
Size: 2811 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230714/04eb5320/attachment.bin>
More information about the llvm-commits
mailing list