Skip to content

Commit a69fd76

Browse files
committed
Merge branch 'tensorflow-stage' into tensorflow-merge
2 parents e33974c + 01b3163 commit a69fd76

File tree

96 files changed

+1715
-1337
lines changed

Some content is hidden

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

96 files changed

+1715
-1337
lines changed

docs/ABI/Mangling.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,11 @@ implementation details of a function type.
655655
opaque-type-decl-name ::= entity 'QO' // opaque result type of specified decl
656656
#endif
657657

658+
#if SWIFT_VERSION >= 5.4
659+
type ::= 'Qu' // opaque result type (of current decl)
660+
// used for ObjC class runtime name purposes.
661+
#endif
662+
658663
Opaque return types have a special short representation in the mangling of
659664
their defining entity. In structural position, opaque types are fully qualified
660665
by mangling the defining entity for the opaque declaration and the substitutions

include/swift/AST/ASTWalker.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class ModuleDecl;
2525
class Stmt;
2626
class Pattern;
2727
class TypeRepr;
28-
class TypeLoc;
2928
class ParameterList;
3029
enum class AccessKind: unsigned char;
3130

@@ -177,19 +176,6 @@ class ASTWalker {
177176
/// returns failure.
178177
virtual bool walkToDeclPost(Decl *D) { return true; }
179178

180-
/// This method is called when first visiting a TypeLoc, before
181-
/// walking into its TypeRepr children. If it returns false, the subtree is
182-
/// skipped.
183-
///
184-
/// \param TL The TypeLoc to check.
185-
virtual bool walkToTypeLocPre(TypeLoc &TL) { return true; }
186-
187-
/// This method is called after visiting the children of a TypeLoc.
188-
/// If it returns false, the remaining traversal is terminated and returns
189-
/// failure.
190-
virtual bool walkToTypeLocPost(TypeLoc &TL) { return true; }
191-
192-
193179
/// This method is called when first visiting a TypeRepr, before
194180
/// walking into its children. If it returns false, the subtree is skipped.
195181
///

include/swift/AST/Decl.h

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -557,14 +557,14 @@ class alignas(1 << DeclAlignInBits) Decl {
557557
IsIncompatibleWithWeakReferences : 1
558558
);
559559

560-
SWIFT_INLINE_BITFIELD(StructDecl, NominalTypeDecl, 1+1,
561-
/// True if this struct has storage for fields that aren't accessible in
562-
/// Swift.
563-
HasUnreferenceableStorage : 1,
564-
/// True if this struct is imported from C++ and not trivially copyable.
565-
IsCxxNotTriviallyCopyable : 1
566-
);
567-
560+
SWIFT_INLINE_BITFIELD(
561+
StructDecl, NominalTypeDecl, 1 + 1,
562+
/// True if this struct has storage for fields that aren't accessible in
563+
/// Swift.
564+
HasUnreferenceableStorage : 1,
565+
/// True if this struct is imported from C++ and does not have trivial value witness functions.
566+
IsCxxNonTrivial : 1);
567+
568568
SWIFT_INLINE_BITFIELD(EnumDecl, NominalTypeDecl, 2+1,
569569
/// True if the enum has cases and at least one case has associated values.
570570
HasAssociatedValues : 2,
@@ -3786,13 +3786,9 @@ class StructDecl final : public NominalTypeDecl {
37863786
Bits.StructDecl.HasUnreferenceableStorage = v;
37873787
}
37883788

3789-
bool isCxxNotTriviallyCopyable() const {
3790-
return Bits.StructDecl.IsCxxNotTriviallyCopyable;
3791-
}
3789+
bool isCxxNonTrivial() const { return Bits.StructDecl.IsCxxNonTrivial; }
37923790

3793-
void setIsCxxNotTriviallyCopyable(bool v) {
3794-
Bits.StructDecl.IsCxxNotTriviallyCopyable = v;
3795-
}
3791+
void setIsCxxNonTrivial(bool v) { Bits.StructDecl.IsCxxNonTrivial = v; }
37963792
};
37973793

37983794
/// This is the base type for AncestryOptions. Each flag describes possible

include/swift/AST/Expr.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5259,7 +5259,6 @@ class KeyPathExpr : public Expr {
52595259
OptionalWrap,
52605260
Identity,
52615261
TupleElement,
5262-
DictionaryKey,
52635262
};
52645263

52655264
private:
@@ -5368,16 +5367,6 @@ class KeyPathExpr : public Expr {
53685367
propertyType,
53695368
loc);
53705369
}
5371-
5372-
/// Create a component for a dictionary key (#keyPath only).
5373-
static Component forDictionaryKey(DeclNameRef UnresolvedName,
5374-
Type valueType,
5375-
SourceLoc loc) {
5376-
return Component(nullptr, UnresolvedName, nullptr, {}, {},
5377-
Kind::DictionaryKey,
5378-
valueType,
5379-
loc);
5380-
}
53815370

