[llvm-commits] [llvm] r67835 - in /llvm/trunk: include/llvm/CompilerDriver/CompilationGraph.h include/llvm/CompilerDriver/Main.inc lib/CompilerDriver/CompilationGraph.cpp
Mikhail Glushenkov
foldr at codedgers.com
Fri Mar 27 05:57:36 PDT 2009
Author: foldr
Date: Fri Mar 27 07:57:14 2009
New Revision: 67835
URL: http://llvm.org/viewvc/llvm-project?rev=67835&view=rev
Log:
-write-graph now can be used with -o.
Makes it possible to set the output file name.
Modified:
llvm/trunk/include/llvm/CompilerDriver/CompilationGraph.h
llvm/trunk/include/llvm/CompilerDriver/Main.inc
llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp
Modified: llvm/trunk/include/llvm/CompilerDriver/CompilationGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/CompilationGraph.h?rev=67835&r1=67834&r2=67835&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/CompilationGraph.h (original)
+++ llvm/trunk/include/llvm/CompilerDriver/CompilationGraph.h Fri Mar 27 07:57:14 2009
@@ -157,8 +157,8 @@
/// in your path.
void viewGraph();
- /// writeGraph - Write a compilation-graph.dot file.
- void writeGraph();
+ /// writeGraph - Write Graphviz .dot source file to the current direcotry.
+ void writeGraph(const std::string& OutputFilename);
// GraphTraits support.
friend NodesIterator GraphBegin(CompilationGraph*);
Modified: llvm/trunk/include/llvm/CompilerDriver/Main.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/Main.inc?rev=67835&r1=67834&r2=67835&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/Main.inc (original)
+++ llvm/trunk/include/llvm/CompilerDriver/Main.inc Fri Mar 27 07:57:14 2009
@@ -98,7 +98,11 @@
Plugins.PopulateCompilationGraph(graph);
if (CheckGraph) {
- return graph.Check();
+ int ret = graph.Check();
+ if (!ret)
+ std::cerr << "check-graph: no errors found.\n";
+
+ return ret;
}
if (ViewGraph) {
@@ -108,7 +112,9 @@
}
if (WriteGraph) {
- graph.writeGraph();
+ graph.writeGraph(OutputFilename.empty()
+ ? std::string("compilation-graph.dot")
+ : OutputFilename);
return 0;
}
Modified: llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp?rev=67835&r1=67834&r2=67835&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp Fri Mar 27 07:57:14 2009
@@ -465,9 +465,6 @@
// Check for cycles.
ret += this->CheckCycles();
- if (!ret)
- std::cerr << "check-graph: no errors found.\n";
-
return ret;
}
@@ -519,18 +516,18 @@
}
-void CompilationGraph::writeGraph() {
- std::ofstream O("compilation-graph.dot");
+void CompilationGraph::writeGraph(const std::string& OutputFilename) {
+ std::ofstream O(OutputFilename.c_str());
if (O.good()) {
- std::cerr << "Writing 'compilation-graph.dot' file...";
+ std::cerr << "Writing '"<< OutputFilename << "' file...";
llvm::WriteGraph(O, this);
std::cerr << "done.\n";
O.close();
}
else {
- throw std::runtime_error("Error opening file 'compilation-graph.dot'"
- " for writing!");
+ throw std::runtime_error("Error opening file '" + OutputFilename
+ + "' for writing!");
}
}
More information about the llvm-commits
mailing list