diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-04 00:52:26 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-04 00:52:26 +0000 |
commit | 4f53b298846d720fbb906373f3f28d92f2121f35 (patch) | |
tree | 67bce9093d9cf27ea303a94f953eae9f0a788fa6 /lib/Driver/Driver.cpp | |
parent | 980d60ae927f5f1da972cbcbcb8313e8ca0ef9d2 (diff) |
Driver: Automatically suppress warnings for duplicate versions of
flags which were used for something.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68416 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r-- | lib/Driver/Driver.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 7890e72de6..74c4b07975 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -807,9 +807,29 @@ void Driver::BuildJobs(Compilation &C) const { // 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()); + } } } |