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

daisytuner / sdfglib / 15487347373

06 Jun 2025 09:26AM UTC coverage: 57.73% (+0.003%) from 57.727%
15487347373

push

github

web-flow
Merge pull request #58 from daisytuner/storage_types

moves from address space to storage type enums

109 of 115 new or added lines in 15 files covered. (94.78%)

15 existing lines in 6 files now uncovered.

7939 of 13752 relevant lines covered (57.73%)

108.46 hits per line

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

37.04
/src/types/function.cpp
1
#include "sdfg/types/function.h"
2

3
namespace sdfg {
4
namespace types {
5

6
Function::Function(const IType& return_type, bool is_var_arg)
6✔
7
    : return_type_(return_type.clone()), is_var_arg_(is_var_arg) {};
12✔
8

9
Function::Function(StorageType storage_type, size_t alignment, const std::string& initializer,
4✔
10
                   const IType& return_type, bool is_var_arg)
11
    : IType(storage_type, alignment, initializer),
2✔
12
      return_type_(return_type.clone()),
2✔
13
      is_var_arg_(is_var_arg) {};
2✔
14

15
PrimitiveType Function::primitive_type() const { return PrimitiveType::Void; }
2✔
16

17
bool Function::is_symbol() const { return false; }
×
18

19
size_t Function::num_params() const { return this->params_.size(); }
9✔
20

21
const IType& Function::param_type(symbolic::Integer index) const {
7✔
22
    return *this->params_[index->as_int()];
7✔
23
}
24

25
void Function::add_param(const IType& param) { this->params_.push_back(param.clone()); }
9✔
26

27
const IType& Function::return_type() const { return *this->return_type_; }
3✔
28

29
bool Function::is_var_arg() const { return this->is_var_arg_; }
7✔
30

31
bool Function::operator==(const IType& other) const {
×
32
    auto other_function = dynamic_cast<const Function*>(&other);
×
33
    if (other_function == nullptr) {
×
34
        return false;
×
35
    }
36

37
    if (this->is_var_arg_ != other_function->is_var_arg_) {
×
38
        return false;
×
39
    }
40

41
    if (this->alignment_ != other_function->alignment_) {
×
42
        return false;
×
43
    }
44

45
    if (*this->return_type_ == *other_function->return_type_) {
×
46
        // Do nothing
47
    } else {
×
48
        return false;
×
49
    }
50

51
    if (this->params_.size() != other_function->params_.size()) {
×
52
        return false;
×
53
    }
54

55
    for (size_t i = 0; i < this->params_.size(); i++) {
×
56
        if (*this->params_[i] == *other_function->params_[i]) {
×
57
            continue;
×
58
        } else {
59
            return false;
×
60
        }
61
    }
62

63
    return true;
×
64
}
×
65

66
std::unique_ptr<IType> Function::clone() const {
1✔
67
    auto new_function =
68
        std::make_unique<Function>(this->storage_type(), this->alignment(), this->initializer(),
2✔
69
                                   *this->return_type_, this->is_var_arg_);
1✔
70
    for (const auto& param : this->params_) {
3✔
71
        new_function->add_param(*param);
2✔
72
    }
73
    return new_function;
1✔
74
}
1✔
75

UNCOV
76
std::string Function::print() const {
×
UNCOV
77
    std::string params = "";
×
78
    for (size_t i = 0; i < this->params_.size(); i++) {
×
79
        params += this->params_[i]->print();
×
80
        if (i != this->params_.size() - 1) {
×
81
            params += ", ";
×
82
        }
×
83
    }
×
84
    if (this->is_var_arg_) {
×
85
        params += ", ...)";
×
86
    } else {
×
87
        params += ")";
×
88
    }
89
    return "Function(" + this->return_type_->print() + ", " + params + ")";
×
90
};
×
91

92
}  // namespace types
93
}  // 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