本文整理汇总了C++中TreeVisitor::traverse方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeVisitor::traverse方法的具体用法?C++ TreeVisitor::traverse怎么用?C++ TreeVisitor::traverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeVisitor
的用法示例。
在下文中一共展示了TreeVisitor::traverse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
if (isVariableDeclaration == NULL)
{
/*
* ======================================================
* Do not append use statement, because other subroutines
* are directly appended to the CUDA module
* ======================================================
*/
SgUseStatement * isUseStmt = isSgUseStatement ( *it );
if (isUseStmt != NULL)
{
Debug::getInstance ()->debugMessage (
"Not appending use statement",
Debug::HIGHEST_DEBUG_LEVEL, __FILE__, __LINE__);
}
else
{
Debug::getInstance ()->debugMessage (
"Appending (non-variable-declaration) statement",
Debug::HIGHEST_DEBUG_LEVEL, __FILE__, __LINE__);
appendStatement (*it, subroutineScope);
/*
* ======================================================
* Recursively look for subroutine calls inside shallow
* nodes in the routines (e.g. when a call is inside an
* if). After the visit get the generated vector of names
* and append it to the userSubroutine vector
* ======================================================
*/
TreeVisitor * visitor = new TreeVisitor ();
visitor->traverse (*it, preorder);
Debug::getInstance ()->debugMessage ("Appending deep subroutine calls", Debug::OUTER_LOOP_LEVEL, __FILE__, __LINE__);
vector < SgProcedureHeaderStatement * > deepStatementCalls = visitor->getCalledRoutinesInStatement ();
vector < SgProcedureHeaderStatement * >::iterator itDeepCalls;
for (itDeepCalls = deepStatementCalls.begin(); itDeepCalls != deepStatementCalls.end(); ++itDeepCalls)
calledRoutines.push_back (*itDeepCalls);
Debug::getInstance ()->debugMessage ("Appending deep subroutine calls", Debug::OUTER_LOOP_LEVEL, __FILE__, __LINE__);
}
}
else
{
Debug::getInstance ()->debugMessage ("Appending variable declaration",
Debug::HIGHEST_DEBUG_LEVEL, __FILE__, __LINE__);
unsigned int OP_DAT_ArgumentGroup = 1;
for (SgInitializedNamePtrList::iterator variableIt =
isVariableDeclaration->get_variables ().begin (); variableIt
!= isVariableDeclaration->get_variables ().end (); ++variableIt)
{
string const variableName = (*variableIt)->get_name ().getString ();
SgType * type = (*variableIt)->get_typeptr ();
/*
* ======================================================
* Specification of "value" attribute is only
* for user kernels. Our call convention is that
* in all deeper level calls we always pass parameters