From: Alexey Bataev Date: Tue, 19 Jul 2016 05:06:39 +0000 (+0000) Subject: [OPENMP] Removed loop statement as its body executes at most once, NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=781898e62c3dbd83a4e8fa7fd24f12b154384ece;p=clang [OPENMP] Removed loop statement as its body executes at most once, NFC. Removed not required loop statement, addressing comments from Richard Smith. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275947 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index 9b8c95c1cb..3f9c35c508 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -771,18 +771,12 @@ DSAStackTy::DSAVarData DSAStackTy::hasInnermostDSA( D = getCanonicalDecl(D); auto StartI = std::next(Stack.rbegin()); auto EndI = Stack.rend(); - if (FromParent && StartI != EndI) { + if (FromParent && StartI != EndI) StartI = std::next(StartI); - } - for (auto I = StartI, EE = EndI; I != EE; ++I) { - if (!DPred(I->Directive)) - break; - DSAVarData DVar = getDSA(I, D); - if (CPred(DVar.CKind)) - return DVar; + if (StartI == EndI || !DPred(StartI->Directive)) return DSAVarData(); - } - return DSAVarData(); + DSAVarData DVar = getDSA(StartI, D); + return CPred(DVar.CKind) ? DVar : DSAVarData(); } bool DSAStackTy::hasExplicitDSA(