diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-06-21 13:59:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-06-21 13:59:01 +0000 |
commit | 3a0822f094b578157263e04114075ad7df81db41 (patch) | |
tree | bc48361fe2cd1ca5f93ac01b38b183774468fc79 /lib/Support/StringSaver.cpp | |
parent | 85d8b2bbe386bcfe669575d05b61482d7be07e5d (diff) |
Notes
Diffstat (limited to 'lib/Support/StringSaver.cpp')
-rw-r--r-- | lib/Support/StringSaver.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Support/StringSaver.cpp b/lib/Support/StringSaver.cpp new file mode 100644 index 000000000000..d6b84e53dccd --- /dev/null +++ b/lib/Support/StringSaver.cpp @@ -0,0 +1,19 @@ +//===-- StringSaver.cpp ---------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Support/StringSaver.h" + +using namespace llvm; + +const char *StringSaver::saveImpl(StringRef S) { + char *P = Alloc.Allocate<char>(S.size() + 1); + memcpy(P, S.data(), S.size()); + P[S.size()] = '\0'; + return P; +} |