2
0

StringSaver.cpp 570 B

12345678910111213141516171819
  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. #include "llvm/Support/StringSaver.h"
  10. using namespace llvm;
  11. const char *StringSaver::saveImpl(StringRef S) {
  12. char *P = Alloc.Allocate<char>(S.size() + 1);
  13. memcpy(P, S.data(), S.size());
  14. P[S.size()] = '\0';
  15. return P;
  16. }