本文整理汇总了C++中SgInitializedName::get_qualified_name方法的典型用法代码示例。如果您正苦于以下问题:C++ SgInitializedName::get_qualified_name方法的具体用法?C++ SgInitializedName::get_qualified_name怎么用?C++ SgInitializedName::get_qualified_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgInitializedName
的用法示例。
在下文中一共展示了SgInitializedName::get_qualified_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getInitName
/**********************************************************
* get the InitName for a sgNode
*********************************************************/
std::string DefUseAnalysis::getInitName(SgNode* sgNode){
SgInitializedName* initName = NULL;
string name = "none";
if (isSgVarRefExp(sgNode)) {
SgVarRefExp* varRefExp = isSgVarRefExp(sgNode);
initName = varRefExp->get_symbol()->get_declaration();
name = initName->get_qualified_name().str();
}
else if (isSgInitializedName(sgNode)) {
initName =isSgInitializedName(sgNode);
name = initName->get_qualified_name().str();
}
else {
name = sgNode->class_name();
}
return name;
}
示例2: printMultiMap
void DefUseAnalysis::printMultiMap(const multitype* multi) {
cout<<"\tmultitype element count:" << multi->size() <<endl;
for (multitype::const_iterator j = multi->begin(); j != multi->end(); ++j) {
SgInitializedName* sgInitMM = (*j).first;
SgNode* sgNodeMM = (*j).second;
ROSE_ASSERT(sgInitMM);
ROSE_ASSERT(sgNodeMM);
cout <<"\t"
<<sgInitMM->class_name()<<" "<<sgInitMM << " " << sgInitMM->get_qualified_name().str() <<
" id ( " << ToString(getIntForSgNode(sgInitMM)) <<" ) - ";
if (sgInitMM!=sgNodeMM)
cout <<sgNodeMM->class_name()<<" "<<sgNodeMM <<
" id ( " << ToString(getIntForSgNode(sgNodeMM)) <<" ) "<< endl;
else
cout << "same self node" <<endl;
}
}
示例3: runCurrentFile
void runCurrentFile(vector<string> &argvList, bool debug, bool debug_map) {
// Build the AST used by ROSE
if (debug)
std::cout << ">>>> Starting ROSE frontend ... " << endl;
SgProject* project = frontend(argvList);
if (debug)
std::cout << ">>>> generate PDF " << endl;
generatePDF ( *project );
if (debug)
std::cout << ">>>> start def-use analysis ... " << endl;
// Call the Def-Use Analysis
DFAnalysis* defuse = new DefUseAnalysis(project);
int val = defuse->run(debug);
if (debug)
std::cout << "Analysis is : " << (val ? "failure" : "success" ) << " " << val <<std::endl;
if (val==1) exit(1);
if (debug==false)
defuse->dfaToDOT();
//example usage
// testing
NodeQuerySynthesizedAttributeType vars = NodeQuery::querySubTree(project, V_SgInitializedName);
NodeQuerySynthesizedAttributeType::const_iterator i = vars.begin();
for (; i!=vars.end();++i) {
SgInitializedName* initName = isSgInitializedName(*i);
std::string name = initName->get_qualified_name().str();
vector<SgNode* > vec = defuse->getDefFor(initName, initName);
if (vec.size()>0)
if (debug)
std::cout << " DEF>> Vector entries for " << name << " ( " <<
initName << " ) : " << vec.size() << std::endl;
}
// testing
vars = NodeQuery::querySubTree(project, V_SgReturnStmt);
i = vars.begin();
typedef std::vector <std::pair <SgInitializedName*, SgNode* > > maptype;
for (; i!=vars.end();++i) {
SgReturnStmt* ret = isSgReturnStmt(*i);
ROSE_ASSERT(ret);
maptype map = defuse->getUseMultiMapFor(ret);
maptype::const_iterator j;
j = map.begin();
for (; j!=map.end();++j) {
SgInitializedName* initName = isSgInitializedName(j->first);
ROSE_ASSERT(initName);
std::string name = initName->get_qualified_name().str();
vector<SgNode* > vec = defuse->getUseFor(ret, initName);
if (vec.size()>0)
std::cout << " USE>> Vector entries for " << name << " ( " <<
ret << " ) : " << vec.size() << std::endl;
}
}
// print resulting table
if (debug_map) {
cout << "\nDEFMAP" << endl;
defuse->printDefMap();
cout << "\nUSEMAP" << endl;
defuse->printUseMap();
}
delete project;
delete defuse;
}