Goose  Diff

Differences From Artifact [07d3c47652]:

  • File bs/eir/compare.cpp — part of check-in [4c0f447d59] at 2022-07-30 11:41:07 on branch trunk — varargs: simplify (not going to attempt handling nesting repetitions after all) (user: zlodo size: 1568)

To Artifact [81c2d4c9ba]:

  • File bs/eir/compare.cpp — part of check-in [0db147f117] at 2024-09-15 20:24:31 on branch cir-ssa-refactor — Add clang format settings, reformat everything (user: achavasse size: 1665)

1
2
3
4
5
6
7
8
9

10
11
12



13
14
15
16
17
18
19
20
21
22
23
24
25
26















27
28
29
30
31
32
33
34
35
36

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

54
55
56
57

1
2
3
4
5
6
7
8
9
10



11
12
13
14













15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

39

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

55


56

57









+
-
-
-
+
+
+

-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+









-
+
-















-
+
-
-

-
+
#include "eir.h"

namespace goose::eir
{
    bool operator==( const Term& lhs, const Term& rhs )
    {
        if( lhs.index() != rhs.index() )
            return false;

        return visit(
        return visit( [&]< typename T >( const T& l )
        {
            const auto& r = get< T >( rhs );
            [&]< typename T >( const T& l )
            {
                const auto& r = get< T >( rhs );

            if constexpr( is_same_v< pvec, T > )
                return *l == *r;
            else if constexpr( is_same_v< LocationId, T > )
                return true;
            else if constexpr( is_same_v< ptr< void >, T > )
                return true;
            else if constexpr( is_same_v< void*, T > )
                return true;
            else if constexpr( is_same_v< APSInt, T >)
                return l.isSigned() == r.isSigned() && l.getBitWidth() == r.getBitWidth() && l == r;
            else
                return l == r;
        }, lhs );
                if constexpr( is_same_v< pvec, T > )
                    return *l == *r;
                else if constexpr( is_same_v< LocationId, T > )
                    return true;
                else if constexpr( is_same_v< ptr< void >, T > )
                    return true;
                else if constexpr( is_same_v< void*, T > )
                    return true;
                else if constexpr( is_same_v< APSInt, T > )
                    return l.isSigned() == r.isSigned() && l.getBitWidth() == r.getBitWidth()
                        && l == r;
                else
                    return l == r;
            },
            lhs );
    }

    bool operator!=( const Term& lhs, const Term& rhs )
    {
        return !( lhs == rhs );
    }

    bool Vector::operator==( const Vector& rhs ) const
    {
        return m_repetitionTerm == rhs.m_repetitionTerm
        return m_repetitionTerm == rhs.m_repetitionTerm && m_terms == rhs.m_terms;
            && m_terms == rhs.m_terms;
    }

    bool Hole::operator<( const Hole& rhs ) const
    {
        if( name() != rhs.name() )
            return name() < rhs.name();

        if( behavior() != rhs.behavior() )
            return behavior() < rhs.behavior();

        return kind() < rhs.kind();
    }

    bool Hole::operator==( const Hole& rhs ) const
    {
        return name() == rhs.name()
        return name() == rhs.name() && behavior() == rhs.behavior() && kind() == rhs.kind();
            && behavior() == rhs.behavior()
            && kind() == rhs.kind();
    }
}
} // namespace goose::eir