From f529c0a8a149ce6d027400a12a1637eda19e03b5 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 11 Jun 2020 13:48:42 +0100 Subject: [PATCH] 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. --- clang/unittests/StaticAnalyzer/ParamRegionTest.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp b/clang/unittests/StaticAnalyzer/ParamRegionTest.cpp index 4edbeb3..52789fd 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(D2), SFC)); - } + assert(llvm::all_of(PVD->redecls(), [](const clang::VarDecl *D2) { + return MRMgr.getVarRegion(PVD, SFC) == + MRMgr.getVarRegion(cast(D2), SFC) + })); } void performTest(const Decl *D) { -- 2.7.4