[llvm] d9941f7 - [Support] [Debuginfod] Move HTTPClient to Debuginfod library.

Noah Shutty via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 6 17:26:03 PST 2021


Author: Noah Shutty
Date: 2021-12-07T01:19:21Z
New Revision: d9941f74549a2e7f21112eecef349b123afc6213

URL: https://github.com/llvm/llvm-project/commit/d9941f74549a2e7f21112eecef349b123afc6213
DIFF: https://github.com/llvm/llvm-project/commit/d9941f74549a2e7f21112eecef349b123afc6213.diff

LOG: [Support] [Debuginfod] Move HTTPClient to Debuginfod library.

Following the discussion in D112753, this moves the HTTPClient from Support to Debuginfod library so that tools depending on Support do not automatically depend on Curl as well. This also removes `HTTPClient::initialize()` and `HTTPClient::cleanup()` from `InitLLVM` so these steps should be implemented by user tools instead.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D115131

Added: 
    llvm/include/llvm/Debuginfod/HTTPClient.h
    llvm/lib/Debuginfod/HTTPClient.cpp
    llvm/unittests/Debuginfod/HTTPClientTests.cpp

Modified: 
    llvm/lib/Debuginfod/CMakeLists.txt
    llvm/lib/Debuginfod/Debuginfod.cpp
    llvm/lib/Support/CMakeLists.txt
    llvm/lib/Support/InitLLVM.cpp
    llvm/unittests/Debuginfod/CMakeLists.txt
    llvm/unittests/Debuginfod/DebuginfodTests.cpp
    llvm/unittests/Support/CMakeLists.txt

Removed: 
    llvm/include/llvm/Support/HTTPClient.h
    llvm/lib/Support/HTTPClient.cpp
    llvm/unittests/Support/HTTPClient.cpp


################################################################################
diff  --git a/llvm/include/llvm/Support/HTTPClient.h b/llvm/include/llvm/Debuginfod/HTTPClient.h
similarity index 100%
rename from llvm/include/llvm/Support/HTTPClient.h
rename to llvm/include/llvm/Debuginfod/HTTPClient.h

diff  --git a/llvm/lib/Debuginfod/CMakeLists.txt b/llvm/lib/Debuginfod/CMakeLists.txt
index 96dc8c33cc4bc..e2c43e61c39f4 100644
--- a/llvm/lib/Debuginfod/CMakeLists.txt
+++ b/llvm/lib/Debuginfod/CMakeLists.txt
@@ -1,9 +1,20 @@
+# Link LibCURL if the user wants it
+if (LLVM_ENABLE_CURL)
+  set(imported_libs ${CURL_LIBRARIES})
+endif()
+
 add_llvm_component_library(LLVMDebuginfod
   Debuginfod.cpp
+  HTTPClient.cpp
 
   ADDITIONAL_HEADER_DIRS
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Debuginfod
 
+  LINK_LIBS
+  ${imported_libs}
+
   LINK_COMPONENTS
   Support
   )
+
+set(llvm_system_libs ${system_libs})

diff  --git a/llvm/lib/Debuginfod/Debuginfod.cpp b/llvm/lib/Debuginfod/Debuginfod.cpp
index b798c165e331f..eafd9d2eeda7e 100644
--- a/llvm/lib/Debuginfod/Debuginfod.cpp
+++ b/llvm/lib/Debuginfod/Debuginfod.cpp
@@ -18,11 +18,11 @@
 
 #include "llvm/Debuginfod/Debuginfod.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Debuginfod/HTTPClient.h"
 #include "llvm/Support/CachePruning.h"
 #include "llvm/Support/Caching.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileUtilities.h"
