I don't think the comment's adding value here - it should be fairly clear from the context that the whole loop only exists for some assertions.
Also: Could you remove the "(void)" casts now that the whole thing's wrapped in NDEBUG? (an alternative way of phrasing this that doesn't require the #ifdef would be using nested llvm::all_of calls, but that would mean the assertion firing wouldn't point to a particular mismatched pair, just that overall the data structures were mismatched - if you think that this isn't especially likely/wouldn't be super hard to debug with that, maybe the assert would be more compact/tidier? assert(llvm::all_of(Dependencies, [&](const auto &DepPair) { return llvm::all_of(WeakDependencies, [&](const auto &WeakDepPair) { return WeakDepPair != DepPair && WeakDepPair.first != DepPair.second && WeakDepPair.second != DepPair.second; } }) && "..."); On Fri, Jun 12, 2020 at 6:45 AM Haojian Wu via cfe-commits <cfe-commits@lists.llvm.org> wrote: > > > Author: Haojian Wu > Date: 2020-06-12T15:42:29+02:00 > New Revision: e4b3fc18d33199e2081d300f14687d81be48b6a0 > > URL: > https://github.com/llvm/llvm-project/commit/e4b3fc18d33199e2081d300f14687d81be48b6a0 > DIFF: > https://github.com/llvm/llvm-project/commit/e4b3fc18d33199e2081d300f14687d81be48b6a0.diff > > LOG: Get rid of -Wunused warnings in release build, NFC. > > Added: > > > Modified: > clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp > > Removed: > > > > ################################################################################ > diff --git a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp > b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp > index c2ca9c12b025..4a7e0d91ea23 100644 > --- a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp > +++ b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp > @@ -285,6 +285,7 @@ CheckerRegistry::CheckerRegistry( > resolveDependencies<true>(); > resolveDependencies<false>(); > > +#ifndef NDEBUG // avoid -Wunused warnings in release build. > for (auto &DepPair : Dependencies) { > for (auto &WeakDepPair : WeakDependencies) { > // Some assertions to enforce that strong dependencies are relations in > @@ -298,6 +299,7 @@ CheckerRegistry::CheckerRegistry( > "A strong dependency mustn't be a weak dependency as well!"); > } > } > +#endif > > resolveCheckerAndPackageOptions(); > > > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits