Skip to content

Commit 9aa8bd0

Browse files
committed
Revert back to only ignoring -wmo
Ignoring both `-wmo` and `-index-file` will be harder than just `-wmo`. This is because when calling the compiler and passing `-index-file` after `-dump-ast`, the option gets un-ignored by `Driver::buildOutputInfo`. Therefore, we will just ignore `-wmo` for now.
1 parent 7088ff7 commit 9aa8bd0

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

include/swift/AST/DiagnosticsDriver.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ WARNING(warn_opt_remark_disabled, none,
166166
WARNING(warn_ignoring_batch_mode,none,
167167
"ignoring '-enable-batch-mode' because '%0' was also specified", (StringRef))
168168

169-
WARNING(warn_ignoring_single_compile, none,
170-
"ignoring '%0' because '-dump-ast' was also specified", (StringRef))
169+
WARNING(warn_ignoring_wmo, none,
170+
"ignoring '-wmo' because '-dump-ast' was also specified", ())
171171

172172
WARNING(warn_ignoring_source_range_dependencies,none,
173173
"ignoring '-enable-source-range-dependencies' because '%0' was also specified", (StringRef))

lib/Driver/Driver.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,13 +1758,14 @@ Driver::computeCompilerMode(const DerivedArgList &Args,
17581758
const Arg *ArgRequiringSinglePrimaryCompile =
17591759
Args.getLastArg(options::OPT_enable_source_range_dependencies);
17601760

1761-
// AST dump doesn't work with `-wmo` or `-index-file`. Since it's not common
1762-
// to want to dump the AST, we assume that's the priority and ignore the
1763-
// conflicting option, but we warn the user about this decision.
1764-
if (ArgRequiringSingleCompile &&
1761+
// AST dump doesn't work with `-wmo`. Since it's not common to want to dump
1762+
// the AST, we assume that's the priority and ignore `-wmo`, but we warn the
1763+
// user about this decision.
1764+
// FIXME: AST dump also doesn't work with `-index-file`, but that fix is a bit
1765+
// more complicated than this.
1766+
if (Args.hasArg(options::OPT_whole_module_optimization) &&
17651767
Args.hasArg(options::OPT_dump_ast)) {
1766-
Diags.diagnose(SourceLoc(), diag::warn_ignoring_single_compile,
1767-
ArgRequiringSingleCompile->getOption().getPrefixedName());
1768+
Diags.diagnose(SourceLoc(), diag::warn_ignoring_wmo);
17681769
return OutputInfo::Mode::StandardCompile;
17691770
}
17701771

0 commit comments

Comments
 (0)