Change allowsUnalignedMemoryAccesses to take type argument since some targets
[llvm/avr.git] / lib / Support / StringPool.cpp
blob735472e26a57fd1b306ac15e87d834841b855e5a
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 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the StringPool class.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Support/StringPool.h"
15 #include "llvm/Support/Streams.h"
16 #include "llvm/ADT/StringRef.h"
18 using namespace llvm;
20 StringPool::StringPool() {}
22 StringPool::~StringPool() {
23 assert(InternTable.empty() && "PooledStringPtr leaked!");
26 PooledStringPtr StringPool::intern(const StringRef &Key) {
27 table_t::iterator I = InternTable.find(Key);
28 if (I != InternTable.end())
29 return PooledStringPtr(&*I);
31 entry_t *S = entry_t::Create(Key.begin(), Key.end());
32 S->getValue().Pool = this;
33 InternTable.insert(S);
35 return PooledStringPtr(S);