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

daisytuner / sdfglib / 15470021361

05 Jun 2025 02:42PM UTC coverage: 57.727% (-0.2%) from 57.883%
15470021361

push

github

web-flow
Merge pull request #57 from daisytuner/alignments

adds explicit alignment to types

44 of 61 new or added lines in 12 files covered. (72.13%)

7 existing lines in 5 files now uncovered.

7953 of 13777 relevant lines covered (57.73%)

108.58 hits per line

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

42.37
/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, DeviceLocation device_location,
16✔
7
                   uint address_space, const std::string& initializer, size_t alignment)
8
    : return_type_(return_type.clone()),
8✔
9
      is_var_arg_(is_var_arg),
8✔
10
      device_location_(device_location),
8✔
11
      address_space_(address_space),
8✔
12
      initializer_(initializer),
8✔
13
      alignment_(alignment) {}
16✔
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

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

UNCOV
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->return_type_, this->is_var_arg_, this->device_location_,
2✔
69
                                   this->address_space_, this->initializer_, this->alignment_);
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

76
DeviceLocation Function::device_location() const { return this->device_location_; }
4✔
77

78
uint Function::address_space() const { return this->address_space_; }
4✔
79

80
std::string Function::initializer() const { return this->initializer_; }
4✔
81

82
size_t Function::alignment() const { return this->alignment_; }
2✔
83

84
std::string Function::print() const {
×
85
    std::string params = "";
×
86
    for (size_t i = 0; i < this->params_.size(); i++) {
×
87
        params += this->params_[i]->print();
×
88
        if (i != this->params_.size() - 1) {
×
89
            params += ", ";
×
90
        }
×
91
    }
×
92
    if (this->is_var_arg_) {
×
93
        params += ", ...)";
×
94
    } else {
×
95
        params += ")";
×
96
    }
97
    return "Function(" + this->return_type_->print() + ", " + params + ")";
×
98
};
×
99

100
}  // namespace types
101
}  // 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