• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daisytuner / sdfglib / 17368505925

01 Sep 2025 05:29AM UTC coverage: 58.982% (-0.8%) from 59.781%
17368505925

push

github

web-flow
Merge pull request #216 from daisytuner/transitions-bug

Updates API for Sequence transitions to prevent leakage of assignments

239 of 547 new or added lines in 25 files covered. (43.69%)

75 existing lines in 12 files now uncovered.

9190 of 15581 relevant lines covered (58.98%)

115.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.97
/src/structured_control_flow/sequence.cpp
1
#include "sdfg/structured_control_flow/sequence.h"
2

3
namespace sdfg {
4
namespace structured_control_flow {
5

UNCOV
6
Transition::Transition(size_t element_id, const DebugInfo& debug_info, Sequence& parent)
×
UNCOV
7
    : Element(element_id, debug_info), parent_(&parent) {
×
8

UNCOV
9
      };
×
10

11
Transition::Transition(
885✔
12
    size_t element_id, const DebugInfo& debug_info, Sequence& parent, const control_flow::Assignments& assignments
13
)
14
    : Element(element_id, debug_info), parent_(&parent), assignments_(assignments) {
885✔
15

16
      };
885✔
17

18
void Transition::validate(const Function& function) const {
846✔
19
    // TODO: Implement validation
20
};
846✔
21

22
const control_flow::Assignments& Transition::assignments() const { return this->assignments_; };
23✔
23

24
control_flow::Assignments& Transition::assignments() { return this->assignments_; };
1,374✔
25

26
Sequence& Transition::parent() { return *this->parent_; };
×
27

28
const Sequence& Transition::parent() const { return *this->parent_; };
×
29

30
bool Transition::empty() const { return this->assignments_.empty(); };
21✔
31

32
size_t Transition::size() const { return this->assignments_.size(); };
45✔
33

34
void Transition::replace(const symbolic::Expression& old_expression, const symbolic::Expression& new_expression) {
2✔
35
    if (SymEngine::is_a<SymEngine::Symbol>(*old_expression) && SymEngine::is_a<SymEngine::Symbol>(*new_expression)) {
2✔
36
        auto old_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(old_expression);
2✔
37
        auto new_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(new_expression);
2✔
38

39
        if (this->assignments().find(old_symbol) != this->assignments().end()) {
2✔
40
            this->assignments()[new_symbol] = this->assignments()[old_symbol];
×
41
            this->assignments().erase(old_symbol);
×
42
        }
×
43
    }
2✔
44

45
    for (auto& entry : this->assignments()) {
2✔
46
        entry.second = symbolic::subs(entry.second, old_expression, new_expression);
×
47
    }
48
};
2✔
49

50
Sequence::Sequence(size_t element_id, const DebugInfo& debug_info)
1,720✔
51
    : ControlFlowNode(element_id, debug_info) {
860✔
52

53
      };
860✔
54

55
void Sequence::validate(const Function& function) const {
728✔
56
    // children and transition have same length
57
    if (this->children_.size() != this->transitions_.size()) {
728✔
NEW
58
        throw InvalidSDFGException("Sequence must have the same number of children and transitions");
×
59
    }
60

61
    for (auto& child : this->children_) {
1,574✔
62
        child->validate(function);
846✔
63
    }
64
    for (auto& trans : this->transitions_) {
1,574✔
65
        trans->validate(function);
846✔
66
    }
67
};
728✔
68

69
size_t Sequence::size() const { return this->children_.size(); };
9,576✔
70

71
std::pair<const ControlFlowNode&, const Transition&> Sequence::at(size_t i) const {
255✔
72
    return {*this->children_.at(i), *this->transitions_.at(i)};
255✔
73
};
74

75
std::pair<ControlFlowNode&, Transition&> Sequence::at(size_t i) {
5,487✔
76
    return {*this->children_.at(i), *this->transitions_.at(i)};
5,487✔
77
};
78

79
int Sequence::index(const ControlFlowNode& child) const {
85✔
80
    for (size_t i = 0; i < this->children_.size(); i++) {
91✔
81
        if (this->children_.at(i).get() == &child) {
91✔
82
            return static_cast<int>(i);
85✔
83
        }
84
    }
6✔
85

NEW
86
    return -1;
×
87
};
85✔
88

NEW
89
int Sequence::index(const Transition& transition) const {
×
NEW
90
    for (size_t i = 0; i < this->transitions_.size(); i++) {
×
NEW
91
        if (this->transitions_.at(i).get() == &transition) {
×
NEW
92
            return static_cast<int>(i);
×
93
        }
NEW
94
    }
×
95

NEW
96
    return -1;
×
NEW
97
};
×
98

99
void Sequence::replace(const symbolic::Expression& old_expression, const symbolic::Expression& new_expression) {
2✔
100
    for (auto& child : this->children_) {
4✔
101
        child->replace(old_expression, new_expression);
2✔
102
    }
103

104
    for (auto& trans : this->transitions_) {
4✔
105
        trans->replace(old_expression, new_expression);
2✔
106
    }
107
};
2✔
108

109
} // namespace structured_control_flow
110
} // namespace sdfg
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc