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

tudasc / TypeART / 25177145272

30 Apr 2026 04:30PM UTC coverage: 84.647% (-5.6%) from 90.246%
25177145272

Pull #188

github

web-flow
Merge 88918912c into 278119205
Pull Request #188: GPU memory allocation support

127 of 259 new or added lines in 19 files covered. (49.03%)

200 existing lines in 18 files now uncovered.

4510 of 5328 relevant lines covered (84.65%)

27776.73 hits per line

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

85.71
/lib/passes/typegen/TypeGenerator.cpp
1
// TypeART library
2
//
3
// Copyright (c) 2017-2026 TypeART Authors
4
// Distributed under the BSD 3-Clause license.
5
// (See accompanying file LICENSE.txt or copy at
6
// https://opensource.org/licenses/BSD-3-Clause)
7
//
8
// Project home: https://github.com/tudasc/TypeART
9
//
10
// SPDX-License-Identifier: BSD-3-Clause
11
//
12

13
#include "TypeGenerator.h"
14

15
#include "TypeIDGenerator.h"
16
#include "dimeta/DimetaTypeGen.h"
17
#include "ir/IRTypeGen.h"
18
#include "support/Logger.h"
19
#include "typelib/TypeDB.h"
20
#include "typelib/TypeIO.h"
21
#include "typelib/TypeInterface.h"
22

23
#include <memory>
24

25
namespace typeart::types {
26

27
TypeIDGenerator::TypeIDGenerator(std::string file_, std::unique_ptr<TypeDatabase> database_)
8,084✔
28
    : file(std::move(file_)), typeDB(std::move(database_)) {
4,042✔
29
}
1,618✔
30

31
std::pair<bool, std::error_code> TypeIDGenerator::load() {
4,042✔
32
  auto loaded        = typeart::io::load(typeDB.get(), file);
4,042✔
33
  std::error_code ec = loaded.getError();
4,042✔
34
  if (ec) {
4,042✔
35
    return {false, ec};
3,517✔
36
  }
37
  structMap.clear();
525✔
38
  for (const auto& structInfo : typeDB->getStructList()) {
645✔
39
    structMap.insert({structInfo.name, structInfo.type_id});
120✔
40
  }
41
  structCount = structMap.size();
525✔
42
  return {true, ec};
525✔
43
}
4,042✔
44

45
std::pair<bool, std::error_code> TypeIDGenerator::store() const {
570✔
46
  auto stored        = typeart::io::store(typeDB.get(), file);
570✔
47
  std::error_code ec = stored.getError();
570✔
48
  return {!static_cast<bool>(ec), ec};
570✔
49
}
570✔
50

51
int TypeIDGenerator::reserveNextTypeId() {
8,440✔
52
  int id = static_cast<int>(TYPEART_NUM_RESERVED_IDS) + structCount;
8,440✔
53
  structCount++;
8,440✔
54
  return id;
8,440✔
55
}
56

57
const TypeDatabase& TypeIDGenerator::getTypeDatabase() const {
21,036✔
58
  return *this->typeDB;
21,036✔
59
}
60

UNCOV
61
bool TypeIDGenerator::registerModule(ModuleData&) {
×
UNCOV
62
  return false;
×
63
}
64

65
}  // namespace typeart::types
66

67
namespace typeart {
68
std::unique_ptr<TypeGenerator> make_typegen(std::string_view file, TypegenImplementation impl) {
4,042✔
69
  auto database = std::make_unique<TypeDB>();
4,042✔
70
  switch (impl) {
4,042✔
71
    case typeart::TypegenImplementation::DIMETA:
72
      LOG_DEBUG("Loading Dimeta type parser")
73
      return types::make_dimeta_typeidgen(file, std::move(database));
4,042✔
74
    default:
UNCOV
75
      break;
×
76
  }
77
#if LLVM_VERSION_MAJOR > 14
UNCOV
78
  LOG_ERROR("TypeGen for LLVM IR (typegen=ir) unsupported with LLVM version > 14. Returning typegen=dimeta")
×
UNCOV
79
  return types::make_dimeta_typeidgen(file, std::move(database));
×
80
#endif
81
  LOG_DEBUG("Loading IR type parser")
82
  return make_ir_typeidgen(file, std::move(database));
83
}
4,042✔
84
}  // namespace typeart
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