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

daisytuner / sdfglib / 15044057891

15 May 2025 11:42AM UTC coverage: 59.37% (+1.8%) from 57.525%
15044057891

push

github

web-flow
Merge pull request #14 from daisytuner/sanitizers

enables sanitizer on unit tests

63 of 67 new or added lines in 47 files covered. (94.03%)

570 existing lines in 62 files now uncovered.

7356 of 12390 relevant lines covered (59.37%)

505.93 hits per line

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

50.53
/src/structured_sdfg.cpp
1
#include "sdfg/structured_sdfg.h"
2

3
#include "sdfg/builder/structured_sdfg_builder.h"
4
#include "sdfg/deepcopy/structured_sdfg_deep_copy.h"
5
#include "sdfg/element.h"
6
#include "sdfg/structured_control_flow/control_flow_node.h"
7
#include "sdfg/structured_control_flow/for.h"
8

9
namespace sdfg {
10

11
StructuredSDFG::StructuredSDFG(const std::string& name) : Function(name) {
281✔
12
    size_t element_id = 0;
281✔
13
    this->root_ = std::unique_ptr<structured_control_flow::Sequence>(
281✔
14
        new structured_control_flow::Sequence(element_id, DebugInfo()));
281✔
15
};
281✔
16

17
const structured_control_flow::Sequence& StructuredSDFG::root() const { return *this->root_; };
20✔
18

19
structured_control_flow::Sequence& StructuredSDFG::root() { return *this->root_; };
5,222✔
20

21
std::unique_ptr<StructuredSDFG> StructuredSDFG::clone() const {
2✔
22
    builder::StructuredSDFGBuilder builder(this->name_);
2✔
23
    auto& new_sdfg = builder.subject();
2✔
24

25
    for (auto& structure : this->structures_) {
3✔
26
        new_sdfg.structures_.insert({structure.first, structure.second->clone()});
1✔
27
    }
28

29
    for (auto& container : this->containers_) {
8✔
30
        new_sdfg.containers_.insert({container.first, container.second->clone()});
6✔
31
    }
32

33
    for (auto& arg : this->arguments_) {
4✔
34
        new_sdfg.arguments_.push_back(arg);
2✔
35
    }
36

37
    for (auto& ext : this->externals_) {
3✔
38
        new_sdfg.externals_.push_back(ext);
1✔
39
    }
40

41
    for (auto& assumption : this->assumptions_) {
7✔
42
        new_sdfg.assumptions_.insert({assumption.first, assumption.second});
5✔
43
    }
44

45
    deepcopy::StructuredSDFGDeepCopy copier(builder, new_sdfg.root(), *this->root_);
2✔
46
    auto mapping = copier.insert();
2✔
47

48
    return builder.move();
2✔
49
};
2✔
50

51
long long StructuredSDFG::num_nodes() const {
×
52
    long long count = 0;
×
53
    std::set<const ControlFlowNode*> to_visit = {&this->root()};
×
54
    while (!to_visit.empty()) {
×
55
        auto current = *to_visit.begin();
×
56
        to_visit.erase(to_visit.begin());
×
57
        // if instance of block, add children to to_visit
58
        if (auto block = dynamic_cast<const structured_control_flow::Block*>(current)) {
×
59
            count += block->dataflow().nodes().size();
×
60
        } else if (auto for_node = dynamic_cast<const structured_control_flow::For*>(current)) {
×
61
            to_visit.insert(&for_node->root());
×
62
        } else if (auto condition_node =
×
63
                       dynamic_cast<const structured_control_flow::IfElse*>(current)) {
×
64
            for (int i = 0; i < condition_node->size(); i++) {
×
65
                to_visit.insert(&condition_node->at(i).first);
×
UNCOV
66
            }
×
67
        } else if (auto while_node = dynamic_cast<const structured_control_flow::While*>(current)) {
×
68
            to_visit.insert(&while_node->root());
×
69
        } else if (auto sequence_node =
×
70
                       dynamic_cast<const structured_control_flow::Sequence*>(current)) {
×
71
            for (size_t i = 0; i < sequence_node->size(); i++) {
×
72
                to_visit.insert(&sequence_node->at(i).first);
×
UNCOV
73
            }
×
74
        } else if (auto kernel_node =
×
75
                       dynamic_cast<const structured_control_flow::Kernel*>(current)) {
×
76
            to_visit.insert(&kernel_node->root());
×
UNCOV
77
        } else if (auto return_node =
×
78
                       dynamic_cast<const structured_control_flow::Return*>(current)) {
×
UNCOV
79
        }
×
80
    }
81
    return count;
×
82
};
×
83

84
const DebugInfo StructuredSDFG::debug_info() const {
5✔
85
    DebugInfo info;
5✔
86
    std::set<const ControlFlowNode*> to_visit = {&this->root()};
5✔
87
    while (!to_visit.empty()) {
15✔
88
        auto current = *to_visit.begin();
10✔
89
        to_visit.erase(to_visit.begin());
10✔
90
        info = DebugInfo::merge(info, current->debug_info());
10✔
91

92
        // if instance of block, add children to to_visit
93
        if (auto block = dynamic_cast<const structured_control_flow::Block*>(current)) {
10✔
94
            for (auto& node : block->dataflow().nodes()) {
5✔
95
                info = DebugInfo::merge(info, node.debug_info());
×
96
            }
97
            for (auto& edge : block->dataflow().edges()) {
5✔
98
                info = DebugInfo::merge(info, edge.debug_info());
×
99
            }
100
        } else if (auto for_node = dynamic_cast<const structured_control_flow::For*>(current)) {
10✔
101
            info = DebugInfo::merge(info, for_node->debug_info());
×
102
            to_visit.insert(&for_node->root());
×
103
        } else if (auto condition_node =
5✔
104
                       dynamic_cast<const structured_control_flow::IfElse*>(current)) {
5✔
105
            info = DebugInfo::merge(info, condition_node->debug_info());
×
106
            for (int i = 0; i < condition_node->size(); i++) {
×
107
                to_visit.insert(&condition_node->at(i).first);
×
UNCOV
108
            }
×
109
        } else if (auto while_node = dynamic_cast<const structured_control_flow::While*>(current)) {
5✔
110
            info = DebugInfo::merge(info, while_node->debug_info());
×
111
            to_visit.insert(&while_node->root());
×
112
        } else if (auto sequence_node =
5✔
113
                       dynamic_cast<const structured_control_flow::Sequence*>(current)) {
5✔
114
            info = DebugInfo::merge(info, sequence_node->debug_info());
5✔
115
            for (size_t i = 0; i < sequence_node->size(); i++) {
10✔
116
                to_visit.insert(&sequence_node->at(i).first);
5✔
117
                info = DebugInfo::merge(info, sequence_node->at(i).second.debug_info());
5✔
118
            }
5✔
119
        } else if (auto kernel_node =
5✔
120
                       dynamic_cast<const structured_control_flow::Kernel*>(current)) {
×
121
            info = DebugInfo::merge(info, kernel_node->debug_info());
×
122
            to_visit.insert(&kernel_node->root());
×
123
        } else if (auto return_node =
×
124
                       dynamic_cast<const structured_control_flow::Return*>(current)) {
×
125
            info = DebugInfo::merge(info, return_node->debug_info());
×
UNCOV
126
        }
×
127
    }
128
    return info;
5✔
129
};
5✔
130

131
}  // 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