2003-09-18 16:17:06 +00: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-09-22 23:44:13 +00:00
|
|
|
AbstractModuleProvider::AbstractModuleProvider() : TheModule(0) { }
|
2003-09-18 16:17:06 +00:00
|
|
|
|
|
|
|
/// dtor - when we leave, we take our Module with us
|
|
|
|
///
|
|
|
|
AbstractModuleProvider::~AbstractModuleProvider() {
|
2003-09-22 23:44:13 +00:00
|
|
|
delete TheModule;
|
2003-09-18 16:17:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// materializeFunction - make sure the given function is fully read.
|
|
|
|
///
|
|
|
|
void AbstractModuleProvider::materializeModule() {
|
2003-09-22 23:44:13 +00:00
|
|
|
if (!TheModule) return;
|
|
|
|
|
|
|
|
for (Module::iterator i = TheModule->begin(), e = TheModule->end();
|
|
|
|
i != e; ++i)
|
2003-09-18 16:17:06 +00:00
|
|
|
materializeFunction(i);
|
|
|
|
}
|