Skip to content

Commit 7162692

Browse files
committed
Swift: exit directly on actions not requiring extraction
1 parent 4a41bb4 commit 7162692

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

swift/extractor/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static void lockOutputSwiftModuleTraps(const codeql::SwiftExtractorConfiguration
3030
}
3131
}
3232

33-
static void modifyFrontendOptions(swift::FrontendOptions& options) {
33+
static void processFrontendOptions(swift::FrontendOptions& options) {
3434
using Action = swift::FrontendOptions::ActionType;
3535
switch (options.RequestedAction) {
3636
case Action::EmitModuleOnly:
@@ -58,9 +58,9 @@ static void modifyFrontendOptions(swift::FrontendOptions& options) {
5858
// version printing is used by CI to match up the correct compiler version
5959
return;
6060
default:
61-
// otherwise, do nothing (the closest action to doing nothing is printing the version)
62-
options.RequestedAction = Action::PrintVersion;
63-
break;
61+
// otherwise, we have nothing to do
62+
std::cerr << "Frontend action requires no action from extractor, exiting\n";
63+
std::exit(0);
6464
}
6565
}
6666

@@ -74,7 +74,7 @@ class Observer : public swift::FrontendObserver {
7474
: config{config}, diagConsumer{diagConsumer} {}
7575

7676
void parsedArgs(swift::CompilerInvocation& invocation) override {
77-
modifyFrontendOptions(invocation.getFrontendOptions());
77+
processFrontendOptions(invocation.getFrontendOptions());
7878
}
7979

8080
void configuredCompiler(swift::CompilerInstance& instance) override {

0 commit comments

Comments
 (0)