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

daisytuner / sdfglib / 20764569418

06 Jan 2026 10:50PM UTC coverage: 62.168% (+21.4%) from 40.764%
20764569418

push

github

web-flow
Merge pull request #433 from daisytuner/clang-coverage

updates clang coverage flags

14988 of 24109 relevant lines covered (62.17%)

88.57 hits per line

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

47.06
/src/deepcopy/structured_sdfg_deep_copy.cpp
1
#include "sdfg/deepcopy/structured_sdfg_deep_copy.h"
2

3
#include "sdfg/element.h"
4

5
namespace sdfg {
6
namespace deepcopy {
7

8
void StructuredSDFGDeepCopy::append(structured_control_flow::Sequence& root, structured_control_flow::Sequence& source) {
18✔
9
    for (size_t i = 0; i < source.size(); i++) {
31✔
10
        auto child = source.at(i);
13✔
11
        auto& node = child.first;
13✔
12
        auto& trans = child.second;
13✔
13

14
        if (auto block_stmt = dynamic_cast<structured_control_flow::Block*>(&node)) {
13✔
15
            auto& block =
3✔
16
                this->builder_.add_block(root, block_stmt->dataflow(), trans.assignments(), block_stmt->debug_info());
3✔
17
            this->node_mapping[block_stmt] = &block;
3✔
18
        } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(&node)) {
10✔
19
            auto& new_seq = this->builder_.add_sequence(root, trans.assignments(), sequence_stmt->debug_info());
2✔
20
            this->node_mapping[sequence_stmt] = &new_seq;
2✔
21
            this->append(new_seq, *sequence_stmt);
2✔
22
        } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(&node)) {
8✔
23
            auto& new_scope = this->builder_.add_if_else(root, trans.assignments(), if_else_stmt->debug_info());
×
24
            this->node_mapping[if_else_stmt] = &new_scope;
×
25
            for (size_t i = 0; i < if_else_stmt->size(); i++) {
×
26
                auto branch = if_else_stmt->at(i);
×
27
                auto& new_branch = this->builder_.add_case(new_scope, branch.second, branch.first.debug_info());
×
28
                this->node_mapping[&branch.first] = &new_branch;
×
29
                this->append(new_branch, branch.first);
×
30
            }
×
31
        } else if (auto loop_stmt = dynamic_cast<structured_control_flow::While*>(&node)) {
8✔
32
            auto& new_scope = this->builder_.add_while(root, trans.assignments(), loop_stmt->debug_info());
3✔
33
            this->node_mapping[loop_stmt] = &new_scope;
3✔
34
            this->append(new_scope.root(), loop_stmt->root());
3✔
35
        } else if (auto cont_stmt = dynamic_cast<structured_control_flow::Continue*>(&node)) {
5✔
36
            auto& new_cont = this->builder_.add_continue(root, trans.assignments(), cont_stmt->debug_info());
1✔
37
            this->node_mapping[cont_stmt] = &new_cont;
1✔
38
        } else if (auto br_stmt = dynamic_cast<structured_control_flow::Break*>(&node)) {
4✔
39
            auto& new_br = this->builder_.add_break(root, trans.assignments(), br_stmt->debug_info());
1✔
40
            this->node_mapping[br_stmt] = &new_br;
1✔
41
        } else if (auto ret_stmt = dynamic_cast<structured_control_flow::Return*>(&node)) {
3✔
42
            if (ret_stmt->is_data()) {
1✔
43
                auto& new_ret =
1✔
44
                    this->builder_.add_return(root, ret_stmt->data(), trans.assignments(), ret_stmt->debug_info());
1✔
45
                this->node_mapping[ret_stmt] = &new_ret;
1✔
46
            } else if (ret_stmt->is_constant()) {
1✔
47
                auto& new_ret = this->builder_.add_constant_return(
×
48
                    root, ret_stmt->data(), ret_stmt->type(), trans.assignments(), ret_stmt->debug_info()
×
49
                );
×
50
                this->node_mapping[ret_stmt] = &new_ret;
×
51
            }
×
52
        } else if (auto for_stmt = dynamic_cast<structured_control_flow::For*>(&node)) {
2✔
53
            auto& new_scope = this->builder_.add_for(
1✔
54
                root,
1✔
55
                for_stmt->indvar(),
1✔
56
                for_stmt->condition(),
1✔
57
                for_stmt->init(),
1✔
58
                for_stmt->update(),
1✔
59
                trans.assignments(),
1✔
60
                for_stmt->debug_info()
1✔
61
            );
1✔
62
            this->node_mapping[for_stmt] = &new_scope;
1✔
63
            this->append(new_scope.root(), for_stmt->root());
1✔
64
        } else if (auto map_stmt = dynamic_cast<structured_control_flow::Map*>(&node)) {
1✔
65
            auto& new_scope = this->builder_.add_map(
1✔
66
                root,
1✔
67
                map_stmt->indvar(),
1✔
68
                map_stmt->condition(),
1✔
69
                map_stmt->init(),
1✔
70
                map_stmt->update(),
1✔
71
                map_stmt->schedule_type(),
1✔
72
                trans.assignments(),
1✔
73
                map_stmt->debug_info()
1✔
74
            );
1✔
75
            this->node_mapping[map_stmt] = &new_scope;
1✔
76
            this->append(new_scope.root(), map_stmt->root());
1✔
77
        } else {
1✔
78
            throw std::runtime_error("Deep copy not implemented");
×
79
        }
×
80
    }
13✔
81
};
18✔
82

