Teach the Mach-O-based AST importer to accept bare serialized ASTs.

This necessitated adding a new function to validate a serialized AST, so
that we can get the same information that used to be extracted from the
section header.

For now, we'll continue accepting the wrapped ASTs as well, since we
haven't changed the existing debug info generator.

Swift SVN r12922
This commit is contained in:
Jordan Rose
2014-01-24 18:42:07 +00:00
parent af700a1912
commit cc3119be51
6 changed files with 196 additions and 78 deletions

View File

@@ -253,12 +253,11 @@ SerializedModuleLoader::loadDeclsConformingTo(KnownProtocolKind kind,
}
}
bool
SerializedModuleLoader::isValidSerializedAST(const llvm::MemoryBuffer &input) {
bool SerializedModuleLoader::isSerializedAST(StringRef data) {
using serialization::SIGNATURE;
StringRef signatureStr(reinterpret_cast<const char *>(SIGNATURE),
llvm::array_lengthof(SIGNATURE));
return input.getBuffer().startswith(signatureStr);
return data.startswith(signatureStr);
}
//-----------------------------------------------------------------------------