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

daisytuner / sdfglib / 19192861975

08 Nov 2025 12:14PM UTC coverage: 61.281% (-0.1%) from 61.415%
19192861975

push

github

web-flow
Merge pull request #329 from daisytuner/trap-nodes

Trap nodes and unreachable return

17 of 101 new or added lines in 7 files covered. (16.83%)

6 existing lines in 2 files now uncovered.

10264 of 16749 relevant lines covered (61.28%)

100.39 hits per line

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

0.0
/src/data_flow/library_nodes/stdlib/unreachable.cpp
1
#include "sdfg/data_flow/library_nodes/stdlib/unreachable.h"
2

3
namespace sdfg {
4
namespace stdlib {
5

NEW
6
UnreachableNode::UnreachableNode(
×
7
    size_t element_id, const DebugInfo& debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph& parent
8
)
NEW
9
    : LibraryNode(
×
NEW
10
          element_id,
×
NEW
11
          debug_info,
×
NEW
12
          vertex,
×
NEW
13
          parent,
×
14
          LibraryNodeType_Unreachable,
NEW
15
          {},
×
NEW
16
          {},
×
17
          true,
18
          data_flow::ImplementationType_NONE
NEW
19
      ) {}
×
20

NEW
21
void UnreachableNode::validate(const Function& function) const {}
×
22

NEW
23
symbolic::SymbolSet UnreachableNode::symbols() const { return symbolic::SymbolSet(); }
×
24

25
std::unique_ptr<data_flow::DataFlowNode> UnreachableNode::
NEW
26
    clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const {
×
NEW
27
    return std::make_unique<UnreachableNode>(element_id, debug_info_, vertex, parent);
×
28
}
29

NEW
30
void UnreachableNode::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
×
NEW
31
    this->size_ = symbolic::subs(this->size_, old_expression, new_expression);
×
NEW
32
}
×
33

NEW
34
nlohmann::json UnreachableNodeSerializer::serialize(const data_flow::LibraryNode& library_node) {
×
NEW
35
    const UnreachableNode& node = static_cast<const UnreachableNode&>(library_node);
×
36

NEW
37
    nlohmann::json j;
×
NEW
38
    j["code"] = node.code().value();
×
39

NEW
40
    return j;
×
NEW
41
}
×
42

NEW
43
data_flow::LibraryNode& UnreachableNodeSerializer::deserialize(
×
44
    const nlohmann::json& j, builder::StructuredSDFGBuilder& builder, structured_control_flow::Block& parent
45
) {
NEW
46
    assert(j.contains("code"));
×
NEW
47
    assert(j.contains("debug_info"));
×
48

NEW
49
    auto code = j["code"].get<std::string>();
×
NEW
50
    if (code != LibraryNodeType_Unreachable.value()) {
×
NEW
51
        throw InvalidSDFGException("Invalid library node code");
×
52
    }
53

NEW
54
    sdfg::serializer::JSONSerializer serializer;
×
NEW
55
    DebugInfo debug_info = serializer.json_to_debug_info(j["debug_info"]);
×
56

NEW
57
    return builder.add_library_node<UnreachableNode>(parent, debug_info);
×
NEW
58
}
×
59

NEW
60
UnreachableNodeDispatcher::UnreachableNodeDispatcher(
×
61
    codegen::LanguageExtension& language_extension,
62
    const Function& function,
63
    const data_flow::DataFlowGraph& data_flow_graph,
64
    const UnreachableNode& node
65
)
NEW
66
    : codegen::LibraryNodeDispatcher(language_extension, function, data_flow_graph, node) {}
×
67

NEW
68
void UnreachableNodeDispatcher::dispatch_code(
×
69
    codegen::PrettyPrinter& stream,
70
    codegen::PrettyPrinter& globals_stream,
71
    codegen::CodeSnippetFactory& library_snippet_factory
72
) {
NEW
73
    auto& node = static_cast<const UnreachableNode&>(node_);
×
74

NEW
75
    stream << "__builtin_unreachable()" << ";";
×
NEW
76
    stream << std::endl;
×
NEW
77
}
×
78

79
} // namespace stdlib
80
} // 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