mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[serialization] Codify the bringup hack with a special note in the module file.
The bringup hack, again, is to just process the module source files as a TranslationUnit if the module doesn't accurately represent the original source. Currently this happens if the module is not empty, or if it imports /anything/, since we don't actually serialize anything yet. This also cleans up the decl/type serialization skeleton a bit. Swift SVN r5238
This commit is contained in:
@@ -65,7 +65,7 @@ ModuleFile::ModuleFile(llvm::OwningPtr<llvm::MemoryBuffer> &&input)
|
||||
: InputFile(std::move(input)),
|
||||
InputReader(reinterpret_cast<const uint8_t *>(InputFile->getBufferStart()),
|
||||
reinterpret_cast<const uint8_t *>(InputFile->getBufferEnd())),
|
||||
Status(ModuleStatus::FallBackToTranslationUnit) {
|
||||
Status(ModuleStatus::Valid) {
|
||||
llvm::BitstreamCursor cursor{InputReader};
|
||||
|
||||
for (unsigned char byte : SIGNATURE) {
|
||||
@@ -129,6 +129,11 @@ ModuleFile::ModuleFile(llvm::OwningPtr<llvm::MemoryBuffer> &&input)
|
||||
break;
|
||||
}
|
||||
|
||||
case FALL_BACK_TO_TRANSLATION_UNIT_ID:
|
||||
// This is a bring-up hack and will eventually go away.
|
||||
Status = ModuleStatus::FallBackToTranslationUnit;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Unknown top-level block, possibly for use by a future version of the
|
||||
// module format.
|
||||
|
||||
Reference in New Issue
Block a user