1ef860a24SChandler Carruth //===-- LLVMContext.cpp - Implement LLVMContext ---------------------------===// 2ef860a24SChandler Carruth // 3ef860a24SChandler Carruth // The LLVM Compiler Infrastructure 4ef860a24SChandler Carruth // 5ef860a24SChandler Carruth // This file is distributed under the University of Illinois Open Source 6ef860a24SChandler Carruth // License. See LICENSE.TXT for details. 7ef860a24SChandler Carruth // 8ef860a24SChandler Carruth //===----------------------------------------------------------------------===// 9ef860a24SChandler Carruth // 10ef860a24SChandler Carruth // This file implements LLVMContext, as a wrapper around the opaque 11ef860a24SChandler Carruth // class LLVMContextImpl. 12ef860a24SChandler Carruth // 13ef860a24SChandler Carruth //===----------------------------------------------------------------------===// 14ef860a24SChandler Carruth 159fb823bbSChandler Carruth #include "llvm/IR/LLVMContext.h" 166bda14b3SChandler Carruth #include "LLVMContextImpl.h" 175354a8aaSEugene Zelenko #include "llvm/ADT/SmallVector.h" 185354a8aaSEugene Zelenko #include "llvm/ADT/StringMap.h" 195354a8aaSEugene Zelenko #include "llvm/ADT/StringRef.h" 205354a8aaSEugene Zelenko #include "llvm/ADT/Twine.h" 21b4c44d23SQuentin Colombet #include "llvm/IR/DiagnosticInfo.h" 22b4c44d23SQuentin Colombet #include "llvm/IR/DiagnosticPrinter.h" 239fb823bbSChandler Carruth #include "llvm/IR/Metadata.h" 245354a8aaSEugene Zelenko #include "llvm/IR/Module.h" 255354a8aaSEugene Zelenko #include "llvm/Support/Casting.h" 265354a8aaSEugene Zelenko #include "llvm/Support/ErrorHandling.h" 275354a8aaSEugene Zelenko #include "llvm/Support/raw_ostream.h" 285354a8aaSEugene Zelenko #include <cassert> 295354a8aaSEugene Zelenko #include <cstdlib> 305354a8aaSEugene Zelenko #include <string> 315354a8aaSEugene Zelenko #include <utility> 325354a8aaSEugene Zelenko 33ef860a24SChandler Carruth using namespace llvm; 34ef860a24SChandler Carruth 35ef860a24SChandler Carruth LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) { 36ef860a24SChandler Carruth // Create the fixed metadata kinds. This is done in the same order as the 37ef860a24SChandler Carruth // MD_* enum values so that they correspond. 386f0b4f2eSPeter Collingbourne std::pair<unsigned, StringRef> MDKinds[] = { 396f0b4f2eSPeter Collingbourne {MD_dbg, "dbg"}, 406f0b4f2eSPeter Collingbourne {MD_tbaa, "tbaa"}, 416f0b4f2eSPeter Collingbourne {MD_prof, "prof"}, 426f0b4f2eSPeter Collingbourne {MD_fpmath, "fpmath"}, 436f0b4f2eSPeter Collingbourne {MD_range, "range"}, 446f0b4f2eSPeter Collingbourne {MD_tbaa_struct, "tbaa.struct"}, 456f0b4f2eSPeter Collingbourne {MD_invariant_load, "invariant.load"}, 466f0b4f2eSPeter Collingbourne {MD_alias_scope, "alias.scope"}, 476f0b4f2eSPeter Collingbourne {MD_noalias, "noalias"}, 486f0b4f2eSPeter Collingbourne {MD_nontemporal, "nontemporal"}, 496f0b4f2eSPeter Collingbourne {MD_mem_parallel_loop_access, "llvm.mem.parallel_loop_access"}, 506f0b4f2eSPeter Collingbourne {MD_nonnull, "nonnull"}, 516f0b4f2eSPeter Collingbourne {MD_dereferenceable, "dereferenceable"}, 526f0b4f2eSPeter Collingbourne {MD_dereferenceable_or_null, "dereferenceable_or_null"}, 536f0b4f2eSPeter Collingbourne {MD_make_implicit, "make.implicit"}, 546f0b4f2eSPeter Collingbourne {MD_unpredictable, "unpredictable"}, 556f0b4f2eSPeter Collingbourne {MD_invariant_group, "invariant.group"}, 566f0b4f2eSPeter Collingbourne {MD_align, "align"}, 576f0b4f2eSPeter Collingbourne {MD_loop, "llvm.loop"}, 586f0b4f2eSPeter Collingbourne {MD_type, "type"}, 596f0b4f2eSPeter Collingbourne {MD_section_prefix, "section_prefix"}, 60235c275bSPeter Collingbourne {MD_absolute_symbol, "absolute_symbol"}, 6151c962f7SEvgeniy Stepanov {MD_associated, "associated"}, 62*36bbc8ceSMatthew Simpson {MD_callees, "callees"}, 636f0b4f2eSPeter Collingbourne }; 64ef860a24SChandler Carruth 656f0b4f2eSPeter Collingbourne for (auto &MDKind : MDKinds) { 666f0b4f2eSPeter Collingbourne unsigned ID = getMDKindID(MDKind.second); 676f0b4f2eSPeter Collingbourne assert(ID == MDKind.first && "metadata kind id drifted"); 686f0b4f2eSPeter Collingbourne (void)ID; 696f0b4f2eSPeter Collingbourne } 70302b69c9SDehao Chen 71cdafd849SSanjoy Das auto *DeoptEntry = pImpl->getOrInsertBundleTag("deopt"); 72cdafd849SSanjoy Das assert(DeoptEntry->second == LLVMContext::OB_deopt && 73cdafd849SSanjoy Das "deopt operand bundle id drifted!"); 74cdafd849SSanjoy Das (void)DeoptEntry; 753bb88c02SDavid Majnemer 763bb88c02SDavid Majnemer auto *FuncletEntry = pImpl->getOrInsertBundleTag("funclet"); 773bb88c02SDavid Majnemer assert(FuncletEntry->second == LLVMContext::OB_funclet && 783bb88c02SDavid Majnemer "funclet operand bundle id drifted!"); 793bb88c02SDavid Majnemer (void)FuncletEntry; 80a34ce95bSSanjoy Das 81a34ce95bSSanjoy Das auto *GCTransitionEntry = pImpl->getOrInsertBundleTag("gc-transition"); 82a34ce95bSSanjoy Das assert(GCTransitionEntry->second == LLVMContext::OB_gc_transition && 83a34ce95bSSanjoy Das "gc-transition operand bundle id drifted!"); 84a34ce95bSSanjoy Das (void)GCTransitionEntry; 85bb80d3e1SKonstantin Zhuravlyov 86bb80d3e1SKonstantin Zhuravlyov SyncScope::ID SingleThreadSSID = 87bb80d3e1SKonstantin Zhuravlyov pImpl->getOrInsertSyncScopeID("singlethread"); 88bb80d3e1SKonstantin Zhuravlyov assert(SingleThreadSSID == SyncScope::SingleThread && 89bb80d3e1SKonstantin Zhuravlyov "singlethread synchronization scope ID drifted!"); 90878fdee0SKonstantin Zhuravlyov (void)SingleThreadSSID; 91bb80d3e1SKonstantin Zhuravlyov 92bb80d3e1SKonstantin Zhuravlyov SyncScope::ID SystemSSID = 93bb80d3e1SKonstantin Zhuravlyov pImpl->getOrInsertSyncScopeID(""); 94bb80d3e1SKonstantin Zhuravlyov assert(SystemSSID == SyncScope::System && 95bb80d3e1SKonstantin Zhuravlyov "system synchronization scope ID drifted!"); 96878fdee0SKonstantin Zhuravlyov (void)SystemSSID; 97ef860a24SChandler Carruth } 985354a8aaSEugene Zelenko 99ef860a24SChandler Carruth LLVMContext::~LLVMContext() { delete pImpl; } 100ef860a24SChandler Carruth 101ef860a24SChandler Carruth void LLVMContext::addModule(Module *M) { 102ef860a24SChandler Carruth pImpl->OwnedModules.insert(M); 103ef860a24SChandler Carruth } 104ef860a24SChandler Carruth 105ef860a24SChandler Carruth void LLVMContext::removeModule(Module *M) { 106ef860a24SChandler Carruth pImpl->OwnedModules.erase(M); 107ef860a24SChandler Carruth } 108ef860a24SChandler Carruth 109ef860a24SChandler Carruth //===----------------------------------------------------------------------===// 110ef860a24SChandler Carruth // Recoverable Backend Errors 111ef860a24SChandler Carruth //===----------------------------------------------------------------------===// 112ef860a24SChandler Carruth 113a594fab4SBob Wilson void LLVMContext:: 114a594fab4SBob Wilson setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler, 115ef860a24SChandler Carruth void *DiagContext) { 116a594fab4SBob Wilson pImpl->InlineAsmDiagHandler = DiagHandler; 117a594fab4SBob Wilson pImpl->InlineAsmDiagContext = DiagContext; 118ef860a24SChandler Carruth } 119ef860a24SChandler Carruth 120a594fab4SBob Wilson /// getInlineAsmDiagnosticHandler - Return the diagnostic handler set by 121a594fab4SBob Wilson /// setInlineAsmDiagnosticHandler. 122a594fab4SBob Wilson LLVMContext::InlineAsmDiagHandlerTy 123a594fab4SBob Wilson LLVMContext::getInlineAsmDiagnosticHandler() const { 124a594fab4SBob Wilson return pImpl->InlineAsmDiagHandler; 125ef860a24SChandler Carruth } 126ef860a24SChandler Carruth 127a594fab4SBob Wilson /// getInlineAsmDiagnosticContext - Return the diagnostic context set by 128a594fab4SBob Wilson /// setInlineAsmDiagnosticHandler. 129a594fab4SBob Wilson void *LLVMContext::getInlineAsmDiagnosticContext() const { 130a594fab4SBob Wilson return pImpl->InlineAsmDiagContext; 131ef860a24SChandler Carruth } 132ef860a24SChandler Carruth 133b5ab895eSVivek Pandya void LLVMContext::setDiagnosticHandlerCallBack( 134b5ab895eSVivek Pandya DiagnosticHandler::DiagnosticHandlerTy DiagnosticHandler, 135b5ab895eSVivek Pandya void *DiagnosticContext, bool RespectFilters) { 136b5ab895eSVivek Pandya pImpl->DiagHandler->DiagHandlerCallback = DiagnosticHandler; 137b5ab895eSVivek Pandya pImpl->DiagHandler->DiagnosticContext = DiagnosticContext; 138b5ab895eSVivek Pandya pImpl->RespectDiagnosticFilters = RespectFilters; 139b5ab895eSVivek Pandya } 140b5ab895eSVivek Pandya 141b5ab895eSVivek Pandya void LLVMContext::setDiagnosticHandler(std::unique_ptr<DiagnosticHandler> &&DH, 14230c9242cSDuncan P. N. Exon Smith bool RespectFilters) { 143b5ab895eSVivek Pandya pImpl->DiagHandler = std::move(DH); 14430c9242cSDuncan P. N. Exon Smith pImpl->RespectDiagnosticFilters = RespectFilters; 145b4c44d23SQuentin Colombet } 146b4c44d23SQuentin Colombet 14744e5f6c4SBrian Gesiak void LLVMContext::setDiagnosticsHotnessRequested(bool Requested) { 14844e5f6c4SBrian Gesiak pImpl->DiagnosticsHotnessRequested = Requested; 14944e5f6c4SBrian Gesiak } 15044e5f6c4SBrian Gesiak bool LLVMContext::getDiagnosticsHotnessRequested() const { 15144e5f6c4SBrian Gesiak return pImpl->DiagnosticsHotnessRequested; 152aad81608SAdam Nemet } 153aad81608SAdam Nemet 1544ef3daafSBrian Gesiak void LLVMContext::setDiagnosticsHotnessThreshold(uint64_t Threshold) { 1554ef3daafSBrian Gesiak pImpl->DiagnosticsHotnessThreshold = Threshold; 1564ef3daafSBrian Gesiak } 1574ef3daafSBrian Gesiak uint64_t LLVMContext::getDiagnosticsHotnessThreshold() const { 1584ef3daafSBrian Gesiak return pImpl->DiagnosticsHotnessThreshold; 1594ef3daafSBrian Gesiak } 1604ef3daafSBrian Gesiak 161a62b7e1aSAdam Nemet yaml::Output *LLVMContext::getDiagnosticsOutputFile() { 162a62b7e1aSAdam Nemet return pImpl->DiagnosticsOutputFile.get(); 163a62b7e1aSAdam Nemet } 164a62b7e1aSAdam Nemet 1656f408368SMehdi Amini void LLVMContext::setDiagnosticsOutputFile(std::unique_ptr<yaml::Output> F) { 1666f408368SMehdi Amini pImpl->DiagnosticsOutputFile = std::move(F); 167a62b7e1aSAdam Nemet } 168a62b7e1aSAdam Nemet 169b5ab895eSVivek Pandya DiagnosticHandler::DiagnosticHandlerTy 170b5ab895eSVivek Pandya LLVMContext::getDiagnosticHandlerCallBack() const { 171b5ab895eSVivek Pandya return pImpl->DiagHandler->DiagHandlerCallback; 172b4c44d23SQuentin Colombet } 173b4c44d23SQuentin Colombet 174b4c44d23SQuentin Colombet void *LLVMContext::getDiagnosticContext() const { 175b5ab895eSVivek Pandya return pImpl->DiagHandler->DiagnosticContext; 176b4c44d23SQuentin Colombet } 177b4c44d23SQuentin Colombet 17834390c70SJuergen Ributzka void LLVMContext::setYieldCallback(YieldCallbackTy Callback, void *OpaqueHandle) 17934390c70SJuergen Ributzka { 18034390c70SJuergen Ributzka pImpl->YieldCallback = Callback; 18134390c70SJuergen Ributzka pImpl->YieldOpaqueHandle = OpaqueHandle; 18234390c70SJuergen Ributzka } 18334390c70SJuergen Ributzka 18434390c70SJuergen Ributzka void LLVMContext::yield() { 18534390c70SJuergen Ributzka if (pImpl->YieldCallback) 18634390c70SJuergen Ributzka pImpl->YieldCallback(this, pImpl->YieldOpaqueHandle); 18734390c70SJuergen Ributzka } 18834390c70SJuergen Ributzka 189ef860a24SChandler Carruth void LLVMContext::emitError(const Twine &ErrorStr) { 190dec8d55bSQuentin Colombet diagnose(DiagnosticInfoInlineAsm(ErrorStr)); 191ef860a24SChandler Carruth } 192ef860a24SChandler Carruth 193bfb44ef9SBob Wilson void LLVMContext::emitError(const Instruction *I, const Twine &ErrorStr) { 194dec8d55bSQuentin Colombet assert (I && "Invalid instruction"); 195dec8d55bSQuentin Colombet diagnose(DiagnosticInfoInlineAsm(*I, ErrorStr)); 196ef860a24SChandler Carruth } 197ef860a24SChandler Carruth 19830c9242cSDuncan P. N. Exon Smith static bool isDiagnosticEnabled(const DiagnosticInfo &DI) { 1997f8af8bfSDiego Novillo // Optimization remarks are selective. They need to check whether the regexp 2007f8af8bfSDiego Novillo // pattern, passed via one of the -pass-remarks* flags, matches the name of 2017f8af8bfSDiego Novillo // the pass that is emitting the diagnostic. If there is no match, ignore the 2027f8af8bfSDiego Novillo // diagnostic and return. 203f31b1f31SAdam Nemet // 204f31b1f31SAdam Nemet // Also noisy remarks are only enabled if we have hotness information to sort 205f31b1f31SAdam Nemet // them. 206e9148dd6SAkira Hatanaka if (auto *Remark = dyn_cast<DiagnosticInfoOptimizationBase>(&DI)) 207f31b1f31SAdam Nemet return Remark->isEnabled() && 208f31b1f31SAdam Nemet (!Remark->isVerbose() || Remark->getHotness()); 209e9148dd6SAkira Hatanaka 21030c9242cSDuncan P. N. Exon Smith return true; 21130c9242cSDuncan P. N. Exon Smith } 21230c9242cSDuncan P. N. Exon Smith 2134b9c0d4dSRenato Golin const char * 2144b9c0d4dSRenato Golin LLVMContext::getDiagnosticMessagePrefix(DiagnosticSeverity Severity) { 215735c47ecSAlex Lorenz switch (Severity) { 216735c47ecSAlex Lorenz case DS_Error: 217735c47ecSAlex Lorenz return "error"; 218735c47ecSAlex Lorenz case DS_Warning: 219735c47ecSAlex Lorenz return "warning"; 220735c47ecSAlex Lorenz case DS_Remark: 221735c47ecSAlex Lorenz return "remark"; 222735c47ecSAlex Lorenz case DS_Note: 223735c47ecSAlex Lorenz return "note"; 224735c47ecSAlex Lorenz } 2255220476aSAaron Ballman llvm_unreachable("Unknown DiagnosticSeverity"); 226735c47ecSAlex Lorenz } 227735c47ecSAlex Lorenz 22830c9242cSDuncan P. N. Exon Smith void LLVMContext::diagnose(const DiagnosticInfo &DI) { 2296c381b7aSAdam Nemet if (auto *OptDiagBase = dyn_cast<DiagnosticInfoOptimizationBase>(&DI)) { 2306c381b7aSAdam Nemet yaml::Output *Out = getDiagnosticsOutputFile(); 2316c381b7aSAdam Nemet if (Out) { 2326c381b7aSAdam Nemet // For remarks the << operator takes a reference to a pointer. 2336c381b7aSAdam Nemet auto *P = const_cast<DiagnosticInfoOptimizationBase *>(OptDiagBase); 2346c381b7aSAdam Nemet *Out << P; 2356c381b7aSAdam Nemet } 2366c381b7aSAdam Nemet } 23730c9242cSDuncan P. N. Exon Smith // If there is a report handler, use it. 238b5ab895eSVivek Pandya if (pImpl->DiagHandler && 239b5ab895eSVivek Pandya (!pImpl->RespectDiagnosticFilters || isDiagnosticEnabled(DI)) && 240b5ab895eSVivek Pandya pImpl->DiagHandler->handleDiagnostics(DI)) 24130c9242cSDuncan P. N. Exon Smith return; 24230c9242cSDuncan P. N. Exon Smith 24330c9242cSDuncan P. N. Exon Smith if (!isDiagnosticEnabled(DI)) 24430c9242cSDuncan P. N. Exon Smith return; 245df655013SDiego Novillo 246b4c44d23SQuentin Colombet // Otherwise, print the message with a prefix based on the severity. 247735c47ecSAlex Lorenz DiagnosticPrinterRawOStream DP(errs()); 248735c47ecSAlex Lorenz errs() << getDiagnosticMessagePrefix(DI.getSeverity()) << ": "; 249b4c44d23SQuentin Colombet DI.print(DP); 250735c47ecSAlex Lorenz errs() << "\n"; 251735c47ecSAlex Lorenz if (DI.getSeverity() == DS_Error) 252b4c44d23SQuentin Colombet exit(1); 253b4c44d23SQuentin Colombet } 254b4c44d23SQuentin Colombet 255ef860a24SChandler Carruth void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) { 256dec8d55bSQuentin Colombet diagnose(DiagnosticInfoInlineAsm(LocCookie, ErrorStr)); 257ef860a24SChandler Carruth } 258ef860a24SChandler Carruth 259ef860a24SChandler Carruth //===----------------------------------------------------------------------===// 260ef860a24SChandler Carruth // Metadata Kind Uniquing 261ef860a24SChandler Carruth //===----------------------------------------------------------------------===// 262ef860a24SChandler Carruth 2631ac0d2deSFilipe Cabecinhas /// Return a unique non-zero ID for the specified metadata kind. 264ef860a24SChandler Carruth unsigned LLVMContext::getMDKindID(StringRef Name) const { 265ef860a24SChandler Carruth // If this is new, assign it its ID. 2661ac0d2deSFilipe Cabecinhas return pImpl->CustomMDKindNames.insert( 2671ac0d2deSFilipe Cabecinhas std::make_pair( 2681ac0d2deSFilipe Cabecinhas Name, pImpl->CustomMDKindNames.size())) 2695106ce78SDavid Blaikie .first->second; 270ef860a24SChandler Carruth } 271ef860a24SChandler Carruth 2724104337dSSanjay Patel /// getHandlerNames - Populate client-supplied smallvector using custom 273ef860a24SChandler Carruth /// metadata name and ID. 274ef860a24SChandler Carruth void LLVMContext::getMDKindNames(SmallVectorImpl<StringRef> &Names) const { 275ef860a24SChandler Carruth Names.resize(pImpl->CustomMDKindNames.size()); 276ef860a24SChandler Carruth for (StringMap<unsigned>::const_iterator I = pImpl->CustomMDKindNames.begin(), 277ef860a24SChandler Carruth E = pImpl->CustomMDKindNames.end(); I != E; ++I) 278ef860a24SChandler Carruth Names[I->second] = I->first(); 279ef860a24SChandler Carruth } 2809303c246SSanjoy Das 2819303c246SSanjoy Das void LLVMContext::getOperandBundleTags(SmallVectorImpl<StringRef> &Tags) const { 2829303c246SSanjoy Das pImpl->getOperandBundleTags(Tags); 2839303c246SSanjoy Das } 2849303c246SSanjoy Das 2859303c246SSanjoy Das uint32_t LLVMContext::getOperandBundleTagID(StringRef Tag) const { 2869303c246SSanjoy Das return pImpl->getOperandBundleTagID(Tag); 2879303c246SSanjoy Das } 288599ebf27SMehdi Amini 289bb80d3e1SKonstantin Zhuravlyov SyncScope::ID LLVMContext::getOrInsertSyncScopeID(StringRef SSN) { 290bb80d3e1SKonstantin Zhuravlyov return pImpl->getOrInsertSyncScopeID(SSN); 291bb80d3e1SKonstantin Zhuravlyov } 292bb80d3e1SKonstantin Zhuravlyov 293bb80d3e1SKonstantin Zhuravlyov void LLVMContext::getSyncScopeNames(SmallVectorImpl<StringRef> &SSNs) const { 294bb80d3e1SKonstantin Zhuravlyov pImpl->getSyncScopeNames(SSNs); 295bb80d3e1SKonstantin Zhuravlyov } 296bb80d3e1SKonstantin Zhuravlyov 297599ebf27SMehdi Amini void LLVMContext::setGC(const Function &Fn, std::string GCName) { 298599ebf27SMehdi Amini auto It = pImpl->GCNames.find(&Fn); 299599ebf27SMehdi Amini 300599ebf27SMehdi Amini if (It == pImpl->GCNames.end()) { 301599ebf27SMehdi Amini pImpl->GCNames.insert(std::make_pair(&Fn, std::move(GCName))); 302599ebf27SMehdi Amini return; 303599ebf27SMehdi Amini } 304599ebf27SMehdi Amini It->second = std::move(GCName); 305599ebf27SMehdi Amini } 3065354a8aaSEugene Zelenko 307599ebf27SMehdi Amini const std::string &LLVMContext::getGC(const Function &Fn) { 308599ebf27SMehdi Amini return pImpl->GCNames[&Fn]; 309599ebf27SMehdi Amini } 3105354a8aaSEugene Zelenko 311599ebf27SMehdi Amini void LLVMContext::deleteGC(const Function &Fn) { 312599ebf27SMehdi Amini pImpl->GCNames.erase(&Fn); 313599ebf27SMehdi Amini } 31409b4a8daSMehdi Amini 315e7090155SMehdi Amini bool LLVMContext::shouldDiscardValueNames() const { 316e7090155SMehdi Amini return pImpl->DiscardValueNames; 317e7090155SMehdi Amini } 31809b4a8daSMehdi Amini 319ed8fdb2aSDuncan P. N. Exon Smith bool LLVMContext::isODRUniquingDebugTypes() const { return !!pImpl->DITypeMap; } 3205ab2be09SDuncan P. N. Exon Smith 321ed8fdb2aSDuncan P. N. Exon Smith void LLVMContext::enableDebugTypeODRUniquing() { 3225ab2be09SDuncan P. N. Exon Smith if (pImpl->DITypeMap) 3235ab2be09SDuncan P. N. Exon Smith return; 3245ab2be09SDuncan P. N. Exon Smith 325e8b555c6SDuncan P. N. Exon Smith pImpl->DITypeMap.emplace(); 3265ab2be09SDuncan P. N. Exon Smith } 3275ab2be09SDuncan P. N. Exon Smith 328ed8fdb2aSDuncan P. N. Exon Smith void LLVMContext::disableDebugTypeODRUniquing() { pImpl->DITypeMap.reset(); } 3295ab2be09SDuncan P. N. Exon Smith 33009b4a8daSMehdi Amini void LLVMContext::setDiscardValueNames(bool Discard) { 33109b4a8daSMehdi Amini pImpl->DiscardValueNames = Discard; 33209b4a8daSMehdi Amini } 333aa641a51SAndrew Kaylor 334aa641a51SAndrew Kaylor OptBisect &LLVMContext::getOptBisect() { 335aa641a51SAndrew Kaylor return pImpl->getOptBisect(); 336aa641a51SAndrew Kaylor } 337b5ab895eSVivek Pandya 338b5ab895eSVivek Pandya const DiagnosticHandler *LLVMContext::getDiagHandlerPtr() const { 339b5ab895eSVivek Pandya return pImpl->DiagHandler.get(); 340b5ab895eSVivek Pandya } 341b5ab895eSVivek Pandya 342b5ab895eSVivek Pandya std::unique_ptr<DiagnosticHandler> LLVMContext::getDiagnosticHandler() { 343b5ab895eSVivek Pandya return std::move(pImpl->DiagHandler); 344b5ab895eSVivek Pandya } 345