summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/GraphWriter.cpp
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-06-04 03:57:44 +0000
committerAlp Toker <alp@nuanti.com>2014-06-04 03:57:44 +0000
commite3fbe2c774ba7b60e2b7b21baa587101e29408dc (patch)
tree5f6951ca31b267c938f2fe11c6adf364fd441885 /llvm/lib/Support/GraphWriter.cpp
parentf88da971e503bbdf935c0304fb2946cf8e47f2bc (diff)
downloadbcm5719-llvm-e3fbe2c774ba7b60e2b7b21baa587101e29408dc.tar.gz
bcm5719-llvm-e3fbe2c774ba7b60e2b7b21baa587101e29408dc.zip
GraphWriter: support the XDG open utility
This runs a suitable viewer on Unix desktop environments specified by Freedesktop.org (GNOME, KDE, Linux distributions etc.) llvm-svn: 210147
Diffstat (limited to 'llvm/lib/Support/GraphWriter.cpp')
-rw-r--r--llvm/lib/Support/GraphWriter.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Support/GraphWriter.cpp b/llvm/lib/Support/GraphWriter.cpp
index 1521475a8b8..a7bb4f26a58 100644
--- a/llvm/lib/Support/GraphWriter.cpp
+++ b/llvm/lib/Support/GraphWriter.cpp
@@ -164,12 +164,14 @@ 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("xdg-open", ViewerPath))
+ PSViewer = PSV_XDGOpen;
if (!PSViewer && S.TryFindProgram("gv", ViewerPath))
PSViewer = PSV_Ghostview;
@@ -202,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());
OpenPOWER on IntegriCloud