Coverage Report

Created: 2018-07-12 09:57

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/ADT/ImmutableList.h
Line
Count
Source (jump to first uncovered line)
1
//==--- ImmutableList.h - Immutable (functional) list interface --*- 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 the ImmutableList class.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_ADT_IMMUTABLELIST_H
15
#define LLVM_ADT_IMMUTABLELIST_H
16
17
#include "llvm/ADT/FoldingSet.h"
18
#include "llvm/Support/Allocator.h"
19
#include <cassert>
20
#include <cstdint>
21
#include <new>
22
23
namespace llvm {
24
25
template <typename T> class ImmutableListFactory;
26
27
template <typename T>
28
class ImmutableListImpl : public FoldingSetNode {
29
  friend class ImmutableListFactory<T>;
30
31
  T Head;
32
  const ImmutableListImpl* Tail;
33
34
  ImmutableListImpl(const T& head, const ImmutableListImpl* tail = nullptr)
35
2.07k
    : Head(head), Tail(tail) {}
llvm::ImmutableListImpl<clang::ento::MemRegion const*>::ImmutableListImpl(clang::ento::MemRegion const* const&, llvm::ImmutableListImpl<clang::ento::MemRegion const*> const*)
Line
Count
Source
35
46
    : Head(head), Tail(tail) {}
llvm::ImmutableListImpl<clang::ento::FieldRegion const*>::ImmutableListImpl(clang::ento::FieldRegion const* const&, llvm::ImmutableListImpl<clang::ento::FieldRegion const*> const*)
Line
Count
Source
35
181
    : Head(head), Tail(tail) {}
llvm::ImmutableListImpl<clang::CXXBaseSpecifier const*>::ImmutableListImpl(clang::CXXBaseSpecifier const* const&, llvm::ImmutableListImpl<clang::CXXBaseSpecifier const*> const*)
Line
Count
Source
35
22
    : Head(head), Tail(tail) {}
llvm::ImmutableListImpl<clang::ento::SVal>::ImmutableListImpl(clang::ento::SVal const&, llvm::ImmutableListImpl<clang::ento::SVal> const*)
Line
Count
Source
35
1.69k
    : Head(head), Tail(tail) {}
llvm::ImmutableListImpl<LoopState>::ImmutableListImpl(LoopState const&, llvm::ImmutableListImpl<LoopState> const*)
Line
Count
Source
35
130
    : Head(head), Tail(tail) {}
36
37
public:
38
  ImmutableListImpl(const ImmutableListImpl &) = delete;
39
  ImmutableListImpl &operator=(const ImmutableListImpl &) = delete;
40
41
17.0k
  const T& getHead() const { return Head; }
llvm::ImmutableListImpl<clang::ento::SVal>::getHead() const
Line
Count
Source
41
5.45k
  const T& getHead() const { return Head; }
llvm::ImmutableListImpl<clang::ento::MemRegion const*>::getHead() const
Line
Count
Source
41
33
  const T& getHead() const { return Head; }
llvm::ImmutableListImpl<clang::ento::FieldRegion const*>::getHead() const
Line
Count
Source
41
778
  const T& getHead() const { return Head; }
llvm::ImmutableListImpl<LoopState>::getHead() const
Line
Count
Source
41
10.8k
  const T& getHead() const { return Head; }
llvm::ImmutableListImpl<clang::CXXBaseSpecifier const*>::getHead() const
Line
Count
Source
41
21
  const T& getHead() const { return Head; }
42
5.91k
  const ImmutableListImpl* getTail() const { return Tail; }
llvm::ImmutableListImpl<clang::ento::MemRegion const*>::getTail() const
Line
Count
Source
42
29
  const ImmutableListImpl* getTail() const { return Tail; }
llvm::ImmutableListImpl<clang::ento::FieldRegion const*>::getTail() const
Line
Count
Source
42
278
  const ImmutableListImpl* getTail() const { return Tail; }
llvm::ImmutableListImpl<LoopState>::getTail() const
Line
Count
Source
42
165
  const ImmutableListImpl* getTail() const { return Tail; }
llvm::ImmutableListImpl<clang::ento::SVal>::getTail() const
Line
Count
Source
42
5.42k
  const ImmutableListImpl* getTail() const { return Tail; }
llvm::ImmutableListImpl<clang::CXXBaseSpecifier const*>::getTail() const
Line
Count
Source
42
21
  const ImmutableListImpl* getTail() const { return Tail; }
43
44
  static inline void Profile(FoldingSetNodeID& ID, const T& H,
45
2.77k
                             const ImmutableListImpl* L){
46
2.77k
    ID.AddPointer(L);
47
2.77k
    ID.Add(H);
48
2.77k
  }
llvm::ImmutableListImpl<clang::ento::MemRegion const*>::Profile(llvm::FoldingSetNodeID&, clang::ento::MemRegion const* const&, llvm::ImmutableListImpl<clang::ento::MemRegion const*> const*)
Line
Count
Source
45
60
                             const ImmutableListImpl* L){
46
60
    ID.AddPointer(L);
47
60
    ID.Add(H);
48
60
  }
llvm::ImmutableListImpl<clang::ento::FieldRegion const*>::Profile(llvm::FoldingSetNodeID&, clang::ento::FieldRegion const* const&, llvm::ImmutableListImpl<clang::ento::FieldRegion const*> const*)
Line
Count
Source
45
252
                             const ImmutableListImpl* L){
46
252
    ID.AddPointer(L);
47
252
    ID.Add(H);
48
252
  }
