Skip to content

Commit 4a66c26

Browse files
author
David Ungar
committed
---
yaml --- r: 340823 b: refs/heads/rxwei-patch-1 c: 375e212 h: refs/heads/master i: 340821: 081743b 340819: cf0fbe1 340815: a5b0541
1 parent fb498c7 commit 4a66c26

File tree

64 files changed

+420
-1394
lines changed

Some content is hidden

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

64 files changed

+420
-1394
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: c58481fc1cd54a60649119e36ef233502ddcf8fb
1018+
refs/heads/rxwei-patch-1: 375e21232fc6c059ac6a730f2e466a0a82590430
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/cmake/modules/AddSwift.cmake

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,17 +2346,6 @@ function(_add_swift_executable_single name)
23462346
target_link_libraries("${name}" PRIVATE ${SWIFTEXE_SINGLE_LINK_LIBRARIES})
23472347
swift_common_llvm_config("${name}" ${SWIFTEXE_SINGLE_LLVM_LINK_COMPONENTS})
23482348

2349-
# NOTE(compnerd) use the C linker language to invoke `clang` rather than
2350-
# `clang++` as we explicitly link against the C++ runtime. We were previously
2351-
# actually passing `-nostdlib++` to avoid the C++ runtime linkage.
2352-
if(SWIFTEXE_SINGLE_SDK STREQUAL ANDROID)
2353-
set_property(TARGET "${name}" PROPERTY
2354-
LINKER_LANGUAGE "C")
2355-
else()
2356-
set_property(TARGET "${name}" PROPERTY
2357-
LINKER_LANGUAGE "CXX")
2358-
endif()
2359-
23602349
set_target_properties(${name} PROPERTIES FOLDER "Swift executables")
23612350
endfunction()
23622351

branches/rxwei-patch-1/include/swift/AST/Attr.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ SIMPLE_DECL_ATTR(_alwaysEmitIntoClient, AlwaysEmitIntoClient,
396396
83)
397397

