Skip to content

Commit ea77afd

Browse files
committed
---
yaml --- r: 339707 b: refs/heads/rxwei-patch-1 c: d86907e h: refs/heads/master i: 339705: 297a28f 339703: 379d35d
1 parent 3880840 commit ea77afd

File tree

76 files changed

+513
-2237
lines changed

Some content is hidden

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

76 files changed

+513
-2237
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: 5fba88c78e9c14d6d555c9950556f976b543e0f1
1018+
refs/heads/rxwei-patch-1: d86907e0954ac686631609a600ce7185afad07e1
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/CHANGELOG.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,6 @@ CHANGELOG
2626
Swift Next
2727
----------
2828

29-
* [SR-8974][]:
30-
31-
Duplicate tuple element labels are no longer allowed, because it leads
32-
to incorrect behavior. For example:
33-
34-
```
35-
let dupLabels: (foo: Int, foo: Int) = (foo: 1, foo: 2)
36-
37-
enum Foo { case bar(x: Int, x: Int) }
38-
let f: Foo = .bar(x: 0, x: 1)
39-
```
40-
41-
will now be diagnosed as an error.
42-
43-
Note: You can still use duplicate labels when declaring functions and
44-
subscripts, as long as the internal labels are different. For example:
45-
46-
```
47-
func foo(bar x: Int, bar y: Int) {}
48-
subscript(a x: Int, a y: Int) -> Int {}
49-
```
50-
5129
* [SR-6118][]:
5230

