Index: lib/Support/Debug.cpp =================================================================== --- lib/Support/Debug.cpp +++ 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 @@ cl::Hidden, cl::init(0)); -static std::string CurrentDebugType; +static ManagedStatic CurrentDebugType; namespace { struct DebugOnlyOpt { void operator=(const std::string &Val) const { DebugFlag |= !Val.empty(); - CurrentDebugType = Val; + *CurrentDebugType = Val; } }; @@ -86,7 +87,7 @@ // 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 @@ /// debug output to be produced. /// void llvm::setCurrentDebugType(const char *Type) { - CurrentDebugType = Type; + *CurrentDebugType = Type; } /// dbgs - Return a circular-buffered debug stream.