X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FADT%2FImmutableList.h;h=20bdd903f7a544a570566d07d64c6a7471bdfbe0;hb=6d42bbfe5e18f7256049435f2e23d11aeee670f1;hp=5f8cb57f1c01e4a29c55c3a93d883d691cd4c3ae;hpb=8b67f774e9c38b7718b2b300b628388f966df4e0;p=oota-llvm.git diff --git a/include/llvm/ADT/ImmutableList.h b/include/llvm/ADT/ImmutableList.h index 5f8cb57f1c0..20bdd903f7a 100644 --- a/include/llvm/ADT/ImmutableList.h +++ b/include/llvm/ADT/ImmutableList.h @@ -16,7 +16,7 @@ #include "llvm/Support/Allocator.h" #include "llvm/ADT/FoldingSet.h" -#include "llvm/System/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include namespace llvm { @@ -33,9 +33,8 @@ class ImmutableListImpl : public FoldingSetNode { friend class ImmutableListFactory; - // Do not implement. - void operator=(const ImmutableListImpl&); - ImmutableListImpl(const ImmutableListImpl&); + void operator=(const ImmutableListImpl&) LLVM_DELETED_FUNCTION; + ImmutableListImpl(const ImmutableListImpl&) LLVM_DELETED_FUNCTION; public: const T& getHead() const { return Head; } @@ -103,6 +102,14 @@ public: /// isEmpty - Returns true if the list is empty. bool isEmpty() const { return !X; } + bool contains(const T& V) const { + for (iterator I = begin(), E = end(); I != E; ++I) { + if (*I == V) + return true; + } + return false; + } + /// isEqual - Returns true if two lists are equal. Because all lists created /// from the same ImmutableListFactory are uniqued, this has O(1) complexity /// because it the contents of the list do not need to be compared. Note @@ -156,7 +163,7 @@ public: if (ownsAllocator()) delete &getAllocator(); } - ImmutableList Concat(const T& Head, ImmutableList Tail) { + ImmutableList concat(const T& Head, ImmutableList Tail) { // Profile the new list to see if it already exists in our cache. FoldingSetNodeID ID; void* InsertPos; @@ -178,16 +185,16 @@ public: return L; } - ImmutableList Add(const T& D, ImmutableList L) { - return Concat(D, L); + ImmutableList add(const T& D, ImmutableList L) { + return concat(D, L); } - ImmutableList GetEmptyList() const { + ImmutableList getEmptyList() const { return ImmutableList(0); } - ImmutableList Create(const T& X) { - return Concat(X, GetEmptyList()); + ImmutableList create(const T& X) { + return Concat(X, getEmptyList()); } }; @@ -211,9 +218,12 @@ template struct DenseMapInfo > { static bool isEqual(ImmutableList X1, ImmutableList X2) { return X1 == X2; } - static bool isPod() { return true; } }; +template struct isPodLike; +template +struct isPodLike > { static const bool value = true; }; + } // end llvm namespace #endif