diff options
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/OpenMPClause.cpp | 12 | ||||
| -rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 7 |
2 files changed, 14 insertions, 5 deletions
diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp index f062c3e463a..790b4401229 100644 --- a/clang/lib/AST/OpenMPClause.cpp +++ b/clang/lib/AST/OpenMPClause.cpp @@ -1162,8 +1162,8 @@ OMPNontemporalClause *OMPNontemporalClause::Create(const ASTContext &C, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL) { - // Allocate space for nontemporal variables. - void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size())); + // Allocate space for nontemporal variables + private references. + void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * VL.size())); auto *Clause = new (Mem) OMPNontemporalClause(StartLoc, LParenLoc, EndLoc, VL.size()); Clause->setVarRefs(VL); @@ -1172,10 +1172,16 @@ OMPNontemporalClause *OMPNontemporalClause::Create(const ASTContext &C, OMPNontemporalClause *OMPNontemporalClause::CreateEmpty(const ASTContext &C, unsigned N) { - void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N)); + void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * N)); return new (Mem) OMPNontemporalClause(N); } +void OMPNontemporalClause::setPrivateRefs(ArrayRef<Expr *> VL) { + assert(VL.size() == varlist_size() && "Number of private references is not " + "the same as the preallocated buffer"); + std::copy(VL.begin(), VL.end(), varlist_end()); +} + //===----------------------------------------------------------------------===// // OpenMP clauses printing methods //===----------------------------------------------------------------------===// diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index 56a65e8deb9..2aa5106e90f 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -769,10 +769,13 @@ void OMPClauseProfiler::VisitOMPIsDevicePtrClause( const OMPIsDevicePtrClause *C) { VisitOMPClauseList(C); } -void OMPClauseProfiler::VisitOMPNontemporalClause(const OMPNontemporalClause *C) { +void OMPClauseProfiler::VisitOMPNontemporalClause( + const OMPNontemporalClause *C) { VisitOMPClauseList(C); + for (auto *E : C->private_refs()) + Profiler->VisitStmt(E); } -} +} // namespace void StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) { |

