Skip to content

Commit 0fa84fc

Browse files
committed
[Driver] -g implies -enable-anonymous-context-mangled-names.
Including the mangled names in anonymous context metadata can bloat code size, and is not needed for normal runtime resolution. However, it aids debugging, so have -g implies the emission of this extra metadata, which is always optional. (cherry picked from commit 580c992)
1 parent 8dd64be commit 0fa84fc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/Driver/ToolChains.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ static void addCommonFrontendArgs(const ToolChain &TC, const OutputInfo &OI,
243243
arguments.push_back(inputArgs.MakeArgString(workingDirectory));
244244
}
245245

246+
// -g implies -enable-anonymous-context-mangled-names, because the extra
247+
// metadata aids debugging.
248+
if (inputArgs.hasArg(options::OPT_g)) {
249+
arguments.push_back("-enable-anonymous-context-mangled-names");
250+
}
251+
246252
// Pass through any subsystem flags.
247253
inputArgs.AddAllArgs(arguments, options::OPT_Xllvm);
248254
inputArgs.AddAllArgs(arguments, options::OPT_Xcc);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %target-swiftc_driver -### -g %s 2>&1 | %FileCheck %s
2+
3+
// CHECK: -enable-anonymous-context-mangled-names
4+

0 commit comments

Comments
 (0)