83
void StructuredSDFGDeepCopy::
84
    insert(structured_control_flow::Sequence& root, structured_control_flow::ControlFlowNode& source) {
11✔
85
    if (auto block_stmt = dynamic_cast<structured_control_flow::Block*>(&source)) {
11✔
86
        auto& block = this->builder_.add_block(root, block_stmt->dataflow(), {}, block_stmt->debug_info());
×
87
        this->node_mapping[block_stmt] = &block;
×
88
    } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(&source)) {
11✔
89
        auto& new_seq = this->builder_.add_sequence(root, {}, sequence_stmt->debug_info());
11✔
90
        this->node_mapping[sequence_stmt] = &new_seq;
11✔
91
        this->append(new_seq, *sequence_stmt);
11✔
92
    } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(&source)) {
11✔
93
        auto& new_scope = this->builder_.add_if_else(root);
×
94
        this->node_mapping[if_else_stmt] = &new_scope;
×
95
        for (size_t i = 0; i < if_else_stmt->size(); i++) {
×
96
            auto branch = if_else_stmt->at(i);
×
97
            auto& new_branch = this->builder_.add_case(new_scope, branch.second, branch.first.debug_info());
×
98
            this->node_mapping[&branch.first] = &new_branch;
×
99
            this->append(new_branch, branch.first);
×
100
        }
×
101
    } else if (auto loop_stmt = dynamic_cast<structured_control_flow::While*>(&source)) {
×
102
        auto& new_scope = this->builder_.add_while(root, {}, loop_stmt->debug_info());
×
103
        this->node_mapping[loop_stmt] = &new_scope;
×
104
        this->append(new_scope.root(), loop_stmt->root());
×
105
    } else if (auto for_stmt = dynamic_cast<structured_control_flow::For*>(&source)) {
×
106
        auto& new_scope = this->builder_.add_for(
×
107
            root,
×
108
            for_stmt->indvar(),
×
109
            for_stmt->condition(),
×
110
            for_stmt->init(),
×
111
            for_stmt->update(),
×
112
            {},
×
113
            for_stmt->debug_info()
×
114
        );
×
115
        this->node_mapping[for_stmt] = &new_scope;
×
116
        this->append(new_scope.root(), for_stmt->root());
×
117
    } else if (auto cont_stmt = dynamic_cast<structured_control_flow::Continue*>(&source)) {
×
118
        auto& new_cont = this->builder_.add_continue(root, {}, cont_stmt->debug_info());
×
119
        this->node_mapping[cont_stmt] = &new_cont;
×
120
    } else if (auto br_stmt = dynamic_cast<structured_control_flow::Break*>(&source)) {
×
121
        auto& new_br = this->builder_.add_break(root, {}, br_stmt->debug_info());
×
122
        this->node_mapping[br_stmt] = &new_br;
×
123
    } else if (auto ret_stmt = dynamic_cast<structured_control_flow::Return*>(&source)) {
×
124
        if (ret_stmt->is_data()) {
×
125
            auto& new_ret = this->builder_.add_return(root, ret_stmt->data(), {}, ret_stmt->debug_info());
×
126
            this->node_mapping[ret_stmt] = &new_ret;
×
127
        } else if (ret_stmt->is_constant()) {
×
128
            auto& new_ret =
×
129
                this->builder_.add_constant_return(root, ret_stmt->data(), ret_stmt->type(), {}, ret_stmt->debug_info());
×
130
            this->node_mapping[ret_stmt] = &new_ret;
×
131
        }
×
132
    } else if (auto map_stmt = dynamic_cast<structured_control_flow::Map*>(&source)) {
×
133
        auto& new_scope = this->builder_.add_map(
×
134
            root,
×
135
            map_stmt->indvar(),
×
136
            map_stmt->condition(),
×
137
            map_stmt->init(),
×
138
            map_stmt->update(),
×
139
            map_stmt->schedule_type(),
×
140
            {},
×
141
            map_stmt->debug_info()
×
142
        );
×
143
        this->node_mapping[map_stmt] = &new_scope;
×
144
        this->append(new_scope.root(), map_stmt->root());
×
145
    } else {
×
146
        throw std::runtime_error("Deep copy not implemented");
×
147
    }
×
148
};
11✔
149

150
StructuredSDFGDeepCopy::StructuredSDFGDeepCopy(
151
    builder::StructuredSDFGBuilder& builder,
152
    structured_control_flow::Sequence& root,
153
    structured_control_flow::ControlFlowNode& source
154
)
155
    : builder_(builder), root_(root), source_(source) {};
11✔
156

157
std::unordered_map<const structured_control_flow::ControlFlowNode*, const structured_control_flow::ControlFlowNode*>
158
StructuredSDFGDeepCopy::copy() {
11✔
159
    this->node_mapping.clear();
11✔
160
    this->insert(this->root_, this->source_);
11✔
161
    return this->node_mapping;
11✔
162
};
11✔
163

164
std::unordered_map<const structured_control_flow::ControlFlowNode*, const structured_control_flow::ControlFlowNode*>
165
StructuredSDFGDeepCopy::insert() {
×
166
    if (auto seq_source = dynamic_cast<structured_control_flow::Sequence*>(&this->source_)) {
×
167
        this->node_mapping.clear();
×
168
        this->append(this->root_, *seq_source);
×
169
        return this->node_mapping;
×
170
    } else {
×
171
        throw std::runtime_error("Source node must be a sequence");
×
172
    }
×
173
};
×
174

175
} // namespace deepcopy
176
} // 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