Put all LLVM code into the llvm namespace, as per bug 109.
[oota-llvm.git] / lib / VMCore / ModuleProvider.cpp
1 //===-- ModuleProvider.cpp - Base implementation for module providers -----===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // Minimal implementation of the abstract interface for providing a module.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "llvm/ModuleProvider.h"
15 #include "llvm/Module.h"
16
17 namespace llvm {
18
19 /// ctor - always have a valid Module
20 ///
21 ModuleProvider::ModuleProvider() : TheModule(0) { }
22
23 /// dtor - when we leave, we take our Module with us
24 ///
25 ModuleProvider::~ModuleProvider() {
26   delete TheModule;
27 }
28
29 /// materializeFunction - make sure the given function is fully read.
30 ///
31 Module* ModuleProvider::materializeModule() {
32   assert(TheModule && "Attempting to materialize an invalid module!");
33
34   for (Module::iterator i = TheModule->begin(), e = TheModule->end();
35        i != e; ++i)
36     materializeFunction(i);
37
38   return TheModule;
39 }
40
41 } // End llvm namespace