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

daisytuner / sdfglib / 19172941610

07 Nov 2025 03:26PM UTC coverage: 61.415% (-0.07%) from 61.486%
19172941610

push

github

web-flow
Merge pull request #328 from daisytuner/sdfg-allocations

Sdfg allocations

3 of 24 new or added lines in 2 files covered. (12.5%)

10276 of 16732 relevant lines covered (61.42%)

100.52 hits per line

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

70.59
/src/types/structure.cpp
1
#include "sdfg/types/structure.h"
2

3
#include "sdfg/types/scalar.h"
4

5
namespace sdfg {
6
namespace types {
7

8
Structure::Structure(const std::string& name) : name_(name) {};
29✔
9

10
Structure::Structure(StorageType storage_type, size_t alignment, const std::string& initializer, const std::string& name)
17✔
11
    : IType(storage_type, alignment, initializer), name_(name) {};
17✔
12

13
PrimitiveType Structure::primitive_type() const { return PrimitiveType::Void; };
1✔
14

15
bool Structure::is_symbol() const { return false; };
4✔
16

17
TypeID Structure::type_id() const { return TypeID::Structure; };
14✔
18

19
const std::string& Structure::name() const { return this->name_; };
26✔
20

21
bool Structure::operator==(const IType& other) const {
5✔
22
    if (auto structure_ = dynamic_cast<const Structure*>(&other)) {
5✔
23
        return this->name_ == structure_->name_;
5✔
24
    } else {
25
        return false;
×
26
    }
27
};
5✔
28

29
std::unique_ptr<IType> Structure::clone() const {
14✔
30
    return std::make_unique<Structure>(this->storage_type(), this->alignment(), this->initializer(), this->name_);
14✔
31
};
×
32

33
std::string Structure::print() const { return "Structure(" + this->name_ + ")"; };
×
34

35
StructureDefinition::StructureDefinition(const std::string& name, bool is_packed)
22✔
36
    : name_(name), is_packed_(is_packed), members_() {};
22✔
37

38
std::unique_ptr<StructureDefinition> StructureDefinition::clone() const {
1✔
39
    auto def = std::make_unique<StructureDefinition>(this->name_, this->is_packed_);
1✔
40
    for (unsigned i = 0; i < this->num_members(); i++) {
3✔
41
        def->add_member(this->member_type(symbolic::integer(i)));
2✔
42
    }
2✔
43
    return def;
1✔
44
};
1✔
45

46
const std::string& StructureDefinition::name() const { return this->name_; };
8✔
47

48
bool StructureDefinition::is_packed() const { return this->is_packed_; };
18✔
49

50
size_t StructureDefinition::num_members() const { return this->members_.size(); };
54✔
51

52
const IType& StructureDefinition::member_type(symbolic::Integer index) const {
37✔
53
    return *this->members_.at(index->as_uint());
37✔
54
};
55

56
void StructureDefinition::add_member(const IType& member_type) { this->members_.push_back(member_type.clone()); };
28✔
57

58
bool StructureDefinition::is_vector() const {
1✔
59
    if (this->num_members() == 0) {
1✔
60
        return false;
×
61
    }
62
    auto& first_member_type = this->member_type(symbolic::zero());
1✔
63
    if (first_member_type.type_id() != TypeID::Scalar) {
1✔
NEW
64
        return false;
×
65
    }
66
    for (size_t i = 1; i < this->num_members(); i++) {
1✔
67
        if (!(this->member_type(symbolic::integer(i)) == first_member_type)) {
1✔
68
            return false;
1✔
69
        }
70
    }
×
71
    return true;
×
72
}
1✔
73

74
const Scalar& StructureDefinition::vector_element_type() const {
×
75
    return dynamic_cast<const Scalar&>(this->member_type(symbolic::zero()));
×
76
}
×
77

78
const size_t StructureDefinition::vector_size() const {
×
79
    if (!this->is_vector()) {
×
80
        return 0;
×
81
    }
82
    return this->num_members();
×
83
}
×
84

85
} // namespace types
86
} // 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