diff options
author | Patrick Lyster <Patrick.lyster@ibm.com> | 2019-01-02 19:28:48 +0000 |
---|---|---|
committer | Patrick Lyster <Patrick.lyster@ibm.com> | 2019-01-02 19:28:48 +0000 |
commit | e13b1e3299c1feb642276491afc5a8cfec9e51b0 (patch) | |
tree | c095757aa3d908dfe29d7dfe8830dedaf57ae57b /clang/lib/CodeGen/CGOpenMPRuntime.cpp | |
parent | 4a401e9479a084e9037a47611f9004e0228c02f8 (diff) | |
download | bcm5719-llvm-e13b1e3299c1feb642276491afc5a8cfec9e51b0.tar.gz bcm5719-llvm-e13b1e3299c1feb642276491afc5a8cfec9e51b0.zip |
[OpenMP] Added support for explicit mapping of classes using 'this' pointer. Differential revision: https://reviews.llvm.org/D55982
llvm-svn: 350252
Diffstat (limited to 'clang/lib/CodeGen/CGOpenMPRuntime.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntime.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 746d3d3e647..81760938406 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -6992,15 +6992,22 @@ private: // components. bool IsExpressionFirstInfo = true; Address BP = Address::invalid(); + const Expr *AssocExpr = I->getAssociatedExpression(); + const auto *AE = dyn_cast<ArraySubscriptExpr>(AssocExpr); + const auto *OASE = dyn_cast<OMPArraySectionExpr>(AssocExpr); - if (isa<MemberExpr>(I->getAssociatedExpression())) { + if (isa<MemberExpr>(AssocExpr)) { // The base is the 'this' pointer. The content of the pointer is going // to be the base of the field being mapped. BP = CGF.LoadCXXThisAddress(); + } else if ((AE && isa<CXXThisExpr>(AE->getBase()->IgnoreParenImpCasts())) || + (OASE && + isa<CXXThisExpr>(OASE->getBase()->IgnoreParenImpCasts()))) { + BP = CGF.EmitOMPSharedLValue(AssocExpr).getAddress(); } else { // The base is the reference to the variable. // BP = &Var. - BP = CGF.EmitOMPSharedLValue(I->getAssociatedExpression()).getAddress(); + BP = CGF.EmitOMPSharedLValue(AssocExpr).getAddress(); if (const auto *VD = dyn_cast_or_null<VarDecl>(I->getAssociatedDeclaration())) { if (llvm::Optional<OMPDeclareTargetDeclAttr::MapTypeTy> Res = |