forked from OSchip/llvm-project
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. llvm-svn: 122281
This commit is contained in:
parent
5ac4e5f812
commit
7f73489c3f
|
@ -55,42 +55,42 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (Res)
|
||||
Res->claim();
|
||||
}
|
||||
}
|
||||
|
||||
return Res;
|
||||
}
|
||||
|
@ -98,18 +98,15 @@ Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (Res)
|
||||
Res->claim();
|
||||
}
|
||||
}
|
||||
|
||||
return Res;
|
||||
}
|
||||
|
|
|
@ -1147,9 +1147,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue