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

daisytuner / sdfglib / 17907460602

22 Sep 2025 07:08AM UTC coverage: 60.192% (-0.5%) from 60.653%
17907460602

Pull #233

github

web-flow
Merge 07c7b1d2f into c3f4f7063
Pull Request #233: adds constant returns with type and extends API

60 of 184 new or added lines in 10 files covered. (32.61%)

19 existing lines in 5 files now uncovered.

9514 of 15806 relevant lines covered (60.19%)

105.75 hits per line

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

33.33
/src/structured_control_flow/return.cpp
1
#include "sdfg/structured_control_flow/return.h"
2

3
#include "sdfg/function.h"
4
#include "sdfg/types/type.h"
5

6
namespace sdfg {
7
namespace structured_control_flow {
8

9
Return::Return(size_t element_id, const DebugInfo& debug_info, const std::string& data)
16✔
10
    : ControlFlowNode(element_id, debug_info), data_(data), unreachable_(false), type_(nullptr) {}
16✔
11

NEW
12
Return::Return(size_t element_id, const DebugInfo& debug_info)
×
NEW
13
    : ControlFlowNode(element_id, debug_info), data_(""), unreachable_(true), type_(nullptr) {}
×
14

NEW
15
Return::Return(size_t element_id, const DebugInfo& debug_info, const std::string& data, const types::IType& type)
×
NEW
16
    : ControlFlowNode(element_id, debug_info), data_(data), unreachable_(false), type_(type.clone()) {}
×
17

18

19
const std::string& Return::data() const { return data_; }
7✔
20

NEW
21
const types::IType& Return::type() const { return *type_; }
×
22

23
bool Return::unreachable() const { return unreachable_; }
4✔
24

25
bool Return::is_data() const { return type_ == nullptr && !unreachable_; }
16✔
26

NEW
27
bool Return::is_unreachable() const { return unreachable_; }
×
28

29
bool Return::is_constant() const { return type_ != nullptr && !unreachable_; }
2✔
30

31
void Return::validate(const Function& function) const {
12✔
32
    if (is_data()) {
12✔
33
        if (data_ != "" && !function.exists(data_)) {
12✔
NEW
34
            throw InvalidSDFGException("Return node with data '" + data_ + "' does not correspond to any container");
×
35
        }
36
        if (unreachable_) {
12✔
NEW
37
            throw InvalidSDFGException("Return node cannot be both data and unreachable");
×
38
        }
39
        if (type_ != nullptr) {
12✔
NEW
40
            throw InvalidSDFGException("Return node with data cannot have a type");
×
41
        }
42
    } else if (is_constant()) {
12✔
NEW
43
        if (function.exists(data_)) {
×
NEW
44
            throw InvalidSDFGException(
×
NEW
45
                "Return node with constant data '" + data_ + "' cannot correspond to any container"
×
46
            );
47
        }
NEW
48
        if (type_ == nullptr) {
×
NEW
49
            throw InvalidSDFGException("Return node with constant data must have a type");
×
50
        }
NEW
51
    } else if (is_unreachable()) {
×
NEW
52
        if (!data_.empty()) {
×
NEW
53
            throw InvalidSDFGException("Unreachable return node cannot have data");
×
54
        }
NEW
55
        if (type_ != nullptr) {
×
NEW
56
            throw InvalidSDFGException("Unreachable return node cannot have a type");
×
57
        }
NEW
58
    } else {
×
NEW
59
        throw InvalidSDFGException("Return node must be either data, constant, or unreachable");
×
60
    }
61
};
12✔
62

63
void Return::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
×
NEW
64
    if (is_data() && data_ == old_expression->__str__()) {
×
65
        data_ = new_expression->__str__();
×
66
    }
×
67
};
×
68

69
} // namespace structured_control_flow
70
} // 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