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

          Line data    Source code
       1             : //===- StringSet.h - The LLVM Compiler Driver -------------------*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open
       6             : // Source License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : //  StringSet - A set-like wrapper for the StringMap.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #ifndef LLVM_ADT_STRINGSET_H
      15             : #define LLVM_ADT_STRINGSET_H
      16             : 
      17             : #include "llvm/ADT/StringMap.h"
      18             : #include "llvm/ADT/StringRef.h"
      19             : #include "llvm/Support/Allocator.h"
      20             : #include <cassert>
      21             : #include <initializer_list>
      22             : #include <utility>
      23             : 
      24             : namespace llvm {
      25             : 
      26             :   /// StringSet - A wrapper for StringMap that provides set-like functionality.
      27             :   template <class AllocatorTy = MallocAllocator>
      28      615105 :   class StringSet : public StringMap<char, AllocatorTy> {
      29             :     using base = StringMap<char, AllocatorTy>;
      30             : 
      31             :   public:
      32     1189820 :     StringSet() = default;
      33         114 :     StringSet(std::initializer_list<StringRef> S) {
      34         456 :       for (StringRef X : S)
      35         342 :         insert(X);
      36          57 :     }
      37             : 
      38             :     std::pair<typename base::iterator, bool> insert(StringRef Key) {
      39             :       assert(!Key.empty());
      40   284613429 :       return base::insert(std::make_pair(Key, '\0'));
      41             :     }
      42             : 
      43             :     template <typename InputIt>
      44          14 :     void insert(const InputIt &Begin, const InputIt &End) {
      45          38 :       for (auto It = Begin; It != End; ++It)
      46          50 :         base::insert(std::make_pair(*It, '\0'));
      47          14 :     }
      48             :   };
      49             : 
      50             : } // end namespace llvm
      51             : 
      52             : #endif // LLVM_ADT_STRINGSET_H

Generated by: LCOV version 1.13