5331
Subscripts can now declare default arguments:
@@ -7718,6 +7696,5 @@ Swift 1.0
77187696
[SR-7799]: <https://bugs.swift.org/browse/SR-7799>
77197697
[SR-8109]: <https://bugs.swift.org/browse/SR-8109>
77207698
[SR-8546]: <https://bugs.swift.org/browse/SR-8546>
7721-
[SR-8974]: <https://bugs.swift.org/browse/SR-8974>
77227699
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
77237700
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3523,8 +3523,6 @@ ERROR(tuple_single_element,none,
35233523
"cannot create a single-element tuple with an element label", ())
35243524
ERROR(tuple_ellipsis,none,
35253525
"cannot create a variadic tuple", ())
3526-
ERROR(tuple_duplicate_label,none,
3527-
"cannot create a tuple with a duplicate element label", ())
35283526
ERROR(enum_element_ellipsis,none,
35293527
"variadic enum cases are not supported", ())
35303528

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

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -953,25 +953,15 @@ class TapExpr : public Expr {
953953
class InterpolatedStringLiteralExpr : public LiteralExpr {
954954
/// Points at the beginning quote.
955955
SourceLoc Loc;
956-
/// Points at the ending quote.
957-
/// Needed for the upcoming \c ASTScope subsystem because lookups can be
958-
/// targeted to inside an \c InterpolatedStringLiteralExpr. It would be nicer
959-
/// to use \c EndLoc for this value, but then \c Lexer::getLocForEndOfToken()
960-
/// would not work for \c stringLiteral->getEndLoc().
961-
SourceLoc TrailingQuoteLoc;
962956
TapExpr *AppendingExpr;
963957
Expr *SemanticExpr;
964958

965959
public:
966-
InterpolatedStringLiteralExpr(SourceLoc Loc,
967-
SourceLoc TrailingQuoteLoc,
968-
unsigned LiteralCapacity,
960+
InterpolatedStringLiteralExpr(SourceLoc Loc, unsigned LiteralCapacity,
969961
unsigned InterpolationCount,
970962
TapExpr *AppendingExpr)
971963
: LiteralExpr(ExprKind::InterpolatedStringLiteral, /*Implicit=*/false),
972-
Loc(Loc),
973-
TrailingQuoteLoc(TrailingQuoteLoc),
974-
AppendingExpr(AppendingExpr), SemanticExpr() {
964+
Loc(Loc), AppendingExpr(AppendingExpr), SemanticExpr() {
975965
Bits.InterpolatedStringLiteralExpr.InterpolationCount = InterpolationCount;
976966
Bits.InterpolatedStringLiteralExpr.LiteralCapacity = LiteralCapacity;
977967
}
@@ -1008,11 +998,6 @@ class InterpolatedStringLiteralExpr : public LiteralExpr {
1008998
// token, so the range should be (Start == End).
1009999
return Loc;
10101000
}
1011-
SourceLoc getTrailingQuoteLoc() const {
1012-
// Except when computing a SourceRange for an ASTScope. Then the range
1013-
// must be (Start - TrainingQuoteLoc).
1014-
return TrailingQuoteLoc;
1015-
}
10161001

10171002
/// Call the \c callback with information about each segment in turn.
10181003
void forEachSegment(ASTContext &Ctx,

branches/rxwei-patch-1/include/swift/FrontendTool/FrontendTool.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,6 @@ class FrontendObserver {
4242

4343
/// The frontend has configured the compiler instance.
4444
virtual void configuredCompiler(CompilerInstance &instance);
45-
46-
/// The frontend has performed semantic analysis.
47-
virtual void performedSemanticAnalysis(CompilerInstance &instance);
48-
49-
/// The frontend has performed basic SIL generation.
50-
/// SIL diagnostic passes have not yet been applied.
51-
virtual void performedSILGeneration(SILModule &module);
52-
53-
/// The frontend has executed the SIL optimization and diagnostics pipelines.
54-
virtual void performedSILProcessing(SILModule &module);
55-
56-
// TODO: maybe enhance this interface to hear about IRGen and LLVM
57-
// progress.
5845
};
5946

6047
namespace frontend {

branches/rxwei-patch-1/include/swift/SIL/SILBasicBlock.h

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -232,20 +232,11 @@ public llvm::ilist_node<SILBasicBlock>, public SILAllocated<SILBasicBlock> {
232232
const ValueDecl *D = nullptr);
233233

234234
/// Replace the \p{i}th BB arg with a new BBArg with SILType \p Ty and
235-
/// ValueDecl \p D.
236-
///
237-
/// NOTE: This assumes that the current argument in position \p i has had its
238-
/// uses eliminated. To replace/replace all uses with, use
239-
/// replacePhiArgumentAndRAUW.
240-
SILPhiArgument *replacePhiArgument(unsigned i, SILType type,
241-
ValueOwnershipKind kind,
242-
const ValueDecl *decl = nullptr);
243-
244-
/// Replace phi argument \p i and RAUW all uses.
245-
SILPhiArgument *
246-
replacePhiArgumentAndReplaceAllUses(unsigned i, SILType type,
247-
ValueOwnershipKind kind,
248-
const ValueDecl *decl = nullptr);
235+
/// ValueDecl
236+
/// \p D.
237+
SILPhiArgument *replacePhiArgument(unsigned i, SILType Ty,
238+
ValueOwnershipKind Kind,
239+
const ValueDecl *D = nullptr);
249240

250241
/// Allocate a new argument of type \p Ty and append it to the argument
251242
/// list. Optionally you can pass in a value decl parameter.

branches/rxwei-patch-1/include/swift/SIL/SILBuilder.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1938,7 +1938,11 @@ class SILBuilder {
19381938
SILType destTy, SILBasicBlock *successBB,
19391939
SILBasicBlock *failureBB,
19401940
ProfileCounter Target1Count = ProfileCounter(),
1941-
ProfileCounter Target2Count = ProfileCounter());
1941+
ProfileCounter Target2Count = ProfileCounter()) {
1942+
return insertTerminator(CheckedCastBranchInst::create(
1943+
getSILDebugLocation(Loc), isExact, op, destTy, successBB, failureBB,
1944+
getFunction(), C.OpenedArchetypes, Target1Count, Target2Count));
1945+
}
19421946

19431947
CheckedCastValueBranchInst *
19441948
createCheckedCastValueBranch(SILLocation Loc, SILValue op, SILType destTy,

branches/rxwei-patch-1/include/swift/SIL/SILInstruction.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,8 +1841,6 @@ class ApplyInstBase<Impl, Base, false> : public Base {
18411841
/// issues. It is at the bottom of the file.
18421842
SILFunction *getCalleeFunction() const;
18431843

1844-
bool isCalleeDynamicallyReplaceable() const;
1845-
18461844
/// Gets the referenced function if the callee is a function_ref instruction.
18471845
SILFunction *getReferencedFunction() const {
18481846
if (auto *FRI = dyn_cast<FunctionRefBaseInst>(getCallee()))
@@ -7775,27 +7773,6 @@ SILValue ApplyInstBase<Impl, Base, false>::getCalleeOrigin() const {
77757773
}
77767774
}
77777775

7778-
template <class Impl, class Base>
7779-
bool ApplyInstBase<Impl, Base, false>::isCalleeDynamicallyReplaceable() const {
7780-
SILValue Callee = getCalleeOrigin();
7781-
7782-
while (true) {
7783-
if (auto *FRI = dyn_cast<FunctionRefInst>(Callee))
7784-
return false;
7785-
7786-
if (auto *FRI = dyn_cast<DynamicFunctionRefInst>(Callee))
7787-
return true;
7788-
if (auto *FRI = dyn_cast<PreviousDynamicFunctionRefInst>(Callee))
7789-
return true;
7790-
7791-
if (auto *PAI = dyn_cast<PartialApplyInst>(Callee)) {
7792-
Callee = PAI->getCalleeOrigin();
7793-
continue;
7794-
}
7795-
return false;
7796-
}
7797-
}
7798-
77997776
template <class Impl, class Base>
78007777
SILFunction *ApplyInstBase<Impl, Base, false>::getCalleeFunction() const {
78017778
SILValue Callee = getCalleeOrigin();

branches/rxwei-patch-1/include/swift/Serialization/ModuleFormat.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5252
/// describe what change you made. The content of this comment isn't important;
5353
/// it just ensures a conflict if two people change the module format.
5454
/// Don't worry about adhering to the 80-column limit for this line.
55-
const uint16_t SWIFTMODULE_VERSION_MINOR = 493; // dependency types for structs
55+
const uint16_t SWIFTMODULE_VERSION_MINOR = 491; // mangled class names as vtable keys
5656

5757
using DeclIDField = BCFixed<31>;
5858

@@ -948,8 +948,7 @@ namespace decls_block {
948948
GenericEnvironmentIDField, // generic environment
949949
AccessLevelField, // access level
950950
BCVBR<4>, // number of conformances
951-
BCVBR<4>, // number of inherited types
952-
BCArray<TypeIDField> // inherited types, followed by dependency types
951+
BCArray<TypeIDField> // inherited types
953952
// Trailed by the generic parameters (if any), the members record, and
954953
// finally conformance info (if any).
955954
>;
@@ -982,8 +981,7 @@ namespace decls_block {
982981
TypeIDField, // superclass
983982
AccessLevelField, // access level
984983
BCVBR<4>, // number of conformances
985-
BCVBR<4>, // number of inherited types
986-
BCArray<TypeIDField> // inherited types, followed by dependency types
984+
BCArray<TypeIDField> // inherited types
987985
// Trailed by the generic parameters (if any), the members record, and
988986
// finally conformance info (if any).
989987
>;

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,19 +1930,7 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
19301930
}
19311931
void visitInterpolatedStringLiteralExpr(InterpolatedStringLiteralExpr *E) {
19321932
printCommon(E, "interpolated_string_literal_expr");
1933-
1934-
// Print the trailing quote location
1935-
if (auto Ty = GetTypeOfExpr(E)) {
1936-
auto &Ctx = Ty->getASTContext();
1937-
auto TQL = E->getTrailingQuoteLoc();
1938-
if (TQL.isValid()) {
1939-
PrintWithColorRAII(OS, LocationColor) << " trailing_quote_loc=";
1940-
TQL.print(PrintWithColorRAII(OS, LocationColor).getOS(),
1941-
Ctx.SourceMgr);
1942-
}
1943-
}
1944-
PrintWithColorRAII(OS, LiteralValueColor)
1945-
<< " literal_capacity="
1933+
PrintWithColorRAII(OS, LiteralValueColor) << " literal_capacity="
19461934
<< E->getLiteralCapacity() << " interpolation_count="
19471935
<< E->getInterpolationCount() << '\n';
19481936
printRec(E->getAppendingExpr());

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,6 @@ static LiteralExpr *
813813
shallowCloneImpl(const InterpolatedStringLiteralExpr *E, ASTContext &Ctx,
814814
llvm::function_ref<Type(const Expr *)> getType) {
815815
auto res = new (Ctx) InterpolatedStringLiteralExpr(E->getLoc(),
816-
E->getTrailingQuoteLoc(),
817816
E->getLiteralCapacity(),
818817
E->getInterpolationCount(),
819818
E->getAppendingExpr());

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,9 +1005,6 @@ static bool performCompile(CompilerInstance &Instance,
10051005
if (Action == FrontendOptions::ActionType::ResolveImports)
10061006
return Context.hadError();
10071007

1008-
if (observer)
1009-
observer->performedSemanticAnalysis(Instance);
1010-
10111008
if (Stats)
10121009
countStatsPostSema(*Stats, Instance);
10131010

@@ -1241,9 +1238,6 @@ static bool performCompileStepsPostSILGen(
12411238
if (auto *SF = MSF.dyn_cast<SourceFile *>())
12421239
ricd.emplace(*SF);
12431240

1244-
if (observer)
1245-
observer->performedSILGeneration(*SM);
1246-
12471241
if (Stats)
12481242
countStatsPostSILGen(*Stats, *SM);
12491243

@@ -1290,9 +1284,6 @@ static bool performCompileStepsPostSILGen(
12901284
if (Instance.performSILProcessing(SM.get(), Stats))
12911285
return true;
12921286

1293-
if (observer)
1294-
observer->performedSILProcessing(*SM);
1295-
12961287
emitAnyWholeModulePostTypeCheckSupplementaryOutputs(Instance, Invocation,
12971288
moduleIsPublic);
12981289

@@ -1856,6 +1847,3 @@ int swift::performFrontend(ArrayRef<const char *> Args,
18561847

18571848
void FrontendObserver::parsedArgs(CompilerInvocation &invocation) {}
18581849
void FrontendObserver::configuredCompiler(CompilerInstance &instance) {}
1859-
void FrontendObserver::performedSemanticAnalysis(CompilerInstance &instance) {}
1860-
void FrontendObserver::performedSILGeneration(SILModule &module) {}
1861-
void FrontendObserver::performedSILProcessing(SILModule &module) {}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ static bool shouldPrintAsFavorable(const Decl *D, const PrintOptions &Options) {
3939
const auto *FD = dyn_cast<FuncDecl>(D);
4040
if (!FD)
4141
return true;
42-
// Don't check overload choices for accessor decls.
43-
if (isa<AccessorDecl>(FD))
44-
return true;
4542
ResolvedMemberResult Result =
4643
resolveValueMember(*DC, BaseTy, FD->getEffectiveFullName());
4744
return !(Result.hasBestOverload() && Result.getBestOverload() != D);

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include "swift/IDE/REPLCodeCompletion.h"
1818
#include "swift/AST/ASTContext.h"
19-
#include "swift/AST/DiagnosticSuppression.h"
2019
#include "swift/AST/Module.h"
2120
#include "swift/Basic/LLVM.h"
2221
#include "swift/Basic/SourceManager.h"
@@ -194,7 +193,7 @@ doCodeCompletion(SourceFile &SF, StringRef EnteredCode, unsigned *BufferID,
194193
CodeCompletionCallbacksFactory *CompletionCallbacksFactory) {
195194
// Temporarily disable printing the diagnostics.
196195
ASTContext &Ctx = SF.getASTContext();
197-
DiagnosticSuppression SuppressedDiags(Ctx.Diags);
196+
DiagnosticTransaction DelayedDiags(Ctx.Diags);
198197

199198
std::string AugmentedCode = EnteredCode.str();
200199
AugmentedCode += '\0';
@@ -223,10 +222,7 @@ doCodeCompletion(SourceFile &SF, StringRef EnteredCode, unsigned *BufferID,
223222
// Now we are done with code completion. Remove the declarations we
224223
// temporarily inserted.
225224
SF.Decls.resize(OriginalDeclCount);
226-
227-
// Reset the error state because it's only relevant to the code that we just
228-
// processed, which now gets thrown away.
229-
Ctx.Diags.resetHadAnyError();
225+
DelayedDiags.abort();
230226
}
231227

232228
void REPLCompletions::populate(SourceFile &SF, StringRef EnteredCode) {

branches/rxwei-patch-1/lib/IRGen/GenKeyPath.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -761,13 +761,8 @@ emitKeyPathComponent(IRGenModule &IGM,
761761
assert(currentBaseTy->getClassOrBoundGenericClass() == propertyBaseDecl);
762762
loweredBaseTy =
763763
IGM.getLoweredType(AbstractionPattern::getOpaque(), currentBaseTy);
764-
765-
auto loweredBaseContextTy = SILType::getPrimitiveObjectType(
766-
GenericEnvironment::mapTypeIntoContext(genericEnv,
767-
loweredBaseTy.getASTType())
768-
->getCanonicalType());
769764

770-
switch (getClassFieldAccess(IGM, loweredBaseContextTy, property)) {
765+
switch (getClassFieldAccess(IGM, loweredBaseTy, property)) {
771766
case FieldAccess::ConstantDirect: {
772767
// Known constant fixed offset.
773768
auto offset = tryEmitConstantClassFragilePhysicalMemberOffset(IGM,

branches/rxwei-patch-1/lib/Parse/ParseExpr.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,8 +2039,8 @@ ParserResult<Expr> Parser::parseExprStringLiteral() {
20392039
// Return an error, but include an empty InterpolatedStringLiteralExpr
20402040
// so that parseDeclPoundDiagnostic() can figure out why this string
20412041
// literal was bad.
2042-
return makeParserErrorResult(new (Context) InterpolatedStringLiteralExpr(
2043-
Loc, Loc.getAdvancedLoc(CloseQuoteBegin), 0, 0, nullptr));
2042+
return makeParserErrorResult(
2043+
new (Context) InterpolatedStringLiteralExpr(Loc, 0, 0, nullptr));
20442044
}
20452045

20462046
unsigned LiteralCapacity = 0;
@@ -2093,8 +2093,7 @@ ParserResult<Expr> Parser::parseExprStringLiteral() {
20932093
}
20942094

20952095
return makeParserResult(Status, new (Context) InterpolatedStringLiteralExpr(
2096-
Loc, Loc.getAdvancedLoc(CloseQuoteBegin),
2097-
LiteralCapacity, InterpolationCount,
2096+
Loc, LiteralCapacity, InterpolationCount,
20982097
AppendingExpr));
20992098
}
21002099

branches/rxwei-patch-1/lib/Parse/ParseIfConfig.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "swift/Parse/Parser.h"
1818

1919
#include "swift/AST/ASTVisitor.h"
20-
#include "swift/AST/DiagnosticSuppression.h"
2120
#include "swift/Basic/Defer.h"
2221
#include "swift/Basic/LangOptions.h"
2322
#include "swift/Basic/Version.h"
@@ -639,12 +638,6 @@ ParserResult<IfConfigDecl> Parser::parseIfConfig(
639638
SmallVector<ASTNode, 16> Elements;
640639
if (isActive || !isVersionCondition) {
641640
parseElements(Elements, isActive);
642-
} else if (SyntaxContext->isEnabled()) {
643-
// We shouldn't skip code if we are building syntax tree.
644-
// The parser will keep running and we just discard the AST part.
645-
DiagnosticSuppression suppression(Context.Diags);
646-
SmallVector<ASTNode, 16> dropedElements;
647-
parseElements(dropedElements, false);
648641
} else {
649642
DiagnosticTransaction DT(Diags);
650643
skipUntilConditionalBlockClose();

0 commit comments

Comments
 (0)