本文整理汇总了C++中llvm::ManagedStatic类的典型用法代码示例。如果您正苦于以下问题:C++ ManagedStatic类的具体用法?C++ ManagedStatic怎么用?C++ ManagedStatic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ManagedStatic类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DtoUnpaddedStructType
/// Return the type returned by DtoUnpaddedStruct called on a value of the
/// specified type.
/// Union types will get expanded into a struct, with a type for each member.
LLType* DtoUnpaddedStructType(Type* dty) {
assert(dty->ty == Tstruct);
typedef llvm::DenseMap<Type*, llvm::StructType*> CacheT;
static llvm::ManagedStatic<CacheT> cache;
CacheT::iterator it = cache->find(dty);
if (it != cache->end())
return it->second;
TypeStruct* sty = static_cast<TypeStruct*>(dty);
VarDeclarations& fields = sty->sym->fields;
std::vector<LLType*> types;
types.reserve(fields.dim);
for (unsigned i = 0; i < fields.dim; i++) {
LLType* fty;
if (fields[i]->type->ty == Tstruct) {
// Nested structs are the only members that can contain padding
fty = DtoUnpaddedStructType(fields[i]->type);
} else {
fty = DtoType(fields[i]->type);
}
types.push_back(fty);
}
LLStructType* Ty = LLStructType::get(gIR->context(), types);
cache->insert(std::make_pair(dty, Ty));
return Ty;
}
开发者ID:rainers,项目名称:ldc,代码行数:32,代码来源:structs.cpp
示例2: create
namespace mcld {
typedef GCFactory<NameSpec, MCLD_SYMBOLS_PER_INPUT> NameSpecFactory;
static llvm::ManagedStatic<NameSpecFactory> g_NameSpecFactory;
//===----------------------------------------------------------------------===//
// NameSpec
//===----------------------------------------------------------------------===//
NameSpec::NameSpec() {
}
NameSpec::NameSpec(const std::string& pName, bool pAsNeeded)
: InputToken(InputToken::NameSpec, pName, pAsNeeded) {
}
NameSpec::~NameSpec() {
}
NameSpec* NameSpec::create(const std::string& pName, bool pAsNeeded) {
NameSpec* result = g_NameSpecFactory->allocate();
new (result) NameSpec(pName, pAsNeeded);
return result;
}
void NameSpec::destroy(NameSpec*& pNameSpec) {
g_NameSpecFactory->destroy(pNameSpec);
g_NameSpecFactory->deallocate(pNameSpec);
pNameSpec = NULL;
}
void NameSpec::clear() {
g_NameSpecFactory->clear();
}
} // namespace mcld
开发者ID:ChihMin,项目名称:mclinker,代码行数:35,代码来源:NameSpec.cpp
示例3: Create
namespace mcld {
typedef GCFactory<SectionData, MCLD_SECTIONS_PER_INPUT> SectDataFactory;
static llvm::ManagedStatic<SectDataFactory> g_SectDataFactory;
//===----------------------------------------------------------------------===//
// SectionData
//===----------------------------------------------------------------------===//
SectionData::SectionData() : m_pSection(NULL) {
}
SectionData::SectionData(LDSection& pSection) : m_pSection(&pSection) {
}
SectionData* SectionData::Create(LDSection& pSection) {
SectionData* result = g_SectDataFactory->allocate();
new (result) SectionData(pSection);
return result;
}
void SectionData::Destroy(SectionData*& pSection) {
pSection->~SectionData();
g_SectDataFactory->deallocate(pSection);
pSection = NULL;
}
void SectionData::Clear() {
g_SectDataFactory->clear();
}
} // namespace mcld
开发者ID:crystax,项目名称:android-toolchain-mclinker,代码行数:32,代码来源:SectionData.cpp
示例4: create
namespace mcld {
typedef GCFactory<StrToken, MCLD_SYMBOLS_PER_INPUT> StrTokenFactory;
static llvm::ManagedStatic<StrTokenFactory> g_StrTokenFactory;
//===----------------------------------------------------------------------===//
// StrToken
//===----------------------------------------------------------------------===//
StrToken::StrToken() : m_Kind(Unknown) {
}
StrToken::StrToken(Kind pKind, const std::string& pString)
: m_Kind(pKind), m_Name(pString) {
}
StrToken::~StrToken() {
}
StrToken* StrToken::create(const std::string& pString) {
StrToken* result = g_StrTokenFactory->allocate();
new (result) StrToken(String, pString);
return result;
}
void StrToken::destroy(StrToken*& pStrToken) {
g_StrTokenFactory->destroy(pStrToken);
g_StrTokenFactory->deallocate(pStrToken);
pStrToken = NULL;
}
void StrToken::clear() {
g_StrTokenFactory->clear();
}
} // namespace mcld
开发者ID:ChihMin,项目名称:mclinker,代码行数:35,代码来源:StrToken.cpp
示例5: Create
namespace mcld {
typedef GCFactory<RelocData, MCLD_SECTIONS_PER_INPUT> RelocDataFactory;
static llvm::ManagedStatic<RelocDataFactory> g_RelocDataFactory;
//===----------------------------------------------------------------------===//
// RelocData
//===----------------------------------------------------------------------===//
RelocData::RelocData() : m_pSection(NULL) {
}
RelocData::RelocData(LDSection& pSection) : m_pSection(&pSection) {
}
RelocData* RelocData::Create(LDSection& pSection) {
RelocData* result = g_RelocDataFactory->allocate();
new (result) RelocData(pSection);
return result;
}
void RelocData::Destroy(RelocData*& pSection) {
pSection->~RelocData();
g_RelocDataFactory->deallocate(pSection);
pSection = NULL;
}
void RelocData::Clear() {
g_RelocDataFactory->clear();
}
RelocData& RelocData::append(Relocation& pRelocation) {
m_Relocations.push_back(&pRelocation);
return *this;
}
Relocation& RelocData::remove(Relocation& pRelocation) {
iterator iter(pRelocation);
Relocation* rel = m_Relocations.remove(iter);
return *rel;
}
} // namespace mcld
开发者ID:ChihMin,项目名称:mclinker,代码行数:43,代码来源:RelocData.cpp
示例6: push_back
namespace mcld {
typedef GCFactory<StringList, MCLD_SYMBOLS_PER_INPUT> StringListFactory;
static llvm::ManagedStatic<StringListFactory> g_StringListFactory;
//===----------------------------------------------------------------------===//
// StringList
//===----------------------------------------------------------------------===//
StringList::StringList() {
}
StringList::~StringList() {
}
void StringList::push_back(StrToken* pToken) {
m_Tokens.push_back(pToken);
}
void StringList::dump() const {
for (const_iterator it = begin(), ie = end(); it != ie; ++it)
mcld::outs() << (*it)->name() << "\t";
mcld::outs() << "\n";
}
StringList* StringList::create() {
StringList* result = g_StringListFactory->allocate();
new (result) StringList();
return result;
}
void StringList::destroy(StringList*& pStringList) {
g_StringListFactory->destroy(pStringList);
g_StringListFactory->deallocate(pStringList);
pStringList = NULL;
}
void StringList::clear() {
g_StringListFactory->clear();
}
} // namespace mcld
开发者ID:crystax,项目名称:android-toolchain-mclinker,代码行数:41,代码来源:StringList.cpp
示例7: SearchForAddressOfSymbol
void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) {
SmartScopedLock<true> Lock(*SymbolsMutex);
// First check symbols added via AddSymbol().
if (ExplicitSymbols.isConstructed()) {
StringMap<void *>::iterator i = ExplicitSymbols->find(symbolName);
if (i != ExplicitSymbols->end())
return i->second;
}
#if HAVE_DLFCN_H
// Now search the libraries.
if (OpenedHandles) {
for (DenseSet<void *>::iterator I = OpenedHandles->begin(),
E = OpenedHandles->end(); I != E; ++I) {
//lt_ptr ptr = lt_dlsym(*I, symbolName);
void *ptr = dlsym(*I, symbolName);
if (ptr) {
return ptr;
}
}
}
#endif
if (void *Result = llvm::SearchForAddressOfSpecialSymbol(symbolName))
return Result;
// This macro returns the address of a well-known, explicit symbol
#define EXPLICIT_SYMBOL(SYM) \
if (!strcmp(symbolName, #SYM)) return &SYM
// On linux we have a weird situation. The stderr/out/in symbols are both
// macros and global variables because of standards requirements. So, we
// boldly use the EXPLICIT_SYMBOL macro without checking for a #define first.
#if defined(__linux__) and !defined(__ANDROID__) and !defined(__ELLCC__)
{
EXPLICIT_SYMBOL(stderr);
EXPLICIT_SYMBOL(stdout);
EXPLICIT_SYMBOL(stdin);
}
#else
// For everything else, we want to check to make sure the symbol isn't defined
// as a macro before using EXPLICIT_SYMBOL.
{
#ifndef stdin
EXPLICIT_SYMBOL(stdin);
#endif
#ifndef stdout
EXPLICIT_SYMBOL(stdout);
#endif
#ifndef stderr
EXPLICIT_SYMBOL(stderr);
#endif
}
#endif
#undef EXPLICIT_SYMBOL
return nullptr;
}
开发者ID:mitchty,项目名称:ellcc-mirror,代码行数:60,代码来源:DynamicLibrary.cpp
示例8: Null
LDSymbol* LDSymbol::Null() {
// lazy initialization
if (g_NullSymbol->resolveInfo() == NULL) {
g_NullSymbol->setResolveInfo(*ResolveInfo::Null());
g_NullSymbol->setFragmentRef(FragmentRef::Create(*g_NullSymbolFragment, 0));
ResolveInfo::Null()->setSymPtr(&*g_NullSymbol);
}
return &*g_NullSymbol;
}
开发者ID:FulcronZ,项目名称:NyuziToolchain,代码行数:9,代码来源:LDSymbol.cpp
示例9: Create
/// Create - create a fragment reference for a given fragment.
///
/// @param pFrag - the given fragment
/// @param pOffset - the offset, can be larger than the fragment, but can not
/// be larger than the section size.
/// @return if the offset is legal, return the fragment reference. Otherwise,
/// return NULL.
FragmentRef* FragmentRef::Create(Fragment& pFrag, uint64_t pOffset) {
int64_t offset = pOffset;
Fragment* frag = &pFrag;
while (frag != NULL) {
offset -= frag->size();
if (offset <= 0)
break;
frag = frag->getNextNode();
}
if ((frag != NULL) && (frag->size() != 0)) {
if (offset == 0)
frag = frag->getNextNode();
else
offset += frag->size();
}
if (frag == NULL)
return Null();
FragmentRef* result = g_FragRefFactory->allocate();
new (result) FragmentRef(*frag, offset);
return result;
}
开发者ID:ChihMin,项目名称:mclinker,代码行数:32,代码来源:FragmentRef.cpp
示例10:
void
SBDebugger::Initialize ()
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBDebugger::Initialize ()");
g_debugger_lifetime->Initialize(llvm::make_unique<SystemInitializerFull>(), LoadPlugin);
}
开发者ID:CTSRD-CHERI,项目名称:lldb,代码行数:10,代码来源:SBDebugger.cpp
示例11: Create
LDSection* LDSection::Create(const std::string& pName,
LDFileFormat::Kind pKind,
uint32_t pType,
uint32_t pFlag,
uint64_t pSize,
uint64_t pAddr) {
LDSection* result = g_SectFactory->allocate();
new (result) LDSection(pName, pKind, pType, pFlag, pSize, pAddr);
return result;
}
开发者ID:ChihMin,项目名称:mclinker,代码行数:10,代码来源:LDSection.cpp
示例12: DebugPrintEnabler
DebugPrintEnabler(unsigned PassNumber) {
#ifndef NDEBUG
OldDebugFlag = llvm::DebugFlag;
if (llvm::DebugFlag)
return;
if (DebugPassNumbers->empty())
return;
// Enable debug printing if the pass number matches
// one of the pass numbers provided as a command line option.
for (auto DebugPassNumber : *DebugPassNumbers) {
if (DebugPassNumber == PassNumber) {
llvm::DebugFlag = true;
return;
}
}
#endif
}
开发者ID:007Indian,项目名称:swift,代码行数:17,代码来源:PassManager.cpp
示例13: create
FragOperand* FragOperand::create(Fragment& pFragment) {
FragOperand* result = g_FragOperandFactory->allocate();
new (result) FragOperand(pFragment);
return result;
}
开发者ID:FulcronZ,项目名称:NyuziToolchain,代码行数:5,代码来源:Operand.cpp
示例14: clear
void SectDescOperand::clear() {
g_SectDescOperandFactory->clear();
}
开发者ID:FulcronZ,项目名称:NyuziToolchain,代码行数:3,代码来源:Operand.cpp
示例15: destroy
void SectDescOperand::destroy(SectDescOperand*& pOperand) {
g_SectDescOperandFactory->destroy(pOperand);
g_SectDescOperandFactory->deallocate(pOperand);
pOperand = NULL;
}
开发者ID:FulcronZ,项目名称:NyuziToolchain,代码行数:5,代码来源:Operand.cpp
示例16: Clear
void EhFrame::Clear()
{
g_EhFrameFactory->clear();
}
开发者ID:aurorarom,项目名称:JsonUtil,代码行数:4,代码来源:EhFrame.cpp
示例17: Destroy
void EhFrame::Destroy(EhFrame*& pSection)
{
pSection->~EhFrame();
g_EhFrameFactory->deallocate(pSection);
pSection = NULL;
}
开发者ID:aurorarom,项目名称:JsonUtil,代码行数:6,代码来源:EhFrame.cpp
示例18: Destroy
void RelocData::Destroy(RelocData*& pSection) {
pSection->~RelocData();
g_RelocDataFactory->deallocate(pSection);
pSection = NULL;
}
开发者ID:ChihMin,项目名称:mclinker,代码行数:5,代码来源:RelocData.cpp
示例19: Clear
void RelocData::Clear() {
g_RelocDataFactory->clear();
}
开发者ID:ChihMin,项目名称:mclinker,代码行数:3,代码来源:RelocData.cpp
示例20: Create
EhFrame* EhFrame::Create(LDSection& pSection)
{
EhFrame* result = g_EhFrameFactory->allocate();
new (result) EhFrame(pSection);
return result;
}
开发者ID:aurorarom,项目名称:JsonUtil,代码行数:6,代码来源:EhFrame.cpp
注:本文中的llvm::ManagedStatic类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论