LLVM API Documentation
00001 //===-- llvm/LLVMContext.h - Class for managing "global" state --*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file declares LLVMContext, a container of "global" state in LLVM, such 00011 // as the global type and constant uniquing tables. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_LLVMCONTEXT_H 00016 #define LLVM_LLVMCONTEXT_H 00017 00018 namespace llvm { 00019 00020 class LLVMContextImpl; 00021 00022 /// This is an important class for using LLVM in a threaded context. It 00023 /// (opaquely) owns and manages the core "global" data of LLVM's core 00024 /// infrastructure, including the type and constant uniquing tables. 00025 /// LLVMContext itself provides no locking guarantees, so you should be careful 00026 /// to have one context per thread. 00027 class LLVMContext { 00028 // DO NOT IMPLEMENT 00029 LLVMContext(LLVMContext&); 00030 void operator=(LLVMContext&); 00031 public: 00032 LLVMContextImpl* pImpl; 00033 bool RemoveDeadMetadata(); 00034 LLVMContext(); 00035 ~LLVMContext(); 00036 }; 00037 00038 /// FOR BACKWARDS COMPATIBILITY - Returns a global context. 00039 extern LLVMContext& getGlobalContext(); 00040 00041 } 00042 00043 #endif