diff options
Diffstat (limited to 'llvm/lib/IR/LLVMContext.cpp')
-rw-r--r-- | llvm/lib/IR/LLVMContext.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp index 0e8d3e826aa..3fc79ed03c3 100644 --- a/llvm/lib/IR/LLVMContext.cpp +++ b/llvm/lib/IR/LLVMContext.cpp @@ -311,6 +311,23 @@ bool LLVMContext::shouldDiscardValueNames() const { return pImpl->DiscardValueNames; } +bool LLVMContext::hasDITypeMap() const { return !!pImpl->DITypeMap; } + +void LLVMContext::ensureDITypeMap() { + if (pImpl->DITypeMap) + return; + + pImpl->DITypeMap = llvm::make_unique<DenseMap<const MDString *, DIType *>>(); +} + +void LLVMContext::destroyDITypeMap() { pImpl->DITypeMap.reset(); } + +DIType **LLVMContext::getOrInsertDITypeMapping(const MDString &S) { + if (!hasDITypeMap()) + return nullptr; + return &(*pImpl->DITypeMap)[&S]; +} + void LLVMContext::setDiscardValueNames(bool Discard) { pImpl->DiscardValueNames = Discard; } |