Coverage Report

Created: 2019-03-24 22:13

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/ADT/SetOperations.h
Line
Count
Source
1
//===-- llvm/ADT/SetOperations.h - Generic Set Operations -------*- 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
// This file defines generic set operations that may be used on set's of
10
// different types, and different element types.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_ADT_SETOPERATIONS_H
15
#define LLVM_ADT_SETOPERATIONS_H
16
17
namespace llvm {
18
19
/// set_union(A, B) - Compute A := A u B, return whether A changed.
20
///
21
template <class S1Ty, class S2Ty>
22
56.9M
bool set_union(S1Ty &S1, const S2Ty &S2) {
23
56.9M
  bool Changed = false;
24
56.9M
25
56.9M
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
26
108M
       SI != SE; 
++SI51.7M
)
27
51.7M
    if (S1.insert(*SI).second)
28
42.7M
      Changed = true;
29
56.9M
30
56.9M
  return Changed;
31
56.9M
}
bool llvm::set_union<llvm::DenseSet<unsigned int, llvm::DenseMapInfo<unsigned int> >, llvm::SmallVector<unsigned int, 16u> >(llvm::DenseSet<unsigned int, llvm::DenseMapInfo<unsigned int> >&, llvm::SmallVector<unsigned int, 16u> const&)
Line
Count
Source
22
56.9M
bool set_union(S1Ty &S1, const S2Ty &S2) {
23
56.9M
  bool Changed = false;
24
56.9M
25
56.9M
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
26
108M
       SI != SE; 
++SI51.7M
)
27
51.7M
    if (S1.insert(*SI).second)
28
42.7M
      Changed = true;
29
56.9M
30
56.9M
  return Changed;
31
56.9M
}
bool llvm::set_union<llvm::DenseSet<llvm::Value const*, llvm::DenseMapInfo<llvm::Value const*> >, llvm::DenseSet<llvm::Value const*, llvm::DenseMapInfo<llvm::Value const*> > >(llvm::DenseSet<llvm::Value const*, llvm::DenseMapInfo<llvm::Value const*> >&, llvm::DenseSet<llvm::Value const*, llvm::DenseMapInfo<llvm::Value const*> > const&)
Line
Count
Source
22
53
bool set_union(S1Ty &S1, const S2Ty &S2) {
23
53
  bool Changed = false;
24
53
25
53
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
26
120
       SI != SE; 
++SI67
)
27
67
    if (S1.insert(*SI).second)
28
67
      Changed = true;
29
53
30
53
  return Changed;
31
53
}
bool llvm::set_union<llvm::SmallMapVector<lld::elf::OutputSection const*, lld::elf::MipsGotSection::FileGot::PageBlock, 16u>, llvm::SmallMapVector<lld::elf::OutputSection const*, lld::elf::MipsGotSection::FileGot::PageBlock, 16u> >(llvm::SmallMapVector<lld::elf::OutputSection const*, lld::elf::MipsGotSection::FileGot::PageBlock, 16u>&, llvm::SmallMapVector<lld::elf::OutputSection const*, lld::elf::MipsGotSection::FileGot::PageBlock, 16u> const&)
Line
Count
Source
22
59
bool set_union(S1Ty &S1, const S2Ty &S2) {
23
59
  bool Changed = false;
24
59
25
59
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
26
74
       SI != SE; 
++SI15
)
27
15
    if (S1.insert(*SI).second)
28
14
      Changed = true;
29
59
30
59
  return Changed;
