Skip to content

Commit 0ccacc5

Browse files
committed
---
yaml --- r: 343611 b: refs/heads/master-rebranch c: e9bcd00 h: refs/heads/master i: 343609: 7370c60 343607: dec7091
1 parent 3ae2c24 commit 0ccacc5

File tree

97 files changed

+805
-786
lines changed

Some content is hidden

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

97 files changed

+805
-786
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: 6aecd4546404132f8ca28289c59f436a3885d919
1458+
refs/heads/master-rebranch: e9bcd00bc2b335f502ca06ff04e56d92a95b7b0f
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/GenericEnvironment.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
5959
: private llvm::TrailingObjects<GenericEnvironment, Type> {
6060
GenericSignature *Signature = nullptr;
6161
GenericSignatureBuilder *Builder = nullptr;
62-
DeclContext *OwningDC = nullptr;
6362

6463
friend TrailingObjects;
6564

@@ -98,18 +97,6 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
9897
GenericEnvironment *getIncomplete(GenericSignature *signature,
9998
GenericSignatureBuilder *builder);
10099

101-
/// Set the owning declaration context for this generic environment.
102-
void setOwningDeclContext(DeclContext *owningDC);
103-
104-
/// Retrieve the declaration context that owns this generic environment, if
105-
/// there is one.
106-
///
107-
/// Note that several generic environments may refer to the same declaration
108-
/// context, because non-generic declarations nested within generic ones
109-
/// inherit the enclosing generic environment. In such cases, the owning
110-
/// context is the outermost context.
111-
DeclContext *getOwningDeclContext() const { return OwningDC; }
112-
113100
/// Add a mapping of a generic parameter to a specific type (which may be
114101
/// an archetype)
115102
void addMapping(GenericParamKey key, Type contextType);

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 *>
@@ -1373,8 +1373,8 @@ class GenericSignatureBuilder::FloatingRequirementSource {
13731373
} kind;
13741374

13751375
using Storage =
1376-
llvm::PointerUnion<const RequirementSource *, const TypeRepr *,
1377-
const RequirementRepr *>;
1376+
llvm::PointerUnion3<const RequirementSource *, const TypeRepr *,
1377+
const RequirementRepr *>;
13781378

13791379
Storage storage;
13801380

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: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,15 @@ struct WhereClauseOwner {
365365

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

370370
WhereClauseOwner(Decl *decl);
371371

372372
WhereClauseOwner(DeclContext *dc, GenericParamList *genericParams)
373-
: dc(dc), source(genericParams) {}
373+
: dc(dc), source(genericParams) { }
374374

375375
WhereClauseOwner(DeclContext *dc, SpecializeAttr *attr)
376-
: dc(dc), source(attr) {}
376+
: dc(dc), source(attr) { }
377377

378378
SourceLoc getLoc() const;
379379

@@ -392,19 +392,6 @@ struct WhereClauseOwner {
392392
const WhereClauseOwner &rhs) {
393393
return !(lhs == rhs);
394394
}
395-
396-
public:
397-
/// Retrieve the array of requirements.
398-
MutableArrayRef<RequirementRepr> getRequirements() const;
399-
400-
/// Visit each of the requirements,
401-
///
402-
/// \returns true after short-circuiting if the callback returned \c true
403-
/// for any of the requirements.
404-
bool
405-
visitRequirements(TypeResolutionStage stage,
406-
llvm::function_ref<bool(Requirement, RequirementRepr *)>
407-
callback) const &&;
408395
};
409396

410397
void simple_display(llvm::raw_ostream &out, const WhereClauseOwner &owner);
@@ -418,6 +405,17 @@ class RequirementRequest :
418405
public:
419406
using SimpleRequest::SimpleRequest;
420407

408+
/// Retrieve the array of requirements from the given owner.
409+
static MutableArrayRef<RequirementRepr> getRequirements(WhereClauseOwner);
410+
411+
/// Visit each of the requirements in the given owner,
412+
///
413+
/// \returns true after short-circuiting if the callback returned \c true
414+
/// for any of the requirements.
415+
static bool visitRequirements(
416+
WhereClauseOwner, TypeResolutionStage stage,
417+
llvm::function_ref<bool(Requirement, RequirementRepr*)> callback);
418+
421419
private:
422420
friend SimpleRequest;
423421

@@ -503,6 +501,20 @@ class DefaultTypeRequest
503501
bool isCached() const { return true; }
504502
Optional<Type> getCachedResult() const;
505503
void cacheResult(Type value) const;
504+
505+
private:
506+
KnownProtocolKind getKnownProtocolKind() const {
507+
return std::get<0>(getStorage());
508+
}
509+
const DeclContext *getDeclContext() const {
510+
return std::get<1>(getStorage());
511+
}
512+
513+
static const char *getTypeName(KnownProtocolKind);
514+
static bool getPerformLocalLookup(KnownProtocolKind);
515+
TypeChecker &getTypeChecker() const;
516+
SourceFile *getSourceFile() const;
517+
Type &getCache() const;
506518
};
507519

