Skip to content

Commit cea7c5d

Browse files
committed
---
yaml --- r: 343134 b: refs/heads/master-rebranch c: e7fdd67 h: refs/heads/master
1 parent 8ba6908 commit cea7c5d

File tree

126 files changed

+1827
-4082
lines changed

Some content is hidden

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

126 files changed

+1827
-4082
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-02-a: ddd2b2976aa9bfde5f20fe37f6bd2
14551455
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-03-a: 171cc166f2abeb5ca2a4003700a8a78a108bd300
14561456
refs/heads/benlangmuir-patch-1: baaebaf39d52f3bf36710d4fe40cf212e996b212
14571457
refs/heads/i-do-redeclare: 8c4e6d5de5c1e3f0a2cedccf319df713ea22c48e
1458-
refs/heads/master-rebranch: abe7c8f49ba547f5050bd960b69fa360af19ea06
1458+
refs/heads/master-rebranch: e7fdd67d4d818280d2a07b77da0dfd3eb8f69e05
14591459
refs/heads/rdar-53901732: 9bd06af3284e18a109cdbf9aa59d833b24eeca7b
14601460
refs/heads/revert-26776-subst-always-returns-a-type: 1b8e18fdd391903a348970a4c848995d4cdd789c
14611461
refs/heads/tensorflow-merge: 8b854f62f80d4476cb383d43c4aac2001dde3cec

