当前位置: 首页>>代码示例>>C++>>正文


C++ SgVariableDeclaration::isTransformation方法代码示例

本文整理汇总了C++中SgVariableDeclaration::isTransformation方法的典型用法代码示例。如果您正苦于以下问题:C++ SgVariableDeclaration::isTransformation方法的具体用法?C++ SgVariableDeclaration::isTransformation怎么用?C++ SgVariableDeclaration::isTransformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SgVariableDeclaration的用法示例。


在下文中一共展示了SgVariableDeclaration::isTransformation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: isSgVariableDeclaration

void
TypeTransformation::visit ( SgNode* astNode )
{
    SgVariableDeclaration* variableDeclaration = isSgVariableDeclaration(astNode);
    if (variableDeclaration != NULL)
    {
#if 0
        // One way to know where you are when your doing a transformation (debugging).
        printf ("Found a variable decaration: \n");
        variableDeclaration->get_file_info()->display("Found a variable decaration");
#endif
        SgInitializedNamePtrList & varList = variableDeclaration->get_variables();
        SgInitializedNamePtrList::iterator i = varList.begin();

        bool transformed = false;

        // Iterate over the SgInitializedName objects.
        while (i != varList.end())
        {
            SgPointerType* pointerType = isSgPointerType((*i)->get_type());
            if (pointerType != NULL)
            {
                // Types are shared, so don't modify the types directly, but point to a new type.
                (*i)->set_type(SageBuilder::buildRestrictType((*i)->get_type()));
#if 1
                printf ("In TypeTransformation::visit(): Calling setTransformation on SgInitializedName: i = %p = %s \n",*i,(*i)->get_name().str());
#endif
                // DQ (4/14/2015): Explicitly set this as containing a transformation (we might want
                // to alternatively fixup the token-based unparsing frontier tests to triggered based
                // on the setting of the isModified flag in each IR node.
                // (*i)->set_containsTransformation(true);
                // (*i)->setTransformation();

                transformed = true;
            }

            i++;
        }

        if (transformed == true)
        {
#if 0
            // DQ (4/16/2015): That this can be commented out means that we have general support in place to
            // interpret transformations from status of the isModified flags that are set by all of the
            // set_* access functions.  This interpretation of the isModified flag status to explicitly
            // mark transformations is handled in the function:
            // SimpleFrontierDetectionForTokenStreamMapping::evaluateInheritedAttribute()
            // in file: simpleFrontierDetection.C

            // DQ (4/14/2015): Mark the SgVariableDeclaration as being a transformation.
            variableDeclaration->setTransformation();

            // Also set to be output in the generated code.
            variableDeclaration->setOutputInCodeGeneration();

            // By definition: for this to be a transformation it cannot also contain a transforamtion.
            ROSE_ASSERT(variableDeclaration->get_containsTransformation() == false);
            ROSE_ASSERT(variableDeclaration->isTransformation() == true);
#endif
        }
    }
}
开发者ID:alexjohn1362,项目名称:rose,代码行数:62,代码来源:testTypeTransformation.C


注:本文中的SgVariableDeclaration::isTransformation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。