llvm::ImmutableListImpl<clang::CXXBaseSpecifier const*>::Profile(llvm::FoldingSetNodeID&, clang::CXXBaseSpecifier const* const&, llvm::ImmutableListImpl<clang::CXXBaseSpecifier const*> const*)
Line
Count
Source
45
37
                             const ImmutableListImpl* L){
46
37
    ID.AddPointer(L);
47
37
    ID.Add(H);
48
37
  }
llvm::ImmutableListImpl<clang::ento::SVal>::Profile(llvm::FoldingSetNodeID&, clang::ento::SVal const&, llvm::ImmutableListImpl<clang::ento::SVal> const*)
Line
Count
Source
45
2.18k
                             const ImmutableListImpl* L){
46
2.18k
    ID.AddPointer(L);
47
2.18k
    ID.Add(H);
48
2.18k
  }
llvm::ImmutableListImpl<LoopState>::Profile(llvm::FoldingSetNodeID&, LoopState const&, llvm::ImmutableListImpl<LoopState> const*)
Line
Count
Source
45
246
                             const ImmutableListImpl* L){
46
246
    ID.AddPointer(L);
47
246
    ID.Add(H);
48
246
  }
49
50
408
  void Profile(FoldingSetNodeID& ID) {
51
408
    Profile(ID, Head, Tail);
52
408
  }
llvm::ImmutableListImpl<clang::ento::MemRegion const*>::Profile(llvm::FoldingSetNodeID&)
Line
Count
Source
50
7
  void Profile(FoldingSetNodeID& ID) {
51
7
    Profile(ID, Head, Tail);
52
7
  }
llvm::ImmutableListImpl<clang::ento::FieldRegion const*>::Profile(llvm::FoldingSetNodeID&)
Line
Count
Source
50
58
  void Profile(FoldingSetNodeID& ID) {
51
58
    Profile(ID, Head, Tail);
52
58
  }
llvm::ImmutableListImpl<clang::CXXBaseSpecifier const*>::Profile(llvm::FoldingSetNodeID&)
Line
Count
Source
50
9
  void Profile(FoldingSetNodeID& ID) {
51
9
    Profile(ID, Head, Tail);
52
9
  }
llvm::ImmutableListImpl<clang::ento::SVal>::Profile(llvm::FoldingSetNodeID&)
Line
Count
Source
50
276
  void Profile(FoldingSetNodeID& ID) {
51
276
    Profile(ID, Head, Tail);
52
276
  }
llvm::ImmutableListImpl<LoopState>::Profile(llvm::FoldingSetNodeID&)
Line
Count
Source
50
58
  void Profile(FoldingSetNodeID& ID) {
51
58
    Profile(ID, Head, Tail);
52
58
  }
