mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SR-8081] Store @_implements synonyms in .swiftmodules.
This commit is contained in:
@@ -55,7 +55,7 @@ const uint16_t VERSION_MAJOR = 0;
|
||||
/// 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 VERSION_MINOR = 448; // Last change: assoc type default is interface type
|
||||
const uint16_t VERSION_MINOR = 449; // Last change: serialize @_implements names
|
||||
|
||||
using DeclIDField = BCFixed<31>;
|
||||
|
||||
|
||||
@@ -1814,6 +1814,16 @@ void Serializer::writeMembers(DeclID parentID,
|
||||
(*memberTable)[parentID].push_back(memberID);
|
||||
}
|
||||
|
||||
// Same as above, but for @_implements attributes
|
||||
if (auto A = VD->getAttrs().getAttribute<ImplementsAttr>()) {
|
||||
std::unique_ptr<DeclMembersTable> &memberTable =
|
||||
DeclMemberNames[A->getMemberName().getBaseName()].second;
|
||||
if (!memberTable) {
|
||||
memberTable = llvm::make_unique<DeclMembersTable>();
|
||||
}
|
||||
(*memberTable)[parentID].push_back(memberID);
|
||||
}
|
||||
|
||||
// Possibly add a record to ClassMembersForDynamicLookup too.
|
||||
if (isClass) {
|
||||
if (VD->canBeAccessedByDynamicLookup()) {
|
||||
|
||||
33
test/attr/attr_implements_serial.swift
Normal file
33
test/attr/attr_implements_serial.swift
Normal file
@@ -0,0 +1,33 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: echo 'client()' >%t/main.swift
|
||||
// RUN: %target-swiftc_driver -module-name AttrImplFP -emit-module -emit-module-path %t/AttrImplFP.swiftmodule -emit-library -o %t/library.%target-dylib-extension %S/attr_implements_fp.swift
|
||||
// RUN: %target-swiftc_driver -I %t -o %t/a.out %s %t/main.swift %t/library.%target-dylib-extension
|
||||
// RUN: %target-run %t/a.out | %FileCheck %s
|
||||
// REQUIRES: executable_test
|
||||
|
||||
// This test just checks that the lookup-table entries for @_implements are
|
||||
// also written-to and read-from serialized .swiftmodules
|
||||
|
||||
import AttrImplFP
|
||||
|
||||
public func client() {
|
||||
assert(compare_Comparables(Fauxt.one, Fauxt.two))
|
||||
assert(comparedAsComparablesCount == 1)
|
||||
// CHECK: compared as Comparables
|
||||
assert(compare_Comparables(Fauxt.one, Fauxt.nan))
|
||||
assert(comparedAsComparablesCount == 2)
|
||||
// CHECK: compared as Comparables
|
||||
assert(!compare_Comparables(Fauxt.nan, Fauxt.one))
|
||||
assert(comparedAsComparablesCount == 3)
|
||||
// CHECK: compared as Comparables
|
||||
|
||||
assert(compare_Fauxts(Fauxt.one, Fauxt.two))
|
||||
assert(comparedAsFauxtsCount == 1)
|
||||
// CHECK: compared as Fauxts
|
||||
assert(!compare_Fauxts(Fauxt.one, Fauxt.nan))
|
||||
assert(comparedAsFauxtsCount == 2)
|
||||
// CHECK: compared as Fauxts
|
||||
assert(!compare_Fauxts(Fauxt.nan, Fauxt.one))
|
||||
assert(comparedAsFauxtsCount == 3)
|
||||
// CHECK: compared as Fauxts
|
||||
}
|
||||
Reference in New Issue
Block a user