Skip to content

Commit 0f6d97e

Browse files
[llvm-jitlink-executor] Drop else block after noreturn-if (NFC)
1 parent c09e690 commit 0f6d97e

File tree

1 file changed

+31
-34
lines changed

1 file changed

+31
-34
lines changed

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

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -159,51 +159,48 @@ int main(int argc, char *argv[]) {
159159
int InFD = 0;
160160
int OutFD = 0;
161161

162-
std::vector<StringRef> TestOutputFlags;
163-
164162
if (argc < 2)
165163
printErrorAndExit("insufficient arguments");
166-
else {
167-
StringRef ConnectArg = argv[FirstProgramArg++];
164+
165+
StringRef NextArg = argv[FirstProgramArg++];
168166
#ifndef NDEBUG
169-
if (ConnectArg == "debug") {
170-
DebugFlag = true;
171-
ConnectArg = argv[FirstProgramArg++];
172-
}
167+
if (NextArg == "debug") {
168+
DebugFlag = true;
169+
NextArg = argv[FirstProgramArg++];
170+
}
173171
#endif
174172

175-
while (ConnectArg.starts_with("test-")) {
176-
TestOutputFlags.push_back(ConnectArg);
177-
ConnectArg = argv[FirstProgramArg++];
178-
}
179-
180-
StringRef SpecifierType, Specifier;
181-
std::tie(SpecifierType, Specifier) = ConnectArg.split('=');
182-
if (SpecifierType == "filedescs") {
183-
StringRef FD1Str, FD2Str;
184-
std::tie(FD1Str, FD2Str) = Specifier.split(',');
185-
if (FD1Str.getAsInteger(10, InFD))
186-
printErrorAndExit(FD1Str + " is not a valid file descriptor");
187-
if (FD2Str.getAsInteger(10, OutFD))
188-
printErrorAndExit(FD2Str + " is not a valid file descriptor");
189-
} else if (SpecifierType == "listen") {
190-
StringRef Host, PortStr;
191-
std::tie(Host, PortStr) = Specifier.split(':');
192-
193-
int Port = 0;
194-
if (PortStr.getAsInteger(10, Port))
195-
printErrorAndExit("port number '" + PortStr +
196-
"' is not a valid integer");
197-
198-
InFD = OutFD = openListener(Host.str(), PortStr.str());
199-
} else
200-
printErrorAndExit("invalid specifier type \"" + SpecifierType + "\"");
173+
std::vector<StringRef> TestOutputFlags;
174+
while (NextArg.starts_with("test-")) {
175+
TestOutputFlags.push_back(NextArg);
176+
NextArg = argv[FirstProgramArg++];
201177
}
202178

203179
if (llvm::is_contained(TestOutputFlags, "test-jitloadergdb"))
204180
fprintf(stderr, "__jit_debug_descriptor.last_entry = 0x%016" PRIx64 "\n",
205181
pointerToJITTargetAddress(findLastDebugDescriptorEntryPtr()));
206182

183+
StringRef SpecifierType, Specifier;
184+
std::tie(SpecifierType, Specifier) = NextArg.split('=');
185+
if (SpecifierType == "filedescs") {
186+
StringRef FD1Str, FD2Str;
187+
std::tie(FD1Str, FD2Str) = Specifier.split(',');
188+
if (FD1Str.getAsInteger(10, InFD))
189+
printErrorAndExit(FD1Str + " is not a valid file descriptor");
190+
if (FD2Str.getAsInteger(10, OutFD))
191+
printErrorAndExit(FD2Str + " is not a valid file descriptor");
192+
} else if (SpecifierType == "listen") {
193+
StringRef Host, PortStr;
194+
std::tie(Host, PortStr) = Specifier.split(':');
195+
196+
int Port = 0;
197+
if (PortStr.getAsInteger(10, Port))
198+
printErrorAndExit("port number '" + PortStr + "' is not a valid integer");
199+
200+
InFD = OutFD = openListener(Host.str(), PortStr.str());
201+
} else
202+
printErrorAndExit("invalid specifier type \"" + SpecifierType + "\"");
203+
207204
auto Server =
208205
ExitOnErr(SimpleRemoteEPCServer::Create<FDSimpleRemoteEPCTransport>(
209206
[](SimpleRemoteEPCServer::Setup &S) -> Error {

0 commit comments

Comments
 (0)