Swift: mangle builtin types

This commit is contained in:
Alex Denisov
2023-03-03 17:27:35 +01:00
parent d469b9711d
commit 1283bcb860
2 changed files with 14 additions and 0 deletions

View File

@@ -38,3 +38,12 @@ std::optional<std::string> SwiftMangler::mangleType(const swift::ModuleType& typ
}
return key;
}
#define TYPE(TYPE_ID, PARENT_TYPE)
#define BUILTIN_TYPE(TYPE_ID, PARENT_TYPE) \
std::optional<std::string> SwiftMangler::mangleType(const swift::TYPE_ID##Type& type) { \
llvm::SmallString<32> buffer; \
type.getTypeName(buffer); \
return buffer.str().str(); \
}
#include <swift/AST/TypeNodes.def>

View File

@@ -15,6 +15,11 @@ class SwiftMangler {
std::optional<std::string> mangleType(const swift::ModuleType& type);
#define TYPE(TYPE_ID, PARENT_TYPE)
#define BUILTIN_TYPE(TYPE_ID, PARENT_TYPE) \
std::optional<std::string> mangleType(const swift::TYPE_ID##Type& type);
#include <swift/AST/TypeNodes.def>
private:
swift::Mangle::ASTMangler mangler;
};