mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Runtime: Generate a mangled name as the ObjC runtime name of generic class instances.
Our hack to generate a unique name by appending the class pointer doesn't produce a stable class name that can persist in NSKeyedArchiver, or eventually be used as a key for dynamic runtime instantiation. Generate a proper mangled name for the class instance by building a demangling AST from the metadata nodes and feeding it into the remangler. Should fix rdar://problem/18884563, though I need to try using an archiver with a generic class to verify. Swift SVN r29316
This commit is contained in:
@@ -73,29 +73,6 @@ std::ostream &operator<<(std::ostream &OS, const QuotedString &QS) {
|
||||
return OS;
|
||||
}
|
||||
|
||||
namespace swift {
|
||||
namespace Demangle {
|
||||
struct NodeFactory {
|
||||
static NodePointer create(Node::Kind K) {
|
||||
return NodePointer(new Node(K));
|
||||
}
|
||||
static NodePointer create(Node::Kind K, Node::IndexType Index) {
|
||||
return NodePointer(new Node(K, Index));
|
||||
}
|
||||
static NodePointer create(Node::Kind K, llvm::StringRef Text) {
|
||||
return NodePointer(new Node(K, Text));
|
||||
}
|
||||
static NodePointer create(Node::Kind K, std::string &&Text) {
|
||||
return NodePointer(new Node(K, std::move(Text)));
|
||||
}
|
||||
template <size_t N>
|
||||
static NodePointer create(Node::Kind K, const char (&Text)[N]) {
|
||||
return NodePointer(new Node(K, llvm::StringRef(Text)));
|
||||
}
|
||||
};
|
||||
} // end namespace Demangle
|
||||
} // end namespace swift
|
||||
|
||||
Node::~Node() {
|
||||
switch (NodePayloadKind) {
|
||||
case PayloadKind::None: return;
|
||||
|
||||
Reference in New Issue
Block a user