diff options
author | Chris Lattner <sabre@nondot.org> | 2001-09-10 07:58:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-09-10 07:58:01 +0000 |
commit | 70cc3397f84c2e1fd69c059a0ef89e398e847b00 (patch) | |
tree | ca2156daf75e4abf788d92925bdce4063da36e58 /lib/VMCore/Module.cpp | |
parent | 7720c8e1a7a252e983e3f3e7f841d7901dfea80c (diff) |
Implement global variable support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@530 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Module.cpp')
-rw-r--r-- | lib/VMCore/Module.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp index 4ab8bb06fc..5fc11d1b10 100644 --- a/lib/VMCore/Module.cpp +++ b/lib/VMCore/Module.cpp @@ -6,6 +6,7 @@ #include "llvm/Module.h" #include "llvm/Method.h" +#include "llvm/GlobalVariable.h" #include "llvm/BasicBlock.h" #include "llvm/InstrTypes.h" #include "llvm/ValueHolderImpl.h" @@ -15,15 +16,18 @@ // Instantiate Templates - This ugliness is the price we have to pay // for having a DefHolderImpl.h file seperate from DefHolder.h! :( // +template class ValueHolder<GlobalVariable, Module, Module>; template class ValueHolder<Method, Module, Module>; Module::Module() : Value(Type::VoidTy, Value::ModuleVal, ""), SymTabValue(this), - MethodList(this, this) { + GlobalList(this, this), MethodList(this, this) { } Module::~Module() { dropAllReferences(); + GlobalList.delete_all(); + GlobalList.setParent(0); MethodList.delete_all(); MethodList.setParent(0); } @@ -46,6 +50,12 @@ void Module::dropAllReferences() { // reduceApply - Apply the specified function to all of the methods in this // module. The result values are or'd together and the result is returned. // +bool Module::reduceApply(bool (*Func)(GlobalVariable*)) { + return reduce_apply_bool(gbegin(), gend(), Func); +} +bool Module::reduceApply(bool (*Func)(const GlobalVariable*)) const { + return reduce_apply_bool(gbegin(), gend(), Func); +} bool Module::reduceApply(bool (*Func)(Method*)) { return reduce_apply_bool(begin(), end(), Func); } |