diff options
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index b87732a..e193fa3 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -2203,11 +2203,14 @@ bool Sema::isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level, ++EI; if (EI == EE) return false; - - if (isa<ArraySubscriptExpr>(EI->getAssociatedExpression()) || - isa<OMPArraySectionExpr>(EI->getAssociatedExpression()) || + auto Last = std::prev(EE); + const auto *UO = + dyn_cast<UnaryOperator>(Last->getAssociatedExpression()); + if ((UO && UO->getOpcode() == UO_Deref) || + isa<ArraySubscriptExpr>(Last->getAssociatedExpression()) || + isa<OMPArraySectionExpr>(Last->getAssociatedExpression()) || isa<MemberExpr>(EI->getAssociatedExpression()) || - isa<OMPArrayShapingExpr>(EI->getAssociatedExpression())) { + isa<OMPArrayShapingExpr>(Last->getAssociatedExpression())) { IsVariableAssociatedWithSection = true; // There is nothing more we need to know about this variable. return true; |