* No longer initialize the module, a subclass is more suitable to do this
[oota-llvm.git] / lib / VMCore / ModuleProvider.cpp
1 //===-- ModuleProvider.cpp - Base implementation for module providers -----===//
2 //
3 // Minimal implementation of the abstract interface for providing a module.
4 //
5 //===----------------------------------------------------------------------===//
6
7 #include "llvm/ModuleProvider.h"
8 #include "llvm/Module.h"
9
10 /// ctor - always have a valid Module
11 ///
12 AbstractModuleProvider::AbstractModuleProvider() : TheModule(0) { }
13
14 /// dtor - when we leave, we take our Module with us
15 ///
16 AbstractModuleProvider::~AbstractModuleProvider() {
17   delete TheModule;
18 }
19
20 /// materializeFunction - make sure the given function is fully read.
21 ///
22 void AbstractModuleProvider::materializeModule() {
23   if (!TheModule) return;
24
25   for (Module::iterator i = TheModule->begin(), e = TheModule->end();
26        i != e; ++i)
27     materializeFunction(i);
28 }