diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
commit | bca07a4524feb4edec581062d631a13116320a24 (patch) | |
tree | a9243275843fbeaa590afc07ee888e006b8d54ea /lib/Driver/ArgList.cpp | |
parent | 998bc5802ecdd65ce3b270f6c69a8ae8557f0a10 (diff) | |
download | src-bca07a4524feb4edec581062d631a13116320a24.tar.gz src-bca07a4524feb4edec581062d631a13116320a24.zip |
Vendor import of clang trunk r126079:vendor/clang/clang-r126079
Notes
Notes:
svn path=/vendor/clang/dist/; revision=218887
svn path=/vendor/clang/clang-r126079/; revision=218888; tag=vendor/clang/clang-r126079
Diffstat (limited to 'lib/Driver/ArgList.cpp')
-rw-r--r-- | lib/Driver/ArgList.cpp | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp index 910152376714..596e2a7529cb 100644 --- a/lib/Driver/ArgList.cpp +++ b/lib/Driver/ArgList.cpp @@ -1,4 +1,4 @@ -//===--- ArgList.cpp - Argument List Management -------------------------*-===// +//===--- ArgList.cpp - Argument List Management ---------------------------===// // // The LLVM Compiler Infrastructure // @@ -55,62 +55,59 @@ Arg *ArgList::getLastArgNoClaim(OptSpecifier Id) const { } Arg *ArgList::getLastArg(OptSpecifier Id) const { - Arg *A = getLastArgNoClaim(Id); - if (A) - A->claim(); - return A; + Arg *Res = 0; + for (const_iterator it = begin(), ie = end(); it != ie; ++it) { + if ((*it)->getOption().matches(Id)) { + Res = *it; + Res->claim(); + } + } + + return Res; } Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1) const { Arg *Res = 0; - for (const_reverse_iterator it = rbegin(), ie = rend(); it != ie; ++it) { + for (const_iterator it = begin(), ie = end(); it != ie; ++it) { if ((*it)->getOption().matches(Id0) || (*it)->getOption().matches(Id1)) { Res = *it; - break; + Res->claim(); + } } - if (Res) - Res->claim(); - return Res; } Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const { Arg *Res = 0; - for (const_reverse_iterator it = rbegin(), ie = rend(); it != ie; ++it) { + for (const_iterator it = begin(), ie = end(); it != ie; ++it) { if ((*it)->getOption().matches(Id0) || (*it)->getOption().matches(Id1) || (*it)->getOption().matches(Id2)) { Res = *it; - break; + Res->claim(); } } - if (Res) - Res->claim(); - return Res; } Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2, OptSpecifier Id3) const { Arg *Res = 0; - for (const_reverse_iterator it = rbegin(), ie = rend(); it != ie; ++it) { + for (const_iterator it = begin(), ie = end(); it != ie; ++it) { if ((*it)->getOption().matches(Id0) || (*it)->getOption().matches(Id1) || (*it)->getOption().matches(Id2) || (*it)->getOption().matches(Id3)) { Res = *it; - break; + Res->claim(); } } - if (Res) - Res->claim(); - return Res; } @@ -214,7 +211,8 @@ const char *ArgList::GetOrMakeJoinedArgString(unsigned Index, // -InputArgList::InputArgList(const char **ArgBegin, const char **ArgEnd) +InputArgList::InputArgList(const char* const *ArgBegin, + const char* const *ArgEnd) : NumInputArgStrings(ArgEnd - ArgBegin) { ArgStrings.append(ArgBegin, ArgEnd); } |