Skip to content

Commit 7c178e8

Browse files
committed
[Graph] Assign a different color to variables based on their visibility.
1 parent 6fb8379 commit 7c178e8

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/Graph/Graph.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,12 @@ class AbstractDottyPrinter {
122122
dumpLabel(N, os);
123123
os << "\"\n";
124124
os << "\tshape = \"record\"\n";
125-
if (llvm::isa<Variable>(N)) {
126-
os << "\tfillcolor=pink,style=filled\n";
125+
if (auto V = llvm::dyn_cast<Variable>(N)) {
126+
if (V->getVisibilityKind() == Variable::VisibilityKind::Public) {
127+
os << "\tfillcolor=SlateGray1,style=filled\n";
128+
} else {
129+
os << "\tfillcolor=thistle2,style=filled\n";
130+
}
127131
}
128132
os << "];\n";
129133

@@ -136,9 +140,9 @@ class AbstractDottyPrinter {
136140
}
137141
if (isa<Variable>(to)) {
138142
if (!N->isOverwrittenNthInput(i)) {
139-
os << "[style=bold, color=pink]";
143+
os << "[style=bold, color=SlateBlue4]";
140144
} else {
141-
os << "[style=bold, color=blue]";
145+
os << "[style=bold, color=RoyalBlue4]";
142146
}
143147
}
144148
}
@@ -179,9 +183,9 @@ class ModuleDottyPrinter : public AbstractDottyPrinter {
179183
os << uniqueVertexName(F) << "[\n"
180184
<< "\tlabel = \"Function\\l"
181185
<< "name : " << F->getName().str() << "\\l"
182-
<< "node count : " << F->getNodes().size()
183-
<< "\"\n"
186+
<< "node count : " << F->getNodes().size() << "\"\n"
184187
<< "\tshape = box\n"
188+
<< "\rstyle=rounded"
185189
<< "];\n";
186190
vertices_.push_back(os.str());
187191

0 commit comments

Comments
 (0)