1 //===-- Module.cpp - Implement the Module class ------------------*- C++ -*--=//
3 // This file implements the Module class for the VMCore library.
5 //===----------------------------------------------------------------------===//
7 #include "llvm/ValueHolderImpl.h"
8 #include "llvm/InstrTypes.h"
9 #include "llvm/BasicBlock.h"
10 #include "llvm/Method.h"
11 #include "llvm/Module.h"
13 // Instantiate Templates - This ugliness is the price we have to pay
14 // for having a DefHolderImpl.h file seperate from DefHolder.h! :(
16 template class ValueHolder<Method, Module>;
19 : SymTabValue(0/*TODO: REAL TYPE*/, Value::ModuleVal, ""),
20 MethodList(this, this) {
25 MethodList.delete_all();
26 MethodList.setParent(0);
30 // dropAllReferences() - This function causes all the subinstructions to "let
31 // go" of all references that they are maintaining. This allows one to
32 // 'delete' a whole class at a time, even though there may be circular
33 // references... first all references are dropped, and all use counts go to
34 // zero. Then everything is delete'd for real. Note that no operations are
35 // valid on an object that has "dropped all references", except operator
38 void Module::dropAllReferences() {
39 MethodListType::iterator MI = MethodList.begin();
40 for (; MI != MethodList.end(); MI++)
41 (*MI)->dropAllReferences();