cpp

Coverage Report

Created: 2022-11-10 11:34

/home/andy/git/oilshell/oil/mycpp/gc_tuple.h
Line
Count
Source (jump to first uncovered line)
1
#ifndef MYCPP_GC_TUPLE_H
2
#define MYCPP_GC_TUPLE_H
3
4
// Note:
5
//
6
// - These use OBJ_HEADER() instead of inheriting from Obj, because Obj can't
7
//   be returned by value.  mycpp generates code that returns TupleN<> VALUES,
8
//   not references (to reduce GC pressure).
9
10
template <class A, class B>
11
class Tuple2 {
12
 public:
13
141
  Tuple2(A a, B b) : a_(a), b_(b) {
14
141
    heap_tag_ = Tag::FixedSize;
15
141
    typedef Tuple2<A, B> this_type;
16
141
    constexpr int m =
17
141
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
18
141
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
19
141
    field_mask_ = m;
20
141
  }
_ZN6Tuple2IP3StrS1_EC2ES1_S1_
Line
Count
Source
13
6
  Tuple2(A a, B b) : a_(a), b_(b) {
14
6
    heap_tag_ = Tag::FixedSize;
15
6
    typedef Tuple2<A, B> this_type;
16
6
    constexpr int m =
17
6
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
18
6
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
19
6
    field_mask_ = m;
20
6
  }
_ZN6Tuple2IiiEC2Eii
Line
Count
Source
13
10
  Tuple2(A a, B b) : a_(a), b_(b) {
14
10
    heap_tag_ = Tag::FixedSize;
15
10
    typedef Tuple2<A, B> this_type;
16
10
    constexpr int m =
17
10
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
18
10
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
19
10
    field_mask_ = m;
20
10
  }
_ZN6Tuple2IiP3StrEC2EiS1_
Line
Count
Source
13
17
  Tuple2(A a, B b) : a_(a), b_(b) {
14
17
    heap_tag_ = Tag::FixedSize;
15
17
    typedef Tuple2<A, B> this_type;
16
17
    constexpr int m =
17
17
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
18
17
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
19
17
    field_mask_ = m;
20
17
  }
_ZN6Tuple2IiPS_IiP3StrEEC2EiS3_
Line
Count
Source
13
1
  Tuple2(A a, B b) : a_(a), b_(b) {
14
1
    heap_tag_ = Tag::FixedSize;
15
1
    typedef Tuple2<A, B> this_type;
16
1
    constexpr int m =
17
1
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
18
1
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
19
1
    field_mask_ = m;
20
1
  }
_ZN6Tuple2IP3StriEC2ES1_i
Line
Count
Source
13
49
  Tuple2(A a, B b) : a_(a), b_(b) {
14
49
    heap_tag_ = Tag::FixedSize;
15
49
    typedef Tuple2<A, B> this_type;
16
49
    constexpr int m =
17
49
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
18
49
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
19
49
    field_mask_ = m;
20
49
  }
_ZN6Tuple2IN9expr_asdl5tok_eEP3StrEC2ES1_S3_
Line
Count
Source
13
58
  Tuple2(A a, B b) : a_(a), b_(b) {
14
58
    heap_tag_ = Tag::FixedSize;
15
58
    typedef Tuple2<A, B> this_type;
16
58
    constexpr int m =
17
58
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
18
58
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
19
58
    field_mask_ = m;
20
58
  }
Unexecuted instantiation: _ZN6Tuple2IPN4args11_AttributesEPNS0_6ReaderEEC2ES2_S4_
21
22
142
  A at0() {
23
142
    return a_;
24
142
  }
_ZN6Tuple2IP3StriE3at0Ev
Line
Count
Source
22
48
  A at0() {
23
48
    return a_;
24
48
  }
_ZN6Tuple2IP3StrS1_E3at0Ev
Line
Count
Source
22
5
  A at0() {
23
5
    return a_;
24
5
  }
_ZN6Tuple2IiiE3at0Ev
Line
Count
Source
22
10
  A at0() {
23
10
    return a_;
24
10
  }
_ZN6Tuple2IiP3StrE3at0Ev
Line
Count
Source
22
20
  A at0() {
23
20
    return a_;
24
20
  }
_ZN6Tuple2IiPS_IiP3StrEE3at0Ev
Line
Count
Source
22
1
  A at0() {
23
1
    return a_;
24
1
  }
_ZN6Tuple2IN9expr_asdl5tok_eEP3StrE3at0Ev
Line
Count
Source
22
58
  A at0() {
23
58
    return a_;
24
58
  }
25
139
  B at1() {
26
139
    return b_;
27
139
  }
_ZN6Tuple2IP3StriE3at1Ev
Line
Count
Source
25
46
  B at1() {
26
46
    return b_;
27
46
  }
_ZN6Tuple2IP3StrS1_E3at1Ev
Line
Count
Source
25
5
  B at1() {
26
5
    return b_;
27
5
  }
_ZN6Tuple2IiiE3at1Ev
Line
Count
Source
25
10
  B at1() {
26
10
    return b_;
27
10
  }
_ZN6Tuple2IiP3StrE3at1Ev
Line
Count
Source
25
18
  B at1() {
26
18
    return b_;
27
18
  }
_ZN6Tuple2IiPS_IiP3StrEE3at1Ev
Line
Count
Source
25
2
  B at1() {
26
2
    return b_;
27
2
  }
_ZN6Tuple2IN9expr_asdl5tok_eEP3StrE3at1Ev
Line
Count
Source
25
58
  B at1() {
26
58
    return b_;
27
58
  }
28
29
  OBJ_HEADER();
30
31
 private:
32
  A a_;
33
  B b_;
34
};
35
36
template <class A, class B, class C>
37
class Tuple3 {
38
 public:
39
3
  Tuple3(A a, B b, C c) : a_(a), b_(b), c_(c) {
40
3
    heap_tag_ = Tag::FixedSize;
41
3
    typedef Tuple3<A, B, C> this_type;
42
3
    constexpr int m =
43
3
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
44
3
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0) |
45
3
        (std::is_pointer<C>() ? maskbit(offsetof(this_type, c_)) : 0);
46
3
    field_mask_ = m;
47
3
  }
