Skip to content

Commit 7c82bc2

Browse files
authored
---
yaml --- r: 340477 b: refs/heads/rxwei-patch-1 c: 6605d56 h: refs/heads/master i: 340475: 565bfaf
1 parent 8426565 commit 7c82bc2

File tree

55 files changed

+618
-338
lines changed

Some content is hidden

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

55 files changed

+618
-338
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: 26d03243183ced04454667496eb2df37e2556670
1018+
refs/heads/rxwei-patch-1: 6605d56781494afc991f746457c26fcb5d4d5378
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/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Instructions for installing CMake and Ninja directly can be found [below](#build
9898

9999
For Ubuntu, you'll need the following development dependencies:
100100

101-
sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev systemtap-sdt-dev tzdata rsync
101+
sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libcurl4-openssl-dev systemtap-sdt-dev tzdata rsync
102102

103103
**Note:** LLDB currently requires at least `swig-1.3.40` but will successfully build
104104
with version 2 shipped with Ubuntu.

branches/rxwei-patch-1/docs/ABI/Mangling.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ Types
512512
FUNCTION-KIND ::= 'U' // uncurried function type (currently not used)
513513
FUNCTION-KIND ::= 'K' // @auto_closure function type (noescape)
514514
FUNCTION-KIND ::= 'B' // objc block function type
515+
FUNCTION-KIND ::= 'L' // objc block function type (escaping) (DWARF only; otherwise use 'B')
515516
FUNCTION-KIND ::= 'C' // C function pointer type
516517
FUNCTION-KIND ::= 'A' // @auto_closure function type (escaping)
517518
FUNCTION-KIND ::= 'E' // function type (noescape)

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,8 @@ class alignas(1 << DeclAlignInBits) Decl {
387387
/// It is up to the debugger to instruct SIL how to access this variable.
388388
IsDebuggerVar : 1,
389389

390-
/// Whether this is a property defined in the debugger's REPL.
391-
/// FIXME: Remove this once LLDB has proper support for resilience.
392-
IsREPLVar : 1,
390+
/// Whether this is the backing storage for a lazy property.
391+
IsLazyStorageProperty : 1,
393392

394393
/// Whether this is the backing storage for a property wrapper.
395394
IsPropertyWrapperBackingProperty : 1
@@ -4806,7 +4805,7 @@ class VarDecl : public AbstractStorageDecl {
48064805
Bits.VarDecl.Specifier = static_cast<unsigned>(Sp);
48074806
Bits.VarDecl.IsCaptureList = IsCaptureList;
48084807
Bits.VarDecl.IsDebuggerVar = false;
4809-
Bits.VarDecl.IsREPLVar = false;
4808+
Bits.VarDecl.IsLazyStorageProperty = false;
48104809
Bits.VarDecl.HasNonPatternBindingInit = false;
48114810
Bits.VarDecl.IsPropertyWrapperBackingProperty = false;
48124811
}
@@ -5095,12 +5094,13 @@ class VarDecl : public AbstractStorageDecl {
50955094
void setDebuggerVar(bool IsDebuggerVar) {
50965095
Bits.VarDecl.IsDebuggerVar = IsDebuggerVar;
50975096
}
5098-
5099-
/// Is this a special debugger REPL variable?
5100-
/// FIXME: Remove this once LLDB has proper support for resilience.
5101-
bool isREPLVar() const { return Bits.VarDecl.IsREPLVar; }
5102-
void setREPLVar(bool IsREPLVar) {
5103-
Bits.VarDecl.IsREPLVar = IsREPLVar;
5097+
5098+
/// Is this the synthesized storage for a 'lazy' property?
5099+
bool isLazyStorageProperty() const {
5100+
return Bits.VarDecl.IsLazyStorageProperty;
5101+
}
5102+
void setLazyStorageProperty(bool IsLazyStorage) {
5103+
Bits.VarDecl.IsLazyStorageProperty = IsLazyStorage;
51045104
}
51055105

51065106
/// Retrieve the custom attribute that attaches a property wrapper to this

branches/rxwei-patch-1/include/swift/Demangling/DemangleNodes.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ NODE(NonObjCAttribute)
147147
NODE(Number)
148148
NODE(ObjCAttribute)
149149
NODE(ObjCBlock)
150+
NODE(EscapingObjCBlock)
150151
CONTEXT_NODE(OtherNominalType)
151152
CONTEXT_NODE(OwningAddressor)
152153
CONTEXT_NODE(OwningMutableAddressor)

branches/rxwei-patch-1/include/swift/Demangling/TypeDecoder.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ class TypeDecoder {
487487
auto index = Node->getChild(1)->getIndex();
488488
return Builder.createGenericTypeParameterType(depth, index);
489489
}
490+
case NodeKind::EscapingObjCBlock:
490491
case NodeKind::ObjCBlock:
491492
case NodeKind::CFunctionPointer:
492493
case NodeKind::ThinFunctionType:
@@ -498,7 +499,8 @@ class TypeDecoder {
498499
return BuiltType();
499500

500501
FunctionTypeFlags flags;
501-
if (Node->getKind() == NodeKind::ObjCBlock) {
502+
if (Node->getKind() == NodeKind::ObjCBlock ||
503+
Node->getKind() == NodeKind::EscapingObjCBlock) {
502504
flags = flags.withConvention(FunctionMetadataConvention::Block);
503505
} else if (Node->getKind() == NodeKind::CFunctionPointer) {
504506
flags =
@@ -524,7 +526,8 @@ class TypeDecoder {
524526
.withParameterFlags(hasParamFlags)
525527
.withEscaping(
526528
Node->getKind() == NodeKind::FunctionType ||
527-
Node->getKind() == NodeKind::EscapingAutoClosureType);
529+
Node->getKind() == NodeKind::EscapingAutoClosureType ||
530+
Node->getKind() == NodeKind::EscapingObjCBlock);
528531

529532
auto result = decodeMangledType(Node->getChild(isThrow ? 2 : 1));
530533
if (!result) return BuiltType();

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ class SILDebugScope : public SILAllocated<SILDebugScope> {
6565
SILFunction *getParentFunction() const;
6666

6767
#ifndef NDEBUG
68-
void dump(SourceManager &SM, llvm::raw_ostream &OS = llvm::errs(),
69-
unsigned Indent = 0) const;
68+
LLVM_ATTRIBUTE_DEPRECATED(void dump(SourceManager &SM, llvm::raw_ostream &OS = llvm::errs(),
69+
unsigned Indent = 0) const,
70+
"only for use in the debugger");
71+
LLVM_ATTRIBUTE_DEPRECATED(void dump(SILModule &Mod) const, "only for use in the debugger");
7072
#endif
7173
};
7274

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,14 @@ Type ASTBuilder::createFunctionType(
378378

379379
auto einfo = AnyFunctionType::ExtInfo(representation,
380380
/*throws*/ flags.throws());
381-
if (flags.isEscaping())
382-
einfo = einfo.withNoEscape(false);
383-
else
384-
einfo = einfo.withNoEscape(true);
381+
382+
if (representation == FunctionTypeRepresentation::Swift ||
383+
representation == FunctionTypeRepresentation::Block) {
384+
if (flags.isEscaping())
385+
einfo = einfo.withNoEscape(false);
386+
else
387+
einfo = einfo.withNoEscape(true);
388+
}
385389

386390
// The result type must be materializable.
387391
if (!output->isMaterializable()) return Type();

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,6 +1911,10 @@ void ASTMangler::appendFunctionType(AnyFunctionType *fn, bool isAutoClosure,
19111911
// changes to better support thin functions.
19121912
switch (fn->getRepresentation()) {
19131913
case AnyFunctionType::Representation::Block:
1914+
// We distinguish escaping and non-escaping blocks, but only in the DWARF
1915+
// mangling, because the ABI is already set.
1916+
if (!fn->isNoEscape() && DWARFMangling)
1917+
return appendOperator("XL");
19141918
return appendOperator("XB");
19151919
case AnyFunctionType::Representation::Thin:
19161920
return appendOperator("Xf");

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ PlatformAvailability::PlatformAvailability(LangOptions &langOpts)
17461746
"APIs deprecated as of macOS 10.9 and earlier are unavailable in Swift";
17471747
break;
17481748

1749-
default:
1749+
case PlatformKind::none:
17501750
break;
17511751
}
17521752
}
@@ -1787,7 +1787,11 @@ bool PlatformAvailability::treatDeprecatedAsUnavailable(
17871787
Optional<unsigned> minor = version.getMinor();
17881788

17891789
switch (platformKind) {
1790+
case PlatformKind::none:
1791+
llvm_unreachable("version but no platform?");
1792+
17901793
case PlatformKind::OSX:
1794+
case PlatformKind::OSXApplicationExtension:
17911795
// Anything deprecated in OSX 10.9.x and earlier is unavailable in Swift.
17921796
return major < 10 ||
17931797
(major == 10 && (!minor.hasValue() || minor.getValue() <= 9));
@@ -1803,10 +1807,9 @@ bool PlatformAvailability::treatDeprecatedAsUnavailable(
18031807
case PlatformKind::watchOSApplicationExtension:
18041808
// No deprecation filter on watchOS
18051809
return false;
1806-
1807-
default:
1808-
return false;
18091810
}
1811+
1812+
llvm_unreachable("Unexpected platform");
18101813
}
18111814

18121815
ClangImporter::Implementation::Implementation(ASTContext &ctx,

branches/rxwei-patch-1/lib/Demangling/Demangler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2709,6 +2709,8 @@ NodePointer Demangler::demangleSpecialType() {
27092709
return popFunctionType(Node::Kind::AutoClosureType);
27102710
case 'U':
27112711
return popFunctionType(Node::Kind::UncurriedFunctionType);
2712+
case 'L':
2713+
return popFunctionType(Node::Kind::EscapingObjCBlock);
27122714
case 'B':
27132715
return popFunctionType(Node::Kind::ObjCBlock);
27142716
case 'C':

branches/rxwei-patch-1/lib/Demangling/NodePrinter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ class NodePrinter {
349349
case Node::Kind::Directness:
350350
case Node::Kind::DynamicAttribute:
351351
case Node::Kind::EscapingAutoClosureType:
352+
case Node::Kind::EscapingObjCBlock:
352353
case Node::Kind::NoEscapeFunctionType:
353354
case Node::Kind::ExplicitClosure:
354355
case Node::Kind::Extension:
@@ -1788,6 +1789,11 @@ NodePointer NodePrinter::print(NodePointer Node, bool asPrefixContext) {
17881789
printFunctionType(nullptr, Node);
17891790
return nullptr;
17901791
}
1792+
case Node::Kind::EscapingObjCBlock: {
1793+
Printer << "@escaping @convention(block) ";
1794+
printFunctionType(nullptr, Node);
1795+
return nullptr;
1796+
}
17911797
case Node::Kind::SILBoxType: {
17921798
Printer << "@box ";
17931799
NodePointer type = Node->getChild(0);

branches/rxwei-patch-1/lib/Demangling/OldRemangler.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,11 @@ void Remangler::mangleObjCBlock(Node *node) {
11291129
mangleChildNodes(node); // argument tuple, result type
11301130
}
11311131

1132+
void Remangler::mangleEscapingObjCBlock(Node *node) {
1133+
// We shouldn't ever be remangling anything with a DWARF-only mangling.
1134+
Buffer << "<escaping block type>";
1135+
}
1136+
11321137
void Remangler::mangleCFunctionPointer(Node *node) {
11331138
Buffer << 'c';
11341139
mangleChildNodes(node); // argument tuple, result type

branches/rxwei-patch-1/lib/Demangling/Remangler.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,11 @@ void Remangler::mangleObjCBlock(Node *node) {
16461646
Buffer << "XB";
16471647
}
16481648

1649+
void Remangler::mangleEscapingObjCBlock(Node *node) {
1650+
mangleChildNodesReversed(node);
1651+
Buffer << "XL";
1652+
}
1653+
16491654
void Remangler::mangleOwningAddressor(Node *node) {
16501655
mangleAbstractStorage(node->getFirstChild(), "lO");
16511656
}

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

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -761,28 +761,6 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
761761
return Size(size);
762762
}
763763

764-
#ifndef NDEBUG
765-
static bool areTypesReallyEqual(Type lhs, Type rhs) {
766-
// Due to an oversight, escaping and non-escaping @convention(block)
767-
// are mangled identically.
768-
auto eraseEscapingBlock = [](Type t) -> Type {
769-
return t.transform([](Type t) -> Type {
770-
if (auto *fnType = t->getAs<FunctionType>()) {
771-
if (fnType->getExtInfo().getRepresentation()
772-
== FunctionTypeRepresentation::Block) {
773-
return FunctionType::get(fnType->getParams(),
774-
fnType->getResult(),
775-
fnType->getExtInfo().withNoEscape(true));
776-
}
777-
}
778-
return t;
779-
});
780-
};
781-
782-
return eraseEscapingBlock(lhs)->isEqual(eraseEscapingBlock(rhs));
783-
}
784-
#endif
785-
786764
StringRef getMangledName(DebugTypeInfo DbgTy) {
787765
if (DbgTy.IsMetadataType)
788766
return MetadataTypeDeclCache.find(DbgTy.getDecl()->getName().str())
@@ -825,14 +803,12 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
825803
Ty->dump();
826804
abort();
827805
} else if (!Reconstructed->isEqual(Ty)) {
828-
if (!areTypesReallyEqual(Reconstructed, Ty)) {
829-
llvm::errs() << "Incorrect reconstructed type for " << Result << "\n";
830-
llvm::errs() << "Original type:\n";
831-
Ty->dump();
832-
llvm::errs() << "Reconstructed type:\n";
833-
Reconstructed->dump();
834-
abort();
835-
}
806+
llvm::errs() << "Incorrect reconstructed type for " << Result << "\n";
807+
llvm::errs() << "Original type:\n";
808+
Ty->dump();
809+
llvm::errs() << "Reconstructed type:\n";
810+
Reconstructed->dump();
811+
abort();
836812
}
837813
#endif
838814
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,8 +1963,9 @@ ParserResult<Expr> Parser::parseExprStringLiteral() {
19631963
unsigned QuoteLength;
19641964
tok QuoteKind;
19651965
std::tie(QuoteLength, QuoteKind) =
1966-
Tok.isMultilineString() ? std::make_tuple(3, tok::multiline_string_quote)
1967-
: std::make_tuple(1, tok::string_quote);
1966+
Tok.isMultilineString() ? std::make_tuple(3, tok::multiline_string_quote)
1967+
: std::make_tuple(1, Tok.getText().startswith("\'") ?
1968+
tok::single_quote: tok::string_quote);
19681969
unsigned CloseQuoteBegin = Tok.getLength() - DelimiterLength - QuoteLength;
19691970

19701971
OpenDelimiterStr = Tok.getRawText().take_front(DelimiterLength);

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3005,6 +3005,12 @@ void SILDebugScope::dump(SourceManager &SM, llvm::raw_ostream &OS,
30053005
}
30063006
OS << "}\n";
30073007
}
3008+
3009+
void SILDebugScope::dump(SILModule &Mod) const {
3010+
// We just use the default indent and llvm::errs().
3011+
dump(Mod.getASTContext().SourceMgr);
3012+
}
3013+
30083014
#endif
30093015

30103016
void SILSpecializeAttr::print(llvm::raw_ostream &OS) const {

branches/rxwei-patch-1/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,11 +1568,15 @@ collectDelegatingInitUses(const DIMemoryObjectInfo &TheMemory,
15681568
// be an end_borrow use in addition to the value_metatype.
15691569
if (isa<LoadBorrowInst>(User)) {
15701570
auto UserVal = cast<SingleValueInstruction>(User);
1571-
bool onlyUseIsValueMetatype = true;
1571+
bool onlyUseIsValueMetatype = false;
15721572
for (auto use : UserVal->getUses()) {
1573-
if (isa<EndBorrowInst>(use->getUser())
1574-
|| isa<ValueMetatypeInst>(use->getUser()))
1573+
auto *user = use->getUser();
1574+
if (isa<EndBorrowInst>(user))
15751575
continue;
1576+
if (isa<ValueMetatypeInst>(user)) {
1577+
onlyUseIsValueMetatype = true;
1578+
continue;
1579+
}
15761580
onlyUseIsValueMetatype = false;
15771581
break;
15781582
}

0 commit comments

Comments
 (0)