[cfe-commits] r122281 - in /cfe/trunk/lib/Driver: ArgList.cpp Tools.cpp
Rafael Espindola
rafael.espindola at gmail.com
Mon Dec 20 14:45:09 PST 2010
Author: rafael
Date: Mon Dec 20 16:45:09 2010
New Revision: 122281
URL: http://llvm.org/viewvc/llvm-project?rev=122281&view=rev
Log:
Fix PR8639 by making the "argument unused during compilation" less agressive. Now we
don't warn if an argument is not used because it is shadowed by a subsequent argument.
Modified:
cfe/trunk/lib/Driver/ArgList.cpp
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/ArgList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ArgList.cpp?rev=122281&r1=122280&r2=122281&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ArgList.cpp (original)
+++ cfe/trunk/lib/Driver/ArgList.cpp Mon Dec 20 16:45:09 2010
@@ -55,62 +55,59 @@
}
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;
}
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=122281&r1=122280&r2=122281&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Dec 20 16:45:09 2010
@@ -1147,9 +1147,6 @@
A->render(Args, CmdArgs);
}
- // Silence warning for "clang -O2 -O0 -c foo.c -o foo.o"
- Args.ClaimAllArgs(options::OPT_O_Group);
-
Args.AddAllArgs(CmdArgs, options::OPT_W_Group);
Args.AddLastArg(CmdArgs, options::OPT_pedantic);
Args.AddLastArg(CmdArgs, options::OPT_pedantic_errors);
More information about the cfe-commits
mailing list