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

daisytuner / sdfglib / 16069945621

04 Jul 2025 08:56AM UTC coverage: 64.375% (-0.2%) from 64.606%
16069945621

push

github

web-flow
Merge pull request #137 from daisytuner/clang-format

runs clang-format on codebase

609 of 827 new or added lines in 63 files covered. (73.64%)

46 existing lines in 30 files now uncovered.

8578 of 13325 relevant lines covered (64.38%)

177.24 hits per line

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

82.5
/src/analysis/scope_analysis.cpp
1
#include "sdfg/analysis/scope_analysis.h"
2

3
namespace sdfg {
4
namespace analysis {
5

6
ScopeAnalysis::ScopeAnalysis(StructuredSDFG& sdfg) : Analysis(sdfg) {}
849✔
7

8
void ScopeAnalysis::
9
    run(structured_control_flow::ControlFlowNode* current, structured_control_flow::ControlFlowNode* parent_scope) {
7,298✔
10
    if (dynamic_cast<structured_control_flow::Block*>(current)) {
7,298✔
11
        this->scope_tree_[current] = parent_scope;
2,052✔
12
    } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(current)) {
7,298✔
13
        this->scope_tree_[current] = parent_scope;
3,067✔
14
        for (size_t i = 0; i < sequence_stmt->size(); i++) {
7,304✔
15
            this->run(&sequence_stmt->at(i).first, current);
4,237✔
16
        }
4,237✔
17
    } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(current)) {
5,246✔
18
        this->scope_tree_[current] = parent_scope;
57✔
19
        for (size_t i = 0; i < if_else_stmt->size(); i++) {
153✔
20
            this->run(&if_else_stmt->at(i).first, current);
96✔
21
        }
96✔
22
    } else if (auto while_stmt = dynamic_cast<structured_control_flow::While*>(current)) {
2,179✔
23
        this->scope_tree_[current] = parent_scope;
29✔
24
        this->run(&while_stmt->root(), current);
29✔
25
    } else if (auto for_stmt = dynamic_cast<structured_control_flow::StructuredLoop*>(current)) {
2,122✔
26
        this->scope_tree_[current] = parent_scope;
2,087✔
27
        this->run(&for_stmt->root(), current);
2,087✔
28
    } else if (dynamic_cast<structured_control_flow::Break*>(current)) {
2,093✔
29
        this->scope_tree_[current] = parent_scope;
×
30
    } else if (dynamic_cast<structured_control_flow::Continue*>(current)) {
6✔
31
        this->scope_tree_[current] = parent_scope;
6✔
32
    } else if (dynamic_cast<structured_control_flow::Return*>(current)) {
6✔
33
        this->scope_tree_[current] = parent_scope;
×
34
    } else {
×
35
        throw std::runtime_error("Unsupported control flow node type");
×
36
    }
37
}
7,298✔
38

39
void ScopeAnalysis::run(AnalysisManager& analysis_manager) {
849✔
40
    this->scope_tree_.clear();
849✔
41
    this->run(&this->sdfg_.root(), nullptr);
849✔
42
}
849✔
43

44
const std::unordered_map<const structured_control_flow::ControlFlowNode*, structured_control_flow::ControlFlowNode*>&
UNCOV
45
ScopeAnalysis::scope_tree() const {
×
46
    return this->scope_tree_;
×
47
}
48

49
structured_control_flow::ControlFlowNode* ScopeAnalysis::parent_scope(const structured_control_flow::ControlFlowNode*
3,541✔
50
                                                                          scope) const {
51
    if (this->scope_tree_.find(scope) == this->scope_tree_.end()) {
3,541✔
52
        return nullptr;
×
53
    }
54
    return this->scope_tree_.at(scope);
3,541✔
55
}
3,541✔
56

57
} // namespace analysis
58
} // 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