Merge pull request #12392 from github/alexdenisov/mangle-builtin-types

Swift: mangle builtin types
This commit is contained in:
AlexDenisov
2023-03-07 18:22:13 +01:00
committed by GitHub
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;
};