[llvm] Reverts recent debuginfod patches (PR #156532)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 13:47:41 PDT 2025


https://github.com/zeroomega created https://github.com/llvm/llvm-project/pull/156532

This patch reverts 44e791c6ff1a982de9651aad7d1c83d1ad96da8a, 3cc1031a827d319c6cb48df1c3aafc9ba7e96d72 and
adbd43250ade1d5357542d8bd7c3dfed212ddec0. Which breaks debuginfod build and tests when httplib is used.

>From 611126e908685aa8d57d7bbfe79b63aabbe88224 Mon Sep 17 00:00:00 2001
From: Haowei Wu <haowei at google.com>
Date: Tue, 2 Sep 2025 11:56:55 -0700
Subject: [PATCH] Reverts recent debuginfod patches

This patch reverts 44e791c6ff1a982de9651aad7d1c83d1ad96da8a,
3cc1031a827d319c6cb48df1c3aafc9ba7e96d72 and
adbd43250ade1d5357542d8bd7c3dfed212ddec0. Which breaks
debuginfod build and tests when httplib is used.
---
 llvm/include/llvm/Debuginfod/Debuginfod.h     | 11 ++------
 llvm/include/llvm/Debuginfod/HTTPServer.h     |  1 -
 llvm/lib/Debuginfod/Debuginfod.cpp            | 28 +++++--------------
 llvm/lib/Debuginfod/HTTPServer.cpp            |  2 --
 .../tools/llvm-debuginfod/llvm-debuginfod.cpp |  4 +--
 5 files changed, 12 insertions(+), 34 deletions(-)

diff --git a/llvm/include/llvm/Debuginfod/Debuginfod.h b/llvm/include/llvm/Debuginfod/Debuginfod.h
index 67121d08d2569..99fe15ad85979 100644
--- a/llvm/include/llvm/Debuginfod/Debuginfod.h
+++ b/llvm/include/llvm/Debuginfod/Debuginfod.h
@@ -152,16 +152,11 @@ class DebuginfodCollection {
   Expected<std::string> findBinaryPath(object::BuildIDRef);
 };
 
-class DebuginfodServer {
-public:
+struct DebuginfodServer {
   HTTPServer Server;
+  DebuginfodLog &Log;
+  DebuginfodCollection &Collection;
   DebuginfodServer(DebuginfodLog &Log, DebuginfodCollection &Collection);
-  static Expected<DebuginfodServer> create(DebuginfodLog &Log,
-                                           DebuginfodCollection &Collection);
-
-private:
-  DebuginfodServer() = default;
-  Error init(DebuginfodLog &Log, DebuginfodCollection &Collection);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Debuginfod/HTTPServer.h b/llvm/include/llvm/Debuginfod/HTTPServer.h
index 5c9c1082cbb95..c200089200ab7 100644
--- a/llvm/include/llvm/Debuginfod/HTTPServer.h
+++ b/llvm/include/llvm/Debuginfod/HTTPServer.h
@@ -104,7 +104,6 @@ class HTTPServer {
 public:
   HTTPServer();
   ~HTTPServer();
-  HTTPServer(HTTPServer &&);
 
   /// Returns true only if LLVM has been compiled with a working HTTPServer.
   static bool isAvailable();
diff --git a/llvm/lib/Debuginfod/Debuginfod.cpp b/llvm/lib/Debuginfod/Debuginfod.cpp
index 77a8011ca82a6..12f817c9e4bf0 100644
--- a/llvm/lib/Debuginfod/Debuginfod.cpp
+++ b/llvm/lib/Debuginfod/Debuginfod.cpp
@@ -567,10 +567,10 @@ Expected<std::string> DebuginfodCollection::findDebugBinaryPath(BuildIDRef ID) {
   return getCachedOrDownloadDebuginfo(ID);
 }
 
-Error DebuginfodServer::init(DebuginfodLog &Log,
-                             DebuginfodCollection &Collection) {
-
-  Error Err =
+DebuginfodServer::DebuginfodServer(DebuginfodLog &Log,
+                                   DebuginfodCollection &Collection)
+    : Log(Log), Collection(Collection) {
+  cantFail(
       Server.get(R"(/buildid/(.*)/debuginfo)", [&](HTTPServerRequest Request) {
         Log.push("GET " + Request.UrlPath);
         std::string IDString;
@@ -587,11 +587,8 @@ Error DebuginfodServer::init(DebuginfodLog &Log,
           return;
         }
         streamFile(Request, *PathOrErr);
-      });
-  if (Err)
-    return Err;
-
-  Err =
+      }));
+  cantFail(
       Server.get(R"(/buildid/(.*)/executable)", [&](HTTPServerRequest Request) {
         Log.push("GET " + Request.UrlPath);
         std::string IDString;
@@ -608,18 +605,7 @@ Error DebuginfodServer::init(DebuginfodLog &Log,
           return;
         }
         streamFile(Request, *PathOrErr);
-      });
-  if (Err)
-    return Err;
-  return Error::success();
-}
-
-Expected<DebuginfodServer>
-DebuginfodServer::create(DebuginfodLog &Log, DebuginfodCollection &Collection) {
-  DebuginfodServer Serverd;
-  if (llvm::Error Err = Serverd.init(Log, Collection))
-    return std::move(Err);
-  return std::move(Serverd);
+      }));
 }
 
 } // namespace llvm
diff --git a/llvm/lib/Debuginfod/HTTPServer.cpp b/llvm/lib/Debuginfod/HTTPServer.cpp
index b384fe812ac2c..1264353ce4b33 100644
--- a/llvm/lib/Debuginfod/HTTPServer.cpp
+++ b/llvm/lib/Debuginfod/HTTPServer.cpp
@@ -62,8 +62,6 @@ bool llvm::streamFile(HTTPServerRequest &Request, StringRef FilePath) {
   return true;
 }
 
-HTTPServer::HTTPServer(HTTPServer &&) = default;
-
 #ifdef LLVM_ENABLE_HTTPLIB
 
 bool HTTPServer::isAvailable() { return true; }
diff --git a/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp b/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
index 901bf489ea9f8..7b85166c1b4ae 100644
--- a/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
+++ b/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
@@ -131,8 +131,8 @@ int llvm_debuginfod_main(int argc, char **argv, const llvm::ToolContext &) {
   DefaultThreadPool Pool(hardware_concurrency(MaxConcurrency));
   DebuginfodLog Log;
   DebuginfodCollection Collection(Paths, Log, Pool, MinInterval);
-  DebuginfodServer Server =
-      ExitOnErr(DebuginfodServer::create(Log, Collection));
+  DebuginfodServer Server(Log, Collection);
+
   if (!Port)
     Port = ExitOnErr(Server.Server.bind(HostInterface.c_str()));
   else



More information about the llvm-commits mailing list