@@ -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
0 commit comments