本文整理汇总了C++中SgStatement::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ SgStatement::setAttribute方法的具体用法?C++ SgStatement::setAttribute怎么用?C++ SgStatement::setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgStatement
的用法示例。
在下文中一共展示了SgStatement::setAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printf
FrontierDetectionForTokenStreamMapping_InheritedAttribute
FrontierDetectionForTokenStreamMapping::evaluateInheritedAttribute(SgNode* n, FrontierDetectionForTokenStreamMapping_InheritedAttribute inheritedAttribute)
{
static int random_counter = 0;
#if 1
// Ignore IR nodes that are front-end specific (declarations of builtin functions, etc.).
if (n->get_file_info()->isFrontendSpecific() == false)
{
printf ("In FrontierDetectionForTokenStreamMapping::evaluateInheritedAttribute(): n = %p = %s \n",n,n->class_name().c_str());
// Count the IR nodes traversed so that we can make a subset transformations.
random_counter++;
}
#endif
FrontierDetectionForTokenStreamMapping_InheritedAttribute returnAttribute;
SgStatement* statement = isSgStatement(n);
// if (statement != NULL && random_counter > 30 && random_counter < 40)
if (statement != NULL)
{
string name = "token_frontier";
string options = "color=\"blue\"";
if (random_counter > 30 && random_counter < 40)
{
printf ("In FrontierDetectionForTokenStreamMapping::evaluateInheritedAttribute(): Mark this statement as a transformation: random_counter = %d statement = %p = %s \n",random_counter,statement,statement->class_name().c_str());
options = "color=\"red\"";
returnAttribute.containsFrontier = true;
}
// AstAttribute::AttributeNodeInfo* attribute = new FrontierDetectionForTokenStreamMappingAttribute ( (SgNode*) n, name, options);
AstAttribute* attribute = new FrontierDetectionForTokenStreamMappingAttribute ( (SgNode*) n, name, options);
statement->setAttribute(name,attribute);
}
// return FrontierDetectionForTokenStreamMapping_InheritedAttribute();
return returnAttribute;
}