Introduce the ObjCSelector class to store an Objective-C selector.

We have to work with selectors quite often, so provide an efficient
representation for them. Switch ObjCAttr over to this representation,
which has the nice property that it efficiently represents implicit
@objc attributes with names and allows us to overwrite the Objective-C
name without losing all source information. Addresses
<rdar://problem/16478678>, and sets us up for dealing with selectors
better.

Swift SVN r16327
This commit is contained in:
Doug Gregor
2014-04-14 20:05:35 +00:00
parent 18bf604360
commit cd4ca76b6a
13 changed files with 331 additions and 362 deletions

View File

@@ -40,7 +40,7 @@ const uint16_t VERSION_MAJOR = 0;
/// Serialized module format minor version number.
///
/// When the format changes IN ANY WAY, this number should be incremented.
const uint16_t VERSION_MINOR = 56;
const uint16_t VERSION_MINOR = 57;
using DeclID = Fixnum<31>;
using DeclIDField = BCFixed<31>;
@@ -200,15 +200,6 @@ enum LibraryKind : uint8_t {
};
using LibraryKindField = BCFixed<1>;
// These IDs must \em not be renumbered or reordered without incrementing
// VERSION_MAJOR.
enum ObjCDeclAttrKind : uint8_t {
Unnamed,
Nullary,
Selector,
};
using ObjCDeclAttrKindField = BCFixed<2>;
// These IDs must \em not be renumbered or reordered without incrementing
// VERSION_MAJOR. Adding a new ID requires adding a byte of overhead to the
// identifier table in Serializer::writeAllIdentifiers.
@@ -982,7 +973,7 @@ namespace decls_block {
using ObjCDeclAttrLayout = BCRecordLayout<
ObjC_DECL_ATTR,
BCFixed<1>, // implicit flag
ObjCDeclAttrKindField, // kind
BCVBR<4>, // # of arguments (+1) or zero if no name
BCArray<IdentifierIDField>
>;