Files
Peter Matula 1815d79beb rename namespace "llvm" to "llvm_ks" (#333)
This prevents symbol collisions when the Keystone library is linked with the LLVM libraries.

Renaming was done by the following repository-wide substitutions:
* `namespace llvm` -> `namespace llvm_ks`
* `llvm::` -> `llvm_ks::`
2018-01-23 11:29:52 +08:00

36 lines
981 B
C++

//===-- StringPool.cpp - Interned string pool -----------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the StringPool class.
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/StringPool.h"
#include "llvm/ADT/StringRef.h"
using namespace llvm_ks;
StringPool::StringPool() {}
StringPool::~StringPool() {
assert(InternTable.empty() && "PooledStringPtr leaked!");
}
PooledStringPtr StringPool::intern(StringRef Key) {
table_t::iterator I = InternTable.find(Key);
if (I != InternTable.end())
return PooledStringPtr(&*I);
entry_t *S = entry_t::Create(Key);
S->getValue().Pool = this;
InternTable.insert(S);
return PooledStringPtr(S);
}