ArrayRef-ify ParseArgs

llvm-svn: 240237
This commit is contained in:
David Blaikie 2015-06-21 06:32:36 +00:00
parent b2b1c7c3e1
commit 6d492ad583
4 changed files with 10 additions and 12 deletions

View File

@ -115,10 +115,9 @@ InputArgList *Driver::ParseArgStrings(ArrayRef<const char *> ArgStrings) {
getIncludeExcludeOptionFlagMasks();
unsigned MissingArgIndex, MissingArgCount;
InputArgList *Args = getOpts().ParseArgs(ArgStrings.begin(), ArgStrings.end(),
MissingArgIndex, MissingArgCount,
IncludedFlagsBitmask,
ExcludedFlagsBitmask);
InputArgList *Args =
getOpts().ParseArgs(ArgStrings, MissingArgIndex, MissingArgCount,
IncludedFlagsBitmask, ExcludedFlagsBitmask);
// Check for missing argument error.
if (MissingArgCount)

View File

@ -1848,8 +1848,8 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
const unsigned IncludedFlagsBitmask = options::CC1Option;
unsigned MissingArgIndex, MissingArgCount;
std::unique_ptr<InputArgList> Args(
Opts->ParseArgs(ArgBegin, ArgEnd, MissingArgIndex, MissingArgCount,
IncludedFlagsBitmask));
Opts->ParseArgs(llvm::makeArrayRef(ArgBegin, ArgEnd), MissingArgIndex,
MissingArgCount, IncludedFlagsBitmask));
// Check for missing argument error.
if (MissingArgCount) {

View File

@ -161,9 +161,8 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
const unsigned IncludedFlagsBitmask = options::CC1AsOption;
unsigned MissingArgIndex, MissingArgCount;
std::unique_ptr<InputArgList> Args(
OptTbl->ParseArgs(Argv.begin(), Argv.end(), MissingArgIndex, MissingArgCount,
IncludedFlagsBitmask));
std::unique_ptr<InputArgList> Args(OptTbl->ParseArgs(
Argv, MissingArgIndex, MissingArgCount, IncludedFlagsBitmask));
// Check for missing argument error.
if (MissingArgCount) {

View File

@ -321,12 +321,12 @@ static void FixupDiagPrefixExeName(TextDiagnosticPrinter *DiagClient,
// This lets us create the DiagnosticsEngine with a properly-filled-out
// DiagnosticOptions instance.
static DiagnosticOptions *
CreateAndPopulateDiagOpts(SmallVectorImpl<const char *> &argv) {
CreateAndPopulateDiagOpts(ArrayRef<const char *> argv) {
auto *DiagOpts = new DiagnosticOptions;
std::unique_ptr<OptTable> Opts(createDriverOptTable());
unsigned MissingArgIndex, MissingArgCount;
std::unique_ptr<InputArgList> Args(Opts->ParseArgs(
argv.begin() + 1, argv.end(), MissingArgIndex, MissingArgCount));
std::unique_ptr<InputArgList> Args(
Opts->ParseArgs(argv.slice(1), MissingArgIndex, MissingArgCount));
// We ignore MissingArgCount and the return value of ParseDiagnosticArgs.
// Any errors that would be diagnosed here will also be diagnosed later,
// when the DiagnosticsEngine actually exists.