[serialization] Add a metaprogramming system for bitcode record layout.

Alternately, "add a system of ridiculous overkill for bitcode record layout",
in the spirit of DRY over YAGNI. It /is/ much more concise than the LLVM way.

Use this to emit a sketch of Clang's PCH control block, although nothing's in
there yet besides "version 1.0" and the LLVM revision number; the latter is
more "proof of concept" than actually useful. We should figure out a good
way to identify trunk Swift compilers; this shouldn't be difficult.

Swift SVN r5107
This commit is contained in:
Jordan Rose
2013-05-08 23:29:52 +00:00
parent 5e5172fcf3
commit c8ecd0ba25
4 changed files with 391 additions and 2 deletions

View File

@@ -18,5 +18,41 @@
#define SWIFT_SERIALIZATION_H
#include "swift/Basic/LLVM.h"
#include "llvm/Bitcode/BitCodes.h"
namespace swift {
namespace serialization {
/// Serialized module format major version number.
///
/// When the format changes in such a way that older compilers will not be
/// able to read the file at all, this number should be incremented.
const unsigned VERSION_MAJOR = 1;
/// Serialized module format minor version number.
///
/// When the format changes in a backwards-compatible way, this number should
/// be incremented.
const unsigned VERSION_MINOR = 0;
/// The various types of blocks that can occur within a serialized Swift
/// module.
enum BlockID {
/// The control block, which contains all of the information that needs to
/// be validated prior to committing to loading the serialized module.
///
/// \sa ControlRecordType
CONTROL_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID
};
/// The record types within the control block.
///
/// \sa CONTROL_BLOCK_ID
enum ControlRecordType {
METADATA = 1
};
} // end namespace serialization
} // end namespace swift
#endif