//===- llvm/LLVMContext.h - Class for managing "global" state ---*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file declares LLVMContext, a container of "global" state in LLVM, such // as the global type and constant uniquing tables. // //===----------------------------------------------------------------------===// #ifndef LLVM_IR_LLVMCONTEXT_H #define LLVM_IR_LLVMCONTEXT_H #include "llvm-c/Types.h" #include "llvm/IR/DiagnosticHandler.h" #include "llvm/Support/CBindingWrapping.h" #include <cstdint> #include <memory> #include <optional> #include <string> namespace llvm { class DiagnosticInfo; enum DiagnosticSeverity : char; class Function; class Instruction; class LLVMContextImpl; class Module; class OptPassGate; template <typename T> class SmallVectorImpl; template <typename T> class StringMapEntry; class StringRef; class Twine; class LLVMRemarkStreamer; namespace remarks { class RemarkStreamer; } namespace SyncScope { ID; /// Known synchronization scope IDs, which always have the same value. All /// synchronization scope IDs that LLVM has special knowledge of are listed /// here. Additionally, this scheme allows LLVM to efficiently check for /// specific synchronization scope ID without comparing strings. enum { … }; } // end namespace SyncScope /// This is an important class for using LLVM in a threaded context. It /// (opaquely) owns and manages the core "global" data of LLVM's core /// infrastructure, including the type and constant uniquing tables. /// LLVMContext itself provides no locking guarantees, so you should be careful /// to have one context per thread. class LLVMContext { … }; // Create wrappers for C Binding types (see CBindingWrapping.h). DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…) /* Specialized opaque context conversions. */ inline LLVMContext **unwrap(LLVMContextRef* Tys) { … } inline LLVMContextRef *wrap(const LLVMContext **Tys) { … } } // end namespace llvm #endif // LLVM_IR_LLVMCONTEXT_H