[cfe-commits] r68549 - in /cfe/trunk: include/clang/Driver/ArgList.h lib/Driver/ArgList.cpp
Daniel Dunbar
daniel at zuster.org
Tue Apr 7 14:08:57 PDT 2009
Author: ddunbar
Date: Tue Apr 7 16:08:57 2009
New Revision: 68549
URL: http://llvm.org/viewvc/llvm-project?rev=68549&view=rev
Log:
Driver: Add default for ArgList::hasFlag and simplify implementation.
Modified:
cfe/trunk/include/clang/Driver/ArgList.h
cfe/trunk/lib/Driver/ArgList.cpp
Modified: cfe/trunk/include/clang/Driver/ArgList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ArgList.h?rev=68549&r1=68548&r2=68549&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ArgList.h (original)
+++ cfe/trunk/include/clang/Driver/ArgList.h Tue Apr 7 16:08:57 2009
@@ -91,7 +91,7 @@
/// negation is present, and \arg Default if neither option is
/// given. If both the option and its negation are present, the
/// last one wins.
- bool hasFlag(options::ID Pos, options::ID Neg, bool Default) const;
+ bool hasFlag(options::ID Pos, options::ID Neg, bool Default=true) const;
/// AddLastArg - Render only the last argument match \arg Id0, if
/// present.
Modified: cfe/trunk/lib/Driver/ArgList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ArgList.cpp?rev=68549&r1=68548&r2=68549&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ArgList.cpp (original)
+++ cfe/trunk/lib/Driver/ArgList.cpp Tue Apr 7 16:08:57 2009
@@ -50,12 +50,8 @@
}
bool ArgList::hasFlag(options::ID Pos, options::ID Neg, bool Default) const {
- Arg *PosA = getLastArg(Pos);
- Arg *NegA = getLastArg(Neg);
- if (PosA && NegA)
- return NegA->getIndex() < PosA->getIndex();
- if (PosA) return true;
- if (NegA) return false;
+ if (Arg *A = getLastArg(Pos, Neg))
+ return A->getOption().matches(Pos);
return Default;
}
More information about the cfe-commits
mailing list