Minimal implementation of the abstract ModuleProvider interface.
[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() {
13   M = new Module("");
14 }
15
16 /// dtor - when we leave, we take our Module with us
17 ///
18 AbstractModuleProvider::~AbstractModuleProvider() {
19   delete M;
20 }
21
22 /// materializeFunction - make sure the given function is fully read.
23 ///
24 void AbstractModuleProvider::materializeModule() {
25   for (Module::iterator i = M->begin(), e = M->end(); i != e; ++i) {
26     materializeFunction(i);
27   }
28 }