• 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

50.0
/src/codegen/utils.cpp
1
#include "sdfg/codegen/utils.h"
2

3
namespace sdfg {
4
namespace codegen {
5

6
// Constructor
7
PrettyPrinter::PrettyPrinter(int indent, bool frozen)
465✔
8
    : indentSize(indent), frozen_(frozen) {
465✔
9

10
      };
11

12
// Set the indentation level
13
void PrettyPrinter::setIndent(int indent) { indentSize = indent; };
2,198✔
14

15
int PrettyPrinter::indent() const { return indentSize; };
430✔
16

17
// Get the underlying string
18
std::string PrettyPrinter::str() const { return stream.str(); };
397✔
19

20
// Clear the stringstream content
21
void PrettyPrinter::clear() {
171✔
22
    stream.str("");
171✔
23
    stream.clear();
171✔
24
};
171✔
25

26
// Overload for manipulators (like std::endl)
27
PrettyPrinter& PrettyPrinter::operator<<(std::ostream& (*manip)(std::ostream&)) {
4,927✔
28
    if (frozen_) {
4,927✔
29
        throw std::runtime_error("PrettyPrinter is frozen");
×
30
    }
31
    stream << manip;
4,927✔
32
    // Reset indent application on new lines
33
    if (manip == static_cast<std::ostream& (*)(std::ostream&)>(std::endl)) {
4,927✔
34
        isNewLine = true;
4,927✔
35
    }
4,927✔
36
    return *this;
4,927✔
37
};
×
38

39
// Apply indentation only at the beginning of a new line
40
void PrettyPrinter::applyIndent() {
13,601✔
41
    if (isNewLine && indentSize > 0) {
13,601✔
42
        stream << std::setw(indentSize) << "";
4,093✔
43
        isNewLine = false;
4,093✔
44
    }
4,093✔
45
};
13,601✔
46

NEW
47
Reference::Reference(const types::IType& reference_, size_t alignment)
×
NEW
48
    : reference_(reference_.clone()), alignment_(alignment) {};
×
49

50
std::unique_ptr<types::IType> Reference::clone() const {
×
NEW
51
    return std::make_unique<Reference>(*this->reference_, this->alignment_);
×
52
};
53

NEW
54
size_t Reference::alignment() const { return this->alignment_; };
×
55

56
types::PrimitiveType Reference::primitive_type() const {
×
57
    return this->reference_->primitive_type();
×
58
};
59

60
bool Reference::is_symbol() const { return false; };
×
61

62
const types::IType& Reference::reference_type() const { return *this->reference_; };
×
63

64
bool Reference::operator==(const types::IType& other) const {
×
65
    if (auto reference = dynamic_cast<const Reference*>(&other)) {
×
NEW
66
        return *(this->reference_) == *reference->reference_ &&
×
NEW
67
               this->alignment_ == reference->alignment_;
×
68
    } else {
69
        return false;
×
70
    }
71
};
×
72

73
uint Reference::address_space() const { return this->reference_->address_space(); };
×
74

75
sdfg::types::DeviceLocation Reference::device_location() const {
×
76
    return this->reference_->device_location();
×
77
};
78

79
std::string Reference::initializer() const { return this->reference_->initializer(); };
×
80

81
std::string Reference::print() const { return "Reference(" + this->reference_->print() + ")"; };
×
82

83
}  // namespace codegen
84
}  // 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