Coverage Report

Created: 2018-07-12 09:57

/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
//                     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 defines generic set operations that may be used on set's of
11
// different types, and different element types.
12
//
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_ADT_SETOPERATIONS_H
16
#define LLVM_ADT_SETOPERATIONS_H
17
18
namespace llvm {
19
20
/// set_union(A, B) - Compute A := A u B, return whether A changed.
21
///
22
template <class S1Ty, class S2Ty>
23
45.6M
bool set_union(S1Ty &S1, const S2Ty &S2) {
24
45.6M
  bool Changed = false;
25
45.6M
26
45.6M
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
27
87.2M
       SI != SE; 
++SI41.6M
)
28
41.6M
    if (S1.insert(*SI).second)
29
34.2M
      Changed = true;
30
45.6M
31
45.6M
  return Changed;
32
45.6M
}
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
23
45.6M
bool set_union(S1Ty &S1, const S2Ty &S2) {
24
45.6M
  bool Changed = false;
25
45.6M
26
45.6M
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
27
87.2M
       SI != SE; 
++SI41.6M
)
28
41.6M
    if (S1.insert(*SI).second)
29
34.2M
      Changed = true;
30
45.6M
31
45.6M
  return Changed;
32
45.6M
}
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
23
53
bool set_union(S1Ty &S1, const S2Ty &S2) {
24
53
  bool Changed = false;
25
53
26
53
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
27
120
       SI != SE; 
++SI67
)
28
67
    if (S1.insert(*SI).second)
29
67
      Changed = true;
30
53
31
53
  return Changed;
32
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
23
57
bool set_union(S1Ty &S1, const S2Ty &S2) {
24
57
  bool Changed = false;
25
57
26
57
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
27
73
       SI != SE; 
++SI16
)
28
16
    if (S1.insert(*SI).second)
29
15
      Changed = true;
30
57
31
57
  return Changed;
32
57
}
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
23
111
bool set_union(S1Ty &S1, const S2Ty &S2) {
24
111
  bool Changed = false;
25
111
26
111
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
27
20.1k
       SI != SE; 
++SI20.0k
)
28
20.0k
    if (S1.insert(*SI).second)
29
20.0k
      Changed = true;
30
111
31
111
  return Changed;
32
111
}
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
23
336
bool set_union(S1Ty &S1, const S2Ty &S2) {
24
336
  bool Changed = false;
25
336
26
336
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
27
449
       SI != SE; 
++SI113
)
28
113
    if (S1.insert(*SI).second)
29
108
      Changed = true;
30
336
31
336
  return Changed;
32
336
}
33
34
/// set_intersect(A, B) - Compute A := A ^ B
35
/// Identical to set_intersection, except that it works on set<>'s and
36
/// is nicer to use.  Functionally, this iterates through S1, removing
37
/// elements that are not contained in S2.
38
///
39
template <class S1Ty, class S2Ty>
40
539k
void set_intersect(S1Ty &S1, const S2Ty &S2) {
41
1.04M
   for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) {
42
508k
     const auto &E = *I;
43
508k
     ++I;
44
508k
     if (!S2.count(E)) 
S1.erase(E)474k
; // Erase element if not in S2
45
508k
   }
46
539k
}
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
40
539k
void set_intersect(S1Ty &S1, const S2Ty &S2) {
41
1.04M
   for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) {
42
508k
     const auto &E = *I;
43
508k
     ++I;
44
508k
     if (!S2.count(E)) 
S1.erase(E)474k
; // Erase element if not in S2
45
508k
   }
46
539k
}
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
40
58
void set_intersect(S1Ty &S1, const S2Ty &S2) {
41
187
   for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) {
42
129
     const auto &E = *I;
43
129
     ++I;
44
129
     if (!S2.count(E)) 
S1.erase(E)33
; // Erase element if not in S2
45
129
   }
46
58
}
47
48
/// set_difference(A, B) - Return A - B
49
///
50
template <class S1Ty, class S2Ty>
51
51
S1Ty set_difference(const S1Ty &S1, const S2Ty &S2) {
52
51
  S1Ty Result;
53
51
  for (typename S1Ty::const_iterator SI = S1.begin(), SE = S1.end();
54
62
       SI != SE; 
++SI11
)
55
11
    if (!S2.count(*SI))       // if the element is not in set2
56
9
      Result.insert(*SI);
57
51
  return Result;
58
51
}
59
60
/// set_subtract(A, B) - Compute A := A - B
61
///
62
template <class S1Ty, class S2Ty>
63
45.6M
void set_subtract(S1Ty &S1, const S2Ty &S2) {
64
45.6M
  for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end();
65
63.6M
       SI != SE; 
++SI18.0M
)
66
18.0M
    S1.erase(*SI);
67
45.6M
}
68
69
} // End llvm namespace
70
71
#endif