本文整理汇总了C++中SgStatement::addToAttachedPreprocessingInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ SgStatement::addToAttachedPreprocessingInfo方法的具体用法?C++ SgStatement::addToAttachedPreprocessingInfo怎么用?C++ SgStatement::addToAttachedPreprocessingInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgStatement
的用法示例。
在下文中一共展示了SgStatement::addToAttachedPreprocessingInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertPreprocessingInfo
void BasicProgmemTransform::insertPreprocessingInfo(const std::string &data) {
SgGlobal *global = SageInterface::getFirstGlobalScope(project);
SgStatement *firstDecl = SageInterface::getFirstStatement(global);
PreprocessingInfo* result = new PreprocessingInfo(PreprocessingInfo::CpreprocessorIncludeDeclaration, data, "Transformation generated",0, 0, 0, PreprocessingInfo::before);
firstDecl->addToAttachedPreprocessingInfo(result, PreprocessingInfo::after);
}
示例2: switch
void
FixupSelfReferentialMacrosInAST::visit ( SgNode* node )
{
// DQ (3/11/2006): Set NULL pointers where we would like to have none.
// printf ("In FixupSelfReferentialMacrosInAST::visit(): node = %s \n",node->class_name().c_str());
ROSE_ASSERT(node != NULL);
switch (node->variantT())
{
case V_SgInitializedName:
{
SgInitializedName* initializedName = isSgInitializedName(node);
ROSE_ASSERT(initializedName != NULL);
SgType* type = initializedName->get_type()->stripType();
SgClassType* classType = isSgClassType(type);
if (classType != NULL)
{
SgClassDeclaration* targetClassDeclaration = isSgClassDeclaration(classType->get_declaration());
SgName className = targetClassDeclaration->get_name();
// printf ("In FixupSelfReferentialMacrosInAST::visit(): Found a class declaration name = %s \n",className.str());
if (className == "sigaction")
{
// printf ("In FixupSelfReferentialMacrosInAST::visit(): Found a sigaction type \n");
// Note we could also check that the declaration came from a known header file.
SgStatement* associatedStatement = isSgStatement(initializedName->get_parent());
if (associatedStatement != NULL)
{
// Add a macro to undefine the "#define sa_handler __sigaction_handler.sa_handler" macro.
// printf ("In FixupSelfReferentialMacrosInAST::visit(): Add a macro to undefine the macro #define sa_handler __sigaction_handler.sa_handler \n");
// PreprocessingInfo* macro = new PreprocessingInfo(DirectiveType, const std::string & inputString,const std::string & filenameString, int line_no , int col_no,int nol, RelativePositionType relPos );
PreprocessingInfo::DirectiveType directiveType = PreprocessingInfo::CpreprocessorUndefDeclaration;
std::string macroString = "#undef sa_handler\n";
std::string filenameString = "macro_call_fixupSelfReferentialMacrosInAST";
int line_no = 1;
int col_no = 1;
int nol = 1;
PreprocessingInfo::RelativePositionType relPos = PreprocessingInfo::before;
PreprocessingInfo* macro = new PreprocessingInfo(directiveType,macroString,filenameString,line_no,col_no,nol,relPos);
// printf ("Attaching CPP directive %s to IR node %p as attributes. \n",PreprocessingInfo::directiveTypeName(macro->getTypeOfDirective()).c_str(),associatedStatement);
associatedStatement->addToAttachedPreprocessingInfo(macro);
#if 0
printf ("Exiting as a test! \n");
ROSE_ASSERT(false);
#endif
}
}
}
}
default:
{
// printf ("Not handled in FixupSelfReferentialMacrosInAST::visit(%s) \n",node->class_name().c_str());
}
}
}