[Lldb-commits] [lldb] [llvm] Reland "[Support] Move HTTP client/server to new LLVMSupportHTTP lib (NFC)" (PR #186074)

via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 12 03:08:47 PDT 2026


Stefan =?utf-8?q?Gränitz?= <stefan.graenitz at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/186074 at github.com>


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Stefan Gränitz (weliveindetail)

<details>
<summary>Changes</summary>

Relocate HTTPClient and HTTPServer from the Debuginfod library to
llvm/Support/HTTP so they can be reused by other components.

---------

Relanding with fixes in CMakeLists.txt to account for dependency to new LLVMSupportHTTP in tools.
Relanding with fix in libSupportHTTP that adds it as a component in libLLVM.so

---------

Co-authored-by: Alexandre Ganea <aganea@<!-- -->havenstudios.com>
Co-authored-by: Jonas Devlieghere <jonas@<!-- -->devlieghere.com>

---

Patch is 20.56 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/186074.diff


28 Files Affected:

- (modified) lldb/source/Plugins/SymbolLocator/Debuginfod/CMakeLists.txt (+1) 
- (modified) lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp (+1-1) 
- (modified) llvm/include/llvm/Debuginfod/Debuginfod.h (+1-2) 
- (renamed) llvm/include/llvm/Support/HTTP/HTTPClient.h (+4-4) 
- (renamed) llvm/include/llvm/Support/HTTP/HTTPServer.h (+4-4) 
- (modified) llvm/lib/Debuginfod/CMakeLists.txt (+1-12) 
- (modified) llvm/lib/Debuginfod/Debuginfod.cpp (+1-1) 
- (modified) llvm/lib/Support/CMakeLists.txt (+1) 
- (added) llvm/lib/Support/HTTP/CMakeLists.txt (+20) 
- (renamed) llvm/lib/Support/HTTP/HTTPClient.cpp (+5-3) 
- (renamed) llvm/lib/Support/HTTP/HTTPServer.cpp (+5-8) 
- (modified) llvm/tools/llvm-cov/CMakeLists.txt (+1) 
- (modified) llvm/tools/llvm-cov/CodeCoverage.cpp (+1-1) 
- (modified) llvm/tools/llvm-debuginfod-find/CMakeLists.txt (+1) 
- (modified) llvm/tools/llvm-debuginfod-find/llvm-debuginfod-find.cpp (+1-1) 
- (modified) llvm/tools/llvm-debuginfod/CMakeLists.txt (+1) 
- (modified) llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp (+1-1) 
- (modified) llvm/tools/llvm-objdump/CMakeLists.txt (+1) 
- (modified) llvm/tools/llvm-objdump/llvm-objdump.cpp (+1-1) 
- (modified) llvm/tools/llvm-profdata/CMakeLists.txt (+1) 
- (modified) llvm/tools/llvm-profdata/llvm-profdata.cpp (+1-1) 
- (modified) llvm/tools/llvm-symbolizer/CMakeLists.txt (+1) 
- (modified) llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp (+1-1) 
- (modified) llvm/unittests/Debuginfod/CMakeLists.txt (+1-1) 
- (modified) llvm/unittests/Debuginfod/DebuginfodTests.cpp (+2-2) 
- (modified) llvm/unittests/Support/CMakeLists.txt (+1) 
- (added) llvm/unittests/Support/HTTP/CMakeLists.txt (+8) 
- (renamed) llvm/unittests/Support/HTTP/HTTPServerTests.cpp (+12-12) 


``````````diff
diff --git a/lldb/source/Plugins/SymbolLocator/Debuginfod/CMakeLists.txt b/lldb/source/Plugins/SymbolLocator/Debuginfod/CMakeLists.txt
index f07e93e131376..4fd27e4f4b49f 100644
--- a/lldb/source/Plugins/SymbolLocator/Debuginfod/CMakeLists.txt
+++ b/lldb/source/Plugins/SymbolLocator/Debuginfod/CMakeLists.txt
@@ -14,6 +14,7 @@ add_lldb_library(lldbPluginSymbolLocatorDebuginfod PLUGIN
     lldbHost
     lldbSymbol
     LLVMDebuginfod
+    LLVMSupportHTTP
   )
 
 add_dependencies(lldbPluginSymbolLocatorDebuginfod
diff --git a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
index a09bb356e3a8c..14f5a6cbc8fa8 100644
--- a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
+++ b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
@@ -15,7 +15,7 @@
 #include "lldb/Utility/Log.h"
 
 #include "llvm/Debuginfod/Debuginfod.h"
-#include "llvm/Debuginfod/HTTPClient.h"
+#include "llvm/Support/HTTP/HTTPClient.h"
 
 using namespace lldb;
 using namespace lldb_private;
diff --git a/llvm/include/llvm/Debuginfod/Debuginfod.h b/llvm/include/llvm/Debuginfod/Debuginfod.h
index 99fe15ad85979..0bdb5d3ce3882 100644
--- a/llvm/include/llvm/Debuginfod/Debuginfod.h
+++ b/llvm/include/llvm/Debuginfod/Debuginfod.h
@@ -20,12 +20,11 @@
 #ifndef LLVM_DEBUGINFOD_DEBUGINFOD_H
 #define LLVM_DEBUGINFOD_DEBUGINFOD_H
 
-#include "HTTPServer.h"
-
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Object/BuildID.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/HTTP/HTTPServer.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Mutex.h"
 #include "llvm/Support/RWMutex.h"
diff --git a/llvm/include/llvm/Debuginfod/HTTPClient.h b/llvm/include/llvm/Support/HTTP/HTTPClient.h
similarity index 92%
rename from llvm/include/llvm/Debuginfod/HTTPClient.h
rename to llvm/include/llvm/Support/HTTP/HTTPClient.h
index 6ded55502f055..aa4727ad33024 100644
--- a/llvm/include/llvm/Debuginfod/HTTPClient.h
+++ b/llvm/include/llvm/Support/HTTP/HTTPClient.h
@@ -1,4 +1,4 @@
-//===-- llvm/Support/HTTPClient.h - HTTP client library ---------*- C++ -*-===//
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -12,8 +12,8 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_DEBUGINFOD_HTTPCLIENT_H
-#define LLVM_DEBUGINFOD_HTTPCLIENT_H
+#ifndef LLVM_SUPPORT_HTTP_HTTPCLIENT_H
+#define LLVM_SUPPORT_HTTP_HTTPCLIENT_H
 
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
@@ -85,4 +85,4 @@ class HTTPClient {
 
 } // end namespace llvm
 
-#endif // LLVM_DEBUGINFOD_HTTPCLIENT_H
+#endif // LLVM_SUPPORT_HTTP_HTTPCLIENT_H
diff --git a/llvm/include/llvm/Debuginfod/HTTPServer.h b/llvm/include/llvm/Support/HTTP/HTTPServer.h
similarity index 95%
rename from llvm/include/llvm/Debuginfod/HTTPServer.h
rename to llvm/include/llvm/Support/HTTP/HTTPServer.h
index c200089200ab7..101ca0e6fbd6b 100644
--- a/llvm/include/llvm/Debuginfod/HTTPServer.h
+++ b/llvm/include/llvm/Support/HTTP/HTTPServer.h
@@ -1,4 +1,4 @@
-//===-- llvm/Debuginfod/HTTPServer.h - HTTP server library ------*- C++ -*-===//
+//===--- HTTPServer.h - HTTP server library ---------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -13,8 +13,8 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_DEBUGINFOD_HTTPSERVER_H
-#define LLVM_DEBUGINFOD_HTTPSERVER_H
+#ifndef LLVM_SUPPORT_HTTP_HTTPSERVER_H
+#define LLVM_SUPPORT_HTTP_HTTPSERVER_H
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
@@ -130,4 +130,4 @@ class HTTPServer {
 };
 } // end namespace llvm
 
-#endif // LLVM_DEBUGINFOD_HTTPSERVER_H
+#endif // LLVM_SUPPORT_HTTP_HTTPSERVER_H
diff --git a/llvm/lib/Debuginfod/CMakeLists.txt b/llvm/lib/Debuginfod/CMakeLists.txt
index b1329bd2d077e..c31481cc97f08 100644
--- a/llvm/lib/Debuginfod/CMakeLists.txt
+++ b/llvm/lib/Debuginfod/CMakeLists.txt
@@ -1,13 +1,3 @@
-# Link LibCURL if the user wants it
-if (LLVM_ENABLE_CURL)
-  set(imported_libs CURL::libcurl)
-endif()
-
-# Link cpp-httplib if the user wants it
-if (LLVM_ENABLE_HTTPLIB)
-  set(imported_libs ${imported_libs} httplib::httplib)
-endif()
-
 # Make sure pthread is linked if this is a unix host
 if (CMAKE_HOST_UNIX)
   set(imported_libs ${imported_libs} ${LLVM_PTHREAD_LIB})
@@ -18,8 +8,6 @@ endif()
 add_llvm_library(LLVMDebuginfod
   BuildIDFetcher.cpp
   Debuginfod.cpp
-  HTTPClient.cpp
-  HTTPServer.cpp
 
   ADDITIONAL_HEADER_DIRS
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Debuginfod
@@ -29,6 +17,7 @@ add_llvm_library(LLVMDebuginfod
 
   LINK_COMPONENTS
   Support
+  SupportHTTP
   Symbolize
   DebugInfoDWARF
   BinaryFormat
diff --git a/llvm/lib/Debuginfod/Debuginfod.cpp b/llvm/lib/Debuginfod/Debuginfod.cpp
index 12f817c9e4bf0..6847dc092dfdb 100644
--- a/llvm/lib/Debuginfod/Debuginfod.cpp
+++ b/llvm/lib/Debuginfod/Debuginfod.cpp
@@ -27,7 +27,6 @@
 #include "llvm/BinaryFormat/Magic.h"
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
 #include "llvm/DebugInfo/Symbolize/Symbolize.h"
-#include "llvm/Debuginfod/HTTPClient.h"
 #include "llvm/Object/BuildID.h"
 #include "llvm/Object/ELFObjectFile.h"
 #include "llvm/Support/CachePruning.h"
@@ -35,6 +34,7 @@
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileUtilities.h"
+#include "llvm/Support/HTTP/HTTPClient.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/ThreadPool.h"
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index b4e39fced3853..380be042df69d 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -135,6 +135,7 @@ if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
 endif()
 
 add_subdirectory(BLAKE3)
+add_subdirectory(HTTP)
 
 add_llvm_component_library(LLVMSupport
   ABIBreak.cpp
diff --git a/llvm/lib/Support/HTTP/CMakeLists.txt b/llvm/lib/Support/HTTP/CMakeLists.txt
new file mode 100644
index 0000000000000..9bf1da8c60c88
--- /dev/null
+++ b/llvm/lib/Support/HTTP/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Link LibCURL if the user wants it
+if (LLVM_ENABLE_CURL)
+  set(imported_libs CURL::libcurl)
+endif()
+
+# Link cpp-httplib if the user wants it
+if (LLVM_ENABLE_HTTPLIB)
+  set(imported_libs ${imported_libs} httplib::httplib)
+endif()
+
+add_llvm_component_library(LLVMSupportHTTP
+  HTTPClient.cpp
+  HTTPServer.cpp
+
+  LINK_LIBS
+  ${imported_libs}
+
+  LINK_COMPONENTS
+  Support
+)
diff --git a/llvm/lib/Debuginfod/HTTPClient.cpp b/llvm/lib/Support/HTTP/HTTPClient.cpp
similarity index 95%
rename from llvm/lib/Debuginfod/HTTPClient.cpp
rename to llvm/lib/Support/HTTP/HTTPClient.cpp
index 4cca250746a59..6301f86da4086 100644
--- a/llvm/lib/Debuginfod/HTTPClient.cpp
+++ b/llvm/lib/Support/HTTP/HTTPClient.cpp
@@ -1,4 +1,4 @@
-//===-- llvm/Debuginfod/HTTPClient.cpp - HTTP client library ----*- C++ -*-===//
+//===--- HTTPClient.cpp - HTTP client library -----------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -12,11 +12,13 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Debuginfod/HTTPClient.h"
+#include "llvm/Support/HTTP/HTTPClient.h"
+
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
 #ifdef LLVM_ENABLE_CURL
 #include <curl/curl.h>
@@ -39,7 +41,7 @@ class HTTPClientCleanup {
 public:
   ~HTTPClientCleanup() { HTTPClient::cleanup(); }
 };
-static const HTTPClientCleanup Cleanup;
+ManagedStatic<HTTPClientCleanup> Cleanup;
 
 #ifdef LLVM_ENABLE_CURL
 
diff --git a/llvm/lib/Debuginfod/HTTPServer.cpp b/llvm/lib/Support/HTTP/HTTPServer.cpp
similarity index 95%
rename from llvm/lib/Debuginfod/HTTPServer.cpp
rename to llvm/lib/Support/HTTP/HTTPServer.cpp
index 1264353ce4b33..c6fd49f7ee623 100644
--- a/llvm/lib/Debuginfod/HTTPServer.cpp
+++ b/llvm/lib/Support/HTTP/HTTPServer.cpp
@@ -1,4 +1,4 @@
-//===-- llvm/Debuginfod/HTTPServer.cpp - HTTP server library -----*- C++-*-===//
+//===--- HTTPServer.cpp - HTTP server library -----------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -13,7 +13,8 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Debuginfod/HTTPServer.h"
+#include "llvm/Support/HTTP/HTTPServer.h"
+
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Errc.h"
@@ -187,12 +188,8 @@ Expected<unsigned> HTTPServer::bind(const char *HostInterface) {
   return make_error<HTTPServerError>("no httplib");
 }
 
-Error HTTPServer::listen() {
-  return make_error<HTTPServerError>("no httplib");
-}
+Error HTTPServer::listen() { return make_error<HTTPServerError>("no httplib"); }
 
-void HTTPServer::stop() {
-  llvm_unreachable("no httplib");
-}
+void HTTPServer::stop() { llvm_unreachable("no httplib"); }
 
 #endif // LLVM_ENABLE_HTTPLIB
diff --git a/llvm/tools/llvm-cov/CMakeLists.txt b/llvm/tools/llvm-cov/CMakeLists.txt
index 7acc87e08a9ef..f902469689ccd 100644
--- a/llvm/tools/llvm-cov/CMakeLists.txt
+++ b/llvm/tools/llvm-cov/CMakeLists.txt
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS
   Core
   Support
+  SupportHTTP
   Object
   Coverage
   ProfileData
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 075b4fc04e525..4be6d8d9cdaf7 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -24,13 +24,13 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Debuginfod/BuildIDFetcher.h"
 #include "llvm/Debuginfod/Debuginfod.h"
-#include "llvm/Debuginfod/HTTPClient.h"
 #include "llvm/Object/BuildID.h"
 #include "llvm/ProfileData/Coverage/CoverageMapping.h"
 #include "llvm/ProfileData/InstrProfReader.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Format.h"
+#include "llvm/Support/HTTP/HTTPClient.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
diff --git a/llvm/tools/llvm-debuginfod-find/CMakeLists.txt b/llvm/tools/llvm-debuginfod-find/CMakeLists.txt
index 39da11fcd9599..e23357008fe77 100644
--- a/llvm/tools/llvm-debuginfod-find/CMakeLists.txt
+++ b/llvm/tools/llvm-debuginfod-find/CMakeLists.txt
@@ -2,6 +2,7 @@ set(LLVM_LINK_COMPONENTS
   Option
   Object
   Support
+  SupportHTTP
   )
 set(LLVM_TARGET_DEFINITIONS Opts.td)
 tablegen(LLVM Opts.inc -gen-opt-parser-defs)
diff --git a/llvm/tools/llvm-debuginfod-find/llvm-debuginfod-find.cpp b/llvm/tools/llvm-debuginfod-find/llvm-debuginfod-find.cpp
index 934833bf6fe42..8f1b9d0f4659d 100644
--- a/llvm/tools/llvm-debuginfod-find/llvm-debuginfod-find.cpp
+++ b/llvm/tools/llvm-debuginfod-find/llvm-debuginfod-find.cpp
@@ -19,10 +19,10 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Debuginfod/BuildIDFetcher.h"
 #include "llvm/Debuginfod/Debuginfod.h"
-#include "llvm/Debuginfod/HTTPClient.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/HTTP/HTTPClient.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/LLVMDriver.h"
 
diff --git a/llvm/tools/llvm-debuginfod/CMakeLists.txt b/llvm/tools/llvm-debuginfod/CMakeLists.txt
index 6b0a1193d1b22..1bca529dcd25e 100644
--- a/llvm/tools/llvm-debuginfod/CMakeLists.txt
+++ b/llvm/tools/llvm-debuginfod/CMakeLists.txt
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS
   Option
   Support
+  SupportHTTP
   )
 set(LLVM_TARGET_DEFINITIONS Opts.td)
 tablegen(LLVM Opts.inc -gen-opt-parser-defs)
diff --git a/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp b/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
index 7b85166c1b4ae..16d95532a9edc 100644
--- a/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
+++ b/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
@@ -18,10 +18,10 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Debuginfod/Debuginfod.h"
-#include "llvm/Debuginfod/HTTPClient.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/HTTP/HTTPClient.h"
 #include "llvm/Support/LLVMDriver.h"
 #include "llvm/Support/ThreadPool.h"
 
diff --git a/llvm/tools/llvm-objdump/CMakeLists.txt b/llvm/tools/llvm-objdump/CMakeLists.txt
index 41d301cd3d77d..8283f07da36ea 100644
--- a/llvm/tools/llvm-objdump/CMakeLists.txt
+++ b/llvm/tools/llvm-objdump/CMakeLists.txt
@@ -12,6 +12,7 @@ set(LLVM_LINK_COMPONENTS
   Object
   Option
   Support
+  SupportHTTP
   Symbolize
   TargetParser
   )
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 6678ba3b205ec..ab06b4cc2bcf2 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -34,7 +34,6 @@
 #include "llvm/DebugInfo/Symbolize/Symbolize.h"
 #include "llvm/Debuginfod/BuildIDFetcher.h"
 #include "llvm/Debuginfod/Debuginfod.h"
-#include "llvm/Debuginfod/HTTPClient.h"
 #include "llvm/Demangle/Demangle.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
@@ -66,6 +65,7 @@
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Format.h"
+#include "llvm/Support/HTTP/HTTPClient.h"
 #include "llvm/Support/LLVMDriver.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/SourceMgr.h"
diff --git a/llvm/tools/llvm-profdata/CMakeLists.txt b/llvm/tools/llvm-profdata/CMakeLists.txt
index e5aa858f3d39c..eeaaa1731744d 100644
--- a/llvm/tools/llvm-profdata/CMakeLists.txt
+++ b/llvm/tools/llvm-profdata/CMakeLists.txt
@@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Object
   ProfileData
   Support
+  SupportHTTP
   )
 
 add_llvm_tool(llvm-profdata
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 74c4732ca129a..ab67d75770fee 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -14,7 +14,6 @@
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Debuginfod/HTTPClient.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/Object/Binary.h"
 #include "llvm/ProfileData/DataAccessProf.h"
@@ -35,6 +34,7 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/HTTP/HTTPClient.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/MemoryBuffer.h"
diff --git a/llvm/tools/llvm-symbolizer/CMakeLists.txt b/llvm/tools/llvm-symbolizer/CMakeLists.txt
index 6f8de1f1f4943..39937e08b7884 100644
--- a/llvm/tools/llvm-symbolizer/CMakeLists.txt
+++ b/llvm/tools/llvm-symbolizer/CMakeLists.txt
@@ -12,6 +12,7 @@ set(LLVM_LINK_COMPONENTS
   Object
   Option
   Support
+  SupportHTTP
   Symbolize
   )
 
diff --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
index 4784dafeb2948..7f7f17ef94750 100644
--- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -25,7 +25,6 @@
 #include "llvm/DebugInfo/Symbolize/Symbolize.h"
 #include "llvm/Debuginfod/BuildIDFetcher.h"
 #include "llvm/Debuginfod/Debuginfod.h"
-#include "llvm/Debuginfod/HTTPClient.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
@@ -34,6 +33,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/HTTP/HTTPClient.h"
 #include "llvm/Support/LLVMDriver.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/StringSaver.h"
diff --git a/llvm/unittests/Debuginfod/CMakeLists.txt b/llvm/unittests/Debuginfod/CMakeLists.txt
index 9b084ff33f3b7..4ac75c0720e89 100644
--- a/llvm/unittests/Debuginfod/CMakeLists.txt
+++ b/llvm/unittests/Debuginfod/CMakeLists.txt
@@ -1,9 +1,9 @@
 add_llvm_unittest(DebuginfodTests
-  HTTPServerTests.cpp
   DebuginfodTests.cpp
   )
 
 target_link_libraries(DebuginfodTests PRIVATE
   LLVMDebuginfod
+  LLVMSupportHTTP
   LLVMTestingSupport
   )
diff --git a/llvm/unittests/Debuginfod/DebuginfodTests.cpp b/llvm/unittests/Debuginfod/DebuginfodTests.cpp
index 5312912599e93..2e39484e7559f 100644
--- a/llvm/unittests/Debuginfod/DebuginfodTests.cpp
+++ b/llvm/unittests/Debuginfod/DebuginfodTests.cpp
@@ -1,4 +1,4 @@
-//===-- llvm/unittest/Support/DebuginfodTests.cpp - unit tests ------------===//
+//===--- DebuginfodTests.cpp - unit tests ---------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Debuginfod/Debuginfod.h"
-#include "llvm/Debuginfod/HTTPClient.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/HTTP/HTTPClient.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gtest/gtest.h"
diff --git a/llvm/unittests/Support/CMakeLists.txt b/llvm/unittests/Support/CMakeLists.txt
index a8bf96bbe096f..a291f17331ff3 100644
--- a/llvm/unittests/Support/CMakeLists.txt
+++ b/llvm/unittests/Support/CMakeLists.txt
@@ -128,6 +128,7 @@ add_llvm_unittest(SupportTests
   intrinsics_gen
   )
 
+add_subdirectory(HTTP)
 add_subdirectory(LSP)
 
 target_link_libraries(SupportTests PRIVATE LLVMTestingSupport)
diff --git a/llvm/unittests/Support/HTTP/CMakeLists.txt b/llvm/unittests/Support/HTTP/CMakeLists.txt
new file mode 100644
index 0000000000000..59e2393bfae06
--- /dev/null
+++ b/llvm/unittests/Support/HTTP/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_llvm_unittest(SupportHTTPTests
+  HTTPServerTests.cpp
+  )
+
+target_link_libraries(SupportHTTPTests PRIVATE
+  LLVMSupportHTTP
+  LLVMTestingSupport
+  )
diff --git a/llvm/unittests/Debuginfod/HTTPServerTests.cpp b/llvm/unittests/Support/HTTP/HTTPServerTests.cpp
similarity index 94%
rename from llvm/unittests/Debuginfod/HTTPServerTests.cpp
rename to llvm/unittests/Support/HTTP/HTTPServerTests.cpp
index cd1d5f2d9fc70..1066fdd2f7735 100644
--- a/llvm/unittests/Debuginfod/HTTPServerTests.cpp
+++ b/llvm/unittests/Support/HTTP/HTTPServerTests.cpp
@@ -1,4 +1,4 @@
-//===-- llvm/unittest/Support/HTTPServer.cpp - unit tests -------*- C++ -*-===//
+//===-- HTTPServerTests.cpp - unit tests ----------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -7,9 +7,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/Debuginfod/HTTPClient.h"
-#include "llvm/Debuginfod/HTTPServer.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/HTTP/HTTPClient.h"
+#include "llvm/Support/HTTP/HTTPServer.h"
 #include "llvm/Support/ThreadPool.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gmock/gmock.h"
@@ -237,15 +237,15 @@ TEST_F(HTTPClientServerTest, ClientTimeout) {
 TEST_F(HTTPClientServerTest, PathMatching) {
   HTTPServer Server;
 
-  EXPECT_THAT_ERROR(
-      Server.get(R"(/abc/(.*)/(.*))",
-                 [&](HTTPServerRequest &Request) {
-                   EXPECT_EQ(Request.UrlPath, "/abc/1/2");
-                   ASSERT_THAT(Request.UrlPathMatches,
-                               testing::ElementsAre("1", "2"));
-                   Request.setResponse({200u, "text/plain", Request.UrlPath});
-                 }),
-      Succeeded());
+  EXPECT_THAT_ERROR(Server.get(R"(/abc/(.*)/(.*))",
+                               [&](HTTPServerRequest &Request) {
+                  ...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/186074


More information about the lldb-commits mailing list