summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/BasicBlock.h4
-rw-r--r--llvm/include/llvm/Function.h8
2 files changed, 6 insertions, 6 deletions
diff --git a/llvm/include/llvm/BasicBlock.h b/llvm/include/llvm/BasicBlock.h
index 3ef83e8a816..54f3690096e 100644
--- a/llvm/include/llvm/BasicBlock.h
+++ b/llvm/include/llvm/BasicBlock.h
@@ -38,14 +38,14 @@ template<> struct ilist_traits<Instruction>
// 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
diff --git a/llvm/include/llvm/Function.h b/llvm/include/llvm/Function.h
index 9f4f23be088..37e8f19f625 100644
--- a/llvm/include/llvm/Function.h
+++ b/llvm/include/llvm/Function.h
@@ -35,28 +35,28 @@ template<> struct ilist_traits<BasicBlock>
// 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,
OpenPOWER on IntegriCloud