1 //===-- ManagedStringPool.h - Managed String Pool ---------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // The strings allocated from a managed string pool are owned by the string
11 // pool and will be deleted together with the managed string pool.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_SUPPORT_MANAGED_STRING_H
16 #define LLVM_SUPPORT_MANAGED_STRING_H
18 #include "llvm/ADT/SmallVector.h"
23 /// ManagedStringPool - The strings allocated from a managed string pool are
24 /// owned by the string pool and will be deleted together with the managed
26 class ManagedStringPool {
27 SmallVector<std::string *, 8> Pool;
30 ManagedStringPool() {}
31 ~ManagedStringPool() {
32 SmallVectorImpl<std::string *>::iterator Current = Pool.begin();
33 while (Current != Pool.end()) {
39 std::string *getManagedString(const char *S) {
40 std::string *Str = new std::string(S);