31
59
}
bool llvm::set_union<llvm::MapVector<std::__1::pair<lld::elf::Symbol*, long long>, unsigned long, llvm::DenseMap<std::__1::pair<lld::elf::Symbol*, long long>, unsigned int, llvm::DenseMapInfo<std::__1::pair<lld::elf::Symbol*, long long> >, llvm::detail::DenseMapPair<std::__1::pair<lld::elf::Symbol*, long long>, unsigned int> >, std::__1::vector<std::__1::pair<std::__1::pair<lld::elf::Symbol*, long long>, unsigned long>, std::__1::allocator<std::__1::pair<std::__1::pair<lld::elf::Symbol*, long long>, unsigned long> > > >, llvm::MapVector<std::__1::pair<lld::elf::Symbol*, long long>, unsigned long, llvm::DenseMap<std::__1::pair<lld::elf::Symbol*, long long>, unsigned int, llvm::DenseMapInfo<std::__1::pair<lld::elf::Symbol*, long long> >, llvm::detail::DenseMapPair<std::__1::pair<lld::elf::Symbol*, long long>, unsigned int> >, std::__1::vector<std::__1::pair<std::__1::pair<lld::elf::Symbol*, long long>, unsigned long>, std::__1::allocator<std::__1::pair<std::__1::pair<lld::elf::Symbol*, long long>, unsigned long> > > > >(llvm::MapVector<std::__1::pair<lld::elf::Symbol*, long long>, unsigned long, llvm::DenseMap<std::__1::pair<lld::elf::Symbol*, long long>, unsigned int, llvm::DenseMapInfo<std::__1::pair<lld::elf::Symbol*, long long> >, llvm::detail::DenseMapPair<std::__1::pair<lld::elf::Symbol*, long long>, unsigned int> >, std::__1::vector<std::__1::pair<std::__1::pair<lld::elf::Symbol*, long long>, unsigned long>, std::__1::allocator<std::__1::pair<std::__1::pair<lld::elf::Symbol*, long long>, unsigned long> > > >&, llvm::MapVector<std::__1::pair<lld::elf::Symbol*, long long>, unsigned long, llvm::DenseMap<std::__1::pair<lld::elf::Symbol*, long long>, unsigned int, llvm::DenseMapInfo<std::__1::pair<lld::elf::Symbol*, long long> >, llvm::detail::DenseMapPair<std::__1::pair<lld::elf::Symbol*, long long>, unsigned int> >, std::__1::vector<std::__1::pair<std::__1::pair<lld::elf::Symbol*, long long>, unsigned long>, std::__1::allocator<std::__1::pair<std::__1::pair<lld::elf::Symbol*, long long>, unsigned long> > > > const&)
Line
Count
Source
22
117
bool set_union(S1Ty &S1, const S2Ty &S2) {
23
117
  bool Changed = false;
24
117
25
117
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
26
10.1k
       SI != SE; 
++SI10.0k
)
27
10.0k
    if (S1.insert(*SI).second)
28
10.0k
      Changed = true;
29
117
30
117
  return Changed;
31
117
}
bool llvm::set_union<llvm::MapVector<lld::elf::Symbol*, unsigned long, llvm::DenseMap<lld::elf::Symbol*, unsigned int, llvm::DenseMapInfo<lld::elf::Symbol*>, llvm::detail::DenseMapPair<lld::elf::Symbol*, unsigned int> >, std::__1::vector<std::__1::pair<lld::elf::Symbol*, unsigned long>, std::__1::allocator<std::__1::pair<lld::elf::Symbol*, unsigned long> > > >, llvm::MapVector<lld::elf::Symbol*, unsigned long, llvm::DenseMap<lld::elf::Symbol*, unsigned int, llvm::DenseMapInfo<lld::elf::Symbol*>, llvm::detail::DenseMapPair<lld::elf::Symbol*, unsigned int> >, std::__1::vector<std::__1::pair<lld::elf::Symbol*, unsigned long>, std::__1::allocator<std::__1::pair<lld::elf::Symbol*, unsigned long> > > > >(llvm::MapVector<lld::elf::Symbol*, unsigned long, llvm::DenseMap<lld::elf::Symbol*, unsigned int, llvm::DenseMapInfo<lld::elf::Symbol*>, llvm::detail::DenseMapPair<lld::elf::Symbol*, unsigned int> >, std::__1::vector<std::__1::pair<lld::elf::Symbol*, unsigned long>, std::__1::allocator<std::__1::pair<lld::elf::Symbol*, unsigned long> > > >&, llvm::MapVector<lld::elf::Symbol*, unsigned long, llvm::DenseMap<lld::elf::Symbol*, unsigned int, llvm::DenseMapInfo<lld::elf::Symbol*>, llvm::detail::DenseMapPair<lld::elf::Symbol*, unsigned int> >, std::__1::vector<std::__1::pair<lld::elf::Symbol*, unsigned long>, std::__1::allocator<std::__1::pair<lld::elf::Symbol*, unsigned long> > > > const&)
Line
Count
Source
22
352
bool set_union(S1Ty &S1, const S2Ty &S2) {
23
352
  bool Changed = false;
24
352
25
352
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
26
461
       SI != SE; 
++SI109
)
27
109
    if (S1.insert(*SI).second)
