Add support for casting operators
[oota-llvm.git] / lib / VMCore / Module.cpp
index 4f2eee466112066f0b64858a349741edcf97ff90..9d0015f7696a232213035cf2e6b3cc68f66f7cde 100644 (file)
@@ -4,19 +4,20 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/ValueHolderImpl.h"
-#include "llvm/InstrTypes.h"
-#include "llvm/BasicBlock.h"
-#include "llvm/Method.h"
 #include "llvm/Module.h"
+#include "llvm/Method.h"
+#include "llvm/BasicBlock.h"
+#include "llvm/InstrTypes.h"
+#include "llvm/ValueHolderImpl.h"
+#include "llvm/Tools/STLExtras.h"
 
 // Instantiate Templates - This ugliness is the price we have to pay
 // for having a DefHolderImpl.h file seperate from DefHolder.h!  :(
 //
-template class ValueHolder<Method, Module>;
+template class ValueHolder<Method, Module, Module>;
 
 Module::Module()
-  : SymTabValue(0/*TODO: REAL TYPE*/, Value::ModuleVal, ""),
+  : Value(0/*TODO: REAL TYPE*/, Value::ModuleVal, ""), SymTabValue(this),
     MethodList(this, this) {
 }
 
@@ -37,6 +38,17 @@ Module::~Module() {
 //
 void Module::dropAllReferences() {
   MethodListType::iterator MI = MethodList.begin();
-  for (; MI != MethodList.end(); MI++)
+  for (; MI != MethodList.end(); ++MI)
     (*MI)->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)(Method*)) {
+  return reduce_apply_bool(begin(), end(), Func);
+}
+bool Module::reduceApply(bool (*Func)(const Method*)) const {
+  return reduce_apply_bool(begin(), end(), Func);
+}
+