diff options
| author | David Blaikie <dblaikie@gmail.com> | 2015-06-21 06:31:53 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2015-06-21 06:31:53 +0000 |
| commit | 259f61d4b8f78638d18578488c18538b8f26f6d2 (patch) | |
| tree | d7e68d6b3bdce4bf1929f3b326f70eeda2163249 /llvm/lib | |
| parent | 1a109285c29d554494d1021c7a2e7550192b414b (diff) | |
| download | bcm5719-llvm-259f61d4b8f78638d18578488c18538b8f26f6d2.tar.gz bcm5719-llvm-259f61d4b8f78638d18578488c18538b8f26f6d2.zip | |
ArrayRef-ify ParseArgs
llvm-svn: 240233
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/LibDriver/LibDriver.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Option/OptTable.cpp | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/LibDriver/LibDriver.cpp b/llvm/lib/LibDriver/LibDriver.cpp index c9857b0493d..0b7c4756d0a 100644 --- a/llvm/lib/LibDriver/LibDriver.cpp +++ b/llvm/lib/LibDriver/LibDriver.cpp @@ -114,8 +114,8 @@ int llvm::libDriverMain(int Argc, const char **Argv) { LibOptTable Table; unsigned MissingIndex; unsigned MissingCount; - std::unique_ptr<llvm::opt::InputArgList> Args( - Table.ParseArgs(&Argv[1], &Argv[Argc], MissingIndex, MissingCount)); + std::unique_ptr<llvm::opt::InputArgList> Args(Table.ParseArgs( + makeArrayRef(Argv, Argc).slice(1), MissingIndex, MissingCount)); if (MissingCount) { llvm::errs() << "missing arg value for \"" << Args->getArgString(MissingIndex) diff --git a/llvm/lib/Option/OptTable.cpp b/llvm/lib/Option/OptTable.cpp index c37f193fa64..cec1717454f 100644 --- a/llvm/lib/Option/OptTable.cpp +++ b/llvm/lib/Option/OptTable.cpp @@ -247,18 +247,17 @@ Arg *OptTable::ParseOneArg(const ArgList &Args, unsigned &Index, return new Arg(getOption(TheUnknownOptionID), Str, Index++, Str); } -InputArgList *OptTable::ParseArgs(const char *const *ArgBegin, - const char *const *ArgEnd, +InputArgList *OptTable::ParseArgs(ArrayRef<const char *> ArgArr, unsigned &MissingArgIndex, unsigned &MissingArgCount, unsigned FlagsToInclude, unsigned FlagsToExclude) const { - InputArgList *Args = new InputArgList(ArgBegin, ArgEnd); + InputArgList *Args = new InputArgList(ArgArr.begin(), ArgArr.end()); // FIXME: Handle '@' args (or at least error on them). MissingArgIndex = MissingArgCount = 0; - unsigned Index = 0, End = ArgEnd - ArgBegin; + unsigned Index = 0, End = ArgArr.size(); while (Index < End) { // Ingore nullptrs, they are response file's EOL markers if (Args->getArgString(Index) == nullptr) { |

