LLVM  6.0.0svn
StringSaver.cpp
Go to the documentation of this file.
1 //===-- StringSaver.cpp ---------------------------------------------------===//
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 
11 
12 using namespace llvm;
13 
15  char *P = Alloc.Allocate<char>(S.size() + 1);
16  memcpy(P, S.data(), S.size());
17  P[S.size()] = '\0';
18  return StringRef(P, S.size());
19 }
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Definition: StringRef.h:138
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:128
#define P(N)
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, size_t Alignment)
Allocate space at the specified alignment.
Definition: Allocator.h:212
StringRef save(const char *S)
Definition: StringSaver.h:26
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49