1 //===-- ManagedStringPool.h - Managed String Pool ---------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // The strings allocated from a managed string pool are owned by the string
10 // pool and will be deleted together with the managed string pool.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_NVPTX_MANAGEDSTRINGPOOL_H
15 #define LLVM_LIB_TARGET_NVPTX_MANAGEDSTRINGPOOL_H
17 #include "llvm/ADT/SmallVector.h"
22 /// ManagedStringPool - The strings allocated from a managed string pool are
23 /// owned by the string pool and will be deleted together with the managed
25 class ManagedStringPool
{
26 SmallVector
<std::string
*, 8> Pool
;
29 ManagedStringPool() = default;
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
);
46 } // end namespace llvm
48 #endif // LLVM_LIB_TARGET_NVPTX_MANAGEDSTRINGPOOL_H