-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathDocFormat.h
85 lines (72 loc) · 2.94 KB
/
DocFormat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//===--- DocFormat.h - The internals of swiftdoc files ----------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
///
/// \file Contains various constants and helper types to deal with serialized
/// documentation info (swiftdoc files).
///
//===----------------------------------------------------------------------===//
#ifndef SWIFT_SERIALIZATION_DOCFORMAT_H
#define SWIFT_SERIALIZATION_DOCFORMAT_H
#include "llvm/Bitcode/RecordLayout.h"
namespace swift {
namespace serialization {
using llvm::BCArray;
using llvm::BCBlob;
using llvm::BCFixed;
using llvm::BCGenericRecordLayout;
using llvm::BCRecordLayout;
using llvm::BCVBR;
/// Magic number for serialized documentation files.
const unsigned char SWIFTDOC_SIGNATURE[] = { 0xE2, 0x9C, 0xA8, 0x07 };
/// Serialized swiftdoc format major version number.
///
/// Increment this value when making a backwards-incompatible change, which
/// should be rare. When incrementing this value, reset SWIFTDOC_VERSION_MINOR
/// to 0.
const uint16_t SWIFTDOC_VERSION_MAJOR = 1;
/// Serialized swiftdoc format minor version number.
///
/// Increment this value when making a backwards-compatible change that might
/// be interesting to test for. However, if old swiftdoc files are fully
/// compatible with the new change, you do not need to increment this.
///
/// To ensure that two separate changes don't silently get merged into one
/// in source control, you should also update the comment to briefly
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t SWIFTDOC_VERSION_MINOR = 1; // Last change: skipping 0 for testing purposes
/// The record types within the comment block.
///
/// Be very careful when changing this block; it must remain stable. Adding new
/// records is okay---they will be ignored---but modifying existing ones must be
/// done carefully. You may need to update the version when you do so.
///
/// \sa COMMENT_BLOCK_ID
namespace comment_block {
enum RecordKind {
DECL_COMMENTS = 1,
GROUP_NAMES = 2,
};
using DeclCommentListLayout = BCRecordLayout<
DECL_COMMENTS, // record ID
BCVBR<16>, // table offset within the blob (an llvm::OnDiskHashTable)
BCBlob // map from Decl USRs to comments
>;
using GroupNamesLayout = BCRecordLayout<
GROUP_NAMES, // record ID
BCBlob // actual names
>;
} // namespace comment_block
} // end namespace serialization
} // end namespace swift
#endif