forked from OSchip/llvm-project
[C++11] Replacing OMPThreadPrivateDecl and OMPClause iterators varlist_begin() and varlist_end() with iterator_range varlists(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203937
This commit is contained in:
parent
fdbd8e05b2
commit
2205d2a56a
|
@ -1389,10 +1389,8 @@ DEF_TRAVERSE_DECL(UsingDirectiveDecl, {
|
||||||
DEF_TRAVERSE_DECL(UsingShadowDecl, { })
|
DEF_TRAVERSE_DECL(UsingShadowDecl, { })
|
||||||
|
|
||||||
DEF_TRAVERSE_DECL(OMPThreadPrivateDecl, {
|
DEF_TRAVERSE_DECL(OMPThreadPrivateDecl, {
|
||||||
for (OMPThreadPrivateDecl::varlist_iterator I = D->varlist_begin(),
|
for (auto *I : D->varlists()) {
|
||||||
E = D->varlist_end();
|
TRY_TO(TraverseStmt(I));
|
||||||
I != E; ++I) {
|
|
||||||
TRY_TO(TraverseStmt(*I));
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -2379,10 +2377,8 @@ bool DataRecursiveASTVisitor<Derived>::VisitOMPDefaultClause(OMPDefaultClause *C
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void DataRecursiveASTVisitor<Derived>::VisitOMPClauseList(T *Node) {
|
void DataRecursiveASTVisitor<Derived>::VisitOMPClauseList(T *Node) {
|
||||||
for (typename T::varlist_iterator I = Node->varlist_begin(),
|
for (auto *I : Node->varlists())
|
||||||
E = Node->varlist_end();
|
TraverseStmt(I);
|
||||||
I != E; ++I)
|
|
||||||
TraverseStmt(*I);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
|
|
|
@ -64,9 +64,18 @@ public:
|
||||||
|
|
||||||
typedef llvm::MutableArrayRef<Expr *>::iterator varlist_iterator;
|
typedef llvm::MutableArrayRef<Expr *>::iterator varlist_iterator;
|
||||||
typedef ArrayRef<const Expr *>::iterator varlist_const_iterator;
|
typedef ArrayRef<const Expr *>::iterator varlist_const_iterator;
|
||||||
|
typedef llvm::iterator_range<varlist_iterator> varlist_range;
|
||||||
|
typedef llvm::iterator_range<varlist_const_iterator> varlist_const_range;
|
||||||
|
|
||||||
unsigned varlist_size() const { return NumVars; }
|
unsigned varlist_size() const { return NumVars; }
|
||||||
bool varlist_empty() const { return NumVars == 0; }
|
bool varlist_empty() const { return NumVars == 0; }
|
||||||
|
|
||||||
|
varlist_range varlists() {
|
||||||
|
return varlist_range(varlist_begin(), varlist_end());
|
||||||
|
}
|
||||||
|
varlist_const_range varlists() const {
|
||||||
|
return varlist_const_range(varlist_begin(), varlist_end());
|
||||||
|
}
|
||||||
varlist_iterator varlist_begin() { return getVars().begin(); }
|
varlist_iterator varlist_begin() { return getVars().begin(); }
|
||||||
varlist_iterator varlist_end() { return getVars().end(); }
|
varlist_iterator varlist_end() { return getVars().end(); }
|
||||||
varlist_const_iterator varlist_begin() const { return getVars().begin(); }
|
varlist_const_iterator varlist_begin() const { return getVars().begin(); }
|
||||||
|
|
|
@ -110,9 +110,19 @@ protected:
|
||||||
public:
|
public:
|
||||||
typedef llvm::MutableArrayRef<Expr *>::iterator varlist_iterator;
|
typedef llvm::MutableArrayRef<Expr *>::iterator varlist_iterator;
|
||||||
typedef ArrayRef<const Expr *>::iterator varlist_const_iterator;
|
typedef ArrayRef<const Expr *>::iterator varlist_const_iterator;
|
||||||
|
typedef llvm::iterator_range<varlist_iterator> varlist_range;
|
||||||
|
typedef llvm::iterator_range<varlist_const_iterator> varlist_const_range;
|
||||||
|
|
||||||
unsigned varlist_size() const { return NumVars; }
|
unsigned varlist_size() const { return NumVars; }
|
||||||
bool varlist_empty() const { return NumVars == 0; }
|
bool varlist_empty() const { return NumVars == 0; }
|
||||||
|
|
||||||
|
varlist_range varlists() {
|
||||||
|
return varlist_range(varlist_begin(), varlist_end());
|
||||||
|
}
|
||||||
|
varlist_const_range varlists() const {
|
||||||
|
return varlist_const_range(varlist_begin(), varlist_end());
|
||||||
|
}
|
||||||
|
|
||||||
varlist_iterator varlist_begin() { return getVarRefs().begin(); }
|
varlist_iterator varlist_begin() { return getVarRefs().begin(); }
|
||||||
varlist_iterator varlist_end() { return getVarRefs().end(); }
|
varlist_iterator varlist_end() { return getVarRefs().end(); }
|
||||||
varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
|
varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
|
||||||
|
|
|
@ -1476,10 +1476,8 @@ DEF_TRAVERSE_DECL(UsingDirectiveDecl, {
|
||||||
DEF_TRAVERSE_DECL(UsingShadowDecl, { })
|
DEF_TRAVERSE_DECL(UsingShadowDecl, { })
|
||||||
|
|
||||||
DEF_TRAVERSE_DECL(OMPThreadPrivateDecl, {
|
DEF_TRAVERSE_DECL(OMPThreadPrivateDecl, {
|
||||||
for (OMPThreadPrivateDecl::varlist_iterator I = D->varlist_begin(),
|
for (auto *I : D->varlists()) {
|
||||||
E = D->varlist_end();
|
TRY_TO(TraverseStmt(I));
|
||||||
I != E; ++I) {
|
|
||||||
TRY_TO(TraverseStmt(*I));
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -2403,10 +2401,8 @@ bool RecursiveASTVisitor<Derived>::VisitOMPDefaultClause(OMPDefaultClause *C) {
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *Node) {
|
void RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *Node) {
|
||||||
for (typename T::varlist_iterator I = Node->varlist_begin(),
|
for (auto *I : Node->varlists())
|
||||||
E = Node->varlist_end();
|
TraverseStmt(I);
|
||||||
I != E; ++I)
|
|
||||||
TraverseStmt(*I);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
|
|
|
@ -279,10 +279,8 @@ void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
|
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
|
||||||
for (typename T::varlist_const_iterator I = Node->varlist_begin(),
|
for (auto *I : Node->varlists())
|
||||||
E = Node->varlist_end();
|
Profiler->VisitStmt(I);
|
||||||
I != E; ++I)
|
|
||||||
Profiler->VisitStmt(*I);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
|
void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
|
||||||
|
|
|
@ -2305,10 +2305,8 @@ Decl *TemplateDeclInstantiator::VisitClassScopeFunctionSpecializationDecl(
|
||||||
Decl *TemplateDeclInstantiator::VisitOMPThreadPrivateDecl(
|
Decl *TemplateDeclInstantiator::VisitOMPThreadPrivateDecl(
|
||||||
OMPThreadPrivateDecl *D) {
|
OMPThreadPrivateDecl *D) {
|
||||||
SmallVector<Expr *, 5> Vars;
|
SmallVector<Expr *, 5> Vars;
|
||||||
for (ArrayRef<Expr *>::iterator I = D->varlist_begin(),
|
for (auto *I : D->varlists()) {
|
||||||
E = D->varlist_end();
|
Expr *Var = SemaRef.SubstExpr(I, TemplateArgs).take();
|
||||||
I != E; ++I) {
|
|
||||||
Expr *Var = SemaRef.SubstExpr(*I, TemplateArgs).take();
|
|
||||||
assert(isa<DeclRefExpr>(Var) && "threadprivate arg is not a DeclRefExpr");
|
assert(isa<DeclRefExpr>(Var) && "threadprivate arg is not a DeclRefExpr");
|
||||||
Vars.push_back(Var);
|
Vars.push_back(Var);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6358,10 +6358,8 @@ OMPClause *
|
||||||
TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *C) {
|
TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *C) {
|
||||||
llvm::SmallVector<Expr *, 16> Vars;
|
llvm::SmallVector<Expr *, 16> Vars;
|
||||||
Vars.reserve(C->varlist_size());
|
Vars.reserve(C->varlist_size());
|
||||||
for (OMPPrivateClause::varlist_iterator I = C->varlist_begin(),
|
for (auto *I : C->varlists()) {
|
||||||
E = C->varlist_end();
|
ExprResult EVar = getDerived().TransformExpr(cast<Expr>(I));
|
||||||
I != E; ++I) {
|
|
||||||
ExprResult EVar = getDerived().TransformExpr(cast<Expr>(*I));
|
|
||||||
if (EVar.isInvalid())
|
if (EVar.isInvalid())
|
||||||
return 0;
|
return 0;
|
||||||
Vars.push_back(EVar.take());
|
Vars.push_back(EVar.take());
|
||||||
|
@ -6378,10 +6376,8 @@ TreeTransform<Derived>::TransformOMPFirstprivateClause(
|
||||||
OMPFirstprivateClause *C) {
|
OMPFirstprivateClause *C) {
|
||||||
llvm::SmallVector<Expr *, 16> Vars;
|
llvm::SmallVector<Expr *, 16> Vars;
|
||||||
Vars.reserve(C->varlist_size());
|
Vars.reserve(C->varlist_size());
|
||||||
for (OMPFirstprivateClause::varlist_iterator I = C->varlist_begin(),
|
for (auto *I : C->varlists()) {
|
||||||
E = C->varlist_end();
|
ExprResult EVar = getDerived().TransformExpr(cast<Expr>(I));
|
||||||
I != E; ++I) {
|
|
||||||
ExprResult EVar = getDerived().TransformExpr(cast<Expr>(*I));
|
|
||||||
if (EVar.isInvalid())
|
if (EVar.isInvalid())
|
||||||
return 0;
|
return 0;
|
||||||
Vars.push_back(EVar.take());
|
Vars.push_back(EVar.take());
|
||||||
|
@ -6397,10 +6393,8 @@ OMPClause *
|
||||||
TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *C) {
|
TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *C) {
|
||||||
llvm::SmallVector<Expr *, 16> Vars;
|
llvm::SmallVector<Expr *, 16> Vars;
|
||||||
Vars.reserve(C->varlist_size());
|
Vars.reserve(C->varlist_size());
|
||||||
for (OMPSharedClause::varlist_iterator I = C->varlist_begin(),
|
for (auto *I : C->varlists()) {
|
||||||
E = C->varlist_end();
|
ExprResult EVar = getDerived().TransformExpr(cast<Expr>(I));
|
||||||
I != E; ++I) {
|
|
||||||
ExprResult EVar = getDerived().TransformExpr(cast<Expr>(*I));
|
|
||||||
if (EVar.isInvalid())
|
if (EVar.isInvalid())
|
||||||
return 0;
|
return 0;
|
||||||
Vars.push_back(EVar.take());
|
Vars.push_back(EVar.take());
|
||||||
|
|
|
@ -1415,10 +1415,8 @@ void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) {
|
||||||
void ASTDeclWriter::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) {
|
void ASTDeclWriter::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) {
|
||||||
Record.push_back(D->varlist_size());
|
Record.push_back(D->varlist_size());
|
||||||
VisitDecl(D);
|
VisitDecl(D);
|
||||||
for (OMPThreadPrivateDecl::varlist_iterator I = D->varlist_begin(),
|
for (auto *I : D->varlists())
|
||||||
E = D->varlist_end();
|
Writer.AddStmt(I);
|
||||||
I != E; ++I)
|
|
||||||
Writer.AddStmt(*I);
|
|
||||||
Code = serialization::DECL_OMP_THREADPRIVATE;
|
Code = serialization::DECL_OMP_THREADPRIVATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1698,28 +1698,22 @@ void OMPClauseWriter::VisitOMPDefaultClause(OMPDefaultClause *C) {
|
||||||
void OMPClauseWriter::VisitOMPPrivateClause(OMPPrivateClause *C) {
|
void OMPClauseWriter::VisitOMPPrivateClause(OMPPrivateClause *C) {
|
||||||
Record.push_back(C->varlist_size());
|
Record.push_back(C->varlist_size());
|
||||||
Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record);
|
Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record);
|
||||||
for (OMPPrivateClause::varlist_iterator I = C->varlist_begin(),
|
for (auto *I : C->varlists())
|
||||||
E = C->varlist_end();
|
Writer->Writer.AddStmt(I);
|
||||||
I != E; ++I)
|
|
||||||
Writer->Writer.AddStmt(*I);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OMPClauseWriter::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) {
|
void OMPClauseWriter::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) {
|
||||||
Record.push_back(C->varlist_size());
|
Record.push_back(C->varlist_size());
|
||||||
Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record);
|
Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record);
|
||||||
for (OMPFirstprivateClause::varlist_iterator I = C->varlist_begin(),
|
for (auto *I : C->varlists())
|
||||||
E = C->varlist_end();
|
Writer->Writer.AddStmt(I);
|
||||||
I != E; ++I)
|
|
||||||
Writer->Writer.AddStmt(*I);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OMPClauseWriter::VisitOMPSharedClause(OMPSharedClause *C) {
|
void OMPClauseWriter::VisitOMPSharedClause(OMPSharedClause *C) {
|
||||||
Record.push_back(C->varlist_size());
|
Record.push_back(C->varlist_size());
|
||||||
Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record);
|
Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record);
|
||||||
for (OMPSharedClause::varlist_iterator I = C->varlist_begin(),
|
for (auto *I : C->varlists())
|
||||||
E = C->varlist_end();
|
Writer->Writer.AddStmt(I);
|
||||||
I != E; ++I)
|
|
||||||
Writer->Writer.AddStmt(*I);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
|
@ -1936,10 +1936,8 @@ void OMPClauseEnqueue::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void OMPClauseEnqueue::VisitOMPClauseList(T *Node) {
|
void OMPClauseEnqueue::VisitOMPClauseList(T *Node) {
|
||||||
for (typename T::varlist_const_iterator I = Node->varlist_begin(),
|
for (const auto *I : Node->varlists())
|
||||||
E = Node->varlist_end();
|
Visitor->AddStmt(I);
|
||||||
I != E; ++I)
|
|
||||||
Visitor->AddStmt(*I);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OMPClauseEnqueue::VisitOMPPrivateClause(const OMPPrivateClause *C) {
|
void OMPClauseEnqueue::VisitOMPPrivateClause(const OMPPrivateClause *C) {
|
||||||
|
|
Loading…
Reference in New Issue