LLVM  8.0.1
Public Member Functions | List of all members
llvm::UniqueStringSaver Class Referencefinal

Saves strings in the provided stable storage and returns a StringRef with a stable character pointer. More...

#include "llvm/Support/StringSaver.h"

Public Member Functions

 UniqueStringSaver (BumpPtrAllocator &Alloc)
 
StringRef save (const char *S)
 
StringRef save (StringRef S)
 
StringRef save (const Twine &S)
 
StringRef save (const std::string &S)
 

Detailed Description

Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.

Saving the same string yields the same StringRef.

Compared to StringSaver, it does more work but avoids saving the same string multiple times.

Compared to StringPool, it performs fewer allocations but doesn't support refcounting/deletion.

Definition at line 43 of file StringSaver.h.

Constructor & Destructor Documentation

◆ UniqueStringSaver()

llvm::UniqueStringSaver::UniqueStringSaver ( BumpPtrAllocator Alloc)
inline

Definition at line 48 of file StringSaver.h.

Member Function Documentation

◆ save() [1/4]

StringRef llvm::UniqueStringSaver::save ( const char S)
inline

Definition at line 51 of file StringSaver.h.

References llvm::StringSaver::save(), and save().

Referenced by save().

◆ save() [2/4]

StringRef UniqueStringSaver::save ( StringRef  S)

Definition at line 22 of file StringSaver.cpp.

◆ save() [3/4]

StringRef llvm::UniqueStringSaver::save ( const Twine S)
inline

Definition at line 53 of file StringSaver.h.

References save(), and llvm::Twine::str().

Referenced by save().

◆ save() [4/4]

StringRef llvm::UniqueStringSaver::save ( const std::string &  S)
inline

Definition at line 54 of file StringSaver.h.

References save().

Referenced by save().


The documentation for this class was generated from the following files: