mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
Get rid of the global CFGOnly flag by threading a ShortNames parameters through the GraphViz rendering code.
Update other uses in the codebase for this change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74084 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -72,6 +72,7 @@ template<typename GraphType>
|
||||
class GraphWriter {
|
||||
std::ostream &O;
|
||||
const GraphType &G;
|
||||
bool ShortNames;
|
||||
|
||||
typedef DOTGraphTraits<GraphType> DOTTraits;
|
||||
typedef GraphTraits<GraphType> GTraits;
|
||||
@ -79,7 +80,8 @@ class GraphWriter {
|
||||
typedef typename GTraits::nodes_iterator node_iterator;
|
||||
typedef typename GTraits::ChildIteratorType child_iterator;
|
||||
public:
|
||||
GraphWriter(std::ostream &o, const GraphType &g) : O(o), G(g) {}
|
||||
GraphWriter(std::ostream &o, const GraphType &g, bool SN) :
|
||||
O(o), G(g), ShortNames(SN) {}
|
||||
|
||||
void writeHeader(const std::string &Name) {
|
||||
std::string GraphName = DOTTraits::getGraphName(G);
|
||||
@ -130,7 +132,7 @@ public:
|
||||
O << "label=\"{";
|
||||
|
||||
if (!DOTTraits::renderGraphFromBottomUp()) {
|
||||
O << DOT::EscapeString(DOTTraits::getNodeLabel(Node, G));
|
||||
O << DOT::EscapeString(DOTTraits::getNodeLabel(Node, G, ShortNames));
|
||||
|
||||
// If we should include the address of the node in the label, do so now.
|
||||
if (DOTTraits::hasNodeAddressLabel(Node, G))
|
||||
@ -156,7 +158,7 @@ public:
|
||||
}
|
||||
|
||||
if (DOTTraits::renderGraphFromBottomUp()) {
|
||||
O << DOT::EscapeString(DOTTraits::getNodeLabel(Node, G));
|
||||
O << DOT::EscapeString(DOTTraits::getNodeLabel(Node, G, ShortNames));
|
||||
|
||||
// If we should include the address of the node in the label, do so now.
|
||||
if (DOTTraits::hasNodeAddressLabel(Node, G))
|
||||
@ -250,10 +252,11 @@ public:
|
||||
|
||||
template<typename GraphType>
|
||||
std::ostream &WriteGraph(std::ostream &O, const GraphType &G,
|
||||
bool ShortNames = false,
|
||||
const std::string &Name = "",
|
||||
const std::string &Title = "") {
|
||||
// Start the graph emission process...
|
||||
GraphWriter<GraphType> W(O, G);
|
||||
GraphWriter<GraphType> W(O, G, ShortNames);
|
||||
|
||||
// Output the header for the graph...
|
||||
W.writeHeader(Title);
|
||||
@ -272,6 +275,7 @@ std::ostream &WriteGraph(std::ostream &O, const GraphType &G,
|
||||
template<typename GraphType>
|
||||
sys::Path WriteGraph(const GraphType &G,
|
||||
const std::string& Name,
|
||||
bool ShortNames = false,
|
||||
const std::string& Title = "") {
|
||||
std::string ErrMsg;
|
||||
sys::Path Filename = sys::Path::GetTemporaryDirectory(&ErrMsg);
|
||||
@ -290,7 +294,7 @@ sys::Path WriteGraph(const GraphType &G,
|
||||
std::ofstream O(Filename.c_str());
|
||||
|
||||
if (O.good()) {
|
||||
WriteGraph(O, G, Name, Title);
|
||||
WriteGraph(O, G, ShortNames, Name, Title);
|
||||
cerr << " done. \n";
|
||||
|
||||
O.close();
|
||||
@ -308,8 +312,9 @@ sys::Path WriteGraph(const GraphType &G,
|
||||
template<typename GraphType>
|
||||
void ViewGraph(const GraphType& G,
|
||||
const std::string& Name,
|
||||
bool ShortNames = false,
|
||||
const std::string& Title = "") {
|
||||
sys::Path Filename = WriteGraph(G, Name, Title);
|
||||
sys::Path Filename = WriteGraph(G, Name, ShortNames, Title);
|
||||
|
||||
if (Filename.isEmpty()) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user