forked from OSchip/llvm-project
Revert "ManagedStatic: remove many straightforward uses in llvm"
This reverts commit e6f1f06245
.
Reverting due to a failure on the fuchsia-x86_64-linux buildbot.
This commit is contained in:
parent
e6f1f06245
commit
e9ce1a5880
|
@ -15,6 +15,7 @@
|
||||||
#define LLVM_IR_OPTBISECT_H
|
#define LLVM_IR_OPTBISECT_H
|
||||||
|
|
||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
@ -89,8 +90,7 @@ private:
|
||||||
|
|
||||||
/// Singleton instance of the OptBisect class, so multiple pass managers don't
|
/// Singleton instance of the OptBisect class, so multiple pass managers don't
|
||||||
/// need to coordinate their uses of OptBisect.
|
/// need to coordinate their uses of OptBisect.
|
||||||
OptBisect &getOptBisector();
|
extern ManagedStatic<OptBisect> OptBisector;
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif // LLVM_IR_OPTBISECT_H
|
#endif // LLVM_IR_OPTBISECT_H
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/JSON.h"
|
#include "llvm/Support/JSON.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/Path.h"
|
#include "llvm/Support/Path.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
@ -48,17 +49,19 @@ using TFStatusPtr = std::unique_ptr<TF_Status, decltype(&TF_DeleteStatus)>;
|
||||||
|
|
||||||
struct TFInitializer {
|
struct TFInitializer {
|
||||||
TFInitializer() {
|
TFInitializer() {
|
||||||
|
assert(!IsInitialized && "TFInitialized should be called only once");
|
||||||
int Argc = 1;
|
int Argc = 1;
|
||||||
const char *Name = "";
|
const char *Name = "";
|
||||||
const char **NamePtr = &Name;
|
const char **NamePtr = &Name;
|
||||||
TF_InitMain(Name, &Argc, const_cast<char ***>(&NamePtr));
|
TF_InitMain(Name, &Argc, const_cast<char ***>(&NamePtr));
|
||||||
|
IsInitialized = true;
|
||||||
}
|
}
|
||||||
|
bool IsInitialized = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ensureInitTF() {
|
llvm::ManagedStatic<TFInitializer> TFLibInitializer;
|
||||||
static TFInitializer TFLibInitializer;
|
|
||||||
return true;
|
bool ensureInitTF() { return TFLibInitializer->IsInitialized; }
|
||||||
}
|
|
||||||
|
|
||||||
TFGraphPtr createTFGraph() {
|
TFGraphPtr createTFGraph() {
|
||||||
return TFGraphPtr(TF_NewGraph(), &TF_DeleteGraph);
|
return TFGraphPtr(TF_NewGraph(), &TF_DeleteGraph);
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
#include "llvm/Support/Error.h"
|
#include "llvm/Support/Error.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/ErrorOr.h"
|
#include "llvm/Support/ErrorOr.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
@ -7445,9 +7446,10 @@ class BitcodeErrorCategoryType : public std::error_category {
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
static ManagedStatic<BitcodeErrorCategoryType> ErrorCategory;
|
||||||
|
|
||||||
const std::error_category &llvm::BitcodeErrorCategory() {
|
const std::error_category &llvm::BitcodeErrorCategory() {
|
||||||
static BitcodeErrorCategoryType ErrorCategory;
|
return *ErrorCategory;
|
||||||
return ErrorCategory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Expected<StringRef> readBlobInRecord(BitstreamCursor &Stream,
|
static Expected<StringRef> readBlobInRecord(BitstreamCursor &Stream,
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/KnownBits.h"
|
#include "llvm/Support/KnownBits.h"
|
||||||
#include "llvm/Support/MachineValueType.h"
|
#include "llvm/Support/MachineValueType.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/Mutex.h"
|
#include "llvm/Support/Mutex.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
@ -10753,19 +10754,19 @@ namespace {
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
static ManagedStatic<std::set<EVT, EVT::compareRawBits>> EVTs;
|
||||||
|
static ManagedStatic<EVTArray> SimpleVTArray;
|
||||||
|
static ManagedStatic<sys::SmartMutex<true>> VTMutex;
|
||||||
|
|
||||||
/// getValueTypeList - Return a pointer to the specified value type.
|
/// getValueTypeList - Return a pointer to the specified value type.
|
||||||
///
|
///
|
||||||
const EVT *SDNode::getValueTypeList(EVT VT) {
|
const EVT *SDNode::getValueTypeList(EVT VT) {
|
||||||
static std::set<EVT, EVT::compareRawBits> EVTs;
|
|
||||||
static EVTArray SimpleVTArray;
|
|
||||||
static sys::SmartMutex<true> VTMutex;
|
|
||||||
|
|
||||||
if (VT.isExtended()) {
|
if (VT.isExtended()) {
|
||||||
sys::SmartScopedLock<true> Lock(VTMutex);
|
sys::SmartScopedLock<true> Lock(*VTMutex);
|
||||||
return &(*EVTs.insert(VT).first);
|
return &(*EVTs->insert(VT).first);
|
||||||
}
|
}
|
||||||
assert(VT.getSimpleVT() < MVT::VALUETYPE_SIZE && "Value type out of range!");
|
assert(VT.getSimpleVT() < MVT::VALUETYPE_SIZE && "Value type out of range!");
|
||||||
return &SimpleVTArray.VTs[VT.getSimpleVT().SimpleTy];
|
return &SimpleVTArray->VTs[VT.getSimpleVT().SimpleTy];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// hasNUsesOfValue - Return true if there are exactly NUSES uses of the
|
/// hasNUsesOfValue - Return true if there are exactly NUSES uses of the
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
@ -41,9 +42,9 @@ public:
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
static llvm::ManagedStatic<CodeViewErrorCategory> CodeViewErrCategory;
|
||||||
const std::error_category &llvm::codeview::CVErrorCategory() {
|
const std::error_category &llvm::codeview::CVErrorCategory() {
|
||||||
static CodeViewErrorCategory CodeViewErrCategory;
|
return *CodeViewErrCategory;
|
||||||
return CodeViewErrCategory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char CodeViewError::ID;
|
char CodeViewError::ID;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
@ -49,9 +50,7 @@ public:
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
const std::error_category &llvm::msf::MSFErrCategory() {
|
static llvm::ManagedStatic<MSFErrorCategory> MSFCategory;
|
||||||
static MSFErrorCategory MSFCategory;
|
const std::error_category &llvm::msf::MSFErrCategory() { return *MSFCategory; }
|
||||||
return MSFCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
char MSFError::ID;
|
char MSFError::ID;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "llvm/DebugInfo/PDB/DIA/DIAError.h"
|
#include "llvm/DebugInfo/PDB/DIA/DIAError.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace llvm::pdb;
|
using namespace llvm::pdb;
|
||||||
|
@ -30,9 +31,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::error_category &llvm::pdb::DIAErrCategory() {
|
static llvm::ManagedStatic<DIAErrorCategory> DIACategory;
|
||||||
static DIAErrorCategory DIACategory;
|
const std::error_category &llvm::pdb::DIAErrCategory() { return *DIACategory; }
|
||||||
return DIACategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
char DIAError::ID;
|
char DIAError::ID;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "llvm/DebugInfo/PDB/GenericError.h"
|
#include "llvm/DebugInfo/PDB/GenericError.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace llvm::pdb;
|
using namespace llvm::pdb;
|
||||||
|
@ -41,9 +42,7 @@ public:
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
const std::error_category &llvm::pdb::PDBErrCategory() {
|
static llvm::ManagedStatic<PDBErrorCategory> PDBCategory;
|
||||||
static PDBErrorCategory PDBCategory;
|
const std::error_category &llvm::pdb::PDBErrCategory() { return *PDBCategory; }
|
||||||
return PDBCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
char PDBError::ID;
|
char PDBError::ID;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "llvm/DebugInfo/PDB/Native/RawError.h"
|
#include "llvm/DebugInfo/PDB/Native/RawError.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace llvm::pdb;
|
using namespace llvm::pdb;
|
||||||
|
@ -46,9 +47,7 @@ public:
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
const std::error_category &llvm::pdb::RawErrCategory() {
|
static llvm::ManagedStatic<RawErrorCategory> RawCategory;
|
||||||
static RawErrorCategory RawCategory;
|
const std::error_category &llvm::pdb::RawErrCategory() { return *RawCategory; }
|
||||||
return RawCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
char RawError::ID;
|
char RawError::ID;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "llvm/Object/ObjectFile.h"
|
#include "llvm/Object/ObjectFile.h"
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/Mutex.h"
|
#include "llvm/Support/Mutex.h"
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@ -122,10 +123,7 @@ private:
|
||||||
|
|
||||||
/// Lock used to serialize all jit registration events, since they
|
/// Lock used to serialize all jit registration events, since they
|
||||||
/// modify global variables.
|
/// modify global variables.
|
||||||
sys::Mutex &getJITDebugLock() {
|
ManagedStatic<sys::Mutex> JITDebugLock;
|
||||||
static sys::Mutex JITDebugLock;
|
|
||||||
return JITDebugLock;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Do the registration.
|
/// Do the registration.
|
||||||
void NotifyDebugger(jit_code_entry* JITCodeEntry) {
|
void NotifyDebugger(jit_code_entry* JITCodeEntry) {
|
||||||
|
@ -145,7 +143,7 @@ void NotifyDebugger(jit_code_entry* JITCodeEntry) {
|
||||||
|
|
||||||
GDBJITRegistrationListener::~GDBJITRegistrationListener() {
|
GDBJITRegistrationListener::~GDBJITRegistrationListener() {
|
||||||
// Free all registered object files.
|
// Free all registered object files.
|
||||||
std::lock_guard<llvm::sys::Mutex> locked(getJITDebugLock());
|
std::lock_guard<llvm::sys::Mutex> locked(*JITDebugLock);
|
||||||
for (RegisteredObjectBufferMap::iterator I = ObjectBufferMap.begin(),
|
for (RegisteredObjectBufferMap::iterator I = ObjectBufferMap.begin(),
|
||||||
E = ObjectBufferMap.end();
|
E = ObjectBufferMap.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
|
@ -169,7 +167,7 @@ void GDBJITRegistrationListener::notifyObjectLoaded(
|
||||||
const char *Buffer = DebugObj.getBinary()->getMemoryBufferRef().getBufferStart();
|
const char *Buffer = DebugObj.getBinary()->getMemoryBufferRef().getBufferStart();
|
||||||
size_t Size = DebugObj.getBinary()->getMemoryBufferRef().getBufferSize();
|
size_t Size = DebugObj.getBinary()->getMemoryBufferRef().getBufferSize();
|
||||||
|
|
||||||
std::lock_guard<llvm::sys::Mutex> locked(getJITDebugLock());
|
std::lock_guard<llvm::sys::Mutex> locked(*JITDebugLock);
|
||||||
assert(ObjectBufferMap.find(K) == ObjectBufferMap.end() &&
|
assert(ObjectBufferMap.find(K) == ObjectBufferMap.end() &&
|
||||||
"Second attempt to perform debug registration.");
|
"Second attempt to perform debug registration.");
|
||||||
jit_code_entry* JITCodeEntry = new jit_code_entry();
|
jit_code_entry* JITCodeEntry = new jit_code_entry();
|
||||||
|
@ -188,7 +186,7 @@ void GDBJITRegistrationListener::notifyObjectLoaded(
|
||||||
}
|
}
|
||||||
|
|
||||||
void GDBJITRegistrationListener::notifyFreeingObject(ObjectKey K) {
|
void GDBJITRegistrationListener::notifyFreeingObject(ObjectKey K) {
|
||||||
std::lock_guard<llvm::sys::Mutex> locked(getJITDebugLock());
|
std::lock_guard<llvm::sys::Mutex> locked(*JITDebugLock);
|
||||||
RegisteredObjectBufferMap::iterator I = ObjectBufferMap.find(K);
|
RegisteredObjectBufferMap::iterator I = ObjectBufferMap.find(K);
|
||||||
|
|
||||||
if (I != ObjectBufferMap.end()) {
|
if (I != ObjectBufferMap.end()) {
|
||||||
|
@ -230,13 +228,14 @@ void GDBJITRegistrationListener::deregisterObjectInternal(
|
||||||
JITCodeEntry = nullptr;
|
JITCodeEntry = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
llvm::ManagedStatic<GDBJITRegistrationListener> GDBRegListener;
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
JITEventListener* JITEventListener::createGDBRegistrationListener() {
|
JITEventListener* JITEventListener::createGDBRegistrationListener() {
|
||||||
static GDBJITRegistrationListener GDBRegListener;
|
return &*GDBRegListener;
|
||||||
return &GDBRegListener;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "llvm/ExecutionEngine/JITLink/ELF.h"
|
#include "llvm/ExecutionEngine/JITLink/ELF.h"
|
||||||
#include "llvm/ExecutionEngine/JITLink/MachO.h"
|
#include "llvm/ExecutionEngine/JITLink/MachO.h"
|
||||||
#include "llvm/Support/Format.h"
|
#include "llvm/Support/Format.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
|
||||||
|
@ -40,6 +41,8 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ManagedStatic<JITLinkerErrorCategory> JITLinkerErrorCategory;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
@ -50,8 +53,7 @@ char JITLinkError::ID = 0;
|
||||||
void JITLinkError::log(raw_ostream &OS) const { OS << ErrMsg; }
|
void JITLinkError::log(raw_ostream &OS) const { OS << ErrMsg; }
|
||||||
|
|
||||||
std::error_code JITLinkError::convertToErrorCode() const {
|
std::error_code JITLinkError::convertToErrorCode() const {
|
||||||
static JITLinkerErrorCategory TheJITLinkerErrorCategory;
|
return std::error_code(GenericJITLinkError, *JITLinkerErrorCategory);
|
||||||
return std::error_code(GenericJITLinkError, TheJITLinkerErrorCategory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *getGenericEdgeKindName(Edge::Kind K) {
|
const char *getGenericEdgeKindName(Edge::Kind K) {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include "llvm/ExecutionEngine/Orc/Shared/OrcError.h"
|
#include "llvm/ExecutionEngine/Orc/Shared/OrcError.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
@ -69,10 +70,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
OrcErrorCategory &getOrcErrCat() {
|
static ManagedStatic<OrcErrorCategory> OrcErrCat;
|
||||||
static OrcErrorCategory OrcErrCat;
|
|
||||||
return OrcErrCat;
|
|
||||||
}
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
@ -83,7 +81,7 @@ char JITSymbolNotFound::ID = 0;
|
||||||
|
|
||||||
std::error_code orcError(OrcErrorCode ErrCode) {
|
std::error_code orcError(OrcErrorCode ErrCode) {
|
||||||
typedef std::underlying_type<OrcErrorCode>::type UT;
|
typedef std::underlying_type<OrcErrorCode>::type UT;
|
||||||
return std::error_code(static_cast<UT>(ErrCode), getOrcErrCat());
|
return std::error_code(static_cast<UT>(ErrCode), *OrcErrCat);
|
||||||
}
|
}
|
||||||
|
|
||||||
DuplicateDefinition::DuplicateDefinition(std::string SymbolName)
|
DuplicateDefinition::DuplicateDefinition(std::string SymbolName)
|
||||||
|
@ -107,7 +105,7 @@ JITSymbolNotFound::JITSymbolNotFound(std::string SymbolName)
|
||||||
std::error_code JITSymbolNotFound::convertToErrorCode() const {
|
std::error_code JITSymbolNotFound::convertToErrorCode() const {
|
||||||
typedef std::underlying_type<OrcErrorCode>::type UT;
|
typedef std::underlying_type<OrcErrorCode>::type UT;
|
||||||
return std::error_code(static_cast<UT>(OrcErrorCode::JITSymbolNotFound),
|
return std::error_code(static_cast<UT>(OrcErrorCode::JITSymbolNotFound),
|
||||||
getOrcErrCat());
|
*OrcErrCat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JITSymbolNotFound::log(raw_ostream &OS) const {
|
void JITSymbolNotFound::log(raw_ostream &OS) const {
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "llvm/ExecutionEngine/JITSymbol.h"
|
#include "llvm/ExecutionEngine/JITSymbol.h"
|
||||||
#include "llvm/Support/BinaryStreamReader.h"
|
#include "llvm/Support/BinaryStreamReader.h"
|
||||||
#include "llvm/Support/FormatVariadic.h"
|
#include "llvm/Support/FormatVariadic.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@ -66,6 +67,9 @@ LLVM_ATTRIBUTE_NOINLINE void __jit_debug_register_code() {
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace llvm::orc;
|
using namespace llvm::orc;
|
||||||
|
|
||||||
|
// Serialize rendezvous with the debugger as well as access to shared data.
|
||||||
|
ManagedStatic<std::mutex> JITDebugLock;
|
||||||
|
|
||||||
// Register debug object, return error message or null for success.
|
// Register debug object, return error message or null for success.
|
||||||
static void registerJITLoaderGDBImpl(const char *ObjAddr, size_t Size) {
|
static void registerJITLoaderGDBImpl(const char *ObjAddr, size_t Size) {
|
||||||
LLVM_DEBUG({
|
LLVM_DEBUG({
|
||||||
|
@ -81,9 +85,7 @@ static void registerJITLoaderGDBImpl(const char *ObjAddr, size_t Size) {
|
||||||
E->symfile_size = Size;
|
E->symfile_size = Size;
|
||||||
E->prev_entry = nullptr;
|
E->prev_entry = nullptr;
|
||||||
|
|
||||||
// Serialize rendezvous with the debugger as well as access to shared data.
|
std::lock_guard<std::mutex> Lock(*JITDebugLock);
|
||||||
static std::mutex JITDebugLock;
|
|
||||||
std::lock_guard<std::mutex> Lock(JITDebugLock);
|
|
||||||
|
|
||||||
// Insert this entry at the head of the list.
|
// Insert this entry at the head of the list.
|
||||||
jit_code_entry *NextEntry = __jit_debug_descriptor.first_entry;
|
jit_code_entry *NextEntry = __jit_debug_descriptor.first_entry;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/Errno.h"
|
#include "llvm/Support/Errno.h"
|
||||||
#include "llvm/Support/FileSystem.h"
|
#include "llvm/Support/FileSystem.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/Mutex.h"
|
#include "llvm/Support/Mutex.h"
|
||||||
#include "llvm/Support/Path.h"
|
#include "llvm/Support/Path.h"
|
||||||
|
@ -487,14 +488,15 @@ void PerfJITEventListener::NotifyDebug(uint64_t CodeAddr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// There should be only a single event listener per process, otherwise perf gets
|
||||||
|
// confused.
|
||||||
|
llvm::ManagedStatic<PerfJITEventListener> PerfListener;
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
JITEventListener *JITEventListener::createPerfJITEventListener() {
|
JITEventListener *JITEventListener::createPerfJITEventListener() {
|
||||||
// There should be only a single event listener per process, otherwise perf
|
return &*PerfListener;
|
||||||
// gets confused.
|
|
||||||
static PerfJITEventListener PerfListener;
|
|
||||||
return &PerfListener;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "llvm/Object/ELFObjectFile.h"
|
#include "llvm/Object/ELFObjectFile.h"
|
||||||
#include "llvm/Support/Alignment.h"
|
#include "llvm/Support/Alignment.h"
|
||||||
#include "llvm/Support/MSVCErrorWorkarounds.h"
|
#include "llvm/Support/MSVCErrorWorkarounds.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
@ -50,6 +51,8 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ManagedStatic<RuntimeDyldErrorCategory> RTDyldErrorCategory;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char RuntimeDyldError::ID = 0;
|
char RuntimeDyldError::ID = 0;
|
||||||
|
@ -59,8 +62,7 @@ void RuntimeDyldError::log(raw_ostream &OS) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_code RuntimeDyldError::convertToErrorCode() const {
|
std::error_code RuntimeDyldError::convertToErrorCode() const {
|
||||||
static RuntimeDyldErrorCategory RTDyldErrorCategory;
|
return std::error_code(GenericRTDyldError, *RTDyldErrorCategory);
|
||||||
return std::error_code(GenericRTDyldError, RTDyldErrorCategory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty out-of-line virtual destructor as the key function.
|
// Empty out-of-line virtual destructor as the key function.
|
||||||
|
|
|
@ -74,16 +74,13 @@ void LLVMDisposeMessage(char *Message) {
|
||||||
|
|
||||||
/*===-- Operations on contexts --------------------------------------------===*/
|
/*===-- Operations on contexts --------------------------------------------===*/
|
||||||
|
|
||||||
static LLVMContext &getGlobalContext() {
|
static ManagedStatic<LLVMContext> GlobalContext;
|
||||||
static LLVMContext GlobalContext;
|
|
||||||
return GlobalContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
LLVMContextRef LLVMContextCreate() {
|
LLVMContextRef LLVMContextCreate() {
|
||||||
return wrap(new LLVMContext());
|
return wrap(new LLVMContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMContextRef LLVMGetGlobalContext() { return wrap(&getGlobalContext()); }
|
LLVMContextRef LLVMGetGlobalContext() { return wrap(&*GlobalContext); }
|
||||||
|
|
||||||
void LLVMContextSetDiagnosticHandler(LLVMContextRef C,
|
void LLVMContextSetDiagnosticHandler(LLVMContextRef C,
|
||||||
LLVMDiagnosticHandler Handler,
|
LLVMDiagnosticHandler Handler,
|
||||||
|
@ -254,7 +251,7 @@ LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI) {
|
||||||
/*===-- Operations on modules ---------------------------------------------===*/
|
/*===-- Operations on modules ---------------------------------------------===*/
|
||||||
|
|
||||||
LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID) {
|
LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID) {
|
||||||
return wrap(new Module(ModuleID, getGlobalContext()));
|
return wrap(new Module(ModuleID, *GlobalContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID,
|
LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID,
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/TypeSize.h"
|
#include "llvm/Support/TypeSize.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -240,7 +241,7 @@ void LLVMContextImpl::getSyncScopeNames(
|
||||||
/// singleton OptBisect if not explicitly set.
|
/// singleton OptBisect if not explicitly set.
|
||||||
OptPassGate &LLVMContextImpl::getOptPassGate() const {
|
OptPassGate &LLVMContextImpl::getOptPassGate() const {
|
||||||
if (!OPG)
|
if (!OPG)
|
||||||
OPG = &getOptBisector();
|
OPG = &(*OptBisector);
|
||||||
return *OPG;
|
return *OPG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ using namespace llvm;
|
||||||
static cl::opt<int> OptBisectLimit("opt-bisect-limit", cl::Hidden,
|
static cl::opt<int> OptBisectLimit("opt-bisect-limit", cl::Hidden,
|
||||||
cl::init(OptBisect::Disabled), cl::Optional,
|
cl::init(OptBisect::Disabled), cl::Optional,
|
||||||
cl::cb<void, int>([](int Limit) {
|
cl::cb<void, int>([](int Limit) {
|
||||||
llvm::getOptBisector().setLimit(Limit);
|
llvm::OptBisector->setLimit(Limit);
|
||||||
}),
|
}),
|
||||||
cl::desc("Maximum optimization to perform"));
|
cl::desc("Maximum optimization to perform"));
|
||||||
|
|
||||||
|
@ -52,7 +52,4 @@ bool OptBisect::checkPass(const StringRef PassName,
|
||||||
|
|
||||||
const int OptBisect::Disabled;
|
const int OptBisect::Disabled;
|
||||||
|
|
||||||
OptBisect &llvm::getOptBisector() {
|
ManagedStatic<OptBisect> llvm::OptBisector;
|
||||||
static OptBisect OptBisector;
|
|
||||||
return OptBisector;
|
|
||||||
}
|
|
||||||
|
|
|
@ -15,15 +15,21 @@
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/PassInfo.h"
|
#include "llvm/PassInfo.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
// FIXME: We use ManagedStatic to erase the pass registrar on shutdown.
|
||||||
|
// Unfortunately, passes are registered with static ctors, and having
|
||||||
|
// llvm_shutdown clear this map prevents successful resurrection after
|
||||||
|
// llvm_shutdown is run. Ideally we should find a solution so that we don't
|
||||||
|
// leak the map, AND can still resurrect after shutdown.
|
||||||
|
static ManagedStatic<PassRegistry> PassRegistryObj;
|
||||||
PassRegistry *PassRegistry::getPassRegistry() {
|
PassRegistry *PassRegistry::getPassRegistry() {
|
||||||
static PassRegistry PassRegistryObj;
|
return &*PassRegistryObj;
|
||||||
return &PassRegistryObj;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "llvm/Object/Error.h"
|
#include "llvm/Object/Error.h"
|
||||||
#include "llvm/ADT/Twine.h"
|
#include "llvm/ADT/Twine.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace object;
|
using namespace object;
|
||||||
|
@ -74,9 +75,10 @@ void GenericBinaryError::log(raw_ostream &OS) const {
|
||||||
OS << Msg;
|
OS << Msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ManagedStatic<_object_error_category> error_category;
|
||||||
|
|
||||||
const std::error_category &object::object_category() {
|
const std::error_category &object::object_category() {
|
||||||
static _object_error_category error_category;
|
return *error_category;
|
||||||
return error_category;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Error llvm::object::isNotObjectErrorInvalidFileType(llvm::Error Err) {
|
llvm::Error llvm::object::isNotObjectErrorInvalidFileType(llvm::Error Err) {
|
||||||
|
|
|
@ -901,11 +901,10 @@ bool OptNoneInstrumentation::shouldRun(StringRef PassID, Any IR) {
|
||||||
|
|
||||||
void OptBisectInstrumentation::registerCallbacks(
|
void OptBisectInstrumentation::registerCallbacks(
|
||||||
PassInstrumentationCallbacks &PIC) {
|
PassInstrumentationCallbacks &PIC) {
|
||||||
if (!getOptBisector().isEnabled())
|
if (!OptBisector->isEnabled())
|
||||||
return;
|
return;
|
||||||
PIC.registerShouldRunOptionalPassCallback([](StringRef PassID, Any IR) {
|
PIC.registerShouldRunOptionalPassCallback([](StringRef PassID, Any IR) {
|
||||||
return isIgnored(PassID) ||
|
return isIgnored(PassID) || OptBisector->checkPass(PassID, getIRName(IR));
|
||||||
getOptBisector().checkPass(PassID, getIRName(IR));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "llvm/Support/Errc.h"
|
#include "llvm/Support/Errc.h"
|
||||||
#include "llvm/Support/Error.h"
|
#include "llvm/Support/Error.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -896,9 +897,10 @@ std::string CoverageMapError::message() const {
|
||||||
return getCoverageMapErrString(Err);
|
return getCoverageMapErrString(Err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ManagedStatic<CoverageMappingErrorCategoryType> ErrorCategory;
|
||||||
|
|
||||||
const std::error_category &llvm::coverage::coveragemap_category() {
|
const std::error_category &llvm::coverage::coveragemap_category() {
|
||||||
static CoverageMappingErrorCategoryType ErrorCategory;
|
return *ErrorCategory;
|
||||||
return ErrorCategory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char CoverageMapError::ID = 0;
|
char CoverageMapError::ID = 0;
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "llvm/Support/Error.h"
|
#include "llvm/Support/Error.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/LEB128.h"
|
#include "llvm/Support/LEB128.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/Path.h"
|
#include "llvm/Support/Path.h"
|
||||||
#include "llvm/Support/SwapByteOrder.h"
|
#include "llvm/Support/SwapByteOrder.h"
|
||||||
|
@ -176,9 +177,10 @@ class InstrProfErrorCategoryType : public std::error_category {
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
static ManagedStatic<InstrProfErrorCategoryType> ErrorCategory;
|
||||||
|
|
||||||
const std::error_category &llvm::instrprof_category() {
|
const std::error_category &llvm::instrprof_category() {
|
||||||
static InstrProfErrorCategoryType ErrorCategory;
|
return *ErrorCategory;
|
||||||
return ErrorCategory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
@ -97,9 +98,10 @@ class SampleProfErrorCategoryType : public std::error_category {
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
static ManagedStatic<SampleProfErrorCategoryType> ErrorCategory;
|
||||||
|
|
||||||
const std::error_category &llvm::sampleprof_category() {
|
const std::error_category &llvm::sampleprof_category() {
|
||||||
static SampleProfErrorCategoryType ErrorCategory;
|
return *ErrorCategory;
|
||||||
return ErrorCategory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineLocation::print(raw_ostream &OS) const {
|
void LineLocation::print(raw_ostream &OS) const {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "llvm/Support/Error.h"
|
#include "llvm/Support/Error.h"
|
||||||
#include "llvm/ADT/Twine.h"
|
#include "llvm/ADT/Twine.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
@ -45,10 +46,7 @@ namespace {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorErrorCategory &getErrorErrorCat() {
|
static ManagedStatic<ErrorErrorCategory> ErrorErrorCat;
|
||||||
static ErrorErrorCategory ErrorErrorCat;
|
|
||||||
return ErrorErrorCat;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
|
@ -73,19 +71,19 @@ void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner) {
|
||||||
|
|
||||||
std::error_code ErrorList::convertToErrorCode() const {
|
std::error_code ErrorList::convertToErrorCode() const {
|
||||||
return std::error_code(static_cast<int>(ErrorErrorCode::MultipleErrors),
|
return std::error_code(static_cast<int>(ErrorErrorCode::MultipleErrors),
|
||||||
getErrorErrorCat());
|
*ErrorErrorCat);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_code inconvertibleErrorCode() {
|
std::error_code inconvertibleErrorCode() {
|
||||||
return std::error_code(static_cast<int>(ErrorErrorCode::InconvertibleError),
|
return std::error_code(static_cast<int>(ErrorErrorCode::InconvertibleError),
|
||||||
getErrorErrorCat());
|
*ErrorErrorCat);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_code FileError::convertToErrorCode() const {
|
std::error_code FileError::convertToErrorCode() const {
|
||||||
std::error_code NestedEC = Err->convertToErrorCode();
|
std::error_code NestedEC = Err->convertToErrorCode();
|
||||||
if (NestedEC == inconvertibleErrorCode())
|
if (NestedEC == inconvertibleErrorCode())
|
||||||
return std::error_code(static_cast<int>(ErrorErrorCode::FileError),
|
return std::error_code(static_cast<int>(ErrorErrorCode::FileError),
|
||||||
getErrorErrorCat());
|
*ErrorErrorCat);
|
||||||
return NestedEC;
|
return NestedEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "llvm/ADT/Hashing.h"
|
#include "llvm/ADT/Hashing.h"
|
||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include "llvm/Config/config.h"
|
#include "llvm/Config/config.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#if HAVE_FCNTL_H
|
#if HAVE_FCNTL_H
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -326,6 +327,10 @@ extern "C" int del_curterm(struct term *termp);
|
||||||
extern "C" int tigetnum(char *capname);
|
extern "C" int tigetnum(char *capname);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef LLVM_ENABLE_TERMINFO
|
||||||
|
static ManagedStatic<std::mutex> TermColorMutex;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool checkTerminalEnvironmentForColors() {
|
bool checkTerminalEnvironmentForColors() {
|
||||||
if (const char *TermStr = std::getenv("TERM")) {
|
if (const char *TermStr = std::getenv("TERM")) {
|
||||||
return StringSwitch<bool>(TermStr)
|
return StringSwitch<bool>(TermStr)
|
||||||
|
@ -346,8 +351,7 @@ bool checkTerminalEnvironmentForColors() {
|
||||||
static bool terminalHasColors(int fd) {
|
static bool terminalHasColors(int fd) {
|
||||||
#ifdef LLVM_ENABLE_TERMINFO
|
#ifdef LLVM_ENABLE_TERMINFO
|
||||||
// First, acquire a global lock because these C routines are thread hostile.
|
// First, acquire a global lock because these C routines are thread hostile.
|
||||||
static std::mutex TermColorMutex;
|
std::lock_guard<std::mutex> G(*TermColorMutex);
|
||||||
std::lock_guard<std::mutex> G(TermColorMutex);
|
|
||||||
|
|
||||||
struct term *previous_term = set_curterm(nullptr);
|
struct term *previous_term = set_curterm(nullptr);
|
||||||
int errret = 0;
|
int errret = 0;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "llvm/IR/InstIterator.h"
|
#include "llvm/IR/InstIterator.h"
|
||||||
#include "llvm/IR/Module.h"
|
#include "llvm/IR/Module.h"
|
||||||
#include "llvm/IR/Operator.h"
|
#include "llvm/IR/Operator.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/Mutex.h"
|
#include "llvm/Support/Mutex.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
@ -31,27 +32,19 @@ namespace llvm {
|
||||||
namespace {
|
namespace {
|
||||||
typedef std::map<std::string, std::vector<unsigned> > key_val_pair_t;
|
typedef std::map<std::string, std::vector<unsigned> > key_val_pair_t;
|
||||||
typedef std::map<const GlobalValue *, key_val_pair_t> global_val_annot_t;
|
typedef std::map<const GlobalValue *, key_val_pair_t> global_val_annot_t;
|
||||||
|
typedef std::map<const Module *, global_val_annot_t> per_module_annot_t;
|
||||||
struct AnnotationCache {
|
|
||||||
sys::Mutex Lock;
|
|
||||||
std::map<const Module *, global_val_annot_t> Cache;
|
|
||||||
};
|
|
||||||
|
|
||||||
AnnotationCache &getAnnotationCache() {
|
|
||||||
static AnnotationCache AC;
|
|
||||||
return AC;
|
|
||||||
}
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
|
static ManagedStatic<per_module_annot_t> annotationCache;
|
||||||
|
static sys::Mutex Lock;
|
||||||
|
|
||||||
void clearAnnotationCache(const Module *Mod) {
|
void clearAnnotationCache(const Module *Mod) {
|
||||||
auto &AC = getAnnotationCache();
|
std::lock_guard<sys::Mutex> Guard(Lock);
|
||||||
std::lock_guard<sys::Mutex> Guard(AC.Lock);
|
annotationCache->erase(Mod);
|
||||||
AC.Cache.erase(Mod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cacheAnnotationFromMD(const MDNode *md, key_val_pair_t &retval) {
|
static void cacheAnnotationFromMD(const MDNode *md, key_val_pair_t &retval) {
|
||||||
auto &AC = getAnnotationCache();
|
std::lock_guard<sys::Mutex> Guard(Lock);
|
||||||
std::lock_guard<sys::Mutex> Guard(AC.Lock);
|
|
||||||
assert(md && "Invalid mdnode for annotation");
|
assert(md && "Invalid mdnode for annotation");
|
||||||
assert((md->getNumOperands() % 2) == 1 && "Invalid number of operands");
|
assert((md->getNumOperands() % 2) == 1 && "Invalid number of operands");
|
||||||
// start index = 1, to skip the global variable key
|
// start index = 1, to skip the global variable key
|
||||||
|
@ -77,8 +70,7 @@ static void cacheAnnotationFromMD(const MDNode *md, key_val_pair_t &retval) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cacheAnnotationFromMD(const Module *m, const GlobalValue *gv) {
|
static void cacheAnnotationFromMD(const Module *m, const GlobalValue *gv) {
|
||||||
auto &AC = getAnnotationCache();
|
std::lock_guard<sys::Mutex> Guard(Lock);
|
||||||
std::lock_guard<sys::Mutex> Guard(AC.Lock);
|
|
||||||
NamedMDNode *NMD = m->getNamedMetadata("nvvm.annotations");
|
NamedMDNode *NMD = m->getNamedMetadata("nvvm.annotations");
|
||||||
if (!NMD)
|
if (!NMD)
|
||||||
return;
|
return;
|
||||||
|
@ -101,42 +93,40 @@ static void cacheAnnotationFromMD(const Module *m, const GlobalValue *gv) {
|
||||||
if (tmp.empty()) // no annotations for this gv
|
if (tmp.empty()) // no annotations for this gv
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (AC.Cache.find(m) != AC.Cache.end())
|
if ((*annotationCache).find(m) != (*annotationCache).end())
|
||||||
AC.Cache[m][gv] = std::move(tmp);
|
(*annotationCache)[m][gv] = std::move(tmp);
|
||||||
else {
|
else {
|
||||||
global_val_annot_t tmp1;
|
global_val_annot_t tmp1;
|
||||||
tmp1[gv] = std::move(tmp);
|
tmp1[gv] = std::move(tmp);
|
||||||
AC.Cache[m] = std::move(tmp1);
|
(*annotationCache)[m] = std::move(tmp1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool findOneNVVMAnnotation(const GlobalValue *gv, const std::string &prop,
|
bool findOneNVVMAnnotation(const GlobalValue *gv, const std::string &prop,
|
||||||
unsigned &retval) {
|
unsigned &retval) {
|
||||||
auto &AC = getAnnotationCache();
|
std::lock_guard<sys::Mutex> Guard(Lock);
|
||||||
std::lock_guard<sys::Mutex> Guard(AC.Lock);
|
|
||||||
const Module *m = gv->getParent();
|
const Module *m = gv->getParent();
|
||||||
if (AC.Cache.find(m) == AC.Cache.end())
|
if ((*annotationCache).find(m) == (*annotationCache).end())
|
||||||
cacheAnnotationFromMD(m, gv);
|
cacheAnnotationFromMD(m, gv);
|
||||||
else if (AC.Cache[m].find(gv) == AC.Cache[m].end())
|
else if ((*annotationCache)[m].find(gv) == (*annotationCache)[m].end())
|
||||||
cacheAnnotationFromMD(m, gv);
|
cacheAnnotationFromMD(m, gv);
|
||||||
if (AC.Cache[m][gv].find(prop) == AC.Cache[m][gv].end())
|
if ((*annotationCache)[m][gv].find(prop) == (*annotationCache)[m][gv].end())
|
||||||
return false;
|
return false;
|
||||||
retval = AC.Cache[m][gv][prop][0];
|
retval = (*annotationCache)[m][gv][prop][0];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool findAllNVVMAnnotation(const GlobalValue *gv, const std::string &prop,
|
bool findAllNVVMAnnotation(const GlobalValue *gv, const std::string &prop,
|
||||||
std::vector<unsigned> &retval) {
|
std::vector<unsigned> &retval) {
|
||||||
auto &AC = getAnnotationCache();
|
std::lock_guard<sys::Mutex> Guard(Lock);
|
||||||
std::lock_guard<sys::Mutex> Guard(AC.Lock);
|
|
||||||
const Module *m = gv->getParent();
|
const Module *m = gv->getParent();
|
||||||
if (AC.Cache.find(m) == AC.Cache.end())
|
if ((*annotationCache).find(m) == (*annotationCache).end())
|
||||||
cacheAnnotationFromMD(m, gv);
|
cacheAnnotationFromMD(m, gv);
|
||||||
else if (AC.Cache[m].find(gv) == AC.Cache[m].end())
|
else if ((*annotationCache)[m].find(gv) == (*annotationCache)[m].end())
|
||||||
cacheAnnotationFromMD(m, gv);
|
cacheAnnotationFromMD(m, gv);
|
||||||
if (AC.Cache[m][gv].find(prop) == AC.Cache[m][gv].end())
|
if ((*annotationCache)[m][gv].find(prop) == (*annotationCache)[m][gv].end())
|
||||||
return false;
|
return false;
|
||||||
retval = AC.Cache[m][gv][prop];
|
retval = (*annotationCache)[m][gv][prop];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "WebAssemblyRuntimeLibcallSignatures.h"
|
#include "WebAssemblyRuntimeLibcallSignatures.h"
|
||||||
#include "WebAssemblySubtarget.h"
|
#include "WebAssemblySubtarget.h"
|
||||||
#include "llvm/CodeGen/RuntimeLibcalls.h"
|
#include "llvm/CodeGen/RuntimeLibcalls.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
@ -481,13 +482,10 @@ struct RuntimeLibcallSignatureTable {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RuntimeLibcallSignatureTable &getRuntimeLibcallSignatures() {
|
ManagedStatic<RuntimeLibcallSignatureTable> RuntimeLibcallSignatures;
|
||||||
static RuntimeLibcallSignatureTable RuntimeLibcallSignatures;
|
|
||||||
return RuntimeLibcallSignatures;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Maps libcall names to their RTLIB::Libcall number. Builds the map in a
|
// Maps libcall names to their RTLIB::Libcall number. Builds the map in a
|
||||||
// constructor for use with a static variable
|
// constructor for use with ManagedStatic
|
||||||
struct StaticLibcallNameMap {
|
struct StaticLibcallNameMap {
|
||||||
StringMap<RTLIB::Libcall> Map;
|
StringMap<RTLIB::Libcall> Map;
|
||||||
StaticLibcallNameMap() {
|
StaticLibcallNameMap() {
|
||||||
|
@ -498,8 +496,7 @@ struct StaticLibcallNameMap {
|
||||||
};
|
};
|
||||||
for (const auto &NameLibcall : NameLibcalls) {
|
for (const auto &NameLibcall : NameLibcalls) {
|
||||||
if (NameLibcall.first != nullptr &&
|
if (NameLibcall.first != nullptr &&
|
||||||
getRuntimeLibcallSignatures().Table[NameLibcall.second] !=
|
RuntimeLibcallSignatures->Table[NameLibcall.second] != unsupported) {
|
||||||
unsupported) {
|
|
||||||
assert(Map.find(NameLibcall.first) == Map.end() &&
|
assert(Map.find(NameLibcall.first) == Map.end() &&
|
||||||
"duplicate libcall names in name map");
|
"duplicate libcall names in name map");
|
||||||
Map[NameLibcall.first] = NameLibcall.second;
|
Map[NameLibcall.first] = NameLibcall.second;
|
||||||
|
@ -526,7 +523,7 @@ void llvm::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
|
||||||
wasm::ValType PtrTy =
|
wasm::ValType PtrTy =
|
||||||
Subtarget.hasAddr64() ? wasm::ValType::I64 : wasm::ValType::I32;
|
Subtarget.hasAddr64() ? wasm::ValType::I64 : wasm::ValType::I32;
|
||||||
|
|
||||||
auto &Table = getRuntimeLibcallSignatures().Table;
|
auto &Table = RuntimeLibcallSignatures->Table;
|
||||||
switch (Table[LC]) {
|
switch (Table[LC]) {
|
||||||
case func:
|
case func:
|
||||||
break;
|
break;
|
||||||
|
@ -888,14 +885,14 @@ void llvm::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ManagedStatic<StaticLibcallNameMap> LibcallNameMap;
|
||||||
// TODO: If the RTLIB::Libcall-taking flavor of GetSignature remains unsed
|
// TODO: If the RTLIB::Libcall-taking flavor of GetSignature remains unsed
|
||||||
// other than here, just roll its logic into this version.
|
// other than here, just roll its logic into this version.
|
||||||
void llvm::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
|
void llvm::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
|
||||||
StringRef Name,
|
StringRef Name,
|
||||||
SmallVectorImpl<wasm::ValType> &Rets,
|
SmallVectorImpl<wasm::ValType> &Rets,
|
||||||
SmallVectorImpl<wasm::ValType> &Params) {
|
SmallVectorImpl<wasm::ValType> &Params) {
|
||||||
static StaticLibcallNameMap LibcallNameMap;
|
auto &Map = LibcallNameMap->Map;
|
||||||
auto &Map = LibcallNameMap.Map;
|
|
||||||
auto Val = Map.find(Name);
|
auto Val = Map.find(Name);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (Val == Map.end()) {
|
if (Val == Map.end()) {
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include "X86InstrRelaxTables.h"
|
#include "X86InstrRelaxTables.h"
|
||||||
#include "X86InstrInfo.h"
|
#include "X86InstrInfo.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include <atomic>
|
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
@ -120,7 +119,7 @@ const X86InstrRelaxTableEntry *llvm::lookupRelaxTable(unsigned ShortOp) {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// This class stores the short form tables. It is instantiated as a
|
// This class stores the short form tables. It is instantiated as a
|
||||||
// function scope static variable to lazily init the short form table.
|
// ManagedStatic to lazily init the short form table.
|
||||||
struct X86ShortFormTable {
|
struct X86ShortFormTable {
|
||||||
// Stores relaxation table entries sorted by relaxed form opcode.
|
// Stores relaxation table entries sorted by relaxed form opcode.
|
||||||
SmallVector<X86InstrRelaxTableEntry, 0> Table;
|
SmallVector<X86InstrRelaxTableEntry, 0> Table;
|
||||||
|
@ -138,9 +137,10 @@ struct X86ShortFormTable {
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
static ManagedStatic<X86ShortFormTable> ShortTable;
|
||||||
|
|
||||||
const X86InstrRelaxTableEntry *llvm::lookupShortTable(unsigned RelaxOp) {
|
const X86InstrRelaxTableEntry *llvm::lookupShortTable(unsigned RelaxOp) {
|
||||||
static X86ShortFormTable ShortTable;
|
auto &Table = ShortTable->Table;
|
||||||
auto &Table = ShortTable.Table;
|
|
||||||
auto I = llvm::lower_bound(Table, RelaxOp);
|
auto I = llvm::lower_bound(Table, RelaxOp);
|
||||||
if (I != Table.end() && I->KeyOp == RelaxOp)
|
if (I != Table.end() && I->KeyOp == RelaxOp)
|
||||||
return &*I;
|
return &*I;
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "llvm/CodeGen/MachineOperand.h"
|
#include "llvm/CodeGen/MachineOperand.h"
|
||||||
#include "llvm/MC/MCInstrDesc.h"
|
#include "llvm/MC/MCInstrDesc.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include <atomic>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include "X86InstrFoldTables.h"
|
#include "X86InstrFoldTables.h"
|
||||||
#include "X86InstrInfo.h"
|
#include "X86InstrInfo.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include <atomic>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
@ -6103,7 +6102,7 @@ llvm::lookupFoldTable(unsigned RegOp, unsigned OpNum) {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// This class stores the memory unfolding tables. It is instantiated as a
|
// This class stores the memory unfolding tables. It is instantiated as a
|
||||||
// function scope static variable to lazily init the unfolding table.
|
// ManagedStatic to lazily init the unfolding table.
|
||||||
struct X86MemUnfoldTable {
|
struct X86MemUnfoldTable {
|
||||||
// Stores memory unfolding tables entries sorted by opcode.
|
// Stores memory unfolding tables entries sorted by opcode.
|
||||||
std::vector<X86MemoryFoldTableEntry> Table;
|
std::vector<X86MemoryFoldTableEntry> Table;
|
||||||
|
@ -6160,10 +6159,11 @@ struct X86MemUnfoldTable {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ManagedStatic<X86MemUnfoldTable> MemUnfoldTable;
|
||||||
|
|
||||||
const X86MemoryFoldTableEntry *
|
const X86MemoryFoldTableEntry *
|
||||||
llvm::lookupUnfoldTable(unsigned MemOp) {
|
llvm::lookupUnfoldTable(unsigned MemOp) {
|
||||||
static X86MemUnfoldTable MemUnfoldTable;
|
auto &Table = MemUnfoldTable->Table;
|
||||||
auto &Table = MemUnfoldTable.Table;
|
|
||||||
auto I = llvm::lower_bound(Table, MemOp);
|
auto I = llvm::lower_bound(Table, MemOp);
|
||||||
if (I != Table.end() && I->KeyOp == MemOp)
|
if (I != Table.end() && I->KeyOp == MemOp)
|
||||||
return &*I;
|
return &*I;
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "llvm/Support/FormattedStream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/Host.h"
|
#include "llvm/Support/Host.h"
|
||||||
#include "llvm/Support/InitLLVM.h"
|
#include "llvm/Support/InitLLVM.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/PluginLoader.h"
|
#include "llvm/Support/PluginLoader.h"
|
||||||
#include "llvm/Support/SourceMgr.h"
|
#include "llvm/Support/SourceMgr.h"
|
||||||
#include "llvm/Support/TargetSelect.h"
|
#include "llvm/Support/TargetSelect.h"
|
||||||
|
@ -191,11 +192,7 @@ static cl::opt<std::string> RemarksFormat(
|
||||||
cl::value_desc("format"), cl::init("yaml"));
|
cl::value_desc("format"), cl::init("yaml"));
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
static ManagedStatic<std::vector<std::string>> RunPassNames;
|
||||||
std::vector<std::string> &getRunPassNames() {
|
|
||||||
static std::vector<std::string> RunPassNames;
|
|
||||||
return RunPassNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct RunPassOption {
|
struct RunPassOption {
|
||||||
void operator=(const std::string &Val) const {
|
void operator=(const std::string &Val) const {
|
||||||
|
@ -204,7 +201,7 @@ struct RunPassOption {
|
||||||
SmallVector<StringRef, 8> PassNames;
|
SmallVector<StringRef, 8> PassNames;
|
||||||
StringRef(Val).split(PassNames, ',', -1, false);
|
StringRef(Val).split(PassNames, ',', -1, false);
|
||||||
for (auto PassName : PassNames)
|
for (auto PassName : PassNames)
|
||||||
getRunPassNames().push_back(std::string(PassName));
|
RunPassNames->push_back(std::string(PassName));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -679,7 +676,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
|
||||||
|
|
||||||
// Construct a custom pass pipeline that starts after instruction
|
// Construct a custom pass pipeline that starts after instruction
|
||||||
// selection.
|
// selection.
|
||||||
if (!getRunPassNames().empty()) {
|
if (!RunPassNames->empty()) {
|
||||||
if (!MIR) {
|
if (!MIR) {
|
||||||
WithColor::warning(errs(), argv[0])
|
WithColor::warning(errs(), argv[0])
|
||||||
<< "run-pass is for .mir file only.\n";
|
<< "run-pass is for .mir file only.\n";
|
||||||
|
@ -697,7 +694,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
|
||||||
PM.add(&TPC);
|
PM.add(&TPC);
|
||||||
PM.add(MMIWP);
|
PM.add(MMIWP);
|
||||||
TPC.printAndVerify("");
|
TPC.printAndVerify("");
|
||||||
for (const std::string &RunPassName : getRunPassNames()) {
|
for (const std::string &RunPassName : *RunPassNames) {
|
||||||
if (addPass(PM, argv0, RunPassName, TPC))
|
if (addPass(PM, argv0, RunPassName, TPC))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
#include "xray-registry.h"
|
#include "xray-registry.h"
|
||||||
|
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
@ -18,22 +19,19 @@ namespace xray {
|
||||||
|
|
||||||
using HandlerType = std::function<Error()>;
|
using HandlerType = std::function<Error()>;
|
||||||
|
|
||||||
static std::unordered_map<cl::SubCommand *, HandlerType> &getCommands() {
|
ManagedStatic<std::unordered_map<cl::SubCommand *, HandlerType>> Commands;
|
||||||
static std::unordered_map<cl::SubCommand *, HandlerType> Commands;
|
|
||||||
return Commands;
|
|
||||||
}
|
|
||||||
|
|
||||||
CommandRegistration::CommandRegistration(cl::SubCommand *SC,
|
CommandRegistration::CommandRegistration(cl::SubCommand *SC,
|
||||||
HandlerType Command) {
|
HandlerType Command) {
|
||||||
assert(getCommands().count(SC) == 0 &&
|
assert(Commands->count(SC) == 0 &&
|
||||||
"Attempting to overwrite a command handler");
|
"Attempting to overwrite a command handler");
|
||||||
assert(Command && "Attempting to register an empty std::function<Error()>");
|
assert(Command && "Attempting to register an empty std::function<Error()>");
|
||||||
getCommands()[SC] = Command;
|
(*Commands)[SC] = Command;
|
||||||
}
|
}
|
||||||
|
|
||||||
HandlerType dispatch(cl::SubCommand *SC) {
|
HandlerType dispatch(cl::SubCommand *SC) {
|
||||||
auto It = getCommands().find(SC);
|
auto It = Commands->find(SC);
|
||||||
assert(It != getCommands().end() &&
|
assert(It != Commands->end() &&
|
||||||
"Attempting to dispatch on un-registered SubCommand.");
|
"Attempting to dispatch on un-registered SubCommand.");
|
||||||
return It->second;
|
return It->second;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "llvm/ADT/Twine.h"
|
#include "llvm/ADT/Twine.h"
|
||||||
#include "llvm/Support/Errc.h"
|
#include "llvm/Support/Errc.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Testing/Support/Error.h"
|
#include "llvm/Testing/Support/Error.h"
|
||||||
#include "gtest/gtest-spi.h"
|
#include "gtest/gtest-spi.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
@ -1038,10 +1039,8 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::error_category &TErrorCategory() {
|
static llvm::ManagedStatic<TestErrorCategory> TestErrCategory;
|
||||||
static TestErrorCategory TestErrCategory;
|
const std::error_category &TErrorCategory() { return *TestErrCategory; }
|
||||||
return TestErrCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
char TestDebugError::ID;
|
char TestDebugError::ID;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue