StringPool.cpp (208954) | StringPool.cpp (210299) |
---|---|
1//===-- StringPool.cpp - Interned string pool -----------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 8 unchanged lines hidden (view full) --- 17using namespace llvm; 18 19StringPool::StringPool() {} 20 21StringPool::~StringPool() { 22 assert(InternTable.empty() && "PooledStringPtr leaked!"); 23} 24 | 1//===-- StringPool.cpp - Interned string pool -----------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 8 unchanged lines hidden (view full) --- 17using namespace llvm; 18 19StringPool::StringPool() {} 20 21StringPool::~StringPool() { 22 assert(InternTable.empty() && "PooledStringPtr leaked!"); 23} 24 |
25PooledStringPtr StringPool::intern(const StringRef &Key) { | 25PooledStringPtr StringPool::intern(StringRef Key) { |
26 table_t::iterator I = InternTable.find(Key); 27 if (I != InternTable.end()) 28 return PooledStringPtr(&*I); 29 30 entry_t *S = entry_t::Create(Key.begin(), Key.end()); 31 S->getValue().Pool = this; 32 InternTable.insert(S); 33 34 return PooledStringPtr(S); 35} | 26 table_t::iterator I = InternTable.find(Key); 27 if (I != InternTable.end()) 28 return PooledStringPtr(&*I); 29 30 entry_t *S = entry_t::Create(Key.begin(), Key.end()); 31 S->getValue().Pool = this; 32 InternTable.insert(S); 33 34 return PooledStringPtr(S); 35} |