Owen Anderson | 8e66e0b | 2009-06-30 00:48:55 +0000 | [diff] [blame] | 1 | //===-- LLVMContext.cpp - Implement LLVMContext -----------------------===// |
| 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 | //===----------------------------------------------------------------------===// |
Owen Anderson | 36f62e5 | 2009-06-30 17:06:46 +0000 | [diff] [blame] | 9 | // |
| 10 | // This file implements LLVMContext, as a wrapper around the opaque |
| 11 | // class LLVMContextImpl. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
Owen Anderson | 8e66e0b | 2009-06-30 00:48:55 +0000 | [diff] [blame] | 14 | |
| 15 | #include "llvm/LLVMContext.h" |
| 16 | #include "llvm/Constants.h" |
Owen Anderson | a856021 | 2009-06-30 17:50:28 +0000 | [diff] [blame] | 17 | #include "llvm/DerivedTypes.h" |
Owen Anderson | 53a5221 | 2009-07-13 04:09:18 +0000 | [diff] [blame] | 18 | #include "llvm/Instruction.h" |
Devang Patel | a4f43fb | 2009-07-28 21:49:47 +0000 | [diff] [blame] | 19 | #include "llvm/Metadata.h" |
Owen Anderson | 1938fb1 | 2009-06-30 23:39:59 +0000 | [diff] [blame] | 20 | #include "llvm/Support/ManagedStatic.h" |
Owen Anderson | 8e66e0b | 2009-06-30 00:48:55 +0000 | [diff] [blame] | 21 | #include "LLVMContextImpl.h" |
Nick Lewycky | c07adb7 | 2009-07-13 05:49:04 +0000 | [diff] [blame] | 22 | #include <cstdarg> |
Owen Anderson | 8e66e0b | 2009-06-30 00:48:55 +0000 | [diff] [blame] | 23 | |
| 24 | using namespace llvm; |
| 25 | |
Owen Anderson | 1938fb1 | 2009-06-30 23:39:59 +0000 | [diff] [blame] | 26 | static ManagedStatic<LLVMContext> GlobalContext; |
| 27 | |
Owen Anderson | 2a15443 | 2009-07-01 23:13:44 +0000 | [diff] [blame] | 28 | LLVMContext& llvm::getGlobalContext() { |
Owen Anderson | 1cf085d | 2009-07-01 21:22:36 +0000 | [diff] [blame] | 29 | return *GlobalContext; |
Owen Anderson | 1938fb1 | 2009-06-30 23:39:59 +0000 | [diff] [blame] | 30 | } |
| 31 | |
Owen Anderson | 20b34ac | 2009-07-16 18:04:31 +0000 | [diff] [blame] | 32 | LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) { } |
Owen Anderson | 8e66e0b | 2009-06-30 00:48:55 +0000 | [diff] [blame] | 33 | LLVMContext::~LLVMContext() { delete pImpl; } |