summaryrefslogtreecommitdiff
path: root/include/llvm/Support/GraphWriter.h
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-06-24 17:37:09 +0000
committerOwen Anderson <resistor@mac.com>2009-06-24 17:37:09 +0000
commit8cbc94afb71fd2da72d8f1284f7f53e39019fdec (patch)
treed86c04e333accc7067f85d349065dab8f02fca1c /include/llvm/Support/GraphWriter.h
parent8539cfd30e6058e605ed2f38fb29523ea42e17a1 (diff)
downloadllvm-8cbc94afb71fd2da72d8f1284f7f53e39019fdec.tar.gz
llvm-8cbc94afb71fd2da72d8f1284f7f53e39019fdec.tar.bz2
llvm-8cbc94afb71fd2da72d8f1284f7f53e39019fdec.tar.xz
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
Diffstat (limited to 'include/llvm/Support/GraphWriter.h')
-rw-r--r--include/llvm/Support/GraphWriter.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h
index ca28aafa78..01b44d0b8e 100644
--- a/include/llvm/Support/GraphWriter.h
+++ b/include/llvm/Support/GraphWriter.h
@@ -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;