diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2017-04-27 15:10:33 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2017-04-27 15:10:33 +0000 |
commit | 60859c068a6ab6880b5c34aad58e48fe1fee3075 (patch) | |
tree | 6a2eb9de4a306935b1682c4cbb6f53cd30ea994f /clang/lib/Sema/SemaOpenMP.cpp | |
parent | e594707dfba133427c30e3ed1743fcf46e4dbffd (diff) | |
download | bcm5719-llvm-60859c068a6ab6880b5c34aad58e48fe1fee3075.tar.gz bcm5719-llvm-60859c068a6ab6880b5c34aad58e48fe1fee3075.zip |
[OPENMP] Add a check for iterator not reached the end of stack, NFC.
Add an extra check for the iterator during checks of the data-sharing
attributes.
llvm-svn: 301549
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 9a190236586..43fd055bbc5 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -828,14 +828,14 @@ DSAStackTy::hasDSA(ValueDecl *D, ? 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 {}; } |