Add a -gnone option that can negate a previous -g option.

The name -gnone was chosen by analogy with -O and -Onone. Like -O/-Onone,
the last option on the command line wins.

The immediate use case for this is because we want to be able to run the
tests with -g injected into every command line, but some tests will fail
when debug info is included. Those particular tests can be explicitly marked
-gnone.

rdar://problem/18636307

Swift SVN r22777
This commit is contained in:
Jordan Rose
2014-10-15 22:12:07 +00:00
parent dfa116600f
commit fe68e7512f
5 changed files with 39 additions and 12 deletions

View File

@@ -892,14 +892,19 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
StringRef ResourceDir) {
using namespace options;
if (Args.hasArg(OPT_g)) {
Opts.DebugInfo = true;
ArgStringList RenderedArgs;
for (auto A : Args)
A->render(Args, RenderedArgs);
CompilerInvocation::buildDWARFDebugFlags(Opts.DWARFDebugFlags,
RenderedArgs, SDKPath,
ResourceDir);
if (const Arg *A = Args.getLastArg(OPT_g_Group)) {
if (A->getOption().matches(OPT_g)) {
Opts.DebugInfo = true;
ArgStringList RenderedArgs;
for (auto A : Args)
A->render(Args, RenderedArgs);
CompilerInvocation::buildDWARFDebugFlags(Opts.DWARFDebugFlags,
RenderedArgs, SDKPath,
ResourceDir);
} else {
assert(A->getOption().matches(options::OPT_gnone) &&
"unknown -g<kind> option");
}
}
for (const Arg *A : make_range(Args.filtered_begin(OPT_l, OPT_framework),