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

daisytuner / sdfglib / 20770413849

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

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

58.55
/src/visitor/structured_sdfg_visitor.cpp
1
#include "sdfg/visitor/structured_sdfg_visitor.h"
2

3
namespace sdfg {
4
namespace visitor {
5

6
StructuredSDFGVisitor::
7
    StructuredSDFGVisitor(builder::StructuredSDFGBuilder& builder, analysis::AnalysisManager& analysis_manager)
8
    : builder_(builder), analysis_manager_(analysis_manager) {}
76✔
9

10
bool StructuredSDFGVisitor::visit() { return this->visit_internal(builder_.subject().root()); }
17✔
11

12
bool StructuredSDFGVisitor::visit_internal(structured_control_flow::Sequence& parent) {
23✔
13
    if (this->accept(parent)) {
23✔
14
        return true;
6✔
15
    }
6✔
16

17
    for (size_t i = 0; i < parent.size(); i++) {
25✔
18
        auto& current = parent.at(i).first;
21✔
19

20
        if (auto block_stmt = dynamic_cast<structured_control_flow::Block*>(&current)) {
21✔
21
            if (this->accept(*block_stmt)) {
4✔
22
                return true;
3✔
23
            }
3✔
24
        } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(&current)) {
17✔
25
            if (this->visit_internal(*sequence_stmt)) {
2✔
26
                return true;
1✔
27
            }
1✔
28
        } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(&current)) {
15✔
29
            if (this->accept(*if_else_stmt)) {
2✔
30
                return true;
1✔
31
            }
1✔
32

33
            for (size_t i = 0; i < if_else_stmt->size(); i++) {
1✔
34
                if (this->visit_internal(if_else_stmt->at(i).first)) {
×
35
                    return true;
×
36
                }
×
37
            }
×
38
        } else if (auto for_stmt = dynamic_cast<structured_control_flow::For*>(&current)) {
13✔
39
            if (this->accept(*for_stmt)) {
2✔
40
                return true;
1✔
41
            }
1✔
42

43
            if (this->visit_internal(for_stmt->root())) {
1✔
44
                return true;
×
45
            }
×
46
        } else if (auto map_stmt = dynamic_cast<structured_control_flow::Map*>(&current)) {
11✔
47
            if (this->accept(*map_stmt)) {
1✔
48
                return true;
1✔
49
            }
1✔
50

51
            if (this->visit_internal(map_stmt->root())) {
×
52
                return true;
×
53
            }
×
54
        } else if (auto while_stmt = dynamic_cast<structured_control_flow::While*>(&current)) {
10✔
55
            if (this->accept(*while_stmt)) {
4✔
56
                return true;
1✔
57
            }
1✔
58

59
            if (this->visit_internal(while_stmt->root())) {
3✔
60
                return true;
2✔
61
            }
2✔
62
        } else if (auto continue_stmt = dynamic_cast<structured_control_flow::Continue*>(&current)) {
6✔
63
            if (this->accept(*continue_stmt)) {
2✔
64
                return true;
1✔
65
            }
1✔
66
        } else if (auto break_stmt = dynamic_cast<structured_control_flow::Break*>(&current)) {
4✔
67
            if (this->accept(*break_stmt)) {
2✔
68
                return true;
1✔
69
            }
1✔
70
        } else if (auto return_stmt = dynamic_cast<structured_control_flow::Return*>(&current)) {
2✔
71
            if (this->accept(*return_stmt)) {
2✔
72
                return true;
1✔
73
            }
1✔
74
        }
2✔
75
    }
21✔
76

77
    return false;
4✔
78
};
17✔
79

80
bool StructuredSDFGVisitor::accept(structured_control_flow::Block& node) { return false; };
98✔
81

82
bool StructuredSDFGVisitor::accept(structured_control_flow::Sequence& node) { return false; };
112✔
83

84
bool StructuredSDFGVisitor::accept(structured_control_flow::Return& node) { return false; };
1✔
85

86
bool StructuredSDFGVisitor::accept(structured_control_flow::IfElse& node) { return false; };
2✔
87

88
bool StructuredSDFGVisitor::accept(structured_control_flow::While& node) { return false; };
1✔
89

90
bool StructuredSDFGVisitor::accept(structured_control_flow::Continue& node) { return false; };
1✔
91

92
bool StructuredSDFGVisitor::accept(structured_control_flow::Break& node) { return false; };
1✔
93

94
bool StructuredSDFGVisitor::accept(structured_control_flow::For& node) { return false; };
12✔
95

96
bool StructuredSDFGVisitor::accept(structured_control_flow::Map& node) { return false; };
×
97

98
NonStoppingStructuredSDFGVisitor::NonStoppingStructuredSDFGVisitor(
99
    builder::StructuredSDFGBuilder& builder, analysis::AnalysisManager& analysis_manager
100
)
101
    : StructuredSDFGVisitor(builder, analysis_manager), applied_(false) {}
59✔
102

103
bool NonStoppingStructuredSDFGVisitor::visit() {
59✔
104
    this->visit_internal(builder_.subject().root());
59✔
105
    return this->applied_;
59✔
106
}
59✔
107

108
bool NonStoppingStructuredSDFGVisitor::visit_internal(structured_control_flow::Sequence& parent) {
125✔
109
    applied_ |= this->accept(parent);
125✔
110

111
    for (size_t i = 0; i < parent.size(); i++) {
295✔
112
        auto& current = parent.at(i).first;
170✔
113

114
        if (auto block_stmt = dynamic_cast<structured_control_flow::Block*>(&current)) {
170✔
115
            applied_ |= this->accept(*block_stmt);
119✔
116
        } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(&current)) {
119✔
117
            this->visit_internal(*sequence_stmt);
3✔
118
        } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(&current)) {
48✔
119
            applied_ |= this->accept(*if_else_stmt);
16✔
120

121
            for (size_t i = 0; i < if_else_stmt->size(); i++) {
47✔
122
                this->visit_internal(if_else_stmt->at(i).first);
31✔
123
            }
31✔
124
        } else if (auto for_stmt = dynamic_cast<structured_control_flow::For*>(&current)) {
32✔
125
            applied_ |= this->accept(*for_stmt);
20✔
126
            this->visit_internal(for_stmt->root());
20✔
127
        } else if (auto map_stmt = dynamic_cast<structured_control_flow::Map*>(&current)) {
20✔
128
            applied_ |= this->accept(*map_stmt);
12✔
129
            this->visit_internal(map_stmt->root());
12✔
130
        } else if (auto while_stmt = dynamic_cast<structured_control_flow::While*>(&current)) {
12✔
131
            applied_ |= this->accept(*while_stmt);
×
132
            this->visit_internal(while_stmt->root());
×
133
        } else if (auto continue_stmt = dynamic_cast<structured_control_flow::Continue*>(&current)) {
×
134
            applied_ |= this->accept(*continue_stmt);
×
135
        } else if (auto break_stmt = dynamic_cast<structured_control_flow::Break*>(&current)) {
×
136
            applied_ |= this->accept(*break_stmt);
×
137
        } else if (auto return_stmt = dynamic_cast<structured_control_flow::Return*>(&current)) {
×
138
            applied_ |= this->accept(*return_stmt);
×
139
        }
×
140
    }
170✔
141

142
    return false;
125✔
143
};
125✔
144

145
bool ActualStructuredSDFGVisitor::visit(sdfg::structured_control_flow::ControlFlowNode& node) { return dispatch(node); }
×
146

147
bool ActualStructuredSDFGVisitor::dispatch(ControlFlowNode& node) {
×
148
    //// ARGH. The most inefficient variant of them all. Is there a good way to
149
    if (auto block_stmt = dynamic_cast<structured_control_flow::Block*>(&node)) {
×
150
        return this->visit(*block_stmt);
×
151
    } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(&node)) {
×
152
        return this->visit(*sequence_stmt);
×
153
    } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(&node)) {
×
154
        return this->visit(*if_else_stmt);
×
155
    } else if (auto for_stmt = dynamic_cast<structured_control_flow::For*>(&node)) {
×
156
        return this->visit(*for_stmt);
×
157
    } else if (auto map_stmt = dynamic_cast<structured_control_flow::Map*>(&node)) {
×
158
        return this->visit(*map_stmt);
×
159
    } else if (auto while_stmt = dynamic_cast<structured_control_flow::While*>(&node)) {
×
160
        return this->visit(*while_stmt);
×
161
    } else if (auto continue_stmt = dynamic_cast<structured_control_flow::Continue*>(&node)) {
×
162
        return this->visit(*continue_stmt);
×
163
    } else if (auto break_stmt = dynamic_cast<structured_control_flow::Break*>(&node)) {
×
164
        return this->visit(*break_stmt);
×
165
    } else if (auto return_stmt = dynamic_cast<structured_control_flow::Return*>(&node)) {
×
166
        return this->visit(*return_stmt);
×
167
    }
×
168

169
    return false;
×
170
}
×
171

172

173
ActualStructuredSDFGVisitor::ActualStructuredSDFGVisitor() {}
×
174

175
bool ActualStructuredSDFGVisitor::visit(Block& node) { return false; }
×
176
bool ActualStructuredSDFGVisitor::visit(Sequence& node) {
×
177
    for (int i = 0; i < node.size(); ++i) {
×
178
        visit(node.at(i).first);
×
179
    }
×
180

181
    return true;
×
182
}
×
183
bool ActualStructuredSDFGVisitor::visit(Return& node) { return false; }
×
184
bool ActualStructuredSDFGVisitor::visit(IfElse& node) {
×
185
    for (int i = 0; i < node.size(); ++i) {
×
186
        visit(node.at(i).first);
×
187
    }
×
188

189
    return true;
×
190
}
×
191
bool ActualStructuredSDFGVisitor::visit(For& node) { return handleStructuredLoop(node); }
×
192
bool ActualStructuredSDFGVisitor::visit(Map& node) { return handleStructuredLoop(node); }
×
193
bool ActualStructuredSDFGVisitor::handleStructuredLoop(StructuredLoop& loop) { return visit(loop.root()); }
×
194
bool ActualStructuredSDFGVisitor::visit(While& node) { return visit(node.root()); }
×
195
bool ActualStructuredSDFGVisitor::visit(Continue& node) { return false; }
×
196
bool ActualStructuredSDFGVisitor::visit(Break& node) { return false; }
×
197
} // namespace visitor
198
} // 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