• 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

39.29
/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)
18✔
10
    : ControlFlowNode(element_id, debug_info), data_(data), type_(nullptr) {}
18✔
11

UNCOV
12
Return::Return(size_t element_id, const DebugInfo& debug_info, const std::string& data, const types::IType& type)
×
NEW
13
    : ControlFlowNode(element_id, debug_info), data_(data), type_(type.clone()) {}
×
14

15

16
const std::string& Return::data() const { return data_; }
10✔
17

18
const types::IType& Return::type() const { return *type_; }
×
19

20
bool Return::is_data() const { return type_ == nullptr; }
18✔
21

22
bool Return::is_constant() const { return type_ != nullptr; }
2✔
23

24
void Return::validate(const Function& function) const {
14✔
25
    if (is_data()) {
14✔
26
        if (data_ != "" && !function.exists(data_)) {
14✔
27
            throw InvalidSDFGException("Return node with data '" + data_ + "' does not correspond to any container");
×
28
        }
29
        if (type_ != nullptr) {
14✔
30
            throw InvalidSDFGException("Return node with data cannot have a type");
×
31
        }
32
    } else if (is_constant()) {
14✔
33
        if (function.exists(data_)) {
×
34
            throw InvalidSDFGException(
×
35
                "Return node with constant data '" + data_ + "' cannot correspond to any container"
×
36
            );
37
        }
38
        if (type_ == nullptr) {
×
39
            throw InvalidSDFGException("Return node with constant data must have a type");
×
40
        }
41
    } else {
×
NEW
42
        throw InvalidSDFGException("Return node must be either data or constant");
×
43
    }
44
};
14✔
45

46
void Return::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
×
47
    if (is_data() && data_ == old_expression->__str__()) {
×
48
        data_ = new_expression->__str__();
×
49
    }
×
50
};
×
51

52
} // namespace structured_control_flow
53
} // 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