]> granicus.if.org Git - clang/commitdiff
[OPENMP] Removed loop statement as its body executes at most once, NFC.
authorAlexey Bataev <a.bataev@hotmail.com>
Tue, 19 Jul 2016 05:06:39 +0000 (05:06 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Tue, 19 Jul 2016 05:06:39 +0000 (05:06 +0000)
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

lib/Sema/SemaOpenMP.cpp

index 9b8c95c1cb44b06784b5c926c00982c2ae6736f2..3f9c35c508b57f9b01aef01a0daf018bc8a4d07a 100644 (file)
@@ -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(