2003-09-19 00:17:06 +08:00
|
|
|
//===-- ModuleProvider.cpp - Base implementation for module providers -----===//
|
|
|
|
//
|
|
|
|
// Minimal implementation of the abstract interface for providing a module.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/ModuleProvider.h"
|
|
|
|
#include "llvm/Module.h"
|
|
|
|
|
|
|
|
/// ctor - always have a valid Module
|
|
|
|
///
|
2003-10-05 04:14:59 +08:00
|
|
|
ModuleProvider::ModuleProvider() : TheModule(0) { }
|
2003-09-19 00:17:06 +08:00
|
|
|
|
|
|
|
/// dtor - when we leave, we take our Module with us
|
|
|
|
///
|
2003-10-05 04:14:59 +08:00
|
|
|
ModuleProvider::~ModuleProvider() {
|
2003-09-23 07:44:13 +08:00
|
|
|
delete TheModule;
|
2003-09-19 00:17:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// materializeFunction - make sure the given function is fully read.
|
|
|
|
///
|
2003-10-18 02:27:13 +08:00
|
|
|
Module* ModuleProvider::materializeModule() {
|
2003-10-18 05:59:57 +08:00
|
|
|
assert(TheModule && "Attempting to materialize an invalid module!");
|
2003-09-23 07:44:13 +08:00
|
|
|
|
|
|
|
for (Module::iterator i = TheModule->begin(), e = TheModule->end();
|
|
|
|
i != e; ++i)
|
2003-09-19 00:17:06 +08:00
|
|
|
materializeFunction(i);
|
2003-10-18 02:27:13 +08:00
|
|
|
|
|
|
|
return TheModule;
|
2003-09-19 00:17:06 +08:00
|
|
|
}
|