Skip to content

Commit 64f4efb

Browse files
Resolving conflicts
2 parents 0384913 + 1857a37 commit 64f4efb

File tree

169 files changed

+3835
-2700
lines changed

Some content is hidden

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

169 files changed

+3835
-2700
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Please make sure you use Python 2.x. Python 3.x is not supported currently.
8787

8888
#### macOS
8989

90-
To build for macOS, you need [Xcode 11 beta 5](https://developer.apple.com/xcode/downloads/).
90+
To build for macOS, you need [Xcode 11 beta 6](https://developer.apple.com/xcode/downloads/).
9191
The required version of Xcode changes frequently, and is often a beta release.
9292
Check this document or the host information on <https://ci.swift.org> for the
9393
current required version.

include/swift/AST/Decl.h

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ class alignas(1 << DeclAlignInBits) Decl {
286286
protected:
287287
union { uint64_t OpaqueBits;
288288

289-
SWIFT_INLINE_BITFIELD_BASE(Decl, bitmax(NumDeclKindBits,8)+1+1+1+1+1+1+1,
289+
SWIFT_INLINE_BITFIELD_BASE(Decl, bitmax(NumDeclKindBits,8)+1+1+1+1+2+1,
290290
Kind : bitmax(NumDeclKindBits,8),
291291

292292
/// Whether this declaration is invalid.
@@ -301,10 +301,6 @@ class alignas(1 << DeclAlignInBits) Decl {
301301
/// Use getClangNode() to retrieve the corresponding Clang AST.
302302
FromClang : 1,
303303

304-
/// Whether we've already performed early attribute validation.
305-
/// FIXME: This is ugly.
306-
EarlyAttrValidation : 1,
307-
308304
/// The validation state of this declaration.
309305
ValidationState : 2,
310306

@@ -694,7 +690,6 @@ class alignas(1 << DeclAlignInBits) Decl {
694690
Bits.Decl.Invalid = false;
695691
Bits.Decl.Implicit = false;
696692
Bits.Decl.FromClang = false;
697-
Bits.Decl.EarlyAttrValidation = false;
698693
Bits.Decl.ValidationState = unsigned(ValidationState::Unchecked);
699694
Bits.Decl.EscapedFromIfConfig = false;
700695
}
@@ -836,14 +831,6 @@ class alignas(1 << DeclAlignInBits) Decl {
836831
/// Mark this declaration as implicit.
837832
void setImplicit(bool implicit = true) { Bits.Decl.Implicit = implicit; }
838833

839-
/// Whether we have already done early attribute validation.
840-
bool didEarlyAttrValidation() const { return Bits.Decl.EarlyAttrValidation; }
841-
842-
/// Set whether we've performed early attribute validation.
843-
void setEarlyAttrValidation(bool validated = true) {
844-
Bits.Decl.EarlyAttrValidation = validated;
845-
}
846-
847834
/// Get the validation state.
848835
ValidationState getValidationState() const {
849836
return ValidationState(Bits.Decl.ValidationState);
@@ -5934,7 +5921,7 @@ class OperatorDecl;
59345921
enum class SelfAccessKind : uint8_t {
59355922
NonMutating,
59365923
Mutating,
5937-
__Consuming,
5924+
Consuming,
59385925
};
59395926

59405927
/// Diagnostic printing of \c SelfAccessKind.
@@ -6037,7 +6024,7 @@ class FuncDecl : public AbstractFunctionDecl {
60376024
return getSelfAccessKind() == SelfAccessKind::NonMutating;
60386025
}
60396026
bool isConsuming() const {
6040-
return getSelfAccessKind() == SelfAccessKind::__Consuming;
6027+
return getSelfAccessKind() == SelfAccessKind::Consuming;
60416028
}
60426029

60436030
SelfAccessKind getSelfAccessKind() const;

include/swift/AST/DeclContext.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,15 +487,11 @@ class alignas(1 << DeclContextAlignInBits) DeclContext {
487487
/// \param options Options that control name lookup, based on the
488488
/// \c NL_* constants in \c NameLookupOptions.
489489
///
490-
/// \param typeResolver Used to resolve types, usually for overload purposes.
491-
/// May be null.
492-
///
493490
/// \param[out] decls Will be populated with the declarations found by name
494491
/// lookup.
495492
///
496493
/// \returns true if anything was found.
497494
bool lookupQualified(Type type, DeclName member, NLOptions options,
498-
LazyResolver *typeResolver,
499495
SmallVectorImpl<ValueDecl *> &decls) const;
500496

501497
/// Look for the set of declarations with the given name within the

include/swift/AST/Expr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4656,7 +4656,8 @@ class AssignExpr : public Expr {
46564656
}
46574657
SourceLoc getEndLoc() const {
46584658
if (!isFolded()) return EqualLoc;
4659-
return (Src->getEndLoc().isValid() ? Src->getEndLoc() : Dest->getEndLoc());
4659+
auto SrcEnd = Src->getEndLoc();
4660+
return (SrcEnd.isValid() ? SrcEnd : Dest->getEndLoc());
46604661
}
46614662

46624663
/// True if the node has been processed by binary expression folding.

include/swift/AST/Module.h

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ namespace swift {
6060
class InfixOperatorDecl;
6161
class LazyResolver;
6262
class LinkLibrary;
63-
class LookupCache;
6463
class ModuleLoader;
6564
class NominalTypeDecl;
6665
class EnumElementDecl;
@@ -80,6 +79,7 @@ namespace swift {
8079
class VisibleDeclConsumer;
8180
class SyntaxParsingCache;
8281
class ASTScope;
82+
class SourceLookupCache;
8383

8484
namespace syntax {
8585
class SourceFileSyntax;
@@ -193,7 +193,7 @@ class ModuleDecl : public DeclContext, public TypeDecl {
193193

194194
/// This is a convenience function that writes the entire name, in forward
195195
/// order, to \p out.
196-
void printForward(raw_ostream &out) const;
196+
void printForward(raw_ostream &out, StringRef delim = ".") const;
197197
};
198198

199199
private:
@@ -204,6 +204,9 @@ class ModuleDecl : public DeclContext, public TypeDecl {
204204

205205
SmallVector<FileUnit *, 2> Files;
206206

207+
std::unique_ptr<SourceLookupCache> Cache;
208+
SourceLookupCache &getSourceLookupCache() const;
209+
207210
/// Tracks the file that will generate the module's entry point, either
208211
/// because it contains a class marked with \@UIApplicationMain
209212
/// or \@NSApplicationMain, or because it is a script file.
@@ -378,6 +381,12 @@ class ModuleDecl : public DeclContext, public TypeDecl {
378381
VisibleDeclConsumer &Consumer,
379382
NLKind LookupKind) const;
380383

384+
/// This is a hack for 'main' file parsing and the integrated REPL.
385+
///
386+
/// FIXME: Refactor main file parsing to not pump the parser incrementally.
387+
/// FIXME: Remove the integrated REPL.
388+
void clearLookupCache();
389+
381390
/// @{
382391

383392
/// Look up the given operator in this module.
@@ -913,7 +922,6 @@ static inline unsigned alignOfFileUnit() {
913922
/// IR generation.
914923
class SourceFile final : public FileUnit {
915924
public:
916-
class LookupCache;
917925
class Impl;
918926
struct SourceFileSyntaxInfo;
919927

@@ -962,8 +970,8 @@ class SourceFile final : public FileUnit {
962970
};
963971

964972
private:
965-
std::unique_ptr<LookupCache> Cache;
966-
LookupCache &getCache() const;
973+
std::unique_ptr<SourceLookupCache> Cache;
974+
SourceLookupCache &getCache() const;
967975

968976
/// This is the list of modules that are imported by this module.
969977
///
@@ -1118,6 +1126,10 @@ class SourceFile final : public FileUnit {
11181126

11191127
bool isImportedImplementationOnly(const ModuleDecl *module) const;
11201128

1129+
/// This is a hack for 'main' file parsing and the integrated REPL.
1130+
///
1131+
/// FIXME: Refactor main file parsing to not pump the parser incrementally.
1132+
/// FIXME: Remove the integrated REPL.
11211133
void clearLookupCache();
11221134

11231135
void cacheVisibleDecls(SmallVectorImpl<ValueDecl *> &&globals) const;

include/swift/AST/NameLookup.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ namespace swift {
3232
class DeclName;
3333
class Expr;
3434
class GenericSignatureBuilder;
35-
class LazyResolver;
3635
class TupleType;
3736
class Type;
3837
class TypeDecl;
@@ -147,7 +146,7 @@ class UnqualifiedLookup {
147146
///
148147
/// If the current DeclContext is nested in a function body, the SourceLoc
149148
/// is used to determine which declarations in that body are visible.
150-
UnqualifiedLookup(DeclName Name, DeclContext *DC, LazyResolver *TypeResolver,
149+
UnqualifiedLookup(DeclName Name, DeclContext *DC,
151150
SourceLoc Loc = SourceLoc(), Options options = Options());
152151

153152
using ResultsVector = SmallVector<LookupResultEntry, 4>;
@@ -394,7 +393,6 @@ bool removeShadowedDecls(SmallVectorImpl<ValueDecl*> &decls,
394393
/// are visible.
395394
void lookupVisibleDecls(VisibleDeclConsumer &Consumer,
396395
const DeclContext *DC,
397-
LazyResolver *typeResolver,
398396
bool IncludeTopLevel,
399397
SourceLoc Loc = SourceLoc());
400398

@@ -405,7 +403,6 @@ void lookupVisibleDecls(VisibleDeclConsumer &Consumer,
405403
void lookupVisibleMemberDecls(VisibleDeclConsumer &Consumer,
406404
Type BaseTy,
407405
const DeclContext *CurrDC,
408-
LazyResolver *typeResolver,
409406
bool includeInstanceMembers,
410407
GenericSignatureBuilder *GSB = nullptr);
411408

@@ -433,16 +430,13 @@ enum class ResolutionKind {
433430
/// \param[out] decls Any found decls will be added to this vector.
434431
/// \param lookupKind Whether this lookup is qualified or unqualified.
435432
/// \param resolutionKind What sort of decl is expected.
436-
/// \param typeResolver The type resolver for decls that need to be
437-
/// type-checked. This is needed for shadowing resolution.
438433
/// \param moduleScopeContext The top-level context from which the lookup is
439434
/// being performed, for checking access. This must be either a
440435
/// FileUnit or a Module.
441436
/// \param extraImports Private imports to include in this search.
442437
void lookupInModule(ModuleDecl *module, ModuleDecl::AccessPathTy accessPath,
443438
DeclName name, SmallVectorImpl<ValueDecl *> &decls,
444439
NLKind lookupKind, ResolutionKind resolutionKind,
445-
LazyResolver *typeResolver,
446440
const DeclContext *moduleScopeContext,
447441
ArrayRef<ModuleDecl::ImportedModule> extraImports = {});
448442

@@ -508,7 +502,6 @@ lookupVisibleDeclsInModule(ModuleDecl *M, ModuleDecl::AccessPathTy accessPath,
508502
SmallVectorImpl<ValueDecl *> &decls,
509503
NLKind lookupKind,
510504
ResolutionKind resolutionKind,
511-
LazyResolver *typeResolver,
512505
const DeclContext *moduleScopeContext,
513506
ArrayRef<ModuleDecl::ImportedModule> extraImports = {});
514507

include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ namespace swift {
213213
unsigned SolverShrinkUnsolvedThreshold = 10;
214214

215215
/// Enable one-way constraints in function builders.
216-
bool FunctionBuilderOneWayConstraints = false;
216+
bool FunctionBuilderOneWayConstraints = true;
217217

218218
/// Disable the shrink phase of the expression type checker.
219219
bool SolverDisableShrink = false;

include/swift/Basic/Statistics.def

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,28 @@ FRONTEND_STATISTIC(AST, NumPrefixOperators)
138138
/// Number of precedence groups in the AST context.
139139
FRONTEND_STATISTIC(AST, NumPrecedenceGroups)
140140

141+
/// Number of qualified lookups into a nominal type.
142+
FRONTEND_STATISTIC(AST, NumLookupQualifiedInNominal)
143+
144+
/// Number of qualified lookups into a module.
145+
FRONTEND_STATISTIC(AST, NumLookupQualifiedInModule)
146+
147+
/// Number of qualified lookups into AnyObject.
148+
FRONTEND_STATISTIC(AST, NumLookupQualifiedInAnyObject)
149+
150+
/// Number of lookups into a module and its imports.
151+
FRONTEND_STATISTIC(AST, NumLookupInModule)
152+
153+
/// Number of local lookups into a module.
154+
FRONTEND_STATISTIC(AST, NumModuleLookupValue)
155+
156+
/// Number of unqualified lookups.
157+
FRONTEND_STATISTIC(AST, NumUnqualifiedLookup)
158+
159+
/// Number of local lookups into a module's class members, for
160+
/// AnyObject lookup.
161+
FRONTEND_STATISTIC(AST, NumModuleLookupClassMember)
162+
141163
/// Number of full function bodies parsed.
142164
FRONTEND_STATISTIC(Parse, NumFunctionsParsed)
143165

@@ -227,6 +249,8 @@ FRONTEND_STATISTIC(Sema, NumTypesValidated)
227249
/// Number of lazy iterable declaration contexts left unloaded.
228250
FRONTEND_STATISTIC(Sema, NumUnloadedLazyIterableDeclContexts)
229251

252+
/// Number of lookups into a module and its imports.
253+
230254
/// All type check requests go into the Sema area.
231255
#define SWIFT_TYPEID(NAME) FRONTEND_STATISTIC(Sema, NAME)
232256
#include "swift/AST/AccessTypeIDZone.def"

include/swift/ClangImporter/ClangImporter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ class DWARFImporterDelegate {
8787
virtual ~DWARFImporterDelegate() = default;
8888
/// Perform a qualified lookup of a Clang type with this name.
8989
/// \param kind Only return results with this type kind.
90+
/// \param inModule only return results from this module.
9091
virtual void lookupValue(StringRef name, llvm::Optional<ClangTypeKind> kind,
92+
StringRef inModule,
9193
SmallVectorImpl<clang::Decl *> &results) {}
9294
/// vtable anchor.
9395
virtual void anchor();

include/swift/ClangImporter/ClangModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ClangModuleUnit final : public LoadedFile {
3535
ClangImporter::Implementation &owner;
3636
const clang::Module *clangModule;
3737
llvm::PointerIntPair<ModuleDecl *, 1, bool> overlayModule;
38-
mutable ArrayRef<ModuleDecl::ImportedModule> importedModulesForLookup;
38+
mutable Optional<ArrayRef<ModuleDecl::ImportedModule>> importedModulesForLookup;
3939
/// The metadata of the underlying Clang module.
4040
clang::ExternalASTSource::ASTSourceDescriptor ASTSourceDescriptor;
4141

include/swift/IDE/DigesterEnums.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,11 @@ KEY_STRING(IntrowatchOS, intro_watchOS)
152152
KEY_STRING(Introswift, intro_swift)
153153

154154
KEY_STRING_ARR(SuperclassNames, superclassNames)
155+
KEY_STRING_ARR(ToolArgs, tool_arguments)
155156

156157
KEY_UINT(SelfIndex, selfIndex)
157158
KEY_UINT(FixedBinaryOrder, fixedbinaryorder)
159+
KEY_UINT(JsonFormatVer, json_format_version)
158160

159161
KEY(children)
160162
KEY(conformances)

include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,10 @@ def enable_function_builder_one_way_constraints : Flag<["-"],
408408
"enable-function-builder-one-way-constraints">,
409409
HelpText<"Enable one-way constraints in the function builder transformation">;
410410

411+
def disable_function_builder_one_way_constraints : Flag<["-"],
412+
"disable-function-builder-one-way-constraints">,
413+
HelpText<"Disable one-way constraints in the function builder transformation">;
414+
411415
def solver_disable_shrink :
412416
Flag<["-"], "solver-disable-shrink">,
413417
HelpText<"Disable the shrink phase of expression type checking">;

include/swift/Serialization/ModuleFile.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -87,46 +87,11 @@ class ModuleFile
8787
/// A callback to be invoked every time a type was deserialized.
8888
std::function<void(Type)> DeserializedTypeCallback;
8989

90-
/// The number of entities that are currently being deserialized.
91-
unsigned NumCurrentDeserializingEntities = 0;
92-
9390
/// Is this module file actually a .sib file? .sib files are serialized SIL at
9491
/// arbitrary granularity and arbitrary stage; unlike serialized Swift
9592
/// modules, which are assumed to contain canonical SIL for an entire module.
9693
bool IsSIB = false;
9794

98-
/// RAII class to be used when deserializing an entity.
99-
class DeserializingEntityRAII {
100-
ModuleFile &MF;
101-
102-
public:
103-
DeserializingEntityRAII(ModuleFile &mf)
104-
: MF(mf.getModuleFileForDelayedActions()) {
105-
++MF.NumCurrentDeserializingEntities;
106-
}
107-
~DeserializingEntityRAII() {
108-
assert(MF.NumCurrentDeserializingEntities > 0 &&
109-
"Imbalanced currently-deserializing count?");
110-
if (MF.NumCurrentDeserializingEntities == 1) {
111-
MF.finishPendingActions();
112-
}
113-
114-
--MF.NumCurrentDeserializingEntities;
115-
}
116-
};
117-
friend class DeserializingEntityRAII;
118-
119-
/// Picks a specific ModuleFile instance to serve as the "delayer" for the
120-
/// entire module.
121-
///
122-
/// This is usually \c this, but when there are partial swiftmodules all
123-
/// loaded for the same module it may be different.
124-
ModuleFile &getModuleFileForDelayedActions();
125-
126-
/// Finish any pending actions that were waiting for the topmost entity to
127-
/// be deserialized.
128-
void finishPendingActions();
129-
13095
public:
13196
/// Represents another module that has been imported as a dependency.
13297
class Dependency {

include/swift/Serialization/ModuleFormat.h

Lines changed: 2 additions & 2 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 = 511; // ctor failability change
55+
const uint16_t SWIFTMODULE_VERSION_MINOR = 512; // extended types may be left as unbound generic types
5656

5757
using DeclIDField = BCFixed<31>;
5858

@@ -300,7 +300,7 @@ using MetatypeRepresentationField = BCFixed<2>;
300300
enum class SelfAccessKind : uint8_t {
301301
NonMutating = 0,
302302
Mutating,
303-
__Consuming,
303+
Consuming,
304304
};
305305
using SelfAccessKindField = BCFixed<2>;
306306

0 commit comments

Comments
 (0)