Rename AbstractModuleProvider -> ModuleProvider, to match the header file name,

and because, while the class used by the interface is abstract, the actual
concept is not.

llvm-svn: 8850
This commit is contained in:
Chris Lattner 2003-10-04 20:14:59 +00:00
parent 7a9db7a722
commit def80d731a
5 changed files with 15 additions and 19 deletions

View File

@ -18,16 +18,14 @@
/// getBytecodeModuleProvider - lazy function-at-a-time loading from a file /// getBytecodeModuleProvider - lazy function-at-a-time loading from a file
/// ///
AbstractModuleProvider* ModuleProvider *getBytecodeModuleProvider(const std::string &Filename);
getBytecodeModuleProvider(const std::string &Filename);
/// getBytecodeBufferModuleProvider - lazy function-at-a-time loading from a /// getBytecodeBufferModuleProvider - lazy function-at-a-time loading from a
/// buffer /// buffer
/// ///
AbstractModuleProvider* ModuleProvider *getBytecodeBufferModuleProvider(const unsigned char *Buffer,
getBytecodeBufferModuleProvider(const unsigned char *Buffer, unsigned BufferSize,
unsigned BufferSize, const std::string &ModuleID="");
const std::string &ModuleID = "");
/// ParseBytecodeFile - Parse the given bytecode file /// ParseBytecodeFile - Parse the given bytecode file
/// ///

View File

@ -14,13 +14,13 @@
class Function; class Function;
class Module; class Module;
class AbstractModuleProvider { class ModuleProvider {
protected: protected:
Module *TheModule; Module *TheModule;
AbstractModuleProvider(); ModuleProvider();
public: public:
virtual ~AbstractModuleProvider(); virtual ~ModuleProvider();
/// getModule - returns the module this provider is encapsulating. /// getModule - returns the module this provider is encapsulating.
/// ///

View File

@ -43,7 +43,7 @@ struct LazyFunctionInfo {
unsigned FunctionSlot; unsigned FunctionSlot;
}; };
class BytecodeParser : public AbstractModuleProvider { class BytecodeParser : public ModuleProvider {
BytecodeParser(const BytecodeParser &); // DO NOT IMPLEMENT BytecodeParser(const BytecodeParser &); // DO NOT IMPLEMENT
void operator=(const BytecodeParser &); // DO NOT IMPLEMENT void operator=(const BytecodeParser &); // DO NOT IMPLEMENT
public: public:

View File

@ -156,7 +156,7 @@ BytecodeStdinReader::BytecodeStdinReader() {
/// getBytecodeBufferModuleProvider - lazy function-at-a-time loading from a /// getBytecodeBufferModuleProvider - lazy function-at-a-time loading from a
/// buffer /// buffer
AbstractModuleProvider* ModuleProvider*
getBytecodeBufferModuleProvider(const unsigned char *Buffer, unsigned Length, getBytecodeBufferModuleProvider(const unsigned char *Buffer, unsigned Length,
const std::string &ModuleID) { const std::string &ModuleID) {
return new BytecodeBufferReader(Buffer, Length, ModuleID); return new BytecodeBufferReader(Buffer, Length, ModuleID);
@ -167,7 +167,7 @@ getBytecodeBufferModuleProvider(const unsigned char *Buffer, unsigned Length,
Module *ParseBytecodeBuffer(const unsigned char *Buffer, unsigned Length, Module *ParseBytecodeBuffer(const unsigned char *Buffer, unsigned Length,
const std::string &ModuleID, std::string *ErrorStr){ const std::string &ModuleID, std::string *ErrorStr){
try { try {
std::auto_ptr<AbstractModuleProvider> std::auto_ptr<ModuleProvider>
AMP(getBytecodeBufferModuleProvider(Buffer, Length, ModuleID)); AMP(getBytecodeBufferModuleProvider(Buffer, Length, ModuleID));
return AMP->releaseModule(); return AMP->releaseModule();
} catch (std::string &err) { } catch (std::string &err) {
@ -178,8 +178,7 @@ Module *ParseBytecodeBuffer(const unsigned char *Buffer, unsigned Length,
/// getBytecodeModuleProvider - lazy function-at-a-time loading from a file /// getBytecodeModuleProvider - lazy function-at-a-time loading from a file
/// ///
AbstractModuleProvider* ModuleProvider *getBytecodeModuleProvider(const std::string &Filename) {
getBytecodeModuleProvider(const std::string &Filename) {
if (Filename != std::string("-")) // Read from a file... if (Filename != std::string("-")) // Read from a file...
return new BytecodeFileReader(Filename); return new BytecodeFileReader(Filename);
else // Read from stdin else // Read from stdin
@ -190,8 +189,7 @@ getBytecodeModuleProvider(const std::string &Filename) {
/// ///
Module *ParseBytecodeFile(const std::string &Filename, std::string *ErrorStr) { Module *ParseBytecodeFile(const std::string &Filename, std::string *ErrorStr) {
try { try {
std::auto_ptr<AbstractModuleProvider> std::auto_ptr<ModuleProvider> AMP(getBytecodeModuleProvider(Filename));
AMP(getBytecodeModuleProvider(Filename));
return AMP->releaseModule(); return AMP->releaseModule();
} catch (std::string &err) { } catch (std::string &err) {
if (ErrorStr) *ErrorStr = err; if (ErrorStr) *ErrorStr = err;

View File

@ -9,17 +9,17 @@
/// ctor - always have a valid Module /// ctor - always have a valid Module
/// ///
AbstractModuleProvider::AbstractModuleProvider() : TheModule(0) { } ModuleProvider::ModuleProvider() : TheModule(0) { }
/// dtor - when we leave, we take our Module with us /// dtor - when we leave, we take our Module with us
/// ///
AbstractModuleProvider::~AbstractModuleProvider() { ModuleProvider::~ModuleProvider() {
delete TheModule; delete TheModule;
} }
/// materializeFunction - make sure the given function is fully read. /// materializeFunction - make sure the given function is fully read.
/// ///
void AbstractModuleProvider::materializeModule() { void ModuleProvider::materializeModule() {
if (!TheModule) return; if (!TheModule) return;
for (Module::iterator i = TheModule->begin(), e = TheModule->end(); for (Module::iterator i = TheModule->begin(), e = TheModule->end();