本文整理汇总了C++中LabelSet::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelSet::insert方法的具体用法?C++ LabelSet::insert怎么用?C++ LabelSet::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LabelSet
的用法示例。
在下文中一共展示了LabelSet::insert方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getLabelSet
LabelSet Labeler::getLabelSet(set<SgNode*>& nodeSet) {
LabelSet lset;
for(set<SgNode*>::iterator i=nodeSet.begin();i!=nodeSet.end();++i) {
lset.insert(getLabel(*i));
}
return lset;
}
示例2:
LabelSet LabelSet::operator+(LabelSet& s2) {
LabelSet result;
result=*this;
for(LabelSet::iterator i2=s2.begin();i2!=s2.end();++i2)
result.insert(*i2);
return result;
}
示例3: targetLabels
LabelSet Flow::targetLabels() {
LabelSet s;
for(Flow::iterator i=begin();i!=end();++i) {
Edge e=*i;
s.insert(e.target);
}
return s;
}
示例4: sourceLabels
LabelSet Flow::sourceLabels() {
LabelSet s;
for(Flow::iterator i=begin();i!=end();++i) {
Edge e=*i;
s.insert(e.source);
}
return s;
}
示例5: labelSetOfIoOperations
LabelSet TransitionGraph::labelSetOfIoOperations(InputOutput::OpType op) {
LabelSet lset;
// the target node records the effect of the edge-operation on the source node.
for(TransitionGraph::iterator i=begin(); i!=end(); ++i) {
if((*i)->target->io.op==op) {
lset.insert((*i)->source->label());
}
}
return lset;
}
示例6: functionEntryLabels
LabelSet CFAnalysis::functionEntryLabels(Flow& flow) {
LabelSet resultSet;
LabelSet nodeLabels;
nodeLabels=flow.nodeLabels();
for(LabelSet::iterator i=nodeLabels.begin();i!=nodeLabels.end();++i) {
if(labeler->isFunctionEntryLabel(*i))
resultSet.insert(*i);
}
return resultSet;
}
示例7: setOfInitialLabelsOfStmtsInBlock
LabelSet CFAnalysis::setOfInitialLabelsOfStmtsInBlock(SgNode* node) {
LabelSet ls;
if(node==0)
return ls;
if(!isSgStatement(node)) {
cerr<<"ERROR: "<<node->class_name()<<endl;
}
size_t len=node->get_numberOfTraversalSuccessors();
for(size_t i=0;i<len;++i) {
SgNode* childNode=node->get_traversalSuccessorByIndex(i);
ls.insert(initialLabel(childNode));
}
return ls;
}
示例8: reachableNodesButNotBeyondTargetNode
// MS: will possibly be replaced with an implementation from the BOOST graph library
LabelSet Flow::reachableNodesButNotBeyondTargetNode(Label start, Label target) {
LabelSet reachableNodes;
LabelSet toVisitSet=succ(start);
size_t oldSize=0;
size_t newSize=0;
do {
LabelSet newToVisitSet;
for(LabelSet::iterator i=toVisitSet.begin();i!=toVisitSet.end();++i) {
LabelSet succSet=succ(*i);
for(LabelSet::iterator j=succSet.begin();j!=succSet.end();++j) {
if(reachableNodes.find(*j)==reachableNodes.end())
newToVisitSet.insert(*j);
}
}
toVisitSet=newToVisitSet;
oldSize=reachableNodes.size();
reachableNodes+=toVisitSet;
newSize=reachableNodes.size();
} while(oldSize!=newSize);
return reachableNodes;
}
示例9: finalLabels
LabelSet CFAnalysis::finalLabels(SgNode* node) {
assert(node);
assert(labeler->isLabelRelevantNode(node));
LabelSet finalSet;
// special case of incExpr in SgForStatement
if(SgNodeHelper::isForIncExpr(node)) {
finalSet.insert(labeler->getLabel(node));
return finalSet;
}
// special case of function call
if(SgNodeHelper::Pattern::matchFunctionCall(node)) {
if(SgNodeHelper::Pattern::matchReturnStmtFunctionCallExp(node)) {
finalSet.insert(labeler->functionCallReturnLabel(node)+1); // special case of function call in return-stmt
} else {
finalSet.insert(labeler->functionCallReturnLabel(node));
}
return finalSet;
}
switch (node->variantT()) {
// function declarations inside basic block
case V_SgFunctionDeclaration:
cerr<<"Error: icfg construction: function declarations are not associated with a label."<<endl;
exit(1);
//finalSet.insert(labeler->getLabel(node));
//return finalSet;
case V_SgFunctionDefinition: {
SgBasicBlock* body=isSgFunctionDefinition(node)->get_body();
return finalLabels(body);
}
case V_SgBreakStmt:
case V_SgContinueStmt:
return finalSet;
case V_SgReturnStmt:
return finalSet;
case V_SgNullStatement:
case V_SgPragmaDeclaration:
case V_SgLabelStatement:
case V_SgInitializedName:
case V_SgVariableDeclaration:
case V_SgDefaultOptionStmt:
case V_SgCaseOptionStmt:
case V_SgClassDeclaration:
finalSet.insert(labeler->getLabel(node));
return finalSet;
case V_SgExprStatement: {
finalSet.insert(labeler->getLabel(node));
return finalSet;
}
case V_SgIfStmt: {
SgNode* nodeTB=SgNodeHelper::getTrueBranch(node);
LabelSet finalSetTB=finalLabels(nodeTB);
finalSet+=finalSetTB;
if(SgNode* nodeFB=SgNodeHelper::getFalseBranch(node)) {
LabelSet finalSetFB=finalLabels(nodeFB);
finalSet+=finalSetFB;
} else {
// in case of an empty else branch the cond node becomes the final node
SgNode* condNode=SgNodeHelper::getCond(node);
finalSet.insert(labeler->getLabel(condNode));
}
return finalSet;
}
case V_SgForStatement:
case V_SgDoWhileStmt:
case V_SgWhileStmt: {
SgNode* condNode=SgNodeHelper::getCond(node);
finalSet.insert(labeler->getLabel(condNode));
set<SgNode*> breakNodes=SgNodeHelper::LoopRelevantBreakStmtNodes(node);
LabelSet lset=labeler->getLabelSet(breakNodes);
finalSet+=lset;
//cout << finalSet.toString() << endl;
return finalSet;
}
case V_SgBasicBlock: {
#if 0
finalSet.insert(labeler->blockEndLabel(node));
return finalSet;
#else
if(SgNodeHelper::numChildren(node)>0) {
SgNode* lastNode=SgNodeHelper::getLastOfBlock(node);
LabelSet s=finalLabels(lastNode);
finalSet+=s;
} else {
// empty basic block
finalSet.insert(initialLabel(node));
}
return finalSet;
#endif
}
case V_SgFunctionCallExp:
finalSet.insert(labeler->functionCallReturnLabel(node));
return finalSet;
case V_SgGotoStatement: {
// for the goto statement (as special case) the final set is empty. This allows all other functions
// operate correctly even in the presence of gotos. The edge for 'goto label' is created as part
// of the semantics of goto (and does not *require* the final labels).
return finalSet;
//.........这里部分代码省略.........
示例10: finalLabels
LabelSet CFAnalyzer::finalLabels(SgNode* node) {
assert(node);
assert(labeler->isLabelRelevantNode(node));
LabelSet finalSet;
// special case of incExpr in SgForStatement
if(SgNodeHelper::isForIncExpr(node)) {
finalSet.insert(labeler->getLabel(node));
return finalSet;
}
// special case of function call
if(SgNodeHelper::Pattern::matchFunctionCall(node)) {
if(SgNodeHelper::Pattern::matchReturnStmtFunctionCallExp(node)) {
finalSet.insert(labeler->functionCallReturnLabel(node)+1); // special case of function call in return-stmt
} else {
finalSet.insert(labeler->functionCallReturnLabel(node));
}
return finalSet;
}
switch (node->variantT()) {
// function declarations inside basic block
case V_SgFunctionDeclaration:
finalSet.insert(labeler->getLabel(node));
return finalSet;
case V_SgFunctionDefinition: {
SgBasicBlock* body=isSgFunctionDefinition(node)->get_body();
return finalLabels(body);
}
case V_SgBreakStmt:
return finalSet;
case V_SgReturnStmt:
return finalSet;
case V_SgNullStatement:
case V_SgLabelStatement:
case V_SgInitializedName:
case V_SgVariableDeclaration:
finalSet.insert(labeler->getLabel(node));
return finalSet;
case V_SgExprStatement: {
finalSet.insert(labeler->getLabel(node));
return finalSet;
}
case V_SgIfStmt: {
SgNode* nodeTB=SgNodeHelper::getTrueBranch(node);
LabelSet finalSetTB=finalLabels(nodeTB);
finalSet+=finalSetTB;
if(SgNode* nodeFB=SgNodeHelper::getFalseBranch(node)) {
LabelSet finalSetFB=finalLabels(nodeFB);
finalSet+=finalSetFB;
} else {
// in case of an empty else branch the cond node becomes the final node
SgNode* condNode=SgNodeHelper::getCond(node);
finalSet.insert(labeler->getLabel(condNode));
}
return finalSet;
}
case V_SgForStatement:
case V_SgDoWhileStmt:
case V_SgWhileStmt: {
SgNode* condNode=SgNodeHelper::getCond(node);
finalSet.insert(labeler->getLabel(condNode));
set<SgNode*> breakNodes=SgNodeHelper::LoopRelevantBreakStmtNodes(node);
LabelSet lset=labeler->getLabelSet(breakNodes);
finalSet+=lset;
cout << finalSet.toString() << endl;
return finalSet;
}
case V_SgBasicBlock: {
if(SgNodeHelper::numChildren(node)>0) {
SgNode* lastNode=SgNodeHelper::getLastOfBlock(node);
LabelSet s=finalLabels(lastNode);
finalSet+=s;
} else {
// empty basic block
finalSet.insert(initialLabel(node));
}
return finalSet;
}
case V_SgFunctionCallExp:
finalSet.insert(labeler->functionCallReturnLabel(node));
return finalSet;
default:
cerr << "Error: Unknown node in CodeThorn::CFAnalyzer::finalLabels: "<<node->sage_class_name()<<endl; exit(1);
}
}