-#ifndef NDEBUG
- std::string Filename = "/tmp/cfg." + getName() + ".dot";
- std::cerr << "Writing '" << Filename << "'... ";
- std::ofstream F(Filename.c_str());
-
- if (!F.good()) {
- std::cerr << " error opening file for writing!\n";
- return;
- }
-
- WriteGraph(F, this);
- F.close();
- std::cerr << "\n";
-
-#ifdef HAVE_GRAPHVIZ
- std::cerr << "Running 'Graphviz' program... " << std::flush;
- if (system((LLVM_PATH_GRAPHVIZ " " + Filename).c_str())) {
- std::cerr << "Error viewing graph: 'Graphviz' not in path?\n";
- } else {
- system(("rm " + Filename).c_str());
- return;
- }
-#endif // HAVE_GRAPHVIZ
-
-#ifdef HAVE_GV
- std::cerr << "Running 'dot' program... " << std::flush;
- if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename
- + " > /tmp/cfg.tempgraph.ps").c_str())) {
- std::cerr << "Error running dot: 'dot' not in path?\n";
- } else {
- std::cerr << "\n";
- system("gv /tmp/cfg.tempgraph.ps");
- }
- system(("rm " + Filename + " /tmp/cfg.tempgraph.ps").c_str());
- return;
-#endif // HAVE_GV
-#endif // NDEBUG
- std::cerr << "Function::viewCFG is only available in debug builds on "
- << "systems with Graphviz or gv!\n";
-
-#ifndef NDEBUG
- system(("rm " + Filename).c_str());
-#endif