LCOV - code coverage report
Current view: top level - include/llvm/Support - StringSaver.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 4 4 100.0 %
Date: 2017-09-14 15:23:50 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- llvm/Support/StringSaver.h -------------------------------*- C++ -*-===//
       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             : 
      10             : #ifndef LLVM_SUPPORT_STRINGSAVER_H
      11             : #define LLVM_SUPPORT_STRINGSAVER_H
      12             : 
      13             : #include "llvm/ADT/StringRef.h"
      14             : #include "llvm/ADT/Twine.h"
      15             : #include "llvm/Support/Allocator.h"
      16             : 
      17             : namespace llvm {
      18             : 
      19             : /// \brief Saves strings in the inheritor's stable storage and returns a
      20             : /// StringRef with a stable character pointer.
      21             : class StringSaver final {
      22             :   BumpPtrAllocator &Alloc;
      23             : 
      24             : public:
      25      131459 :   StringSaver(BumpPtrAllocator &Alloc) : Alloc(Alloc) {}
      26          22 :   StringRef save(const char *S) { return save(StringRef(S)); }
      27             :   StringRef save(StringRef S);
      28     1177941 :   StringRef save(const Twine &S) { return save(StringRef(S.str())); }
      29        3666 :   StringRef save(const std::string &S) { return save(StringRef(S)); }
      30             : };
      31             : }
      32             : #endif

Generated by: LCOV version 1.13