| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2021-2025 ChilliBits. All rights reserved. | ||
| 2 | |||
| 3 | #pragma once | ||
| 4 | |||
| 5 | #include <string> | ||
| 6 | #include <unordered_map> | ||
| 7 | #include <vector> | ||
| 8 | |||
| 9 | #include <llvm/IR/DebugInfoMetadata.h> | ||
| 10 | |||
| 11 | #include <model/GenericType.h> | ||
| 12 | |||
| 13 | namespace spice::compiler { | ||
| 14 | |||
| 15 | // Forward declarations | ||
| 16 | class Type; | ||
| 17 | class SymbolTableEntry; | ||
| 18 | class Scope; | ||
| 19 | class ASTNode; | ||
| 20 | struct CodeLoc; | ||
| 21 | |||
| 22 | class StructBase { | ||
| 23 | public: | ||
| 24 | // Constructors | ||
| 25 | 758 | StructBase(std::string name, SymbolTableEntry *entry, Scope *scope, std::vector<GenericType> templateTypes, ASTNode *declNode) | |
| 26 | 758 | : name(std::move(name)), templateTypes(std::move(templateTypes)), entry(entry), scope(scope), declNode(declNode) {} | |
| 27 | |||
| 28 | // Public methods | ||
| 29 | [[nodiscard]] std::string getSignature() const; | ||
| 30 | static std::string getSignature(const std::string &name, const QualTypeList &concreteTemplateTypes); | ||
| 31 | [[nodiscard]] bool hasSubstantiatedGenerics() const; | ||
| 32 | [[nodiscard]] bool isFullySubstantiated() const; | ||
| 33 | [[nodiscard]] QualTypeList getTemplateTypes() const; | ||
| 34 | [[nodiscard]] const CodeLoc &getDeclCodeLoc() const; | ||
| 35 | [[nodiscard]] bool isGenericSubstantiation() const; | ||
| 36 | |||
| 37 | // Public members | ||
| 38 | std::string name; | ||
| 39 | std::vector<GenericType> templateTypes; | ||
| 40 | TypeMapping typeMapping; | ||
| 41 | SymbolTableEntry *entry = nullptr; | ||
| 42 | Scope *scope = nullptr; | ||
| 43 | ASTNode *declNode; | ||
| 44 | size_t manifestationIndex = 0; | ||
| 45 | StructBase *genericPreset = nullptr; | ||
| 46 | struct { | ||
| 47 | llvm::StructType *typeInfoType = nullptr; | ||
| 48 | llvm::StructType *vtableType = nullptr; | ||
| 49 | llvm::Constant *typeInfoName = nullptr; | ||
| 50 | llvm::Constant *typeInfo = nullptr; | ||
| 51 | llvm::Constant *vtable = nullptr; | ||
| 52 | } vTableData; | ||
| 53 | bool used = false; | ||
| 54 | }; | ||
| 55 | |||
| 56 | } // namespace spice::compiler | ||
| 57 |