1 //===-- llvm/Module.h - C++ class to represent a VM module -------*- C++ -*--=//
3 // This file contains the declarations for the Module class that is used to
4 // maintain all the information related to a VM module.
6 //===----------------------------------------------------------------------===//
11 #include "llvm/SymTabValue.h"
14 class Module : public SymTabValue {
16 typedef ValueHolder<Method, Module> MethodListType;
18 // Method iterators...
19 typedef MethodListType::iterator iterator;
20 typedef MethodListType::const_iterator const_iterator;
21 typedef reverse_iterator<const_iterator> const_reverse_iterator;
22 typedef reverse_iterator<iterator> reverse_iterator;
24 MethodListType MethodList; // The Methods
30 // Get the underlying elements of the Module...
31 inline const MethodListType &getMethodList() const { return MethodList; }
32 inline MethodListType &getMethodList() { return MethodList; }
34 //===--------------------------------------------------------------------===//
35 // Module iterator forwarding functions
37 inline iterator begin() { return MethodList.begin(); }
38 inline const_iterator begin() const { return MethodList.begin(); }
39 inline iterator end () { return MethodList.end(); }
40 inline const_iterator end () const { return MethodList.end(); }
42 inline reverse_iterator rbegin() { return MethodList.rbegin(); }
43 inline const_reverse_iterator rbegin() const { return MethodList.rbegin(); }
44 inline reverse_iterator rend () { return MethodList.rend(); }
45 inline const_reverse_iterator rend () const { return MethodList.rend(); }
47 inline unsigned size() const { return MethodList.size(); }
48 inline bool empty() const { return MethodList.empty(); }
49 inline const Method *front() const { return MethodList.front(); }
50 inline Method *front() { return MethodList.front(); }
51 inline const Method *back() const { return MethodList.back(); }
52 inline Method *back() { return MethodList.back(); }
55 // dropAllReferences() - This function causes all the subinstructions to "let
56 // go" of all references that they are maintaining. This allows one to
57 // 'delete' a whole class at a time, even though there may be circular
58 // references... first all references are dropped, and all use counts go to
59 // zero. Then everything is delete'd for real. Note that no operations are
60 // valid on an object that has "dropped all references", except operator
63 void dropAllReferences();