diff --git a/llvm/lib/Support/GraphWriter.cpp b/llvm/lib/Support/GraphWriter.cpp --- a/llvm/lib/Support/GraphWriter.cpp +++ b/llvm/lib/Support/GraphWriter.cpp @@ -152,19 +152,6 @@ std::string ViewerPath; GraphSession S; -#ifdef __APPLE__ - wait &= !ViewBackground; - if (S.TryFindProgram("open", ViewerPath)) { - std::vector args; - args.push_back(ViewerPath); - if (wait) - args.push_back("-W"); - args.push_back(Filename); - errs() << "Trying 'open' program... "; - if (!ExecGraphViewer(ViewerPath, args, Filename, wait, ErrMsg)) - return false; - } -#endif if (S.TryFindProgram("xdg-open", ViewerPath)) { std::vector args; args.push_back(ViewerPath); @@ -197,6 +184,20 @@ return ExecGraphViewer(ViewerPath, args, Filename, wait, ErrMsg); } +#ifdef __APPLE__ + wait &= !ViewBackground; + if (S.TryFindProgram("open", ViewerPath)) { + std::vector args; + args.push_back(ViewerPath); + if (wait) + args.push_back("-W"); + args.push_back(Filename); + errs() << "Trying 'open' program... "; + if (!ExecGraphViewer(ViewerPath, args, Filename, wait, ErrMsg)) + return false; + } +#endif + enum ViewerKind { VK_None, VK_OSXOpen,