Skip to content

Commit 018c929

Browse files
committed
---
yaml --- r: 345067 b: refs/heads/master c: e31046d h: refs/heads/master i: 345065: f713ae9 345063: 774de99
1 parent 3fc2fc9 commit 018c929

File tree

13 files changed

+539
-447
lines changed

13 files changed

+539
-447
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: c8e9965725c921369f6812fe66aa8f8fea3f9165
2+
refs/heads/master: e31046dbba30f9a375191f4a1afba9fa14638781
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/docs/ByteTree.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Arrays are modelled as objects whose fields are all of the same type and whose l
2121

2222
## Versioning
2323

24-
The ByteTree format is prepended by a 4-byte protocol version number that describes the version of the object tree that was serialized. Its exact semantics are up to each specific application, but it is encouraged to interpret it as a two-comentent number where the first component, consisting of the first three bytes, is incremented for breaking changes and the last byte is incremented for backwards-compatible changes.
24+
The ByteTree format is prepended by a 4-byte protocol version number that describes the version of the object tree that was serialized. Its exact semantics are up to each specific application, but it is encouraged to interpret it as a two-comentent number where the first component, consisting of the three most significant bytes, is incremented for breaking changes and the last byte is incremented for backwards-compatible changes.
2525

2626
## Forward compatilibity
2727

trunk/include/swift/Syntax/Serialization/SyntaxSerialization.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,20 @@ struct NullableTraits<RC<syntax::RawSyntax>> {
203203

204204
namespace byteTree {
205205

206+
/// Increase the major version for every change that is not just adding a new
207+
/// field at the end of an object. Older swiftSyntax clients will no longer be
208+
/// able to deserialize the format.
209+
const uint16_t SYNTAX_TREE_VERSION_MAJOR = 1; // Last change: initial version
210+
/// Increase the minor version if only new field has been added at the end of
211+
/// an object. Older swiftSyntax clients will still be able to deserialize the
212+
/// format.
213+
const uint8_t SYNTAX_TREE_VERSION_MINOR = 0; // Last change: initial version
214+
215+
// Combine the major and minor version into one. The first three bytes
216+
// represent the major version, the last byte the minor version.
217+
const uint32_t SYNTAX_TREE_VERSION =
218+
SYNTAX_TREE_VERSION_MAJOR << 8 | SYNTAX_TREE_VERSION_MINOR;
219+
206220
/// The key for a ByteTree serializion user info of type
207221
/// `std::unordered_set<unsigned> *`. Specifies the IDs of syntax nodes that
208222
/// shall be omitted when the syntax tree gets serialized.

0 commit comments

Comments
 (0)