LCOV - code coverage report
Current view: top level - /usr/lib/llvm-19/include/llvm/ADT - StringSet.h (source / functions) Coverage Total Hit
Test: PostgreSQL 19devel Lines: 100.0 % 3 3
Test Date: 2026-02-27 05:14:50 Functions: 100.0 % 2 2
Legend: Lines:     hit not hit

            Line data    Source code
       1              : //===- StringSet.h - An efficient set built on StringMap --------*- C++ -*-===//
       2              : //
       3              : // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
       4              : // See https://llvm.org/LICENSE.txt for license information.
       5              : // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
       6              : //
       7              : //===----------------------------------------------------------------------===//
       8              : ///
       9              : /// \file
      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              : 
      19              : namespace llvm {
      20              : 
      21              : /// StringSet - A wrapper for StringMap that provides set-like functionality.
      22              : template <class AllocatorTy = MallocAllocator>
      23              : class StringSet : public StringMap<std::nullopt_t, AllocatorTy> {
      24              :   using Base = StringMap<std::nullopt_t, AllocatorTy>;
      25              : 
      26              : public:
      27        27237 :   StringSet() = default;
      28              :   StringSet(std::initializer_list<StringRef> initializer) {
      29              :     for (StringRef str : initializer)
      30              :       insert(str);
      31              :   }
      32              :   template <typename Container> explicit StringSet(Container &&C) {
      33              :     for (auto &&Str : C)
      34              :       insert(Str);
      35              :   }
      36              :   explicit StringSet(AllocatorTy a) : Base(a) {}
      37              : 
      38        66188 :   std::pair<typename Base::iterator, bool> insert(StringRef key) {
      39        66188 :     return Base::try_emplace(key);
      40              :   }
      41              : 
      42              :   template <typename InputIt>
      43              :   void insert(InputIt begin, InputIt end) {
      44              :     for (auto it = begin; it != end; ++it)
      45              :       insert(*it);
      46              :   }
      47              : 
      48              :   template <typename ValueTy>
      49              :   std::pair<typename Base::iterator, bool>
      50              :   insert(const StringMapEntry<ValueTy> &mapEntry) {
      51              :     return insert(mapEntry.getKey());
      52              :   }
      53              : 
      54              :   /// Check if the set contains the given \c key.
      55              :   bool contains(StringRef key) const { return Base::FindKey(key) != -1; }
      56              : };
      57              : 
      58              : } // end namespace llvm
      59              : 
      60              : #endif // LLVM_ADT_STRINGSET_H
        

Generated by: LCOV version 2.0-1