本文整理汇总了C++中SgStatement::set_parent方法的典型用法代码示例。如果您正苦于以下问题:C++ SgStatement::set_parent方法的具体用法?C++ SgStatement::set_parent怎么用?C++ SgStatement::set_parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgStatement
的用法示例。
在下文中一共展示了SgStatement::set_parent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replaceMintForWithOmpFor
//note that we keep mint for pragma as well
//#pragma mint for
//#pragma omp for
void MintCudaMidend::replaceMintForWithOmpFor(SgSourceFile* file)
{
Rose_STL_Container<SgNode*> nodeList = NodeQuery::querySubTree(file, V_SgPragmaDeclaration);
Rose_STL_Container<SgNode*>::reverse_iterator nodeListIterator = nodeList.rbegin();
for ( ;nodeListIterator !=nodeList.rend(); ++nodeListIterator)
{
SgPragmaDeclaration* node = isSgPragmaDeclaration(*nodeListIterator);
ROSE_ASSERT(node != NULL);
//checks if the syntax is correct and the parallel region is followed by
//a basic block
if(MintPragmas::isForLoopPragma(node))
{
SgStatement* loop = getNextStatement(node);
ROSE_ASSERT(loop);
if(isSgForStatement(loop))
{
removeStatement(loop);
SgOmpForStatement* omp_stmt = new SgOmpForStatement(NULL, loop);
setOneSourcePositionForTransformation(omp_stmt);
loop->set_parent(omp_stmt);
insertStatementAfter(node, omp_stmt);
}
}
}
}
示例2: buildExprStatement
SgIfStmt *
RoseStatementsAndExpressionsBuilder::buildIfStatementWithEmptyElse (
SgExpression * ifGuard, SgScopeStatement * thenBlock)
{
using namespace SageBuilder;
using namespace SageInterface;
SgStatement * ifGuardStatement = buildExprStatement (ifGuard);
SgIfStmt * ifStatement = new SgIfStmt (ifGuardStatement, thenBlock, NULL);
ifStatement->setCaseInsensitive (true);
ifStatement->set_use_then_keyword (true);
ifStatement->set_has_end_statement (true);
setOneSourcePositionForTransformation (ifStatement);
ifGuardStatement->set_parent (ifStatement);
thenBlock->set_parent (ifStatement);
return ifStatement;
}