[ARM] Support for ARMv6-Z / ARMv6-ZK missing
[oota-llvm.git] / include / llvm / Support / StringPool.h
index 98db8e2bf37c9fd673a05c2ad70f7557ef497ca9..2ec0c3b76c11f13557ee5f810baa46a3bf7d512d 100644 (file)
@@ -1,4 +1,4 @@
-//===-- StringPool.h - Interned string pool -------------------------------===//
+//===-- StringPool.h - Interned string pool ---------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -30,7 +30,6 @@
 #define LLVM_SUPPORT_STRINGPOOL_H
 
 #include "llvm/ADT/StringMap.h"
-#include <new>
 #include <cassert>
 
 namespace llvm {
@@ -48,7 +47,7 @@ namespace llvm {
       unsigned Refcount; ///< Number of referencing PooledStringPtrs.
 
     public:
-      PooledString() : Pool(0), Refcount(0) { }
+      PooledString() : Pool(nullptr), Refcount(0) { }
     };
 
     friend class PooledStringPtr;
@@ -64,12 +63,7 @@ namespace llvm {
     /// intern - Adds a string to the pool and returns a reference-counted
     /// pointer to it. No additional memory is allocated if the string already
     /// exists in the pool.
-    PooledStringPtr intern(const char *Begin, const char *End);
-
-    /// intern - Adds a null-terminated string to the pool and returns a
-    /// reference-counted pointer to it. No additional memory is allocated if
-    /// the string already exists in the pool.
-    inline PooledStringPtr intern(const char *Str);
+    PooledStringPtr intern(StringRef Str);
 
     /// empty - Checks whether the pool is empty. Returns true if so.
     ///
@@ -86,7 +80,7 @@ namespace llvm {
     entry_t *S;
 
   public:
-    PooledStringPtr() : S(0) {}
+    PooledStringPtr() : S(nullptr) {}
 
     explicit PooledStringPtr(entry_t *E) : S(E) {
       if (S) ++S->getValue().Refcount;
@@ -112,7 +106,7 @@ namespace llvm {
         S->getValue().Pool->InternTable.remove(S);
         S->Destroy();
       }
-      S = 0;
+      S = nullptr;
     }
 
     ~PooledStringPtr() { clear(); }
@@ -133,16 +127,12 @@ namespace llvm {
     }
 
     inline const char *operator*() const { return begin(); }
-    inline operator bool() const { return S != 0; }
+    inline explicit operator bool() const { return S != nullptr; }
 
-    inline bool operator==(const PooledStringPtr &That) { return S == That.S; }
-    inline bool operator!=(const PooledStringPtr &That) { return S != That.S; }
+    inline bool operator==(const PooledStringPtr &That) const { return S == That.S; }
+    inline bool operator!=(const PooledStringPtr &That) const { return S != That.S; }
   };
 
-  PooledStringPtr StringPool::intern(const char *Str) {
-    return intern(Str, Str + strlen(Str));
-  }
-
 } // End llvm namespace
 
 #endif