28
104
      Changed = true;
29
352
30
352
  return Changed;
31
352
}
32
33
/// set_intersect(A, B) - Compute A := A ^ B
34
/// Identical to set_intersection, except that it works on set<>'s and
35
/// is nicer to use.  Functionally, this iterates through S1, removing
36
/// elements that are not contained in S2.
37
///
38
template <class S1Ty, class S2Ty>
39
577k
void set_intersect(S1Ty &S1, const S2Ty &S2) {
40
1.10M
   for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) {
41
523k
     const auto &E = *I;
42
523k
     ++I;
43
523k
     if (!S2.count(E)) 
S1.erase(E)490k
; // Erase element if not in S2
44
523k
   }
45
577k
}
void llvm::set_intersect<llvm::SmallPtrSet<llvm::BasicBlock*, 4u>, llvm::SmallPtrSet<llvm::BasicBlock*, 4u> >(llvm::SmallPtrSet<llvm::BasicBlock*, 4u>&, llvm::SmallPtrSet<llvm::BasicBlock*, 4u> const&)
Line
Count
Source
39
90
void set_intersect(S1Ty &S1, const S2Ty &S2) {
40
210
   for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) {
41
120
     const auto &E = *I;
42
120
     ++I;
43
120
     if (!S2.count(E)) 
S1.erase(E)51
; // Erase element if not in S2
44
120
   }
45
90
}
void llvm::set_intersect<llvm::SmallPtrSet<llvm::Value*, 4u>, llvm::SmallPtrSet<llvm::Value*, 4u> >(llvm::SmallPtrSet<llvm::Value*, 4u>&, llvm::SmallPtrSet<llvm::Value*, 4u> const&)
Line
Count
Source
39
577k
void set_intersect(S1Ty &S1, const S2Ty &S2) {
40
1.10M
   for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) {
41
523k
     const auto &E = *I;
42
523k
     ++I;
43
523k
     if (!S2.count(E)) 
S1.erase(E)490k
; // Erase element if not in S2
44
523k
   }
45
577k
}
void llvm::set_intersect<llvm::DenseSet<llvm::Value const*, llvm::DenseMapInfo<llvm::Value const*> >, llvm::DenseSet<llvm::Value const*, llvm::DenseMapInfo<llvm::Value const*> > >(llvm::DenseSet<llvm::Value const*, llvm::DenseMapInfo<llvm::Value const*> >&, llvm::DenseSet<llvm::Value const*, llvm::DenseMapInfo<llvm::Value const*> > const&)
Line
Count
Source
39
56
void set_intersect(S1Ty &S1, const S2Ty &S2) {
40
151
   for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) {
41
95
     const auto &E = *I;
42
95
     ++I;
43
95
     if (!S2.count(E)) 
S1.erase(E)33
; // Erase element if not in S2
44
95
   }
45
56
}
46
47
/// set_difference(A, B) - Return A - B
48
///
49
template <class S1Ty, class S2Ty>
50
51
S1Ty set_difference(const S1Ty &S1, const S2Ty &S2) {
51
51
  S1Ty Result;
52
51
  for (typename S1Ty::const_iterator SI = S1.begin(), SE = S1.end();
53
62
       SI != SE; 
++SI11
)
54
11
    if (!S2.count(*SI))       // if the element is not in set2
55
9
      Result.insert(*SI);
56
51
  return Result;
57
51
}
58
59
/// set_subtract(A, B) - Compute A := A - B
60
///
61
template <class S1Ty, class S2Ty>
62
56.9M
void set_subtract(S1Ty &S1, const S2Ty &S2) {
63
56.9M
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
64
79.7M
       SI != SE; 
++SI22.8M
)
65
22.8M
    S1.erase(*SI);
66
56.9M
}
67
68
} // End llvm namespace
69
70
#endif