diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-07-29 20:15:26 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-07-29 20:15:26 +0000 |
commit | 344a3780b2e33f6ca763666c380202b18aab72a3 (patch) | |
tree | f0b203ee6eb71d7fdd792373e3c81eb18d6934dd /llvm/lib/Support/GraphWriter.cpp | |
parent | b60736ec1405bb0a8dd40989f67ef4c93da068ab (diff) |
vendor/llvm-project/llvmorg-13-init-16847-g88e66fa60ae5vendor/llvm-project/llvmorg-12.0.1-rc2-0-ge7dac564cd0evendor/llvm-project/llvmorg-12.0.1-0-gfed41342a82f
Diffstat (limited to 'llvm/lib/Support/GraphWriter.cpp')
-rw-r--r-- | llvm/lib/Support/GraphWriter.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/llvm/lib/Support/GraphWriter.cpp b/llvm/lib/Support/GraphWriter.cpp index d8aae9260323..b41869aba95f 100644 --- a/llvm/lib/Support/GraphWriter.cpp +++ b/llvm/lib/Support/GraphWriter.cpp @@ -11,6 +11,9 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/GraphWriter.h" + +#include "DebugOptions.h" + #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -29,8 +32,21 @@ using namespace llvm; -static cl::opt<bool> ViewBackground("view-background", cl::Hidden, - cl::desc("Execute graph viewer in the background. Creates tmp file litter.")); +#ifdef __APPLE__ +namespace { +struct CreateViewBackground { + static void *call() { + return new cl::opt<bool>("view-background", cl::Hidden, + cl::desc("Execute graph viewer in the background. " + "Creates tmp file litter.")); + } +}; +} // namespace +static ManagedStatic<cl::opt<bool>, CreateViewBackground> ViewBackground; +void llvm::initGraphWriterOptions() { *ViewBackground; } +#else +void llvm::initGraphWriterOptions() {} +#endif std::string llvm::DOT::EscapeString(const std::string &Label) { std::string Str(Label); @@ -54,7 +70,7 @@ std::string llvm::DOT::EscapeString(const std::string &Label) { Str.erase(Str.begin()+i); continue; default: break; } - LLVM_FALLTHROUGH; + LLVM_FALLTHROUGH; case '{': case '}': case '<': case '>': case '|': case '"': @@ -178,7 +194,7 @@ bool llvm::DisplayGraph(StringRef FilenameRef, bool wait, GraphSession S; #ifdef __APPLE__ - wait &= !ViewBackground; + wait &= !*ViewBackground; if (S.TryFindProgram("open", ViewerPath)) { std::vector<StringRef> args; args.push_back(ViewerPath); |