398398
SIMPLE_DECL_ATTR(_implementationOnly, ImplementationOnly,
399-
OnImport | OnFunc | OnConstructor | OnVar | OnSubscript | UserInaccessible,
399+
OnImport | UserInaccessible,
400400
84)
401401
DECL_ATTR(_custom, Custom,
402402
OnAnyDecl | UserInaccessible,

branches/rxwei-patch-1/include/swift/AST/Decl.h

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2700,20 +2700,7 @@ class ValueDecl : public Decl {
27002700
/// True if this is a C function that was imported as a member of a type in
27012701
/// Swift.
27022702
bool isImportAsMember() const;
2703-
2704-
/// Returns true if the declaration's interface type is a function type with a
2705-
/// curried self parameter.
2706-
bool hasCurriedSelf() const;
2707-
2708-
/// Returns true if the declaration has a parameter list associated with it.
2709-
///
2710-
/// Note that not all declarations with function interface types have
2711-
/// parameter lists, for example an enum element without associated values.
2712-
bool hasParameterList() const;
2713-
2714-
/// Returns the number of curry levels in the declaration's interface type.
2715-
unsigned getNumCurryLevels() const;
2716-
2703+
27172704
/// Get the decl for this value's opaque result type, if it has one.
27182705
OpaqueTypeDecl *getOpaqueResultTypeDecl() const;
27192706

@@ -7202,29 +7189,6 @@ inline bool ValueDecl::isImportAsMember() const {
72027189
return false;
72037190
}
72047191

7205-
inline bool ValueDecl::hasCurriedSelf() const {
7206-
if (auto *afd = dyn_cast<AbstractFunctionDecl>(this))
7207-
return afd->hasImplicitSelfDecl();
7208-
if (isa<EnumElementDecl>(this))
7209-
return true;
7210-
return false;
7211-
}
7212-
7213-
inline bool ValueDecl::hasParameterList() const {
7214-
if (auto *eed = dyn_cast<EnumElementDecl>(this))
7215-
return eed->hasAssociatedValues();
7216-
return isa<AbstractFunctionDecl>(this) || isa<SubscriptDecl>(this);
7217-
}
7218-
7219-
inline unsigned ValueDecl::getNumCurryLevels() const {
7220-
unsigned curryLevels = 0;
7221-
if (hasParameterList())
7222-
curryLevels++;
7223-
if (hasCurriedSelf())
7224-
curryLevels++;
7225-
return curryLevels;
7226-
}
7227-
72287192
inline bool Decl::isPotentiallyOverridable() const {
72297193
if (isa<VarDecl>(this) ||
72307194
isa<SubscriptDecl>(this) ||
@@ -7289,7 +7253,7 @@ inline EnumElementDecl *EnumDecl::getUniqueElement(bool hasValue) const {
72897253
}
72907254

72917255
/// Retrieve parameter declaration from the given source at given index.
7292-
const ParamDecl *getParameterAt(const ValueDecl *source, unsigned index);
7256+
const ParamDecl *getParameterAt(ValueDecl *source, unsigned index);
72937257

72947258
/// Display Decl subclasses.
72957259
void simple_display(llvm::raw_ostream &out, const Decl *decl);

branches/rxwei-patch-1/include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
//
1818
//===----------------------------------------------------------------------===//
1919

20-
#if !(defined(DIAG) || (defined(ERROR) && defined(WARNING) && defined(NOTE) && defined(REMARK)))
21-
# error Must define either DIAG or the set {ERROR,WARNING,NOTE,REMARK}
20+
#if !(defined(DIAG) || (defined(ERROR) && defined(WARNING) && defined(NOTE)))
21+
# error Must define either DIAG or the set {ERROR,WARNING,NOTE}
2222
#endif
2323

2424
#ifndef ERROR
@@ -36,19 +36,12 @@
3636
DIAG(NOTE,ID,Options,Text,Signature)
3737
#endif
3838

39-
#ifndef REMARK
40-
# define REMARK(ID,Options,Text,Signature) \
41-
DIAG(REMARK,ID,Options,Text,Signature)
42-
#endif
43-
4439
WARNING(warning_from_clang,none,
4540
"%0", (StringRef))
4641
ERROR(error_from_clang,none,
4742
"%0", (StringRef))
4843
NOTE(note_from_clang,none,
4944
"%0", (StringRef))
50-
REMARK(remark_from_clang,none,
51-
"%0", (StringRef))
5245

5346
ERROR(clang_cannot_build_module,Fatal,
5447
"could not build %select{C|Objective-C}0 module '%1'", (bool, StringRef))

branches/rxwei-patch-1/include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,18 +2490,6 @@ WARNING(warn_implementation_only_conflict,none,
24902490
NOTE(implementation_only_conflict_here,none,
24912491
"imported as implementation-only here", ())
24922492

2493-
ERROR(implementation_only_decl_non_override,none,
2494-
"'@_implementationOnly' can only be used on overrides", ())
2495-
ERROR(implementation_only_override_changed_type,none,
2496-
"'@_implementationOnly' override must have the same type as the "
2497-
"declaration it overrides (%0)", (Type))
2498-
ERROR(implementation_only_override_without_attr,none,
2499-
"override of '@_implementationOnly' %0 should also be declared "
2500-
"'@_implementationOnly'", (DescriptiveDeclKind))
2501-
ERROR(implementation_only_override_import_without_attr,none,
2502-
"override of %0 imported as implementation-only must be declared "
2503-
"'@_implementationOnly'", (DescriptiveDeclKind))
2504-
25052493
// Derived conformances
25062494
ERROR(cannot_synthesize_init_in_extension_of_nonfinal,none,
25072495
"implementation of %0 for non-final class cannot be automatically "
@@ -3655,10 +3643,6 @@ ERROR(unsupported_opaque_type,none,
36553643
ERROR(opaque_type_unsupported_pattern,none,
36563644
"'some' type can only be declared on a single property declaration", ())
36573645

3658-
ERROR(opaque_type_in_protocol_requirement,none,
3659-
"'some' type cannot be the return type of a protocol requirement; did you mean to add an associated type?",
3660-
())
3661-
36623646
// SIL
36633647
ERROR(opened_non_protocol,none,
36643648
"@opened cannot be applied to non-protocol type %0", (Type))

branches/rxwei-patch-1/lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ PrintOptions PrintOptions::printParseableInterfaceFile(bool preferTypeRepr) {
126126

127127
class ShouldPrintForParseableInterface : public ShouldPrintChecker {
128128
bool shouldPrint(const Decl *D, const PrintOptions &options) override {
129-
// Skip anything that is marked `@_implementationOnly` itself.
130-
if (D->getAttrs().hasAttribute<ImplementationOnlyAttr>())
131-
return false;
132-
133129
// Skip anything that isn't 'public' or '@usableFromInline'.
134130
if (auto *VD = dyn_cast<ValueDecl>(D)) {
135131
if (!isPublicOrUsableFromInline(VD)) {

branches/rxwei-patch-1/lib/AST/Decl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,7 +2400,7 @@ CanType ValueDecl::getOverloadSignatureType() const {
24002400
/*topLevelFunction=*/true,
24012401
isMethod,
24022402
/*isInitializer=*/isa<ConstructorDecl>(afd),
2403-
getNumCurryLevels())->getCanonicalType();
2403+
isMethod ? 2 : 1)->getCanonicalType();
24042404
}
24052405

24062406
if (isa<AbstractStorageDecl>(this)) {
@@ -2416,7 +2416,7 @@ CanType ValueDecl::getOverloadSignatureType() const {
24162416
/*topLevelFunction=*/true,
24172417
/*isMethod=*/false,
24182418
/*isInitializer=*/false,
2419-
getNumCurryLevels())->getCanonicalType();
2419+
1)->getCanonicalType();
24202420
}
24212421

24222422
// We want to curry the default signature type with the 'self' type of the
@@ -2430,7 +2430,7 @@ CanType ValueDecl::getOverloadSignatureType() const {
24302430
if (isa<EnumElementDecl>(this)) {
24312431
auto mappedType = mapSignatureFunctionType(
24322432
getASTContext(), getInterfaceType(), /*topLevelFunction=*/false,
2433-
/*isMethod=*/false, /*isInitializer=*/false, getNumCurryLevels());
2433+
/*isMethod=*/false, /*isInitializer=*/false, /*curryLevels=*/0);
24342434
return mappedType->getCanonicalType();
24352435
}
24362436

@@ -6108,7 +6108,7 @@ DeclName AbstractFunctionDecl::getEffectiveFullName() const {
61086108
return DeclName();
61096109
}
61106110

6111-
const ParamDecl *swift::getParameterAt(const ValueDecl *source, unsigned index) {
6111+
const ParamDecl *swift::getParameterAt(ValueDecl *source, unsigned index) {
61126112
const ParameterList *paramList;
61136113
if (auto *AFD = dyn_cast<AbstractFunctionDecl>(source)) {
61146114
paramList = AFD->getParameters();

branches/rxwei-patch-1/lib/AST/DeclContext.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,14 @@ ResilienceExpansion DeclContext::getResilienceExpansion() const {
317317
if (isa<DefaultArgumentInitializer>(dc)) {
318318
dc = dc->getParent();
319319

320-
auto *VD = cast<ValueDecl>(dc->getAsDecl());
321-
assert(VD->hasParameterList());
320+
const ValueDecl *VD;
321+
if (auto *FD = dyn_cast<AbstractFunctionDecl>(dc)) {
322+
VD = FD;
323+
} else if (auto *EED = dyn_cast<EnumElementDecl>(dc)) {
324+
VD = EED;
325+
} else {
326+
VD = cast<SubscriptDecl>(dc);
327+
}
322328

323329
auto access =
324330
VD->getFormalAccessScope(/*useDC=*/nullptr,

branches/rxwei-patch-1/lib/AST/Type.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -743,26 +743,26 @@ ParameterListInfo::ParameterListInfo(
743743
if (!paramOwner)
744744
return;
745745

746-
// If the decl has a curried self, but we're not allowed to skip it, return.
747-
if (paramOwner->hasCurriedSelf() && !skipCurriedSelf)
748-
return;
749-
750746
// Find the corresponding parameter list.
751747
const ParameterList *paramList = nullptr;
752748
if (auto *func = dyn_cast<AbstractFunctionDecl>(paramOwner)) {
753-
paramList = func->getParameters();
749+
if (func->hasImplicitSelfDecl()) {
750+
if (skipCurriedSelf)
751+
paramList = func->getParameters();
752+
} else if (!skipCurriedSelf)
753+
paramList = func->getParameters();
754754
} else if (auto *subscript = dyn_cast<SubscriptDecl>(paramOwner)) {
755-
paramList = subscript->getIndices();
755+
if (skipCurriedSelf)
756+
paramList = subscript->getIndices();
756757
} else if (auto *enumElement = dyn_cast<EnumElementDecl>(paramOwner)) {
757-
paramList = enumElement->getParameterList();
758+
if (skipCurriedSelf)
759+
paramList = enumElement->getParameterList();
758760
}
759761

760762
// No parameter list means no default arguments - hand back the zeroed
761763
// bitvector.
762-
if (!paramList) {
763-
assert(!paramOwner->hasParameterList());
764+
if (!paramList)
764765
return;
765-
}
766766

767767
switch (params.size()) {
768768
case 0:

branches/rxwei-patch-1/lib/AST/UnqualifiedLookup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ void UnqualifiedLookupFactory::performUnqualifiedLookup() {
504504
void UnqualifiedLookupFactory::lookUpTopLevelNamesInModuleScopeContext(
505505
DeclContext *DC) {
506506
// TODO: Does the debugger client care about compound names?
507-
if (Name.isSimpleName() && DebugClient &&
507+
if (Name.isSimpleName() && !Name.isSpecial() && DebugClient &&
508508
DebugClient->lookupOverrides(Name.getBaseName(), DC, Loc,
509509
isOriginallyTypeLookup, Results))
510510
return;

branches/rxwei-patch-1/lib/ClangImporter/ClangDiagnosticConsumer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ void ClangDiagnosticConsumer::HandleDiagnostic(
227227
diagKind = diag::note_from_clang;
228228
break;
229229
case clang::DiagnosticsEngine::Remark:
230-
diagKind = diag::remark_from_clang;
231-
break;
230+
// FIXME: We don't handle remarks yet.
231+
return;
232232
case clang::DiagnosticsEngine::Warning:
233233
diagKind = diag::warning_from_clang;
234234
break;

branches/rxwei-patch-1/lib/IDE/CodeCompletion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ protocolForLiteralKind(CodeCompletionLiteralKind kind) {
14641464
static bool hasTrivialTrailingClosure(const FuncDecl *FD,
14651465
AnyFunctionType *funcType) {
14661466
ParameterListInfo paramInfo(funcType->getParams(), FD,
1467-
/*skipCurriedSelf*/ FD->hasCurriedSelf());
1467+
/*level*/ FD->isInstanceMember() ? 1 : 0);
14681468

14691469
if (paramInfo.size() - paramInfo.numNonDefaultedParameters() == 1) {
14701470
auto param = funcType->getParams().back();

branches/rxwei-patch-1/lib/ParseSIL/ParseSIL.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2028,9 +2028,18 @@ bool SILParser::parseSILDeclRef(SILDeclRef &Member, bool FnTypeRequired) {
20282028
for (unsigned I = 0, E = values.size(); I < E; I++) {
20292029
auto *decl = values[I];
20302030

2031+
unsigned numArgumentLabels = 0;
2032+
if (auto *eed = dyn_cast<EnumElementDecl>(decl)) {
2033+
numArgumentLabels =
2034+
(eed->hasAssociatedValues() ? 2 : 1);
2035+
} else if (auto *afd = dyn_cast<AbstractFunctionDecl>(decl)) {
2036+
numArgumentLabels =
2037+
(decl->getDeclContext()->isTypeContext() ? 2 : 1);
2038+
}
2039+
20312040
auto lookupTy =
20322041
decl->getInterfaceType()
2033-
->removeArgumentLabels(decl->getNumCurryLevels());
2042+
->removeArgumentLabels(numArgumentLabels);
20342043
if (declTy == lookupTy->getCanonicalType()) {
20352044
TheDecl = decl;
20362045
// Update SILDeclRef to point to the right Decl.

branches/rxwei-patch-1/lib/PrintAsObjC/PrintAsObjC.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
204204
}
205205

206206
bool shouldInclude(const ValueDecl *VD) {
207-
return isVisibleToObjC(VD, minRequiredAccess) &&
208-
!VD->getAttrs().hasAttribute<ImplementationOnlyAttr>();
207+
return isVisibleToObjC(VD, minRequiredAccess);
209208
}
210209

211210
private:

branches/rxwei-patch-1/lib/SIL/SILDeclRef.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,10 +1018,10 @@ unsigned SILDeclRef::getParameterListCount() const {
10181018

10191019
auto *vd = getDecl();
10201020

1021-
if (isa<AbstractFunctionDecl>(vd) || isa<EnumElementDecl>(vd)) {
1022-
// For functions and enum elements, the number of parameter lists is the
1023-
// same as in their interface type.
1024-
return vd->getNumCurryLevels();
1021+
if (auto *func = dyn_cast<AbstractFunctionDecl>(vd)) {
1022+
return func->hasImplicitSelfDecl() ? 2 : 1;
1023+
} else if (auto *ed = dyn_cast<EnumElementDecl>(vd)) {
1024+
return ed->hasAssociatedValues() ? 2 : 1;
10251025
} else if (isa<ClassDecl>(vd)) {
10261026
return 2;
10271027
} else if (isa<VarDecl>(vd)) {

branches/rxwei-patch-1/lib/Sema/CSDiag.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,7 +2663,8 @@ typeCheckArgumentChildIndependently(Expr *argExpr, Type argType,
26632663
// default arguments.
26642664
ParameterListInfo paramInfo;
26652665
if (!candidates.empty()) {
2666-
paramInfo = candidates[0].getParameterListInfo(params);
2666+
paramInfo = ParameterListInfo(params, candidates[0].getDecl(),
2667+
candidates[0].skipCurriedSelf);
26672668
} else {
26682669
paramInfo = ParameterListInfo(params, nullptr, /*skipCurriedSelf=*/false);
26692670
}
@@ -3549,7 +3550,8 @@ diagnoseSingleCandidateFailures(CalleeCandidateInfo &CCI, Expr *fnExpr,
35493550
return false;
35503551

35513552
auto params = candidate.getParameters();
3552-
auto paramInfo = candidate.getParameterListInfo(params);
3553+
ParameterListInfo paramInfo(params, candidate.getDecl(),
3554+
candidate.skipCurriedSelf);
35533555
auto args = decomposeArgType(CCI.CS.getType(argExpr), argLabels);
35543556

35553557
// Check the case where a raw-representable type is constructed from an
@@ -4196,7 +4198,8 @@ bool FailureDiagnosis::diagnoseArgumentGenericRequirements(
41964198
return false;
41974199

41984200
auto params = candidate.getParameters();
4199-
auto paramInfo = candidate.getParameterListInfo(params);
4201+
ParameterListInfo paramInfo(params, candidate.getDecl(),
4202+
candidate.skipCurriedSelf);
42004203
auto args = decomposeArgType(CS.getType(argExpr), argLabels);
42014204

42024205
SmallVector<ParamBinding, 4> bindings;
@@ -4669,7 +4672,7 @@ static bool isViableOverloadSet(const CalleeCandidateInfo &CCI,
46694672
return true;
46704673
};
46714674

4672-
auto paramInfo = cand.getParameterListInfo(params);
4675+
ParameterListInfo paramInfo(params, funcDecl, cand.skipCurriedSelf);
46734676
InputMatcher IM(params, paramInfo);
46744677
auto result = IM.match(numArgs, pairMatcher);
46754678
if (result == InputMatcher::IM_Succeeded)

0 commit comments

Comments
 (0)