mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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:
@@ -399,6 +399,12 @@ void SerializedASTFile::lookupValue(Module::AccessPathTy accessPath,
|
||||
File.lookupValue(name, results);
|
||||
}
|
||||
|
||||
TypeDecl *SerializedASTFile::lookupLocalType(llvm::StringRef FileHash,
|
||||
unsigned int LocalDiscriminator,
|
||||
llvm::StringRef Name) const {
|
||||
return File.lookupLocalType(FileHash, LocalDiscriminator, Name);
|
||||
}
|
||||
|
||||
OperatorDecl *SerializedASTFile::lookupOperator(Identifier name,
|
||||
DeclKind fixity) const {
|
||||
return File.lookupOperator(name, fixity);
|
||||
@@ -431,6 +437,10 @@ void SerializedASTFile::getTopLevelDecls(SmallVectorImpl<Decl*> &results) const{
|
||||
File.getTopLevelDecls(results);
|
||||
}
|
||||
|
||||
void SerializedASTFile::getLocalTypeDecls(SmallVectorImpl<Decl*> &results) const {
|
||||
return File.getLocalTypeDecls(results);
|
||||
}
|
||||
|
||||
void SerializedASTFile::getDisplayDecls(SmallVectorImpl<Decl*> &results) const {
|
||||
File.getDisplayDecls(results);
|
||||
}
|
||||
@@ -451,3 +461,10 @@ SerializedASTFile::getDiscriminatorForPrivateValue(const ValueDecl *D) const {
|
||||
assert(!discriminator.empty() && "no discriminator found for value");
|
||||
return discriminator;
|
||||
}
|
||||
|
||||
Identifier
|
||||
SerializedASTFile::getDiscriminatorForLocalValue(const ValueDecl *D) const {
|
||||
Identifier discriminator = File.getDiscriminatorForLocalValue(D);
|
||||
assert(!discriminator.empty() && "no discriminator found for value");
|
||||
return discriminator;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user