From a93c17c9ab7aa7b394313898e0db7aae6adeeaa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Wed, 3 Jan 2024 15:12:31 +0100 Subject: [llvm-jitlink-executor] Drop else block after noreturn-if (NFC) (#76689) NFC follow-up from https://github.com/llvm/llvm-project/pull/76236 --- .../llvm-jitlink-executor.cpp | 69 +++++++++++----------- 1 file changed, 33 insertions(+), 36 deletions(-) (limited to 'llvm/tools/llvm-jitlink') diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp index 034c43f..20205ee 100644 --- a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp +++ b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp @@ -54,9 +54,9 @@ void printErrorAndExit(Twine ErrMsg) { errs() << "error: " << ErrMsg.str() << "\n\n" << "Usage:\n" << " llvm-jitlink-executor " << DebugOption - << "filedescs=, [args...]\n" + << "[test-jitloadergdb] filedescs=, [args...]\n" << " llvm-jitlink-executor " << DebugOption - << "listen=: [args...]\n"; + << "[test-jitloadergdb] listen=: [args...]\n"; exit(1); } @@ -132,51 +132,48 @@ int main(int argc, char *argv[]) { int InFD = 0; int OutFD = 0; - std::vector TestOutputFlags; - if (argc < 2) printErrorAndExit("insufficient arguments"); - else { - StringRef ConnectArg = argv[FirstProgramArg++]; + + StringRef NextArg = argv[FirstProgramArg++]; #ifndef NDEBUG - if (ConnectArg == "debug") { - DebugFlag = true; - ConnectArg = argv[FirstProgramArg++]; - } + if (NextArg == "debug") { + DebugFlag = true; + NextArg = argv[FirstProgramArg++]; + } #endif - while (ConnectArg.starts_with("test-")) { - TestOutputFlags.push_back(ConnectArg); - ConnectArg = argv[FirstProgramArg++]; - } - - StringRef SpecifierType, Specifier; - std::tie(SpecifierType, Specifier) = ConnectArg.split('='); - if (SpecifierType == "filedescs") { - StringRef FD1Str, FD2Str; - std::tie(FD1Str, FD2Str) = Specifier.split(','); - if (FD1Str.getAsInteger(10, InFD)) - printErrorAndExit(FD1Str + " is not a valid file descriptor"); - if (FD2Str.getAsInteger(10, OutFD)) - printErrorAndExit(FD2Str + " is not a valid file descriptor"); - } else if (SpecifierType == "listen") { - StringRef Host, PortStr; - std::tie(Host, PortStr) = Specifier.split(':'); - - int Port = 0; - if (PortStr.getAsInteger(10, Port)) - printErrorAndExit("port number '" + PortStr + - "' is not a valid integer"); - - InFD = OutFD = openListener(Host.str(), PortStr.str()); - } else - printErrorAndExit("invalid specifier type \"" + SpecifierType + "\""); + std::vector TestOutputFlags; + while (NextArg.starts_with("test-")) { + TestOutputFlags.push_back(NextArg); + NextArg = argv[FirstProgramArg++]; } if (llvm::is_contained(TestOutputFlags, "test-jitloadergdb")) fprintf(stderr, "__jit_debug_descriptor.last_entry = 0x%016" PRIx64 "\n", pointerToJITTargetAddress(findLastDebugDescriptorEntryPtr())); + StringRef SpecifierType, Specifier; + std::tie(SpecifierType, Specifier) = NextArg.split('='); + if (SpecifierType == "filedescs") { + StringRef FD1Str, FD2Str; + std::tie(FD1Str, FD2Str) = Specifier.split(','); + if (FD1Str.getAsInteger(10, InFD)) + printErrorAndExit(FD1Str + " is not a valid file descriptor"); + if (FD2Str.getAsInteger(10, OutFD)) + printErrorAndExit(FD2Str + " is not a valid file descriptor"); + } else if (SpecifierType == "listen") { + StringRef Host, PortStr; + std::tie(Host, PortStr) = Specifier.split(':'); + + int Port = 0; + if (PortStr.getAsInteger(10, Port)) + printErrorAndExit("port number '" + PortStr + "' is not a valid integer"); + + InFD = OutFD = openListener(Host.str(), PortStr.str()); + } else + printErrorAndExit("invalid specifier type \"" + SpecifierType + "\""); + auto Server = ExitOnErr(SimpleRemoteEPCServer::Create( [](SimpleRemoteEPCServer::Setup &S) -> Error { -- cgit v1.1