X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FGraphWriter.cpp;h=e68ee434dd592557d0d44ca84191ee80cedf04ea;hb=6d48faf334248edd0cf0933b86aee87dda2fbee8;hp=c26f6a141ec1a9ee49bb19c8e3be60aa2c14da02;hpb=939fd59eea0463a08ff672d146047c7e10d69458;p=oota-llvm.git diff --git a/lib/Support/GraphWriter.cpp b/lib/Support/GraphWriter.cpp index c26f6a141ec..e68ee434dd5 100644 --- a/lib/Support/GraphWriter.cpp +++ b/lib/Support/GraphWriter.cpp @@ -68,7 +68,7 @@ StringRef llvm::DOT::getColorString(unsigned ColorNumber) { std::string llvm::createGraphFilename(const Twine &Name, int &FD) { FD = -1; SmallString<128> Filename; - error_code EC = sys::fs::createTemporaryFile(Name, "dot", FD, Filename); + std::error_code EC = sys::fs::createTemporaryFile(Name, "dot", FD, Filename); if (EC) { errs() << "Error: " << EC.message() << "\n"; return ""; @@ -127,6 +127,7 @@ static const char *getProgramName(GraphProgram::Name program) { case GraphProgram::CIRCO: return "circo"; } + llvm_unreachable("bad kind"); } bool llvm::DisplayGraph(StringRef FilenameRef, bool wait, @@ -163,14 +164,16 @@ bool llvm::DisplayGraph(StringRef FilenameRef, bool wait, return ExecGraphViewer(ViewerPath, args, Filename, wait, ErrMsg); } - enum PSViewerKind { PSV_None, PSV_OSXOpen, PSV_Ghostview }; + enum PSViewerKind { PSV_None, PSV_OSXOpen, PSV_XDGOpen, PSV_Ghostview }; PSViewerKind PSViewer = PSV_None; #ifdef __APPLE__ - if (S.TryFindProgram("open", ViewerPath)) + if (!PSViewer && S.TryFindProgram("open", ViewerPath)) PSViewer = PSV_OSXOpen; #endif if (!PSViewer && S.TryFindProgram("gv", ViewerPath)) PSViewer = PSV_Ghostview; + if (!PSViewer && S.TryFindProgram("xdg-open", ViewerPath)) + PSViewer = PSV_XDGOpen; // PostScript graph generator + PostScript viewer std::string GeneratorPath; @@ -201,6 +204,10 @@ bool llvm::DisplayGraph(StringRef FilenameRef, bool wait, args.push_back("-W"); args.push_back(PSFilename.c_str()); break; + case PSV_XDGOpen: + wait = false; + args.push_back(PSFilename.c_str()); + break; case PSV_Ghostview: args.push_back("--spartan"); args.push_back(PSFilename.c_str());