508520
/// Retrieve information about a property wrapper type.

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

@@ -150,8 +149,7 @@ class ClangImporter final : public ClangModuleLoader {
150149
/// Create a new clang::DependencyCollector customized to
151150
/// ClangImporter's specific uses.
152151
static std::shared_ptr<clang::DependencyCollector>
153-
createDependencyCollector(bool TrackSystemDeps,
154-
std::shared_ptr<llvm::FileCollector> FileCollector);
152+
createDependencyCollector(bool TrackSystemDeps);
155153

156154
/// Append visible module names to \p names. Note that names are possibly
157155
/// 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/Parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include "llvm/ADT/SetVector.h"
4141

4242
namespace llvm {
43-
template <typename... PTs> class PointerUnion;
43+
template <typename PT1, typename PT2, typename PT3> class PointerUnion3;
4444
}
4545

4646
namespace swift {

branches/master-rebranch/include/swift/SILOptimizer/Analysis/LoopRegionAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ class LoopRegion {
384384
private:
385385
/// A pointer to one of a Loop, Basic Block, or Function represented by this
386386
/// region.
387-
llvm::PointerUnion<FunctionTy *, LoopTy *, BlockTy *> Ptr;
387+
llvm::PointerUnion3<FunctionTy *, LoopTy *, BlockTy *> Ptr;
388388

389389
/// The ID of this region.
390390
unsigned ID;

branches/master-rebranch/lib/AST/ASTDumper.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3519,10 +3519,6 @@ namespace {
35193519
printArchetypeCommon(T, "primary_archetype_type", label);
35203520
printField("name", T->getFullName());
35213521
OS << "\n";
3522-
auto genericEnv = T->getGenericEnvironment();
3523-
if (auto owningDC = genericEnv->getOwningDeclContext()) {
3524-
owningDC->printContext(OS, Indent + 2);
3525-
}
35263522
printArchetypeNestedTypes(T);
35273523
PrintWithColorRAII(OS, ParenthesisColor) << ')';
35283524
}

branches/master-rebranch/lib/AST/ASTVerifier.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -667,14 +667,6 @@ class Verifier : public ASTWalker {
667667
Out << "AST verification error: archetype "
668668
<< root->getString() << " not allowed in this context\n";
669669

670-
if (auto env = rootPrimary->getGenericEnvironment()) {
671-
if (auto owningDC = env->getOwningDeclContext()) {
672-
llvm::errs() << "archetype came from:\n";
673-
owningDC->dumpContext();
674-
llvm::errs() << "\n";
675-
}
676-
}
677-
678670
return true;
679671
}
680672

branches/master-rebranch/lib/AST/Builtins.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,6 @@ Type IntrinsicTypeDecoder::decodeImmediate() {
13621362
case IITDescriptor::HalfVecArgument:
13631363
case IITDescriptor::VarArg:
13641364
case IITDescriptor::Token:
1365-
case IITDescriptor::VecElementArgument:
13661365
case IITDescriptor::VecOfAnyPtrsToElt:
13671366
// These types cannot be expressed in swift yet.
13681367
return Type();

branches/master-rebranch/lib/AST/Decl.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,8 +874,6 @@ void GenericContext::setGenericEnvironment(GenericEnvironment *genericEnv) {
874874
genericEnv->getGenericSignature()->getCanonicalSignature()) &&
875875
"set a generic environment with a different generic signature");
876876
this->GenericSigOrEnv = genericEnv;
877-
if (genericEnv)
878-
genericEnv->setOwningDeclContext(this);
879877
}
880878

881879
GenericEnvironment *

branches/master-rebranch/lib/AST/GenericEnvironment.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -55,35 +55,6 @@ GenericEnvironment::GenericEnvironment(GenericSignature *signature,
5555
Type());
5656
}
5757

58-
void GenericEnvironment::setOwningDeclContext(DeclContext *newOwningDC) {
59-
if (!OwningDC) {
60-
OwningDC = newOwningDC;
61-
return;
62-
}
63-
64-
if (!newOwningDC || OwningDC == newOwningDC)
65-
return;
66-
67-
// Find the least common ancestor context to be the owner.
68-
unsigned oldDepth = OwningDC->getSyntacticDepth();
69-
unsigned newDepth = newOwningDC->getSyntacticDepth();
70-
71-
while (oldDepth > newDepth) {
72-
OwningDC = OwningDC->getParent();
73-
--oldDepth;
74-
}
75-
76-
while (newDepth > oldDepth) {
77-
newOwningDC = newOwningDC->getParent();
78-
--newDepth;
79-
}
80-
81-
while (OwningDC != newOwningDC) {
82-
OwningDC = OwningDC->getParent();
83-
newOwningDC = newOwningDC->getParent();
84-
}
85-
}
86-
8758
void GenericEnvironment::addMapping(GenericParamKey key,
8859
Type contextType) {
8960
// Find the index into the parallel arrays of generic parameters and

branches/master-rebranch/lib/AST/GenericSignatureBuilder.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4114,7 +4114,7 @@ ConstraintResult GenericSignatureBuilder::expandConformanceRequirement(
41144114
}
41154115

41164116
// Add any requirements in the where clause on the protocol.
4117-
WhereClauseOwner(proto).visitRequirements(TypeResolutionStage::Structural,
4117+
RequirementRequest::visitRequirements(proto, TypeResolutionStage::Structural,
41184118
[&](const Requirement &req, RequirementRepr *reqRepr) {
41194119
// If we're only looking at same-type constraints, skip everything else.
41204120
if (onlySameTypeConstraints &&
@@ -4240,8 +4240,8 @@ ConstraintResult GenericSignatureBuilder::expandConformanceRequirement(
42404240
}
42414241

42424242
// Add requirements from this associated type's where clause.
4243-
WhereClauseOwner(assocTypeDecl).visitRequirements(
4244-
TypeResolutionStage::Structural,
4243+
RequirementRequest::visitRequirements(assocTypeDecl,
4244+
TypeResolutionStage::Structural,
42454245
[&](const Requirement &req, RequirementRepr *reqRepr) {
42464246
// If we're only looking at same-type constraints, skip everything else.
42474247
if (onlySameTypeConstraints &&
@@ -7714,18 +7714,18 @@ InferredGenericSignatureRequest::evaluate(
77147714

77157715
// Add the requirements clause to the builder.
77167716

7717+
WhereClauseOwner owner(lookupDC, genericParams);
77177718
using FloatingRequirementSource =
77187719
GenericSignatureBuilder::FloatingRequirementSource;
7719-
WhereClauseOwner(lookupDC, genericParams).visitRequirements(
7720-
TypeResolutionStage::Structural,
7720+
RequirementRequest::visitRequirements(owner, TypeResolutionStage::Structural,
77217721
[&](const Requirement &req, RequirementRepr *reqRepr) {
77227722
auto source = FloatingRequirementSource::forExplicit(reqRepr);
77237723

77247724
// If we're extending a protocol and adding a redundant requirement,
77257725
// for example, `extension Foo where Self: Foo`, then emit a
77267726
// diagnostic.
77277727

7728-
if (auto decl = lookupDC->getAsDecl()) {
7728+
if (auto decl = owner.dc->getAsDecl()) {
77297729
if (auto extDecl = dyn_cast<ExtensionDecl>(decl)) {
77307730
auto extType = extDecl->getDeclaredInterfaceType();
77317731
auto extSelfType = extDecl->getSelfInterfaceType();

0 commit comments

Comments
 (0)