Skip to content

Commit 81131f3

Browse files
authored
Reverts recent debuginfod patches (#156532)
This patch reverts 44e791c, 3cc1031 and adbd432. Which breaks debuginfod build and tests when httplib is used.
1 parent 49fcfaa commit 81131f3

File tree

5 files changed

+12
-34
lines changed

5 files changed

+12
-34
lines changed

llvm/include/llvm/Debuginfod/Debuginfod.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,11 @@ class DebuginfodCollection {
152152
Expected<std::string> findBinaryPath(object::BuildIDRef);
153153
};
154154

155-
class DebuginfodServer {
156-
public:
155+
struct DebuginfodServer {
157156
HTTPServer Server;
157+
DebuginfodLog &Log;
158+
DebuginfodCollection &Collection;
158159
DebuginfodServer(DebuginfodLog &Log, DebuginfodCollection &Collection);
159-
static Expected<DebuginfodServer> create(DebuginfodLog &Log,
160-
DebuginfodCollection &Collection);
161-
162-
private:
163-
DebuginfodServer() = default;
164-
Error init(DebuginfodLog &Log, DebuginfodCollection &Collection);
165160
};
166161

167162
} // end namespace llvm

llvm/include/llvm/Debuginfod/HTTPServer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ class HTTPServer {
104104
public:
105105
HTTPServer();
106106
~HTTPServer();
107-
HTTPServer(HTTPServer &&);
108107

109108
/// Returns true only if LLVM has been compiled with a working HTTPServer.
110109
static bool isAvailable();

llvm/lib/Debuginfod/Debuginfod.cpp

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,10 @@ Expected<std::string> DebuginfodCollection::findDebugBinaryPath(BuildIDRef ID) {
567567
return getCachedOrDownloadDebuginfo(ID);
568568
}
569569

570-
Error DebuginfodServer::init(DebuginfodLog &Log,
571-
DebuginfodCollection &Collection) {
572-
573-
Error Err =
570+
DebuginfodServer::DebuginfodServer(DebuginfodLog &Log,
571+
DebuginfodCollection &Collection)
572+
: Log(Log), Collection(Collection) {
573+
cantFail(
574574
Server.get(R"(/buildid/(.*)/debuginfo)", [&](HTTPServerRequest Request) {
575575
Log.push("GET " + Request.UrlPath);
576576
std::string IDString;
@@ -587,11 +587,8 @@ Error DebuginfodServer::init(DebuginfodLog &Log,
587587
return;
588588
}
589589
streamFile(Request, *PathOrErr);
590-
});
591-
if (Err)
592-
return Err;
593-
594-
Err =
590+
}));
591+
cantFail(
595592
Server.get(R"(/buildid/(.*)/executable)", [&](HTTPServerRequest Request) {
596593
Log.push("GET " + Request.UrlPath);
597594
std::string IDString;
@@ -608,18 +605,7 @@ Error DebuginfodServer::init(DebuginfodLog &Log,
608605
return;
609606
}
610607
streamFile(Request, *PathOrErr);
611-
});
612-
if (Err)
613-
return Err;
614-
return Error::success();
615-
}
616-
617-
Expected<DebuginfodServer>
618-
DebuginfodServer::create(DebuginfodLog &Log, DebuginfodCollection &Collection) {
619-
DebuginfodServer Serverd;
620-
if (llvm::Error Err = Serverd.init(Log, Collection))
621-
return std::move(Err);
622-
return std::move(Serverd);
608+
}));
623609
}
624610

625611
} // namespace llvm

llvm/lib/Debuginfod/HTTPServer.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ bool llvm::streamFile(HTTPServerRequest &Request, StringRef FilePath) {
6262
return true;
6363
}
6464

65-
HTTPServer::HTTPServer(HTTPServer &&) = default;
66-
6765
#ifdef LLVM_ENABLE_HTTPLIB
6866

6967
bool HTTPServer::isAvailable() { return true; }

llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ int llvm_debuginfod_main(int argc, char **argv, const llvm::ToolContext &) {
131131
DefaultThreadPool Pool(hardware_concurrency(MaxConcurrency));
132132
DebuginfodLog Log;
133133
DebuginfodCollection Collection(Paths, Log, Pool, MinInterval);
134-
DebuginfodServer Server =
135-
ExitOnErr(DebuginfodServer::create(Log, Collection));
134+
DebuginfodServer Server(Log, Collection);
135+
136136
if (!Port)
137137
Port = ExitOnErr(Server.Server.bind(HostInterface.c_str()));
138138
else

0 commit comments

Comments
 (0)