[cfe-commits] r68416 - /cfe/trunk/lib/Driver/Driver.cpp
Daniel Dunbar
daniel at zuster.org
Fri Apr 3 17:52:26 PDT 2009
Author: ddunbar
Date: Fri Apr 3 19:52:26 2009
New Revision: 68416
URL: http://llvm.org/viewvc/llvm-project?rev=68416&view=rev
Log:
Driver: Automatically suppress warnings for duplicate versions of
flags which were used for something.
Modified:
cfe/trunk/lib/Driver/Driver.cpp
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=68416&r1=68415&r2=68416&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Apr 3 19:52:26 2009
@@ -807,9 +807,29 @@
// FIXME: It would be nice to be able to send the argument to the
// Diagnostic, so that extra values, position, and so on could be
// printed.
- if (!A->isClaimed())
+ if (!A->isClaimed()) {
+ // Suppress the warning automatically if this is just a flag,
+ // and it is an instance of an argument we already claimed.
+ const Option &Opt = A->getOption();
+ if (isa<FlagOption>(Opt)) {
+ bool DuplicateClaimed = false;
+
+ // FIXME: Use iterator.
+ for (ArgList::const_iterator it = C.getArgs().begin(),
+ ie = C.getArgs().end(); it != ie; ++it) {
+ if ((*it)->isClaimed() && (*it)->getOption().matches(Opt.getId())) {
+ DuplicateClaimed = true;
+ break;
+ }
+ }
+
+ if (DuplicateClaimed)
+ continue;
+ }
+
Diag(clang::diag::warn_drv_unused_argument)
<< A->getAsString(C.getArgs());
+ }
}
}
More information about the cfe-commits
mailing list