| 87 | } |
| 88 | |
| 89 | static void LifetimeTest() { |
| 90 | ObjectPool pool; |
| 91 | Status status; |
| 92 | for (int i = 0; i < 10; ++i) { |
| 93 | LlvmCodeGen object1(NULL, &pool, NULL, "Test"); |
| 94 | LlvmCodeGen object2(NULL, &pool, NULL, "Test"); |
| 95 | LlvmCodeGen object3(NULL, &pool, NULL, "Test"); |
| 96 | |
| 97 | ASSERT_OK(object1.Init( |
| 98 | unique_ptr<llvm::Module>(new llvm::Module("Test", object1.context())))); |
| 99 | ASSERT_OK(object2.Init( |
| 100 | unique_ptr<llvm::Module>(new llvm::Module("Test", object2.context())))); |
| 101 | ASSERT_OK(object3.Init( |
| 102 | unique_ptr<llvm::Module>(new llvm::Module("Test", object3.context())))); |
| 103 | |
| 104 | object1.Close(); |
| 105 | object2.Close(); |
| 106 | object3.Close(); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | // Wrapper to call private test-only methods on LlvmCodeGen object |
| 111 | Status CreateFromFile(const string& filename, scoped_ptr<LlvmCodeGen>* codegen) { |