Skip to content

Commit ba2e0fe

Browse files
committed
[dsymutil] Add option to include swiftmodules built from interface
1 parent 263377a commit ba2e0fe

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

llvm/tools/dsymutil/DwarfLinkerForBinary.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,9 @@ bool DwarfLinkerForBinary::linkImpl(
794794
reportWarning("Could not parse binary Swift module: " +
795795
toString(FromInterfaceOrErr.takeError()),
796796
Obj->getObjectFilename());
797-
// Only skip swiftmodules that could be parsed and are
798-
// positively identified as textual.
799-
} else if (*FromInterfaceOrErr) {
797+
// Only skip swiftmodules that could be parsed and are positively
798+
// identified as textual. Do so only when the option allows.
799+
} else if (*FromInterfaceOrErr && !Options.IncludeSwiftModulesFromInterface) {
800800
if (Options.Verbose)
801801
outs() << "Skipping compiled textual Swift interface: "
802802
<< Obj->getObjectFilename() << "\n";

llvm/tools/dsymutil/LinkUtils.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ struct LinkOptions {
114114
/// Whether all remarks should be kept or only remarks with valid debug
115115
/// locations.
116116
bool RemarksKeepAll = true;
117+
118+
/// Whether or not to copy binary swiftmodules built from textual
119+
/// .swiftinterface files into the dSYM bundle. These typically come only
120+
/// from the SDK (since textual interfaces require library evolution) and
121+
/// thus are a waste of space to copy into the bundle. Turn this on if the
122+
/// swiftmodules are different from those in the SDK.
123+
bool IncludeSwiftModulesFromInterface = false;
117124
/// @}
118125

119126
LinkOptions() = default;

llvm/tools/dsymutil/Options.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ def remarks_drop_without_debug: Flag<["--", "-"], "remarks-drop-without-debug">,
202202
"all remarks are kept.">,
203203
Group<grp_general>;
204204

205+
def include_swiftmodules_from_interface: Flag<["--", "-"], "include-swiftmodules-from-interface">,
206+
HelpText<"Whether or not to copy binary swiftmodules built from textual "
207+
".swiftinterface files into the dSYM bundle. These typically come only "
208+
"from the SDK (since textual interfaces require library evolution) and "
209+
"thus are a waste of space to copy into the bundle. Turn this on if the "
210+
"swiftmodules are different from those in the SDK.">,
211+
Group<grp_general>;
212+
205213
def linker: Separate<["--", "-"], "linker">,
206214
MetaVarName<"<DWARF linker type>">,
207215
HelpText<"Specify the desired type of DWARF linker. Defaults to 'classic'">,

llvm/tools/dsymutil/dsymutil.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ static Expected<DsymutilOptions> getOptions(opt::InputArgList &Args) {
391391
Options.LinkOpts.RemarksKeepAll =
392392
!Args.hasArg(OPT_remarks_drop_without_debug);
393393

394+
Options.LinkOpts.IncludeSwiftModulesFromInterface =
395+
Args.hasArg(OPT_include_swiftmodules_from_interface);
396+
394397
if (opt::Arg *BuildVariantSuffix = Args.getLastArg(OPT_build_variant_suffix))
395398
Options.LinkOpts.BuildVariantSuffix = BuildVariantSuffix->getValue();
396399

0 commit comments

Comments
 (0)