53
};
54
55
/// ImmutableList - This class represents an immutable (functional) list.
56
///  It is implemented as a smart pointer (wraps ImmutableListImpl), so it
57
///  it is intended to always be copied by value as if it were a pointer.
58
///  This interface matches ImmutableSet and ImmutableMap.  ImmutableList
59
///  objects should almost never be created directly, and instead should
60
///  be created by ImmutableListFactory objects that manage the lifetime
61
///  of a group of lists.  When the factory object is reclaimed, all lists
62
///  created by that factory are released as well.
63
template <typename T>
64
class ImmutableList {
65
public:
66
  using value_type = T;
67
  using Factory = ImmutableListFactory<T>;
68
69
private:
70
  const ImmutableListImpl<T>* X;
71
72
public:
73
  // This constructor should normally only be called by ImmutableListFactory<T>.
74
  // There may be cases, however, when one needs to extract the internal pointer
75
  // and reconstruct a list object from that pointer.
76
15.0k
  ImmutableList(const ImmutableListImpl<T>* x = nullptr) : X(x) {}
llvm::ImmutableList<clang::ento::MemRegion const*>::ImmutableList(llvm::ImmutableListImpl<clang::ento::MemRegion const*> const*)
Line
Count
Source
76
181
  ImmutableList(const ImmutableListImpl<T>* x = nullptr) : X(x) {}
llvm::ImmutableList<clang::ento::FieldRegion const*>::ImmutableList(llvm::ImmutableListImpl<clang::ento::FieldRegion const*> const*)
Line
Count
Source
76
1.45k
  ImmutableList(const ImmutableListImpl<T>* x = nullptr) : X(x) {}
llvm::ImmutableList<clang::CXXBaseSpecifier const*>::ImmutableList(llvm::ImmutableListImpl<clang::CXXBaseSpecifier const*> const*)
Line
Count
Source
76
71
  ImmutableList(const ImmutableListImpl<T>* x = nullptr) : X(x) {}
llvm::ImmutableList<clang::ento::SVal>::ImmutableList(llvm::ImmutableListImpl<clang::ento::SVal> const*)
Line
Count
Source
76
5.16k
  ImmutableList(const ImmutableListImpl<T>* x = nullptr) : X(x) {}
llvm::ImmutableList<LoopState>::ImmutableList(llvm::ImmutableListImpl<LoopState> const*)
Line
Count
Source
76
8.12k
  ImmutableList(const ImmutableListImpl<T>* x = nullptr) : X(x) {}
77
78
7.34k
  const ImmutableListImpl<T>* getInternalPointer() const {
79
7.34k
    return X;
80
7.34k
  }
llvm::ImmutableList<clang::ento::MemRegion const*>::getInternalPointer() const
Line
Count
Source
78
135
  const ImmutableListImpl<T>* getInternalPointer() const {
79
135
    return X;
80
135
  }
llvm::ImmutableList<clang::ento::FieldRegion const*>::getInternalPointer() const
Line
Count
Source
78
1.31k
  const ImmutableListImpl<T>* getInternalPointer() const {
79
1.31k
    return X;
80
1.31k
  }
llvm::ImmutableList<clang::ento::SVal>::getInternalPointer() const
Line
Count
Source
78
5.28k
  const ImmutableListImpl<T>* getInternalPointer() const {
79
5.28k
    return X;
80
5.28k
  }
llvm::ImmutableList<clang::CXXBaseSpecifier const*>::getInternalPointer() const
Line
Count
Source
78
65
  const ImmutableListImpl<T>* getInternalPointer() const {
79
65
    return X;
80
65
  }
llvm::ImmutableList<LoopState>::getInternalPointer() const
Line
Count
Source
78
541
  const ImmutableListImpl<T>* getInternalPointer() const {
79
541
    return X;
80
541
  }
81
82
  class iterator {
83
    const ImmutableListImpl<T>* L = nullptr;
84
85
  public:
86
2.92k
    iterator() = default;
Unexecuted instantiation: llvm::ImmutableList<clang::ento::MemRegion const*>::iterator::iterator()
llvm::ImmutableList<clang::ento::FieldRegion const*>::iterator::iterator()
Line
Count
Source
86
523
    iterator() = default;
llvm::ImmutableList<clang::ento::SVal>::iterator::iterator()
Line
Count
Source
86
2.38k
    iterator() = default;
llvm::ImmutableList<clang::CXXBaseSpecifier const*>::iterator::iterator()
Line
Count
Source
86
11
    iterator() = default;
87
3.42k
    iterator(ImmutableList l) : L(l.getInternalPointer()) {}
Unexecuted instantiation: llvm::ImmutableList<clang::ento::MemRegion const*>::iterator::iterator(llvm::ImmutableList<clang::ento::MemRegion const*>)
llvm::ImmutableList<clang::ento::FieldRegion const*>::iterator::iterator(llvm::ImmutableList<clang::ento::FieldRegion const*>)
Line
Count
Source
87
1.02k
    iterator(ImmutableList l) : L(l.getInternalPointer()) {}
llvm::ImmutableList<clang::ento::SVal>::iterator::iterator(llvm::ImmutableList<clang::ento::SVal>)
Line
Count
Source
87
2.39k
    iterator(ImmutableList l) : L(l.getInternalPointer()) {}
llvm::ImmutableList<clang::CXXBaseSpecifier const*>::iterator::iterator(llvm::ImmutableList<clang::CXXBaseSpecifier const*>)
Line
Count
Source
87
7
    iterator(ImmutableList l) : L(l.getInternalPointer()) {}
88
89
5.58k
    iterator& operator++() { L = L->getTail(); return *this; }
Unexecuted instantiation: llvm::ImmutableList<clang::ento::MemRegion const*>::iterator::operator++()
llvm::ImmutableList<clang::ento::FieldRegion const*>::iterator::operator++()
Line
Count
Source
89
138
    iterator& operator++() { L = L->getTail(); return *this; }
llvm::ImmutableList<clang::ento::SVal>::iterator::operator++()
Line
Count
Source
89
5.42k
    iterator& operator++() { L = L->getTail(); return *this; }
llvm::ImmutableList<clang::CXXBaseSpecifier const*>::iterator::operator++()
Line
Count
Source
89
21
    iterator& operator++() { L = L->getTail(); return *this; }
90
3.92k
    bool operator==(const iterator& I) const { return L == I.L; }
91
3.37k
    bool operator!=(const iterator& I) const { return L != I.L; }
Unexecuted instantiation: llvm::ImmutableList<clang::ento::MemRegion const*>::iterator::operator!=(llvm::ImmutableList<clang::ento::MemRegion const*>::iterator const&) const
llvm::ImmutableList<clang::ento::FieldRegion const*>::iterator::operator!=(llvm::ImmutableList<clang::ento::FieldRegion const*>::iterator const&) const
Line
Count
Source
91
661
    bool operator!=(const iterator& I) const { return L != I.L; }
llvm::ImmutableList<clang::ento::SVal>::iterator::operator!=(llvm::ImmutableList<clang::ento::SVal>::iterator const&) const
Line
Count
Source
91
2.67k
    bool operator!=(const iterator& I) const { return L != I.L; }
llvm::ImmutableList<clang::CXXBaseSpecifier const*>::iterator::operator!=(llvm::ImmutableList<clang::CXXBaseSpecifier const*>::iterator const&) const
Line
Count
Source
91
30
    bool operator!=(const iterator& I) const { return L != I.L; }
92
6.11k
    const value_type& operator*() const { return L->getHead(); }
llvm::ImmutableList<clang::ento::SVal>::iterator::operator*() const
Line
Count
Source
92
5.45k
    const value_type& operator*() const { return L->getHead(); }
Unexecuted instantiation: llvm::ImmutableList<clang::ento::MemRegion const*>::iterator::operator*() const
llvm::ImmutableList<clang::ento::FieldRegion const*>::iterator::operator*() const
Line
Count
Source
92
638
    const value_type& operator*() const { return L->getHead(); }
llvm::ImmutableList<clang::CXXBaseSpecifier const*>::iterator::operator*() const
Line
Count
Source
92
21
    const value_type& operator*() const { return L->getHead(); }
93
94
    ImmutableList getList() const { return L; }
95
  };
96
97
  /// begin - Returns an iterator referring to the head of the list, or
98
  ///  an iterator denoting the end of the list if the list is empty.
99
3.42k
  iterator begin() const { return iterator(X); }
Unexecuted instantiation: llvm::ImmutableList<clang::ento::MemRegion const*>::begin() const
llvm::ImmutableList<clang::ento::FieldRegion const*>::begin() const
Line
Count
Source
99
1.02k
  iterator begin() const { return iterator(X); }
llvm::ImmutableList<clang::ento::SVal>::begin() const
Line
Count
Source
99
2.39k
  iterator begin() const { return iterator(X); }
llvm::ImmutableList<clang::CXXBaseSpecifier const*>::begin() const
Line
Count
Source
99
7
  iterator begin() const { return iterator(X); }
100
101
  /// end - Returns an iterator denoting the end of the list.  This iterator
102
  ///  does not refer to a valid list element.
103
2.91k
  iterator end() const { return iterator(); }
Unexecuted instantiation: llvm::ImmutableList<clang::ento::MemRegion const*>::end() const
llvm::ImmutableList<clang::ento::FieldRegion const*>::end() const
Line
Count
Source
103
523
  iterator end() const { return iterator(); }
llvm::ImmutableList<clang::ento::SVal>::end() const
Line
Count
Source
103
2.38k
  iterator end() const { return iterator(); }
llvm::ImmutableList<clang::CXXBaseSpecifier const*>::end() const
Line
Count
Source
103
7
  iterator end() const { return iterator(); }
104
105
  /// isEmpty - Returns true if the list is empty.
106
7.83k
  bool isEmpty() const { return !X; }
llvm::ImmutableList<clang::ento::MemRegion const*>::isEmpty() const
Line
Count
Source
106
46
  bool isEmpty() const { return !X; }
llvm::ImmutableList<clang::ento::FieldRegion const*>::isEmpty() const
Line
Count
Source
106
99
  bool isEmpty() const { return !X; }
llvm::ImmutableList<LoopState>::isEmpty() const
Line
Count
Source
106
7.69k
  bool isEmpty() const { return !X; }
107
108
523
  bool contains(const T& V) const {
109
661
    for (iterator I = begin(), E = end(); I != E; 
++I138
) {
110
140
      if (*I == V)
111
2
        return true;
112
140
    }
113
523
    
return false521
;
114
523
  }
115
116
  /// isEqual - Returns true if two lists are equal.  Because all lists created
117
  ///  from the same ImmutableListFactory are uniqued, this has O(1) complexity
118
  ///  because it the contents of the list do not need to be compared.  Note
119
  ///  that you should only compare two lists created from the same
120
  ///  ImmutableListFactory.
121
  bool isEqual(const ImmutableList& L) const { return X == L.X; }
122
123
  bool operator==(const ImmutableList& L) const { return isEqual(L); }
124
125
  /// getHead - Returns the head of the list.
126
10.8k
  const T& getHead() {
127
10.8k
    assert(!isEmpty() && "Cannot get the head of an empty list.");
128
10.8k
    return X->getHead();
129
10.8k
  }
llvm::ImmutableList<clang::ento::MemRegion const*>::getHead()
Line
Count
Source
126
33
  const T& getHead() {
127
33
    assert(!isEmpty() && "Cannot get the head of an empty list.");
128
33
    return X->getHead();
129
33
  }
llvm::ImmutableList<LoopState>::getHead()
Line
Count
Source
126
10.8k
  const T& getHead() {
127
10.8k
    assert(!isEmpty() && "Cannot get the head of an empty list.");
128
10.8k
    return X->getHead();
129
10.8k
  }
130
131
  /// getTail - Returns the tail of the list, which is another (possibly empty)
132
  ///  ImmutableList.
133
194
  ImmutableList getTail() {
134
194
    return X ? X->getTail() : 
nullptr0
;
135
194
  }
llvm::ImmutableList<clang::ento::MemRegion const*>::getTail()
Line
Count
Source
133
29
  ImmutableList getTail() {
134
29
    return X ? X->getTail() : 
nullptr0
;
135
29
  }
llvm::ImmutableList<LoopState>::getTail()
Line
Count
Source
133
165
  ImmutableList getTail() {
134
165
    return X ? X->getTail() : 
nullptr0
;
135
165
  }
136
137
  void Profile(FoldingSetNodeID& ID) const {
138
    ID.AddPointer(X);
139
  }
140
};
141
142
template <typename T>
143
class ImmutableListFactory {
144
  using ListTy = ImmutableListImpl<T>;
145
  using CacheTy = FoldingSet<ListTy>;
146
147
  CacheTy Cache;
148
  uintptr_t Allocator;
149
150
76.4k
  bool ownsAllocator() const {
151
76.4k
    return (Allocator & 0x1) == 0;
152
76.4k
  }
llvm::ImmutableListFactory<clang::ento::MemRegion const*>::ownsAllocator() const
Line
Count
Source
150
37
  bool ownsAllocator() const {
151
37
    return (Allocator & 0x1) == 0;
152
37
  }
llvm::ImmutableListFactory<clang::ento::FieldRegion const*>::ownsAllocator() const
Line
Count
Source
150
57.6k
  bool ownsAllocator() const {
151
57.6k
    return (Allocator & 0x1) == 0;
152
57.6k
  }
llvm::ImmutableListFactory<clang::CXXBaseSpecifier const*>::ownsAllocator() const
Line
Count
Source
150
9.36k
  bool ownsAllocator() const {
151
9.36k
    return (Allocator & 0x1) == 0;
152
9.36k
  }
llvm::ImmutableListFactory<clang::ento::SVal>::ownsAllocator() const
Line
Count
Source
150
9.36k
  bool ownsAllocator() const {
151
9.36k
    return (Allocator & 0x1) == 0;
152
9.36k
  }
llvm::ImmutableListFactory<LoopState>::ownsAllocator() const
Line
Count
Source
150
86
  bool ownsAllocator() const {
151
86
    return (Allocator & 0x1) == 0;
152
86
  }
153
154
59.6k
  BumpPtrAllocator& getAllocator() const {
155
59.6k
    return *reinterpret_cast<BumpPtrAllocator*>(Allocator & ~0x1);
156
59.6k
  }
llvm::ImmutableListFactory<clang::ento::MemRegion const*>::getAllocator() const
Line
Count
Source
154
46
  BumpPtrAllocator& getAllocator() const {
155
46
    return *reinterpret_cast<BumpPtrAllocator*>(Allocator & ~0x1);
156
46
  }
llvm::ImmutableListFactory<clang::ento::FieldRegion const*>::getAllocator() const
Line
Count
Source
154
57.8k
  BumpPtrAllocator& getAllocator() const {
155
57.8k
    return *reinterpret_cast<BumpPtrAllocator*>(Allocator & ~0x1);
156
57.8k
  }
llvm::ImmutableListFactory<clang::CXXBaseSpecifier const*>::getAllocator() const
Line
Count
Source
154
22
  BumpPtrAllocator& getAllocator() const {
155
22
    return *reinterpret_cast<BumpPtrAllocator*>(Allocator & ~0x1);
156
22
  }
llvm::ImmutableListFactory<clang::ento::SVal>::getAllocator() const
Line
Count
Source
154
1.69k
  BumpPtrAllocator& getAllocator() const {
155
1.69k
    return *reinterpret_cast<BumpPtrAllocator*>(Allocator & ~0x1);
156
1.69k
  }
llvm::ImmutableListFactory<LoopState>::getAllocator() const
Line
Count
Source
154
130
  BumpPtrAllocator& getAllocator() const {
155
130
    return *reinterpret_cast<BumpPtrAllocator*>(Allocator & ~0x1);
156
130
  }
157
158
public:
159
  ImmutableListFactory()
160
57.6k
    : Allocator(reinterpret_cast<uintptr_t>(new BumpPtrAllocator())) {}
161
162
  ImmutableListFactory(BumpPtrAllocator& Alloc)
163
18.8k
  : Allocator(reinterpret_cast<uintptr_t>(&Alloc) | 0x1) {}
llvm::ImmutableListFactory<clang::ento::MemRegion const*>::ImmutableListFactory(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&)
Line
Count
Source
163
37
  : Allocator(reinterpret_cast<uintptr_t>(&Alloc) | 0x1) {}
llvm::ImmutableListFactory<LoopState>::ImmutableListFactory(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&)
Line
Count
Source
163
86
  : Allocator(reinterpret_cast<uintptr_t>(&Alloc) | 0x1) {}
llvm::ImmutableListFactory<clang::ento::SVal>::ImmutableListFactory(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&)
Line
Count
Source
163
9.36k
  : Allocator(reinterpret_cast<uintptr_t>(&Alloc) | 0x1) {}
llvm::ImmutableListFactory<clang::CXXBaseSpecifier const*>::ImmutableListFactory(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&)
Line
Count
Source
163
9.36k
  : Allocator(reinterpret_cast<uintptr_t>(&Alloc) | 0x1) {}
164
165
76.4k
  ~ImmutableListFactory() {
166
76.4k
    if (ownsAllocator()) 
delete &getAllocator()57.6k
;
167
76.4k
  }
llvm::ImmutableListFactory<clang::ento::MemRegion const*>::~ImmutableListFactory()
Line
Count
Source
165
37
  ~ImmutableListFactory() {
166
37
    if (ownsAllocator()) 
delete &getAllocator()0
;
167
37
  }
llvm::ImmutableListFactory<clang::ento::FieldRegion const*>::~ImmutableListFactory()
Line
Count
Source
165
57.6k
  ~ImmutableListFactory() {
166
57.6k
    if (ownsAllocator()) delete &getAllocator();
167
57.6k
  }
llvm::ImmutableListFactory<clang::CXXBaseSpecifier const*>::~ImmutableListFactory()
Line
Count
Source
165
9.36k
  ~ImmutableListFactory() {
166
9.36k
    if (ownsAllocator()) 
delete &getAllocator()0
;
167
9.36k
  }
llvm::ImmutableListFactory<clang::ento::SVal>::~ImmutableListFactory()
Line
Count
Source
165
9.36k
  ~ImmutableListFactory() {
166
9.36k
    if (ownsAllocator()) 
delete &getAllocator()0
;
167
9.36k
  }
llvm::ImmutableListFactory<LoopState>::~ImmutableListFactory()
Line
Count
Source
165
86
  ~ImmutableListFactory() {
166
86
    if (ownsAllocator()) 
delete &getAllocator()0
;
167
86
  }
168
169
2.36k
  LLVM_NODISCARD ImmutableList<T> concat(const T &Head, ImmutableList<T> Tail) {
170
2.36k
    // Profile the new list to see if it already exists in our cache.
171
2.36k
    FoldingSetNodeID ID;
172
2.36k
    void* InsertPos;
173
2.36k
174
2.36k
    const ListTy* TailImpl = Tail.getInternalPointer();
175
2.36k
    ListTy::Profile(ID, Head, TailImpl);
176
2.36k
    ListTy* L = Cache.FindNodeOrInsertPos(ID, InsertPos);
177
2.36k
178
2.36k
    if (!L) {
179
2.07k
      // The list does not exist in our cache.  Create it.
180
2.07k
      BumpPtrAllocator& A = getAllocator();
181
2.07k
      L = (ListTy*) A.Allocate<ListTy>();
182
2.07k
      new (L) ListTy(Head, TailImpl);
183
2.07k
184
2.07k
      // Insert the new list into the cache.
185
2.07k
      Cache.InsertNode(L, InsertPos);
186
2.07k
    }
187
2.36k
188
2.36k
    return L;
189
2.36k
  }
llvm::ImmutableListFactory<clang::ento::MemRegion const*>::concat(clang::ento::MemRegion const* const&, llvm::ImmutableList<clang::ento::MemRegion const*>)
Line
Count
Source
169
53
  LLVM_NODISCARD ImmutableList<T> concat(const T &Head, ImmutableList<T> Tail) {
170
53
    // Profile the new list to see if it already exists in our cache.
171
53
    FoldingSetNodeID ID;
172
53
    void* InsertPos;
173
53
174
53
    const ListTy* TailImpl = Tail.getInternalPointer();
175
53
    ListTy::Profile(ID, Head, TailImpl);
176
53
    ListTy* L = Cache.FindNodeOrInsertPos(ID, InsertPos);
177
53
178
53
    if (!L) {
179
46
      // The list does not exist in our cache.  Create it.
180
46
      BumpPtrAllocator& A = getAllocator();
181
46
      L = (ListTy*) A.Allocate<ListTy>();
182
46
      new (L) ListTy(Head, TailImpl);
183
46
184
46
      // Insert the new list into the cache.
185
46
      Cache.InsertNode(L, InsertPos);
186
46
    }
187
53
188
53
    return L;
189
53
  }
llvm::ImmutableListFactory<clang::ento::FieldRegion const*>::concat(clang::ento::FieldRegion const* const&, llvm::ImmutableList<clang::ento::FieldRegion const*>)
Line
Count
Source
169
194
  LLVM_NODISCARD ImmutableList<T> concat(const T &Head, ImmutableList<T> Tail) {
170
194
    // Profile the new list to see if it already exists in our cache.
171
194
    FoldingSetNodeID ID;
172
194
    void* InsertPos;
173
194
174
194
    const ListTy* TailImpl = Tail.getInternalPointer();
175
194
    ListTy::Profile(ID, Head, TailImpl);
176
194
    ListTy* L = Cache.FindNodeOrInsertPos(ID, InsertPos);
177
194
178
194
    if (!L) {
179
181
      // The list does not exist in our cache.  Create it.
180
181
      BumpPtrAllocator& A = getAllocator();
181
181
      L = (ListTy*) A.Allocate<ListTy>();
182
181
      new (L) ListTy(Head, TailImpl);
183
181
184
181
      // Insert the new list into the cache.
185
181
      Cache.InsertNode(L, InsertPos);
186
181
    }
187
194
188
194
    return L;
189
194
  }
llvm::ImmutableListFactory<clang::CXXBaseSpecifier const*>::concat(clang::CXXBaseSpecifier const* const&, llvm::ImmutableList<clang::CXXBaseSpecifier const*>)
Line
Count
Source
169
28
  LLVM_NODISCARD ImmutableList<T> concat(const T &Head, ImmutableList<T> Tail) {
170
28
    // Profile the new list to see if it already exists in our cache.
171
28
    FoldingSetNodeID ID;
172
28
    void* InsertPos;
173
28
174
28
    const ListTy* TailImpl = Tail.getInternalPointer();
175
28
    ListTy::Profile(ID, Head, TailImpl);
176
28
    ListTy* L = Cache.FindNodeOrInsertPos(ID, InsertPos);
177
28
178
28
    if (!L) {
179
22
      // The list does not exist in our cache.  Create it.
180
22
      BumpPtrAllocator& A = getAllocator();
181
22
      L = (ListTy*) A.Allocate<ListTy>();
182
22
      new (L) ListTy(Head, TailImpl);
183
22
184
22
      // Insert the new list into the cache.
185
22
      Cache.InsertNode(L, InsertPos);
186
22
    }
187
28
188
28
    return L;
189
28
  }
llvm::ImmutableListFactory<clang::ento::SVal>::concat(clang::ento::SVal const&, llvm::ImmutableList<clang::ento::SVal>)
Line
Count
Source
169
1.90k
  LLVM_NODISCARD ImmutableList<T> concat(const T &Head, ImmutableList<T> Tail) {
170
1.90k
    // Profile the new list to see if it already exists in our cache.
171
1.90k
    FoldingSetNodeID ID;
172
1.90k
    void* InsertPos;
173
1.90k
174
1.90k
    const ListTy* TailImpl = Tail.getInternalPointer();
175
1.90k
    ListTy::Profile(ID, Head, TailImpl);
176
1.90k
    ListTy* L = Cache.FindNodeOrInsertPos(ID, InsertPos);
177
1.90k
178
1.90k
    if (!L) {
179
1.69k
      // The list does not exist in our cache.  Create it.
180
1.69k
      BumpPtrAllocator& A = getAllocator();
181
1.69k
      L = (ListTy*) A.Allocate<ListTy>();
182
1.69k
      new (L) ListTy(Head, TailImpl);
183
1.69k
184
1.69k
      // Insert the new list into the cache.
185
1.69k
      Cache.InsertNode(L, InsertPos);
186
1.69k
    }
187
1.90k
188
1.90k
    return L;
189
1.90k
  }
llvm::ImmutableListFactory<LoopState>::concat(LoopState const&, llvm::ImmutableList<LoopState>)
Line
Count
Source
169
188
  LLVM_NODISCARD ImmutableList<T> concat(const T &Head, ImmutableList<T> Tail) {
170
188
    // Profile the new list to see if it already exists in our cache.
171
188
    FoldingSetNodeID ID;
172
188
    void* InsertPos;
173
188
174
188
    const ListTy* TailImpl = Tail.getInternalPointer();
175
188
    ListTy::Profile(ID, Head, TailImpl);
176
188
    ListTy* L = Cache.FindNodeOrInsertPos(ID, InsertPos);
177
188
178
188
    if (!L) {
179
130
      // The list does not exist in our cache.  Create it.
180
130
      BumpPtrAllocator& A = getAllocator();
181
130
      L = (ListTy*) A.Allocate<ListTy>();
182
130
      new (L) ListTy(Head, TailImpl);
183
130
184
130
      // Insert the new list into the cache.
185
130
      Cache.InsertNode(L, InsertPos);
186
130
    }
187
188
188
188
    return L;
189
188
  }
190
191
2.36k
  LLVM_NODISCARD ImmutableList<T> add(const T& D, ImmutableList<T> L) {
192
2.36k
    return concat(D, L);
193
2.36k
  }
llvm::ImmutableListFactory<clang::ento::MemRegion const*>::add(clang::ento::MemRegion const* const&, llvm::ImmutableList<clang::ento::MemRegion const*>)
Line
Count
Source
191
53
  LLVM_NODISCARD ImmutableList<T> add(const T& D, ImmutableList<T> L) {
192
53
    return concat(D, L);
193
53
  }
llvm::ImmutableListFactory<clang::ento::FieldRegion const*>::add(clang::ento::FieldRegion const* const&, llvm::ImmutableList<clang::ento::FieldRegion const*>)
Line
Count
Source
191
194
  LLVM_NODISCARD ImmutableList<T> add(const T& D, ImmutableList<T> L) {
192
194
    return concat(D, L);
193
194
  }
llvm::ImmutableListFactory<clang::CXXBaseSpecifier const*>::add(clang::CXXBaseSpecifier const* const&, llvm::ImmutableList<clang::CXXBaseSpecifier const*>)
Line
Count
Source
191
28
  LLVM_NODISCARD ImmutableList<T> add(const T& D, ImmutableList<T> L) {
192
28
    return concat(D, L);
193
28
  }
llvm::ImmutableListFactory<clang::ento::SVal>::add(clang::ento::SVal const&, llvm::ImmutableList<clang::ento::SVal>)
Line
Count
Source
191
1.90k
  LLVM_NODISCARD ImmutableList<T> add(const T& D, ImmutableList<T> L) {
192
1.90k
    return concat(D, L);
193
1.90k
  }
llvm::ImmutableListFactory<LoopState>::add(LoopState const&, llvm::ImmutableList<LoopState>)
Line
Count
Source
191
188
  LLVM_NODISCARD ImmutableList<T> add(const T& D, ImmutableList<T> L) {
192
188
    return concat(D, L);
193
188
  }
194
195
880
  ImmutableList<T> getEmptyList() const {
196
880
    return ImmutableList<T>(nullptr);
197
880
  }
llvm::ImmutableListFactory<clang::CXXBaseSpecifier const*>::getEmptyList() const
Line
Count
Source
195
12
  ImmutableList<T> getEmptyList() const {
196
12
    return ImmutableList<T>(nullptr);
197
12
  }
llvm::ImmutableListFactory<clang::ento::SVal>::getEmptyList() const
Line
Count
Source
195
868
  ImmutableList<T> getEmptyList() const {
196
868
    return ImmutableList<T>(nullptr);
197
868
  }
198
199
  ImmutableList<T> create(const T& X) {
200
    return Concat(X, getEmptyList());
201
  }
202
};
203
204
//===----------------------------------------------------------------------===//
205
// Partially-specialized Traits.
206
//===----------------------------------------------------------------------===//
207
208
template<typename T> struct DenseMapInfo;
209
template<typename T> struct DenseMapInfo<ImmutableList<T>> {
210
  static inline ImmutableList<T> getEmptyKey() {
211
    return reinterpret_cast<ImmutableListImpl<T>*>(-1);
212
  }
213
214
  static inline ImmutableList<T> getTombstoneKey() {
215
    return reinterpret_cast<ImmutableListImpl<T>*>(-2);
216
  }
217
218
  static unsigned getHashValue(ImmutableList<T> X) {
219
    uintptr_t PtrVal = reinterpret_cast<uintptr_t>(X.getInternalPointer());
220
    return (unsigned((uintptr_t)PtrVal) >> 4) ^
221
           (unsigned((uintptr_t)PtrVal) >> 9);
222
  }
223
224
  static bool isEqual(ImmutableList<T> X1, ImmutableList<T> X2) {
225
    return X1 == X2;
226
  }
227
};
228
229
template <typename T> struct isPodLike;
230
template <typename T>
231
struct isPodLike<ImmutableList<T>> { static const bool value = true; };
232
233
} // end namespace llvm
234
235
#endif // LLVM_ADT_IMMUTABLELIST_H