diff options
Diffstat (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 8fd7469..ffcd3ae 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -7023,19 +7023,25 @@ void CodeGenFunction::EmitOMPInteropDirective(const OMPInteropDirective &S) { S.getSingleClause<OMPUseClause>())) && "OMPNowaitClause clause is used separately in OMPInteropDirective."); - if (const auto *C = S.getSingleClause<OMPInitClause>()) { - llvm::Value *InteropvarPtr = - EmitLValue(C->getInteropVar()).getPointer(*this); - llvm::omp::OMPInteropType InteropType = llvm::omp::OMPInteropType::Unknown; - if (C->getIsTarget()) { - InteropType = llvm::omp::OMPInteropType::Target; - } else { - assert(C->getIsTargetSync() && "Expected interop-type target/targetsync"); - InteropType = llvm::omp::OMPInteropType::TargetSync; + auto ItOMPInitClause = S.getClausesOfKind<OMPInitClause>(); + if (!ItOMPInitClause.empty()) { + // Look at the multiple init clauses + for (const OMPInitClause *C : ItOMPInitClause) { + llvm::Value *InteropvarPtr = + EmitLValue(C->getInteropVar()).getPointer(*this); + llvm::omp::OMPInteropType InteropType = + llvm::omp::OMPInteropType::Unknown; + if (C->getIsTarget()) { + InteropType = llvm::omp::OMPInteropType::Target; + } else { + assert(C->getIsTargetSync() && + "Expected interop-type target/targetsync"); + InteropType = llvm::omp::OMPInteropType::TargetSync; + } + OMPBuilder.createOMPInteropInit(Builder, InteropvarPtr, InteropType, + Device, NumDependences, DependenceList, + Data.HasNowaitClause); } - OMPBuilder.createOMPInteropInit(Builder, InteropvarPtr, InteropType, Device, - NumDependences, DependenceList, - Data.HasNowaitClause); } else if (const auto *C = S.getSingleClause<OMPDestroyClause>()) { llvm::Value *InteropvarPtr = EmitLValue(C->getInteropVar()).getPointer(*this); |