_ZN6Tuple3IiP3StrS1_EC2EiS1_S1_
Line
Count
Source
39
2
  Tuple3(A a, B b, C c) : a_(a), b_(b), c_(c) {
40
2
    heap_tag_ = Tag::FixedSize;
41
2
    typedef Tuple3<A, B, C> this_type;
42
2
    constexpr int m =
43
2
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
44
2
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0) |
45
2
        (std::is_pointer<C>() ? maskbit(offsetof(this_type, c_)) : 0);
46
2
    field_mask_ = m;
47
2
  }
_ZN6Tuple3IP3StrS1_S1_EC2ES1_S1_S1_
Line
Count
Source
39
1
  Tuple3(A a, B b, C c) : a_(a), b_(b), c_(c) {
40
1
    heap_tag_ = Tag::FixedSize;
41
1
    typedef Tuple3<A, B, C> this_type;
42
1
    constexpr int m =
43
1
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
44
1
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0) |
45
1
        (std::is_pointer<C>() ? maskbit(offsetof(this_type, c_)) : 0);
46
1
    field_mask_ = m;
47
1
  }
Unexecuted instantiation: _ZN6Tuple3IdddEC2Eddd
48
1
  A at0() {
49
1
    return a_;
50
1
  }
51
1
  B at1() {
52
1
    return b_;
53
1
  }
54
1
  C at2() {
55
1
    return c_;
56
1
  }
57
58
  OBJ_HEADER();
59
60
 private:
61
  A a_;
62
  B b_;
63
  C c_;
64
};
65
66
template <class A, class B, class C, class D>
67
class Tuple4 {
68
 public:
69
2
  Tuple4(A a, B b, C c, D d) : a_(a), b_(b), c_(c), d_(d) {
70
2
    heap_tag_ = Tag::FixedSize;
71
2
    typedef Tuple4<A, B, C, D> this_type;
72
2
    constexpr int m =
73
2
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
74
2
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0) |
75
2
        (std::is_pointer<C>() ? maskbit(offsetof(this_type, c_)) : 0) |
76
2
        (std::is_pointer<D>() ? maskbit(offsetof(this_type, d_)) : 0);
77
2
    field_mask_ = m;
78
2
  }
_ZN6Tuple4IiP3StrS1_iEC2EiS1_S1_i
Line
Count
Source
69
1
  Tuple4(A a, B b, C c, D d) : a_(a), b_(b), c_(c), d_(d) {
70
1
    heap_tag_ = Tag::FixedSize;
71
1
    typedef Tuple4<A, B, C, D> this_type;
72
1
    constexpr int m =
73
1
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
74
1
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0) |
75
1
        (std::is_pointer<C>() ? maskbit(offsetof(this_type, c_)) : 0) |
76
1
        (std::is_pointer<D>() ? maskbit(offsetof(this_type, d_)) : 0);
77
1
    field_mask_ = m;
78
1
  }
_ZN6Tuple4IiiP3StrS1_EC2EiiS1_S1_
Line
Count
Source
69
1
  Tuple4(A a, B b, C c, D d) : a_(a), b_(b), c_(c), d_(d) {
70
1
    heap_tag_ = Tag::FixedSize;
71
1
    typedef Tuple4<A, B, C, D> this_type;
72
1
    constexpr int m =
73
1
        (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
74
1
        (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0) |
75
1
        (std::is_pointer<C>() ? maskbit(offsetof(this_type, c_)) : 0) |
76
1
        (std::is_pointer<D>() ? maskbit(offsetof(this_type, d_)) : 0);
77
1
    field_mask_ = m;
78
1
  }
79
80
1
  A at0() {
81
1
    return a_;
82
1
  }
83
1
  B at1() {
84
1
    return b_;
85
1
  }
86
1
  C at2() {
87
1
    return c_;
88
1
  }
89
1
  D at3() {
90
1
    return d_;
91
1
  }
92
93
  OBJ_HEADER();
94
95
 private:
96
  A a_;
97
  B b_;
98
  C c_;
99
  D d_;
100
};
101
102
#endif  // MYCPP_GC_TUPLE_H