d74fa11f3fefd1c85a9b0fda07a944006bd7b4e5
[oota-llvm.git] / include / llvm / LLVMContext.h
1 //===-- llvm/LLVMContext.h - Class for managing "global" state --*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares LLVMContext, a container of "global" state in LLVM, such
11 // as the global type and constant uniquing tables.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_LLVMCONTEXT_H
16 #define LLVM_LLVMCONTEXT_H
17
18 #include "llvm/Support/DataTypes.h"
19 #include <vector>
20 #include <string>
21
22 namespace llvm {
23
24 struct LLVMContextImpl;
25
26 /// This is an important class for using LLVM in a threaded context.  It
27 /// (opaquely) owns and manages the core "global" data of LLVM's core 
28 /// infrastructure, including the type and constant uniquing tables.
29 /// LLVMContext itself provides no locking guarantees, so you should be careful
30 /// to have one context per thread.
31 struct LLVMContext {
32   LLVMContextImpl* pImpl;
33   bool RemoveDeadMetadata();
34   LLVMContext();
35   ~LLVMContext();
36 };
37
38 /// FOR BACKWARDS COMPATIBILITY - Returns a global context.
39 extern LLVMContext& getGlobalContext();
40
41 }
42
43 #endif