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

daisytuner / sdfglib / 19192861975

08 Nov 2025 12:14PM UTC coverage: 61.281% (-0.1%) from 61.415%
19192861975

push

github

web-flow
Merge pull request #329 from daisytuner/trap-nodes

Trap nodes and unreachable return

17 of 101 new or added lines in 7 files covered. (16.83%)

6 existing lines in 2 files now uncovered.

10264 of 16749 relevant lines covered (61.28%)

100.39 hits per line

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

25.0
/src/control_flow/state.cpp
1
#include "sdfg/control_flow/state.h"
2

3
#include "sdfg/sdfg.h"
4

5
namespace sdfg {
6
namespace control_flow {
7

8
State::State(size_t element_id, const DebugInfo& debug_info, const graph::Vertex vertex)
148✔
9
    : Element(element_id, debug_info), vertex_(vertex) {
74✔
10
    this->dataflow_ = std::make_unique<data_flow::DataFlowGraph>();
74✔
11
};
74✔
12

13
void State::validate(const Function& function) const { this->dataflow_->validate(function); };
×
14

15
graph::Vertex State::vertex() const { return this->vertex_; };
127✔
16

17
const data_flow::DataFlowGraph& State::dataflow() const { return *this->dataflow_; };
17✔
18

19
data_flow::DataFlowGraph& State::dataflow() { return *this->dataflow_; };
74✔
20

21
void State::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
×
22
    this->dataflow_->replace(old_expression, new_expression);
×
23
};
×
24

25
ReturnState::ReturnState(size_t element_id, const DebugInfo& debug_info, const graph::Vertex vertex, const std::string& data)
4✔
26
    : State(element_id, debug_info, vertex), data_(data), type_(nullptr) {};
4✔
27

28
ReturnState::ReturnState(
×
29
    size_t element_id,
30
    const DebugInfo& debug_info,
31
    const graph::Vertex vertex,
32
    const std::string& data,
33
    const types::IType& type
34
)
NEW
35
    : State(element_id, debug_info, vertex), data_(data), type_(type.clone()) {};
×
36

37
const std::string& ReturnState::data() const { return this->data_; };
4✔
38

39
const types::IType& ReturnState::type() const { return *(this->type_); };
×
40

41
bool ReturnState::is_data() const { return type_ == nullptr; };
4✔
42

NEW
43
bool ReturnState::is_constant() const { return type_ != nullptr; };
×
44

45
void ReturnState::validate(const Function& function) const {
×
46
    State::validate(function);
×
47

48
    auto& sdfg = static_cast<const SDFG&>(function);
×
49
    if (sdfg.out_degree(*this) > 0) {
×
50
        throw InvalidSDFGException("ReturnState must not have outgoing transitions");
×
51
    }
52

53
    if (is_data()) {
×
54
        if (data_ != "" && !function.exists(data_)) {
×
55
            throw InvalidSDFGException("Return node with data '" + data_ + "' does not correspond to any container");
×
56
        }
57
        if (type_ != nullptr) {
×
58
            throw InvalidSDFGException("Return node with data cannot have a type");
×
59
        }
60
    } else if (is_constant()) {
×
61
        if (function.exists(data_)) {
×
62
            throw InvalidSDFGException(
×
63
                "Return node with constant data '" + data_ + "' cannot correspond to any container"
×
64
            );
65
        }
66
        if (type_ == nullptr) {
×
67
            throw InvalidSDFGException("Return node with constant data must have a type");
×
68
        }
69
    } else {
×
NEW
70
        throw InvalidSDFGException("Return node must be either data or constant");
×
71
    }
72
}
×
73

74
void ReturnState::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
×
75
    State::replace(old_expression, new_expression);
×
76

77
    if (this->data_ == old_expression->__str__()) {
×
78
        this->data_ = new_expression->__str__();
×
79
    }
×
80
};
×
81

82
} // namespace control_flow
83
} // 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

© 2025 Coveralls, Inc