This is part of our larger effort to remove static initializers from LLVM libraries.
Reviewed by: chandlerc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217053
91177308-0d34-0410-b5e6-
96231b3b80d8
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/circular_raw_ostream.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/circular_raw_ostream.h"
+#include "llvm/Support/ManagedStatic.h"
cl::Hidden,
cl::init(0));
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();
namespace {
struct DebugOnlyOpt {
void operator=(const std::string &Val) const {
DebugFlag |= !Val.empty();
- CurrentDebugType = Val;
+ *CurrentDebugType = Val;
// with the -debug-only=X option.
//
bool llvm::isCurrentDebugType(const char *DebugType) {
// 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
}
/// setCurrentDebugType - Set the current debug type, as if the -debug-only=X
/// debug output to be produced.
///
void llvm::setCurrentDebugType(const char *Type) {
/// debug output to be produced.
///
void llvm::setCurrentDebugType(const char *Type) {
- CurrentDebugType = Type;
+ *CurrentDebugType = Type;
}
/// dbgs - Return a circular-buffered debug stream.
}
/// dbgs - Return a circular-buffered debug stream.