branches/master-rebranch/include/swift/AST/ASTNode.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ namespace swift {
3636
enum class DeclKind : uint8_t;
3737
enum class StmtKind;
3838

39-
struct ASTNode : public llvm::PointerUnion<Expr*, Stmt*, Decl*> {
39+
struct ASTNode : public llvm::PointerUnion3<Expr*, Stmt*, Decl*> {
4040
// Inherit the constructors from PointerUnion.
41-
using PointerUnion::PointerUnion;
42-
41+
using PointerUnion3::PointerUnion3;
42+
4343
SourceRange getSourceRange() const;
4444

4545
/// Return the location of the start of the statement.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4789,7 +4789,7 @@ class VarDecl : public AbstractStorageDecl {
47894789
};
47904790

47914791
protected:
4792-
PointerUnion<PatternBindingDecl *, Stmt *, VarDecl *> Parent;
4792+
PointerUnion3<PatternBindingDecl *, Stmt *, VarDecl *> Parent;
47934793

47944794
VarDecl(DeclKind kind, bool isStatic, Introducer introducer,
47954795
bool issCaptureList, SourceLoc nameLoc, Identifier name,

branches/master-rebranch/include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ WARNING(implicit_bridging_header_imported_from_module,none,
9191
"is deprecated and will be removed in a later version of Swift",
9292
(StringRef, Identifier))
9393

94+
WARNING(clang_vfs_overlay_is_ignored,none,
95+
"ignoring '-ivfsoverlay' options provided to '-Xcc' in favor of "
96+
"'-vfsoverlay'", ())
97+
9498
#ifndef DIAG_NO_UNDEF
9599
# if defined(DIAG)
96100
# undef DIAG

branches/master-rebranch/include/swift/AST/GenericSignatureBuilder.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ class GenericSignatureBuilder {
9292
class ResolvedType;
9393

9494
using UnresolvedRequirementRHS =
95-
llvm::PointerUnion<Type, PotentialArchetype *, LayoutConstraint>;
95+
llvm::PointerUnion3<Type, PotentialArchetype *, LayoutConstraint>;
9696

9797
using RequirementRHS =
98-
llvm::PointerUnion<Type, PotentialArchetype *, LayoutConstraint>;
98+
llvm::PointerUnion3<Type, PotentialArchetype *, LayoutConstraint>;
9999

100100
/// The location of a requirement as written somewhere in the source.
101101
typedef llvm::PointerUnion<const TypeRepr *, const RequirementRepr *>
@@ -1374,8 +1374,8 @@ class GenericSignatureBuilder::FloatingRequirementSource {
13741374
} kind;
13751375

13761376
using Storage =
1377-
llvm::PointerUnion<const RequirementSource *, const TypeRepr *,
1378-
const RequirementRepr *>;
1377+
llvm::PointerUnion3<const RequirementSource *, const TypeRepr *,
1378+
const RequirementRepr *>;
13791379

13801380
Storage storage;
13811381

branches/master-rebranch/include/swift/AST/ModuleLoader.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
#include "llvm/ADT/SmallSet.h"
2525
#include "llvm/ADT/TinyPtrVector.h"
2626

27-
namespace llvm {
28-
class FileCollector;
29-
}
30-
3127
namespace clang {
3228
class DependencyCollector;
3329
}
@@ -58,9 +54,8 @@ enum class Bridgeability : unsigned {
5854
class DependencyTracker {
5955
std::shared_ptr<clang::DependencyCollector> clangCollector;
6056
public:
61-
explicit DependencyTracker(
62-
bool TrackSystemDeps,
63-
std::shared_ptr<llvm::FileCollector> FileCollector = {});
57+
58+
explicit DependencyTracker(bool TrackSystemDeps);
6459

6560
/// Adds a file as a dependency.
6661
///

branches/master-rebranch/include/swift/AST/TypeCheckRequests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ struct WhereClauseOwner {
369369

370370
/// The source of the where clause, which can be a generic parameter list
371371
/// or a declaration that can have a where clause.
372-
llvm::PointerUnion<GenericParamList *, Decl *, SpecializeAttr *> source;
372+
llvm::PointerUnion3<GenericParamList *, Decl *, SpecializeAttr *> source;
373373

374374
WhereClauseOwner(Decl *decl);
375375

branches/master-rebranch/include/swift/Basic/LLVM.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ namespace llvm {
4242
template<typename T> class MutableArrayRef;
4343
template<typename T> class TinyPtrVector;
4444
template<typename T> class Optional;
45-
template <typename ...PTs> class PointerUnion;
45+
template <typename PT1, typename PT2> class PointerUnion;
46+
template <typename PT1, typename PT2, typename PT3> class PointerUnion3;
4647
class SmallBitVector;
4748

4849
// Other common classes.
@@ -67,6 +68,7 @@ namespace swift {
6768
using llvm::None;
6869
using llvm::Optional;
6970
using llvm::PointerUnion;
71+
using llvm::PointerUnion3;
7072
using llvm::SmallBitVector;
7173
using llvm::SmallPtrSet;
7274
using llvm::SmallPtrSetImpl;

branches/master-rebranch/include/swift/ClangImporter/ClangImporter.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
namespace llvm {
2525
class Triple;
26-
class FileCollector;
2726
template<typename Fn> class function_ref;
2827
}
2928

@@ -148,8 +147,7 @@ class ClangImporter final : public ClangModuleLoader {
148147
/// Create a new clang::DependencyCollector customized to
149148
/// ClangImporter's specific uses.
150149
static std::shared_ptr<clang::DependencyCollector>
151-
createDependencyCollector(bool TrackSystemDeps,
152-
std::shared_ptr<llvm::FileCollector> FileCollector);
150+
createDependencyCollector(bool TrackSystemDeps);
153151

154152
/// Append visible module names to \p names. Note that names are possibly
155153
/// duplicated, and not guaranteed to be ordered in any way.

branches/master-rebranch/include/swift/ClangImporter/ClangImporterOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ class ClangImporterOptions {
9696
/// When set, don't enforce warnings with -Werror.
9797
bool DebuggerSupport = false;
9898

99+
/// When set, clobber the Clang instance's virtual file system with the Swift
100+
/// virtual file system.
101+
bool ForceUseSwiftVirtualFileSystem = false;
102+
99103
/// Return a hash code of any components from these options that should
100104
/// contribute to a Swift Bridging PCH hash.
101105
llvm::hash_code getPCHHashComponents() const {

branches/master-rebranch/include/swift/LLVMPasses/Passes.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,8 @@ namespace swift {
3030
const llvm::PreservedAnalyses &) { return false; }
3131

3232
using AAResultBase::getModRefInfo;
33-
llvm::ModRefInfo getModRefInfo(const llvm::CallBase *Call,
34-
const llvm::MemoryLocation &Loc) {
35-
llvm::AAQueryInfo AAQI;
36-
return getModRefInfo(Call, Loc, AAQI);
37-
}
38-
llvm::ModRefInfo getModRefInfo(const llvm::CallBase *Call,
39-
const llvm::MemoryLocation &Loc,
40-
llvm::AAQueryInfo &AAQI);
33+
llvm::ModRefInfo getModRefInfo(llvm::ImmutableCallSite CS,
34+
const llvm::MemoryLocation &Loc);
4135
};
4236

4337
class SwiftAAWrapperPass : public llvm::ImmutablePass {

branches/master-rebranch/include/swift/Parse/ASTGen.h

Lines changed: 28 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -14,108 +14,54 @@
1414
#define SWIFT_PARSE_ASTGEN_H
1515

1616
#include "swift/AST/ASTContext.h"
17-
#include "swift/AST/Decl.h"
1817
#include "swift/AST/Expr.h"
19-
#include "swift/Parse/PersistentParserState.h"
2018
#include "swift/Syntax/SyntaxNodes.h"
2119
#include "llvm/ADT/DenseMap.h"
2220

2321
namespace swift {
2422
/// Generates AST nodes from Syntax nodes.
2523
class ASTGen {
2624
ASTContext &Context;
27-
28-
/// Type cache to prevent multiple transformations of the same syntax node.
29-
llvm::DenseMap<syntax::SyntaxNodeId, TypeRepr *> TypeCache;
30-
31-
PersistentParserState **ParserState;
32-
33-
// FIXME: remove when Syntax can represent all types and ASTGen can handle them
34-
/// Types that cannot be represented by Syntax or generated by ASTGen.
35-
llvm::DenseMap<SourceLoc, TypeRepr *> Types;
25+
// A stack of source locations of syntax constructs. Allows us to get the
26+
// SourceLoc necessary to create AST nodes for nodes in not-yet-complete
27+
// Syntax tree. The topmost item should always correspond to the token/node
28+
// that has been parsed/transformed most recently.
29+
// todo [gsoc]: remove when possible
30+
llvm::SmallVector<SourceLoc, 16> LocStack;
3631

3732
public:
38-
ASTGen(ASTContext &Context, PersistentParserState **ParserState)
39-
: Context(Context), ParserState(ParserState) {}
40-
41-
SourceLoc generate(syntax::TokenSyntax Tok, SourceLoc &Loc);
42-
43-
Expr *generate(syntax::IntegerLiteralExprSyntax &Expr, SourceLoc &Loc);
44-
Expr *generate(syntax::FloatLiteralExprSyntax &Expr, SourceLoc &Loc);
45-
Expr *generate(syntax::NilLiteralExprSyntax &Expr, SourceLoc &Loc);
46-
Expr *generate(syntax::BooleanLiteralExprSyntax &Expr, SourceLoc &Loc);
47-
Expr *generate(syntax::PoundFileExprSyntax &Expr, SourceLoc &Loc);
48-
Expr *generate(syntax::PoundLineExprSyntax &Expr, SourceLoc &Loc);
49-
Expr *generate(syntax::PoundColumnExprSyntax &Expr, SourceLoc &Loc);
50-
Expr *generate(syntax::PoundFunctionExprSyntax &Expr, SourceLoc &Loc);
51-
Expr *generate(syntax::PoundDsohandleExprSyntax &Expr, SourceLoc &Loc);
52-
Expr *generate(syntax::UnknownExprSyntax &Expr, SourceLoc &Loc);
53-
54-
TypeRepr *generate(syntax::TypeSyntax Type, SourceLoc &Loc);
55-
TypeRepr *generate(syntax::SomeTypeSyntax Type, SourceLoc &Loc);
56-
TypeRepr *generate(syntax::CompositionTypeSyntax Type, SourceLoc &Loc);
57-
TypeRepr *generate(syntax::SimpleTypeIdentifierSyntax Type, SourceLoc &Loc);
58-
TypeRepr *generate(syntax::MemberTypeIdentifierSyntax Type, SourceLoc &Loc);
59-
TypeRepr *generate(syntax::DictionaryTypeSyntax Type, SourceLoc &Loc);
60-
TypeRepr *generate(syntax::ArrayTypeSyntax Type, SourceLoc &Loc);
61-
TypeRepr *generate(syntax::TupleTypeSyntax Type, SourceLoc &Loc);
62-
TypeRepr *generate(syntax::AttributedTypeSyntax Type, SourceLoc &Loc);
63-
TypeRepr *generate(syntax::FunctionTypeSyntax Type, SourceLoc &Loc);
64-
TypeRepr *generate(syntax::MetatypeTypeSyntax Type, SourceLoc &Loc);
65-
TypeRepr *generate(syntax::OptionalTypeSyntax Type, SourceLoc &Loc);
66-
TypeRepr *generate(syntax::ImplicitlyUnwrappedOptionalTypeSyntax Type, SourceLoc &Loc);
67-
TypeRepr *generate(syntax::UnknownTypeSyntax Type, SourceLoc &Loc);
68-
69-
TypeRepr *generate(syntax::GenericArgumentSyntax Arg, SourceLoc &Loc);
70-
llvm::SmallVector<TypeRepr *, 4>
71-
generate(syntax::GenericArgumentListSyntax Args, SourceLoc &Loc);
33+
explicit ASTGen(ASTContext &Context) : Context(Context) {}
34+
35+
IntegerLiteralExpr *generate(syntax::IntegerLiteralExprSyntax &Expr);
36+
FloatLiteralExpr *generate(syntax::FloatLiteralExprSyntax &Expr);
37+
NilLiteralExpr *generate(syntax::NilLiteralExprSyntax &Expr);
38+
BooleanLiteralExpr *generate(syntax::BooleanLiteralExprSyntax &Expr);
39+
MagicIdentifierLiteralExpr *generate(syntax::PoundFileExprSyntax &Expr);
40+
MagicIdentifierLiteralExpr *generate(syntax::PoundLineExprSyntax &Expr);
41+
MagicIdentifierLiteralExpr *generate(syntax::PoundColumnExprSyntax &Expr);
42+
MagicIdentifierLiteralExpr *generate(syntax::PoundFunctionExprSyntax &Expr);
43+
MagicIdentifierLiteralExpr *generate(syntax::PoundDsohandleExprSyntax &Expr);
44+
Expr *generate(syntax::UnknownExprSyntax &Expr);
45+
46+
/// Stores source location necessary for AST creation.
47+
void pushLoc(SourceLoc Loc);
7248

7349
/// Copy a numeric literal value into AST-owned memory, stripping underscores
7450
/// so the semantic part of the value can be parsed by APInt/APFloat parsers.
7551
static StringRef copyAndStripUnderscores(StringRef Orig, ASTContext &Context);
7652

7753
private:
78-
Expr *generateMagicIdentifierLiteralExpression(syntax::TokenSyntax PoundToken,
79-
SourceLoc &Loc);
80-
81-
TupleTypeRepr *generateTuple(syntax::TokenSyntax LParen,
82-
syntax::TupleTypeElementListSyntax Elements,
83-
syntax::TokenSyntax RParen, SourceLoc &Loc,
84-
bool IsFunction = false);
85-
86-
void gatherTypeIdentifierComponents(
87-
syntax::TypeSyntax Component, SourceLoc &Loc,
88-
llvm::SmallVectorImpl<ComponentIdentTypeRepr *> &Components);
89-
90-
template <typename T>
91-
TypeRepr *generateSimpleOrMemberIdentifier(T Type, SourceLoc &Loc);
92-
93-
template <typename T>
94-
ComponentIdentTypeRepr *generateIdentifier(T Type, SourceLoc &Loc);
95-
9654
StringRef copyAndStripUnderscores(StringRef Orig);
9755

98-
static SourceLoc advanceLocBegin(const SourceLoc &Loc,
99-
const syntax::Syntax &Node);
100-
static SourceLoc advanceLocEnd(const SourceLoc &Loc,
101-
const syntax::TokenSyntax &Token);
102-
static SourceLoc advanceLocAfter(const SourceLoc &Loc,
103-
const syntax::Syntax &Node);
104-
105-
static MagicIdentifierLiteralExpr::Kind getMagicIdentifierLiteralKind(tok Kind);
106-
107-
ValueDecl *lookupInScope(DeclName Name);
108-
109-
TypeRepr *cacheType(syntax::TypeSyntax Type, TypeRepr *TypeAST);
110-
111-
TypeRepr *lookupType(syntax::TypeSyntax Type);
112-
113-
public:
114-
TypeRepr *addType(TypeRepr *Type, const SourceLoc &Loc);
56+
SourceLoc topLoc();
11557

116-
bool hasType(const SourceLoc &Loc) const;
58+
MagicIdentifierLiteralExpr *
59+
generateMagicIdentifierLiteralExpr(const syntax::TokenSyntax &PoundToken);
11760

118-
TypeRepr *getType(const SourceLoc &Loc) const;
61+
/// Map magic literal tokens such as #file to their MagicIdentifierLiteralExpr
62+
/// kind.
63+
static MagicIdentifierLiteralExpr::Kind
64+
getMagicIdentifierLiteralKind(tok Kind);
11965
};
12066
} // namespace swift
12167

branches/master-rebranch/include/swift/Parse/ParsedRawSyntaxNode.h

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,9 @@ class ParsedRawSyntaxNode {
136136
/// Primary used for a deferred missing token.
137137
bool isMissing() const { return IsMissing; }
138138

139-
CharSourceRange getDeferredRange() const {
140-
switch (DK) {
141-
case DataKind::DeferredLayout:
142-
return getDeferredLayoutRange();
143-
case DataKind::DeferredToken:
144-
return getDeferredTokenRangeWithoutBackticks();
145-
default:
146-
llvm_unreachable("node not deferred");
147-
}
148-
}
149-
150139
// Recorded Data ===========================================================//
151140

152-
CharSourceRange getRecordedRange() const {
141+
CharSourceRange getRange() const {
153142
assert(isRecorded());
154143
return RecordedData.Range;
155144
}
@@ -160,20 +149,6 @@ class ParsedRawSyntaxNode {
160149

161150
// Deferred Layout Data ====================================================//
162151

163-
CharSourceRange getDeferredLayoutRange() const {
164-
assert(DK == DataKind::DeferredLayout);
165-
assert(!DeferredLayout.Children.empty());
166-
auto getLastNonNullChild = [this]() {
167-
for (auto &&Child : llvm::reverse(getDeferredChildren()))
168-
if (!Child.isNull())
169-
return Child;
170-
llvm_unreachable("layout node without non-null children");
171-
};
172-
auto firstRange = DeferredLayout.Children.front().getDeferredRange();
173-
auto lastRange = getLastNonNullChild().getDeferredRange();
174-
firstRange.widen(lastRange);
175-
return firstRange;
176-
}
177152
ArrayRef<ParsedRawSyntaxNode> getDeferredChildren() const {
178153
assert(DK == DataKind::DeferredLayout);
179154
return DeferredLayout.Children;

0 commit comments

Comments
 (0)