本文整理汇总了C++中NodeQuerySynthesizedAttributeType::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeQuerySynthesizedAttributeType::erase方法的具体用法?C++ NodeQuerySynthesizedAttributeType::erase怎么用?C++ NodeQuerySynthesizedAttributeType::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeQuerySynthesizedAttributeType
的用法示例。
在下文中一共展示了NodeQuerySynthesizedAttributeType::erase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testOneFunction
void testOneFunction( std::string funcParamName,
vector<string> argvList,
bool debug, int nrOfNodes,
multimap <int, vector<string> > resultsIn,
multimap <int, vector<string> > resultsOut) {
cout << " \n\n------------------------------------------\nrunning (variable)... " << argvList[1] << endl;
// Build the AST used by ROSE
SgProject* project = frontend(argvList);
// Call the Def-Use Analysis
DFAnalysis* defuse = new DefUseAnalysis(project);
int val = defuse->run(debug);
if (debug)
std::cerr << ">Analysis run is : " << (val ? "failure" : "success" ) << " " << val << std::endl;
if (val==1) exit(1);
if (debug==false)
defuse->dfaToDOT();
LivenessAnalysis* liv = new LivenessAnalysis(debug,(DefUseAnalysis*)defuse);
std::vector <FilteredCFGNode < IsDFAFilter > > dfaFunctions;
NodeQuerySynthesizedAttributeType vars = NodeQuery::querySubTree(project, V_SgFunctionDefinition);
NodeQuerySynthesizedAttributeType::const_iterator i = vars.begin();
bool abortme=false;
int hitIn=0;
int hitOut=0;
for (; i!=vars.end();++i) {
SgFunctionDefinition* func = isSgFunctionDefinition(*i);
std::string name = func->class_name();
string funcName = func->get_declaration()->get_qualified_name().str();
if (debug)
cerr << " .. running live analysis for func : " << funcName << endl;
FilteredCFGNode <IsDFAFilter> rem_source = liv->run(func,abortme);
if (abortme)
break;
if (funcName!=funcParamName) {
if (debug)
cerr << " .. skipping live analysis check for func : " << funcName << endl;
continue;
}
if (rem_source.getNode()!=NULL)
dfaFunctions.push_back(rem_source);
NodeQuerySynthesizedAttributeType nodes = NodeQuery::querySubTree(func, V_SgNode);
// Edg3 mistakenly adds SgType nodes to the AST; Edg4 adds some also, but fewer. So we just remove them all. They
// make no difference in the variable-liveness analysis anyway.
nodes.erase(std::remove_if(nodes.begin(), nodes.end(), is_type_node), nodes.end());
SgFunctionDeclaration* decl = isSgFunctionDeclaration(func->get_declaration());
ROSE_ASSERT(decl);
Rose_STL_Container<SgInitializedName*> args = decl->get_parameterList()->get_args();
if (debug)
cerr <<"Found args : " << args.size() << endl;
Rose_STL_Container<SgInitializedName*>::const_iterator it = args.begin();
for (;it!=args.end();++it) {
nodes.push_back(*it);
}
if((int)nodes.size()-1!=nrOfNodes) {
cerr << "Error :: Number of nodes = " << nodes.size()-1 << " should be : " << nrOfNodes << endl;
exit(1);
} else {
if (debug)
cerr << "Investigating nodes : " << nodes.size() << endl;
}
NodeQuerySynthesizedAttributeType::const_iterator nodesIt = nodes.begin();
for (; nodesIt!=nodes.end();++nodesIt) {
SgNode* node = *nodesIt;
ROSE_ASSERT(node);
int tableNr = defuse->getIntForSgNode(node);
std::vector<SgInitializedName*> in = liv->getIn(node);
std::vector<SgInitializedName*> out = liv->getOut(node);
std::vector<string> inName;
std::vector<string> outName;
std::vector<SgInitializedName*>::const_iterator itv = in.begin();
for (;itv!=in.end();++itv) {
SgInitializedName* init = *itv;
string name = init->get_name();
inName.push_back(name);
}
itv = out.begin();
for (;itv!=out.end();++itv) {
SgInitializedName* init = *itv;
string name = init->get_name();
outName.push_back(name);
}
std::sort(inName.begin(), inName.end());
std::sort(outName.begin(), outName.end());
multimap <int, vector<string> >::const_iterator k =resultsIn.begin();
for (;k!=resultsIn.end();++k) {
int resNr = k->first;
vector<string> results = k->second;
if (debug)
cerr << " ... containing nodes : " << results.size() << " node: " << node->class_name()
<< " tableNr : " << tableNr
<< " resNr : " << resNr << endl;
//.........这里部分代码省略.........