Skip to content
This repository was archived by the owner on Mar 29, 2019. It is now read-only.

Commit b855367

Browse files
author
Zhang
committed
Add missing folder
1 parent 422ce79 commit b855367

File tree

5,158 files changed

+2438220
-20
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,158 files changed

+2438220
-20
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ dist/
4646
downloads/
4747
eggs/
4848
.eggs/
49-
lib/
5049
lib64/
5150
parts/
5251
sdist/
Lines changed: 308 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
1+
//===--- APINotesFormat.h - The internals of API notes files ----*- C++ -*-===//
2+
//
3+
// The LLVM Compiler Infrastructure
4+
//
5+
// This file is distributed under the University of Illinois Open Source
6+
// License. See LICENSE.TXT for details.
7+
//
8+
//===----------------------------------------------------------------------===//
9+
///
10+
/// \file
11+
/// \brief Contains various constants and helper types to deal with API notes
12+
/// files.
13+
///
14+
//===----------------------------------------------------------------------===//
15+
#ifndef LLVM_CLANG_API_NOTES_FORMAT_H
16+
#define LLVM_CLANG_API_NOTES_FORMAT_H
17+
18+
#include "llvm/ADT/DenseMapInfo.h"
19+
#include "llvm/ADT/Hashing.h"
20+
#include "llvm/ADT/PointerEmbeddedInt.h"
21+
#include "llvm/ADT/SmallVector.h"
22+
#include "llvm/Bitcode/RecordLayout.h"
23+
24+
namespace clang {
25+
namespace api_notes {
26+
27+
using namespace llvm;
28+
29+
/// Magic number for API notes files.
30+
const unsigned char API_NOTES_SIGNATURE[] = { 0xE2, 0x9C, 0xA8, 0x01 };
31+
32+
/// API notes file major version number.
33+
///
34+
const uint16_t VERSION_MAJOR = 0;
35+
36+
/// API notes file minor version number.
37+
///
38+
/// When the format changes IN ANY WAY, this number should be incremented.
39+
const uint16_t VERSION_MINOR = 24; // EnumExtensibility+FlagEnum
40+
41+
using IdentifierID = PointerEmbeddedInt<unsigned, 31>;
42+
using IdentifierIDField = BCVBR<16>;
43+
44+
using SelectorID = PointerEmbeddedInt<unsigned, 31>;
45+
using SelectorIDField = BCVBR<16>;
46+
47+
using StoredContextID = PointerEmbeddedInt<unsigned, 31>;
48+
49+
/// The various types of blocks that can occur within a API notes file.
50+
///
51+
/// These IDs must \em not be renumbered or reordered without incrementing
52+
/// VERSION_MAJOR.
53+
enum BlockID {
54+
/// The control block, which contains all of the information that needs to
55+
/// be validated prior to committing to loading the API notes file.
56+
///
57+
/// \sa control_block
58+
CONTROL_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID,
59+
60+
/// The identifier data block, which maps identifier strings to IDs.
61+
IDENTIFIER_BLOCK_ID,
62+
63+
/// The Objective-C context data block, which contains information about
64+
/// Objective-C classes and protocols.
65+
OBJC_CONTEXT_BLOCK_ID,
66+
67+
/// The Objective-C property data block, which maps Objective-C
68+
/// (class name, property name) pairs to information about the
69+
/// property.
70+
OBJC_PROPERTY_BLOCK_ID,
71+
72+
/// The Objective-C property data block, which maps Objective-C
73+
/// (class name, selector, is_instance_method) tuples to information
74+
/// about the method.
75+
OBJC_METHOD_BLOCK_ID,
76+
77+
/// The Objective-C selector data block, which maps Objective-C
78+
/// selector names (# of pieces, identifier IDs) to the selector ID
79+
/// used in other tables.
80+
OBJC_SELECTOR_BLOCK_ID,
81+
82+
/// The global variables data block, which maps global variable names to
83+
/// information about the global variable.
84+
GLOBAL_VARIABLE_BLOCK_ID,
85+
86+
/// The (global) functions data block, which maps global function names to
87+
/// information about the global function.
88+
GLOBAL_FUNCTION_BLOCK_ID,
89+
90+
/// The tag data block, which maps tag names to information about
91+
/// the tags.
92+
TAG_BLOCK_ID,
93+
94+
/// The typedef data block, which maps typedef names to information about
95+
/// the typedefs.
96+
TYPEDEF_BLOCK_ID,
97+
98+
/// The enum constant data block, which maps enumerator names to
99+
/// information about the enumerators.
100+
ENUM_CONSTANT_BLOCK_ID,
101+
};
102+
103+
namespace control_block {
104+
// These IDs must \em not be renumbered or reordered without incrementing
105+
// VERSION_MAJOR.
106+
enum {
107+
METADATA = 1,
108+
MODULE_NAME = 2,
109+
MODULE_OPTIONS = 3,
110+
SOURCE_FILE = 4,
111+
};
112+
113+
using MetadataLayout = BCRecordLayout<
114+
METADATA, // ID
115+
BCFixed<16>, // Module format major version
116+
BCFixed<16> // Module format minor version
117+
>;
118+
119+
using ModuleNameLayout = BCRecordLayout<
120+
MODULE_NAME,
121+
BCBlob // Module name
122+
>;
123+
124+
using ModuleOptionsLayout = BCRecordLayout<
125+
MODULE_OPTIONS,
126+
BCFixed<1> // SwiftInferImportAsMember
127+
>;
128+
129+
using SourceFileLayout = BCRecordLayout<
130+
SOURCE_FILE,
131+
BCVBR<16>, // file size
132+
BCVBR<16> // creation time
133+
>;
134+
}
135+
136+
namespace identifier_block {
137+
enum {
138+
IDENTIFIER_DATA = 1,
139+
};
140+
141+
using IdentifierDataLayout = BCRecordLayout<
142+
IDENTIFIER_DATA, // record ID
143+
BCVBR<16>, // table offset within the blob (see below)
144+
BCBlob // map from identifier strings to decl kinds / decl IDs
145+
>;
146+
}
147+
148+
namespace objc_context_block {
149+
enum {
150+
OBJC_CONTEXT_ID_DATA = 1,
151+
OBJC_CONTEXT_INFO_DATA = 2,
152+
};
153+
154+
using ObjCContextIDLayout = BCRecordLayout<
155+
OBJC_CONTEXT_ID_DATA, // record ID
156+
BCVBR<16>, // table offset within the blob (see below)
157+
BCBlob // map from ObjC class names/protocol (as IDs) to context IDs
158+
>;
159+
160+
using ObjCContextInfoLayout = BCRecordLayout<
161+
OBJC_CONTEXT_INFO_DATA, // record ID
162+
BCVBR<16>, // table offset within the blob (see below)
163+
BCBlob // map from ObjC context IDs to context information.
164+
>;
165+
}
166+
167+
namespace objc_property_block {
168+
enum {
169+
OBJC_PROPERTY_DATA = 1,
170+
};
171+
172+
using ObjCPropertyDataLayout = BCRecordLayout<
173+
OBJC_PROPERTY_DATA, // record ID
174+
BCVBR<16>, // table offset within the blob (see below)
175+
BCBlob // map from ObjC (class name, property name) pairs to ObjC
176+
// property information
177+
>;
178+
}
179+
180+
namespace objc_method_block {
181+
enum {
182+
OBJC_METHOD_DATA = 1,
183+
};
184+
185+
using ObjCMethodDataLayout = BCRecordLayout<
186+
OBJC_METHOD_DATA, // record ID
187+
BCVBR<16>, // table offset within the blob (see below)
188+
BCBlob // map from ObjC (class names, selector,
189+
// is-instance-method) tuples to ObjC method information
190+
>;
191+
}
192+
193+
namespace objc_selector_block {
194+
enum {
195+
OBJC_SELECTOR_DATA = 1,
196+
};
197+
198+
using ObjCSelectorDataLayout = BCRecordLayout<
199+
OBJC_SELECTOR_DATA, // record ID
200+
BCVBR<16>, // table offset within the blob (see below)
201+
BCBlob // map from (# pieces, identifier IDs) to Objective-C selector ID.
202+
>;
203+
}
204+
205+
namespace global_variable_block {
206+
enum {
207+
GLOBAL_VARIABLE_DATA = 1
208+
};
209+
210+
using GlobalVariableDataLayout = BCRecordLayout<
211+
GLOBAL_VARIABLE_DATA, // record ID
212+
BCVBR<16>, // table offset within the blob (see below)
213+
BCBlob // map from name to global variable information
214+
>;
215+
}
216+
217+
namespace global_function_block {
218+
enum {
219+
GLOBAL_FUNCTION_DATA = 1
220+
};
221+
222+
using GlobalFunctionDataLayout = BCRecordLayout<
223+
GLOBAL_FUNCTION_DATA, // record ID
224+
BCVBR<16>, // table offset within the blob (see below)
225+
BCBlob // map from name to global function information
226+
>;
227+
}
228+
229+
namespace tag_block {
230+
enum {
231+
TAG_DATA = 1
232+
};
233+
234+
using TagDataLayout = BCRecordLayout<
235+
TAG_DATA, // record ID
236+
BCVBR<16>, // table offset within the blob (see below)
237+
BCBlob // map from name to tag information
238+
>;
239+
};
240+
241+
namespace typedef_block {
242+
enum {
243+
TYPEDEF_DATA = 1
244+
};
245+
246+
using TypedefDataLayout = BCRecordLayout<
247+
TYPEDEF_DATA, // record ID
248+
BCVBR<16>, // table offset within the blob (see below)
249+
BCBlob // map from name to typedef information
250+
>;
251+
};
252+
253+
namespace enum_constant_block {
254+
enum {
255+
ENUM_CONSTANT_DATA = 1
256+
};
257+
258+
using EnumConstantDataLayout = BCRecordLayout<
259+
ENUM_CONSTANT_DATA, // record ID
260+
BCVBR<16>, // table offset within the blob (see below)
261+
BCBlob // map from name to enumerator information
262+
>;
263+
}
264+
265+
/// A stored Objective-C selector.
266+
struct StoredObjCSelector {
267+
unsigned NumPieces;
268+
llvm::SmallVector<IdentifierID, 2> Identifiers;
269+
};
270+
271+
} // end namespace api_notes
272+
} // end namespace clang
273+
274+
namespace llvm {
275+
template<>
276+
struct DenseMapInfo<clang::api_notes::StoredObjCSelector> {
277+
typedef DenseMapInfo<unsigned> UnsignedInfo;
278+
279+
static inline clang::api_notes::StoredObjCSelector getEmptyKey() {
280+
return clang::api_notes::StoredObjCSelector{
281+
UnsignedInfo::getEmptyKey(), { } };
282+
}
283+
284+
static inline clang::api_notes::StoredObjCSelector getTombstoneKey() {
285+
return clang::api_notes::StoredObjCSelector{
286+
UnsignedInfo::getTombstoneKey(), { } };
287+
}
288+
289+
static unsigned getHashValue(
290+
const clang::api_notes::StoredObjCSelector& value) {
291+
auto hash = llvm::hash_value(value.NumPieces);
292+
hash = hash_combine(hash, value.Identifiers.size());
293+
for (auto piece : value.Identifiers)
294+
hash = hash_combine(hash, static_cast<unsigned>(piece));
295+
// FIXME: Mix upper/lower 32-bit values together to produce
296+
// unsigned rather than truncating.
297+
return hash;
298+
}
299+
300+
static bool isEqual(const clang::api_notes::StoredObjCSelector &lhs,
301+
const clang::api_notes::StoredObjCSelector &rhs) {
302+
return lhs.NumPieces == rhs.NumPieces &&
303+
lhs.Identifiers == rhs.Identifiers;
304+
}
305+
};
306+
}
307+
308+
#endif // LLVM_CLANG_API_NOTES_FORMAT_H

0 commit comments

Comments
 (0)