Author: Simon Pilgrim Date: 2020-06-11T13:48:42+01:00 New Revision: f529c0a8a149ce6d027400a12a1637eda19e03b5
URL: https://github.com/llvm/llvm-project/commit/f529c0a8a149ce6d027400a12a1637eda19e03b5 DIFF: https://github.com/llvm/llvm-project/commit/f529c0a8a149ce6d027400a12a1637eda19e03b5.diff LOG: Fix unused variable warning. NFCI. We're only using the D2 iteration value inside the assert (the only component of the loop) - move the entire loop inside the assert by using llvm::all_of. Added: Modified: clang/unittests/StaticAnalyzer/ParamRegionTest.cpp Removed: ################################################################################ diff --git a/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp b/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp index 4edbeb30df1c..52789fdf5b9d 100644 --- a/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp +++ b/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp @@ -19,10 +19,10 @@ class ParamRegionTestConsumer : public ExprEngineConsumer { void checkForSameParamRegions(MemRegionManager &MRMgr, const StackFrameContext *SFC, const ParmVarDecl *PVD) { - for (const auto *D2: PVD->redecls()) { - assert(MRMgr.getVarRegion(PVD, SFC) == - MRMgr.getVarRegion(cast<ParmVarDecl>(D2), SFC)); - } + assert(llvm::all_of(PVD->redecls(), [](const clang::VarDecl *D2) { + return MRMgr.getVarRegion(PVD, SFC) == + MRMgr.getVarRegion(cast<ParmVarDecl>(D2), SFC) + })); } void performTest(const Decl *D) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits