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

daisytuner / sdfglib / 15348583372

30 May 2025 02:07PM UTC coverage: 58.75% (+0.1%) from 58.631%
15348583372

Pull #48

github

web-flow
Merge fe123e4c5 into d1039227e
Pull Request #48: adds scope tree analysis

56 of 67 new or added lines in 2 files covered. (83.58%)

71 existing lines in 1 file now uncovered.

8242 of 14029 relevant lines covered (58.75%)

109.68 hits per line

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

77.5
/src/analysis/scope_tree_analysis.cpp
1
#include "sdfg/analysis/scope_tree_analysis.h"
2

3
namespace sdfg {
4
namespace analysis {
5

6
ScopeTreeAnalysis::ScopeTreeAnalysis(StructuredSDFG& sdfg) : Analysis(sdfg) {}
31✔
7

8
void ScopeTreeAnalysis::run(structured_control_flow::ControlFlowNode* current,
189✔
9
                            structured_control_flow::ControlFlowNode* parent_scope) {
10
    if (dynamic_cast<structured_control_flow::Block*>(current)) {
189✔
11
        this->scope_tree_[current] = parent_scope;
39✔
12
    } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(current)) {
189✔
13
        this->scope_tree_[current] = parent_scope;
94✔
14
        for (size_t i = 0; i < sequence_stmt->size(); i++) {
195✔
15
            this->run(&sequence_stmt->at(i).first, current);
101✔
16
        }
101✔
17
    } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(current)) {
150✔
18
        this->scope_tree_[current] = parent_scope;
18✔
19
        for (size_t i = 0; i < if_else_stmt->size(); i++) {
44✔
20
            this->run(&if_else_stmt->at(i).first, current);
26✔
21
        }
26✔
22
    } else if (auto while_stmt = dynamic_cast<structured_control_flow::While*>(current)) {
56✔
23
        this->scope_tree_[current] = parent_scope;
31✔
24
        this->run(&while_stmt->root(), current);
31✔
25
    } else if (auto for_stmt = dynamic_cast<structured_control_flow::For*>(current)) {
38✔
NEW
26
        this->scope_tree_[current] = parent_scope;
×
NEW
27
        this->run(&for_stmt->root(), current);
×
28
    } else if (dynamic_cast<structured_control_flow::Kernel*>(current)) {
7✔
NEW
29
        this->scope_tree_[current] = parent_scope;
×
30
    } else if (dynamic_cast<structured_control_flow::Break*>(current)) {
7✔
NEW
31
        this->scope_tree_[current] = parent_scope;
×
32
    } else if (dynamic_cast<structured_control_flow::Continue*>(current)) {
7✔
33
        this->scope_tree_[current] = parent_scope;
7✔
34
    } else if (dynamic_cast<structured_control_flow::Return*>(current)) {
7✔
NEW
35
        this->scope_tree_[current] = parent_scope;
×
NEW
36
    } else {
×
NEW
37
        throw std::runtime_error("Unsupported control flow node type");
×
38
    }
39
}
189✔
40

41
void ScopeTreeAnalysis::run(AnalysisManager& analysis_manager) {
31✔
42
    this->scope_tree_.clear();
31✔
43

44
    this->scope_tree_[&this->sdfg_.root()] = nullptr;
31✔
45
    this->run(&this->sdfg_.root(), nullptr);
31✔
46
}
31✔
47

48
const std::unordered_map<structured_control_flow::ControlFlowNode*,
49
                         structured_control_flow::ControlFlowNode*>&
NEW
50
ScopeTreeAnalysis::scope_tree() const {
×
NEW
51
    return this->scope_tree_;
×
52
}
53

54
structured_control_flow::ControlFlowNode* ScopeTreeAnalysis::parent_scope(
55✔
55
    structured_control_flow::ControlFlowNode* scope) const {
56
    return this->scope_tree_.at(scope);
55✔
57
}
58

59
}  // namespace analysis
60
}  // 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