Skip to content

Commit a93c17c

Browse files
[llvm-jitlink-executor] Drop else block after noreturn-if (NFC) (#76689)
NFC follow-up from #76236
1 parent 3ae3e40 commit a93c17c

File tree

1 file changed

+33
-36
lines changed

1 file changed

+33
-36
lines changed

llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ void printErrorAndExit(Twine ErrMsg) {
5454
errs() << "error: " << ErrMsg.str() << "\n\n"
5555
<< "Usage:\n"
5656
<< " llvm-jitlink-executor " << DebugOption
57-
<< "filedescs=<infd>,<outfd> [args...]\n"
57+
<< "[test-jitloadergdb] filedescs=<infd>,<outfd> [args...]\n"
5858
<< " llvm-jitlink-executor " << DebugOption
59-
<< "listen=<host>:<port> [args...]\n";
59+
<< "[test-jitloadergdb] listen=<host>:<port> [args...]\n";
6060
exit(1);
6161
}
6262

@@ -132,51 +132,48 @@ int main(int argc, char *argv[]) {
132132
int InFD = 0;
133133
int OutFD = 0;
134134

135-
std::vector<StringRef> TestOutputFlags;
136-
137135
if (argc < 2)
138136
printErrorAndExit("insufficient arguments");
139-
else {
140-
StringRef ConnectArg = argv[FirstProgramArg++];
137+
138+
StringRef NextArg = argv[FirstProgramArg++];
141139
#ifndef NDEBUG
142-
if (ConnectArg == "debug") {
143-
DebugFlag = true;
144-
ConnectArg = argv[FirstProgramArg++];
145-
}
140+
if (NextArg == "debug") {
141+
DebugFlag = true;
142+
NextArg = argv[FirstProgramArg++];
143+
}
146144
#endif
147145

148-
while (ConnectArg.starts_with("test-")) {
149-
TestOutputFlags.push_back(ConnectArg);
150-
ConnectArg = argv[FirstProgramArg++];
151-
}
152-
153-
StringRef SpecifierType, Specifier;
154-
std::tie(SpecifierType, Specifier) = ConnectArg.split('=');
155-
if (SpecifierType == "filedescs") {
156-
StringRef FD1Str, FD2Str;
157-
std::tie(FD1Str, FD2Str) = Specifier.split(',');
158-
if (FD1Str.getAsInteger(10, InFD))
159-
printErrorAndExit(FD1Str + " is not a valid file descriptor");
160-
if (FD2Str.getAsInteger(10, OutFD))
161-
printErrorAndExit(FD2Str + " is not a valid file descriptor");
162-
} else if (SpecifierType == "listen") {
163-
StringRef Host, PortStr;
164-
std::tie(Host, PortStr) = Specifier.split(':');
165-
166-
int Port = 0;
167-
if (PortStr.getAsInteger(10, Port))
168-
printErrorAndExit("port number '" + PortStr +
169-
"' is not a valid integer");
170-
171-
InFD = OutFD = openListener(Host.str(), PortStr.str());
172-
} else
173-
printErrorAndExit("invalid specifier type \"" + SpecifierType + "\"");
146+
std::vector<StringRef> TestOutputFlags;
147+
while (NextArg.starts_with("test-")) {
148+
TestOutputFlags.push_back(NextArg);
149+
NextArg = argv[FirstProgramArg++];
174150
}
175151

176152
if (llvm::is_contained(TestOutputFlags, "test-jitloadergdb"))
177153
fprintf(stderr, "__jit_debug_descriptor.last_entry = 0x%016" PRIx64 "\n",
178154
pointerToJITTargetAddress(findLastDebugDescriptorEntryPtr()));
179155

156+
StringRef SpecifierType, Specifier;
157+
std::tie(SpecifierType, Specifier) = NextArg.split('=');
158+
if (SpecifierType == "filedescs") {
159+
StringRef FD1Str, FD2Str;
160+
std::tie(FD1Str, FD2Str) = Specifier.split(',');
161+
if (FD1Str.getAsInteger(10, InFD))
162+
printErrorAndExit(FD1Str + " is not a valid file descriptor");
163+
if (FD2Str.getAsInteger(10, OutFD))
164+
printErrorAndExit(FD2Str + " is not a valid file descriptor");
165+
} else if (SpecifierType == "listen") {
166+
StringRef Host, PortStr;
167+
std::tie(Host, PortStr) = Specifier.split(':');
168+
169+
int Port = 0;
170+
if (PortStr.getAsInteger(10, Port))
171+
printErrorAndExit("port number '" + PortStr + "' is not a valid integer");
172+
173+
InFD = OutFD = openListener(Host.str(), PortStr.str());
174+
} else
175+
printErrorAndExit("invalid specifier type \"" + SpecifierType + "\"");
176+
180177
auto Server =
181178
ExitOnErr(SimpleRemoteEPCServer::Create<FDSimpleRemoteEPCTransport>(
182179
[](SimpleRemoteEPCServer::Setup &S) -> Error {

0 commit comments

Comments
 (0)