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

daisytuner / docc / 26520678771

27 May 2026 03:22PM UTC coverage: 60.864% (-0.02%) from 60.886%
26520678771

Pull #719

github

web-flow
Merge 99c5e4f9d into 707dadcf8
Pull Request #719: Libnode ptr edges

961 of 1749 new or added lines in 52 files covered. (54.95%)

90 existing lines in 29 files now uncovered.

35222 of 57870 relevant lines covered (60.86%)

11043.61 hits per line

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

50.0
/sdfg/src/data_flow/library_nodes/stdlib/free.cpp
1
#include "sdfg/data_flow/library_nodes/stdlib/free.h"
2

3
namespace sdfg {
4
namespace stdlib {
5

6
FreeNode::FreeNode(
7
    size_t element_id, const DebugInfo& debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph& parent
8
)
9
    : StdlibNode(
56✔
10
          element_id,
56✔
11
          debug_info,
56✔
12
          vertex,
56✔
13
          parent,
56✔
14
          LibraryNodeType_Free,
56✔
15
          {},
56✔
16
          {"_ptr"},
56✔
17
          true,
56✔
18
          data_flow::ImplementationType_NONE
56✔
19
      ) {}
56✔
20

21

22
void FreeNode::validate(const Function& function) const { LibraryNode::validate(function); }
139✔
23

24
symbolic::SymbolSet FreeNode::symbols() const { return {}; }
60✔
25

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

31
void FreeNode::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
×
32
    // Do nothing
33
    return;
×
34
}
×
35

36
data_flow::PointerAccessType FreeNode::pointer_access_type(int input_idx) const {
3✔
37
    if (input_idx == 0) {
3✔
38
        return data_flow::PointerAccessMeta::create_invalidate();
3✔
39
    } else {
3✔
NEW
40
        return LibraryNode::pointer_access_type(input_idx);
×
NEW
41
    }
×
42
}
3✔
43

44
nlohmann::json FreeNodeSerializer::serialize(const data_flow::LibraryNode& library_node) {
×
45
    const FreeNode& node = static_cast<const FreeNode&>(library_node);
×
46

47
    nlohmann::json j;
×
48
    j["code"] = node.code().value();
×
49

50
    return j;
×
51
}
×
52

53
data_flow::LibraryNode& FreeNodeSerializer::deserialize(
54
    const nlohmann::json& j, builder::StructuredSDFGBuilder& builder, structured_control_flow::Block& parent
55
) {
×
56
    assert(j.contains("code"));
×
57
    assert(j.contains("debug_info"));
×
58

59
    auto code = j["code"].get<std::string>();
×
60
    if (code != LibraryNodeType_Free.value()) {
×
61
        throw InvalidSDFGException("Invalid library node code");
×
62
    }
×
63

64
    sdfg::serializer::JSONSerializer serializer;
×
65
    DebugInfo debug_info = serializer.json_to_debug_info(j["debug_info"]);
×
66

67
    return builder.add_library_node<FreeNode>(parent, debug_info);
×
68
}
×
69

70
FreeNodeDispatcher::FreeNodeDispatcher(
71
    codegen::LanguageExtension& language_extension,
72
    const Function& function,
73
    const data_flow::DataFlowGraph& data_flow_graph,
74
    const FreeNode& node
75
)
76
    : codegen::LibraryNodeDispatcher(language_extension, function, data_flow_graph, node) {}
×
77

78
void FreeNodeDispatcher::dispatch_code_with_edges(
79
    codegen::CodegenOutput& out,
80
    std::vector<codegen::DispatchInput>& inputs,
81
    std::vector<codegen::DispatchOutput>& outputs
NEW
82
) {
×
NEW
83
    out.stream << out.language_extension.external_prefix() << "free(" << inputs.at(0).expr << ");" << std::endl;
×
NEW
84
}
×
85

86
FreeNode& add_free_node(
87
    builder::StructuredSDFGBuilder& builder,
88
    Block& block,
89
    const std::string& ptr,
90
    const types::IType& ptr_type,
91
    DebugInfo debug_info
92
) {
2✔
93
    auto& dst_ptr_access = builder.add_access(block, ptr);
2✔
94
    auto& libnode = builder.add_library_node<stdlib::FreeNode>(block, debug_info);
2✔
95
    builder.add_computational_memlet(block, dst_ptr_access, libnode, "_ptr", {}, ptr_type);
2✔
96

97
    return static_cast<FreeNode&>(libnode);
2✔
98
}
2✔
99

100
std::tuple<Block&, FreeNode&> add_free_block(
101
    builder::StructuredSDFGBuilder& builder,
102
    Sequence& parent,
103
    const std::string& ptr,
104
    const types::IType& ptr_type,
105
    DebugInfo debug_info
106
) {
2✔
107
    auto& block = builder.add_block(parent);
2✔
108

109
    auto& libnode = add_free_node(builder, block, ptr, ptr_type, debug_info);
2✔
110

111
    return {block, libnode};
2✔
112
}
2✔
113

114
} // namespace stdlib
115
} // namespace sdfg
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc