[frontend] Added support for the -use-malloc flag.

Added a new static ParseLangArgs, which fills in a LangOptions object.
Also moved the handling of -debug-constraints out of the loop in CompilerInvocation::parseArgs() and into ParseLangArgs, now that it has a proper home.

Swift SVN r11172
This commit is contained in:
Connor Wakamo
2013-12-12 02:44:34 +00:00
parent 7ca3ce1102
commit b4ea0c8b73
2 changed files with 24 additions and 4 deletions

View File

@@ -63,6 +63,21 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
return false;
}
static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
DiagnosticEngine &Diags) {
using namespace options;
if (Args.hasArg(OPT_use_malloc)) {
Opts.UseMalloc = true;
}
if (Args.hasArg(OPT_debug_constraints)) {
Opts.DebugConstraintSolver = true;
}
return false;
}
bool CompilerInvocation::parseArgs(ArrayRef<const char *> Args,
DiagnosticEngine &Diags) {
using namespace driver::options;
@@ -97,6 +112,10 @@ bool CompilerInvocation::parseArgs(ArrayRef<const char *> Args,
return true;
}
if (ParseLangArgs(LangOpts, *ParsedArgs, Diags)) {
return true;
}
for (auto InputArg : *ParsedArgs) {
switch (InputArg->getOption().getID()) {
case OPT_target:
@@ -131,10 +150,6 @@ bool CompilerInvocation::parseArgs(ArrayRef<const char *> Args,
ExtraClangArgs.push_back(InputArg->getValue());
break;
case OPT_debug_constraints:
LangOpts.DebugConstraintSolver = true;
break;
case OPT_l:
addLinkLibrary(InputArg->getValue(), LibraryKind::Library);
break;