53825371
/// Create a component for a subscript.
53835372
static Component forSubscript(ASTContext &ctx,
@@ -5468,7 +5457,6 @@ class KeyPathExpr : public Expr {
54685457
case Kind::Property:
54695458
case Kind::Identity:
54705459
case Kind::TupleElement:
5471-
case Kind::DictionaryKey:
54725460
return true;
54735461

54745462
case Kind::UnresolvedSubscript:
@@ -5493,7 +5481,6 @@ class KeyPathExpr : public Expr {
54935481
case Kind::Property:
54945482
case Kind::Identity:
54955483
case Kind::TupleElement:
5496-
case Kind::DictionaryKey:
54975484
return nullptr;
54985485
}
54995486
llvm_unreachable("unhandled kind");
@@ -5513,7 +5500,6 @@ class KeyPathExpr : public Expr {
55135500
case Kind::Property:
55145501
case Kind::Identity:
55155502
case Kind::TupleElement:
5516-
case Kind::DictionaryKey:
55175503
llvm_unreachable("no subscript labels for this kind");
55185504
}
55195505
llvm_unreachable("unhandled kind");
@@ -5536,7 +5522,6 @@ class KeyPathExpr : public Expr {
55365522
case Kind::Property:
55375523
case Kind::Identity:
55385524
case Kind::TupleElement:
5539-
case Kind::DictionaryKey:
55405525
return {};
55415526
}
55425527
llvm_unreachable("unhandled kind");
@@ -5548,7 +5533,6 @@ class KeyPathExpr : public Expr {
55485533
DeclNameRef getUnresolvedDeclName() const {
55495534
switch (getKind()) {
55505535
case Kind::UnresolvedProperty:
5551-
case Kind::DictionaryKey:
55525536
return Decl.UnresolvedName;
55535537

55545538
case Kind::Invalid:
@@ -5579,7 +5563,6 @@ class KeyPathExpr : public Expr {
55795563
case Kind::OptionalForce:
55805564
case Kind::Identity:
55815565
case Kind::TupleElement:
5582-
case Kind::DictionaryKey:
55835566
llvm_unreachable("no decl ref for this kind");
55845567
}
55855568
llvm_unreachable("unhandled kind");
@@ -5599,7 +5582,6 @@ class KeyPathExpr : public Expr {
55995582
case Kind::Identity:
56005583
case Kind::Property:
56015584
case Kind::Subscript:
5602-
case Kind::DictionaryKey:
56035585
llvm_unreachable("no field number for this kind");
56045586
}
56055587
llvm_unreachable("unhandled kind");

include/swift/AST/ForeignErrorConvention.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ class ForeignErrorConvention {
9595
CanType ResultType;
9696

9797
ForeignErrorConvention(Kind kind, unsigned parameterIndex, IsOwned_t isOwned,
98-
IsReplaced_t isReplaced, Type parameterType,
99-
Type resultType = Type())
98+
IsReplaced_t isReplaced, CanType parameterType,
99+
CanType resultType = CanType())
100100
: info(kind, parameterIndex, isOwned, isReplaced),
101101
ErrorParameterType(parameterType), ResultType(resultType) {}
102102

include/swift/AST/Pattern.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ namespace swift {
3434
class Expr;
3535
enum class CheckedCastKind : unsigned;
3636
class TypeExpr;
37-
class TypeLoc;
3837

3938
/// PatternKind - The classification of different kinds of
4039
/// value-matching pattern.
@@ -447,7 +446,6 @@ class TypedPattern : public Pattern {
447446

448447
TypeRepr *getTypeRepr() const { return PatTypeRepr; }
449448

450-
TypeLoc getTypeLoc() const;
451449
SourceLoc getLoc() const;
452450
SourceRange getSourceRange() const;
453451

include/swift/AST/Stmt.h

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -814,13 +814,13 @@ class CaseLabelItem {
814814
Default,
815815
};
816816

817-
Pattern *CasePattern;
817+
llvm::PointerIntPair<Pattern *, 1, bool> CasePatternAndResolved;
818818
SourceLoc WhereLoc;
819819
llvm::PointerIntPair<Expr *, 1, Kind> GuardExprAndKind;
820820

821821
CaseLabelItem(Kind kind, Pattern *casePattern, SourceLoc whereLoc,
822822
Expr *guardExpr)
823-
: CasePattern(casePattern), WhereLoc(whereLoc),
823+
: CasePatternAndResolved(casePattern, false), WhereLoc(whereLoc),
824824
GuardExprAndKind(guardExpr, kind) {}
825825

826826
public:
@@ -848,9 +848,19 @@ class CaseLabelItem {
848848
SourceLoc getEndLoc() const;
849849
SourceRange getSourceRange() const;
850850

851-
Pattern *getPattern() { return CasePattern; }
852-
const Pattern *getPattern() const { return CasePattern; }
853-
void setPattern(Pattern *CasePattern) { this->CasePattern = CasePattern; }
851+
Pattern *getPattern() {
852+
return CasePatternAndResolved.getPointer();
853+
}
854+
const Pattern *getPattern() const {
855+
return CasePatternAndResolved.getPointer();
856+
}
857+
bool isPatternResolved() const {
858+
return CasePatternAndResolved.getInt();
859+
}
860+
void setPattern(Pattern *CasePattern, bool resolved) {
861+
this->CasePatternAndResolved.setPointer(CasePattern);
862+
this->CasePatternAndResolved.setInt(resolved);
863+
}
854864

855865
/// Return the guard expression if present, or null if the case label has
856866
/// no guard.
@@ -1073,6 +1083,10 @@ class CaseStmt final
10731083
return *CaseBodyVariables;
10741084
}
10751085

1086+
/// Find the next case statement within the same 'switch' or 'do-catch',
1087+
/// if there is one.
1088+
CaseStmt *findNextCaseStmt() const;
1089+
10761090
static bool classof(const Stmt *S) { return S->getKind() == StmtKind::Case; }
10771091

10781092
size_t numTrailingObjects(OverloadToken<CaseLabelItem>) const {

include/swift/Frontend/Frontend.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ class CompilerInvocation {
128128
bool parseArgs(ArrayRef<const char *> Args, DiagnosticEngine &Diags,
129129
SmallVectorImpl<std::unique_ptr<llvm::MemoryBuffer>>
130130
*ConfigurationFileBuffers = nullptr,
131-
StringRef workingDirectory = {});
131+
StringRef workingDirectory = {},
132+
StringRef mainExecutablePath = {});
132133

133134
/// Sets specific options based on the given serialized Swift binary data.
134135
///
@@ -213,8 +214,11 @@ class CompilerInvocation {
213214
/// Computes the runtime resource path relative to the given Swift
214215
/// executable.
215216
static void computeRuntimeResourcePathFromExecutablePath(
216-
StringRef mainExecutablePath,
217-
llvm::SmallString<128> &runtimeResourcePath);
217+
StringRef mainExecutablePath, bool shared,
218+
llvm::SmallVectorImpl<char> &runtimeResourcePath);
219+
220+
/// Appends `lib/swift[_static]` to the given path
221+
static void appendSwiftLibDir(llvm::SmallVectorImpl<char> &path, bool shared);
218222

219223
void setSDKPath(const std::string &Path);
220224

include/swift/Frontend/FrontendOptions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ class FrontendOptions {
286286
/// -dump-scope-maps.
287287
SmallVector<std::pair<unsigned, unsigned>, 2> DumpScopeMapLocations;
288288

289+
/// Determines whether the static or shared resource folder is used.
290+
/// When set to `true`, the default resource folder will be set to
291+
/// '.../lib/swift', otherwise '.../lib/swift_static'.
292+
bool UseSharedResourceFolder = true;
293+
289294
/// \return true if action only parses without doing other compilation steps.
290295
static bool shouldActionOnlyParse(ActionType);
291296

include/swift/IDE/Utils.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,6 @@ class NameMatcher: public ASTWalker {
280280
bool walkToDeclPost(Decl *D) override;
281281
std::pair<bool, Stmt*> walkToStmtPre(Stmt *S) override;
282282
Stmt* walkToStmtPost(Stmt *S) override;
283-
bool walkToTypeLocPre(TypeLoc &TL) override;
284-
bool walkToTypeLocPost(TypeLoc &TL) override;
285283
bool walkToTypeReprPre(TypeRepr *T) override;
286284
bool walkToTypeReprPost(TypeRepr *T) override;
287285
std::pair<bool, Pattern*> walkToPatternPre(Pattern *P) override;

0 commit comments

Comments
 (0)