Skip to content

Commit 6f367ae

Browse files
authored
---
yaml --- r: 229374 b: refs/heads/master-next c: ca4898f h: refs/heads/master
1 parent 1f070e7 commit 6f367ae

File tree

70 files changed

+1339
-418
lines changed

Some content is hidden

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

70 files changed

+1339
-418
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: a37c1f05e28110b00b679c219d162d85a7e2b546
3-
refs/heads/master-next: 9ae572f83f9edbb62464bbe1ab62fa176a3bfdea
3+
refs/heads/master-next: ca4898fbbf83bca9dcc3617e050f105433dbb174
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,10 @@ endif()
775775
# Should we cross-compile the standard library for Windows?
776776
is_sdk_requested(WINDOWS swift_build_windows)
777777
if(swift_build_windows AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
778-
configure_sdk_windows(WINDOWS "Windows" "msvc" "aarch64;armv7;i686;x86_64")
778+
if("${SWIFT_SDK_WINDOWS_ARCHITECTURES}" STREQUAL "")
779+
set(SWIFT_SDK_WINDOWS_ARCHITECTURES aarch64;armv7;i686;x86_64)
780+
endif()
781+
configure_sdk_windows(WINDOWS "Windows" "msvc" "${SWIFT_SDK_WINDOWS_ARCHITECTURES}")
779782
endif()
780783

781784
if("${SWIFT_SDKS}" STREQUAL "")

branches/master-next/cmake/modules/AddSwift.cmake

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,11 @@ function(_add_variant_c_compile_link_flags)
132132
endif()
133133

134134
if("${CFLAGS_SDK}" STREQUAL "ANDROID")
135-
list(APPEND result
136-
"--sysroot=${SWIFT_SDK_ANDROID_ARCH_${CFLAGS_ARCH}_PATH}"
137-
# Use the linker included in the Android NDK.
138-
"-B" "${SWIFT_SDK_ANDROID_ARCH_${CFLAGS_ARCH}_NDK_PREBUILT_PATH}/${SWIFT_SDK_ANDROID_ARCH_${CFLAGS_ARCH}_NDK_TRIPLE}/bin/")
135+
# lld can handle targeting the android build. However, if lld is not
136+
# enabled, then fallback to the linker included in the android NDK.
137+
if(NOT SWIFT_ENABLE_LLD_LINKER)
138+
list(APPEND result "-B" "${SWIFT_SDK_ANDROID_ARCH_${CFLAGS_ARCH}_NDK_PREBUILT_PATH}/${SWIFT_SDK_ANDROID_ARCH_${CFLAGS_ARCH}_NDK_TRIPLE}/bin")
139+
endif()
139140
endif()
140141

141142
if(IS_DARWIN)
@@ -227,8 +228,8 @@ function(_add_variant_c_compile_flags)
227228
# -D_MD or D_MDd either, as CMake does this automatically.
228229
if(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
229230
list(APPEND result -Xclang;--dependent-lib=oldnames)
230-
# TODO(compnerd) handle /MT, /MTd, /MD, /MDd
231-
if("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
231+
# TODO(compnerd) handle /MT, /MTd
232+
if("${CFLAGS_BUILD_TYPE}" STREQUAL "Debug")
232233
list(APPEND result "-D_MDd")
233234
list(APPEND result -Xclang;--dependent-lib=msvcrtd)
234235
else()

branches/master-next/docs/ABI/Mangling.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Globals
6464
global ::= context 'MXE' // extension descriptor
6565
global ::= context 'MXX' // anonymous context descriptor
6666
global ::= context identifier 'MXY' // anonymous context descriptor
67-
global ::= type assoc_type_path 'MXA' // generic parameter ref
67+
global ::= type assoc-type-list 'MXA' // generic parameter ref
6868
global ::= protocol 'Mp' // protocol descriptor
6969

7070
global ::= nominal-type 'Mo' // class metadata immediate member base offset
@@ -91,15 +91,13 @@ Globals
9191
global ::= type protocol-conformance 'WL' // lazy protocol witness table cache variable
9292

9393
global ::= protocol-conformance identifier 'Wt' // associated type metadata accessor
94-
global ::= protocol-conformance assoc_type_path nominal-type 'WT' // associated type witness table accessor
94+
global ::= protocol-conformance assoc-type-list nominal-type 'WT' // associated type witness table accessor
9595
global ::= type protocol-conformance 'Wl' // lazy protocol witness table accessor
9696

9797
global ::= type 'WV' // value witness table
9898
global ::= entity 'Wvd' // field offset
9999
global ::= entity 'WC' // resilient enum tag index
100100

101-
assoc_type_path ::= identifier '_' identifier*
102-
103101
A direct symbol resolves directly to the address of an object. An
104102
indirect symbol resolves to the address of a pointer to the object.
105103
They are distinct manglings to make a certain class of bugs

branches/master-next/docs/WindowsBuild.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,12 @@ pushd "%swift_source_dir%/build/Ninja-DebugAssert/swift-windows-amd64"
233233
cmake -G "Ninja" "%swift_source_dir%/swift"^
234234
-DCMAKE_BUILD_TYPE=Debug^
235235
-DSWIFT_PATH_TO_CMARK_SOURCE="%swift_source_dir%/cmark"^
236-
-DSWIFT_PATH_TO_CMARK_BUILD="%swift_source_dir%/build/Ninja-RelWithDebInfoAssert/cmark-windows-amd64"^
237-
-DSWIFT_CMARK_LIBRARY_DIR="%swift_source_dir%/build/Ninja-RelWithDebInfoAssert/cmark-windows-amd64/src"^
236+
-DSWIFT_PATH_TO_CMARK_BUILD="%swift_source_dir%/build/Ninja-DebugAssert/cmark-windows-amd64"^
237+
-DSWIFT_CMARK_LIBRARY_DIR="%swift_source_dir%/build/Ninja-DebugAssert/cmark-windows-amd64/src"^
238238
-DSWIFT_PATH_TO_LLVM_SOURCE="%swift_source_dir%/llvm"^
239-
-DSWIFT_PATH_TO_LLVM_BUILD="%swift_source_dir%/build/Ninja-RelWithDebInfoAssert/llvm-windows-amd64"^
239+
-DSWIFT_PATH_TO_LLVM_BUILD="%swift_source_dir%/build/Ninja-DebugAssert/llvm-windows-amd64"^
240240
-DSWIFT_PATH_TO_CLANG_SOURCE="%swift_source_dir%/llvm/tools/clang"^
241-
-DSWIFT_PATH_TO_CLANG_BUILD="%swift_source_dir%/build/Ninja-RelWithDebInfoAssert/llvm-windows-amd64"^
241+
-DSWIFT_PATH_TO_CLANG_BUILD="%swift_source_dir%/build/Ninja-DebugAssert/llvm-windows-amd64"^
242242
-DICU_UC_INCLUDE_DIRS="%swift_source_dir%/icu/include"^
243243
-DICU_UC_LIBRARY_DIRS="%swift_source_dir%/icu/lib64"^
244244
-DICU_I18N_INCLUDE_DIRS="%swift_source_dir%/icu/include"^

branches/master-next/include/swift/AST/Decl.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,18 +3116,26 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
31163116
/// called to make it immediately visible.
31173117
void makeMemberVisible(ValueDecl *member);
31183118

3119+
/// Special-behaviour flags passed to lookupDirect()
3120+
enum class LookupDirectFlags {
3121+
/// Whether to avoid loading any new extension.
3122+
/// Used by the module loader to break recursion.
3123+
IgnoreNewExtensions = 1 << 0,
3124+
/// Whether to include @_implements members.
3125+
/// Used by conformance-checking to find special @_implements members.
3126+
IncludeAttrImplements = 1 << 1,
3127+
};
3128+
31193129
/// Find all of the declarations with the given name within this nominal type
31203130
/// and its extensions.
31213131
///
31223132
/// This routine does not look into superclasses, nor does it consider
31233133
/// protocols to which the nominal type conforms. Furthermore, the resulting
31243134
/// set of declarations has not been filtered for visibility, nor have
31253135
/// overridden declarations been removed.
3126-
///
3127-
/// \param ignoreNewExtensions Whether to avoid loading any new extension.
3128-
/// Used by the module loader to break recursion.
31293136
TinyPtrVector<ValueDecl *> lookupDirect(DeclName name,
3130-
bool ignoreNewExtensions = false);
3137+
OptionSet<LookupDirectFlags> flags =
3138+
OptionSet<LookupDirectFlags>());
31313139

31323140
/// Collect the set of protocols to which this type should implicitly
31333141
/// conform, such as AnyObject (for classes).

branches/master-next/include/swift/AST/DiagnosticsModuleDiffer.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ ERROR(raw_type_change,none,"%0(%1) is now %2 representable", (StringRef, StringR
4242

4343
ERROR(removed_decl,none,"%0 has been removed%select{| (deprecated)}1", (StringRef, bool))
4444

45+
ERROR(removed_setter,none,"%0 has removed its setter", (StringRef))
46+
4547
ERROR(moved_decl,none,"%0 has been moved to %1", (StringRef, StringRef))
4648

4749
ERROR(renamed_decl,none,"%0 has been renamed to %1", (StringRef, StringRef))
@@ -64,6 +66,8 @@ ERROR(conformance_added,none,"%0 has added inherited protocol %1", (StringRef, S
6466

6567
ERROR(default_associated_type_removed,none,"%0 has removed default type %1", (StringRef, StringRef))
6668

69+
ERROR(protocol_req_added,none,"%0 has been added as a protocol requirement", (StringRef))
70+
6771
#ifndef DIAG_NO_UNDEF
6872
# if defined(DIAG)
6973
# undef DIAG

branches/master-next/include/swift/AST/DiagnosticsSema.def

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,24 +1541,23 @@ ERROR(types_not_equal,none,
15411541
ERROR(type_does_not_conform_owner,none,
15421542
"%0 requires that %1 conform to %2", (Type, Type, Type))
15431543
ERROR(type_does_not_conform_in_decl_ref,none,
1544-
"referencing %0 %select{%2 |}1on %3 requires that %4 conform to %5",
1545-
(DescriptiveDeclKind, bool, DeclName, Type, Type, Type))
1544+
"referencing %0 %1 on %2 requires that %3 conform to %4",
1545+
(DescriptiveDeclKind, DeclName, Type, Type, Type))
15461546
ERROR(type_does_not_conform_decl_owner,none,
1547-
"%0 %select{%2 |}1requires that %3 conform to %4",
1548-
(DescriptiveDeclKind, bool, DeclName, Type, Type))
1547+
"%0 %1 requires that %2 conform to %3",
1548+
(DescriptiveDeclKind, DeclName, Type, Type))
15491549
ERROR(types_not_equal_decl,none,
1550-
"%0 %select{%2 |}1requires the types %3 and %4 be equivalent",
1551-
(DescriptiveDeclKind, bool, DeclName, Type, Type))
1550+
"%0 %1 requires the types %2 and %3 be equivalent",
1551+
(DescriptiveDeclKind, DeclName, Type, Type))
15521552
ERROR(types_not_equal_in_decl_ref,none,
1553-
"referencing %0 %select{%2 |}1on %3 requires the types "
1554-
"%4 and %5 be equivalent",
1555-
(DescriptiveDeclKind, bool, DeclName, Type, Type, Type))
1553+
"referencing %0 %1 on %2 requires the types %3 and %4 be equivalent",
1554+
(DescriptiveDeclKind, DeclName, Type, Type, Type))
15561555
ERROR(types_not_inherited_decl,none,
1557-
"%0 %select{%2 |}1requires that %3 inherit from %4",
1558-
(DescriptiveDeclKind, bool, DeclName, Type, Type))
1556+
"%0 %1 requires that %2 inherit from %3",
1557+
(DescriptiveDeclKind, DeclName, Type, Type))
15591558
ERROR(types_not_inherited_in_decl_ref,none,
1560-
"referencing %0 %select{%2 |}1on %3 requires that %4 inherit from %5",
1561-
(DescriptiveDeclKind, bool, DeclName, Type, Type, Type))
1559+
"referencing %0 %1 on %2 requires that %3 inherit from %4",
1560+
(DescriptiveDeclKind, DeclName, Type, Type, Type))
15621561
NOTE(where_requirement_failure_one_subst,none,
15631562
"where %0 = %1", (Type, Type))
15641563
NOTE(where_requirement_failure_both_subst,none,

branches/master-next/include/swift/AST/LookupKinds.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ enum NLOptions : unsigned {
5757
/// This lookup should only return type declarations.
5858
NL_OnlyTypes = 0x80,
5959

60+
/// Include synonyms declared with @_implements()
61+
NL_IncludeAttributeImplements = 0x100,
62+
6063
/// This lookup is known to not add any additional dependencies to the
6164
/// primary source file.
6265
///

branches/master-next/include/swift/AST/Types.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4088,7 +4088,8 @@ class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode,
40884088
void Profile(llvm::FoldingSetNodeID &ID) {
40894089
Profile(ID, getGenericSignature(), getExtInfo(), getCoroutineKind(),
40904090
getCalleeConvention(), getParameters(), getYields(),
4091-
getResults(), getOptionalErrorResult());
4091+
getResults(), getOptionalErrorResult(),
4092+
getWitnessMethodConformanceOrNone());
40924093
}
40934094
static void Profile(llvm::FoldingSetNodeID &ID,
40944095
GenericSignature *genericSig,
@@ -4098,7 +4099,8 @@ class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode,
40984099
ArrayRef<SILParameterInfo> params,
40994100
ArrayRef<SILYieldInfo> yields,
41004101
ArrayRef<SILResultInfo> results,
4101-
Optional<SILResultInfo> errorResult);
4102+
Optional<SILResultInfo> errorResult,
4103+
Optional<ProtocolConformanceRef> conformance);
41024104

41034105
// Implement isa/cast/dyncast/etc.
41044106
static bool classof(const TypeBase *T) {

branches/master-next/include/swift/IDE/DigesterEnums.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ NODE_KIND(DeclSetter, Setter)
4646
NODE_KIND(DeclVar, Var)
4747
NODE_KIND(DeclTypeAlias, TypeAlias)
4848
NODE_KIND(DeclAssociatedType, AssociatedType)
49+
NODE_KIND(DeclSubscript, Subscript)
4950

5051
NODE_ANNOTATION(Added)
5152
NODE_ANNOTATION(Removed)
@@ -101,6 +102,7 @@ KEY(throwing)
101102
KEY(mutating)
102103
KEY(static)
103104
KEY(deprecated)
105+
KEY(protocolReq)
104106
KEY(implicit)
105107
KEY(typeAttributes)
106108
KEY(declAttributes)
@@ -112,6 +114,7 @@ KEY(conformingProtocols)
112114
KEY(enumRawTypeName)
113115
KEY(genericSig)
114116
KEY(fixedbinaryorder)
117+
KEY(hasSetter)
115118

116119
KNOWN_TYPE(Optional)
117120
KNOWN_TYPE(ImplicitlyUnwrappedOptional)

branches/master-next/include/swift/Serialization/ModuleFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const uint16_t VERSION_MAJOR = 0;
5555
/// describe what change you made. The content of this comment isn't important;
5656
/// it just ensures a conflict if two people change the module format.
5757
/// Don't worry about adhering to the 80-column limit for this line.
58-
const uint16_t VERSION_MINOR = 448; // Last change: assoc type default is interface type
58+
const uint16_t VERSION_MINOR = 449; // Last change: serialize @_implements names
5959

6060
using DeclIDField = BCFixed<31>;
6161

branches/master-next/lib/AST/ASTContext.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3891,7 +3891,8 @@ void SILFunctionType::Profile(llvm::FoldingSetNodeID &id,
38913891
ArrayRef<SILParameterInfo> params,
38923892
ArrayRef<SILYieldInfo> yields,
38933893
ArrayRef<SILResultInfo> results,
3894-
Optional<SILResultInfo> errorResult) {
3894+
Optional<SILResultInfo> errorResult,
3895+
Optional<ProtocolConformanceRef> conformance) {
38953896
id.AddPointer(genericParams);
38963897
id.AddInteger(info.getFuncAttrKey());
38973898
id.AddInteger(unsigned(coroutineKind));
@@ -3909,6 +3910,8 @@ void SILFunctionType::Profile(llvm::FoldingSetNodeID &id,
39093910
// Just allow the profile length to implicitly distinguish the
39103911
// presence of an error result.
39113912
if (errorResult) errorResult->profile(id);
3913+
if (conformance)
3914+
id.AddPointer(conformance->getRequirement());
39123915
}
39133916

39143917
SILFunctionType::SILFunctionType(GenericSignature *genericSig, ExtInfo ext,
@@ -4045,8 +4048,9 @@ CanSILFunctionType SILFunctionType::get(GenericSignature *genericSig,
40454048
assert(!ext.isPseudogeneric() || genericSig);
40464049

40474050
llvm::FoldingSetNodeID id;
4048-
SILFunctionType::Profile(id, genericSig, ext, coroutineKind, callee,
4049-
params, yields, normalResults, errorResult);
4051+
SILFunctionType::Profile(id, genericSig, ext, coroutineKind, callee, params,
4052+
yields, normalResults, errorResult,
4053+
witnessMethodConformance);
40504054

40514055
// Do we already have this generic function type?
40524056
void *insertPos;

branches/master-next/lib/AST/Decl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3252,8 +3252,10 @@ void ClassDecl::addImplicitDestructor() {
32523252

32533253
bool ClassDecl::hasMissingDesignatedInitializers() const {
32543254
auto *mutableThis = const_cast<ClassDecl *>(this);
3255+
auto flags = OptionSet<LookupDirectFlags>();
3256+
flags |= LookupDirectFlags::IgnoreNewExtensions;
32553257
(void)mutableThis->lookupDirect(DeclBaseName::createConstructor(),
3256-
/*ignoreNewExtensions*/true);
3258+
flags);
32573259
return Bits.ClassDecl.HasMissingDesignatedInitializers;
32583260
}
32593261

branches/master-next/lib/AST/GenericSignatureBuilder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,8 +2124,9 @@ TypeDecl *EquivalenceClass::lookupNestedType(
21242124
ProtocolDecl *proto = conforms.first;
21252125

21262126
// Look for an associated type and/or concrete type with this name.
2127-
for (auto member : proto->lookupDirect(name,
2128-
/*ignoreNewExtensions=*/true)) {
2127+
auto flags = OptionSet<NominalTypeDecl::LookupDirectFlags>();
2128+
flags |= NominalTypeDecl::LookupDirectFlags::IgnoreNewExtensions;
2129+
for (auto member : proto->lookupDirect(name, flags)) {
21292130
// If this is an associated type, record whether it is the best
21302131
// associated type we've seen thus far.
21312132
if (auto assocType = dyn_cast<AssociatedTypeDecl>(member)) {

branches/master-next/lib/AST/NameLookup.cpp

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,8 +1339,11 @@ void MemberLookupTable::addMember(Decl *member) {
13391339
if (!vd)
13401340
return;
13411341

1342-
// Unnamed entities cannot be found by name lookup.
1343-
if (!vd->hasName())
1342+
// @_implements members get added under their declared name.
1343+
auto A = vd->getAttrs().getAttribute<ImplementsAttr>();
1344+
1345+
// Unnamed entities w/o @_implements synonyms cannot be found by name lookup.
1346+
if (!A && !vd->hasName())
13441347
return;
13451348

13461349
// If this declaration is already in the lookup table, don't add it
@@ -1353,6 +1356,10 @@ void MemberLookupTable::addMember(Decl *member) {
13531356
// Add this declaration to the lookup set under its compound name and simple
13541357
// name.
13551358
vd->getFullName().addToLookupTable(Lookup, vd);
1359+
1360+
// And if given a synonym, under that name too.
1361+
if (A)
1362+
A->getMemberName().addToLookupTable(Lookup, vd);
13561363
}
13571364

13581365
void MemberLookupTable::addMembers(DeclRange members) {
@@ -1592,9 +1599,31 @@ void NominalTypeDecl::makeMemberVisible(ValueDecl *member) {
15921599
LookupTable.getPointer()->addMember(member);
15931600
}
15941601

1602+
1603+
static TinyPtrVector<ValueDecl *>
1604+
maybeFilterOutAttrImplements(TinyPtrVector<ValueDecl *> decls,
1605+
DeclName name,
1606+
bool includeAttrImplements) {
1607+
if (includeAttrImplements)
1608+
return decls;
1609+
TinyPtrVector<ValueDecl*> result;
1610+
for (auto V : decls) {
1611+
// Filter-out any decl that doesn't have the name we're looking for
1612+
// (asserting as a consistency-check that such entries all have
1613+
// @_implements attrs for the name!)
1614+
if (V->getFullName().matchesRef(name)) {
1615+
result.push_back(V);
1616+
} else {
1617+
auto A = V->getAttrs().getAttribute<ImplementsAttr>();
1618+
assert(A && A->getMemberName().matchesRef(name));
1619+
}
1620+
}
1621+
return result;
1622+
}
1623+
15951624
TinyPtrVector<ValueDecl *> NominalTypeDecl::lookupDirect(
15961625
DeclName name,
1597-
bool ignoreNewExtensions) {
1626+
OptionSet<LookupDirectFlags> flags) {
15981627
ASTContext &ctx = getASTContext();
15991628
if (auto s = ctx.Stats) {
16001629
++s->getFrontendCounters().NominalTypeLookupDirectCount;
@@ -1605,6 +1634,12 @@ TinyPtrVector<ValueDecl *> NominalTypeDecl::lookupDirect(
16051634
bool useNamedLazyMemberLoading = (ctx.LangOpts.NamedLazyMemberLoading &&
16061635
hasLazyMembers());
16071636

1637+
bool ignoreNewExtensions =
1638+
flags.contains(LookupDirectFlags::IgnoreNewExtensions);
1639+
1640+
bool includeAttrImplements =
1641+
flags.contains(LookupDirectFlags::IncludeAttrImplements);
1642+
16081643
// FIXME: At present, lazy member loading conflicts with a bunch of other code
16091644
// that appears to special-case initializers (clang-imported initializer
16101645
// sorting, implicit initializer synthesis), so for the time being we have to
@@ -1663,7 +1698,8 @@ TinyPtrVector<ValueDecl *> NominalTypeDecl::lookupDirect(
16631698

16641699
// We found something; return it.
16651700
if (known != LookupTable.getPointer()->end())
1666-
return known->second;
1701+
return maybeFilterOutAttrImplements(known->second, name,
1702+
includeAttrImplements);
16671703

16681704
// If we have no more second chances, stop now.
16691705
if (!useNamedLazyMemberLoading || i > 0)
@@ -2004,7 +2040,10 @@ bool DeclContext::lookupQualified(ArrayRef<TypeDecl *> typeDecls,
20042040

20052041
// Look for results within the current nominal type and its extensions.
20062042
bool currentIsProtocol = isa<ProtocolDecl>(current);
2007-
for (auto decl : current->lookupDirect(member)) {
2043+
auto flags = OptionSet<NominalTypeDecl::LookupDirectFlags>();
2044+
if (options & NL_IncludeAttributeImplements)
2045+
flags |= NominalTypeDecl::LookupDirectFlags::IncludeAttrImplements;
2046+
for (auto decl : current->lookupDirect(member, flags)) {
20082047
// If we're performing a type lookup, don't even attempt to validate
20092048
// the decl if its not a type.
20102049
if ((options & NL_OnlyTypes) && !isa<TypeDecl>(decl))

branches/master-next/lib/ClangImporter/ClangImporter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2634,7 +2634,9 @@ ClangModuleUnit::lookupNestedType(Identifier name,
26342634
isa<StructDecl>(baseType) && !baseType->hasLazyMembers() &&
26352635
baseType->isChildContextOf(this)) {
26362636
auto *mutableBase = const_cast<NominalTypeDecl *>(baseType);
2637-
auto codeEnum = mutableBase->lookupDirect(name,/*ignoreNewExtensions*/true);
2637+
auto flags = OptionSet<NominalTypeDecl::LookupDirectFlags>();
2638+
flags |= NominalTypeDecl::LookupDirectFlags::IgnoreNewExtensions;
2639+
auto codeEnum = mutableBase->lookupDirect(name, flags);
26382640
// Double-check that we actually have a good result. It's possible what we
26392641
// found is /not/ a synthesized error struct, but just something that looks
26402642
// like it. But if we still found a good result we should return that.

0 commit comments

Comments
 (0)