[llvm-commits] [llvm] r65843 - in /llvm/trunk/include/llvm: BasicBlock.h Function.h
Gabor Greif
ggreif at gmail.com
Mon Mar 2 06:47:57 PST 2009
Author: ggreif
Date: Mon Mar 2 08:47:45 2009
New Revision: 65843
URL: http://llvm.org/viewvc/llvm-project?rev=65843&view=rev
Log:
Declare Sentinel fragments as mutable to get rid
of some pointless casting. This fragment logically
does not belong to ilist anyway, but to "ghostly"
NodeType.
Modified:
llvm/trunk/include/llvm/BasicBlock.h
llvm/trunk/include/llvm/Function.h
Modified: llvm/trunk/include/llvm/BasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=65843&r1=65842&r2=65843&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BasicBlock.h (original)
+++ llvm/trunk/include/llvm/BasicBlock.h Mon Mar 2 08:47:45 2009
@@ -38,14 +38,14 @@
// NodeTy, which becomes the sentinel. Dereferencing the sentinel is
// forbidden (save the ilist_node<NodeTy>) so no one will ever notice
// the superposition.
- return const_cast<Instruction*>(static_cast<const Instruction*>(&Sentinel));
+ return static_cast<Instruction*>(&Sentinel);
}
static void destroySentinel(Instruction*) {}
static iplist<Instruction> &getList(BasicBlock *BB);
static ValueSymbolTable *getSymTab(BasicBlock *ItemParent);
static int getListOffset();
private:
- ilist_node<Instruction> Sentinel;
+ mutable ilist_node<Instruction> Sentinel;
};
/// This represents a single basic block in LLVM. A basic block is simply a
Modified: llvm/trunk/include/llvm/Function.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=65843&r1=65842&r2=65843&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Function.h (original)
+++ llvm/trunk/include/llvm/Function.h Mon Mar 2 08:47:45 2009
@@ -35,28 +35,28 @@
// 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>)
BasicBlock *createSentinel() const {
- return const_cast<BasicBlock*>(static_cast<const BasicBlock*>(&Sentinel));
+ return static_cast<BasicBlock*>(&Sentinel);
}
static void destroySentinel(BasicBlock*) {}
static iplist<BasicBlock> &getList(Function *F);
static ValueSymbolTable *getSymTab(Function *ItemParent);
static int getListOffset();
private:
- ilist_node<BasicBlock> Sentinel;
+ mutable ilist_node<BasicBlock> Sentinel;
};
template<> struct ilist_traits<Argument>
: public SymbolTableListTraits<Argument, Function> {
Argument *createSentinel() const {
- return const_cast<Argument*>(static_cast<const Argument*>(&Sentinel));
+ return static_cast<Argument*>(&Sentinel);
}
static void destroySentinel(Argument*) {}
static iplist<Argument> &getList(Function *F);
static ValueSymbolTable *getSymTab(Function *ItemParent);
static int getListOffset();
private:
- ilist_node<Argument> Sentinel;
+ mutable ilist_node<Argument> Sentinel;
};
class Function : public GlobalValue, public Annotable,
More information about the llvm-commits
mailing list