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

daisytuner / sdfglib / 19162352523

07 Nov 2025 08:16AM UTC coverage: 61.556% (-0.4%) from 61.911%
19162352523

push

github

web-flow
rewrite of arg captures to work on a scope level (#319)

* rewrite of arg captures to work on a scope level

* adding first unit tests for arg capturing

* Fix scoped arg captures

* Fix debug output

* Only write capture fila name to index

* Switch to element-id based capture storage

* Reenable debug prints

* Fix serialization deserialization of arg capture index

* Use fake node ids in rtl test

* Add debug output for capture file creation

* Boost coverage

---------

Co-authored-by: Nora Hagmeyer <nora.hagmeyer@daisytuner.com>

171 of 320 new or added lines in 18 files covered. (53.44%)

17 existing lines in 5 files now uncovered.

10265 of 16676 relevant lines covered (61.56%)

100.85 hits per line

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

25.0
/src/codegen/code_generators/c_style_base_code_generator.cpp
1

2
#include "sdfg/codegen/code_generators/c_style_base_code_generator.h"
3

4
#include "sdfg/helpers/helpers.h"
5

6
namespace sdfg::codegen {
7

8
CStyleBaseCodeGenerator::CStyleBaseCodeGenerator(
16✔
9
    StructuredSDFG& sdfg,
10
    analysis::AnalysisManager& analysis_manager,
11
    InstrumentationPlan& instrumentation_plan,
12
    ArgCapturePlan& arg_capture_plan,
13
    const std::pair<std::filesystem::path, std::filesystem::path>* output_and_header_paths,
14
    const std::string& externals_prefix
15
)
16
    : CodeGenerator(
16✔
17
          sdfg, analysis_manager, instrumentation_plan, arg_capture_plan, output_and_header_paths, externals_prefix
16✔
18
      ) {
16✔
19
    if (sdfg.type() != FunctionType_CPU) {
16✔
20
        throw std::runtime_error("CStyleBaseCodeGenerator can only be used for CPU SDFGs");
×
21
    }
22
};
16✔
23

24
bool CStyleBaseCodeGenerator::generate() {
14✔
25
    this->dispatch_includes();
14✔
26
    this->dispatch_structures();
14✔
27
    this->dispatch_globals();
14✔
28
    this->dispatch_schedule();
14✔
29
    return true;
14✔
30
};
31

32
bool CStyleBaseCodeGenerator::as_source(const std::filesystem::path& header_path, const std::filesystem::path& source_path) {
×
33
    std::ofstream ofs_header(header_path, std::ofstream::out | std::ofstream::trunc);
×
34
    if (!ofs_header.is_open()) {
×
35
        return false;
×
36
    }
37

38
    std::ofstream ofs_source(source_path, std::ofstream::out | std::ofstream::trunc);
×
39
    if (!ofs_source.is_open()) {
×
40
        return false;
×
41
    }
42

43
    ofs_header << "#pragma once" << std::endl;
×
44
    ofs_header << this->includes_stream_.str() << std::endl;
×
45
    ofs_header << this->classes_stream_.str() << std::endl;
×
46
    ofs_header.close();
×
47

48
    ofs_source << "#include \"" << header_path.filename().string() << "\"" << std::endl;
×
49
    ofs_source << this->globals_stream_.str() << std::endl;
×
50

51
    append_function_source(ofs_source);
×
52

53
    ofs_source.close();
×
54

55
    return true;
×
56
}
×
57

58
void CStyleBaseCodeGenerator::append_function_source(std::ofstream& ofs_source) {
×
59
    std::unique_ptr<std::vector<CaptureVarPlan>> capturePlan;
×
NEW
60
    if (!arg_capture_plan_.is_empty()) {
×
NEW
61
        this->emit_capture_context_init(ofs_source);
×
UNCOV
62
    }
×
63

64
    ofs_source << this->function_definition() << std::endl;
×
65
    ofs_source << "{" << std::endl;
×
66

67
    auto init_once = library_snippet_factory_.find(CODE_SNIPPET_INIT_ONCE);
×
68
    if (init_once != library_snippet_factory_.snippets().end()) {
×
69
        ofs_source << init_once->second.stream().str() << std::endl;
×
70
    }
×
71

72
    ofs_source << this->main_stream_.str() << std::endl;
×
73

74
    auto deinit_once = library_snippet_factory_.find(CODE_SNIPPET_DEINIT_ONCE);
×
75
    if (deinit_once != library_snippet_factory_.snippets().end()) {
×
76
        ofs_source << deinit_once->second.stream().str() << std::endl;
×
77
    }
×
78

79
    ofs_source << "}" << std::endl;
×
80
}
×
81

82
} // namespace sdfg::codegen
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