Skip to content

Commit 9f9e906

Browse files
committed
[embedded] Detect WMO via .hasPrimaryInputs() instead of -wmo flag presense
1 parent 544ee14 commit 9f9e906

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,11 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
13271327
Diags.diagnose(SourceLoc(), diag::evolution_with_embedded);
13281328
HadError = true;
13291329
}
1330+
1331+
if (FrontendOpts.InputsAndOutputs.hasPrimaryInputs()) {
1332+
Diags.diagnose(SourceLoc(), diag::wmo_with_embedded);
1333+
HadError = true;
1334+
}
13301335
}
13311336

13321337
if (auto A = Args.getLastArg(OPT_checked_async_objc_bridging)) {
@@ -1344,15 +1349,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
13441349
}
13451350
}
13461351

1347-
// Is this the correct way to query for WMO?
1348-
bool isWMO =
1349-
Args.hasArg(OPT_wmo) ||
1350-
Args.hasArg(OPT_whole_module_optimization);
1351-
if (!isWMO && Opts.hasFeature(Feature::Embedded)) {
1352-
Diags.diagnose(SourceLoc(), diag::wmo_with_embedded);
1353-
HadError = true;
1354-
}
1355-
13561352
return HadError || UnsupportedOS || UnsupportedArch;
13571353
}
13581354

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
// RUN: not %target-swift-frontend -emit-ir %s -enable-experimental-feature Embedded 2>&1 | %FileCheck %s
1+
// RUN: %target-swift-frontend -typecheck -parse-stdlib %s -enable-experimental-feature Embedded
2+
// RUN: not %target-swift-frontend -typecheck -parse-stdlib %s -primary-file %s -enable-experimental-feature Embedded 2>&1 | %FileCheck %s
3+
4+
// RUN: %target-swiftc_driver -typecheck -parse-stdlib %s -enable-experimental-feature Embedded -wmo
5+
// RUN: not %target-swiftc_driver -typecheck -parse-stdlib %s -enable-experimental-feature Embedded 2>&1 | %FileCheck %s
26

37
// CHECK: error: Whole module optimization (wmo) must be enabled with embedded Swift.

0 commit comments

Comments
 (0)