summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/ImmutableList.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-10-21 05:59:33 +0000
committerTed Kremenek <kremenek@apple.com>2008-10-21 05:59:33 +0000
commite06e91122fefcadd252ddd2f2591e181683fc2f1 (patch)
tree60589a2a9ecdfc7d6f32162ca7a51d96570e4260 /include/llvm/ADT/ImmutableList.h
parent7fb501c9cd1d47aac667f53879bd35f3b4822468 (diff)
downloadllvm-e06e91122fefcadd252ddd2f2591e181683fc2f1.tar.gz
llvm-e06e91122fefcadd252ddd2f2591e181683fc2f1.tar.bz2
llvm-e06e91122fefcadd252ddd2f2591e181683fc2f1.tar.xz
constify some methods and variables in ImmutableList.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57894 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/ImmutableList.h')
-rw-r--r--include/llvm/ADT/ImmutableList.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/include/llvm/ADT/ImmutableList.h b/include/llvm/ADT/ImmutableList.h
index dd88023fd1..baf86daa36 100644
--- a/include/llvm/ADT/ImmutableList.h
+++ b/include/llvm/ADT/ImmutableList.h
@@ -26,9 +26,9 @@ template <typename T> class ImmutableListFactory;
template <typename T>
class ImmutableListImpl : public FoldingSetNode {
T Head;
- ImmutableListImpl* Tail;
+ const ImmutableListImpl* Tail;
- ImmutableListImpl(const T& head, ImmutableListImpl* tail = 0)
+ ImmutableListImpl(const T& head, const ImmutableListImpl* tail = 0)
: Head(head), Tail(tail) {}
friend class ImmutableListFactory<T>;
@@ -39,10 +39,10 @@ class ImmutableListImpl : public FoldingSetNode {
public:
const T& getHead() const { return Head; }
- ImmutableListImpl* getTail() const { return Tail; }
+ const ImmutableListImpl* getTail() const { return Tail; }
static inline void Profile(FoldingSetNodeID& ID, const T& H,
- ImmutableListImpl* L){
+ const ImmutableListImpl* L){
ID.AddPointer(L);
ID.Add(H);
}
@@ -67,20 +67,20 @@ public:
typedef ImmutableListFactory<T> Factory;
private:
- ImmutableListImpl<T>* X;
+ const ImmutableListImpl<T>* X;
public:
// This constructor should normally only be called by ImmutableListFactory<T>.
// There may be cases, however, when one needs to extract the internal pointer
// and reconstruct a list object from that pointer.
- ImmutableList(ImmutableListImpl<T>* x = 0) : X(x) {}
+ ImmutableList(const ImmutableListImpl<T>* x = 0) : X(x) {}
- ImmutableListImpl<T>* getInternalPointer() const {
+ const ImmutableListImpl<T>* getInternalPointer() const {
return X;
}
class iterator {
- ImmutableListImpl<T>* L;
+ const ImmutableListImpl<T>* L;
public:
iterator() : L(0) {}
iterator(ImmutableList l) : L(l.getInternalPointer()) {}
@@ -157,7 +157,7 @@ public:
FoldingSetNodeID ID;
void* InsertPos;
- ListTy* TailImpl = Tail.getInternalPointer();
+ const ListTy* TailImpl = Tail.getInternalPointer();
ListTy::Profile(ID, Head, TailImpl);
ListTy* L = Cache.FindNodeOrInsertPos(ID, InsertPos);