summaryrefslogtreecommitdiff
path: root/include/llvm/Module.h
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2009-03-27 22:28:33 +0000
committerGabor Greif <ggreif@gmail.com>2009-03-27 22:28:33 +0000
commitd257f7d96b414682834f1eb5aa4d9ea00f6761be (patch)
tree58f65fd749589ee7ae6d8c308a016c221effdd79 /include/llvm/Module.h
parent5c1f715d4b68d4adb54fd0bf37c099039d6849d3 (diff)
downloadllvm-d257f7d96b414682834f1eb5aa4d9ea00f6761be.tar.gz
llvm-d257f7d96b414682834f1eb5aa4d9ea00f6761be.tar.bz2
llvm-d257f7d96b414682834f1eb5aa4d9ea00f6761be.tar.xz
"ghostify" the ilist<Function> sentinel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67872 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Module.h')
-rw-r--r--include/llvm/Module.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/llvm/Module.h b/include/llvm/Module.h
index 9d0b2b62f2..9c8607a188 100644
--- a/include/llvm/Module.h
+++ b/include/llvm/Module.h
@@ -28,9 +28,20 @@ class FunctionType;
template<> struct ilist_traits<Function>
: public SymbolTableListTraits<Function, Module> {
- // createSentinel is used to create a node that marks the end of the list.
- static Function *createSentinel();
- static void destroySentinel(Function *F) { delete F; }
+
+ // createSentinel is used to get hold of the node that marks the end of the
+ // list... (same trick used here as in ilist_traits<Instruction>)
+ Function *createSentinel() const {
+ return static_cast<Function*>(&Sentinel);
+ }
+ static void destroySentinel(Function*) {}
+
+ Function *provideInitialHead() const { return createSentinel(); }
+ Function *ensureHead(Function*) const { return createSentinel(); }
+ static void noteHead(Function*, Function*) {}
+
+private:
+ mutable ilist_node<Function> Sentinel;
};
template<> struct ilist_traits<GlobalVariable>
: public SymbolTableListTraits<GlobalVariable, Module> {