mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[serialization] Load the decl and type offset arrays from the module.
...but don't do anything with them yet. This does check that they're being correctly serialized, though. This introduces a new ADT, PointerIntUnion, which like PointerUnion is an efficient variant type using the lowest bit of data as a discriminator. By default, the union can store any pointer-bits-minus-one-sized integer, but both the integer type and the underlying storage type can be customized. Swift SVN r5321
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
#ifndef SWIFT_SERIALIZATION_MODULEFILE_H
|
||||
#define SWIFT_SERIALIZATION_MODULEFILE_H
|
||||
|
||||
#include "ModuleFormat.h"
|
||||
#include "swift/AST/Type.h"
|
||||
#include "swift/Basic/PointerIntUnion.h"
|
||||
#include "swift/Basic/LLVM.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
@@ -25,6 +28,7 @@ namespace llvm {
|
||||
}
|
||||
|
||||
namespace swift {
|
||||
class Decl;
|
||||
|
||||
/// Describes whether a loaded module can be used.
|
||||
enum class ModuleStatus {
|
||||
@@ -53,9 +57,19 @@ class ModuleFile {
|
||||
/// The reader attached to InputFile.
|
||||
llvm::BitstreamReader InputReader;
|
||||
|
||||
/// The cursor used to lazily load things from the file.
|
||||
llvm::BitstreamCursor In;
|
||||
|
||||
/// Paths to the source files used to build this module.
|
||||
SmallVector<StringRef, 4> SourcePaths;
|
||||
|
||||
/// Decls referenced by this module.
|
||||
std::vector<PointerIntUnion<const Decl *, serialization::BitOffset,
|
||||
uint64_t>> Decls;
|
||||
|
||||
/// Types referenced by this module.
|
||||
std::vector<PointerIntUnion<Type, serialization::BitOffset, uint64_t>> Types;
|
||||
|
||||
/// Whether this module file can be used.
|
||||
ModuleStatus Status;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user