本文整理汇总了C++中SgInitializedName::addNewAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ SgInitializedName::addNewAttribute方法的具体用法?C++ SgInitializedName::addNewAttribute怎么用?C++ SgInitializedName::addNewAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgInitializedName
的用法示例。
在下文中一共展示了SgInitializedName::addNewAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Detection_InheritedAttribute
Detection_InheritedAttribute
DetectionTraversal::evaluateInheritedAttribute (SgNode* astNode, Detection_InheritedAttribute inheritedAttribute )
{
#if 0
printf ("In DetectionTraversal::evaluateInheritedAttribute(): astNode = %p = %s \n",astNode,astNode->class_name().c_str());
#endif
// DQ (2/3/2016): Recognize IR nodes that are representative of target DSL abstractions.
bool foundTargetDslAbstraction = DSL_Support::isDslAbstraction(astNode);
#if 1
printf ("In DetectionTraversal::evaluateInheritedAttribute(): astNode = %p = %s: foundTargetDslAbstraction = %s \n",astNode,astNode->class_name().c_str(),foundTargetDslAbstraction ? "true" : "false");
#endif
#if 0
// OLD CODE (represented by DSL_Support::isDslAbstraction() function).
// Detection of stencil declaration and stencil operator.
// Where the stencil specification is using std::vectors as parameters to the constructor, we have to first
// find the stencil declaration and read the associated SgVarRefExp to get the variable names used.
// Then a finite state machine can be constructed for each of the input variables so that we can
// interpret the state when the stencil operator is constructed.
SgVariableDeclaration* variableDeclaration = isSgVariableDeclaration(astNode);
if (variableDeclaration != NULL)
{
// Get the SgInitializedName from the SgVariableDeclaration.
SgInitializedName* initializedName = SageInterface::getFirstInitializedName(variableDeclaration);
SgType* base_type = initializedName->get_type()->findBaseType();
ROSE_ASSERT(base_type != NULL);
// SgClassType* classType = isSgClassType(initializedName->get_type());
SgClassType* classType = isSgClassType(base_type);
if (classType != NULL)
{
#if 1
printf ("In DetectionTraversal::evaluateInheritedAttribute(): case SgClassType: class name = %s \n",classType->get_name().str());
#endif
// Check if this is associated with a template instantiation.
SgTemplateInstantiationDecl* templateInstantiationDecl = isSgTemplateInstantiationDecl(classType->get_declaration());
if (templateInstantiationDecl != NULL)
{
#if 1
printf ("case SgTemplateInstaiationDecl: class name = %s \n",classType->get_name().str());
printf ("case SgTemplateInstaiationDecl: templateInstantiationDecl->get_templateName() = %s \n",templateInstantiationDecl->get_templateName().str());
#endif
// inheritedAttribute.set_StencilDeclaration(templateInstantiationDecl->get_templateName() == "Stencil");
// inheritedAttribute.set_StencilOperatorDeclaration(templateInstantiationDecl->get_templateName() == "StencilOperator");
if (templateInstantiationDecl->get_templateName() == "Stencil")
{
// DQ (2/8/2015): Ignore compiler generated IR nodes (from template instantiations, etc.).
// Note that simpleCNS.cpp generates one of these from it's use of the tuple template and associated template instantations.
// DQ: Test the DSL support.
ROSE_ASSERT(isMatchingClassType(classType,"Stencil",true) == true);
checkAndResetToMakeConsistantCompilerGenerated(initializedName);
if (initializedName->isCompilerGenerated() == false)
{
// Save the SgInitializedName associated with the stencil.
// stencilInitializedNameList.push_back(initializedName);
// inheritedAttribute.set_StencilDeclaration(true);
// foundStencilVariable = true;
#if 1
printf ("Detected Stencil<> typed variable: initializedName = %p name = %s \n",initializedName,initializedName->get_name().str());
// printf (" --- stencilInitializedNameList.size() = %zu \n",stencilInitializedNameList.size());
#endif
#if 1
initializedName->get_file_info()->display("In DetectionTraversal::evaluateInheritedAttribute(): initializedName : debug");
#endif
#if 0
Stencil_Attribute* dslAttribute = new Stencil_Attribute();
#if 1
printf ("Adding (Stencil) dslAttribute = %p \n",dslAttribute);
#endif
ROSE_ASSERT(dslAttribute != NULL);
// virtual void addNewAttribute (std::string s, AstAttribute *a);
initializedName->addNewAttribute(StencilVariable,dslAttribute);
#endif
}
}
}
SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
if (classDeclaration != NULL)
{
if (classDeclaration->get_name() == "Point")
{
// Save the SgInitializedName associated with the Point type.
#if 0
printf ("Detected Point<> typed variable: initializedName = %p name = %s \n",initializedName,initializedName->get_name().str());
#endif
checkAndResetToMakeConsistantCompilerGenerated(initializedName);
if (initializedName->isCompilerGenerated() == false)
{
//.........这里部分代码省略.........