diff options
author | Chris Bieneman <beanz@apple.com> | 2014-09-03 17:50:14 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2014-09-03 17:50:14 +0000 |
commit | f7a637281ab38f0342a0e75dc51c672053c220c1 (patch) | |
tree | 4652f712303d9c56e2c8e7904342cc2a513240a1 /llvm/lib/Support/Debug.cpp | |
parent | 1f76e5262937a7db2ee46ad35511f0544b9305fb (diff) | |
download | bcm5719-llvm-f7a637281ab38f0342a0e75dc51c672053c220c1.tar.gz bcm5719-llvm-f7a637281ab38f0342a0e75dc51c672053c220c1.zip |
Removing static initializer from Debug.cpp by converting to a ManagedStatic.
This is part of our larger effort to remove static initializers from LLVM libraries.
Reviewed by: chandlerc
llvm-svn: 217053
Diffstat (limited to 'llvm/lib/Support/Debug.cpp')
-rw-r--r-- | llvm/lib/Support/Debug.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Support/Debug.cpp b/llvm/lib/Support/Debug.cpp index ad4d4ef1d92..824654257ac 100644 --- a/llvm/lib/Support/Debug.cpp +++ b/llvm/lib/Support/Debug.cpp @@ -27,6 +27,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Signals.h" #include "llvm/Support/circular_raw_ostream.h" +#include "llvm/Support/ManagedStatic.h" using namespace llvm; @@ -50,14 +51,14 @@ DebugBufferSize("debug-buffer-size", cl::Hidden, cl::init(0)); -static std::string CurrentDebugType; +static ManagedStatic<std::string> CurrentDebugType; namespace { struct DebugOnlyOpt { void operator=(const std::string &Val) const { DebugFlag |= !Val.empty(); - CurrentDebugType = Val; + *CurrentDebugType = Val; } }; @@ -86,7 +87,7 @@ static void debug_user_sig_handler(void *Cookie) { // with the -debug-only=X option. // bool llvm::isCurrentDebugType(const char *DebugType) { - return CurrentDebugType.empty() || DebugType == CurrentDebugType; + return CurrentDebugType->empty() || DebugType == *CurrentDebugType; } /// setCurrentDebugType - Set the current debug type, as if the -debug-only=X @@ -94,7 +95,7 @@ bool llvm::isCurrentDebugType(const char *DebugType) { /// debug output to be produced. /// void llvm::setCurrentDebugType(const char *Type) { - CurrentDebugType = Type; + *CurrentDebugType = Type; } /// dbgs - Return a circular-buffered debug stream. |