Lines Matching +full:csi +full:- +full:no +full:- +full:ss

1 //===--- SemaOpenMP.cpp - Semantic Analysis for OpenMP constructs ---------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
55 //===----------------------------------------------------------------------===//
56 // Stack of data-sharing attributes for variables
57 //===----------------------------------------------------------------------===//
75 /// clauses and their data-sharing attributes.
102 /// User-defined allocator
180 /// get the data (loop counters etc.) about enclosing loop-based construct.
238 /// Stack of used declaration and their data-sharing attributes.
281 : Stack.back().first.size() - IgnoredStackElements; in getStackSize()
288 return &Stack.back().first[Size - 1]; in getTopOfStackOrNull()
294 assert(!isStackEmpty() && "no current directive"); in getTopOfStack()
305 return &Stack.back().first[Size - 2]; in getSecondOnStackOrNull()
318 assert(Level < getStackSize() && "no such stack element"); in getStackElemAtLevel()
388 return Top && Top->BodyComplete; in isBodyComplete()
417 "Data-sharing attributes stack is empty!"); in pop()
436 --Self.IgnoredStackElements; in disable()
451 "Expected loop-based directive."); in loopInit()
457 "Expected loop-based directive."); in loopStart()
463 "Expected loop-based directive."); in isLoopStarted()
468 getTopOfStack().PossiblyLoopCounter = D ? D->getCanonicalDecl() : D; in resetPossibleLoopCounter()
474 /// Start new OpenMP region stack in new non-capturing function.
482 /// Pop region stack for non-capturing function.
500 Criticals.try_emplace(D->getDirectiveName().getAsString(), D, Hint); in addCriticalWithHint()
506 return I->second; in getCriticalWithHint()
523 /// for-loops (from outer to inner).
528 /// for-loops (from outer to inner).
533 /// for-loops (from outer to inner).
536 /// Get the loop control variable for the I-th loop (or nullptr) in
543 Stack->UsedInScanDirective.insert(D); in markDeclAsUsedInScanDirective()
549 return Stack->UsedInScanDirective.contains(D); in isUsedInScanDirective()
594 ->getDecl() == VD; in isTaskgroupReductionRef()
600 /// Returns data-sharing attributes for the specified declaration.
602 /// Returns data-sharing attributes for the specified declaration.
604 /// Checks if the specified variables has data-sharing attributes which
614 /// Checks if the specified variables has data-sharing attributes which
622 /// Checks if the specified variables has explicit data-sharing
646 return Top ? Top->Directive : OMPD_unknown; in getCurrentDirective()
650 return Top ? Top->MappedDirective : OMPD_unknown; in getMappedDirective()
657 Top->Directive = NewDK; in setCurrentDirective()
664 Top->MappedDirective = NewDK; in setMappedDirective()
668 assert(!isStackEmpty() && "No directive at specified level."); in getDirective()
681 return Parent ? Parent->Directive : OMPD_unknown; in getParentDirective()
690 return llvm::any_of(D->clauselists(), [](const OMPClause *C) { in hasRequiresDeclWithClause()
702 for (const OMPClause *CPrev : D->clauselists()) { in hasDuplicateRequiresClause()
703 if (CNew->getClauseKind() == CPrev->getClauseKind()) { in hasDuplicateRequiresClause()
704 SemaRef.Diag(CNew->getBeginLoc(), in hasDuplicateRequiresClause()
706 << getOpenMPClauseName(CNew->getClauseKind()); in hasDuplicateRequiresClause()
707 SemaRef.Diag(CPrev->getBeginLoc(), in hasDuplicateRequiresClause()
709 << getOpenMPClauseName(CPrev->getClauseKind()); in hasDuplicateRequiresClause()
765 /// Check whether the implicit-behavior has been set in defaultmap
871 /// false - otherwise.
874 return Top->OrderedRegion.has_value(); in isOrderedRegion()
880 if (Top->OrderedRegion) in getOrderedRegionParam()
881 return *Top->OrderedRegion; in getOrderedRegionParam()
885 /// 'ordered' clause), false - otherwise.
888 return Parent->OrderedRegion.has_value(); in isParentOrderedRegion()
895 if (Parent->OrderedRegion) in getParentOrderedRegionParam()
896 return *Parent->OrderedRegion; in getParentOrderedRegionParam()
904 /// 'order' clause), false - otherwise.
907 return Parent->RegionHasOrderConcurrent; in isParentOrderConcurrent()
915 /// 'nowait' clause), false - otherwise.
918 return Parent->NowaitRegion; in isParentNowaitRegion()
928 return Top ? Top->UntiedRegion : false; in isUntiedRegion()
933 Parent->CancelRegion |= Cancel; in setParentCancelRegion()
938 return Top ? Top->CancelRegion : false; in isCancelRegion()
944 Parent->PrevScanLocation = Loc; in setParentHasScanDirective()
949 return Top ? Top->PrevScanLocation.isValid() : false; in doesParentHasScanDirective()
954 return Top ? Top->PrevScanLocation : SourceLocation(); in getParentScanDirectiveLoc()
959 Parent->PrevOrderedLocation = Loc; in setParentHasOrderedDirective()
964 return Top ? Top->PrevOrderedLocation.isValid() : false; in doesParentHasOrderedDirective()
969 return Top ? Top->PrevOrderedLocation : SourceLocation(); in getParentOrderedDirectiveLoc()
981 return Top ? Top->AssociatedLoops : 0; in getAssociatedLoops()
986 return Top ? Top->HasMutipleLoops : false; in hasMutipleLoops()
993 Parent->InnerTeamsRegionLoc = TeamsRegionLoc; in setParentTeamsRegionLoc()
1002 return Top ? Top->InnerTeamsRegionLoc : SourceLocation(); in getInnerTeamsRegionLoc()
1007 return Top ? Top->CurScope : nullptr; in getCurScope()
1012 return Top ? Top->ConstructLoc : SourceLocation(); in getConstructLoc()
1037 auto MI = SI->MappedExprComponents.find(VD); in checkMappableExprComponentListsForDecl()
1038 if (MI != SI->MappedExprComponents.end()) in checkMappableExprComponentListsForDecl()
1040 MI->second.Components) in checkMappableExprComponentListsForDecl()
1041 if (Check(L, MI->second.Kind)) in checkMappableExprComponentListsForDecl()
1062 MI->second.Components) in checkMappableExprComponentListsForDeclAtLevel()
1063 if (Check(L, MI->second.Kind)) in checkMappableExprComponentListsForDeclAtLevel()
1083 return getStackSize() - 1; in getNestingLevel()
1087 assert(Parent && isOpenMPWorksharingDirective(Parent->Directive)); in addDoacrossDependClause()
1088 Parent->DoacrossDepends.try_emplace(C, OpsOffs); in addDoacrossDependClause()
1116 E->getDecl()) == OMPDeclareTargetDeclAttr::MT_Link && in addToParentTargetRegionLinkGlobals()
1142 /// Marks the declaration as implicitly firstprivate nin the task-based
1147 /// Checks if the decl is implicitly firstprivate in the task-based region.
1164 return I->getSecond(); in isUsesAllocatorsDecl()
1172 return I->getSecond(); in isUsesAllocatorsDecl()
1181 return Top ? Top->DeclareMapperVar : nullptr; in getDeclareMapperVarRef()
1187 StackElem.IteratorVarDecls.push_back(VD->getCanonicalDecl()); in addIteratorVarDecl()
1195 return llvm::is_contained(Top->IteratorVarDecls, VD->getCanonicalDecl()); in isIteratorVarDecl()
1203 if (I->DefaultAttr == DSA_firstprivate || I->DefaultAttr == DSA_private) in getImplicitFDCapExprDecl()
1205 StackLevel--; in getImplicitFDCapExprDecl()
1210 for (const auto &IFD : I->ImplicitDefaultFirstprivateFDs) in getImplicitFDCapExprDecl()
1220 if (I->DefaultAttr == DSA_firstprivate || I->DefaultAttr == DSA_private) in isImplicitDefaultFirstprivateFD()
1224 for (const auto &IFD : I->ImplicitDefaultFirstprivateFDs) in isImplicitDefaultFirstprivateFD()
1235 if (I->DefaultAttr == DSA_private || I->DefaultAttr == DSA_firstprivate) { in addImplicitDefaultFirstprivateFD()
1236 I->ImplicitDefaultFirstprivateFDs.emplace_back(FD, StackLevel, VD); in addImplicitDefaultFirstprivateFD()
1239 StackLevel--; in addImplicitDefaultFirstprivateFD()
1258 E = FE->getSubExpr(); in getExprAsWritten()
1261 E = MTE->getSubExpr(); in getExprAsWritten()
1264 E = Binder->getSubExpr(); in getExprAsWritten()
1267 E = ICE->getSubExprAsWritten(); in getExprAsWritten()
1268 return E->IgnoreParens(); in getExprAsWritten()
1277 if (const auto *ME = dyn_cast<MemberExpr>(getExprAsWritten(CED->getInit()))) in getCanonicalDecl()
1278 D = ME->getMemberDecl(); in getCanonicalDecl()
1282 VD = VD->getCanonicalDecl(); in getCanonicalDecl()
1286 FD = FD->getCanonicalDecl(); in getCanonicalDecl()
1304 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in getDSA()
1306 // File-scope or namespace-scope variables referenced in called routines in getDSA()
1309 if (VD && !VD->isFunctionOrMethodVarDecl() && !isa<ParmVarDecl>(VD)) in getDSA()
1312 // OpenMP [2.9.1.2, Data-sharing Attribute Rules for Variables Referenced in getDSA()
1316 if (VD && VD->hasGlobalStorage()) in getDSA()
1319 // Non-static data members are shared by default. in getDSA()
1326 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in getDSA()
1330 if (VD && isOpenMPLocal(VD, Iter) && VD->isLocalVarDecl() && in getDSA()
1331 (VD->getStorageClass() == SC_Auto || VD->getStorageClass() == SC_None)) { in getDSA()
1336 DVar.DKind = Iter->Directive; in getDSA()
1339 if (Iter->SharingMap.count(D)) { in getDSA()
1340 const DSAInfo &Data = Iter->SharingMap.lookup(D); in getDSA()
1344 DVar.ImplicitDSALoc = Iter->DefaultAttrLoc; in getDSA()
1350 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in getDSA()
1352 // In a parallel or task construct, the data-sharing attributes of these in getDSA()
1354 switch (Iter->DefaultAttr) { in getDSA()
1357 DVar.ImplicitDSALoc = Iter->DefaultAttrLoc; in getDSA()
1362 if (VD && VD->getStorageDuration() == SD_Static && in getDSA()
1363 VD->getDeclContext()->isFileContext()) { in getDSA()
1368 DVar.ImplicitDSALoc = Iter->DefaultAttrLoc; in getDSA()
1373 // and that does not have a predetermined data-sharing attribute in getDSA()
1374 if (VD && VD->getStorageDuration() == SD_Static && in getDSA()
1375 VD->getDeclContext()->isFileContext()) { in getDSA()
1380 DVar.ImplicitDSALoc = Iter->DefaultAttrLoc; in getDSA()
1383 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in getDSA()
1385 // In a parallel construct, if no default clause is present, these in getDSA()
1387 DVar.ImplicitDSALoc = Iter->DefaultAttrLoc; in getDSA()
1395 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in getDSA()
1397 // In a task construct, if no default clause is present, a variable that in in getDSA()
1405 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables in getDSA()
1407 // In a task construct, if no default clause is present, a variable in getDSA()
1408 // whose data-sharing attribute is not determined by the rules above is in getDSA()
1416 } while (I != E && !isImplicitTaskingRegion(I->Directive)); in getDSA()
1422 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in getDSA()
1424 // For constructs other than task, if no default clause is present, these in getDSA()
1425 // variables inherit their data-sharing attributes from the enclosing in getDSA()
1441 assert(It->second && "Unexpected nullptr expr in the aligned map"); in addUniqueAligned()
1442 return It->second; in addUniqueAligned()
1456 assert(It->second && "Unexpected nullptr expr in the aligned map"); in addUniqueNontemporal()
1457 return It->second; in addUniqueNontemporal()
1461 assert(!isStackEmpty() && "Data-sharing attributes stack is empty"); in addLoopControlVariable()
1470 assert(!isStackEmpty() && "Data-sharing attributes stack is empty"); in isLoopControlVariable()
1475 return It->second; in isLoopControlVariable()
1481 assert(!isStackEmpty() && "Data-sharing attributes stack is empty"); in isLoopControlVariable()
1483 for (unsigned I = Level + 1; I > 0; --I) { in isLoopControlVariable()
1484 const SharingMapTy &StackElem = getStackElemAtLevel(I - 1); in isLoopControlVariable()
1487 return It->second; in isLoopControlVariable()
1495 assert(Parent && "Data-sharing attributes stack is empty"); in isParentLoopControlVariable()
1497 auto It = Parent->LCVMap.find(D); in isParentLoopControlVariable()
1498 if (It != Parent->LCVMap.end()) in isParentLoopControlVariable()
1499 return It->second; in isParentLoopControlVariable()
1505 assert(Parent && "Data-sharing attributes stack is empty"); in getParentLoopControlVariable()
1506 if (Parent->LCVMap.size() < I) in getParentLoopControlVariable()
1508 for (const auto &Pair : Parent->LCVMap) in getParentLoopControlVariable()
1542 DSAInfo &Data = getTopOfStack().SharingMap[PrivateCopy->getDecl()]; in addDSA()
1562 for (specific_attr_iterator<AlignedAttr> I(Attrs->begin()), E(Attrs->end()); in buildVarDecl()
1564 Decl->addAttr(*I); in buildVarDecl()
1566 Decl->setImplicit(); in buildVarDecl()
1568 Decl->addAttr( in buildVarDecl()
1577 D->setReferenced(); in buildDeclRefExpr()
1578 D->markUsed(S.Context); in buildDeclRefExpr()
1587 assert(!isStackEmpty() && "Data-sharing attributes stack is empty"); in addTaskgroupReductionData()
1612 assert(!isStackEmpty() && "Data-sharing attributes stack is empty"); in addTaskgroupReductionData()
1638 assert(!isStackEmpty() && "Data-sharing attributes stack is empty."); in getTopMostTaskgroupReductionData()
1640 const DSAInfo &Data = I->SharingMap.lookup(D); in getTopMostTaskgroupReductionData()
1644 const ReductionData &ReductionData = I->ReductionMap.lookup(D); in getTopMostTaskgroupReductionData()
1650 assert(I->TaskgroupReductionRef && "taskgroup reduction reference " in getTopMostTaskgroupReductionData()
1653 TaskgroupDescriptor = I->TaskgroupReductionRef; in getTopMostTaskgroupReductionData()
1654 return DSAVarData(I->Directive, OMPC_reduction, Data.RefExpr.getPointer(), in getTopMostTaskgroupReductionData()
1655 Data.PrivateCopy, I->DefaultAttrLoc, OMPC_REDUCTION_task, in getTopMostTaskgroupReductionData()
1665 assert(!isStackEmpty() && "Data-sharing attributes stack is empty."); in getTopMostTaskgroupReductionData()
1667 const DSAInfo &Data = I->SharingMap.lookup(D); in getTopMostTaskgroupReductionData()
1671 const ReductionData &ReductionData = I->ReductionMap.lookup(D); in getTopMostTaskgroupReductionData()
1677 assert(I->TaskgroupReductionRef && "taskgroup reduction reference " in getTopMostTaskgroupReductionData()
1680 TaskgroupDescriptor = I->TaskgroupReductionRef; in getTopMostTaskgroupReductionData()
1681 return DSAVarData(I->Directive, OMPC_reduction, Data.RefExpr.getPointer(), in getTopMostTaskgroupReductionData()
1682 Data.PrivateCopy, I->DefaultAttrLoc, OMPC_REDUCTION_task, in getTopMostTaskgroupReductionData()
1689 D = D->getCanonicalDecl(); in isOpenMPLocal()
1691 if (isImplicitOrExplicitTaskingRegion(I->Directive) || in isOpenMPLocal()
1692 isOpenMPTargetExecutionDirective(I->Directive)) { in isOpenMPLocal()
1693 if (I->CurScope) { in isOpenMPLocal()
1694 Scope *TopScope = I->CurScope->getParent(); in isOpenMPLocal()
1696 while (CurScope && CurScope != TopScope && !CurScope->isDeclScope(D)) in isOpenMPLocal()
1697 CurScope = CurScope->getParent(); in isOpenMPLocal()
1700 for (DeclContext *DC = D->getDeclContext(); DC; DC = DC->getParent()) in isOpenMPLocal()
1701 if (I->Context == DC) in isOpenMPLocal()
1717 ? Type->getAsCXXRecordDecl() in isConstNotMutableType()
1720 if (const ClassTemplateDecl *CTD = CTSD->getSpecializedTemplate()) in isConstNotMutableType()
1721 RD = CTD->getTemplatedDecl(); in isConstNotMutableType()
1725 RD->hasDefinition() && RD->hasMutableFields()); in isConstNotMutableType()
1742 bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) == in rejectConstNotMutableType()
1744 SemaRef.Diag(D->getLocation(), in rejectConstNotMutableType()
1761 DVar.RefExpr = TI->getSecond().RefExpr.getPointer(); in getTopDSA()
1763 DVar.Modifier = TI->getSecond().Modifier; in getTopDSA()
1766 if (VD && VD->hasAttr<OMPThreadPrivateDeclAttr>()) { in getTopDSA()
1768 SemaRef, VD, D->getType().getNonReferenceType(), in getTopDSA()
1769 VD->getAttr<OMPThreadPrivateDeclAttr>()->getLocation()); in getTopDSA()
1774 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in getTopDSA()
1777 if ((VD && VD->getTLSKind() != VarDecl::TLS_None && in getTopDSA()
1778 !(VD->hasAttr<OMPThreadPrivateDeclAttr>() && in getTopDSA()
1781 (VD && VD->getStorageClass() == SC_Register && in getTopDSA()
1782 VD->hasAttr<AsmLabelAttr>() && !VD->isLocalVarDecl())) { in getTopDSA()
1784 SemaRef, VD, D->getType().getNonReferenceType(), D->getLocation()); in getTopDSA()
1790 VD->isLocalVarDeclOrParm() && !isStackEmpty() && in getTopDSA()
1801 buildDeclRefExpr(SemaRef, VD, D->getType().getNonReferenceType(), in getTopDSA()
1802 D->getLocation()); in getTopDSA()
1808 auto DSAIter = IterTarget->SharingMap.find(D); in getTopDSA()
1809 if (DSAIter != IterTarget->SharingMap.end() && in getTopDSA()
1810 isOpenMPPrivate(DSAIter->getSecond().Attributes)) { in getTopDSA()
1811 DVar.RefExpr = DSAIter->getSecond().RefExpr.getPointer(); in getTopDSA()
1820 buildDeclRefExpr(SemaRef, VD, D->getType().getNonReferenceType(), in getTopDSA()
1821 IterTarget->ConstructLoc); in getTopDSA()
1833 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in getTopDSA()
1836 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in getTopDSA()
1840 if (VD && VD->isStaticDataMember()) { in getTopDSA()
1847 auto It = I->SharingMap.find(D); in getTopDSA()
1848 if (It != I->SharingMap.end()) { in getTopDSA()
1849 const DSAInfo &Data = It->getSecond(); in getTopDSA()
1853 DVar.ImplicitDSALoc = I->DefaultAttrLoc; in getTopDSA()
1854 DVar.DKind = I->Directive; in getTopDSA()
1866 // The predetermined shared attribute for const-qualified types having no in getTopDSA()
1869 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in getTopDSA()
1871 // Variables with const qualified type having no mutable member are in getTopDSA()
1873 if (isConstNotMutableType(SemaRef, D->getType())) { in getTopDSA()
1874 // Variables with const-qualified type having no mutable member may be in getTopDSA()
1898 auto It = I->SharingMap.find(D); in getTopDSA()
1899 if (It != I->SharingMap.end()) { in getTopDSA()
1900 const DSAInfo &Data = It->getSecond(); in getTopDSA()
1904 DVar.ImplicitDSALoc = I->DefaultAttrLoc; in getTopDSA()
1905 DVar.DKind = I->Directive; in getTopDSA()
1932 const_iterator StartI = std::next(begin(), getStackSize() - 1 - Level); in getImplicitDSA()
1951 if (!DPred(I->Directive) && in hasDSA()
1952 !isImplicitOrExplicitTaskingRegion(I->Directive)) in hasDSA()
1956 if (I == NewI && CPred(DVar.CKind, DVar.AppliedToPointee, I->DefaultAttr)) in hasDSA()
1973 if (StartI == EndI || !DPred(StartI->Directive)) in hasInnermostDSA()
1991 if (I != StackElem.SharingMap.end() && I->getSecond().RefExpr.getPointer() && in hasExplicitDSA()
1992 CPred(I->getSecond().Attributes, I->getSecond().AppliedToPointee) && in hasExplicitDSA()
1993 (!NotLastprivate || !I->getSecond().RefExpr.getInt())) in hasExplicitDSA()
2020 if (DPred(I->Directive, I->DirectiveName, I->ConstructLoc)) in hasDirective()
2032 void SemaOpenMP::pushOpenMPFunctionRegion() { DSAStack->pushFunction(); } in pushOpenMPFunctionRegion()
2035 DSAStack->popFunction(OldFSI); in popOpenMPFunctionRegion()
2121 if (VD->getType().getNonReferenceType()->isScalarType()) in getVariableCategoryFromDecl()
2125 if (VD->getType().getNonReferenceType()->isAnyPointerType()) in getVariableCategoryFromDecl()
2127 if (VD->getType().getNonReferenceType()->isScalarType()) in getVariableCategoryFromDecl()
2140 D = cast<ValueDecl>(D->getCanonicalDecl()); in isOpenMPCapturedByRef()
2141 QualType Ty = D->getType(); in isOpenMPCapturedByRef()
2144 if (DSAStack->hasExplicitDirective(isOpenMPTargetExecutionDirective, Level)) { in isOpenMPCapturedByRef()
2148 // OpenMP 4.5 [2.15.5, Data-mapping Attribute Rules and Clauses]. in isOpenMPCapturedByRef()
2154 // | scl | | | | - | | bycopy| in isOpenMPCapturedByRef()
2155 // | scl | | - | x | - | - | bycopy| in isOpenMPCapturedByRef()
2156 // | scl | | x | - | - | - | null | in isOpenMPCapturedByRef()
2157 // | scl | x | | | - | | byref | in isOpenMPCapturedByRef()
2158 // | scl | x | - | x | - | - | bycopy| in isOpenMPCapturedByRef()
2159 // | scl | x | x | - | - | - | null | in isOpenMPCapturedByRef()
2160 // | scl | | - | - | - | x | byref | in isOpenMPCapturedByRef()
2161 // | scl | x | - | - | - | x | byref | in isOpenMPCapturedByRef()
2163 // | agg | n.a. | | | - | | byref | in isOpenMPCapturedByRef()
2164 // | agg | n.a. | - | x | - | - | byref | in isOpenMPCapturedByRef()
2165 // | agg | n.a. | x | - | - | - | null | in isOpenMPCapturedByRef()
2166 // | agg | n.a. | - | - | - | x | byref | in isOpenMPCapturedByRef()
2167 // | agg | n.a. | - | - | - | x[] | byref | in isOpenMPCapturedByRef()
2169 // | ptr | n.a. | | | - | | bycopy| in isOpenMPCapturedByRef()
2170 // | ptr | n.a. | - | x | - | - | bycopy| in isOpenMPCapturedByRef()
2171 // | ptr | n.a. | x | - | - | - | null | in isOpenMPCapturedByRef()
2172 // | ptr | n.a. | - | - | - | x | byref | in isOpenMPCapturedByRef()
2173 // | ptr | n.a. | - | - | - | x[] | bycopy| in isOpenMPCapturedByRef()
2174 // | ptr | n.a. | - | - | x | | bycopy| in isOpenMPCapturedByRef()
2175 // | ptr | n.a. | - | - | x | x | bycopy| in isOpenMPCapturedByRef()
2176 // | ptr | n.a. | - | - | x | x[] | bycopy| in isOpenMPCapturedByRef()
2179 // scl - scalar in isOpenMPCapturedByRef()
2180 // ptr - pointer in isOpenMPCapturedByRef()
2181 // agg - aggregate in isOpenMPCapturedByRef()
2182 // x - applies in isOpenMPCapturedByRef()
2183 // - - invalid in this combination in isOpenMPCapturedByRef()
2184 // [] - mapped with an array section in isOpenMPCapturedByRef()
2185 // byref - should be mapped by reference in isOpenMPCapturedByRef()
2186 // byval - should be mapped by value in isOpenMPCapturedByRef()
2187 // null - initialize a local variable to null on the device in isOpenMPCapturedByRef()
2190 // - All scalar declarations that show up in a map clause have to be passed in isOpenMPCapturedByRef()
2193 // - If the scalar value does not fit the size of uintptr, it has to be in isOpenMPCapturedByRef()
2195 // - For pointers mapped by value that have either an implicit map or an in isOpenMPCapturedByRef()
2199 if (Ty->isReferenceType()) in isOpenMPCapturedByRef()
2200 Ty = Ty->castAs<ReferenceType>()->getPointeeType(); in isOpenMPCapturedByRef()
2207 DSAStack->checkMappableExprComponentListsForDeclAtLevel( in isOpenMPCapturedByRef()
2225 if (isa<DeclRefExpr>(EI->getAssociatedExpression())) in isOpenMPCapturedByRef()
2226 IsVariableUsedInMapClause |= EI->getAssociatedDeclaration() == D; in isOpenMPCapturedByRef()
2233 dyn_cast<UnaryOperator>(Last->getAssociatedExpression()); in isOpenMPCapturedByRef()
2234 if ((UO && UO->getOpcode() == UO_Deref) || in isOpenMPCapturedByRef()
2235 isa<ArraySubscriptExpr>(Last->getAssociatedExpression()) || in isOpenMPCapturedByRef()
2236 isa<ArraySectionExpr>(Last->getAssociatedExpression()) || in isOpenMPCapturedByRef()
2237 isa<MemberExpr>(EI->getAssociatedExpression()) || in isOpenMPCapturedByRef()
2238 isa<OMPArrayShapingExpr>(Last->getAssociatedExpression())) { in isOpenMPCapturedByRef()
2251 IsByRef = !(Ty->isPointerType() && IsVariableAssociatedWithSection); in isOpenMPCapturedByRef()
2256 IsByRef = (DSAStack->isForceCaptureByReferenceInTargetExecutable() && in isOpenMPCapturedByRef()
2257 !Ty->isAnyPointerType()) || in isOpenMPCapturedByRef()
2258 !Ty->isScalarType() || in isOpenMPCapturedByRef()
2259 DSAStack->isDefaultmapCapturedByRef( in isOpenMPCapturedByRef()
2261 DSAStack->hasExplicitDSA( in isOpenMPCapturedByRef()
2270 if (IsByRef && Ty.getNonReferenceType()->isScalarType()) { in isOpenMPCapturedByRef()
2273 DSAStack->getCaptureRegion(Level, OpenMPCaptureLevel) == in isOpenMPCapturedByRef()
2275 !(DSAStack->hasExplicitDSA( in isOpenMPCapturedByRef()
2277 [](OpenMPClauseKind K, bool AppliedToPointee) -> bool { in isOpenMPCapturedByRef()
2282 DSAStack->isUsesAllocatorsDecl(Level, D))) && in isOpenMPCapturedByRef()
2283 // If the variable is artificial and must be captured by value - try to in isOpenMPCapturedByRef()
2285 !(isa<OMPCapturedExprDecl>(D) && !D->hasAttr<OMPCaptureNoInitAttr>() && in isOpenMPCapturedByRef()
2286 !cast<OMPCapturedExprDecl>(D)->getInit()->isGLValue()) && in isOpenMPCapturedByRef()
2287 // If the variable is implicitly firstprivate and scalar - capture by in isOpenMPCapturedByRef()
2289 !((DSAStack->getDefaultDSA() == DSA_firstprivate || in isOpenMPCapturedByRef()
2290 DSAStack->getDefaultDSA() == DSA_private) && in isOpenMPCapturedByRef()
2291 !DSAStack->hasExplicitDSA( in isOpenMPCapturedByRef()
2294 !DSAStack->isLoopControlVariable(D, Level).first); in isOpenMPCapturedByRef()
2313 return DSAStack->getNestingLevel(); in getOpenMPNestingLevel()
2317 return isOpenMPTaskingDirective(DSAStack->getCurrentDirective()) && in isInOpenMPTaskUntiedContext()
2318 DSAStack->isUntiedRegion(); in isInOpenMPTaskUntiedContext()
2322 return (isOpenMPTargetExecutionDirective(DSAStack->getCurrentDirective()) && in isInOpenMPTargetExecutionDirective()
2323 !DSAStack->isClauseParsingMode()) || in isInOpenMPTargetExecutionDirective()
2324 DSAStack->hasDirective( in isInOpenMPTargetExecutionDirective()
2326 SourceLocation) -> bool { in isInOpenMPTargetExecutionDirective()
2336 DSAStackTy::DSAVarData DVarPrivate = DSAStack->hasDSA( in isOpenMPRebuildMemberExpr()
2344 DSAStack->isClauseParsingMode()); in isOpenMPRebuildMemberExpr()
2362 if (VD && VD->isConstexpr()) in isOpenMPCapturedDecl()
2370 *DSAStack, CheckScopeInfo && DSAStack->isBodyComplete()); in isOpenMPCapturedDecl()
2375 if (VD && !VD->hasLocalStorage() && in isOpenMPCapturedDecl()
2380 DSAStack->getTopDSA(D, DSAStack->isClauseParsingMode()); in isOpenMPCapturedDecl()
2388 CapturedRegionScopeInfo *CSI = nullptr; in isOpenMPCapturedDecl() local
2391 CheckScopeInfo ? (SemaRef.FunctionScopes.size() - (StopAt + 1)) in isOpenMPCapturedDecl()
2396 if (RSI->CapRegionKind == CR_OpenMP) { in isOpenMPCapturedDecl()
2397 CSI = RSI; in isOpenMPCapturedDecl()
2401 assert(CSI && "Failed to find CapturedRegionScopeInfo"); in isOpenMPCapturedDecl()
2404 DSAStack->getDirective(CSI->OpenMPLevel)); in isOpenMPCapturedDecl()
2405 if (Regions[CSI->OpenMPCaptureLevel] != OMPD_task) in isOpenMPCapturedDecl()
2420 for (unsigned I = StopAt + 1; I > 0; --I) { in isOpenMPCapturedDecl()
2421 FunctionScopeInfo *FSI = SemaRef.FunctionScopes[I - 1]; in isOpenMPCapturedDecl()
2425 if (RSI->CapRegionKind == CR_OpenMP) { in isOpenMPCapturedDecl()
2434 if (DSAStack->getCurrentDirective() != OMPD_unknown && in isOpenMPCapturedDecl()
2435 (!DSAStack->isClauseParsingMode() || in isOpenMPCapturedDecl()
2436 DSAStack->getParentDirective() != OMPD_unknown)) { in isOpenMPCapturedDecl()
2437 auto &&Info = DSAStack->isLoopControlVariable(D); in isOpenMPCapturedDecl()
2439 (VD && VD->hasLocalStorage() && in isOpenMPCapturedDecl()
2440 isImplicitOrExplicitTaskingRegion(DSAStack->getCurrentDirective())) || in isOpenMPCapturedDecl()
2441 (VD && DSAStack->isForceVarCapturing())) in isOpenMPCapturedDecl()
2444 DSAStack->getTopDSA(D, DSAStack->isClauseParsingMode()); in isOpenMPCapturedDecl()
2446 (!VD || VD->hasLocalStorage() || !DVarTop.AppliedToPointee)) in isOpenMPCapturedDecl()
2447 return VD ? VD : cast<VarDecl>(DVarTop.PrivateCopy->getDecl()); in isOpenMPCapturedDecl()
2453 DSAStackTy::DSAVarData DVarPrivate = DSAStack->hasDSA( in isOpenMPCapturedDecl()
2459 DSAStack->isClauseParsingMode()); in isOpenMPCapturedDecl()
2461 if (VD && !VD->hasLocalStorage() && DVarPrivate.CKind == OMPC_unknown && in isOpenMPCapturedDecl()
2462 ((DSAStack->getDefaultDSA() != DSA_none && in isOpenMPCapturedDecl()
2463 DSAStack->getDefaultDSA() != DSA_private && in isOpenMPCapturedDecl()
2464 DSAStack->getDefaultDSA() != DSA_firstprivate) || in isOpenMPCapturedDecl()
2470 DSAStackTy::DSAVarData DVarPrivate = DSAStack->hasDSA( in isOpenMPCapturedDecl()
2479 DSAStack->isClauseParsingMode()); in isOpenMPCapturedDecl()
2483 VarDecl *VD = DSAStack->getImplicitFDCapExprDecl(FD); in isOpenMPCapturedDecl()
2495 DeclAccessPair::make(FD, FD->getAccess()), in isOpenMPCapturedDecl()
2496 /*HadMultipleCandidates=*/false, DeclarationNameInfo(), FD->getType(), in isOpenMPCapturedDecl()
2499 SemaRef, FD->getIdentifier(), ME, DVarPrivate.CKind != OMPC_private, in isOpenMPCapturedDecl()
2500 SemaRef.CurContext->getParent(), /*AsExpression=*/false); in isOpenMPCapturedDecl()
2502 SemaRef, CD, CD->getType().getNonReferenceType(), SourceLocation()); in isOpenMPCapturedDecl()
2503 VD = cast<VarDecl>(VDPrivateRefExpr->getDecl()); in isOpenMPCapturedDecl()
2504 DSAStack->addImplicitDefaultFirstprivateFD(FD, VD); in isOpenMPCapturedDecl()
2508 (VD && (DSAStack->getDefaultDSA() == DSA_none || in isOpenMPCapturedDecl()
2509 DSAStack->getDefaultDSA() == DSA_private || in isOpenMPCapturedDecl()
2510 DSAStack->getDefaultDSA() == DSA_firstprivate))) in isOpenMPCapturedDecl()
2511 return VD ? VD : cast<VarDecl>(DVarPrivate.PrivateCopy->getDecl()); in isOpenMPCapturedDecl()
2518 FunctionScopesIndex -= getOpenMPCaptureLevels(DSAStack->getDirective(Level)); in adjustOpenMPTargetScopeIndex()
2523 if (isOpenMPLoopDirective(DSAStack->getCurrentDirective())) in startOpenMPLoop()
2524 DSAStack->loopInit(); in startOpenMPLoop()
2529 if (isOpenMPLoopDirective(DSAStack->getCurrentDirective())) { in startOpenMPCXXRangeFor()
2530 DSAStack->resetPossibleLoopCounter(); in startOpenMPCXXRangeFor()
2531 DSAStack->loopStart(); in startOpenMPCXXRangeFor()
2538 if (DSAStack->getCurrentDirective() != OMPD_unknown && in isOpenMPPrivateDecl()
2539 (!DSAStack->isClauseParsingMode() || in isOpenMPPrivateDecl()
2540 DSAStack->getParentDirective() != OMPD_unknown)) { in isOpenMPPrivateDecl()
2541 DSAStackTy::DSAVarData DVarPrivate = DSAStack->hasDSA( in isOpenMPPrivateDecl()
2549 DSAStack->isClauseParsingMode()); in isOpenMPPrivateDecl()
2551 DSAStack->isImplicitDefaultFirstprivateFD(cast<VarDecl>(D)) && in isOpenMPPrivateDecl()
2552 !DSAStack->isLoopControlVariable(D).first) in isOpenMPPrivateDecl()
2555 if (DSAStack->hasExplicitDirective(isOpenMPTaskingDirective, Level)) { in isOpenMPPrivateDecl()
2557 D->getType().getNonReferenceType().isTriviallyCopyableType( in isOpenMPPrivateDecl()
2559 !D->getType() in isOpenMPPrivateDecl()
2562 ->getAsCXXRecordDecl(); in isOpenMPPrivateDecl()
2563 OpenMPDirectiveKind DKind = DSAStack->getDirective(Level); in isOpenMPPrivateDecl()
2569 if (DSAStack->hasExplicitDSA( in isOpenMPPrivateDecl()
2574 DSAStackTy::DSAVarData DVar = DSAStack->getImplicitDSA(D, Level); in isOpenMPPrivateDecl()
2576 !DSAStack->isLoopControlVariable(D, Level).first && !DVar.RefExpr) { in isOpenMPPrivateDecl()
2577 DSAStack->addImplicitTaskFirstprivate(Level, D); in isOpenMPPrivateDecl()
2582 if (isOpenMPLoopDirective(DSAStack->getCurrentDirective()) && in isOpenMPPrivateDecl()
2583 !isOpenMPLoopTransformationDirective(DSAStack->getCurrentDirective())) { in isOpenMPPrivateDecl()
2584 if (DSAStack->getAssociatedLoops() > 0 && !DSAStack->isLoopStarted()) { in isOpenMPPrivateDecl()
2585 DSAStack->resetPossibleLoopCounter(D); in isOpenMPPrivateDecl()
2586 DSAStack->loopStart(); in isOpenMPPrivateDecl()
2589 if ((DSAStack->getPossiblyLoopCounter() == D->getCanonicalDecl() || in isOpenMPPrivateDecl()
2590 DSAStack->isLoopControlVariable(D).first) && in isOpenMPPrivateDecl()
2591 !DSAStack->hasExplicitDSA( in isOpenMPPrivateDecl()
2594 !isOpenMPSimdDirective(DSAStack->getCurrentDirective())) in isOpenMPPrivateDecl()
2598 if (DSAStack->isThreadPrivate(const_cast<VarDecl *>(VD)) && in isOpenMPPrivateDecl()
2599 DSAStack->isForceVarCapturing() && in isOpenMPPrivateDecl()
2600 !DSAStack->hasExplicitDSA( in isOpenMPPrivateDecl()
2605 // User-defined allocators are private since they must be defined in the in isOpenMPPrivateDecl()
2607 if (DSAStack->hasExplicitDirective(isOpenMPTargetExecutionDirective, Level) && in isOpenMPPrivateDecl()
2608 DSAStack->isUsesAllocatorsDecl(Level, D).value_or( in isOpenMPPrivateDecl()
2612 return (DSAStack->hasExplicitDSA( in isOpenMPPrivateDecl()
2615 (DSAStack->isClauseParsingMode() && in isOpenMPPrivateDecl()
2616 DSAStack->getClauseParsingMode() == OMPC_private) || in isOpenMPPrivateDecl()
2619 (DSAStack->hasExplicitDirective( in isOpenMPPrivateDecl()
2627 DSAStack->isTaskgroupReductionRef(D, Level))) in isOpenMPPrivateDecl()
2637 for (unsigned I = DSAStack->getNestingLevel() + 1; I > Level; --I) { in setOpenMPCaptureKind()
2638 const unsigned NewLevel = I - 1; in setOpenMPCaptureKind()
2639 if (DSAStack->hasExplicitDSA( in setOpenMPCaptureKind()
2650 if (DSAStack->checkMappableExprComponentListsForDeclAtLevel( in setOpenMPCaptureKind()
2657 if (DSAStack->hasExplicitDirective(isOpenMPTargetExecutionDirective, in setOpenMPCaptureKind()
2660 if (DSAStack->mustBeFirstprivateAtLevel( in setOpenMPCaptureKind()
2667 FD->addAttr( in setOpenMPCaptureKind()
2674 // Return true if the current level is no longer enclosed in a target region. in isOpenMPTargetCapturedDecl()
2677 getOpenMPCaptureRegions(Regions, DSAStack->getDirective(Level)); in isOpenMPTargetCapturedDecl()
2679 return VD && !VD->hasLocalStorage() && in isOpenMPTargetCapturedDecl()
2680 DSAStack->hasExplicitDirective(isOpenMPTargetExecutionDirective, in isOpenMPTargetCapturedDecl()
2688 // Return true if the current level is no longer enclosed in a target region. in isOpenMPGlobalCapturedDecl()
2691 if (!VD->hasLocalStorage()) { in isOpenMPGlobalCapturedDecl()
2695 DSAStack->getTopDSA(D, /*FromParent=*/false); in isOpenMPGlobalCapturedDecl()
2697 getOpenMPCaptureLevels(DSAStack->getDirective(Level)); in isOpenMPGlobalCapturedDecl()
2699 // non-file scope static variable with default(firstprivate) in isOpenMPGlobalCapturedDecl()
2703 DSAStack->getDefaultDSA() == DSA_firstprivate)); in isOpenMPGlobalCapturedDecl()
2705 --Level; in isOpenMPGlobalCapturedDecl()
2706 DSAStackTy::DSAVarData DVar = DSAStack->getImplicitDSA(D, Level); in isOpenMPGlobalCapturedDecl()
2734 OMPDeclareTargetDeclAttr::getDeviceType(Caller->getMostRecentDecl()); in finalizeOpenMPDelayedAnalysis()
2743 const FunctionDecl *FD = Callee->getMostRecentDecl(); in finalizeOpenMPDelayedAnalysis()
2763 Callee->specific_attrs<OMPDeclareVariantAttr>()) { in finalizeOpenMPDelayedAnalysis()
2764 auto *DeclRefVariant = cast<DeclRefExpr>(A->getVariantFuncRef()); in finalizeOpenMPDelayedAnalysis()
2765 auto *VariantFD = cast<FunctionDecl>(DeclRefVariant->getDecl()); in finalizeOpenMPDelayedAnalysis()
2768 VariantFD->getMostRecentDecl()); in finalizeOpenMPDelayedAnalysis()
2775 Callee->hasAttr<OMPDeclareVariantAttr>() && HasHostAttr(Callee)) in finalizeOpenMPDelayedAnalysis()
2790 DSAStack->push(DKind, DirName, CurScope, Loc); in StartOpenMPDSABlock()
2796 DSAStack->setClauseParsingMode(K); in StartOpenMPClause()
2800 DSAStack->setClauseParsingMode(/*K=*/OMPC_unknown); in EndOpenMPClause()
2815 // A reduction clause without the inscan reduction-modifier may not appear on in checkReductionClauses()
2816 // a construct on which a reduction clause with the inscan reduction-modifier in checkReductionClauses()
2819 if (C->getClauseKind() != OMPC_reduction) in checkReductionClauses()
2822 if (RC->getModifier() == OMPC_REDUCTION_inscan) { in checkReductionClauses()
2824 InscanLoc = RC->getModifierLoc(); in checkReductionClauses()
2827 if (RC->getModifier() == OMPC_REDUCTION_task) { in checkReductionClauses()
2829 // A reduction clause with the task reduction-modifier may only appear on in checkReductionClauses()
2833 OpenMPDirectiveKind CurDir = Stack->getCurrentDirective(); in checkReductionClauses()
2837 S.Diag(RC->getModifierLoc(), in checkReductionClauses()
2844 if (C->getClauseKind() != OMPC_reduction) in checkReductionClauses()
2847 if (RC->getModifier() != OMPC_REDUCTION_inscan) { in checkReductionClauses()
2848 S.Diag(RC->getModifier() == OMPC_REDUCTION_unknown in checkReductionClauses()
2849 ? RC->getBeginLoc() in checkReductionClauses()
2850 : RC->getModifierLoc(), in checkReductionClauses()
2855 for (Expr *Ref : RC->varlists()) { in checkReductionClauses()
2865 if (!Stack->isUsedInScanDirective(getCanonicalDecl(D))) { in checkReductionClauses()
2866 S.Diag(Ref->getExprLoc(), in checkReductionClauses()
2868 << Ref->getSourceRange(); in checkReductionClauses()
2892 for (OMPClause *C : D->clauses()) { in EndOpenMPDSABlock()
2895 for (Expr *DE : Clause->varlists()) { in EndOpenMPDSABlock()
2896 if (DE->isValueDependent() || DE->isTypeDependent()) { in EndOpenMPDSABlock()
2900 auto *DRE = cast<DeclRefExpr>(DE->IgnoreParens()); in EndOpenMPDSABlock()
2901 auto *VD = cast<VarDecl>(DRE->getDecl()); in EndOpenMPDSABlock()
2902 QualType Type = VD->getType().getNonReferenceType(); in EndOpenMPDSABlock()
2904 DSAStack->getTopDSA(VD, /*FromParent=*/false); in EndOpenMPDSABlock()
2912 SemaRef, DE->getExprLoc(), Type.getUnqualifiedType(), in EndOpenMPDSABlock()
2913 VD->getName(), VD->hasAttrs() ? &VD->getAttrs() : nullptr, DRE); in EndOpenMPDSABlock()
2915 if (VDPrivate->isInvalidDecl()) { in EndOpenMPDSABlock()
2920 SemaRef, VDPrivate, DE->getType(), DE->getExprLoc())); in EndOpenMPDSABlock()
2927 Clause->setPrivateCopies(PrivateCopies); in EndOpenMPDSABlock()
2933 for (Expr *RefExpr : Clause->varlists()) { in EndOpenMPDSABlock()
2947 DSAStack->getTopDSA(D, /*FromParent=*/false); in EndOpenMPDSABlock()
2951 Clause->setPrivateRefs(PrivateRefs); in EndOpenMPDSABlock()
2955 for (unsigned I = 0, E = Clause->getNumberOfAllocators(); I < E; ++I) { in EndOpenMPDSABlock()
2956 OMPUsesAllocatorsClause::Data D = Clause->getAllocatorData(I); in EndOpenMPDSABlock()
2957 auto *DRE = dyn_cast<DeclRefExpr>(D.Allocator->IgnoreParenImpCasts()); in EndOpenMPDSABlock()
2960 ValueDecl *VD = DRE->getDecl(); in EndOpenMPDSABlock()
2964 DSAStack->getTopDSA(VD, /*FromParent=*/false); in EndOpenMPDSABlock()
2967 // appear in other data-sharing attribute clauses or data-mapping in EndOpenMPDSABlock()
2971 DSAStack->checkMappableExprComponentListsForDecl( in EndOpenMPDSABlock()
2980 MI->getAssociatedDeclaration()->getCanonicalDecl() == in EndOpenMPDSABlock()
2981 VD->getCanonicalDecl()) { in EndOpenMPDSABlock()
2982 MapExpr = MI->getAssociatedExpression(); in EndOpenMPDSABlock()
2987 Diag(D.Allocator->getExprLoc(), in EndOpenMPDSABlock()
2989 << D.Allocator->getSourceRange(); in EndOpenMPDSABlock()
2993 Diag(MapExpr->getExprLoc(), diag::note_used_here) in EndOpenMPDSABlock()
2994 << MapExpr->getSourceRange(); in EndOpenMPDSABlock()
3001 if (!SemaRef.CurContext->isDependentContext()) in EndOpenMPDSABlock()
3002 checkAllocateClauses(SemaRef, DSAStack, D->clauses()); in EndOpenMPDSABlock()
3003 checkReductionClauses(SemaRef, DSAStack, D->clauses()); in EndOpenMPDSABlock()
3006 DSAStack->pop(); in EndOpenMPDSABlock()
3018 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in finishLinearClauses()
3021 if (SemaRef.CurContext->isDependentContext()) in finishLinearClauses()
3024 // Finalize the clauses that need pre-built expressions for CodeGen. in finishLinearClauses()
3049 return VD->hasGlobalStorage() && in ValidateCandidate()
3069 if (ND && ((isa<VarDecl>(ND) && ND->getKind() == Decl::Var) || in ValidateCandidate()
3117 Diag(Lookup.getFoundDecl()->getLocation(), diag::note_declared_at); in ActOnOpenMPIdExpression()
3123 // Variables must be file-scope, namespace-scope, or static block-scope. in ActOnOpenMPIdExpression()
3124 if (Kind == OMPD_threadprivate && !VD->hasGlobalStorage()) { in ActOnOpenMPIdExpression()
3126 << getOpenMPDirectiveName(Kind) << !VD->isStaticLocal(); in ActOnOpenMPIdExpression()
3128 VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; in ActOnOpenMPIdExpression()
3129 Diag(VD->getLocation(), in ActOnOpenMPIdExpression()
3135 VarDecl *CanonicalVD = VD->getCanonicalDecl(); in ActOnOpenMPIdExpression()
3138 // A threadprivate directive for file-scope variables must appear outside in ActOnOpenMPIdExpression()
3140 if (CanonicalVD->getDeclContext()->isTranslationUnit() && in ActOnOpenMPIdExpression()
3141 !SemaRef.getCurLexicalContext()->isTranslationUnit()) { in ActOnOpenMPIdExpression()
3145 VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; in ActOnOpenMPIdExpression()
3146 Diag(VD->getLocation(), in ActOnOpenMPIdExpression()
3155 if (CanonicalVD->isStaticDataMember() && in ActOnOpenMPIdExpression()
3156 !CanonicalVD->getDeclContext()->Equals(SemaRef.getCurLexicalContext())) { in ActOnOpenMPIdExpression()
3160 VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; in ActOnOpenMPIdExpression()
3161 Diag(VD->getLocation(), in ActOnOpenMPIdExpression()
3167 // A threadprivate directive for namespace-scope variables must appear in ActOnOpenMPIdExpression()
3170 if (CanonicalVD->getDeclContext()->isNamespace() && in ActOnOpenMPIdExpression()
3171 (!SemaRef.getCurLexicalContext()->isFileContext() || in ActOnOpenMPIdExpression()
3172 !SemaRef.getCurLexicalContext()->Encloses( in ActOnOpenMPIdExpression()
3173 CanonicalVD->getDeclContext()))) { in ActOnOpenMPIdExpression()
3177 VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; in ActOnOpenMPIdExpression()
3178 Diag(VD->getLocation(), in ActOnOpenMPIdExpression()
3184 // A threadprivate directive for static block-scope variables must appear in ActOnOpenMPIdExpression()
3186 if (CanonicalVD->isLocalVarDecl() && CurScope && in ActOnOpenMPIdExpression()
3191 VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; in ActOnOpenMPIdExpression()
3192 Diag(VD->getLocation(), in ActOnOpenMPIdExpression()
3198 // OpenMP [2.9.2, Restrictions, C/C++, p.2-6] in ActOnOpenMPIdExpression()
3201 if (Kind == OMPD_threadprivate && VD->isUsed() && in ActOnOpenMPIdExpression()
3202 !DSAStack->isThreadPrivate(VD)) { in ActOnOpenMPIdExpression()
3208 QualType ExprType = VD->getType().getNonReferenceType(); in ActOnOpenMPIdExpression()
3219 SemaRef.CurContext->addDecl(D); in ActOnOpenMPThreadprivateDirective()
3232 if (const auto *VD = dyn_cast<VarDecl>(E->getDecl())) { in VisitDeclRefExpr()
3233 if (VD->hasLocalStorage()) { in VisitDeclRefExpr()
3234 SemaRef.Diag(E->getBeginLoc(), in VisitDeclRefExpr()
3236 << E->getSourceRange(); in VisitDeclRefExpr()
3237 SemaRef.Diag(VD->getLocation(), diag::note_defined_here) in VisitDeclRefExpr()
3238 << VD << VD->getSourceRange(); in VisitDeclRefExpr()
3245 for (const Stmt *Child : S->children()) { in VisitStmt()
3262 auto *VD = cast<VarDecl>(DE->getDecl()); in CheckOMPThreadPrivateDecl()
3263 SourceLocation ILoc = DE->getExprLoc(); in CheckOMPThreadPrivateDecl()
3266 VD->setReferenced(); in CheckOMPThreadPrivateDecl()
3267 VD->markUsed(Context); in CheckOMPThreadPrivateDecl()
3269 QualType QType = VD->getType(); in CheckOMPThreadPrivateDecl()
3270 if (QType->isDependentType() || QType->isInstantiationDependentType()) { in CheckOMPThreadPrivateDecl()
3279 ILoc, VD->getType(), diag::err_omp_threadprivate_incomplete_type)) { in CheckOMPThreadPrivateDecl()
3285 if (VD->getType()->isReferenceType()) { in CheckOMPThreadPrivateDecl()
3287 << getOpenMPDirectiveName(OMPD_threadprivate) << VD->getType(); in CheckOMPThreadPrivateDecl()
3289 VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; in CheckOMPThreadPrivateDecl()
3290 Diag(VD->getLocation(), in CheckOMPThreadPrivateDecl()
3298 if ((VD->getTLSKind() != VarDecl::TLS_None && in CheckOMPThreadPrivateDecl()
3299 !(VD->hasAttr<OMPThreadPrivateDeclAttr>() && in CheckOMPThreadPrivateDecl()
3302 (VD->getStorageClass() == SC_Register && VD->hasAttr<AsmLabelAttr>() && in CheckOMPThreadPrivateDecl()
3303 !VD->isLocalVarDecl())) { in CheckOMPThreadPrivateDecl()
3305 << VD << ((VD->getTLSKind() != VarDecl::TLS_None) ? 0 : 1); in CheckOMPThreadPrivateDecl()
3307 VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; in CheckOMPThreadPrivateDecl()
3308 Diag(VD->getLocation(), in CheckOMPThreadPrivateDecl()
3316 if (const Expr *Init = VD->getAnyInitializer()) { in CheckOMPThreadPrivateDecl()
3323 DSAStack->addDSA(VD, DE, OMPC_threadprivate); in CheckOMPThreadPrivateDecl()
3324 VD->addAttr(OMPThreadPrivateDeclAttr::CreateImplicit( in CheckOMPThreadPrivateDecl()
3327 ML->DeclarationMarkedOpenMPThreadPrivate(VD); in CheckOMPThreadPrivateDecl()
3333 D->setAccess(AS_public); in CheckOMPThreadPrivateDecl()
3342 if (Allocator->isTypeDependent() || Allocator->isValueDependent() || in getAllocatorKind()
3343 Allocator->isInstantiationDependent() || in getAllocatorKind()
3344 Allocator->containsUnexpandedParameterPack()) in getAllocatorKind()
3348 const Expr *AE = Allocator->IgnoreParenImpCasts(); in getAllocatorKind()
3349 AE->IgnoreImpCasts()->Profile(AEId, S.getASTContext(), /*Canonical=*/true); in getAllocatorKind()
3352 const Expr *DefAllocator = Stack->getAllocator(AllocatorKind); in getAllocatorKind()
3354 DefAllocator->IgnoreImpCasts()->Profile(DAEId, S.getASTContext(), in getAllocatorKind()
3367 if (!VD->hasAttr<OMPAllocateDeclAttr>()) in checkPreviousOMPAllocateAttribute()
3369 const auto *A = VD->getAttr<OMPAllocateDeclAttr>(); in checkPreviousOMPAllocateAttribute()
3370 Expr *PrevAllocator = A->getAllocator(); in checkPreviousOMPAllocateAttribute()
3377 const Expr *AE = Allocator->IgnoreParenImpCasts(); in checkPreviousOMPAllocateAttribute()
3378 const Expr *PAE = PrevAllocator->IgnoreParenImpCasts(); in checkPreviousOMPAllocateAttribute()
3380 AE->Profile(AEId, S.Context, /*Canonical=*/true); in checkPreviousOMPAllocateAttribute()
3381 PAE->Profile(PAEId, S.Context, /*Canonical=*/true); in checkPreviousOMPAllocateAttribute()
3388 Allocator->printPretty(AllocatorStream, nullptr, S.getPrintingPolicy()); in checkPreviousOMPAllocateAttribute()
3392 PrevAllocator->printPretty(PrevAllocatorStream, nullptr, in checkPreviousOMPAllocateAttribute()
3396 Allocator ? Allocator->getExprLoc() : RefExpr->getExprLoc(); in checkPreviousOMPAllocateAttribute()
3398 Allocator ? Allocator->getSourceRange() : RefExpr->getSourceRange(); in checkPreviousOMPAllocateAttribute()
3400 PrevAllocator ? PrevAllocator->getExprLoc() : A->getLocation(); in checkPreviousOMPAllocateAttribute()
3402 PrevAllocator ? PrevAllocator->getSourceRange() : A->getRange(); in checkPreviousOMPAllocateAttribute()
3418 if (VD->hasAttr<OMPAllocateDeclAttr>()) in applyOMPAllocateAttribute()
3421 (Alignment->isTypeDependent() || Alignment->isValueDependent() || in applyOMPAllocateAttribute()
3422 Alignment->isInstantiationDependent() || in applyOMPAllocateAttribute()
3423 Alignment->containsUnexpandedParameterPack())) in applyOMPAllocateAttribute()
3427 (Allocator->isTypeDependent() || Allocator->isValueDependent() || in applyOMPAllocateAttribute()
3428 Allocator->isInstantiationDependent() || in applyOMPAllocateAttribute()
3429 Allocator->containsUnexpandedParameterPack())) in applyOMPAllocateAttribute()
3433 VD->addAttr(A); in applyOMPAllocateAttribute()
3435 ML->DeclarationMarkedOpenMPAllocate(VD, A); in applyOMPAllocateAttribute()
3450 !DSAStack->hasRequiresDeclWithClause<OMPDynamicAllocatorsClause>()) in ActOnOpenMPAllocateDirective()
3455 Allocator = AC->getAllocator(); in ActOnOpenMPAllocateDirective()
3457 Alignment = AC->getAlignment(); in ActOnOpenMPAllocateDirective()
3466 auto *VD = cast<VarDecl>(DE->getDecl()); in ActOnOpenMPAllocateDirective()
3469 if (VD->getTLSKind() != VarDecl::TLS_None || in ActOnOpenMPAllocateDirective()
3470 VD->hasAttr<OMPThreadPrivateDeclAttr>() || in ActOnOpenMPAllocateDirective()
3471 (VD->getStorageClass() == SC_Register && VD->hasAttr<AsmLabelAttr>() && in ActOnOpenMPAllocateDirective()
3472 !VD->isLocalVarDecl())) in ActOnOpenMPAllocateDirective()
3485 if (Allocator && VD->hasGlobalStorage()) { in ActOnOpenMPAllocateDirective()
3487 Diag(Allocator->getExprLoc(), in ActOnOpenMPAllocateDirective()
3489 << Allocator->getSourceRange(); in ActOnOpenMPAllocateDirective()
3490 bool IsDecl = VD->isThisDeclarationADefinition(getASTContext()) == in ActOnOpenMPAllocateDirective()
3492 Diag(VD->getLocation(), in ActOnOpenMPAllocateDirective()
3501 DE->getSourceRange()); in ActOnOpenMPAllocateDirective()
3508 D->setAccess(AS_public); in ActOnOpenMPAllocateDirective()
3509 Owner->addDecl(D); in ActOnOpenMPAllocateDirective()
3517 if (!SemaRef.CurContext->isFileContext()) { in ActOnOpenMPRequiresDirective()
3522 SemaRef.CurContext->addDecl(D); in ActOnOpenMPRequiresDirective()
3523 DSAStack->addRequiresDecl(D); in ActOnOpenMPRequiresDirective()
3559 while (Ctx->getLexicalParent()) in ActOnOpenMPAssumesDirective()
3560 Ctx = Ctx->getLexicalParent(); in ActOnOpenMPAssumesDirective()
3564 for (auto *SubDC : DC->decls()) { in ActOnOpenMPAssumesDirective()
3565 if (SubDC->isInvalidDecl()) in ActOnOpenMPAssumesDirective()
3568 DeclContexts.push_back(CTD->getTemplatedDecl()); in ActOnOpenMPAssumesDirective()
3569 llvm::append_range(DeclContexts, CTD->specializations()); in ActOnOpenMPAssumesDirective()
3575 F->addAttr(AA); in ActOnOpenMPAssumesDirective()
3594 DSAStack->getEncounteredTargetLocs(); in CheckOMPRequiresDecl()
3595 SourceLocation AtomicLoc = DSAStack->getAtomicDirectiveLoc(); in CheckOMPRequiresDecl()
3604 << "target" << getOpenMPClauseName(CNew->getClauseKind()); in CheckOMPRequiresDecl()
3612 << "atomic" << getOpenMPClauseName(CNew->getClauseKind()); in CheckOMPRequiresDecl()
3619 if (!DSAStack->hasDuplicateRequiresClause(ClauseList)) in CheckOMPRequiresDecl()
3630 SemaRef.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa) in reportOriginalDsa()
3647 auto ReportLoc = D->getLocation(); in reportOriginalDsa()
3660 } else if (VD && VD->isStaticLocal()) in reportOriginalDsa()
3662 else if (VD && VD->isStaticDataMember()) in reportOriginalDsa()
3664 else if (VD && VD->isFileVarDecl()) in reportOriginalDsa()
3666 else if (D->getType().isConstant(SemaRef.getASTContext())) in reportOriginalDsa()
3668 else if (VD && VD->isLocalVarDecl() && DVar.CKind == OMPC_private) { in reportOriginalDsa()
3675 << getOpenMPDirectiveName(Stack->getCurrentDirective()); in reportOriginalDsa()
3701 // If implicit-behavior is present, each variable referenced in the in getMapClauseKindFromModifier()
3702 // construct in the category specified by variable-category is treated as if in getMapClauseKindFromModifier()
3703 // it had been listed in a map clause with the map-type of alloc and in getMapClauseKindFromModifier()
3704 // map-type-modifier of present. in getMapClauseKindFromModifier()
3744 if (!S->hasAssociatedStmt() || !S->getAssociatedStmt()) in VisitSubCaptures()
3746 if (S->getDirectiveKind() == OMPD_atomic || in VisitSubCaptures()
3747 S->getDirectiveKind() == OMPD_critical || in VisitSubCaptures()
3748 S->getDirectiveKind() == OMPD_section || in VisitSubCaptures()
3749 S->getDirectiveKind() == OMPD_master || in VisitSubCaptures()
3750 S->getDirectiveKind() == OMPD_masked || in VisitSubCaptures()
3751 S->getDirectiveKind() == OMPD_scope || in VisitSubCaptures()
3752 isOpenMPLoopTransformationDirective(S->getDirectiveKind())) { in VisitSubCaptures()
3753 Visit(S->getAssociatedStmt()); in VisitSubCaptures()
3756 visitSubCaptures(S->getInnermostCapturedStmt()); in VisitSubCaptures()
3757 // Try to capture inner this->member references to generate correct mappings in VisitSubCaptures()
3760 (isOpenMPTargetExecutionDirective(Stack->getCurrentDirective()) && in VisitSubCaptures()
3761 llvm::any_of(S->getInnermostCapturedStmt()->captures(), in VisitSubCaptures()
3767 Visit(S->getInnermostCapturedStmt()->getCapturedStmt()); in VisitSubCaptures()
3772 if (isOpenMPTaskingDirective(S->getDirectiveKind()) && in VisitSubCaptures()
3773 !isOpenMPTaskLoopDirective(S->getDirectiveKind())) { in VisitSubCaptures()
3774 for (OMPClause *C : S->clauses()) in VisitSubCaptures()
3776 for (Expr *Ref : FC->varlists()) in VisitSubCaptures()
3784 if (TryCaptureCXXThisMembers || E->isTypeDependent() || in VisitDeclRefExpr()
3785 E->isValueDependent() || E->containsUnexpandedParameterPack() || in VisitDeclRefExpr()
3786 E->isInstantiationDependent() || in VisitDeclRefExpr()
3787 E->isNonOdrUse() == clang::NOUR_Unevaluated) in VisitDeclRefExpr()
3789 if (auto *VD = dyn_cast<VarDecl>(E->getDecl())) { in VisitDeclRefExpr()
3791 if (!CS || (isa<OMPCapturedExprDecl>(VD) && !CS->capturesVariable(VD) && in VisitDeclRefExpr()
3792 !Stack->getTopDSA(VD, /*FromParent=*/false).RefExpr && in VisitDeclRefExpr()
3793 !Stack->isImplicitDefaultFirstprivateFD(VD))) { in VisitDeclRefExpr()
3795 if (!CED->hasAttr<OMPCaptureNoInitAttr>()) { in VisitDeclRefExpr()
3796 Visit(CED->getInit()); in VisitDeclRefExpr()
3799 } else if (VD->isImplicit() || isa<OMPCapturedExprDecl>(VD)) in VisitDeclRefExpr()
3802 if (!Stack->isImplicitDefaultFirstprivateFD(VD)) in VisitDeclRefExpr()
3804 VD = VD->getCanonicalDecl(); in VisitDeclRefExpr()
3806 if (VD->hasLocalStorage() && CS && !CS->capturesVariable(VD) && in VisitDeclRefExpr()
3807 !Stack->isImplicitDefaultFirstprivateFD(VD) && in VisitDeclRefExpr()
3808 !Stack->isImplicitTaskFirstprivate(VD)) in VisitDeclRefExpr()
3811 if (Stack->isUsesAllocatorsDecl(VD)) in VisitDeclRefExpr()
3814 DSAStackTy::DSAVarData DVar = Stack->getTopDSA(VD, /*FromParent=*/false); in VisitDeclRefExpr()
3822 if (VD->hasGlobalStorage() && CS && !CS->capturesVariable(VD) && in VisitDeclRefExpr()
3823 (Stack->hasRequiresDeclWithClause<OMPUnifiedSharedMemoryClause>() || in VisitDeclRefExpr()
3825 !Stack->isImplicitDefaultFirstprivateFD(VD) && in VisitDeclRefExpr()
3826 !Stack->isImplicitTaskFirstprivate(VD)) in VisitDeclRefExpr()
3829 SourceLocation ELoc = E->getExprLoc(); in VisitDeclRefExpr()
3830 OpenMPDirectiveKind DKind = Stack->getCurrentDirective(); in VisitDeclRefExpr()
3832 // in the construct, and does not have a predetermined data-sharing in VisitDeclRefExpr()
3833 // attribute, must have its data-sharing attribute explicitly determined in VisitDeclRefExpr()
3834 // by being listed in a data-sharing attribute clause. in VisitDeclRefExpr()
3836 (Stack->getDefaultDSA() == DSA_none || in VisitDeclRefExpr()
3837 Stack->getDefaultDSA() == DSA_private || in VisitDeclRefExpr()
3838 Stack->getDefaultDSA() == DSA_firstprivate) && in VisitDeclRefExpr()
3841 bool InheritedDSA = Stack->getDefaultDSA() == DSA_none; in VisitDeclRefExpr()
3842 if (!InheritedDSA && (Stack->getDefaultDSA() == DSA_firstprivate || in VisitDeclRefExpr()
3843 Stack->getDefaultDSA() == DSA_private)) { in VisitDeclRefExpr()
3845 Stack->getImplicitDSA(VD, /*FromParent=*/false); in VisitDeclRefExpr()
3850 if (Stack->getDefaultDSA() == DSA_none) in VisitDeclRefExpr()
3855 // If implicit-behavior is none, each variable referenced in the in VisitDeclRefExpr()
3856 // construct that does not have a predetermined data-sharing attribute in VisitDeclRefExpr()
3858 // directive must be listed in a data-mapping attribute clause, a in VisitDeclRefExpr()
3859 // data-sharing attribute clause (including a data-sharing attribute in VisitDeclRefExpr()
3865 bool IsModifierNone = Stack->getDefaultmapModifier(ClauseKind) == in VisitDeclRefExpr()
3869 // Only check for data-mapping attribute and is_device_ptr here in VisitDeclRefExpr()
3871 // have a data-sharing attribute above in VisitDeclRefExpr()
3872 if (!Stack->checkMappableExprComponentListsForDecl( in VisitDeclRefExpr()
3879 return MI != ME && MI->getAssociatedDeclaration() == VD; in VisitDeclRefExpr()
3887 bool IsModifierPresent = Stack->getDefaultmapModifier(ClauseKind) == in VisitDeclRefExpr()
3899 !Stack->isLoopControlVariable(VD).first) { in VisitDeclRefExpr()
3900 if (!Stack->checkMappableExprComponentListsForDecl( in VisitDeclRefExpr()
3927 VD->getType().getNonReferenceType()->getAsCXXRecordDecl()) in VisitDeclRefExpr()
3928 IsFirstprivate = RD->isLambda(); in VisitDeclRefExpr()
3930 IsFirstprivate || (Stack->mustBeFirstprivate(ClauseKind) && !Res); in VisitDeclRefExpr()
3935 Stack->getDefaultmapModifier(ClauseKind); in VisitDeclRefExpr()
3948 DVar = Stack->hasInnermostDSA( in VisitDeclRefExpr()
3965 // Define implicit data-sharing attributes for task. in VisitDeclRefExpr()
3966 DVar = Stack->getImplicitDSA(VD, /*FromParent=*/false); in VisitDeclRefExpr()
3968 (((Stack->getDefaultDSA() == DSA_firstprivate && in VisitDeclRefExpr()
3970 (Stack->getDefaultDSA() == DSA_private && in VisitDeclRefExpr()
3973 !Stack->isLoopControlVariable(VD).first) { in VisitDeclRefExpr()
3974 if (Stack->getDefaultDSA() == DSA_private) in VisitDeclRefExpr()
3985 Stack->addToParentTargetRegionLinkGlobals(E); in VisitDeclRefExpr()
3991 if (E->isTypeDependent() || E->isValueDependent() || in VisitMemberExpr()
3992 E->containsUnexpandedParameterPack() || E->isInstantiationDependent()) in VisitMemberExpr()
3994 auto *FD = dyn_cast<FieldDecl>(E->getMemberDecl()); in VisitMemberExpr()
3995 OpenMPDirectiveKind DKind = Stack->getCurrentDirective(); in VisitMemberExpr()
3996 if (auto *TE = dyn_cast<CXXThisExpr>(E->getBase()->IgnoreParenCasts())) { in VisitMemberExpr()
3999 DSAStackTy::DSAVarData DVar = Stack->getTopDSA(FD, /*FromParent=*/false); in VisitMemberExpr()
4006 !Stack->isLoopControlVariable(FD).first && in VisitMemberExpr()
4007 !Stack->checkMappableExprComponentListsForDecl( in VisitMemberExpr()
4015 ->getBase() in VisitMemberExpr()
4016 ->IgnoreParens()); in VisitMemberExpr()
4019 // A bit-field cannot appear in a map clause. in VisitMemberExpr()
4021 if (FD->isBitField()) in VisitMemberExpr()
4026 if (Stack->isClassPreviouslyMapped(TE->getType())) in VisitMemberExpr()
4030 Stack->getDefaultmapModifier(OMPC_DEFAULTMAP_aggregate); in VisitMemberExpr()
4039 SourceLocation ELoc = E->getExprLoc(); in VisitMemberExpr()
4044 DVar = Stack->hasInnermostDSA( in VisitMemberExpr()
4061 // Define implicit data-sharing attributes for task. in VisitMemberExpr()
4062 DVar = Stack->getImplicitDSA(FD, /*FromParent=*/false); in VisitMemberExpr()
4064 !Stack->isLoopControlVariable(FD).first) { in VisitMemberExpr()
4066 // region. Do not mark it as firstprivate unless there is no captured in VisitMemberExpr()
4077 Stack->getCurrentDirective(), in VisitMemberExpr()
4081 CurComponents.back().getAssociatedDeclaration()->getCanonicalDecl()); in VisitMemberExpr()
4082 if (!Stack->checkMappableExprComponentListsForDecl( in VisitMemberExpr()
4092 if (CCI->getAssociatedExpression()->getStmtClass() != in VisitMemberExpr()
4093 SC.getAssociatedExpression()->getStmtClass()) in VisitMemberExpr()
4099 CCI->getAssociatedExpression()))) in VisitMemberExpr()
4102 const Decl *CCD = CCI->getAssociatedDeclaration(); in VisitMemberExpr()
4104 CCD = CCD ? CCD->getCanonicalDecl() : nullptr; in VisitMemberExpr()
4105 SCD = SCD ? SCD->getCanonicalDecl() : nullptr; in VisitMemberExpr()
4114 Visit(E->getBase()); in VisitMemberExpr()
4117 Visit(E->getBase()); in VisitMemberExpr()
4121 for (OMPClause *C : S->clauses()) { in VisitOMPExecutableDirective()
4131 C->isImplicit() && in VisitOMPExecutableDirective()
4132 !isOpenMPTaskingDirective(Stack->getCurrentDirective()))) { in VisitOMPExecutableDirective()
4133 for (Stmt *CC : C->children()) { in VisitOMPExecutableDirective()
4149 for (Stmt *C : S->arguments()) { in VisitCallExpr()
4151 // Check implicitly captured variables in the task-based directives to in VisitCallExpr()
4156 if (Expr *Callee = S->getCallee()) { in VisitCallExpr()
4157 auto *CI = Callee->IgnoreParenImpCasts(); in VisitCallExpr()
4159 Visit(CE->getBase()); in VisitCallExpr()
4165 for (Stmt *C : S->children()) { in VisitStmt()
4167 // Check implicitly captured variables in the task-based directives to in VisitStmt()
4175 for (const CapturedStmt::Capture &Cap : S->captures()) { in visitSubCaptures()
4179 // Do not try to map the variable if it or its sub-component was mapped in visitSubCaptures()
4181 if (isOpenMPTargetExecutionDirective(Stack->getCurrentDirective()) && in visitSubCaptures()
4182 Stack->checkMappableExprComponentListsForDecl( in visitSubCaptures()
4188 SemaRef, VD, VD->getType().getNonLValueExprType(SemaRef.Context), in visitSubCaptures()
4213 if (isOpenMPTargetExecutionDirective(S->getCurrentDirective())) { in DSAAttrChecker()
4214 for (DeclRefExpr *E : Stack->getLinkGlobals()) in DSAAttrChecker()
4235 Stack->handleConstructTrait(Traits, ScopeEntry); in handleDeclareVariantConstructTrait()
4351 auto MarkAsInlined = [&](CapturedRegionScopeInfo *CSI) { in processCapturedRegions() argument
4352 CSI->TheCapturedDecl->addAttr(AlwaysInlineAttr::CreateImplicit( in processCapturedRegions()
4414 DSAStack->getConstructLoc()); in ActOnOpenMPRegionStart()
4418 DSAStack->setContext(SemaRef.CurContext); in ActOnOpenMPRegionStart()
4423 return getOpenMPCaptureLevels(DSAStack->getDirective(Level)); in getNumberOfConstructScopes()
4438 Expr *Init = AsExpression ? CaptureExpr : CaptureExpr->IgnoreImpCasts(); in buildCaptureDecl()
4439 QualType Ty = Init->getType(); in buildCaptureDecl()
4440 if (CaptureExpr->getObjectKind() == OK_Ordinary && CaptureExpr->isGLValue()) { in buildCaptureDecl()
4446 S.CreateBuiltinUnaryOp(CaptureExpr->getExprLoc(), UO_AddrOf, Init); in buildCaptureDecl()
4454 CaptureExpr->getBeginLoc()); in buildCaptureDecl()
4456 CED->addAttr(OMPCaptureNoInitAttr::CreateImplicit(C)); in buildCaptureDecl()
4457 CurContext->addHiddenDecl(CED); in buildCaptureDecl()
4469 CD = buildCaptureDecl(S, D->getIdentifier(), CaptureExpr, WithInit, in buildCapture()
4472 return buildDeclRefExpr(S, CD, CD->getType().getNonReferenceType(), in buildCapture()
4473 CaptureExpr->getExprLoc()); in buildCapture()
4483 Ref = buildDeclRefExpr(S, CD, CD->getType().getNonReferenceType(), in buildCapture()
4484 CaptureExpr->getExprLoc()); in buildCapture()
4488 CaptureExpr->getObjectKind() == OK_Ordinary && CaptureExpr->isGLValue() && in buildCapture()
4489 Ref->getType()->isPointerType()) { in buildCapture()
4490 Res = S.CreateBuiltinUnaryOp(CaptureExpr->getExprLoc(), UO_Deref, Ref); in buildCapture()
4519 while (--ThisCaptureLevel >= 0) in ~CaptureRegionUnwinderRAII()
4527 // Capture variables captured by reference in lambdas for target-based in tryCaptureOpenMPLambdas()
4529 if (!SemaRef.CurContext->isDependentContext() && in tryCaptureOpenMPLambdas()
4530 (isOpenMPTargetExecutionDirective(DSAStack->getCurrentDirective()) || in tryCaptureOpenMPLambdas()
4532 DSAStack->getCurrentDirective()))) { in tryCaptureOpenMPLambdas()
4533 QualType Type = V->getType(); in tryCaptureOpenMPLambdas()
4536 ->getAsCXXRecordDecl()) { in tryCaptureOpenMPLambdas()
4538 DSAStack->isForceCaptureByReferenceInTargetExecutable(); in tryCaptureOpenMPLambdas()
4539 DSAStack->setForceCaptureByReferenceInTargetExecutable( in tryCaptureOpenMPLambdas()
4541 if (RD->isLambda()) { in tryCaptureOpenMPLambdas()
4544 RD->getCaptureFields(Captures, ThisCapture); in tryCaptureOpenMPLambdas()
4545 for (const LambdaCapture &LC : RD->captures()) { in tryCaptureOpenMPLambdas()
4548 DeclContext *VDC = VD->getDeclContext(); in tryCaptureOpenMPLambdas()
4549 if (!VDC->Encloses(SemaRef.CurContext)) in tryCaptureOpenMPLambdas()
4555 ThisTy, ThisCapture->getType())) in tryCaptureOpenMPLambdas()
4560 DSAStack->setForceCaptureByReferenceInTargetExecutable( in tryCaptureOpenMPLambdas()
4572 if (Clause->getClauseKind() == OMPC_ordered) in checkOrderedOrderSpecified()
4574 else if (Clause->getClauseKind() == OMPC_order) { in checkOrderedOrderSpecified()
4576 if (Order->getKind() != OMPC_ORDER_concurrent) in checkOrderedOrderSpecified()
4584 S.Diag(Order->getKindKwLoc(), in checkOrderedOrderSpecified()
4588 << SourceRange(Order->getBeginLoc(), Order->getEndLoc()); in checkOrderedOrderSpecified()
4589 S.Diag(Ordered->getBeginLoc(), diag::note_omp_ordered_param) in checkOrderedOrderSpecified()
4590 << 0 << SourceRange(Ordered->getBeginLoc(), Ordered->getEndLoc()); in checkOrderedOrderSpecified()
4598 handleDeclareVariantConstructTrait(DSAStack, DSAStack->getCurrentDirective(), in ActOnOpenMPRegionEnd()
4600 if (!isOpenMPCapturingDirective(DSAStack->getCurrentDirective())) in ActOnOpenMPRegionEnd()
4605 SemaRef, ErrorFound, DSAStack->getCurrentDirective()); in ActOnOpenMPRegionEnd()
4612 getOpenMPCaptureRegions(CaptureRegions, DSAStack->getCurrentDirective()); in ActOnOpenMPRegionEnd()
4620 (isOpenMPTaskingDirective(DSAStack->getCurrentDirective()) || in ActOnOpenMPRegionEnd()
4621 DSAStack->getCurrentDirective() == OMPD_target) && in ActOnOpenMPRegionEnd()
4622 Clause->getClauseKind() == OMPC_in_reduction) { in ActOnOpenMPRegionEnd()
4626 for (Expr *E : IRC->taskgroup_descriptors()) in ActOnOpenMPRegionEnd()
4630 if (isOpenMPPrivate(Clause->getClauseKind()) || in ActOnOpenMPRegionEnd()
4631 Clause->getClauseKind() == OMPC_copyprivate || in ActOnOpenMPRegionEnd()
4634 Clause->getClauseKind() == OMPC_copyin)) { in ActOnOpenMPRegionEnd()
4635 DSAStack->setForceVarCapturing(Clause->getClauseKind() == OMPC_copyin); in ActOnOpenMPRegionEnd()
4637 for (Stmt *VarRef : Clause->children()) { in ActOnOpenMPRegionEnd()
4642 DSAStack->setForceVarCapturing(/*V=*/false); in ActOnOpenMPRegionEnd()
4648 if (Expr *E = C->getPostUpdateExpr()) in ActOnOpenMPRegionEnd()
4652 if (Clause->getClauseKind() == OMPC_schedule) in ActOnOpenMPRegionEnd()
4654 else if (Clause->getClauseKind() == OMPC_ordered) in ActOnOpenMPRegionEnd()
4656 else if (Clause->getClauseKind() == OMPC_linear) in ActOnOpenMPRegionEnd()
4660 for (Expr *E : DSAStack->getInnerAllocators()) in ActOnOpenMPRegionEnd()
4666 (SC->getFirstScheduleModifier() == OMPC_SCHEDULE_MODIFIER_nonmonotonic || in ActOnOpenMPRegionEnd()
4667 SC->getSecondScheduleModifier() == in ActOnOpenMPRegionEnd()
4670 Diag(SC->getFirstScheduleModifier() == OMPC_SCHEDULE_MODIFIER_nonmonotonic in ActOnOpenMPRegionEnd()
4671 ? SC->getFirstScheduleModifierLoc() in ActOnOpenMPRegionEnd()
4672 : SC->getSecondScheduleModifierLoc(), in ActOnOpenMPRegionEnd()
4677 << SourceRange(OC->getBeginLoc(), OC->getEndLoc()); in ActOnOpenMPRegionEnd()
4680 // OpenMP 5.0, 2.9.2 Worksharing-Loop Construct, Restrictions. in ActOnOpenMPRegionEnd()
4685 if (!LCs.empty() && OC && OC->getNumForLoops()) { in ActOnOpenMPRegionEnd()
4687 Diag(C->getBeginLoc(), diag::err_omp_linear_ordered) in ActOnOpenMPRegionEnd()
4688 << SourceRange(OC->getBeginLoc(), OC->getEndLoc()); in ActOnOpenMPRegionEnd()
4692 if (isOpenMPWorksharingDirective(DSAStack->getCurrentDirective()) && in ActOnOpenMPRegionEnd()
4693 isOpenMPSimdDirective(DSAStack->getCurrentDirective()) && OC && in ActOnOpenMPRegionEnd()
4694 OC->getNumForLoops()) { in ActOnOpenMPRegionEnd()
4695 Diag(OC->getBeginLoc(), diag::err_omp_ordered_simd) in ActOnOpenMPRegionEnd()
4696 << getOpenMPDirectiveName(DSAStack->getCurrentDirective()); in ActOnOpenMPRegionEnd()
4710 OpenMPDirectiveKind CaptureRegion = C->getCaptureRegion(); in ActOnOpenMPRegionEnd()
4718 if (auto *DS = cast_or_null<DeclStmt>(C->getPreInitStmt())) { in ActOnOpenMPRegionEnd()
4719 for (Decl *D : DS->decls()) in ActOnOpenMPRegionEnd()
4720 SemaRef.MarkVariableReferenced(D->getLocation(), in ActOnOpenMPRegionEnd()
4731 for (unsigned I = 0, End = UAC->getNumberOfAllocators(); I < End; in ActOnOpenMPRegionEnd()
4733 OMPUsesAllocatorsClause::Data D = UAC->getAllocatorData(I); in ActOnOpenMPRegionEnd()
4746 if (RC->getModifier() != OMPC_REDUCTION_inscan) in ActOnOpenMPRegionEnd()
4748 for (Expr *E : RC->copy_array_temps()) in ActOnOpenMPRegionEnd()
4753 for (Expr *E : AC->varlists()) in ActOnOpenMPRegionEnd()
4759 DSAStack->setBodyComplete(); in ActOnOpenMPRegionEnd()
4787 if (!Stack->getCurScope()) in checkNestingOfRegions()
4790 OpenMPDirectiveKind ParentRegion = Stack->getParentDirective(); in checkNestingOfRegions()
4809 if (SemaRef.LangOpts.OpenMP >= 51 && Stack->isParentOrderConcurrent() && in checkNestingOfRegions()
4882 // A cancellation point construct for which construct-type-clause is in checkNestingOfRegions()
4884 // point construct for which construct-type-clause is not taskgroup must in checkNestingOfRegions()
4886 // specified in construct-type-clause. in checkNestingOfRegions()
4887 // A cancel construct for which construct-type-clause is taskgroup must be in checkNestingOfRegions()
4889 // construct-type-clause is not taskgroup must be closely nested inside an in checkNestingOfRegions()
4891 // construct-type-clause. in checkNestingOfRegions()
4917 bool DeadLock = Stack->hasDirective( in checkNestingOfRegions()
4975 Stack->isParentOrderedRegion()); in checkNestingOfRegions()
5005 // distribute, distribute simd, distribute parallel worksharing-loop, in checkNestingOfRegions()
5006 // distribute parallel worksharing-loop SIMD, loop, parallel regions, in checkNestingOfRegions()
5043 NestingProhibited = Stack->hasDirective( in checkNestingOfRegions()
5083 // At most one if clause without a directive-name-modifier can appear on in checkIfClauses()
5085 OpenMPDirectiveKind CurNM = IC->getNameModifier(); in checkIfClauses()
5087 S.Diag(C->getBeginLoc(), diag::err_omp_more_one_clause) in checkIfClauses()
5092 NameModifierLoc.push_back(IC->getNameModifierLoc()); in checkIfClauses()
5100 // At most one if clause with the particular directive-name-modifier can in checkIfClauses()
5103 S.Diag(IC->getNameModifierLoc(), in checkIfClauses()
5110 // If any if clause on the directive includes a directive-name-modifier then in checkIfClauses()
5111 // all if clauses on the directive must include a directive-name-modifier. in checkIfClauses()
5114 S.Diag(FoundNameModifiers[OMPD_unknown]->getBeginLoc(), in checkIfClauses()
5121 AllowedNameModifiers.size() - NamedModifiersNumber; in checkIfClauses()
5136 S.Diag(FoundNameModifiers[OMPD_unknown]->getCondition()->getBeginLoc(), in checkIfClauses()
5153 if (RefExpr->isTypeDependent() || RefExpr->isValueDependent() || in getPrivateItem()
5154 RefExpr->containsUnexpandedParameterPack()) in getPrivateItem()
5162 RefExpr = RefExpr->IgnoreParens(); in getPrivateItem()
5164 NoArrayExpr = -1, in getPrivateItem()
5170 Expr *Base = ASE->getBase()->IgnoreParenImpCasts(); in getPrivateItem()
5172 Base = TempASE->getBase()->IgnoreParenImpCasts(); in getPrivateItem()
5176 Expr *Base = OASE->getBase()->IgnoreParenImpCasts(); in getPrivateItem()
5178 Base = TempOASE->getBase()->IgnoreParenImpCasts(); in getPrivateItem()
5180 Base = TempASE->getBase()->IgnoreParenImpCasts(); in getPrivateItem()
5185 ELoc = RefExpr->getExprLoc(); in getPrivateItem()
5186 ERange = RefExpr->getSourceRange(); in getPrivateItem()
5187 RefExpr = RefExpr->IgnoreParenImpCasts(); in getPrivateItem()
5190 if ((!DE || !isa<VarDecl>(DE->getDecl())) && in getPrivateItem()
5192 !isa<CXXThisExpr>(ME->getBase()->IgnoreParenImpCasts()) || in getPrivateItem()
5193 !isa<FieldDecl>(ME->getMemberDecl()))) { in getPrivateItem()
5213 getCanonicalDecl(DE ? DE->getDecl() : ME->getMemberDecl()), false); in getPrivateItem()
5224 return S->isUsesAllocatorsDecl(E->getDecl()) in VisitDeclRefExpr()
5229 for (const Stmt *Child : S->children()) { in VisitStmt()
5241 assert(!S.CurContext->isDependentContext() && in checkAllocateClauses()
5242 "Expected non-dependent context."); in checkAllocateClauses()
5247 return isOpenMPPrivate(C->getClauseKind()); in checkAllocateClauses()
5251 if (Cl->getClauseKind() == OMPC_private) { in checkAllocateClauses()
5253 I = PC->private_copies().begin(); in checkAllocateClauses()
5254 It = PC->varlist_begin(); in checkAllocateClauses()
5255 Et = PC->varlist_end(); in checkAllocateClauses()
5256 } else if (Cl->getClauseKind() == OMPC_firstprivate) { in checkAllocateClauses()
5258 I = PC->private_copies().begin(); in checkAllocateClauses()
5259 It = PC->varlist_begin(); in checkAllocateClauses()
5260 Et = PC->varlist_end(); in checkAllocateClauses()
5261 } else if (Cl->getClauseKind() == OMPC_lastprivate) { in checkAllocateClauses()
5263 I = PC->private_copies().begin(); in checkAllocateClauses()
5264 It = PC->varlist_begin(); in checkAllocateClauses()
5265 Et = PC->varlist_end(); in checkAllocateClauses()
5266 } else if (Cl->getClauseKind() == OMPC_linear) { in checkAllocateClauses()
5268 I = PC->privates().begin(); in checkAllocateClauses()
5269 It = PC->varlist_begin(); in checkAllocateClauses()
5270 Et = PC->varlist_end(); in checkAllocateClauses()
5271 } else if (Cl->getClauseKind() == OMPC_reduction) { in checkAllocateClauses()
5273 I = PC->privates().begin(); in checkAllocateClauses()
5274 It = PC->varlist_begin(); in checkAllocateClauses()
5275 Et = PC->varlist_end(); in checkAllocateClauses()
5276 } else if (Cl->getClauseKind() == OMPC_task_reduction) { in checkAllocateClauses()
5278 I = PC->privates().begin(); in checkAllocateClauses()
5279 It = PC->varlist_begin(); in checkAllocateClauses()
5280 Et = PC->varlist_end(); in checkAllocateClauses()
5281 } else if (Cl->getClauseKind() == OMPC_in_reduction) { in checkAllocateClauses()
5283 I = PC->privates().begin(); in checkAllocateClauses()
5284 It = PC->varlist_begin(); in checkAllocateClauses()
5285 Et = PC->varlist_end(); in checkAllocateClauses()
5300 cast<VarDecl>(cast<DeclRefExpr>(*I)->getDecl())); in checkAllocateClauses()
5307 !Stack->hasRequiresDeclWithClause<OMPDynamicAllocatorsClause>() && in checkAllocateClauses()
5308 isOpenMPTargetExecutionDirective(Stack->getCurrentDirective()) && in checkAllocateClauses()
5309 AC->getAllocator()) { in checkAllocateClauses()
5310 Expr *Allocator = AC->getAllocator(); in checkAllocateClauses()
5318 S.Diag(Allocator->getExprLoc(), in checkAllocateClauses()
5320 << Allocator->getSourceRange(); in checkAllocateClauses()
5323 getAllocatorKind(S, Stack, AC->getAllocator()); in checkAllocateClauses()
5329 (isOpenMPTaskingDirective(Stack->getCurrentDirective()) || in checkAllocateClauses()
5330 isOpenMPTargetExecutionDirective(Stack->getCurrentDirective()))) { in checkAllocateClauses()
5331 S.Diag(AC->getAllocator()->getExprLoc(), in checkAllocateClauses()
5333 << getOpenMPDirectiveName(Stack->getCurrentDirective()); in checkAllocateClauses()
5335 for (Expr *E : AC->varlists()) { in checkAllocateClauses()
5341 DSAStackTy::DSAVarData Data = Stack->getTopDSA(VD, /*FromParent=*/false); in checkAllocateClauses()
5343 S.Diag(E->getExprLoc(), in checkAllocateClauses()
5349 AllocatorKind, AC->getAllocator())) in checkAllocateClauses()
5353 applyOMPAllocateAttribute(S, PrivateVD, AllocatorKind, AC->getAllocator(), in checkAllocateClauses()
5354 Alignment, E->getSourceRange()); in checkAllocateClauses()
5379 VarDecl *NewVar = buildVarDecl(Actions, {}, NewE->getType(), Name, nullptr, in precomputeExpr()
5380 dyn_cast<DeclRefExpr>(E->IgnoreImplicit())); in precomputeExpr()
5383 Actions.AddInitializerToDecl(NewDeclStmt->getSingleDecl(), NewE, false); in precomputeExpr()
5406 // out-parameter instead. All inputs are implicit captures. in buildDistanceFunc()
5420 ImplicitParamDecl *DistParam = CS->getParam(0); in buildDistanceFunc()
5434 return buildDeclRefExpr(Actions, VD, VD->getType(), {}); in buildDistanceFunc()
5443 // When using a != comparison, the increment can be +1 or -1. This can be in buildDistanceFunc()
5474 // non well-formed OpenMP if Step increments/decrements in the other in buildDistanceFunc()
5500 // the step size, rounding-up the effective upper bound ensures that the in buildDistanceFunc()
5502 // Note that the rounding-up may cause an overflow in a temporary that in buildDistanceFunc()
5503 // could be avoided, but would have occurred in a C-style for-loop as in buildDistanceFunc()
5522 // Assign the result to the out-parameter. in buildDistanceFunc()
5552 // Pass the result as an out-parameter. Passing as return value would require in buildLoopVarFunc()
5564 VarDecl *StartVar = cast<VarDecl>(StartExpr->getDecl()); in buildLoopVarFunc()
5568 assert(!Invalid && "Expecting capture-by-value to work."); in buildLoopVarFunc()
5575 ImplicitParamDecl *TargetParam = CS->getParam(0); in buildLoopVarFunc()
5578 ImplicitParamDecl *IndvarParam = CS->getParam(1); in buildLoopVarFunc()
5595 // For range-based for-loops convert the loop counter value to a concrete in buildLoopVarFunc()
5617 Stmt *Init = For->getInit(); in ActOnOpenMPCanonicalLoop()
5620 LIVDecl = cast<VarDecl>(LCVarDeclStmt->getSingleDecl()); in ActOnOpenMPCanonicalLoop()
5623 assert(LCAssign->getOpcode() == BO_Assign && in ActOnOpenMPCanonicalLoop()
5625 auto *CounterRef = cast<DeclRefExpr>(LCAssign->getLHS()); in ActOnOpenMPCanonicalLoop()
5626 LIVDecl = cast<VarDecl>(CounterRef->getDecl()); in ActOnOpenMPCanonicalLoop()
5631 Cond = For->getCond(); in ActOnOpenMPCanonicalLoop()
5632 Inc = For->getInc(); in ActOnOpenMPCanonicalLoop()
5634 DeclStmt *BeginStmt = RangeFor->getBeginStmt(); in ActOnOpenMPCanonicalLoop()
5635 LIVDecl = cast<VarDecl>(BeginStmt->getSingleDecl()); in ActOnOpenMPCanonicalLoop()
5636 LUVDecl = RangeFor->getLoopVariable(); in ActOnOpenMPCanonicalLoop()
5638 Cond = RangeFor->getCond(); in ActOnOpenMPCanonicalLoop()
5639 Inc = RangeFor->getInc(); in ActOnOpenMPCanonicalLoop()
5643 QualType CounterTy = LIVDecl->getType(); in ActOnOpenMPCanonicalLoop()
5644 QualType LVTy = LUVDecl->getType(); in ActOnOpenMPCanonicalLoop()
5649 Cond = Cond->IgnoreImplicit(); in ActOnOpenMPCanonicalLoop()
5651 LHS = CondBinExpr->getLHS(); in ActOnOpenMPCanonicalLoop()
5652 RHS = CondBinExpr->getRHS(); in ActOnOpenMPCanonicalLoop()
5653 CondRel = CondBinExpr->getOpcode(); in ActOnOpenMPCanonicalLoop()
5655 assert(CondCXXOp->getNumArgs() == 2 && "Comparison should have 2 operands"); in ActOnOpenMPCanonicalLoop()
5656 LHS = CondCXXOp->getArg(0); in ActOnOpenMPCanonicalLoop()
5657 RHS = CondCXXOp->getArg(1); in ActOnOpenMPCanonicalLoop()
5658 switch (CondCXXOp->getOperator()) { in ActOnOpenMPCanonicalLoop()
5681 if (!isa<DeclRefExpr>(LHS->IgnoreImplicit()) || in ActOnOpenMPCanonicalLoop()
5682 cast<DeclRefExpr>(LHS->IgnoreImplicit())->getDecl() != LIVDecl) { in ActOnOpenMPCanonicalLoop()
5686 auto *CounterRef = cast<DeclRefExpr>(LHS->IgnoreImplicit()); in ActOnOpenMPCanonicalLoop()
5691 // std::iterator_traits<>::difference_type or decltype(it - end). in ActOnOpenMPCanonicalLoop()
5693 if (CounterTy->isIntegerType()) { in ActOnOpenMPCanonicalLoop()
5702 switch (IncUn->getOpcode()) { in ActOnOpenMPCanonicalLoop()
5709 Direction = -1; in ActOnOpenMPCanonicalLoop()
5717 if (IncBin->getOpcode() == BO_AddAssign) { in ActOnOpenMPCanonicalLoop()
5718 Step = IncBin->getRHS(); in ActOnOpenMPCanonicalLoop()
5719 } else if (IncBin->getOpcode() == BO_SubAssign) { in ActOnOpenMPCanonicalLoop()
5721 SemaRef.BuildUnaryOp(nullptr, {}, UO_Minus, IncBin->getRHS())); in ActOnOpenMPCanonicalLoop()
5725 switch (CondCXXOp->getOperator()) { in ActOnOpenMPCanonicalLoop()
5732 Ctx, llvm::APInt(Ctx.getIntWidth(LogicalTy), -1), LogicalTy, {}); in ActOnOpenMPCanonicalLoop()
5735 Step = CondCXXOp->getArg(1); in ActOnOpenMPCanonicalLoop()
5739 SemaRef.BuildUnaryOp(nullptr, {}, UO_Minus, CondCXXOp->getArg(1))); in ActOnOpenMPCanonicalLoop()
5752 SemaRef.BuildDeclRefExpr(LUVDecl, LUVDecl->getType(), VK_LValue, {}, in ActOnOpenMPCanonicalLoop()
5766 isOpenMPLoopTransformationDirective(LoopTransform->getDirectiveKind()) && in ActOnOpenMPLoopnest()
5778 /// member(s) with user-defined 'default' mapper and generate implicit map
5792 auto *MI = C->mapperlist_begin(); in processImplicitMapsWithDefaultMappers()
5793 for (auto I = C->varlist_begin(), End = C->varlist_end(); I != End; in processImplicitMapsWithDefaultMappers()
5795 // Expression is mapped using mapper - skip it. in processImplicitMapsWithDefaultMappers()
5799 // Expression is dependent - skip it, build the mapper when it gets in processImplicitMapsWithDefaultMappers()
5801 if (E->isTypeDependent() || E->isValueDependent() || in processImplicitMapsWithDefaultMappers()
5802 E->containsUnexpandedParameterPack()) in processImplicitMapsWithDefaultMappers()
5804 // Array section - need to check for the mapping of the array section in processImplicitMapsWithDefaultMappers()
5806 QualType CanonType = E->getType().getCanonicalType(); in processImplicitMapsWithDefaultMappers()
5807 if (CanonType->isSpecificBuiltinType(BuiltinType::ArraySection)) { in processImplicitMapsWithDefaultMappers()
5808 const auto *OASE = cast<ArraySectionExpr>(E->IgnoreParenImpCasts()); in processImplicitMapsWithDefaultMappers()
5810 ArraySectionExpr::getBaseOriginalType(OASE->getBase()); in processImplicitMapsWithDefaultMappers()
5812 if (const auto *ATy = BaseType->getAsArrayTypeUnsafe()) in processImplicitMapsWithDefaultMappers()
5813 ElemType = ATy->getElementType(); in processImplicitMapsWithDefaultMappers()
5815 ElemType = BaseType->getPointeeType(); in processImplicitMapsWithDefaultMappers()
5831 --ParentChain.back().second; in processImplicitMapsWithDefaultMappers()
5835 const RecordDecl *RD = BaseType.getCanonicalType()->getAsRecordDecl(); in processImplicitMapsWithDefaultMappers()
5840 // Try to find the associated user-defined mapper. in processImplicitMapsWithDefaultMappers()
5845 DefaultMapperId.setLoc(E->getExprLoc()); in processImplicitMapsWithDefaultMappers()
5847 S, Stack->getCurScope(), MapperIdScopeSpec, DefaultMapperId, in processImplicitMapsWithDefaultMappers()
5854 if (It->second) { in processImplicitMapsWithDefaultMappers()
5855 auto *OE = new (S.Context) OpaqueValueExpr(E->getExprLoc(), CanonType, in processImplicitMapsWithDefaultMappers()
5857 OE->setIsUnique(/*V=*/true); in processImplicitMapsWithDefaultMappers()
5862 BaseExpr, /*IsArrow=*/false, E->getExprLoc(), in processImplicitMapsWithDefaultMappers()
5864 DeclAccessPair::make(P.first, P.first->getAccess()), in processImplicitMapsWithDefaultMappers()
5866 P.first->getType(), VK_LValue, OK_Ordinary); in processImplicitMapsWithDefaultMappers()
5872 BaseExpr, /*IsArrow=*/false, E->getExprLoc(), in processImplicitMapsWithDefaultMappers()
5874 DeclAccessPair::make(CurFD, CurFD->getAccess()), in processImplicitMapsWithDefaultMappers()
5876 CurFD->getType(), VK_LValue, OK_Ordinary); in processImplicitMapsWithDefaultMappers()
5882 for (FieldDecl *FD : RD->fields()) { in processImplicitMapsWithDefaultMappers()
5885 QualType FieldTy = FD->getType(); in processImplicitMapsWithDefaultMappers()
5887 !(FieldTy->isStructureOrClassType() || FieldTy->isUnionType())) in processImplicitMapsWithDefaultMappers()
5904 nullptr, C->getMapTypeModifiers(), C->getMapTypeModifiersLoc(), in processImplicitMapsWithDefaultMappers()
5905 MapperIdScopeSpec, MapperId, C->getMapType(), in processImplicitMapsWithDefaultMappers()
5914 /// call in the associated loop-nest cannot be a 'parallel for'.
5923 if (D->getDirectiveKind() == llvm::omp::Directive::OMPD_loop) { in VisitOMPExecutableDirective()
5924 if (const auto *C = D->getSingleClause<OMPBindClause>()) in VisitOMPExecutableDirective()
5925 if (C->getBindKind() == OMPC_BIND_parallel) { in VisitOMPExecutableDirective()
5927 // No need to continue visiting any more in VisitOMPExecutableDirective()
5931 for (const Stmt *Child : D->children()) in VisitOMPExecutableDirective()
5938 // unless the assume-no-nested-parallelism flag has been specified. in VisitCallExpr()
5940 // translation, regardless of the assume-no-nested-parallelism. in VisitCallExpr()
5942 auto *FD = dyn_cast_or_null<FunctionDecl>(C->getCalleeDecl()); in VisitCallExpr()
5944 std::string Name = FD->getNameInfo().getAsString(); in VisitCallExpr()
5952 for (const Stmt *Child : C->children()) in VisitCallExpr()
5960 Visit(S->getCapturedDecl()->getBody()); in VisitCapturedStmt()
5966 for (const Stmt *Child : S->children()) in VisitStmt()
5996 const OpenMPDirectiveKind ParentDirective = DSAStack->getParentDirective(); in mapLoopConstruct()
6001 // [5.0:129:25-28] If the bind clause is not present on the construct and in mapLoopConstruct()
6011 Diag(DSAStack->getDefaultDSALocation(), in mapLoopConstruct()
6029 C->getClauseKind() == llvm::omp::Clause::OMPC_reduction) in mapLoopConstruct()
6030 Diag(DSAStack->getDefaultDSALocation(), in mapLoopConstruct()
6035 if (C->getClauseKind() != llvm::omp::Clause::OMPC_bind) in mapLoopConstruct()
6042 DSAStack->setCurrentDirective(OMPD_for); in mapLoopConstruct()
6043 DSAStack->setMappedDirective(OMPD_loop); in mapLoopConstruct()
6048 DSAStack->setCurrentDirective(OMPD_distribute); in mapLoopConstruct()
6049 DSAStack->setMappedDirective(OMPD_loop); in mapLoopConstruct()
6054 DSAStack->setCurrentDirective(OMPD_simd); in mapLoopConstruct()
6055 DSAStack->setMappedDirective(OMPD_loop); in mapLoopConstruct()
6070 DSAStack->setMappedDirective(OMPD_loop); in mapLoopConstruct()
6090 BindKind = BC->getBindKind(); in ActOnOpenMPExecutableDirective()
6109 // Report affected OpenMP target offloading behavior when in HIP lang-mode. in ActOnOpenMPExecutableDirective()
6123 if (AStmt && !SemaRef.CurContext->isDependentContext() && in ActOnOpenMPExecutableDirective()
6131 while (--ThisCaptureLevel >= 0) in ActOnOpenMPExecutableDirective()
6132 S = cast<CapturedStmt>(S)->getCapturedStmt(); in ActOnOpenMPExecutableDirective()
6142 CS = cast<CapturedStmt>(CS->getCapturedStmt()); in ActOnOpenMPExecutableDirective()
6166 if (DMC->getDefaultmapModifier() == OMPC_DEFAULTMAP_MODIFIER_present) in ActOnOpenMPExecutableDirective()
6167 PresentModifierLocs[DMC->getDefaultmapKind()] = in ActOnOpenMPExecutableDirective()
6168 DMC->getDefaultmapModifierLoc(); in ActOnOpenMPExecutableDirective()
6187 for (Expr *E : IRC->taskgroup_descriptors()) in ActOnOpenMPExecutableDirective()
6192 // [detach clause]... The event-handle will be considered as if it was in ActOnOpenMPExecutableDirective()
6195 ImplicitFirstprivates.push_back(DC->getEventHandler()); in ActOnOpenMPExecutableDirective()
6202 ErrorFound = cast<OMPFirstprivateClause>(Implicit)->varlist_size() != in ActOnOpenMPExecutableDirective()
6213 ErrorFound = cast<OMPPrivateClause>(Implicit)->varlist_size() != in ActOnOpenMPExecutableDirective()
6222 // if it also appears in a map clause with a map-type of tofrom in ActOnOpenMPExecutableDirective()
6228 for (Expr *E : RC->varlists()) in ActOnOpenMPExecutableDirective()
6229 if (!isa<DeclRefExpr>(E->IgnoreParenImpCasts())) in ActOnOpenMPExecutableDirective()
6245 int ClauseKindCnt = -1; in ActOnOpenMPExecutableDirective()
6259 ErrorFound |= cast<OMPMapClause>(Implicit)->varlist_size() != in ActOnOpenMPExecutableDirective()
6313 "No clauses are allowed for 'omp section' directive"); in ActOnOpenMPExecutableDirective()
6322 "No clauses are allowed for 'omp master' directive"); in ActOnOpenMPExecutableDirective()
6363 "No clauses are allowed for 'omp taskyield' directive"); in ActOnOpenMPExecutableDirective()
6365 "No associated statement allowed for 'omp taskyield' directive"); in ActOnOpenMPExecutableDirective()
6370 "No associated statement allowed for 'omp error' directive"); in ActOnOpenMPExecutableDirective()
6375 "No clauses are allowed for 'omp barrier' directive"); in ActOnOpenMPExecutableDirective()
6377 "No associated statement allowed for 'omp barrier' directive"); in ActOnOpenMPExecutableDirective()
6382 "No associated statement allowed for 'omp taskwait' directive"); in ActOnOpenMPExecutableDirective()
6391 "No associated statement allowed for 'omp flush' directive"); in ActOnOpenMPExecutableDirective()
6396 "No associated statement allowed for 'omp depobj' directive"); in ActOnOpenMPExecutableDirective()
6401 "No associated statement allowed for 'omp scan' directive"); in ActOnOpenMPExecutableDirective()
6430 "No clauses are allowed for 'omp cancellation point' directive"); in ActOnOpenMPExecutableDirective()
6431 assert(AStmt == nullptr && "No associated statement allowed for 'omp " in ActOnOpenMPExecutableDirective()
6437 "No associated statement allowed for 'omp cancel' directive"); in ActOnOpenMPExecutableDirective()
6559 "No associated statement allowed for 'omp interop' directive"); in ActOnOpenMPExecutableDirective()
6607 if (DSAStack->getDefaultDSA() == DSA_none || in ActOnOpenMPExecutableDirective()
6608 DSAStack->getDefaultDSA() == DSA_private || in ActOnOpenMPExecutableDirective()
6609 DSAStack->getDefaultDSA() == DSA_firstprivate) { in ActOnOpenMPExecutableDirective()
6612 switch (C->getClauseKind()) { in ActOnOpenMPExecutableDirective()
6615 // Do not analyze if no parent teams directive. in ActOnOpenMPExecutableDirective()
6621 cast<OMPIfClause>(C)->getNameModifier() != OMPD_target) in ActOnOpenMPExecutableDirective()
6625 cast<OMPIfClause>(C)->getNameModifier() != OMPD_parallel) in ActOnOpenMPExecutableDirective()
6637 // Do not analyze if no parent parallel directive. in ActOnOpenMPExecutableDirective()
6719 for (Stmt *CC : C->children()) { in ActOnOpenMPExecutableDirective()
6728 if (P.getFirst()->isImplicit() || isa<OMPCapturedExprDecl>(P.getFirst())) in ActOnOpenMPExecutableDirective()
6731 if (DSAStack->getDefaultDSA() == DSA_none || in ActOnOpenMPExecutableDirective()
6732 DSAStack->getDefaultDSA() == DSA_private || in ActOnOpenMPExecutableDirective()
6733 DSAStack->getDefaultDSA() == DSA_firstprivate) { in ActOnOpenMPExecutableDirective()
6734 Diag(P.second->getExprLoc(), diag::err_omp_no_dsa_for_variable) in ActOnOpenMPExecutableDirective()
6735 << P.first << P.second->getSourceRange(); in ActOnOpenMPExecutableDirective()
6736 Diag(DSAStack->getDefaultDSALocation(), diag::note_omp_default_dsa_none); in ActOnOpenMPExecutableDirective()
6738 Diag(P.second->getExprLoc(), in ActOnOpenMPExecutableDirective()
6740 << P.first << P.second->getSourceRange(); in ActOnOpenMPExecutableDirective()
6741 Diag(DSAStack->getDefaultDSALocation(), in ActOnOpenMPExecutableDirective()
6758 if (!SemaRef.CurContext->isDependentContext() && in ActOnOpenMPExecutableDirective()
6760 !(DSAStack->hasRequiresDeclWithClause<OMPUnifiedSharedMemoryClause>() || in ActOnOpenMPExecutableDirective()
6761 DSAStack->hasRequiresDeclWithClause<OMPUnifiedAddressClause>() || in ActOnOpenMPExecutableDirective()
6762 DSAStack->hasRequiresDeclWithClause<OMPReverseOffloadClause>() || in ActOnOpenMPExecutableDirective()
6763 DSAStack->hasRequiresDeclWithClause<OMPDynamicAllocatorsClause>())) { in ActOnOpenMPExecutableDirective()
6765 DSAStack->addTargetDirLocation(StartLoc); in ActOnOpenMPExecutableDirective()
6790 ADecl = FTD->getTemplatedDecl(); in ActOnOpenMPDeclareSimdDirective()
6794 Diag(ADecl->getLocation(), diag::err_omp_function_expected) << SimdId; in ActOnOpenMPDeclareSimdDirective()
6813 E = E->IgnoreParenImpCasts(); in ActOnOpenMPDeclareSimdDirective()
6815 if (const auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) in ActOnOpenMPDeclareSimdDirective()
6816 if (FD->getNumParams() > PVD->getFunctionScopeIndex() && in ActOnOpenMPDeclareSimdDirective()
6817 FD->getParamDecl(PVD->getFunctionScopeIndex()) in ActOnOpenMPDeclareSimdDirective()
6818 ->getCanonicalDecl() == PVD->getCanonicalDecl()) { in ActOnOpenMPDeclareSimdDirective()
6819 UniformedArgs.try_emplace(PVD->getCanonicalDecl(), E); in ActOnOpenMPDeclareSimdDirective()
6826 Diag(E->getExprLoc(), diag::err_omp_param_or_this_in_clause) in ActOnOpenMPDeclareSimdDirective()
6827 << FD->getDeclName() << (isa<CXXMethodDecl>(ADecl) ? 1 : 0); in ActOnOpenMPDeclareSimdDirective()
6840 E = E->IgnoreParenImpCasts(); in ActOnOpenMPDeclareSimdDirective()
6842 if (const auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) { in ActOnOpenMPDeclareSimdDirective()
6843 const VarDecl *CanonPVD = PVD->getCanonicalDecl(); in ActOnOpenMPDeclareSimdDirective()
6844 if (FD->getNumParams() > PVD->getFunctionScopeIndex() && in ActOnOpenMPDeclareSimdDirective()
6845 FD->getParamDecl(PVD->getFunctionScopeIndex()) in ActOnOpenMPDeclareSimdDirective()
6846 ->getCanonicalDecl() == CanonPVD) { in ActOnOpenMPDeclareSimdDirective()
6848 // A list-item cannot appear in more than one aligned clause. in ActOnOpenMPDeclareSimdDirective()
6850 Diag(E->getExprLoc(), diag::err_omp_used_in_clause_twice) in ActOnOpenMPDeclareSimdDirective()
6852 << E->getSourceRange(); in ActOnOpenMPDeclareSimdDirective()
6853 Diag(AlignedArgs[CanonPVD]->getExprLoc(), in ActOnOpenMPDeclareSimdDirective()
6859 QualType QTy = PVD->getType() in ActOnOpenMPDeclareSimdDirective()
6864 if (!Ty || (!Ty->isArrayType() && !Ty->isPointerType())) { in ActOnOpenMPDeclareSimdDirective()
6865 Diag(E->getExprLoc(), diag::err_omp_aligned_expected_array_or_ptr) in ActOnOpenMPDeclareSimdDirective()
6866 << QTy << getLangOpts().CPlusPlus << E->getSourceRange(); in ActOnOpenMPDeclareSimdDirective()
6867 Diag(PVD->getLocation(), diag::note_previous_decl) << PVD; in ActOnOpenMPDeclareSimdDirective()
6874 Diag(E->getExprLoc(), diag::err_omp_used_in_clause_twice) in ActOnOpenMPDeclareSimdDirective()
6875 << 2 << getOpenMPClauseName(OMPC_aligned) << E->getSourceRange(); in ActOnOpenMPDeclareSimdDirective()
6876 Diag(AlignedThis->getExprLoc(), diag::note_omp_explicit_dsa) in ActOnOpenMPDeclareSimdDirective()
6882 Diag(E->getExprLoc(), diag::err_omp_param_or_this_in_clause) in ActOnOpenMPDeclareSimdDirective()
6883 << FD->getDeclName() << (isa<CXXMethodDecl>(ADecl) ? 1 : 0); in ActOnOpenMPDeclareSimdDirective()
6886 // positive integer expression. If no optional parameter is specified, in ActOnOpenMPDeclareSimdDirective()
6887 // implementation-defined default alignments for SIMD instructions on the in ActOnOpenMPDeclareSimdDirective()
6902 // When a linear-step expression is specified in a linear clause it must be in ActOnOpenMPDeclareSimdDirective()
6903 // either a constant integer expression or an integer-typed parameter that is in ActOnOpenMPDeclareSimdDirective()
6911 E = E->IgnoreParenImpCasts(); in ActOnOpenMPDeclareSimdDirective()
6913 if (const auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) { in ActOnOpenMPDeclareSimdDirective()
6914 const VarDecl *CanonPVD = PVD->getCanonicalDecl(); in ActOnOpenMPDeclareSimdDirective()
6915 if (FD->getNumParams() > PVD->getFunctionScopeIndex() && in ActOnOpenMPDeclareSimdDirective()
6916 FD->getParamDecl(PVD->getFunctionScopeIndex()) in ActOnOpenMPDeclareSimdDirective()
6917 ->getCanonicalDecl() == CanonPVD) { in ActOnOpenMPDeclareSimdDirective()
6919 // A list-item cannot appear in more than one linear clause. in ActOnOpenMPDeclareSimdDirective()
6921 Diag(E->getExprLoc(), diag::err_omp_wrong_dsa) in ActOnOpenMPDeclareSimdDirective()
6923 << getOpenMPClauseName(OMPC_linear) << E->getSourceRange(); in ActOnOpenMPDeclareSimdDirective()
6924 Diag(LinearArgs[CanonPVD]->getExprLoc(), in ActOnOpenMPDeclareSimdDirective()
6931 Diag(E->getExprLoc(), diag::err_omp_wrong_dsa) in ActOnOpenMPDeclareSimdDirective()
6933 << getOpenMPClauseName(OMPC_uniform) << E->getSourceRange(); in ActOnOpenMPDeclareSimdDirective()
6934 Diag(UniformedArgs[CanonPVD]->getExprLoc(), in ActOnOpenMPDeclareSimdDirective()
6940 if (E->isValueDependent() || E->isTypeDependent() || in ActOnOpenMPDeclareSimdDirective()
6941 E->isInstantiationDependent() || in ActOnOpenMPDeclareSimdDirective()
6942 E->containsUnexpandedParameterPack()) in ActOnOpenMPDeclareSimdDirective()
6944 (void)CheckOpenMPLinearDecl(CanonPVD, E->getExprLoc(), LinKind, in ActOnOpenMPDeclareSimdDirective()
6945 PVD->getOriginalType(), in ActOnOpenMPDeclareSimdDirective()
6952 Diag(E->getExprLoc(), diag::err_omp_wrong_dsa) in ActOnOpenMPDeclareSimdDirective()
6955 << E->getSourceRange(); in ActOnOpenMPDeclareSimdDirective()
6956 Diag(UniformedLinearThis->getExprLoc(), diag::note_omp_explicit_dsa) in ActOnOpenMPDeclareSimdDirective()
6962 if (E->isValueDependent() || E->isTypeDependent() || in ActOnOpenMPDeclareSimdDirective()
6963 E->isInstantiationDependent() || E->containsUnexpandedParameterPack()) in ActOnOpenMPDeclareSimdDirective()
6965 (void)CheckOpenMPLinearDecl(/*D=*/nullptr, E->getExprLoc(), LinKind, in ActOnOpenMPDeclareSimdDirective()
6966 E->getType(), /*IsDeclareSimd=*/true); in ActOnOpenMPDeclareSimdDirective()
6969 Diag(E->getExprLoc(), diag::err_omp_param_or_this_in_clause) in ActOnOpenMPDeclareSimdDirective()
6970 << FD->getDeclName() << (isa<CXXMethodDecl>(ADecl) ? 1 : 0); in ActOnOpenMPDeclareSimdDirective()
6983 if (const auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) { in ActOnOpenMPDeclareSimdDirective()
6984 const VarDecl *CanonPVD = PVD->getCanonicalDecl(); in ActOnOpenMPDeclareSimdDirective()
6986 Diag(Step->getExprLoc(), diag::err_omp_expected_uniform_param) in ActOnOpenMPDeclareSimdDirective()
6987 << Step->getSourceRange(); in ActOnOpenMPDeclareSimdDirective()
6988 } else if (E->isValueDependent() || E->isTypeDependent() || in ActOnOpenMPDeclareSimdDirective()
6989 E->isInstantiationDependent() || in ActOnOpenMPDeclareSimdDirective()
6990 E->containsUnexpandedParameterPack() || in ActOnOpenMPDeclareSimdDirective()
6991 CanonPVD->getType()->hasIntegerRepresentation()) { in ActOnOpenMPDeclareSimdDirective()
6994 Diag(Step->getExprLoc(), diag::err_omp_expected_int_param) in ActOnOpenMPDeclareSimdDirective()
6995 << Step->getSourceRange(); in ActOnOpenMPDeclareSimdDirective()
7000 if (Step && !Step->isValueDependent() && !Step->isTypeDependent() && in ActOnOpenMPDeclareSimdDirective()
7001 !Step->isInstantiationDependent() && in ActOnOpenMPDeclareSimdDirective()
7002 !Step->containsUnexpandedParameterPack()) { in ActOnOpenMPDeclareSimdDirective()
7003 NewStep = PerformOpenMPImplicitIntegerConversion(Step->getExprLoc(), Step) in ActOnOpenMPDeclareSimdDirective()
7020 ADecl->addAttr(NewAttr); in ActOnOpenMPDeclareSimdDirective()
7026 assert(NewType->isFunctionProtoType() && in setPrototype()
7028 assert(FD->getType()->isFunctionNoProtoType() && in setPrototype()
7029 "Expected function with type with no prototype."); in setPrototype()
7030 assert(FDWithProto->getType()->isFunctionProtoType() && in setPrototype()
7033 FD->setType(NewType); in setPrototype()
7035 for (const ParmVarDecl *P : FDWithProto->parameters()) { in setPrototype()
7037 SourceLocation(), nullptr, P->getType(), in setPrototype()
7039 Param->setScopeInfo(0, Params.size()); in setPrototype()
7040 Param->setImplicit(); in setPrototype()
7044 FD->setParams(Params); in setPrototype()
7048 if (D->isInvalidDecl()) in ActOnFinishedFunctionDefinitionInOpenMPAssumeScope()
7052 FD = UTemplDecl->getTemplatedDecl(); in ActOnFinishedFunctionDefinitionInOpenMPAssumeScope()
7062 FD->addAttr(AA); in ActOnFinishedFunctionDefinitionInOpenMPAssumeScope()
7065 FD->addAttr(AA); in ActOnFinishedFunctionDefinitionInOpenMPAssumeScope()
7082 !DVScope.TI->isExtensionActive( in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7093 QualType FType = TInfo->getType(); in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7101 auto *CandidateDecl = Candidate->getUnderlyingDecl(); in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7105 if (FTD->getTemplateParameters()->size() == TemplateParamLists.size()) in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7106 UDecl = FTD->getTemplatedDecl(); in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7113 // non-constexpr/consteval functions. in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7114 if (UDecl->isConstexpr() && !IsConstexpr) in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7116 if (UDecl->isConsteval() && !IsConsteval) in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7119 QualType UDeclTy = UDecl->getType(); in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7120 if (!UDeclTy->isDependentType()) { in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7132 bool UseImplicitBase = !DVScope.TI->isExtensionActive( in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7134 // If no base was found we create a declaration that we use as base. in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7138 BaseD->setImplicit(true); in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7140 Bases.push_back(BaseTemplD->getTemplatedDecl()); in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7146 MangledName += D.getIdentifier()->getName(); in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope()
7164 FD = UTemplDecl->getTemplatedDecl(); in ActOnFinishedFunctionDefinitionInOpenMPDeclareVariantScope()
7170 /* NameLoc */ FD->getLocation(), FD->getType(), in ActOnFinishedFunctionDefinitionInOpenMPDeclareVariantScope()
7180 BaseFD->addAttr(OMPDeclareVariantA); in ActOnFinishedFunctionDefinitionInOpenMPDeclareVariantScope()
7194 FunctionDecl *CalleeFnDecl = CE->getDirectCallee(); in ActOnOpenMPCall()
7198 if (getLangOpts().OpenMP >= 51 && CalleeFnDecl->getIdentifier() && in ActOnOpenMPCall()
7199 CalleeFnDecl->getName().starts_with_insensitive("omp_")) { in ActOnOpenMPCall()
7201 if (Scope && Scope->isOpenMPOrderClauseScope()) in ActOnOpenMPCall()
7205 if (!CalleeFnDecl->hasAttr<OMPDeclareVariantAttr>()) in ActOnOpenMPCall()
7213 Diag(CE->getBeginLoc(), diag::warn_unknown_declare_variant_isa_trait) in ActOnOpenMPCall()
7218 DSAStack->getConstructTraits()); in ActOnOpenMPCall()
7220 QualType CalleeFnType = CalleeFnDecl->getType(); in ActOnOpenMPCall()
7226 CalleeFnDecl->specific_attrs<OMPDeclareVariantAttr>()) { in ActOnOpenMPCall()
7227 Expr *VariantRef = A->getVariantFuncRef(); in ActOnOpenMPCall()
7230 OMPTraitInfo &TI = A->getTraitInfo(); in ActOnOpenMPCall()
7240 CalleeFnDecl = CalleeFnDecl->getPreviousDecl(); in ActOnOpenMPCall()
7249 Decl *BestDecl = cast<DeclRefExpr>(BestExpr)->getDecl(); in ActOnOpenMPCall()
7268 Context, MemberCall->getImplicitObjectArgument(), in ActOnOpenMPCall()
7270 MemberCall->getValueKind(), MemberCall->getObjectKind()); in ActOnOpenMPCall()
7276 FunctionDecl *NewCalleeFnDecl = NCE->getDirectCallee(); in ActOnOpenMPCall()
7278 CalleeFnType, NewCalleeFnDecl->getType(), in ActOnOpenMPCall()
7317 ADecl = FTD->getTemplatedDecl(); in checkOpenMPDeclareVariantFunction()
7322 Diag(ADecl->getLocation(), diag::err_omp_function_expected) in checkOpenMPDeclareVariantFunction()
7330 return FD->isMultiVersion() || FD->hasAttr<TargetAttr>(); in checkOpenMPDeclareVariantFunction()
7334 Diag(FD->getLocation(), diag::err_omp_declare_variant_incompat_attributes) in checkOpenMPDeclareVariantFunction()
7340 if (FD->isUsed(false)) in checkOpenMPDeclareVariantFunction()
7342 << FD->getLocation(); in checkOpenMPDeclareVariantFunction()
7346 if (!FD->isThisDeclarationADefinition() && FD->isDefined(Definition) && in checkOpenMPDeclareVariantFunction()
7349 << FD->getLocation(); in checkOpenMPDeclareVariantFunction()
7358 return E && (E->isTypeDependent() || E->isValueDependent() || in checkOpenMPDeclareVariantFunction()
7359 E->containsUnexpandedParameterPack() || in checkOpenMPDeclareVariantFunction()
7360 E->isInstantiationDependent()); in checkOpenMPDeclareVariantFunction()
7363 if (FD->isDependentContext() || ShouldDelayChecks(VariantRef, false) || in checkOpenMPDeclareVariantFunction()
7367 // Deal with non-constant score and user condition expressions. in checkOpenMPDeclareVariantFunction()
7369 bool IsScore) -> bool { in checkOpenMPDeclareVariantFunction()
7370 if (!E || E->isIntegerConstantExpr(getASTContext())) in checkOpenMPDeclareVariantFunction()
7374 // We warn on non-constant scores and pretend they were not present. in checkOpenMPDeclareVariantFunction()
7375 Diag(E->getExprLoc(), diag::warn_omp_declare_variant_score_not_constant) in checkOpenMPDeclareVariantFunction()
7379 // We could replace a non-constant user condition with "false" but we in checkOpenMPDeclareVariantFunction()
7382 Diag(E->getExprLoc(), in checkOpenMPDeclareVariantFunction()
7391 QualType AdjustedFnType = FD->getType(); in checkOpenMPDeclareVariantFunction()
7393 const auto *PTy = AdjustedFnType->getAsAdjusted<FunctionProtoType>(); in checkOpenMPDeclareVariantFunction()
7395 Diag(FD->getLocation(), diag::err_omp_declare_variant_prototype_required) in checkOpenMPDeclareVariantFunction()
7413 if (PTy->isVariadic()) { in checkOpenMPDeclareVariantFunction()
7414 Diag(FD->getLocation(), diag::err_omp_append_args_with_varargs) << SR; in checkOpenMPDeclareVariantFunction()
7418 Params.append(PTy->param_type_begin(), PTy->param_type_end()); in checkOpenMPDeclareVariantFunction()
7420 AdjustedFnType = Context.getFunctionType(PTy->getReturnType(), Params, in checkOpenMPDeclareVariantFunction()
7421 PTy->getExtProtoInfo()); in checkOpenMPDeclareVariantFunction()
7430 if (Method && !Method->isStatic()) { in checkOpenMPDeclareVariantFunction()
7432 Context.getTypeDeclType(Method->getParent()).getTypePtr(); in checkOpenMPDeclareVariantFunction()
7439 ER = SemaRef.CreateBuiltinUnaryOp(VariantRef->getBeginLoc(), UO_AddrOf, in checkOpenMPDeclareVariantFunction()
7443 Diag(VariantRef->getExprLoc(), diag::err_omp_function_expected) in checkOpenMPDeclareVariantFunction()
7444 << VariantId << VariantRef->getSourceRange(); in checkOpenMPDeclareVariantFunction()
7451 QualType VarianPtrType = Context.getPointerType(VariantRef->getType()); in checkOpenMPDeclareVariantFunction()
7460 Diag(VariantRef->getExprLoc(), in checkOpenMPDeclareVariantFunction()
7462 << VariantRef->getType() in checkOpenMPDeclareVariantFunction()
7463 << ((Method && !Method->isStatic()) ? FnPtrType : FD->getType()) in checkOpenMPDeclareVariantFunction()
7464 << (NumAppendArgs ? 1 : 0) << VariantRef->getSourceRange(); in checkOpenMPDeclareVariantFunction()
7473 if (Method && !Method->isStatic()) { in checkOpenMPDeclareVariantFunction()
7476 PossibleAddrOfVariantRef->IgnoreImplicit())) in checkOpenMPDeclareVariantFunction()
7477 VariantRefCast = UO->getSubExpr(); in checkOpenMPDeclareVariantFunction()
7483 !ER.get()->IgnoreParenImpCasts()->getType()->isFunctionType()) { in checkOpenMPDeclareVariantFunction()
7484 Diag(VariantRef->getExprLoc(), diag::err_omp_function_expected) in checkOpenMPDeclareVariantFunction()
7485 << VariantId << VariantRef->getSourceRange(); in checkOpenMPDeclareVariantFunction()
7490 auto *DRE = dyn_cast<DeclRefExpr>(ER.get()->IgnoreParenImpCasts()); in checkOpenMPDeclareVariantFunction()
7492 Diag(VariantRef->getExprLoc(), diag::err_omp_function_expected) in checkOpenMPDeclareVariantFunction()
7493 << VariantId << VariantRef->getSourceRange(); in checkOpenMPDeclareVariantFunction()
7496 auto *NewFD = dyn_cast_or_null<FunctionDecl>(DRE->getDecl()); in checkOpenMPDeclareVariantFunction()
7498 Diag(VariantRef->getExprLoc(), diag::err_omp_function_expected) in checkOpenMPDeclareVariantFunction()
7499 << VariantId << VariantRef->getSourceRange(); in checkOpenMPDeclareVariantFunction()
7503 if (FD->getCanonicalDecl() == NewFD->getCanonicalDecl()) { in checkOpenMPDeclareVariantFunction()
7504 Diag(VariantRef->getExprLoc(), in checkOpenMPDeclareVariantFunction()
7506 << VariantRef->getSourceRange(); in checkOpenMPDeclareVariantFunction()
7513 Context.mergeFunctionTypes(AdjustedFnType, NewFD->getType()); in checkOpenMPDeclareVariantFunction()
7515 Diag(VariantRef->getExprLoc(), in checkOpenMPDeclareVariantFunction()
7517 << NewFD->getType() << FD->getType() << (NumAppendArgs ? 1 : 0) in checkOpenMPDeclareVariantFunction()
7518 << VariantRef->getSourceRange(); in checkOpenMPDeclareVariantFunction()
7521 if (NewType->isFunctionProtoType()) { in checkOpenMPDeclareVariantFunction()
7522 if (FD->getType()->isFunctionNoProtoType()) in checkOpenMPDeclareVariantFunction()
7524 else if (NewFD->getType()->isFunctionNoProtoType()) in checkOpenMPDeclareVariantFunction()
7530 if (NewFD->hasAttrs() && NewFD->hasAttr<OMPDeclareVariantAttr>()) { in checkOpenMPDeclareVariantFunction()
7531 Diag(VariantRef->getExprLoc(), in checkOpenMPDeclareVariantFunction()
7533 << VariantRef->getSourceRange(); in checkOpenMPDeclareVariantFunction()
7535 NewFD->specific_attr_begin<OMPDeclareVariantAttr>()->getRange(); in checkOpenMPDeclareVariantFunction()
7550 if (CXXFD->isVirtual()) { in checkOpenMPDeclareVariantFunction()
7551 Diag(FD->getLocation(), diag::err_omp_declare_variant_doesnt_support) in checkOpenMPDeclareVariantFunction()
7557 Diag(FD->getLocation(), diag::err_omp_declare_variant_doesnt_support) in checkOpenMPDeclareVariantFunction()
7563 Diag(FD->getLocation(), diag::err_omp_declare_variant_doesnt_support) in checkOpenMPDeclareVariantFunction()
7569 if (FD->isDeleted()) { in checkOpenMPDeclareVariantFunction()
7570 Diag(FD->getLocation(), diag::err_omp_declare_variant_doesnt_support) in checkOpenMPDeclareVariantFunction()
7575 if (FD->isDefaulted()) { in checkOpenMPDeclareVariantFunction()
7576 Diag(FD->getLocation(), diag::err_omp_declare_variant_doesnt_support) in checkOpenMPDeclareVariantFunction()
7581 if (FD->isConstexpr()) { in checkOpenMPDeclareVariantFunction()
7582 Diag(FD->getLocation(), diag::err_omp_declare_variant_doesnt_support) in checkOpenMPDeclareVariantFunction()
7583 << (NewFD->isConsteval() ? ConstevalFuncs : ConstexprFuncs); in checkOpenMPDeclareVariantFunction()
7593 VariantRef->getExprLoc(), in checkOpenMPDeclareVariantFunction()
7595 PartialDiagnosticAt(VariantRef->getExprLoc(), in checkOpenMPDeclareVariantFunction()
7597 << FD->getLocation()), in checkOpenMPDeclareVariantFunction()
7642 E = E->IgnoreParenImpCasts(); in ActOnOpenMPDeclareVariantDirective()
7644 if (const auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) { in ActOnOpenMPDeclareVariantDirective()
7645 const VarDecl *CanonPVD = PVD->getCanonicalDecl(); in ActOnOpenMPDeclareVariantDirective()
7646 if (FD->getNumParams() > PVD->getFunctionScopeIndex() && in ActOnOpenMPDeclareVariantDirective()
7647 FD->getParamDecl(PVD->getFunctionScopeIndex()) in ActOnOpenMPDeclareVariantDirective()
7648 ->getCanonicalDecl() == CanonPVD) { in ActOnOpenMPDeclareVariantDirective()
7651 Diag(DRE->getLocation(), diag::err_omp_adjust_arg_multiple_clauses) in ActOnOpenMPDeclareVariantDirective()
7660 Diag(E->getExprLoc(), diag::err_omp_param_or_this_in_clause) << FD << 0; in ActOnOpenMPDeclareVariantDirective()
7670 FD->addAttr(NewAttr); in ActOnOpenMPDeclareVariantDirective()
7678 // Structured block - An executable statement with a single entry at the in setBranchProtectedScope()
7682 CS->getCapturedDecl()->setNothrow(); in setBranchProtectedScope()
7685 ThisCaptureLevel > 1; --ThisCaptureLevel) { in setBranchProtectedScope()
7686 CS = cast<CapturedStmt>(CS->getCapturedStmt()); in setBranchProtectedScope()
7688 // Structured block - An executable statement with a single entry at the in setBranchProtectedScope()
7692 CS->getCapturedDecl()->setNothrow(); in setBranchProtectedScope()
7709 DSAStack->getTaskgroupReductionRef(), DSAStack->isCancelRegion()); in ActOnOpenMPParallelDirective()
7741 /// non-rectangular loops. Applied only for LCV with the non-iterator types,
7742 /// since only such variables can be used in non-loop invariant expressions.
7745 /// non-rectangular loops. Applied only for LCV with the non-iterator type,
7746 /// since only such variables can be used in non-loop invariant expressions.
7752 /// Index of the loop this loop depends on and forms non-rectangular loop
7755 /// Final condition for the non-rectangular loop nest support. It is used to
7767 /// Does the loop associated directive support non-rectangular loops?
7769 /// Data-sharing stack.
7771 /// A location for diagnostics (when there is no some better location).
7796 /// This will have no value when the condition is !=
7814 /// non-rectangular loop.
7822 /// Check init-expr for canonical loop form and save loop counter
7823 /// variable - #Var and its initialization value - #LB.
7825 /// Check test-expr for canonical form, save upper-bound (#UB), flags
7826 /// for less/greater and for strict/non-strict comparison.
7828 /// Check incr-expr for canonical loop form and return true if it
7874 /// Builds final condition for the non-rectangular loops.
7878 /// Returns true if the initializer forms non-rectangular loop.
7880 /// Returns true if the condition forms non-rectangular loop.
7888 /// Check the right-hand side of an assignment in the increment
7906 return LCDecl->getType()->isDependentType() || in dependent()
7907 (LB && LB->isValueDependent()) || (UB && UB->isValueDependent()) || in dependent()
7908 (Step && Step->isValueDependent()); in dependent()
7917 if (!NewLCDecl || !NewLB || NewLB->containsErrors()) in setLCDeclAndLB()
7922 if (const CXXConstructorDecl *Ctor = CE->getConstructor()) in setLCDeclAndLB()
7923 if ((Ctor->isCopyOrMoveConstructor() || in setLCDeclAndLB()
7924 Ctor->isConvertingConstructor(/*AllowExplicit=*/false)) && in setLCDeclAndLB()
7925 CE->getNumArgs() > 0 && CE->getArg(0) != nullptr) in setLCDeclAndLB()
7926 NewLB = CE->getArg(0)->IgnoreParenImpCasts(); in setLCDeclAndLB()
7939 if (!NewUB || NewUB->containsErrors()) in setUB()
7954 if (!NewStep || NewStep->containsErrors()) in setStep()
7956 if (!NewStep->isValueDependent()) { in setStep()
7958 SourceLocation StepLoc = NewStep->getBeginLoc(); in setStep()
7966 // If test-expr is of form var relational-op b and relational-op is < or in setStep()
7967 // <= then incr-expr must cause var to increase on each iteration of the in setStep()
7968 // loop. If test-expr is of form var relational-op b and relational-op is in setStep()
7969 // > or >= then incr-expr must cause var to decrease on each iteration of in setStep()
7971 // If test-expr is of form b relational-op var and relational-op is < or in setStep()
7972 // <= then incr-expr must cause var to decrease on each iteration of the in setStep()
7973 // loop. If test-expr is of form b relational-op var and relational-op is in setStep()
7974 // > or >= then incr-expr must cause var to increase on each iteration of in setStep()
7977 NewStep->getIntegerConstantExpr(SemaRef.Context); in setStep()
7978 bool IsUnsigned = !NewStep->getType()->hasSignedIntegerRepresentation(); in setStep()
7980 Result && Result->isSigned() && (Subtract != Result->isNegative()); in setStep()
7982 Result && Result->isSigned() && (Subtract == Result->isNegative()); in setStep()
7983 bool IsConstZero = Result && !Result->getBoolValue(); in setStep()
7991 SemaRef.Diag(NewStep->getExprLoc(), in setStep()
7993 << LCDecl << *TestIsLessOp << NewStep->getSourceRange(); in setStep()
8001 SemaRef.CreateBuiltinUnaryOp(NewStep->getExprLoc(), UO_Minus, NewStep) in setStep()
8013 /// Checker for the non-rectangular loops. Checks if the initializer or
8027 SemaRef.Diag(E->getExprLoc(), diag::err_omp_stmt_depends_on_loop_counter) in checkDecl()
8035 if (Data.first && VD->getType()->isRecordType()) { in checkDecl()
8038 VD->getNameForDiagnostic(OS, SemaRef.getPrintingPolicy(), in checkDecl()
8040 SemaRef.Diag(E->getExprLoc(), in checkDecl()
8043 SemaRef.Diag(VD->getLocation(), diag::note_previous_decl) << VD; in checkDecl()
8047 SemaRef.Diag(E->getExprLoc(), diag::err_omp_invariant_dependency); in checkDecl()
8057 DepDecl->getNameForDiagnostic(OS, SemaRef.getPrintingPolicy(), in checkDecl()
8059 SemaRef.Diag(E->getExprLoc(), in checkDecl()
8073 const ValueDecl *VD = E->getDecl(); in VisitDeclRefExpr()
8079 if (isa<CXXThisExpr>(E->getBase()->IgnoreParens())) { in VisitMemberExpr()
8080 const ValueDecl *VD = E->getMemberDecl(); in VisitMemberExpr()
8088 for (const Stmt *Child : S->children()) in VisitStmt()
8113 // Check for the non-rectangular loops. in doesDependOnLoopCounter()
8124 // Check init-expr for canonical loop form and save loop counter in checkAndSetInit()
8125 // variable - #Var and its initialization value - #LB. in checkAndSetInit()
8126 // OpenMP [2.6] Canonical loop form. init-expr may be one of the following: in checkAndSetInit()
8128 // integer-type var = lb in checkAndSetInit()
8129 // random-access-iterator-type var = lb in checkAndSetInit()
8130 // pointer-type var = lb in checkAndSetInit()
8139 if (!ExprTemp->cleanupsHaveSideEffects()) in checkAndSetInit()
8140 S = ExprTemp->getSubExpr(); in checkAndSetInit()
8142 InitSrcRange = S->getSourceRange(); in checkAndSetInit()
8144 S = E->IgnoreParens(); in checkAndSetInit()
8146 if (BO->getOpcode() == BO_Assign) { in checkAndSetInit()
8147 Expr *LHS = BO->getLHS()->IgnoreParens(); in checkAndSetInit()
8149 if (auto *CED = dyn_cast<OMPCapturedExprDecl>(DRE->getDecl())) in checkAndSetInit()
8150 if (auto *ME = dyn_cast<MemberExpr>(getExprAsWritten(CED->getInit()))) in checkAndSetInit()
8151 return setLCDeclAndLB(ME->getMemberDecl(), ME, BO->getRHS(), in checkAndSetInit()
8153 return setLCDeclAndLB(DRE->getDecl(), DRE, BO->getRHS(), EmitDiags); in checkAndSetInit()
8156 if (ME->isArrow() && in checkAndSetInit()
8157 isa<CXXThisExpr>(ME->getBase()->IgnoreParenImpCasts())) in checkAndSetInit()
8158 return setLCDeclAndLB(ME->getMemberDecl(), ME, BO->getRHS(), in checkAndSetInit()
8163 if (DS->isSingleDecl()) { in checkAndSetInit()
8164 if (auto *Var = dyn_cast_or_null<VarDecl>(DS->getSingleDecl())) { in checkAndSetInit()
8165 if (Var->hasInit() && !Var->getType()->isReferenceType()) { in checkAndSetInit()
8166 // Accept non-canonical init form here but emit ext. warning. in checkAndSetInit()
8167 if (Var->getInitStyle() != VarDecl::CInit && EmitDiags) in checkAndSetInit()
8168 SemaRef.Diag(S->getBeginLoc(), in checkAndSetInit()
8170 << S->getSourceRange(); in checkAndSetInit()
8174 Var->getType().getNonReferenceType(), in checkAndSetInit()
8175 DS->getBeginLoc()), in checkAndSetInit()
8176 Var->getInit(), EmitDiags); in checkAndSetInit()
8181 if (CE->getOperator() == OO_Equal) { in checkAndSetInit()
8182 Expr *LHS = CE->getArg(0); in checkAndSetInit()
8184 if (auto *CED = dyn_cast<OMPCapturedExprDecl>(DRE->getDecl())) in checkAndSetInit()
8185 if (auto *ME = dyn_cast<MemberExpr>(getExprAsWritten(CED->getInit()))) in checkAndSetInit()
8186 return setLCDeclAndLB(ME->getMemberDecl(), ME, BO->getRHS(), in checkAndSetInit()
8188 return setLCDeclAndLB(DRE->getDecl(), DRE, CE->getArg(1), EmitDiags); in checkAndSetInit()
8191 if (ME->isArrow() && in checkAndSetInit()
8192 isa<CXXThisExpr>(ME->getBase()->IgnoreParenImpCasts())) in checkAndSetInit()
8193 return setLCDeclAndLB(ME->getMemberDecl(), ME, BO->getRHS(), in checkAndSetInit()
8199 if (dependent() || SemaRef.CurContext->isDependentContext()) in checkAndSetInit()
8202 SemaRef.Diag(S->getBeginLoc(), diag::err_omp_loop_not_canonical_init) in checkAndSetInit()
8203 << S->getSourceRange(); in checkAndSetInit()
8215 if (const CXXConstructorDecl *Ctor = CE->getConstructor()) in getInitLCDecl()
8216 if ((Ctor->isCopyOrMoveConstructor() || in getInitLCDecl()
8217 Ctor->isConvertingConstructor(/*AllowExplicit=*/false)) && in getInitLCDecl()
8218 CE->getNumArgs() > 0 && CE->getArg(0) != nullptr) in getInitLCDecl()
8219 E = CE->getArg(0)->IgnoreParenImpCasts(); in getInitLCDecl()
8221 if (const auto *VD = dyn_cast<VarDecl>(DRE->getDecl())) in getInitLCDecl()
8225 if (ME->isArrow() && isa<CXXThisExpr>(ME->getBase()->IgnoreParenImpCasts())) in getInitLCDecl()
8226 return getCanonicalDecl(ME->getMemberDecl()); in getInitLCDecl()
8231 // Check test-expr for canonical form, save upper-bound UB, flags for in checkAndSetCond()
8232 // less/greater and for strict/non-strict comparison. in checkAndSetCond()
8233 // OpenMP [2.9] Canonical loop form. Test-expr may be one of the following: in checkAndSetCond()
8234 // var relational-op b in checkAndSetCond()
8235 // b relational-op var in checkAndSetCond()
8245 SourceLocation CondLoc = S->getBeginLoc(); in checkAndSetCond()
8249 SourceLocation OpLoc) -> std::optional<bool> { in checkAndSetCond()
8268 CXXRewrittenBinaryOperator::DecomposedForm DF = RBO->getDecomposedForm(); in checkAndSetCond()
8269 Res = CheckAndSetCond(DF.Opcode, DF.LHS, DF.RHS, RBO->getSourceRange(), in checkAndSetCond()
8270 RBO->getOperatorLoc()); in checkAndSetCond()
8272 Res = CheckAndSetCond(BO->getOpcode(), BO->getLHS(), BO->getRHS(), in checkAndSetCond()
8273 BO->getSourceRange(), BO->getOperatorLoc()); in checkAndSetCond()
8275 if (CE->getNumArgs() == 2) { in checkAndSetCond()
8277 BinaryOperator::getOverloadedOpcode(CE->getOperator()), CE->getArg(0), in checkAndSetCond()
8278 CE->getArg(1), CE->getSourceRange(), CE->getOperatorLoc()); in checkAndSetCond()
8283 if (dependent() || SemaRef.CurContext->isDependentContext()) in checkAndSetCond()
8286 << (IneqCondIsCanonical ? 1 : 0) << S->getSourceRange() << LCDecl; in checkAndSetCond()
8294 // var - incr in checkAndSetIncRHS()
8296 RHS = RHS->IgnoreParenImpCasts(); in checkAndSetIncRHS()
8298 if (BO->isAdditiveOp()) { in checkAndSetIncRHS()
8299 bool IsAdd = BO->getOpcode() == BO_Add; in checkAndSetIncRHS()
8300 if (getInitLCDecl(BO->getLHS()) == LCDecl) in checkAndSetIncRHS()
8301 return setStep(BO->getRHS(), !IsAdd); in checkAndSetIncRHS()
8302 if (IsAdd && getInitLCDecl(BO->getRHS()) == LCDecl) in checkAndSetIncRHS()
8303 return setStep(BO->getLHS(), /*Subtract=*/false); in checkAndSetIncRHS()
8306 bool IsAdd = CE->getOperator() == OO_Plus; in checkAndSetIncRHS()
8307 if ((IsAdd || CE->getOperator() == OO_Minus) && CE->getNumArgs() == 2) { in checkAndSetIncRHS()
8308 if (getInitLCDecl(CE->getArg(0)) == LCDecl) in checkAndSetIncRHS()
8309 return setStep(CE->getArg(1), !IsAdd); in checkAndSetIncRHS()
8310 if (IsAdd && getInitLCDecl(CE->getArg(1)) == LCDecl) in checkAndSetIncRHS()
8311 return setStep(CE->getArg(0), /*Subtract=*/false); in checkAndSetIncRHS()
8314 if (dependent() || SemaRef.CurContext->isDependentContext()) in checkAndSetIncRHS()
8316 SemaRef.Diag(RHS->getBeginLoc(), diag::err_omp_loop_not_canonical_incr) in checkAndSetIncRHS()
8317 << RHS->getSourceRange() << LCDecl; in checkAndSetIncRHS()
8322 // Check incr-expr for canonical loop form and return true if it in checkAndSetInc()
8324 // OpenMP [2.6] Canonical loop form. Test-expr may be one of the following: in checkAndSetInc()
8327 // --var in checkAndSetInc()
8328 // var-- in checkAndSetInc()
8330 // var -= incr in checkAndSetInc()
8333 // var = var - incr in checkAndSetInc()
8340 if (!ExprTemp->cleanupsHaveSideEffects()) in checkAndSetInc()
8341 S = ExprTemp->getSubExpr(); in checkAndSetInc()
8343 IncrementSrcRange = S->getSourceRange(); in checkAndSetInc()
8344 S = S->IgnoreParens(); in checkAndSetInc()
8346 if (UO->isIncrementDecrementOp() && in checkAndSetInc()
8347 getInitLCDecl(UO->getSubExpr()) == LCDecl) in checkAndSetInc()
8349 .ActOnIntegerConstant(UO->getBeginLoc(), in checkAndSetInc()
8350 (UO->isDecrementOp() ? -1 : 1)) in checkAndSetInc()
8354 switch (BO->getOpcode()) { in checkAndSetInc()
8357 if (getInitLCDecl(BO->getLHS()) == LCDecl) in checkAndSetInc()
8358 return setStep(BO->getRHS(), BO->getOpcode() == BO_SubAssign); in checkAndSetInc()
8361 if (getInitLCDecl(BO->getLHS()) == LCDecl) in checkAndSetInc()
8362 return checkAndSetIncRHS(BO->getRHS()); in checkAndSetInc()
8368 switch (CE->getOperator()) { in checkAndSetInc()
8371 if (getInitLCDecl(CE->getArg(0)) == LCDecl) in checkAndSetInc()
8374 CE->getBeginLoc(), in checkAndSetInc()
8375 ((CE->getOperator() == OO_MinusMinus) ? -1 : 1)) in checkAndSetInc()
8381 if (getInitLCDecl(CE->getArg(0)) == LCDecl) in checkAndSetInc()
8382 return setStep(CE->getArg(1), CE->getOperator() == OO_MinusEqual); in checkAndSetInc()
8385 if (getInitLCDecl(CE->getArg(0)) == LCDecl) in checkAndSetInc()
8386 return checkAndSetIncRHS(CE->getArg(1)); in checkAndSetInc()
8392 if (dependent() || SemaRef.CurContext->isDependentContext()) in checkAndSetInc()
8394 SemaRef.Diag(S->getBeginLoc(), diag::err_omp_loop_not_canonical_incr) in checkAndSetInc()
8395 << S->getSourceRange() << LCDecl; in checkAndSetInc()
8403 if (SemaRef.CurContext->isDependentContext() || Capture->containsErrors()) in tryBuildCapture()
8405 if (Capture->isEvaluatable(SemaRef.Context, Expr::SE_AllowSideEffects)) in tryBuildCapture()
8407 Capture->IgnoreImpCasts(), Capture->getType(), Sema::AA_Converting, in tryBuildCapture()
8411 return buildCapture(SemaRef, Capture, I->second, Name); in tryBuildCapture()
8431 Lower->getIntegerConstantExpr(SemaRef.Context)) { in calculateNumIters()
8436 Step->getIntegerConstantExpr(SemaRef.Context)) { in calculateNumIters()
8444 // Check if any subexpressions in Lower -Step [+ 1] lead to overflow. in calculateNumIters()
8456 LRes -= SRes; in calculateNumIters()
8475 Upper->getIntegerConstantExpr(SemaRef.Context)) { in calculateNumIters()
8487 URes -= LRes; in calculateNumIters()
8491 // If the boundaries are not constant or (Lower - Step [+ 1]) is not constant in calculateNumIters()
8492 // or less than zero (Upper - (Lower - Step [+ 1]) may overflow) - promote to in calculateNumIters()
8495 !LCTy->isDependentType() && LCTy->isIntegerType()) { in calculateNumIters()
8496 QualType LowerTy = Lower->getType(); in calculateNumIters()
8497 QualType UpperTy = Upper->getType(); in calculateNumIters()
8500 if ((LowerSize <= UpperSize && UpperTy->hasSignedIntegerRepresentation()) || in calculateNumIters()
8501 (LowerSize > UpperSize && LowerTy->hasSignedIntegerRepresentation())) { in calculateNumIters()
8518 // If need to reorganize, then calculate the form as Upper - (Lower - Step [+ in calculateNumIters()
8524 // Lower - Step in calculateNumIters()
8531 // Lower - Step [+ 1] in calculateNumIters()
8543 // Upper - (Lower - Step [+ 1]). in calculateNumIters()
8550 if (!Diff.isUsable() && LCTy->getAsCXXRecordDecl()) { in calculateNumIters()
8552 // and lower bound, and to tell what is passed to 'operator-'. in calculateNumIters()
8553 SemaRef.Diag(Upper->getBeginLoc(), diag::err_omp_loop_diff_cxx) in calculateNumIters()
8554 << Upper->getSourceRange() << Lower->getSourceRange(); in calculateNumIters()
8561 // Upper - Lower [- 1] in calculateNumIters()
8570 // Upper - Lower [- 1] + Step in calculateNumIters()
8583 // (Upper - Lower [- 1] + Step) / Step or (Upper - Lower) / Step in calculateNumIters()
8595 QualType VarType = LCDecl->getType().getNonReferenceType(); in buildNumIterations()
8596 if (!VarType->isIntegerType() && !VarType->isPointerType() && in buildNumIterations()
8604 const LoopIterationSpace &IS = ResultIterSpaces[*InitDependOnLC - 1]; in buildNumIterations()
8664 // LB(MinVal) < LB(MaxVal) ? LB(MinVal) : LB(MaxVal) - min(LB(MinVal), in buildNumIterations()
8672 // LB(MinVal) < LB(MaxVal) ? LB(MaxVal) : LB(MinVal) - max(LB(MinVal), in buildNumIterations()
8690 const LoopIterationSpace &IS = ResultIterSpaces[*CondDependOnLC - 1]; in buildNumIterations()
8750 // UB(MinVal) > UB(MaxVal) ? UB(MinVal) : UB(MaxVal) - max(UB(MinVal), in buildNumIterations()
8758 // UB(MinVal) > UB(MaxVal) ? UB(MaxVal) : UB(MinVal) - min(UB(MinVal), in buildNumIterations()
8780 // OpenMP runtime requires 32-bit or 64-bit loop variables. in buildNumIterations()
8781 QualType Type = Diff.get()->getType(); in buildNumIterations()
8783 bool UseVarType = VarType->hasIntegerRepresentation() && in buildNumIterations()
8785 if (!Type->isIntegerType() || UseVarType) { in buildNumIterations()
8788 bool IsSigned = UseVarType ? VarType->hasSignedIntegerRepresentation() in buildNumIterations()
8789 : Type->hasSignedIntegerRepresentation(); in buildNumIterations()
8791 if (!SemaRef.Context.hasSameType(Diff.get()->getType(), Type)) { in buildNumIterations()
8807 NewSize, Type->hasSignedIntegerRepresentation() || in buildNumIterations()
8809 if (!SemaRef.Context.hasSameType(Diff.get()->getType(), NewType)) { in buildNumIterations()
8823 // Do not build for iterators, they cannot be used in non-rectangular loop in buildMinMaxValues()
8825 if (LCDecl->getType()->isRecordType()) in buildMinMaxValues()
8850 QualType VarType = LCDecl->getType().getNonReferenceType(); in buildMinMaxValues()
8858 // ((Upper - Lower [- 1]) / Step) * Step in buildMinMaxValues()
8877 if (VarType->isAnyPointerType() && in buildMinMaxValues()
8879 Diff.get()->getType(), in buildMinMaxValues()
8890 // MaxExpr = Lower + (((Upper - Lower [- 1]) / Step) * Step) in buildMinMaxValues()
8899 // MinExpr = Upper - (((Upper - Lower [- 1]) / Step) * Step) in buildMinMaxValues()
8909 if (SemaRef.Context.hasSameType(Diff.get()->getType(), VarType)) in buildMinMaxValues()
8964 if (!SemaRef.Context.hasSameUnqualifiedType(CondExpr.get()->getType(), in buildPreCond()
8983 SemaRef, VD, VD->getType().getNonReferenceType(), DefaultLoc); in buildCounterVar()
8996 if (LCDecl && !LCDecl->isInvalidDecl()) { in buildPrivateCounterVar()
8997 QualType Type = LCDecl->getType().getNonReferenceType(); in buildPrivateCounterVar()
8999 SemaRef, DefaultLoc, Type, LCDecl->getName(), in buildPrivateCounterVar()
9000 LCDecl->hasAttrs() ? &LCDecl->getAttrs() : nullptr, in buildPrivateCounterVar()
9004 if (PrivateVar->isInvalidDecl()) in buildPrivateCounterVar()
9026 "Expected only + or - operations for depend clauses."); in buildOrderedLoopData()
9032 QualType VarType = LCDecl->getType().getNonReferenceType(); in buildOrderedLoopData()
9033 if (!VarType->isIntegerType() && !VarType->isPointerType() && in buildOrderedLoopData()
9036 // Upper - Lower in buildOrderedLoopData()
9058 unsigned AssociatedLoops = DSAStack->getAssociatedLoops(); in ActOnOpenMPLoopInitialization()
9059 OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); in ActOnOpenMPLoopInitialization()
9063 DSAStack->loopStart(); in ActOnOpenMPLoopInitialization()
9076 VD = cast<VarDecl>(PrivateRef->getDecl()); in ActOnOpenMPLoopInitialization()
9079 DSAStack->addLoopControlVariable(D, VD); in ActOnOpenMPLoopInitialization()
9080 const Decl *LD = DSAStack->getPossiblyLoopCounter(); in ActOnOpenMPLoopInitialization()
9081 if (LD != D->getCanonicalDecl()) { in ActOnOpenMPLoopInitialization()
9082 DSAStack->resetPossibleLoopCounter(); in ActOnOpenMPLoopInitialization()
9086 Var->getType().getNonLValueExprType(getASTContext()), ForLoc, in ActOnOpenMPLoopInitialization()
9089 // OpenMP [2.14.1.1, Data-sharing Attribute Rules for Variables in ActOnOpenMPLoopInitialization()
9091 // associated for-loop of a simd construct with just one associated in ActOnOpenMPLoopInitialization()
9092 // for-loop may be listed in a linear clause with a constant-linear-step in ActOnOpenMPLoopInitialization()
9093 // that is the increment of the associated for-loop. The loop iteration in ActOnOpenMPLoopInitialization()
9094 // variable(s) in the associated for-loop(s) of a for or parallel for in ActOnOpenMPLoopInitialization()
9097 DSAStack->getTopDSA(D, /*FromParent=*/false); in ActOnOpenMPLoopInitialization()
9103 ? (DSAStack->hasMutipleLoops() ? OMPC_lastprivate : OMPC_linear) in ActOnOpenMPLoopInitialization()
9118 Diag(Init->getBeginLoc(), diag::err_omp_loop_var_dsa) in ActOnOpenMPLoopInitialization()
9130 DSAStack->addDSA(D, LoopDeclRefExpr, PredeterminedCKind, PrivateRef); in ActOnOpenMPLoopInitialization()
9134 DSAStack->setAssociatedLoops(AssociatedLoops - 1); in ActOnOpenMPLoopInitialization()
9142 return C->getDependenceType() == OMPC_DOACROSS_source || in isSource()
9143 C->getDependenceType() == OMPC_DOACROSS_source_omp_cur_iteration; in isSource()
9146 return C->getDependenceType() == OMPC_DOACROSS_sink; in isSink()
9149 return C->getDependenceType() == OMPC_DOACROSS_sink_omp_cur_iteration; in isSinkIter()
9165 // for (init-expr; test-expr; incr-expr) structured-block in checkOpenMPIterationSpace()
9166 // for (range-decl: range-expr) structured-block in checkOpenMPIterationSpace()
9168 S = CanonLoop->getLoopStmt(); in checkOpenMPIterationSpace()
9177 SemaRef.Diag(S->getBeginLoc(), diag::err_omp_not_for) in checkOpenMPIterationSpace()
9185 << 2 << CollapseLoopCountExpr->getSourceRange() in checkOpenMPIterationSpace()
9186 << OrderedLoopCountExpr->getSourceRange(); in checkOpenMPIterationSpace()
9188 SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(), in checkOpenMPIterationSpace()
9190 << 0 << CollapseLoopCountExpr->getSourceRange(); in checkOpenMPIterationSpace()
9192 SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(), in checkOpenMPIterationSpace()
9194 << 1 << OrderedLoopCountExpr->getSourceRange(); in checkOpenMPIterationSpace()
9198 assert(((For && For->getBody()) || (CXXFor && CXXFor->getBody())) && in checkOpenMPIterationSpace()
9199 "No loop body."); in checkOpenMPIterationSpace()
9201 if (CXXFor && SemaRef.CurContext->isDependentContext()) in checkOpenMPIterationSpace()
9205 For ? For->getForLoc() : CXXFor->getForLoc()); in checkOpenMPIterationSpace()
9208 Stmt *Init = For ? For->getInit() : CXXFor->getBeginStmt(); in checkOpenMPIterationSpace()
9221 QualType VarType = LCDecl->getType().getNonReferenceType(); in checkOpenMPIterationSpace()
9222 if (!VarType->isDependentType() && !VarType->isIntegerType() && in checkOpenMPIterationSpace()
9223 !VarType->isPointerType() && in checkOpenMPIterationSpace()
9224 !(SemaRef.getLangOpts().CPlusPlus && VarType->isOverloadableType())) { in checkOpenMPIterationSpace()
9225 SemaRef.Diag(Init->getBeginLoc(), diag::err_omp_loop_variable_type) in checkOpenMPIterationSpace()
9230 // OpenMP, 2.14.1.1 Data-sharing Attribute Rules for Variables Referenced in in checkOpenMPIterationSpace()
9232 // The loop iteration variable(s) in the associated for-loop(s) of a for or in checkOpenMPIterationSpace()
9234 // The loop iteration variable in the associated for-loop of a simd in checkOpenMPIterationSpace()
9235 // construct with just one associated for-loop is linear with a in checkOpenMPIterationSpace()
9236 // constant-linear-step that is the increment of the associated for-loop. in checkOpenMPIterationSpace()
9241 assert(isOpenMPLoopDirective(DKind) && "DSA for non-loop vars"); in checkOpenMPIterationSpace()
9243 // Check test-expr. in checkOpenMPIterationSpace()
9244 HasErrors |= ISC.checkAndSetCond(For ? For->getCond() : CXXFor->getCond()); in checkOpenMPIterationSpace()
9246 // Check incr-expr. in checkOpenMPIterationSpace()
9247 HasErrors |= ISC.checkAndSetInc(For ? For->getInc() : CXXFor->getInc()); in checkOpenMPIterationSpace()
9250 if (ISC.dependent() || SemaRef.CurContext->isDependentContext() || HasErrors) in checkOpenMPIterationSpace()
9255 DSA.getCurScope(), For ? For->getCond() : CXXFor->getCond(), Captures); in checkOpenMPIterationSpace()
9298 if (DSA.getOrderedRegionParam().second->getNumForLoops()) { in checkOpenMPIterationSpace()
9300 DSA.getOrderedRegionParam().second->getLoopNumIterations().size()) { in checkOpenMPIterationSpace()
9301 DSA.getOrderedRegionParam().second->setLoopNumIterations( in checkOpenMPIterationSpace()
9304 DSA.getOrderedRegionParam().second->setLoopCounter( in checkOpenMPIterationSpace()
9313 DependC ? DependC->getNumLoops() : DoacrossC->getNumLoops(); in checkOpenMPIterationSpace()
9315 // Erroneous case - clause has some problems. in checkOpenMPIterationSpace()
9318 if (DependC && DependC->getDependencyKind() == OMPC_DEPEND_sink && in checkOpenMPIterationSpace()
9320 // Erroneous case - clause has some problems. in checkOpenMPIterationSpace()
9321 DependC->setLoopData(CurrentNestedLoopCount, nullptr); in checkOpenMPIterationSpace()
9327 // Erroneous case - clause has some problems. in checkOpenMPIterationSpace()
9328 DoacrossC->setLoopData(CurrentNestedLoopCount, nullptr); in checkOpenMPIterationSpace()
9333 DependC ? DependC->getDependencyLoc() : DoacrossC->getDependenceLoc(); in checkOpenMPIterationSpace()
9334 if ((DependC && DependC->getDependencyKind() == OMPC_DEPEND_source) || in checkOpenMPIterationSpace()
9347 // build CounterVar - 1 in checkOpenMPIterationSpace()
9349 SemaRef.ActOnIntegerConstant(DoacrossC->getColonLoc(), /*Val=*/1) in checkOpenMPIterationSpace()
9362 DependC->setLoopData(CurrentNestedLoopCount, CntValue); in checkOpenMPIterationSpace()
9364 DoacrossC->setLoopData(CurrentNestedLoopCount, CntValue); in checkOpenMPIterationSpace()
9382 if (!SemaRef.Context.hasSameType(NewStart.get()->getType(), in buildCounterInit()
9383 VarRef.get()->getType())) { in buildCounterInit()
9385 NewStart.get(), VarRef.get()->getType(), Sema::AA_Converting, in buildCounterInit()
9418 // Try to build 'VarRef = Start, VarRef (+|-)= Iter * Step' or in buildCounterUpdate()
9419 // 'VarRef = Start (+|-) Iter * Step'. in buildCounterUpdate()
9433 if (VarRef.get()->getType()->isOverloadableType() || in buildCounterUpdate()
9434 NewStart.get()->getType()->isOverloadableType() || in buildCounterUpdate()
9435 Update.get()->getType()->isOverloadableType()) { in buildCounterUpdate()
9451 // Second attempt: try to build 'VarRef = Start (+|-) Iter * Step'. in buildCounterUpdate()
9458 if (!SemaRef.Context.hasSameType(Update.get()->getType(), in buildCounterUpdate()
9459 VarRef.get()->getType())) { in buildCounterUpdate()
9461 Update.get(), VarRef.get()->getType(), Sema::AA_Converting, true); in buildCounterUpdate()
9477 QualType OldType = E->getType(); in widenIterationCount()
9493 E->getIntegerConstantExpr(SemaRef.Context)) in fitsInto()
9494 return Signed ? Result->isSignedIntN(Bits) : Result->isIntN(Bits); in fitsInto()
9515 /// for OpenMP pre-init declarations/statements.
9523 llvm::append_range(TargetList, CS->body()); in appendFlattenedStmtList()
9535 PreInits.push_back(Pair.second->getDecl()); in buildPreInits()
9541 /// Build pre-init statement for the given statements.
9558 E->getExprLoc(), in buildPostUpdate()
9560 E->getExprLoc(), E) in buildPostUpdate()
9563 ? S.CreateBuiltinBinOp(ConvE->getExprLoc(), BO_Comma, in buildPostUpdate()
9586 // Found 'collapse' clause - calculate collapse number. in checkOpenMPLoop()
9588 if (!CollapseLoopCountExpr->isValueDependent() && in checkOpenMPLoop()
9589 CollapseLoopCountExpr->EvaluateAsInt(Result, SemaRef.getASTContext())) { in checkOpenMPLoop()
9598 // Found 'ordered' clause - calculate collapse number. in checkOpenMPLoop()
9600 if (!OrderedLoopCountExpr->isValueDependent() && in checkOpenMPLoop()
9601 OrderedLoopCountExpr->EvaluateAsInt(EVResult, in checkOpenMPLoop()
9605 SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(), in checkOpenMPLoop()
9607 << OrderedLoopCountExpr->getSourceRange(); in checkOpenMPLoop()
9608 SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(), in checkOpenMPLoop()
9610 << CollapseLoopCountExpr->getSourceRange(); in checkOpenMPLoop()
9624 AStmt->IgnoreContainers(!isOpenMPLoopTransformationDirective(DKind)), in checkOpenMPLoop()
9638 if (isa<OMPCapturedExprDecl>(DRE->getDecl())) { in checkOpenMPLoop()
9645 Stmt *DependentPreInits = Transform->getPreInits(); in checkOpenMPLoop()
9649 // Search for pre-init declared variables that need to be captured in checkOpenMPLoop()
9655 for (Decl *C : DC->decls()) { in checkOpenMPLoop()
9658 SemaRef, D, D->getType().getNonReferenceType(), in checkOpenMPLoop()
9659 Transform->getBeginLoc()); in checkOpenMPLoop()
9669 if (SemaRef.CurContext->isDependentContext()) in checkOpenMPLoop()
9683 // Note: some counters may be C++ classes, operator- is used to find number of in checkOpenMPLoop()
9688 // #define NumIterations (NI * ((NJ - J0 - 1 + 2) / 2)) in checkOpenMPLoop()
9690 // .local.i = IV / ((NJ - J0 - 1 + 2) / 2); in checkOpenMPLoop()
9691 // .local.j = J0 + (IV % ((NJ - J0 - 1 + 2) / 2)) * 2; in checkOpenMPLoop()
9699 // Last iteration number is (I1 * I2 * ... In) - 1, where I1, I2 ... In are in checkOpenMPLoop()
9709 N0->IgnoreImpCasts(), N0->getType(), in checkOpenMPLoop()
9716 .PerformImplicitConversion(N0->IgnoreImpCasts(), N0->getType(), in checkOpenMPLoop()
9726 bool AllCountsNeedLessThan32Bits = C.getTypeSize(N0->getType()) < 32; in checkOpenMPLoop()
9732 SemaRef.BuildBinOp(CurScope, PreCond.get()->getExprLoc(), BO_LAnd, in checkOpenMPLoop()
9736 SourceLocation Loc = N->getExprLoc(); in checkOpenMPLoop()
9737 AllCountsNeedLessThan32Bits &= C.getTypeSize(N->getType()) < 32; in checkOpenMPLoop()
9742 .PerformImplicitConversion(N->IgnoreImpCasts(), N->getType(), in checkOpenMPLoop()
9750 .PerformImplicitConversion(N->IgnoreImpCasts(), N->getType(), in checkOpenMPLoop()
9756 // Choose either the 32-bit or 64-bit version. in checkOpenMPLoop()
9760 C.getTypeSize(LastIteration32.get()->getType()) == 32 && in checkOpenMPLoop()
9764 LastIteration32.get()->getType()->hasSignedIntegerRepresentation(), in checkOpenMPLoop()
9767 QualType VType = LastIteration.get()->getType(); in checkOpenMPLoop()
9784 CurScope, LastIteration.get()->getExprLoc(), BO_Sub, in checkOpenMPLoop()
9792 // each iteration. Do not do this if the number of iterations may be kfold-ed. in checkOpenMPLoop()
9793 bool IsConstant = LastIteration.get()->isIntegerConstantExpr(SemaRef.Context); in checkOpenMPLoop()
9802 CurScope, SaveRef.get()->getExprLoc(), BO_Add, SaveRef.get(), in checkOpenMPLoop()
9829 // A 32-bit variable-flag where runtime returns 1 for the last iteration. in checkOpenMPLoop()
9851 LastIteration.get()->getExprLoc(), InitLoc, IsUBGreater.get(), in checkOpenMPLoop()
9887 const CapturedDecl *CD = cast<CapturedStmt>(AStmt)->getCapturedDecl(); in checkOpenMPLoop()
9889 // directive does - the lower and upper bounds of the previous schedule. in checkOpenMPLoop()
9890 assert(CD->getNumParams() >= 4 && in checkOpenMPLoop()
9895 ImplicitParamDecl *PrevLBDecl = CD->getParam(/*PrevLB=*/2); in checkOpenMPLoop()
9896 ImplicitParamDecl *PrevUBDecl = CD->getParam(/*PrevUB=*/3); in checkOpenMPLoop()
9901 buildDeclRefExpr(SemaRef, PrevLBDecl, PrevLBDecl->getType(), InitLoc); in checkOpenMPLoop()
9903 buildDeclRefExpr(SemaRef, PrevUBDecl, PrevUBDecl->getType(), InitLoc); in checkOpenMPLoop()
9939 RealVType->hasUnsignedIntegerRepresentation() && in checkOpenMPLoop()
9945 SourceLocation CondLoc = AStmt->getBeginLoc(); in checkOpenMPLoop()
9991 SourceLocation IncLoc = AStmt->getBeginLoc(); in checkOpenMPLoop()
10062 // on PrevUB instead of NumIterations - used to implement 'for' when found in checkOpenMPLoop()
10064 SourceLocation DistIncLoc = AStmt->getBeginLoc(); in checkOpenMPLoop()
10083 SourceLocation DistEUBLoc = AStmt->getBeginLoc(); in checkOpenMPLoop()
10084 if (!SemaRef.Context.hasSameType(UB.get()->getType(), in checkOpenMPLoop()
10085 PrevUB.get()->getType())) { in checkOpenMPLoop()
10088 SemaRef.Context.getTrivialTypeSourceInfo(UB.get()->getType()), in checkOpenMPLoop()
10145 // Acc -= Ik * Prod; in checkOpenMPLoop()
10173 // Acc -= Iter * Prod in checkOpenMPLoop()
10184 auto *VD = cast<VarDecl>(cast<DeclRefExpr>(IS.CounterVar)->getDecl()); in checkOpenMPLoop()
10186 SemaRef, VD, IS.CounterVar->getType(), IS.CounterVar->getExprLoc(), in checkOpenMPLoop()
10227 Built.DependentCounters[Cnt] = Built.Counters[IS.LoopDependentIdx - 1]; in checkOpenMPLoop()
10228 Built.DependentInits[Cnt] = Built.Inits[IS.LoopDependentIdx - 1]; in checkOpenMPLoop()
10278 return (*CollapseClauses.begin())->getNumForLoops(); in getCollapseNumberExpr()
10286 return (*OrderedClauses.begin())->getNumForLoops(); in getOrderedNumberExpr()
10296 if (Clause->getClauseKind() == OMPC_safelen) in checkSimdlenSafelenSpecified()
10298 else if (Clause->getClauseKind() == OMPC_simdlen) in checkSimdlenSafelenSpecified()
10305 const Expr *SimdlenLength = Simdlen->getSimdlen(); in checkSimdlenSafelenSpecified()
10306 const Expr *SafelenLength = Safelen->getSafelen(); in checkSimdlenSafelenSpecified()
10307 if (SimdlenLength->isValueDependent() || SimdlenLength->isTypeDependent() || in checkSimdlenSafelenSpecified()
10308 SimdlenLength->isInstantiationDependent() || in checkSimdlenSafelenSpecified()
10309 SimdlenLength->containsUnexpandedParameterPack()) in checkSimdlenSafelenSpecified()
10311 if (SafelenLength->isValueDependent() || SafelenLength->isTypeDependent() || in checkSimdlenSafelenSpecified()
10312 SafelenLength->isInstantiationDependent() || in checkSimdlenSafelenSpecified()
10313 SafelenLength->containsUnexpandedParameterPack()) in checkSimdlenSafelenSpecified()
10316 SimdlenLength->EvaluateAsInt(SimdlenResult, S.Context); in checkSimdlenSafelenSpecified()
10317 SafelenLength->EvaluateAsInt(SafelenResult, S.Context); in checkSimdlenSafelenSpecified()
10325 S.Diag(SimdlenLength->getExprLoc(), in checkSimdlenSafelenSpecified()
10327 << SimdlenLength->getSourceRange() << SafelenLength->getSourceRange(); in checkSimdlenSafelenSpecified()
10346 DSAStack->getMappedDirective() == OMPD_loop && in checkLastPrivateForMappedDirectives()
10381 DSAStack->getMappedDirective()); in ActOnOpenMPSimdDirective()
10409 DSAStack->getTaskgroupReductionRef(), DSAStack->isCancelRegion(), in ActOnOpenMPForDirective()
10410 DSAStack->getMappedDirective()); in ActOnOpenMPForDirective()
10450 BaseStmt = CS->getCapturedStmt(); in checkSectionsDirective()
10452 auto S = C->children(); in checkSectionsDirective()
10460 SemaRef.Diag(SectionStmt->getBeginLoc(), in checkSectionsDirective()
10466 ->setHasCancel(Stack->isCancelRegion()); in checkSectionsDirective()
10469 SemaRef.Diag(AStmt->getBeginLoc(), diag::err_omp_sections_not_compound_stmt) in checkSectionsDirective()
10487 DSAStack->getTaskgroupReductionRef(), DSAStack->isCancelRegion()); in ActOnOpenMPSectionsDirective()
10497 DSAStack->setParentCancelRegion(DSAStack->isCancelRegion()); in ActOnOpenMPSectionDirective()
10500 DSAStack->isCancelRegion()); in ActOnOpenMPSectionDirective()
10504 E = E->IgnoreParenCasts()->IgnoreImplicit(); in getDirectCallExpr()
10506 if (CE->getDirectCallee()) in getDirectCallExpr()
10518 Stmt *S = cast<CapturedStmt>(AStmt)->getCapturedStmt(); in ActOnOpenMPDispatchDirective()
10521 // expression-stmt : an expression statement with one of the following forms: in ActOnOpenMPDispatchDirective()
10522 // expression = target-call ( [expression-list] ); in ActOnOpenMPDispatchDirective()
10523 // target-call ( [expression-list] ); in ActOnOpenMPDispatchDirective()
10527 if (!SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPDispatchDirective()
10532 Diag(S->getBeginLoc(), diag::err_omp_dispatch_statement_call); in ActOnOpenMPDispatchDirective()
10536 E = E->IgnoreParenCasts()->IgnoreImplicit(); in ActOnOpenMPDispatchDirective()
10539 if (BO->getOpcode() == BO_Assign) in ActOnOpenMPDispatchDirective()
10540 TargetCall = getDirectCallExpr(BO->getRHS()); in ActOnOpenMPDispatchDirective()
10543 if (COCE->getOperator() == OO_Equal) in ActOnOpenMPDispatchDirective()
10544 TargetCall = getDirectCallExpr(COCE->getArg(1)); in ActOnOpenMPDispatchDirective()
10549 Diag(E->getBeginLoc(), diag::err_omp_dispatch_statement_call); in ActOnOpenMPDispatchDirective()
10552 TargetCallLoc = TargetCall->getExprLoc(); in ActOnOpenMPDispatchDirective()
10567 for (Expr *RefExpr : LPC->varlists()) { in checkGenericLoopLastprivate()
10573 auto &&Info = Stack->isLoopControlVariable(D); in checkGenericLoopLastprivate()
10608 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPGenericLoopDirective()
10638 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPTeamsGenericLoopDirective()
10641 DSAStack->setParentTeamsRegionLoc(StartLoc); in ActOnOpenMPTeamsGenericLoopDirective()
10672 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPTargetTeamsGenericLoopDirective()
10705 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPParallelGenericLoopDirective()
10737 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPTargetParallelGenericLoopDirective()
10760 if (Clause->getClauseKind() == OMPC_nowait) in ActOnOpenMPSingleDirective()
10762 else if (Clause->getClauseKind() == OMPC_copyprivate) in ActOnOpenMPSingleDirective()
10765 Diag(Copyprivate->getBeginLoc(), in ActOnOpenMPSingleDirective()
10767 Diag(Nowait->getBeginLoc(), diag::note_omp_nowait_clause_here); in ActOnOpenMPSingleDirective()
10811 if (C->getClauseKind() == OMPC_hint) { in ActOnOpenMPCriticalDirective()
10813 Diag(C->getBeginLoc(), diag::err_omp_hint_clause_no_name); in ActOnOpenMPCriticalDirective()
10816 Expr *E = cast<OMPHintClause>(C)->getHint(); in ActOnOpenMPCriticalDirective()
10817 if (E->isTypeDependent() || E->isValueDependent() || in ActOnOpenMPCriticalDirective()
10818 E->isInstantiationDependent()) { in ActOnOpenMPCriticalDirective()
10821 Hint = E->EvaluateKnownConstInt(getASTContext()); in ActOnOpenMPCriticalDirective()
10822 HintLoc = C->getBeginLoc(); in ActOnOpenMPCriticalDirective()
10828 const auto Pair = DSAStack->getCriticalWithHint(DirName); in ActOnOpenMPCriticalDirective()
10837 if (const auto *C = Pair.first->getSingleClause<OMPHintClause>()) { in ActOnOpenMPCriticalDirective()
10838 Diag(C->getBeginLoc(), diag::note_omp_critical_hint_here) in ActOnOpenMPCriticalDirective()
10840 << toString(C->getHint()->EvaluateKnownConstInt(getASTContext()), in ActOnOpenMPCriticalDirective()
10843 Diag(Pair.first->getBeginLoc(), diag::note_omp_critical_no_hint) << 1; in ActOnOpenMPCriticalDirective()
10853 DSAStack->addCriticalWithHint(Dir, Hint); in ActOnOpenMPCriticalDirective()
10880 DSAStack->getTaskgroupReductionRef(), DSAStack->isCancelRegion()); in ActOnOpenMPParallelForDirective()
10921 DSAStack->getTaskgroupReductionRef()); in ActOnOpenMPParallelMasterDirective()
10934 DSAStack->getTaskgroupReductionRef()); in ActOnOpenMPParallelMaskedDirective()
10947 DSAStack->getTaskgroupReductionRef(), DSAStack->isCancelRegion()); in ActOnOpenMPParallelSectionsDirective()
10957 if (llvm::is_contained(MutuallyExclusiveClauses, C->getClauseKind())) { in checkMutuallyExclusiveClauses()
10960 } else if (PrevClause->getClauseKind() != C->getClauseKind()) { in checkMutuallyExclusiveClauses()
10961 S.Diag(C->getBeginLoc(), diag::err_omp_clauses_mutually_exclusive) in checkMutuallyExclusiveClauses()
10962 << getOpenMPClauseName(C->getClauseKind()) in checkMutuallyExclusiveClauses()
10963 << getOpenMPClauseName(PrevClause->getClauseKind()); in checkMutuallyExclusiveClauses()
10964 S.Diag(PrevClause->getBeginLoc(), diag::note_omp_previous_clause) in checkMutuallyExclusiveClauses()
10965 << getOpenMPClauseName(PrevClause->getClauseKind()); in checkMutuallyExclusiveClauses()
10990 AStmt, DSAStack->isCancelRegion()); in ActOnOpenMPTaskDirective()
11010 if (AtC && !InExContext && AtC->getAtKind() == OMPC_AT_execution) { in ActOnOpenMPErrorDirective()
11011 Diag(AtC->getAtKindKwLoc(), diag::err_omp_unexpected_execution_modifier); in ActOnOpenMPErrorDirective()
11019 Expr *ME = MessageC ? MessageC->getMessageString() : nullptr; in ActOnOpenMPErrorDirective()
11021 if (!AtC || AtC->getAtKind() == OMPC_AT_compilation) { in ActOnOpenMPErrorDirective()
11022 if (SeverityC && SeverityC->getSeverityKind() == OMPC_SEVERITY_warning) in ActOnOpenMPErrorDirective()
11023 Diag(SeverityC->getSeverityKindKwLoc(), diag::warn_diagnose_if_succeeded) in ActOnOpenMPErrorDirective()
11024 << (ME ? cast<StringLiteral>(ME)->getString() : "WARNING"); in ActOnOpenMPErrorDirective()
11027 << (ME ? cast<StringLiteral>(ME)->getString() : "ERROR"); in ActOnOpenMPErrorDirective()
11028 if (!SeverityC || SeverityC->getSeverityKind() != OMPC_SEVERITY_warning) in ActOnOpenMPErrorDirective()
11065 DSAStack->getTaskgroupReductionRef()); in ActOnOpenMPTaskgroupDirective()
11074 if (C->getClauseKind() == OMPC_flush) in ActOnOpenMPFlushDirective()
11082 if (C->getClauseKind() == OMPC_acq_rel || in ActOnOpenMPFlushDirective()
11083 C->getClauseKind() == OMPC_acquire || in ActOnOpenMPFlushDirective()
11084 C->getClauseKind() == OMPC_release) { in ActOnOpenMPFlushDirective()
11086 Diag(C->getBeginLoc(), diag::err_omp_several_mem_order_clauses) in ActOnOpenMPFlushDirective()
11088 << SourceRange(C->getBeginLoc(), C->getEndLoc()); in ActOnOpenMPFlushDirective()
11092 MemOrderKind = C->getClauseKind(); in ActOnOpenMPFlushDirective()
11093 MemOrderLoc = C->getBeginLoc(); in ActOnOpenMPFlushDirective()
11098 Diag(FC->getLParenLoc(), diag::err_omp_flush_order_clause_and_list) in ActOnOpenMPFlushDirective()
11099 << getOpenMPClauseName(OrderClause->getClauseKind()); in ActOnOpenMPFlushDirective()
11100 Diag(OrderClause->getBeginLoc(), diag::note_omp_flush_order_clause_here) in ActOnOpenMPFlushDirective()
11101 << getOpenMPClauseName(OrderClause->getClauseKind()); in ActOnOpenMPFlushDirective()
11113 } else if (Clauses[0]->getClauseKind() != OMPC_depobj) { in ActOnOpenMPDepobjDirective()
11114 Diag(Clauses[0]->getBeginLoc(), diag::err_omp_depobj_expected); in ActOnOpenMPDepobjDirective()
11119 Diag(Clauses[2]->getBeginLoc(), in ActOnOpenMPDepobjDirective()
11123 Diag(Clauses[0]->getEndLoc(), diag::err_omp_depobj_single_clause_expected); in ActOnOpenMPDepobjDirective()
11134 Diag(Clauses.empty() ? EndLoc : Clauses[1]->getBeginLoc(), in ActOnOpenMPScanDirective()
11139 if (Scope *S = DSAStack->getCurScope()) { in ActOnOpenMPScanDirective()
11140 Scope *ParentS = S->getParent(); in ActOnOpenMPScanDirective()
11141 if (!ParentS || ParentS->getParent() != ParentS->getBreakParent() || in ActOnOpenMPScanDirective()
11142 !ParentS->getBreakParent()->isOpenMPLoopScope()) in ActOnOpenMPScanDirective()
11148 if (DSAStack->doesParentHasScanDirective()) { in ActOnOpenMPScanDirective()
11150 Diag(DSAStack->getParentScanDirectiveLoc(), in ActOnOpenMPScanDirective()
11155 DSAStack->setParentHasScanDirective(StartLoc); in ActOnOpenMPScanDirective()
11179 if ((DC && DC->getDependencyKind() == OMPC_DEPEND_source) || in ActOnOpenMPOrderedDirective()
11182 Diag(C->getBeginLoc(), diag::err_omp_more_one_clause) in ActOnOpenMPOrderedDirective()
11193 Diag(C->getBeginLoc(), diag::err_omp_sink_and_source_not_allowed) in ActOnOpenMPOrderedDirective()
11197 } else if ((DC && DC->getDependencyKind() == OMPC_DEPEND_sink) || in ActOnOpenMPOrderedDirective()
11200 Diag(C->getBeginLoc(), diag::err_omp_sink_and_source_not_allowed) in ActOnOpenMPOrderedDirective()
11209 } else if (C->getClauseKind() == OMPC_threads) { in ActOnOpenMPOrderedDirective()
11211 } else if (C->getClauseKind() == OMPC_simd) { in ActOnOpenMPOrderedDirective()
11216 isOpenMPSimdDirective(DSAStack->getParentDirective())) { in ActOnOpenMPOrderedDirective()
11225 DependFound ? DependFound->getBeginLoc() : DoacrossFound->getBeginLoc(); in ActOnOpenMPOrderedDirective()
11228 << getOpenMPClauseName(TC ? TC->getClauseKind() : SC->getClauseKind()); in ActOnOpenMPOrderedDirective()
11231 !DSAStack->getParentOrderedRegionParam().first) { in ActOnOpenMPOrderedDirective()
11233 DependFound ? DependFound->getBeginLoc() : DoacrossFound->getBeginLoc(); in ActOnOpenMPOrderedDirective()
11238 if (const Expr *Param = DSAStack->getParentOrderedRegionParam().first) { in ActOnOpenMPOrderedDirective()
11239 SourceLocation ErrLoc = TC ? TC->getBeginLoc() : StartLoc; in ActOnOpenMPOrderedDirective()
11242 Diag(Param->getBeginLoc(), diag::note_omp_ordered_param) << 1; in ActOnOpenMPOrderedDirective()
11250 // During execution of an iteration of a worksharing-loop or a loop nest in ActOnOpenMPOrderedDirective()
11251 // within a worksharing-loop, simd, or worksharing-loop SIMD region, a thread in ActOnOpenMPOrderedDirective()
11255 if (DSAStack->doesParentHasOrderedDirective()) { in ActOnOpenMPOrderedDirective()
11257 Diag(DSAStack->getParentOrderedDirectiveLoc(), in ActOnOpenMPOrderedDirective()
11262 DSAStack->setParentHasOrderedDirective(StartLoc); in ActOnOpenMPOrderedDirective()
11285 /// Unary operation is not post-/pre- increment/decrement operation.
11302 /// No errors is found.
11318 /// important for non-associative operations.
11367 if (AtomicBinOp->getOpcode() == BO_Assign) { in checkBinaryOperation()
11368 X = AtomicBinOp->getLHS(); in checkBinaryOperation()
11370 AtomicBinOp->getRHS()->IgnoreParenImpCasts())) { in checkBinaryOperation()
11371 if (AtomicInnerBinOp->isMultiplicativeOp() || in checkBinaryOperation()
11372 AtomicInnerBinOp->isAdditiveOp() || AtomicInnerBinOp->isShiftOp() || in checkBinaryOperation()
11373 AtomicInnerBinOp->isBitwiseOp()) { in checkBinaryOperation()
11374 Op = AtomicInnerBinOp->getOpcode(); in checkBinaryOperation()
11375 OpLoc = AtomicInnerBinOp->getOperatorLoc(); in checkBinaryOperation()
11376 Expr *LHS = AtomicInnerBinOp->getLHS(); in checkBinaryOperation()
11377 Expr *RHS = AtomicInnerBinOp->getRHS(); in checkBinaryOperation()
11379 X->IgnoreParenImpCasts()->Profile(XId, SemaRef.getASTContext(), in checkBinaryOperation()
11381 LHS->IgnoreParenImpCasts()->Profile(LHSId, SemaRef.getASTContext(), in checkBinaryOperation()
11383 RHS->IgnoreParenImpCasts()->Profile(RHSId, SemaRef.getASTContext(), in checkBinaryOperation()
11392 ErrorLoc = AtomicInnerBinOp->getExprLoc(); in checkBinaryOperation()
11393 ErrorRange = AtomicInnerBinOp->getSourceRange(); in checkBinaryOperation()
11394 NoteLoc = X->getExprLoc(); in checkBinaryOperation()
11395 NoteRange = X->getSourceRange(); in checkBinaryOperation()
11399 ErrorLoc = AtomicInnerBinOp->getExprLoc(); in checkBinaryOperation()
11400 ErrorRange = AtomicInnerBinOp->getSourceRange(); in checkBinaryOperation()
11401 NoteLoc = AtomicInnerBinOp->getOperatorLoc(); in checkBinaryOperation()
11406 NoteLoc = ErrorLoc = AtomicBinOp->getRHS()->getExprLoc(); in checkBinaryOperation()
11407 NoteRange = ErrorRange = AtomicBinOp->getRHS()->getSourceRange(); in checkBinaryOperation()
11411 ErrorLoc = AtomicBinOp->getExprLoc(); in checkBinaryOperation()
11412 ErrorRange = AtomicBinOp->getSourceRange(); in checkBinaryOperation()
11413 NoteLoc = AtomicBinOp->getOperatorLoc(); in checkBinaryOperation()
11422 if (SemaRef.CurContext->isDependentContext()) in checkBinaryOperation()
11434 // x--; in checkStatement()
11436 // --x; in checkStatement()
11441 AtomicBody = AtomicBody->IgnoreParenImpCasts(); in checkStatement()
11442 if (AtomicBody->getType()->isScalarType() || in checkStatement()
11443 AtomicBody->isInstantiationDependent()) { in checkStatement()
11445 AtomicBody->IgnoreParenImpCasts())) { in checkStatement()
11448 AtomicCompAssignOp->getOpcode()); in checkStatement()
11449 OpLoc = AtomicCompAssignOp->getOperatorLoc(); in checkStatement()
11450 E = AtomicCompAssignOp->getRHS(); in checkStatement()
11451 X = AtomicCompAssignOp->getLHS()->IgnoreParens(); in checkStatement()
11454 AtomicBody->IgnoreParenImpCasts())) { in checkStatement()
11459 AtomicBody->IgnoreParenImpCasts())) { in checkStatement()
11461 if (AtomicUnaryOp->isIncrementDecrementOp()) { in checkStatement()
11462 IsPostfixUpdate = AtomicUnaryOp->isPostfix(); in checkStatement()
11463 Op = AtomicUnaryOp->isIncrementOp() ? BO_Add : BO_Sub; in checkStatement()
11464 OpLoc = AtomicUnaryOp->getOperatorLoc(); in checkStatement()
11465 X = AtomicUnaryOp->getSubExpr()->IgnoreParens(); in checkStatement()
11470 ErrorLoc = AtomicUnaryOp->getExprLoc(); in checkStatement()
11471 ErrorRange = AtomicUnaryOp->getSourceRange(); in checkStatement()
11472 NoteLoc = AtomicUnaryOp->getOperatorLoc(); in checkStatement()
11475 } else if (!AtomicBody->isInstantiationDependent()) { in checkStatement()
11477 NoteLoc = ErrorLoc = AtomicBody->getExprLoc(); in checkStatement()
11478 NoteRange = ErrorRange = AtomicBody->getSourceRange(); in checkStatement()
11479 } else if (AtomicBody->containsErrors()) { in checkStatement()
11481 NoteLoc = ErrorLoc = AtomicBody->getExprLoc(); in checkStatement()
11482 NoteRange = ErrorRange = AtomicBody->getSourceRange(); in checkStatement()
11486 NoteLoc = ErrorLoc = AtomicBody->getBeginLoc(); in checkStatement()
11491 NoteLoc = ErrorLoc = S->getBeginLoc(); in checkStatement()
11499 if (SemaRef.CurContext->isDependentContext()) in checkStatement()
11506 OpaqueValueExpr(X->getExprLoc(), X->getType(), VK_PRValue); in checkStatement()
11508 OpaqueValueExpr(E->getExprLoc(), E->getType(), VK_PRValue); in checkStatement()
11514 Update = SemaRef.PerformImplicitConversion(Update.get(), X->getType(), in checkStatement()
11526 S->IgnoreParenImpCasts()->Profile(Id, Context, true); in getNodeId()
11575 /// No else statement.
11579 /// No error.
11621 /// Check if it is a valid conditional update statement (cond-update-stmt).
11624 /// Check if it is a valid conditional expression statement (cond-expr-stmt).
11632 if (E->isInstantiationDependent()) in CheckValue()
11635 if (ShouldBeLValue && !E->isLValue()) { in CheckValue()
11637 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = E->getExprLoc(); in CheckValue()
11638 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = E->getSourceRange(); in CheckValue()
11642 QualType QTy = E->getType(); in CheckValue()
11643 if (!QTy->isScalarType()) { in CheckValue()
11645 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = E->getExprLoc(); in CheckValue()
11646 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = E->getSourceRange(); in CheckValue()
11649 if (ShouldBeInteger && !QTy->isIntegerType()) { in CheckValue()
11651 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = E->getExprLoc(); in CheckValue()
11652 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = E->getSourceRange(); in CheckValue()
11662 auto *Then = S->getThen(); in checkCondUpdateStmt()
11664 if (CS->body_empty()) { in checkCondUpdateStmt()
11666 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CS->getBeginLoc(); in checkCondUpdateStmt()
11667 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = CS->getSourceRange(); in checkCondUpdateStmt()
11670 if (CS->size() > 1) { in checkCondUpdateStmt()
11672 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CS->getBeginLoc(); in checkCondUpdateStmt()
11673 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = S->getSourceRange(); in checkCondUpdateStmt()
11676 Then = CS->body_front(); in checkCondUpdateStmt()
11682 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Then->getBeginLoc(); in checkCondUpdateStmt()
11683 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Then->getSourceRange(); in checkCondUpdateStmt()
11686 if (BO->getOpcode() != BO_Assign) { in checkCondUpdateStmt()
11688 ErrorInfo.ErrorLoc = BO->getExprLoc(); in checkCondUpdateStmt()
11689 ErrorInfo.NoteLoc = BO->getOperatorLoc(); in checkCondUpdateStmt()
11690 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = BO->getSourceRange(); in checkCondUpdateStmt()
11694 X = BO->getLHS(); in checkCondUpdateStmt()
11696 auto *Cond = dyn_cast<BinaryOperator>(S->getCond()); in checkCondUpdateStmt()
11699 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = S->getCond()->getExprLoc(); in checkCondUpdateStmt()
11700 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = S->getCond()->getSourceRange(); in checkCondUpdateStmt()
11704 switch (Cond->getOpcode()) { in checkCondUpdateStmt()
11707 D = BO->getRHS(); in checkCondUpdateStmt()
11708 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS())) { in checkCondUpdateStmt()
11709 E = Cond->getRHS(); in checkCondUpdateStmt()
11710 } else if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getRHS())) { in checkCondUpdateStmt()
11711 E = Cond->getLHS(); in checkCondUpdateStmt()
11714 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc(); in checkCondUpdateStmt()
11715 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange(); in checkCondUpdateStmt()
11722 E = BO->getRHS(); in checkCondUpdateStmt()
11723 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS()) && in checkCondUpdateStmt()
11724 checkIfTwoExprsAreSame(ContextRef, E, Cond->getRHS())) { in checkCondUpdateStmt()
11726 } else if (checkIfTwoExprsAreSame(ContextRef, E, Cond->getLHS()) && in checkCondUpdateStmt()
11727 checkIfTwoExprsAreSame(ContextRef, X, Cond->getRHS())) { in checkCondUpdateStmt()
11732 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc(); in checkCondUpdateStmt()
11733 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange(); in checkCondUpdateStmt()
11740 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc(); in checkCondUpdateStmt()
11741 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange(); in checkCondUpdateStmt()
11745 if (S->getElse()) { in checkCondUpdateStmt()
11747 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = S->getElse()->getBeginLoc(); in checkCondUpdateStmt()
11748 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = S->getElse()->getSourceRange(); in checkCondUpdateStmt()
11760 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = S->getBeginLoc(); in checkCondExprStmt()
11761 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = S->getSourceRange(); in checkCondExprStmt()
11764 if (BO->getOpcode() != BO_Assign) { in checkCondExprStmt()
11766 ErrorInfo.ErrorLoc = BO->getExprLoc(); in checkCondExprStmt()
11767 ErrorInfo.NoteLoc = BO->getOperatorLoc(); in checkCondExprStmt()
11768 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = BO->getSourceRange(); in checkCondExprStmt()
11772 X = BO->getLHS(); in checkCondExprStmt()
11774 auto *CO = dyn_cast<ConditionalOperator>(BO->getRHS()->IgnoreParenImpCasts()); in checkCondExprStmt()
11777 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = BO->getRHS()->getExprLoc(); in checkCondExprStmt()
11778 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = BO->getRHS()->getSourceRange(); in checkCondExprStmt()
11782 if (!checkIfTwoExprsAreSame(ContextRef, X, CO->getFalseExpr())) { in checkCondExprStmt()
11784 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CO->getFalseExpr()->getExprLoc(); in checkCondExprStmt()
11786 CO->getFalseExpr()->getSourceRange(); in checkCondExprStmt()
11790 auto *Cond = dyn_cast<BinaryOperator>(CO->getCond()); in checkCondExprStmt()
11793 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CO->getCond()->getExprLoc(); in checkCondExprStmt()
11795 CO->getCond()->getSourceRange(); in checkCondExprStmt()
11799 switch (Cond->getOpcode()) { in checkCondExprStmt()
11802 D = CO->getTrueExpr(); in checkCondExprStmt()
11803 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS())) { in checkCondExprStmt()
11804 E = Cond->getRHS(); in checkCondExprStmt()
11805 } else if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getRHS())) { in checkCondExprStmt()
11806 E = Cond->getLHS(); in checkCondExprStmt()
11809 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc(); in checkCondExprStmt()
11810 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange(); in checkCondExprStmt()
11817 E = CO->getTrueExpr(); in checkCondExprStmt()
11818 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS()) && in checkCondExprStmt()
11819 checkIfTwoExprsAreSame(ContextRef, E, Cond->getRHS())) { in checkCondExprStmt()
11821 } else if (checkIfTwoExprsAreSame(ContextRef, E, Cond->getLHS()) && in checkCondExprStmt()
11822 checkIfTwoExprsAreSame(ContextRef, X, Cond->getRHS())) { in checkCondExprStmt()
11827 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc(); in checkCondExprStmt()
11828 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange(); in checkCondExprStmt()
11835 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc(); in checkCondExprStmt()
11836 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange(); in checkCondExprStmt()
11863 if (CS->body_empty()) { in checkStmt()
11865 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CS->getBeginLoc(); in checkStmt()
11866 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = CS->getSourceRange(); in checkStmt()
11870 if (CS->size() != 1) { in checkStmt()
11872 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CS->getBeginLoc(); in checkStmt()
11873 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = CS->getSourceRange(); in checkStmt()
11876 S = CS->body_front(); in checkStmt()
11883 // (cond-update-stmt): in checkStmt()
11889 // Check if the statement is in one of the following forms (cond-expr-stmt): in checkStmt()
11919 // form of 'conditional-update-capture-atomic' structured block on the v5.2
11921 // (1) { v = x; cond-update-stmt }
11922 // (2) { cond-update-stmt v = x; }
11961 auto *Then = S->getThen(); in checkForm3()
11963 if (CS->body_empty()) { in checkForm3()
11965 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CS->getBeginLoc(); in checkForm3()
11966 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = CS->getSourceRange(); in checkForm3()
11969 if (CS->size() > 1) { in checkForm3()
11971 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CS->getBeginLoc(); in checkForm3()
11972 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = CS->getSourceRange(); in checkForm3()
11975 Then = CS->body_front(); in checkForm3()
11981 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Then->getBeginLoc(); in checkForm3()
11982 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Then->getSourceRange(); in checkForm3()
11985 if (BO->getOpcode() != BO_Assign) { in checkForm3()
11987 ErrorInfo.ErrorLoc = BO->getExprLoc(); in checkForm3()
11988 ErrorInfo.NoteLoc = BO->getOperatorLoc(); in checkForm3()
11989 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = BO->getSourceRange(); in checkForm3()
11993 X = BO->getLHS(); in checkForm3()
11994 D = BO->getRHS(); in checkForm3()
11996 auto *Cond = dyn_cast<BinaryOperator>(S->getCond()); in checkForm3()
11999 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = S->getCond()->getExprLoc(); in checkForm3()
12000 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = S->getCond()->getSourceRange(); in checkForm3()
12003 if (Cond->getOpcode() != BO_EQ) { in checkForm3()
12005 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc(); in checkForm3()
12006 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange(); in checkForm3()
12010 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS())) { in checkForm3()
12011 E = Cond->getRHS(); in checkForm3()
12012 } else if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getRHS())) { in checkForm3()
12013 E = Cond->getLHS(); in checkForm3()
12016 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc(); in checkForm3()
12017 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange(); in checkForm3()
12023 if (!S->getElse()) { in checkForm3()
12025 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = S->getBeginLoc(); in checkForm3()
12026 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = S->getSourceRange(); in checkForm3()
12030 auto *Else = S->getElse(); in checkForm3()
12032 if (CS->body_empty()) { in checkForm3()
12034 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CS->getBeginLoc(); in checkForm3()
12035 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = CS->getSourceRange(); in checkForm3()
12038 if (CS->size() > 1) { in checkForm3()
12040 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CS->getBeginLoc(); in checkForm3()
12041 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = S->getSourceRange(); in checkForm3()
12044 Else = CS->body_front(); in checkForm3()
12050 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Else->getBeginLoc(); in checkForm3()
12051 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Else->getSourceRange(); in checkForm3()
12054 if (ElseBO->getOpcode() != BO_Assign) { in checkForm3()
12056 ErrorInfo.ErrorLoc = ElseBO->getExprLoc(); in checkForm3()
12057 ErrorInfo.NoteLoc = ElseBO->getOperatorLoc(); in checkForm3()
12058 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = ElseBO->getSourceRange(); in checkForm3()
12062 if (!checkIfTwoExprsAreSame(ContextRef, X, ElseBO->getRHS())) { in checkForm3()
12064 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = ElseBO->getRHS()->getExprLoc(); in checkForm3()
12066 ElseBO->getRHS()->getSourceRange(); in checkForm3()
12070 V = ElseBO->getLHS(); in checkForm3()
12080 assert(CS->size() == 2 && "CompoundStmt size is not expected"); in checkForm45()
12081 auto *S1 = cast<BinaryOperator>(CS->body_front()); in checkForm45()
12082 auto *S2 = cast<IfStmt>(CS->body_back()); in checkForm45()
12083 assert(S1->getOpcode() == BO_Assign && "unexpected binary operator"); in checkForm45()
12085 if (!checkIfTwoExprsAreSame(ContextRef, S1->getLHS(), S2->getCond())) { in checkForm45()
12087 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = S2->getCond()->getExprLoc(); in checkForm45()
12088 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = S1->getLHS()->getSourceRange(); in checkForm45()
12092 R = S1->getLHS(); in checkForm45()
12094 auto *Then = S2->getThen(); in checkForm45()
12096 if (ThenCS->body_empty()) { in checkForm45()
12098 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = ThenCS->getBeginLoc(); in checkForm45()
12099 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = ThenCS->getSourceRange(); in checkForm45()
12102 if (ThenCS->size() > 1) { in checkForm45()
12104 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = ThenCS->getBeginLoc(); in checkForm45()
12105 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = ThenCS->getSourceRange(); in checkForm45()
12108 Then = ThenCS->body_front(); in checkForm45()
12114 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = S2->getBeginLoc(); in checkForm45()
12115 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = S2->getSourceRange(); in checkForm45()
12118 if (ThenBO->getOpcode() != BO_Assign) { in checkForm45()
12120 ErrorInfo.ErrorLoc = ThenBO->getExprLoc(); in checkForm45()
12121 ErrorInfo.NoteLoc = ThenBO->getOperatorLoc(); in checkForm45()
12122 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = ThenBO->getSourceRange(); in checkForm45()
12126 X = ThenBO->getLHS(); in checkForm45()
12127 D = ThenBO->getRHS(); in checkForm45()
12129 auto *BO = cast<BinaryOperator>(S1->getRHS()->IgnoreImpCasts()); in checkForm45()
12130 if (BO->getOpcode() != BO_EQ) { in checkForm45()
12132 ErrorInfo.ErrorLoc = BO->getExprLoc(); in checkForm45()
12133 ErrorInfo.NoteLoc = BO->getOperatorLoc(); in checkForm45()
12134 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = BO->getSourceRange(); in checkForm45()
12140 if (checkIfTwoExprsAreSame(ContextRef, X, BO->getLHS())) { in checkForm45()
12141 E = BO->getRHS(); in checkForm45()
12142 } else if (checkIfTwoExprsAreSame(ContextRef, X, BO->getRHS())) { in checkForm45()
12143 E = BO->getLHS(); in checkForm45()
12146 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = BO->getExprLoc(); in checkForm45()
12147 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = BO->getSourceRange(); in checkForm45()
12151 if (S2->getElse()) { in checkForm45()
12154 auto *Else = S2->getElse(); in checkForm45()
12156 if (ElseCS->body_empty()) { in checkForm45()
12158 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = ElseCS->getBeginLoc(); in checkForm45()
12159 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = ElseCS->getSourceRange(); in checkForm45()
12162 if (ElseCS->size() > 1) { in checkForm45()
12164 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = ElseCS->getBeginLoc(); in checkForm45()
12165 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = ElseCS->getSourceRange(); in checkForm45()
12168 Else = ElseCS->body_front(); in checkForm45()
12174 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Else->getBeginLoc(); in checkForm45()
12175 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Else->getSourceRange(); in checkForm45()
12178 if (ElseBO->getOpcode() != BO_Assign) { in checkForm45()
12180 ErrorInfo.ErrorLoc = ElseBO->getExprLoc(); in checkForm45()
12181 ErrorInfo.NoteLoc = ElseBO->getOperatorLoc(); in checkForm45()
12182 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = ElseBO->getSourceRange(); in checkForm45()
12185 if (!checkIfTwoExprsAreSame(ContextRef, X, ElseBO->getRHS())) { in checkForm45()
12187 ErrorInfo.ErrorLoc = ElseBO->getRHS()->getExprLoc(); in checkForm45()
12188 ErrorInfo.NoteLoc = X->getExprLoc(); in checkForm45()
12189 ErrorInfo.ErrorRange = ElseBO->getRHS()->getSourceRange(); in checkForm45()
12190 ErrorInfo.NoteRange = X->getSourceRange(); in checkForm45()
12194 V = ElseBO->getLHS(); in checkForm45()
12209 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = S->getBeginLoc(); in checkStmt()
12210 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = S->getSourceRange(); in checkStmt()
12213 if (CS->body_empty()) { in checkStmt()
12215 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CS->getBeginLoc(); in checkStmt()
12216 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = CS->getSourceRange(); in checkStmt()
12221 if (CS->size() == 1) { in checkStmt()
12222 auto *IS = dyn_cast<IfStmt>(CS->body_front()); in checkStmt()
12225 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CS->body_front()->getBeginLoc(); in checkStmt()
12227 CS->body_front()->getSourceRange(); in checkStmt()
12232 } else if (CS->size() == 2) { in checkStmt()
12233 auto *S1 = CS->body_front(); in checkStmt()
12234 auto *S2 = CS->body_back(); in checkStmt()
12242 // { v = x; cond-update-stmt } in checkStmt()
12243 // { v = x; cond-expr-stmt } in checkStmt()
12244 // { cond-expr-stmt; v = x; } in checkStmt()
12246 if (isa<BinaryOperator>(BO->getRHS()->IgnoreImpCasts()) || in checkStmt()
12247 isa<ConditionalOperator>(BO->getRHS()->IgnoreImpCasts())) { in checkStmt()
12251 // { cond-expr-stmt; v = x; } in checkStmt()
12258 // { v = x; cond-update-stmt } in checkStmt()
12261 // { v = x; cond-expr-stmt } in checkStmt()
12266 // { cond-update-stmt v = x; } in checkStmt()
12275 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CUS->getBeginLoc(); in checkStmt()
12276 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = CUS->getSourceRange(); in checkStmt()
12288 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = US->getBeginLoc(); in checkStmt()
12289 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = US->getSourceRange(); in checkStmt()
12292 if (BO->getOpcode() != BO_Assign) { in checkStmt()
12294 ErrorInfo.ErrorLoc = BO->getExprLoc(); in checkStmt()
12295 ErrorInfo.NoteLoc = BO->getOperatorLoc(); in checkStmt()
12296 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = BO->getSourceRange(); in checkStmt()
12299 if (!checkIfTwoExprsAreSame(ContextRef, this->X, BO->getRHS())) { in checkStmt()
12301 ErrorInfo.ErrorLoc = BO->getRHS()->getExprLoc(); in checkStmt()
12302 ErrorInfo.NoteLoc = this->X->getExprLoc(); in checkStmt()
12303 ErrorInfo.ErrorRange = BO->getRHS()->getSourceRange(); in checkStmt()
12304 ErrorInfo.NoteRange = this->X->getSourceRange(); in checkStmt()
12308 this->V = BO->getLHS(); in checkStmt()
12321 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = CS->getBeginLoc(); in checkStmt()
12322 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = CS->getSourceRange(); in checkStmt()
12336 DSAStack->addAtomicDirectiveLoc(StartLoc); in ActOnOpenMPAtomicDirective()
12341 // Structured block - An executable statement with a single entry at the in ActOnOpenMPAtomicDirective()
12352 switch (C->getClauseKind()) { in ActOnOpenMPAtomicDirective()
12361 Diag(C->getBeginLoc(), diag::err_omp_atomic_several_clauses) in ActOnOpenMPAtomicDirective()
12362 << SourceRange(C->getBeginLoc(), C->getEndLoc()); in ActOnOpenMPAtomicDirective()
12366 AtomicKind = C->getClauseKind(); in ActOnOpenMPAtomicDirective()
12367 AtomicKindLoc = C->getBeginLoc(); in ActOnOpenMPAtomicDirective()
12368 if (!EncounteredAtomicKinds.insert(C->getClauseKind()).second) { in ActOnOpenMPAtomicDirective()
12369 Diag(C->getBeginLoc(), diag::err_omp_atomic_several_clauses) in ActOnOpenMPAtomicDirective()
12370 << SourceRange(C->getBeginLoc(), C->getEndLoc()); in ActOnOpenMPAtomicDirective()
12380 Diag(C->getBeginLoc(), diag::err_omp_atomic_no_compare) in ActOnOpenMPAtomicDirective()
12381 << getOpenMPClauseName(C->getClauseKind()) in ActOnOpenMPAtomicDirective()
12382 << SourceRange(C->getBeginLoc(), C->getEndLoc()); in ActOnOpenMPAtomicDirective()
12393 Diag(C->getBeginLoc(), diag::err_omp_several_mem_order_clauses) in ActOnOpenMPAtomicDirective()
12395 << SourceRange(C->getBeginLoc(), C->getEndLoc()); in ActOnOpenMPAtomicDirective()
12399 MemOrderKind = C->getClauseKind(); in ActOnOpenMPAtomicDirective()
12400 MemOrderLoc = C->getBeginLoc(); in ActOnOpenMPAtomicDirective()
12418 // If atomic-clause is read then memory-order-clause must not be acq_rel or in ActOnOpenMPAtomicDirective()
12420 // If atomic-clause is write then memory-order-clause must not be acq_rel or in ActOnOpenMPAtomicDirective()
12422 // If atomic-clause is update or not present then memory-order-clause must not in ActOnOpenMPAtomicDirective()
12442 Body = EWC->getSubExpr(); in ActOnOpenMPAtomicDirective()
12456 // * x and v (as applicable) are both l-value expressions with scalar type. in ActOnOpenMPAtomicDirective()
12464 // * binop is one of +, *, -, /, &, ^, |, <<, or >>. in ActOnOpenMPAtomicDirective()
12465 // * binop, binop=, ++, and -- are not overloaded operators. in ActOnOpenMPAtomicDirective()
12490 dyn_cast<BinaryOperator>(AtomicBody->IgnoreParenImpCasts()); in ActOnOpenMPAtomicDirective()
12491 if (AtomicBinOp && AtomicBinOp->getOpcode() == BO_Assign) { in ActOnOpenMPAtomicDirective()
12492 X = AtomicBinOp->getRHS()->IgnoreParenImpCasts(); in ActOnOpenMPAtomicDirective()
12493 V = AtomicBinOp->getLHS()->IgnoreParenImpCasts(); in ActOnOpenMPAtomicDirective()
12494 if ((X->isInstantiationDependent() || X->getType()->isScalarType()) && in ActOnOpenMPAtomicDirective()
12495 (V->isInstantiationDependent() || V->getType()->isScalarType())) { in ActOnOpenMPAtomicDirective()
12496 if (!X->isLValue() || !V->isLValue()) { in ActOnOpenMPAtomicDirective()
12497 const Expr *NotLValueExpr = X->isLValue() ? V : X; in ActOnOpenMPAtomicDirective()
12499 ErrorLoc = AtomicBinOp->getExprLoc(); in ActOnOpenMPAtomicDirective()
12500 ErrorRange = AtomicBinOp->getSourceRange(); in ActOnOpenMPAtomicDirective()
12501 NoteLoc = NotLValueExpr->getExprLoc(); in ActOnOpenMPAtomicDirective()
12502 NoteRange = NotLValueExpr->getSourceRange(); in ActOnOpenMPAtomicDirective()
12504 } else if (!X->isInstantiationDependent() || in ActOnOpenMPAtomicDirective()
12505 !V->isInstantiationDependent()) { in ActOnOpenMPAtomicDirective()
12507 (X->isInstantiationDependent() || X->getType()->isScalarType()) in ActOnOpenMPAtomicDirective()
12511 ErrorLoc = AtomicBinOp->getExprLoc(); in ActOnOpenMPAtomicDirective()
12512 ErrorRange = AtomicBinOp->getSourceRange(); in ActOnOpenMPAtomicDirective()
12513 NoteLoc = NotScalarExpr->getExprLoc(); in ActOnOpenMPAtomicDirective()
12514 NoteRange = NotScalarExpr->getSourceRange(); in ActOnOpenMPAtomicDirective()
12516 } else if (!AtomicBody->isInstantiationDependent()) { in ActOnOpenMPAtomicDirective()
12518 ErrorLoc = AtomicBody->getExprLoc(); in ActOnOpenMPAtomicDirective()
12519 ErrorRange = AtomicBody->getSourceRange(); in ActOnOpenMPAtomicDirective()
12520 NoteLoc = AtomicBinOp ? AtomicBinOp->getOperatorLoc() in ActOnOpenMPAtomicDirective()
12521 : AtomicBody->getExprLoc(); in ActOnOpenMPAtomicDirective()
12522 NoteRange = AtomicBinOp ? AtomicBinOp->getSourceRange() in ActOnOpenMPAtomicDirective()
12523 : AtomicBody->getSourceRange(); in ActOnOpenMPAtomicDirective()
12527 NoteLoc = ErrorLoc = Body->getBeginLoc(); in ActOnOpenMPAtomicDirective()
12537 if (SemaRef.CurContext->isDependentContext()) in ActOnOpenMPAtomicDirective()
12553 dyn_cast<BinaryOperator>(AtomicBody->IgnoreParenImpCasts()); in ActOnOpenMPAtomicDirective()
12554 if (AtomicBinOp && AtomicBinOp->getOpcode() == BO_Assign) { in ActOnOpenMPAtomicDirective()
12555 X = AtomicBinOp->getLHS(); in ActOnOpenMPAtomicDirective()
12556 E = AtomicBinOp->getRHS(); in ActOnOpenMPAtomicDirective()
12557 if ((X->isInstantiationDependent() || X->getType()->isScalarType()) && in ActOnOpenMPAtomicDirective()
12558 (E->isInstantiationDependent() || E->getType()->isScalarType())) { in ActOnOpenMPAtomicDirective()
12559 if (!X->isLValue()) { in ActOnOpenMPAtomicDirective()
12561 ErrorLoc = AtomicBinOp->getExprLoc(); in ActOnOpenMPAtomicDirective()
12562 ErrorRange = AtomicBinOp->getSourceRange(); in ActOnOpenMPAtomicDirective()
12563 NoteLoc = X->getExprLoc(); in ActOnOpenMPAtomicDirective()
12564 NoteRange = X->getSourceRange(); in ActOnOpenMPAtomicDirective()
12566 } else if (!X->isInstantiationDependent() || in ActOnOpenMPAtomicDirective()
12567 !E->isInstantiationDependent()) { in ActOnOpenMPAtomicDirective()
12569 (X->isInstantiationDependent() || X->getType()->isScalarType()) in ActOnOpenMPAtomicDirective()
12573 ErrorLoc = AtomicBinOp->getExprLoc(); in ActOnOpenMPAtomicDirective()
12574 ErrorRange = AtomicBinOp->getSourceRange(); in ActOnOpenMPAtomicDirective()
12575 NoteLoc = NotScalarExpr->getExprLoc(); in ActOnOpenMPAtomicDirective()
12576 NoteRange = NotScalarExpr->getSourceRange(); in ActOnOpenMPAtomicDirective()
12578 } else if (!AtomicBody->isInstantiationDependent()) { in ActOnOpenMPAtomicDirective()
12580 ErrorLoc = AtomicBody->getExprLoc(); in ActOnOpenMPAtomicDirective()
12581 ErrorRange = AtomicBody->getSourceRange(); in ActOnOpenMPAtomicDirective()
12582 NoteLoc = AtomicBinOp ? AtomicBinOp->getOperatorLoc() in ActOnOpenMPAtomicDirective()
12583 : AtomicBody->getExprLoc(); in ActOnOpenMPAtomicDirective()
12584 NoteRange = AtomicBinOp ? AtomicBinOp->getSourceRange() in ActOnOpenMPAtomicDirective()
12585 : AtomicBody->getSourceRange(); in ActOnOpenMPAtomicDirective()
12589 NoteLoc = ErrorLoc = Body->getBeginLoc(); in ActOnOpenMPAtomicDirective()
12599 if (SemaRef.CurContext->isDependentContext()) in ActOnOpenMPAtomicDirective()
12604 // x--; in ActOnOpenMPAtomicDirective()
12606 // --x; in ActOnOpenMPAtomicDirective()
12618 if (!SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPAtomicDirective()
12637 // v = x--; in ActOnOpenMPAtomicDirective()
12639 // v = --x; in ActOnOpenMPAtomicDirective()
12644 dyn_cast<BinaryOperator>(AtomicBody->IgnoreParenImpCasts()); in ActOnOpenMPAtomicDirective()
12645 if (AtomicBinOp && AtomicBinOp->getOpcode() == BO_Assign) { in ActOnOpenMPAtomicDirective()
12646 V = AtomicBinOp->getLHS(); in ActOnOpenMPAtomicDirective()
12647 Body = AtomicBinOp->getRHS()->IgnoreParenImpCasts(); in ActOnOpenMPAtomicDirective()
12658 } else if (!AtomicBody->isInstantiationDependent()) { in ActOnOpenMPAtomicDirective()
12659 ErrorLoc = AtomicBody->getExprLoc(); in ActOnOpenMPAtomicDirective()
12660 ErrorRange = AtomicBody->getSourceRange(); in ActOnOpenMPAtomicDirective()
12661 NoteLoc = AtomicBinOp ? AtomicBinOp->getOperatorLoc() in ActOnOpenMPAtomicDirective()
12662 : AtomicBody->getExprLoc(); in ActOnOpenMPAtomicDirective()
12663 NoteRange = AtomicBinOp ? AtomicBinOp->getSourceRange() in ActOnOpenMPAtomicDirective()
12664 : AtomicBody->getSourceRange(); in ActOnOpenMPAtomicDirective()
12673 if (SemaRef.CurContext->isDependentContext()) in ActOnOpenMPAtomicDirective()
12679 // { v = x; x--; } in ActOnOpenMPAtomicDirective()
12681 // { v = x; --x; } in ActOnOpenMPAtomicDirective()
12686 // { x--; v = x; } in ActOnOpenMPAtomicDirective()
12688 // { --x; v = x; } in ActOnOpenMPAtomicDirective()
12694 if (CS->size() == 2) { in ActOnOpenMPAtomicDirective()
12695 Stmt *First = CS->body_front(); in ActOnOpenMPAtomicDirective()
12696 Stmt *Second = CS->body_back(); in ActOnOpenMPAtomicDirective()
12698 First = EWC->getSubExpr()->IgnoreParenImpCasts(); in ActOnOpenMPAtomicDirective()
12700 Second = EWC->getSubExpr()->IgnoreParenImpCasts(); in ActOnOpenMPAtomicDirective()
12707 IsUpdateExprFound = BinOp && BinOp->getOpcode() == BO_Assign; in ActOnOpenMPAtomicDirective()
12709 if (IsUpdateExprFound && !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPAtomicDirective()
12711 // { v = x; x--; } in ActOnOpenMPAtomicDirective()
12713 // { v = x; --x; } in ActOnOpenMPAtomicDirective()
12718 Expr *PossibleX = BinOp->getRHS()->IgnoreParenImpCasts(); in ActOnOpenMPAtomicDirective()
12720 Checker.getX()->Profile(XId, Context, /*Canonical=*/true); in ActOnOpenMPAtomicDirective()
12721 PossibleX->Profile(PossibleXId, Context, /*Canonical=*/true); in ActOnOpenMPAtomicDirective()
12724 V = BinOp->getLHS(); in ActOnOpenMPAtomicDirective()
12737 IsUpdateExprFound = BinOp && BinOp->getOpcode() == BO_Assign; in ActOnOpenMPAtomicDirective()
12740 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPAtomicDirective()
12742 // { x--; v = x; } in ActOnOpenMPAtomicDirective()
12744 // { --x; v = x; } in ActOnOpenMPAtomicDirective()
12749 Expr *PossibleX = BinOp->getRHS()->IgnoreParenImpCasts(); in ActOnOpenMPAtomicDirective()
12751 Checker.getX()->Profile(XId, Context, /*Canonical=*/true); in ActOnOpenMPAtomicDirective()
12752 PossibleX->Profile(PossibleXId, Context, /*Canonical=*/true); in ActOnOpenMPAtomicDirective()
12755 V = BinOp->getLHS(); in ActOnOpenMPAtomicDirective()
12769 !(FirstExpr->isInstantiationDependent() || in ActOnOpenMPAtomicDirective()
12770 SecondExpr->isInstantiationDependent())) { in ActOnOpenMPAtomicDirective()
12772 if (!FirstBinOp || FirstBinOp->getOpcode() != BO_Assign) { in ActOnOpenMPAtomicDirective()
12774 NoteLoc = ErrorLoc = FirstBinOp ? FirstBinOp->getOperatorLoc() in ActOnOpenMPAtomicDirective()
12775 : First->getBeginLoc(); in ActOnOpenMPAtomicDirective()
12777 ? FirstBinOp->getSourceRange() in ActOnOpenMPAtomicDirective()
12781 if (!SecondBinOp || SecondBinOp->getOpcode() != BO_Assign) { in ActOnOpenMPAtomicDirective()
12784 ? SecondBinOp->getOperatorLoc() in ActOnOpenMPAtomicDirective()
12785 : Second->getBeginLoc(); in ActOnOpenMPAtomicDirective()
12787 SecondBinOp ? SecondBinOp->getSourceRange() in ActOnOpenMPAtomicDirective()
12791 FirstBinOp->getRHS()->IgnoreParenImpCasts(); in ActOnOpenMPAtomicDirective()
12793 SecondBinOp->getLHS()->IgnoreParenImpCasts(); in ActOnOpenMPAtomicDirective()
12795 PossibleXRHSInFirst->Profile(X1Id, Context, in ActOnOpenMPAtomicDirective()
12797 PossibleXLHSInSecond->Profile(X2Id, Context, in ActOnOpenMPAtomicDirective()
12801 V = FirstBinOp->getLHS(); in ActOnOpenMPAtomicDirective()
12802 X = SecondBinOp->getLHS(); in ActOnOpenMPAtomicDirective()
12803 E = SecondBinOp->getRHS(); in ActOnOpenMPAtomicDirective()
12809 ErrorLoc = FirstBinOp->getExprLoc(); in ActOnOpenMPAtomicDirective()
12810 ErrorRange = FirstBinOp->getSourceRange(); in ActOnOpenMPAtomicDirective()
12811 NoteLoc = SecondBinOp->getLHS()->getExprLoc(); in ActOnOpenMPAtomicDirective()
12812 NoteRange = SecondBinOp->getRHS()->getSourceRange(); in ActOnOpenMPAtomicDirective()
12819 NoteLoc = ErrorLoc = Body->getBeginLoc(); in ActOnOpenMPAtomicDirective()
12821 SourceRange(Body->getBeginLoc(), Body->getBeginLoc()); in ActOnOpenMPAtomicDirective()
12825 NoteLoc = ErrorLoc = Body->getBeginLoc(); in ActOnOpenMPAtomicDirective()
12827 SourceRange(Body->getBeginLoc(), Body->getBeginLoc()); in ActOnOpenMPAtomicDirective()
12837 if (SemaRef.CurContext->isDependentContext()) in ActOnOpenMPAtomicDirective()
12880 return C->getClauseKind() == llvm::omp::Clause::OMPC_weak; in ActOnOpenMPAtomicDirective()
12884 if (Cond->getOpcode() != BO_EQ) { in ActOnOpenMPAtomicDirective()
12886 ErrorInfo.ErrorLoc = Cond->getExprLoc(); in ActOnOpenMPAtomicDirective()
12887 ErrorInfo.NoteLoc = Cond->getOperatorLoc(); in ActOnOpenMPAtomicDirective()
12888 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange(); in ActOnOpenMPAtomicDirective()
12918 // construct. That target construct must contain no statements or directives in ActOnOpenMPTargetDirective()
12920 if (DSAStack->hasInnerTeamsRegion()) { in ActOnOpenMPTargetDirective()
12921 const Stmt *S = CS->IgnoreContainers(/*IgnoreCaptured=*/true); in ActOnOpenMPTargetDirective()
12924 auto I = CS->body_begin(); in ActOnOpenMPTargetDirective()
12925 while (I != CS->body_end()) { in ActOnOpenMPTargetDirective()
12927 bool IsTeams = OED && isOpenMPTeamsDirective(OED->getDirectiveKind()); in ActOnOpenMPTargetDirective()
12928 if (!IsTeams || I != CS->body_begin()) { in ActOnOpenMPTargetDirective()
12930 if (IsTeams && I != CS->body_begin()) { in ActOnOpenMPTargetDirective()
12933 --I; in ActOnOpenMPTargetDirective()
12939 assert(I != CS->body_end() && "Not found statement"); in ActOnOpenMPTargetDirective()
12943 OMPTeamsFound = OED && isOpenMPTeamsDirective(OED->getDirectiveKind()); in ActOnOpenMPTargetDirective()
12947 Diag(DSAStack->getInnerTeamsRegionLoc(), in ActOnOpenMPTargetDirective()
12949 Diag(S->getBeginLoc(), diag::note_omp_nested_statement_here) in ActOnOpenMPTargetDirective()
12969 DSAStack->getTaskgroupReductionRef(), DSAStack->isCancelRegion()); in ActOnOpenMPTargetParallelDirective()
12996 DSAStack->getTaskgroupReductionRef(), DSAStack->isCancelRegion()); in ActOnOpenMPTargetParallelForDirective()
13003 Clauses, [K](const OMPClause *C) { return C->getClauseKind() == K; }); in hasClauses()
13016 return llvm::all_of(TC->all_decls(), [](ValueDecl *VD) { in isClauseMappable()
13017 return !VD || !VD->hasAttr<OMPDeclareTargetDeclAttr>() || in isClauseMappable()
13018 (VD->isExternallyVisible() && in isClauseMappable()
13019 VD->getVisibility() != HiddenVisibility); in isClauseMappable()
13022 return llvm::all_of(FC->all_decls(), [](ValueDecl *VD) { in isClauseMappable()
13023 return !VD || !VD->hasAttr<OMPDeclareTargetDeclAttr>() || in isClauseMappable()
13024 (VD->isExternallyVisible() && in isClauseMappable()
13025 VD->getVisibility() != HiddenVisibility); in isClauseMappable()
13132 // Report affected OpenMP target offloading behavior when in HIP lang-mode. in ActOnOpenMPTeamsDirective()
13133 if (getLangOpts().HIP && (DSAStack->getParentDirective() == OMPD_target)) in ActOnOpenMPTeamsDirective()
13138 DSAStack->setParentTeamsRegionLoc(StartLoc); in ActOnOpenMPTeamsDirective()
13147 if (DSAStack->isParentNowaitRegion()) { in ActOnOpenMPCancellationPointDirective()
13151 if (DSAStack->isParentOrderedRegion()) { in ActOnOpenMPCancellationPointDirective()
13162 if (DSAStack->isParentNowaitRegion()) { in ActOnOpenMPCancelDirective()
13166 if (DSAStack->isParentOrderedRegion()) { in ActOnOpenMPCancelDirective()
13170 DSAStack->setParentCancelRegion(/*Cancel=*/true); in ActOnOpenMPCancelDirective()
13180 if (C->getClauseKind() == OMPC_reduction) { in checkReductionClauseWithNogroup()
13186 if (C->getClauseKind() == OMPC_nogroup) { in checkReductionClauseWithNogroup()
13194 S.Diag(ReductionClause->getBeginLoc(), diag::err_omp_reduction_with_nogroup) in checkReductionClauseWithNogroup()
13195 << SourceRange(NogroupClause->getBeginLoc(), in checkReductionClauseWithNogroup()
13196 NogroupClause->getEndLoc()); in checkReductionClauseWithNogroup()
13219 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPTaskLoopDirective()
13237 DSAStack->isCancelRegion()); in ActOnOpenMPTaskLoopDirective()
13296 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPMasterTaskLoopDirective()
13314 DSAStack->isCancelRegion()); in ActOnOpenMPMasterTaskLoopDirective()
13334 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPMaskedTaskLoopDirective()
13352 DSAStack->isCancelRegion()); in ActOnOpenMPMaskedTaskLoopDirective()
13452 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPParallelMasterTaskLoopDirective()
13469 DSAStack->isCancelRegion()); in ActOnOpenMPParallelMasterTaskLoopDirective()
13491 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPParallelMaskedTaskLoopDirective()
13508 DSAStack->isCancelRegion()); in ActOnOpenMPParallelMaskedTaskLoopDirective()
13611 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPDistributeDirective()
13617 DSAStack->getMappedDirective()); in ActOnOpenMPDistributeDirective()
13640 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPDistributeParallelForDirective()
13645 DSAStack->getTaskgroupReductionRef(), DSAStack->isCancelRegion()); in ActOnOpenMPDistributeParallelForDirective()
13782 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPTeamsDistributeDirective()
13785 DSAStack->setParentTeamsRegionLoc(StartLoc); in ActOnOpenMPTeamsDistributeDirective()
13816 DSAStack->setParentTeamsRegionLoc(StartLoc); in ActOnOpenMPTeamsDistributeSimdDirective()
13847 DSAStack->setParentTeamsRegionLoc(StartLoc); in ActOnOpenMPTeamsDistributeParallelForSimdDirective()
13873 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPTeamsDistributeParallelForDirective()
13876 DSAStack->setParentTeamsRegionLoc(StartLoc); in ActOnOpenMPTeamsDistributeParallelForDirective()
13880 DSAStack->getTaskgroupReductionRef(), DSAStack->isCancelRegion()); in ActOnOpenMPTeamsDistributeParallelForDirective()
13896 return C->getClauseKind() == OMPC_ompx_bare; in ActOnOpenMPTargetTeamsDirective()
13900 Diag(BareClause->getBeginLoc(), diag::err_ompx_bare_no_grid); in ActOnOpenMPTargetTeamsDirective()
13927 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) && in ActOnOpenMPTargetTeamsDistributeDirective()
13958 DSAStack->getTaskgroupReductionRef(), DSAStack->isCancelRegion()); in ActOnOpenMPTargetTeamsDistributeParallelForDirective()
14026 AStmt->IgnoreContainers(), /*TryImperfectlyNestedLoops=*/false, NumLoops, in checkTransformableLoopNest()
14037 OriginalInits.back().push_back(For->getInit()); in checkTransformableLoopNest()
14038 Body = For->getBody(); in checkTransformableLoopNest()
14041 "Expected canonical for or range-based for loops."); in checkTransformableLoopNest()
14043 OriginalInits.back().push_back(CXXFor->getBeginStmt()); in checkTransformableLoopNest()
14044 Body = CXXFor->getBody(); in checkTransformableLoopNest()
14052 DependentPreInits = Dir->getPreInits(); in checkTransformableLoopNest()
14054 DependentPreInits = Dir->getPreInits(); in checkTransformableLoopNest()
14056 DependentPreInits = Dir->getPreInits(); in checkTransformableLoopNest()
14058 DependentPreInits = Dir->getPreInits(); in checkTransformableLoopNest()
14064 assert(OriginalInits.back().empty() && "No preinit after innermost loop"); in checkTransformableLoopNest()
14075 // For range-based for-statements, ensure that their syntactic sugar is in addLoopPreInits()
14076 // executed by adding them as pre-init statements. in addLoopPreInits()
14078 Stmt *RangeInit = CXXRangeFor->getInit(); in addLoopPreInits()
14082 DeclStmt *RangeStmt = CXXRangeFor->getRangeStmt(); in addLoopPreInits()
14083 PreInits.push_back(new (Context) DeclStmt(RangeStmt->getDeclGroup(), in addLoopPreInits()
14084 RangeStmt->getBeginLoc(), in addLoopPreInits()
14085 RangeStmt->getEndLoc())); in addLoopPreInits()
14087 DeclStmt *RangeEnd = CXXRangeFor->getEndStmt(); in addLoopPreInits()
14088 PreInits.push_back(new (Context) DeclStmt(RangeEnd->getDeclGroup(), in addLoopPreInits()
14089 RangeEnd->getBeginLoc(), in addLoopPreInits()
14090 RangeEnd->getEndLoc())); in addLoopPreInits()
14098 PI->getDeclGroup(), PI->getBeginLoc(), PI->getEndLoc())); in addLoopPreInits()
14103 auto *CounterDecl = cast<DeclRefExpr>(CounterRef)->getDecl(); in addLoopPreInits()
14135 llvm::any_of(SizesClause->getSizesRefs(), [](Expr *E) { return !E; })) in ActOnOpenMPTileDirective()
14137 unsigned NumLoops = SizesClause->getNumSizes(); in ActOnOpenMPTileDirective()
14152 if (SemaRef.CurContext->isDependentContext()) in ActOnOpenMPTileDirective()
14179 "Expect single-dimensional loop iteration space"); in ActOnOpenMPTileDirective()
14181 std::string OrigVarName = OrigCntVar->getNameInfo().getAsString(); in ActOnOpenMPTileDirective()
14183 QualType CntTy = IterVarRef->getType(); in ActOnOpenMPTileDirective()
14202 auto *TileCntDecl = cast<VarDecl>(IterVarRef->getDecl()); in ActOnOpenMPTileDirective()
14203 TileCntDecl->setDeclName( in ActOnOpenMPTileDirective()
14215 auto MakeDimTileSize = [&SemaRef = this->SemaRef, &CopyTransformer, &Context, in ActOnOpenMPTileDirective()
14216 SizesClause, CurScope](int I) -> Expr * { in ActOnOpenMPTileDirective()
14217 Expr *DimTileSizeExpr = SizesClause->getSizesRefs()[I]; in ActOnOpenMPTileDirective()
14222 // pass non-positive numbers. For instance: in ActOnOpenMPTileDirective()
14229 // Although there is no meaningful interpretation of the tile size, the body in ActOnOpenMPTileDirective()
14237 QualType DimTy = DimTileSizeExpr->getType(); in ActOnOpenMPTileDirective()
14254 for (int I = NumLoops - 1; I >= 0; --I) { in ActOnOpenMPTileDirective()
14258 QualType IVTy = NumIterations->getType(); in ActOnOpenMPTileDirective()
14264 auto MakeTileIVRef = [&SemaRef = this->SemaRef, &TileIndVars, I, IVTy, in ActOnOpenMPTileDirective()
14267 OrigCntVar->getExprLoc()); in ActOnOpenMPTileDirective()
14269 auto MakeFloorIVRef = [&SemaRef = this->SemaRef, &FloorIndVars, I, IVTy, in ActOnOpenMPTileDirective()
14272 OrigCntVar->getExprLoc()); in ActOnOpenMPTileDirective()
14275 // For init-statement: auto .tile.iv = .floor.iv in ActOnOpenMPTileDirective()
14282 OrigCntVar->getBeginLoc(), OrigCntVar->getEndLoc()); in ActOnOpenMPTileDirective()
14286 // For cond-expression: in ActOnOpenMPTileDirective()
14289 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_Add, in ActOnOpenMPTileDirective()
14294 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT, in ActOnOpenMPTileDirective()
14299 LoopHelper.Cond->getBeginLoc(), LoopHelper.Cond->getEndLoc(), in ActOnOpenMPTileDirective()
14304 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT, in ActOnOpenMPTileDirective()
14309 // For incr-statement: ++.tile.iv in ActOnOpenMPTileDirective()
14311 CurScope, LoopHelper.Inc->getExprLoc(), UO_PreInc, MakeTileIVRef()); in ActOnOpenMPTileDirective()
14334 BodyParts.push_back(SourceCXXFor->getLoopVarStmt()); in ActOnOpenMPTileDirective()
14337 Inner->getBeginLoc(), Inner->getEndLoc()); in ActOnOpenMPTileDirective()
14340 IncrStmt.get(), Inner, LoopHelper.Init->getBeginLoc(), in ActOnOpenMPTileDirective()
14341 LoopHelper.Init->getBeginLoc(), LoopHelper.Inc->getEndLoc()); in ActOnOpenMPTileDirective()
14345 for (int I = NumLoops - 1; I >= 0; --I) { in ActOnOpenMPTileDirective()
14349 QualType IVTy = NumIterations->getType(); in ActOnOpenMPTileDirective()
14354 auto MakeFloorIVRef = [&SemaRef = this->SemaRef, &FloorIndVars, I, IVTy, in ActOnOpenMPTileDirective()
14357 OrigCntVar->getExprLoc()); in ActOnOpenMPTileDirective()
14360 // For init-statement: auto .floor.iv = 0 in ActOnOpenMPTileDirective()
14363 SemaRef.ActOnIntegerConstant(LoopHelper.Init->getExprLoc(), 0).get(), in ActOnOpenMPTileDirective()
14368 OrigCntVar->getBeginLoc(), OrigCntVar->getEndLoc()); in ActOnOpenMPTileDirective()
14372 // For cond-expression: .floor.iv < NumIterations in ActOnOpenMPTileDirective()
14374 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT, in ActOnOpenMPTileDirective()
14379 // For incr-statement: .floor.iv += DimTileSize in ActOnOpenMPTileDirective()
14381 SemaRef.BuildBinOp(CurScope, LoopHelper.Inc->getExprLoc(), BO_AddAssign, in ActOnOpenMPTileDirective()
14388 IncrStmt.get(), Inner, LoopHelper.Init->getBeginLoc(), in ActOnOpenMPTileDirective()
14389 LoopHelper.Init->getBeginLoc(), LoopHelper.Inc->getEndLoc()); in ActOnOpenMPTileDirective()
14430 if (SemaRef.CurContext->isDependentContext()) in ActOnOpenMPUnrollDirective()
14435 "Expecting a single-dimensional loop iteration space"); in ActOnOpenMPUnrollDirective()
14437 "Expecting a single-dimensional loop iteration space"); in ActOnOpenMPUnrollDirective()
14445 Diag(AStmt->getBeginLoc(), diag::err_omp_unroll_full_variable_trip_count); in ActOnOpenMPUnrollDirective()
14446 Diag(FullClause->getBeginLoc(), diag::note_omp_directive_here) in ActOnOpenMPUnrollDirective()
14452 // The generated loop may only be passed to other loop-associated directive in ActOnOpenMPUnrollDirective()
14454 // sufficient to generate loop unroll metadata at code-generation. in ActOnOpenMPUnrollDirective()
14459 // Otherwise, we need to provide a de-sugared/transformed AST that can be in ActOnOpenMPUnrollDirective()
14497 // CompoundStatement. This is to allow the loop to become a non-outermost loop in ActOnOpenMPUnrollDirective()
14510 QualType IVTy = IterationVarRef->getType(); in ActOnOpenMPUnrollDirective()
14512 "Expecting a single-dimensional loop iteration space"); in ActOnOpenMPUnrollDirective()
14518 if (Expr *FactorVal = PartialClause->getFactor()) { in ActOnOpenMPUnrollDirective()
14519 Factor = FactorVal->getIntegerConstantExpr(Context)->getZExtValue(); in ActOnOpenMPUnrollDirective()
14520 FactorLoc = FactorVal->getExprLoc(); in ActOnOpenMPUnrollDirective()
14533 SourceLocation OrigVarLoc = OrigVar->getExprLoc(); in ActOnOpenMPUnrollDirective()
14534 SourceLocation OrigVarLocBegin = OrigVar->getBeginLoc(); in ActOnOpenMPUnrollDirective()
14535 SourceLocation OrigVarLocEnd = OrigVar->getEndLoc(); in ActOnOpenMPUnrollDirective()
14538 std::string OrigVarName = OrigVar->getNameInfo().getAsString(); in ActOnOpenMPUnrollDirective()
14553 auto *InnerIVDecl = cast<VarDecl>(IterationVarRef->getDecl()); in ActOnOpenMPUnrollDirective()
14554 InnerIVDecl->setDeclName(&SemaRef.PP.getIdentifierTable().get(InnerIVName)); in ActOnOpenMPUnrollDirective()
14562 auto MakeNumIterations = [&CopyTransformer, &LoopHelper]() -> Expr * { in ActOnOpenMPUnrollDirective()
14567 // Inner For init-statement: auto .unroll_inner.iv = .unrolled.iv in ActOnOpenMPUnrollDirective()
14576 // Inner For cond-expression: in ActOnOpenMPUnrollDirective()
14584 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_Add, in ActOnOpenMPUnrollDirective()
14589 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT, in ActOnOpenMPUnrollDirective()
14594 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT, in ActOnOpenMPUnrollDirective()
14599 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LAnd, in ActOnOpenMPUnrollDirective()
14604 // Inner For incr-statement: ++.unroll_inner.iv in ActOnOpenMPUnrollDirective()
14606 CurScope, LoopHelper.Inc->getExprLoc(), UO_PreInc, MakeInnerRef()); in ActOnOpenMPUnrollDirective()
14614 InnerBodyStmts.push_back(CXXRangeFor->getLoopVarStmt()); in ActOnOpenMPUnrollDirective()
14618 Body->getBeginLoc(), Body->getEndLoc()); in ActOnOpenMPUnrollDirective()
14621 InnerIncr.get(), InnerBody, LoopHelper.Init->getBeginLoc(), in ActOnOpenMPUnrollDirective()
14622 LoopHelper.Init->getBeginLoc(), LoopHelper.Inc->getEndLoc()); in ActOnOpenMPUnrollDirective()
14642 // Outer For init-statement: auto .unrolled.iv = 0 in ActOnOpenMPUnrollDirective()
14645 SemaRef.ActOnIntegerConstant(LoopHelper.Init->getExprLoc(), 0).get(), in ActOnOpenMPUnrollDirective()
14652 // Outer For cond-expression: .unrolled.iv < NumIterations in ActOnOpenMPUnrollDirective()
14654 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT, in ActOnOpenMPUnrollDirective()
14659 // Outer For incr-statement: .unrolled.iv += Factor in ActOnOpenMPUnrollDirective()
14661 SemaRef.BuildBinOp(CurScope, LoopHelper.Inc->getExprLoc(), BO_AddAssign, in ActOnOpenMPUnrollDirective()
14669 OuterIncr.get(), InnerUnrolled, LoopHelper.Init->getBeginLoc(), in ActOnOpenMPUnrollDirective()
14670 LoopHelper.Init->getBeginLoc(), LoopHelper.Inc->getEndLoc()); in ActOnOpenMPUnrollDirective()
14698 if (SemaRef.CurContext->isDependentContext()) in ActOnOpenMPReverseDirective()
14703 "Expecting a single-dimensional loop iteration space"); in ActOnOpenMPReverseDirective()
14705 "Expecting a single-dimensional loop iteration space"); in ActOnOpenMPReverseDirective()
14717 QualType IVTy = IterationVarRef->getType(); in ActOnOpenMPReverseDirective()
14722 SourceLocation OrigVarLoc = OrigVar->getExprLoc(); in ActOnOpenMPReverseDirective()
14723 SourceLocation OrigVarLocBegin = OrigVar->getBeginLoc(); in ActOnOpenMPReverseDirective()
14724 SourceLocation OrigVarLocEnd = OrigVar->getEndLoc(); in ActOnOpenMPReverseDirective()
14732 std::string OrigVarName = OrigVar->getNameInfo().getAsString(); in ActOnOpenMPReverseDirective()
14750 // for (unsigned i = n-1; i >= 0; --i) in ActOnOpenMPReverseDirective()
14760 // auto .reversed.iv = n - .forward.iv - 1; in ActOnOpenMPReverseDirective()
14770 auto MakeNumIterations = [&CopyTransformer, &LoopHelper]() -> Expr * { in ActOnOpenMPReverseDirective()
14775 // Create the iteration variable for the forward loop (from 0 to n-1). in ActOnOpenMPReverseDirective()
14778 auto MakeForwardRef = [&SemaRef = this->SemaRef, ForwardIVDecl, IVTy, in ActOnOpenMPReverseDirective()
14783 // Iteration variable for the reversed induction variable (from n-1 downto 0): in ActOnOpenMPReverseDirective()
14785 auto *ReversedIVDecl = cast<VarDecl>(IterationVarRef->getDecl()); in ActOnOpenMPReverseDirective()
14786 ReversedIVDecl->setDeclName( in ActOnOpenMPReverseDirective()
14789 // For init-statement: in ActOnOpenMPReverseDirective()
14794 ForwardIVDecl->getType(), OrigVarLoc); in ActOnOpenMPReverseDirective()
14801 // Forward iv cond-expression: in ActOnOpenMPReverseDirective()
14806 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT, in ActOnOpenMPReverseDirective()
14811 // Forward incr-statement: in ActOnOpenMPReverseDirective()
14815 ExprResult Incr = SemaRef.BuildUnaryOp(CurScope, LoopHelper.Inc->getExprLoc(), in ActOnOpenMPReverseDirective()
14820 // Reverse the forward-iv: in ActOnOpenMPReverseDirective()
14822 // auto .reversed.iv = MakeNumIterations() - 1 - .forward.iv in ActOnOpenMPReverseDirective()
14848 BodyStmts.push_back(CXXRangeFor->getLoopVarStmt()); in ActOnOpenMPReverseDirective()
14852 Body->getBeginLoc(), Body->getEndLoc()); in ActOnOpenMPReverseDirective()
14854 // Finally create the reversed For-statement. in ActOnOpenMPReverseDirective()
14857 ReversedBody, LoopHelper.Init->getBeginLoc(), in ActOnOpenMPReverseDirective()
14858 LoopHelper.Init->getBeginLoc(), LoopHelper.Inc->getEndLoc()); in ActOnOpenMPReverseDirective()
14887 if (CurContext->isDependentContext()) in ActOnOpenMPInterchangeDirective()
14905 // Collect pre-init statements on the order before the permuation. in ActOnOpenMPInterchangeDirective()
14911 "Single-dimensional loop iteration space expected"); in ActOnOpenMPInterchangeDirective()
14914 std::string OrigVarName = OrigCntVar->getNameInfo().getAsString(); in ActOnOpenMPInterchangeDirective()
14932 "Single-dimensional loop iteration space expected"); in ActOnOpenMPInterchangeDirective()
14935 // Normalized loop counter variable: From 0 to n-1, always an integer type. in ActOnOpenMPInterchangeDirective()
14937 QualType IVTy = IterVarRef->getType(); in ActOnOpenMPInterchangeDirective()
14938 assert(IVTy->isIntegerType() && in ActOnOpenMPInterchangeDirective()
14941 std::string OrigVarName = OrigCntVar->getNameInfo().getAsString(); in ActOnOpenMPInterchangeDirective()
14942 SourceLocation OrigVarLoc = IterVarRef->getExprLoc(); in ActOnOpenMPInterchangeDirective()
14946 auto MakeNumIterations = [&CopyTransformer, &SourceHelper]() -> Expr * { in ActOnOpenMPInterchangeDirective()
14956 auto *PermutedCntDecl = cast<VarDecl>(IterVarRef->getDecl()); in ActOnOpenMPInterchangeDirective()
14957 PermutedCntDecl->setDeclName( in ActOnOpenMPInterchangeDirective()
14964 // For init-statement: in ActOnOpenMPInterchangeDirective()
14974 DeclStmt(DeclGroupRef(PermutedCntDecl), OrigCntVar->getBeginLoc(), in ActOnOpenMPInterchangeDirective()
14975 OrigCntVar->getEndLoc()); in ActOnOpenMPInterchangeDirective()
14979 // For cond-expression: in ActOnOpenMPInterchangeDirective()
14984 SemaRef.BuildBinOp(CurScope, SourceHelper.Cond->getExprLoc(), BO_LT, in ActOnOpenMPInterchangeDirective()
14989 // For incr-statement: in ActOnOpenMPInterchangeDirective()
14994 CurScope, SourceHelper.Inc->getExprLoc(), UO_PreInc, MakePermutedRef()); in ActOnOpenMPInterchangeDirective()
15001 BodyParts.push_back(SourceCXXFor->getLoopVarStmt()); in ActOnOpenMPInterchangeDirective()
15004 Inner->getBeginLoc(), Inner->getEndLoc()); in ActOnOpenMPInterchangeDirective()
15007 SourceHelper.Init->getBeginLoc(), SourceHelper.Init->getBeginLoc(), in ActOnOpenMPInterchangeDirective()
15008 SourceHelper.Inc->getEndLoc()); in ActOnOpenMPInterchangeDirective()
15165 "Invalid directive with CKind-clause"); in getOpenMPCaptureRegionForClause()
15174 // [5.2:341:24-30] in getOpenMPCaptureRegionForClause()
15176 // the argument of the clause is an expression, or lower-bound, length, or in getOpenMPCaptureRegionForClause()
15178 // expressions in subscript-triplet for Fortran), or linear-step or alignment in getOpenMPCaptureRegionForClause()
15239 for (int I = EndIdx - 1; I >= 0; --I) { in getOpenMPCaptureRegionForClause()
15243 return -1; in getOpenMPCaptureRegionForClause()
15248 for (int I = InnermostIdx - 1; I >= 0; --I) { in getOpenMPCaptureRegionForClause()
15283 if (!Condition->isValueDependent() && !Condition->isTypeDependent() && in ActOnOpenMPIfClause()
15284 !Condition->isInstantiationDependent() && in ActOnOpenMPIfClause()
15285 !Condition->containsUnexpandedParameterPack()) { in ActOnOpenMPIfClause()
15292 OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); in ActOnOpenMPIfClause()
15296 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPIfClause()
15316 if (!Condition->isValueDependent() && !Condition->isTypeDependent() && in ActOnOpenMPFinalClause()
15317 !Condition->isInstantiationDependent() && in ActOnOpenMPFinalClause()
15318 !Condition->containsUnexpandedParameterPack()) { in ActOnOpenMPFinalClause()
15325 OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); in ActOnOpenMPFinalClause()
15329 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPFinalClause()
15366 return S.Diag(Conv->getLocation(), diag::note_omp_conversion_here) in PerformOpenMPImplicitIntegerConversion()
15367 << ConvTy->isEnumeralType() << ConvTy; in PerformOpenMPImplicitIntegerConversion()
15375 return S.Diag(Conv->getLocation(), diag::note_omp_conversion_here) in PerformOpenMPImplicitIntegerConversion()
15376 << ConvTy->isEnumeralType() << ConvTy; in PerformOpenMPImplicitIntegerConversion()
15392 if (!ValExpr->isTypeDependent() && !ValExpr->isValueDependent() && in isNonNegativeIntegerValue()
15393 !ValExpr->isInstantiationDependent()) { in isNonNegativeIntegerValue()
15394 SourceLocation Loc = ValExpr->getExprLoc(); in isNonNegativeIntegerValue()
15401 // The expression must evaluate to a non-negative integer value. in isNonNegativeIntegerValue()
15403 ValExpr->getIntegerConstantExpr(SemaRef.Context)) { in isNonNegativeIntegerValue()
15404 if (Result->isSigned() && in isNonNegativeIntegerValue()
15405 !((!StrictlyPositive && Result->isNonNegative()) || in isNonNegativeIntegerValue()
15406 (StrictlyPositive && Result->isStrictlyPositive()))) { in isNonNegativeIntegerValue()
15409 << ValExpr->getSourceRange(); in isNonNegativeIntegerValue()
15418 !SemaRef.CurContext->isDependentContext()) { in isNonNegativeIntegerValue()
15441 OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); in ActOnOpenMPNumThreadsClause()
15445 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPNumThreadsClause()
15461 if (E->isValueDependent() || E->isTypeDependent() || in VerifyPositiveIntegerConstantInClause()
15462 E->isInstantiationDependent() || E->containsUnexpandedParameterPack()) in VerifyPositiveIntegerConstantInClause()
15488 Diag(E->getExprLoc(), diag::err_omp_negative_expression_in_clause) in VerifyPositiveIntegerConstantInClause()
15490 << E->getSourceRange(); in VerifyPositiveIntegerConstantInClause()
15494 Diag(E->getExprLoc(), diag::warn_omp_alignment_not_power_of_two) in VerifyPositiveIntegerConstantInClause()
15495 << E->getSourceRange(); in VerifyPositiveIntegerConstantInClause()
15498 if (CKind == OMPC_collapse && DSAStack->getAssociatedLoops() == 1) in VerifyPositiveIntegerConstantInClause()
15499 DSAStack->setAssociatedLoops(Result.getExtValue()); in VerifyPositiveIntegerConstantInClause()
15501 DSAStack->setAssociatedLoops(Result.getExtValue()); in VerifyPositiveIntegerConstantInClause()
15536 if (!Stack->getOMPAllocatorHandleT().isNull()) in findOMPAllocatorHandleT()
15549 Stack->setOMPAllocatorHandleT(AllocatorHandleEnumTy); in findOMPAllocatorHandleT()
15565 VD->getType().getNonLValueExprType(S.getASTContext()); in findOMPAllocatorHandleT()
15578 Stack->setAllocator(AllocatorKind, Res.get()); in findOMPAllocatorHandleT()
15595 if (!findOMPAllocatorHandleT(SemaRef, A->getExprLoc(), DSAStack)) in ActOnOpenMPAllocatorClause()
15602 Allocator.get(), DSAStack->getOMPAllocatorHandleT(), in ActOnOpenMPAllocatorClause()
15648 NumForLoops ? DSAStack->getAssociatedLoops() : 0, in ActOnOpenMPOrderedClause()
15650 DSAStack->setOrderedRegion(/*IsOrdered=*/true, NumForLoops, Clause); in ActOnOpenMPOrderedClause()
15783 --Skipped; in getListOfPossibleValues()
15810 DSAStack->setDefaultDSANone(KindKwLoc); in ActOnOpenMPDefaultClause()
15813 DSAStack->setDefaultDSAShared(KindKwLoc); in ActOnOpenMPDefaultClause()
15816 DSAStack->setDefaultDSAFirstPrivate(KindKwLoc); in ActOnOpenMPDefaultClause()
15819 DSAStack->setDefaultDSAPrivate(KindKwLoc); in ActOnOpenMPDefaultClause()
15910 Diag(ME->getBeginLoc(), diag::warn_clause_expected_string) in ActOnOpenMPMessageClause()
15944 DSAStack->setRegionHasOrderConcurrent(/*HasOrderConcurrent=*/true); in ActOnOpenMPOrderClause()
15945 if (DSAStack->getCurScope()) { in ActOnOpenMPOrderClause()
15947 unsigned existingFlags = DSAStack->getCurScope()->getFlags(); in ActOnOpenMPOrderClause()
15948 DSAStack->getCurScope()->setFlags(existingFlags | in ActOnOpenMPOrderClause()
15993 // isNonNegativeIntegerValue returns true for non-integral types (but still in ActOnOpenMPSizesClause()
15995 QualType SizeTy = SizeExpr->getType(); in ActOnOpenMPSizesClause()
15996 if (!SizeTy->isIntegerType()) in ActOnOpenMPSizesClause()
16007 // isNonNegativeIntegerValue skipped any checks so there is no in ActOnOpenMPSizesClause()
16020 // Pass the invalid expression as-is, template instantiation may in ActOnOpenMPSizesClause()
16024 if (!SizeExpr->isInstantiationDependent() && !IsValid) in ActOnOpenMPSizesClause()
16285 if (!ChunkSize->isValueDependent() && !ChunkSize->isTypeDependent() && in ActOnOpenMPScheduleClause()
16286 !ChunkSize->isInstantiationDependent() && in ActOnOpenMPScheduleClause()
16287 !ChunkSize->containsUnexpandedParameterPack()) { in ActOnOpenMPScheduleClause()
16288 SourceLocation ChunkSizeLoc = ChunkSize->getBeginLoc(); in ActOnOpenMPScheduleClause()
16300 ValExpr->getIntegerConstantExpr(getASTContext())) { in ActOnOpenMPScheduleClause()
16301 if (Result->isSigned() && !Result->isStrictlyPositive()) { in ActOnOpenMPScheduleClause()
16303 << "schedule" << 1 << ChunkSize->getSourceRange(); in ActOnOpenMPScheduleClause()
16307 DSAStack->getCurrentDirective(), OMPC_schedule, in ActOnOpenMPScheduleClause()
16309 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPScheduleClause()
16481 DSAStack->setNowaitRegion(); in ActOnOpenMPNowaitClause()
16487 DSAStack->setUntiedRegion(); in ActOnOpenMPUntiedClause()
16613 // At least one action-clause must appear on a directive. in ActOnOpenMPInteropDirective()
16623 // interop-type is present or the interop-var was initialized with in ActOnOpenMPInteropDirective()
16624 // the targetsync interop-type. in ActOnOpenMPInteropDirective()
16626 // If there is any 'init' clause diagnose if there is no 'init' clause with in ActOnOpenMPInteropDirective()
16627 // interop-type of 'targetsync'. Cases involving other directives cannot be in ActOnOpenMPInteropDirective()
16637 if (InitClause->getIsTargetSync()) in ActOnOpenMPInteropDirective()
16644 Diag(DependClause->getBeginLoc(), diag::err_omp_interop_bad_depend_clause); in ActOnOpenMPInteropDirective()
16649 // Each interop-var may be specified for at most one action-clause of each in ActOnOpenMPInteropDirective()
16653 OpenMPClauseKind ClauseKind = C->getClauseKind(); in ActOnOpenMPInteropDirective()
16659 auto *E = cast<OMPInitClause>(C)->getInteropVar(); in ActOnOpenMPInteropDirective()
16662 auto *E = cast<OMPUseClause>(C)->getInteropVar(); in ActOnOpenMPInteropDirective()
16665 auto *E = cast<OMPDestroyClause>(C)->getInteropVar(); in ActOnOpenMPInteropDirective()
16708 InteropType = QualType(TD->getTypeForDecl(), 0); in isValidInteropVariable()
16722 QualType VarType = InteropVarExpr->getType().getUnqualifiedType(); in isValidInteropVariable()
16729 // The interop-var passed to init or destroy must be non-const. in isValidInteropVariable()
16731 isConstNotMutableType(SemaRef, InteropVarExpr->getType())) { in isValidInteropVariable()
16733 << /*non-const*/ 1; in isValidInteropVariable()
16746 // Check prefer_type values. These foreign-runtime-id values are either in ActOnOpenMPInitClause()
16749 if (E->isValueDependent() || E->isTypeDependent() || in ActOnOpenMPInitClause()
16750 E->isInstantiationDependent() || E->containsUnexpandedParameterPack()) in ActOnOpenMPInitClause()
16752 if (E->isIntegerConstantExpr(getASTContext())) in ActOnOpenMPInitClause()
16756 Diag(E->getExprLoc(), diag::err_omp_interop_prefer_type); in ActOnOpenMPInitClause()
16783 DSAStack->getCurrentDirective() == OMPD_depobj) { in ActOnOpenMPDestroyClause()
16804 if (!Condition->isValueDependent() && !Condition->isTypeDependent() && in ActOnOpenMPNovariantsClause()
16805 !Condition->isInstantiationDependent() && in ActOnOpenMPNovariantsClause()
16806 !Condition->containsUnexpandedParameterPack()) { in ActOnOpenMPNovariantsClause()
16813 OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); in ActOnOpenMPNovariantsClause()
16817 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPNovariantsClause()
16836 if (!Condition->isValueDependent() && !Condition->isTypeDependent() && in ActOnOpenMPNocontextClause()
16837 !Condition->isInstantiationDependent() && in ActOnOpenMPNocontextClause()
16838 !Condition->containsUnexpandedParameterPack()) { in ActOnOpenMPNocontextClause()
16845 OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); in ActOnOpenMPNocontextClause()
16849 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPNocontextClause()
16868 OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); in ActOnOpenMPFilterClause()
16872 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPFilterClause()
17082 Capture, Capture->getType().getNonReferenceType(), VK_LValue, Loc); in getOpenMPCapturedExpr()
17090 if (VK != VK_LValue && Res.get()->isGLValue()) { in getOpenMPCapturedExpr()
17121 QualType Type = D->getType(); in ActOnOpenMPPrivateClause()
17133 // A variable that is privatized must not have a const-qualified type in ActOnOpenMPPrivateClause()
17139 // const-qualified type unless it is of class type with a mutable member. in ActOnOpenMPPrivateClause()
17143 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in ActOnOpenMPPrivateClause()
17145 // Variables with the predetermined data-sharing attributes may not be in ActOnOpenMPPrivateClause()
17146 // listed in data-sharing attributes clauses, except for the cases in ActOnOpenMPPrivateClause()
17148 // variable in a data-sharing attribute clause is allowed and overrides in ActOnOpenMPPrivateClause()
17149 // the variable's predetermined data-sharing attributes. in ActOnOpenMPPrivateClause()
17150 DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(D, /*FromParent=*/false); in ActOnOpenMPPrivateClause()
17158 OpenMPDirectiveKind CurrDir = DSAStack->getCurrentDirective(); in ActOnOpenMPPrivateClause()
17160 if (!Type->isAnyPointerType() && Type->isVariablyModifiedType() && in ActOnOpenMPPrivateClause()
17165 bool IsDecl = !VD || VD->isThisDeclarationADefinition(getASTContext()) == in ActOnOpenMPPrivateClause()
17167 Diag(D->getLocation(), in ActOnOpenMPPrivateClause()
17174 // A list item cannot appear in both a map clause and a data-sharing in ActOnOpenMPPrivateClause()
17178 // A list item cannot appear in both a map clause and a data-sharing in ActOnOpenMPPrivateClause()
17185 if (DSAStack->checkMappableExprComponentListsForDecl( in ActOnOpenMPPrivateClause()
17188 OpenMPClauseKind WhereFoundClauseKind) -> bool { in ActOnOpenMPPrivateClause()
17212 buildVarDecl(SemaRef, ELoc, Type, D->getName(), in ActOnOpenMPPrivateClause()
17213 D->hasAttrs() ? &D->getAttrs() : nullptr, in ActOnOpenMPPrivateClause()
17216 if (VDPrivate->isInvalidDecl()) in ActOnOpenMPPrivateClause()
17219 SemaRef, VDPrivate, RefExpr->getType().getUnqualifiedType(), ELoc); in ActOnOpenMPPrivateClause()
17222 if (!VD && !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPPrivateClause()
17224 VarDecl *VD = FD ? DSAStack->getImplicitFDCapExprDecl(FD) : nullptr; in ActOnOpenMPPrivateClause()
17226 Ref = buildDeclRefExpr(SemaRef, VD, VD->getType().getNonReferenceType(), in ActOnOpenMPPrivateClause()
17227 RefExpr->getExprLoc()); in ActOnOpenMPPrivateClause()
17232 DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_private, Ref); in ActOnOpenMPPrivateClause()
17233 Vars.push_back((VD || SemaRef.CurContext->isDependentContext()) in ActOnOpenMPPrivateClause()
17234 ? RefExpr->IgnoreParens() in ActOnOpenMPPrivateClause()
17256 SourceLocation ImplicitClauseLoc = DSAStack->getConstructLoc(); in ActOnOpenMPFirstprivateClause()
17275 QualType Type = D->getType(); in ActOnOpenMPFirstprivateClause()
17297 DSAStack->getTopDSA(D, /*FromParent=*/false); in ActOnOpenMPFirstprivateClause()
17299 OpenMPDirectiveKind CurrDir = DSAStack->getCurrentDirective(); in ActOnOpenMPFirstprivateClause()
17301 // OpenMP [2.4.13, Data-sharing Attribute Clauses] in ActOnOpenMPFirstprivateClause()
17319 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in ActOnOpenMPFirstprivateClause()
17321 // Variables with the predetermined data-sharing attributes may not be in ActOnOpenMPFirstprivateClause()
17322 // listed in data-sharing attributes clauses, except for the cases in ActOnOpenMPFirstprivateClause()
17324 // variable in a data-sharing attribute clause is allowed and overrides in ActOnOpenMPFirstprivateClause()
17325 // the variable's predetermined data-sharing attributes. in ActOnOpenMPFirstprivateClause()
17326 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in ActOnOpenMPFirstprivateClause()
17328 // Variables with const-qualified type having no mutable member may be in ActOnOpenMPFirstprivateClause()
17330 if (!(IsConstant || (VD && VD->isStaticDataMember())) && !DVar.RefExpr && in ActOnOpenMPFirstprivateClause()
17358 DVar = DSAStack->getImplicitDSA(D, true); in ActOnOpenMPFirstprivateClause()
17382 DVar = DSAStack->hasInnermostDSA( in ActOnOpenMPFirstprivateClause()
17405 // A list item cannot appear in both a map clause and a data-sharing in ActOnOpenMPFirstprivateClause()
17409 // A list item cannot appear in both a map clause and a data-sharing in ActOnOpenMPFirstprivateClause()
17416 if (DSAStack->checkMappableExprComponentListsForDecl( in ActOnOpenMPFirstprivateClause()
17427 << getOpenMPDirectiveName(DSAStack->getCurrentDirective()); in ActOnOpenMPFirstprivateClause()
17435 if (!Type->isAnyPointerType() && Type->isVariablyModifiedType() && in ActOnOpenMPFirstprivateClause()
17436 isOpenMPTaskingDirective(DSAStack->getCurrentDirective())) { in ActOnOpenMPFirstprivateClause()
17439 << getOpenMPDirectiveName(DSAStack->getCurrentDirective()); in ActOnOpenMPFirstprivateClause()
17440 bool IsDecl = !VD || VD->isThisDeclarationADefinition(getASTContext()) == in ActOnOpenMPFirstprivateClause()
17442 Diag(D->getLocation(), in ActOnOpenMPFirstprivateClause()
17450 buildVarDecl(SemaRef, ELoc, Type, D->getName(), in ActOnOpenMPFirstprivateClause()
17451 D->hasAttrs() ? &D->getAttrs() : nullptr, in ActOnOpenMPFirstprivateClause()
17461 if (Type->isArrayType()) { in ActOnOpenMPFirstprivateClause()
17463 buildVarDecl(SemaRef, RefExpr->getExprLoc(), ElemType, D->getName()); in ActOnOpenMPFirstprivateClause()
17467 VarDecl *VDInitTemp = buildVarDecl(SemaRef, RefExpr->getExprLoc(), in ActOnOpenMPFirstprivateClause()
17476 VDPrivate->setInvalidDecl(); in ActOnOpenMPFirstprivateClause()
17478 VDPrivate->setInit(Result.getAs<Expr>()); in ActOnOpenMPFirstprivateClause()
17482 VarDecl *VDInit = buildVarDecl(SemaRef, RefExpr->getExprLoc(), Type, in ActOnOpenMPFirstprivateClause()
17484 VDInitRefExpr = buildDeclRefExpr(SemaRef, VDInit, RefExpr->getType(), in ActOnOpenMPFirstprivateClause()
17485 RefExpr->getExprLoc()); in ActOnOpenMPFirstprivateClause()
17490 if (VDPrivate->isInvalidDecl()) { in ActOnOpenMPFirstprivateClause()
17492 Diag(RefExpr->getExprLoc(), in ActOnOpenMPFirstprivateClause()
17497 SemaRef.CurContext->addDecl(VDPrivate); in ActOnOpenMPFirstprivateClause()
17499 SemaRef, VDPrivate, RefExpr->getType().getUnqualifiedType(), in ActOnOpenMPFirstprivateClause()
17500 RefExpr->getExprLoc()); in ActOnOpenMPFirstprivateClause()
17502 if (!VD && !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPFirstprivateClause()
17507 VarDecl *VD = FD ? DSAStack->getImplicitFDCapExprDecl(FD) : nullptr; in ActOnOpenMPFirstprivateClause()
17510 buildDeclRefExpr(SemaRef, VD, VD->getType().getNonReferenceType(), in ActOnOpenMPFirstprivateClause()
17511 RefExpr->getExprLoc()); in ActOnOpenMPFirstprivateClause()
17515 ExprCaptures.push_back(Ref->getDecl()); in ActOnOpenMPFirstprivateClause()
17519 DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_firstprivate, Ref); in ActOnOpenMPFirstprivateClause()
17520 Vars.push_back((VD || SemaRef.CurContext->isDependentContext()) in ActOnOpenMPFirstprivateClause()
17521 ? RefExpr->IgnoreParens() in ActOnOpenMPFirstprivateClause()
17571 QualType Type = D->getType(); in ActOnOpenMPLastprivateClause()
17583 // A variable that is privatized must not have a const-qualified type in ActOnOpenMPLastprivateClause()
17589 // const-qualified type unless it is of class type with a mutable member. in ActOnOpenMPLastprivateClause()
17596 if (LPKind == OMPC_LASTPRIVATE_conditional && !Type->isScalarType()) { in ActOnOpenMPLastprivateClause()
17598 bool IsDecl = !VD || VD->isThisDeclarationADefinition(getASTContext()) == in ActOnOpenMPLastprivateClause()
17600 Diag(D->getLocation(), in ActOnOpenMPLastprivateClause()
17606 OpenMPDirectiveKind CurrDir = DSAStack->getCurrentDirective(); in ActOnOpenMPLastprivateClause()
17607 // OpenMP [2.14.1.1, Data-sharing Attribute Rules for Variables Referenced in ActOnOpenMPLastprivateClause()
17609 // Variables with the predetermined data-sharing attributes may not be in ActOnOpenMPLastprivateClause()
17610 // listed in data-sharing attributes clauses, except for the cases in ActOnOpenMPLastprivateClause()
17615 DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(D, /*FromParent=*/false); in ActOnOpenMPLastprivateClause()
17637 DVar = DSAStack->getImplicitDSA(D, true); in ActOnOpenMPLastprivateClause()
17658 D->hasAttrs() ? &D->getAttrs() : nullptr); in ActOnOpenMPLastprivateClause()
17663 D->hasAttrs() ? &D->getAttrs() : nullptr); in ActOnOpenMPLastprivateClause()
17677 if (!VD && !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPLastprivateClause()
17683 ExprCaptures.push_back(Ref->getDecl()); in ActOnOpenMPLastprivateClause()
17687 Ref->getDecl()->hasAttr<OMPCaptureNoInitAttr>())) { in ActOnOpenMPLastprivateClause()
17692 SemaRef.BuildBinOp(DSAStack->getCurScope(), ELoc, BO_Assign, in ActOnOpenMPLastprivateClause()
17700 DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_lastprivate, Ref); in ActOnOpenMPLastprivateClause()
17701 Vars.push_back((VD || SemaRef.CurContext->isDependentContext()) in ActOnOpenMPLastprivateClause()
17702 ? RefExpr->IgnoreParens() in ActOnOpenMPLastprivateClause()
17739 // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced in ActOnOpenMPSharedClause()
17741 // Variables with the predetermined data-sharing attributes may not be in ActOnOpenMPSharedClause()
17742 // listed in data-sharing attributes clauses, except for the cases in ActOnOpenMPSharedClause()
17744 // variable in a data-sharing attribute clause is allowed and overrides in ActOnOpenMPSharedClause()
17745 // the variable's predetermined data-sharing attributes. in ActOnOpenMPSharedClause()
17746 DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(D, /*FromParent=*/false); in ActOnOpenMPSharedClause()
17757 !SemaRef.CurContext->isDependentContext()) in ActOnOpenMPSharedClause()
17759 DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_shared, Ref); in ActOnOpenMPSharedClause()
17760 Vars.push_back((VD || !Ref || SemaRef.CurContext->isDependentContext()) in ActOnOpenMPSharedClause()
17761 ? RefExpr->IgnoreParens() in ActOnOpenMPSharedClause()
17778 if (auto *VD = dyn_cast<VarDecl>(E->getDecl())) { in VisitDeclRefExpr()
17779 DSAStackTy::DSAVarData DVar = Stack->getTopDSA(VD, /*FromParent=*/false); in VisitDeclRefExpr()
17784 DSAStackTy::DSAVarData DVarPrivate = Stack->hasDSA( in VisitDeclRefExpr()
17796 for (Stmt *Child : S->children()) { in VisitStmt()
17819 if (isa<CXXThisExpr>(E->getBase()->IgnoreParenImpCasts()) && in TransformMemberExpr()
17820 E->getMemberDecl() == Field) { in TransformMemberExpr()
17845 for (auto *RD : D->redecls()) { in findAcceptableDecl()
17886 // -- Any using-directives in the associated namespace are in argumentDependentLookup()
17889 // -- Any namespace-scope friend functions declared in in argumentDependentLookup()
17893 DeclContext::lookup_result R = NS->lookup(Id.getName()); in argumentDependentLookup()
17897 Underlying = USD->getTargetDecl(); in argumentDependentLookup()
17908 Underlying = USD->getTargetDecl(); in argumentDependentLookup()
17931 S = S->getParent(); in buildDeclareReductionRef()
17932 } while (S && !S->isDeclScope(D)); in buildDeclareReductionRef()
17934 S = S->getParent(); in buildDeclareReductionRef()
17943 for (NamedDecl *D : ULE->decls()) { in buildDeclareReductionRef()
17951 if (SemaRef.CurContext->isDependentContext() || Ty->isDependentType() || in buildDeclareReductionRef()
17952 Ty->isInstantiationDependentType() || in buildDeclareReductionRef()
17953 Ty->containsUnexpandedParameterPack() || in buildDeclareReductionRef()
17955 return !D->isInvalidDecl() && in buildDeclareReductionRef()
17956 (D->getType()->isDependentType() || in buildDeclareReductionRef()
17957 D->getType()->isInstantiationDependentType() || in buildDeclareReductionRef()
17958 D->getType()->containsUnexpandedParameterPack()); in buildDeclareReductionRef()
17966 ResSet.addDecl(Set[Set.size() - 1]); in buildDeclareReductionRef()
17977 // cv-unqualified version is T1, and for a binary operator @ with in buildDeclareReductionRef()
17978 // a left operand of a type whose cv-unqualified version is T1 and in buildDeclareReductionRef()
17979 // a right operand of a type whose cv-unqualified version is T2, in buildDeclareReductionRef()
17981 // candidates, non-member candidates and built-in candidates, are in buildDeclareReductionRef()
17983 // -- If T1 is a complete class type or a class currently being in buildDeclareReductionRef()
17989 if (const auto *TyRec = Ty->getAs<RecordType>()) { in buildDeclareReductionRef()
17992 if (SemaRef.isCompleteType(Loc, Ty) || TyRec->isBeingDefined() || in buildDeclareReductionRef()
17993 TyRec->getDecl()->getDefinition()) { in buildDeclareReductionRef()
17995 SemaRef.LookupQualifiedName(Lookup, TyRec->getDecl()); in buildDeclareReductionRef()
18006 Lookups, [&SemaRef, Ty](ValueDecl *D) -> ValueDecl * { in buildDeclareReductionRef()
18007 if (!D->isInvalidDecl() && in buildDeclareReductionRef()
18008 SemaRef.Context.hasSameType(D->getType(), Ty)) in buildDeclareReductionRef()
18012 return SemaRef.BuildDeclRefExpr(VD, VD->getType().getNonReferenceType(), in buildDeclareReductionRef()
18016 Lookups, [&SemaRef, Ty, Loc](ValueDecl *D) -> ValueDecl * { in buildDeclareReductionRef()
18017 if (!D->isInvalidDecl() && in buildDeclareReductionRef()
18018 SemaRef.IsDerivedFrom(Loc, Ty, D->getType()) && in buildDeclareReductionRef()
18019 !Ty.isMoreQualifiedThan(D->getType())) in buildDeclareReductionRef()
18025 if (SemaRef.IsDerivedFrom(Loc, Ty, VD->getType(), Paths)) { in buildDeclareReductionRef()
18027 VD->getType().getUnqualifiedType()))) { in buildDeclareReductionRef()
18029 Loc, VD->getType(), Ty, Paths.front(), in buildDeclareReductionRef()
18033 VD, VD->getType().getNonReferenceType(), VK_LValue, Loc); in buildDeclareReductionRef()
18048 /// Data for the reduction-based clauses.
18133 const Expr *Length = OASE->getLength(); in checkOMPArraySectionConstantForReduction()
18137 if (OASE->getColonLocFirst().isValid()) in checkOMPArraySectionConstantForReduction()
18145 if (!Length->EvaluateAsInt(Result, Context)) in checkOMPArraySectionConstantForReduction()
18154 const Expr *Base = OASE->getBase()->IgnoreParenImpCasts(); in checkOMPArraySectionConstantForReduction()
18156 // We require length = 1 for all array sections except the right-most to in checkOMPArraySectionConstantForReduction()
18157 // guarantee that the memory region is contiguous and has no holes in it. in checkOMPArraySectionConstantForReduction()
18159 Length = TempOASE->getLength(); in checkOMPArraySectionConstantForReduction()
18163 if (OASE->getColonLocFirst().isValid()) in checkOMPArraySectionConstantForReduction()
18170 if (!Length->EvaluateAsInt(Result, Context)) in checkOMPArraySectionConstantForReduction()
18179 Base = TempOASE->getBase()->IgnoreParenImpCasts(); in checkOMPArraySectionConstantForReduction()
18187 Base = TempASE->getBase()->IgnoreParenImpCasts(); in checkOMPArraySectionConstantForReduction()
18224 // reduction-identifier is either an identifier or one of the following in actOnOMPReductionKindClause()
18225 // operators: +, -, *, &, |, ^, && and || in actOnOMPReductionKindClause()
18227 // reduction-identifier is either an id-expression or one of the following in actOnOMPReductionKindClause()
18228 // operators: +, -, *, &, |, ^, && and || in actOnOMPReductionKindClause()
18234 // Minus(-) operator is not supported in TR11 (OpenMP 6.0). Setting BOK to in actOnOMPReductionKindClause()
18301 if (II->isStr("max")) in actOnOMPReductionKindClause()
18303 else if (II->isStr("min")) in actOnOMPReductionKindClause()
18310 // A reduction clause with the minus (-) operator was deprecated in actOnOMPReductionKindClause()
18346 S, ELoc, ERange, Stack->getCurScope(), ReductionIdScopeSpec, in actOnOMPReductionKindClause()
18349 if (S.CurContext->isDependentContext() && in actOnOMPReductionKindClause()
18362 auto *ASE = dyn_cast<ArraySubscriptExpr>(RefExpr->IgnoreParens()); in actOnOMPReductionKindClause()
18363 auto *OASE = dyn_cast<ArraySectionExpr>(RefExpr->IgnoreParens()); in actOnOMPReductionKindClause()
18365 Type = ASE->getType().getNonReferenceType(); in actOnOMPReductionKindClause()
18368 ArraySectionExpr::getBaseOriginalType(OASE->getBase()); in actOnOMPReductionKindClause()
18369 if (const auto *ATy = BaseType->getAsArrayTypeUnsafe()) in actOnOMPReductionKindClause()
18370 Type = ATy->getElementType(); in actOnOMPReductionKindClause()
18372 Type = BaseType->getPointeeType(); in actOnOMPReductionKindClause()
18375 Type = Context.getBaseElementType(D->getType().getNonReferenceType()); in actOnOMPReductionKindClause()
18382 if (S.RequireCompleteType(ELoc, D->getType(), in actOnOMPReductionKindClause()
18387 // const-qualified. in actOnOMPReductionKindClause()
18392 OpenMPDirectiveKind CurrDir = Stack->getCurrentDirective(); in actOnOMPReductionKindClause()
18394 // If a list-item is a reference type then it must bind to the same object in actOnOMPReductionKindClause()
18398 VarDecl *VDDef = VD->getDefinition(); in actOnOMPReductionKindClause()
18399 if (VD->getType()->isReferenceType() && VDDef && VDDef->hasInit()) { in actOnOMPReductionKindClause()
18401 if (Check.Visit(VDDef->getInit())) { in actOnOMPReductionKindClause()
18404 S.Diag(VDDef->getLocation(), diag::note_defined_here) << VDDef; in actOnOMPReductionKindClause()
18410 // OpenMP [2.14.1.1, Data-sharing Attribute Rules for Variables Referenced in actOnOMPReductionKindClause()
18412 // Variables with the predetermined data-sharing attributes may not be in actOnOMPReductionKindClause()
18413 // listed in data-sharing attributes clauses, except for the cases in actOnOMPReductionKindClause()
18415 // variable in a data-sharing attribute clause is allowed and overrides in actOnOMPReductionKindClause()
18416 // the variable's predetermined data-sharing attributes. in actOnOMPReductionKindClause()
18421 DSAStackTy::DSAVarData DVar = Stack->getTopDSA(D, /*FromParent=*/false); in actOnOMPReductionKindClause()
18426 S.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_referenced); in actOnOMPReductionKindClause()
18444 DVar = Stack->getImplicitDSA(D, true); in actOnOMPReductionKindClause()
18456 DSAStackTy::DSAVarData DVar = Stack->getTopDSA(D, /*FromParent=*/false); in actOnOMPReductionKindClause()
18470 S, ELoc, ERange, Stack->getCurScope(), ReductionIdScopeSpec, in actOnOMPReductionKindClause()
18474 if (S.CurContext->isDependentContext() && in actOnOMPReductionKindClause()
18495 // for the reduction-identifier. For a max or min reduction in C, the type in actOnOMPReductionKindClause()
18503 !(Type->isScalarType() || in actOnOMPReductionKindClause()
18504 (S.getLangOpts().CPlusPlus && Type->isArithmeticType()))) { in actOnOMPReductionKindClause()
18508 bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) == in actOnOMPReductionKindClause()
18510 S.Diag(D->getLocation(), in actOnOMPReductionKindClause()
18517 !S.getLangOpts().CPlusPlus && Type->isFloatingType()) { in actOnOMPReductionKindClause()
18521 bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) == in actOnOMPReductionKindClause()
18523 S.Diag(D->getLocation(), in actOnOMPReductionKindClause()
18533 D->hasAttrs() ? &D->getAttrs() : nullptr); in actOnOMPReductionKindClause()
18534 VarDecl *RHSVD = buildVarDecl(S, ELoc, Type, D->getName(), in actOnOMPReductionKindClause()
18535 D->hasAttrs() ? &D->getAttrs() : nullptr); in actOnOMPReductionKindClause()
18558 D->getType().getNonReferenceType()->isVariablyModifiedType())) { in actOnOMPReductionKindClause()
18560 if (isOpenMPTargetExecutionDirective(Stack->getCurrentDirective())) { in actOnOMPReductionKindClause()
18580 Context.getAsArrayType(D->getType().getNonReferenceType())) { in actOnOMPReductionKindClause()
18581 PrivateTy = D->getType().getNonReferenceType(); in actOnOMPReductionKindClause()
18585 buildVarDecl(S, ELoc, PrivateTy, D->getName(), in actOnOMPReductionKindClause()
18586 D->hasAttrs() ? &D->getAttrs() : nullptr, in actOnOMPReductionKindClause()
18594 auto *DRD = cast<OMPDeclareReductionDecl>(DRDRef->getDecl()); in actOnOMPReductionKindClause()
18595 if (DRD->getInitializer()) { in actOnOMPReductionKindClause()
18597 RHSVD->setInit(DRDRef); in actOnOMPReductionKindClause()
18598 RHSVD->setInitStyle(VarDecl::CallInit); in actOnOMPReductionKindClause()
18606 // '+', '-', '^', '|', '||' reduction ops - initializer is '0'. in actOnOMPReductionKindClause()
18607 if (Type->isScalarType() || Type->isAnyComplexType()) in actOnOMPReductionKindClause()
18612 if (Type->isScalarType() || Type->isAnyComplexType()) { in actOnOMPReductionKindClause()
18613 // '*' and '&&' reduction ops - initializer is '1'. in actOnOMPReductionKindClause()
18618 // '&' reduction op - initializer is '~0'. in actOnOMPReductionKindClause()
18620 if (auto *ComplexTy = OrigType->getAs<ComplexType>()) in actOnOMPReductionKindClause()
18621 Type = ComplexTy->getElementType(); in actOnOMPReductionKindClause()
18622 if (Type->isRealFloatingType()) { in actOnOMPReductionKindClause()
18627 } else if (Type->isScalarType()) { in actOnOMPReductionKindClause()
18633 if (Init && OrigType->isAnyComplexType()) { in actOnOMPReductionKindClause()
18643 // 'min' reduction op - initializer is 'Largest representable number in in actOnOMPReductionKindClause()
18645 // 'max' reduction op - initializer is 'Least representable number in in actOnOMPReductionKindClause()
18647 if (Type->isIntegerType() || Type->isPointerType()) { in actOnOMPReductionKindClause()
18648 bool IsSigned = Type->hasSignedIntegerRepresentation(); in actOnOMPReductionKindClause()
18658 if (Type->isPointerType()) { in actOnOMPReductionKindClause()
18666 } else if (Type->isRealFloatingType()) { in actOnOMPReductionKindClause()
18705 PrivateVD->setInit(RHSVD->getInit()); in actOnOMPReductionKindClause()
18706 PrivateVD->setInitStyle(RHSVD->getInitStyle()); in actOnOMPReductionKindClause()
18711 PrivateVD->setInit(RHSVD->getInit()); in actOnOMPReductionKindClause()
18712 PrivateVD->setInitStyle(RHSVD->getInitStyle()); in actOnOMPReductionKindClause()
18714 if (RHSVD->isInvalidDecl()) in actOnOMPReductionKindClause()
18716 if (!RHSVD->hasInit() && DeclareReductionRef.isUnset()) { in actOnOMPReductionKindClause()
18719 bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) == in actOnOMPReductionKindClause()
18721 S.Diag(D->getLocation(), in actOnOMPReductionKindClause()
18729 QualType RedTy = DeclareReductionRef.get()->getType(); in actOnOMPReductionKindClause()
18738 LHS.get()->getValueKind(), FPOptionsOverride()); in actOnOMPReductionKindClause()
18741 RHS.get()->getValueKind(), FPOptionsOverride()); in actOnOMPReductionKindClause()
18755 if (Type->isRecordType() && CombBOK != BOK) { in actOnOMPReductionKindClause()
18758 S.BuildBinOp(Stack->getCurScope(), ReductionId.getBeginLoc(), in actOnOMPReductionKindClause()
18763 S.BuildBinOp(Stack->getCurScope(), ReductionId.getBeginLoc(), BOK, in actOnOMPReductionKindClause()
18768 S.BuildBinOp(Stack->getCurScope(), ReductionId.getBeginLoc(), in actOnOMPReductionKindClause()
18775 S.BuildBinOp(Stack->getCurScope(), ReductionId.getBeginLoc(), in actOnOMPReductionKindClause()
18793 CopyOpRes = S.BuildBinOp(Stack->getCurScope(), ELoc, BO_Assign, LHSDRE, in actOnOMPReductionKindClause()
18801 // For simd directive and simd-based directives in simd mode no need to in actOnOMPReductionKindClause()
18803 if (Stack->getCurrentDirective() == OMPD_simd || in actOnOMPReductionKindClause()
18805 isOpenMPSimdDirective(Stack->getCurrentDirective()))) { in actOnOMPReductionKindClause()
18807 buildVarDecl(S, ELoc, PrivateTy, D->getName(), in actOnOMPReductionKindClause()
18808 D->hasAttrs() ? &D->getAttrs() : nullptr); in actOnOMPReductionKindClause()
18820 buildVarDecl(S, ELoc, ArrayTy, D->getName(), in actOnOMPReductionKindClause()
18821 D->hasAttrs() ? &D->getAttrs() : nullptr); in actOnOMPReductionKindClause()
18839 // condition must specify the same reduction-identifier as the in_reduction in actOnOMPReductionKindClause()
18847 Stack->getTopMostTaskgroupReductionData(D, ParentSR, ParentBOK, in actOnOMPReductionKindClause()
18850 Stack->getTopMostTaskgroupReductionData( in actOnOMPReductionKindClause()
18860 ParentReductionOp->Profile(ParentRedId, Context, /*Canonical=*/true); in actOnOMPReductionKindClause()
18861 DeclareReductionRef.get()->Profile(RedId, Context, in actOnOMPReductionKindClause()
18868 << ReductionIdRange << RefExpr->getSourceRange(); in actOnOMPReductionKindClause()
18874 ->getSourceRange(); in actOnOMPReductionKindClause()
18882 Expr *VarsExpr = RefExpr->IgnoreParens(); in actOnOMPReductionKindClause()
18883 if (!VD && !S.CurContext->isDependentContext()) { in actOnOMPReductionKindClause()
18887 RebuildToCapture.TransformExpr(RefExpr->IgnoreParens()).get(); in actOnOMPReductionKindClause()
18893 RD.ExprCaptures.emplace_back(Ref->getDecl()); in actOnOMPReductionKindClause()
18894 if (Ref->getDecl()->hasAttr<OMPCaptureNoInitAttr>()) { in actOnOMPReductionKindClause()
18899 S.BuildBinOp(Stack->getCurScope(), ELoc, BO_Assign, SimpleRefExpr, in actOnOMPReductionKindClause()
18903 if (isOpenMPTaskingDirective(Stack->getCurrentDirective()) || in actOnOMPReductionKindClause()
18904 Stack->getCurrentDirective() == OMPD_taskgroup) { in actOnOMPReductionKindClause()
18905 S.Diag(RefExpr->getExprLoc(), in actOnOMPReductionKindClause()
18907 << RefExpr->getSourceRange(); in actOnOMPReductionKindClause()
18922 Stack->addDSA(D, RefExpr->IgnoreParens(), OMPC_reduction, Ref, Modifier, in actOnOMPReductionKindClause()
18930 Stack->addTaskgroupReductionData(D, ReductionIdRange, in actOnOMPReductionKindClause()
18933 Stack->addTaskgroupReductionData(D, ReductionIdRange, BOK); in actOnOMPReductionKindClause()
18956 // A reduction clause with the inscan reduction-modifier may only appear on a in ActOnOpenMPReductionClause()
18957 // worksharing-loop construct, a worksharing-loop SIMD construct, a simd in ActOnOpenMPReductionClause()
18958 // construct, a parallel worksharing-loop construct or a parallel in ActOnOpenMPReductionClause()
18959 // worksharing-loop SIMD construct. in ActOnOpenMPReductionClause()
18961 (DSAStack->getCurrentDirective() != OMPD_for && in ActOnOpenMPReductionClause()
18962 DSAStack->getCurrentDirective() != OMPD_for_simd && in ActOnOpenMPReductionClause()
18963 DSAStack->getCurrentDirective() != OMPD_simd && in ActOnOpenMPReductionClause()
18964 DSAStack->getCurrentDirective() != OMPD_parallel_for && in ActOnOpenMPReductionClause()
18965 DSAStack->getCurrentDirective() != OMPD_parallel_for_simd)) { in ActOnOpenMPReductionClause()
19047 !Type->isReferenceType()) { in CheckOpenMPLinearDecl()
19055 // A variable that is privatized must not have a const-qualified type in CheckOpenMPLinearDecl()
19066 if (!Ty || (LinKind != OMPC_LINEAR_ref && !Ty->isDependentType() && in CheckOpenMPLinearDecl()
19067 !Ty->isIntegralType(getASTContext()) && !Ty->isPointerType())) { in CheckOpenMPLinearDecl()
19070 bool IsDecl = !VD || VD->isThisDeclarationADefinition(getASTContext()) == in CheckOpenMPLinearDecl()
19072 Diag(D->getLocation(), in CheckOpenMPLinearDecl()
19092 // step-simple-modifier is exclusive, can't be used with 'val', 'uval', or in ActOnOpenMPLinearClause()
19096 Diag(Step->getBeginLoc(), diag::err_omp_step_simple_modifier_exclusive); in ActOnOpenMPLinearClause()
19115 QualType Type = D->getType(); in ActOnOpenMPLinearClause()
19119 // A list-item cannot appear in more than one linear clause. in ActOnOpenMPLinearClause()
19120 // A list-item that appears in a linear clause cannot appear in any in ActOnOpenMPLinearClause()
19121 // other data-sharing attribute clause. in ActOnOpenMPLinearClause()
19122 DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(D, /*FromParent=*/false); in ActOnOpenMPLinearClause()
19136 buildVarDecl(SemaRef, ELoc, Type, D->getName(), in ActOnOpenMPLinearClause()
19137 D->hasAttrs() ? &D->getAttrs() : nullptr, in ActOnOpenMPLinearClause()
19144 if (!VD && !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPLinearClause()
19147 ExprCaptures.push_back(Ref->getDecl()); in ActOnOpenMPLinearClause()
19148 if (Ref->getDecl()->hasAttr<OMPCaptureNoInitAttr>()) { in ActOnOpenMPLinearClause()
19153 SemaRef.BuildBinOp(DSAStack->getCurScope(), ELoc, BO_Assign, in ActOnOpenMPLinearClause()
19163 InitExpr = VD ? VD->getInit() : SimpleRefExpr; in ActOnOpenMPLinearClause()
19171 DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_linear, Ref); in ActOnOpenMPLinearClause()
19172 Vars.push_back((VD || SemaRef.CurContext->isDependentContext()) in ActOnOpenMPLinearClause()
19173 ? RefExpr->IgnoreParens() in ActOnOpenMPLinearClause()
19184 if (Step && !Step->isValueDependent() && !Step->isTypeDependent() && in ActOnOpenMPLinearClause()
19185 !Step->isInstantiationDependent() && in ActOnOpenMPLinearClause()
19186 !Step->containsUnexpandedParameterPack()) { in ActOnOpenMPLinearClause()
19187 SourceLocation StepLoc = Step->getBeginLoc(); in ActOnOpenMPLinearClause()
19195 buildVarDecl(SemaRef, StepLoc, StepExpr->getType(), ".linear.step"); in ActOnOpenMPLinearClause()
19197 buildDeclRefExpr(SemaRef, SaveVar, StepExpr->getType(), StepLoc); in ActOnOpenMPLinearClause()
19206 StepExpr->getIntegerConstantExpr(getASTContext())) { in ActOnOpenMPLinearClause()
19207 if (!Result->isNegative() && !Result->isStrictlyPositive()) in ActOnOpenMPLinearClause()
19212 // (This is not used if the number of iterations may be kfold-ed). in ActOnOpenMPLinearClause()
19234 // If linear-step is not specified it is assumed to be 1. in FinishOpenMPLinearClause()
19238 Step = cast<BinaryOperator>(CalcStep)->getLHS(); in FinishOpenMPLinearClause()
19255 auto &&Info = Stack->isLoopControlVariable(D); in FinishOpenMPLinearClause()
19259 if (isOpenMPDistributeDirective(Stack->getCurrentDirective()) && in FinishOpenMPLinearClause()
19260 isOpenMPSimdDirective(Stack->getCurrentDirective()) && !Info.first) { in FinishOpenMPLinearClause()
19274 CapturedRef = cast<VarDecl>(DE->getDecl())->getInit(); in FinishOpenMPLinearClause()
19277 buildDeclRefExpr(SemaRef, cast<VarDecl>(DE->getDecl()), in FinishOpenMPLinearClause()
19278 DE->getType().getUnqualifiedType(), DE->getExprLoc(), in FinishOpenMPLinearClause()
19285 SemaRef, S, RefExpr->getExprLoc(), *CurPrivate, InitExpr, IV, Step, in FinishOpenMPLinearClause()
19289 Update = SemaRef.ActOnFinishFullExpr(Update.get(), DE->getBeginLoc(), in FinishOpenMPLinearClause()
19296 S, RefExpr->getExprLoc(), BO_Assign, CapturedRef, in FinishOpenMPLinearClause()
19300 Final = SemaRef.ActOnFinishFullExpr(Final.get(), DE->getBeginLoc(), in FinishOpenMPLinearClause()
19320 UsedExprs.append(Clause.varlist_size() + 1 - UsedExprs.size(), nullptr); in FinishOpenMPLinearClause()
19345 QualType QType = D->getType(); in ActOnOpenMPAlignedClause()
19353 if (!Ty || (!Ty->isArrayType() && !Ty->isPointerType())) { in ActOnOpenMPAlignedClause()
19356 bool IsDecl = !VD || VD->isThisDeclarationADefinition(getASTContext()) == in ActOnOpenMPAlignedClause()
19358 Diag(D->getLocation(), in ActOnOpenMPAlignedClause()
19365 // A list-item cannot appear in more than one aligned clause. in ActOnOpenMPAlignedClause()
19366 if (const Expr *PrevRef = DSAStack->addUniqueAligned(D, SimpleRefExpr)) { in ActOnOpenMPAlignedClause()
19369 Diag(PrevRef->getExprLoc(), diag::note_omp_explicit_dsa) in ActOnOpenMPAlignedClause()
19379 (VD || !Ref) ? RefExpr->IgnoreParens() : Ref) in ActOnOpenMPAlignedClause()
19386 // If no optional parameter is specified, implementation-defined default in ActOnOpenMPAlignedClause()
19421 SourceLocation ELoc = RefExpr->getExprLoc(); in ActOnOpenMPCopyinClause()
19427 if (!DE || !isa<VarDecl>(DE->getDecl())) { in ActOnOpenMPCopyinClause()
19429 << 0 << RefExpr->getSourceRange(); in ActOnOpenMPCopyinClause()
19433 Decl *D = DE->getDecl(); in ActOnOpenMPCopyinClause()
19436 QualType Type = VD->getType(); in ActOnOpenMPCopyinClause()
19437 if (Type->isDependentType() || Type->isInstantiationDependentType()) { in ActOnOpenMPCopyinClause()
19448 if (!DSAStack->isThreadPrivate(VD)) { in ActOnOpenMPCopyinClause()
19462 buildVarDecl(SemaRef, DE->getBeginLoc(), ElemType.getUnqualifiedType(), in ActOnOpenMPCopyinClause()
19463 ".copyin.src", VD->hasAttrs() ? &VD->getAttrs() : nullptr); in ActOnOpenMPCopyinClause()
19465 SemaRef, SrcVD, ElemType.getUnqualifiedType(), DE->getExprLoc()); in ActOnOpenMPCopyinClause()
19467 buildVarDecl(SemaRef, DE->getBeginLoc(), ElemType, ".copyin.dst", in ActOnOpenMPCopyinClause()
19468 VD->hasAttrs() ? &VD->getAttrs() : nullptr); in ActOnOpenMPCopyinClause()
19470 buildDeclRefExpr(SemaRef, DstVD, ElemType, DE->getExprLoc()); in ActOnOpenMPCopyinClause()
19474 SemaRef.BuildBinOp(/*S=*/nullptr, DE->getExprLoc(), BO_Assign, in ActOnOpenMPCopyinClause()
19479 SemaRef.ActOnFinishFullExpr(AssignmentOp.get(), DE->getExprLoc(), in ActOnOpenMPCopyinClause()
19484 DSAStack->addDSA(VD, DE, OMPC_copyin); in ActOnOpenMPCopyinClause()
19523 QualType Type = D->getType(); in ActOnOpenMPCopyprivateClause()
19529 if (!VD || !DSAStack->isThreadPrivate(VD)) { in ActOnOpenMPCopyprivateClause()
19531 DSAStack->getTopDSA(D, /*FromParent=*/false); in ActOnOpenMPCopyprivateClause()
19545 DVar = DSAStack->getImplicitDSA(D, false); in ActOnOpenMPCopyprivateClause()
19557 if (!Type->isAnyPointerType() && Type->isVariablyModifiedType()) { in ActOnOpenMPCopyprivateClause()
19560 << getOpenMPDirectiveName(DSAStack->getCurrentDirective()); in ActOnOpenMPCopyprivateClause()
19561 bool IsDecl = !VD || VD->isThisDeclarationADefinition(getASTContext()) == in ActOnOpenMPCopyprivateClause()
19563 Diag(D->getLocation(), in ActOnOpenMPCopyprivateClause()
19577 buildVarDecl(SemaRef, RefExpr->getBeginLoc(), Type, ".copyprivate.src", in ActOnOpenMPCopyprivateClause()
19578 D->hasAttrs() ? &D->getAttrs() : nullptr); in ActOnOpenMPCopyprivateClause()
19581 buildVarDecl(SemaRef, RefExpr->getBeginLoc(), Type, ".copyprivate.dst", in ActOnOpenMPCopyprivateClause()
19582 D->hasAttrs() ? &D->getAttrs() : nullptr); in ActOnOpenMPCopyprivateClause()
19585 DSAStack->getCurScope(), ELoc, BO_Assign, PseudoDstExpr, PseudoSrcExpr); in ActOnOpenMPCopyprivateClause()
19593 // No need to mark vars as copyprivate, they are already threadprivate or in ActOnOpenMPCopyprivateClause()
19597 VD ? RefExpr->IgnoreParens() in ActOnOpenMPCopyprivateClause()
19626 QualType OMPDependT = Stack->getOMPDependT(); in findOMPDependT()
19636 Stack->setOMPDependT(PT.get()); in findOMPDependT()
19651 if (!Depobj->isTypeDependent() && !Depobj->isValueDependent() && in ActOnOpenMPDepobjClause()
19652 !Depobj->isInstantiationDependent() && in ActOnOpenMPDepobjClause()
19653 !Depobj->containsUnexpandedParameterPack() && in ActOnOpenMPDepobjClause()
19655 DSAStack->getOMPDependT(), Depobj->getType(), in ActOnOpenMPDepobjClause()
19657 Diag(Depobj->getExprLoc(), diag::err_omp_expected_omp_depend_t_lvalue) in ActOnOpenMPDepobjClause()
19658 << 0 << Depobj->getType() << Depobj->getSourceRange(); in ActOnOpenMPDepobjClause()
19661 if (!Depobj->isLValue()) { in ActOnOpenMPDepobjClause()
19662 Diag(Depobj->getExprLoc(), diag::err_omp_expected_omp_depend_t_lvalue) in ActOnOpenMPDepobjClause()
19663 << 1 << Depobj->getSourceRange(); in ActOnOpenMPDepobjClause()
19692 Stack->getParentOrderedRegionParam().first) { in ProcessOpenMPDoacrossClauseCommon()
19693 TotalDepCount = OrderedCountExpr->EvaluateKnownConstInt(SemaRef.Context); in ProcessOpenMPDoacrossClauseCommon()
19705 SourceLocation ELoc = RefExpr->getExprLoc(); in ProcessOpenMPDoacrossClauseCommon()
19706 Expr *SimpleExpr = RefExpr->IgnoreParenCasts(); in ProcessOpenMPDoacrossClauseCommon()
19708 if (Stack->getParentOrderedRegionParam().first && in ProcessOpenMPDoacrossClauseCommon()
19715 // depend(dependence-type : vec), where dependence-type is: in ProcessOpenMPDoacrossClauseCommon()
19717 // x1 [+- d1], x2 [+- d2 ], . . . , xn [+- dn] in ProcessOpenMPDoacrossClauseCommon()
19719 // directive, xi denotes the loop iteration variable of the i-th nested in ProcessOpenMPDoacrossClauseCommon()
19721 // non-negative integer. in ProcessOpenMPDoacrossClauseCommon()
19722 if (SemaRef.CurContext->isDependentContext()) { in ProcessOpenMPDoacrossClauseCommon()
19727 SimpleExpr = SimpleExpr->IgnoreImplicit(); in ProcessOpenMPDoacrossClauseCommon()
19733 OOK = BinaryOperator::getOverloadedOperator(BO->getOpcode()); in ProcessOpenMPDoacrossClauseCommon()
19734 OOLoc = BO->getOperatorLoc(); in ProcessOpenMPDoacrossClauseCommon()
19735 LHS = BO->getLHS()->IgnoreParenImpCasts(); in ProcessOpenMPDoacrossClauseCommon()
19736 RHS = BO->getRHS()->IgnoreParenImpCasts(); in ProcessOpenMPDoacrossClauseCommon()
19738 OOK = OCE->getOperator(); in ProcessOpenMPDoacrossClauseCommon()
19739 OOLoc = OCE->getOperatorLoc(); in ProcessOpenMPDoacrossClauseCommon()
19740 LHS = OCE->getArg(/*Arg=*/0)->IgnoreParenImpCasts(); in ProcessOpenMPDoacrossClauseCommon()
19741 RHS = OCE->getArg(/*Arg=*/1)->IgnoreParenImpCasts(); in ProcessOpenMPDoacrossClauseCommon()
19743 OOK = MCE->getMethodDecl() in ProcessOpenMPDoacrossClauseCommon()
19744 ->getNameInfo() in ProcessOpenMPDoacrossClauseCommon()
19747 OOLoc = MCE->getCallee()->getExprLoc(); in ProcessOpenMPDoacrossClauseCommon()
19748 LHS = MCE->getImplicitObjectArgument()->IgnoreParenImpCasts(); in ProcessOpenMPDoacrossClauseCommon()
19749 RHS = MCE->getArg(/*Arg=*/0)->IgnoreParenImpCasts(); in ProcessOpenMPDoacrossClauseCommon()
19773 if (!SemaRef.CurContext->isDependentContext() && in ProcessOpenMPDoacrossClauseCommon()
19774 Stack->getParentOrderedRegionParam().first && in ProcessOpenMPDoacrossClauseCommon()
19775 DepCounter != Stack->isParentLoopControlVariable(D).first) { in ProcessOpenMPDoacrossClauseCommon()
19777 Stack->getParentLoopControlVariable(DepCounter.getZExtValue()); in ProcessOpenMPDoacrossClauseCommon()
19788 Vars.push_back(RefExpr->IgnoreParenImpCasts()); in ProcessOpenMPDoacrossClauseCommon()
19790 if (!SemaRef.CurContext->isDependentContext() && !IsSource && in ProcessOpenMPDoacrossClauseCommon()
19792 Stack->getParentOrderedRegionParam().first && in ProcessOpenMPDoacrossClauseCommon()
19793 Stack->getParentLoopControlVariable(VarList.size() + 1)) { in ProcessOpenMPDoacrossClauseCommon()
19795 << 1 << Stack->getParentLoopControlVariable(VarList.size() + 1); in ProcessOpenMPDoacrossClauseCommon()
19806 if (DSAStack->getCurrentDirective() == OMPD_ordered && in ActOnOpenMPDependClause()
19812 if (DSAStack->getCurrentDirective() == OMPD_taskwait && in ActOnOpenMPDependClause()
19817 if ((DSAStack->getCurrentDirective() != OMPD_ordered || in ActOnOpenMPDependClause()
19818 DSAStack->getCurrentDirective() == OMPD_depobj) && in ActOnOpenMPDependClause()
19822 DSAStack->getCurrentDirective() == OMPD_depobj) && in ActOnOpenMPDependClause()
19828 DSAStack->getCurrentDirective() == OMPD_depobj) in ActOnOpenMPDependClause()
19844 Diag(DepModifier->getExprLoc(), in ActOnOpenMPDependClause()
19849 !DepModifier->getType()->isSpecificBuiltinType(BuiltinType::OMPIterator)) in ActOnOpenMPDependClause()
19850 Diag(DepModifier->getExprLoc(), diag::err_omp_depend_modifier_not_iterator); in ActOnOpenMPDependClause()
19871 SourceLocation ELoc = RefExpr->getExprLoc(); in ActOnOpenMPDependClause()
19872 Expr *SimpleExpr = RefExpr->IgnoreParenCasts(); in ActOnOpenMPDependClause()
19882 if (!RefExpr->isValueDependent() && !RefExpr->isTypeDependent() && in ActOnOpenMPDependClause()
19883 !RefExpr->isInstantiationDependent() && in ActOnOpenMPDependClause()
19884 !RefExpr->containsUnexpandedParameterPack() && in ActOnOpenMPDependClause()
19887 DSAStack->getOMPDependT(), RefExpr->getType()))) { in ActOnOpenMPDependClause()
19889 << 0 << RefExpr->getType() << RefExpr->getSourceRange(); in ActOnOpenMPDependClause()
19892 if (!RefExpr->isLValue()) { in ActOnOpenMPDependClause()
19894 << 1 << RefExpr->getType() << RefExpr->getSourceRange(); in ActOnOpenMPDependClause()
19899 // List items used in depend clauses cannot be zero-length array in ActOnOpenMPDependClause()
19901 QualType ExprTy = RefExpr->getType().getNonReferenceType(); in ActOnOpenMPDependClause()
19905 ArraySectionExpr::getBaseOriginalType(OASE->getBase()); in ActOnOpenMPDependClause()
19908 if (const auto *ATy = BaseType->getAsArrayTypeUnsafe()) in ActOnOpenMPDependClause()
19909 ExprTy = ATy->getElementType(); in ActOnOpenMPDependClause()
19911 ExprTy = BaseType->getPointeeType(); in ActOnOpenMPDependClause()
19915 const Expr *Length = OASE->getLength(); in ActOnOpenMPDependClause()
19917 if (Length && !Length->isValueDependent() && in ActOnOpenMPDependClause()
19918 Length->EvaluateAsInt(Result, getASTContext()) && in ActOnOpenMPDependClause()
19922 << SimpleExpr->getSourceRange(); in ActOnOpenMPDependClause()
19931 if (!RefExpr->isValueDependent() && !RefExpr->isTypeDependent() && in ActOnOpenMPDependClause()
19932 !RefExpr->isInstantiationDependent() && in ActOnOpenMPDependClause()
19933 !RefExpr->containsUnexpandedParameterPack() && in ActOnOpenMPDependClause()
19934 (!RefExpr->IgnoreParenImpCasts()->isLValue() || in ActOnOpenMPDependClause()
19935 (OMPDependTFound && DSAStack->getOMPDependT().getTypePtr() == in ActOnOpenMPDependClause()
19940 << RefExpr->getSourceRange(); in ActOnOpenMPDependClause()
19945 if (ASE && !ASE->getBase()->isTypeDependent() && in ActOnOpenMPDependClause()
19946 !ASE->getBase() in ActOnOpenMPDependClause()
19947 ->getType() in ActOnOpenMPDependClause()
19949 ->isPointerType() && in ActOnOpenMPDependClause()
19950 !ASE->getBase()->getType().getNonReferenceType()->isArrayType()) { in ActOnOpenMPDependClause()
19954 << RefExpr->getSourceRange(); in ActOnOpenMPDependClause()
19962 RefExpr->IgnoreParenImpCasts()); in ActOnOpenMPDependClause()
19969 << RefExpr->getSourceRange(); in ActOnOpenMPDependClause()
19974 Vars.push_back(RefExpr->IgnoreParenImpCasts()); in ActOnOpenMPDependClause()
19988 DSAStack->isParentOrderedRegion()) in ActOnOpenMPDependClause()
19989 DSAStack->addDoacrossDependClause(C, OpsOffs); in ActOnOpenMPDependClause()
20013 // The device expression must evaluate to a non-negative integer value. in ActOnOpenMPDeviceClause()
20021 // In case of ancestor device-modifier, a requires directive with in ActOnOpenMPDeviceClause()
20024 if (!DSAStack->hasRequiresDeclWithClause<OMPReverseOffloadClause>()) { in ActOnOpenMPDeviceClause()
20032 OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); in ActOnOpenMPDeviceClause()
20036 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPDeviceClause()
20053 if (FullCheck && !SemaRef.CurContext->isDependentContext() && in checkTypeMappable()
20069 // format of an array subscript if no colon is used. in checkArrayExpressionDoesNotReferToWholeSize()
20071 (OASE && OASE->getColonLocFirst().isInvalid())) { in checkArrayExpressionDoesNotReferToWholeSize()
20073 return ATy->getSExtSize() != 1; in checkArrayExpressionDoesNotReferToWholeSize()
20079 const Expr *LowerBound = OASE->getLowerBound(); in checkArrayExpressionDoesNotReferToWholeSize()
20080 const Expr *Length = OASE->getLength(); in checkArrayExpressionDoesNotReferToWholeSize()
20086 if (!LowerBound->EvaluateAsInt(Result, SemaRef.getASTContext())) in checkArrayExpressionDoesNotReferToWholeSize()
20100 if (BaseQTy->isPointerType()) in checkArrayExpressionDoesNotReferToWholeSize()
20110 if (!Length->EvaluateAsInt(Result, SemaRef.getASTContext())) in checkArrayExpressionDoesNotReferToWholeSize()
20114 return CATy->getSExtSize() != ConstLength.getSExtValue(); in checkArrayExpressionDoesNotReferToWholeSize()
20126 // assumes the format of an array subscript if no colon is used. in checkArrayExpressionDoesNotReferToUnitySize()
20128 (OASE && OASE->getColonLocFirst().isInvalid())) in checkArrayExpressionDoesNotReferToUnitySize()
20132 const Expr *Length = OASE->getLength(); in checkArrayExpressionDoesNotReferToUnitySize()
20139 return ATy->getSExtSize() != 1; in checkArrayExpressionDoesNotReferToUnitySize()
20146 if (!Length->EvaluateAsInt(Result, SemaRef.getASTContext())) in checkArrayExpressionDoesNotReferToUnitySize()
20154 // - a reference to variable or field.
20155 // - a member expression.
20156 // - an array expression.
20163 // struct SS {
20170 // We want to retrieve the member expression 'this->S';
20176 // to variables or fields and array expressions, and that no array sections
20217 if (!isa<VarDecl>(DRE->getDecl())) { in VisitDeclRefExpr()
20224 Components.emplace_back(DRE, DRE->getDecl(), IsNonContiguous); in VisitDeclRefExpr()
20230 Expr *BaseE = ME->getBase()->IgnoreParenCasts(); in VisitMemberExpr()
20234 // We found a base expression: this->Val. in VisitMemberExpr()
20240 if (!isa<FieldDecl>(ME->getMemberDecl())) { in VisitMemberExpr()
20243 << ME->getSourceRange(); in VisitMemberExpr()
20251 auto *FD = cast<FieldDecl>(ME->getMemberDecl()); in VisitMemberExpr()
20254 // A bit-field cannot appear in a map clause. in VisitMemberExpr()
20256 if (FD->isBitField()) { in VisitMemberExpr()
20259 << ME->getSourceRange() << getOpenMPClauseName(CKind); in VisitMemberExpr()
20270 QualType CurType = BaseE->getType().getNonReferenceType(); in VisitMemberExpr()
20276 if (CurType->isUnionType()) { in VisitMemberExpr()
20279 << ME->getSourceRange(); in VisitMemberExpr()
20301 Expr *E = AE->getBase()->IgnoreParenImpCasts(); in VisitArraySubscriptExpr()
20303 if (!E->getType()->isAnyPointerType() && !E->getType()->isArrayType()) { in VisitArraySubscriptExpr()
20306 << 0 << AE->getSourceRange(); in VisitArraySubscriptExpr()
20314 // the dimension, we can only have unitary-size array expressions. in VisitArraySubscriptExpr()
20315 if (checkArrayExpressionDoesNotReferToWholeSize(SemaRef, AE, E->getType())) in VisitArraySubscriptExpr()
20318 if (const auto *TE = dyn_cast<CXXThisExpr>(E->IgnoreParenCasts())) { in VisitArraySubscriptExpr()
20320 if (!AE->getIdx()->isValueDependent() && in VisitArraySubscriptExpr()
20321 AE->getIdx()->EvaluateAsInt(Result, SemaRef.getASTContext()) && in VisitArraySubscriptExpr()
20323 SemaRef.Diag(AE->getIdx()->getExprLoc(), in VisitArraySubscriptExpr()
20325 SemaRef.Diag(AE->getIdx()->getExprLoc(), in VisitArraySubscriptExpr()
20332 // Record the component - we don't have any declaration associated. in VisitArraySubscriptExpr()
20343 Expr *E = OASE->getBase()->IgnoreParenImpCasts(); in VisitArraySectionExpr()
20350 if (CurType->isReferenceType()) in VisitArraySectionExpr()
20351 CurType = CurType->getPointeeType(); in VisitArraySectionExpr()
20353 bool IsPointer = CurType->isAnyPointerType(); in VisitArraySectionExpr()
20355 if (!IsPointer && !CurType->isArrayType()) { in VisitArraySectionExpr()
20357 << 0 << OASE->getSourceRange(); in VisitArraySectionExpr()
20389 << OASE->getSourceRange(); in VisitArraySectionExpr()
20399 if (!OASE->getLength()->isValueDependent() && in VisitArraySectionExpr()
20400 OASE->getLength()->EvaluateAsInt(ResultR, SemaRef.getASTContext()) && in VisitArraySectionExpr()
20402 SemaRef.Diag(OASE->getLength()->getExprLoc(), in VisitArraySectionExpr()
20404 SemaRef.Diag(OASE->getLength()->getExprLoc(), in VisitArraySectionExpr()
20407 if (OASE->getLowerBound() && !OASE->getLowerBound()->isValueDependent() && in VisitArraySectionExpr()
20408 OASE->getLowerBound()->EvaluateAsInt(ResultL, in VisitArraySectionExpr()
20411 SemaRef.Diag(OASE->getLowerBound()->getExprLoc(), in VisitArraySectionExpr()
20413 SemaRef.Diag(OASE->getLowerBound()->getExprLoc(), in VisitArraySectionExpr()
20420 // Record the component - we don't have any declaration associated. in VisitArraySectionExpr()
20425 Expr *Base = E->getBase(); in VisitOMPArrayShapingExpr()
20427 // Record the component - we don't have any declaration associated. in VisitOMPArrayShapingExpr()
20430 return Visit(Base->IgnoreParenImpCasts()); in VisitOMPArrayShapingExpr()
20434 if (SemaRef.getLangOpts().OpenMP < 50 || !UO->isLValue() || in VisitUnaryOperator()
20435 UO->getOpcode() != UO_Deref) { in VisitUnaryOperator()
20443 return RelevantExpr || Visit(UO->getSubExpr()->IgnoreParenImpCasts()); in VisitUnaryOperator()
20446 if (SemaRef.getLangOpts().OpenMP < 50 || !BO->getType()->isPointerType()) { in VisitBinaryOperator()
20455 Expr *LE = BO->getLHS()->IgnoreParenImpCasts(); in VisitBinaryOperator()
20456 Expr *RE = BO->getRHS()->IgnoreParenImpCasts(); in VisitBinaryOperator()
20458 assert((LE->getType().getTypePtr() == BO->getType().getTypePtr() || in VisitBinaryOperator()
20459 RE->getType().getTypePtr() == BO->getType().getTypePtr()) && in VisitBinaryOperator()
20461 if (BO->getType().getTypePtr() == LE->getType().getTypePtr()) in VisitBinaryOperator()
20477 Expr *Source = E->getSourceExpr(); in VisitOpaqueValueExpr()
20506 SourceLocation ELoc = E->getExprLoc(); in checkMapClauseExpressionBase()
20507 SourceRange ERange = E->getSourceRange(); in checkMapClauseExpressionBase()
20510 if (Checker.Visit(E->IgnoreParens())) { in checkMapClauseExpressionBase()
20518 dyn_cast<ArraySectionExpr>(CI->getAssociatedExpression()); in checkMapClauseExpressionBase()
20521 if (OASE && OASE->getLength()) in checkMapClauseExpressionBase()
20540 SourceLocation ELoc = E->getExprLoc(); in checkMapConflicts()
20541 SourceRange ERange = E->getSourceRange(); in checkMapConflicts()
20547 assert(!CurComponents.empty() && "Map clause expression with no components!"); in checkMapConflicts()
20555 bool FoundError = DSAS->checkMappableExprComponentListsForDecl( in checkMapConflicts()
20565 "Map clause expression with no components!"); in checkMapConflicts()
20587 (isa<ArraySubscriptExpr>(CI->getAssociatedExpression()) || in checkMapConflicts()
20588 isa<ArraySectionExpr>(CI->getAssociatedExpression()) || in checkMapConflicts()
20589 isa<OMPArrayShapingExpr>(CI->getAssociatedExpression())) && in checkMapConflicts()
20590 (isa<ArraySubscriptExpr>(SI->getAssociatedExpression()) || in checkMapConflicts()
20591 isa<ArraySectionExpr>(SI->getAssociatedExpression()) || in checkMapConflicts()
20592 isa<OMPArrayShapingExpr>(SI->getAssociatedExpression()))) { in checkMapConflicts()
20593 SemaRef.Diag(CI->getAssociatedExpression()->getExprLoc(), in checkMapConflicts()
20595 << CI->getAssociatedExpression()->getSourceRange(); in checkMapConflicts()
20596 SemaRef.Diag(SI->getAssociatedExpression()->getExprLoc(), in checkMapConflicts()
20598 << SI->getAssociatedExpression()->getSourceRange(); in checkMapConflicts()
20603 if (CI->getAssociatedExpression()->getStmtClass() != in checkMapConflicts()
20604 SI->getAssociatedExpression()->getStmtClass()) in checkMapConflicts()
20608 if (CI->getAssociatedDeclaration() != SI->getAssociatedDeclaration()) in checkMapConflicts()
20617 dyn_cast<ArraySubscriptExpr>(SI->getAssociatedExpression())) { in checkMapConflicts()
20618 Type = ASE->getBase()->IgnoreParenImpCasts()->getType(); in checkMapConflicts()
20620 SI->getAssociatedExpression())) { in checkMapConflicts()
20621 const Expr *E = OASE->getBase()->IgnoreParenImpCasts(); in checkMapConflicts()
20624 SI->getAssociatedExpression())) { in checkMapConflicts()
20625 Type = OASE->getBase()->getType()->getPointeeType(); in checkMapConflicts()
20627 if (Type.isNull() || Type->isAnyPointerType() || in checkMapConflicts()
20629 SemaRef, SI->getAssociatedExpression(), Type)) in checkMapConflicts()
20648 SemaRef.Diag(RE->getExprLoc(), diag::note_used_here) in checkMapConflicts()
20649 << RE->getSourceRange(); in checkMapConflicts()
20659 std::prev(CI)->getAssociatedDeclaration()->getType(); in checkMapConflicts()
20661 std::prev(CI)->getAssociatedExpression()->getExprLoc(); in checkMapConflicts()
20679 if (DerivedType->isAnyPointerType()) { in checkMapConflicts()
20685 SemaRef.Diag(RE->getExprLoc(), diag::note_used_here) in checkMapConflicts()
20686 << RE->getSourceRange(); in checkMapConflicts()
20689 if (CI->getAssociatedExpression()->getStmtClass() != in checkMapConflicts()
20690 SI->getAssociatedExpression()->getStmtClass() || in checkMapConflicts()
20691 CI->getAssociatedDeclaration()->getCanonicalDecl() == in checkMapConflicts()
20692 SI->getAssociatedDeclaration()->getCanonicalDecl()) { in checkMapConflicts()
20696 SemaRef.Diag(RE->getExprLoc(), diag::note_used_here) in checkMapConflicts()
20697 << RE->getSourceRange(); in checkMapConflicts()
20716 while (It != End && !It->getAssociatedDeclaration()) in checkMapConflicts()
20720 if (It != Begin && It->getAssociatedDeclaration() in checkMapConflicts()
20721 ->getType() in checkMapConflicts()
20723 ->isAnyPointerType()) { in checkMapConflicts()
20735 SemaRef.Diag(RE->getExprLoc(), diag::note_used_here) in checkMapConflicts()
20736 << RE->getSourceRange(); in checkMapConflicts()
20771 SemaRef.Diag(EnclosingExpr->getExprLoc(), diag::note_used_here) in checkMapConflicts()
20772 << EnclosingExpr->getSourceRange(); in checkMapConflicts()
20779 // Look up the user-defined mapper given the mapper name and mapped type, and
20789 if (Type->isArrayType()) { in buildUserDefinedMapperRef()
20790 assert(Type->getAsArrayTypeUnsafe() && "Expect to get a valid array type"); in buildUserDefinedMapperRef()
20791 Type = Type->getAsArrayTypeUnsafe()->getElementType().getCanonicalType(); in buildUserDefinedMapperRef()
20793 // Find all user-defined mappers with the given MapperId. in buildUserDefinedMapperRef()
20801 while (S && !S->isDeclScope(D)) in buildUserDefinedMapperRef()
20802 S = S->getParent(); in buildUserDefinedMapperRef()
20804 S = S->getParent(); in buildUserDefinedMapperRef()
20810 // Extract the user-defined mappers with the given MapperId. in buildUserDefinedMapperRef()
20812 for (NamedDecl *D : ULE->decls()) { in buildUserDefinedMapperRef()
20820 if (SemaRef.CurContext->isDependentContext() || Type->isDependentType() || in buildUserDefinedMapperRef()
20821 Type->isInstantiationDependentType() || in buildUserDefinedMapperRef()
20822 Type->containsUnexpandedParameterPack() || in buildUserDefinedMapperRef()
20824 return !D->isInvalidDecl() && in buildUserDefinedMapperRef()
20825 (D->getType()->isDependentType() || in buildUserDefinedMapperRef()
20826 D->getType()->isInstantiationDependentType() || in buildUserDefinedMapperRef()
20827 D->getType()->containsUnexpandedParameterPack()); in buildUserDefinedMapperRef()
20844 if (!Type->isStructureOrClassType() && !Type->isUnionType() && in buildUserDefinedMapperRef()
20852 // Return the first user-defined mapper with the desired type. in buildUserDefinedMapperRef()
20854 Lookups, [&SemaRef, Type](ValueDecl *D) -> ValueDecl * { in buildUserDefinedMapperRef()
20855 if (!D->isInvalidDecl() && in buildUserDefinedMapperRef()
20856 SemaRef.Context.hasSameType(D->getType(), Type)) in buildUserDefinedMapperRef()
20861 // Find the first user-defined mapper with a type derived from the desired in buildUserDefinedMapperRef()
20864 Lookups, [&SemaRef, Type, Loc](ValueDecl *D) -> ValueDecl * { in buildUserDefinedMapperRef()
20865 if (!D->isInvalidDecl() && in buildUserDefinedMapperRef()
20866 SemaRef.IsDerivedFrom(Loc, Type, D->getType()) && in buildUserDefinedMapperRef()
20867 !Type.isMoreQualifiedThan(D->getType())) in buildUserDefinedMapperRef()
20873 if (SemaRef.IsDerivedFrom(Loc, Type, VD->getType(), Paths)) { in buildUserDefinedMapperRef()
20875 VD->getType().getUnqualifiedType()))) { in buildUserDefinedMapperRef()
20877 Loc, VD->getType(), Type, Paths.front(), in buildUserDefinedMapperRef()
20905 // The reference to the user-defined mapper associated with every expression.
20919 // components, variables, and user-defined mappers are extracted and used to
20935 // If the identifier of user-defined mapper is not specified, it is "default". in checkMappableExpressionList()
20962 SourceLocation ELoc = RE->getExprLoc(); in checkMappableExpressionList()
20975 const Expr *VE = RE->IgnoreParenLValueCasts(); in checkMappableExpressionList()
20977 if (VE->isValueDependent() || VE->isTypeDependent() || in checkMappableExpressionList()
20978 VE->isInstantiationDependent() || in checkMappableExpressionList()
20979 VE->containsUnexpandedParameterPack()) { in checkMappableExpressionList()
20980 // Try to find the associated user-defined mapper. in checkMappableExpressionList()
20982 SemaRef, DSAS->getCurScope(), MapperIdScopeSpec, MapperId, in checkMappableExpressionList()
20983 VE->getType().getCanonicalType(), UnresolvedMapper); in checkMappableExpressionList()
20993 Expr *SimpleExpr = RE->IgnoreParenCasts(); in checkMappableExpressionList()
20995 if (!RE->isLValue()) { in checkMappableExpressionList()
20999 << RE->getSourceRange(); in checkMappableExpressionList()
21002 << getOpenMPClauseName(CKind) << RE->getSourceRange(); in checkMappableExpressionList()
21014 DSAS->getCurrentDirective(), NoDiagnose); in checkMappableExpressionList()
21023 DSAS->addMappedClassesQualTypes(TE->getType()); in checkMappableExpressionList()
21024 // Try to find the associated user-defined mapper. in checkMappableExpressionList()
21026 SemaRef, DSAS->getCurScope(), MapperIdScopeSpec, MapperId, in checkMappableExpressionList()
21027 VE->getType().getCanonicalType(), UnresolvedMapper); in checkMappableExpressionList()
21046 CurDeclaration->isCanonicalDecl() && in checkMappableExpressionList()
21059 if (VD && DSAS->isThreadPrivate(VD)) { in checkMappableExpressionList()
21062 DSAStackTy::DSAVarData DVar = DSAS->getTopDSA(VD, /*FromParent=*/false); in checkMappableExpressionList()
21070 // A list item cannot appear in both a map clause and a data-sharing in checkMappableExpressionList()
21098 auto *ASE = dyn_cast<ArraySubscriptExpr>(VE->IgnoreParens()); in checkMappableExpressionList()
21099 auto *OASE = dyn_cast<ArraySectionExpr>(VE->IgnoreParens()); in checkMappableExpressionList()
21100 auto *OAShE = dyn_cast<OMPArrayShapingExpr>(VE->IgnoreParens()); in checkMappableExpressionList()
21102 Type = ASE->getType().getNonReferenceType(); in checkMappableExpressionList()
21105 ArraySectionExpr::getBaseOriginalType(OASE->getBase()); in checkMappableExpressionList()
21106 if (const auto *ATy = BaseType->getAsArrayTypeUnsafe()) in checkMappableExpressionList()
21107 Type = ATy->getElementType(); in checkMappableExpressionList()
21109 Type = BaseType->getPointeeType(); in checkMappableExpressionList()
21112 Type = OAShE->getBase()->getType()->getPointeeType(); in checkMappableExpressionList()
21114 Type = VE->getType(); in checkMappableExpressionList()
21121 if (!checkTypeMappable(VE->getExprLoc(), VE->getSourceRange(), SemaRef, in checkMappableExpressionList()
21128 // A map-type must be specified in all map clauses and must be either in checkMappableExpressionList()
21130 // no map type is present. in checkMappableExpressionList()
21131 OpenMPDirectiveKind DKind = DSAS->getCurrentDirective(); in checkMappableExpressionList()
21144 // A map-type must be specified in all map clauses and must be either in checkMappableExpressionList()
21146 // type is `from` if no map type is present. in checkMappableExpressionList()
21160 // enter data' or 'target exit data' directive, which have no associated in checkMappableExpressionList()
21175 // A map-type in a map clause must be to, from, tofrom or alloc in checkMappableExpressionList()
21188 // A list item cannot appear in both a map clause and a data-sharing in checkMappableExpressionList()
21192 // A list item cannot appear in both a map clause and a data-sharing in checkMappableExpressionList()
21198 DSAStackTy::DSAVarData DVar = DSAS->getTopDSA(VD, /*FromParent=*/false); in checkMappableExpressionList()
21203 << getOpenMPDirectiveName(DSAS->getCurrentDirective()); in checkMappableExpressionList()
21210 // Try to find the associated user-defined mapper. in checkMappableExpressionList()
21212 SemaRef, DSAS->getCurScope(), MapperIdScopeSpec, MapperId, in checkMappableExpressionList()
21223 DSAS->addMappableExpressionComponents(CurDeclaration, CurComponents, in checkMappableExpressionList()
21251 if (IteratorModifier && !IteratorModifier->getType()->isSpecificBuiltinType( in ActOnOpenMPMapClause()
21253 Diag(IteratorModifier->getExprLoc(), in ActOnOpenMPMapClause()
21256 // Process map-type-modifiers, flag errors for duplicate modifiers. in ActOnOpenMPMapClause()
21278 // other diagnostics related with non-existing map clauses are accurate. in ActOnOpenMPMapClause()
21303 if (ReductionType->isFunctionType()) { in ActOnOpenMPDeclareReductionType()
21307 if (ReductionType->isReferenceType()) { in ActOnOpenMPDeclareReductionType()
21311 if (ReductionType->isArrayType()) { in ActOnOpenMPDeclareReductionType()
21330 // A reduction-identifier may not be re-declared in the current scope for the in ActOnOpenMPDeclareReductionDirectiveStart()
21341 (ParentFn != nullptr) && !ParentFn->CompoundScopes.empty(); in ActOnOpenMPDeclareReductionDirectiveStart()
21353 if (OMPDeclareReductionDecl *D = PrevDecl->getPrevDeclInScope()) in ActOnOpenMPDeclareReductionDirectiveStart()
21356 PreviousRedeclTypes[PrevDecl->getType().getCanonicalType()] = in ActOnOpenMPDeclareReductionDirectiveStart()
21357 PrevDecl->getLocation(); in ActOnOpenMPDeclareReductionDirectiveStart()
21372 PreviousRedeclTypes[PrevDRDInScope->getType().getCanonicalType()] = in ActOnOpenMPDeclareReductionDirectiveStart()
21373 PrevDRDInScope->getLocation(); in ActOnOpenMPDeclareReductionDirectiveStart()
21374 PrevDRDInScope = PrevDRDInScope->getPrevDeclInScope(); in ActOnOpenMPDeclareReductionDirectiveStart()
21383 Diag(I->second, diag::note_previous_definition); in ActOnOpenMPDeclareReductionDirectiveStart()
21389 DC->addDecl(DRD); in ActOnOpenMPDeclareReductionDirectiveStart()
21390 DRD->setAccess(AS); in ActOnOpenMPDeclareReductionDirectiveStart()
21393 DRD->setInvalidDecl(); in ActOnOpenMPDeclareReductionDirectiveStart()
21408 SemaRef.getCurFunction()->setHasOMPDeclareReductionCombiner(); in ActOnOpenMPDeclareReductionCombinerStart()
21418 QualType ReductionType = DRD->getType(); in ActOnOpenMPDeclareReductionCombinerStart()
21426 buildVarDecl(SemaRef, D->getLocation(), ReductionType, "omp_in"); in ActOnOpenMPDeclareReductionCombinerStart()
21434 buildVarDecl(SemaRef, D->getLocation(), ReductionType, "omp_out"); in ActOnOpenMPDeclareReductionCombinerStart()
21439 DRD->addDecl(OmpInParm); in ActOnOpenMPDeclareReductionCombinerStart()
21440 DRD->addDecl(OmpOutParm); in ActOnOpenMPDeclareReductionCombinerStart()
21443 ::buildDeclRefExpr(SemaRef, OmpInParm, ReductionType, D->getLocation()); in ActOnOpenMPDeclareReductionCombinerStart()
21445 ::buildDeclRefExpr(SemaRef, OmpOutParm, ReductionType, D->getLocation()); in ActOnOpenMPDeclareReductionCombinerStart()
21446 DRD->setCombinerData(InE, OutE); in ActOnOpenMPDeclareReductionCombinerStart()
21459 DRD->setCombiner(Combiner); in ActOnOpenMPDeclareReductionCombinerEnd()
21461 DRD->setInvalidDecl(); in ActOnOpenMPDeclareReductionCombinerEnd()
21480 QualType ReductionType = DRD->getType(); in ActOnOpenMPDeclareReductionInitializerStart()
21488 buildVarDecl(SemaRef, D->getLocation(), ReductionType, "omp_priv"); in ActOnOpenMPDeclareReductionInitializerStart()
21496 buildVarDecl(SemaRef, D->getLocation(), ReductionType, "omp_orig"); in ActOnOpenMPDeclareReductionInitializerStart()
21501 DRD->addDecl(OmpPrivParm); in ActOnOpenMPDeclareReductionInitializerStart()
21502 DRD->addDecl(OmpOrigParm); in ActOnOpenMPDeclareReductionInitializerStart()
21505 ::buildDeclRefExpr(SemaRef, OmpOrigParm, ReductionType, D->getLocation()); in ActOnOpenMPDeclareReductionInitializerStart()
21507 ::buildDeclRefExpr(SemaRef, OmpPrivParm, ReductionType, D->getLocation()); in ActOnOpenMPDeclareReductionInitializerStart()
21508 DRD->setInitializerData(OrigE, PrivE); in ActOnOpenMPDeclareReductionInitializerStart()
21522 DRD->setInitializer(Initializer, OMPDeclareReductionInitKind::Call); in ActOnOpenMPDeclareReductionInitializerEnd()
21523 } else if (OmpPrivParm->hasInit()) { in ActOnOpenMPDeclareReductionInitializerEnd()
21524 DRD->setInitializer(OmpPrivParm->getInit(), in ActOnOpenMPDeclareReductionInitializerEnd()
21525 OmpPrivParm->isDirectInit() in ActOnOpenMPDeclareReductionInitializerEnd()
21529 DRD->setInvalidDecl(); in ActOnOpenMPDeclareReductionInitializerEnd()
21541 D->setInvalidDecl(); in ActOnOpenMPDeclareReductionDirectiveEnd()
21550 QualType T = TInfo->getType(); in ActOnOpenMPDeclareMapperVarDecl()
21555 // Check that there are no default arguments (C++ only). in ActOnOpenMPDeclareMapperVarDecl()
21571 if (!MapperType->isStructureOrClassType() && !MapperType->isUnionType()) { in ActOnOpenMPDeclareMapperType()
21586 // A mapper-identifier may not be redeclared in the current scope for the in ActOnOpenMPDeclareMapperDirective()
21597 (ParentFn != nullptr) && !ParentFn->CompoundScopes.empty(); in ActOnOpenMPDeclareMapperDirective()
21609 if (OMPDeclareMapperDecl *D = PrevDecl->getPrevDeclInScope()) in ActOnOpenMPDeclareMapperDirective()
21612 PreviousRedeclTypes[PrevDecl->getType().getCanonicalType()] = in ActOnOpenMPDeclareMapperDirective()
21613 PrevDecl->getLocation(); in ActOnOpenMPDeclareMapperDirective()
21628 PreviousRedeclTypes[PrevDMDInScope->getType().getCanonicalType()] = in ActOnOpenMPDeclareMapperDirective()
21629 PrevDMDInScope->getLocation(); in ActOnOpenMPDeclareMapperDirective()
21630 PrevDMDInScope = PrevDMDInScope->getPrevDeclInScope(); in ActOnOpenMPDeclareMapperDirective()
21638 Diag(I->second, diag::note_previous_definition); in ActOnOpenMPDeclareMapperDirective()
21654 DC->addDecl(DMD); in ActOnOpenMPDeclareMapperDirective()
21655 DMD->setAccess(AS); in ActOnOpenMPDeclareMapperDirective()
21657 DMD->setInvalidDecl(); in ActOnOpenMPDeclareMapperDirective()
21659 auto *VD = cast<DeclRefExpr>(MapperVarRef)->getDecl(); in ActOnOpenMPDeclareMapperDirective()
21660 VD->setDeclContext(DMD); in ActOnOpenMPDeclareMapperDirective()
21661 VD->setLexicalDeclContext(DMD); in ActOnOpenMPDeclareMapperDirective()
21662 DMD->addDecl(VD); in ActOnOpenMPDeclareMapperDirective()
21663 DMD->setMapperVarRef(MapperVarRef); in ActOnOpenMPDeclareMapperDirective()
21679 DSAStack->addDeclareMapperVarRef(E); in ActOnOpenMPDeclareMapperDirectiveVarDecl()
21684 if (DSAStack->getDeclareMapperVarRef()) in ActOnOpenMPIteratorVarDecl()
21685 DSAStack->addIteratorVarDecl(VD); in ActOnOpenMPIteratorVarDecl()
21690 const Expr *Ref = DSAStack->getDeclareMapperVarRef(); in isOpenMPDeclareMapperVarDeclAllowed()
21692 if (VD->getCanonicalDecl() == DRE->getDecl()->getCanonicalDecl()) in isOpenMPDeclareMapperVarDeclAllowed()
21694 if (VD->isUsableInConstantExpressions(getASTContext())) in isOpenMPDeclareMapperVarDeclAllowed()
21696 if (getLangOpts().OpenMP >= 52 && DSAStack->isIteratorVarDecl(VD)) in isOpenMPDeclareMapperVarDeclAllowed()
21705 return cast<DeclRefExpr>(DSAStack->getDeclareMapperVarRef())->getDecl(); in getOpenMPDeclareMapperVarName()
21721 OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); in ActOnOpenMPNumTeamsClause()
21725 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPNumTeamsClause()
21749 OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); in ActOnOpenMPThreadLimitClause()
21753 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPThreadLimitClause()
21773 // The priority-value is a non-negative numerical scalar expression. in ActOnOpenMPPriorityClause()
21777 DSAStack->getCurrentDirective(), &CaptureRegion, &HelperValStmt)) in ActOnOpenMPPriorityClause()
21809 DSAStack->getCurrentDirective(), in ActOnOpenMPGrainsizeClause()
21843 DSAStack->getCurrentDirective(), &CaptureRegion, &HelperValStmt)) in ActOnOpenMPNumTasksClause()
21856 // ... where hint-expression is an integer constant expression that evaluates in ActOnOpenMPHintClause()
21869 QualType OMPEventHandleT = Stack->getOMPEventHandleT(); in findOMPEventHandleT()
21878 Stack->setOMPEventHandleT(PT.get()); in findOMPEventHandleT()
21886 if (!Evt->isValueDependent() && !Evt->isTypeDependent() && in ActOnOpenMPDetachClause()
21887 !Evt->isInstantiationDependent() && in ActOnOpenMPDetachClause()
21888 !Evt->containsUnexpandedParameterPack()) { in ActOnOpenMPDetachClause()
21889 if (!findOMPEventHandleT(SemaRef, Evt->getExprLoc(), DSAStack)) in ActOnOpenMPDetachClause()
21892 // event-handle is a variable of the omp_event_handle_t type. in ActOnOpenMPDetachClause()
21893 auto *Ref = dyn_cast<DeclRefExpr>(Evt->IgnoreParenImpCasts()); in ActOnOpenMPDetachClause()
21895 Diag(Evt->getExprLoc(), diag::err_omp_var_expected) in ActOnOpenMPDetachClause()
21896 << "omp_event_handle_t" << 0 << Evt->getSourceRange(); in ActOnOpenMPDetachClause()
21899 auto *VD = dyn_cast_or_null<VarDecl>(Ref->getDecl()); in ActOnOpenMPDetachClause()
21901 Diag(Evt->getExprLoc(), diag::err_omp_var_expected) in ActOnOpenMPDetachClause()
21902 << "omp_event_handle_t" << 0 << Evt->getSourceRange(); in ActOnOpenMPDetachClause()
21905 if (!getASTContext().hasSameUnqualifiedType(DSAStack->getOMPEventHandleT(), in ActOnOpenMPDetachClause()
21906 VD->getType()) || in ActOnOpenMPDetachClause()
21907 VD->getType().isConstant(getASTContext())) { in ActOnOpenMPDetachClause()
21908 Diag(Evt->getExprLoc(), diag::err_omp_var_expected) in ActOnOpenMPDetachClause()
21909 << "omp_event_handle_t" << 1 << VD->getType() in ActOnOpenMPDetachClause()
21910 << Evt->getSourceRange(); in ActOnOpenMPDetachClause()
21914 // [detach clause]... The event-handle will be considered as if it was in ActOnOpenMPDetachClause()
21916 DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(VD, /*FromParent=*/false); in ActOnOpenMPDetachClause()
21919 Diag(Evt->getExprLoc(), diag::err_omp_wrong_dsa) in ActOnOpenMPDetachClause()
21947 if (!ChunkSize->isValueDependent() && !ChunkSize->isTypeDependent() && in ActOnOpenMPDistScheduleClause()
21948 !ChunkSize->isInstantiationDependent() && in ActOnOpenMPDistScheduleClause()
21949 !ChunkSize->containsUnexpandedParameterPack()) { in ActOnOpenMPDistScheduleClause()
21950 SourceLocation ChunkSizeLoc = ChunkSize->getBeginLoc(); in ActOnOpenMPDistScheduleClause()
21962 ValExpr->getIntegerConstantExpr(getASTContext())) { in ActOnOpenMPDistScheduleClause()
21963 if (Result->isSigned() && !Result->isStrictlyPositive()) { in ActOnOpenMPDistScheduleClause()
21965 << "dist_schedule" << ChunkSize->getSourceRange(); in ActOnOpenMPDistScheduleClause()
21969 DSAStack->getCurrentDirective(), OMPC_dist_schedule, in ActOnOpenMPDistScheduleClause()
21971 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPDistScheduleClause()
22053 if (DSAStack->checkDefaultmapCategory(Kind)) { in ActOnOpenMPDefaultmapClause()
22059 // Variable category is not specified - mark all categories. in ActOnOpenMPDefaultmapClause()
22060 DSAStack->setDefaultDMAAttr(M, OMPC_DEFAULTMAP_aggregate, StartLoc); in ActOnOpenMPDefaultmapClause()
22061 DSAStack->setDefaultDMAAttr(M, OMPC_DEFAULTMAP_scalar, StartLoc); in ActOnOpenMPDefaultmapClause()
22062 DSAStack->setDefaultDMAAttr(M, OMPC_DEFAULTMAP_pointer, StartLoc); in ActOnOpenMPDefaultmapClause()
22064 DSAStack->setDefaultDMAAttr(M, Kind, StartLoc); in ActOnOpenMPDefaultmapClause()
22074 if (!CurLexicalContext->isFileContext() && in ActOnStartOpenMPDeclareTargetContext()
22075 !CurLexicalContext->isExternCContext() && in ActOnStartOpenMPDeclareTargetContext()
22076 !CurLexicalContext->isExternCXXContext() && in ActOnStartOpenMPDeclareTargetContext()
22085 // Report affected OpenMP target offloading behavior when in HIP lang-mode. in ActOnStartOpenMPDeclareTargetContext()
22159 if (!VD->isFileVarDecl() && !VD->isStaticLocal() && in ActOnOpenMPDeclareTargetName()
22160 !VD->isStaticDataMember()) { in ActOnOpenMPDeclareTargetName()
22162 << VD->getNameAsString(); in ActOnOpenMPDeclareTargetName()
22169 (ND->isUsed(/*CheckUsedAttr=*/false) || ND->isReferenced())) in ActOnOpenMPDeclareTargetName()
22172 // Report affected OpenMP target offloading behavior when in HIP lang-mode. in ActOnOpenMPDeclareTargetName()
22177 const unsigned Level = -1; in ActOnOpenMPDeclareTargetName()
22182 if (ActiveAttr && (*ActiveAttr)->getDevType() != DTCI.DT && in ActOnOpenMPDeclareTargetName()
22183 (*ActiveAttr)->getLevel() == Level) { in ActOnOpenMPDeclareTargetName()
22187 (*ActiveAttr)->getDevType()); in ActOnOpenMPDeclareTargetName()
22190 if (ActiveAttr && (*ActiveAttr)->getMapType() != MT && in ActOnOpenMPDeclareTargetName()
22191 (*ActiveAttr)->getLevel() == Level) { in ActOnOpenMPDeclareTargetName()
22196 if (ActiveAttr && (*ActiveAttr)->getLevel() == Level) in ActOnOpenMPDeclareTargetName()
22209 ND->addAttr(A); in ActOnOpenMPDeclareTargetName()
22211 ML->DeclarationMarkedOpenMPDeclareTarget(ND, A); in ActOnOpenMPDeclareTargetName()
22214 getLangOpts().OpenMP && VD && VD->hasAttr<OMPDeclareTargetDeclAttr>() && in ActOnOpenMPDeclareTargetName()
22215 VD->hasGlobalStorage()) in ActOnOpenMPDeclareTargetName()
22229 VD->hasGlobalStorage()) { in checkDeclInTargetContext()
22237 SemaRef.Diag(VD->getLocation(), in checkDeclInTargetContext()
22246 SemaRef.Diag(VD->getLocation(), diag::warn_omp_not_in_target_context); in checkDeclInTargetContext()
22254 checkTypeMappable(SL, SR, SemaRef, Stack, VD->getType(), in checkValueDeclInTarget()
22260 if (!D || D->isInvalidDecl()) in checkDeclIsAllowedInOpenMPTarget()
22262 SourceRange SR = E ? E->getSourceRange() : D->getSourceRange(); in checkDeclIsAllowedInOpenMPTarget()
22263 SourceLocation SL = E ? E->getBeginLoc() : D->getLocation(); in checkDeclIsAllowedInOpenMPTarget()
22266 if (!VD->isFileVarDecl() && !VD->isStaticLocal() && in checkDeclIsAllowedInOpenMPTarget()
22267 !VD->isStaticDataMember()) in checkDeclIsAllowedInOpenMPTarget()
22271 if (DSAStack->isThreadPrivate(VD)) { in checkDeclIsAllowedInOpenMPTarget()
22273 reportOriginalDsa(SemaRef, DSAStack, VD, DSAStack->getTopDSA(VD, false)); in checkDeclIsAllowedInOpenMPTarget()
22278 D = FTD->getTemplatedDecl(); in checkDeclIsAllowedInOpenMPTarget()
22284 Diag(FD->getLocation(), diag::note_defined_here) << FD; in checkDeclIsAllowedInOpenMPTarget()
22290 // as normal, so no need to check it here. in checkDeclIsAllowedInOpenMPTarget()
22291 if ((E || !VD->getType()->isIncompleteType()) && in checkDeclIsAllowedInOpenMPTarget()
22301 if (ActiveAttr && (*ActiveAttr)->getLevel() >= Level) in checkDeclIsAllowedInOpenMPTarget()
22317 D->addAttr(A); in checkDeclIsAllowedInOpenMPTarget()
22319 ML->DeclarationMarkedOpenMPDeclareTarget(D, A); in checkDeclIsAllowedInOpenMPTarget()
22326 checkDeclInTargetContext(E->getExprLoc(), E->getSourceRange(), SemaRef, D); in checkDeclIsAllowedInOpenMPTarget()
22339 if (auto *VD = dyn_cast<VarDecl>(Node->getDecl())) { in VisitDeclRefExpr()
22340 VD->addAttr(A); in VisitDeclRefExpr()
22346 for (auto *Child : Ex->children()) { in VisitExpr()
22355 A = TD->getAttr<OMPDeclareTargetDeclAttr>(); in declareTargetInitializer()
22359 if (TargetVarDecl->hasAttr<OMPDeclareTargetDeclAttr>() && in declareTargetInitializer()
22360 TargetVarDecl->hasInit() && TargetVarDecl->hasGlobalStorage()) { in declareTargetInitializer()
22361 if (Expr *Ex = TargetVarDecl->getInit()) in declareTargetInitializer()
22387 // Process motion-modifiers, flag errors for duplicate modifiers. in ActOnOpenMPToClause()
22424 // Process motion-modifiers, flag errors for duplicate modifiers. in ActOnOpenMPFromClause()
22474 QualType Type = D->getType(); in ActOnOpenMPUseDevicePtrClause()
22480 if (!Type->isPointerType()) { in ActOnOpenMPUseDevicePtrClause()
22482 << 0 << RefExpr->getSourceRange(); in ActOnOpenMPUseDevicePtrClause()
22488 buildVarDecl(SemaRef, ELoc, Type, D->getName(), in ActOnOpenMPUseDevicePtrClause()
22489 D->hasAttrs() ? &D->getAttrs() : nullptr, in ActOnOpenMPUseDevicePtrClause()
22491 if (VDPrivate->isInvalidDecl()) in ActOnOpenMPUseDevicePtrClause()
22494 SemaRef.CurContext->addDecl(VDPrivate); in ActOnOpenMPUseDevicePtrClause()
22496 SemaRef, VDPrivate, RefExpr->getType().getUnqualifiedType(), ELoc); in ActOnOpenMPUseDevicePtrClause()
22500 buildVarDecl(SemaRef, RefExpr->getExprLoc(), Type, ".devptr.temp"); in ActOnOpenMPUseDevicePtrClause()
22502 SemaRef, VDInit, RefExpr->getType(), RefExpr->getExprLoc()); in ActOnOpenMPUseDevicePtrClause()
22512 MVLI.ProcessedVarList.push_back(VD ? RefExpr->IgnoreParens() : Ref); in ActOnOpenMPUseDevicePtrClause()
22519 DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_firstprivate, Ref); in ActOnOpenMPUseDevicePtrClause()
22563 MVLI.ProcessedVarList.push_back(VD ? RefExpr->IgnoreParens() : Ref); in ActOnOpenMPUseDeviceAddrClause()
22568 DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_firstprivate, Ref); in ActOnOpenMPUseDeviceAddrClause()
22575 if (VD && (isa<ArraySectionExpr>(RefExpr->IgnoreParenImpCasts()) || in ActOnOpenMPUseDeviceAddrClause()
22576 isa<ArraySubscriptExpr>(RefExpr->IgnoreParenImpCasts()))) in ActOnOpenMPUseDeviceAddrClause()
22609 QualType Type = D->getType(); in ActOnOpenMPIsDevicePtrClause()
22611 if (!Type.getNonReferenceType()->isPointerType() && in ActOnOpenMPIsDevicePtrClause()
22612 !Type.getNonReferenceType()->isArrayType()) { in ActOnOpenMPIsDevicePtrClause()
22614 << 0 << RefExpr->getSourceRange(); in ActOnOpenMPIsDevicePtrClause()
22620 DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(D, /*FromParent=*/false); in ActOnOpenMPIsDevicePtrClause()
22625 << getOpenMPDirectiveName(DSAStack->getCurrentDirective()); in ActOnOpenMPIsDevicePtrClause()
22631 if (DSAStack->checkMappableExprComponentListsForDecl( in ActOnOpenMPIsDevicePtrClause()
22635 OpenMPClauseKind) -> bool { in ActOnOpenMPIsDevicePtrClause()
22639 Diag(ELoc, diag::err_omp_map_shared_storage) << RefExpr->getSourceRange(); in ActOnOpenMPIsDevicePtrClause()
22640 Diag(ConflictExpr->getExprLoc(), diag::note_used_here) in ActOnOpenMPIsDevicePtrClause()
22641 << ConflictExpr->getSourceRange(); in ActOnOpenMPIsDevicePtrClause()
22649 DSAStack->addMappableExpressionComponents( in ActOnOpenMPIsDevicePtrClause()
22659 isa<CXXThisExpr>(cast<MemberExpr>(SimpleRefExpr)->getBase())) && in ActOnOpenMPIsDevicePtrClause()
22696 DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(D, /*FromParent=*/false); in ActOnOpenMPHasDeviceAddrClause()
22701 << getOpenMPDirectiveName(DSAStack->getCurrentDirective()); in ActOnOpenMPHasDeviceAddrClause()
22707 if (DSAStack->checkMappableExprComponentListsForDecl( in ActOnOpenMPHasDeviceAddrClause()
22711 OpenMPClauseKind) -> bool { in ActOnOpenMPHasDeviceAddrClause()
22715 Diag(ELoc, diag::err_omp_map_shared_storage) << RefExpr->getSourceRange(); in ActOnOpenMPHasDeviceAddrClause()
22716 Diag(ConflictExpr->getExprLoc(), diag::note_used_here) in ActOnOpenMPHasDeviceAddrClause()
22717 << ConflictExpr->getSourceRange(); in ActOnOpenMPHasDeviceAddrClause()
22725 if (VD && (isa<ArraySectionExpr>(RefExpr->IgnoreParenImpCasts()) || in ActOnOpenMPHasDeviceAddrClause()
22726 isa<ArraySubscriptExpr>(RefExpr->IgnoreParenImpCasts()))) in ActOnOpenMPHasDeviceAddrClause()
22731 DSAStack->addMappableExpressionComponents( in ActOnOpenMPHasDeviceAddrClause()
22735 if (!VD && !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPHasDeviceAddrClause()
22741 MVLI.ProcessedVarList.push_back(RefExpr->IgnoreParens()); in ActOnOpenMPHasDeviceAddrClause()
22747 isa<CXXThisExpr>(cast<MemberExpr>(SimpleRefExpr)->getBase())) && in ActOnOpenMPHasDeviceAddrClause()
22769 if (!findOMPAllocatorHandleT(SemaRef, Allocator->getExprLoc(), DSAStack)) in ActOnOpenMPAllocateClause()
22776 AllocatorRes.get(), DSAStack->getOMPAllocatorHandleT(), in ActOnOpenMPAllocateClause()
22789 !DSAStack->hasRequiresDeclWithClause<OMPDynamicAllocatorsClause>()) in ActOnOpenMPAllocateClause()
22810 if (!VD && !SemaRef.CurContext->isDependentContext()) in ActOnOpenMPAllocateClause()
22812 Vars.push_back((VD || SemaRef.CurContext->isDependentContext()) in ActOnOpenMPAllocateClause()
22813 ? RefExpr->IgnoreParens() in ActOnOpenMPAllocateClause()
22821 DSAStack->addInnerAllocatorExpr(Allocator); in ActOnOpenMPAllocateClause()
22845 // A list-item cannot appear in more than one nontemporal clause. in ActOnOpenMPNontemporalClause()
22847 DSAStack->addUniqueNontemporal(D, SimpleRefExpr)) { in ActOnOpenMPNontemporalClause()
22850 Diag(PrevRef->getExprLoc(), diag::note_omp_explicit_dsa) in ActOnOpenMPNontemporalClause()
22898 DSAStack->getTopDSA(D, /*FromParent=*/true); in ActOnOpenMPInclusiveClause()
22902 // worksharing-loop, worksharing-loop SIMD, or simd construct. in ActOnOpenMPInclusiveClause()
22905 << RefExpr->getSourceRange(); in ActOnOpenMPInclusiveClause()
22907 if (DSAStack->getParentDirective() != OMPD_unknown) in ActOnOpenMPInclusiveClause()
22908 DSAStack->markDeclAsUsedInScanDirective(D); in ActOnOpenMPInclusiveClause()
22938 OpenMPDirectiveKind ParentDirective = DSAStack->getParentDirective(); in ActOnOpenMPExclusiveClause()
22941 DVar = DSAStack->getTopDSA(D, /*FromParent=*/true); in ActOnOpenMPExclusiveClause()
22945 // worksharing-loop, worksharing-loop SIMD, or simd construct. in ActOnOpenMPExclusiveClause()
22949 << RefExpr->getSourceRange(); in ActOnOpenMPExclusiveClause()
22951 DSAStack->markDeclAsUsedInScanDirective(D); in ActOnOpenMPExclusiveClause()
22965 QualType OMPAlloctraitT = Stack->getOMPAlloctraitT(); in findOMPAlloctraitT()
22974 Stack->setOMPAlloctraitT(PT.get()); in findOMPAlloctraitT()
22987 // allocator-traits-array is an identifier of const omp_alloctrait_t * type. in ActOnOpenMPUsesAllocatorClause()
23007 if (D.Allocator->isTypeDependent()) { in ActOnOpenMPUsesAllocatorClause()
23010 // Traits were specified - need to assign new allocator to the specified in ActOnOpenMPUsesAllocatorClause()
23012 AllocatorExpr = D.Allocator->IgnoreParenImpCasts(); in ActOnOpenMPUsesAllocatorClause()
23022 QualType OMPAllocatorHandleT = DSAStack->getOMPAllocatorHandleT(); in ActOnOpenMPUsesAllocatorClause()
23023 QualType AllocatorExprType = AllocatorExpr->getType(); in ActOnOpenMPUsesAllocatorClause()
23032 !AllocatorExprType.isConstant(Context) && AllocatorExpr->isLValue(); in ActOnOpenMPUsesAllocatorClause()
23035 Diag(D.Allocator->getExprLoc(), diag::err_omp_var_expected) in ActOnOpenMPUsesAllocatorClause()
23037 << AllocatorExpr->getType() << D.Allocator->getSourceRange(); in ActOnOpenMPUsesAllocatorClause()
23044 Diag(D.AllocatorTraits->getExprLoc(), in ActOnOpenMPUsesAllocatorClause()
23046 << D.AllocatorTraits->getSourceRange(); in ActOnOpenMPUsesAllocatorClause()
23047 Diag(D.Allocator->getExprLoc(), diag::note_omp_predefined_allocator) in ActOnOpenMPUsesAllocatorClause()
23048 << cast<NamedDecl>(DRE->getDecl())->getName() in ActOnOpenMPUsesAllocatorClause()
23049 << D.Allocator->getSourceRange(); in ActOnOpenMPUsesAllocatorClause()
23053 // Non-predefined allocators appearing in a uses_allocators clause must in ActOnOpenMPUsesAllocatorClause()
23056 Diag(D.Allocator->getExprLoc(), in ActOnOpenMPUsesAllocatorClause()
23060 // No allocator traits - just convert it to rvalue. in ActOnOpenMPUsesAllocatorClause()
23063 DSAStack->addUsesAllocatorsDecl( in ActOnOpenMPUsesAllocatorClause()
23064 DRE->getDecl(), in ActOnOpenMPUsesAllocatorClause()
23071 if (D.AllocatorTraits->isTypeDependent()) { in ActOnOpenMPUsesAllocatorClause()
23078 AllocatorTraitsExpr = D.AllocatorTraits->IgnoreParenImpCasts(); in ActOnOpenMPUsesAllocatorClause()
23082 AllocatorTraitsExpr->getType()->getAsArrayTypeUnsafe()) in ActOnOpenMPUsesAllocatorClause()
23084 TraitTy = ConstArrayTy->getElementType(); in ActOnOpenMPUsesAllocatorClause()
23087 DSAStack->getOMPAlloctraitT()) || in ActOnOpenMPUsesAllocatorClause()
23088 Context.typesAreCompatible(TraitTy, DSAStack->getOMPAlloctraitT(), in ActOnOpenMPUsesAllocatorClause()
23090 Diag(D.AllocatorTraits->getExprLoc(), in ActOnOpenMPUsesAllocatorClause()
23092 << AllocatorTraitsExpr->getType(); in ActOnOpenMPUsesAllocatorClause()
23098 DSAStack->addUsesAllocatorsDecl( in ActOnOpenMPUsesAllocatorClause()
23099 DRE->getDecl(), in ActOnOpenMPUsesAllocatorClause()
23119 if (isa<DependentScopeDeclRefExpr>(RefExpr) || RefExpr->isTypeDependent()) { in ActOnOpenMPAffinityClause()
23125 SourceLocation ELoc = RefExpr->getExprLoc(); in ActOnOpenMPAffinityClause()
23126 Expr *SimpleExpr = RefExpr->IgnoreParenImpCasts(); in ActOnOpenMPAffinityClause()
23128 if (!SimpleExpr->isLValue()) { in ActOnOpenMPAffinityClause()
23130 << 1 << 0 << RefExpr->getSourceRange(); in ActOnOpenMPAffinityClause()
23142 << 1 << 0 << RefExpr->getSourceRange(); in ActOnOpenMPAffinityClause()
23183 OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); in ActOnOpenMPXDynCGroupMemClause()
23187 !SemaRef.CurContext->isDependentContext()) { in ActOnOpenMPXDynCGroupMemClause()
23203 if (DSAStack->getCurrentDirective() == OMPD_ordered && in ActOnOpenMPDoacrossClause()
23228 if (DSAStack->isParentOrderedRegion()) in ActOnOpenMPDoacrossClause()
23229 DSAStack->addDoacrossDependClause(C, OpsOffs); in ActOnOpenMPDoacrossClause()
23251 if (Base->hasPlaceholderType() && in ActOnOMPArraySectionExpr()
23252 !Base->hasPlaceholderType(BuiltinType::ArraySection)) { in ActOnOMPArraySectionExpr()
23258 if (LowerBound && LowerBound->getType()->isNonOverloadPlaceholderType()) { in ActOnOMPArraySectionExpr()
23267 if (Length && Length->getType()->isNonOverloadPlaceholderType()) { in ActOnOMPArraySectionExpr()
23276 if (Stride && Stride->getType()->isNonOverloadPlaceholderType()) { in ActOnOMPArraySectionExpr()
23286 // Build an unanalyzed expression if either operand is type-dependent. in ActOnOMPArraySectionExpr()
23287 if (Base->isTypeDependent() || in ActOnOMPArraySectionExpr()
23289 (LowerBound->isTypeDependent() || LowerBound->isValueDependent())) || in ActOnOMPArraySectionExpr()
23290 (Length && (Length->isTypeDependent() || Length->isValueDependent())) || in ActOnOMPArraySectionExpr()
23291 (Stride && (Stride->isTypeDependent() || Stride->isValueDependent()))) { in ActOnOMPArraySectionExpr()
23300 if (OriginalTy->isAnyPointerType()) { in ActOnOMPArraySectionExpr()
23301 ResultTy = OriginalTy->getPointeeType(); in ActOnOMPArraySectionExpr()
23302 } else if (OriginalTy->isArrayType()) { in ActOnOMPArraySectionExpr()
23303 ResultTy = OriginalTy->getAsArrayTypeUnsafe()->getElementType(); in ActOnOMPArraySectionExpr()
23306 Diag(Base->getExprLoc(), diag::err_omp_typecheck_section_value) in ActOnOMPArraySectionExpr()
23307 << Base->getSourceRange()); in ActOnOMPArraySectionExpr()
23311 auto Res = PerformOpenMPImplicitIntegerConversion(LowerBound->getExprLoc(), in ActOnOMPArraySectionExpr()
23314 return ExprError(Diag(LowerBound->getExprLoc(), in ActOnOMPArraySectionExpr()
23316 << 0 << LowerBound->getSourceRange()); in ActOnOMPArraySectionExpr()
23319 if (LowerBound->getType()->isSpecificBuiltinType(BuiltinType::Char_S) || in ActOnOMPArraySectionExpr()
23320 LowerBound->getType()->isSpecificBuiltinType(BuiltinType::Char_U)) in ActOnOMPArraySectionExpr()
23321 Diag(LowerBound->getExprLoc(), diag::warn_omp_section_is_char) in ActOnOMPArraySectionExpr()
23322 << 0 << LowerBound->getSourceRange(); in ActOnOMPArraySectionExpr()
23326 PerformOpenMPImplicitIntegerConversion(Length->getExprLoc(), Length); in ActOnOMPArraySectionExpr()
23328 return ExprError(Diag(Length->getExprLoc(), in ActOnOMPArraySectionExpr()
23330 << 1 << Length->getSourceRange()); in ActOnOMPArraySectionExpr()
23333 if (Length->getType()->isSpecificBuiltinType(BuiltinType::Char_S) || in ActOnOMPArraySectionExpr()
23334 Length->getType()->isSpecificBuiltinType(BuiltinType::Char_U)) in ActOnOMPArraySectionExpr()
23335 Diag(Length->getExprLoc(), diag::warn_omp_section_is_char) in ActOnOMPArraySectionExpr()
23336 << 1 << Length->getSourceRange(); in ActOnOMPArraySectionExpr()
23340 PerformOpenMPImplicitIntegerConversion(Stride->getExprLoc(), Stride); in ActOnOMPArraySectionExpr()
23342 return ExprError(Diag(Stride->getExprLoc(), in ActOnOMPArraySectionExpr()
23344 << 1 << Stride->getSourceRange()); in ActOnOMPArraySectionExpr()
23347 if (Stride->getType()->isSpecificBuiltinType(BuiltinType::Char_S) || in ActOnOMPArraySectionExpr()
23348 Stride->getType()->isSpecificBuiltinType(BuiltinType::Char_U)) in ActOnOMPArraySectionExpr()
23349 Diag(Stride->getExprLoc(), diag::warn_omp_section_is_char) in ActOnOMPArraySectionExpr()
23350 << 1 << Stride->getSourceRange(); in ActOnOMPArraySectionExpr()
23354 // C++ [expr.sub]p1: The type "T" shall be a completely-defined object in ActOnOMPArraySectionExpr()
23357 if (ResultTy->isFunctionType()) { in ActOnOMPArraySectionExpr()
23358 Diag(Base->getExprLoc(), diag::err_omp_section_function_type) in ActOnOMPArraySectionExpr()
23359 << ResultTy << Base->getSourceRange(); in ActOnOMPArraySectionExpr()
23363 if (SemaRef.RequireCompleteType(Base->getExprLoc(), ResultTy, in ActOnOMPArraySectionExpr()
23367 if (LowerBound && !OriginalTy->isAnyPointerType()) { in ActOnOMPArraySectionExpr()
23369 if (LowerBound->EvaluateAsInt(Result, Context)) { in ActOnOMPArraySectionExpr()
23374 Diag(LowerBound->getExprLoc(), in ActOnOMPArraySectionExpr()
23376 << LowerBound->getSourceRange(); in ActOnOMPArraySectionExpr()
23384 if (Length->EvaluateAsInt(Result, Context)) { in ActOnOMPArraySectionExpr()
23386 // The length must evaluate to non-negative integers. in ActOnOMPArraySectionExpr()
23389 Diag(Length->getExprLoc(), diag::err_omp_section_length_negative) in ActOnOMPArraySectionExpr()
23391 << Length->getSourceRange(); in ActOnOMPArraySectionExpr()
23396 (OriginalTy.isNull() || (!OriginalTy->isConstantArrayType() && in ActOnOMPArraySectionExpr()
23397 !OriginalTy->isVariableArrayType()))) { in ActOnOMPArraySectionExpr()
23402 << (!OriginalTy.isNull() && OriginalTy->isArrayType()); in ActOnOMPArraySectionExpr()
23408 if (Stride->EvaluateAsInt(Result, Context)) { in ActOnOMPArraySectionExpr()
23413 Diag(Stride->getExprLoc(), diag::err_omp_section_stride_non_positive) in ActOnOMPArraySectionExpr()
23415 << Stride->getSourceRange(); in ActOnOMPArraySectionExpr()
23421 if (!Base->hasPlaceholderType(BuiltinType::ArraySection)) { in ActOnOMPArraySectionExpr()
23436 if (Base->hasPlaceholderType()) { in ActOnOMPArrayShapingExpr()
23445 QualType BaseTy = Base->getType(); in ActOnOMPArrayShapingExpr()
23448 if (!BaseTy->isPointerType() && Base->isTypeDependent()) in ActOnOMPArrayShapingExpr()
23451 if (!BaseTy->isPointerType() || in ActOnOMPArrayShapingExpr()
23452 (!Base->isTypeDependent() && in ActOnOMPArrayShapingExpr()
23453 BaseTy->getPointeeType()->isIncompleteType())) in ActOnOMPArrayShapingExpr()
23454 return ExprError(Diag(Base->getExprLoc(), in ActOnOMPArrayShapingExpr()
23456 << Base->getSourceRange()); in ActOnOMPArrayShapingExpr()
23461 if (Dim->hasPlaceholderType()) { in ActOnOMPArrayShapingExpr()
23474 if (!Dim->isTypeDependent()) { in ActOnOMPArrayShapingExpr()
23476 PerformOpenMPImplicitIntegerConversion(Dim->getExprLoc(), Dim); in ActOnOMPArrayShapingExpr()
23479 Diag(Dim->getExprLoc(), diag::err_omp_typecheck_shaping_not_integer) in ActOnOMPArrayShapingExpr()
23480 << Dim->getSourceRange(); in ActOnOMPArrayShapingExpr()
23485 if (!Dim->isValueDependent() && Dim->EvaluateAsInt(EvResult, Context)) { in ActOnOMPArrayShapingExpr()
23491 Diag(Dim->getExprLoc(), diag::err_omp_shaping_dimension_not_positive) in ActOnOMPArrayShapingExpr()
23493 << Dim->getSourceRange(); in ActOnOMPArrayShapingExpr()
23521 // In an iterator-specifier, if the iterator-type is not specified then in ActOnOMPIteratorExpr()
23527 StartLoc = TInfo->getTypeLoc().getBeginLoc(); in ActOnOMPIteratorExpr()
23530 bool IsDeclTyDependent = DeclTy->isDependentType() || in ActOnOMPIteratorExpr()
23531 DeclTy->containsUnexpandedParameterPack() || in ActOnOMPIteratorExpr()
23532 DeclTy->isInstantiationDependentType(); in ActOnOMPIteratorExpr()
23534 if (!DeclTy->isIntegralType(Context) && !DeclTy->isAnyPointerType()) { in ActOnOMPIteratorExpr()
23536 // The iterator-type must be an integral or pointer type. in ActOnOMPIteratorExpr()
23544 // The iterator-type must not be const qualified. in ActOnOMPIteratorExpr()
23559 VD->setImplicit(); in ActOnOMPIteratorExpr()
23562 DeclarationNameInfo NameInfo(VD->getDeclName(), D.DeclIdentLoc); in ActOnOMPIteratorExpr()
23573 Diag(D.DeclIdentLoc, diag::err_redefinition) << VD->getDeclName(); in ActOnOMPIteratorExpr()
23574 Diag(Old->getLocation(), diag::note_previous_definition); in ActOnOMPIteratorExpr()
23579 SemaRef.CurContext->addDecl(VD); in ActOnOMPIteratorExpr()
23586 if (!IsDeclTyDependent && Begin && !Begin->isTypeDependent()) { in ActOnOMPIteratorExpr()
23592 if (!IsDeclTyDependent && End && !End->isTypeDependent()) { in ActOnOMPIteratorExpr()
23598 if (!IsDeclTyDependent && Step && !Step->isTypeDependent()) { in ActOnOMPIteratorExpr()
23599 if (!Step->getType()->isIntegralType(Context)) { in ActOnOMPIteratorExpr()
23600 Diag(Step->getExprLoc(), diag::err_omp_iterator_step_not_integral) in ActOnOMPIteratorExpr()
23601 << Step << Step->getSourceRange(); in ActOnOMPIteratorExpr()
23606 Step->getIntegerConstantExpr(Context); in ActOnOMPIteratorExpr()
23608 // If the step expression of a range-specification equals zero, the in ActOnOMPIteratorExpr()
23610 if (Result && Result->isZero()) { in ActOnOMPIteratorExpr()
23611 Diag(Step->getExprLoc(), diag::err_omp_iterator_step_constant_zero) in ActOnOMPIteratorExpr()
23612 << Step << Step->getSourceRange(); in ActOnOMPIteratorExpr()
23634 ID->setInvalidDecl(); in ActOnOMPIteratorExpr()
23639 if (!SemaRef.CurContext->isDependentContext()) { in ActOnOMPIteratorExpr()
23641 // Ni = ((Stepi > 0) ? ((Endi + Stepi -1 - Begini)/Stepi) : in ActOnOMPIteratorExpr()
23642 // ((Begini-Stepi-1-Endi) / -Stepi); in ActOnOMPIteratorExpr()
23644 // (Endi - Begini) in ActOnOMPIteratorExpr()
23654 // (Endi - Begini) + Stepi in ActOnOMPIteratorExpr()
23661 // (Endi - Begini) + Stepi - 1 in ActOnOMPIteratorExpr()
23669 // ((Endi - Begini) + Stepi - 1) / Stepi in ActOnOMPIteratorExpr()
23678 // (Begini - Endi) in ActOnOMPIteratorExpr()
23685 // (Begini - Endi) - Stepi in ActOnOMPIteratorExpr()
23692 // (Begini - Endi) - Stepi - 1 in ActOnOMPIteratorExpr()
23700 // ((Begini - Endi) - Stepi - 1) / (-Stepi) in ActOnOMPIteratorExpr()
23731 D.IteratorDecl->getBeginLoc(), in ActOnOMPIteratorExpr()
23732 D.IteratorDecl->getBeginLoc(), nullptr, in ActOnOMPIteratorExpr()
23733 Res.get()->getType(), nullptr, SC_None); in ActOnOMPIteratorExpr()
23734 CounterVD->setImplicit(); in ActOnOMPIteratorExpr()
23736 SemaRef.BuildDeclRefExpr(CounterVD, CounterVD->getType(), VK_LValue, in ActOnOMPIteratorExpr()
23737 D.IteratorDecl->getBeginLoc()); in ActOnOMPIteratorExpr()
23760 cast<VarDecl>(D.IteratorDecl)->getType(), in ActOnOMPIteratorExpr()
23761 VK_LValue, D.IteratorDecl->getBeginLoc()); in ActOnOMPIteratorExpr()
23799 ID->setInvalidDecl(); in ActOnOMPIteratorExpr()
23841 D->addAttr(::new (getASTContext()) OMPAssumeAttr(getASTContext(), AL, Str)); in handleOMPAssumeAttr()