本文整理汇总了C++中SgVariableDeclaration::get_decl_item方法的典型用法代码示例。如果您正苦于以下问题:C++ SgVariableDeclaration::get_decl_item方法的具体用法?C++ SgVariableDeclaration::get_decl_item怎么用?C++ SgVariableDeclaration::get_decl_item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgVariableDeclaration
的用法示例。
在下文中一共展示了SgVariableDeclaration::get_decl_item方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getExpectation
DeterminismState getExpectation(SgNode *ast, const char *varName)
{
SgName name(varName);
Rose_STL_Container<SgNode*> sdNodes = NodeQuery::querySubTree(ast, &name, NodeQuery::VariableDeclarationFromName);
if (sdNodes.size() != 1) {
cerr << "Didn't find target variable " << varName << " in list of size " << sdNodes.size() << endl;
for (Rose_STL_Container<SgNode*>::iterator i = sdNodes.begin(); i != sdNodes.end(); ++i)
cerr << "\t" << (*(isSgVariableDeclaration(*i)->get_variables().begin()))->get_name().str() << endl;
return QUESTIONABLE;
}
SgNode *nSd = *(sdNodes.begin());
SgVariableDeclaration *vdSd = dynamic_cast<SgVariableDeclaration *>(nSd);
if (!vdSd) {
cerr << "Node wasn't a variable declaration" << endl;
return QUESTIONABLE;
}
SgInitializedName *inSd = vdSd->get_decl_item(name);
SgAssignInitializer *aiSd = dynamic_cast<SgAssignInitializer*>(inSd->get_initializer());
if (!aiSd) {
cerr << "Couldn't pull an assignment initializer out" << endl;
return QUESTIONABLE;
}
SgIntVal *ivSd = dynamic_cast<SgIntVal*>(aiSd->get_operand());
if (!ivSd) {
cerr << "Assignment wasn't an intval" << endl;
return QUESTIONABLE;
}
int value = ivSd->get_value();
return value ? DETERMINISTIC : NONDETERMINISTIC;
}