Skip to content

Commit 6a985a3

Browse files
authored
Merge pull request github#12392 from github/alexdenisov/mangle-builtin-types
Swift: mangle builtin types
2 parents d469b97 + 1283bcb commit 6a985a3

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

swift/extractor/mangler/SwiftMangler.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,12 @@ std::optional<std::string> SwiftMangler::mangleType(const swift::ModuleType& typ
3838
}
3939
return key;
4040
}
41+
42+
#define TYPE(TYPE_ID, PARENT_TYPE)
43+
#define BUILTIN_TYPE(TYPE_ID, PARENT_TYPE) \
44+
std::optional<std::string> SwiftMangler::mangleType(const swift::TYPE_ID##Type& type) { \
45+
llvm::SmallString<32> buffer; \
46+
type.getTypeName(buffer); \
47+
return buffer.str().str(); \
48+
}
49+
#include <swift/AST/TypeNodes.def>

swift/extractor/mangler/SwiftMangler.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ class SwiftMangler {
1515

1616
std::optional<std::string> mangleType(const swift::ModuleType& type);
1717

18+
#define TYPE(TYPE_ID, PARENT_TYPE)
19+
#define BUILTIN_TYPE(TYPE_ID, PARENT_TYPE) \
20+
std::optional<std::string> mangleType(const swift::TYPE_ID##Type& type);
21+
#include <swift/AST/TypeNodes.def>
22+
1823
private:
1924
swift::Mangle::ASTMangler mangler;
2025
};

0 commit comments

Comments
 (0)