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

daisytuner / sdfglib / 20770413849

06 Jan 2026 10:50PM UTC coverage: 62.168% (+21.4%) from 40.764%
20770413849

push

github

web-flow
Merge pull request #433 from daisytuner/clang-coverage

updates clang coverage flags

14988 of 24109 relevant lines covered (62.17%)

88.57 hits per line

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

78.95
/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) {};
31✔
9

10
Structure::Structure(StorageType storage_type, size_t alignment, const std::string& initializer, const std::string& name)
11
    : IType(storage_type, alignment, initializer), name_(name) {};
27✔
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; };
52✔
18

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

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

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

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

35
bool Structure::is_pointer_like() const { return this->name_.starts_with("std::shared_ptr"); }
×
36

37
StructureDefinition::StructureDefinition(const std::string& name, bool is_packed)
38
    : name_(name), is_packed_(is_packed), members_() {};
24✔
39

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

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

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

52
size_t StructureDefinition::num_members() const { return this->members_.size(); };
74✔
53

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

58
void StructureDefinition::add_member(const IType& member_type) { this->members_.push_back(member_type.clone()); };
30✔
59

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

76
const Scalar& StructureDefinition::vector_element_type() const {
10✔
77
    return dynamic_cast<const Scalar&>(this->member_type(symbolic::zero()));
10✔
78
}
10✔
79

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

87
} // namespace types
88
} // 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