本文整理汇总了C++中Sg_File_Info::get_col方法的典型用法代码示例。如果您正苦于以下问题:C++ Sg_File_Info::get_col方法的具体用法?C++ Sg_File_Info::get_col怎么用?C++ Sg_File_Info::get_col使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sg_File_Info
的用法示例。
在下文中一共展示了Sg_File_Info::get_col方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: preOrderVisit
void PreAndPostOrderTraversal::preOrderVisit(SgNode* n) {
SgFunctionDeclaration * dec = isSgFunctionDeclaration(n);
if (dec != NULL) {
cout << "Found function declaration " << dec->get_name().getString();
Sg_File_Info * start = dec->get_startOfConstruct();
Sg_File_Info * end = dec->get_endOfConstruct();
if(start->isCompilerGenerated()) {
cout << ", which is compiler-generated" << endl;
} else {
cout << " in file " << start->get_raw_filename() << ", " << start->get_file_id() << " from line " <<
start->get_line() << ", col " << start->get_col() << " to line " <<
end->get_line() << ", col " << end->get_col() << endl;
}
SgFunctionType * type = dec->get_type();
SgType * retType = type->get_return_type();
cout << "Return type: " << retType->unparseToString() << endl;
SgFunctionParameterList * params = dec->get_parameterList();
SgInitializedNamePtrList & ptrList = params->get_args();
if(!ptrList.empty()) {
cout << "Parameter types: ";
for(SgInitializedNamePtrList::iterator j = ptrList.begin(); j != ptrList.end(); j++) {
SgType * pType = (*j)->get_type();
cout << pType->unparseToString() << " ";
}
cout << endl;
}
cout << "Linkage: " << dec->get_linkage() << endl;
cout << endl;
}
SgFunctionDefinition * def = isSgFunctionDefinition(n);
if (def != NULL) {
cout << "Found function definition " << def->get_declaration()->get_name().getString();
Sg_File_Info * start = def->get_startOfConstruct();
Sg_File_Info * end = def->get_endOfConstruct();
if(start->isCompilerGenerated()) {
cout << ", which is compiler-generated" << endl;
} else {
cout << " in file " << start->get_raw_filename() << " from line " << start->get_line() << ", col " << start->get_col() << " to line " << end->get_line() << ", col " << end->get_col() << endl;
SgBasicBlock * body = def->get_body();
Sg_File_Info * bodyStart = body->get_startOfConstruct();
Sg_File_Info * bodyEnd = body->get_endOfConstruct();
cout << "Function body from line " << bodyStart->get_line() << ", col " << bodyStart->get_col() << " to line " << bodyEnd->get_line() << ", col " << bodyEnd->get_col() << endl;
}
cout << endl;
}
}
示例2: switch
FindSmallestStatementsInh
FindSmallestStatements::evaluateInheritedAttribute(SgNode* n, FindSmallestStatementsInh inheritedAttribute)
{
//If the node should be consired as a topmost node
if(inheritedAttribute.inSubtreeOfStatement == false && isSgLocatedNode(n))
{
Sg_File_Info* thisNodePos = n->get_file_info();
#if 0
std::string pos;
thisNodePos->display(pos);
std::cerr << "************************\n";
std::cerr << "NodePosDisp " << n->class_name() << pos << std::endl;
std::cerr << "************************\n";
#endif
//If positions are the same add to list of statements
switch(n->variantT())
{
case V_SgExprStatement:
std::cout << "Skipping this node" << std::endl;
break;
default:
{
if( macroCallInfo->get_file_id() == thisNodePos->get_file_id() &&
macroCallInfo->get_line() == thisNodePos->get_line() &&
macroCallInfo->get_col() == thisNodePos->get_col()
)
{
if( find_all == false )
inheritedAttribute.inSubtreeOfStatement = true;
matchingCalls.push_back(n);
}
break;
}
}
}
return inheritedAttribute;
}
示例3: isSgLocatedNode
/** Show an error message about a node. */
static void
emit_node_mesg(SgNode *node, const std::string &mesg="")
{
Sg_File_Info *loc = isSgLocatedNode(node) ? isSgLocatedNode(node)->get_startOfConstruct() : NULL;
std::string filename = loc ? loc->get_filenameString() : "__UNKNOWN_FILE__";
int lno = loc ? loc->get_line() : 0;
int cno = loc ? loc->get_col() : 0;
std::cerr <<filename <<":" <<lno <<"." <<cno <<": " <<(mesg.empty() ? "error" : mesg) <<"\n";
}
示例4:
std::ostream &operator<<(std::ostream &os, SgNode *node)
{
os << node->class_name();
if (SgLocatedNode *ln = isSgLocatedNode(node))
{
Sg_File_Info *fi = ln->get_file_info();
os << "(" << fi->get_filename() << ":" << fi->get_line() << ":" << fi->get_col() << ") ";
}
os << node->unparseToCompleteString();
return os;
}
示例5:
void
createMap::printNodeToTokenMap()
{
#ifndef USE_ROSE
#ifndef ROSE_SKIP_COMPILATION_OF_WAVE
// If we are using ROSE to compile ROSE source code then the Wave support is not present.
std::cout << "BEGIN printing node to token map" << std::endl;
std::cout << "SIZE: " << nodeToTokenMap.size() << std::endl;
for(map<SgNode*,std::pair<int,int> >::iterator map_it = nodeToTokenMap.begin();
map_it != nodeToTokenMap.end(); ++map_it ){
Sg_File_Info* fileInfo = map_it->first->get_file_info();
token_type currentBeginToken = tokenStream[map_it->second.first];
token_type currentEndToken = tokenStream[map_it->second.second];
string nodeFilename = fileInfo->get_filenameString();
int nodeLine = fileInfo->get_line();
int nodeColumn = fileInfo->get_col();
std::cout << "Position of node is filename " << nodeFilename << " line "
<< nodeLine << " column " << nodeColumn << std::endl;
string beginTokenFilename = currentBeginToken.get_position().get_file().c_str();
int beginTokenLine = currentBeginToken.get_position().get_line();
int beginTokenColumn = currentBeginToken.get_position().get_column();
std::cout << "Begin position of token is filename " << beginTokenFilename << " line "
<< beginTokenLine << " column " << beginTokenColumn << std::endl;
string endTokenFilename = currentEndToken.get_position().get_file().c_str();
int endTokenLine = currentEndToken.get_position().get_line();
int endTokenColumn = currentEndToken.get_position().get_column();
std::cout << "End position of token is filename " << endTokenFilename << " line "
<< endTokenLine << " column " << endTokenColumn << std::endl;
std::cout << std::endl;
};
std::cout << "END printing node to token map" << std::endl;
#endif
#endif
}
示例6:
string
AstPDFGeneration_private::get_bookmark_name(SgNode* node)
{
string nodefilename="--not initialized--";
string bookmarktext;
{
ostringstream ss;
ss << node->sage_class_name() << " ";
SgLocatedNode* sgLocNode = dynamic_cast<SgLocatedNode*> (node);
if(sgLocNode)
{
Sg_File_Info* fi = sgLocNode->get_file_info();
if(fi)
{
// ss << "(" << fi->get_line() << "," << fi->get_col() << ") in \"" << fi->get_filename() << "\"";
// nodefilename=string(fi->get_filename());
#if 1
// if (fi->isCompilerGenerated())
// ss << " compilerGenerated ";
if (fi->isTransformation())
ss << " transformation " ;
if (fi->isOutputInCodeGeneration())
ss<< " unparsable ";
ss << "(" << fi->get_line() << "," << fi->get_col() << ") in \"" << fi->get_filename() << "\"";
#endif
nodefilename=string(fi->get_filename());
}
else
{
ss << "(BUG)";
}
}
else
{
ss << ""; // provide no explicit info about the lack of file_info
}
bookmarktext=ss.str();
}
return bookmarktext;
}
示例7: isSgDeclarationStatement
void
AstPDFGeneration_private::edit_page(size_t pageNumber, SgNode* node, PDFInheritedAttribute inheritedValue)
{
// JW (added by DQ 7/23/2004): Adds address of each IR node to the top of the page
HPDF_Page_SetRGBFill(currentPage, 1, 0, 0);
// DQ (1/20/2006): Modified for 64 bit machines
// ostringstream _ss; _ss << "0x" << std::hex << (int)node;
ostringstream _ss;
_ss << "pointer:" << std::hex << node;
HPDF_Page_ShowTextNextLine(currentPage, _ss.str().c_str());
// Liao, 2/11/2009, move some essential information from bookmark into the page also
// since some deep levels of bookmarks cannot display long lines properly by acrobat reader
HPDF_Page_ShowTextNextLine(currentPage, node->sage_class_name());
SgLocatedNode* sgLocNode = dynamic_cast<SgLocatedNode*> (node);
if(sgLocNode)
{
Sg_File_Info* fi = sgLocNode->get_file_info();
ostringstream temp;
temp<<fi->get_filename()<<" "<<fi->get_line()<<":"<<fi->get_col();
if(fi)
HPDF_Page_ShowTextNextLine(currentPage,temp.str().c_str());
if (fi->isTransformation())
HPDF_Page_ShowTextNextLine(currentPage,"IsTransformation:1");
else
HPDF_Page_ShowTextNextLine(currentPage,"IsTransformation:0");
if (fi->isOutputInCodeGeneration())
HPDF_Page_ShowTextNextLine(currentPage,"IsOutputInCodeGeneration:1");
else
HPDF_Page_ShowTextNextLine(currentPage,"IsOutputInCodeGeneration:0");
}
if (isSgDeclarationStatement(node))
{
HPDF_Page_ShowTextNextLine(currentPage, ("Declaration mangled name: " + isSgDeclarationStatement(node)->get_mangled_name().getString()).c_str());
#if 0 // not necessary, p_name field gives the similar information
if (isSgDeclarationStatement(node)->hasAssociatedSymbol())
{
SgSymbol *symbol = isSgDeclarationStatement(node)->get_symbol_from_symbol_table ();
if (symbol)
HPDF_Page_ShowTextNextLine(currentPage, ("Symbol name: " + symbol->get_name().getString()).c_str());
}
#endif
}
// JW hack to show expression types
if (isSgExpression(node))
HPDF_Page_ShowTextNextLine(currentPage, ("Expression type: " + isSgExpression(node)->get_type()->unparseToString()).c_str());
HPDF_Page_SetRGBFill(currentPage, 0, 1, 0);
if (inheritedValue.parentPage==NULL)
{
HPDF_Page_ShowTextNextLine(currentPage, "");
HPDF_Page_ShowTextNextLine(currentPage, " root node");
}
else
{
HPDF_Page_ShowTextNextLine(currentPage, "");
HPDF_Page_ShowTextNextLine(currentPage, " ");
create_textlink("Click here to go to the parent node", inheritedValue.parentPage, 9);
}
HPDF_Page_ShowTextNextLine(currentPage, "");
HPDF_Page_ShowTextNextLine(currentPage, "");
// generate RTI information for SgNode
{
RTIReturnType rti=node->roseRTI();
for(RTIReturnType::iterator i=rti.begin(); i<rti.end(); i++)
{
if (strlen(i->type) >= 7 &&
strncmp(i->type, "static ", 7) == 0) {
continue; // Skip static members
}
HPDF_Page_SetRGBFill(currentPage, 0.5, 0, 0.1);
HPDF_Page_ShowTextNextLine(currentPage, i->type);
HPDF_Page_ShowText(currentPage, " ");
HPDF_Page_SetRGBFill(currentPage, 0.0, 0.5, 0.5);
HPDF_Page_ShowText(currentPage, i->name);
HPDF_Page_ShowText(currentPage, " : ");
HPDF_Page_SetRGBFill(currentPage, 0.0, 0.0, 0.0);
string value=i->value;
if (value.size() >= 80) { // HPDF doesn't like strings > 64k, and we probably shouldn't be trying to print them anyway; this trims things to a reasonable length
value = "<too long>: " + value.substr(0, 80);
}
if (value.size() >= 80) {
value = "<too long>: " + value.substr(0, 80);
}
AstNodeVisitMapping::MappingType::iterator mapit;
// ensure that mapping value exists (otherwise it would be added to the map)
// and decide whether to create a link to a page (representing a node) or not
mapit=addrPageMapping.find(value);
if (mapit!=addrPageMapping.end())
{
size_t destPageNum = mapit->second;
ROSE_ASSERT (destPageNum < pageDests.size());
//.........这里部分代码省略.........