aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/ArgList.cpp
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2009-07-04 13:58:54 +0000
committerEd Schouten <ed@FreeBSD.org>2009-07-04 13:58:54 +0000
commit5362a71c02e7d448a8ce98cf00c47e353fba5d04 (patch)
tree8ddfe382e1c6d590dc240e76f7cd45cea5c78e24 /lib/Driver/ArgList.cpp
parent4ebdf5c4f587daef4e0be499802eac3a7a49bf2f (diff)
downloadsrc-5362a71c02e7d448a8ce98cf00c47e353fba5d04.tar.gz
src-5362a71c02e7d448a8ce98cf00c47e353fba5d04.zip
Import Clang r74788.vendor/clang/clang-r74788
Notes
Notes: svn path=/vendor/clang/dist/; revision=195341 svn path=/vendor/clang/clang-r74788/; revision=195343; tag=vendor/clang/clang-r74788
Diffstat (limited to 'lib/Driver/ArgList.cpp')
-rw-r--r--lib/Driver/ArgList.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp
index 593694cfbbf6..54dd4bb77538 100644
--- a/lib/Driver/ArgList.cpp
+++ b/lib/Driver/ArgList.cpp
@@ -49,6 +49,35 @@ Arg *ArgList::getLastArg(options::ID Id0, options::ID Id1, bool Claim) const {
return Res;
}
+Arg *ArgList::getLastArg(options::ID Id0, options::ID Id1, options::ID Id2,
+ bool Claim) const {
+ Arg *Res = 0;
+ Arg *A0 = getLastArg(Id0, false);
+ Arg *A1 = getLastArg(Id1, false);
+ Arg *A2 = getLastArg(Id2, false);
+
+ int A0Idx = A0 ? A0->getIndex() : -1;
+ int A1Idx = A1 ? A1->getIndex() : -1;
+ int A2Idx = A2 ? A2->getIndex() : -1;
+
+ if (A0Idx > A1Idx) {
+ if (A0Idx > A2Idx)
+ Res = A0;
+ else if (A2Idx != -1)
+ Res = A2;
+ } else {
+ if (A1Idx > A2Idx)
+ Res = A1;
+ else if (A2Idx != -1)
+ Res = A2;
+ }
+
+ if (Claim && Res)
+ Res->claim();
+
+ return Res;
+}
+
bool ArgList::hasFlag(options::ID Pos, options::ID Neg, bool Default) const {
if (Arg *A = getLastArg(Pos, Neg))
return A->getOption().matches(Pos);