-#include "llvm/Support/HTTPClient.h"
 #include "llvm/Support/xxhash.h"
 
 namespace llvm {

diff  --git a/llvm/lib/Support/HTTPClient.cpp b/llvm/lib/Debuginfod/HTTPClient.cpp
similarity index 98%
rename from llvm/lib/Support/HTTPClient.cpp
rename to llvm/lib/Debuginfod/HTTPClient.cpp
index 52178e054f686..5ba51502b34c2 100644
--- a/llvm/lib/Support/HTTPClient.cpp
+++ b/llvm/lib/Debuginfod/HTTPClient.cpp
@@ -1,4 +1,4 @@
-//===-- llvm/Support/HTTPClient.cpp - HTTP client library -------*- C++ -*-===//
+//===-- llvm/Debuginfod/HTTPClient.cpp - 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.
@@ -13,7 +13,7 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Support/HTTPClient.h"
+#include "llvm/Debuginfod/HTTPClient.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Errc.h"

diff  --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 7e9fdd047f65b..4d9099554192d 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -74,11 +74,6 @@ if(LLVM_WITH_Z3)
   set(system_libs ${system_libs} ${Z3_LIBRARIES})
 endif()
 
-# Link LibCURL if the user wants it
-if (LLVM_ENABLE_CURL)
-  set(system_libs ${system_libs} ${CURL_LIBRARIES})
-endif()
-
 # Override the C runtime allocator on Windows and embed it into LLVM tools & libraries
 if(LLVM_INTEGRATED_CRT_ALLOC)
   if (CMAKE_BUILD_TYPE AND NOT ${LLVM_USE_CRT_${uppercase_CMAKE_BUILD_TYPE}} MATCHES "^(MT|MTd)$")
@@ -160,7 +155,6 @@ add_llvm_component_library(LLVMSupport
   GlobPattern.cpp
   GraphWriter.cpp
   Hashing.cpp
-  HTTPClient.cpp
   InitLLVM.cpp
   InstructionCost.cpp
   IntEqClasses.cpp

diff  --git a/llvm/lib/Support/InitLLVM.cpp b/llvm/lib/Support/InitLLVM.cpp
index 8a0068feeadac..152de6ebae0ac 100644
--- a/llvm/lib/Support/InitLLVM.cpp
+++ b/llvm/lib/Support/InitLLVM.cpp
@@ -8,7 +8,6 @@
 
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Error.h"
-#include "llvm/Support/HTTPClient.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Process.h"
@@ -59,11 +58,6 @@ InitLLVM::InitLLVM(int &Argc, const char **&Argv,
   Argc = Args.size() - 1;
   Argv = Args.data();
 #endif
-
-  HTTPClient::initialize();
 }
 
-InitLLVM::~InitLLVM() {
-  HTTPClient::cleanup();
-  llvm_shutdown();
-}
+InitLLVM::~InitLLVM() { llvm_shutdown(); }

diff  --git a/llvm/unittests/Debuginfod/CMakeLists.txt b/llvm/unittests/Debuginfod/CMakeLists.txt
index 439a48a448528..967ea79bbf5c7 100644
--- a/llvm/unittests/Debuginfod/CMakeLists.txt
+++ b/llvm/unittests/Debuginfod/CMakeLists.txt
@@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS
   )
 
 add_llvm_unittest(DebuginfodTests
+  HTTPClientTests.cpp
   DebuginfodTests.cpp
   )
 

diff  --git a/llvm/unittests/Debuginfod/DebuginfodTests.cpp b/llvm/unittests/Debuginfod/DebuginfodTests.cpp
index 5e58e3005b720..4a69fcc8039f8 100644
--- a/llvm/unittests/Debuginfod/DebuginfodTests.cpp
+++ b/llvm/unittests/Debuginfod/DebuginfodTests.cpp
@@ -1,4 +1,4 @@
-//===-- llvm/unittest/Support/DebuginfodTests.cpp - unit tests --*- C++ -*-===//
+//===-- llvm/unittest/Support/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/HTTPClient.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gtest/gtest.h"

diff  --git a/llvm/unittests/Support/HTTPClient.cpp b/llvm/unittests/Debuginfod/HTTPClientTests.cpp
similarity index 96%
rename from llvm/unittests/Support/HTTPClient.cpp
rename to llvm/unittests/Debuginfod/HTTPClientTests.cpp
index e4f965bb463c3..7f7d201064a8a 100644
--- a/llvm/unittests/Support/HTTPClient.cpp
+++ b/llvm/unittests/Debuginfod/HTTPClientTests.cpp
@@ -1,4 +1,4 @@
-//===-- llvm/unittest/Support/HTTPClient.cpp - unit tests -------*- C++ -*-===//
+//===-- llvm/unittest/Debuginfod/HTTPClientTests.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.
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Support/HTTPClient.h"
+#include "llvm/Debuginfod/HTTPClient.h"
 #include "llvm/Support/Errc.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 e3a57c9dbfc7a..d331d1b4b187a 100644
--- a/llvm/unittests/Support/CMakeLists.txt
+++ b/llvm/unittests/Support/CMakeLists.txt
@@ -41,7 +41,6 @@ add_llvm_unittest(SupportTests
   GlobPatternTest.cpp
   HashBuilderTest.cpp
   Host.cpp
-  HTTPClient.cpp
   IndexedAccessorTest.cpp
   InstructionCostTest.cpp
   ItaniumManglingCanonicalizerTest.cpp


        


More information about the llvm-commits mailing list