/// \brief Process clauses with list of variables.
template <typename T> bool VisitOMPClauseList(T *Node);
- bool dataTraverse(Stmt *S);
bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue);
};
-template <typename Derived>
-bool RecursiveASTVisitor<Derived>::dataTraverse(Stmt *S) {
- SmallVector<Stmt*, 16> Queue;
- Queue.push_back(S);
-
- while (!Queue.empty()) {
- Stmt *CurrS = Queue.pop_back_val();
-
- size_t N = Queue.size();
- TRY_TO(dataTraverseNode(CurrS, &Queue));
- // Process new children in the order they were added.
- std::reverse(Queue.begin() + N, Queue.end());
- }
-
- return true;
-}
-
template <typename Derived>
bool RecursiveASTVisitor<Derived>::dataTraverseNode(Stmt *S,
DataRecursionQueue *Queue) {
&RecursiveASTVisitor::TraverseStmt>::value)
return dataTraverseNode(S, nullptr);
- if (!Queue)
- return dataTraverse(S);
+ if (Queue) {
+ Queue->push_back(S);
+ return true;
+ }
+
+ SmallVector<Stmt *, 8> LocalQueue;
+ LocalQueue.push_back(S);
+
+ while (!LocalQueue.empty()) {
+ Stmt *CurrS = LocalQueue.pop_back_val();
+
+ size_t N = LocalQueue.size();
+ TRY_TO(dataTraverseNode(CurrS, &LocalQueue));
+ // Process new children in the order they were added.
+ std::reverse(LocalQueue.begin() + N, LocalQueue.end());
+ }
- Queue->push_back(S);
return true;
}