Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from apple:master #19

Merged
merged 45 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
15583ac
Make some PassManager options to accept comma separated values
meg-gupta Jun 2, 2020
5f162eb
[SIL] NFC: Shrink SILGlobalVariable by 16 bytes
davezarzycki Jun 5, 2020
67e88f4
[SourceKit] Disable labeled trailing closure support except code comp…
rintaro Jun 9, 2020
f60d17b
[Function builders] Use one-way constraints for closure parameters.
DougGregor Jun 10, 2020
f46e2c2
[testing] Workaround unsorted output
davezarzycki Jun 11, 2020
552134a
Merge pull request #32276 from rintaro/ide-conformingmethods-disablel…
rintaro Jun 11, 2020
acf923b
MandatoryInlining: fix a memory lifetime bug related to partial_apply…
eeckstein Jun 11, 2020
d54bbc6
[Gardening] Remove TypeChecker::validateType Entrypoint
CodaFi Jun 11, 2020
4c0c7da
[NFC] Fixup TypeChecker::getArraySliceType To Not Return Type()
CodaFi Jun 11, 2020
d9073c8
Merge pull request #32135 from davezarzycki/pr32135
davezarzycki Jun 11, 2020
bd6724c
[NFC] Collapse TypeChecker::getDictionaryType
CodaFi Jun 11, 2020
d81f148
[NFC] Fixup TypeChecker::getOptionalType To Not Return Type()
CodaFi Jun 11, 2020
743230e
[NFC] applyGenericArguments Returns ErrorType Consistently
CodaFi Jun 11, 2020
26ee5d5
[NFC] Fixup resolveSILFunctionType To Not Return Type()
CodaFi Jun 11, 2020
69dc77f
[NFC] Refactor resolveASTFunctionTypeParams
CodaFi Jun 11, 2020
b6143c6
[NFC] Remove TypeChecker::getIntType
CodaFi Jun 11, 2020
f02a0f0
[NFC] Remove TypeChecker::getSubstringType
CodaFi Jun 11, 2020
09395ba
[NFC] Inline TypeChecker::getInt8Type and TypeChecker::getUInt8Type
CodaFi Jun 11, 2020
399a551
[NFC] Inline TypeChecker::getStringType
CodaFi Jun 11, 2020
eacc130
[NFC] Consistently return ErrorTypes when resolveType fails
CodaFi Jun 11, 2020
22ead9f
DepScanner: use emplace_back instead of push_back. rdar://64227623
nkcsgexi Jun 11, 2020
6ab29cb
Introduce NeverNullType to Assert resolveType Never Returns the null …
CodaFi Jun 11, 2020
409603c
Merge pull request #32305 from DougGregor/function-builder-one-way-pa…
DougGregor Jun 11, 2020
0023695
[NFC] Update calls to assume resolveType never returns null
CodaFi Jun 11, 2020
0c597a8
Dependencies: Move YAML reader and writer code to swift-dependency-tool
slavapestov Jun 11, 2020
86b7e98
[NFC] CS: Give the type-transforming openUnboundGenericType method a …
AnthonyLatsis Jun 11, 2020
b5a8b51
Merge pull request #32141 from meg-gupta/commaflags
meg-gupta Jun 11, 2020
8c3f154
[NFC] Wean SILParser off of TypeLocs
CodaFi Jun 11, 2020
8be08b1
[NFC] Remove Trivial Projections from TypeLocs in RequirementRepr
CodaFi Jun 11, 2020
a748d8e
[NFC] Fixup RequirementRepr Printing To Use Only the Repr
CodaFi Jun 11, 2020
10f53c0
[NFC] Refactor getAdopteeSelfSameTypeConstraint
CodaFi Jun 11, 2020
68d2d82
[NFC] Teach BuiltinFunctionBuilder to Build Requirements
CodaFi Jun 11, 2020
b8d0cf3
[NFC] Only Resolve TypeReprs If Given a RequirementRepr
CodaFi Jun 11, 2020
d197f9d
[NFC] Make RequirementRequest Cached
CodaFi Jun 11, 2020
b9427b0
[NFC] Strip RequirementRepr of its TypeLocs
CodaFi Jun 11, 2020
9cc07c7
[test][stdlib] Define stdio stubs for OpenBSD.
3405691582 May 10, 2020
399e533
Merge pull request #32326 from AnthonyLatsis/openunbound-disambig
AnthonyLatsis Jun 12, 2020
86baa41
Merge pull request #32322 from slavapestov/move-yaml-code-to-dep-tool
slavapestov Jun 12, 2020
080bea5
Merge pull request #32321 from CodaFi/type-check
CodaFi Jun 12, 2020
fc33bae
Merge pull request #32331 from CodaFi/no-where-clause-for-alarm
CodaFi Jun 12, 2020
f3e389c
Merge pull request #32320 from nkcsgexi/64227623
nkcsgexi Jun 12, 2020
ee1d76e
[opt] Re-work broadenSingleElementStores to use projections. (#32318)
zoecarver Jun 12, 2020
7784581
Merge pull request #32317 from eeckstein/fix-mandatory-inliner
eeckstein Jun 12, 2020
fc5fae5
Merge pull request #32330 from 3405691582/Test_OpenBSD_StdioStreams
CodaFi Jun 12, 2020
8d79ec1
Merge pull request #32313 from davezarzycki/pr32313
davezarzycki Jun 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 13 additions & 82 deletions include/swift/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1030,12 +1030,12 @@ class RequirementRepr {
SourceLoc SeparatorLoc;
RequirementReprKind Kind : 2;
bool Invalid : 1;
TypeLoc FirstType;
TypeRepr *FirstType;

/// The second element represents the right-hand side of the constraint.
/// It can be e.g. a type or a layout constraint.
union {
TypeLoc SecondType;
TypeRepr *SecondType;
LayoutConstraintLoc SecondLayout;
};

Expand All @@ -1044,16 +1044,16 @@ class RequirementRepr {
StringRef AsWrittenString;

RequirementRepr(SourceLoc SeparatorLoc, RequirementReprKind Kind,
TypeLoc FirstType, TypeLoc SecondType)
TypeRepr *FirstType, TypeRepr *SecondType)
: SeparatorLoc(SeparatorLoc), Kind(Kind), Invalid(false),
FirstType(FirstType), SecondType(SecondType) { }

RequirementRepr(SourceLoc SeparatorLoc, RequirementReprKind Kind,
TypeLoc FirstType, LayoutConstraintLoc SecondLayout)
TypeRepr *FirstType, LayoutConstraintLoc SecondLayout)
: SeparatorLoc(SeparatorLoc), Kind(Kind), Invalid(false),
FirstType(FirstType), SecondLayout(SecondLayout) { }

void printImpl(ASTPrinter &OS, bool AsWritten) const;
void printImpl(ASTPrinter &OS) const;

public:
/// Construct a new type-constraint requirement.
Expand All @@ -1064,9 +1064,9 @@ class RequirementRepr {
/// this requirement was implied.
/// \param Constraint The protocol or protocol composition to which the
/// subject must conform, or superclass from which the subject must inherit.
static RequirementRepr getTypeConstraint(TypeLoc Subject,
static RequirementRepr getTypeConstraint(TypeRepr *Subject,
SourceLoc ColonLoc,
TypeLoc Constraint) {
TypeRepr *Constraint) {
return { ColonLoc, RequirementReprKind::TypeConstraint, Subject, Constraint };
}

Expand All @@ -1076,9 +1076,9 @@ class RequirementRepr {
/// \param EqualLoc The location of the '==' in the same-type constraint, or
/// an invalid location if this requirement was implied.
/// \param SecondType The second type.
static RequirementRepr getSameType(TypeLoc FirstType,
static RequirementRepr getSameType(TypeRepr *FirstType,
SourceLoc EqualLoc,
TypeLoc SecondType) {
TypeRepr *SecondType) {
return { EqualLoc, RequirementReprKind::SameType, FirstType, SecondType };
}

Expand All @@ -1090,7 +1090,7 @@ class RequirementRepr {
/// this requirement was implied.
/// \param Layout The layout requirement to which the
/// subject must conform.
static RequirementRepr getLayoutConstraint(TypeLoc Subject,
static RequirementRepr getLayoutConstraint(TypeRepr *Subject,
SourceLoc ColonLoc,
LayoutConstraintLoc Layout) {
return {ColonLoc, RequirementReprKind::LayoutConstraint, Subject,
Expand All @@ -1108,48 +1108,15 @@ class RequirementRepr {

/// For a type-bound requirement, return the subject of the
/// conformance relationship.
Type getSubject() const {
assert(getKind() == RequirementReprKind::TypeConstraint ||
getKind() == RequirementReprKind::LayoutConstraint);
return FirstType.getType();
}

TypeRepr *getSubjectRepr() const {
assert(getKind() == RequirementReprKind::TypeConstraint ||
getKind() == RequirementReprKind::LayoutConstraint);
return FirstType.getTypeRepr();
}

TypeLoc &getSubjectLoc() {
assert(getKind() == RequirementReprKind::TypeConstraint ||
getKind() == RequirementReprKind::LayoutConstraint);
return FirstType;
}

const TypeLoc &getSubjectLoc() const {
assert(getKind() == RequirementReprKind::TypeConstraint ||
getKind() == RequirementReprKind::LayoutConstraint);
return FirstType;
}

/// For a type-bound requirement, return the protocol or to which
/// the subject conforms or superclass it inherits.
Type getConstraint() const {
assert(getKind() == RequirementReprKind::TypeConstraint);
return SecondType.getType();
}

TypeRepr *getConstraintRepr() const {
assert(getKind() == RequirementReprKind::TypeConstraint);
return SecondType.getTypeRepr();
}

TypeLoc &getConstraintLoc() {
assert(getKind() == RequirementReprKind::TypeConstraint);
return SecondType;
}

const TypeLoc &getConstraintLoc() const {
assert(getKind() == RequirementReprKind::TypeConstraint);
return SecondType;
}
Expand All @@ -1170,43 +1137,13 @@ class RequirementRepr {
}

/// Retrieve the first type of a same-type requirement.
Type getFirstType() const {
assert(getKind() == RequirementReprKind::SameType);
return FirstType.getType();
}

TypeRepr *getFirstTypeRepr() const {
assert(getKind() == RequirementReprKind::SameType);
return FirstType.getTypeRepr();
}

TypeLoc &getFirstTypeLoc() {
assert(getKind() == RequirementReprKind::SameType);
return FirstType;
}

const TypeLoc &getFirstTypeLoc() const {
assert(getKind() == RequirementReprKind::SameType);
return FirstType;
}

/// Retrieve the second type of a same-type requirement.
Type getSecondType() const {
assert(getKind() == RequirementReprKind::SameType);
return SecondType.getType();
}

TypeRepr *getSecondTypeRepr() const {
assert(getKind() == RequirementReprKind::SameType);
return SecondType.getTypeRepr();
}

TypeLoc &getSecondTypeLoc() {
assert(getKind() == RequirementReprKind::SameType);
return SecondType;
}

const TypeLoc &getSecondTypeLoc() const {
assert(getKind() == RequirementReprKind::SameType);
return SecondType;
}
Expand All @@ -1217,19 +1154,13 @@ class RequirementRepr {
return SeparatorLoc;
}

SourceRange getSourceRange() const {
if (getKind() == RequirementReprKind::LayoutConstraint)
return SourceRange(FirstType.getSourceRange().Start,
SecondLayout.getSourceRange().End);
return SourceRange(FirstType.getSourceRange().Start,
SecondType.getSourceRange().End);
}
SourceRange getSourceRange() const;

/// Retrieve the first or subject type representation from the \c repr,
/// or \c nullptr if \c repr is null.
static TypeRepr *getFirstTypeRepr(const RequirementRepr *repr) {
if (!repr) return nullptr;
return repr->FirstType.getTypeRepr();
return repr->FirstType;
}

/// Retrieve the second or constraint type representation from the \c repr,
Expand All @@ -1238,7 +1169,7 @@ class RequirementRepr {
if (!repr) return nullptr;
assert(repr->getKind() == RequirementReprKind::TypeConstraint ||
repr->getKind() == RequirementReprKind::SameType);
return repr->SecondType.getTypeRepr();
return repr->SecondType;
}

SWIFT_DEBUG_DUMP;
Expand Down
55 changes: 0 additions & 55 deletions include/swift/AST/FineGrainedDependencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -804,15 +804,6 @@ class SourceFileDepGraph {
forEachNode([&](SourceFileDepGraphNode *n) { delete n; });
}

/// Goes at the start of an emitted YAML file to help tools recognize it.
/// May vary in the future according to version, etc.
std::string yamlProlog(const bool hadCompilationError) const {
return std::string("# Fine-grained v0\n") +
(!hadCompilationError ? ""
: "# Dependencies are unknown because a "
"compilation error occurred.\n");
}

SourceFileDepGraphNode *getNode(size_t sequenceNumber) const;

InterfaceAndImplementationPair<SourceFileDepGraphNode>
Expand Down Expand Up @@ -1016,50 +1007,4 @@ template <typename GraphT> class DotFileEmitter {
} // end namespace fine_grained_dependencies
} // end namespace swift

//==============================================================================
// MARK: Declarations for YAMLTraits for reading/writing of SourceFileDepGraph
//==============================================================================

// This introduces a redefinition where ever std::is_same_t<size_t, uint64_t>
// holds
#if !(defined(__linux__) || defined(_WIN64))
LLVM_YAML_DECLARE_SCALAR_TRAITS(size_t, QuotingType::None)
#endif
LLVM_YAML_DECLARE_ENUM_TRAITS(swift::fine_grained_dependencies::NodeKind)
LLVM_YAML_DECLARE_ENUM_TRAITS(swift::fine_grained_dependencies::DeclAspect)
LLVM_YAML_DECLARE_MAPPING_TRAITS(
swift::fine_grained_dependencies::DependencyKey)
LLVM_YAML_DECLARE_MAPPING_TRAITS(swift::fine_grained_dependencies::DepGraphNode)

namespace llvm {
namespace yaml {
template <>
struct MappingContextTraits<
swift::fine_grained_dependencies::SourceFileDepGraphNode,
swift::fine_grained_dependencies::SourceFileDepGraph> {
using SourceFileDepGraphNode =
swift::fine_grained_dependencies::SourceFileDepGraphNode;
using SourceFileDepGraph =
swift::fine_grained_dependencies::SourceFileDepGraph;

static void mapping(IO &io, SourceFileDepGraphNode &node,
SourceFileDepGraph &g);
};

template <>
struct SequenceTraits<
std::vector<swift::fine_grained_dependencies::SourceFileDepGraphNode *>> {
using SourceFileDepGraphNode =
swift::fine_grained_dependencies::SourceFileDepGraphNode;
using NodeVec = std::vector<SourceFileDepGraphNode *>;
static size_t size(IO &, NodeVec &vec);
static SourceFileDepGraphNode &element(IO &, NodeVec &vec, size_t index);
};

} // namespace yaml
} // namespace llvm

LLVM_YAML_DECLARE_MAPPING_TRAITS(
swift::fine_grained_dependencies::SourceFileDepGraph)

#endif // SWIFT_AST_FINE_GRAINED_DEPENDENCIES_H
6 changes: 2 additions & 4 deletions include/swift/AST/TypeCheckRequests.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ class RequirementRequest :
public SimpleRequest<RequirementRequest,
Requirement(WhereClauseOwner, unsigned,
TypeResolutionStage),
RequestFlags::SeparatelyCached> {
RequestFlags::Cached> {
public:
using SimpleRequest::SimpleRequest;

Expand All @@ -464,10 +464,8 @@ class RequirementRequest :
// Cycle handling.
void noteCycleStep(DiagnosticEngine &diags) const;

// Separate caching.
// Caching.
bool isCached() const;
Optional<Requirement> getCachedResult() const;
void cacheResult(Requirement value) const;
};

/// Generate the USR for the given declaration.
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/TypeCheckerTypeIDZone.def
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ SWIFT_REQUEST(TypeChecker, ProtocolRequiresClassRequest, bool(ProtocolDecl *),
SeparatelyCached, NoLocationInfo)
SWIFT_REQUEST(TypeChecker, RequirementRequest,
Requirement(WhereClauseOwner, unsigned, TypeResolutionStage),
SeparatelyCached, HasNearestLocation)
Cached, HasNearestLocation)
SWIFT_REQUEST(TypeChecker, RequirementSignatureRequest,
ArrayRef<Requirement>(ProtocolDecl *), SeparatelyCached,
NoLocationInfo)
Expand Down
4 changes: 4 additions & 0 deletions include/swift/Parse/CodeCompletionCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ class CodeCompletionCallbacks {

virtual void completeCallArg(CodeCompletionExpr *E, bool isFirst) {};

virtual bool canPerformCompleteLabeledTrailingClosure() const {
return false;
}

virtual void completeLabeledTrailingClosure(CodeCompletionExpr *E,
bool isAtStartOfLine) {};

Expand Down
2 changes: 1 addition & 1 deletion include/swift/SIL/Projection.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ class Projection {
static NullablePtr<SingleValueInstruction>
createAggFromFirstLevelProjections(SILBuilder &B, SILLocation Loc,
SILType BaseType,
llvm::SmallVectorImpl<SILValue> &Values);
ArrayRef<SILValue> Values);

void print(raw_ostream &os, SILType baseType) const;
private:
Expand Down
20 changes: 10 additions & 10 deletions include/swift/SIL/SILGlobalVariable.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SILGlobalVariable

/// The SIL location of the variable, which provides a link back to the AST.
/// The variable only gets a location after it's been emitted.
Optional<SILLocation> Location;
const SILLocation Location;

/// The linkage of the global variable.
unsigned Linkage : NumSILLinkageBits;
Expand All @@ -67,13 +67,16 @@ class SILGlobalVariable
/// once (either in its declaration, or once later), making it immutable.
unsigned IsLet : 1;

/// Whether or not this is a declaration.
unsigned IsDeclaration : 1;

/// Whether or not there is a valid SILLocation.
unsigned HasLocation : 1;

/// The VarDecl associated with this SILGlobalVariable. Must by nonnull for
/// language-level global variables.
VarDecl *VDecl;

/// Whether or not this is a declaration.
bool IsDeclaration;

/// If this block is not empty, the global variable has a static initializer.
///
/// The last instruction of this block is the top-level value of the static
Expand Down Expand Up @@ -132,20 +135,17 @@ class SILGlobalVariable

VarDecl *getDecl() const { return VDecl; }

/// Initialize the source location of the function.
void setLocation(SILLocation L) { Location = L; }

/// Check if the function has a location.
/// FIXME: All functions should have locations, so this method should not be
/// necessary.
bool hasLocation() const {
return Location.hasValue();
return HasLocation;
}

/// Get the source location of the function.
SILLocation getLocation() const {
assert(Location.hasValue());
return Location.getValue();
assert(HasLocation);
return Location;
}

/// Returns the value of the static initializer or null if the global has no
Expand Down
2 changes: 2 additions & 0 deletions include/swift/SIL/SILLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ class SILLocation {
assert(isASTNode());
}

static SILLocation invalid() { return SILLocation(); }

/// Check if the location wraps an AST node or a valid SIL file
/// location.
///
Expand Down
Loading