Skip to content

Commit 580c992

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.
1 parent 0c88b88 commit 580c992

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
@@ -244,6 +244,12 @@ static void addCommonFrontendArgs(const ToolChain &TC, const OutputInfo &OI,
244244
arguments.push_back(inputArgs.MakeArgString(workingDirectory));
245245
}
246246

247+
// -g implies -enable-anonymous-context-mangled-names, because the extra
248+
// metadata aids debugging.
249+
if (inputArgs.hasArg(options::OPT_g)) {
250+
arguments.push_back("-enable-anonymous-context-mangled-names");
251+
}
252+
247253
// Pass through any subsystem flags.
248254
inputArgs.AddAllArgs(arguments, options::OPT_Xllvm);
249255
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)