From 21fb3afe73726f3c250e821c0862be73b1d63720 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 13 Oct 2003 03:30:47 +0000 Subject: [PATCH] Regularize header file comment, eliminate using's git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9069 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Instrumentation/ProfilePaths/Graph.cpp | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp index 8571dc819d7..f0e430125e7 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp @@ -1,7 +1,7 @@ -//===--Graph.cpp--- implements Graph class ---------------- ------*- C++ -*--=// +//===-- Graph.cpp - Implements Graph class --------------------------------===// // -// This implements Graph for helping in trace generation -// This graph gets used by "ProfilePaths" class +// This implements Graph for helping in trace generation This graph gets used by +// "ProfilePaths" class. // //===----------------------------------------------------------------------===// @@ -10,9 +10,7 @@ #include "Support/Debug.h" #include -using std::map; using std::vector; -using std::cerr; const graphListElement *findNodeInList(const Graph::nodeList &NL, Node *N) { @@ -326,7 +324,7 @@ struct compare_nodes { static void printNode(Node *nd){ - cerr<<"Node:"<getElement()->getName()<<"\n"; + std::cerr<<"Node:"<getElement()->getName()<<"\n"; } //Get the Maximal spanning tree (also a graph) @@ -354,8 +352,8 @@ Graph* Graph::getMaxSpanningTree(){ vector vt; - map parent; - map ed_weight; + std::map parent; + std::map ed_weight; //initialize: wt(root)=0, wt(others)=infinity //parent(root)=NULL, parent(others) not defined (but not null) @@ -377,14 +375,14 @@ Graph* Graph::getMaxSpanningTree(){ //keep pulling out vertex of min wt from vt while(!vt.empty()){ Node *u=*(min_element(vt.begin(), vt.end(), compare_nodes())); - DEBUG(cerr<<"popped wt"<<(u)->getWeight()<<"\n"; + DEBUG(std::cerr<<"popped wt"<<(u)->getWeight()<<"\n"; printNode(u)); if(parent[u]!=NULL){ //so not root Edge edge(parent[u],u, ed_weight[u]); //assign edge in spanning tree st->addEdge(edge,ed_weight[u]); - DEBUG(cerr<<"added:\n"; + DEBUG(std::cerr<<"added:\n"; printEdge(edge)); } @@ -412,8 +410,8 @@ Graph* Graph::getMaxSpanningTree(){ break; } } - DEBUG(cerr<<"wt:v->wt"<getWeight()<<"\n"; - printNode(v);cerr<<"node wt:"<<(*v).weight<<"\n"); + DEBUG(std::cerr<<"wt:v->wt"<getWeight()<<"\n"; + printNode(v);std::cerr<<"node wt:"<<(*v).weight<<"\n"); //so if v in in vt, change wt(v) to wt(u->v) //only if wt(u->v)setWeight(weight); - DEBUG(cerr<getWeight()<<":Set weight------\n"; + DEBUG(std::cerr<getWeight()<<":Set weight------\n"; printGraph(); printEdge(Edge(u,v,weight))); } @@ -434,15 +432,15 @@ Graph* Graph::getMaxSpanningTree(){ //print the graph (for debugging) void Graph::printGraph(){ vector lt=getAllNodes(); - cerr<<"Graph---------------------\n"; + std::cerr<<"Graph---------------------\n"; for(vector::iterator LI=lt.begin(), LE=lt.end(); LI!=LE; ++LI){ - cerr<<((*LI)->getElement())->getName()<<"->"; + std::cerr<<((*LI)->getElement())->getName()<<"->"; Graph::nodeList &nl = getNodeList(*LI); for(Graph::nodeList::iterator NI=nl.begin(), NE=nl.end(); NI!=NE; ++NI){ - cerr<<":"<<"("<<(NI->element->getElement()) + std::cerr<<":"<<"("<<(NI->element->getElement()) ->getName()<<":"<element->getWeight()<<","<weight<<")"; } - cerr<<"--------\n"; + std::cerr<<"--------\n"; } } @@ -487,7 +485,7 @@ void Graph::makeUnDirectional(){ for(nodeList::iterator NLI=nl.begin(), NLE=nl.end(); NLI!=NLE; ++NLI){ Edge ed(NLI->element, *NI, NLI->weight); if(!hasEdgeAndWt(ed)){ - DEBUG(cerr<<"######doesn't hv\n"; + DEBUG(std::cerr<<"######doesn't hv\n"; printEdge(ed)); addEdgeForce(ed); } @@ -521,8 +519,8 @@ void Graph::reverseWts(){ //have been visited //So we have a back edge when we meet a successor of //a node with smaller time, and GREY color -void Graph::getBackEdges(vector &be, map &d){ - map color; +void Graph::getBackEdges(vector &be, std::map &d){ + std::map color; int time=0; getBackEdgesVisit(getRoot(), be, color, d, time); @@ -531,8 +529,8 @@ void Graph::getBackEdges(vector &be, map &d){ //helper function to get back edges: it is called by //the "getBackEdges" function above void Graph::getBackEdgesVisit(Node *u, vector &be, - map &color, - map &d, int &time) { + std::map &color, + std::map &d, int &time) { color[u]=GREY; time++; d[u]=time;