diff options
| author | Reid Kleckner <reid@kleckner.net> | 2013-06-13 18:12:12 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2013-06-13 18:12:12 +0000 |
| commit | 12e0332bfd3895d1f5c7adf5005dfe539ed0d7e8 (patch) | |
| tree | 322ad2189f7dd4d04e55ab3c32b8c1ad269b90f9 /llvm/lib/Option/ArgList.cpp | |
| parent | 77ad7a2d3d9c0fc416b3d08ed50fde5f7fb1fe7a (diff) | |
| download | bcm5719-llvm-12e0332bfd3895d1f5c7adf5005dfe539ed0d7e8.tar.gz bcm5719-llvm-12e0332bfd3895d1f5c7adf5005dfe539ed0d7e8.zip | |
Merge changes to clang's Driver code into LLVM's Option library
This is in preparation for switching the clang driver over to using LLVM's
Option library. Richard Smith introduced most of these changes to the clang
driver in r167638.
Reviewers: espindola on IRC
Differential Revision: http://llvm-reviews.chandlerc.com/D970
llvm-svn: 183925
Diffstat (limited to 'llvm/lib/Option/ArgList.cpp')
| -rw-r--r-- | llvm/lib/Option/ArgList.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Option/ArgList.cpp b/llvm/lib/Option/ArgList.cpp index 39b22d776ed..15f7e8bf4b8 100644 --- a/llvm/lib/Option/ArgList.cpp +++ b/llvm/lib/Option/ArgList.cpp @@ -206,6 +206,13 @@ bool ArgList::hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default) const { return Default; } +bool ArgList::hasFlag(OptSpecifier Pos, OptSpecifier PosAlias, OptSpecifier Neg, + bool Default) const { + if (Arg *A = getLastArg(Pos, PosAlias, Neg)) + return A->getOption().matches(Pos) || A->getOption().matches(PosAlias); + return Default; +} + StringRef ArgList::getLastArgValue(OptSpecifier Id, StringRef Default) const { if (Arg *A = getLastArg(Id)) @@ -226,6 +233,14 @@ void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id) const { } } +void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id0, + OptSpecifier Id1) const { + if (Arg *A = getLastArg(Id0, Id1)) { + A->claim(); + A->render(*this, Output); + } +} + void ArgList::AddAllArgs(ArgStringList &Output, OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const { for (arg_iterator it = filtered_begin(Id0, Id1, Id2), |

