mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Serialize local types and provide a lookup API
rdar://problem/18295292 Locally scoped type declarations were previously not serialized into the module, which meant that the debugger couldn't reason about the structure of instances of those types. Introduce a new mangling for local types: [file basename MD5][counter][identifier] This allows the demangle node's data to be used directly for lookup without having to backtrack in the debugger. Local decls are now serialized into a LOCAL_TYPE_DECLS table in the module, which acts as the backing hash table for looking up [file basename MD5][counter][identifier] -> DeclID mappings. New tests: * swift-ide-test mode for testing the demangle/lookup/mangle lifecycle of a module that contains local decls * mangling * module merging with local decls Swift SVN r24426
This commit is contained in:
@@ -1371,8 +1371,12 @@ void Parser::setLocalDiscriminator(ValueDecl *D) {
|
||||
if (!CurLocalContext || !D->getDeclContext()->isLocalContext())
|
||||
return;
|
||||
|
||||
if (auto type = dyn_cast<TypeDecl>(D))
|
||||
SF.LocalTypeDecls.push_back(type);
|
||||
|
||||
Identifier name = D->getName();
|
||||
unsigned discriminator = CurLocalContext->claimNextNamedDiscriminator(name);
|
||||
auto SF = D->getDeclContext()->getParentSourceFile();
|
||||
auto discriminator = SF->claimNextNamedDiscriminator(name);
|
||||
D->setLocalDiscriminator(discriminator);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user