本文整理汇总了C++中SgStatement::getAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ SgStatement::getAttribute方法的具体用法?C++ SgStatement::getAttribute怎么用?C++ SgStatement::getAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgStatement
的用法示例。
在下文中一共展示了SgStatement::getAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isSgStatement
ClastToSage::ClastToSage(SgScopeStatement* scopScope,
clast_stmt* root,
scoplib_scop_p scoplibScop,
PolyRoseOptions& options)
{
//SgScopeStatement* scope = isSgScopeStatement((SgNode*) scoplibScop->usr);
_polyoptions = options;
SgScopeStatement* scope = scopScope;
ROSE_ASSERT(scope);
m_scopRoot = NULL;
/// OLD:
m_scope = scope;
m_scoplib_scop = scoplibScop;
m_verbose = _polyoptions.isVerbose();
// 0- Retrive meta information stored as an annotation of the
// SageAST root.
SgStatement* scopRoot = isSgStatement((SgNode*)(scoplibScop->usr));
ScopRootAnnotation* annot =
(ScopRootAnnotation*)(scopRoot->getAttribute("ScopRoot"));
ROSE_ASSERT(annot);
_fakeSymbolMap = annot->fakeSymbolMap;
// 1- Collect all iterators in the clast. They are of the from 'cXX'
// where XX is an integer.
_scoplibIterators = collectAllIterators(root);
// 2- Map clast iterator to new variables that does not conflict
// with existing names, and register the symbols in the symbol
// table.
_sageIterators = createNewIterators(_scoplibIterators, scope);
// 3- Create the basic block containing the transformed scop.
SgBasicBlock* bb = buildBasicBlock(root);
// 4- Update the variable scope with the new bb, and insert the
// declaration statement in the AST.
std::map<const char*, SgVariableDeclaration*>::iterator iter;
Rose_STL_Container<SgNode*> varRefs =
NodeQuery::querySubTree(bb,V_SgVarRefExp);
for(iter = _sageIterators.begin(); iter != _sageIterators.end(); ++iter)
{
// Deal with the symbol tables.
SgInitializedNamePtrList& l = iter->second->get_variables();
for (SgInitializedNamePtrList::iterator i = l.begin(); i != l.end(); i++)
{
(*i)->set_scope(bb);
SgVariableSymbol* sym = new SgVariableSymbol(*i);
bb->insert_symbol((*i)->get_name(), sym);
// Ugly hack: replace the old symbol with the new entry in
// the symbol table.
for (Rose_STL_Container<SgNode *>::iterator j = varRefs.begin();
j != varRefs.end(); j++)
{
SgVarRefExp *vRef = isSgVarRefExp((*j));
if (vRef->get_symbol()->get_name() == (*i)->get_name())
vRef->set_symbol(sym);
}
}
// Insert the declaration statement in the BB.
bb->prepend_statement(iter->second);
}
// Post-process for pragma insertion.
if (options.getGeneratePragmas())
insertPragmas(bb);
m_scopRoot = bb;
}