LCOV - code coverage report
Current view: top level - lib/Support - StringPool.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 8 8 100.0 %
Date: 2018-10-20 13:21:21 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- StringPool.cpp - Interned string pool -----------------------------===//
       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             : // This file implements the StringPool class.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #include "llvm/Support/StringPool.h"
      15             : #include "llvm/ADT/StringRef.h"
      16             : 
      17             : using namespace llvm;
      18             : 
      19          48 : StringPool::StringPool() {}
      20             : 
      21          24 : StringPool::~StringPool() {
      22             :   assert(InternTable.empty() && "PooledStringPtr leaked!");
      23          24 : }
      24             : 
      25         155 : PooledStringPtr StringPool::intern(StringRef Key) {
      26         155 :   table_t::iterator I = InternTable.find(Key);
      27         310 :   if (I != InternTable.end())
      28             :     return PooledStringPtr(&*I);
      29             : 
      30             :   entry_t *S = entry_t::Create(Key);
      31         104 :   S->getValue().Pool = this;
      32         104 :   InternTable.insert(S);
      33             : 
      34             :   return PooledStringPtr(S);
      35             : }

Generated by: LCOV version 1.13