Add an extra check for the iterator during checks of the data-sharing
attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301549
91177308-0d34-0410-b5e6-
96231b3b80d8
? std::next(Stack.back().first.rbegin())
: Stack.back().first.rbegin();
auto EndI = Stack.back().first.rend();
- do {
+ while (std::distance(I, EndI) > 1) {
std::advance(I, 1);
if (!DPred(I->Directive) && !isParallelOrTaskRegion(I->Directive))
continue;
DSAVarData DVar = getDSA(I, D);
if (CPred(DVar.CKind))
return DVar;
- } while (std::distance(I, EndI) > 1);
+ }
return {};
}