mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[frontend] Add support for the -g option.
Added a static ParseIRGenArgs function, which includes a handler for -g (including setting up the DWARFDebugFlags appropriately). Swift SVN r11449
This commit is contained in:
@@ -272,6 +272,23 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
|
||||
DiagnosticEngine &Diags) {
|
||||
using namespace options;
|
||||
|
||||
if (Args.hasArg(OPT_g)) {
|
||||
Opts.DebugInfo = true;
|
||||
llvm::raw_string_ostream Flags(Opts.DWARFDebugFlags);
|
||||
interleave(Args,
|
||||
[&](const Arg *Argument) {
|
||||
Flags << Argument->getAsString(Args);
|
||||
},
|
||||
[&] { Flags << " "; });
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CompilerInvocation::parseArgs(ArrayRef<const char *> Args,
|
||||
DiagnosticEngine &Diags) {
|
||||
using namespace driver::options;
|
||||
@@ -341,6 +358,10 @@ bool CompilerInvocation::parseArgs(ArrayRef<const char *> Args,
|
||||
if (ParseTargetArgs(TargetOpts, *ParsedArgs, Diags)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ParseIRGenArgs(IRGenOpts, *ParsedArgs, Diags)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ParseDiagnosticArgs(DiagnosticOpts, *ParsedArgs, Diags)) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user