diff --git a/cmake/modules/AddSwift.cmake b/cmake/modules/AddSwift.cmake index 5ed289be208f7..cbef2b8534d4f 100644 --- a/cmake/modules/AddSwift.cmake +++ b/cmake/modules/AddSwift.cmake @@ -451,20 +451,16 @@ function(add_swift_host_library name) LIBRARY_DIR ${SWIFT_LIBRARY_OUTPUT_INTDIR}) if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS) - set_target_properties(${name} - PROPERTIES + set_target_properties(${name} PROPERTIES INSTALL_NAME_DIR "@rpath") elseif(SWIFT_HOST_VARIANT_SDK STREQUAL LINUX) - set_target_properties(${name} - PROPERTIES + set_target_properties(${name} PROPERTIES INSTALL_RPATH "$ORIGIN:/usr/lib/swift/linux") elseif(SWIFT_HOST_VARIANT_SDK STREQUAL CYGWIN) - set_target_properties(${name} - PROPERTIES + set_target_properties(${name} PROPERTIES INSTALL_RPATH "$ORIGIN:/usr/lib/swift/cygwin") elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID") - set_target_properties(${name} - PROPERTIES + set_target_properties(${name} PROPERTIES INSTALL_RPATH "$ORIGIN") endif() diff --git a/docs/ABI/Mangling.rst b/docs/ABI/Mangling.rst index c301dbf6fbe26..d21ca5334d30a 100644 --- a/docs/ABI/Mangling.rst +++ b/docs/ABI/Mangling.rst @@ -589,7 +589,7 @@ mangled in to disambiguate. impl-function-type ::= type* 'I' FUNC-ATTRIBUTES '_' impl-function-type ::= type* generic-signature 'I' FUNC-ATTRIBUTES '_' - FUNC-ATTRIBUTES ::= PATTERN-SUBS? INVOCATION-SUBS? PSEUDO-GENERIC? CALLEE-ESCAPE? DIFFERENTIABILITY-KIND? CALLEE-CONVENTION FUNC-REPRESENTATION? COROUTINE-KIND? (PARAM-CONVENTION PARAM-DIFFERENTIABILITY?)* RESULT-CONVENTION* ('Y' PARAM-CONVENTION)* ('z' RESULT-CONVENTION)? + FUNC-ATTRIBUTES ::= PATTERN-SUBS? INVOCATION-SUBS? PSEUDO-GENERIC? CALLEE-ESCAPE? DIFFERENTIABILITY-KIND? CALLEE-CONVENTION FUNC-REPRESENTATION? COROUTINE-KIND? (PARAM-CONVENTION PARAM-DIFFERENTIABILITY?)* RESULT-CONVENTION* ('Y' PARAM-CONVENTION)* ('z' RESULT-CONVENTION RESULT-DIFFERENTIABILITY?)? PATTERN-SUBS ::= 's' // has pattern substitutions INVOCATION-SUB ::= 'I' // has invocation substitutions @@ -634,6 +634,8 @@ mangled in to disambiguate. RESULT-CONVENTION ::= 'u' // unowned inner pointer RESULT-CONVENTION ::= 'a' // auto-released + RESULT-DIFFERENTIABILITY ::= 'w' // @noDerivative + For the most part, manglings follow the structure of formal language types. However, in some cases it is more useful to encode the exact implementation details of a function type. diff --git a/include/swift/AST/ASTContext.h b/include/swift/AST/ASTContext.h index 665fcb0894313..4ff1060777427 100644 --- a/include/swift/AST/ASTContext.h +++ b/include/swift/AST/ASTContext.h @@ -407,6 +407,12 @@ class ASTContext final { array.size()); } + template + MutableArrayRef + AllocateCopy(const std::vector &vec, + AllocationArena arena = AllocationArena::Permanent) const { + return AllocateCopy(ArrayRef(vec), arena); + } template ArrayRef AllocateCopy(const SmallVectorImpl &vec, diff --git a/include/swift/AST/ASTNode.h b/include/swift/AST/ASTNode.h index 892555418765d..4492c5063642a 100644 --- a/include/swift/AST/ASTNode.h +++ b/include/swift/AST/ASTNode.h @@ -30,7 +30,7 @@ namespace swift { class Stmt; class Decl; class Pattern; - class TypeLoc; + class TypeRepr; class DeclContext; class SourceLoc; class SourceRange; @@ -41,7 +41,7 @@ namespace swift { enum class StmtKind; struct ASTNode : public llvm::PointerUnion { + TypeRepr *> { // Inherit the constructors from PointerUnion. using PointerUnion::PointerUnion; diff --git a/include/swift/AST/ASTWalker.h b/include/swift/AST/ASTWalker.h index af4308ecd8db4..4aed8fa6eabf0 100644 --- a/include/swift/AST/ASTWalker.h +++ b/include/swift/AST/ASTWalker.h @@ -216,12 +216,12 @@ class ASTWalker { virtual bool shouldWalkIntoLazyInitializers() { return true; } /// This method configures whether the walker should visit the body of a - /// non-single expression closure. + /// closure that was checked separately from its enclosing expression. /// /// For work that is performed for every top-level expression, this should /// be overridden to return false, to avoid duplicating work or visiting /// bodies of closures that have not yet been type checked. - virtual bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *) { + virtual bool shouldWalkIntoSeparatelyCheckedClosure(ClosureExpr *) { return true; } diff --git a/include/swift/AST/AnyFunctionRef.h b/include/swift/AST/AnyFunctionRef.h index 9c0ebe122e03c..da5be7c7adf91 100644 --- a/include/swift/AST/AnyFunctionRef.h +++ b/include/swift/AST/AnyFunctionRef.h @@ -89,20 +89,6 @@ class AnyFunctionRef { return TheFunction.get()->getSingleExpressionBody(); } - void setSingleExpressionBody(Expr *expr) { - if (auto *AFD = TheFunction.dyn_cast()) { - AFD->setSingleExpressionBody(expr); - return; - } - - auto ACE = TheFunction.get(); - if (auto CE = dyn_cast(ACE)) { - CE->setSingleExpressionBody(expr); - } else { - cast(ACE)->setBody(expr); - } - } - Type getType() const { if (auto *AFD = TheFunction.dyn_cast()) return AFD->getInterfaceType(); diff --git a/include/swift/AST/Attr.h b/include/swift/AST/Attr.h index fde3102843bd5..d6482297d272f 100644 --- a/include/swift/AST/Attr.h +++ b/include/swift/AST/Attr.h @@ -36,7 +36,6 @@ #include "swift/AST/PlatformKind.h" #include "swift/AST/Requirement.h" #include "swift/AST/TrailingCallArguments.h" -#include "swift/AST/TypeLoc.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ErrorHandling.h" @@ -56,6 +55,7 @@ class LazyConformanceLoader; class LazyMemberLoader; class PatternBindingInitializer; class TrailingWhereClause; +class TypeExpr; /// TypeAttributes - These are attributes that may be applied to types. class TypeAttributes { @@ -1110,22 +1110,22 @@ class DynamicReplacementAttr final /// The \c @_typeEraser(TypeEraserType) attribute. class TypeEraserAttr final : public DeclAttribute { - TypeLoc TypeEraserLoc; + TypeExpr *TypeEraserExpr; LazyMemberLoader *Resolver; uint64_t ResolverContextData; friend class ResolveTypeEraserTypeRequest; - TypeEraserAttr(SourceLoc atLoc, SourceRange range, TypeLoc typeEraserLoc, + TypeEraserAttr(SourceLoc atLoc, SourceRange range, TypeExpr *typeEraserExpr, LazyMemberLoader *Resolver, uint64_t Data) : DeclAttribute(DAK_TypeEraser, atLoc, range, /*Implicit=*/false), - TypeEraserLoc(typeEraserLoc), + TypeEraserExpr(typeEraserExpr), Resolver(Resolver), ResolverContextData(Data) {} public: static TypeEraserAttr *create(ASTContext &ctx, SourceLoc atLoc, SourceRange range, - TypeLoc typeEraserLoc); + TypeExpr *typeEraserRepr); static TypeEraserAttr *create(ASTContext &ctx, LazyMemberLoader *Resolver, @@ -1133,14 +1133,10 @@ class TypeEraserAttr final : public DeclAttribute { /// Retrieve the parsed type repr for this attribute, if it /// was parsed. Else returns \c nullptr. - TypeRepr *getParsedTypeEraserTypeRepr() const { - return TypeEraserLoc.getTypeRepr(); - } + TypeRepr *getParsedTypeEraserTypeRepr() const; /// Retrieve the parsed location for this attribute, if it was parsed. - SourceLoc getLoc() const { - return TypeEraserLoc.getLoc(); - } + SourceLoc getLoc() const; /// Retrieve the resolved type of this attribute if it has been resolved by a /// successful call to \c getResolvedType(). Otherwise, @@ -1148,9 +1144,7 @@ class TypeEraserAttr final : public DeclAttribute { /// /// This entrypoint is only suitable for syntactic clients like the /// AST printer. Semantic clients should use \c getResolvedType() instead. - Type getTypeWithoutResolving() const { - return TypeEraserLoc.getType(); - } + Type getTypeWithoutResolving() const; /// Returns \c true if the type eraser type has a valid implementation of the /// erasing initializer for the given protocol. @@ -1464,25 +1458,26 @@ class SpecializeAttr : public DeclAttribute { /// The @_implements attribute, which treats a decl as the implementation for /// some named protocol requirement (but otherwise not-visible by that name). class ImplementsAttr : public DeclAttribute { - - TypeLoc ProtocolType; + TypeExpr *ProtocolType; DeclName MemberName; DeclNameLoc MemberNameLoc; public: ImplementsAttr(SourceLoc atLoc, SourceRange Range, - TypeLoc ProtocolType, + TypeExpr *ProtocolType, DeclName MemberName, DeclNameLoc MemberNameLoc); static ImplementsAttr *create(ASTContext &Ctx, SourceLoc atLoc, SourceRange Range, - TypeLoc ProtocolType, + TypeExpr *ProtocolType, DeclName MemberName, DeclNameLoc MemberNameLoc); - TypeLoc getProtocolType() const; - TypeLoc &getProtocolType(); + void setProtocolType(Type ty); + Type getProtocolType() const; + TypeRepr *getProtocolTypeRepr() const; + DeclName getMemberName() const { return MemberName; } DeclNameLoc getMemberNameLoc() const { return MemberNameLoc; } @@ -1595,7 +1590,7 @@ class ClangImporterSynthesizedTypeAttr : public DeclAttribute { /// Defines a custom attribute. class CustomAttr final : public DeclAttribute, public TrailingCallArguments { - TypeLoc type; + TypeExpr *typeExpr; Expr *arg; PatternBindingInitializer *initContext; Expr *semanticInit = nullptr; @@ -1603,19 +1598,19 @@ class CustomAttr final : public DeclAttribute, unsigned hasArgLabelLocs : 1; unsigned numArgLabels : 16; - CustomAttr(SourceLoc atLoc, SourceRange range, TypeLoc type, + CustomAttr(SourceLoc atLoc, SourceRange range, TypeExpr *type, PatternBindingInitializer *initContext, Expr *arg, ArrayRef argLabels, ArrayRef argLabelLocs, bool implicit); public: - static CustomAttr *create(ASTContext &ctx, SourceLoc atLoc, TypeLoc type, + static CustomAttr *create(ASTContext &ctx, SourceLoc atLoc, TypeExpr *type, bool implicit = false) { return create(ctx, atLoc, type, false, nullptr, SourceLoc(), { }, { }, { }, SourceLoc(), implicit); } - static CustomAttr *create(ASTContext &ctx, SourceLoc atLoc, TypeLoc type, + static CustomAttr *create(ASTContext &ctx, SourceLoc atLoc, TypeExpr *type, bool hasInitializer, PatternBindingInitializer *initContext, SourceLoc lParenLoc, @@ -1628,8 +1623,8 @@ class CustomAttr final : public DeclAttribute, unsigned getNumArguments() const { return numArgLabels; } bool hasArgumentLabelLocs() const { return hasArgLabelLocs; } - TypeLoc &getTypeLoc() { return type; } - const TypeLoc &getTypeLoc() const { return type; } + TypeRepr *getTypeRepr() const; + Type getType() const; Expr *getArg() const { return arg; } void setArg(Expr *newArg) { arg = newArg; } @@ -1642,6 +1637,14 @@ class CustomAttr final : public DeclAttribute, static bool classof(const DeclAttribute *DA) { return DA->getKind() == DAK_Custom; } + +private: + friend class CustomAttrNominalRequest; + void resetTypeInformation(TypeExpr *repr); + +private: + friend class CustomAttrTypeRequest; + void setType(Type ty); }; /// Relates a property to its projection value property, as described by a property wrapper. For diff --git a/include/swift/AST/AutoDiff.h b/include/swift/AST/AutoDiff.h index ffd3919bdd6bd..5b447027b20c5 100644 --- a/include/swift/AST/AutoDiff.h +++ b/include/swift/AST/AutoDiff.h @@ -173,18 +173,21 @@ enum class AutoDiffGeneratedDeclarationKind : uint8_t { }; /// SIL-level automatic differentiation indices. Consists of: -/// - Parameter indices: indices of parameters to differentiate with respect to. -/// - Result index: index of the result to differentiate from. +/// - The differentiability parameter indices. +/// - The differentiability result indices. // TODO(TF-913): Remove `SILAutoDiffIndices` in favor of `AutoDiffConfig`. -// `AutoDiffConfig` supports multiple result indices. +// `AutoDiffConfig` additionally stores a derivative generic signature. struct SILAutoDiffIndices { - /// The index of the dependent result to differentiate from. - unsigned source; - /// The indices for independent parameters to differentiate with respect to. + /// The indices of independent parameters to differentiate with respect to. IndexSubset *parameters; + /// The indices of dependent results to differentiate from. + IndexSubset *results; - /*implicit*/ SILAutoDiffIndices(unsigned source, IndexSubset *parameters) - : source(source), parameters(parameters) {} + /*implicit*/ SILAutoDiffIndices(IndexSubset *parameters, IndexSubset *results) + : parameters(parameters), results(results) { + assert(parameters && "Parameter indices must be non-null"); + assert(results && "Result indices must be non-null"); + } bool operator==(const SILAutoDiffIndices &other) const; @@ -202,7 +205,12 @@ struct SILAutoDiffIndices { SWIFT_DEBUG_DUMP; std::string mangle() const { - std::string result = "src_" + llvm::utostr(source) + "_wrt_"; + std::string result = "src_"; + interleave( + results->getIndices(), + [&](unsigned idx) { result += llvm::utostr(idx); }, + [&] { result += '_'; }); + result += "_wrt_"; llvm::interleave( parameters->getIndices(), [&](unsigned idx) { result += llvm::utostr(idx); }, @@ -513,8 +521,8 @@ IndexSubset *getLoweredParameterIndices(IndexSubset *astParameterIndices, /// /// Returns the "constrained" derivative/transpose generic signature given: /// - An original SIL function type. -/// - Differentiability parameter indices. -/// - A possibly "unconstrained" derivative generic signature. +/// - Differentiability/linearity parameter indices. +/// - A possibly "unconstrained" derivative/transpose generic signature. GenericSignature getConstrainedDerivativeGenericSignature( SILFunctionType *originalFnTy, IndexSubset *diffParamIndices, GenericSignature derivativeGenSig, LookupConformanceFn lookupConformance, diff --git a/include/swift/AST/Decl.h b/include/swift/AST/Decl.h index 78e04e69598cf..600042bf07563 100644 --- a/include/swift/AST/Decl.h +++ b/include/swift/AST/Decl.h @@ -2715,6 +2715,7 @@ class ValueDecl : public Decl { /// Is this declaration marked with 'dynamic'? bool isDynamic() const; +private: bool isObjCDynamic() const { return isObjC() && isDynamic(); } @@ -2723,6 +2724,37 @@ class ValueDecl : public Decl { return !isObjC() && isDynamic(); } + bool isObjCDynamicInGenericClass() const; + +public: + /// Should we use Objective-C method dispatch for this decl. + bool shouldUseObjCDispatch() const { + return isObjCDynamic(); + } + + /// Should we use native dynamic function replacement dispatch for this decl. + bool shouldUseNativeDynamicDispatch() const { + return isNativeDynamic(); + } + + /// Should we use Objective-C category based function replacement for this + /// decl. + /// This is all `@objc dynamic` methods except for such methods in native + /// generic classes. We can't use a category for generic classes so we use + /// native replacement instead (this behavior is only enabled with + /// -enable-implicit-dynamic). + bool shouldUseObjCMethodReplacement() const; + + /// Should we use native dynamic function replacement mechanism for this decl. + /// This is all native dynamic methods except for `@objc dynamic` methods in + /// generic classes (see above). + bool shouldUseNativeMethodReplacement() const; + + /// Is this a native dynamic function replacement based replacement. + /// This is all @_dynamicReplacement(for:) of native functions and @objc + /// dynamic methods on generic classes (see above). + bool isNativeMethodReplacement() const; + bool isEffectiveLinkageMoreVisibleThan(ValueDecl *other) const { return (std::min(getEffectiveAccess(), AccessLevel::Public) > std::min(other->getEffectiveAccess(), AccessLevel::Public)); diff --git a/include/swift/AST/DiagnosticsCommon.def b/include/swift/AST/DiagnosticsCommon.def index b633d8d686bd6..d797125013ed3 100644 --- a/include/swift/AST/DiagnosticsCommon.def +++ b/include/swift/AST/DiagnosticsCommon.def @@ -159,11 +159,11 @@ NOTE(circular_type_resolution_note,none, // MARK: Cross-import overlay loading diagnostics //------------------------------------------------------------------------------ ERROR(cannot_load_swiftoverlay_file, none, - "cannot load cross-import overlay for %0 and %1: %2 (declared by '%3')", - (Identifier, Identifier, StringRef, StringRef)) + "cannot load cross-import overlay for '%0' and '%1': %2 (declared by '%3')", + (StringRef, StringRef, StringRef, StringRef)) ERROR(cannot_list_swiftcrossimport_dir, none, - "cannot list cross-import overlays for %0: %1 (declared in '%2')", - (Identifier, StringRef, StringRef)) + "cannot list cross-import overlays for '%0': %1 (declared in '%2')", + (StringRef, StringRef, StringRef)) WARNING(cross_imported_by_both_modules, none, "modules %0 and %1 both declare module %2 as a cross-import overlay, " "which may cause paradoxical behavior when looking up names in them; " diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index e8581d3cbc515..d12b61b251394 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -94,6 +94,9 @@ ERROR(could_not_find_enum_case,none, NOTE(did_you_mean_raw_type,none, "did you mean to specify a raw type on the enum declaration?", ()) + +NOTE(did_you_mean_generic_param_as_conformance,none, + "did you mean to declare %0 as a protocol conformance for %1?", (DeclName, Type)) NOTE(any_as_anyobject_fixit, none, "cast 'Any' to 'AnyObject' or use 'as!' to force downcast to a more specific type to access members", ()) @@ -5075,8 +5078,8 @@ ERROR(function_builder_infer_ambig, none, NOTE(function_builder_infer_add_return, none, "add an explicit 'return' statement to not use a function builder", ()) NOTE(function_builder_infer_pick_specific, none, - "apply function builder %0 (inferred from protocol %1)", - (Type, DeclName)) + "apply function builder %0 (inferred from %select{protocol|dynamic replacement of}1 %2)", + (Type, unsigned, DeclName)) //------------------------------------------------------------------------------ // MARK: Tuple Shuffle Diagnostics diff --git a/include/swift/AST/Evaluator.h b/include/swift/AST/Evaluator.h index 95730fffc812c..5235343ebe779 100644 --- a/include/swift/AST/Evaluator.h +++ b/include/swift/AST/Evaluator.h @@ -439,7 +439,7 @@ class Evaluator { !Request::isDependencySink>::type * = nullptr> void reportEvaluatedResult(const Request &r, const typename Request::OutputType &o) { - recorder.replay(ActiveRequest(r)); + recorder.replay(activeRequests, ActiveRequest(r)); } // Report the result of evaluating a request that is a dependency sink. diff --git a/include/swift/AST/EvaluatorDependencies.h b/include/swift/AST/EvaluatorDependencies.h index 9f42c90d9108a..7808e86caa9cc 100644 --- a/include/swift/AST/EvaluatorDependencies.h +++ b/include/swift/AST/EvaluatorDependencies.h @@ -109,6 +109,14 @@ using DependencySource = llvm::PointerIntPair; struct DependencyRecorder; +/// A \c DependencyCollector defines an abstract write-only buffer of +/// \c Reference objects. References are added to a collector during the write +/// phase of request evaluation (in \c writeDependencySink) with the various +/// \c add* functions below.. +/// +/// A \c DependencyCollector cannot be created directly. You must invoke +/// \c DependencyRecorder::record, which will wire a dependency collector into +/// the provided continuation block. struct DependencyCollector { friend DependencyRecorder; @@ -227,27 +235,33 @@ struct DependencyCollector { void addDynamicLookupName(DeclBaseName name); public: + /// Retrieves the dependency recorder that created this dependency collector. const DependencyRecorder &getRecorder() const { return parent; } + + /// Returns \c true if this collector has not accumulated + /// any \c Reference objects. bool empty() const { return scratch.empty(); } }; -/// A \c DependencyCollector is an aggregator of named references discovered in a +/// A \c DependencyRecorder is an aggregator of named references discovered in a /// particular \c DependencyScope during the course of request evaluation. struct DependencyRecorder { friend DependencyCollector; enum class Mode { - // Enables the current "status quo" behavior of the dependency collector. - // - // By default, the dependency collector moves to register dependencies in - // the referenced name trackers at the top of the active dependency stack. - StatusQuo, - // Enables an experimental mode to only register private dependencies. + // Enables the status quo of recording direct dependencies. // // This mode restricts the dependency collector to ignore changes of // scope. This has practical effect of charging all unqualified lookups to // the primary file being acted upon instead of to the destination file. - ExperimentalPrivateDependencies, + DirectDependencies, + // Enables a legacy mode of dependency tracking that makes a distinction + // between private and cascading edges, and does not directly capture + // transitive dependencies. + // + // By default, the dependency collector moves to register dependencies in + // the referenced name trackers at the top of the active dependency stack. + LegacyCascadingDependencies, }; private: @@ -264,16 +278,62 @@ struct DependencyRecorder { explicit DependencyRecorder(Mode mode) : mode{mode}, isRecording{false} {}; private: + /// Records the given \c Reference as a dependency of the current dependency + /// source. + /// + /// This is as opposed to merely collecting a \c Reference, which may just buffer + /// it for realization or replay later. void realize(const DependencyCollector::Reference &ref); public: - void replay(const swift::ActiveRequest &req); + /// Begins the recording of references by invoking the given continuation + /// with a fresh \c DependencyCollector object. This object should be used + /// to buffer dependency-relevant references to names looked up by a + /// given request. + /// + /// Recording only occurs for requests that are dependency sinks. void record(const llvm::SetVector &stack, llvm::function_ref rec); + /// Replays the \c Reference objects collected by a given cached request and + /// its sub-requests into the current dependency scope. + /// + /// Dependency replay ensures that cached requests do not "hide" names from + /// the active dependency scope. This would otherwise occur frequently in + /// batch mode, where cached requests effectively block the re-evaluation of + /// a large quantity of computations that perform name lookups by design. + /// + /// Replay need only occur for requests that are (separately) cached. + void replay(const llvm::SetVector &stack, + const swift::ActiveRequest &req); +private: + /// Given the current stack of requests and a buffer of \c Reference objects + /// walk the active stack looking for the next-innermost cached request. If + /// found, insert the buffer of references into that request's known reference + /// set. + /// + /// This algorithm ensures that references propagate lazily up the request + /// graph from cached sub-requests to their cached parents. Once this process + /// completes, all cached requests in the request graph will see the + /// union of all references recorded while evaluating their sub-requests. + /// + /// This algorithm *must* be tail-called during + /// \c DependencyRecorder::record or \c DependencyRecorder::replay + /// or the corresponding set of references for the active dependency scope + /// will become incoherent. + void + unionNearestCachedRequest(ArrayRef stack, + const DependencyCollector::ReferenceSet &scratch); + public: using ReferenceEnumerator = llvm::function_ref; + + /// Enumerates the set of references associated with a given source file, + /// passing them to the given enumeration callback. + /// + /// The order of enumeration is completely undefined. It is the responsibility + /// of callers to ensure they are order-invariant or are sorting the result. void enumerateReferencesInFile(const SourceFile *SF, ReferenceEnumerator f) const ; @@ -298,7 +358,12 @@ struct DependencyRecorder { SourceFile *getActiveDependencySourceOrNull() const { if (dependencySources.empty()) return nullptr; - return dependencySources.back().getPointer(); + switch (mode) { + case Mode::LegacyCascadingDependencies: + return dependencySources.back().getPointer(); + case Mode::DirectDependencies: + return dependencySources.front().getPointer(); + } } public: @@ -331,22 +396,14 @@ struct DependencyRecorder { }; private: - /// Returns the first dependency source registered with the tracker, or - /// \c nullptr if no dependency sources have been registered. - SourceFile *getFirstDependencySourceOrNull() const { - if (dependencySources.empty()) - return nullptr; - return dependencySources.front().getPointer(); - } - /// Returns \c true if the scope of the current active source cascades. /// /// If there is no active scope, the result always cascades. bool isActiveSourceCascading() const { switch (mode) { - case Mode::StatusQuo: + case Mode::LegacyCascadingDependencies: return getActiveSourceScope() == evaluator::DependencyScope::Cascading; - case Mode::ExperimentalPrivateDependencies: + case Mode::DirectDependencies: return false; } llvm_unreachable("invalid mode"); diff --git a/include/swift/AST/Expr.h b/include/swift/AST/Expr.h index 34f94465a8ec0..1cb0976cdfd5e 100644 --- a/include/swift/AST/Expr.h +++ b/include/swift/AST/Expr.h @@ -25,7 +25,6 @@ #include "swift/AST/ProtocolConformanceRef.h" #include "swift/AST/TrailingCallArguments.h" #include "swift/AST/TypeAlignments.h" -#include "swift/AST/TypeLoc.h" #include "swift/AST/Availability.h" #include "swift/Basic/Debug.h" #include "swift/Basic/InlineBitfield.h" @@ -555,7 +554,7 @@ class alignas(8) Expr { SWIFT_DEBUG_DUMP; void dump(raw_ostream &OS, unsigned Indent = 0) const; void dump(raw_ostream &OS, llvm::function_ref getType, - llvm::function_ref getTypeOfTypeLoc, + llvm::function_ref getTypeOfTypeRepr, llvm::function_ref getTypeOfKeyPathComponent, unsigned Indent = 0) const; @@ -598,13 +597,23 @@ class ErrorExpr : public Expr { /// CodeCompletionExpr - Represents the code completion token in the AST, this /// can help us preserve the context of the code completion position. class CodeCompletionExpr : public Expr { - SourceRange Range; + Expr *Base; + SourceLoc Loc; public: - CodeCompletionExpr(SourceRange Range, Type Ty = Type()) - : Expr(ExprKind::CodeCompletion, /*Implicit=*/true, Ty), Range(Range) {} + CodeCompletionExpr(Expr *Base, SourceLoc Loc) + : Expr(ExprKind::CodeCompletion, /*Implicit=*/true, Type()), + Base(Base), Loc(Loc) {} - SourceRange getSourceRange() const { return Range; } + CodeCompletionExpr(SourceLoc Loc) + : CodeCompletionExpr(/*Base=*/nullptr, Loc) {} + + Expr *getBase() const { return Base; } + void setBase(Expr *E) { Base = E; } + + SourceLoc getLoc() const { return Loc; } + SourceLoc getStartLoc() const { return Base ? Base->getStartLoc() : Loc; } + SourceLoc getEndLoc() const { return Loc; } static bool classof(const Expr *E) { return E->getKind() == ExprKind::CodeCompletion; @@ -3770,10 +3779,7 @@ class ClosureExpr : public AbstractClosureExpr { /// the CaptureListExpr which would normally maintain this sort of /// information about captured variables), we need to have some way to access /// this information directly on the ClosureExpr. - /// - /// The bit indicates whether this closure has had a function builder - /// applied to it. - llvm::PointerIntPair CapturedSelfDeclAndAppliedBuilder; + VarDecl * CapturedSelfDecl; /// The location of the "throws", if present. SourceLoc ThrowsLoc; @@ -3787,7 +3793,7 @@ class ClosureExpr : public AbstractClosureExpr { /// The explicitly-specified result type. llvm::PointerIntPair - ExplicitResultTypeAndEnclosingChecked; + ExplicitResultTypeAndSeparatelyChecked; /// The body of the closure, along with a bit indicating whether it /// was originally just a single expression. @@ -3800,9 +3806,9 @@ class ClosureExpr : public AbstractClosureExpr { : AbstractClosureExpr(ExprKind::Closure, Type(), /*Implicit=*/false, discriminator, parent), BracketRange(bracketRange), - CapturedSelfDeclAndAppliedBuilder(capturedSelfDecl, false), + CapturedSelfDecl(capturedSelfDecl), ThrowsLoc(throwsLoc), ArrowLoc(arrowLoc), InLoc(inLoc), - ExplicitResultTypeAndEnclosingChecked(explicitResultType, false), + ExplicitResultTypeAndSeparatelyChecked(explicitResultType, false), Body(nullptr) { setParameterList(params); Bits.ClosureExpr.HasAnonymousClosureVars = false; @@ -3857,14 +3863,14 @@ class ClosureExpr : public AbstractClosureExpr { Type getExplicitResultType() const { assert(hasExplicitResultType() && "No explicit result type"); - return ExplicitResultTypeAndEnclosingChecked.getPointer() + return ExplicitResultTypeAndSeparatelyChecked.getPointer() ->getInstanceType(); } void setExplicitResultType(Type ty); TypeRepr *getExplicitResultTypeRepr() const { assert(hasExplicitResultType() && "No explicit result type"); - return ExplicitResultTypeAndEnclosingChecked.getPointer() + return ExplicitResultTypeAndSeparatelyChecked.getPointer() ->getTypeRepr(); } @@ -3894,19 +3900,12 @@ class ClosureExpr : public AbstractClosureExpr { /// Only valid when \c hasSingleExpressionBody() is true. Expr *getSingleExpressionBody() const; - /// Set the body for a closure that has a single expression as its - /// body. - /// - /// This routine cannot change whether a closure has a single expression as - /// its body; it can only update that expression. - void setSingleExpressionBody(Expr *NewBody); - /// Is this a completely empty closure? bool hasEmptyBody() const; /// VarDecl captured by this closure under the literal name \c self , if any. VarDecl *getCapturedSelfDecl() const { - return CapturedSelfDeclAndAppliedBuilder.getPointer(); + return CapturedSelfDecl; } /// Whether this closure captures the \c self param in its body in such a @@ -3914,22 +3913,14 @@ class ClosureExpr : public AbstractClosureExpr { /// captured non-weakly). bool capturesSelfEnablingImplictSelf() const; - bool hasAppliedFunctionBuilder() const { - return CapturedSelfDeclAndAppliedBuilder.getInt(); + /// Whether this closure's body was type checked separately from its + /// enclosing expression. + bool wasSeparatelyTypeChecked() const { + return ExplicitResultTypeAndSeparatelyChecked.getInt(); } - void setAppliedFunctionBuilder(bool flag = true) { - CapturedSelfDeclAndAppliedBuilder.setInt(flag); - } - - /// Whether this closure's body was type checked within the enclosing - /// context. - bool wasTypeCheckedInEnclosingContext() const { - return ExplicitResultTypeAndEnclosingChecked.getInt(); - } - - void setTypeCheckedInEnclosingContext(bool flag = true) { - ExplicitResultTypeAndEnclosingChecked.setInt(flag); + void setSeparatelyTypeChecked(bool flag = true) { + ExplicitResultTypeAndSeparatelyChecked.setInt(flag); } static bool classof(const Expr *E) { @@ -4605,23 +4596,22 @@ class DotSyntaxBaseIgnoredExpr : public Expr { class ExplicitCastExpr : public Expr { Expr *SubExpr; SourceLoc AsLoc; - TypeLoc CastTy; + TypeExpr *const CastTy; protected: - ExplicitCastExpr(ExprKind kind, Expr *sub, SourceLoc AsLoc, TypeLoc castTy) - : Expr(kind, /*Implicit=*/false), SubExpr(sub), AsLoc(AsLoc), CastTy(castTy) - {} + ExplicitCastExpr(ExprKind kind, Expr *sub, SourceLoc AsLoc, TypeExpr *castTy) + : Expr(kind, /*Implicit=*/false), SubExpr(sub), AsLoc(AsLoc), + CastTy(castTy) {} public: Expr *getSubExpr() const { return SubExpr; } - - /// Get the type syntactically spelled in the cast. For some forms of checked - /// cast this is different from the result type of the expression. - TypeLoc &getCastTypeLoc() { return CastTy; } /// Get the type syntactically spelled in the cast. For some forms of checked /// cast this is different from the result type of the expression. - TypeLoc getCastTypeLoc() const { return CastTy; } + Type getCastType() const { return CastTy->getInstanceType(); } + void setCastType(Type type); + + TypeRepr *getCastTypeRepr() const { return CastTy->getTypeRepr(); } void setSubExpr(Expr *E) { SubExpr = E; } @@ -4637,7 +4627,7 @@ class ExplicitCastExpr : public Expr { } SourceRange getSourceRange() const { - SourceRange castTyRange = CastTy.getSourceRange(); + const SourceRange castTyRange = CastTy->getSourceRange(); if (castTyRange.isInvalid()) return SubExpr->getSourceRange(); @@ -4662,14 +4652,13 @@ StringRef getCheckedCastKindName(CheckedCastKind kind); /// Abstract base class for checked casts 'as' and 'is'. These represent /// casts that can dynamically fail. class CheckedCastExpr : public ExplicitCastExpr { -public: - CheckedCastExpr(ExprKind kind, - Expr *sub, SourceLoc asLoc, TypeLoc castTy) - : ExplicitCastExpr(kind, sub, asLoc, castTy) - { +protected: + CheckedCastExpr(ExprKind kind, Expr *sub, SourceLoc asLoc, TypeExpr *castTy) + : ExplicitCastExpr(kind, sub, asLoc, castTy) { Bits.CheckedCastExpr.CastKind = unsigned(CheckedCastKind::Unresolved); } - + +public: /// Return the semantic kind of cast performed. CheckedCastKind getCastKind() const { return CheckedCastKind(Bits.CheckedCastExpr.CastKind); @@ -4693,22 +4682,20 @@ class CheckedCastExpr : public ExplicitCastExpr { /// from a value of some type to some specified subtype and fails dynamically /// if the value does not have that type. /// Spelled 'a as! T' and produces a value of type 'T'. -class ForcedCheckedCastExpr : public CheckedCastExpr { +class ForcedCheckedCastExpr final : public CheckedCastExpr { SourceLoc ExclaimLoc; -public: ForcedCheckedCastExpr(Expr *sub, SourceLoc asLoc, SourceLoc exclaimLoc, - TypeLoc type) - : CheckedCastExpr(ExprKind::ForcedCheckedCast, - sub, asLoc, type), - ExclaimLoc(exclaimLoc) - { - } + TypeExpr *type) + : CheckedCastExpr(ExprKind::ForcedCheckedCast, sub, asLoc, type), + ExclaimLoc(exclaimLoc) {} - ForcedCheckedCastExpr(SourceLoc asLoc, SourceLoc exclaimLoc, TypeLoc type) - : ForcedCheckedCastExpr(nullptr, asLoc, exclaimLoc, type) - { - } +public: + static ForcedCheckedCastExpr *create(ASTContext &ctx, SourceLoc asLoc, + SourceLoc exclaimLoc, TypeRepr *tyRepr); + + static ForcedCheckedCastExpr *createImplicit(ASTContext &ctx, Expr *sub, + Type castTy); /// Retrieve the location of the '!' that follows 'as'. SourceLoc getExclaimLoc() const { return ExclaimLoc; } @@ -4722,21 +4709,24 @@ class ForcedCheckedCastExpr : public CheckedCastExpr { /// from a type to some subtype and produces an Optional value, which will be /// .Some(x) if the cast succeeds, or .None if the cast fails. /// Spelled 'a as? T' and produces a value of type 'T?'. -class ConditionalCheckedCastExpr : public CheckedCastExpr { +class ConditionalCheckedCastExpr final : public CheckedCastExpr { SourceLoc QuestionLoc; -public: ConditionalCheckedCastExpr(Expr *sub, SourceLoc asLoc, SourceLoc questionLoc, - TypeLoc type) - : CheckedCastExpr(ExprKind::ConditionalCheckedCast, - sub, asLoc, type), - QuestionLoc(questionLoc) - { } - - ConditionalCheckedCastExpr(SourceLoc asLoc, SourceLoc questionLoc, - TypeLoc type) - : ConditionalCheckedCastExpr(nullptr, asLoc, questionLoc, type) - {} + TypeExpr *type) + : CheckedCastExpr(ExprKind::ConditionalCheckedCast, sub, asLoc, type), + QuestionLoc(questionLoc) {} + +public: + static ConditionalCheckedCastExpr *create(ASTContext &ctx, SourceLoc asLoc, + SourceLoc questionLoc, + TypeRepr *tyRepr); + + static ConditionalCheckedCastExpr *createImplicit(ASTContext &ctx, Expr *sub, + Type castTy); + + static ConditionalCheckedCastExpr * + createImplicit(ASTContext &ctx, Expr *sub, TypeRepr *tyRepr, Type castTy); /// Retrieve the location of the '?' that follows 'as'. SourceLoc getQuestionLoc() const { return QuestionLoc; } @@ -4751,16 +4741,13 @@ class ConditionalCheckedCastExpr : public CheckedCastExpr { /// of the type and 'a as T' would succeed, false otherwise. /// /// FIXME: We should support type queries with a runtime metatype value too. -class IsExpr : public CheckedCastExpr { +class IsExpr final : public CheckedCastExpr { + IsExpr(Expr *sub, SourceLoc isLoc, TypeExpr *type) + : CheckedCastExpr(ExprKind::Is, sub, isLoc, type) {} + public: - IsExpr(Expr *sub, SourceLoc isLoc, TypeLoc type) - : CheckedCastExpr(ExprKind::Is, sub, isLoc, type) - {} - - IsExpr(SourceLoc isLoc, TypeLoc type) - : IsExpr(nullptr, isLoc, type) - {} - + static IsExpr *create(ASTContext &ctx, SourceLoc isLoc, TypeRepr *tyRepr); + static bool classof(const Expr *E) { return E->getKind() == ExprKind::Is; } @@ -4769,35 +4756,29 @@ class IsExpr : public CheckedCastExpr { /// Represents an explicit coercion from a value to a specific type. /// /// Spelled 'a as T' and produces a value of type 'T'. -class CoerceExpr : public ExplicitCastExpr { +class CoerceExpr final : public ExplicitCastExpr { /// Since there is already `asLoc` location, /// we use it to store `start` of the initializer /// call source range to save some storage. SourceLoc InitRangeEnd; -public: - CoerceExpr(Expr *sub, SourceLoc asLoc, TypeLoc type) - : ExplicitCastExpr(ExprKind::Coerce, sub, asLoc, type) - { } + CoerceExpr(Expr *sub, SourceLoc asLoc, TypeExpr *type) + : ExplicitCastExpr(ExprKind::Coerce, sub, asLoc, type) {} - CoerceExpr(SourceLoc asLoc, TypeLoc type) - : CoerceExpr(nullptr, asLoc, type) - { } - -private: - CoerceExpr(SourceRange initRange, Expr *literal, TypeLoc type) - : ExplicitCastExpr(ExprKind::Coerce, literal, initRange.Start, - type), InitRangeEnd(initRange.End) - { setImplicit(); } + CoerceExpr(SourceRange initRange, Expr *literal, TypeExpr *type) + : ExplicitCastExpr(ExprKind::Coerce, literal, initRange.Start, type), + InitRangeEnd(initRange.End) {} public: + static CoerceExpr *create(ASTContext &ctx, SourceLoc asLoc, TypeRepr *tyRepr); + + static CoerceExpr *createImplicit(ASTContext &ctx, Expr *sub, Type castTy); + /// Create an implicit coercion expression for literal initialization /// preserving original source information, this way original call /// could be recreated if needed. static CoerceExpr *forLiteralInit(ASTContext &ctx, Expr *literal, - SourceRange range, TypeLoc literalType) { - return new (ctx) CoerceExpr(range, literal, literalType); - } + SourceRange range, TypeRepr *literalTyRepr); bool isLiteralInit() const { return InitRangeEnd.isValid(); } diff --git a/include/swift/AST/FileSystem.h b/include/swift/AST/FileSystem.h index 90d693a4fee9e..15641164c3e08 100644 --- a/include/swift/AST/FileSystem.h +++ b/include/swift/AST/FileSystem.h @@ -15,6 +15,7 @@ #include "swift/Basic/FileSystem.h" #include "swift/AST/DiagnosticEngine.h" +#include "swift/AST/DiagnosticsCommon.h" namespace swift { diff --git a/include/swift/AST/FineGrainedDependencies.h b/include/swift/AST/FineGrainedDependencies.h index f76a0f5305484..381b4443c0cb3 100644 --- a/include/swift/AST/FineGrainedDependencies.h +++ b/include/swift/AST/FineGrainedDependencies.h @@ -1,4 +1,4 @@ -//===----- FineGrainedependencies.h -----------------------------*- C++ -*-===// +//===----- FineGrainedDependencies.h ----------------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // @@ -632,6 +632,11 @@ class DepGraphNode { const DependencyKey &getKey() const { return key; } + /// Only used when the driver is reading a SourceFileDepGraphNode. + void setKey(const DependencyKey &key) { + this->key = key; + } + const Optional getFingerprint() const { if (fingerprint) { return StringRef(fingerprint.getValue()); @@ -684,7 +689,7 @@ class SourceFileDepGraphNode : public DepGraphNode { /// True iff a Decl exists for this node. /// If a provides and a depends in the existing system both have the same key, /// only one SourceFileDepGraphNode is emitted. - bool isProvides; + bool isProvides = false; friend ::llvm::yaml::MappingContextTraits; @@ -692,7 +697,7 @@ class SourceFileDepGraphNode : public DepGraphNode { public: /// When the driver imports a node create an uninitialized instance for /// deserializing. - SourceFileDepGraphNode() : DepGraphNode(), sequenceNumber(~0) {} + SourceFileDepGraphNode() : DepGraphNode() {} /// Used by the frontend to build nodes. SourceFileDepGraphNode(DependencyKey key, Optional fingerprint, @@ -736,6 +741,9 @@ class SourceFileDepGraphNode : public DepGraphNode { : "somewhere else"); } + SWIFT_DEBUG_DUMP; + void dump(llvm::raw_ostream &os) const; + bool verify() const { DepGraphNode::verify(); assert(getIsProvides() || isDepends()); @@ -872,7 +880,6 @@ class SourceFileDepGraph { void emitDotFile(StringRef outputPath, DiagnosticEngine &diags); -private: void addNode(SourceFileDepGraphNode *n) { n->setSequenceNumber(allNodes.size()); allNodes.push_back(n); diff --git a/include/swift/AST/FineGrainedDependencyFormat.h b/include/swift/AST/FineGrainedDependencyFormat.h new file mode 100644 index 0000000000000..a4d35695ceebb --- /dev/null +++ b/include/swift/AST/FineGrainedDependencyFormat.h @@ -0,0 +1,133 @@ +//===---- FineGrainedDependencyFormat.h - swiftdeps format ---*- C++ -*-======// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +#ifndef SWIFT_AST_FINEGRAINEDDEPENDENCYFORMAT_H +#define SWIFT_AST_FINEGRAINEDDEPENDENCYFORMAT_H + +#include "llvm/Bitcode/RecordLayout.h" +#include "llvm/Bitstream/BitCodes.h" + +namespace llvm { +class MemoryBuffer; +} + +namespace swift { + +class DiagnosticEngine; + +namespace fine_grained_dependencies { + +class SourceFileDepGraph; + +using llvm::BCFixed; +using llvm::BCVBR; +using llvm::BCBlob; +using llvm::BCRecordLayout; + +/// Every .swiftdeps file begins with these 4 bytes, for easy identification when +/// debugging. +const unsigned char FINE_GRAINED_DEPDENENCY_FORMAT_SIGNATURE[] = {'D', 'E', 'P', 'S'}; + +const unsigned FINE_GRAINED_DEPENDENCY_FORMAT_VERSION_MAJOR = 1; + +/// Increment this on every change. +const unsigned FINE_GRAINED_DEPENDENCY_FORMAT_VERSION_MINOR = 0; + +using IdentifierIDField = BCVBR<13>; + +using NodeKindField = BCFixed<3>; +using DeclAspectField = BCFixed<1>; + +const unsigned RECORD_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID; + +/// The swiftdeps file format consists of a METADATA record, followed by zero or more +/// IDENTIFIER_NODE records. +/// +/// Then, there is one SOURCE_FILE_DEP_GRAPH_NODE for each serialized +/// SourceFileDepGraphNode. These are followed by FINGERPRINT_NODE and +/// DEPENDS_ON_DEFINITION_NODE, if the node has a fingerprint and depends-on +/// definitions, respectively. +namespace record_block { + enum { + METADATA = 1, + SOURCE_FILE_DEP_GRAPH_NODE, + FINGERPRINT_NODE, + DEPENDS_ON_DEFINITION_NODE, + IDENTIFIER_NODE, + }; + + // Always the first record in the file. + using MetadataLayout = BCRecordLayout< + METADATA, // ID + BCFixed<16>, // Dependency graph format major version + BCFixed<16>, // Dependency graph format minor version + BCBlob // Compiler version string + >; + + // After the metadata record, we have zero or more identifier records, + // for each unique string that is referenced from a SourceFileDepGraphNode. + // + // Identifiers are referenced by their sequence number, starting from 1. + // The identifier value 0 is special; it always represents the empty string. + // There is no IDENTIFIER_NODE serialized that corresponds to it, instead + // the first IDENTIFIER_NODE always has a sequence number of 1. + using IdentifierNodeLayout = BCRecordLayout< + IDENTIFIER_NODE, + BCBlob + >; + + using SourceFileDepGraphNodeLayout = BCRecordLayout< + SOURCE_FILE_DEP_GRAPH_NODE, // ID + // The next four fields correspond to the fields of the DependencyKey + // structure. + NodeKindField, // DependencyKey::kind + DeclAspectField, // DependencyKey::aspect + IdentifierIDField, // DependencyKey::context + IdentifierIDField, // DependencyKey::name + BCFixed<1> // Is this a "provides" node? + >; + + // Follows DEPENDS_ON_DEFINITION_NODE when the SourceFileDepGraphNode has a + // fingerprint set. + using FingerprintNodeLayout = BCRecordLayout< + FINGERPRINT_NODE, + BCBlob + >; + + // Follows SOURCE_FILE_DEP_GRAPH_NODE and FINGERPRINT_NODE when the + // SourceFileDepGraphNode has one or more depends-on entries. + using DependsOnDefNodeLayout = BCRecordLayout< + DEPENDS_ON_DEFINITION_NODE, + BCVBR<16> // The sequence number (starting from 0) of the referenced + // SOURCE_FILE_DEP_GRAPH_NODE + >; +} + +/// Tries to read the dependency graph from the given buffer. +/// Returns true if there was an error. +bool readFineGrainedDependencyGraph(llvm::MemoryBuffer &buffer, + SourceFileDepGraph &g); + +/// Tries to read the dependency graph from the given path name. +/// Returns true if there was an error. +bool readFineGrainedDependencyGraph(llvm::StringRef path, + SourceFileDepGraph &g); + +/// Tries to write the dependency graph to the given path name. +/// Returns true if there was an error. +bool writeFineGrainedDependencyGraph(DiagnosticEngine &diags, llvm::StringRef path, + const SourceFileDepGraph &g); + +} // namespace fine_grained_dependencies +} // namespace swift + +#endif diff --git a/include/swift/AST/KnownDecls.def b/include/swift/AST/KnownDecls.def index 32ce519b12c57..15a5081285d1d 100644 --- a/include/swift/AST/KnownDecls.def +++ b/include/swift/AST/KnownDecls.def @@ -44,6 +44,8 @@ FUNC_DECL(AllocateUninitializedArray, "_allocateUninitializedArray") FUNC_DECL(DeallocateUninitializedArray, "_deallocateUninitializedArray") +FUNC_DECL(FinalizeUninitializedArray, + "_finalizeUninitializedArray") FUNC_DECL(ForceBridgeFromObjectiveC, "_forceBridgeFromObjectiveC") diff --git a/include/swift/AST/LazyResolver.h b/include/swift/AST/LazyResolver.h index eb468f7cfe855..ee6e64ff25ac8 100644 --- a/include/swift/AST/LazyResolver.h +++ b/include/swift/AST/LazyResolver.h @@ -18,7 +18,6 @@ #define SWIFT_AST_LAZYRESOLVER_H #include "swift/AST/ProtocolConformanceRef.h" -#include "swift/AST/TypeLoc.h" #include "llvm/ADT/PointerEmbeddedInt.h" namespace swift { diff --git a/include/swift/AST/Module.h b/include/swift/AST/Module.h index cea3d769704b2..3817283cfe3f0 100644 --- a/include/swift/AST/Module.h +++ b/include/swift/AST/Module.h @@ -391,6 +391,11 @@ class ModuleDecl : public DeclContext, public TypeDecl { /// Add a file declaring a cross-import overlay. void addCrossImportOverlayFile(StringRef file); + /// Collect cross-import overlay names from a given YAML file path. + static llvm::SmallSetVector + collectCrossImportOverlay(ASTContext &ctx, StringRef file, + StringRef moduleName, StringRef& bystandingModule); + /// If this method returns \c false, the module does not declare any /// cross-import overlays. /// diff --git a/include/swift/AST/ModuleDependencies.h b/include/swift/AST/ModuleDependencies.h index 196c69c237cad..47ff92fa8f3e4 100644 --- a/include/swift/AST/ModuleDependencies.h +++ b/include/swift/AST/ModuleDependencies.h @@ -29,6 +29,8 @@ namespace swift { class ClangModuleDependenciesCacheImpl; class SourceFile; +class ASTContext; +class Identifier; /// Which kind of module dependencies we are looking for. enum class ModuleDependenciesKind : int8_t { @@ -246,6 +248,11 @@ class ModuleDependencies { /// Add (Clang) module on which the bridging header depends. void addBridgingModuleDependency(StringRef module, llvm::StringSet<> &alreadyAddedModules); + + /// Collect a map from a secondary module name to a list of cross-import + /// overlays, when this current module serves as the primary module. + llvm::StringMap> + collectCrossImportOverlayNames(ASTContext &ctx, StringRef moduleName); }; using ModuleDependencyID = std::pair; diff --git a/include/swift/AST/NameLookupRequests.h b/include/swift/AST/NameLookupRequests.h index e71c789fbfb0a..be6be839b0a81 100644 --- a/include/swift/AST/NameLookupRequests.h +++ b/include/swift/AST/NameLookupRequests.h @@ -447,7 +447,7 @@ class LookupInModuleRequest QualifiedLookupResult( const DeclContext *, DeclName, NLKind, namelookup::ResolutionKind, const DeclContext *), - RequestFlags::Uncached> { + RequestFlags::Uncached | RequestFlags::DependencySink> { public: using SimpleRequest::SimpleRequest; @@ -459,6 +459,11 @@ class LookupInModuleRequest evaluate(Evaluator &evaluator, const DeclContext *moduleOrFile, DeclName name, NLKind lookupKind, namelookup::ResolutionKind resolutionKind, const DeclContext *moduleScopeContext) const; + +public: + // Incremental dependencies + void writeDependencySink(evaluator::DependencyCollector &tracker, + QualifiedLookupResult l) const; }; /// Perform \c AnyObject lookup for a given member. diff --git a/include/swift/AST/ParseRequests.h b/include/swift/AST/ParseRequests.h index bd641893490d4..e804023bcdd6a 100644 --- a/include/swift/AST/ParseRequests.h +++ b/include/swift/AST/ParseRequests.h @@ -19,6 +19,7 @@ #include "swift/AST/ASTTypeIDs.h" #include "swift/AST/EvaluatorDependencies.h" #include "swift/AST/SimpleRequest.h" +#include "swift/Syntax/SyntaxNodes.h" namespace swift { @@ -81,10 +82,17 @@ class ParseAbstractFunctionBodyRequest : void cacheResult(BraceStmt *value) const; }; +struct SourceFileParsingResult { + ArrayRef TopLevelDecls; + Optional> CollectedTokens; + Optional InterfaceHash; + Optional SyntaxRoot; +}; + /// Parse the top-level decls of a SourceFile. class ParseSourceFileRequest : public SimpleRequest< - ParseSourceFileRequest, ArrayRef(SourceFile *), + ParseSourceFileRequest, SourceFileParsingResult(SourceFile *), RequestFlags::SeparatelyCached | RequestFlags::DependencySource> { public: using SimpleRequest::SimpleRequest; @@ -93,13 +101,13 @@ class ParseSourceFileRequest friend SimpleRequest; // Evaluation. - ArrayRef evaluate(Evaluator &evaluator, SourceFile *SF) const; + SourceFileParsingResult evaluate(Evaluator &evaluator, SourceFile *SF) const; public: // Caching. bool isCached() const { return true; } - Optional> getCachedResult() const; - void cacheResult(ArrayRef decls) const; + Optional getCachedResult() const; + void cacheResult(SourceFileParsingResult result) const; public: evaluator::DependencySource diff --git a/include/swift/AST/ParseTypeIDZone.def b/include/swift/AST/ParseTypeIDZone.def index 1c2f07e5162dc..36f95f7117bb7 100644 --- a/include/swift/AST/ParseTypeIDZone.def +++ b/include/swift/AST/ParseTypeIDZone.def @@ -23,5 +23,5 @@ SWIFT_REQUEST(Parse, ParseAbstractFunctionBodyRequest, BraceStmt *(AbstractFunctionDecl *), SeparatelyCached, NoLocationInfo) SWIFT_REQUEST(Parse, ParseSourceFileRequest, - ArrayRef(SourceFile *), SeparatelyCached, + SourceFileParsingResult(SourceFile *), SeparatelyCached, NoLocationInfo) diff --git a/include/swift/AST/Pattern.h b/include/swift/AST/Pattern.h index 7b11705882afb..a5005df8d7ddf 100644 --- a/include/swift/AST/Pattern.h +++ b/include/swift/AST/Pattern.h @@ -24,7 +24,6 @@ #include "swift/Basic/LLVM.h" #include "swift/AST/Type.h" #include "swift/AST/Types.h" -#include "swift/AST/TypeLoc.h" #include "swift/AST/TypeAlignments.h" #include "swift/Basic/InlineBitfield.h" #include "swift/Basic/OptionSet.h" @@ -35,6 +34,7 @@ namespace swift { class Expr; enum class CheckedCastKind : unsigned; class TypeExpr; + class TypeLoc; /// PatternKind - The classification of different kinds of /// value-matching pattern. @@ -470,19 +470,14 @@ class IsPattern : public Pattern { CheckedCastKind CastKind; /// The type being checked for. - TypeLoc CastType; + TypeExpr *CastType; public: - IsPattern(SourceLoc IsLoc, TypeLoc CastTy, - Pattern *SubPattern, - CheckedCastKind Kind) - : Pattern(PatternKind::Is), - IsLoc(IsLoc), - SubPattern(SubPattern), - CastKind(Kind), - CastType(CastTy) { - assert(IsLoc.isValid() == CastTy.hasLocation()); - } + IsPattern(SourceLoc IsLoc, TypeExpr *CastTy, Pattern *SubPattern, + CheckedCastKind Kind); + + static IsPattern *createImplicit(ASTContext &Ctx, Type castTy, + Pattern *SubPattern, CheckedCastKind Kind); CheckedCastKind getCastKind() const { return CastKind; } void setCastKind(CheckedCastKind kind) { CastKind = kind; } @@ -493,16 +488,11 @@ class IsPattern : public Pattern { void setSubPattern(Pattern *p) { SubPattern = p; } SourceLoc getLoc() const { return IsLoc; } - SourceRange getSourceRange() const { - SourceLoc beginLoc = - SubPattern ? SubPattern->getSourceRange().Start : IsLoc; - SourceLoc endLoc = - (isImplicit() ? beginLoc : CastType.getSourceRange().End); - return { beginLoc, endLoc }; - } + SourceRange getSourceRange() const; - TypeLoc &getCastTypeLoc() { return CastType; } - TypeLoc getCastTypeLoc() const { return CastType; } + void setCastType(Type castTy); + Type getCastType() const; + TypeRepr *getCastTypeRepr() const; static bool classof(const Pattern *P) { return P->getKind() == PatternKind::Is; @@ -513,7 +503,7 @@ class IsPattern : public Pattern { /// case, then the value is extracted. If there is a subpattern, it is then /// matched against the associated value for the case. class EnumElementPattern : public Pattern { - TypeLoc ParentType; + TypeExpr *ParentType; SourceLoc DotLoc; DeclNameLoc NameLoc; DeclNameRef Name; @@ -521,27 +511,23 @@ class EnumElementPattern : public Pattern { Pattern /*nullable*/ *SubPattern; public: - EnumElementPattern(TypeLoc ParentType, SourceLoc DotLoc, DeclNameLoc NameLoc, - DeclNameRef Name, EnumElementDecl *Element, - Pattern *SubPattern) - : Pattern(PatternKind::EnumElement), - ParentType(ParentType), DotLoc(DotLoc), NameLoc(NameLoc), Name(Name), - ElementDeclOrUnresolvedOriginalExpr(Element), - SubPattern(SubPattern) { } + EnumElementPattern(TypeExpr *ParentType, SourceLoc DotLoc, + DeclNameLoc NameLoc, DeclNameRef Name, + EnumElementDecl *Element, Pattern *SubPattern) + : Pattern(PatternKind::EnumElement), ParentType(ParentType), + DotLoc(DotLoc), NameLoc(NameLoc), Name(Name), + ElementDeclOrUnresolvedOriginalExpr(Element), SubPattern(SubPattern) { + assert(ParentType && "Missing parent type?"); + } /// Create an unresolved EnumElementPattern for a `.foo` pattern relying on /// contextual type. - EnumElementPattern(SourceLoc DotLoc, - DeclNameLoc NameLoc, - DeclNameRef Name, - Pattern *SubPattern, - Expr *UnresolvedOriginalExpr) - : Pattern(PatternKind::EnumElement), - ParentType(), DotLoc(DotLoc), NameLoc(NameLoc), Name(Name), - ElementDeclOrUnresolvedOriginalExpr(UnresolvedOriginalExpr), - SubPattern(SubPattern) { - - } + EnumElementPattern(SourceLoc DotLoc, DeclNameLoc NameLoc, DeclNameRef Name, + Pattern *SubPattern, Expr *UnresolvedOriginalExpr) + : Pattern(PatternKind::EnumElement), ParentType(nullptr), DotLoc(DotLoc), + NameLoc(NameLoc), Name(Name), + ElementDeclOrUnresolvedOriginalExpr(UnresolvedOriginalExpr), + SubPattern(SubPattern) {} bool hasSubPattern() const { return SubPattern; } @@ -553,10 +539,6 @@ class EnumElementPattern : public Pattern { return SubPattern; } - bool isParentTypeImplicit() { - return !ParentType.hasLocation(); - } - void setSubPattern(Pattern *p) { SubPattern = p; } DeclNameRef getName() const { return Name; } @@ -577,21 +559,14 @@ class EnumElementPattern : public Pattern { DeclNameLoc getNameLoc() const { return NameLoc; } SourceLoc getLoc() const { return NameLoc.getBaseNameLoc(); } - SourceLoc getStartLoc() const { - return ParentType.hasLocation() ? ParentType.getSourceRange().Start : - DotLoc.isValid() ? DotLoc - : NameLoc.getBaseNameLoc(); - } - SourceLoc getEndLoc() const { - if (SubPattern && SubPattern->getSourceRange().isValid()) { - return SubPattern->getSourceRange().End; - } - return NameLoc.getEndLoc(); - } + SourceLoc getStartLoc() const; + SourceLoc getEndLoc() const; SourceRange getSourceRange() const { return {getStartLoc(), getEndLoc()}; } - TypeLoc &getParentType() { return ParentType; } - TypeLoc getParentType() const { return ParentType; } + TypeRepr *getParentTypeRepr() const; + + void setParentType(Type ty); + Type getParentType() const; static bool classof(const Pattern *P) { return P->getKind() == PatternKind::EnumElement; diff --git a/include/swift/AST/PrettyStackTrace.h b/include/swift/AST/PrettyStackTrace.h index ace327d4ead5b..51d047ecbb1b5 100644 --- a/include/swift/AST/PrettyStackTrace.h +++ b/include/swift/AST/PrettyStackTrace.h @@ -38,22 +38,24 @@ namespace swift { class TypeRepr; void printSourceLocDescription(llvm::raw_ostream &out, SourceLoc loc, - ASTContext &Context, bool addNewline = true); + const ASTContext &Context, + bool addNewline = true); /// PrettyStackTraceLocation - Observe that we are doing some /// processing starting at a fixed location. class PrettyStackTraceLocation : public llvm::PrettyStackTraceEntry { - ASTContext &Context; + const ASTContext &Context; SourceLoc Loc; const char *Action; public: - PrettyStackTraceLocation(ASTContext &C, const char *action, SourceLoc loc) + PrettyStackTraceLocation(const ASTContext &C, const char *action, + SourceLoc loc) : Context(C), Loc(loc), Action(action) {} virtual void print(llvm::raw_ostream &OS) const; }; void printDeclDescription(llvm::raw_ostream &out, const Decl *D, - ASTContext &Context, bool addNewline = true); + const ASTContext &Context, bool addNewline = true); /// PrettyStackTraceDecl - Observe that we are processing a specific /// declaration. @@ -78,60 +80,60 @@ class PrettyStackTraceAnyFunctionRef : public llvm::PrettyStackTraceEntry { }; void printExprDescription(llvm::raw_ostream &out, Expr *E, - ASTContext &Context, bool addNewline = true); + const ASTContext &Context, bool addNewline = true); /// PrettyStackTraceExpr - Observe that we are processing a specific /// expression. class PrettyStackTraceExpr : public llvm::PrettyStackTraceEntry { - ASTContext &Context; + const ASTContext &Context; Expr *TheExpr; const char *Action; public: - PrettyStackTraceExpr(ASTContext &C, const char *action, Expr *E) + PrettyStackTraceExpr(const ASTContext &C, const char *action, Expr *E) : Context(C), TheExpr(E), Action(action) {} virtual void print(llvm::raw_ostream &OS) const; }; void printStmtDescription(llvm::raw_ostream &out, Stmt *S, - ASTContext &Context, bool addNewline = true); + const ASTContext &Context, bool addNewline = true); /// PrettyStackTraceStmt - Observe that we are processing a specific /// statement. class PrettyStackTraceStmt : public llvm::PrettyStackTraceEntry { - ASTContext &Context; + const ASTContext &Context; Stmt *TheStmt; const char *Action; public: - PrettyStackTraceStmt(ASTContext &C, const char *action, Stmt *S) + PrettyStackTraceStmt(const ASTContext &C, const char *action, Stmt *S) : Context(C), TheStmt(S), Action(action) {} virtual void print(llvm::raw_ostream &OS) const; }; void printPatternDescription(llvm::raw_ostream &out, Pattern *P, - ASTContext &Context, bool addNewline = true); + const ASTContext &Context, bool addNewline = true); /// PrettyStackTracePattern - Observe that we are processing a /// specific pattern. class PrettyStackTracePattern : public llvm::PrettyStackTraceEntry { - ASTContext &Context; + const ASTContext &Context; Pattern *ThePattern; const char *Action; public: - PrettyStackTracePattern(ASTContext &C, const char *action, Pattern *P) + PrettyStackTracePattern(const ASTContext &C, const char *action, Pattern *P) : Context(C), ThePattern(P), Action(action) {} virtual void print(llvm::raw_ostream &OS) const; }; void printTypeDescription(llvm::raw_ostream &out, Type T, - ASTContext &Context, bool addNewline = true); + const ASTContext &Context, bool addNewline = true); /// PrettyStackTraceType - Observe that we are processing a specific type. class PrettyStackTraceType : public llvm::PrettyStackTraceEntry { - ASTContext &Context; + const ASTContext &Context; Type TheType; const char *Action; public: - PrettyStackTraceType(ASTContext &C, const char *action, Type type) + PrettyStackTraceType(const ASTContext &C, const char *action, Type type) : Context(C), TheType(type), Action(action) {} virtual void print(llvm::raw_ostream &OS) const; }; @@ -149,11 +151,12 @@ class PrettyStackTraceClangType : public llvm::PrettyStackTraceEntry { /// Observe that we are processing a specific type representation. class PrettyStackTraceTypeRepr : public llvm::PrettyStackTraceEntry { - ASTContext &Context; + const ASTContext &Context; TypeRepr *TheType; const char *Action; public: - PrettyStackTraceTypeRepr(ASTContext &C, const char *action, TypeRepr *type) + PrettyStackTraceTypeRepr(const ASTContext &C, const char *action, + TypeRepr *type) : Context(C), TheType(type), Action(action) {} virtual void print(llvm::raw_ostream &OS) const; }; @@ -161,11 +164,11 @@ class PrettyStackTraceTypeRepr : public llvm::PrettyStackTraceEntry { /// PrettyStackTraceConformance - Observe that we are processing a /// specific protocol conformance. class PrettyStackTraceConformance : public llvm::PrettyStackTraceEntry { - ASTContext &Context; + const ASTContext &Context; const ProtocolConformance *Conformance; const char *Action; public: - PrettyStackTraceConformance(ASTContext &C, const char *action, + PrettyStackTraceConformance(const ASTContext &C, const char *action, const ProtocolConformance *conformance) : Context(C), Conformance(conformance), Action(action) {} virtual void print(llvm::raw_ostream &OS) const; @@ -173,7 +176,8 @@ class PrettyStackTraceConformance : public llvm::PrettyStackTraceEntry { void printConformanceDescription(llvm::raw_ostream &out, const ProtocolConformance *conformance, - ASTContext &Context, bool addNewline = true); + const ASTContext &Context, + bool addNewline = true); class PrettyStackTraceGenericSignature : public llvm::PrettyStackTraceEntry { const char *Action; diff --git a/include/swift/AST/PrintOptions.h b/include/swift/AST/PrintOptions.h index 8846c849c8da6..8fdfac5488e61 100644 --- a/include/swift/AST/PrintOptions.h +++ b/include/swift/AST/PrintOptions.h @@ -450,6 +450,9 @@ struct PrintOptions { /// Whether to print parameter specifiers as 'let' and 'var'. bool PrintParameterSpecifiers = false; + /// Whether to print inheritance lists for types. + bool PrintInherited = true; + /// \see ShouldQualifyNestedDeclarations enum class QualifyNestedDeclarations { Never, diff --git a/include/swift/AST/SemanticAttrs.def b/include/swift/AST/SemanticAttrs.def index 944d56b9348d6..a77a6b295ad24 100644 --- a/include/swift/AST/SemanticAttrs.def +++ b/include/swift/AST/SemanticAttrs.def @@ -60,6 +60,7 @@ SEMANTICS_ATTR(ARRAY_WITH_UNSAFE_MUTABLE_BUFFER_POINTER, "array.withUnsafeMutabl SEMANTICS_ATTR(ARRAY_COUNT, "array.count") SEMANTICS_ATTR(ARRAY_DEALLOC_UNINITIALIZED, "array.dealloc_uninitialized") SEMANTICS_ATTR(ARRAY_UNINITIALIZED_INTRINSIC, "array.uninitialized_intrinsic") +SEMANTICS_ATTR(ARRAY_FINALIZE_INTRINSIC, "array.finalize_intrinsic") SEMANTICS_ATTR(SEQUENCE_FOR_EACH, "sequence.forEach") diff --git a/include/swift/AST/SemanticAttrs.h b/include/swift/AST/SemanticAttrs.h index b6b9926ca8165..7fe7c38644dee 100644 --- a/include/swift/AST/SemanticAttrs.h +++ b/include/swift/AST/SemanticAttrs.h @@ -19,6 +19,7 @@ #ifndef SWIFT_SEMANTICS_H #define SWIFT_SEMANTICS_H +#include "swift/Basic/LLVM.h" #include "llvm/ADT/StringRef.h" namespace swift { diff --git a/include/swift/AST/SourceFile.h b/include/swift/AST/SourceFile.h index 0b0a17f56bd58..ca305f8675db8 100644 --- a/include/swift/AST/SourceFile.h +++ b/include/swift/AST/SourceFile.h @@ -32,8 +32,6 @@ class SourceFile final : public FileUnit { friend class ParseSourceFileRequest; public: - struct SourceFileSyntaxInfo; - /// Possible attributes for imports in source files. enum class ImportFlags { /// The imported module is exposed to anyone who imports the parent module. @@ -107,15 +105,27 @@ class SourceFile final : public FileUnit { /// decl. /// /// FIXME: When condition evaluation moves to a later phase, remove this - /// and adjust the client call 'performParseOnly'. + /// and the associated language option. DisablePoundIfEvaluation = 1 << 1, + /// Whether to build a syntax tree. + BuildSyntaxTree = 1 << 2, + + /// Whether to save the file's parsed tokens. + CollectParsedTokens = 1 << 3, + + /// Whether to compute the interface hash of the file. + EnableInterfaceHash = 1 << 4, + /// Whether to suppress warnings when parsing. This is set for secondary /// files, as they get parsed multiple times. - SuppressWarnings = 1 << 2 + SuppressWarnings = 1 << 5, }; using ParsingOptions = OptionSet; + /// Retrieve the parsing options specified in the LangOptions. + static ParsingOptions getDefaultParsingOptions(const LangOptions &langOpts); + private: std::unique_ptr Cache; SourceLookupCache &getCache() const; @@ -313,7 +323,6 @@ class SourceFile final : public FileUnit { llvm::StringMap getInfoForUsedFilePaths() const; SourceFile(ModuleDecl &M, SourceFileKind K, Optional bufferID, - bool KeepParsedTokens = false, bool KeepSyntaxTree = false, ParsingOptions parsingOpts = {}, bool isPrimary = false); ~SourceFile(); @@ -481,7 +490,7 @@ class SourceFile final : public FileUnit { } SWIFT_DEBUG_DUMP; - void dump(raw_ostream &os) const; + void dump(raw_ostream &os, bool parseIfNeeded = false) const; /// Pretty-print the contents of this source file. /// @@ -544,26 +553,13 @@ class SourceFile final : public FileUnit { /// Set the root refinement context for the file. void setTypeRefinementContext(TypeRefinementContext *TRC); - void enableInterfaceHash() { - assert(!hasInterfaceHash()); - InterfaceHash.emplace(); - } - + /// Whether this file has an interface hash available. bool hasInterfaceHash() const { - return InterfaceHash.hasValue(); + return ParsingOpts.contains(ParsingFlags::EnableInterfaceHash); } - NullablePtr getInterfaceHashPtr() { - return InterfaceHash ? InterfaceHash.getPointer() : nullptr; - } - - void getInterfaceHash(llvm::SmallString<32> &str) const { - // Copy to preserve idempotence. - llvm::MD5 md5 = *InterfaceHash; - llvm::MD5::MD5Result result; - md5.final(result); - llvm::MD5::stringifyResult(result, str); - } + /// Output this file's interface hash into the provided string buffer. + void getInterfaceHash(llvm::SmallString<32> &str) const; void dumpInterfaceHash(llvm::raw_ostream &out) { llvm::SmallString<32> str; @@ -571,23 +567,21 @@ class SourceFile final : public FileUnit { out << str << '\n'; } - std::vector &getTokenVector(); - + /// If this source file has been told to collect its parsed tokens, retrieve + /// those tokens. ArrayRef getAllTokens() const; - bool shouldCollectToken() const; + /// Whether the parsed tokens of this source file should be saved, allowing + /// them to be accessed from \c getAllTokens. + bool shouldCollectTokens() const; bool shouldBuildSyntaxTree() const; - bool canBeParsedInFull() const; - /// Whether the bodies of types and functions within this file can be lazily /// parsed. bool hasDelayedBodyParsing() const; syntax::SourceFileSyntax getSyntaxRoot() const; - void setSyntaxRoot(syntax::SourceFileSyntax &&Root); - bool hasSyntaxRoot() const; OpaqueTypeDecl *lookupOpaqueResultType(StringRef MangledName) override; @@ -602,10 +596,12 @@ class SourceFile final : public FileUnit { private: - /// If not None, the underlying vector should contain tokens of this source file. - Optional> AllCorrectedTokens; + /// If not \c None, the underlying vector contains the parsed tokens of this + /// source file. + Optional> AllCollectedTokens; - std::unique_ptr SyntaxInfo; + /// The root of the syntax tree representing the source file. + std::unique_ptr SyntaxRoot; }; inline SourceFile::ParsingOptions operator|(SourceFile::ParsingFlags lhs, diff --git a/include/swift/AST/TypeAlignments.h b/include/swift/AST/TypeAlignments.h index b1b5a1bb596dc..2482500387532 100644 --- a/include/swift/AST/TypeAlignments.h +++ b/include/swift/AST/TypeAlignments.h @@ -51,7 +51,7 @@ namespace swift { class TypeVariableType; class TypeBase; class TypeDecl; - class TypeLoc; + class TypeRepr; class ValueDecl; /// We frequently use three tag bits on all of these types. @@ -64,7 +64,7 @@ namespace swift { constexpr size_t PatternAlignInBits = 3; constexpr size_t SILFunctionAlignInBits = 2; constexpr size_t TypeVariableAlignInBits = 4; - constexpr size_t TypeLocAlignInBits = 3; + constexpr size_t TypeReprAlignInBits = 3; } namespace llvm { @@ -126,7 +126,7 @@ LLVM_DECLARE_TYPE_ALIGNMENT(swift::SILFunction, LLVM_DECLARE_TYPE_ALIGNMENT(swift::AttributeBase, swift::AttrAlignInBits) -LLVM_DECLARE_TYPE_ALIGNMENT(swift::TypeLoc, swift::TypeLocAlignInBits) +LLVM_DECLARE_TYPE_ALIGNMENT(swift::TypeRepr, swift::TypeReprAlignInBits) static_assert(alignof(void*) >= 2, "pointer alignment is too small"); diff --git a/include/swift/AST/TypeCheckRequests.h b/include/swift/AST/TypeCheckRequests.h index cedeea5866a0c..75392765ce473 100644 --- a/include/swift/AST/TypeCheckRequests.h +++ b/include/swift/AST/TypeCheckRequests.h @@ -2513,6 +2513,41 @@ class CodeCompletionFileRequest bool isCached() const { return true; } }; +/// Kinds of types for CustomAttr. +enum class CustomAttrTypeKind { + /// The type is required to not be expressed in terms of + /// any contextual type parameters. + NonGeneric, + + /// Property delegates have some funky rules, like allowing + /// unbound generic types. + PropertyDelegate, +}; + +void simple_display(llvm::raw_ostream &out, CustomAttrTypeKind value); + +class CustomAttrTypeRequest + : public SimpleRequest { +public: + using SimpleRequest::SimpleRequest; + +private: + friend SimpleRequest; + + // Evaluation. + Type evaluate(Evaluator &evaluator, CustomAttr *, DeclContext *, + CustomAttrTypeKind) const; + +public: + // Separate caching. + bool isCached() const { return true; } + Optional getCachedResult() const; + void cacheResult(Type value) const; +}; + // Allow AnyValue to compare two Type values, even though Type doesn't // support ==. template<> diff --git a/include/swift/AST/TypeCheckerTypeIDZone.def b/include/swift/AST/TypeCheckerTypeIDZone.def index f1b71d2d25a83..4df761af7c2d2 100644 --- a/include/swift/AST/TypeCheckerTypeIDZone.def +++ b/include/swift/AST/TypeCheckerTypeIDZone.def @@ -41,6 +41,9 @@ SWIFT_REQUEST(TypeChecker, CodeCompletionFileRequest, SWIFT_REQUEST(TypeChecker, CompareDeclSpecializationRequest, bool (DeclContext *, ValueDecl *, ValueDecl *, bool), Cached, NoLocationInfo) +SWIFT_REQUEST(TypeChecker, CustomAttrTypeRequest, + Type(CustomAttr *, DeclContext *, CustomAttrTypeKind), + SeparatelyCached, NoLocationInfo) SWIFT_REQUEST(TypeChecker, DefaultArgumentExprRequest, Expr *(ParamDecl *), SeparatelyCached, NoLocationInfo) SWIFT_REQUEST(TypeChecker, DefaultArgumentInitContextRequest, diff --git a/include/swift/AST/TypeLoc.h b/include/swift/AST/TypeLoc.h index 9eefeed82e529..2f8007dda9900 100644 --- a/include/swift/AST/TypeLoc.h +++ b/include/swift/AST/TypeLoc.h @@ -29,7 +29,7 @@ class TypeRepr; /// TypeLoc - Provides source location information for a parsed type. /// A TypeLoc is stored in AST nodes which use an explicitly written type. -class alignas(1 << TypeLocAlignInBits) TypeLoc { +class alignas(1 << TypeReprAlignInBits) TypeLoc final { Type Ty; TypeRepr *TyR = nullptr; diff --git a/include/swift/AST/TypeRepr.h b/include/swift/AST/TypeRepr.h index 57cb8c6b73011..3e618c88802b2 100644 --- a/include/swift/AST/TypeRepr.h +++ b/include/swift/AST/TypeRepr.h @@ -48,7 +48,7 @@ enum : unsigned { NumTypeReprKindBits = countBitsUsed(static_cast(TypeReprKind::Last_TypeRepr)) }; /// Representation of a type as written in source. -class alignas(8) TypeRepr { +class alignas(1 << TypeReprAlignInBits) TypeRepr { TypeRepr(const TypeRepr&) = delete; void operator=(const TypeRepr&) = delete; diff --git a/include/swift/AST/Types.h b/include/swift/AST/Types.h index 6e8c2cd1b0330..abe0baf5a6a08 100644 --- a/include/swift/AST/Types.h +++ b/include/swift/AST/Types.h @@ -3942,13 +3942,34 @@ inline bool isIndirectFormalResult(ResultConvention convention) { return convention == ResultConvention::Indirect; } +/// The differentiability of a SIL function type result. +enum class SILResultDifferentiability : unsigned { + /// Either differentiable or not applicable. + /// + /// - If the function type is not `@differentiable`, result + /// differentiability is not applicable. This case is the default value. + /// - If the function type is `@differentiable`, the function is + /// differentiable with respect to this result. + DifferentiableOrNotApplicable, + + /// Not differentiable: a `@noDerivative` result. + /// + /// May be applied only to result of `@differentiable` function types. + /// The function type is not differentiable with respect to this result. + NotDifferentiable, +}; + /// A result type and the rules for returning it. class SILResultInfo { llvm::PointerIntPair TypeAndConvention; + SILResultDifferentiability Differentiability : 1; + public: SILResultInfo() = default; - SILResultInfo(CanType type, ResultConvention conv) - : TypeAndConvention(type, conv) { + SILResultInfo(CanType type, ResultConvention conv, + SILResultDifferentiability differentiability = + SILResultDifferentiability::DifferentiableOrNotApplicable) + : TypeAndConvention(type, conv), Differentiability(differentiability) { assert(type->isLegalSILType() && "SILResultInfo has illegal SIL type"); } @@ -3969,6 +3990,17 @@ class SILResultInfo { ResultConvention getConvention() const { return TypeAndConvention.getInt(); } + + SILResultDifferentiability getDifferentiability() const { + return Differentiability; + } + + SILResultInfo + getWithDifferentiability(SILResultDifferentiability differentiability) const { + return SILResultInfo(getInterfaceType(), getConvention(), + differentiability); + } + /// The SIL storage type determines the ABI for arguments based purely on the /// formal result conventions. The actual SIL type for the result values may /// differ in canonical SIL. In particular, opaque values require indirect @@ -4025,6 +4057,7 @@ class SILResultInfo { void profile(llvm::FoldingSetNodeID &id) { id.AddPointer(TypeAndConvention.getOpaqueValue()); + id.AddInteger((unsigned)getDifferentiability()); } SWIFT_DEBUG_DUMP; @@ -4714,24 +4747,31 @@ class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode, /// `@noDerivative` ones). IndexSubset *getDifferentiabilityParameterIndices(); + /// Given that `this` is a `@differentiable` or `@differentiable(linear)` + /// function type, returns an `IndexSubset` corresponding to the + /// differentiability/linearity results (e.g. all results except the + /// `@noDerivative` ones). + IndexSubset *getDifferentiabilityResultIndices(); + /// Returns the `@differentiable` or `@differentiable(linear)` function type - /// for the given differentiability kind and parameter indices representing - /// differentiability/linearity parameters. + /// for the given differentiability kind and differentiability/linearity + /// parameter/result indices. CanSILFunctionType getWithDifferentiability(DifferentiabilityKind kind, - IndexSubset *parameterIndices); + IndexSubset *parameterIndices, + IndexSubset *resultIndices); /// Returns the SIL function type stripping differentiability kind and /// differentiability from all parameters. CanSILFunctionType getWithoutDifferentiability(); /// Returns the type of the derivative function for the given parameter - /// indices, result index, derivative function kind, derivative function + /// indices, result indices, derivative function kind, derivative function /// generic signature (optional), and other auxiliary parameters. /// /// Preconditions: /// - Parameters corresponding to parameter indices must conform to /// `Differentiable`. - /// - The result corresponding to the result index must conform to + /// - Results corresponding to result indices must conform to /// `Differentiable`. /// /// Typing rules, given: @@ -4803,14 +4843,8 @@ class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode, /// function - this is more direct. It may be possible to implement /// reabstraction thunk derivatives using "reabstraction thunks for /// the original function's derivative", avoiding extra code generation. - /// - /// Caveats: - /// - We may support multiple result indices instead of a single result index - /// eventually. At the SIL level, this enables differentiating wrt multiple - /// function results. At the Swift level, this enables differentiating wrt - /// multiple tuple elements for tuple-returning functions. CanSILFunctionType getAutoDiffDerivativeFunctionType( - IndexSubset *parameterIndices, unsigned resultIndex, + IndexSubset *parameterIndices, IndexSubset *resultIndices, AutoDiffDerivativeFunctionKind kind, Lowering::TypeConverter &TC, LookupConformanceFn lookupConformance, CanGenericSignature derivativeFunctionGenericSignature = nullptr, diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h index 9e4a053e972d4..9456b729871b3 100644 --- a/include/swift/Basic/LangOptions.h +++ b/include/swift/Basic/LangOptions.h @@ -335,6 +335,10 @@ namespace swift { /// Whether to verify the parsed syntax tree and emit related diagnostics. bool VerifySyntaxTree = false; + /// Whether to disable the evaluation of '#if' decls, such that the bodies + /// of active clauses aren't hoisted into the enclosing scope. + bool DisablePoundIfEvaluation = false; + /// Instead of hashing tokens inside of NominalType and ExtensionBodies into /// the interface hash, hash them into per-iterable-decl-context /// fingerprints. Fine-grained dependency types won't dirty every provides @@ -363,7 +367,7 @@ namespace swift { /// Whether to enable a more aggressive mode of incremental dependency /// gathering that never captures cascading edges. - bool EnableExperientalPrivateIntransitiveDependencies = false; + bool DirectIntramoduleDependencies = true; /// Enable verification when every SubstitutionMap is constructed. bool VerifyAllSubstitutionMaps = false; @@ -549,7 +553,10 @@ namespace swift { /// Enable constraint solver support for experimental /// operator protocol designator feature. bool SolverEnableOperatorDesignatedTypes = false; - + + /// Enable experimental support for one-way constraints for the + /// parameters of closures. + bool EnableOneWayClosureParameters = false; }; } // end namespace swift diff --git a/include/swift/Basic/Statistics.def b/include/swift/Basic/Statistics.def index 6cc99e356934c..419567fc8bba5 100644 --- a/include/swift/Basic/Statistics.def +++ b/include/swift/Basic/Statistics.def @@ -247,9 +247,6 @@ FRONTEND_STATISTIC(Sema, NamedLazyMemberLoadSuccessCount) /// Number of types deserialized. FRONTEND_STATISTIC(Sema, NumTypesDeserialized) -/// Number of types validated. -FRONTEND_STATISTIC(Sema, NumTypesValidated) - /// Number of lazy iterable declaration contexts left unloaded. FRONTEND_STATISTIC(Sema, NumUnloadedLazyIterableDeclContexts) diff --git a/include/swift/Demangling/TypeDecoder.h b/include/swift/Demangling/TypeDecoder.h index 017fd096e0f74..fb87307e97b34 100644 --- a/include/swift/Demangling/TypeDecoder.h +++ b/include/swift/Demangling/TypeDecoder.h @@ -94,22 +94,13 @@ enum class ImplParameterDifferentiability { NotDifferentiable }; -static inline llvm::Optional -getDifferentiabilityFromString(StringRef string) { - if (string.empty()) - return ImplParameterDifferentiability::DifferentiableOrNotApplicable; - if (string == "@noDerivative") - return ImplParameterDifferentiability::NotDifferentiable; - return None; -} - /// Describe a lowered function parameter, parameterized on the type /// representation. template class ImplFunctionParam { + BuiltType Type; ImplParameterConvention Convention; ImplParameterDifferentiability Differentiability; - BuiltType Type; public: using ConventionType = ImplParameterConvention; @@ -137,9 +128,18 @@ class ImplFunctionParam { return None; } - ImplFunctionParam(ImplParameterConvention convention, - ImplParameterDifferentiability diffKind, BuiltType type) - : Convention(convention), Differentiability(diffKind), Type(type) {} + static llvm::Optional + getDifferentiabilityFromString(StringRef string) { + if (string.empty()) + return DifferentiabilityType::DifferentiableOrNotApplicable; + if (string == "@noDerivative") + return DifferentiabilityType::NotDifferentiable; + return None; + } + + ImplFunctionParam(BuiltType type, ImplParameterConvention convention, + ImplParameterDifferentiability diffKind) + : Type(type), Convention(convention), Differentiability(diffKind) {} ImplParameterConvention getConvention() const { return Convention; } @@ -158,15 +158,22 @@ enum class ImplResultConvention { Autoreleased, }; +enum class ImplResultDifferentiability { + DifferentiableOrNotApplicable, + NotDifferentiable +}; + /// Describe a lowered function result, parameterized on the type /// representation. template class ImplFunctionResult { - ImplResultConvention Convention; BuiltType Type; + ImplResultConvention Convention; + ImplResultDifferentiability Differentiability; public: using ConventionType = ImplResultConvention; + using DifferentiabilityType = ImplResultDifferentiability; static llvm::Optional getConventionFromString(StringRef conventionString) { @@ -184,11 +191,27 @@ class ImplFunctionResult { return None; } - ImplFunctionResult(ImplResultConvention convention, BuiltType type) - : Convention(convention), Type(type) {} + static llvm::Optional + getDifferentiabilityFromString(StringRef string) { + if (string.empty()) + return DifferentiabilityType::DifferentiableOrNotApplicable; + if (string == "@noDerivative") + return DifferentiabilityType::NotDifferentiable; + return None; + } + + ImplFunctionResult( + BuiltType type, ImplResultConvention convention, + ImplResultDifferentiability diffKind = + ImplResultDifferentiability::DifferentiableOrNotApplicable) + : Type(type), Convention(convention), Differentiability(diffKind) {} ImplResultConvention getConvention() const { return Convention; } + ImplResultDifferentiability getDifferentiability() const { + return Differentiability; + } + BuiltType getType() const { return Type; } }; @@ -640,7 +663,7 @@ class TypeDecoder { if (decodeImplFunctionParam(child, parameters)) return BuiltType(); } else if (child->getKind() == NodeKind::ImplResult) { - if (decodeImplFunctionPart(child, results)) + if (decodeImplFunctionParam(child, results)) return BuiltType(); } else if (child->getKind() == NodeKind::ImplErrorResult) { if (decodeImplFunctionPart(child, errorResults)) @@ -913,13 +936,13 @@ class TypeDecoder { if (!type) return true; - results.emplace_back(*convention, type); + results.emplace_back(type, *convention); return false; } - bool decodeImplFunctionParam( - Demangle::NodePointer node, - llvm::SmallVectorImpl> &results) { + template + bool decodeImplFunctionParam(Demangle::NodePointer node, + llvm::SmallVectorImpl &results) { // Children: `convention, differentiability?, type` if (node->getNumChildren() != 2 && node->getNumChildren() != 3) return true; @@ -931,28 +954,26 @@ class TypeDecoder { return true; StringRef conventionString = conventionNode->getText(); - auto convention = - ImplFunctionParam::getConventionFromString(conventionString); + auto convention = T::getConventionFromString(conventionString); if (!convention) return true; BuiltType type = decodeMangledType(typeNode); if (!type) return true; - auto diffKind = - ImplParameterDifferentiability::DifferentiableOrNotApplicable; + auto diffKind = T::DifferentiabilityType::DifferentiableOrNotApplicable; if (node->getNumChildren() == 3) { auto diffKindNode = node->getChild(1); if (diffKindNode->getKind() != Node::Kind::ImplDifferentiability) return true; auto optDiffKind = - getDifferentiabilityFromString(diffKindNode->getText()); + T::getDifferentiabilityFromString(diffKindNode->getText()); if (!optDiffKind) return true; diffKind = *optDiffKind; } - results.emplace_back(*convention, diffKind, type); + results.emplace_back(type, *convention, diffKind); return false; } diff --git a/include/swift/Driver/FrontendUtil.h b/include/swift/Driver/FrontendUtil.h index 78e307cd47000..cfa46e017a67b 100644 --- a/include/swift/Driver/FrontendUtil.h +++ b/include/swift/Driver/FrontendUtil.h @@ -33,6 +33,9 @@ namespace driver { /// \param Action Called with the list of frontend arguments if there were no /// errors in processing \p ArgList. This is a callback rather than a return /// value to avoid copying the arguments more than necessary. +/// \param ForceNoOutputs If true, override the output mode to "-typecheck" and +/// produce no outputs. For example, this disables "-emit-module" and "-c" and +/// prevents the creation of temporary files. /// /// \returns True on error, or if \p Action returns true. /// @@ -40,7 +43,8 @@ namespace driver { /// suitable for use in REPL or immediate modes. bool getSingleFrontendInvocationFromDriverArguments( ArrayRef ArgList, DiagnosticEngine &Diags, - llvm::function_ref FrontendArgs)> Action); + llvm::function_ref FrontendArgs)> Action, + bool ForceNoOutputs = false); } // end namespace driver } // end namespace swift diff --git a/include/swift/Frontend/Frontend.h b/include/swift/Frontend/Frontend.h index c955bb3061eaf..f8cad378fc6ae 100644 --- a/include/swift/Frontend/Frontend.h +++ b/include/swift/Frontend/Frontend.h @@ -441,8 +441,9 @@ class CompilerInstance { std::vector InputSourceCodeBufferIDs; /// Contains \c MemoryBuffers for partial serialized module files and - /// corresponding partial serialized module documentation files. - std::vector PartialModules; + /// corresponding partial serialized module documentation files. This is + /// \c mutable as it is consumed by \c loadPartialModulesAndImplicitImports. + mutable std::vector PartialModules; enum : unsigned { NO_SUCH_BUFFER = ~0U }; unsigned MainBufferID = NO_SUCH_BUFFER; @@ -460,7 +461,7 @@ class CompilerInstance { /// If \p BufID is already in the set, do nothing. void recordPrimaryInputBuffer(unsigned BufID); - bool isWholeModuleCompilation() { return PrimaryBufferIDs.empty(); } + bool isWholeModuleCompilation() const { return PrimaryBufferIDs.empty(); } public: // Out of line to avoid having to import SILModule.h. @@ -615,10 +616,6 @@ class CompilerInstance { /// Parses and type-checks all input files. void performSema(); - /// Parses the input file but does no type-checking or module imports. - void performParseOnly(bool EvaluateConditionals = false, - bool CanDelayBodies = true); - /// Parses and performs import resolution on all input files. /// /// This is similar to a parse-only invocation, but module imports will also @@ -631,10 +628,15 @@ class CompilerInstance { bool performSILProcessing(SILModule *silModule); private: - SourceFile * - createSourceFileForMainModule(SourceFileKind FileKind, - Optional BufferID, - SourceFile::ParsingOptions options = {}); + /// Creates a new source file for the main module. + SourceFile *createSourceFileForMainModule(ModuleDecl *mod, + SourceFileKind FileKind, + Optional BufferID) const; + + /// Creates all the files to be added to the main module, appending them to + /// \p files. If a loading error occurs, returns \c true. + bool createFilesForMainModule(ModuleDecl *mod, + SmallVectorImpl &files) const; public: void freeASTContext(); @@ -644,14 +646,17 @@ class CompilerInstance { bool loadStdlibIfNeeded(); private: + /// Compute the parsing options for a source file in the main module. + SourceFile::ParsingOptions getSourceFileParsingOptions(bool forPrimary) const; + /// Retrieve a description of which modules should be implicitly imported. ImplicitImportInfo getImplicitImportInfo() const; - void performSemaUpTo(SourceFile::ASTStage_t LimitStage, - SourceFile::ParsingOptions POpts = {}); - - /// Return true if had load error - bool loadPartialModulesAndImplicitImports(); + /// For any serialized AST inputs, loads them in as partial module files, + /// appending them to \p partialModules. If a loading error occurs, returns + /// \c true. + bool loadPartialModulesAndImplicitImports( + ModuleDecl *mod, SmallVectorImpl &partialModules) const; void forEachFileToTypeCheck(llvm::function_ref fn); diff --git a/include/swift/IDE/CommentConversion.h b/include/swift/IDE/CommentConversion.h index d2703a03097fb..50c9ce71a68ad 100644 --- a/include/swift/IDE/CommentConversion.h +++ b/include/swift/IDE/CommentConversion.h @@ -14,6 +14,7 @@ #define SWIFT_IDE_COMMENT_CONVERSION_H #include "swift/Basic/LLVM.h" +#include "swift/AST/TypeOrExtensionDecl.h" #include #include @@ -27,7 +28,9 @@ namespace ide { /// in Clang-like XML format. /// /// \returns true if the declaration has a documentation comment. -bool getDocumentationCommentAsXML(const Decl *D, raw_ostream &OS); +bool getDocumentationCommentAsXML( + const Decl *D, raw_ostream &OS, + TypeOrExtensionDecl SynthesizedTarget = TypeOrExtensionDecl()); /// If the declaration has a documentation comment and a localization key, /// print it into the given output stream and return true. Else, return false. diff --git a/include/swift/Option/FrontendOptions.td b/include/swift/Option/FrontendOptions.td index 9ba2fc6ed4fe8..42b4e5db2974c 100644 --- a/include/swift/Option/FrontendOptions.td +++ b/include/swift/Option/FrontendOptions.td @@ -642,6 +642,10 @@ def experimental_print_full_convention : HelpText<"When emitting a module interface, emit additional @convention " "arguments, regardless of whether they were written in the source">; +def experimental_one_way_closure_params : + Flag<["-"], "experimental-one-way-closure-params">, + HelpText<"Enable experimental support for one-way closure parameters">; + def prebuilt_module_cache_path : Separate<["-"], "prebuilt-module-cache-path">, HelpText<"Directory of prebuilt modules for loading module interfaces">; diff --git a/include/swift/Option/Options.h b/include/swift/Option/Options.h index 2ecc402f77659..9307d74ab0f56 100644 --- a/include/swift/Option/Options.h +++ b/include/swift/Option/Options.h @@ -36,6 +36,7 @@ namespace options { SwiftIndentOption = (1 << 11), ArgumentIsPath = (1 << 12), ModuleInterfaceOption = (1 << 13), + SupplementaryOutput = (1 << 14), }; enum ID { diff --git a/include/swift/Option/Options.td b/include/swift/Option/Options.td index b771b48b3895d..edaf19bdc3559 100644 --- a/include/swift/Option/Options.td +++ b/include/swift/Option/Options.td @@ -51,6 +51,10 @@ def ArgumentIsPath : OptionFlag; // and read/parsed from there when reconstituting a .swiftmodule from it. def ModuleInterfaceOption : OptionFlag; +// The option causes the output of a supplementary output, or is the path option +// for a supplementary output. E.g., `-emit-module` and `-emit-module-path`. +def SupplementaryOutput : OptionFlag; + ///////// // Options @@ -314,21 +318,24 @@ def profile_stats_entities: Flag<["-"], "profile-stats-entities">, HelpText<"Profile changes to stats in -stats-output-dir, subdivided by source entity">; def emit_dependencies : Flag<["-"], "emit-dependencies">, - Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>, + Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild, + SupplementaryOutput]>, HelpText<"Emit basic Make-compatible dependencies files">; def track_system_dependencies : Flag<["-"], "track-system-dependencies">, Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>, HelpText<"Track system dependencies while emitting Make-style dependencies">; def emit_loaded_module_trace : Flag<["-"], "emit-loaded-module-trace">, - Flags<[FrontendOption, NoInteractiveOption]>, + Flags<[FrontendOption, NoInteractiveOption, SupplementaryOutput]>, HelpText<"Emit a JSON file containing information about what modules were loaded">; def emit_loaded_module_trace_path : Separate<["-"], "emit-loaded-module-trace-path">, - Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath]>, + Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath, + SupplementaryOutput]>, HelpText<"Emit the loaded module trace JSON to ">, MetaVarName<"">; def emit_loaded_module_trace_path_EQ : Joined<["-"], "emit-loaded-module-trace-path=">, - Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath]>, + Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath, + SupplementaryOutput]>, Alias; def emit_cross_import_remarks : Flag<["-"], "Rcross-import">, Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>, @@ -336,27 +343,32 @@ def emit_cross_import_remarks : Flag<["-"], "Rcross-import">, def emit_tbd : Flag<["-"], "emit-tbd">, HelpText<"Emit a TBD file">, - Flags<[FrontendOption, NoInteractiveOption]>; + Flags<[FrontendOption, NoInteractiveOption, SupplementaryOutput]>; def emit_tbd_path : Separate<["-"], "emit-tbd-path">, - Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath]>, + Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath, + SupplementaryOutput]>, HelpText<"Emit the TBD file to ">, MetaVarName<"">; def emit_tbd_path_EQ : Joined<["-"], "emit-tbd-path=">, - Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath]>, + Flags<[FrontendOption, NoInteractiveOption, ArgumentIsPath, + SupplementaryOutput]>, Alias; def embed_tbd_for_module : Separate<["-"], "embed-tbd-for-module">, Flags<[FrontendOption]>, HelpText<"Embed symbols from the module in the emitted tbd file">; def serialize_diagnostics : Flag<["-"], "serialize-diagnostics">, - Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>, + Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild, + SupplementaryOutput]>, HelpText<"Serialize diagnostics in a binary format">; def serialize_diagnostics_path : Separate<["-"], "serialize-diagnostics-path">, - Flags<[FrontendOption, NoBatchOption, DoesNotAffectIncrementalBuild, ArgumentIsPath]>, + Flags<[FrontendOption, NoBatchOption, DoesNotAffectIncrementalBuild, + ArgumentIsPath, SupplementaryOutput]>, HelpText<"Emit a serialized diagnostics file to ">, MetaVarName<"">; def serialize_diagnostics_path_EQ: Joined<["-"], "serialize-diagnostics-path=">, - Flags<[FrontendOption, NoBatchOption, DoesNotAffectIncrementalBuild, ArgumentIsPath]>, + Flags<[FrontendOption, NoBatchOption, DoesNotAffectIncrementalBuild, + ArgumentIsPath, SupplementaryOutput]>, Alias; def color_diagnostics : Flag<["-"], "color-diagnostics">, Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>, @@ -410,32 +422,34 @@ def autolink_force_load : Flag<["-"], "autolink-force-load">, HelpText<"Force ld to link against this module even if no symbols are used">; def emit_module : Flag<["-"], "emit-module">, - Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>, + Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild, + SupplementaryOutput]>, HelpText<"Emit an importable module">; def emit_module_path : Separate<["-"], "emit-module-path">, Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild, - ArgumentIsPath]>, + ArgumentIsPath, SupplementaryOutput]>, HelpText<"Emit an importable module to ">, MetaVarName<"">; def emit_module_path_EQ : Joined<["-"], "emit-module-path=">, Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild, - ArgumentIsPath]>, + ArgumentIsPath, SupplementaryOutput]>, Alias; def emit_module_interface : Flag<["-"], "emit-module-interface">, - Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild]>, + Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild, + SupplementaryOutput]>, HelpText<"Output module interface file">; def emit_module_interface_path : Separate<["-"], "emit-module-interface-path">, Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild, - ArgumentIsPath]>, + ArgumentIsPath, SupplementaryOutput]>, MetaVarName<"">, HelpText<"Output module interface file to ">; def emit_private_module_interface_path : Separate<["-"], "emit-private-module-interface-path">, Flags<[FrontendOption, NoInteractiveOption, HelpHidden, - DoesNotAffectIncrementalBuild, ArgumentIsPath]>, + DoesNotAffectIncrementalBuild, ArgumentIsPath, SupplementaryOutput]>, MetaVarName<"">, HelpText<"Output private module interface file to ">; def avoid_emit_module_source_info : @@ -446,25 +460,27 @@ def avoid_emit_module_source_info : def emit_module_source_info_path : Separate<["-"], "emit-module-source-info-path">, Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild, - ArgumentIsPath]>, + ArgumentIsPath, SupplementaryOutput]>, MetaVarName<"">, HelpText<"Output module source info file to ">; def emit_parseable_module_interface : Flag<["-"], "emit-parseable-module-interface">, Alias, - Flags<[NoInteractiveOption, HelpHidden, DoesNotAffectIncrementalBuild]>; + Flags<[NoInteractiveOption, HelpHidden, DoesNotAffectIncrementalBuild, + SupplementaryOutput]>; def emit_parseable_module_interface_path : Separate<["-"], "emit-parseable-module-interface-path">, Alias, Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild, - HelpHidden, ArgumentIsPath]>; + HelpHidden, ArgumentIsPath, SupplementaryOutput]>; def emit_objc_header : Flag<["-"], "emit-objc-header">, - Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>, + Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild, + SupplementaryOutput]>, HelpText<"Emit an Objective-C header file">; def emit_objc_header_path : Separate<["-"], "emit-objc-header-path">, Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild, - ArgumentIsPath]>, + ArgumentIsPath, SupplementaryOutput]>, MetaVarName<"">, HelpText<"Emit an Objective-C header file to ">; def static : Flag<["-"], "static">, @@ -518,11 +534,16 @@ def enable_experimental_concise_pound_file : Flag<["-"], Flags<[FrontendOption]>, HelpText<"Enable experimental concise '#file' identifier">; -def experimental_private_intransitive_dependencies : Flag<["-"], - "experimental-private-intransitive-dependencies">, +def enable_direct_intramodule_dependencies : Flag<["-"], + "enable-direct-intramodule-dependencies">, Flags<[FrontendOption, HelpHidden]>, HelpText<"Enable experimental dependency tracking that never cascades">; +def disable_direct_intramodule_dependencies : Flag<["-"], + "disable-direct-intramodule-dependencies">, + Flags<[FrontendOption, HelpHidden]>, + HelpText<"Disable experimental dependency tracking that never cascades">; + // Diagnostic control options def suppress_warnings : Flag<["-"], "suppress-warnings">, diff --git a/include/swift/Parse/Parser.h b/include/swift/Parse/Parser.h index 38672aa3f9492..75d710cc6769b 100644 --- a/include/swift/Parse/Parser.h +++ b/include/swift/Parse/Parser.h @@ -22,6 +22,7 @@ #include "swift/AST/Expr.h" #include "swift/AST/DiagnosticsParse.h" #include "swift/AST/LayoutConstraint.h" +#include "swift/AST/ParseRequests.h" #include "swift/AST/Pattern.h" #include "swift/AST/Stmt.h" #include "swift/Basic/OptionSet.h" @@ -92,8 +93,11 @@ class ConsumeTokenReceiver { /// This is called to update the kind of a token whose start location is Loc. virtual void registerTokenKindChange(SourceLoc Loc, tok NewKind) {}; - /// This is called when a source file is fully parsed. - virtual void finalize() {}; + /// This is called when a source file is fully parsed. It returns the + /// finalized vector of tokens, or \c None if the receiver isn't configured to + /// record them. + virtual Optional> finalize() { return None; } + virtual ~ConsumeTokenReceiver() = default; }; @@ -124,7 +128,10 @@ class Parser { /// Tracks parsed decls that LLDB requires to be inserted at the top-level. std::vector ContextSwitchedTopLevelDecls; - NullablePtr CurrentTokenHash; + /// The current token hash, or \c None if the parser isn't computing a hash + /// for the token stream. + Optional CurrentTokenHash; + void recordTokenHash(const Token Tok) { if (!Tok.getText().empty()) recordTokenHash(Tok.getText()); @@ -416,6 +423,14 @@ class Parser { return SyntaxContext->finalizeRoot(); } + /// Retrieve the token receiver from the parser once it has finished parsing. + std::unique_ptr takeTokenReceiver() { + assert(Tok.is(tok::eof) && "not done parsing yet"); + auto *receiver = TokReceiver; + TokReceiver = nullptr; + return std::unique_ptr(receiver); + } + //===--------------------------------------------------------------------===// // Routines to save and restore parser state. @@ -472,6 +487,9 @@ class Parser { void receive(Token tok) override { delayedTokens.push_back(tok); } + Optional> finalize() override { + llvm_unreachable("Cannot finalize a DelayedTokenReciever"); + } ~DelayedTokenReceiver() { if (!shouldTransfer) return; diff --git a/include/swift/Parse/SyntaxParseActions.h b/include/swift/Parse/SyntaxParseActions.h index 33b1cd7f6e2ec..987de9ee4c06a 100644 --- a/include/swift/Parse/SyntaxParseActions.h +++ b/include/swift/Parse/SyntaxParseActions.h @@ -24,11 +24,13 @@ namespace swift { class CharSourceRange; class ParsedTriviaPiece; +class SourceFile; class SourceLoc; enum class tok; namespace syntax { - enum class SyntaxKind; +class SourceFileSyntax; +enum class SyntaxKind; } typedef void *OpaqueSyntaxNode; @@ -55,6 +57,12 @@ class SyntaxParseActions { ArrayRef elements, CharSourceRange range) = 0; + /// Attempt to realize an opaque raw syntax node for a source file into a + /// SourceFileSyntax node. This will return \c None if the parsing action + /// doesn't support the realization of syntax nodes. + virtual Optional + realizeSyntaxRoot(OpaqueSyntaxNode root, const SourceFile &SF) = 0; + /// Discard raw syntax node. /// /// FIXME: This breaks invariant that any recorded node will be a part of the diff --git a/include/swift/SIL/OwnershipUtils.h b/include/swift/SIL/OwnershipUtils.h index 35d11727a9f75..c2d6b45336597 100644 --- a/include/swift/SIL/OwnershipUtils.h +++ b/include/swift/SIL/OwnershipUtils.h @@ -502,6 +502,10 @@ struct OwnedValueIntroducerKind { /// owned. Struct, + /// An owned value that is from a tuple that has multiple operands that are + /// owned. + Tuple, + /// An owned value that is a function argument. FunctionArgument, @@ -528,6 +532,8 @@ struct OwnedValueIntroducerKind { return OwnedValueIntroducerKind(BeginApply); case ValueKind::StructInst: return OwnedValueIntroducerKind(Struct); + case ValueKind::TupleInst: + return OwnedValueIntroducerKind(Tuple); case ValueKind::SILPhiArgument: { auto *phiArg = cast(value); if (dyn_cast_or_null(phiArg->getSingleTerminator())) { @@ -621,6 +627,7 @@ struct OwnedValueIntroducer { case OwnedValueIntroducerKind::LoadTake: case OwnedValueIntroducerKind::Phi: case OwnedValueIntroducerKind::Struct: + case OwnedValueIntroducerKind::Tuple: case OwnedValueIntroducerKind::FunctionArgument: case OwnedValueIntroducerKind::PartialApplyInit: case OwnedValueIntroducerKind::AllocBoxInit: @@ -639,6 +646,7 @@ struct OwnedValueIntroducer { case OwnedValueIntroducerKind::Phi: return true; case OwnedValueIntroducerKind::Struct: + case OwnedValueIntroducerKind::Tuple: case OwnedValueIntroducerKind::Copy: case OwnedValueIntroducerKind::LoadCopy: case OwnedValueIntroducerKind::Apply: diff --git a/include/swift/SIL/SILBuilder.h b/include/swift/SIL/SILBuilder.h index 26fab8b9acd85..3d8dbbf19be1d 100644 --- a/include/swift/SIL/SILBuilder.h +++ b/include/swift/SIL/SILBuilder.h @@ -899,6 +899,14 @@ class SILBuilder { DebugValueAddrInst *createDebugValueAddr(SILLocation Loc, SILValue src, SILDebugVariable Var); + /// Create a debug_value_addr if \p src is an address; a debug_value if not. + SILInstruction *emitDebugDescription(SILLocation Loc, SILValue src, + SILDebugVariable Var) { + if (src->getType().isAddress()) + return createDebugValueAddr(Loc, src, Var); + return createDebugValue(Loc, src, Var); + } + #define NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \ Load##Name##Inst *createLoad##Name(SILLocation Loc, \ SILValue src, \ @@ -2179,10 +2187,11 @@ class SILBuilder { //===--------------------------------------------------------------------===// DifferentiableFunctionInst *createDifferentiableFunction( - SILLocation Loc, IndexSubset *ParameterIndices, SILValue OriginalFunction, + SILLocation Loc, IndexSubset *ParameterIndices, + IndexSubset *ResultIndices, SILValue OriginalFunction, Optional> JVPAndVJPFunctions = None) { return insert(DifferentiableFunctionInst::create( - getModule(), getSILDebugLocation(Loc), ParameterIndices, + getModule(), getSILDebugLocation(Loc), ParameterIndices, ResultIndices, OriginalFunction, JVPAndVJPFunctions, hasOwnership())); } diff --git a/include/swift/SIL/SILCloner.h b/include/swift/SIL/SILCloner.h index 010aefc58805f..331ec7fb1ac61 100644 --- a/include/swift/SIL/SILCloner.h +++ b/include/swift/SIL/SILCloner.h @@ -2853,6 +2853,7 @@ void SILCloner::visitDifferentiableFunctionInst( recordClonedInstruction( Inst, getBuilder().createDifferentiableFunction( getOpLocation(Inst->getLoc()), Inst->getParameterIndices(), + Inst->getResultIndices(), getOpValue(Inst->getOriginalFunction()), derivativeFns)); } diff --git a/include/swift/SIL/SILDebugScope.h b/include/swift/SIL/SILDebugScope.h index 55a0a17c8f720..ce9ad200ac77e 100644 --- a/include/swift/SIL/SILDebugScope.h +++ b/include/swift/SIL/SILDebugScope.h @@ -56,6 +56,8 @@ class SILDebugScope : public SILAllocated { /// Create a scope for an artificial function. SILDebugScope(SILLocation Loc); + SILLocation getLoc() const { return Loc; } + /// Return the function this scope originated from before being inlined. SILFunction *getInlinedFunction() const; @@ -64,12 +66,10 @@ class SILDebugScope : public SILAllocated { /// into. SILFunction *getParentFunction() const; -#ifndef NDEBUG - SWIFT_DEBUG_DUMPER(dump(SourceManager &SM, - llvm::raw_ostream &OS = llvm::errs(), - unsigned Indent = 0)); - SWIFT_DEBUG_DUMPER(dump(SILModule &Mod)); -#endif + void print(SourceManager &SM, llvm::raw_ostream &OS = llvm::errs(), + unsigned Indent = 0) const; + + void print(SILModule &Mod) const; }; /// Determine whether an instruction may not have a SILDebugScope. diff --git a/include/swift/SIL/SILInstruction.h b/include/swift/SIL/SILInstruction.h index 99ce5b3225f64..0f7bd45022eb5 100644 --- a/include/swift/SIL/SILInstruction.h +++ b/include/swift/SIL/SILInstruction.h @@ -8165,17 +8165,21 @@ class DifferentiableFunctionInst final friend SILBuilder; /// Differentiability parameter indices. IndexSubset *ParameterIndices; + /// Differentiability result indices. + IndexSubset *ResultIndices; /// Indicates whether derivative function operands (JVP/VJP) exist. bool HasDerivativeFunctions; DifferentiableFunctionInst(SILDebugLocation DebugLoc, IndexSubset *ParameterIndices, + IndexSubset *ResultIndices, SILValue OriginalFunction, ArrayRef DerivativeFunctions, bool HasOwnership); static SILType getDifferentiableFunctionType(SILValue OriginalFunction, - IndexSubset *ParameterIndices); + IndexSubset *ParameterIndices, + IndexSubset *ResultIndices); static ValueOwnershipKind getMergedOwnershipKind(SILValue OriginalFunction, @@ -8184,7 +8188,7 @@ class DifferentiableFunctionInst final public: static DifferentiableFunctionInst * create(SILModule &Module, SILDebugLocation Loc, IndexSubset *ParameterIndices, - SILValue OriginalFunction, + IndexSubset *ResultIndices, SILValue OriginalFunction, Optional> VJPAndJVPFunctions, bool HasOwnership); @@ -8194,6 +8198,9 @@ class DifferentiableFunctionInst final /// Returns differentiability parameter indices. IndexSubset *getParameterIndices() const { return ParameterIndices; } + /// Returns differentiability result indices. + IndexSubset *getResultIndices() const { return ResultIndices; } + /// Returns true if derivative functions (JVP/VJP) exist. bool hasDerivativeFunctions() const { return HasDerivativeFunctions; } diff --git a/include/swift/SIL/SILLocation.h b/include/swift/SIL/SILLocation.h index 60bedd6f8ef31..a7a21c52e2bed 100644 --- a/include/swift/SIL/SILLocation.h +++ b/include/swift/SIL/SILLocation.h @@ -490,6 +490,8 @@ class SILLocation { Loc.ASTNode.ForDebugger.getOpaqueValue() == R.Loc.ASTNode.ForDebugger.getOpaqueValue(); } + + inline bool operator!=(const SILLocation &R) const { return !(*this == R); } }; /// Allowed on any instruction. diff --git a/include/swift/SIL/SILModule.h b/include/swift/SIL/SILModule.h index c3869a1ff7a0c..4c97abd5751f2 100644 --- a/include/swift/SIL/SILModule.h +++ b/include/swift/SIL/SILModule.h @@ -110,7 +110,7 @@ class SILModule { public: using FunctionListType = llvm::ilist; using GlobalListType = llvm::ilist; - using VTableListType = llvm::ilist; + using VTableListType = llvm::ArrayRef; using PropertyListType = llvm::ilist; using WitnessTableListType = llvm::ilist; using DefaultWitnessTableListType = llvm::ilist; @@ -178,7 +178,7 @@ class SILModule { llvm::DenseMap VTableMap; /// The list of SILVTables in the module. - VTableListType vtables; + std::vector vtables; /// This is a cache of vtable entries for quick look-up llvm::DenseMap, SILVTable::Entry> @@ -404,20 +404,15 @@ class SILModule { const_iterator zombies_begin() const { return zombieFunctions.begin(); } const_iterator zombies_end() const { return zombieFunctions.end(); } + llvm::ArrayRef getVTables() const { + return llvm::ArrayRef(vtables); + } using vtable_iterator = VTableListType::iterator; using vtable_const_iterator = VTableListType::const_iterator; - VTableListType &getVTableList() { return vtables; } - const VTableListType &getVTableList() const { return vtables; } - vtable_iterator vtable_begin() { return vtables.begin(); } - vtable_iterator vtable_end() { return vtables.end(); } - vtable_const_iterator vtable_begin() const { return vtables.begin(); } - vtable_const_iterator vtable_end() const { return vtables.end(); } - iterator_range getVTables() { - return {vtables.begin(), vtables.end()}; - } - iterator_range getVTables() const { - return {vtables.begin(), vtables.end()}; - } + vtable_iterator vtable_begin() { return getVTables().begin(); } + vtable_iterator vtable_end() { return getVTables().end(); } + vtable_const_iterator vtable_begin() const { return getVTables().begin(); } + vtable_const_iterator vtable_end() const { return getVTables().end(); } using witness_table_iterator = WitnessTableListType::iterator; using witness_table_const_iterator = WitnessTableListType::const_iterator; diff --git a/include/swift/SIL/SILNodes.def b/include/swift/SIL/SILNodes.def index 9bd877c60c166..44adf50b7aea8 100644 --- a/include/swift/SIL/SILNodes.def +++ b/include/swift/SIL/SILNodes.def @@ -880,8 +880,13 @@ NODE_RANGE(NonValueInstruction, UnreachableInst, CondFailInst) ABSTRACT_INST(MultipleValueInstruction, SILInstruction) FULLAPPLYSITE_MULTIPLE_VALUE_INST(BeginApplyInst, begin_apply, MultipleValueInstruction, MayHaveSideEffects, MayRelease) + +// begin_cow_mutation is defined to have side effects, because it has +// dependencies with instructions which retain the buffer operand. This prevents +// optimizations from moving begin_cow_mutation instructions across such retain +// instructions. MULTIPLE_VALUE_INST(BeginCOWMutationInst, begin_cow_mutation, - MultipleValueInstruction, None, DoesNotRelease) + MultipleValueInstruction, MayHaveSideEffects, DoesNotRelease) MULTIPLE_VALUE_INST(DestructureStructInst, destructure_struct, MultipleValueInstruction, None, DoesNotRelease) MULTIPLE_VALUE_INST(DestructureTupleInst, destructure_tuple, diff --git a/include/swift/SIL/SILVTable.h b/include/swift/SIL/SILVTable.h index 54dc2aec4cb5b..36beb837e70f0 100644 --- a/include/swift/SIL/SILVTable.h +++ b/include/swift/SIL/SILVTable.h @@ -29,8 +29,6 @@ #include "swift/SIL/SILAllocated.h" #include "swift/SIL/SILDeclRef.h" #include "swift/SIL/SILFunction.h" -#include "llvm/ADT/ilist_node.h" -#include "llvm/ADT/ilist.h" #include "llvm/ADT/Optional.h" #include @@ -44,8 +42,7 @@ class SILModule; /// A mapping from each dynamically-dispatchable method of a class to the /// SILFunction that implements the method for that class. /// Note that dead methods are completely removed from the vtable. -class SILVTable : public llvm::ilist_node, - public SILAllocated { +class SILVTable : public SILAllocated { public: // TODO: Entry should include substitutions needed to invoke an overridden // generic base class method. @@ -128,6 +125,9 @@ class SILVTable : public llvm::ilist_node, /// Return all of the method entries. ArrayRef getEntries() const { return {Entries, NumEntries}; } + /// Return all of the method entries mutably. + MutableArrayRef getMutableEntries() { return {Entries, NumEntries}; } + /// Look up the implementation function for the given method. Optional getEntry(SILModule &M, SILDeclRef method) const; diff --git a/include/swift/SIL/TypeSubstCloner.h b/include/swift/SIL/TypeSubstCloner.h index 768a92e8d612e..9c91771c651df 100644 --- a/include/swift/SIL/TypeSubstCloner.h +++ b/include/swift/SIL/TypeSubstCloner.h @@ -351,7 +351,8 @@ class TypeSubstCloner : public SILClonerWithScopes { remappedOrigFnType ->getAutoDiffDerivativeFunctionType( remappedOrigFnType->getDifferentiabilityParameterIndices(), - /*resultIndex*/ 0, dfei->getDerivativeFunctionKind(), + remappedOrigFnType->getDifferentiabilityResultIndices(), + dfei->getDerivativeFunctionKind(), getBuilder().getModule().Types, LookUpConformanceInModule(SwiftMod)) ->getWithoutDifferentiability(); diff --git a/include/swift/SILOptimizer/Analysis/DifferentiableActivityAnalysis.h b/include/swift/SILOptimizer/Analysis/DifferentiableActivityAnalysis.h index 06be53f4e8524..ed3b065240ac8 100644 --- a/include/swift/SILOptimizer/Analysis/DifferentiableActivityAnalysis.h +++ b/include/swift/SILOptimizer/Analysis/DifferentiableActivityAnalysis.h @@ -190,12 +190,16 @@ class DifferentiableActivityInfo { /// Returns true if the given value is varied for any of the given parameter /// (independent variable) indices. - bool isVaried(SILValue value, IndexSubset *parameterIndices) const; + bool isVaried(SILValue value, IndexSubset *independentVariableIndices) const; /// Returns true if the given value is useful for the given dependent variable /// index. bool isUseful(SILValue value, unsigned dependentVariableIndex) const; + /// Returns true if the given value is varied for any of the given result + /// (dependent variable) indices. + bool isUseful(SILValue value, IndexSubset *dependentVariableIndices) const; + /// Returns true if the given value is active for the given /// `SILAutoDiffIndices` (parameter indices and result index). bool isActive(SILValue value, const SILAutoDiffIndices &indices) const; diff --git a/include/swift/SILOptimizer/Differentiation/ADContext.h b/include/swift/SILOptimizer/Differentiation/ADContext.h index b6cd81bf8af76..1b0426aed0f1e 100644 --- a/include/swift/SILOptimizer/Differentiation/ADContext.h +++ b/include/swift/SILOptimizer/Differentiation/ADContext.h @@ -86,9 +86,6 @@ class ADContext { 32> invokers; - /// Mapping from `differentiable_function` instructions to result indices. - llvm::DenseMap resultIndices; - /// Mapping from original `apply` instructions to their corresponding /// `NestedApplyInfo`s. llvm::DenseMap nestedApplyInfo; @@ -174,17 +171,6 @@ class ADContext { invokers.insert({witness, DifferentiationInvoker(witness)}); } - /// Returns the result index for `dfi` if found in this context. Otherwise, - /// sets the result index to zero and returns it. - unsigned getResultIndex(DifferentiableFunctionInst *dfi) { - return resultIndices[dfi]; - } - - /// Sets the result index for `dfi`. - void setResultIndex(DifferentiableFunctionInst *dfi, unsigned index) { - resultIndices[dfi] = index; - } - llvm::DenseMap &getNestedApplyInfo() { return nestedApplyInfo; } @@ -215,7 +201,7 @@ class ADContext { /// `CanonicalizeInstruction` may get rid of the need for this workaround. DifferentiableFunctionInst *createDifferentiableFunction( SILBuilder &builder, SILLocation loc, IndexSubset *parameterIndices, - SILValue original, + IndexSubset *resultIndices, SILValue original, Optional> derivativeFunctions = None); // Given an `differentiable_function` instruction, finds the corresponding diff --git a/include/swift/SILOptimizer/Differentiation/AdjointValue.h b/include/swift/SILOptimizer/Differentiation/AdjointValue.h index 4b316835518f7..cd2b244b65af6 100644 --- a/include/swift/SILOptimizer/Differentiation/AdjointValue.h +++ b/include/swift/SILOptimizer/Differentiation/AdjointValue.h @@ -136,13 +136,12 @@ class AdjointValue final { void print(llvm::raw_ostream &s) const { switch (getKind()) { case AdjointValueKind::Zero: - s << "Zero"; + s << "Zero[" << getType() << ']'; break; case AdjointValueKind::Aggregate: - s << "Aggregate<"; + s << "Aggregate[" << getType() << "]("; if (auto *decl = getType().getASTType()->getStructOrBoundGenericStruct()) { - s << "Struct>("; interleave( llvm::zip(decl->getStoredProperties(), base->value.aggregate), [&s](std::tuple elt) { @@ -151,7 +150,6 @@ class AdjointValue final { }, [&s] { s << ", "; }); } else if (getType().is()) { - s << "Tuple>("; interleave( base->value.aggregate, [&s](const AdjointValue &elt) { elt.print(s); }, @@ -162,10 +160,11 @@ class AdjointValue final { s << ')'; break; case AdjointValueKind::Concrete: - s << "Concrete(" << base->value.concrete << ')'; + s << "Concrete[" << getType() << "](" << base->value.concrete << ')'; break; } } + SWIFT_DEBUG_DUMP { print(llvm::dbgs()); }; }; diff --git a/include/swift/SILOptimizer/Differentiation/Common.h b/include/swift/SILOptimizer/Differentiation/Common.h index 7dff0973e46a8..a4d8637b386d8 100644 --- a/include/swift/SILOptimizer/Differentiation/Common.h +++ b/include/swift/SILOptimizer/Differentiation/Common.h @@ -17,10 +17,12 @@ #ifndef SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_COMMON_H #define SWIFT_SILOPTIMIZER_UTILS_DIFFERENTIATION_COMMON_H +#include "swift/AST/SemanticAttrs.h" #include "swift/SIL/SILDifferentiabilityWitness.h" #include "swift/SIL/SILFunction.h" #include "swift/SIL/SILModule.h" #include "swift/SIL/TypeSubstCloner.h" +#include "swift/SILOptimizer/Analysis/ArraySemantic.h" #include "swift/SILOptimizer/Analysis/DifferentiableActivityAnalysis.h" namespace swift { @@ -35,15 +37,6 @@ namespace autodiff { /// This is being used to print short debug messages within the AD pass. raw_ostream &getADDebugStream(); -/// Returns true if this is an full apply site whose callee has -/// `array.uninitialized_intrinsic` semantics. -bool isArrayLiteralIntrinsic(FullApplySite applySite); - -/// If the given value `v` corresponds to an `ApplyInst` with -/// `array.uninitialized_intrinsic` semantics, returns the corresponding -/// `ApplyInst`. Otherwise, returns `nullptr`. -ApplyInst *getAllocateUninitializedArrayIntrinsic(SILValue v); - /// Given an element address from an `array.uninitialized_intrinsic` `apply` /// instruction, returns the `apply` instruction. The element address is either /// a `pointer_to_address` or `index_addr` instruction to the `RawPointer` @@ -55,6 +48,8 @@ ApplyInst *getAllocateUninitializedArrayIntrinsic(SILValue v); /// %index_1 = integer_literal $Builtin.Word, 1 /// %elt1 = index_addr %elt0, %index_1 // element address /// ... +// TODO(SR-12894): Find a better name and move this general utility to +// ArraySemantic.h. ApplyInst *getAllocateUninitializedArrayIntrinsicElementAddress(SILValue v); /// Given a value, finds its single `destructure_tuple` user if the value is diff --git a/include/swift/SILOptimizer/Differentiation/JVPEmitter.h b/include/swift/SILOptimizer/Differentiation/JVPEmitter.h index 509a0ec992cc9..935f4dca145de 100644 --- a/include/swift/SILOptimizer/Differentiation/JVPEmitter.h +++ b/include/swift/SILOptimizer/Differentiation/JVPEmitter.h @@ -347,10 +347,13 @@ class JVPEmitter final #undef CLONE_AND_EMIT_TANGENT - /// Handle `apply` instruction. + /// Handle `apply` instruction, given: + /// - The minimal indices for differentiating the `apply`. + /// - The original non-reabstracted differential type. + /// /// Original: y = apply f(x0, x1, ...) /// Tangent: tan[y] = apply diff_f(tan[x0], tan[x1], ...) - void emitTangentForApplyInst(ApplyInst *ai, SILAutoDiffIndices actualIndices, + void emitTangentForApplyInst(ApplyInst *ai, SILAutoDiffIndices applyIndices, CanSILFunctionType originalDifferentialType); /// Generate a `return` instruction in the current differential basic block. diff --git a/include/swift/SILOptimizer/Differentiation/PullbackEmitter.h b/include/swift/SILOptimizer/Differentiation/PullbackEmitter.h index e44c873331186..964923f2267bf 100644 --- a/include/swift/SILOptimizer/Differentiation/PullbackEmitter.h +++ b/include/swift/SILOptimizer/Differentiation/PullbackEmitter.h @@ -307,6 +307,13 @@ class PullbackEmitter final : public SILInstructionVisitor { return pullbackTrampolineBBMap.lookup({originalBlock, successorBlock}); } + //--------------------------------------------------------------------------// + // Debugging utilities + //--------------------------------------------------------------------------// + + void printAdjointValueMapping(); + void printAdjointBufferMapping(); + public: //--------------------------------------------------------------------------// // Entry point diff --git a/include/swift/SILOptimizer/PassManager/Passes.def b/include/swift/SILOptimizer/PassManager/Passes.def index b18748cb603d0..88630d491744e 100644 --- a/include/swift/SILOptimizer/PassManager/Passes.def +++ b/include/swift/SILOptimizer/PassManager/Passes.def @@ -248,6 +248,9 @@ PASS(OwnershipModelEliminator, "ownership-model-eliminator", PASS(NonTransparentFunctionOwnershipModelEliminator, "non-transparent-func-ownership-model-eliminator", "Eliminate Ownership Annotations from non-transparent SIL Functions") +PASS(NonStdlibNonTransparentFunctionOwnershipModelEliminator, + "non-stdlib-non-transparent-func-ownership-model-eliminator", + "Eliminate Ownership Annotations from non-transparent SIL Functions only when not processing the stdlib.") PASS(RCIdentityDumper, "rc-id-dumper", "Print Reference Count Identities") PASS(AlwaysInlineInliner, "always-inline", @@ -340,7 +343,9 @@ PASS(MandatoryCombine, "mandatory-combine", "Perform mandatory peephole combines") PASS(BugReducerTester, "bug-reducer-tester", "sil-bug-reducer Tool Testing by Asserting on a Sentinel Function") -PASS_RANGE(AllPasses, AADumper, BugReducerTester) +PASS(PruneVTables, "prune-vtables", + "Mark class methods that do not require vtable dispatch") +PASS_RANGE(AllPasses, AADumper, PruneVTables) #undef IRGEN_PASS #undef PASS diff --git a/include/swift/Serialization/Validation.h b/include/swift/Serialization/Validation.h index 5208ac62ccbc5..c727b198cc0de 100644 --- a/include/swift/Serialization/Validation.h +++ b/include/swift/Serialization/Validation.h @@ -98,6 +98,7 @@ class ExtendedValidationInfo { unsigned IsSIB : 1; unsigned IsTestable : 1; unsigned ResilienceStrategy : 2; + unsigned IsImplicitDynamicEnabled: 1; } Bits; public: ExtendedValidationInfo() : Bits() {} @@ -123,6 +124,10 @@ class ExtendedValidationInfo { void setPrivateImportsEnabled(bool enabled) { Bits.ArePrivateImportsEnabled = enabled; } + bool isImplicitDynamicEnabled() { return Bits.IsImplicitDynamicEnabled; } + void setImplicitDynamicEnabled(bool val) { + Bits.IsImplicitDynamicEnabled = val; + } bool isTestable() const { return Bits.IsTestable; } void setIsTestable(bool val) { Bits.IsTestable = val; diff --git a/include/swift/SyntaxParse/SyntaxTreeCreator.h b/include/swift/SyntaxParse/SyntaxTreeCreator.h index 680233298d590..26b5bdabe5548 100644 --- a/include/swift/SyntaxParse/SyntaxTreeCreator.h +++ b/include/swift/SyntaxParse/SyntaxTreeCreator.h @@ -23,7 +23,8 @@ namespace swift { class SourceFile; namespace syntax { - class SyntaxArena; +class SyntaxArena; +class SourceFileSyntax; } /// Receives the parsed syntax info from the parser and constructs a persistent @@ -51,7 +52,8 @@ class SyntaxTreeCreator: public SyntaxParseActions { RC arena); ~SyntaxTreeCreator(); - void acceptSyntaxRoot(OpaqueSyntaxNode root, SourceFile &SF); + Optional + realizeSyntaxRoot(OpaqueSyntaxNode root, const SourceFile &SF) override; private: OpaqueSyntaxNode recordToken(tok tokenKind, diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 01e94203cffe6..2a617a3616ec1 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -3364,14 +3364,22 @@ SILFunctionType::SILFunctionType( } } - // Check that `@noDerivative` parameters only exist on `@differentiable` - // functions. - if (!ext.isDifferentiable()) - for (auto param : getParameters()) + // Check that `@noDerivative` parameters and results only exist in + // `@differentiable` function types. + if (!ext.isDifferentiable()) { + for (auto param : getParameters()) { assert(param.getDifferentiability() == SILParameterDifferentiability::DifferentiableOrNotApplicable && - "non-`@differentiable` function should not have NotDifferentiable " - "parameter"); + "non-`@differentiable` function type should not have " + "`@noDerivative` parameter"); + } + for (auto result : getResults()) { + assert(result.getDifferentiability() == + SILResultDifferentiability::DifferentiableOrNotApplicable && + "non-`@differentiable` function type should not have " + "`@noDerivative` result"); + } + } #endif } diff --git a/lib/AST/ASTDemangler.cpp b/lib/AST/ASTDemangler.cpp index a0f083c9f50d1..57692d6be94cf 100644 --- a/lib/AST/ASTDemangler.cpp +++ b/lib/AST/ASTDemangler.cpp @@ -471,6 +471,17 @@ static ResultConvention getResultConvention(ImplResultConvention conv) { llvm_unreachable("covered switch"); } +static SILResultDifferentiability +getResultDifferentiability(ImplResultDifferentiability diffKind) { + switch (diffKind) { + case ImplResultDifferentiability::DifferentiableOrNotApplicable: + return SILResultDifferentiability::DifferentiableOrNotApplicable; + case ImplResultDifferentiability::NotDifferentiable: + return SILResultDifferentiability::NotDifferentiable; + } + llvm_unreachable("unknown differentiability kind"); +} + Type ASTBuilder::createImplFunctionType( Demangle::ImplParameterConvention calleeConvention, ArrayRef> params, @@ -544,7 +555,8 @@ Type ASTBuilder::createImplFunctionType( for (const auto &result : results) { auto type = result.getType()->getCanonicalType(); auto conv = getResultConvention(result.getConvention()); - funcResults.emplace_back(type, conv); + auto diffKind = getResultDifferentiability(result.getDifferentiability()); + funcResults.emplace_back(type, conv, diffKind); } if (errorResult) { diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index cd7c1b627e887..4aef9bc3905ca 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -479,9 +479,9 @@ namespace { void visitTypedPattern(TypedPattern *P) { printCommon(P, "pattern_typed") << '\n'; printRec(P->getSubPattern()); - if (P->getTypeLoc().getTypeRepr()) { + if (auto *repr = P->getTypeRepr()) { OS << '\n'; - printRec(P->getTypeLoc().getTypeRepr()); + printRec(repr); } PrintWithColorRAII(OS, ParenthesisColor) << ')'; } @@ -489,7 +489,7 @@ namespace { void visitIsPattern(IsPattern *P) { printCommon(P, "pattern_is") << ' ' << getCheckedCastKindName(P->getCastKind()) << ' '; - P->getCastTypeLoc().getType().print(OS); + P->getCastType().print(OS); if (auto sub = P->getSubPattern()) { OS << '\n'; printRec(sub); @@ -514,8 +514,7 @@ namespace { void visitEnumElementPattern(EnumElementPattern *P) { printCommon(P, "pattern_enum_element"); OS << ' '; - P->getParentType().getType().print( - PrintWithColorRAII(OS, TypeColor).getOS()); + P->getParentType().print(PrintWithColorRAII(OS, TypeColor).getOS()); PrintWithColorRAII(OS, IdentifierColor) << '.' << P->getName(); if (P->hasSubPattern()) { OS << '\n'; @@ -1420,7 +1419,13 @@ void SourceFile::dump() const { dump(llvm::errs()); } -void SourceFile::dump(llvm::raw_ostream &OS) const { +void SourceFile::dump(llvm::raw_ostream &OS, bool parseIfNeeded) const { + // If we're allowed to parse the SourceFile, do so now. We need to force the + // parsing request as by default the dumping logic tries not to kick any + // requests. + if (parseIfNeeded) + (void)getTopLevelDecls(); + PrintDecl(OS).visitSourceFile(*this); llvm::errs() << '\n'; } @@ -1775,18 +1780,18 @@ class PrintExpr : public ExprVisitor { public: raw_ostream &OS; llvm::function_ref GetTypeOfExpr; - llvm::function_ref GetTypeOfTypeLoc; + llvm::function_ref GetTypeOfTypeRepr; llvm::function_ref GetTypeOfKeyPathComponent; unsigned Indent; PrintExpr(raw_ostream &os, llvm::function_ref getTypeOfExpr, - llvm::function_ref getTypeOfTypeLoc, + llvm::function_ref getTypeOfTypeRepr, llvm::function_ref getTypeOfKeyPathComponent, unsigned indent) : OS(os), GetTypeOfExpr(getTypeOfExpr), - GetTypeOfTypeLoc(getTypeOfTypeLoc), + GetTypeOfTypeRepr(getTypeOfTypeRepr), GetTypeOfKeyPathComponent(getTypeOfKeyPathComponent), Indent(indent) {} void printRec(Expr *E) { @@ -2601,7 +2606,10 @@ class PrintExpr : public ExprVisitor { if (auto checkedCast = dyn_cast(E)) OS << getCheckedCastKindName(checkedCast->getCastKind()) << ' '; OS << "writtenType='"; - GetTypeOfTypeLoc(E->getCastTypeLoc()).print(OS); + if (GetTypeOfTypeRepr) + GetTypeOfTypeRepr(E->getCastTypeRepr()).print(OS); + else + E->getCastType().print(OS); OS << "'\n"; printRec(E->getSubExpr()); PrintWithColorRAII(OS, ParenthesisColor) << ')'; @@ -2866,21 +2874,22 @@ void Expr::dump() const { } void Expr::dump(raw_ostream &OS, llvm::function_ref getTypeOfExpr, - llvm::function_ref getTypeOfTypeLoc, + llvm::function_ref getTypeOfTypeRepr, llvm::function_ref getTypeOfKeyPathComponent, unsigned Indent) const { - PrintExpr(OS, getTypeOfExpr, getTypeOfTypeLoc, getTypeOfKeyPathComponent, Indent) + PrintExpr(OS, getTypeOfExpr, getTypeOfTypeRepr, getTypeOfKeyPathComponent, + Indent) .visit(const_cast(this)); } void Expr::dump(raw_ostream &OS, unsigned Indent) const { auto getTypeOfExpr = [](Expr *E) -> Type { return E->getType(); }; - auto getTypeOfTypeLoc = [](TypeLoc &TL) -> Type { return TL.getType(); }; auto getTypeOfKeyPathComponent = [](KeyPathExpr *E, unsigned index) -> Type { return E->getComponents()[index].getComponentType(); }; - dump(OS, getTypeOfExpr, getTypeOfTypeLoc, getTypeOfKeyPathComponent, Indent); + dump(OS, getTypeOfExpr, /*getTypeOfTypeRepr*/ nullptr, + getTypeOfKeyPathComponent, Indent); } void Expr::print(ASTPrinter &Printer, const PrintOptions &Opts) const { diff --git a/lib/AST/ASTMangler.cpp b/lib/AST/ASTMangler.cpp index 0ae8ccfa7b2f1..ec579237a8311 100644 --- a/lib/AST/ASTMangler.cpp +++ b/lib/AST/ASTMangler.cpp @@ -1584,7 +1584,7 @@ getParamDifferentiability(SILParameterDifferentiability diffKind) { case swift::SILParameterDifferentiability::NotDifferentiable: return 'w'; } - llvm_unreachable("bad parameter convention"); + llvm_unreachable("bad parameter differentiability"); }; static char getResultConvention(ResultConvention conv) { @@ -1598,6 +1598,17 @@ static char getResultConvention(ResultConvention conv) { llvm_unreachable("bad result convention"); }; +static Optional +getResultDifferentiability(SILResultDifferentiability diffKind) { + switch (diffKind) { + case swift::SILResultDifferentiability::DifferentiableOrNotApplicable: + return None; + case swift::SILResultDifferentiability::NotDifferentiable: + return 'w'; + } + llvm_unreachable("bad result differentiability"); +}; + void ASTMangler::appendImplFunctionType(SILFunctionType *fn) { llvm::SmallVector OpArgs; @@ -1684,6 +1695,9 @@ void ASTMangler::appendImplFunctionType(SILFunctionType *fn) { // Mangle the results. for (auto result : fn->getResults()) { OpArgs.push_back(getResultConvention(result.getConvention())); + if (auto diffKind = + getResultDifferentiability(result.getDifferentiability())) + OpArgs.push_back(*diffKind); appendType(result.getInterfaceType()); } diff --git a/lib/AST/ASTNode.cpp b/lib/AST/ASTNode.cpp index f3f71baa2cfe0..92ac33f35cfad 100644 --- a/lib/AST/ASTNode.cpp +++ b/lib/AST/ASTNode.cpp @@ -19,7 +19,7 @@ #include "swift/AST/Expr.h" #include "swift/AST/Stmt.h" #include "swift/AST/Pattern.h" -#include "swift/AST/TypeLoc.h" +#include "swift/AST/TypeRepr.h" #include "swift/Basic/SourceLoc.h" using namespace swift; @@ -33,8 +33,8 @@ SourceRange ASTNode::getSourceRange() const { return D->getSourceRange(); if (const auto *P = this->dyn_cast()) return P->getSourceRange(); - if (const auto *L = this->dyn_cast()) - return L->getSourceRange(); + if (const auto *T = this->dyn_cast()) + return T->getSourceRange(); llvm_unreachable("unsupported AST node"); } @@ -71,7 +71,7 @@ bool ASTNode::isImplicit() const { return D->isImplicit(); if (const auto *P = this->dyn_cast()) return P->isImplicit(); - if (const auto *L = this->dyn_cast()) + if (const auto *T = this->dyn_cast()) return false; llvm_unreachable("unsupported AST node"); } @@ -85,6 +85,8 @@ void ASTNode::walk(ASTWalker &Walker) { D->walk(Walker); else if (auto *P = this->dyn_cast()) P->walk(Walker); + else if (auto *T = this->dyn_cast()) + T->walk(Walker); else llvm_unreachable("unsupported AST node"); } @@ -98,8 +100,10 @@ void ASTNode::dump(raw_ostream &OS, unsigned Indent) const { D->dump(OS, Indent); else if (auto P = dyn_cast()) P->dump(OS, Indent); + else if (auto T = dyn_cast()) + T->print(OS); else - OS << ""; + llvm_unreachable("unsupported AST node"); } void ASTNode::dump() const { diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index b3815525627ee..56fe31e3f8a91 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -813,6 +813,10 @@ class PrintAST : public ASTVisitor { TypeArrayView genericParams, ArrayRef requirements, unsigned flags, llvm::function_ref filter); + void printSingleDepthOfGenericSignature( + TypeArrayView genericParams, + ArrayRef requirements, bool &isFirstReq, unsigned flags, + llvm::function_ref filter); void printRequirement(const Requirement &req); private: @@ -872,7 +876,12 @@ class PrintAST : public ASTVisitor { return false; // not needed for the parser library. #endif - if (!shouldPrint(D, true)) + bool Synthesize = + Options.TransformContext && + Options.TransformContext->isPrintingSynthesizedExtension() && + isa(D); + + if (!shouldPrint(D, true) && !Synthesize) return false; Decl *Old = Current; @@ -890,10 +899,6 @@ class PrintAST : public ASTVisitor { SWIFT_DEFER { CurrentType = OldType; }; - bool Synthesize = - Options.TransformContext && - Options.TransformContext->isPrintingSynthesizedExtension() && - isa(D); if (Synthesize) { Printer.setSynthesizedTarget(Options.TransformContext->getDecl()); } @@ -1158,7 +1163,7 @@ void PrintAST::printPattern(const Pattern *pattern) { case PatternKind::Is: { auto isa = cast(pattern); Printer << tok::kw_is << " "; - isa->getCastTypeLoc().getType().print(Printer, Options); + isa->getCastType().print(Printer, Options); break; } @@ -1456,6 +1461,15 @@ void PrintAST::printSingleDepthOfGenericSignature( TypeArrayView genericParams, ArrayRef requirements, unsigned flags, llvm::function_ref filter) { + bool isFirstReq = true; + printSingleDepthOfGenericSignature(genericParams, requirements, isFirstReq, + flags, filter); +} + +void PrintAST::printSingleDepthOfGenericSignature( + TypeArrayView genericParams, + ArrayRef requirements, bool &isFirstReq, unsigned flags, + llvm::function_ref filter) { bool printParams = (flags & PrintParams); bool printRequirements = (flags & PrintRequirements); printRequirements &= Options.PrintGenericRequirements; @@ -1502,7 +1516,6 @@ void PrintAST::printSingleDepthOfGenericSignature( } if (printRequirements || printInherited) { - bool isFirstReq = true; for (const auto &req : requirements) { if (!filter(req)) continue; @@ -1564,9 +1577,6 @@ void PrintAST::printSingleDepthOfGenericSignature( } } else { Printer.callPrintStructurePre(PrintStructureKind::GenericRequirement); - - // We don't substitute type for the printed requirement so that the - // printed requirement agrees with separately reported generic parameters. printRequirement(req); Printer.printStructurePost(PrintStructureKind::GenericRequirement); } @@ -1578,7 +1588,7 @@ void PrintAST::printSingleDepthOfGenericSignature( } void PrintAST::printRequirement(const Requirement &req) { - printType(req.getFirstType()); + printTransformedType(req.getFirstType()); switch (req.getKind()) { case RequirementKind::Layout: Printer << " : "; @@ -1592,7 +1602,7 @@ void PrintAST::printRequirement(const Requirement &req) { Printer << " == "; break; } - printType(req.getSecondType()); + printTransformedType(req.getSecondType()); } bool PrintAST::shouldPrintPattern(const Pattern *P) { @@ -2073,6 +2083,9 @@ void PrintAST::printDeclGenericRequirements(GenericContext *decl) { } void PrintAST::printInherited(const Decl *decl) { + if (!Options.PrintInherited) { + return; + } SmallVector TypesToPrint; getInheritedForPrinting(decl, Options, TypesToPrint); if (TypesToPrint.empty()) @@ -2180,8 +2193,52 @@ static void printExtendedTypeName(Type ExtendedType, ASTPrinter &Printer, Ty->print(Printer, Options); } + void PrintAST::printSynthesizedExtension(Type ExtendedType, ExtensionDecl *ExtDecl) { + + auto printRequirementsFrom = [&](ExtensionDecl *ED, bool &IsFirst) { + auto Sig = ED->getGenericSignature(); + printSingleDepthOfGenericSignature(Sig->getGenericParams(), + Sig->getRequirements(), + IsFirst, PrintRequirements, + [](const Requirement &Req){ + return true; + }); + }; + + auto printCombinedRequirementsIfNeeded = [&]() -> bool { + if (!Options.TransformContext || + !Options.TransformContext->isPrintingSynthesizedExtension()) + return false; + + // Combined requirements only needed if the transform context is an enabling + // extension of the protocol rather than a nominal (which can't have + // constraints of its own). + ExtensionDecl *Target = dyn_cast( + Options.TransformContext->getDecl().getAsDecl()); + if (!Target || Target == ExtDecl) + return false; + + bool IsFirst = true; + if (ExtDecl->isConstrainedExtension()) { + printRequirementsFrom(ExtDecl, IsFirst); + } + if (Target->isConstrainedExtension()) { + if (auto *NTD = Target->getExtendedNominal()) { + // Update the current decl and type transform for Target rather than + // ExtDecl. + PrintOptions Adjusted = Options; + Adjusted.initForSynthesizedExtension(NTD); + llvm::SaveAndRestore TempCurrent(Current, NTD); + llvm::SaveAndRestore TempOptions(Options, Adjusted); + printRequirementsFrom(Target, IsFirst); + } + } + return true; + }; + + if (Options.BracketOptions.shouldOpenExtension(ExtDecl)) { printDocumentationComment(ExtDecl); printAttributes(ExtDecl); @@ -2189,7 +2246,25 @@ void PrintAST::printSynthesizedExtension(Type ExtendedType, printExtendedTypeName(ExtendedType, Printer, Options); printInherited(ExtDecl); - printDeclGenericRequirements(ExtDecl); + + // We may need to combine requirements from ExtDecl (which has the members + // to print) and the TransformContexts' decl if it is an enabling extension + // of the base NominalDecl (which can have its own requirements) rather than + // base NominalDecl itself (which can't). E.g: + // + // protocol Foo {} + // extension Foo where { ... } + // struct Bar {} + // extension Bar: Foo where { ... } + // + // should produce a synthesized extension of Bar with both sets of + // requirments: + // + // extension Bar where getAttrs().getAttributes()) { if (sr.isInvalid()) - sr = attr->getTypeLoc().getSourceRange(); + sr = attr->getTypeRepr()->getSourceRange(); else - sr.widen(attr->getTypeLoc().getSourceRange()); + sr.widen(attr->getTypeRepr()->getSourceRange()); } return sr; } diff --git a/lib/AST/ASTVerifier.cpp b/lib/AST/ASTVerifier.cpp index 5dcc06c745e57..20bd5fd7cc18f 100644 --- a/lib/AST/ASTVerifier.cpp +++ b/lib/AST/ASTVerifier.cpp @@ -3120,12 +3120,12 @@ class Verifier : public ASTWalker { storageDecl->getWriteImpl() == WriteImplKind::StoredWithObservers || storageDecl->getWriteImpl() == WriteImplKind::MutableAddress) && - storageDecl->isNativeDynamic()) && + storageDecl->shouldUseNativeDynamicDispatch()) && // We allow a non dynamic getter if there is a dynamic read. !(FD->isGetter() && (storageDecl->getReadImpl() == ReadImplKind::Read || storageDecl->getReadImpl() == ReadImplKind::Address) && - storageDecl->isNativeDynamic())) { + storageDecl->shouldUseNativeDynamicDispatch())) { Out << "Property and accessor do not match for 'dynamic'\n"; abort(); } diff --git a/lib/AST/ASTWalker.cpp b/lib/AST/ASTWalker.cpp index e3340143015ec..57d4cda33ff27 100644 --- a/lib/AST/ASTWalker.cpp +++ b/lib/AST/ASTWalker.cpp @@ -476,7 +476,15 @@ class Traversal : public ASTVisitorgetBase()) { + Expr *newBaseExpr = doIt(baseExpr); + if (!newBaseExpr) + return nullptr; + E->setBase(newBaseExpr); + } + return E; + } Expr *visitLiteralExpr(LiteralExpr *E) { return E; } Expr *visitDiscardAssignmentExpr(DiscardAssignmentExpr *E) { return E; } Expr *visitTypeExpr(TypeExpr *E) { @@ -815,21 +823,15 @@ class Traversal : public ASTVisitorhasSingleExpressionBody()) { - if (Expr *body = doIt(expr->getSingleExpressionBody())) { - expr->setSingleExpressionBody(body); - return expr; - } - return nullptr; - } - - if (!Walker.shouldWalkIntoNonSingleExpressionClosure(expr)) + // If the closure was separately type checked and we don't want to + // visit separately-checked closure bodies, bail out now. + if (expr->wasSeparatelyTypeChecked() && + !Walker.shouldWalkIntoSeparatelyCheckedClosure(expr)) return expr; // Handle other closures. if (BraceStmt *body = cast_or_null(doIt(expr->getBody()))) { - expr->setBody(body, false); + expr->setBody(body, expr->hasSingleExpressionBody()); return expr; } return nullptr; @@ -898,8 +900,9 @@ class Traversal : public ASTVisitorsetSubExpr(Sub); } - if (doIt(E->getCastTypeLoc())) - return nullptr; + if (auto *const tyRepr = E->getCastTypeRepr()) + if (doIt(tyRepr)) + return nullptr; return E; } @@ -1696,14 +1699,15 @@ Pattern *Traversal::visitIsPattern(IsPattern *P) { } } if (!P->isImplicit()) - if (doIt(P->getCastTypeLoc())) - return nullptr; + if (auto *TR = P->getCastTypeRepr()) + if (doIt(TR)) + return nullptr; return P; } Pattern *Traversal::visitEnumElementPattern(EnumElementPattern *P) { - if (!P->isParentTypeImplicit()) - if (doIt(P->getParentType())) + if (auto *TR = P->getParentTypeRepr()) + if (doIt(TR)) return nullptr; if (!P->hasSubPattern()) diff --git a/lib/AST/AbstractSourceFileDepGraphFactory.cpp b/lib/AST/AbstractSourceFileDepGraphFactory.cpp index 390fe06dbfcbc..6a4ccfdf78ab6 100644 --- a/lib/AST/AbstractSourceFileDepGraphFactory.cpp +++ b/lib/AST/AbstractSourceFileDepGraphFactory.cpp @@ -79,14 +79,30 @@ void AbstractSourceFileDepGraphFactory::addAUsedDecl( const DependencyKey &defKey, const DependencyKey &useKey) { auto *defNode = g.findExistingNodeOrCreateIfNew(defKey, None, false /* = !isProvides */); + // If the depended-upon node is defined in this file, then don't // create an arc to the user, when the user is the whole file. // Otherwise, if the defNode's type-body fingerprint changes, // the whole file will be marked as dirty, losing the benefit of the // fingerprint. - if (defNode->getIsProvides() && - useKey.getKind() == NodeKind::sourceFileProvide) - return; + + // if (defNode->getIsProvides() && + // useKey.getKind() == NodeKind::sourceFileProvide) + // return; + + // Turns out the above three lines cause miscompiles, so comment them out + // for now. We might want them back if we can change the inputs to this + // function to be more precise. + + // Example of a miscompile: + // In main.swift + // func foo(_: Any) { print("Hello Any") } + // foo(123) + // Then add the following line to another file: + // func foo(_: Int) { print("Hello Int") } + // Although main.swift needs to get recompiled, the commented-out code below + // prevents that. + auto nullableUse = g.findExistingNode(useKey); assert(nullableUse.isNonNull() && "Use must be an already-added provides"); auto *useNode = nullableUse.get(); diff --git a/lib/AST/Attr.cpp b/lib/AST/Attr.cpp index cf90377151b74..8173205f3d2cf 100644 --- a/lib/AST/Attr.cpp +++ b/lib/AST/Attr.cpp @@ -975,7 +975,7 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options, Printer.printAttrName("@_implements"); Printer << "("; auto *attr = cast(this); - attr->getProtocolType().getType().print(Printer, Options); + attr->getProtocolType().print(Printer, Options); Printer << ", " << attr->getMemberName() << ")"; break; } @@ -1022,11 +1022,11 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options, case DAK_Custom: { Printer.callPrintNamePre(PrintNameContext::Attribute); Printer << "@"; - const TypeLoc &typeLoc = cast(this)->getTypeLoc(); - if (auto type = typeLoc.getType()) - type->print(Printer, Options); + auto *attr = cast(this); + if (auto type = attr->getType()) + type.print(Printer, Options); else - typeLoc.getTypeRepr()->print(Printer, Options); + attr->getTypeRepr()->print(Printer, Options); Printer.printNamePost(PrintNameContext::Attribute); break; } @@ -1386,25 +1386,36 @@ SourceLoc DynamicReplacementAttr::getRParenLoc() const { TypeEraserAttr *TypeEraserAttr::create(ASTContext &ctx, SourceLoc atLoc, SourceRange range, - TypeLoc typeEraserLoc) { - return new (ctx) TypeEraserAttr(atLoc, range, typeEraserLoc, nullptr, 0); + TypeExpr *typeEraserExpr) { + return new (ctx) TypeEraserAttr(atLoc, range, typeEraserExpr, nullptr, 0); } TypeEraserAttr *TypeEraserAttr::create(ASTContext &ctx, LazyMemberLoader *Resolver, uint64_t Data) { return new (ctx) TypeEraserAttr(SourceLoc(), SourceRange(), - TypeLoc(), Resolver, Data); + nullptr, Resolver, Data); } -bool -TypeEraserAttr::hasViableTypeEraserInit(ProtocolDecl *protocol) const { +bool TypeEraserAttr::hasViableTypeEraserInit(ProtocolDecl *protocol) const { return evaluateOrDefault(protocol->getASTContext().evaluator, TypeEraserHasViableInitRequest{ const_cast(this), protocol}, false); } +TypeRepr *TypeEraserAttr::getParsedTypeEraserTypeRepr() const { + return TypeEraserExpr ? TypeEraserExpr->getTypeRepr() : nullptr; +} + +SourceLoc TypeEraserAttr::getLoc() const { + return TypeEraserExpr ? TypeEraserExpr->getLoc() : SourceLoc(); +} + +Type TypeEraserAttr::getTypeWithoutResolving() const { + return TypeEraserExpr ? TypeEraserExpr->getInstanceType() : Type(); +} + Type TypeEraserAttr::getResolvedType(const ProtocolDecl *PD) const { auto &ctx = PD->getASTContext(); return evaluateOrDefault(ctx.evaluator, @@ -1814,7 +1825,7 @@ TransposeAttr *TransposeAttr::create(ASTContext &context, bool implicit, } ImplementsAttr::ImplementsAttr(SourceLoc atLoc, SourceRange range, - TypeLoc ProtocolType, + TypeExpr *ProtocolType, DeclName MemberName, DeclNameLoc MemberNameLoc) : DeclAttribute(DAK_Implements, atLoc, range, /*Implicit=*/false), @@ -1826,7 +1837,7 @@ ImplementsAttr::ImplementsAttr(SourceLoc atLoc, SourceRange range, ImplementsAttr *ImplementsAttr::create(ASTContext &Ctx, SourceLoc atLoc, SourceRange range, - TypeLoc ProtocolType, + TypeExpr *ProtocolType, DeclName MemberName, DeclNameLoc MemberNameLoc) { void *mem = Ctx.Allocate(sizeof(ImplementsAttr), alignof(ImplementsAttr)); @@ -1834,28 +1845,34 @@ ImplementsAttr *ImplementsAttr::create(ASTContext &Ctx, SourceLoc atLoc, MemberName, MemberNameLoc); } -TypeLoc ImplementsAttr::getProtocolType() const { - return ProtocolType; +void ImplementsAttr::setProtocolType(Type ty) { + assert(ty); + ProtocolType->setType(MetatypeType::get(ty)); } -TypeLoc &ImplementsAttr::getProtocolType() { - return ProtocolType; +Type ImplementsAttr::getProtocolType() const { + return ProtocolType->getInstanceType(); } -CustomAttr::CustomAttr(SourceLoc atLoc, SourceRange range, TypeLoc type, +TypeRepr *ImplementsAttr::getProtocolTypeRepr() const { + return ProtocolType->getTypeRepr(); +} + +CustomAttr::CustomAttr(SourceLoc atLoc, SourceRange range, TypeExpr *type, PatternBindingInitializer *initContext, Expr *arg, ArrayRef argLabels, ArrayRef argLabelLocs, bool implicit) : DeclAttribute(DAK_Custom, atLoc, range, implicit), - type(type), + typeExpr(type), arg(arg), initContext(initContext) { + assert(type); hasArgLabelLocs = !argLabelLocs.empty(); numArgLabels = argLabels.size(); initializeCallArguments(argLabels, argLabelLocs); } -CustomAttr *CustomAttr::create(ASTContext &ctx, SourceLoc atLoc, TypeLoc type, +CustomAttr *CustomAttr::create(ASTContext &ctx, SourceLoc atLoc, TypeExpr *type, bool hasInitializer, PatternBindingInitializer *initContext, SourceLoc lParenLoc, @@ -1864,6 +1881,7 @@ CustomAttr *CustomAttr::create(ASTContext &ctx, SourceLoc atLoc, TypeLoc type, ArrayRef argLabelLocs, SourceLoc rParenLoc, bool implicit) { + assert(type); SmallVector argLabelsScratch; SmallVector argLabelLocsScratch; Expr *arg = nullptr; @@ -1873,7 +1891,7 @@ CustomAttr *CustomAttr::create(ASTContext &ctx, SourceLoc atLoc, TypeLoc type, argLabelsScratch, argLabelLocsScratch); } - SourceRange range(atLoc, type.getSourceRange().End); + SourceRange range(atLoc, type->getSourceRange().End); if (arg) range.End = arg->getEndLoc(); @@ -1883,6 +1901,16 @@ CustomAttr *CustomAttr::create(ASTContext &ctx, SourceLoc atLoc, TypeLoc type, argLabelLocs, implicit); } +TypeRepr *CustomAttr::getTypeRepr() const { return typeExpr->getTypeRepr(); } +Type CustomAttr::getType() const { return typeExpr->getInstanceType(); } + +void CustomAttr::resetTypeInformation(TypeExpr *info) { typeExpr = info; } + +void CustomAttr::setType(Type ty) { + assert(ty); + typeExpr->setType(MetatypeType::get(ty)); +} + void swift::simple_display(llvm::raw_ostream &out, const DeclAttribute *attr) { if (attr) attr->print(out); diff --git a/lib/AST/AutoDiff.cpp b/lib/AST/AutoDiff.cpp index c1b65191b73bb..df1376a6cc41a 100644 --- a/lib/AST/AutoDiff.cpp +++ b/lib/AST/AutoDiff.cpp @@ -98,10 +98,13 @@ DifferentiabilityWitnessFunctionKind::getAsDerivativeFunctionKind() const { } void SILAutoDiffIndices::print(llvm::raw_ostream &s) const { - s << "(source=" << source << " parameters=("; + s << "(parameters=("; interleave( parameters->getIndices(), [&s](unsigned p) { s << p; }, [&s] { s << ' '; }); + s << ") results=("; + interleave( + results->getIndices(), [&s](unsigned p) { s << p; }, [&s] { s << ' '; }); s << "))"; } @@ -111,8 +114,7 @@ void SILAutoDiffIndices::dump() const { } SILAutoDiffIndices AutoDiffConfig::getSILAutoDiffIndices() const { - assert(resultIndices->getNumIndices() == 1); - return SILAutoDiffIndices(*resultIndices->begin(), parameterIndices); + return SILAutoDiffIndices(parameterIndices, resultIndices); } void AutoDiffConfig::print(llvm::raw_ostream &s) const { diff --git a/lib/AST/CMakeLists.txt b/lib/AST/CMakeLists.txt index bc655a43df383..26d74feb33012 100644 --- a/lib/AST/CMakeLists.txt +++ b/lib/AST/CMakeLists.txt @@ -45,6 +45,7 @@ add_swift_host_library(swiftAST STATIC Evaluator.cpp Expr.cpp FineGrainedDependencies.cpp + FineGrainedDependencyFormat.cpp FrontendSourceFileDepGraphFactory.cpp GenericEnvironment.cpp GenericSignature.cpp diff --git a/lib/AST/ConformanceLookupTable.h b/lib/AST/ConformanceLookupTable.h index a27c89f03e063..c6843b32dabe1 100644 --- a/lib/AST/ConformanceLookupTable.h +++ b/lib/AST/ConformanceLookupTable.h @@ -21,7 +21,6 @@ #define SWIFT_AST_CONFORMANCE_LOOKUP_TABLE_H #include "swift/AST/DeclContext.h" -#include "swift/AST/TypeLoc.h" #include "swift/Basic/Debug.h" #include "swift/Basic/LLVM.h" #include "swift/Basic/SourceLoc.h" diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 19fb3aca7c390..81706cee2a48b 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -44,7 +44,7 @@ #include "swift/AST/TypeCheckRequests.h" #include "swift/AST/TypeLoc.h" #include "swift/AST/SwiftNameTranslation.h" -#include "swift/Parse/Lexer.h" +#include "swift/Parse/Lexer.h" // FIXME: Bad dependency #include "clang/Lex/MacroInfo.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallSet.h" @@ -738,9 +738,6 @@ bool Decl::hasUnderscoredNaming() const { } if (const auto PD = dyn_cast(D)) { - if (PD->getAttrs().hasAttribute()) { - return false; - } StringRef NameStr = PD->getNameStr(); if (NameStr.startswith("_Builtin")) { return true; @@ -797,6 +794,10 @@ bool Decl::isPrivateStdlibDecl(bool treatNonBuiltinProtocolsAsPublic) const { return false; } + if (D->getAttrs().hasAttribute()) { + return false; + } + return hasUnderscoredNaming(); } @@ -1859,7 +1860,7 @@ bool PatternBindingDecl::isDefaultInitializable(unsigned i) const { // If the pattern is typed as optional (or tuples thereof), it is // default initializable. if (const auto typedPattern = dyn_cast(entry.getPattern())) { - if (const auto typeRepr = typedPattern->getTypeLoc().getTypeRepr()) { + if (const auto typeRepr = typedPattern->getTypeRepr()) { if (::isDefaultInitializable(typeRepr, ctx)) return true; } else if (typedPattern->isImplicit()) { @@ -1869,11 +1870,15 @@ bool PatternBindingDecl::isDefaultInitializable(unsigned i) const { // // All lazy storage is implicitly default initializable, though, because // lazy backing storage is optional. - if (const auto *varDecl = typedPattern->getSingleVar()) + if (const auto *varDecl = typedPattern->getSingleVar()) { // Lazy storage is never user accessible. - if (!varDecl->isUserAccessible()) - if (typedPattern->getTypeLoc().getType()->getOptionalObjectType()) + if (!varDecl->isUserAccessible()) { + if (typedPattern->hasType() && + typedPattern->getType()->getOptionalObjectType()) { return true; + } + } + } } } @@ -1912,7 +1917,7 @@ SourceRange IfConfigDecl::getSourceRange() const { } static bool isPolymorphic(const AbstractStorageDecl *storage) { - if (storage->isObjCDynamic()) + if (storage->shouldUseObjCDispatch()) return true; @@ -2063,7 +2068,7 @@ getDirectReadWriteAccessStrategy(const AbstractStorageDecl *storage) { return AccessStrategy::getStorage(); case ReadWriteImplKind::Stored: { // If the storage isDynamic (and not @objc) use the accessors. - if (storage->isNativeDynamic()) + if (storage->shouldUseNativeDynamicDispatch()) return AccessStrategy::getMaterializeToTemporary( getOpaqueReadAccessStrategy(storage, false), getOpaqueWriteAccessStrategy(storage, false)); @@ -2148,7 +2153,7 @@ AbstractStorageDecl::getAccessStrategy(AccessSemantics semantics, if (isPolymorphic(this)) return getOpaqueAccessStrategy(this, accessKind, /*dispatch*/ true); - if (isNativeDynamic()) + if (shouldUseNativeDynamicDispatch()) return getOpaqueAccessStrategy(this, accessKind, /*dispatch*/ false); // If the storage is resilient from the given module and resilience @@ -2840,7 +2845,7 @@ OpaqueReturnTypeRepr *ValueDecl::getOpaqueResultTypeRepr() const { assert(NP->getDecl() == VD); (void) NP; - returnRepr = TP->getTypeLoc().getTypeRepr(); + returnRepr = TP->getTypeRepr(); } } } else { @@ -2906,6 +2911,59 @@ bool ValueDecl::isDynamic() const { getAttrs().hasAttribute()); } +bool ValueDecl::isObjCDynamicInGenericClass() const { + if (!isObjCDynamic()) + return false; + + auto *DC = this->getDeclContext(); + auto *classDecl = DC->getSelfClassDecl(); + if (!classDecl) + return false; + + return classDecl->isGenericContext() && !classDecl->usesObjCGenericsModel(); +} + +bool ValueDecl::shouldUseObjCMethodReplacement() const { + if (isNativeDynamic()) + return false; + + if (getModuleContext()->isImplicitDynamicEnabled() && + isObjCDynamicInGenericClass()) + return false; + + return isObjCDynamic(); +} + +bool ValueDecl::shouldUseNativeMethodReplacement() const { + if (isNativeDynamic()) + return true; + + if (!isObjCDynamicInGenericClass()) + return false; + + auto *replacedDecl = getDynamicallyReplacedDecl(); + if (replacedDecl) + return false; + + return getModuleContext()->isImplicitDynamicEnabled(); +} + +bool ValueDecl::isNativeMethodReplacement() const { + // Is this a @_dynamicReplacement(for:) that use the native dynamic function + // replacement mechanism. + auto *replacedDecl = getDynamicallyReplacedDecl(); + if (!replacedDecl) + return false; + + if (isNativeDynamic()) + return true; + + if (isObjCDynamicInGenericClass()) + return replacedDecl->getModuleContext()->isImplicitDynamicEnabled(); + + return false; +} + void ValueDecl::setIsDynamic(bool value) { assert(!LazySemanticInfo.isDynamicComputed || LazySemanticInfo.isDynamic == value); @@ -5132,7 +5190,7 @@ bool AbstractStorageDecl::hasDidSetOrWillSetDynamicReplacement() const { bool AbstractStorageDecl::hasAnyNativeDynamicAccessors() const { for (auto accessor : getAllAccessors()) { - if (accessor->isNativeDynamic()) + if (accessor->shouldUseNativeDynamicDispatch()) return true; } return false; @@ -5532,7 +5590,7 @@ SourceRange VarDecl::getTypeSourceRangeForDiagnostics() const { if (auto *VP = dyn_cast(Pat)) Pat = VP->getSubPattern(); if (auto *TP = dyn_cast(Pat)) - if (auto typeRepr = TP->getTypeLoc().getTypeRepr()) + if (auto typeRepr = TP->getTypeRepr()) return typeRepr->getSourceRange(); return SourceRange(); @@ -6457,7 +6515,7 @@ ParamDecl::getDefaultValueStringRepresentation( if (wrapperAttrs.size() > 0) { auto attr = wrapperAttrs.front(); if (auto arg = attr->getArg()) { - SourceRange fullRange(attr->getTypeLoc().getSourceRange().Start, + SourceRange fullRange(attr->getTypeRepr()->getSourceRange().Start, arg->getEndLoc()); auto charRange = Lexer::getCharSourceRangeFromSourceRange( getASTContext().SourceMgr, fullRange); diff --git a/lib/AST/Evaluator.cpp b/lib/AST/Evaluator.cpp index 785b0d99ff277..9977642e66cbb 100644 --- a/lib/AST/Evaluator.cpp +++ b/lib/AST/Evaluator.cpp @@ -65,11 +65,11 @@ void Evaluator::registerRequestFunctions( static evaluator::DependencyRecorder::Mode computeDependencyModeFromFlags(const LangOptions &opts) { using Mode = evaluator::DependencyRecorder::Mode; - if (opts.EnableExperientalPrivateIntransitiveDependencies) { - return Mode::ExperimentalPrivateDependencies; + if (opts.DirectIntramoduleDependencies) { + return Mode::DirectDependencies; } - return Mode::StatusQuo; + return Mode::LegacyCascadingDependencies; } Evaluator::Evaluator(DiagnosticEngine &diags, const LangOptions &opts) @@ -391,8 +391,7 @@ void evaluator::DependencyRecorder::realize( void evaluator::DependencyCollector::addUsedMember(NominalTypeDecl *subject, DeclBaseName name) { - if (parent.mode == - DependencyRecorder::Mode::ExperimentalPrivateDependencies) { + if (parent.mode == DependencyRecorder::Mode::DirectDependencies) { scratch.insert( Reference::usedMember(subject, name, parent.isActiveSourceCascading())); } @@ -402,8 +401,7 @@ void evaluator::DependencyCollector::addUsedMember(NominalTypeDecl *subject, void evaluator::DependencyCollector::addPotentialMember( NominalTypeDecl *subject) { - if (parent.mode == - DependencyRecorder::Mode::ExperimentalPrivateDependencies) { + if (parent.mode == DependencyRecorder::Mode::DirectDependencies) { scratch.insert( Reference::potentialMember(subject, parent.isActiveSourceCascading())); } @@ -412,8 +410,7 @@ void evaluator::DependencyCollector::addPotentialMember( } void evaluator::DependencyCollector::addTopLevelName(DeclBaseName name) { - if (parent.mode == - DependencyRecorder::Mode::ExperimentalPrivateDependencies) { + if (parent.mode == DependencyRecorder::Mode::DirectDependencies) { scratch.insert(Reference::topLevel(name, parent.isActiveSourceCascading())); } return parent.realize( @@ -421,8 +418,7 @@ void evaluator::DependencyCollector::addTopLevelName(DeclBaseName name) { } void evaluator::DependencyCollector::addDynamicLookupName(DeclBaseName name) { - if (parent.mode == - DependencyRecorder::Mode::ExperimentalPrivateDependencies) { + if (parent.mode == DependencyRecorder::Mode::DirectDependencies) { scratch.insert(Reference::dynamic(name, parent.isActiveSourceCascading())); } return parent.realize( @@ -446,27 +442,20 @@ void evaluator::DependencyRecorder::record( return; } - assert(mode != Mode::StatusQuo); - for (const auto &request : stack) { - if (!request.isCached()) { - continue; - } - - auto entry = requestReferences.find_as(request); - if (entry == requestReferences.end()) { - requestReferences.insert({AnyRequest(request), collector.scratch}); - continue; - } - - entry->second.insert(collector.scratch.begin(), collector.scratch.end()); - } + return unionNearestCachedRequest(stack.getArrayRef(), collector.scratch); } -void evaluator::DependencyRecorder::replay(const swift::ActiveRequest &req) { +void evaluator::DependencyRecorder::replay( + const llvm::SetVector &stack, + const swift::ActiveRequest &req) { assert(!isRecording && "Probably not a good idea to allow nested recording"); auto *source = getActiveDependencySourceOrNull(); - if (mode == Mode::StatusQuo || !source || !source->isPrimary()) { + if (mode == Mode::LegacyCascadingDependencies) { + return; + } + + if (!source || !source->isPrimary()) { return; } @@ -482,6 +471,51 @@ void evaluator::DependencyRecorder::replay(const swift::ActiveRequest &req) { for (const auto &ref : entry->second) { realize(ref); } + + // N.B. This is a particularly subtle detail of the replay unioning step. The + // evaluator does not push cached requests onto the active request stack, + // so it is possible (and, in fact, quite likely) we'll wind up with an + // empty request stack. The remaining troublesome case is when we have a + // cached request being run through the uncached path - take the + // InterfaceTypeRequest, which involves many component requests, most of which + // are themselves cached. In such a case, the active stack will look like + // + // -> TypeCheckSourceFileRequest + // -> ... + // -> InterfaceTypeRequest + // -> ... + // -> UnderlyingTypeRequest + // + // We want the UnderlyingTypeRequest to union its names into the + // InterfaceTypeRequest, and if we were to just start searching the active + // stack backwards for a cached request we would find... + // the UnderlyingTypeRequest! So, we'll just drop it from consideration. + // + // We do *not* have to consider this during the recording step because none + // of the name lookup requests (or any dependency sinks in general) are + // cached. Should this change in the future, we will need to sink this logic + // into the union step itself. + const size_t d = (!stack.empty() && req == stack.back()) ? 1 : 0; + return unionNearestCachedRequest(stack.getArrayRef().drop_back(d), + entry->second); +} + +void evaluator::DependencyRecorder::unionNearestCachedRequest( + ArrayRef stack, + const DependencyCollector::ReferenceSet &scratch) { + assert(mode != Mode::LegacyCascadingDependencies); + auto nearest = std::find_if(stack.rbegin(), stack.rend(), + [](const auto &req){ return req.isCached(); }); + if (nearest == stack.rend()) { + return; + } + + auto entry = requestReferences.find_as(*nearest); + if (entry == requestReferences.end()) { + requestReferences.insert({AnyRequest(*nearest), scratch}); + } else { + entry->second.insert(scratch.begin(), scratch.end()); + } } using namespace swift; diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 34d70a3ad815c..da1abe0e0b28f 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1770,6 +1770,82 @@ Expr *CallExpr::getDirectCallee() const { } } +void ExplicitCastExpr::setCastType(Type type) { + CastTy->setType(MetatypeType::get(type)); +} + +ForcedCheckedCastExpr *ForcedCheckedCastExpr::create(ASTContext &ctx, + SourceLoc asLoc, + SourceLoc exclaimLoc, + TypeRepr *tyRepr) { + return new (ctx) ForcedCheckedCastExpr(nullptr, asLoc, exclaimLoc, + new (ctx) TypeExpr(tyRepr)); +} + +ForcedCheckedCastExpr * +ForcedCheckedCastExpr::createImplicit(ASTContext &ctx, Expr *sub, Type castTy) { + auto *const expr = new (ctx) ForcedCheckedCastExpr( + sub, SourceLoc(), SourceLoc(), TypeExpr::createImplicit(castTy, ctx)); + expr->setType(castTy); + expr->setImplicit(); + return expr; +} + +ConditionalCheckedCastExpr * +ConditionalCheckedCastExpr::create(ASTContext &ctx, SourceLoc asLoc, + SourceLoc questionLoc, TypeRepr *tyRepr) { + return new (ctx) ConditionalCheckedCastExpr(nullptr, asLoc, questionLoc, + new (ctx) TypeExpr(tyRepr)); +} + +ConditionalCheckedCastExpr * +ConditionalCheckedCastExpr::createImplicit(ASTContext &ctx, Expr *sub, + Type castTy) { + auto *const expr = new (ctx) ConditionalCheckedCastExpr( + sub, SourceLoc(), SourceLoc(), TypeExpr::createImplicit(castTy, ctx)); + expr->setType(OptionalType::get(castTy)); + expr->setImplicit(); + return expr; +} + +ConditionalCheckedCastExpr * +ConditionalCheckedCastExpr::createImplicit(ASTContext &ctx, Expr *sub, + TypeRepr *tyRepr, Type castTy) { + auto *const expr = new (ctx) ConditionalCheckedCastExpr( + sub, SourceLoc(), SourceLoc(), new (ctx) TypeExpr(tyRepr)); + expr->setType(OptionalType::get(castTy)); + expr->setImplicit(); + expr->setCastType(castTy); + return expr; +} + +IsExpr *IsExpr::create(ASTContext &ctx, SourceLoc isLoc, TypeRepr *tyRepr) { + return new (ctx) IsExpr(nullptr, isLoc, new (ctx) TypeExpr(tyRepr)); +} + +CoerceExpr *CoerceExpr::create(ASTContext &ctx, SourceLoc asLoc, + TypeRepr *tyRepr) { + return new (ctx) CoerceExpr(nullptr, asLoc, new (ctx) TypeExpr(tyRepr)); +} + +CoerceExpr *CoerceExpr::createImplicit(ASTContext &ctx, Expr *sub, + Type castTy) { + auto *const expr = new (ctx) + CoerceExpr(sub, SourceLoc(), TypeExpr::createImplicit(castTy, ctx)); + expr->setType(castTy); + expr->setImplicit(); + return expr; +} + +CoerceExpr *CoerceExpr::forLiteralInit(ASTContext &ctx, Expr *literal, + SourceRange range, + TypeRepr *literalTyRepr) { + auto *const expr = + new (ctx) CoerceExpr(range, literal, new (ctx) TypeExpr(literalTyRepr)); + expr->setImplicit(); + return expr; +} + RebindSelfInConstructorExpr::RebindSelfInConstructorExpr(Expr *SubExpr, VarDecl *Self) : Expr(ExprKind::RebindSelfInConstructor, /*Implicit=*/true, @@ -1898,19 +1974,6 @@ Expr *ClosureExpr::getSingleExpressionBody() const { return body.get(); } -void ClosureExpr::setSingleExpressionBody(Expr *NewBody) { - assert(hasSingleExpressionBody() && "Not a single-expression body"); - auto body = getBody()->getFirstElement(); - if (auto stmt = body.dyn_cast()) { - if (auto braceStmt = dyn_cast(stmt)) - braceStmt->getFirstElement() = NewBody; - else - cast(stmt)->setResult(NewBody); - return; - } - getBody()->setFirstElement(NewBody); -} - bool ClosureExpr::hasEmptyBody() const { return getBody()->empty(); } @@ -1923,7 +1986,7 @@ bool ClosureExpr::capturesSelfEnablingImplictSelf() const { void ClosureExpr::setExplicitResultType(Type ty) { assert(ty && !ty->hasTypeVariable()); - ExplicitResultTypeAndEnclosingChecked.getPointer() + ExplicitResultTypeAndSeparatelyChecked.getPointer() ->setType(MetatypeType::get(ty)); } diff --git a/lib/AST/FineGrainedDependencies.cpp b/lib/AST/FineGrainedDependencies.cpp index b3f9c752b0e80..4a0c99bbfcd3c 100644 --- a/lib/AST/FineGrainedDependencies.cpp +++ b/lib/AST/FineGrainedDependencies.cpp @@ -10,8 +10,6 @@ // //===----------------------------------------------------------------------===// -#include - #include "swift/AST/FineGrainedDependencies.h" // may not all be needed @@ -19,6 +17,7 @@ #include "swift/AST/DiagnosticsCommon.h" #include "swift/AST/DiagnosticsFrontend.h" #include "swift/AST/FileSystem.h" +#include "swift/AST/FineGrainedDependencyFormat.h" #include "swift/Basic/FileSystem.h" #include "swift/Basic/LLVM.h" #include "swift/Demangling/Demangle.h" @@ -31,6 +30,7 @@ #include "llvm/Support/Path.h" #include "llvm/Support/YAMLParser.h" + // This file holds the definitions for the fine-grained dependency system // that are likely to be stable as it moves away from the status quo. // These include the graph structures common to both programs and also @@ -53,11 +53,9 @@ Optional SourceFileDepGraph::loadFromPath(StringRef path) { Optional SourceFileDepGraph::loadFromBuffer(llvm::MemoryBuffer &buffer) { SourceFileDepGraph fg; - llvm::yaml::Input yamlReader(llvm::MemoryBufferRef(buffer), nullptr); - yamlReader >> fg; - if (yamlReader.error()) + if (swift::fine_grained_dependencies::readFineGrainedDependencyGraph( + buffer, fg)) return None; - // return fg; compiles for Mac but not Linux, because it cannot be copied. return Optional(std::move(fg)); } @@ -333,6 +331,19 @@ void DepGraphNode::dump(raw_ostream &os) const { llvm::errs() << "no fingerprint"; } +void SourceFileDepGraphNode::dump() const { + dump(llvm::errs()); +} + +void SourceFileDepGraphNode::dump(raw_ostream &os) const { + DepGraphNode::dump(os); + os << " sequence number: " << sequenceNumber; + os << " is provides: " << isProvides; + os << " depends on:"; + for (auto def : defsIDependUpon) + os << " " << def; +} + std::string DepGraphNode::humanReadableName(StringRef where) const { return getKey().humanReadableName() + diff --git a/lib/AST/FineGrainedDependencyFormat.cpp b/lib/AST/FineGrainedDependencyFormat.cpp new file mode 100644 index 0000000000000..b52cc2af98baf --- /dev/null +++ b/lib/AST/FineGrainedDependencyFormat.cpp @@ -0,0 +1,486 @@ +//===---- FineGrainedDependencyFormat.cpp - reading and writing swiftdeps -===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +#include "swift/AST/FileSystem.h" +#include "swift/AST/FineGrainedDependencies.h" +#include "swift/AST/FineGrainedDependencyFormat.h" +#include "swift/Basic/PrettyStackTrace.h" +#include "swift/Basic/Version.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/Bitstream/BitstreamReader.h" +#include "llvm/Bitstream/BitstreamWriter.h" +#include "llvm/Support/Allocator.h" +#include "llvm/Support/MemoryBuffer.h" + +using namespace swift; +using namespace fine_grained_dependencies; + +namespace { + +class Deserializer { + std::vector Identifiers; + + llvm::BitstreamCursor Cursor; + + SmallVector Scratch; + StringRef BlobData; + + // These all return true if there was an error. + bool readSignature(); + bool enterTopLevelBlock(); + bool readMetadata(); + + llvm::Optional getIdentifier(unsigned n); + +public: + Deserializer(llvm::MemoryBufferRef Data) : Cursor(Data) {} + bool readFineGrainedDependencyGraph(SourceFileDepGraph &g); +}; + +} // end namespace + +bool Deserializer::readSignature() { + for (unsigned char byte : FINE_GRAINED_DEPDENENCY_FORMAT_SIGNATURE) { + if (Cursor.AtEndOfStream()) + return true; + if (auto maybeRead = Cursor.Read(8)) { + if (maybeRead.get() != byte) + return true; + } else { + return true; + } + } + return false; +} + +bool Deserializer::enterTopLevelBlock() { + // Read the BLOCKINFO_BLOCK, which contains metadata used when dumping + // the binary data with llvm-bcanalyzer. + { + auto next = Cursor.advance(); + if (!next) { + consumeError(next.takeError()); + return true; + } + + if (next->Kind != llvm::BitstreamEntry::SubBlock) + return true; + + if (next->ID != llvm::bitc::BLOCKINFO_BLOCK_ID) + return true; + + if (!Cursor.ReadBlockInfoBlock()) + return true; + } + + // Enters our subblock, which contains the actual dependency information. + { + auto next = Cursor.advance(); + if (!next) { + consumeError(next.takeError()); + return true; + } + + if (next->Kind != llvm::BitstreamEntry::SubBlock) + return true; + + if (next->ID != RECORD_BLOCK_ID) + return true; + + if (auto err = Cursor.EnterSubBlock(RECORD_BLOCK_ID)) { + consumeError(std::move(err)); + return true; + } + } + + return false; +} + +bool Deserializer::readMetadata() { + using namespace record_block; + + auto entry = Cursor.advance(); + if (!entry) { + consumeError(entry.takeError()); + return true; + } + + if (entry->Kind != llvm::BitstreamEntry::Record) + return true; + + auto recordID = Cursor.readRecord(entry->ID, Scratch, &BlobData); + if (!recordID) { + consumeError(recordID.takeError()); + return true; + } + + if (*recordID != METADATA) + return true; + + unsigned majorVersion, minorVersion; + + MetadataLayout::readRecord(Scratch, majorVersion, minorVersion); + if (majorVersion != FINE_GRAINED_DEPENDENCY_FORMAT_VERSION_MAJOR || + minorVersion != FINE_GRAINED_DEPENDENCY_FORMAT_VERSION_MINOR) { + return true; + } + + return false; +} + +static llvm::Optional getNodeKind(unsigned nodeKind) { + if (nodeKind < unsigned(NodeKind::kindCount)) + return NodeKind(nodeKind); + return None; +} + +static llvm::Optional getDeclAspect(unsigned declAspect) { + if (declAspect < unsigned(DeclAspect::aspectCount)) + return DeclAspect(declAspect); + return None; +} + +bool Deserializer::readFineGrainedDependencyGraph(SourceFileDepGraph &g) { + using namespace record_block; + + if (readSignature()) + return true; + + if (enterTopLevelBlock()) + return true; + + if (readMetadata()) + return true; + + SourceFileDepGraphNode *node = nullptr; + size_t sequenceNumber = 0; + + while (!Cursor.AtEndOfStream()) { + auto entry = cantFail(Cursor.advance(), "Advance bitstream cursor"); + + if (entry.Kind == llvm::BitstreamEntry::EndBlock) { + Cursor.ReadBlockEnd(); + assert(Cursor.GetCurrentBitNo() % CHAR_BIT == 0); + break; + } + + if (entry.Kind != llvm::BitstreamEntry::Record) + llvm::report_fatal_error("Bad bitstream entry kind"); + + Scratch.clear(); + unsigned recordID = cantFail( + Cursor.readRecord(entry.ID, Scratch, &BlobData), + "Read bitstream record"); + + switch (recordID) { + case METADATA: { + // METADATA must appear at the beginning and is handled by readMetadata(). + llvm::report_fatal_error("Unexpected METADATA record"); + break; + } + + case SOURCE_FILE_DEP_GRAPH_NODE: { + unsigned nodeKindID, declAspectID, contextID, nameID, isProvides; + SourceFileDepGraphNodeLayout::readRecord(Scratch, nodeKindID, declAspectID, + contextID, nameID, isProvides); + node = new SourceFileDepGraphNode(); + node->setSequenceNumber(sequenceNumber++); + g.addNode(node); + + auto nodeKind = getNodeKind(nodeKindID); + if (!nodeKind) + llvm::report_fatal_error("Bad node kind"); + auto declAspect = getDeclAspect(declAspectID); + if (!declAspect) + llvm::report_fatal_error("Bad decl aspect"); + auto context = getIdentifier(contextID); + if (!context) + llvm::report_fatal_error("Bad context"); + auto name = getIdentifier(nameID); + if (!name) + llvm::report_fatal_error("Bad identifier"); + + node->setKey(DependencyKey(*nodeKind, *declAspect, *context, *name)); + if (isProvides) + node->setIsProvides(); + break; + } + + case FINGERPRINT_NODE: { + // FINGERPRINT_NODE must follow a SOURCE_FILE_DEP_GRAPH_NODE. + if (node == nullptr) + llvm::report_fatal_error("Unexpected FINGERPRINT_NODE record"); + + node->setFingerprint(BlobData); + break; + } + + case DEPENDS_ON_DEFINITION_NODE: { + // DEPENDS_ON_DEFINITION_NODE must follow a SOURCE_FILE_DEP_GRAPH_NODE. + if (node == nullptr) + llvm::report_fatal_error("Unexpected DEPENDS_ON_DEFINITION_NODE record"); + + unsigned dependsOnDefID; + DependsOnDefNodeLayout::readRecord(Scratch, dependsOnDefID); + + node->addDefIDependUpon(dependsOnDefID); + break; + } + + case IDENTIFIER_NODE: { + // IDENTIFIER_NODE must come before SOURCE_FILE_DEP_GRAPH_NODE. + if (node != nullptr) + llvm::report_fatal_error("Unexpected IDENTIFIER_NODE record"); + + IdentifierNodeLayout::readRecord(Scratch); + Identifiers.push_back(BlobData.str()); + break; + } + + default: { + llvm::report_fatal_error("Unknown record ID"); + } + } + } + + return false; +} + +bool swift::fine_grained_dependencies::readFineGrainedDependencyGraph( + llvm::MemoryBuffer &buffer, SourceFileDepGraph &g) { + Deserializer deserializer(buffer.getMemBufferRef()); + return deserializer.readFineGrainedDependencyGraph(g); +} + +bool swift::fine_grained_dependencies::readFineGrainedDependencyGraph( + StringRef path, SourceFileDepGraph &g) { + auto buffer = llvm::MemoryBuffer::getFile(path); + if (!buffer) + return false; + + return readFineGrainedDependencyGraph(*buffer.get(), g); +} + +llvm::Optional Deserializer::getIdentifier(unsigned n) { + if (n == 0) + return std::string(); + + --n; + if (n >= Identifiers.size()) + return None; + + return Identifiers[n]; +} + +namespace { + +class Serializer { + llvm::StringMap IdentifierIDs; + unsigned LastIdentifierID = 0; + std::vector IdentifiersToWrite; + + SmallVector Buffer; + llvm::BitstreamWriter Out{Buffer}; + + /// A reusable buffer for emitting records. + SmallVector ScratchRecord; + + std::array AbbrCodes; + + void writeFineGrainedDependencyGraph(const SourceFileDepGraph &g); + + void addIdentifier(StringRef str); + unsigned getIdentifier(StringRef str); + + template + void registerRecordAbbr() { + using AbbrArrayTy = decltype(AbbrCodes); + static_assert(Layout::Code <= std::tuple_size::value, + "layout has invalid record code"); + AbbrCodes[Layout::Code] = Layout::emitAbbrev(Out); + } + + void emitBlockID(unsigned ID, StringRef name, + SmallVectorImpl &nameBuffer); + + void emitRecordID(unsigned ID, StringRef name, + SmallVectorImpl &nameBuffer); + + void writeSignature(); + void writeBlockInfoBlock(); + void writeMetadata(); + +public: + void writeFineGrainedDependencyGraph(llvm::raw_ostream &os, + const SourceFileDepGraph &g); +}; + +} // end namespace + +/// Record the name of a block. +void Serializer::emitBlockID(unsigned ID, StringRef name, + SmallVectorImpl &nameBuffer) { + SmallVector idBuffer; + idBuffer.push_back(ID); + Out.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETBID, idBuffer); + + // Emit the block name if present. + if (name.empty()) + return; + nameBuffer.resize(name.size()); + memcpy(nameBuffer.data(), name.data(), name.size()); + Out.EmitRecord(llvm::bitc::BLOCKINFO_CODE_BLOCKNAME, nameBuffer); +} + +void Serializer::emitRecordID(unsigned ID, StringRef name, + SmallVectorImpl &nameBuffer) { + assert(ID < 256 && "can't fit record ID in next to name"); + nameBuffer.resize(name.size()+1); + nameBuffer[0] = ID; + memcpy(nameBuffer.data()+1, name.data(), name.size()); + Out.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETRECORDNAME, nameBuffer); +} + +void Serializer::writeSignature() { + for (auto c : FINE_GRAINED_DEPDENENCY_FORMAT_SIGNATURE) + Out.Emit((unsigned) c, 8); +} + +void Serializer::writeBlockInfoBlock() { + llvm::BCBlockRAII restoreBlock(Out, llvm::bitc::BLOCKINFO_BLOCK_ID, 2); + + SmallVector nameBuffer; +#define BLOCK(X) emitBlockID(X ## _ID, #X, nameBuffer) +#define BLOCK_RECORD(K, X) emitRecordID(K::X, #X, nameBuffer) + + BLOCK(RECORD_BLOCK); + BLOCK_RECORD(record_block, METADATA); + BLOCK_RECORD(record_block, SOURCE_FILE_DEP_GRAPH_NODE); + BLOCK_RECORD(record_block, FINGERPRINT_NODE); + BLOCK_RECORD(record_block, DEPENDS_ON_DEFINITION_NODE); + BLOCK_RECORD(record_block, IDENTIFIER_NODE); +} + +void Serializer::writeMetadata() { + using namespace record_block; + + MetadataLayout::emitRecord(Out, ScratchRecord, + AbbrCodes[MetadataLayout::Code], + FINE_GRAINED_DEPENDENCY_FORMAT_VERSION_MAJOR, + FINE_GRAINED_DEPENDENCY_FORMAT_VERSION_MINOR, + version::getSwiftFullVersion()); +} + +void +Serializer::writeFineGrainedDependencyGraph(const SourceFileDepGraph &g) { + writeSignature(); + writeBlockInfoBlock(); + + llvm::BCBlockRAII restoreBlock(Out, RECORD_BLOCK_ID, 8); + + using namespace record_block; + + registerRecordAbbr(); + registerRecordAbbr(); + registerRecordAbbr(); + registerRecordAbbr(); + registerRecordAbbr(); + + writeMetadata(); + + // Make a pass to collect all unique strings + g.forEachNode([&](SourceFileDepGraphNode *node) { + addIdentifier(node->getKey().getContext()); + addIdentifier(node->getKey().getName()); + }); + + // Write the strings + for (auto str : IdentifiersToWrite) { + IdentifierNodeLayout::emitRecord(Out, ScratchRecord, + AbbrCodes[IdentifierNodeLayout::Code], + str); + } + + size_t sequenceNumber = 0; + + // Now write each graph node + g.forEachNode([&](SourceFileDepGraphNode *node) { + SourceFileDepGraphNodeLayout::emitRecord(Out, ScratchRecord, + AbbrCodes[SourceFileDepGraphNodeLayout::Code], + unsigned(node->getKey().getKind()), + unsigned(node->getKey().getAspect()), + getIdentifier(node->getKey().getContext()), + getIdentifier(node->getKey().getName()), + node->getIsProvides() ? 1 : 0); + assert(sequenceNumber == node->getSequenceNumber()); + sequenceNumber++; + (void) sequenceNumber; + + if (auto fingerprint = node->getFingerprint()) { + FingerprintNodeLayout::emitRecord(Out, ScratchRecord, + AbbrCodes[FingerprintNodeLayout::Code], + *fingerprint); + } + + node->forEachDefIDependUpon([&](size_t defIDependOn) { + DependsOnDefNodeLayout::emitRecord(Out, ScratchRecord, + AbbrCodes[DependsOnDefNodeLayout::Code], + defIDependOn); + }); + }); +} + +void Serializer::addIdentifier(StringRef str) { + if (str.empty()) + return; + + decltype(IdentifierIDs)::iterator iter; + bool isNew; + std::tie(iter, isNew) = + IdentifierIDs.insert({str, LastIdentifierID + 1}); + + if (!isNew) + return; + + ++LastIdentifierID; + // Note that we use the string data stored in the StringMap. + IdentifiersToWrite.push_back(iter->getKey()); +} + +unsigned Serializer::getIdentifier(StringRef str) { + if (str.empty()) + return 0; + + auto iter = IdentifierIDs.find(str); + assert(iter != IdentifierIDs.end()); + assert(iter->second != 0); + return iter->second; +} + +void Serializer::writeFineGrainedDependencyGraph(llvm::raw_ostream &os, + const SourceFileDepGraph &g) { + writeFineGrainedDependencyGraph(g); + os.write(Buffer.data(), Buffer.size()); + os.flush(); +} + +bool swift::fine_grained_dependencies::writeFineGrainedDependencyGraph( + DiagnosticEngine &diags, StringRef path, + const SourceFileDepGraph &g) { + PrettyStackTraceStringAction stackTrace("saving fine-grained dependency graph", path); + return withOutputFile(diags, path, [&](llvm::raw_ostream &out) { + Serializer serializer; + serializer.writeFineGrainedDependencyGraph(out, g); + return false; + }); +} \ No newline at end of file diff --git a/lib/AST/FrontendSourceFileDepGraphFactory.cpp b/lib/AST/FrontendSourceFileDepGraphFactory.cpp index fb87b49304026..3f690852197f5 100644 --- a/lib/AST/FrontendSourceFileDepGraphFactory.cpp +++ b/lib/AST/FrontendSourceFileDepGraphFactory.cpp @@ -27,6 +27,7 @@ #include "swift/AST/ExistentialLayout.h" #include "swift/AST/FileSystem.h" #include "swift/AST/FineGrainedDependencies.h" +#include "swift/AST/FineGrainedDependencyFormat.h" #include "swift/AST/Module.h" #include "swift/AST/ModuleLoader.h" #include "swift/AST/NameLookup.h" @@ -291,13 +292,7 @@ bool fine_grained_dependencies::emitReferenceDependencies( SF, outputPath, depTracker, alsoEmitDotFile) .construct(); - const bool hadError = - withOutputFile(diags, outputPath, [&](llvm::raw_pwrite_stream &out) { - out << g.yamlProlog(SF->getASTContext().hadError()); - llvm::yaml::Output yamlWriter(out); - yamlWriter << g; - return false; - }); + bool hadError = writeFineGrainedDependencyGraph(diags, outputPath, g); // If path is stdout, cannot read it back, so check for "-" assert(outputPath == "-" || g.verifyReadsWhatIsWritten(outputPath)); diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp index 41c4ac32330e0..874cdbdedd57c 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -1077,24 +1077,23 @@ LookupConformanceInModuleRequest::evaluate( return ProtocolConformanceRef(conformance); } -struct SourceFile::SourceFileSyntaxInfo { - const bool Enable; - /// The root of the syntax tree representing the source file. - Optional SyntaxRoot; - SourceFileSyntaxInfo(bool Enable): Enable(Enable) {} -}; - -bool SourceFile::hasSyntaxRoot() const { - return SyntaxInfo->SyntaxRoot.hasValue(); +void SourceFile::getInterfaceHash(llvm::SmallString<32> &str) const { + assert(hasInterfaceHash() && "Interface hash not enabled"); + auto &eval = getASTContext().evaluator; + auto *mutableThis = const_cast(this); + auto md5 = *evaluateOrDefault(eval, ParseSourceFileRequest{mutableThis}, {}) + .InterfaceHash; + llvm::MD5::MD5Result result; + md5.final(result); + llvm::MD5::stringifyResult(result, str); } syntax::SourceFileSyntax SourceFile::getSyntaxRoot() const { - assert(hasSyntaxRoot() && "no syntax root is set."); - return *SyntaxInfo->SyntaxRoot; -} - -void SourceFile::setSyntaxRoot(syntax::SourceFileSyntax &&Root) { - SyntaxInfo->SyntaxRoot.emplace(Root); + assert(shouldBuildSyntaxTree() && "Syntax tree disabled"); + auto &eval = getASTContext().evaluator; + auto *mutableThis = const_cast(this); + return *evaluateOrDefault(eval, ParseSourceFileRequest{mutableThis}, {}) + .SyntaxRoot; } void DirectOperatorLookupRequest::writeDependencySink( @@ -1520,6 +1519,7 @@ const clang::Module *ModuleDecl::findUnderlyingClangModule() const { namespace swift { /// Represents a file containing information about cross-module overlays. class OverlayFile { + friend class ModuleDecl; /// The file that data should be loaded from. StringRef filePath; @@ -1536,7 +1536,10 @@ class OverlayFile { /// before returning. bool loadOverlayModuleNames(const ModuleDecl *M, SourceLoc diagLoc, Identifier bystandingModule); - + bool loadOverlayModuleNames(ASTContext &ctx, + StringRef module, + StringRef bystandingModule, + SourceLoc diagLoc); public: // Only allocate in ASTContexts. void *operator new(size_t bytes) = delete; @@ -1577,6 +1580,21 @@ void ModuleDecl::addCrossImportOverlayFile(StringRef file) { .push_back(new (ctx) OverlayFile(ctx.AllocateCopy(file))); } +llvm::SmallSetVector +ModuleDecl::collectCrossImportOverlay(ASTContext &ctx, + StringRef file, + StringRef moduleName, + StringRef &bystandingModule) { + OverlayFile ovFile(file); + bystandingModule = llvm::sys::path::stem(file); + ovFile.loadOverlayModuleNames(ctx, moduleName, bystandingModule, SourceLoc()); + llvm::SmallSetVector result; + for (auto Id: ovFile.overlayModuleNames) { + result.insert(Id); + } + return result; +} + bool ModuleDecl::mightDeclareCrossImportOverlays() const { return !declaredCrossImports.empty(); } @@ -1803,15 +1821,15 @@ OverlayFileContents::load(std::unique_ptr input, } bool -OverlayFile::loadOverlayModuleNames(const ModuleDecl *M, SourceLoc diagLoc, - Identifier bystanderName) { - auto &ctx = M->getASTContext(); +OverlayFile::loadOverlayModuleNames(ASTContext &ctx, StringRef module, + StringRef bystanderName, + SourceLoc diagLoc) { llvm::vfs::FileSystem &fs = *ctx.SourceMgr.getFileSystem(); auto bufOrError = fs.getBufferForFile(filePath); if (!bufOrError) { ctx.Diags.diagnose(diagLoc, diag::cannot_load_swiftoverlay_file, - M->getName(), bystanderName, + module, bystanderName, bufOrError.getError().message(), filePath); return false; } @@ -1825,7 +1843,7 @@ OverlayFile::loadOverlayModuleNames(const ModuleDecl *M, SourceLoc diagLoc, for (auto message : errorMessages) ctx.Diags.diagnose(diagLoc, diag::cannot_load_swiftoverlay_file, - M->getName(), bystanderName, message, filePath); + module, bystanderName, message, filePath); return false; } @@ -1839,6 +1857,15 @@ OverlayFile::loadOverlayModuleNames(const ModuleDecl *M, SourceLoc diagLoc, return true; } +bool +OverlayFile::loadOverlayModuleNames(const ModuleDecl *M, SourceLoc diagLoc, + Identifier bystanderName) { + return loadOverlayModuleNames(M->getASTContext(), + M->getName().str(), + bystanderName.str(), + diagLoc); +} + //===----------------------------------------------------------------------===// // SourceFile Implementation //===----------------------------------------------------------------------===// @@ -2216,11 +2243,9 @@ ModuleDecl::computeMagicFileStringMap(bool shouldDiagnose) const { SourceFile::SourceFile(ModuleDecl &M, SourceFileKind K, Optional bufferID, - bool KeepParsedTokens, bool BuildSyntaxTree, ParsingOptions parsingOpts, bool isPrimary) : FileUnit(FileUnitKind::Source, M), BufferID(bufferID ? *bufferID : -1), - ParsingOpts(parsingOpts), IsPrimary(isPrimary), Kind(K), - SyntaxInfo(new SourceFileSyntaxInfo(BuildSyntaxTree)) { + ParsingOpts(parsingOpts), IsPrimary(isPrimary), Kind(K) { M.getASTContext().addDestructorCleanup(*this); assert(!IsPrimary || M.isMainModule() && @@ -2231,47 +2256,36 @@ SourceFile::SourceFile(ModuleDecl &M, SourceFileKind K, assert(!problem && "multiple main files?"); (void)problem; } - if (KeepParsedTokens) { - AllCorrectedTokens = std::vector(); - } } -std::vector &SourceFile::getTokenVector() { - assert(shouldCollectToken() && "Disabled"); - return *AllCorrectedTokens; +SourceFile::ParsingOptions +SourceFile::getDefaultParsingOptions(const LangOptions &langOpts) { + ParsingOptions opts; + if (langOpts.DisablePoundIfEvaluation) + opts |= ParsingFlags::DisablePoundIfEvaluation; + if (langOpts.BuildSyntaxTree) + opts |= ParsingFlags::BuildSyntaxTree; + if (langOpts.CollectParsedToken) + opts |= ParsingFlags::CollectParsedTokens; + return opts; } ArrayRef SourceFile::getAllTokens() const { - assert(shouldCollectToken() && "Disabled"); - return *AllCorrectedTokens; + assert(shouldCollectTokens() && "Disabled"); + auto &eval = getASTContext().evaluator; + auto *mutableThis = const_cast(this); + return *evaluateOrDefault(eval, ParseSourceFileRequest{mutableThis}, {}) + .CollectedTokens; } -bool SourceFile::shouldCollectToken() const { - switch (Kind) { - case SourceFileKind::Library: - case SourceFileKind::Main: - case SourceFileKind::Interface: - return (bool)AllCorrectedTokens; - case SourceFileKind::SIL: - return false; - } - llvm_unreachable("unhandled kind"); +bool SourceFile::shouldCollectTokens() const { + return Kind != SourceFileKind::SIL && + ParsingOpts.contains(ParsingFlags::CollectParsedTokens); } bool SourceFile::shouldBuildSyntaxTree() const { - return canBeParsedInFull() && SyntaxInfo->Enable; -} - -bool SourceFile::canBeParsedInFull() const { - switch (Kind) { - case SourceFileKind::Library: - case SourceFileKind::Main: - case SourceFileKind::Interface: - return true; - case SourceFileKind::SIL: - return false; - } - llvm_unreachable("unhandled kind"); + return Kind != SourceFileKind::SIL && + ParsingOpts.contains(ParsingFlags::BuildSyntaxTree); } bool SourceFile::hasDelayedBodyParsing() const { @@ -2283,7 +2297,7 @@ bool SourceFile::hasDelayedBodyParsing() const { return false; if (hasInterfaceHash()) return false; - if (shouldCollectToken()) + if (shouldCollectTokens()) return false; if (shouldBuildSyntaxTree()) return false; @@ -2295,7 +2309,7 @@ ArrayRef SourceFile::getTopLevelDecls() const { auto &ctx = getASTContext(); auto *mutableThis = const_cast(this); return evaluateOrDefault(ctx.evaluator, ParseSourceFileRequest{mutableThis}, - {}); + {}).TopLevelDecls; } bool FileUnit::walk(ASTWalker &walker) { diff --git a/lib/AST/ModuleLoader.cpp b/lib/AST/ModuleLoader.cpp index bdc7d096f149a..978488df4e801 100644 --- a/lib/AST/ModuleLoader.cpp +++ b/lib/AST/ModuleLoader.cpp @@ -59,13 +59,13 @@ DependencyTracker::getClangCollector() { return clangCollector; } -static bool findOverlayFilesInDirectory(SourceLoc diagLoc, StringRef path, - ModuleDecl *module, - DependencyTracker * const tracker) { +static bool findOverlayFilesInDirectory(ASTContext &ctx, StringRef path, + StringRef moduleName, + SourceLoc diagLoc, + llvm::function_ref callback) { using namespace llvm::sys; using namespace file_types; - ASTContext &ctx = module->getASTContext(); auto fs = ctx.SourceMgr.getFileSystem(); std::error_code error; @@ -76,27 +76,23 @@ static bool findOverlayFilesInDirectory(SourceLoc diagLoc, StringRef path, if (lookupTypeForExtension(path::extension(file)) != TY_SwiftOverlayFile) continue; - module->addCrossImportOverlayFile(file); - - // FIXME: Better to add it only if we load it. - if (tracker) - tracker->addDependency(file, module->isSystemModule()); + callback(file); } if (error && error != std::errc::no_such_file_or_directory) { ctx.Diags.diagnose(diagLoc, diag::cannot_list_swiftcrossimport_dir, - module->getName(), error.message(), path); + moduleName, error.message(), path); } return !error; } -void ModuleLoader::findOverlayFiles(SourceLoc diagLoc, ModuleDecl *module, - FileUnit *file) { +static void findOverlayFilesInternal(ASTContext &ctx, StringRef moduleDefiningPath, + StringRef moduleName, + SourceLoc diagLoc, + llvm::function_ref callback) { using namespace llvm::sys; using namespace file_types; - - auto &langOpts = module->getASTContext().LangOpts; - + auto &langOpts = ctx.LangOpts; // This method constructs several paths to directories near the module and // scans them for .swiftoverlay files. These paths can be in various // directories and have a few different filenames at the end, but I'll @@ -106,19 +102,17 @@ void ModuleLoader::findOverlayFiles(SourceLoc diagLoc, ModuleDecl *module, // /usr/lib/swift/FooKit.swiftmodule/x86_64-apple-macos.swiftinterface // dirPath = /usr/lib/swift/FooKit.swiftmodule - SmallString<64> dirPath{file->getModuleDefiningPath()}; - if (dirPath.empty()) - return; + SmallString<64> dirPath{moduleDefiningPath}; // dirPath = /usr/lib/swift/ path::remove_filename(dirPath); // dirPath = /usr/lib/swift/FooKit.swiftcrossimport - path::append(dirPath, file->getExportedModuleName()); + path::append(dirPath, moduleName); path::replace_extension(dirPath, getExtension(TY_SwiftCrossImportDir)); // Search for swiftoverlays that apply to all platforms. - if (!findOverlayFilesInDirectory(diagLoc, dirPath, module, dependencyTracker)) + if (!findOverlayFilesInDirectory(ctx, dirPath, moduleName, diagLoc, callback)) // If we diagnosed an error, or we didn't find the directory at all, don't // bother trying the target-specific directories. return; @@ -128,7 +122,7 @@ void ModuleLoader::findOverlayFiles(SourceLoc diagLoc, ModuleDecl *module, path::append(dirPath, moduleTriple.str()); // Search for swiftoverlays specific to the target triple's platform. - findOverlayFilesInDirectory(diagLoc, dirPath, module, dependencyTracker); + findOverlayFilesInDirectory(ctx, dirPath, moduleName, diagLoc, callback); // The rest of this handles target variant triples, which are only used for // certain MacCatalyst builds. @@ -142,7 +136,59 @@ void ModuleLoader::findOverlayFiles(SourceLoc diagLoc, ModuleDecl *module, path::append(dirPath, moduleVariantTriple.str()); // Search for swiftoverlays specific to the target variant's platform. - findOverlayFilesInDirectory(diagLoc, dirPath, module, dependencyTracker); + findOverlayFilesInDirectory(ctx, dirPath, moduleName, diagLoc, callback); +} + +void ModuleLoader::findOverlayFiles(SourceLoc diagLoc, ModuleDecl *module, + FileUnit *file) { + using namespace llvm::sys; + using namespace file_types; + + if (file->getModuleDefiningPath().empty()) + return; + findOverlayFilesInternal(module->getASTContext(), + file->getModuleDefiningPath(), + module->getName().str(), + diagLoc, + [&](StringRef file) { + module->addCrossImportOverlayFile(file); + // FIXME: Better to add it only if we load it. + if (dependencyTracker) + dependencyTracker->addDependency(file, module->isSystemModule()); + }); } +llvm::StringMap> +ModuleDependencies::collectCrossImportOverlayNames(ASTContext &ctx, + StringRef moduleName) { + using namespace llvm::sys; + using namespace file_types; + Optional modulePath; + // Mimic getModuleDefiningPath() for Swift and Clang module. + if (auto *swiftDep = dyn_cast(storage.get())) { + // Prefer interface path to binary module path if we have it. + modulePath = swiftDep->swiftInterfaceFile; + if (!modulePath.hasValue()) + modulePath = swiftDep->compiledModulePath; + assert(modulePath.hasValue()); + StringRef parentDir = llvm::sys::path::parent_path(*modulePath); + if (llvm::sys::path::extension(parentDir) == ".swiftmodule") { + modulePath = parentDir.str(); + } + } else { + modulePath = cast(storage.get())->moduleMapFile; + assert(modulePath.hasValue()); + } + // A map from secondary module name to a vector of overlay names. + llvm::StringMap> result; + findOverlayFilesInternal(ctx, *modulePath, moduleName, SourceLoc(), + [&](StringRef file) { + StringRef bystandingModule; + auto overlayNames = + ModuleDecl::collectCrossImportOverlay(ctx, file, moduleName, + bystandingModule); + result[bystandingModule] = std::move(overlayNames); + }); + return result; +} } // namespace swift diff --git a/lib/AST/NameLookup.cpp b/lib/AST/NameLookup.cpp index 5da65daf1d014..36311b7f85644 100644 --- a/lib/AST/NameLookup.cpp +++ b/lib/AST/NameLookup.cpp @@ -2296,12 +2296,11 @@ CustomAttrNominalRequest::evaluate(Evaluator &evaluator, CustomAttr *attr, DeclContext *dc) const { // Find the types referenced by the custom attribute. auto &ctx = dc->getASTContext(); - TypeLoc &typeLoc = attr->getTypeLoc(); DirectlyReferencedTypeDecls decls; - if (auto typeRepr = typeLoc.getTypeRepr()) { + if (auto *typeRepr = attr->getTypeRepr()) { decls = directReferencesForTypeRepr( evaluator, ctx, typeRepr, dc); - } else if (Type type = typeLoc.getType()) { + } else if (Type type = attr->getType()) { decls = directReferencesForType(type); } @@ -2316,7 +2315,7 @@ CustomAttrNominalRequest::evaluate(Evaluator &evaluator, // If we found declarations that are associated types, look outside of // the current context to see if we can recover. if (declsAreAssociatedTypes(decls)) { - if (auto typeRepr = typeLoc.getTypeRepr()) { + if (auto typeRepr = attr->getTypeRepr()) { if (auto identTypeRepr = dyn_cast(typeRepr)) { auto assocType = cast(decls.front()); @@ -2348,7 +2347,8 @@ CustomAttrNominalRequest::evaluate(Evaluator &evaluator, identTypeRepr }; - typeLoc = TypeLoc(IdentTypeRepr::create(ctx, components)); + auto *newTE = new (ctx) TypeExpr(IdentTypeRepr::create(ctx, components)); + attr->resetTypeInformation(newTE); return nominal; } } diff --git a/lib/AST/NameLookupRequests.cpp b/lib/AST/NameLookupRequests.cpp index 0e3f41f6aee43..c21024b789c02 100644 --- a/lib/AST/NameLookupRequests.cpp +++ b/lib/AST/NameLookupRequests.cpp @@ -319,6 +319,24 @@ void DirectLookupRequest::writeDependencySink( tracker.addUsedMember(desc.DC, desc.Name.getBaseName()); } +//----------------------------------------------------------------------------// +// LookupInModuleRequest computation. +//----------------------------------------------------------------------------// + +void LookupInModuleRequest::writeDependencySink( + evaluator::DependencyCollector &reqTracker, QualifiedLookupResult l) const { + auto *module = std::get<0>(getStorage()); + auto member = std::get<1>(getStorage()); + auto *DC = std::get<4>(getStorage()); + + // Decline to record lookups outside our module. + if (!DC->getParentSourceFile() || + module->getParentModule() != DC->getParentModule()) { + return; + } + reqTracker.addTopLevelName(member.getBaseName()); +} + //----------------------------------------------------------------------------// // LookupConformanceInModuleRequest computation. //----------------------------------------------------------------------------// diff --git a/lib/AST/Pattern.cpp b/lib/AST/Pattern.cpp index a6385bc564991..97178c4eb9156 100644 --- a/lib/AST/Pattern.cpp +++ b/lib/AST/Pattern.cpp @@ -441,6 +441,37 @@ SourceRange TypedPattern::getSourceRange() const { PatTypeRepr->getSourceRange().End }; } +IsPattern::IsPattern(SourceLoc IsLoc, TypeExpr *CastTy, Pattern *SubPattern, + CheckedCastKind Kind) + : Pattern(PatternKind::Is), IsLoc(IsLoc), SubPattern(SubPattern), + CastKind(Kind), CastType(CastTy) { + assert(IsLoc.isValid() == CastTy->getLoc().isValid()); +} + +IsPattern *IsPattern::createImplicit(ASTContext &Ctx, Type castTy, + Pattern *SubPattern, + CheckedCastKind Kind) { + assert(castTy); + auto *CastTE = TypeExpr::createImplicit(castTy, Ctx); + auto *ip = new (Ctx) IsPattern(SourceLoc(), CastTE, SubPattern, Kind); + ip->setImplicit(); + return ip; +} + +SourceRange IsPattern::getSourceRange() const { + SourceLoc beginLoc = SubPattern ? SubPattern->getSourceRange().Start : IsLoc; + SourceLoc endLoc = (isImplicit() ? beginLoc : CastType->getEndLoc()); + return {beginLoc, endLoc}; +} + +Type IsPattern::getCastType() const { return CastType->getInstanceType(); } +void IsPattern::setCastType(Type type) { + assert(type); + CastType->setType(MetatypeType::get(type)); +} + +TypeRepr *IsPattern::getCastTypeRepr() const { return CastType->getTypeRepr(); } + /// Construct an ExprPattern. ExprPattern::ExprPattern(Expr *e, bool isResolved, Expr *matchExpr, VarDecl *matchVar) @@ -449,6 +480,40 @@ ExprPattern::ExprPattern(Expr *e, bool isResolved, Expr *matchExpr, assert(!matchExpr || e->isImplicit() == matchExpr->isImplicit()); } +SourceLoc EnumElementPattern::getStartLoc() const { + return (ParentType && !ParentType->isImplicit()) + ? ParentType->getSourceRange().Start + : DotLoc.isValid() ? DotLoc : NameLoc.getBaseNameLoc(); +} + +SourceLoc EnumElementPattern::getEndLoc() const { + if (SubPattern && SubPattern->getSourceRange().isValid()) { + return SubPattern->getSourceRange().End; + } + return NameLoc.getEndLoc(); +} + +TypeRepr *EnumElementPattern::getParentTypeRepr() const { + if (!ParentType) + return nullptr; + return ParentType->getTypeRepr(); +} + +Type EnumElementPattern::getParentType() const { + if (!ParentType) + return Type(); + return ParentType->getInstanceType(); +} + +void EnumElementPattern::setParentType(Type type) { + assert(type); + if (ParentType) { + ParentType->setType(MetatypeType::get(type)); + } else { + ParentType = TypeExpr::createImplicit(type, type->getASTContext()); + } +} + SourceLoc ExprPattern::getLoc() const { return getSubExpr()->getLoc(); } diff --git a/lib/AST/PrettyStackTrace.cpp b/lib/AST/PrettyStackTrace.cpp index c4266b4e7b8c0..a13caf0683dab 100644 --- a/lib/AST/PrettyStackTrace.cpp +++ b/lib/AST/PrettyStackTrace.cpp @@ -43,7 +43,7 @@ void PrettyStackTraceDecl::print(llvm::raw_ostream &out) const { } void swift::printDeclDescription(llvm::raw_ostream &out, const Decl *D, - ASTContext &Context, bool addNewline) { + const ASTContext &Context, bool addNewline) { SourceLoc loc = D->getStartLoc(); bool hasPrintedName = false; if (auto *named = dyn_cast(D)) { @@ -127,7 +127,7 @@ void PrettyStackTraceExpr::print(llvm::raw_ostream &out) const { } void swift::printExprDescription(llvm::raw_ostream &out, Expr *E, - ASTContext &Context, bool addNewline) { + const ASTContext &Context, bool addNewline) { out << "expression at "; E->getSourceRange().print(out, Context.SourceMgr); if (addNewline) out << '\n'; @@ -143,7 +143,7 @@ void PrettyStackTraceStmt::print(llvm::raw_ostream &out) const { } void swift::printStmtDescription(llvm::raw_ostream &out, Stmt *S, - ASTContext &Context, bool addNewline) { + const ASTContext &Context, bool addNewline) { out << "statement at "; S->getSourceRange().print(out, Context.SourceMgr); if (addNewline) out << '\n'; @@ -159,7 +159,8 @@ void PrettyStackTracePattern::print(llvm::raw_ostream &out) const { } void swift::printPatternDescription(llvm::raw_ostream &out, Pattern *P, - ASTContext &Context, bool addNewline) { + const ASTContext &Context, + bool addNewline) { out << "pattern at "; P->getSourceRange().print(out, Context.SourceMgr); if (addNewline) out << '\n'; @@ -198,7 +199,7 @@ void PrettyStackTraceType::print(llvm::raw_ostream &out) const { } void swift::printTypeDescription(llvm::raw_ostream &out, Type type, - ASTContext &Context, bool addNewline) { + const ASTContext &Context, bool addNewline) { out << "type '" << type << '\''; if (Decl *decl = InterestingDeclForType().visit(type)) { if (decl->getSourceRange().isValid()) { @@ -236,7 +237,8 @@ void PrettyStackTraceConformance::print(llvm::raw_ostream &out) const { void swift::printConformanceDescription(llvm::raw_ostream &out, const ProtocolConformance *conformance, - ASTContext &ctxt, bool addNewline) { + const ASTContext &ctxt, + bool addNewline) { if (!conformance) { out << "NULL protocol conformance!"; if (addNewline) out << '\n'; @@ -250,7 +252,7 @@ void swift::printConformanceDescription(llvm::raw_ostream &out, } void swift::printSourceLocDescription(llvm::raw_ostream &out, - SourceLoc loc, ASTContext &ctx, + SourceLoc loc, const ASTContext &ctx, bool addNewline) { loc.print(out, ctx.SourceMgr); if (addNewline) out << '\n'; diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index d8ab0842fa9c1..192a85ff30e6c 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -3973,16 +3973,16 @@ TypeBase::getContextSubstitutions(const DeclContext *dc, return substitutions; } + const auto genericSig = dc->getGenericSignatureOfContext(); + if (!genericSig) + return substitutions; + // Find the superclass type with the context matching that of the member. auto *ownerNominal = dc->getSelfNominalTypeDecl(); if (auto *ownerClass = dyn_cast(ownerNominal)) baseTy = baseTy->getSuperclassForDecl(ownerClass); // Gather all of the substitutions for all levels of generic arguments. - auto genericSig = dc->getGenericSignatureOfContext(); - if (!genericSig) - return substitutions; - auto params = genericSig->getGenericParams(); unsigned n = params.size(); diff --git a/lib/AST/TypeCheckRequests.cpp b/lib/AST/TypeCheckRequests.cpp index f6313796e1fc4..6ecd7c87e2b50 100644 --- a/lib/AST/TypeCheckRequests.cpp +++ b/lib/AST/TypeCheckRequests.cpp @@ -1410,16 +1410,22 @@ void LookupAllConformancesInContextRequest::writeDependencySink( //----------------------------------------------------------------------------// Optional ResolveTypeEraserTypeRequest::getCachedResult() const { - auto ty = std::get<1>(getStorage())->TypeEraserLoc.getType(); - if (ty.isNull()) { + auto *TyExpr = std::get<1>(getStorage())->TypeEraserExpr; + if (!TyExpr || !TyExpr->getType()) { return None; } - return ty; + return TyExpr->getInstanceType(); } void ResolveTypeEraserTypeRequest::cacheResult(Type value) const { assert(value && "Resolved type erasure type to null type!"); - std::get<1>(getStorage())->TypeEraserLoc.setType(value); + auto *attr = std::get<1>(getStorage()); + if (attr->TypeEraserExpr) { + attr->TypeEraserExpr->setType(MetatypeType::get(value)); + } else { + attr->TypeEraserExpr = TypeExpr::createImplicit(value, + value->getASTContext()); + } } //----------------------------------------------------------------------------// @@ -1498,3 +1504,33 @@ SourceLoc swift::extractNearestSourceLoc(const TypeRepr *repr) { return SourceLoc(); return repr->getLoc(); } + +//----------------------------------------------------------------------------// +// CustomAttrTypeRequest computation. +//----------------------------------------------------------------------------// + +void swift::simple_display(llvm::raw_ostream &out, CustomAttrTypeKind value) { + switch (value) { + case CustomAttrTypeKind::NonGeneric: + out << "non-generic"; + return; + + case CustomAttrTypeKind::PropertyDelegate: + out << "property-delegate"; + return; + } + llvm_unreachable("bad kind"); +} + +Optional CustomAttrTypeRequest::getCachedResult() const { + auto *attr = std::get<0>(getStorage()); + if (auto ty = attr->getType()) { + return ty; + } + return None; +} + +void CustomAttrTypeRequest::cacheResult(Type value) const { + auto *attr = std::get<0>(getStorage()); + attr->setType(value); +} diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index 5f971d0872e63..19810013c1aef 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -648,10 +648,7 @@ synthesizeStructRawValueGetterBody(AbstractFunctionDecl *afd, void *context) { auto bridge = new (ctx) BridgeFromObjCExpr(storedRef, computedType); bridge->setType(computedType); - auto coerce = new (ctx) CoerceExpr(bridge, {}, {nullptr, computedType}); - coerce->setType(computedType); - - result = coerce; + result = CoerceExpr::createImplicit(ctx, bridge, computedType); } auto ret = new (ctx) ReturnStmt(SourceLoc(), result); @@ -1566,11 +1563,7 @@ synthesizeRawValueBridgingConstructorBody(AbstractFunctionDecl *afd, auto bridge = new (ctx) BridgeToObjCExpr(paramRef, storedType); bridge->setType(storedType); - auto coerce = new (ctx) CoerceExpr(bridge, SourceLoc(), - {nullptr, storedType}); - coerce->setType(storedType); - - rhs = coerce; + rhs = CoerceExpr::createImplicit(ctx, bridge, storedType); } // Add assignment. @@ -4313,12 +4306,12 @@ namespace { // "raw" name will be imported as unavailable with a more helpful and // specific message. ++NumFactoryMethodsAsInitializers; - bool redundant = false; + ConstructorDecl *existing = nullptr; auto result = importConstructor(decl, dc, false, importedName.getInitKind(), /*required=*/false, selector, importedName, {decl->param_begin(), decl->param_size()}, - decl->isVariadic(), redundant); + decl->isVariadic(), existing); if (!isActiveSwiftVersion() && result) markAsVariant(result, *correctSwiftName); @@ -4562,7 +4555,7 @@ namespace { ImportedName importedName, ArrayRef args, bool variadic, - bool &redundant); + ConstructorDecl *&existing); void recordObjCOverride(SubscriptDecl *subscript); @@ -6241,11 +6234,11 @@ ConstructorDecl *SwiftDeclConverter::importConstructor( variadic = false; } - bool redundant; + ConstructorDecl *existing; auto result = importConstructor(objcMethod, dc, implicit, kind.getValueOr(importedName.getInitKind()), required, selector, importedName, params, - variadic, redundant); + variadic, existing); // If this is a compatibility stub, mark it as such. if (result && correctSwiftName) @@ -6357,8 +6350,8 @@ ConstructorDecl *SwiftDeclConverter::importConstructor( const clang::ObjCMethodDecl *objcMethod, const DeclContext *dc, bool implicit, CtorInitializerKind kind, bool required, ObjCSelector selector, ImportedName importedName, ArrayRef args, - bool variadic, bool &redundant) { - redundant = false; + bool variadic, ConstructorDecl *&existing) { + existing = nullptr; // Figure out the type of the container. auto ownerNominal = dc->getSelfNominalTypeDecl(); @@ -6458,7 +6451,7 @@ ConstructorDecl *SwiftDeclConverter::importConstructor( // Otherwise, we shouldn't create a new constructor, because // it will be no better than the existing one. - redundant = true; + existing = ctor; return nullptr; } @@ -7395,19 +7388,26 @@ void SwiftDeclConverter::importInheritedConstructors( !correctSwiftName && "Import inherited initializers never references correctSwiftName"); importedName.setHasCustomName(); - bool redundant; + ConstructorDecl *existing; if (auto newCtor = importConstructor(objcMethod, classDecl, /*implicit=*/true, ctor->getInitKind(), /*required=*/false, ctor->getObjCSelector(), importedName, objcMethod->parameters(), - objcMethod->isVariadic(), redundant)) { + objcMethod->isVariadic(), existing)) { // If this is a compatibility stub, mark it as such. if (correctSwiftName) markAsVariant(newCtor, *correctSwiftName); Impl.importAttributes(objcMethod, newCtor, curObjCClass); newMembers.push_back(newCtor); + } else if (existing && existing->getClangDecl()) { + // Check that the existing constructor the prevented new creation is + // really an inherited factory initializer and not a class member. + auto existingMD = cast(existing->getClangDecl()); + if (existingMD->getClassInterface() != curObjCClass) { + newMembers.push_back(existing); + } } continue; } diff --git a/lib/Demangling/Demangler.cpp b/lib/Demangling/Demangler.cpp index 37aed75054988..e87f9f6bf691a 100644 --- a/lib/Demangling/Demangler.cpp +++ b/lib/Demangling/Demangler.cpp @@ -1835,6 +1835,8 @@ NodePointer Demangler::demangleImplFunctionType() { while (NodePointer Result = demangleImplResultConvention( Node::Kind::ImplResult)) { type = addChild(type, Result); + if (NodePointer Diff = demangleImplDifferentiability()) + Result = addChild(Result, Diff); ++NumTypesToAdd; } while (nextIf('Y')) { diff --git a/lib/Demangling/NodePrinter.cpp b/lib/Demangling/NodePrinter.cpp index 96c6b2cdd74e3..ef6e5d4b9a64d 100644 --- a/lib/Demangling/NodePrinter.cpp +++ b/lib/Demangling/NodePrinter.cpp @@ -2088,6 +2088,7 @@ NodePointer NodePrinter::print(NodePointer Node, bool asPrefixContext) { printChildren(Node, " "); return nullptr; case Node::Kind::ImplParameter: + case Node::Kind::ImplResult: // Children: `convention, differentiability?, type` // Print convention. print(Node->getChild(0)); @@ -2098,9 +2099,6 @@ NodePointer NodePrinter::print(NodePointer Node, bool asPrefixContext) { // Print type. print(Node->getLastChild()); return nullptr; - case Node::Kind::ImplResult: - printChildren(Node, " "); - return nullptr; case Node::Kind::ImplFunctionType: printImplFunctionType(Node); return nullptr; diff --git a/lib/Demangling/Remangler.cpp b/lib/Demangling/Remangler.cpp index d30c52137244a..1af12dc3c93e5 100644 --- a/lib/Demangling/Remangler.cpp +++ b/lib/Demangling/Remangler.cpp @@ -1573,6 +1573,9 @@ void Remangler::mangleImplFunctionType(Node *node) { .Default(0); assert(ConvCh && "invalid impl parameter convention"); Buffer << ConvCh; + // Mangle result differentiability, if it exists. + if (Child->getNumChildren() == 3) + mangleImplDifferentiability(Child->getChild(1)); break; } default: diff --git a/lib/Driver/FineGrainedDependencyDriverGraph.cpp b/lib/Driver/FineGrainedDependencyDriverGraph.cpp index dd9d1460b1357..bc1cda3e359f7 100644 --- a/lib/Driver/FineGrainedDependencyDriverGraph.cpp +++ b/lib/Driver/FineGrainedDependencyDriverGraph.cpp @@ -15,6 +15,7 @@ #include "swift/AST/DiagnosticEngine.h" #include "swift/AST/DiagnosticsFrontend.h" #include "swift/AST/FileSystem.h" +#include "swift/Basic/PrettyStackTrace.h" #include "swift/Basic/ReferenceDependencyKeys.h" #include "swift/Basic/SourceManager.h" #include "swift/Basic/Statistic.h" @@ -65,6 +66,7 @@ ModuleDepGraph::Changes ModuleDepGraph::loadFromPath(const Job *Cmd, StringRef path, DiagnosticEngine &diags) { FrontendStatsTracer tracer(stats, "fine-grained-dependencies-loadFromPath"); + PrettyStackTraceStringAction stackTrace("loading fine-grained dependency graph", path); if (driverDotFileBasePath.empty()) { driverDotFileBasePath = path; diff --git a/lib/Driver/FrontendUtil.cpp b/lib/Driver/FrontendUtil.cpp index bd771faf28c5b..7d796ddfc722c 100644 --- a/lib/Driver/FrontendUtil.cpp +++ b/lib/Driver/FrontendUtil.cpp @@ -19,13 +19,16 @@ #include "swift/Driver/Job.h" #include "swift/Driver/ToolChain.h" #include "llvm/Option/ArgList.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/StringSaver.h" using namespace swift; using namespace swift::driver; bool swift::driver::getSingleFrontendInvocationFromDriverArguments( ArrayRef Argv, DiagnosticEngine &Diags, - llvm::function_ref FrontendArgs)> Action) { + llvm::function_ref FrontendArgs)> Action, + bool ForceNoOutputs) { SmallVector Args; Args.push_back(""); // FIXME: Remove dummy argument. Args.insert(Args.end(), Argv.begin(), Argv.end()); @@ -45,6 +48,16 @@ bool swift::driver::getSingleFrontendInvocationFromDriverArguments( Args.push_back("-driver-filelist-threshold"); Args.push_back(neverThreshold.c_str()); + // Expand any file list args. + llvm::BumpPtrAllocator Allocator; + llvm::StringSaver Saver(Allocator); + llvm::cl::ExpandResponseFiles( + Saver, + llvm::Triple(llvm::sys::getProcessTriple()).isOSWindows() + ? llvm::cl::TokenizeWindowsCommandLine + : llvm::cl::TokenizeGNUCommandLine, + Args); + // Force the driver into batch mode by specifying "swiftc" as the name. Driver TheDriver("swiftc", "swiftc", Args, Diags); @@ -57,6 +70,20 @@ bool swift::driver::getSingleFrontendInvocationFromDriverArguments( if (Diags.hadAnyError()) return true; + if (ForceNoOutputs) { + // Clear existing output modes and supplementary outputs. + ArgList->eraseArg(options::OPT_modes_Group); + ArgList->eraseArgIf([](const llvm::opt::Arg *A) { + return A && A->getOption().hasFlag(options::SupplementaryOutput); + }); + + unsigned index = ArgList->MakeIndex("-typecheck"); + // Takes ownership of the Arg. + ArgList->append(new llvm::opt::Arg( + TheDriver.getOpts().getOption(options::OPT_typecheck), + ArgList->getArgString(index), index)); + } + std::unique_ptr TC = TheDriver.buildToolChain(*ArgList); if (Diags.hadAnyError()) return true; diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 232a69ac30487..b1d6f97b0e887 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -254,7 +254,8 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI, inputArgs.AddLastArg(arguments, options::OPT_verify_incremental_dependencies); inputArgs.AddLastArg(arguments, - options::OPT_experimental_private_intransitive_dependencies); + options::OPT_enable_direct_intramodule_dependencies, + options::OPT_disable_direct_intramodule_dependencies); // Pass on any build config options inputArgs.AddAllArgs(arguments, options::OPT_D); diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 46bdf5c5f0d8d..c1fc9ac970bf5 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -435,8 +435,10 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args, if (Args.hasArg(OPT_enable_experimental_additive_arithmetic_derivation)) Opts.EnableExperimentalAdditiveArithmeticDerivedConformances = true; - if (Args.hasArg(OPT_experimental_private_intransitive_dependencies)) - Opts.EnableExperientalPrivateIntransitiveDependencies = true; + Opts.DirectIntramoduleDependencies = + Args.hasFlag(OPT_enable_direct_intramodule_dependencies, + OPT_disable_direct_intramodule_dependencies, + Opts.DirectIntramoduleDependencies); Opts.EnableExperimentalForwardModeDifferentiation |= Args.hasArg(OPT_enable_experimental_forward_mode_differentiation); @@ -724,6 +726,8 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args, Opts.SolverEnableOperatorDesignatedTypes |= Args.hasArg(OPT_solver_enable_operator_designated_types); + Opts.EnableOneWayClosureParameters |= + Args.hasArg(OPT_experimental_one_way_closure_params); Opts.DebugConstraintSolver |= Args.hasArg(OPT_debug_constraints); Opts.DebugGenericSignatures |= Args.hasArg(OPT_debug_generic_signatures); diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index 2f862316262a7..36c99310b587e 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -705,6 +705,37 @@ ImplicitImportInfo CompilerInstance::getImplicitImportInfo() const { return imports; } +bool CompilerInstance::createFilesForMainModule( + ModuleDecl *mod, SmallVectorImpl &files) const { + // Make sure the main file is the first file in the module. + if (MainBufferID != NO_SUCH_BUFFER) { + auto *mainFile = createSourceFileForMainModule( + mod, Invocation.getSourceFileKind(), MainBufferID); + files.push_back(mainFile); + } + + // If we have partial modules to load, do so now, bailing if any failed to + // load. + if (!PartialModules.empty()) { + if (loadPartialModulesAndImplicitImports(mod, files)) + return true; + } + + // Finally add the library files. + // FIXME: This is the only demand point for InputSourceCodeBufferIDs. We + // should compute this list of source files lazily. + for (auto BufferID : InputSourceCodeBufferIDs) { + // Skip the main buffer, we've already handled it. + if (BufferID == MainBufferID) + continue; + + auto *libraryFile = + createSourceFileForMainModule(mod, SourceFileKind::Library, BufferID); + files.push_back(libraryFile); + } + return false; +} + ModuleDecl *CompilerInstance::getMainModule() const { if (!MainModule) { Identifier ID = Context->getIdentifier(Invocation.getModuleName()); @@ -719,6 +750,22 @@ ModuleDecl *CompilerInstance::getMainModule() const { if (Invocation.getFrontendOptions().EnableLibraryEvolution) MainModule->setResilienceStrategy(ResilienceStrategy::Resilient); + + Context->LoadedModules[MainModule->getName()] = MainModule; + + // Create and add the module's files. + SmallVector files; + if (!createFilesForMainModule(MainModule, files)) { + for (auto *file : files) + MainModule->addFile(*file); + } else { + // If we failed to load a partial module, mark the main module as having + // "failed to load", as it will contain no files. Note that we don't try + // to add any of the successfully loaded partial modules. This ensures + // that we don't encounter cases where we try to resolve a cross-reference + // into a partial module that failed to load. + MainModule->setFailedToLoad(); + } } return MainModule; } @@ -729,93 +776,31 @@ void CompilerInstance::setMainModule(ModuleDecl *newMod) { Context->LoadedModules[newMod->getName()] = newMod; } -void CompilerInstance::performParseOnly(bool EvaluateConditionals, - bool CanDelayBodies) { - const InputFileKind Kind = Invocation.getInputKind(); - assert((Kind == InputFileKind::Swift || Kind == InputFileKind::SwiftLibrary || - Kind == InputFileKind::SwiftModuleInterface) && - "only supports parsing .swift files"); - (void)Kind; - - SourceFile::ParsingOptions parsingOpts; - if (!EvaluateConditionals) - parsingOpts |= SourceFile::ParsingFlags::DisablePoundIfEvaluation; - if (!CanDelayBodies) - parsingOpts |= SourceFile::ParsingFlags::DisableDelayedBodies; - performSemaUpTo(SourceFile::Unprocessed, parsingOpts); - assert(Context->LoadedModules.size() == 1 && - "Loaded a module during parse-only"); -} - void CompilerInstance::performParseAndResolveImportsOnly() { - performSemaUpTo(SourceFile::ImportsResolved); -} - -void CompilerInstance::performSema() { - performSemaUpTo(SourceFile::TypeChecked); -} - -void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage, - SourceFile::ParsingOptions POpts) { - FrontendStatsTracer tracer(getStatsReporter(), "perform-sema"); - - ModuleDecl *mainModule = getMainModule(); - Context->LoadedModules[mainModule->getName()] = mainModule; - - // Make sure the main file is the first file in the module, so do this now. - if (MainBufferID != NO_SUCH_BUFFER) { - auto *mainFile = createSourceFileForMainModule( - Invocation.getSourceFileKind(), MainBufferID, POpts); - mainFile->SyntaxParsingCache = Invocation.getMainFileSyntaxParsingCache(); - } - - // If we aren't in a parse-only context, load the remaining serialized inputs - // and resolve implicit imports. - if (LimitStage > SourceFile::Unprocessed && - loadPartialModulesAndImplicitImports()) { - // If we failed to load a partial module, mark the main module as having - // "failed to load", as it may contain no files. - mainModule->setFailedToLoad(); - return; - } + FrontendStatsTracer tracer(getStatsReporter(), "parse-and-resolve-imports"); - // Then parse all the input files. - // FIXME: This is the only demand point for InputSourceCodeBufferIDs. We - // should compute this list of source files lazily. - for (auto BufferID : InputSourceCodeBufferIDs) { - SourceFile *SF; - if (BufferID == MainBufferID) { - // If this is the main file, we've already created it. - SF = &getMainModule()->getMainSourceFile(Invocation.getSourceFileKind()); - } else { - // Otherwise create a library file. - SF = createSourceFileForMainModule(SourceFileKind::Library, - BufferID, POpts); - } - // Trigger parsing of the file. - if (LimitStage == SourceFile::Unprocessed) { - (void)SF->getTopLevelDecls(); - } else { + // Resolve imports for all the source files. + auto *mainModule = getMainModule(); + for (auto *file : mainModule->getFiles()) { + if (auto *SF = dyn_cast(file)) performImportResolution(*SF); - } } - if (LimitStage == SourceFile::Unprocessed) - return; - - assert(llvm::all_of(MainModule->getFiles(), [](const FileUnit *File) -> bool { + assert(llvm::all_of(mainModule->getFiles(), [](const FileUnit *File) -> bool { auto *SF = dyn_cast(File); if (!SF) return true; return SF->ASTStage >= SourceFile::ImportsResolved; }) && "some files have not yet had their imports resolved"); - MainModule->setHasResolvedImports(); + mainModule->setHasResolvedImports(); - bindExtensions(*MainModule); + bindExtensions(*mainModule); +} - // If the limiting AST stage is import resolution, we're done. - if (LimitStage == SourceFile::ImportsResolved) - return; +void CompilerInstance::performSema() { + performParseAndResolveImportsOnly(); + + FrontendStatsTracer tracer(getStatsReporter(), "perform-sema"); forEachFileToTypeCheck([&](SourceFile &SF) { performTypeChecking(SF); @@ -847,26 +832,27 @@ bool CompilerInstance::loadStdlibIfNeeded() { return false; } -bool CompilerInstance::loadPartialModulesAndImplicitImports() { +bool CompilerInstance::loadPartialModulesAndImplicitImports( + ModuleDecl *mod, SmallVectorImpl &partialModules) const { FrontendStatsTracer tracer(getStatsReporter(), "load-partial-modules-and-implicit-imports"); // Force loading implicit imports. This is currently needed to allow // deserialization to resolve cross references into bridging headers. // FIXME: Once deserialization loads all the modules it needs for cross // references, this can be removed. - (void)MainModule->getImplicitImports(); + (void)mod->getImplicitImports(); + // Load in the partial modules. bool hadLoadError = false; - // Parse all the partial modules first. for (auto &PM : PartialModules) { assert(PM.ModuleBuffer); auto *file = - SML->loadAST(*MainModule, SourceLoc(), /*moduleInterfacePath*/ "", + SML->loadAST(*mod, /*diagLoc*/ SourceLoc(), /*moduleInterfacePath*/ "", std::move(PM.ModuleBuffer), std::move(PM.ModuleDocBuffer), std::move(PM.ModuleSourceInfoBuffer), /*isFramework*/ false); if (file) { - MainModule->addFile(*file); + partialModules.push_back(file); } else { hadLoadError = true; } @@ -877,7 +863,7 @@ bool CompilerInstance::loadPartialModulesAndImplicitImports() { void CompilerInstance::forEachFileToTypeCheck( llvm::function_ref fn) { if (isWholeModuleCompilation()) { - for (auto fileName : MainModule->getFiles()) { + for (auto fileName : getMainModule()->getFiles()) { auto *SF = dyn_cast(fileName); if (!SF) { continue; @@ -897,14 +883,29 @@ void CompilerInstance::finishTypeChecking() { }); } -SourceFile *CompilerInstance::createSourceFileForMainModule( - SourceFileKind fileKind, Optional bufferID, - SourceFile::ParsingOptions opts) { - ModuleDecl *mainModule = getMainModule(); +SourceFile::ParsingOptions +CompilerInstance::getSourceFileParsingOptions(bool forPrimary) const { + const auto &frontendOpts = Invocation.getFrontendOptions(); + const auto action = frontendOpts.RequestedAction; + + auto opts = SourceFile::getDefaultParsingOptions(getASTContext().LangOpts); + if (FrontendOptions::shouldActionOnlyParse(action)) { + // Generally in a parse-only invocation, we want to disable #if evaluation. + // However, there are a couple of modes where we need to know which clauses + // are active. + if (action != FrontendOptions::ActionType::EmitImportedModules && + action != FrontendOptions::ActionType::ScanDependencies) { + opts |= SourceFile::ParsingFlags::DisablePoundIfEvaluation; + } - auto isPrimary = bufferID && isPrimaryInput(*bufferID); - if (isPrimary || isWholeModuleCompilation()) { - // Disable delayed body parsing for primaries. + // If we need to dump the parse tree, disable delayed bodies as we want to + // show everything. + if (action == FrontendOptions::ActionType::DumpParse) + opts |= SourceFile::ParsingFlags::DisableDelayedBodies; + } + + if (forPrimary || isWholeModuleCompilation()) { + // Disable delayed body parsing for primaries and in WMO. opts |= SourceFile::ParsingFlags::DisableDelayedBodies; } else { // Suppress parse warnings for non-primaries, as they'll get parsed multiple @@ -912,15 +913,26 @@ SourceFile *CompilerInstance::createSourceFileForMainModule( opts |= SourceFile::ParsingFlags::SuppressWarnings; } - SourceFile *inputFile = new (*Context) - SourceFile(*mainModule, fileKind, bufferID, - Invocation.getLangOptions().CollectParsedToken, - Invocation.getLangOptions().BuildSyntaxTree, opts, isPrimary); - MainModule->addFile(*inputFile); - - if (isPrimary) { - inputFile->enableInterfaceHash(); + // Enable interface hash computation for primaries, but not in WMO, as it's + // only currently needed for incremental mode. + if (forPrimary) { + opts |= SourceFile::ParsingFlags::EnableInterfaceHash; } + return opts; +} + +SourceFile *CompilerInstance::createSourceFileForMainModule( + ModuleDecl *mod, SourceFileKind fileKind, + Optional bufferID) const { + auto isPrimary = bufferID && isPrimaryInput(*bufferID); + auto opts = getSourceFileParsingOptions(isPrimary); + + auto *inputFile = new (*Context) + SourceFile(*mod, fileKind, bufferID, opts, isPrimary); + + if (bufferID == MainBufferID) + inputFile->SyntaxParsingCache = Invocation.getMainFileSyntaxParsingCache(); + return inputFile; } @@ -988,7 +1000,7 @@ static void countStatsPostSILOpt(UnifiedStatsReporter &Stats, auto &C = Stats.getFrontendCounters(); // FIXME: calculate these in constant time, via the dense maps. C.NumSILOptFunctions += Module.getFunctionList().size(); - C.NumSILOptVtables += Module.getVTableList().size(); + C.NumSILOptVtables += Module.getVTables().size(); C.NumSILOptWitnessTables += Module.getWitnessTableList().size(); C.NumSILOptDefaultWitnessTables += Module.getDefaultWitnessTableList().size(); C.NumSILOptGlobalVariables += Module.getSILGlobalList().size(); diff --git a/lib/FrontendTool/FrontendTool.cpp b/lib/FrontendTool/FrontendTool.cpp index f322da4198ae4..8610dbc96e654 100644 --- a/lib/FrontendTool/FrontendTool.cpp +++ b/lib/FrontendTool/FrontendTool.cpp @@ -169,20 +169,31 @@ static bool emitMakeDependenciesIfNeeded(DiagnosticEngine &diags, llvm::SmallString<256> buffer; + // collect everything in memory to avoid redundant work + // when there are multiple targets + std::string dependencyString; + + // First include all other files in the module. Make-style dependencies + // need to be conservative! + auto inputPaths = + reversePathSortedFilenames(opts.InputsAndOutputs.getInputFilenames()); + for (auto const &path : inputPaths) { + dependencyString.push_back(' '); + dependencyString.append(frontend::utils::escapeForMake(path, buffer)); + } + // Then print dependencies we've picked up during compilation. + auto dependencyPaths = + reversePathSortedFilenames(depTracker->getDependencies()); + for (auto const &path : dependencyPaths) { + dependencyString.push_back(' '); + dependencyString.append(frontend::utils::escapeForMake(path, buffer)); + } + // FIXME: Xcode can't currently handle multiple targets in a single // dependency line. opts.forAllOutputPaths(input, [&](const StringRef targetName) { - out << swift::frontend::utils::escapeForMake(targetName, buffer) << " :"; - // First include all other files in the module. Make-style dependencies - // need to be conservative! - for (auto const &path : - reversePathSortedFilenames(opts.InputsAndOutputs.getInputFilenames())) - out << ' ' << swift::frontend::utils::escapeForMake(path, buffer); - // Then print dependencies we've picked up during compilation. - for (auto const &path : - reversePathSortedFilenames(depTracker->getDependencies())) - out << ' ' << swift::frontend::utils::escapeForMake(path, buffer); - out << '\n'; + auto targetNameEscaped = frontend::utils::escapeForMake(targetName, buffer); + out << targetNameEscaped << " :" << dependencyString << '\n'; }); return false; @@ -499,11 +510,6 @@ getFileOutputStream(StringRef OutputFilename, ASTContext &Ctx) { /// Writes the Syntax tree to the given file static bool emitSyntax(SourceFile *SF, StringRef OutputFilename) { - auto bufferID = SF->getBufferID(); - assert(bufferID && "frontend should have a buffer ID " - "for the main source file"); - (void)bufferID; - auto os = getFileOutputStream(OutputFilename, SF->getASTContext()); if (!os) return true; @@ -730,7 +736,7 @@ static void countStatsPostSILGen(UnifiedStatsReporter &Stats, auto &C = Stats.getFrontendCounters(); // FIXME: calculate these in constant time, via the dense maps. C.NumSILGenFunctions += Module.getFunctionList().size(); - C.NumSILGenVtables += Module.getVTableList().size(); + C.NumSILGenVtables += Module.getVTables().size(); C.NumSILGenWitnessTables += Module.getWitnessTableList().size(); C.NumSILGenDefaultWitnessTables += Module.getDefaultWitnessTableList().size(); C.NumSILGenGlobalVariables += Module.getSILGlobalList().size(); @@ -873,12 +879,13 @@ static void dumpAST(CompilerInstance &Instance) { auto PSPs = Instance.getPrimarySpecificPathsForSourceFile(*sourceFile); auto OutputFilename = PSPs.OutputFilename; auto OS = getFileOutputStream(OutputFilename, Instance.getASTContext()); - sourceFile->dump(*OS); + sourceFile->dump(*OS, /*parseIfNeeded*/ true); } } else { // Some invocations don't have primary files. In that case, we default to // looking for the main file and dumping it to `stdout`. - getPrimaryOrMainSourceFile(Instance)->dump(llvm::outs()); + auto *SF = getPrimaryOrMainSourceFile(Instance); + SF->dump(llvm::outs(), /*parseIfNeeded*/ true); } } @@ -1215,9 +1222,20 @@ static bool emitAnyWholeModulePostTypeCheckSupplementaryOutputs( /// before or after LLVM depending on when the ASTContext gets freed. static void performEndOfPipelineActions(CompilerInstance &Instance) { assert(Instance.hasASTContext()); + auto &ctx = Instance.getASTContext(); + + // Make sure we didn't load a module during a parse-only invocation, unless + // it's -emit-imported-modules, which can load modules. + auto action = Instance.getInvocation().getFrontendOptions().RequestedAction; + if (FrontendOptions::shouldActionOnlyParse(action) && + action != FrontendOptions::ActionType::EmitImportedModules) { + assert(ctx.LoadedModules.size() == 1 && + "Loaded a module during parse-only"); + assert(ctx.LoadedModules.front().second == Instance.getMainModule()); + } // Verify the AST for all the modules we've loaded. - Instance.getASTContext().verifyAllLoadedModules(); + ctx.verifyAllLoadedModules(); // Emit dependencies and index data. emitReferenceDependenciesForAllPrimaryInputsIfNeeded(Instance); @@ -1262,15 +1280,22 @@ static bool performCompile(CompilerInstance &Instance, return true; } + SWIFT_DEFER { + // We might have freed the ASTContext already, but in that case we would + // have already performed these actions. + if (Instance.hasASTContext()) + performEndOfPipelineActions(Instance); + }; + if (FrontendOptions::shouldActionOnlyParse(Action)) { - // Disable delayed parsing of type and function bodies when we've been - // asked to dump the resulting AST. - bool CanDelayBodies = Action != FrontendOptions::ActionType::DumpParse; - bool EvaluateConditionals = - Action == FrontendOptions::ActionType::EmitImportedModules - || Action == FrontendOptions::ActionType::ScanDependencies; - Instance.performParseOnly(EvaluateConditionals, - CanDelayBodies); + // Parsing gets triggered lazily, but let's make sure we have the right + // input kind. + auto kind = Invocation.getInputKind(); + assert((kind == InputFileKind::Swift || + kind == InputFileKind::SwiftLibrary || + kind == InputFileKind::SwiftModuleInterface) && + "Only supports parsing .swift files"); + (void)kind; } else if (Action == FrontendOptions::ActionType::ResolveImports) { Instance.performParseAndResolveImportsOnly(); } else { @@ -1278,8 +1303,15 @@ static bool performCompile(CompilerInstance &Instance, } ASTContext &Context = Instance.getASTContext(); - if (Action == FrontendOptions::ActionType::Parse) + if (Action == FrontendOptions::ActionType::Parse) { + // A -parse invocation only cares about the side effects of parsing, so + // force the parsing of all the source files. + for (auto *file : Instance.getMainModule()->getFiles()) { + if (auto *SF = dyn_cast(file)) + (void)SF->getTopLevelDecls(); + } return Context.hadError(); + } if (Action == FrontendOptions::ActionType::ScanDependencies) { scanDependencies(Instance); @@ -1326,13 +1358,6 @@ static bool performCompile(CompilerInstance &Instance, emitSwiftRangesForAllPrimaryInputsIfNeeded(Instance); emitCompiledSourceForAllPrimaryInputsIfNeeded(Instance); - SWIFT_DEFER { - // We might have freed the ASTContext already, but in that case we would - // have already performed these actions. - if (Instance.hasASTContext()) - performEndOfPipelineActions(Instance); - }; - if (Context.hadError()) return true; diff --git a/lib/FrontendTool/ScanDependencies.cpp b/lib/FrontendTool/ScanDependencies.cpp index f8974d96ea6f2..3487946ca3346 100644 --- a/lib/FrontendTool/ScanDependencies.cpp +++ b/lib/FrontendTool/ScanDependencies.cpp @@ -138,7 +138,38 @@ static std::vector resolveDirectDependencies( } } } - + // Only resolve cross-import overlays when this is the main module. + // For other modules, these overlays are explicitly written. + bool isMainModule = + instance.getMainModule()->getName().str() == module.first && + module.second == ModuleDependenciesKind::Swift; + if (isMainModule) { + // Modules explicitly imported. Only these can be secondary module. + std::vector explicitImports = result; + for (unsigned I = 0; I != result.size(); ++I) { + auto dep = result[I]; + auto moduleName = dep.first; + auto dependencies = *cache.findDependencies(moduleName, dep.second); + // Collect a map from secondary module name to cross-import overlay names. + auto overlayMap = dependencies.collectCrossImportOverlayNames( + instance.getASTContext(), moduleName); + if (overlayMap.empty()) + continue; + std::for_each(explicitImports.begin(), explicitImports.end(), + [&](ModuleDependencyID Id) { + // check if any explicitly imported modules can serve as a secondary + // module, and add the overlay names to the dependencies list. + for (auto overlayName: overlayMap[Id.first]) { + if (auto found = ctx.getModuleDependencies(overlayName.str(), + /*onlyClangModule=*/false, + cache, + ASTDelegate)) { + result.push_back({overlayName.str(), found->getKind()}); + } + } + }); + } + } return result; } diff --git a/lib/IDE/CodeCompletion.cpp b/lib/IDE/CodeCompletion.cpp index f05c3c8ffe83a..17ea784cd4988 100644 --- a/lib/IDE/CodeCompletion.cpp +++ b/lib/IDE/CodeCompletion.cpp @@ -2762,23 +2762,32 @@ class CompletionLookup final : public swift::VisibleDeclConsumer { const AnyFunctionType *AFT, const SubscriptDecl *SD, const Optional SemanticContext = None) { foundFunction(AFT); - auto genericSig = - SD->getInnermostDeclContext()->getGenericSignatureOfContext(); - AFT = eraseArchetypes(const_cast(AFT), genericSig) - ->castTo(); + if (SD) { + auto genericSig = + SD->getInnermostDeclContext()->getGenericSignatureOfContext(); + AFT = eraseArchetypes(const_cast(AFT), genericSig) + ->castTo(); + } CommandWordsPairs Pairs; CodeCompletionResultBuilder Builder( - Sink, CodeCompletionResult::ResultKind::Declaration, + Sink, + SD ? CodeCompletionResult::ResultKind::Declaration + : CodeCompletionResult::ResultKind::Pattern, SemanticContext ? *SemanticContext : getSemanticContextKind(SD), expectedTypeContext); - Builder.setAssociatedDecl(SD); - setClangDeclKeywords(SD, Pairs, Builder); + if (SD) { + Builder.setAssociatedDecl(SD); + setClangDeclKeywords(SD, Pairs, Builder); + } if (!HaveLParen) Builder.addLeftBracket(); else Builder.addAnnotatedLeftBracket(); - addCallArgumentPatterns(Builder, AFT, SD->getIndices()); + ArrayRef declParams; + if (SD) + declParams = SD->getIndices()->getArray(); + addCallArgumentPatterns(Builder, AFT->getParams(), declParams); if (!HaveLParen) Builder.addRightBracket(); else @@ -6063,7 +6072,7 @@ void CodeCompletionCallbacksImpl::doneParsing() { Lookup.getUnresolvedMemberCompletions(ContextInfo.getPossibleTypes()); break; } - case CompletionKind::CallArg : { + case CompletionKind::CallArg: { ExprContextInfo ContextInfo(CurDeclContext, CodeCompleteTokenExpr); bool shouldPerformGlobalCompletion = true; @@ -6072,9 +6081,12 @@ void CodeCompletionCallbacksImpl::doneParsing() { !ContextInfo.getPossibleCallees().empty()) { Lookup.setHaveLParen(true); for (auto &typeAndDecl : ContextInfo.getPossibleCallees()) { - if (auto SD = dyn_cast_or_null(typeAndDecl.Decl)) { - Lookup.addSubscriptCallPattern(typeAndDecl.Type, SD, - typeAndDecl.SemanticContext); + auto apply = ContextInfo.getAnalyzedExpr(); + if (apply && isa(apply)) { + Lookup.addSubscriptCallPattern( + typeAndDecl.Type, + dyn_cast_or_null(typeAndDecl.Decl), + typeAndDecl.SemanticContext); } else { Lookup.addFunctionCallPattern( typeAndDecl.Type, diff --git a/lib/IDE/CommentConversion.cpp b/lib/IDE/CommentConversion.cpp index 35319263eaf48..db69658d6c46b 100644 --- a/lib/IDE/CommentConversion.cpp +++ b/lib/IDE/CommentConversion.cpp @@ -258,7 +258,7 @@ struct CommentToXMLConverter { OS << ""; } - void visitDocComment(const DocComment *DC); + void visitDocComment(const DocComment *DC, TypeOrExtensionDecl SynthesizedTarget); void visitCommentParts(const swift::markup::CommentParts &Parts); }; } // unnamed namespace @@ -297,7 +297,8 @@ void CommentToXMLConverter::visitCommentParts(const swift::markup::CommentParts } } -void CommentToXMLConverter::visitDocComment(const DocComment *DC) { +void CommentToXMLConverter:: +visitDocComment(const DocComment *DC, TypeOrExtensionDecl SynthesizedTarget) { const Decl *D = DC->getDecl(); StringRef RootEndTag; @@ -347,6 +348,10 @@ void CommentToXMLConverter::visitDocComment(const DocComment *DC) { { llvm::raw_svector_ostream OS(SS); Failed = ide::printValueDeclUSR(VD, OS); + if (!Failed && SynthesizedTarget) { + OS << "::SYNTHESIZED::"; + Failed = ide::printValueDeclUSR(SynthesizedTarget.getBaseNominal(), OS); + } } if (!Failed && !SS.empty()) { OS << "" << SS << ""; @@ -362,6 +367,9 @@ void CommentToXMLConverter::visitDocComment(const DocComment *DC) { PO.VarInitializers = false; PO.ShouldQualifyNestedDeclarations = PrintOptions::QualifyNestedDeclarations::TypesOnly; + PO.SkipUnderscoredStdlibProtocols = false; + if (SynthesizedTarget) + PO.initForSynthesizedExtension(SynthesizedTarget); OS << ""; llvm::SmallString<32> DeclSS; @@ -398,12 +406,15 @@ static bool getClangDocumentationCommentAsXML(const clang::Decl *D, return true; } -static void replaceObjcDeclarationsWithSwiftOnes(const Decl *D, - StringRef Doc, - raw_ostream &OS) { +static void +replaceObjcDeclarationsWithSwiftOnes(const Decl *D, StringRef Doc, + raw_ostream &OS, + TypeOrExtensionDecl SynthesizedTarget) { StringRef Open = ""; StringRef Close = ""; PrintOptions Options = PrintOptions::printQuickHelpDeclaration(); + if (SynthesizedTarget) + Options.initForSynthesizedExtension(SynthesizedTarget); std::string S; llvm::raw_string_ostream SS(S); D->print(SS, Options); @@ -444,14 +455,16 @@ std::string ide::extractPlainTextFromComment(const StringRef Text) { return getLineListFromComment(SourceMgr, MC, Text).str(); } -bool ide::getDocumentationCommentAsXML(const Decl *D, raw_ostream &OS) { +bool ide::getDocumentationCommentAsXML(const Decl *D, raw_ostream &OS, + TypeOrExtensionDecl SynthesizedTarget) { auto MaybeClangNode = D->getClangNode(); if (MaybeClangNode) { if (auto *CD = MaybeClangNode.getAsDecl()) { std::string S; llvm::raw_string_ostream SS(S); if (getClangDocumentationCommentAsXML(CD, SS)) { - replaceObjcDeclarationsWithSwiftOnes(D, SS.str(), OS); + replaceObjcDeclarationsWithSwiftOnes(D, SS.str(), OS, + SynthesizedTarget); return true; } } @@ -464,7 +477,7 @@ bool ide::getDocumentationCommentAsXML(const Decl *D, raw_ostream &OS) { return false; CommentToXMLConverter Converter(OS); - Converter.visitDocComment(DC); + Converter.visitDocComment(DC, SynthesizedTarget); OS.flush(); return true; diff --git a/lib/IDE/CompletionInstance.cpp b/lib/IDE/CompletionInstance.cpp index 7a00e4c627343..e1aadf8a5b610 100644 --- a/lib/IDE/CompletionInstance.cpp +++ b/lib/IDE/CompletionInstance.cpp @@ -328,9 +328,7 @@ bool CompletionInstance::performCachedOperationIfPossible( registerSILGenRequestFunctions(tmpCtx->evaluator); ModuleDecl *tmpM = ModuleDecl::create(Identifier(), *tmpCtx); SourceFile *tmpSF = new (*tmpCtx) - SourceFile(*tmpM, oldSF->Kind, tmpBufferID, /*KeepParsedTokens=*/false, - /*BuildSyntaxTree=*/false, oldSF->getParsingOptions()); - tmpSF->enableInterfaceHash(); + SourceFile(*tmpM, oldSF->Kind, tmpBufferID, oldSF->getParsingOptions()); // FIXME: Since we don't setup module loaders on the temporary AST context, // 'canImport()' conditional compilation directive always fails. That causes @@ -441,10 +439,9 @@ bool CompletionInstance::performCachedOperationIfPossible( auto &Ctx = oldM->getASTContext(); auto *newM = ModuleDecl::createMainModule(Ctx, oldM->getName(), oldM->getImplicitImportInfo()); - auto *newSF = - new (Ctx) SourceFile(*newM, SourceFileKind::Main, newBufferID); + auto *newSF = new (Ctx) SourceFile(*newM, SourceFileKind::Main, newBufferID, + oldSF->getParsingOptions()); newM->addFile(*newSF); - newSF->enableInterfaceHash(); // Tell the compiler instance we've replaced the main module. CI.setMainModule(newM); diff --git a/lib/IDE/ExprContextAnalysis.cpp b/lib/IDE/ExprContextAnalysis.cpp index d93d311f45493..05aeef6bef665 100644 --- a/lib/IDE/ExprContextAnalysis.cpp +++ b/lib/IDE/ExprContextAnalysis.cpp @@ -299,8 +299,11 @@ class ExprParentFinder : public ASTWalker { static void collectPossibleCalleesByQualifiedLookup( DeclContext &DC, Type baseTy, DeclNameRef name, SmallVectorImpl &candidates) { - bool isOnMetaType = baseTy->is(); auto baseInstanceTy = baseTy->getMetatypeInstanceType(); + if (!baseInstanceTy->mayHaveMembers()) + return; + + bool isOnMetaType = baseTy->is(); SmallVector decls; if (!DC.lookupQualified(baseInstanceTy, @@ -389,8 +392,6 @@ static void collectPossibleCalleesByQualifiedLookup( baseTy = *baseTyOpt; } baseTy = baseTy->getWithoutSpecifierType(); - if (!baseTy->getMetatypeInstanceType()->mayHaveMembers()) - return; // Use metatype for lookup 'super.init' if it's inside constructors. if (isa(baseExpr) && isa(DC) && @@ -398,6 +399,22 @@ static void collectPossibleCalleesByQualifiedLookup( baseTy = MetatypeType::get(baseTy); collectPossibleCalleesByQualifiedLookup(DC, baseTy, name, candidates); + + // Add virtual 'subscript(keyPath: KeyPath) -> Value'. + if (name.getBaseName() == DeclBaseName::createSubscript() && + (baseTy->getAnyNominal() || baseTy->is() || + baseTy->is())) { + auto &Ctx = DC.getASTContext(); + + auto *kpDecl = Ctx.getKeyPathDecl(); + Type kpTy = kpDecl->mapTypeIntoContext(kpDecl->getDeclaredInterfaceType()); + Type kpValueTy = kpTy->castTo()->getGenericArgs()[1]; + kpTy = BoundGenericType::get(kpDecl, Type(), {baseTy, kpValueTy}); + + Type fnTy = FunctionType::get( + {AnyFunctionType::Param(kpTy, Ctx.Id_keyPath)}, kpValueTy); + candidates.emplace_back(fnTy->castTo(), nullptr); + } } /// For the given \c callExpr, collect possible callee types and declarations. diff --git a/lib/IDE/Formatting.cpp b/lib/IDE/Formatting.cpp index cf601d5b7d5b2..102e0786ebfe9 100644 --- a/lib/IDE/Formatting.cpp +++ b/lib/IDE/Formatting.cpp @@ -446,7 +446,7 @@ class RangeWalker: protected ASTWalker { } } for (auto *customAttr : D->getAttrs().getAttributes()) { - if (auto *Repr = customAttr->getTypeLoc().getTypeRepr()) { + if (auto *Repr = customAttr->getTypeRepr()) { if (!Repr->walk(*this)) return false; } @@ -1260,7 +1260,7 @@ class FormatWalker : public ASTWalker { } } for (auto *customAttr : D->getAttrs().getAttributes()) { - if (auto *Repr = customAttr->getTypeLoc().getTypeRepr()) { + if (auto *Repr = customAttr->getTypeRepr()) { if (!Repr->walk(*this)) return false; } diff --git a/lib/IDE/IDETypeChecking.cpp b/lib/IDE/IDETypeChecking.cpp index 57c124d7f184e..c928cb3dd6824 100644 --- a/lib/IDE/IDETypeChecking.cpp +++ b/lib/IDE/IDETypeChecking.cpp @@ -282,7 +282,10 @@ struct SynthesizedExtensionAnalyzer::Implementation { auto handleRequirements = [&](SubstitutionMap subMap, GenericSignature GenericSig, + ExtensionDecl *OwningExt, ArrayRef Reqs) { + ProtocolDecl *BaseProto = OwningExt->getInnermostDeclContext() + ->getSelfProtocolDecl(); for (auto Req : Reqs) { auto Kind = Req.getKind(); @@ -290,8 +293,16 @@ struct SynthesizedExtensionAnalyzer::Implementation { if (Kind == RequirementKind::Layout) continue; - auto First = Req.getFirstType(); - auto Second = Req.getSecondType(); + Type First = Req.getFirstType(); + Type Second = Req.getSecondType(); + + // Skip protocol's Self : requirement. + if (BaseProto && + Req.getKind() == RequirementKind::Conformance && + First->isEqual(BaseProto->getSelfInterfaceType()) && + Second->getAnyNominal() == BaseProto) + continue; + if (!BaseType->isExistentialType()) { First = First.subst(subMap); Second = Second.subst(subMap); @@ -346,19 +357,29 @@ struct SynthesizedExtensionAnalyzer::Implementation { // the extension to the interface types of the base type's // declaration. SubstitutionMap subMap; - if (!BaseType->isExistentialType()) - subMap = BaseType->getContextSubstitutionMap(M, Ext); + if (!BaseType->isExistentialType()) { + if (auto *NTD = Ext->getExtendedNominal()) + subMap = BaseType->getContextSubstitutionMap(M, NTD); + } assert(Ext->getGenericSignature() && "No generic signature."); auto GenericSig = Ext->getGenericSignature(); - if (handleRequirements(subMap, GenericSig, GenericSig->getRequirements())) + if (handleRequirements(subMap, GenericSig, Ext, GenericSig->getRequirements())) return {Result, MergeInfo}; } - if (Conf && handleRequirements(Conf->getSubstitutions(M), - Conf->getGenericSignature(), - Conf->getConditionalRequirements())) - return {Result, MergeInfo}; + if (Conf) { + SubstitutionMap subMap; + if (!BaseType->isExistentialType()) { + if (auto *NTD = EnablingExt->getExtendedNominal()) + subMap = BaseType->getContextSubstitutionMap(M, NTD); + } + if (handleRequirements(subMap, + Conf->getGenericSignature(), + EnablingExt, + Conf->getConditionalRequirements())) + return {Result, MergeInfo}; + } Result.Ext = Ext; return {Result, MergeInfo}; @@ -431,7 +452,14 @@ struct SynthesizedExtensionAnalyzer::Implementation { auto handleExtension = [&](ExtensionDecl *E, bool Synthesized, ExtensionDecl *EnablingE, NormalProtocolConformance *Conf) { - if (Options.shouldPrint(E)) { + PrintOptions AdjustedOpts = Options; + if (Synthesized) { + // Members from underscored system protocols should still appear as + // members of the target type, even if the protocols themselves are not + // printed. + AdjustedOpts.SkipUnderscoredStdlibProtocols = false; + } + if (AdjustedOpts.shouldPrint(E)) { auto Pair = isApplicable(E, Synthesized, EnablingE, Conf); if (Pair.first) { InfoMap->insert({E, Pair.first}); diff --git a/lib/IDE/Refactoring.cpp b/lib/IDE/Refactoring.cpp index 080cb1ef1330f..a64ad89315458 100644 --- a/lib/IDE/Refactoring.cpp +++ b/lib/IDE/Refactoring.cpp @@ -1174,13 +1174,12 @@ getNotableRegions(StringRef SourceText, unsigned NameOffset, StringRef Name, Invocation.getFrontendOptions().InputsAndOutputs.addInput( InputFile("", true, InputBuffer.get())); Invocation.getFrontendOptions().ModuleName = "extract"; + Invocation.getLangOptions().DisablePoundIfEvaluation = true; auto Instance = std::make_unique(); if (Instance->setup(Invocation)) llvm_unreachable("Failed setup"); - Instance->performParseOnly(); - unsigned BufferId = Instance->getPrimarySourceFile()->getBufferID().getValue(); SourceManager &SM = Instance->getSourceMgr(); SourceLoc NameLoc = SM.getLocForOffset(BufferId, NameOffset); @@ -3127,7 +3126,7 @@ struct MemberwiseParameter { Expr *DefaultExpr; MemberwiseParameter(Identifier name, Type type, Expr *initialExpr) - : Name(name), MemberType(type), DefaultExpr(initialExpr) {} + : Name(name), MemberType(type), DefaultExpr(initialExpr) {} }; static void generateMemberwiseInit(SourceEditConsumer &EditConsumer, @@ -3140,7 +3139,16 @@ static void generateMemberwiseInit(SourceEditConsumer &EditConsumer, EditConsumer.accept(SM, targetLocation, "\ninternal init("); auto insertMember = [&SM](const MemberwiseParameter &memberData, llvm::raw_ostream &OS, bool wantsSeparator) { - OS << memberData.Name << ": " << memberData.MemberType.getString(); + { + OS << memberData.Name << ": "; + // Unconditionally print '@escaping' if we print out a function type - + // the assignments we generate below will escape this parameter. + if (isa(memberData.MemberType->getCanonicalType())) { + OS << "@" << TypeAttributes::getAttrName(TAK_escaping) << " "; + } + OS << memberData.MemberType.getString(); + } + if (auto *expr = memberData.DefaultExpr) { if (isa(expr)) { OS << " = nil"; @@ -3659,16 +3667,25 @@ static CallExpr *findTrailingClosureTarget(SourceManager &SM, return N.isStmt(StmtKind::Brace) || N.isExpr(ExprKind::Call); }); Finder.resolve(); - if (Finder.getContexts().empty() - || !Finder.getContexts().back().is()) + auto contexts = Finder.getContexts(); + if (contexts.empty()) + return nullptr; + + // If the innermost context is a statement (which will be a BraceStmt per + // the filtering condition above), drop it. + if (contexts.back().is()) { + contexts = contexts.drop_back(); + } + + if (contexts.empty() || !contexts.back().is()) return nullptr; - CallExpr *CE = cast(Finder.getContexts().back().get()); + CallExpr *CE = cast(contexts.back().get()); if (CE->hasTrailingClosure()) // Call expression already has a trailing closure. return nullptr; - // The last arugment is a closure? + // The last argument is a closure? Expr *Args = CE->getArg(); if (!Args) return nullptr; diff --git a/lib/IDE/SourceEntityWalker.cpp b/lib/IDE/SourceEntityWalker.cpp index f2dc3e165a072..d52e8c43fd368 100644 --- a/lib/IDE/SourceEntityWalker.cpp +++ b/lib/IDE/SourceEntityWalker.cpp @@ -598,7 +598,7 @@ bool SemaAnnotator::handleCustomAttributes(Decl *D) { } } for (auto *customAttr : D->getAttrs().getAttributes()) { - if (auto *Repr = customAttr->getTypeLoc().getTypeRepr()) { + if (auto *Repr = customAttr->getTypeRepr()) { if (!Repr->walk(*this)) return false; } diff --git a/lib/IDE/SwiftSourceDocInfo.cpp b/lib/IDE/SwiftSourceDocInfo.cpp index f8211c437795a..a08719d75af83 100644 --- a/lib/IDE/SwiftSourceDocInfo.cpp +++ b/lib/IDE/SwiftSourceDocInfo.cpp @@ -177,7 +177,7 @@ bool NameMatcher::handleCustomAttrs(Decl *D) { if (shouldSkip(customAttr->getRangeWithAt())) continue; auto *Arg = customAttr->getArg(); - if (auto *Repr = customAttr->getTypeLoc().getTypeRepr()) { + if (auto *Repr = customAttr->getTypeRepr()) { // Note the associated call arguments of the semantic initializer call // in case we're resolving an explicit initializer call within the // CustomAttr's type, e.g. on `Wrapper` in `@Wrapper(wrappedValue: 10)`. diff --git a/lib/IDE/SyntaxModel.cpp b/lib/IDE/SyntaxModel.cpp index aa97eb458e3b0..0d06879c184a7 100644 --- a/lib/IDE/SyntaxModel.cpp +++ b/lib/IDE/SyntaxModel.cpp @@ -1199,7 +1199,7 @@ bool ModelASTWalker::handleSpecialDeclAttribute(const DeclAttribute *D, ExcludeNodeAtLocation).shouldContinue) return false; if (auto *CA = dyn_cast(D)) { - if (auto *Repr = CA->getTypeLoc().getTypeRepr()) { + if (auto *Repr = CA->getTypeRepr()) { if (!Repr->walk(*this)) return false; } diff --git a/lib/IRGen/GenArchetype.cpp b/lib/IRGen/GenArchetype.cpp index a74f5496f567b..84f9c98b2e55e 100644 --- a/lib/IRGen/GenArchetype.cpp +++ b/lib/IRGen/GenArchetype.cpp @@ -468,7 +468,7 @@ bool shouldUseOpaqueTypeDescriptorAccessor(OpaqueTypeDecl *opaque) { // Don't emit accessors for functions that are not dynamic or dynamic // replacements. - return namingDecl->isNativeDynamic() || + return namingDecl->shouldUseNativeDynamicDispatch() || (bool)namingDecl->getDynamicallyReplacedDecl(); } diff --git a/lib/IRGen/GenClass.cpp b/lib/IRGen/GenClass.cpp index f613828649ee9..2098294809116 100644 --- a/lib/IRGen/GenClass.cpp +++ b/lib/IRGen/GenClass.cpp @@ -207,6 +207,13 @@ namespace { /// to compute FieldAccesses for them. void addFieldsForClass(ClassDecl *theClass, SILType classType, bool superclass) { + addFieldsForClassImpl(theClass, classType, theClass, classType, + superclass); + } + + void addFieldsForClassImpl(ClassDecl *rootClass, SILType rootClassType, + ClassDecl *theClass, SILType classType, + bool superclass) { if (theClass->hasClangNode()) { Options |= ClassMetadataFlags::ClassHasObjCAncestry; return; @@ -240,7 +247,8 @@ namespace { } else { // Otherwise, we are allowed to have total knowledge of the superclass // fields, so walk them to compute the layout. - addFieldsForClass(superclassDecl, superclassType, /*superclass=*/true); + addFieldsForClassImpl(rootClass, rootClassType, superclassDecl, + superclassType, /*superclass=*/true); } } @@ -259,11 +267,12 @@ namespace { } // Collect fields from this class and add them to the layout as a chunk. - addDirectFieldsFromClass(theClass, classType, superclass); + addDirectFieldsFromClass(rootClass, rootClassType, theClass, classType, + superclass); } - void addDirectFieldsFromClass(ClassDecl *theClass, - SILType classType, + void addDirectFieldsFromClass(ClassDecl *rootClass, SILType rootClassType, + ClassDecl *theClass, SILType classType, bool superclass) { for (VarDecl *var : theClass->getStoredProperties()) { SILType type = classType.getFieldType(var, IGM.getSILModule(), @@ -287,9 +296,9 @@ namespace { bool isKnownEmpty = !addField(element, LayoutStrategy::Universal); bool isSpecializedGeneric = - (theClass->isGenericContext() && !classType.getASTType() - ->getRecursiveProperties() - .hasUnboundGeneric()); + (rootClass->isGenericContext() && !rootClassType.getASTType() + ->getRecursiveProperties() + .hasUnboundGeneric()); // The 'Elements' list only contains superclass fields when we're // building a layout for tail allocation. diff --git a/lib/IRGen/GenDecl.cpp b/lib/IRGen/GenDecl.cpp index 7e6710311b798..d50173195d07e 100644 --- a/lib/IRGen/GenDecl.cpp +++ b/lib/IRGen/GenDecl.cpp @@ -2566,7 +2566,7 @@ void IRGenModule::emitOpaqueTypeDescriptorAccessor(OpaqueTypeDecl *opaque) { // Don't emit accessors for functions that are not dynamic or dynamic // replacements. if (!abstractStorage) { - isNativeDynamic = namingDecl->isNativeDynamic(); + isNativeDynamic = namingDecl->shouldUseNativeDynamicDispatch(); if (!isNativeDynamic && !isDynamicReplacement) return; } @@ -3303,7 +3303,10 @@ llvm::Constant *IRGenModule::emitSwiftProtocols() { } void IRGenModule::addProtocolConformance(ConformanceDescription &&record) { - // Add this protocol conformance. + + emitProtocolConformance(record); + + // Add this conformance to the conformance list. ProtocolConformances.push_back(std::move(record)); } @@ -3312,10 +3315,6 @@ llvm::Constant *IRGenModule::emitProtocolConformances() { if (ProtocolConformances.empty()) return nullptr; - // Emit the conformances. - for (const auto &record : ProtocolConformances) - emitProtocolConformance(record); - // Define the global variable for the conformance list. ConstantInitBuilder builder(*this); auto descriptorArray = builder.beginArray(RelativeAddressTy); diff --git a/lib/IRGen/GenDiffFunc.cpp b/lib/IRGen/GenDiffFunc.cpp index fa772ab7b49e0..24bac7bef01c3 100644 --- a/lib/IRGen/GenDiffFunc.cpp +++ b/lib/IRGen/GenDiffFunc.cpp @@ -46,15 +46,17 @@ class DifferentiableFuncFieldInfo final public: DifferentiableFuncFieldInfo( NormalDifferentiableFunctionTypeComponent component, const TypeInfo &type, - IndexSubset *parameterIndices) + IndexSubset *parameterIndices, IndexSubset *resultIndices) : RecordField(type), component(component), - parameterIndices(parameterIndices) {} + parameterIndices(parameterIndices), resultIndices(resultIndices) {} /// The field index. const NormalDifferentiableFunctionTypeComponent component; /// The parameter indices. IndexSubset *parameterIndices; + /// The result indices. + IndexSubset *resultIndices; std::string getFieldName() const { switch (component) { @@ -75,7 +77,7 @@ class DifferentiableFuncFieldInfo final return SILType::getPrimitiveObjectType(origFnTy); auto kind = *component.getAsDerivativeFunctionKind(); auto assocTy = origFnTy->getAutoDiffDerivativeFunctionType( - parameterIndices, /*resultIndex*/ 0, kind, IGM.getSILTypes(), + parameterIndices, resultIndices, kind, IGM.getSILTypes(), LookUpConformanceInModule(IGM.getSwiftModule())); return SILType::getPrimitiveObjectType(assocTy); } @@ -132,12 +134,14 @@ class DifferentiableFuncTypeBuilder SILFunctionType *originalType; IndexSubset *parameterIndices; + IndexSubset *resultIndices; public: DifferentiableFuncTypeBuilder(IRGenModule &IGM, SILFunctionType *fnTy) : RecordTypeBuilder(IGM), originalType(fnTy->getWithoutDifferentiability()), - parameterIndices(fnTy->getDifferentiabilityParameterIndices()) { + parameterIndices(fnTy->getDifferentiabilityParameterIndices()), + resultIndices(fnTy->getDifferentiabilityResultIndices()) { assert(fnTy->getDifferentiabilityKind() == DifferentiabilityKind::Normal); } @@ -165,7 +169,8 @@ class DifferentiableFuncTypeBuilder getFieldInfo(unsigned index, NormalDifferentiableFunctionTypeComponent component, const TypeInfo &fieldTI) { - return DifferentiableFuncFieldInfo(component, fieldTI, parameterIndices); + return DifferentiableFuncFieldInfo(component, fieldTI, parameterIndices, + resultIndices); } SILType getType(NormalDifferentiableFunctionTypeComponent component) { @@ -173,7 +178,7 @@ class DifferentiableFuncTypeBuilder return SILType::getPrimitiveObjectType(originalType->getCanonicalType()); auto kind = *component.getAsDerivativeFunctionKind(); auto assocTy = originalType->getAutoDiffDerivativeFunctionType( - parameterIndices, /*resultIndex*/ 0, kind, IGM.getSILTypes(), + parameterIndices, resultIndices, kind, IGM.getSILTypes(), LookUpConformanceInModule(IGM.getSwiftModule())); return SILType::getPrimitiveObjectType(assocTy); } diff --git a/lib/IRGen/GenMeta.cpp b/lib/IRGen/GenMeta.cpp index 927f329420c77..3762857f8c1fc 100644 --- a/lib/IRGen/GenMeta.cpp +++ b/lib/IRGen/GenMeta.cpp @@ -1563,7 +1563,7 @@ namespace { auto flags = getMethodDescriptorFlags(func); // Remember if the declaration was dynamic. - if (func->isObjCDynamic()) + if (func->shouldUseObjCDispatch()) flags = flags.withIsDynamic(true); // Include the pointer-auth discriminator. diff --git a/lib/IRGen/GenObjC.cpp b/lib/IRGen/GenObjC.cpp index ec583b9a54997..c46cadcaa5745 100644 --- a/lib/IRGen/GenObjC.cpp +++ b/lib/IRGen/GenObjC.cpp @@ -1435,12 +1435,22 @@ void irgen::emitObjCSetterDescriptor(IRGenModule &IGM, emitObjCDescriptor(IGM, descriptors, descriptor); } +static bool isObjCGenericClassExtension(ValueDecl *decl) { + // Don't emit category entries for @objc methods in extensions they would + // normally be disallowed except for @_dynamicReplacement(for:) methods that + // use the native dynamic replacement mechanism instead of objc categories. + auto *DC = decl->getDeclContext(); + if (!isa(DC)) + return false; + return decl->isNativeMethodReplacement(); +} + bool irgen::requiresObjCMethodDescriptor(FuncDecl *method) { // Property accessors should be generated alongside the property. if (isa(method)) return false; - return method->isObjC(); + return method->isObjC() && !isObjCGenericClassExtension(method); } bool irgen::requiresObjCMethodDescriptor(ConstructorDecl *constructor) { @@ -1452,12 +1462,13 @@ bool irgen::requiresObjCPropertyDescriptor(IRGenModule &IGM, // Don't generate a descriptor for a property without any accessors. // This is only possible in SIL files because Sema will normally // implicitly synthesize accessors for @objc properties. - return property->isObjC() && property->requiresOpaqueAccessors(); + return property->isObjC() && property->requiresOpaqueAccessors() && + !isObjCGenericClassExtension(property); } bool irgen::requiresObjCSubscriptDescriptor(IRGenModule &IGM, SubscriptDecl *subscript) { - return subscript->isObjC(); + return subscript->isObjC() && !isObjCGenericClassExtension(subscript); } llvm::Value *IRGenFunction::emitBlockCopyCall(llvm::Value *value) { diff --git a/lib/IRGen/IRGenSIL.cpp b/lib/IRGen/IRGenSIL.cpp index a6114f47737c4..1942a358c7779 100644 --- a/lib/IRGen/IRGenSIL.cpp +++ b/lib/IRGen/IRGenSIL.cpp @@ -696,6 +696,29 @@ class IRGenSILFunction : return !isa(Storage); } +#ifndef NDEBUG + /// Check if \p Val can be stored into \p Alloca, and emit some diagnostic + /// info if it can't. + bool canAllocaStoreValue(Address Alloca, llvm::Value *Val, + SILDebugVariable VarInfo, + const SILDebugScope *Scope) { + bool canStore = + cast(Alloca->getType())->getElementType() == + Val->getType(); + if (canStore) + return true; + llvm::errs() << "Invalid shadow copy:\n" + << " Value : " << *Val << "\n" + << " Alloca: " << *Alloca.getAddress() << "\n" + << "---\n" + << "Previous shadow copy into " << VarInfo.Name + << " in the same scope!\n" + << "Scope:\n"; + Scope->print(getSILModule()); + return false; + } +#endif + /// Unconditionally emit a stack shadow copy of an \c llvm::Value. llvm::Value *emitShadowCopy(llvm::Value *Storage, const SILDebugScope *Scope, SILDebugVariable VarInfo, llvm::Optional _Align) { @@ -706,7 +729,8 @@ class IRGenSILFunction : if (!Alloca.isValid()) Alloca = createAlloca(Storage->getType(), Align, VarInfo.Name + ".debug"); zeroInit(cast(Alloca.getAddress())); - + assert(canAllocaStoreValue(Alloca, Storage, VarInfo, Scope) && + "bad scope?"); ArtificialLocation AutoRestore(Scope, IGM.DebugInfo.get(), Builder); Builder.CreateStore(Storage, Alloca.getAddress(), Align); return Alloca.getAddress(); @@ -1852,7 +1876,8 @@ void IRGenSILFunction::visitDifferentiableFunctionInst( auto origFnType = i->getOriginalFunction()->getType().castTo(); auto derivativeFnType = origFnType->getAutoDiffDerivativeFunctionType( - i->getParameterIndices(), /*resultIndex*/ 0, kind, i->getModule().Types, + i->getParameterIndices(), i->getResultIndices(), kind, + i->getModule().Types, LookUpConformanceInModule(i->getModule().getSwiftModule())); auto *undef = SILUndef::get( SILType::getPrimitiveObjectType(derivativeFnType), *i->getFunction()); diff --git a/lib/IRGen/LoadableByAddress.cpp b/lib/IRGen/LoadableByAddress.cpp index e096798cee1c6..01abf45d6e0e7 100644 --- a/lib/IRGen/LoadableByAddress.cpp +++ b/lib/IRGen/LoadableByAddress.cpp @@ -2841,7 +2841,7 @@ bool LoadableByAddress::recreateConvInstr(SILInstruction &I, auto instr = cast(convInstr); newInstr = convBuilder.createDifferentiableFunction( instr->getLoc(), instr->getParameterIndices(), - instr->getOriginalFunction(), + instr->getResultIndices(), instr->getOriginalFunction(), instr->getOptionalDerivativeFunctionPair()); break; } diff --git a/lib/IRGen/MetadataRequest.cpp b/lib/IRGen/MetadataRequest.cpp index 1ffa24555c328..d593ab3bcd095 100644 --- a/lib/IRGen/MetadataRequest.cpp +++ b/lib/IRGen/MetadataRequest.cpp @@ -672,7 +672,7 @@ static MetadataResponse emitNominalMetadataRef(IRGenFunction &IGF, } else if (auto theClass = dyn_cast(theDecl)) { if (isCanonicalSpecializedNominalTypeMetadataStaticallyAddressable( IGF.IGM, *theClass, theType, - /*usingCanonicalSpecializedAccessor=*/true)) { + ForUseOnlyFromAccessor)) { llvm::Function *accessor = IGF.IGM .getAddrOfCanonicalSpecializedGenericTypeMetadataAccessFunction( @@ -699,7 +699,7 @@ static MetadataResponse emitNominalMetadataRef(IRGenFunction &IGF, bool irgen::isCanonicalSpecializedNominalTypeMetadataStaticallyAddressable( IRGenModule &IGM, NominalTypeDecl &nominal, CanType type, - bool usingCanonicalSpecializedAccessor) { + CanonicalSpecializedMetadataUsageIsOnlyFromAccessor onlyFromAccessor) { assert(nominal.isGenericContext()); if (!IGM.shouldPrespecializeGenericMetadata()) { @@ -750,7 +750,10 @@ bool irgen::isCanonicalSpecializedNominalTypeMetadataStaticallyAddressable( auto superclassType = type->getSuperclass(/*useArchetypes=*/false)->getCanonicalType(); if (!isInitializableTypeMetadataStaticallyAddressable(IGM, - superclassType)) { + superclassType) && + !tryEmitConstantHeapMetadataRef( + IGM, superclassType, + /*allowDynamicUninitialized=*/false)) { return false; } } @@ -788,7 +791,7 @@ bool irgen::isCanonicalSpecializedNominalTypeMetadataStaticallyAddressable( (protocols.size() > 0); }; auto metadataAccessIsTrivial = [&]() { - if (usingCanonicalSpecializedAccessor) { + if (onlyFromAccessor) { // If an accessor is being used, then the accessor will be able to // initialize the arguments, i.e. register classes with the ObjC // runtime. @@ -821,7 +824,7 @@ bool irgen:: // Struct> // Enum> return isCanonicalSpecializedNominalTypeMetadataStaticallyAddressable( - IGM, nominal, type, /*usingCanonicalSpecializedAccessor=*/false); + IGM, nominal, type, NotForUseOnlyFromAccessor); } /// Is there a known address for canonical specialized metadata? The metadata @@ -841,7 +844,7 @@ bool irgen::isInitializableTypeMetadataStaticallyAddressable(IRGenModule &IGM, // runtime. // Concretely, Clazz> can be prespecialized. return isCanonicalSpecializedNominalTypeMetadataStaticallyAddressable( - IGM, *nominal, type, /*usingCanonicalSpecializedAccessor=*/true); + IGM, *nominal, type, ForUseOnlyFromAccessor); } return false; @@ -923,7 +926,7 @@ bool irgen::shouldCacheTypeMetadataAccess(IRGenModule &IGM, CanType type) { return true; if (classDecl->isGenericContext() && isCanonicalSpecializedNominalTypeMetadataStaticallyAddressable( - IGM, *classDecl, type, /*usingCanonicalSpecializedAccessor=*/true)) + IGM, *classDecl, type, ForUseOnlyFromAccessor)) return false; auto strategy = IGM.getClassMetadataStrategy(classDecl); return strategy != ClassMetadataStrategy::Fixed; @@ -2172,12 +2175,21 @@ emitIdempotentCanonicalSpecializedClassMetadataInitializationComponent( return; } initializedTypes.insert(theType); - llvm::Function *accessor = - IGF.IGM.getAddrOfCanonicalSpecializedGenericTypeMetadataAccessFunction( - theType, NotForDefinition); + auto *classDecl = theType->getClassOrBoundGenericClass(); + assert(classDecl); + if (classDecl->isGenericContext()) { + llvm::Function *accessor = + IGF.IGM.getAddrOfCanonicalSpecializedGenericTypeMetadataAccessFunction( + theType, NotForDefinition); - auto request = DynamicMetadataRequest(MetadataState::Complete); - IGF.emitGenericTypeMetadataAccessFunctionCall(accessor, {}, request); + auto request = DynamicMetadataRequest(MetadataState::Complete); + IGF.emitGenericTypeMetadataAccessFunctionCall(accessor, {}, request); + } else { + llvm::Function *accessor = + IGF.IGM.getAddrOfTypeMetadataAccessFunction(theType, NotForDefinition); + auto request = DynamicMetadataRequest(MetadataState::Complete); + IGF.emitGenericTypeMetadataAccessFunctionCall(accessor, {}, request); + } } MetadataResponse @@ -2197,10 +2209,6 @@ irgen::emitCanonicalSpecializedGenericTypeMetadataAccessFunction( assert(nominal->isGenericContext()); assert(!theType->hasUnboundGenericType()); - auto *uninitializedMetadata = IGF.IGM.getAddrOfTypeMetadata(theType); - initializedTypes.insert(theType); - auto *initializedMetadata = - emitIdempotentClassMetadataInitialization(IGF, uninitializedMetadata); auto requirements = GenericTypeRequirements(IGF.IGM, nominal); auto substitutions = theType->getContextSubstitutionMap(IGF.IGM.getSwiftModule(), nominal); @@ -2220,12 +2228,14 @@ irgen::emitCanonicalSpecializedGenericTypeMetadataAccessFunction( if (superclassType) { auto superclass = superclassType->getCanonicalType(); auto *superclassNominal = superclass->getAnyNominal(); - if (superclassNominal->isGenericContext()) { - emitIdempotentCanonicalSpecializedClassMetadataInitializationComponent( - IGF, superclassType->getCanonicalType(), initializedTypes); - } + emitIdempotentCanonicalSpecializedClassMetadataInitializationComponent( + IGF, superclassType->getCanonicalType(), initializedTypes); } + auto *uninitializedMetadata = IGF.IGM.getAddrOfTypeMetadata(theType); + initializedTypes.insert(theType); + auto *initializedMetadata = + emitIdempotentClassMetadataInitialization(IGF, uninitializedMetadata); return MetadataResponse::forComplete(initializedMetadata); } diff --git a/lib/IRGen/MetadataRequest.h b/lib/IRGen/MetadataRequest.h index 16b3a88576cf1..1bef5ea3f45cd 100644 --- a/lib/IRGen/MetadataRequest.h +++ b/lib/IRGen/MetadataRequest.h @@ -508,16 +508,21 @@ bool shouldCacheTypeMetadataAccess(IRGenModule &IGM, CanType type); bool isInitializableTypeMetadataStaticallyAddressable(IRGenModule &IGM, CanType type); +enum CanonicalSpecializedMetadataUsageIsOnlyFromAccessor : bool { + ForUseOnlyFromAccessor = true, + NotForUseOnlyFromAccessor = false +}; + /// Is the address of the canonical specialization of a generic metadata /// statically known? /// /// In other words, can a canonical specialization be formed for the specified -/// type. If usingCanonicalSpecializedAccessor is true, then metadata's address +/// type. If onlyFromAccess is ForUseOnlyFromAccessor, then metadata's address /// is known, but access to the metadata must go through the canonical /// specialized accessor so that initialization of the metadata can occur. bool isCanonicalSpecializedNominalTypeMetadataStaticallyAddressable( IRGenModule &IGM, NominalTypeDecl &nominal, CanType type, - bool usingCanonicalSpecializedAccessor); + CanonicalSpecializedMetadataUsageIsOnlyFromAccessor onlyFromAccessor); bool isCompleteCanonicalSpecializedNominalTypeMetadataStaticallyAddressable( IRGenModule &IGM, NominalTypeDecl &nominal, CanType type); diff --git a/lib/Index/Index.cpp b/lib/Index/Index.cpp index 8153592ff4dae..487eeace69098 100644 --- a/lib/Index/Index.cpp +++ b/lib/Index/Index.cpp @@ -343,13 +343,13 @@ class IndexSwiftASTWalker : public SourceEntityWalker { if (customAttr->isImplicit()) continue; - auto &Loc = customAttr->getTypeLoc(); if (auto *semanticInit = dyn_cast_or_null(customAttr->getSemanticInit())) { if (auto *CD = semanticInit->getCalledValue()) { if (!shouldIndex(CD, /*IsRef*/true)) continue; IndexSymbol Info; - if (initIndexSymbol(CD, Loc.getLoc(), /*IsRef=*/true, Info)) + const auto reprLoc = customAttr->getTypeRepr()->getLoc(); + if (initIndexSymbol(CD, reprLoc, /*IsRef=*/true, Info)) continue; Info.roles |= (unsigned)SymbolRole::Call; if (semanticInit->isImplicit()) diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 09010264d323f..b69991bafd180 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -236,9 +236,8 @@ void Parser::parseTopLevel(SmallVectorImpl &decls) { decls.push_back(decl); } - // Finalize the token receiver. + // Finalize the syntax context. SyntaxContext->addToken(Tok, LeadingTrivia, TrailingTrivia); - TokReceiver->finalize(); } bool Parser::parseTopLevelSIL() { @@ -812,10 +811,10 @@ Parser::parseImplementsAttribute(SourceLoc AtLoc, SourceLoc Loc) { } // FIXME(ModQual): Reject module qualification on MemberName. - + auto *TE = new (Context) TypeExpr(ProtocolType.get()); return ParserResult( ImplementsAttr::create(Context, AtLoc, SourceRange(Loc, rParenLoc), - ProtocolType.get(), MemberName.getFullName(), + TE, MemberName.getFullName(), MemberNameLoc)); } @@ -2219,7 +2218,8 @@ bool Parser::parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc, if (invalid) return false; - Attributes.add(TypeEraserAttr::create(Context, AtLoc, {Loc, RParenLoc}, ErasedType.get())); + auto *TE = new (Context) TypeExpr(ErasedType.get()); + Attributes.add(TypeEraserAttr::create(Context, AtLoc, {Loc, RParenLoc}, TE)); break; } @@ -2592,7 +2592,8 @@ ParserStatus Parser::parseDeclAttribute(DeclAttributes &Attributes, SourceLoc At } // Form the attribute. - auto attr = CustomAttr::create(Context, AtLoc, type.get(), hasInitializer, + auto *TE = new (Context) TypeExpr(type.get()); + auto attr = CustomAttr::create(Context, AtLoc, TE, hasInitializer, initContext, lParenLoc, args, argLabels, argLabelLocs, rParenLoc); Attributes.add(attr); @@ -4478,16 +4479,14 @@ Parser::parseDeclList(SourceLoc LBLoc, SourceLoc &RBLoc, Diag<> ErrorDiag, ParseDeclOptions Options, IterableDeclContext *IDC, bool &hadError) { - // Record the curly braces but nothing inside. + // If we're hashing the type body separately, record the curly braces but + // nothing inside for the interface hash. + Optional>> MemberHashingScope; if (IDC->areTokensHashedForThisBodyInsteadOfInterfaceHash()) { recordTokenHash("{"); recordTokenHash("}"); + MemberHashingScope.emplace(CurrentTokenHash, llvm::MD5()); } - llvm::MD5 tokenHashForThisDeclList; - llvm::SaveAndRestore> T( - CurrentTokenHash, IDC->areTokensHashedForThisBodyInsteadOfInterfaceHash() - ? &tokenHashForThisDeclList - : CurrentTokenHash); std::vector decls; ParserStatus Status; @@ -4522,7 +4521,8 @@ Parser::parseDeclList(SourceLoc LBLoc, SourceLoc &RBLoc, Diag<> ErrorDiag, return std::make_pair(decls, None); llvm::MD5::MD5Result result; - tokenHashForThisDeclList.final(result); + auto declListHash = MemberHashingScope ? *CurrentTokenHash : llvm::MD5(); + declListHash.final(result); llvm::SmallString<32> tokenHashString; llvm::MD5::stringifyResult(result, tokenHashString); return std::make_pair(decls, tokenHashString.str().str()); @@ -5696,12 +5696,7 @@ Parser::parseDeclVarGetSet(Pattern *pattern, ParseDeclOptions Flags, if (!PrimaryVar) return nullptr; - TypeLoc TyLoc; - if (auto *TP = dyn_cast(pattern)) { - TyLoc = TP->getTypeLoc(); - } - - if (!TyLoc.hasLocation()) { + if (!isa(pattern)) { if (accessors.Get || accessors.Set || accessors.Address || accessors.MutableAddress) { SourceLoc locAfterPattern = pattern->getLoc().getAdvancedLoc( @@ -6413,7 +6408,7 @@ void Parser::parseAbstractFunctionBody(AbstractFunctionDecl *AFD) { recordTokenHash("{"); recordTokenHash("}"); - llvm::SaveAndRestore> T(CurrentTokenHash, nullptr); + llvm::SaveAndRestore> T(CurrentTokenHash, None); // If we can delay parsing this body, or this is the first pass of code // completion, skip until the end. If we encounter a code completion token diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index 3922c9e2d1569..55176e22ccf71 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -78,7 +78,7 @@ ParserResult Parser::parseExprIs() { if (type.isNull()) return nullptr; - return makeParserResult(new (Context) IsExpr(isLoc, type.get())); + return makeParserResult(IsExpr::create(Context, isLoc, type.get())); } /// parseExprAs @@ -108,12 +108,13 @@ ParserResult Parser::parseExprAs() { Expr *parsed; if (questionLoc.isValid()) { - parsed = new (Context) ConditionalCheckedCastExpr(asLoc, questionLoc, - type.get()); + parsed = ConditionalCheckedCastExpr::create(Context, asLoc, questionLoc, + type.get()); } else if (exclaimLoc.isValid()) { - parsed = new (Context) ForcedCheckedCastExpr(asLoc, exclaimLoc, type.get()); + parsed = ForcedCheckedCastExpr::create(Context, asLoc, exclaimLoc, + type.get()); } else { - parsed = new (Context) CoerceExpr(asLoc, type.get()); + parsed = CoerceExpr::create(Context, asLoc, type.get()); } return makeParserResult(parsed); } @@ -1132,10 +1133,9 @@ Parser::parseExprPostfixSuffix(ParserResult Result, bool isExprBasic, if (CodeCompletion) { CodeCompletion->completeDotExpr(Result.get(), /*DotLoc=*/TokLoc); } - // Eat the code completion token because we handled it. - consumeToken(tok::code_complete); - Result.setHasCodeCompletion(); - return Result; + auto CCExpr = new (Context) CodeCompletionExpr(Result.get(), + consumeToken(tok::code_complete)); + return makeParserCodeCompletionResult(CCExpr); } DeclNameLoc NameLoc; diff --git a/lib/Parse/ParseIfConfig.cpp b/lib/Parse/ParseIfConfig.cpp index ac68043a60193..a1c260f1e38bd 100644 --- a/lib/Parse/ParseIfConfig.cpp +++ b/lib/Parse/ParseIfConfig.cpp @@ -677,8 +677,9 @@ ParserResult Parser::parseIfConfig( llvm::SaveAndRestore S(InInactiveClauseEnvironment, InInactiveClauseEnvironment || !isActive); // Disable updating the interface hash inside inactive blocks. - llvm::SaveAndRestore> T( - CurrentTokenHash, isActive ? CurrentTokenHash : nullptr); + Optional>> T; + if (!isActive) + T.emplace(CurrentTokenHash, None); if (isActive || !isVersionCondition) { parseElements(Elements, isActive); diff --git a/lib/Parse/ParsePattern.cpp b/lib/Parse/ParsePattern.cpp index c1631d2de3c4a..bf95b7375d0e7 100644 --- a/lib/Parse/ParsePattern.cpp +++ b/lib/Parse/ParsePattern.cpp @@ -1184,9 +1184,9 @@ ParserResult Parser::parseMatchingPattern(bool isExprBasic) { ParserResult castType = parseType(); if (castType.isNull() || castType.hasCodeCompletion()) return nullptr; - return makeParserResult(new (Context) IsPattern(isLoc, castType.get(), - nullptr, - CheckedCastKind::Unresolved)); + auto *CastTE = new (Context) TypeExpr(castType.get()); + return makeParserResult(new (Context) IsPattern( + isLoc, CastTE, nullptr, CheckedCastKind::Unresolved)); } // matching-pattern ::= expr diff --git a/lib/Parse/ParseRequests.cpp b/lib/Parse/ParseRequests.cpp index 3890b5cb55ce8..e0399897c1baa 100644 --- a/lib/Parse/ParseRequests.cpp +++ b/lib/Parse/ParseRequests.cpp @@ -22,6 +22,7 @@ #include "swift/Parse/Parser.h" #include "swift/Subsystems.h" #include "swift/Syntax/SyntaxArena.h" +#include "swift/Syntax/SyntaxNodes.h" #include "swift/SyntaxParse/SyntaxTreeCreator.h" using namespace swift; @@ -116,8 +117,8 @@ static void deletePersistentParserState(PersistentParserState *state) { delete state; } -ArrayRef ParseSourceFileRequest::evaluate(Evaluator &evaluator, - SourceFile *SF) const { +SourceFileParsingResult ParseSourceFileRequest::evaluate(Evaluator &evaluator, + SourceFile *SF) const { assert(SF); auto &ctx = SF->getASTContext(); auto bufferID = SF->getBufferID(); @@ -149,21 +150,24 @@ ArrayRef ParseSourceFileRequest::evaluate(Evaluator &evaluator, SF->setDelayedParserState({state, &deletePersistentParserState}); } - FrontendStatsTracer tracer(ctx.Stats, "Parsing"); Parser parser(*bufferID, *SF, /*SIL*/ nullptr, state, sTreeCreator); PrettyStackTraceParser StackTrace(parser); - llvm::SaveAndRestore> S(parser.CurrentTokenHash, - SF->getInterfaceHashPtr()); - SmallVector decls; parser.parseTopLevel(decls); + Optional syntaxRoot; if (sTreeCreator) { auto rawNode = parser.finalizeSyntaxTree(); - sTreeCreator->acceptSyntaxRoot(rawNode, *SF); + syntaxRoot.emplace(*sTreeCreator->realizeSyntaxRoot(rawNode, *SF)); } - return ctx.AllocateCopy(decls); + + Optional> tokensRef; + if (auto tokens = parser.takeTokenReceiver()->finalize()) + tokensRef = ctx.AllocateCopy(*tokens); + + return SourceFileParsingResult{ctx.AllocateCopy(decls), tokensRef, + parser.CurrentTokenHash, syntaxRoot}; } evaluator::DependencySource ParseSourceFileRequest::readDependencySource( @@ -171,15 +175,30 @@ evaluator::DependencySource ParseSourceFileRequest::readDependencySource( return {std::get<0>(getStorage()), evaluator::DependencyScope::Cascading}; } -Optional> ParseSourceFileRequest::getCachedResult() const { +Optional +ParseSourceFileRequest::getCachedResult() const { auto *SF = std::get<0>(getStorage()); - return SF->getCachedTopLevelDecls(); + auto decls = SF->getCachedTopLevelDecls(); + if (!decls) + return None; + + Optional syntaxRoot; + if (auto &rootPtr = SF->SyntaxRoot) + syntaxRoot.emplace(*rootPtr); + + return SourceFileParsingResult{*decls, SF->AllCollectedTokens, + SF->InterfaceHash, syntaxRoot}; } -void ParseSourceFileRequest::cacheResult(ArrayRef decls) const { +void ParseSourceFileRequest::cacheResult(SourceFileParsingResult result) const { auto *SF = std::get<0>(getStorage()); assert(!SF->Decls); - SF->Decls = decls; + SF->Decls = result.TopLevelDecls; + SF->AllCollectedTokens = result.CollectedTokens; + SF->InterfaceHash = result.InterfaceHash; + + if (auto &root = result.SyntaxRoot) + SF->SyntaxRoot = std::make_unique(std::move(*root)); // Verify the parsed source file. verify(*SF); diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 6cd20d3dfbf4f..c0cfc7da3de43 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -750,7 +750,7 @@ ParserResult Parser::parseStmtReturn(SourceLoc tryLoc) { SourceLoc ReturnLoc = consumeToken(tok::kw_return); if (Tok.is(tok::code_complete)) { - auto CCE = new (Context) CodeCompletionExpr(SourceRange(Tok.getLoc())); + auto CCE = new (Context) CodeCompletionExpr(Tok.getLoc()); auto Result = makeParserResult(new (Context) ReturnStmt(ReturnLoc, CCE)); if (CodeCompletion) { CodeCompletion->completeReturnStmt(CCE); @@ -818,7 +818,7 @@ ParserResult Parser::parseStmtYield(SourceLoc tryLoc) { SourceLoc yieldLoc = consumeToken(tok::kw_yield); if (Tok.is(tok::code_complete)) { - auto cce = new (Context) CodeCompletionExpr(SourceRange(Tok.getLoc())); + auto cce = new (Context) CodeCompletionExpr(Tok.getLoc()); auto result = makeParserResult( YieldStmt::create(Context, yieldLoc, SourceLoc(), cce, SourceLoc())); if (CodeCompletion) { diff --git a/lib/Parse/ParseType.cpp b/lib/Parse/ParseType.cpp index 68c1b715be06c..d4d20c0e36d6a 100644 --- a/lib/Parse/ParseType.cpp +++ b/lib/Parse/ParseType.cpp @@ -17,7 +17,6 @@ #include "swift/Parse/Parser.h" #include "swift/AST/ASTWalker.h" #include "swift/AST/Attr.h" -#include "swift/AST/TypeLoc.h" #include "swift/AST/TypeRepr.h" #include "swift/Parse/Lexer.h" #include "swift/Parse/CodeCompletionCallbacks.h" diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 3b3a87d2e5c55..92dc540964995 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -32,6 +32,7 @@ #include "swift/Parse/SyntaxParsingContext.h" #include "swift/Syntax/RawSyntax.h" #include "swift/Syntax/TokenSyntax.h" +#include "swift/SyntaxParse/SyntaxTreeCreator.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MD5.h" @@ -109,6 +110,7 @@ void tokenize(const LangOptions &LangOpts, const SourceManager &SM, using namespace swift; using namespace swift::syntax; +using ParsingFlags = SourceFile::ParsingFlags; void SILParserStateBase::anchor() { } @@ -147,8 +149,8 @@ void Parser::performCodeCompletionSecondPassImpl( SyntaxContext->disable(); // Disable updating the interface hash - llvm::SaveAndRestore> CurrentTokenHashSaver( - CurrentTokenHash, nullptr); + llvm::SaveAndRestore> CurrentTokenHashSaver( + CurrentTokenHash, None); auto BufferID = L->getBufferID(); auto startLoc = SourceMgr.getLocForOffset(BufferID, info.StartOffset); @@ -411,18 +413,17 @@ namespace { /// underlying corrected token stream. class TokenRecorder: public ConsumeTokenReceiver { ASTContext &Ctx; - SourceManager &SM; + unsigned BufferID; // Token list ordered by their appearance in the source file. - std::vector &Bag; - unsigned BufferID; + std::vector Tokens; // Registered token kind change. These changes are regiestered before the // token is consumed, so we need to keep track of them here. llvm::DenseMap TokenKindChangeMap; std::vector::iterator lower_bound(SourceLoc Loc) { - return token_lower_bound(Bag, Loc); + return token_lower_bound(Tokens, Loc); } std::vector::iterator lower_bound(Token Tok) { @@ -431,9 +432,9 @@ class TokenRecorder: public ConsumeTokenReceiver { void relexComment(CharSourceRange CommentRange, llvm::SmallVectorImpl &Scratch) { - Lexer L(Ctx.LangOpts, Ctx.SourceMgr, BufferID, nullptr, LexerMode::Swift, - HashbangMode::Disallowed, - CommentRetentionMode::ReturnAsTokens, + auto &SM = Ctx.SourceMgr; + Lexer L(Ctx.LangOpts, SM, BufferID, nullptr, LexerMode::Swift, + HashbangMode::Disallowed, CommentRetentionMode::ReturnAsTokens, TriviaRetentionMode::WithoutTrivia, SM.getLocOffsetInBuffer(CommentRange.getStart(), BufferID), SM.getLocOffsetInBuffer(CommentRange.getEnd(), BufferID)); @@ -448,19 +449,17 @@ class TokenRecorder: public ConsumeTokenReceiver { } public: - TokenRecorder(SourceFile &SF, unsigned BufferID): - Ctx(SF.getASTContext()), - SM(SF.getASTContext().SourceMgr), - Bag(SF.getTokenVector()), - BufferID(BufferID) {}; + TokenRecorder(ASTContext &ctx, unsigned BufferID) + : Ctx(ctx), BufferID(BufferID) {} - void finalize() override { + Optional> finalize() override { + auto &SM = Ctx.SourceMgr; // We should consume the comments at the end of the file that don't attach // to any tokens. SourceLoc TokEndLoc; - if (!Bag.empty()) { - Token Last = Bag.back(); + if (!Tokens.empty()) { + Token Last = Tokens.back(); TokEndLoc = Last.getLoc().getAdvancedLoc(Last.getLength()); } else { @@ -472,14 +471,15 @@ class TokenRecorder: public ConsumeTokenReceiver { SM.getRangeForBuffer(BufferID).getEnd()), Scratch); // Accept these orphaned comments. - Bag.insert(Bag.end(), Scratch.begin(), Scratch.end()); + Tokens.insert(Tokens.end(), Scratch.begin(), Scratch.end()); + return std::move(Tokens); } void registerTokenKindChange(SourceLoc Loc, tok NewKind) override { // If a token with the same location is already in the bag, update its kind. auto Pos = lower_bound(Loc); - if (Pos != Bag.end() && Pos->getLoc().getOpaquePointerValue() == - Loc.getOpaquePointerValue()) { + if (Pos != Tokens.end() && + Pos->getLoc().getOpaquePointerValue() == Loc.getOpaquePointerValue()) { Pos->setKind(NewKind); return; } @@ -495,8 +495,8 @@ class TokenRecorder: public ConsumeTokenReceiver { // If a token with the same location is already in the bag, skip this token. auto Pos = lower_bound(Tok); - if (Pos != Bag.end() && Pos->getLoc().getOpaquePointerValue() == - Tok.getLoc().getOpaquePointerValue()) { + if (Pos != Tokens.end() && Pos->getLoc().getOpaquePointerValue() == + Tok.getLoc().getOpaquePointerValue()) { return; } @@ -515,7 +515,7 @@ class TokenRecorder: public ConsumeTokenReceiver { } TokensToConsume.push_back(Tok); - Bag.insert(Pos, TokensToConsume.begin(), TokensToConsume.end()); + Tokens.insert(Pos, TokensToConsume.begin(), TokensToConsume.end()); } }; } // End of an anonymous namespace. @@ -530,9 +530,8 @@ Parser::Parser(std::unique_ptr Lex, SourceFile &SF, SIL(SIL), CurDeclContext(&SF), Context(SF.getASTContext()), - CurrentTokenHash(SF.getInterfaceHashPtr()), - TokReceiver(SF.shouldCollectToken() ? - new TokenRecorder(SF, L->getBufferID()) : + TokReceiver(SF.shouldCollectTokens() ? + new TokenRecorder(SF.getASTContext(), L->getBufferID()) : new ConsumeTokenReceiver()), SyntaxContext(new SyntaxParsingContext(SyntaxContext, SF, L->getBufferID(), @@ -543,6 +542,10 @@ Parser::Parser(std::unique_ptr Lex, SourceFile &SF, State = OwnedState.get(); } + // If the interface hash is enabled, set up the initial hash. + if (SF.hasInterfaceHash()) + CurrentTokenHash.emplace(); + // Set the token to a sentinel so that we know the lexer isn't primed yet. // This cannot be tok::unknown, since that is a token the lexer could produce. Tok.setKind(tok::NUM_TOKENS); @@ -566,7 +569,7 @@ bool Parser::isDelayedParsingEnabled() const { bool Parser::shouldEvaluatePoundIfDecls() const { auto opts = SF.getParsingOptions(); - return !opts.contains(SourceFile::ParsingFlags::DisablePoundIfEvaluation); + return !opts.contains(ParsingFlags::DisablePoundIfEvaluation); } bool Parser::allowTopLevelCode() const { @@ -590,11 +593,11 @@ SourceLoc Parser::consumeTokenWithoutFeedingReceiver() { void Parser::recordTokenHash(StringRef token) { assert(!token.empty()); - if (llvm::MD5 *cth = CurrentTokenHash.getPtrOrNull()) { - cth->update(token); + if (CurrentTokenHash) { + CurrentTokenHash->update(token); // Add null byte to separate tokens. uint8_t a[1] = {0}; - cth->update(a); + CurrentTokenHash->update(a); } } @@ -1196,14 +1199,17 @@ struct ParserUnit::Implementation { const LangOptions &Opts, const TypeCheckerOptions &TyOpts, StringRef ModuleName, std::shared_ptr spActions) - : SPActions(std::move(spActions)), - LangOpts(Opts), TypeCheckerOpts(TyOpts), Diags(SM), - Ctx(*ASTContext::get(LangOpts, TypeCheckerOpts, SearchPathOpts, SM, Diags)), - SF(new (Ctx) SourceFile( - *ModuleDecl::create(Ctx.getIdentifier(ModuleName), Ctx), SFKind, - BufferID, Opts.CollectParsedToken, Opts.BuildSyntaxTree, - SourceFile::ParsingFlags::DisableDelayedBodies | - SourceFile::ParsingFlags::DisablePoundIfEvaluation)) {} + : SPActions(std::move(spActions)), LangOpts(Opts), + TypeCheckerOpts(TyOpts), Diags(SM), + Ctx(*ASTContext::get(LangOpts, TypeCheckerOpts, SearchPathOpts, SM, + Diags)) { + auto parsingOpts = SourceFile::getDefaultParsingOptions(LangOpts); + parsingOpts |= ParsingFlags::DisableDelayedBodies; + parsingOpts |= ParsingFlags::DisablePoundIfEvaluation; + + auto *M = ModuleDecl::create(Ctx.getIdentifier(ModuleName), Ctx); + SF = new (Ctx) SourceFile(*M, SFKind, BufferID, parsingOpts); + } ~Implementation() { // We need to delete the parser before the context so that it can finalize @@ -1260,9 +1266,21 @@ OpaqueSyntaxNode ParserUnit::parse() { SmallVector decls; P.parseTopLevel(decls); - ctx.evaluator.cacheOutput(ParseSourceFileRequest{&P.SF}, - ctx.AllocateCopy(decls)); - return P.finalizeSyntaxTree(); + Optional> tokensRef; + if (auto tokens = P.takeTokenReceiver()->finalize()) + tokensRef = ctx.AllocateCopy(*tokens); + + auto rawNode = P.finalizeSyntaxTree(); + Optional syntaxRoot; + if (Impl.SPActions) { + if (auto root = Impl.SPActions->realizeSyntaxRoot(rawNode, *Impl.SF)) + syntaxRoot.emplace(*root); + } + + auto result = SourceFileParsingResult{ctx.AllocateCopy(decls), tokensRef, + P.CurrentTokenHash, syntaxRoot}; + ctx.evaluator.cacheOutput(ParseSourceFileRequest{&P.SF}, std::move(result)); + return rawNode; } Parser &ParserUnit::getParser() { diff --git a/lib/SIL/IR/SILDeclRef.cpp b/lib/SIL/IR/SILDeclRef.cpp index 6989994303775..9835c2865adba 100644 --- a/lib/SIL/IR/SILDeclRef.cpp +++ b/lib/SIL/IR/SILDeclRef.cpp @@ -41,7 +41,7 @@ swift::getMethodDispatch(AbstractFunctionDecl *method) { auto dc = method->getDeclContext(); if (dc->getSelfClassDecl()) { - if (method->isObjCDynamic()) { + if (method->shouldUseObjCDispatch()) { return MethodDispatch::Class; } @@ -88,7 +88,7 @@ bool swift::requiresForeignToNativeThunk(ValueDecl *vd) { bool swift::requiresForeignEntryPoint(ValueDecl *vd) { assert(!isa(vd)); - if (vd->isObjCDynamic()) { + if (vd->shouldUseObjCDispatch()) { return true; } @@ -872,15 +872,15 @@ SILDeclRef SILDeclRef::getNextOverriddenVTableEntry() const { } // Overrides of @objc dynamic declarations are not in the vtable. - if (overridden.getDecl()->isObjCDynamic()) { + if (overridden.getDecl()->shouldUseObjCDispatch()) { return SILDeclRef(); } - + if (auto *accessor = dyn_cast(overridden.getDecl())) { auto *asd = accessor->getStorage(); if (asd->hasClangNode()) return SILDeclRef(); - if (asd->isObjCDynamic()) { + if (asd->shouldUseObjCDispatch()) { return SILDeclRef(); } } @@ -1111,6 +1111,10 @@ static bool isDesignatedConstructorForClass(ValueDecl *decl) { } bool SILDeclRef::canBeDynamicReplacement() const { + // The foreign entry of a @dynamicReplacement(for:) of @objc method in a + // generic class can't be a dynamic replacement. + if (isForeign && hasDecl() && getDecl()->isNativeMethodReplacement()) + return false; if (kind == SILDeclRef::Kind::Destroyer || kind == SILDeclRef::Kind::DefaultArgGenerator) return false; @@ -1122,6 +1126,11 @@ bool SILDeclRef::canBeDynamicReplacement() const { } bool SILDeclRef::isDynamicallyReplaceable() const { + // The non-foreign entry of a @dynamicReplacement(for:) of @objc method in a + // generic class can't be a dynamically replaced. + if (!isForeign && hasDecl() && getDecl()->isNativeMethodReplacement()) + return false; + if (kind == SILDeclRef::Kind::DefaultArgGenerator) return false; if (isStoredPropertyInitializer() || isPropertyWrapperBackingInitializer()) @@ -1143,5 +1152,15 @@ bool SILDeclRef::isDynamicallyReplaceable() const { return false; auto decl = getDecl(); - return decl->isNativeDynamic(); + + if (isForeign) + return false; + + // We can't generate categories for generic classes. So the standard mechanism + // for replacing @objc dynamic methods in generic classes does not work. + // Instead we mark the non @objc entry dynamically replaceable and replace + // that. + // For now, we only support this behavior if -enable-implicit-dynamic is + // enabled. + return decl->shouldUseNativeMethodReplacement(); } diff --git a/lib/SIL/IR/SILFunctionBuilder.cpp b/lib/SIL/IR/SILFunctionBuilder.cpp index e30dde44ec358..b56d34ea74d00 100644 --- a/lib/SIL/IR/SILFunctionBuilder.cpp +++ b/lib/SIL/IR/SILFunctionBuilder.cpp @@ -91,7 +91,10 @@ void SILFunctionBuilder::addFunctionAttributes( auto *decl = constant.getDecl(); // Only emit replacements for the objc entry point of objc methods. - if (decl->isObjC() && + // There is one exception: @_dynamicReplacement(for:) of @objc methods in + // generic classes. In this special case we use native replacement instead of + // @objc categories. + if (decl->isObjC() && !decl->isNativeMethodReplacement() && F->getLoweredFunctionType()->getExtInfo().getRepresentation() != SILFunctionTypeRepresentation::ObjCMethod) return; @@ -103,7 +106,10 @@ void SILFunctionBuilder::addFunctionAttributes( if (!replacedDecl) return; - if (decl->isObjC()) { + // For @objc method replacement we normally use categories to perform the + // replacement. Except for methods in generic class where we can't. Instead, + // we special case this and use the native swift replacement mechanism. + if (decl->isObjC() && !decl->isNativeMethodReplacement()) { F->setObjCReplacement(replacedDecl); return; } diff --git a/lib/SIL/IR/SILFunctionType.cpp b/lib/SIL/IR/SILFunctionType.cpp index ed3a450a1a96f..79659d8dcdb1a 100644 --- a/lib/SIL/IR/SILFunctionType.cpp +++ b/lib/SIL/IR/SILFunctionType.cpp @@ -216,17 +216,36 @@ SILFunctionType::getWitnessMethodClass(SILModule &M, IndexSubset * SILFunctionType::getDifferentiabilityParameterIndices() { assert(isDifferentiable() && "Must be a differentiable function"); - SmallVector result; - for (auto valueAndIndex : enumerate(getParameters())) - if (valueAndIndex.value().getDifferentiability() != - SILParameterDifferentiability::NotDifferentiable) - result.push_back(valueAndIndex.index()); - return IndexSubset::get(getASTContext(), getNumParameters(), result); + SmallVector paramIndices; + for (auto paramAndIndex : enumerate(getParameters())) + if (paramAndIndex.value().getDifferentiability() != + SILParameterDifferentiability::NotDifferentiable) + paramIndices.push_back(paramAndIndex.index()); + return IndexSubset::get(getASTContext(), getNumParameters(), paramIndices); +} + +IndexSubset *SILFunctionType::getDifferentiabilityResultIndices() { + assert(isDifferentiable() && "Must be a differentiable function"); + SmallVector resultIndices; + // Check formal results. + for (auto resultAndIndex : enumerate(getResults())) + if (resultAndIndex.value().getDifferentiability() != + SILResultDifferentiability::NotDifferentiable) + resultIndices.push_back(resultAndIndex.index()); + // Check `inout` parameters. + for (auto inoutParamAndIndex : enumerate(getIndirectMutatingParameters())) + if (inoutParamAndIndex.value().getDifferentiability() != + SILParameterDifferentiability::NotDifferentiable) + resultIndices.push_back(getNumResults() + inoutParamAndIndex.index()); + auto numSemanticResults = + getNumResults() + getNumIndirectMutatingParameters(); + return IndexSubset::get(getASTContext(), numSemanticResults, resultIndices); } CanSILFunctionType SILFunctionType::getWithDifferentiability(DifferentiabilityKind kind, - IndexSubset *parameterIndices) { + IndexSubset *parameterIndices, + IndexSubset *resultIndices) { assert(kind != DifferentiabilityKind::NonDifferentiable && "Differentiability kind must be normal or linear"); SmallVector newParameters; @@ -239,9 +258,18 @@ SILFunctionType::getWithDifferentiability(DifferentiabilityKind kind, ? SILParameterDifferentiability::DifferentiableOrNotApplicable : SILParameterDifferentiability::NotDifferentiable)); } + SmallVector newResults; + for (auto resultAndIndex : enumerate(getResults())) { + auto &result = resultAndIndex.value(); + unsigned index = resultAndIndex.index(); + newResults.push_back(result.getWithDifferentiability( + index < resultIndices->getCapacity() && resultIndices->contains(index) + ? SILResultDifferentiability::DifferentiableOrNotApplicable + : SILResultDifferentiability::NotDifferentiable)); + } auto newExtInfo = getExtInfo().withDifferentiabilityKind(kind); return get(getInvocationGenericSignature(), newExtInfo, getCoroutineKind(), - getCalleeConvention(), newParameters, getYields(), getResults(), + getCalleeConvention(), newParameters, getYields(), newResults, getOptionalErrorResult(), getPatternSubstitutions(), getInvocationSubstitutions(), getASTContext(), getWitnessMethodConformanceOrInvalid()); @@ -256,13 +284,15 @@ CanSILFunctionType SILFunctionType::getWithoutDifferentiability() { for (auto ¶m : getParameters()) newParams.push_back(param.getWithDifferentiability( SILParameterDifferentiability::DifferentiableOrNotApplicable)); - return SILFunctionType::get(getInvocationGenericSignature(), nondiffExtInfo, - getCoroutineKind(), getCalleeConvention(), - newParams, getYields(), getResults(), - getOptionalErrorResult(), - getPatternSubstitutions(), - getInvocationSubstitutions(), - getASTContext()); + SmallVector newResults; + for (auto &result : getResults()) + newResults.push_back(result.getWithDifferentiability( + SILResultDifferentiability::DifferentiableOrNotApplicable)); + return SILFunctionType::get( + getInvocationGenericSignature(), nondiffExtInfo, getCoroutineKind(), + getCalleeConvention(), newParams, getYields(), newResults, + getOptionalErrorResult(), getPatternSubstitutions(), + getInvocationSubstitutions(), getASTContext()); } /// Collects the differentiability parameters of the given original function @@ -311,11 +341,10 @@ getSemanticResults(SILFunctionType *functionType, IndexSubset *parameterIndices, /// Returns the differential type for the given original function type, /// parameter indices, and result index. -static CanSILFunctionType -getAutoDiffDifferentialType(SILFunctionType *originalFnTy, - IndexSubset *parameterIndices, unsigned resultIndex, - LookupConformanceFn lookupConformance, - TypeConverter &TC) { +static CanSILFunctionType getAutoDiffDifferentialType( + SILFunctionType *originalFnTy, IndexSubset *parameterIndices, + IndexSubset *resultIndices, LookupConformanceFn lookupConformance, + TypeConverter &TC) { // Given the tangent type and the corresponding original parameter's // convention, returns the tangent parameter's convention. auto getTangentParameterConvention = @@ -402,22 +431,25 @@ getAutoDiffDifferentialType(SILFunctionType *originalFnTy, } SmallVector differentialResults; if (!inoutParam || !isWrtInoutParameter) { - auto &result = originalResults[resultIndex]; - auto resultTan = - result.getInterfaceType()->getAutoDiffTangentSpace(lookupConformance); - assert(resultTan && "Result type does not have a tangent space?"); - auto resultTanType = resultTan->getCanonicalType(); - auto resultConv = getTangentResultConvention(resultTanType, - result.getConvention()); - if (!resultTanType->hasArchetype() && !resultTanType->hasTypeParameter()) { - differentialResults.push_back( - {resultTan->getCanonicalType(), resultConv}); - } else { - auto gpIndex = substGenericParams.size(); - auto gpType = CanGenericTypeParamType::get(0, gpIndex, ctx); - substGenericParams.push_back(gpType); - substReplacements.push_back(resultTanType); - differentialResults.push_back({gpType, resultConv}); + for (auto resultIndex : resultIndices->getIndices()) { + auto &result = originalResults[resultIndex]; + auto resultTan = + result.getInterfaceType()->getAutoDiffTangentSpace(lookupConformance); + assert(resultTan && "Result type does not have a tangent space?"); + auto resultTanType = resultTan->getCanonicalType(); + auto resultConv = + getTangentResultConvention(resultTanType, result.getConvention()); + if (!resultTanType->hasArchetype() && + !resultTanType->hasTypeParameter()) { + differentialResults.push_back( + {resultTan->getCanonicalType(), resultConv}); + } else { + auto gpIndex = substGenericParams.size(); + auto gpType = CanGenericTypeParamType::get(0, gpIndex, ctx); + substGenericParams.push_back(gpType); + substReplacements.push_back(resultTanType); + differentialResults.push_back({gpType, resultConv}); + } } } SubstitutionMap substitutions; @@ -438,11 +470,10 @@ getAutoDiffDifferentialType(SILFunctionType *originalFnTy, /// Returns the pullback type for the given original function type, parameter /// indices, and result index. -static CanSILFunctionType -getAutoDiffPullbackType(SILFunctionType *originalFnTy, - IndexSubset *parameterIndices, unsigned resultIndex, - LookupConformanceFn lookupConformance, - TypeConverter &TC) { +static CanSILFunctionType getAutoDiffPullbackType( + SILFunctionType *originalFnTy, IndexSubset *parameterIndices, + IndexSubset *resultIndices, LookupConformanceFn lookupConformance, + TypeConverter &TC) { auto &ctx = originalFnTy->getASTContext(); SmallVector substGenericParams; SmallVector substRequirements; @@ -540,22 +571,25 @@ getAutoDiffPullbackType(SILFunctionType *originalFnTy, pullbackParams.push_back({gpType, paramTanConvention}); } } else { - auto &origRes = originalResults[resultIndex]; - auto resultTan = - origRes.getInterfaceType()->getAutoDiffTangentSpace(lookupConformance); - assert(resultTan && "Result type does not have a tangent space?"); - auto resultTanType = resultTan->getCanonicalType(); - auto paramTanConvention = getTangentParameterConventionForOriginalResult( - resultTanType, origRes.getConvention()); - if (!resultTanType->hasArchetype() && !resultTanType->hasTypeParameter()) { + for (auto resultIndex : resultIndices->getIndices()) { + auto &origRes = originalResults[resultIndex]; + auto resultTan = origRes.getInterfaceType()->getAutoDiffTangentSpace( + lookupConformance); + assert(resultTan && "Result type does not have a tangent space?"); auto resultTanType = resultTan->getCanonicalType(); - pullbackParams.push_back({resultTanType, paramTanConvention}); - } else { - auto gpIndex = substGenericParams.size(); - auto gpType = CanGenericTypeParamType::get(0, gpIndex, ctx); - substGenericParams.push_back(gpType); - substReplacements.push_back(resultTanType); - pullbackParams.push_back({gpType, paramTanConvention}); + auto paramTanConvention = getTangentParameterConventionForOriginalResult( + resultTanType, origRes.getConvention()); + if (!resultTanType->hasArchetype() && + !resultTanType->hasTypeParameter()) { + auto resultTanType = resultTan->getCanonicalType(); + pullbackParams.push_back({resultTanType, paramTanConvention}); + } else { + auto gpIndex = substGenericParams.size(); + auto gpType = CanGenericTypeParamType::get(0, gpIndex, ctx); + substGenericParams.push_back(gpType); + substReplacements.push_back(resultTanType); + pullbackParams.push_back({gpType, paramTanConvention}); + } } } SmallVector diffParams; @@ -655,16 +689,16 @@ static SILFunctionType *getConstrainedAutoDiffOriginalFunctionType( } CanSILFunctionType SILFunctionType::getAutoDiffDerivativeFunctionType( - IndexSubset *parameterIndices, unsigned resultIndex, + IndexSubset *parameterIndices, IndexSubset *resultIndices, AutoDiffDerivativeFunctionKind kind, TypeConverter &TC, LookupConformanceFn lookupConformance, CanGenericSignature derivativeFnInvocationGenSig, bool isReabstractionThunk) { + assert(parameterIndices); + assert(resultIndices); auto &ctx = getASTContext(); // Look up result in cache. - auto *resultIndices = IndexSubset::get( - ctx, getNumResults() + getNumIndirectMutatingParameters(), {resultIndex}); SILAutoDiffDerivativeFunctionKey key{this, parameterIndices, resultIndices, @@ -687,12 +721,12 @@ CanSILFunctionType SILFunctionType::getAutoDiffDerivativeFunctionType( case AutoDiffDerivativeFunctionKind::JVP: closureType = getAutoDiffDifferentialType(constrainedOriginalFnTy, parameterIndices, - resultIndex, lookupConformance, TC); + resultIndices, lookupConformance, TC); break; case AutoDiffDerivativeFunctionKind::VJP: closureType = getAutoDiffPullbackType(constrainedOriginalFnTy, parameterIndices, - resultIndex, lookupConformance, TC); + resultIndices, lookupConformance, TC); break; } // Compute the derivative function parameters. @@ -711,7 +745,7 @@ CanSILFunctionType SILFunctionType::getAutoDiffDerivativeFunctionType( auto fnParamType = dyn_cast(fnParam.getInterfaceType()); assert(fnParamType); auto diffFnType = fnParamType->getWithDifferentiability( - DifferentiabilityKind::Normal, parameterIndices); + DifferentiabilityKind::Normal, parameterIndices, resultIndices); newParameters.back() = fnParam.getWithInterfaceType(diffFnType); } @@ -3185,11 +3219,16 @@ TypeConverter::getConstantInfo(TypeExpansionContext expansion, auto origFnConstantInfo = getConstantInfo( TypeExpansionContext::minimal(), constant.asAutoDiffOriginalFunction()); // Use it to compute lowered derivative function type. - auto *loweredIndices = autodiff::getLoweredParameterIndices( + auto *loweredParamIndices = autodiff::getLoweredParameterIndices( derivativeId->getParameterIndices(), formalInterfaceType); + auto numResults = + origFnConstantInfo.SILFnType->getNumResults() + + origFnConstantInfo.SILFnType->getNumIndirectMutatingParameters(); + auto *loweredResultIndices = IndexSubset::getDefault( + M.getASTContext(), numResults, /*includeAll*/ true); silFnType = origFnConstantInfo.SILFnType->getAutoDiffDerivativeFunctionType( - loweredIndices, /*resultIndex*/ 0, derivativeId->getKind(), *this, - LookUpConformanceInModule(&M)); + loweredParamIndices, loweredResultIndices, derivativeId->getKind(), + *this, LookUpConformanceInModule(&M)); } LLVM_DEBUG(llvm::dbgs() << "lowering type for constant "; diff --git a/lib/SIL/IR/SILGlobalVariable.cpp b/lib/SIL/IR/SILGlobalVariable.cpp index a7473bbd287e6..e7a4879d29348 100644 --- a/lib/SIL/IR/SILGlobalVariable.cpp +++ b/lib/SIL/IR/SILGlobalVariable.cpp @@ -24,14 +24,13 @@ SILGlobalVariable *SILGlobalVariable::create(SILModule &M, SILLinkage linkage, SILType loweredType, Optional loc, VarDecl *Decl) { - // Get a StringMapEntry for the variable. As a sop to error cases, - // allow the name to have an empty string. + // Get a StringMapEntry for the variable. llvm::StringMapEntry *entry = nullptr; - if (!name.empty()) { - entry = &*M.GlobalVariableMap.insert(std::make_pair(name, nullptr)).first; - assert(!entry->getValue() && "global variable already exists"); - name = entry->getKey(); - } + assert(!name.empty() && "Name required"); + + entry = &*M.GlobalVariableMap.insert(std::make_pair(name, nullptr)).first; + assert(!entry->getValue() && "global variable already exists"); + name = entry->getKey(); auto var = new (M) SILGlobalVariable(M, linkage, isSerialized, name, loweredType, loc, Decl); diff --git a/lib/SIL/IR/SILInstructions.cpp b/lib/SIL/IR/SILInstructions.cpp index 235b5098eb149..8ad354575fca6 100644 --- a/lib/SIL/IR/SILInstructions.cpp +++ b/lib/SIL/IR/SILInstructions.cpp @@ -608,10 +608,12 @@ TryApplyInst *TryApplyInst::create( } SILType DifferentiableFunctionInst::getDifferentiableFunctionType( - SILValue OriginalFunction, IndexSubset *ParameterIndices) { + SILValue OriginalFunction, IndexSubset *ParameterIndices, + IndexSubset *ResultIndices) { + assert(!ResultIndices->isEmpty()); auto fnTy = OriginalFunction->getType().castTo(); auto diffTy = fnTy->getWithDifferentiability(DifferentiabilityKind::Normal, - ParameterIndices); + ParameterIndices, ResultIndices); return SILType::getPrimitiveObjectType(diffTy); } @@ -625,22 +627,23 @@ ValueOwnershipKind DifferentiableFunctionInst::getMergedOwnershipKind( DifferentiableFunctionInst::DifferentiableFunctionInst( SILDebugLocation Loc, IndexSubset *ParameterIndices, - SILValue OriginalFunction, ArrayRef DerivativeFunctions, - bool HasOwnership) + IndexSubset *ResultIndices, SILValue OriginalFunction, + ArrayRef DerivativeFunctions, bool HasOwnership) : InstructionBaseWithTrailingOperands( OriginalFunction, DerivativeFunctions, Loc, - getDifferentiableFunctionType(OriginalFunction, ParameterIndices), + getDifferentiableFunctionType(OriginalFunction, ParameterIndices, + ResultIndices), HasOwnership ? getMergedOwnershipKind(OriginalFunction, DerivativeFunctions) : ValueOwnershipKind(ValueOwnershipKind::None)), - ParameterIndices(ParameterIndices), + ParameterIndices(ParameterIndices), ResultIndices(ResultIndices), HasDerivativeFunctions(!DerivativeFunctions.empty()) { assert(DerivativeFunctions.empty() || DerivativeFunctions.size() == 2); } DifferentiableFunctionInst *DifferentiableFunctionInst::create( SILModule &Module, SILDebugLocation Loc, IndexSubset *ParameterIndices, - SILValue OriginalFunction, + IndexSubset *ResultIndices, SILValue OriginalFunction, Optional> VJPAndJVPFunctions, bool HasOwnership) { auto derivativeFunctions = @@ -651,16 +654,18 @@ DifferentiableFunctionInst *DifferentiableFunctionInst::create( : ArrayRef(); size_t size = totalSizeToAlloc(1 + derivativeFunctions.size()); void *buffer = Module.allocateInst(size, alignof(DifferentiableFunctionInst)); - return ::new (buffer) - DifferentiableFunctionInst(Loc, ParameterIndices, OriginalFunction, - derivativeFunctions, HasOwnership); + return ::new (buffer) DifferentiableFunctionInst( + Loc, ParameterIndices, ResultIndices, OriginalFunction, + derivativeFunctions, HasOwnership); } SILType LinearFunctionInst::getLinearFunctionType( SILValue OriginalFunction, IndexSubset *ParameterIndices) { auto fnTy = OriginalFunction->getType().castTo(); - auto diffTy = fnTy->getWithDifferentiability( - DifferentiabilityKind::Linear, ParameterIndices); + auto *resultIndices = + IndexSubset::get(fnTy->getASTContext(), /*capacity*/ 1, /*indices*/ {0}); + auto diffTy = fnTy->getWithDifferentiability(DifferentiabilityKind::Linear, + ParameterIndices, resultIndices); return SILType::getPrimitiveObjectType(diffTy); } @@ -707,8 +712,9 @@ SILType DifferentiableFunctionExtractInst::getExtracteeType( return SILType::getPrimitiveObjectType(originalFnTy); } auto resultFnTy = originalFnTy->getAutoDiffDerivativeFunctionType( - fnTy->getDifferentiabilityParameterIndices(), /*resultIndex*/ 0, *kindOpt, - module.Types, LookUpConformanceInModule(module.getSwiftModule())); + fnTy->getDifferentiabilityParameterIndices(), + fnTy->getDifferentiabilityResultIndices(), *kindOpt, module.Types, + LookUpConformanceInModule(module.getSwiftModule())); return SILType::getPrimitiveObjectType(resultFnTy); } @@ -774,9 +780,9 @@ SILType DifferentiabilityWitnessFunctionInst::getDifferentiabilityWitnessType( bool isReabstractionThunk = witness->getOriginalFunction()->isThunk() == IsReabstractionThunk; auto diffFnTy = fnTy->getAutoDiffDerivativeFunctionType( - parameterIndices, *resultIndices->begin(), *derivativeKind, - module.Types, LookUpConformanceInModule(module.getSwiftModule()), - witnessCanGenSig, isReabstractionThunk); + parameterIndices, resultIndices, *derivativeKind, module.Types, + LookUpConformanceInModule(module.getSwiftModule()), witnessCanGenSig, + isReabstractionThunk); return SILType::getPrimitiveObjectType(diffFnTy); } assert(witnessKind == DifferentiabilityWitnessFunctionKind::Transpose); diff --git a/lib/SIL/IR/SILModule.cpp b/lib/SIL/IR/SILModule.cpp index 50aadb293da66..5c86ac2ffd976 100644 --- a/lib/SIL/IR/SILModule.cpp +++ b/lib/SIL/IR/SILModule.cpp @@ -115,6 +115,9 @@ SILModule::~SILModule() { for (SILGlobalVariable &v : silGlobals) v.dropAllReferences(); + for (auto vt : vtables) + vt->~SILVTable(); + // Drop everything functions in this module reference. // // This is necessary since the functions may reference each other. We don't @@ -355,6 +358,7 @@ bool SILModule::linkFunction(SILFunction *F, SILModule::LinkingMode Mode) { SILFunction *SILModule::findFunction(StringRef Name, SILLinkage Linkage) { assert((Linkage == SILLinkage::Public || + Linkage == SILLinkage::SharedExternal || Linkage == SILLinkage::PublicExternal) && "Only a lookup of public functions is supported currently"); @@ -405,6 +409,9 @@ SILFunction *SILModule::findFunction(StringRef Name, SILLinkage Linkage) { // compilation, simply convert it into an external declaration, // so that a compiled version from the shared library is used. if (F->isDefinition() && + // Don't eliminate bodies of _alwaysEmitIntoClient functions + // (PublicNonABI linkage is de-serialized as SharedExternal) + F->getLinkage() != SILLinkage::SharedExternal && !F->getModule().getOptions().shouldOptimize()) { F->convertToDeclaration(); } diff --git a/lib/SIL/IR/SILPrinter.cpp b/lib/SIL/IR/SILPrinter.cpp index 4feafae6df321..29034513c01e0 100644 --- a/lib/SIL/IR/SILPrinter.cpp +++ b/lib/SIL/IR/SILPrinter.cpp @@ -2334,6 +2334,10 @@ class SILPrinter : public SILInstructionVisitor { for (auto i : dfi->getParameterIndices()->getIndices()) *this << ' ' << i; *this << "] "; + *this << "[results"; + for (auto i : dfi->getResultIndices()->getIndices()) + *this << ' ' << i; + *this << "] "; *this << getIDAndType(dfi->getOriginalFunction()); if (dfi->hasDerivativeFunctions()) { *this << " with_derivative "; @@ -2793,15 +2797,15 @@ static void printSILFunctions(SILPrintContext &Ctx, static void printSILVTables(SILPrintContext &Ctx, const SILModule::VTableListType &VTables) { if (!Ctx.sortSIL()) { - for (const SILVTable &vt : VTables) - vt.print(Ctx.OS(), Ctx.printVerbose()); + for (const auto &vt : VTables) + vt->print(Ctx.OS(), Ctx.printVerbose()); return; } std::vector vtables; vtables.reserve(VTables.size()); - for (const SILVTable &vt : VTables) - vtables.push_back(&vt); + for (const auto &vt : VTables) + vtables.push_back(vt); std::sort(vtables.begin(), vtables.end(), [] (const SILVTable *v1, const SILVTable *v2) -> bool { StringRef Name1 = v1->getClass()->getName().str(); @@ -3063,7 +3067,7 @@ void SILModule::print(SILPrintContext &PrintCtx, ModuleDecl *M, printSILDifferentiabilityWitnesses(PrintCtx, getDifferentiabilityWitnessList()); printSILFunctions(PrintCtx, getFunctionList()); - printSILVTables(PrintCtx, getVTableList()); + printSILVTables(PrintCtx, getVTables()); printSILWitnessTables(PrintCtx, getWitnessTableList()); printSILDefaultWitnessTables(PrintCtx, getDefaultWitnessTableList()); printSILCoverageMaps(PrintCtx, getCoverageMaps()); @@ -3377,7 +3381,7 @@ void SILCoverageMap::dump() const { #pragma warning(disable : 4996) #endif -void SILDebugScope::dump(SourceManager &SM, llvm::raw_ostream &OS, +void SILDebugScope::print(SourceManager &SM, llvm::raw_ostream &OS, unsigned Indent) const { OS << "{\n"; OS.indent(Indent); @@ -3387,7 +3391,7 @@ void SILDebugScope::dump(SourceManager &SM, llvm::raw_ostream &OS, OS.indent(Indent + 2); OS << " parent: "; if (auto *P = Parent.dyn_cast()) { - P->dump(SM, OS, Indent + 2); + P->print(SM, OS, Indent + 2); OS.indent(Indent + 2); } else if (auto *F = Parent.dyn_cast()) @@ -3399,15 +3403,15 @@ void SILDebugScope::dump(SourceManager &SM, llvm::raw_ostream &OS, OS.indent(Indent + 2); if (auto *CS = InlinedCallSite) { OS << "inlinedCallSite: "; - CS->dump(SM, OS, Indent + 2); + CS->print(SM, OS, Indent + 2); OS.indent(Indent + 2); } OS << "}\n"; } -void SILDebugScope::dump(SILModule &Mod) const { +void SILDebugScope::print(SILModule &Mod) const { // We just use the default indent and llvm::errs(). - dump(Mod.getASTContext().SourceMgr); + print(Mod.getASTContext().SourceMgr); } #if SWIFT_COMPILER_IS_MSVC diff --git a/lib/SIL/IR/TypeLowering.cpp b/lib/SIL/IR/TypeLowering.cpp index 576d1c4f75109..fd3e8f28fe6d2 100644 --- a/lib/SIL/IR/TypeLowering.cpp +++ b/lib/SIL/IR/TypeLowering.cpp @@ -272,11 +272,13 @@ namespace { // `SILFunctionType:getAutoDiffDerivativeFunctionType` for correct type // lowering. auto jvpTy = origTy->getAutoDiffDerivativeFunctionType( - type->getDifferentiabilityParameterIndices(), /*resultIndex*/ 0, + type->getDifferentiabilityParameterIndices(), + type->getDifferentiabilityResultIndices(), AutoDiffDerivativeFunctionKind::JVP, TC, LookUpConformanceInModule(&M), CanGenericSignature()); auto vjpTy = origTy->getAutoDiffDerivativeFunctionType( - type->getDifferentiabilityParameterIndices(), /*resultIndex*/ 0, + type->getDifferentiabilityParameterIndices(), + type->getDifferentiabilityResultIndices(), AutoDiffDerivativeFunctionKind::VJP, TC, LookUpConformanceInModule(&M), CanGenericSignature()); RecursiveProperties props; @@ -1040,9 +1042,11 @@ namespace { ArrayRef values) const override { assert(values.size() == 3); auto fnTy = getLoweredType().castTo(); - auto paramIndices = fnTy->getDifferentiabilityParameterIndices(); + auto *parameterIndices = fnTy->getDifferentiabilityParameterIndices(); + auto *resultIndices = fnTy->getDifferentiabilityResultIndices(); return B.createDifferentiableFunction( - loc, paramIndices, values[0], std::make_pair(values[1], values[2])); + loc, parameterIndices, resultIndices, values[0], + std::make_pair(values[1], values[2])); } void lowerChildren(TypeConverter &TC, @@ -1051,7 +1055,8 @@ namespace { auto numDerivativeFns = 2; children.reserve(numDerivativeFns + 1); auto origFnTy = fnTy->getWithoutDifferentiability(); - auto paramIndices = fnTy->getDifferentiabilityParameterIndices(); + auto *paramIndices = fnTy->getDifferentiabilityParameterIndices(); + auto *resultIndices = fnTy->getDifferentiabilityResultIndices(); children.push_back(Child{ NormalDifferentiableFunctionTypeComponent::Original, TC.getTypeLowering(origFnTy, getExpansionContext()) @@ -1060,7 +1065,7 @@ namespace { {AutoDiffDerivativeFunctionKind::JVP, AutoDiffDerivativeFunctionKind::VJP}) { auto derivativeFnTy = origFnTy->getAutoDiffDerivativeFunctionType( - paramIndices, 0, kind, TC, + paramIndices, resultIndices, kind, TC, LookUpConformanceInModule(&TC.M)); auto silTy = SILType::getPrimitiveObjectType(derivativeFnTy); NormalDifferentiableFunctionTypeComponent extractee(kind); diff --git a/lib/SIL/Parser/ParseSIL.cpp b/lib/SIL/Parser/ParseSIL.cpp index 43cd5899e96aa..f08dbc88235fc 100644 --- a/lib/SIL/Parser/ParseSIL.cpp +++ b/lib/SIL/Parser/ParseSIL.cpp @@ -2000,12 +2000,12 @@ static Optional> parseSILDifferentiabilityWitnessConfigAndFunction(Parser &P, SILParser &SP, SILLocation L) { // Parse parameter and result indices. - SmallVector parameterIndices; - SmallVector resultIndices; - if (parseIndexList(P, "parameters", parameterIndices, + SmallVector rawParameterIndices; + SmallVector rawResultIndices; + if (parseIndexList(P, "parameters", rawParameterIndices, diag::sil_autodiff_expected_parameter_index)) return {}; - if (parseIndexList(P, "results", resultIndices, + if (parseIndexList(P, "results", rawResultIndices, diag::sil_autodiff_expected_result_index)) return {}; // Parse witness generic parameter clause. @@ -2058,11 +2058,11 @@ parseSILDifferentiabilityWitnessConfigAndFunction(Parser &P, SILParser &SP, nullptr); } auto origFnType = originalFunction->getLoweredFunctionType(); - auto *parameterIndexSet = IndexSubset::get( - P.Context, origFnType->getNumParameters(), parameterIndices); - auto *resultIndexSet = - IndexSubset::get(P.Context, origFnType->getNumResults(), resultIndices); - AutoDiffConfig config(parameterIndexSet, resultIndexSet, witnessGenSig); + auto *parameterIndices = IndexSubset::get( + P.Context, origFnType->getNumParameters(), rawParameterIndices); + auto *resultIndices = IndexSubset::get(P.Context, origFnType->getNumResults(), + rawResultIndices); + AutoDiffConfig config(parameterIndices, resultIndices, witnessGenSig); return std::make_pair(config, originalFunction); } @@ -5042,16 +5042,20 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B, break; } case SILInstructionKind::DifferentiableFunctionInst: { - // e.g. differentiable_function [parameters 0 1 2] %0 : $T + // e.g. differentiable_function [parameters 0 1 2] [results 0] %0 : $T // - // e.g. differentiable_function [parameters 0 1 2] %0 : $T with_derivative - // {%1 : $T, %2 : $T} - // ^~ jvp ^~ vjp + // e.g. differentiable_function [parameters 0 1 2] [results 0] %0 : $T + // with_derivative {%1 : $T, %2 : $T} + // ^~ jvp ^~ vjp // Parse `[parameters ...]`. - SmallVector parameterIndices; - if (parseIndexList(P, "parameters", parameterIndices, + SmallVector rawParameterIndices; + if (parseIndexList(P, "parameters", rawParameterIndices, diag::sil_autodiff_expected_parameter_index)) return true; + SmallVector rawResultIndices; + if (parseIndexList(P, "results", rawResultIndices, + diag::sil_autodiff_expected_result_index)) + return true; // Parse the original function value. SILValue original; SourceLoc originalOperandLoc; @@ -5085,18 +5089,23 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B, } if (parseSILDebugLocation(InstLoc, B)) return true; - auto *parameterIndicesSubset = IndexSubset::get( - P.Context, fnType->getNumParameters(), parameterIndices); - ResultVal = B.createDifferentiableFunction( - InstLoc, parameterIndicesSubset, original, derivativeFunctions); + auto *parameterIndices = IndexSubset::get( + P.Context, fnType->getNumParameters(), rawParameterIndices); + auto *resultIndices = IndexSubset::get( + P.Context, + fnType->getNumResults() + fnType->getNumIndirectMutatingParameters(), + rawResultIndices); + ResultVal = B.createDifferentiableFunction(InstLoc, parameterIndices, + resultIndices, original, + derivativeFunctions); break; } case SILInstructionKind::LinearFunctionInst: { // e.g. linear_function [parameters 0 1 2] %0 : $T // e.g. linear_function [parameters 0 1 2] %0 : $T with_transpose %1 : $T // Parse `[parameters ...]`. - SmallVector parameterIndices; - if (parseIndexList(P, "parameters", parameterIndices, + SmallVector rawParameterIndices; + if (parseIndexList(P, "parameters", rawParameterIndices, diag::sil_autodiff_expected_parameter_index)) return true; // Parse the original function value. @@ -5121,7 +5130,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B, if (parseSILDebugLocation(InstLoc, B)) return true; auto *parameterIndicesSubset = IndexSubset::get( - P.Context, fnType->getNumParameters(), parameterIndices); + P.Context, fnType->getNumParameters(), rawParameterIndices); ResultVal = B.createLinearFunction( InstLoc, parameterIndicesSubset, original, transpose); break; diff --git a/lib/SIL/Utils/OwnershipUtils.cpp b/lib/SIL/Utils/OwnershipUtils.cpp index 836895a103a9c..d696a9b1db227 100644 --- a/lib/SIL/Utils/OwnershipUtils.cpp +++ b/lib/SIL/Utils/OwnershipUtils.cpp @@ -488,6 +488,9 @@ void OwnedValueIntroducerKind::print(llvm::raw_ostream &os) const { case OwnedValueIntroducerKind::Struct: os << "Struct"; return; + case OwnedValueIntroducerKind::Tuple: + os << "Tuple"; + return; case OwnedValueIntroducerKind::FunctionArgument: os << "FunctionArgument"; return; diff --git a/lib/SIL/Verifier/SILVerifier.cpp b/lib/SIL/Verifier/SILVerifier.cpp index ca14212c91eb3..2a974fb82aa74 100644 --- a/lib/SIL/Verifier/SILVerifier.cpp +++ b/lib/SIL/Verifier/SILVerifier.cpp @@ -4660,7 +4660,7 @@ class SILVerifier : public SILVerifierBase { require(!jvpType->isDifferentiable(), "The JVP function must not be @differentiable"); auto expectedJVPType = origTy->getAutoDiffDerivativeFunctionType( - dfi->getParameterIndices(), /*resultIndex*/ 0, + dfi->getParameterIndices(), dfi->getResultIndices(), AutoDiffDerivativeFunctionKind::JVP, TC, LookUpConformanceInModule(M)); requireSameType(SILType::getPrimitiveObjectType(jvpType), @@ -4672,7 +4672,7 @@ class SILVerifier : public SILVerifierBase { require(!vjpType->isDifferentiable(), "The VJP function must not be @differentiable"); auto expectedVJPType = origTy->getAutoDiffDerivativeFunctionType( - dfi->getParameterIndices(), /*resultIndex*/ 0, + dfi->getParameterIndices(), dfi->getResultIndices(), AutoDiffDerivativeFunctionKind::VJP, TC, LookUpConformanceInModule(M)); requireSameType(SILType::getPrimitiveObjectType(vjpType), @@ -5367,8 +5367,8 @@ void SILVTable::verify(const SILModule &M) const { auto superclass = getClass()->getSuperclassDecl(); if (superclass) { for (auto &vt : M.getVTables()) { - if (vt.getClass() == superclass) { - superVTable = &vt; + if (vt->getClass() == superclass) { + superVTable = vt; break; } } @@ -5582,15 +5582,15 @@ void SILModule::verify() const { // Check all vtables and the vtable cache. llvm::DenseSet vtableClasses; unsigned EntriesSZ = 0; - for (const SILVTable &vt : getVTables()) { - if (!vtableClasses.insert(vt.getClass()).second) { - llvm::errs() << "Vtable redefined: " << vt.getClass()->getName() << "!\n"; + for (const auto &vt : getVTables()) { + if (!vtableClasses.insert(vt->getClass()).second) { + llvm::errs() << "Vtable redefined: " << vt->getClass()->getName() << "!\n"; assert(false && "triggering standard assertion failure routine"); } - vt.verify(*this); + vt->verify(*this); // Check if there is a cache entry for each vtable entry - for (auto entry : vt.getEntries()) { - if (VTableEntryCache.find({&vt, entry.Method}) == VTableEntryCache.end()) { + for (auto entry : vt->getEntries()) { + if (VTableEntryCache.find({vt, entry.Method}) == VTableEntryCache.end()) { llvm::errs() << "Vtable entry for function: " << entry.Implementation->getName() << "not in cache!\n"; assert(false && "triggering standard assertion failure routine"); diff --git a/lib/SILGen/Initialization.h b/lib/SILGen/Initialization.h index bda3a3bc6fdfe..60ddc9c893a3f 100644 --- a/lib/SILGen/Initialization.h +++ b/lib/SILGen/Initialization.h @@ -148,6 +148,9 @@ class Initialization { ManagedValue explodedElement, bool isInit) = 0; + /// Whether to emit a debug value during initialization. + void setEmitDebugValueOnInit(bool emit) { EmitDebugValueOnInit = emit; } + /// Perform post-initialization bookkeeping for this initialization. virtual void finishInitialization(SILGenFunction &SGF) {} @@ -158,6 +161,9 @@ class Initialization { "uninitialized"); } +protected: + bool EmitDebugValueOnInit = true; + private: Initialization(const Initialization &) = delete; Initialization(Initialization &&) = delete; diff --git a/lib/SILGen/SILGenApply.cpp b/lib/SILGen/SILGenApply.cpp index e80d4f8da4d5e..5829066d560c6 100644 --- a/lib/SILGen/SILGenApply.cpp +++ b/lib/SILGen/SILGenApply.cpp @@ -1005,7 +1005,7 @@ class SILGenApply : public Lowering::ExprVisitor { // @objc dynamic initializers are statically dispatched (we're // calling the allocating entry point, which is a thunk that // does the dynamic dispatch for us). - if (ctor->isObjCDynamic()) + if (ctor->shouldUseObjCDispatch()) return false; // Required constructors are statically dispatched when the 'self' @@ -4962,6 +4962,31 @@ void SILGenFunction::emitUninitializedArrayDeallocation(SILLocation loc, SGFContext()); } +ManagedValue SILGenFunction::emitUninitializedArrayFinalization(SILLocation loc, + ManagedValue array) { + auto &Ctx = getASTContext(); + FuncDecl *finalize = Ctx.getFinalizeUninitializedArray(); + + // The _finalizeUninitializedArray function only needs to be called if the + // library contains it. + // The Array implementation in the stdlib <= 5.3 does not use SIL COW + // support yet and therefore does not provide the _finalizeUninitializedArray + // intrinsic function. + if (!finalize) + return array; + + SILValue arrayVal = array.forward(*this); + CanType arrayTy = arrayVal->getType().getASTType(); + + // Invoke the intrinsic. + auto subMap = arrayTy->getContextSubstitutionMap(SGM.M.getSwiftModule(), + Ctx.getArrayDecl()); + RValue result = emitApplyOfLibraryIntrinsic(loc, finalize, subMap, + ManagedValue::forUnmanaged(arrayVal), + SGFContext()); + return std::move(result).getScalarValue(); +} + namespace { /// A cleanup that deallocates an uninitialized array. class DeallocateUninitializedArray: public Cleanup { diff --git a/lib/SILGen/SILGenBridging.cpp b/lib/SILGen/SILGenBridging.cpp index 6f1c92ea9f26c..fbff1a5b02d71 100644 --- a/lib/SILGen/SILGenBridging.cpp +++ b/lib/SILGen/SILGenBridging.cpp @@ -1469,7 +1469,7 @@ void SILGenFunction::emitNativeToForeignThunk(SILDeclRef thunk) { // If @objc was inferred based on the Swift 3 @objc inference rules, emit // a call to Builtin.swift3ImplicitObjCEntrypoint() to enable runtime // logging of the uses of such entrypoints. - if (attr->isSwift3Inferred() && !decl->isObjCDynamic()) { + if (attr->isSwift3Inferred() && !decl->shouldUseObjCDispatch()) { // Get the starting source location of the declaration so we can say // exactly where to stick '@objc'. SourceLoc objcInsertionLoc = diff --git a/lib/SILGen/SILGenBuiltin.cpp b/lib/SILGen/SILGenBuiltin.cpp index 8ed54c56622c5..46b9f4abd5988 100644 --- a/lib/SILGen/SILGenBuiltin.cpp +++ b/lib/SILGen/SILGenBuiltin.cpp @@ -1237,11 +1237,14 @@ static ManagedValue emitBuiltinDifferentiableFunction( assert(args.size() == 3); auto origFn = args.front(); auto origType = origFn.getType().castTo(); + auto numResults = + origType->getNumResults() + origType->getNumIndirectMutatingParameters(); auto diffFn = SGF.B.createDifferentiableFunction( loc, - IndexSubset::getDefault( - SGF.getASTContext(), origType->getNumParameters(), - /*includeAll*/ true), + IndexSubset::getDefault(SGF.getASTContext(), origType->getNumParameters(), + /*includeAll*/ true), + IndexSubset::getDefault(SGF.getASTContext(), numResults, + /*includeAll*/ true), origFn.forward(SGF), std::make_pair(args[1].forward(SGF), args[2].forward(SGF))); return SGF.emitManagedRValueWithCleanup(diffFn); diff --git a/lib/SILGen/SILGenConstructor.cpp b/lib/SILGen/SILGenConstructor.cpp index 83ad4870154aa..e81be5a9cefcc 100644 --- a/lib/SILGen/SILGenConstructor.cpp +++ b/lib/SILGen/SILGenConstructor.cpp @@ -576,7 +576,7 @@ void SILGenFunction::emitClassConstructorAllocator(ConstructorDecl *ctor) { bool useObjCAllocation = usesObjCAllocator(selfClassDecl); if (ctor->hasClangNode() || - ctor->isObjCDynamic() || + ctor->shouldUseObjCDispatch() || ctor->isConvenienceInit()) { assert(ctor->hasClangNode() || ctor->isObjC()); // For an allocator thunk synthesized for an @objc convenience initializer diff --git a/lib/SILGen/SILGenDecl.cpp b/lib/SILGen/SILGenDecl.cpp index ace1e9e71c359..13e3dfc08d656 100644 --- a/lib/SILGen/SILGenDecl.cpp +++ b/lib/SILGen/SILGenDecl.cpp @@ -555,14 +555,13 @@ class LetValueInitialization : public Initialization { SGF.VarLocs[vd] = SILGenFunction::VarLoc::get(value); // Emit a debug_value[_addr] instruction to record the start of this value's - // lifetime. + // lifetime, if permitted to do so. + if (!EmitDebugValueOnInit) + return; SILLocation PrologueLoc(vd); PrologueLoc.markAsPrologue(); SILDebugVariable DbgVar(vd->isLet(), /*ArgNo=*/0); - if (address) - SGF.B.createDebugValueAddr(PrologueLoc, value, DbgVar); - else - SGF.B.createDebugValue(PrologueLoc, value, DbgVar); + SGF.B.emitDebugDescription(PrologueLoc, value, DbgVar); } void copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, @@ -966,7 +965,7 @@ copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, // Try to perform the cast to the destination type, producing an optional that // indicates whether we succeeded. - auto destType = OptionalType::get(pattern->getCastTypeLoc().getType()); + auto destType = OptionalType::get(pattern->getCastType()); value = emitConditionalCheckedCast(SGF, loc, value, pattern->getType(), destType, diff --git a/lib/SILGen/SILGenExpr.cpp b/lib/SILGen/SILGenExpr.cpp index a64ad886888f0..631dd9f88bbf4 100644 --- a/lib/SILGen/SILGenExpr.cpp +++ b/lib/SILGen/SILGenExpr.cpp @@ -1972,7 +1972,7 @@ static RValue emitBoolLiteral(SILGenFunction &SGF, SILLocation loc, } RValue RValueEmitter::visitIsExpr(IsExpr *E, SGFContext C) { SILValue isa = emitIsa(SGF, E, E->getSubExpr(), - E->getCastTypeLoc().getType(), E->getCastKind()); + E->getCastType(), E->getCastKind()); return emitBoolLiteral(SGF, E, isa, C); } @@ -2113,10 +2113,11 @@ ManagedValue Lowering::emitEndVarargs(SILGenFunction &SGF, SILLocation loc, SGF.Cleanups.setCleanupState(varargs.getAbortCleanup(), CleanupState::Dead); // Reactivate the result cleanup. - auto result = varargs.getArray(); - if (result.hasCleanup()) - SGF.Cleanups.setCleanupState(result.getCleanup(), CleanupState::Active); - return result; + auto array = varargs.getArray(); + if (array.hasCleanup()) + SGF.Cleanups.setCleanupState(array.getCleanup(), CleanupState::Active); + + return SGF.emitUninitializedArrayFinalization(loc, std::move(array)); } RValue RValueEmitter::visitTupleExpr(TupleExpr *E, SGFContext C) { @@ -5451,7 +5452,8 @@ RValue RValueEmitter::visitDifferentiableFunctionExpr( auto origFunc = SGF.emitRValueAsSingleValue(E->getSubExpr()); auto destTy = SGF.getLoweredType(E->getType()).castTo(); auto *diffFunc = SGF.B.createDifferentiableFunction( - E, destTy->getDifferentiabilityParameterIndices(), origFunc.forward(SGF)); + E, destTy->getDifferentiabilityParameterIndices(), + destTy->getDifferentiabilityResultIndices(), origFunc.forward(SGF)); return RValue(SGF, E, SGF.emitManagedRValueWithCleanup(diffFunc)); } diff --git a/lib/SILGen/SILGenFunction.cpp b/lib/SILGen/SILGenFunction.cpp index 2974e7a8f0f3e..bacfbd3c9df08 100644 --- a/lib/SILGen/SILGenFunction.cpp +++ b/lib/SILGen/SILGenFunction.cpp @@ -154,7 +154,7 @@ SILGenFunction::emitSiblingMethodRef(SILLocation loc, // If the method is dynamic, access it through runtime-hookable virtual // dispatch (viz. objc_msgSend for now). if (methodConstant.hasDecl() - && methodConstant.getDecl()->isObjCDynamic()) { + && methodConstant.getDecl()->shouldUseObjCDispatch()) { methodValue = emitDynamicMethodRef( loc, methodConstant, diff --git a/lib/SILGen/SILGenFunction.h b/lib/SILGen/SILGenFunction.h index ca922d32de6bf..dbdc8fb8d8b28 100644 --- a/lib/SILGen/SILGenFunction.h +++ b/lib/SILGen/SILGenFunction.h @@ -324,7 +324,7 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction std::vector BreakContinueDestStack; std::vector SwitchStack; /// Keep track of our current nested scope. - std::vector DebugScopeStack; + std::vector DebugScopeStack; /// The cleanup depth and BB for when the operand of a /// BindOptionalExpr is a missing value. @@ -571,12 +571,15 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction StringRef getMagicFilePathString(SourceLoc loc); StringRef getMagicFunctionString(); - /// Push a new debug scope and set its parent pointer. + /// Enter the debug scope for \p Loc, creating it if necessary. void enterDebugScope(SILLocation Loc) { auto *Parent = DebugScopeStack.size() ? DebugScopeStack.back() : F.getDebugScope(); - auto *DS = new (SGM.M) - SILDebugScope(Loc.getAsRegularLocation(), &getFunction(), Parent); + auto *DS = Parent; + // Don't nest a scope for Loc under Parent unless it's actually different. + if (Parent->getLoc().getAsRegularLocation() != Loc.getAsRegularLocation()) + DS = DS = new (SGM.M) + SILDebugScope(Loc.getAsRegularLocation(), &getFunction(), Parent); DebugScopeStack.push_back(DS); B.setCurrentDebugScope(DS); } @@ -1187,6 +1190,8 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction CleanupHandle enterDeallocateUninitializedArrayCleanup(SILValue array); void emitUninitializedArrayDeallocation(SILLocation loc, SILValue array); + ManagedValue emitUninitializedArrayFinalization(SILLocation loc, + ManagedValue array); /// Emit a cleanup for an owned value that should be written back at end of /// scope if the value is not forwarded. diff --git a/lib/SILGen/SILGenLValue.cpp b/lib/SILGen/SILGenLValue.cpp index dd71c1f7a8d0d..da8d723b8d4b4 100644 --- a/lib/SILGen/SILGenLValue.cpp +++ b/lib/SILGen/SILGenLValue.cpp @@ -1463,7 +1463,7 @@ namespace { auto setterInfo = SGF.getConstantInfo(SGF.getTypeExpansionContext(), setter); SILValue setterFRef; - if (setter.hasDecl() && setter.getDecl()->isObjCDynamic()) { + if (setter.hasDecl() && setter.getDecl()->shouldUseObjCDispatch()) { // Emit a thunk we might have to bridge arguments. auto foreignSetterThunk = setter.asForeign(false); setterFRef = diff --git a/lib/SILGen/SILGenPattern.cpp b/lib/SILGen/SILGenPattern.cpp index ecacd2536ca7d..bdec97860688a 100644 --- a/lib/SILGen/SILGenPattern.cpp +++ b/lib/SILGen/SILGenPattern.cpp @@ -81,7 +81,7 @@ static void dumpPattern(const Pattern *p, llvm::raw_ostream &os) { } case PatternKind::Is: os << "is "; - cast(p)->getCastTypeLoc().getType()->print(os); + cast(p)->getCastType()->print(os); break; case PatternKind::EnumElement: { auto eep = cast(p); @@ -286,8 +286,7 @@ static Pattern *getSimilarSpecializingPattern(Pattern *p, Pattern *first) { auto pIs = cast(p); // 'is' patterns are only similar to matches to the same type. if (auto firstIs = dyn_cast(first)) { - if (firstIs->getCastTypeLoc().getType() - ->isEqual(pIs->getCastTypeLoc().getType())) + if (firstIs->getCastType()->isEqual(pIs->getCastType())) return p; } return nullptr; @@ -1193,6 +1192,17 @@ void PatternMatchEmission::bindVariable(Pattern *pattern, VarDecl *var, // Initialize the variable value. InitializationPtr init = SGF.emitInitializationForVarDecl(var, immutable); + + // Do not emit debug descriptions at this stage. + // + // If there are multiple let bindings, the value is forwarded to the case + // block via a phi. Emitting duplicate debug values for the incoming values + // leads to bogus debug info -- we must emit the debug value only on the phi. + // + // If there's only one let binding, we still want to wait until we can nest + // the scope for the case body under the scope for the pattern match. + init->setEmitDebugValueOnInit(false); + auto mv = value.getFinalManagedValue(); if (shouldTake(value, isIrrefutable)) { mv.forwardInto(SGF, pattern, init.get()); @@ -1581,7 +1591,7 @@ emitTupleDispatch(ArrayRef rows, ConsumableManagedValue src, } static CanType getTargetType(const RowToSpecialize &row) { - auto type = cast(row.Pattern)->getCastTypeLoc().getType(); + auto type = cast(row.Pattern)->getCastType(); return type->getCanonicalType(); } @@ -2441,7 +2451,7 @@ void PatternMatchEmission::emitSharedCaseBlocks( // the order of variables that are the incoming BB arguments. Setup the // VarLocs to point to the incoming args and setup initialization so any // args needing Cleanup will get that as well. - Scope scope(SGF.Cleanups, CleanupLocation(caseBlock)); + LexicalScope scope(SGF, CleanupLocation(caseBlock)); unsigned argIndex = 0; for (auto *vd : caseBlock->getCaseBodyVariables()) { if (!vd->hasName()) @@ -2472,6 +2482,11 @@ void PatternMatchEmission::emitSharedCaseBlocks( mv = SGF.emitManagedRValueWithCleanup(arg); } + // Emit a debug description of the incoming arg, nested within the scope + // for the pattern match. + SILDebugVariable dbgVar(vd->isLet(), /*ArgNo=*/0); + SGF.B.emitDebugDescription(vd, mv.getValue(), dbgVar); + if (vd->isLet()) { // Just emit a let and leave the cleanup alone. SGF.VarLocs[vd].value = mv.getValue(); @@ -2608,6 +2623,10 @@ static void switchCaseStmtSuccessCallback(SILGenFunction &SGF, // If we don't have a fallthrough or a multi-pattern 'case', we can emit the // body inline. Emit the statement here and bail early. if (!row.hasFallthroughTo() && caseBlock->getCaseLabelItems().size() == 1) { + // Debug values for case body variables must be nested within a scope for + // the case block to avoid name conflicts. + DebugScope scope(SGF, CleanupLocation(caseBlock)); + // If we have case body vars, set them up to point at the matching var // decls. if (caseBlock->hasCaseBodyVariables()) { @@ -2628,6 +2647,11 @@ static void switchCaseStmtSuccessCallback(SILGenFunction &SGF, // Ok, we found a match. Update the VarLocs for the case block. auto v = SGF.VarLocs[vd]; SGF.VarLocs[expected] = v; + + // Emit a debug description for the variable, nested within a scope + // for the pattern match. + SILDebugVariable dbgVar(vd->isLet(), /*ArgNo=*/0); + SGF.B.emitDebugDescription(vd, v.value, dbgVar); } } } @@ -2747,7 +2771,7 @@ void SILGenFunction::emitSwitchStmt(SwitchStmt *S) { emitProfilerIncrement(S); JumpDest contDest(contBB, Cleanups.getCleanupsDepth(), CleanupLocation(S)); - Scope switchScope(Cleanups, CleanupLocation(S)); + LexicalScope switchScope(*this, CleanupLocation(S)); // Enter a break/continue scope. If we wanted a continue // destination, it would probably be out here. diff --git a/lib/SILGen/SILGenPoly.cpp b/lib/SILGen/SILGenPoly.cpp index e0d71dc6bb708..4d3cd693fdd34 100644 --- a/lib/SILGen/SILGenPoly.cpp +++ b/lib/SILGen/SILGenPoly.cpp @@ -3466,6 +3466,7 @@ static ManagedValue createDifferentiableFunctionThunk( SILValue convertedBundle = SGF.B.createDifferentiableFunction( loc, sourceType->getDifferentiabilityParameterIndices(), + sourceType->getDifferentiabilityResultIndices(), originalThunk.forward(SGF), std::make_pair(jvpThunk.forward(SGF), vjpThunk.forward(SGF))); return SGF.emitManagedRValueWithCleanup(convertedBundle); @@ -3914,8 +3915,6 @@ ManagedValue SILGenFunction::getThunkedAutoDiffLinearMap( SILFunction *SILGenModule::getOrCreateCustomDerivativeThunk( SILFunction *customDerivativeFn, SILFunction *originalFn, const AutoDiffConfig &config, AutoDiffDerivativeFunctionKind kind) { - auto indices = config.getSILAutoDiffIndices(); - auto customDerivativeFnTy = customDerivativeFn->getLoweredFunctionType(); auto *thunkGenericEnv = customDerivativeFnTy->getSubstGenericSignature() ? customDerivativeFnTy->getSubstGenericSignature() @@ -3927,7 +3926,7 @@ SILFunction *SILGenModule::getOrCreateCustomDerivativeThunk( if (auto derivativeGenSig = config.derivativeGenericSignature) derivativeCanGenSig = derivativeGenSig->getCanonicalSignature(); auto thunkFnTy = origFnTy->getAutoDiffDerivativeFunctionType( - indices.parameters, indices.source, kind, Types, + config.parameterIndices, config.resultIndices, kind, Types, LookUpConformanceInModule(M.getSwiftModule()), derivativeCanGenSig); assert(!thunkFnTy->getExtInfo().hasContext()); @@ -4017,9 +4016,9 @@ SILFunction *SILGenModule::getOrCreateCustomDerivativeThunk( if (!originalFn->hasSelfParam()) return false; auto selfParamIndex = origFnTy->getNumParameters() - 1; - if (!indices.isWrtParameter(selfParamIndex)) + if (!config.parameterIndices->contains(selfParamIndex)) return false; - return indices.parameters->getNumIndices() > 1; + return config.parameterIndices->getNumIndices() > 1; }; bool reorderSelf = shouldReorderSelf(); @@ -4505,7 +4504,7 @@ static WitnessDispatchKind getWitnessDispatchKind(SILDeclRef witness, } // If the witness is dynamic, go through dynamic dispatch. - if (decl->isObjCDynamic()) { + if (decl->shouldUseObjCDispatch()) { // For initializers we still emit a static allocating thunk around // the dynamic initializing entry point. if (witness.kind == SILDeclRef::Kind::Allocator) @@ -4582,8 +4581,10 @@ getWitnessFunctionRef(SILGenFunction &SGF, auto *loweredParamIndices = autodiff::getLoweredParameterIndices( derivativeId->getParameterIndices(), witness.getDecl()->getInterfaceType()->castTo()); - auto diffFn = SGF.B.createDifferentiableFunction(loc, loweredParamIndices, - originalFn); + auto *loweredResultIndices = IndexSubset::get( + SGF.getASTContext(), 1, {0}); // FIXME, set to all results + auto diffFn = SGF.B.createDifferentiableFunction( + loc, loweredParamIndices, loweredResultIndices, originalFn); return SGF.B.createDifferentiableFunctionExtract( loc, NormalDifferentiableFunctionTypeComponent(derivativeId->getKind()), diff --git a/lib/SILGen/SILGenThunk.cpp b/lib/SILGen/SILGenThunk.cpp index d0087194d217f..8fd44deec40bc 100644 --- a/lib/SILGen/SILGenThunk.cpp +++ b/lib/SILGen/SILGenThunk.cpp @@ -214,8 +214,9 @@ SILFunction *SILGenModule::getOrCreateAutoDiffClassMethodThunk( auto *loweredParamIndices = autodiff::getLoweredParameterIndices( derivativeId->getParameterIndices(), derivativeFnDecl->getInterfaceType()->castTo()); - auto diffFn = - SGF.B.createDifferentiableFunction(loc, loweredParamIndices, originalFn); + auto *loweredResultIndices = IndexSubset::get(getASTContext(), 1, {0}); + auto diffFn = SGF.B.createDifferentiableFunction( + loc, loweredParamIndices, loweredResultIndices, originalFn); auto derivativeFn = SGF.B.createDifferentiableFunctionExtract( loc, NormalDifferentiableFunctionTypeComponent(derivativeId->getKind()), diffFn); diff --git a/lib/SILGen/SILGenType.cpp b/lib/SILGen/SILGenType.cpp index 75c2b1aa662fa..b4356c89bb066 100644 --- a/lib/SILGen/SILGenType.cpp +++ b/lib/SILGen/SILGenType.cpp @@ -83,7 +83,7 @@ SILGenModule::emitVTableMethod(ClassDecl *theClass, // it will be redispatched, funneling the method call through the runtime // hook point. bool usesObjCDynamicDispatch = - (derivedDecl->isObjCDynamic() && + (derivedDecl->shouldUseObjCDispatch() && derived.kind != SILDeclRef::Kind::Allocator); if (usesObjCDynamicDispatch) { @@ -216,18 +216,27 @@ bool SILGenModule::requiresObjCMethodEntryPoint(FuncDecl *method) { if (auto accessor = dyn_cast(method)) { if (accessor->isGetterOrSetter()) { auto asd = accessor->getStorage(); - return asd->isObjC() && !asd->getAttrs().hasAttribute(); + return asd->isObjC() && !asd->getAttrs().hasAttribute() && + !method->isNativeMethodReplacement(); } } if (method->getAttrs().hasAttribute()) return false; + if (!method->isObjC()) + return false; - return method->isObjC(); + // Don't emit the objective c entry point of @_dynamicReplacement(for:) + // methods in generic classes. There is no way to call it. + return !method->isNativeMethodReplacement(); } bool SILGenModule::requiresObjCMethodEntryPoint(ConstructorDecl *constructor) { - return constructor->isObjC(); + if (!constructor->isObjC()) + return false; + // Don't emit the objective c entry point of @_dynamicReplacement(for:) + // methods in generic classes. There is no way to call it. + return !constructor->isNativeMethodReplacement(); } namespace { diff --git a/lib/SILOptimizer/Analysis/BasicCalleeAnalysis.cpp b/lib/SILOptimizer/Analysis/BasicCalleeAnalysis.cpp index 61fe528efe0e6..417340158fc2d 100644 --- a/lib/SILOptimizer/Analysis/BasicCalleeAnalysis.cpp +++ b/lib/SILOptimizer/Analysis/BasicCalleeAnalysis.cpp @@ -107,10 +107,10 @@ void CalleeCache::computeClassMethodCallees() { // This is a little bit more complicated than to just check the VTable // entry.Method itself, because an overridden method might be more accessible // than the base method (e.g. a public method overrides a private method). - for (auto &VTable : M.getVTableList()) { - assert(!VTable.getClass()->hasClangNode()); + for (auto &VTable : M.getVTables()) { + assert(!VTable->getClass()->hasClangNode()); - for (Decl *member : VTable.getClass()->getMembers()) { + for (Decl *member : VTable->getClass()->getMembers()) { if (auto *afd = dyn_cast(member)) { // If a method implementation might be overridden in another translation // unit, also mark all the base methods as 'unknown'. @@ -127,8 +127,8 @@ void CalleeCache::computeClassMethodCallees() { } // Second step: collect all implementations of a method. - for (auto &VTable : M.getVTableList()) { - for (const SILVTable::Entry &entry : VTable.getEntries()) { + for (auto &VTable : M.getVTables()) { + for (const SILVTable::Entry &entry : VTable->getEntries()) { if (auto *afd = entry.Method.getAbstractFunctionDecl()) { CalleesAndCanCallUnknown &callees = getOrCreateCalleesForMethod(entry.Method); if (unknownCallees.count(afd) != 0) @@ -308,8 +308,8 @@ void BasicCalleeAnalysis::print(llvm::raw_ostream &os) const { os << "\n"; } llvm::DenseSet printed; - for (auto &VTable : M.getVTableList()) { - for (const SILVTable::Entry &entry : VTable.getEntries()) { + for (auto &VTable : M.getVTables()) { + for (const SILVTable::Entry &entry : VTable->getEntries()) { if (printed.insert(entry.Method).second) { os << "callees for " << entry.Method << ":\n"; Cache->getCalleeList(entry.Method).print(os); diff --git a/lib/SILOptimizer/Analysis/ClassHierarchyAnalysis.cpp b/lib/SILOptimizer/Analysis/ClassHierarchyAnalysis.cpp index 1e63c2b856f72..b31b6564ae0e8 100644 --- a/lib/SILOptimizer/Analysis/ClassHierarchyAnalysis.cpp +++ b/lib/SILOptimizer/Analysis/ClassHierarchyAnalysis.cpp @@ -23,8 +23,8 @@ void ClassHierarchyAnalysis::init() { auto module = M->getSwiftModule(); // For each class declaration in our V-table list: - for (auto &VT : M->getVTableList()) { - ClassDecl *C = VT.getClass(); + for (auto &VT : M->getVTables()) { + ClassDecl *C = VT->getClass(); while (true) { // Ignore classes that are at the top of the class hierarchy: diff --git a/lib/SILOptimizer/Analysis/DifferentiableActivityAnalysis.cpp b/lib/SILOptimizer/Analysis/DifferentiableActivityAnalysis.cpp index c903dbeb6435c..3d1da0abb78fd 100644 --- a/lib/SILOptimizer/Analysis/DifferentiableActivityAnalysis.cpp +++ b/lib/SILOptimizer/Analysis/DifferentiableActivityAnalysis.cpp @@ -403,7 +403,9 @@ void DifferentiableActivityInfo::setUsefulThroughArrayInitialization( SILValue value, unsigned dependentVariableIndex) { // Array initializer syntax is lowered to an intrinsic and one or more // stores to a `RawPointer` returned by the intrinsic. - auto *uai = getAllocateUninitializedArrayIntrinsic(value); + ArraySemanticsCall uninitCall(value, + semantics::ARRAY_UNINITIALIZED_INTRINSIC); + ApplyInst *uai = uninitCall; if (!uai) return; for (auto use : value->getUses()) { @@ -498,9 +500,18 @@ bool DifferentiableActivityInfo::isUseful( return set.count(value); } +bool DifferentiableActivityInfo::isUseful( + SILValue value, IndexSubset *dependentVariableIndices) const { + for (auto i : dependentVariableIndices->getIndices()) + if (isUseful(value, i)) + return true; + return false; +} + bool DifferentiableActivityInfo::isActive( SILValue value, const SILAutoDiffIndices &indices) const { - return isVaried(value, indices.parameters) && isUseful(value, indices.source); + return isVaried(value, indices.parameters) && + isUseful(value, indices.results); } Activity DifferentiableActivityInfo::getActivity( @@ -508,7 +519,7 @@ Activity DifferentiableActivityInfo::getActivity( Activity activity; if (isVaried(value, indices.parameters)) activity |= ActivityFlags::Varied; - if (isUseful(value, indices.source)) + if (isUseful(value, indices.results)) activity |= ActivityFlags::Useful; return activity; } diff --git a/lib/SILOptimizer/Analysis/MemoryBehavior.cpp b/lib/SILOptimizer/Analysis/MemoryBehavior.cpp index e3e2e5fd1d002..5eed0b391ea95 100644 --- a/lib/SILOptimizer/Analysis/MemoryBehavior.cpp +++ b/lib/SILOptimizer/Analysis/MemoryBehavior.cpp @@ -180,6 +180,7 @@ class MemoryBehaviorVisitor MemBehavior visitStrongReleaseInst(StrongReleaseInst *BI); MemBehavior visitReleaseValueInst(ReleaseValueInst *BI); MemBehavior visitSetDeallocatingInst(SetDeallocatingInst *BI); + MemBehavior visitBeginCOWMutationInst(BeginCOWMutationInst *BCMI); #define ALWAYS_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \ MemBehavior visit##Name##ReleaseInst(Name##ReleaseInst *BI); #include "swift/AST/ReferenceStorage.def" @@ -395,6 +396,14 @@ MemBehavior MemoryBehaviorVisitor::visitSetDeallocatingInst(SetDeallocatingInst return MemBehavior::None; } +MemBehavior MemoryBehaviorVisitor:: +visitBeginCOWMutationInst(BeginCOWMutationInst *BCMI) { + // begin_cow_mutation is defined to have side effects, because it has + // dependencies with instructions which retain the buffer operand. + // But it never interferes with any memory address. + return MemBehavior::None; +} + //===----------------------------------------------------------------------===// // Top Level Entrypoint //===----------------------------------------------------------------------===// diff --git a/lib/SILOptimizer/Differentiation/ADContext.cpp b/lib/SILOptimizer/Differentiation/ADContext.cpp index 5e621f7e25193..d6591cd92e228 100644 --- a/lib/SILOptimizer/Differentiation/ADContext.cpp +++ b/lib/SILOptimizer/Differentiation/ADContext.cpp @@ -115,10 +115,10 @@ void ADContext::cleanUp() { DifferentiableFunctionInst *ADContext::createDifferentiableFunction( SILBuilder &builder, SILLocation loc, IndexSubset *parameterIndices, - SILValue original, + IndexSubset *resultIndices, SILValue original, Optional> derivativeFunctions) { auto *dfi = builder.createDifferentiableFunction( - loc, parameterIndices, original, derivativeFunctions); + loc, parameterIndices, resultIndices, original, derivativeFunctions); processedDifferentiableFunctionInsts.erase(dfi); return dfi; } diff --git a/lib/SILOptimizer/Differentiation/Common.cpp b/lib/SILOptimizer/Differentiation/Common.cpp index af60a744a38ef..be3f802c0e7d2 100644 --- a/lib/SILOptimizer/Differentiation/Common.cpp +++ b/lib/SILOptimizer/Differentiation/Common.cpp @@ -27,18 +27,6 @@ raw_ostream &getADDebugStream() { return llvm::dbgs() << "[AD] "; } // Helpers //===----------------------------------------------------------------------===// -bool isArrayLiteralIntrinsic(FullApplySite applySite) { - return doesApplyCalleeHaveSemantics(applySite.getCalleeOrigin(), - "array.uninitialized_intrinsic"); -} - -ApplyInst *getAllocateUninitializedArrayIntrinsic(SILValue v) { - if (auto *ai = dyn_cast(v)) - if (isArrayLiteralIntrinsic(ai)) - return ai; - return nullptr; -} - ApplyInst *getAllocateUninitializedArrayIntrinsicElementAddress(SILValue v) { // Find the `pointer_to_address` result, peering through `index_addr`. auto *ptai = dyn_cast(v); @@ -48,10 +36,9 @@ ApplyInst *getAllocateUninitializedArrayIntrinsicElementAddress(SILValue v) { return nullptr; // Return the `array.uninitialized_intrinsic` application, if it exists. if (auto *dti = dyn_cast( - ptai->getOperand()->getDefiningInstruction())) { - if (auto *ai = getAllocateUninitializedArrayIntrinsic(dti->getOperand())) - return ai; - } + ptai->getOperand()->getDefiningInstruction())) + return ArraySemanticsCall(dti->getOperand(), + semantics::ARRAY_UNINITIALIZED_INTRINSIC); return nullptr; } diff --git a/lib/SILOptimizer/Differentiation/JVPEmitter.cpp b/lib/SILOptimizer/Differentiation/JVPEmitter.cpp index f37c67a3a7a1f..8f53b37667113 100644 --- a/lib/SILOptimizer/Differentiation/JVPEmitter.cpp +++ b/lib/SILOptimizer/Differentiation/JVPEmitter.cpp @@ -741,7 +741,7 @@ CLONE_AND_EMIT_TANGENT(DestructureTuple, dti) { /// Original: y = apply f(x0, x1, ...) /// Tangent: tan[y] = apply diff_f(tan[x0], tan[x1], ...) void JVPEmitter::emitTangentForApplyInst( - ApplyInst *ai, SILAutoDiffIndices actualIndices, + ApplyInst *ai, SILAutoDiffIndices applyIndices, CanSILFunctionType originalDifferentialType) { assert(differentialInfo.shouldDifferentiateApplySite(ai)); auto *bb = ai->getParent(); @@ -820,43 +820,45 @@ void JVPEmitter::emitTangentForApplyInst( diffBuilder.createApply(loc, differential, SubstitutionMap(), diffArgs, /*isNonThrowing*/ false); diffBuilder.emitDestroyValueOperation(loc, differential); - assert(differentialCall->getNumResults() == 1 && - "Expected differential to return one result"); - // Get the original results of the `apply` instructions. + // Get the original `apply` results. SmallVector origDirectResults; forEachApplyDirectResult(ai, [&](SILValue directResult) { origDirectResults.push_back(directResult); }); SmallVector origAllResults; collectAllActualResultsInTypeOrder(ai, origDirectResults, origAllResults); - auto origResult = origAllResults[actualIndices.source]; - // Get the differential results of the `apply` instructions. + // Get the callee differential `apply` results. SmallVector differentialDirectResults; - forEachApplyDirectResult(differentialCall, [&](SILValue directResult) { - differentialDirectResults.push_back(directResult); - }); + extractAllElements(differentialCall, getDifferentialBuilder(), + differentialDirectResults); SmallVector differentialAllResults; collectAllActualResultsInTypeOrder( differentialCall, differentialDirectResults, differentialAllResults); - auto differentialResult = differentialAllResults.front(); - - // Add tangent for original result. - if (origResult->getType().isObject()) { - if (!origResult->getType().is()) { - setTangentValue(bb, origResult, - makeConcreteTangentValue(differentialResult)); - } else if (auto *dti = getSingleDestructureTupleUser(ai)) { - bool notSetValue = true; - for (auto result : dti->getResults()) { - if (activityInfo.isActive(result, getIndices())) { - assert(notSetValue && - "This was incorrectly set, should only have one active " - "result from the tuple."); - notSetValue = false; - setTangentValue(bb, result, - makeConcreteTangentValue(differentialResult)); + assert(applyIndices.results->getNumIndices() == + differentialAllResults.size()); + + // Set tangent values for original `apply` results. + unsigned differentialResultIndex = 0; + for (auto resultIndex : applyIndices.results->getIndices()) { + auto origResult = origAllResults[resultIndex]; + auto differentialResult = differentialAllResults[differentialResultIndex++]; + if (origResult->getType().isObject()) { + if (!origResult->getType().is()) { + setTangentValue(bb, origResult, + makeConcreteTangentValue(differentialResult)); + } else if (auto *dti = getSingleDestructureTupleUser(ai)) { + bool notSetValue = true; + for (auto result : dti->getResults()) { + if (activityInfo.isActive(result, getIndices())) { + assert(notSetValue && + "This was incorrectly set, should only have one active " + "result from the tuple."); + notSetValue = false; + setTangentValue(bb, result, + makeConcreteTangentValue(differentialResult)); + } } } } @@ -869,43 +871,18 @@ void JVPEmitter::emitReturnInstForDifferential() { auto diffLoc = differential.getLocation(); auto &diffBuilder = getDifferentialBuilder(); - SmallVector activeResults; - - // This vector will contain all the materialized return elements. - SmallVector retElts; + // Collect original results. SmallVector originalResults; collectAllDirectResultsInTypeOrder(*original, originalResults); - - // Materializes the return element corresponding to the result - // `resultIndex` into the `retElts` vector. - auto addActiveResult = [&](unsigned resultIndex) -> void { - auto origResult = originalResults[resultIndex]; - assert(origResult->getType().isObject() && - "Should only be handling direct results for 'return' " - "instruction."); - if (activityInfo.isActive(origResult, getIndices())) { - activeResults.push_back(origResult); - } - }; - // Create an array of the direct tangent values of the original results. - for (auto i : range(originalResults.size())) - addActiveResult(i); - assert(activeResults.size() <= 1); - - if (activeResults.empty() && !originalResults.empty()) { - // Create zero tangent value for direct result. - auto origResult = originalResults[getIndices().source]; - assert(origResult->getType().isObject() && - "Should only be handling direct results for 'return' " - "instruction."); - auto zeroType = origResult->getType().getASTType(); - auto zero = - emitZeroDirect(getTangentSpace(zeroType)->getCanonicalType(), diffLoc); - retElts.push_back(zero); - } else if (!activeResults.empty()) { - auto diffVal = getTangentValue(activeResults.front()); - auto val = materializeTangent(diffVal, diffLoc); - retElts.push_back(val); + // Collect differential return elements. + SmallVector retElts; + // for (auto origResult : originalResults) { + for (auto i : range(originalResults.size())) { + auto origResult = originalResults[i]; + if (!getIndices().results->contains(i)) + continue; + auto tanVal = materializeTangent(getTangentValue(origResult), diffLoc); + retElts.push_back(tanVal); } diffBuilder.createReturn(diffLoc, @@ -963,17 +940,20 @@ void JVPEmitter::prepareForDifferentialGeneration() { // Check if result is not varied. SmallVector origFormalResults; collectAllFormalResultsInTypeOrder(*original, origFormalResults); - auto origResult = origFormalResults[getIndices().source]; - // Emit warning if original result is not varied, because it will always - // have a zero derivative. - if (!activityInfo.isVaried(origResult, getIndices().parameters)) { - // Emit fixit if original result has a valid source location. - auto startLoc = origResult.getLoc().getStartSourceLoc(); - auto endLoc = origResult.getLoc().getEndSourceLoc(); - if (startLoc.isValid() && endLoc.isValid()) { - context.diagnose(startLoc, diag::autodiff_nonvaried_result_fixit) - .fixItInsert(startLoc, "withoutDerivative(at:") - .fixItInsertAfter(endLoc, ")"); + std::get<0>(pair); + for (auto resultIndex : getIndices().results->getIndices()) { + auto origResult = origFormalResults[resultIndex]; + // Emit warning if original result is not varied, because it will always + // have a zero derivative. + if (!activityInfo.isVaried(origResult, getIndices().parameters)) { + // Emit fixit if original result has a valid source location. + auto startLoc = origResult.getLoc().getStartSourceLoc(); + auto endLoc = origResult.getLoc().getEndSourceLoc(); + if (startLoc.isValid() && endLoc.isValid()) { + context.diagnose(startLoc, diag::autodiff_nonvaried_result_fixit) + .fixItInsert(startLoc, "withoutDerivative(at:") + .fixItInsertAfter(endLoc, ")"); + } } } */ @@ -1050,15 +1030,17 @@ JVPEmitter::createEmptyDifferential(ADContext &context, ->getCanonicalType(witnessCanGenSig), ResultConvention::Indirect)); } else { - auto origResult = origTy->getResults()[indices.source]; - origResult = origResult.getWithInterfaceType( - origResult.getInterfaceType()->getCanonicalType(witnessCanGenSig)); - dfResults.push_back( - SILResultInfo(origResult.getInterfaceType() - ->getAutoDiffTangentSpace(lookupConformance) - ->getType() - ->getCanonicalType(witnessCanGenSig), - origResult.getConvention())); + for (auto resultIndex : indices.results->getIndices()) { + auto origResult = origTy->getResults()[resultIndex]; + origResult = origResult.getWithInterfaceType( + origResult.getInterfaceType()->getCanonicalType(witnessCanGenSig)); + dfResults.push_back( + SILResultInfo(origResult.getInterfaceType() + ->getAutoDiffTangentSpace(lookupConformance) + ->getType() + ->getCanonicalType(witnessCanGenSig), + origResult.getConvention())); + } } // Add differential parameters for the requested wrt parameters. @@ -1199,7 +1181,7 @@ void JVPEmitter::visitApplyInst(ApplyInst *ai) { // If the function should not be differentiated or its the array literal // initialization intrinsic, just do standard cloning. if (!differentialInfo.shouldDifferentiateApplySite(ai) || - isArrayLiteralIntrinsic(ai)) { + ArraySemanticsCall(ai, semantics::ARRAY_UNINITIALIZED_INTRINSIC)) { LLVM_DEBUG(getADDebugStream() << "No active results:\n" << *ai << '\n'); TypeSubstCloner::visitApplyInst(ai); return; @@ -1217,6 +1199,11 @@ void JVPEmitter::visitApplyInst(ApplyInst *ai) { } } + auto loc = ai->getLoc(); + auto &builder = getBuilder(); + auto origCallee = getOpValue(ai->getCallee()); + auto originalFnTy = origCallee->getType().castTo(); + LLVM_DEBUG(getADDebugStream() << "JVP-transforming:\n" << *ai << '\n'); // Get the minimal parameter and result indices required for differentiating @@ -1237,49 +1224,39 @@ void JVPEmitter::visitApplyInst(ApplyInst *ai) { activeResultIndices.begin(), activeResultIndices.end(), [&s](unsigned i) { s << i; }, [&s] { s << ", "; }); s << "}\n";); - // Diagnose multiple active results. - // TODO(TF-983): Support multiple active results. - if (activeResultIndices.size() > 1) { - context.emitNondifferentiabilityError( - ai, invoker, - diag::autodiff_cannot_differentiate_through_multiple_results); - errorOccurred = true; - return; - } - // Form expected indices, assuming there's only one result. + // Form expected indices. + auto numResults = + ai->getSubstCalleeType()->getNumResults() + + ai->getSubstCalleeType()->getNumIndirectMutatingParameters(); SILAutoDiffIndices indices( - activeResultIndices.front(), IndexSubset::get(getASTContext(), ai->getArgumentsWithoutIndirectResults().size(), - activeParamIndices)); + activeParamIndices), + IndexSubset::get(getASTContext(), numResults, activeResultIndices)); // Emit the JVP. - auto loc = ai->getLoc(); - auto &builder = getBuilder(); - auto original = getOpValue(ai->getCallee()); SILValue jvpValue; // If functionSource is a `@differentiable` function, just extract it. - auto originalFnTy = original->getType().castTo(); if (originalFnTy->isDifferentiable()) { auto paramIndices = originalFnTy->getDifferentiabilityParameterIndices(); for (auto i : indices.parameters->getIndices()) { if (!paramIndices->contains(i)) { context.emitNondifferentiabilityError( - original, invoker, + origCallee, invoker, diag::autodiff_function_noderivative_parameter_not_differentiable); errorOccurred = true; return; } } - auto borrowedDiffFunc = builder.emitBeginBorrowOperation(loc, original); + auto borrowedDiffFunc = builder.emitBeginBorrowOperation(loc, origCallee); jvpValue = builder.createDifferentiableFunctionExtract( loc, NormalDifferentiableFunctionTypeComponent::JVP, borrowedDiffFunc); jvpValue = builder.emitCopyValueOperation(loc, jvpValue); } // If JVP has not yet been found, emit an `differentiable_function` - // instruction on the remapped original function operand and + // instruction on the remapped function operand and // an `differentiable_function_extract` instruction to get the JVP. // The `differentiable_function` instruction will be canonicalized during // the transform main loop. @@ -1290,7 +1267,7 @@ void JVPEmitter::visitApplyInst(ApplyInst *ai) { /* DifferentiationInvoker indirect(ai, attr); auto insertion = - context.getInvokers().try_emplace({this->original, attr}, indirect); + context.getInvokers().try_emplace({original, attr}, indirect); auto &invoker = insertion.first->getSecond(); invoker = indirect; */ @@ -1301,22 +1278,21 @@ void JVPEmitter::visitApplyInst(ApplyInst *ai) { // function operand is specialized with a remapped version of same // substitution map using an argument-less `partial_apply`. if (ai->getSubstitutionMap().empty()) { - original = builder.emitCopyValueOperation(loc, original); + origCallee = builder.emitCopyValueOperation(loc, origCallee); } else { auto substMap = getOpSubstitutionMap(ai->getSubstitutionMap()); auto jvpPartialApply = getBuilder().createPartialApply( - ai->getLoc(), original, substMap, {}, + ai->getLoc(), origCallee, substMap, {}, ParameterConvention::Direct_Guaranteed); - original = jvpPartialApply; + origCallee = jvpPartialApply; } // Check and diagnose non-differentiable original function type. auto diagnoseNondifferentiableOriginalFunctionType = [&](CanSILFunctionType origFnTy) { // Check and diagnose non-differentiable arguments. - for (unsigned paramIndex : range(originalFnTy->getNumParameters())) { - if (indices.isWrtParameter(paramIndex) && - !originalFnTy->getParameters()[paramIndex] + for (auto paramIndex : indices.parameters->getIndices()) { + if (!originalFnTy->getParameters()[paramIndex] .getSILStorageInterfaceType() .isDifferentiable(getModule())) { context.emitNondifferentiabilityError( @@ -1327,13 +1303,23 @@ void JVPEmitter::visitApplyInst(ApplyInst *ai) { } } // Check and diagnose non-differentiable results. - if (!originalFnTy->getResults()[indices.source] - .getSILStorageInterfaceType() - .isDifferentiable(getModule())) { - context.emitNondifferentiabilityError( - original, invoker, diag::autodiff_nondifferentiable_result); - errorOccurred = true; - return true; + for (auto resultIndex : indices.results->getIndices()) { + SILType remappedResultType; + if (resultIndex >= originalFnTy->getNumResults()) { + auto inoutArgIdx = resultIndex - originalFnTy->getNumResults(); + auto inoutArg = + *std::next(ai->getInoutArguments().begin(), inoutArgIdx); + remappedResultType = inoutArg->getType(); + } else { + remappedResultType = originalFnTy->getResults()[resultIndex] + .getSILStorageInterfaceType(); + } + if (!remappedResultType.isDifferentiable(getModule())) { + context.emitNondifferentiabilityError( + origCallee, invoker, diag::autodiff_nondifferentiable_result); + errorOccurred = true; + return true; + } } return false; }; @@ -1341,13 +1327,10 @@ void JVPEmitter::visitApplyInst(ApplyInst *ai) { return; auto *diffFuncInst = context.createDifferentiableFunction( - builder, loc, indices.parameters, original); + builder, loc, indices.parameters, indices.results, origCallee); // Record the `differentiable_function` instruction. context.addDifferentiableFunctionInstToWorklist(diffFuncInst); - // TODO(TF-689): Make `differentiable_function` store result indices and - // remove `ADContext::resultIndices`. - context.setResultIndex(diffFuncInst, activeResultIndices.front()); auto borrowedADFunc = builder.emitBeginBorrowOperation(loc, diffFuncInst); auto extractedJVP = builder.createDifferentiableFunctionExtract( diff --git a/lib/SILOptimizer/Differentiation/LinearMapInfo.cpp b/lib/SILOptimizer/Differentiation/LinearMapInfo.cpp index e2798eb863473..4582c20521d6d 100644 --- a/lib/SILOptimizer/Differentiation/LinearMapInfo.cpp +++ b/lib/SILOptimizer/Differentiation/LinearMapInfo.cpp @@ -123,13 +123,7 @@ LinearMapInfo::createBranchingTraceDecl(SILBasicBlock *originalBB, auto &file = getSynthesizedFile(); // Create a branching trace enum. Mangle::ASTMangler mangler; - auto originalFnTy = original->getLoweredFunctionType(); - auto numResults = originalFnTy->getNumResults() + - originalFnTy->getNumIndirectMutatingParameters(); - auto *resultIndices = - IndexSubset::get(original->getASTContext(), numResults, indices.source); - auto *parameterIndices = indices.parameters; - AutoDiffConfig config(parameterIndices, resultIndices, genericSig); + AutoDiffConfig config(indices.parameters, indices.results, genericSig); auto enumName = mangler.mangleAutoDiffGeneratedDeclaration( AutoDiffGeneratedDeclarationKind::BranchingTraceEnum, original->getName().str(), originalBB->getDebugID(), kind, config); @@ -196,13 +190,7 @@ LinearMapInfo::createLinearMapStruct(SILBasicBlock *originalBB, auto &file = getSynthesizedFile(); // Create a linear map struct. Mangle::ASTMangler mangler; - auto originalFnTy = original->getLoweredFunctionType(); - auto numResults = originalFnTy->getNumResults() + - originalFnTy->getNumIndirectMutatingParameters(); - auto *resultIndices = - IndexSubset::get(original->getASTContext(), numResults, indices.source); - auto *parameterIndices = indices.parameters; - AutoDiffConfig config(parameterIndices, resultIndices, genericSig); + AutoDiffConfig config(indices.parameters, indices.results, genericSig); auto structName = mangler.mangleAutoDiffGeneratedDeclaration( AutoDiffGeneratedDeclarationKind::LinearMapStruct, original->getName().str(), originalBB->getDebugID(), kind, config); @@ -292,9 +280,7 @@ void LinearMapInfo::addLinearMapToStruct(ADContext &context, ApplyInst *ai) { if (!hasActiveResults && !hasActiveInoutArgument) return; - // Compute differentiation result index. - auto source = activeResultIndices.front(); - // Compute differentiation parameters. + // Compute differentiability parameters. // - If the callee has `@differentiable` function type, use differentiation // parameters from the function type. // - Otherwise, use the active parameters. @@ -311,35 +297,41 @@ void LinearMapInfo::addLinearMapToStruct(ADContext &context, ApplyInst *ai) { original->getASTContext(), ai->getArgumentsWithoutIndirectResults().size(), activeParamIndices); } + // Compute differentiability results. + auto numResults = remappedOrigFnSubstTy->getNumResults() + + remappedOrigFnSubstTy->getNumIndirectMutatingParameters(); + auto *results = IndexSubset::get(original->getASTContext(), numResults, + activeResultIndices); // Create autodiff indices for the `apply` instruction. - SILAutoDiffIndices applyIndices(source, parameters); + SILAutoDiffIndices applyIndices(parameters, results); // Check for non-differentiable original function type. - auto checkNondifferentiableOriginalFunctionType = - [&](CanSILFunctionType origFnTy) { - // Check non-differentiable arguments. - for (unsigned paramIndex : range(origFnTy->getNumParameters())) { - auto remappedParamType = origFnTy->getParameters()[paramIndex] - .getSILStorageInterfaceType(); - if (applyIndices.isWrtParameter(paramIndex) && - !remappedParamType.isDifferentiable(derivative->getModule())) - return true; - } - // Check non-differentiable results. - SILType remappedResultType; - if (applyIndices.source >= origFnTy->getNumResults()) { - auto inoutArgIdx = applyIndices.source - origFnTy->getNumResults(); - auto inoutArg = - *std::next(ai->getInoutArguments().begin(), inoutArgIdx); - remappedResultType = inoutArg->getType(); - } else { - remappedResultType = origFnTy->getResults()[applyIndices.source] - .getSILStorageInterfaceType(); - } - if (!remappedResultType.isDifferentiable(derivative->getModule())) - return true; - return false; - }; + auto checkNondifferentiableOriginalFunctionType = [&](CanSILFunctionType + origFnTy) { + // Check non-differentiable arguments. + for (auto paramIndex : applyIndices.parameters->getIndices()) { + auto remappedParamType = + origFnTy->getParameters()[paramIndex].getSILStorageInterfaceType(); + if (!remappedParamType.isDifferentiable(derivative->getModule())) + return true; + } + // Check non-differentiable results. + for (auto resultIndex : applyIndices.results->getIndices()) { + SILType remappedResultType; + if (resultIndex >= origFnTy->getNumResults()) { + auto inoutArgIdx = resultIndex - origFnTy->getNumResults(); + auto inoutArg = + *std::next(ai->getInoutArguments().begin(), inoutArgIdx); + remappedResultType = inoutArg->getType(); + } else { + remappedResultType = + origFnTy->getResults()[resultIndex].getSILStorageInterfaceType(); + } + if (!remappedResultType.isDifferentiable(derivative->getModule())) + return true; + } + return false; + }; if (checkNondifferentiableOriginalFunctionType(remappedOrigFnSubstTy)) return; @@ -347,7 +339,7 @@ void LinearMapInfo::addLinearMapToStruct(ADContext &context, ApplyInst *ai) { auto derivativeFnType = remappedOrigFnSubstTy ->getAutoDiffDerivativeFunctionType( - parameters, source, derivativeFnKind, context.getTypeConverter(), + parameters, results, derivativeFnKind, context.getTypeConverter(), LookUpConformanceInModule( derivative->getModule().getSwiftModule())) ->getUnsubstitutedType(original->getModule()); @@ -420,7 +412,10 @@ void LinearMapInfo::generateDifferentiationDataStructures( // Add linear map field to struct for active `apply` instructions. // Skip array literal intrinsic applications since array literal // initialization is linear and handled separately. - if (!shouldDifferentiateApplySite(ai) || isArrayLiteralIntrinsic(ai)) + if (!shouldDifferentiateApplySite(ai) || + ArraySemanticsCall(ai, semantics::ARRAY_UNINITIALIZED_INTRINSIC)) + continue; + if (ArraySemanticsCall(ai, semantics::ARRAY_FINALIZE_INTRINSIC)) continue; LLVM_DEBUG(getADDebugStream() << "Adding linear map struct field for " << *ai); @@ -482,7 +477,9 @@ bool LinearMapInfo::shouldDifferentiateApplySite(FullApplySite applySite) { // TODO: Pattern match to make sure there is at least one `store` to the // array's active buffer. - if (isArrayLiteralIntrinsic(applySite) && hasActiveResults) + if (ArraySemanticsCall(applySite.getInstruction(), + semantics::ARRAY_UNINITIALIZED_INTRINSIC) && + hasActiveResults) return true; auto arguments = applySite.getArgumentsWithoutIndirectResults(); diff --git a/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp b/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp index 098709c3e541a..f6e2c5be52732 100644 --- a/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp +++ b/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp @@ -272,7 +272,8 @@ void PullbackEmitter::accumulateArrayLiteralElementAddressAdjoints( originalValue->getDefiningInstruction()); if (!dti) return; - if (!getAllocateUninitializedArrayIntrinsic(dti->getOperand())) + if (!ArraySemanticsCall(dti->getOperand(), + semantics::ARRAY_UNINITIALIZED_INTRINSIC)) return; if (originalValue != dti->getResult(0)) return; @@ -513,6 +514,66 @@ void PullbackEmitter::addToAdjointBuffer(SILBasicBlock *origBB, accumulateIndirect(adjointBuffer, rhsBufferAccess, loc); } +//--------------------------------------------------------------------------// +// Debugging utilities +//--------------------------------------------------------------------------// + +void PullbackEmitter::printAdjointValueMapping() { + // Group original/adjoint values by basic block. + llvm::DenseMap> tmp; + for (auto pair : valueMap) { + auto origPair = pair.first; + auto *origBB = origPair.first; + auto origValue = origPair.second; + auto adjValue = pair.second; + tmp[origBB].insert({origValue, adjValue}); + } + // Print original/adjoint values per basic block. + auto &s = getADDebugStream() << "Adjoint value mapping:\n"; + for (auto &origBB : getOriginal()) { + if (!pullbackBBMap.count(&origBB)) + continue; + auto bbValueMap = tmp[&origBB]; + s << "bb" << origBB.getDebugID(); + s << " (size " << bbValueMap.size() << "):\n"; + for (auto valuePair : bbValueMap) { + auto origValue = valuePair.first; + auto adjValue = valuePair.second; + s << "ORIG: " << origValue; + s << "ADJ: " << adjValue << '\n'; + } + s << '\n'; + } +} + +void PullbackEmitter::printAdjointBufferMapping() { + // Group original/adjoint buffers by basic block. + llvm::DenseMap> tmp; + for (auto pair : bufferMap) { + auto origPair = pair.first; + auto *origBB = origPair.first; + auto origBuf = origPair.second; + auto adjBuf = pair.second; + tmp[origBB][origBuf] = adjBuf; + } + // Print original/adjoint buffers per basic block. + auto &s = getADDebugStream() << "Adjoint buffer mapping:\n"; + for (auto &origBB : getOriginal()) { + if (!pullbackBBMap.count(&origBB)) + continue; + auto bbBufferMap = tmp[&origBB]; + s << "bb" << origBB.getDebugID(); + s << " (size " << bbBufferMap.size() << "):\n"; + for (auto valuePair : bbBufferMap) { + auto origBuf = valuePair.first; + auto adjBuf = valuePair.second; + s << "ORIG: " << origBuf; + s << "ADJ: " << adjBuf << '\n'; + } + s << '\n'; + } +} + //--------------------------------------------------------------------------// // Member accessor pullback generation //--------------------------------------------------------------------------// @@ -554,7 +615,9 @@ bool PullbackEmitter::runForSemanticMemberGetter() { SmallVector origFormalResults; collectAllFormalResultsInTypeOrder(original, origFormalResults); - auto origResult = origFormalResults[getIndices().source]; + assert(getIndices().results->getNumIndices() == 1 && + "Getter should have one semantic result"); + auto origResult = origFormalResults[*getIndices().results->begin()]; // TODO(TF-970): Emit diagnostic when `TangentVector` is not a struct. auto tangentVectorSILTy = pullback.getConventions().getSingleSILResultType( @@ -736,19 +799,20 @@ bool PullbackEmitter::run() { SmallVector origFormalResults; collectAllFormalResultsInTypeOrder(original, origFormalResults); - auto origResult = origFormalResults[getIndices().source]; - - // If original result is non-varied, it will always have a zero derivative. - // Skip full pullback generation and simply emit zero derivatives for wrt - // parameters. - // - // NOTE(TF-876): This shortcut is currently necessary for functions - // returning non-varied result with >1 basic block where some basic blocks - // have no dominated active values; control flow differentiation does not - // handle this case. See TF-876 for context. - if (!getActivityInfo().isVaried(origResult, getIndices().parameters)) { - emitZeroDerivativesForNonvariedResult(origResult); - return false; + for (auto resultIndex : getIndices().results->getIndices()) { + auto origResult = origFormalResults[resultIndex]; + // If original result is non-varied, it will always have a zero derivative. + // Skip full pullback generation and simply emit zero derivatives for wrt + // parameters. + // + // NOTE(TF-876): This shortcut is currently necessary for functions + // returning non-varied result with >1 basic block where some basic blocks + // have no dominated active values; control flow differentiation does not + // handle this case. See TF-876 for context. + if (!getActivityInfo().isVaried(origResult, getIndices().parameters)) { + emitZeroDerivativesForNonvariedResult(origResult); + return false; + } } // Get dominated active values in original blocks. @@ -934,6 +998,9 @@ bool PullbackEmitter::run() { auto pbParamArgs = pullback.getArgumentsWithoutIndirectResults(); assert(pbParamArgs.size() == 2); seed = pbParamArgs[0]; + // TODO(TF-983): Handle multiple original results. + assert(getIndices().results->getNumIndices() == 1); + auto origResult = origFormalResults[*getIndices().results->begin()]; // Assign adjoint for original result. builder.setInsertionPoint(pullbackEntry, @@ -1414,10 +1481,23 @@ PullbackEmitter::getArrayAdjointElementBuffer(SILValue arrayAdjoint, void PullbackEmitter::visitApplyInst(ApplyInst *ai) { assert(getPullbackInfo().shouldDifferentiateApplySite(ai)); - // Skip `array.uninitialized_intrinsic` intrinsic applications, which have - // special `store` and `copy_addr` support. - if (isArrayLiteralIntrinsic(ai)) + // Skip `array.uninitialized_intrinsic` applications, which have special + // `store` and `copy_addr` support. + if (ArraySemanticsCall(ai, semantics::ARRAY_UNINITIALIZED_INTRINSIC)) + return; + auto loc = ai->getLoc(); + auto *bb = ai->getParent(); + // Handle `array.finalize_intrinsic` applications. `array.finalize_intrinsic` + // semantically behaves like an identity function. + if (ArraySemanticsCall(ai, semantics::ARRAY_FINALIZE_INTRINSIC)) { + assert(ai->getNumArguments() == 1 && + "Expected intrinsic to have one operand"); + // Accumulate result's adjoint into argument's adjoint. + auto adjResult = getAdjointValue(bb, ai); + auto origArg = ai->getArgumentsWithoutIndirectResults().front(); + addAdjointValue(bb, origArg, adjResult, loc); return; + } // Replace a call to a function with a call to its pullback. auto &nestedApplyInfo = getContext().getNestedApplyInfo(); auto applyInfoLookup = nestedApplyInfo.find(ai); @@ -1433,7 +1513,6 @@ void PullbackEmitter::visitApplyInst(ApplyInst *ai) { // Get the pullback. auto *field = getPullbackInfo().lookUpLinearMapDecl(ai); assert(field); - auto loc = ai->getLoc(); auto pullback = getPullbackStructElement(ai->getParent(), field); // Get the original result of the `apply` instruction. @@ -1453,31 +1532,17 @@ void PullbackEmitter::visitApplyInst(ApplyInst *ai) { ai->getArgumentsWithoutIndirectResults()[paramIdx]); } - assert(applyInfo.indices.source < origAllResults.size()); - auto origResult = origAllResults[applyInfo.indices.source]; - assert(origResult); - auto origNumIndRes = ai->getNumIndirectResults(); - - // Get pullback arguments. + // Get callee pullback arguments. SmallVector args; - auto pullbackType = remapType(pullback->getType()).castTo(); - // Get the seed (i.e. adjoint value of the original result). - SILValue seed; - auto *bb = ai->getParent(); - if (origResult->getType().isObject()) { - // Otherwise, materialize adjoint value of `ai`. - seed = materializeAdjoint(getAdjointValue(bb, origResult), loc); - } else { - seed = getAdjointBuffer(bb, origResult); - } - - // Create allocations for pullback indirect results. - SmallVector pullbackIndirectResults; + // Handle callee pullback indirect results. + // Create local allocations for these and destroy them after the call. + auto pullbackType = remapType(pullback->getType()).castTo(); auto actualPullbackType = applyInfo.originalPullbackType ? *applyInfo.originalPullbackType : pullbackType; actualPullbackType = actualPullbackType->getUnsubstitutedType(getModule()); + SmallVector pullbackIndirectResults; for (auto indRes : actualPullbackType->getIndirectFormalResults()) { auto *alloc = builder.createAllocStack( loc, remapType(indRes.getSILStorageInterfaceType())); @@ -1485,6 +1550,22 @@ void PullbackEmitter::visitApplyInst(ApplyInst *ai) { args.push_back(alloc); } + // Get formal callee pullback arguments. + assert(applyInfo.indices.results->getNumIndices() == 1); + for (auto resultIndex : applyInfo.indices.results->getIndices()) { + assert(resultIndex < origAllResults.size()); + auto origResult = origAllResults[resultIndex]; + // Get the seed (i.e. adjoint value of the original result). + SILValue seed; + if (origResult->getType().isObject()) { + // Otherwise, materialize adjoint value of `ai`. + seed = materializeAdjoint(getAdjointValue(bb, origResult), loc); + } else { + seed = getAdjointBuffer(bb, origResult); + } + args.push_back(seed); + } + // If callee pullback was reabstracted in VJP, reabstract callee pullback. if (applyInfo.originalPullbackType) { SILOptFunctionBuilder fb(getContext().getTransform()); @@ -1494,7 +1575,6 @@ void PullbackEmitter::visitApplyInst(ApplyInst *ai) { return this->remapSubstitutionMap(subs); }); } - args.push_back(seed); // Call the callee pullback. auto *pullbackCall = builder.createApply(loc, pullback, SubstitutionMap(), @@ -1517,7 +1597,7 @@ void PullbackEmitter::visitApplyInst(ApplyInst *ai) { // Accumulate adjoints for original differentiation parameters. auto allResultsIt = allResults.begin(); for (unsigned i : applyInfo.indices.parameters->getIndices()) { - auto origArg = ai->getArgument(origNumIndRes + i); + auto origArg = ai->getArgument(ai->getNumIndirectResults() + i); // Skip adjoint accumulation for `inout` arguments. auto paramInfo = ai->getSubstCalleeConv().getParamInfoForSILArg( ai->getNumIndirectResults() + i); diff --git a/lib/SILOptimizer/Differentiation/Thunk.cpp b/lib/SILOptimizer/Differentiation/Thunk.cpp index e0b66c4be29f4..9d56ae56310b5 100644 --- a/lib/SILOptimizer/Differentiation/Thunk.cpp +++ b/lib/SILOptimizer/Differentiation/Thunk.cpp @@ -725,7 +725,7 @@ getOrCreateSubsetParametersThunkForDerivativeFunction( // Compute target type for thunking. auto derivativeFnType = derivativeFn->getType().castTo(); auto targetType = origFnType->getAutoDiffDerivativeFunctionType( - desiredIndices.parameters, desiredIndices.source, kind, module.Types, + desiredIndices.parameters, desiredIndices.results, kind, module.Types, lookupConformance); auto *caller = derivativeFn->getFunction(); if (targetType->hasArchetype()) { diff --git a/lib/SILOptimizer/Differentiation/VJPEmitter.cpp b/lib/SILOptimizer/Differentiation/VJPEmitter.cpp index 49e85bea7b1d0..a5e2b80348dae 100644 --- a/lib/SILOptimizer/Differentiation/VJPEmitter.cpp +++ b/lib/SILOptimizer/Differentiation/VJPEmitter.cpp @@ -179,15 +179,17 @@ SILFunction *VJPEmitter::createEmptyPullback() { inoutParamTanConvention); pbParams.push_back(inoutParamTanParam); } else { - auto origResult = origTy->getResults()[indices.source]; - origResult = origResult.getWithInterfaceType( - origResult.getInterfaceType()->getCanonicalType(witnessCanGenSig)); - pbParams.push_back(getTangentParameterInfoForOriginalResult( - origResult.getInterfaceType() - ->getAutoDiffTangentSpace(lookupConformance) - ->getType() - ->getCanonicalType(witnessCanGenSig), - origResult.getConvention())); + for (auto i : indices.results->getIndices()) { + auto origResult = origTy->getResults()[i]; + origResult = origResult.getWithInterfaceType( + origResult.getInterfaceType()->getCanonicalType(witnessCanGenSig)); + pbParams.push_back(getTangentParameterInfoForOriginalResult( + origResult.getInterfaceType() + ->getAutoDiffTangentSpace(lookupConformance) + ->getType() + ->getCanonicalType(witnessCanGenSig), + origResult.getConvention())); + } } // Accept a pullback struct in the pullback parameter list. This is the @@ -531,11 +533,21 @@ void VJPEmitter::visitApplyInst(ApplyInst *ai) { TypeSubstCloner::visitApplyInst(ai); return; } - // If callee is the array literal initialization intrinsic, do standard - // cloning. Array literal differentiation is handled separately. - if (isArrayLiteralIntrinsic(ai)) { - LLVM_DEBUG(getADDebugStream() << "Cloning array literal intrinsic `apply`\n" - << *ai << '\n'); + // If callee is `array.uninitialized_intrinsic`, do standard cloning. + // `array.unininitialized_intrinsic` differentiation is handled separately. + if (ArraySemanticsCall(ai, semantics::ARRAY_UNINITIALIZED_INTRINSIC)) { + LLVM_DEBUG(getADDebugStream() + << "Cloning `array.unininitialized_intrinsic` `apply`:\n" + << *ai << '\n'); + TypeSubstCloner::visitApplyInst(ai); + return; + } + // If callee is `array.finalize_intrinsic`, do standard cloning. + // `array.finalize_intrinsic` has special-case pullback generation. + if (ArraySemanticsCall(ai, semantics::ARRAY_FINALIZE_INTRINSIC)) { + LLVM_DEBUG(getADDebugStream() + << "Cloning `array.finalize_intrinsic` `apply`:\n" + << *ai << '\n'); TypeSubstCloner::visitApplyInst(ai); return; } @@ -585,12 +597,16 @@ void VJPEmitter::visitApplyInst(ApplyInst *ai) { return; } - // Form expected indices, assuming there's only one result. + // Form expected indices. + auto numSemanticResults = + ai->getSubstCalleeType()->getNumResults() + + ai->getSubstCalleeType()->getNumIndirectMutatingParameters(); SILAutoDiffIndices indices( - activeResultIndices.front(), IndexSubset::get(getASTContext(), ai->getArgumentsWithoutIndirectResults().size(), - activeParamIndices)); + activeParamIndices), + IndexSubset::get(getASTContext(), numSemanticResults, + activeResultIndices)); // Emit the VJP. SILValue vjpValue; @@ -630,9 +646,8 @@ void VJPEmitter::visitApplyInst(ApplyInst *ai) { auto diagnoseNondifferentiableOriginalFunctionType = [&](CanSILFunctionType origFnTy) { // Check and diagnose non-differentiable arguments. - for (unsigned paramIndex : range(originalFnTy->getNumParameters())) { - if (indices.isWrtParameter(paramIndex) && - !originalFnTy->getParameters()[paramIndex] + for (auto paramIndex : indices.parameters->getIndices()) { + if (!originalFnTy->getParameters()[paramIndex] .getSILStorageInterfaceType() .isDifferentiable(getModule())) { context.emitNondifferentiabilityError( @@ -643,21 +658,23 @@ void VJPEmitter::visitApplyInst(ApplyInst *ai) { } } // Check and diagnose non-differentiable results. - SILType remappedResultType; - if (indices.source >= originalFnTy->getNumResults()) { - auto inoutArgIdx = indices.source - originalFnTy->getNumResults(); - auto inoutArg = - *std::next(ai->getInoutArguments().begin(), inoutArgIdx); - remappedResultType = inoutArg->getType(); - } else { - remappedResultType = originalFnTy->getResults()[indices.source] - .getSILStorageInterfaceType(); - } - if (!remappedResultType.isDifferentiable(getModule())) { - context.emitNondifferentiabilityError( - origCallee, invoker, diag::autodiff_nondifferentiable_result); - errorOccurred = true; - return true; + for (auto resultIndex : indices.results->getIndices()) { + SILType remappedResultType; + if (resultIndex >= originalFnTy->getNumResults()) { + auto inoutArgIdx = resultIndex - originalFnTy->getNumResults(); + auto inoutArg = + *std::next(ai->getInoutArguments().begin(), inoutArgIdx); + remappedResultType = inoutArg->getType(); + } else { + remappedResultType = originalFnTy->getResults()[resultIndex] + .getSILStorageInterfaceType(); + } + if (!remappedResultType.isDifferentiable(getModule())) { + context.emitNondifferentiabilityError( + origCallee, invoker, diag::autodiff_nondifferentiable_result); + errorOccurred = true; + return true; + } } return false; }; @@ -701,13 +718,10 @@ void VJPEmitter::visitApplyInst(ApplyInst *ai) { } auto *diffFuncInst = context.createDifferentiableFunction( - getBuilder(), loc, indices.parameters, origCallee); + getBuilder(), loc, indices.parameters, indices.results, origCallee); // Record the `differentiable_function` instruction. context.addDifferentiableFunctionInstToWorklist(diffFuncInst); - // TODO(TF-689): Make `differentiable_function` store result indices and - // remove `ADContext::resultIndices`. - context.setResultIndex(diffFuncInst, activeResultIndices.front()); auto borrowedADFunc = builder.emitBeginBorrowOperation(loc, diffFuncInst); auto extractedVJP = getBuilder().createDifferentiableFunctionExtract( @@ -828,15 +842,16 @@ bool VJPEmitter::run() { // `-enable-strip-ownership-after-serialization` is true. mergeBasicBlocks(vjp); + LLVM_DEBUG(getADDebugStream() + << "Generated VJP for " << original->getName() << ":\n" + << *vjp); + // Generate pullback code. PullbackEmitter PullbackEmitter(*this); if (PullbackEmitter.run()) { errorOccurred = true; return true; } - LLVM_DEBUG(getADDebugStream() - << "Generated VJP for " << original->getName() << ":\n" - << *vjp); return errorOccurred; } diff --git a/lib/SILOptimizer/IPO/DeadFunctionElimination.cpp b/lib/SILOptimizer/IPO/DeadFunctionElimination.cpp index 15c65d2d70f36..1fe9d1b5538c4 100644 --- a/lib/SILOptimizer/IPO/DeadFunctionElimination.cpp +++ b/lib/SILOptimizer/IPO/DeadFunctionElimination.cpp @@ -440,8 +440,8 @@ class DeadFunctionElimination : FunctionLivenessComputation { void collectMethodImplementations() { // Collect vtable method implementations. - for (SILVTable &vTable : Module->getVTableList()) { - for (const SILVTable::Entry &entry : vTable.getEntries()) { + for (auto &vTable : Module->getVTables()) { + for (const SILVTable::Entry &entry : vTable->getEntries()) { // We don't need to collect destructors because we mark them as alive // anyway. if (entry.Method.kind == SILDeclRef::Kind::Deallocator || @@ -452,7 +452,7 @@ class DeadFunctionElimination : FunctionLivenessComputation { auto *fd = getBaseMethod(cast( entry.Method.getDecl())); MethodInfo *mi = getMethodInfo(fd, /*isWitnessTable*/ false); - mi->addClassMethodImpl(F, vTable.getClass()); + mi->addClassMethodImpl(F, vTable->getClass()); } } @@ -500,8 +500,8 @@ class DeadFunctionElimination : FunctionLivenessComputation { collectMethodImplementations(); // Check vtable methods. - for (SILVTable &vTable : Module->getVTableList()) { - for (const SILVTable::Entry &entry : vTable.getEntries()) { + for (auto &vTable : Module->getVTables()) { + for (const SILVTable::Entry &entry : vTable->getEntries()) { if (entry.Method.kind == SILDeclRef::Kind::Deallocator || entry.Method.kind == SILDeclRef::Kind::IVarDestroyer) { // Destructors are alive because they are called from swift_release @@ -600,9 +600,9 @@ class DeadFunctionElimination : FunctionLivenessComputation { /// Removes all dead methods from vtables and witness tables. bool removeDeadEntriesFromTables() { bool changedTable = false; - for (SILVTable &vTable : Module->getVTableList()) { - vTable.removeEntries_if([this, &changedTable] - (SILVTable::Entry &entry) -> bool { + for (auto &vTable : Module->getVTables()) { + vTable->removeEntries_if([this, &changedTable] + (SILVTable::Entry &entry) -> bool { if (!isAlive(entry.Implementation)) { LLVM_DEBUG(llvm::dbgs() << " erase dead vtable method " << entry.Implementation->getName() << "\n"); diff --git a/lib/SILOptimizer/LoopTransforms/ArrayOpt.h b/lib/SILOptimizer/LoopTransforms/ArrayOpt.h index 68644a33ee9bb..00bf1e0d9b492 100644 --- a/lib/SILOptimizer/LoopTransforms/ArrayOpt.h +++ b/lib/SILOptimizer/LoopTransforms/ArrayOpt.h @@ -118,15 +118,17 @@ class StructUseCollector { } } - /// Returns true if there is a single address user of the value. - bool hasSingleAddressUse(SILInstruction *SingleAddressUser) { + /// Returns true if there are only address users of the value. + bool hasOnlyAddressUses(ApplyInst *use1, ApplyInst *use2) { if (!AggregateAddressUsers.empty()) return false; if (!ElementAddressUsers.empty()) return false; - if (StructAddressUsers.size() != 1) - return false; - return StructAddressUsers[0] == SingleAddressUser; + for (SILInstruction *user : StructAddressUsers) { + if (user != use1 && user != use2) + return false; + } + return true; } protected: diff --git a/lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp b/lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp index fc4ca58f5659c..1141d8dd7ea6d 100644 --- a/lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp +++ b/lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp @@ -436,6 +436,18 @@ bool COWArrayOpt::checkSafeArrayAddressUses(UserList &AddressUsers) { return true; } +template +ArraySemanticsCall getEndMutationCall(const UserRange &AddressUsers) { + for (auto *UseInst : AddressUsers) { + if (auto *AI = dyn_cast(UseInst)) { + ArraySemanticsCall ASC(AI); + if (ASC.getKind() == ArrayCallKind::kEndMutation) + return ASC; + } + } + return ArraySemanticsCall(); +} + /// Returns true if this instruction is a safe array use if all of its users are /// also safe array users. static SILValue isTransitiveSafeUser(SILInstruction *I) { @@ -642,7 +654,7 @@ bool COWArrayOpt::hasLoopOnlyDestructorSafeArrayOperations() { // Semantic calls are safe. ArraySemanticsCall Sem(Inst); - if (Sem) { + if (Sem && Sem.hasSelf()) { auto Kind = Sem.getKind(); // Safe because they create new arrays. if (Kind == ArrayCallKind::kArrayInit || @@ -811,8 +823,14 @@ void COWArrayOpt::hoistAddressProjections(Operand &ArrayOp) { } } -/// Check if this call to "make_mutable" is hoistable, and move it, or delete it -/// if it's already hoisted. +/// Check if this call to "make_mutable" is hoistable, and copy it, along with +/// the corresponding end_mutation call, to the loop pre-header. +/// +/// The origial make_mutable/end_mutation calls remain in the loop, because +/// removing them would violate the COW representation rules. +/// Having those calls in the pre-header will then enable COWOpts (after +/// inlining) to constant fold the uniqueness check of the begin_cow_mutation +/// in the loop. bool COWArrayOpt::hoistMakeMutable(ArraySemanticsCall MakeMutable, bool dominatesExits) { LLVM_DEBUG(llvm::dbgs() << " Checking mutable array: " <getUses(), + ValueBase::UseToUser()); + + // There should be a call to end_mutation. Find it so that we can copy it to + // the pre-header. + ArraySemanticsCall EndMutation = getEndMutationCall(ArrayUsers); + if (!EndMutation) { + EndMutation = getEndMutationCall(StructUses.StructAddressUsers); + if (!EndMutation) + return false; + } + // Hoist the make_mutable. LLVM_DEBUG(llvm::dbgs() << " Hoisting make_mutable: " << *MakeMutable); @@ -880,12 +910,18 @@ bool COWArrayOpt::hoistMakeMutable(ArraySemanticsCall MakeMutable, assert(MakeMutable.canHoist(Preheader->getTerminator(), DomTree) && "Should be able to hoist make_mutable"); - MakeMutable.hoist(Preheader->getTerminator(), DomTree); + // Copy the make_mutable and end_mutation calls to the pre-header. + TermInst *insertionPoint = Preheader->getTerminator(); + ApplyInst *hoistedMM = MakeMutable.copyTo(insertionPoint, DomTree); + ApplyInst *EMInst = EndMutation; + ApplyInst *hoistedEM = cast(EMInst->clone(insertionPoint)); + hoistedEM->setArgument(0, hoistedMM->getArgument(0)); + placeFuncRef(hoistedEM, DomTree); // Register array loads. This is needed for hoisting make_mutable calls of // inner arrays in the two-dimensional case. if (arrayContainerIsUnique && - StructUses.hasSingleAddressUse((ApplyInst *)MakeMutable)) { + StructUses.hasOnlyAddressUses((ApplyInst *)MakeMutable, EMInst)) { for (auto use : MakeMutable.getSelf()->getUses()) { if (auto *LI = dyn_cast(use->getUser())) HoistableLoads.insert(LI); @@ -917,39 +953,33 @@ bool COWArrayOpt::run() { // is only mapped to a call once the analysis has determined that no // make_mutable calls are required within the loop body for that array. llvm::SmallDenseMap ArrayMakeMutableMap; - + + llvm::SmallVector makeMutableCalls; + for (auto *BB : Loop->getBlocks()) { if (ColdBlocks.isCold(BB)) continue; - bool dominatesExits = dominatesExitingBlocks(BB); - for (auto II = BB->begin(), IE = BB->end(); II != IE;) { - // Inst may be moved by hoistMakeMutable. - SILInstruction *Inst = &*II; - ++II; - ArraySemanticsCall MakeMutableCall(Inst, "array.make_mutable"); - if (!MakeMutableCall) - continue; + + // Instructions are getting moved around. To not mess with iterator + // invalidation, first collect all calls, and then do the transformation. + for (SILInstruction &I : *BB) { + ArraySemanticsCall MakeMutableCall(&I, "array.make_mutable"); + if (MakeMutableCall) + makeMutableCalls.push_back(MakeMutableCall); + } + bool dominatesExits = dominatesExitingBlocks(BB); + for (ArraySemanticsCall MakeMutableCall : makeMutableCalls) { CurrentArrayAddr = MakeMutableCall.getSelf(); auto HoistedCallEntry = ArrayMakeMutableMap.find(CurrentArrayAddr); if (HoistedCallEntry == ArrayMakeMutableMap.end()) { - if (!hoistMakeMutable(MakeMutableCall, dominatesExits)) { + if (hoistMakeMutable(MakeMutableCall, dominatesExits)) { + ArrayMakeMutableMap[CurrentArrayAddr] = MakeMutableCall; + HasChanged = true; + } else { ArrayMakeMutableMap[CurrentArrayAddr] = nullptr; - continue; } - - ArrayMakeMutableMap[CurrentArrayAddr] = MakeMutableCall; - HasChanged = true; - continue; } - - if (!HoistedCallEntry->second) - continue; - - LLVM_DEBUG(llvm::dbgs() << " Removing make_mutable call: " - << *MakeMutableCall); - MakeMutableCall.removeCall(); - HasChanged = true; } } return HasChanged; diff --git a/lib/SILOptimizer/LoopTransforms/ForEachLoopUnroll.cpp b/lib/SILOptimizer/LoopTransforms/ForEachLoopUnroll.cpp index a1da1e09b6e9f..0aec5461189b8 100644 --- a/lib/SILOptimizer/LoopTransforms/ForEachLoopUnroll.cpp +++ b/lib/SILOptimizer/LoopTransforms/ForEachLoopUnroll.cpp @@ -323,8 +323,15 @@ void ArrayInfo::classifyUsesOfArray(SILValue arrayValue) { // as the array itself is not modified (which is possible with reference // types). ArraySemanticsCall arrayOp(user); - if (!arrayOp.doesNotChangeArray()) - mayBeWritten = true; + if (arrayOp.doesNotChangeArray()) + continue; + + if (arrayOp.getKind() == swift::ArrayCallKind::kArrayFinalizeIntrinsic) { + classifyUsesOfArray((ApplyInst *)arrayOp); + continue; + } + + mayBeWritten = true; } } diff --git a/lib/SILOptimizer/Mandatory/Differentiation.cpp b/lib/SILOptimizer/Mandatory/Differentiation.cpp index b05e8a6550e28..cd219974ff80c 100644 --- a/lib/SILOptimizer/Mandatory/Differentiation.cpp +++ b/lib/SILOptimizer/Mandatory/Differentiation.cpp @@ -341,7 +341,7 @@ static SILValue reapplyFunctionConversion( ADContext &context, SILValue newFunc, SILValue oldFunc, SILValue oldConvertedFunc, SILBuilder &builder, SILLocation loc, SmallVectorImpl &newBuffersToDealloc, - IndexSubset *parameterIndices, + IndexSubset *parameterIndices, IndexSubset *resultIndices, GenericSignature newFuncGenSig = GenericSignature()) { // If the old func is the new func, then there's no conversion. if (oldFunc == oldConvertedFunc) @@ -354,7 +354,7 @@ static SILValue reapplyFunctionConversion( // function. return reapplyFunctionConversion( context, newFunc, oldFunc, cvi->getOperand(), builder, loc, - newBuffersToDealloc, parameterIndices, newFuncGenSig); + newBuffersToDealloc, parameterIndices, resultIndices, newFuncGenSig); } // begin_borrow if (auto *bbi = dyn_cast(oldConvertedFunc)) { @@ -363,19 +363,19 @@ static SILValue reapplyFunctionConversion( // function. return reapplyFunctionConversion( context, newFunc, oldFunc, bbi->getOperand(), builder, loc, - newBuffersToDealloc, parameterIndices, newFuncGenSig); + newBuffersToDealloc, parameterIndices, resultIndices, newFuncGenSig); } // convert_function if (auto *cfi = dyn_cast(oldConvertedFunc)) { return reapplyFunctionConversion( context, newFunc, oldFunc, cfi->getOperand(), builder, loc, - newBuffersToDealloc, parameterIndices, newFuncGenSig); + newBuffersToDealloc, parameterIndices, resultIndices, newFuncGenSig); } // thin_to_thick_function if (auto *tttfi = dyn_cast(oldConvertedFunc)) { auto innerNewFunc = reapplyFunctionConversion( context, newFunc, oldFunc, tttfi->getOperand(), builder, loc, - newBuffersToDealloc, parameterIndices, newFuncGenSig); + newBuffersToDealloc, parameterIndices, resultIndices, newFuncGenSig); auto operandFnTy = innerNewFunc->getType().castTo(); auto thickTy = operandFnTy->getWithRepresentation( SILFunctionTypeRepresentation::Thick); @@ -391,7 +391,7 @@ static SILValue reapplyFunctionConversion( newBuffersToDealloc); auto innerNewFunc = reapplyFunctionConversion( context, newFunc, oldFunc, pai->getCallee(), builder, loc, - newBuffersToDealloc, parameterIndices, newFuncGenSig); + newBuffersToDealloc, parameterIndices, resultIndices, newFuncGenSig); // Reabstraction thunk `partial_apply` reapplications require special // support. Reabstraction thunk JVP/VJP expects a `@differentiable` // function-typed argument to avoid opaque function non-differentiability @@ -407,7 +407,7 @@ static SILValue reapplyFunctionConversion( "Expected reabstraction thunk to be partially applied with only " "one argument"); auto *dfi = context.createDifferentiableFunction( - builder, loc, parameterIndices, newArgs.back()); + builder, loc, parameterIndices, resultIndices, newArgs.back()); context.addDifferentiableFunctionInstToWorklist(dfi); newArgs.back() = dfi; } @@ -487,8 +487,7 @@ emitDerivativeFunctionReference( derivativeFn = builder.emitCopyValueOperation(original.getLoc(), derivativeFn); builder.emitEndBorrowOperation(original.getLoc(), borrowedDiffFunc); - SILAutoDiffIndices indices(0, desiredIndices.parameters); - return std::make_pair(derivativeFn, indices); + return std::make_pair(derivativeFn, desiredIndices); } } @@ -499,11 +498,8 @@ emitDerivativeFunctionReference( auto *originalFn = originalFRI->getReferencedFunctionOrNull(); assert(originalFn); auto originalFnTy = originalFn->getLoweredFunctionType(); - auto numResults = originalFnTy->getNumResults() + - originalFnTy->getNumIndirectMutatingParameters(); - auto *desiredResultIndices = IndexSubset::get( - context.getASTContext(), numResults, {desiredIndices.source}); auto *desiredParameterIndices = desiredIndices.parameters; + auto *desiredResultIndices = desiredIndices.results; // NOTE(TF-893): Extending capacity is necessary when `originalFnTy` has // parameters corresponding to captured variables. // TODO: If posssible, change `autodiff::getLoweredParameterIndices` to @@ -547,22 +543,23 @@ emitDerivativeFunctionReference( } } // Check and diagnose non-differentiable results. - SILType resultType; - if (desiredIndices.source >= originalFnTy->getNumResults()) { - auto inoutParamIdx = - desiredIndices.source - originalFnTy->getNumResults(); - auto inoutParam = - *std::next(originalFnTy->getIndirectMutatingParameters().begin(), - inoutParamIdx); - resultType = inoutParam.getSILStorageInterfaceType(); - } else { - resultType = originalFnTy->getResults()[desiredIndices.source] - .getSILStorageInterfaceType(); - } - if (!resultType.isDifferentiable(context.getModule())) { - context.emitNondifferentiabilityError( - original, invoker, diag::autodiff_nondifferentiable_result); - return None; + for (auto resultIndex : desiredResultIndices->getIndices()) { + SILType resultType; + if (resultIndex >= originalFnTy->getNumResults()) { + auto inoutParamIdx = resultIndex - originalFnTy->getNumResults(); + auto inoutParam = + *std::next(originalFnTy->getIndirectMutatingParameters().begin(), + inoutParamIdx); + resultType = inoutParam.getSILStorageInterfaceType(); + } else { + resultType = originalFnTy->getResults()[resultIndex] + .getSILStorageInterfaceType(); + } + if (!resultType.isDifferentiable(context.getModule())) { + context.emitNondifferentiabilityError( + original, invoker, diag::autodiff_nondifferentiable_result); + return None; + } } // Check and diagnose external declarations. if (originalFn->isExternalDeclaration()) { @@ -642,15 +639,14 @@ emitDerivativeFunctionReference( loc, witnessKind, minimalWitness); auto convertedRef = reapplyFunctionConversion( context, derivativeFnRef, originalFRI, original, builder, loc, - newBuffersToDealloc, desiredIndices.parameters, + newBuffersToDealloc, desiredIndices.parameters, desiredIndices.results, derivativeFnRef->getType() .getASTType() ->castTo() ->getSubstGenericSignature()); return std::make_pair( - convertedRef, - SILAutoDiffIndices(desiredIndices.source, - minimalWitness->getParameterIndices())); + convertedRef, SILAutoDiffIndices(minimalWitness->getParameterIndices(), + minimalWitness->getResultIndices())); } // Handle `witness_method`. @@ -682,7 +678,7 @@ emitDerivativeFunctionReference( // Emit a `witness_method` instruction for the derivative function. auto originalType = witnessMethod->getType().castTo(); auto assocType = originalType->getAutoDiffDerivativeFunctionType( - minimalIndices.parameters, minimalIndices.source, kind, + minimalIndices.parameters, minimalIndices.results, kind, context.getTypeConverter(), LookUpConformanceInModule(builder.getModule().getSwiftModule())); auto *autoDiffFuncId = AutoDiffDerivativeFunctionIdentifier::get( @@ -694,7 +690,7 @@ emitDerivativeFunctionReference( SILType::getPrimitiveObjectType(assocType)); auto convertedRef = reapplyFunctionConversion( context, ref, witnessMethod, original, builder, loc, - newBuffersToDealloc, desiredIndices.parameters); + newBuffersToDealloc, desiredIndices.parameters, desiredIndices.results); return std::make_pair(convertedRef, minimalIndices); } @@ -727,7 +723,7 @@ emitDerivativeFunctionReference( // Emit a `class_method` instruction for the derivative function. auto originalType = classMethod->getType().castTo(); auto assocType = originalType->getAutoDiffDerivativeFunctionType( - minimalIndices.parameters, minimalIndices.source, kind, + minimalIndices.parameters, minimalIndices.results, kind, context.getTypeConverter(), LookUpConformanceInModule(builder.getModule().getSwiftModule())); auto *autoDiffFuncId = AutoDiffDerivativeFunctionIdentifier::get( @@ -739,7 +735,7 @@ emitDerivativeFunctionReference( SILType::getPrimitiveObjectType(assocType)); auto convertedRef = reapplyFunctionConversion( context, ref, classMethod, original, builder, loc, newBuffersToDealloc, - desiredIndices.parameters); + desiredIndices.parameters, desiredIndices.results); return std::make_pair(convertedRef, minimalIndices); } @@ -781,7 +777,7 @@ static SILFunction *createEmptyVJP(ADContext &context, SILFunction *original, if (vjpCanGenSig && !vjpCanGenSig->areAllParamsConcrete()) vjpGenericEnv = vjpCanGenSig->getGenericEnvironment(); auto vjpType = originalTy->getAutoDiffDerivativeFunctionType( - indices.parameters, indices.source, AutoDiffDerivativeFunctionKind::VJP, + indices.parameters, indices.results, AutoDiffDerivativeFunctionKind::VJP, module.Types, LookUpConformanceInModule(module.getSwiftModule()), vjpCanGenSig, /*isReabstractionThunk*/ original->isThunk() == IsReabstractionThunk); @@ -826,7 +822,7 @@ static SILFunction *createEmptyJVP(ADContext &context, SILFunction *original, if (jvpCanGenSig && !jvpCanGenSig->areAllParamsConcrete()) jvpGenericEnv = jvpCanGenSig->getGenericEnvironment(); auto jvpType = originalTy->getAutoDiffDerivativeFunctionType( - indices.parameters, indices.source, AutoDiffDerivativeFunctionKind::JVP, + indices.parameters, indices.results, AutoDiffDerivativeFunctionKind::JVP, module.Types, LookUpConformanceInModule(module.getSwiftModule()), jvpCanGenSig, /*isReabstractionThunk*/ original->isThunk() == IsReabstractionThunk); @@ -979,9 +975,9 @@ static SILValue promoteCurryThunkApplicationToDifferentiableFunction( DifferentiationTransformer &dt, DifferentiableFunctionInst *dfi, SILBuilder &builder, SILLocation loc, DifferentiationInvoker invoker) { auto origFnOperand = dfi->getOriginalFunction(); - auto parameterIndices = dfi->getParameterIndices(); + auto *parameterIndices = dfi->getParameterIndices(); + auto *resultIndices = dfi->getResultIndices(); auto &context = dt.getContext(); - unsigned resultIndex = context.getResultIndex(dfi); // Check for curry thunk application: // - The original function operand must be an `apply` instruction. @@ -1001,7 +997,7 @@ static SILValue promoteCurryThunkApplicationToDifferentiableFunction( return nullptr; // Create a new curry thunk. - SILAutoDiffIndices desiredIndices(resultIndex, parameterIndices); + SILAutoDiffIndices desiredIndices(parameterIndices, resultIndices); // TODO(TF-685): Use more principled mangling for thunks. auto newThunkName = "AD__" + thunk->getName().str() + "__differentiable_curry_thunk_" + desiredIndices.mangle(); @@ -1044,8 +1040,7 @@ static SILValue promoteCurryThunkApplicationToDifferentiableFunction( SILBuilderWithScope dfiBuilder( std::next(returnValue->getDefiningInstruction()->getIterator())); auto *dfi = context.createDifferentiableFunction( - dfiBuilder, loc, parameterIndices, returnValue); - context.setResultIndex(dfi, resultIndex); + dfiBuilder, loc, parameterIndices, resultIndices, returnValue); dfiBuilder.setInsertionPoint(newThunk->findReturnBB()); dfiBuilder.createReturn(loc, dfi); retInst->eraseFromParent(); @@ -1076,16 +1071,17 @@ static SILValue promoteCurryThunkApplicationToDifferentiableFunction( SILValue DifferentiationTransformer::promoteToDifferentiableFunction( DifferentiableFunctionInst *dfi, SILBuilder &builder, SILLocation loc, DifferentiationInvoker invoker) { + auto &astCtx = context.getASTContext(); auto origFnOperand = dfi->getOriginalFunction(); auto origFnTy = origFnOperand->getType().castTo(); - auto parameterIndices = dfi->getParameterIndices(); - unsigned resultIndex = context.getResultIndex(dfi); + auto *parameterIndices = dfi->getParameterIndices(); + auto *resultIndices = dfi->getResultIndices(); if (auto diffFn = promoteCurryThunkApplicationToDifferentiableFunction( *this, dfi, builder, loc, invoker)) return diffFn; - SILAutoDiffIndices desiredIndices(resultIndex, parameterIndices); + SILAutoDiffIndices desiredIndices(parameterIndices, resultIndices); SmallVector derivativeFns; SmallVector newBuffersToDealloc; for (auto derivativeFnKind : {AutoDiffDerivativeFunctionKind::JVP, @@ -1112,10 +1108,11 @@ SILValue DifferentiationTransformer::promoteToDifferentiableFunction( // have smaller capacity than `actualIndices`. We expect this logic to go // away when we support `@differentiable` partial apply. // if (actualIndices != desiredIndices) { // TODO: Re-enable. - auto extendedDesiredIndices = desiredIndices.parameters->extendingCapacity( - context.getASTContext(), actualIndices.parameters->getCapacity()); - if (actualIndices.source != desiredIndices.source || - !actualIndices.parameters->equals(extendedDesiredIndices)) { + auto extendedDesiredParameterIndices = + desiredIndices.parameters->extendingCapacity( + astCtx, actualIndices.parameters->getCapacity()); + if (!actualIndices.parameters->equals(extendedDesiredParameterIndices) || + !actualIndices.results->equals(desiredIndices.results)) { // Destroy the already emitted derivative function reference because it // is no longer used. builder.emitDestroyValueOperation(loc, derivativeFn); @@ -1139,7 +1136,8 @@ SILValue DifferentiationTransformer::promoteToDifferentiableFunction( return nullptr; } // Create the parameter subset thunk. - assert(actualIndices.parameters->isSupersetOf(extendedDesiredIndices)); + assert(actualIndices.parameters->isSupersetOf( + extendedDesiredParameterIndices)); SILFunction *thunk; SubstitutionMap interfaceSubs; SILOptFunctionBuilder fb(transform); @@ -1158,7 +1156,7 @@ SILValue DifferentiationTransformer::promoteToDifferentiableFunction( } } auto expectedDerivativeFnTy = origFnTy->getAutoDiffDerivativeFunctionType( - parameterIndices, resultIndex, derivativeFnKind, + parameterIndices, resultIndices, derivativeFnKind, context.getTypeConverter(), LookUpConformanceInModule(context.getModule().getSwiftModule())); // If `derivativeFn` is `@convention(thin)` but is expected to be @@ -1181,9 +1179,8 @@ SILValue DifferentiationTransformer::promoteToDifferentiableFunction( auto origFnCopy = builder.emitCopyValueOperation(loc, origFnOperand); auto *newDiffFn = context.createDifferentiableFunction( - builder, loc, parameterIndices, origFnCopy, + builder, loc, parameterIndices, resultIndices, origFnCopy, std::make_pair(derivativeFns[0], derivativeFns[1])); - context.setResultIndex(dfi, resultIndex); context.addDifferentiableFunctionInstToWorklist(dfi); return newDiffFn; } diff --git a/lib/SILOptimizer/Mandatory/OSLogOptimization.cpp b/lib/SILOptimizer/Mandatory/OSLogOptimization.cpp index c543b72f8f79a..9b0ded1b091ed 100644 --- a/lib/SILOptimizer/Mandatory/OSLogOptimization.cpp +++ b/lib/SILOptimizer/Mandatory/OSLogOptimization.cpp @@ -539,6 +539,16 @@ static SILValue emitCodeForConstantArray(ArrayRef elements, module.findFunction(allocatorMangledName, SILLinkage::PublicExternal); assert(arrayAllocateFun); + SILFunction *arrayFinalizeFun = nullptr; + if (FuncDecl *arrayFinalizeDecl = astContext.getFinalizeUninitializedArray()) { + std::string finalizeMangledName = + SILDeclRef(arrayFinalizeDecl, SILDeclRef::Kind::Func).mangle(); + arrayFinalizeFun = + module.findFunction(finalizeMangledName, SILLinkage::SharedExternal); + assert(arrayFinalizeFun); + module.linkFunction(arrayFinalizeFun); + } + // Call the _allocateUninitializedArray function with numElementsSIL. The // call returns a two-element tuple, where the first element is the newly // created array and the second element is a pointer to the internal storage @@ -596,6 +606,12 @@ static SILValue emitCodeForConstantArray(ArrayRef elements, StoreOwnershipQualifier::Init); ++elementIndex; } + if (arrayFinalizeFun) { + FunctionRefInst *arrayFinalizeRef = + builder.createFunctionRef(loc, arrayFinalizeFun); + arraySIL = builder.createApply(loc, arrayFinalizeRef, subMap, + ArrayRef(arraySIL)); + } return arraySIL; } diff --git a/lib/SILOptimizer/Mandatory/OwnershipModelEliminator.cpp b/lib/SILOptimizer/Mandatory/OwnershipModelEliminator.cpp index 40c47fd45f47d..33d574faddb73 100644 --- a/lib/SILOptimizer/Mandatory/OwnershipModelEliminator.cpp +++ b/lib/SILOptimizer/Mandatory/OwnershipModelEliminator.cpp @@ -362,9 +362,10 @@ namespace { struct OwnershipModelEliminator : SILModuleTransform { bool SkipTransparent; + bool SkipStdlibModule; - OwnershipModelEliminator(bool SkipTransparent) - : SkipTransparent(SkipTransparent) {} + OwnershipModelEliminator(bool SkipTransparent, bool SkipStdlibModule) + : SkipTransparent(SkipTransparent), SkipStdlibModule(SkipStdlibModule) {} void run() override { if (DumpBefore.size()) { @@ -372,6 +373,13 @@ struct OwnershipModelEliminator : SILModuleTransform { } auto &Mod = *getModule(); + + // If we are supposed to skip the stdlib module and we are in the stdlib + // module bail. + if (SkipStdlibModule && Mod.isStdlibModule()) { + return; + } + for (auto &F : Mod) { // If F does not have ownership, skip it. We have no further work to do. if (!F.hasOwnership()) @@ -429,9 +437,17 @@ struct OwnershipModelEliminator : SILModuleTransform { } // end anonymous namespace SILTransform *swift::createOwnershipModelEliminator() { - return new OwnershipModelEliminator(false /*skip transparent*/); + return new OwnershipModelEliminator(false /*skip transparent*/, + false /*ignore stdlib*/); } SILTransform *swift::createNonTransparentFunctionOwnershipModelEliminator() { - return new OwnershipModelEliminator(true /*skip transparent*/); + return new OwnershipModelEliminator(true /*skip transparent*/, + false /*ignore stdlib*/); +} + +SILTransform * +swift::createNonStdlibNonTransparentFunctionOwnershipModelEliminator() { + return new OwnershipModelEliminator(true /*skip transparent*/, + true /*ignore stdlib*/); } diff --git a/lib/SILOptimizer/SILCombiner/SILCombiner.h b/lib/SILOptimizer/SILCombiner/SILCombiner.h index 508fa6e324a94..cfd8207d089fe 100644 --- a/lib/SILOptimizer/SILCombiner/SILCombiner.h +++ b/lib/SILOptimizer/SILCombiner/SILCombiner.h @@ -176,6 +176,7 @@ class SILCombiner : SILInstruction *optimizeLoadFromStringLiteral(LoadInst *LI); SILInstruction *visitLoadInst(LoadInst *LI); SILInstruction *visitIndexAddrInst(IndexAddrInst *IA); + bool optimizeStackAllocatedEnum(AllocStackInst *AS); SILInstruction *visitAllocStackInst(AllocStackInst *AS); SILInstruction *visitAllocRefInst(AllocRefInst *AR); SILInstruction *visitSwitchEnumAddrInst(SwitchEnumAddrInst *SEAI); diff --git a/lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp b/lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp index 2001a208d78a5..01c9237526742 100644 --- a/lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp +++ b/lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp @@ -454,10 +454,109 @@ static bool somethingIsRetained(SILInstruction *from, AllocStackInst *alloc) { return false; } +/// Replaces an alloc_stack of an enum by an alloc_stack of the payload if only +/// one enum case (with payload) is stored to that location. +/// +/// For example: +/// +/// %loc = alloc_stack $Optional +/// %payload = init_enum_data_addr %loc +/// store %value to %payload +/// ... +/// %take_addr = unchecked_take_enum_data_addr %loc +/// %l = load %take_addr +/// +/// is transformed to +/// +/// %loc = alloc_stack $T +/// store %value to %loc +/// ... +/// %l = load %loc +bool SILCombiner::optimizeStackAllocatedEnum(AllocStackInst *AS) { + EnumDecl *enumDecl = AS->getType().getEnumOrBoundGenericEnum(); + if (!enumDecl) + return false; + + EnumElementDecl *element = nullptr; + SILType payloadType; + + // First step: check if the stack location is only used to hold one specific + // enum case with payload. + for (auto *use : AS->getUses()) { + SILInstruction *user = use->getUser(); + switch (user->getKind()) { + case SILInstructionKind::DebugValueAddrInst: + case SILInstructionKind::DestroyAddrInst: + case SILInstructionKind::DeallocStackInst: + break; + case SILInstructionKind::InitEnumDataAddrInst: { + auto *ieda = cast(user); + auto *el = ieda->getElement(); + if (element && el != element) + return false; + element = el; + assert(!payloadType || payloadType == ieda->getType()); + payloadType = ieda->getType(); + break; + } + case SILInstructionKind::InjectEnumAddrInst: { + auto *el = cast(user)->getElement(); + if (element && el != element) + return false; + element = el; + break; + } + case SILInstructionKind::UncheckedTakeEnumDataAddrInst: { + auto *el = cast(user)->getElement(); + if (element && el != element) + return false; + element = el; + break; + } + default: + return false; + } + } + if (!element || !payloadType) + return false; + + // Second step: replace the enum alloc_stack with a payload alloc_stack. + auto *newAlloc = Builder.createAllocStack( + AS->getLoc(), payloadType, AS->getVarInfo(), AS->hasDynamicLifetime()); + + while (!AS->use_empty()) { + Operand *use = *AS->use_begin(); + SILInstruction *user = use->getUser(); + switch (user->getKind()) { + case SILInstructionKind::InjectEnumAddrInst: + case SILInstructionKind::DebugValueAddrInst: + eraseInstFromFunction(*user); + break; + case SILInstructionKind::DestroyAddrInst: + case SILInstructionKind::DeallocStackInst: + use->set(newAlloc); + break; + case SILInstructionKind::InitEnumDataAddrInst: + case SILInstructionKind::UncheckedTakeEnumDataAddrInst: { + auto *svi = cast(user); + svi->replaceAllUsesWith(newAlloc); + eraseInstFromFunction(*svi); + break; + } + default: + llvm_unreachable("unexpected alloc_stack user"); + } + } + return true; +} + SILInstruction *SILCombiner::visitAllocStackInst(AllocStackInst *AS) { if (AS->getFunction()->hasOwnership()) return nullptr; + if (optimizeStackAllocatedEnum(AS)) + return nullptr; + // If we are testing SILCombine and we are asked not to eliminate // alloc_stacks, just return. if (DisableAllocStackOpts) diff --git a/lib/SILOptimizer/Transforms/CMakeLists.txt b/lib/SILOptimizer/Transforms/CMakeLists.txt index b5cfb49ac39d8..f1e604be3aeb5 100644 --- a/lib/SILOptimizer/Transforms/CMakeLists.txt +++ b/lib/SILOptimizer/Transforms/CMakeLists.txt @@ -25,6 +25,7 @@ target_sources(swiftSILOptimizer PRIVATE ObjectOutliner.cpp PerformanceInliner.cpp PhiArgumentOptimizations.cpp + PruneVTables.cpp RedundantLoadElimination.cpp RedundantOverflowCheckRemoval.cpp ReleaseDevirtualizer.cpp diff --git a/lib/SILOptimizer/Transforms/GenericSpecializer.cpp b/lib/SILOptimizer/Transforms/GenericSpecializer.cpp index 82dd9d4d33ce8..60bb6377fe69c 100644 --- a/lib/SILOptimizer/Transforms/GenericSpecializer.cpp +++ b/lib/SILOptimizer/Transforms/GenericSpecializer.cpp @@ -64,14 +64,13 @@ bool GenericSpecializer::specializeAppliesInFunction(SILFunction &F) { // Collect the applies for this block in reverse order so that we // can pop them off the end of our vector and process them in // forward order. - for (auto It = BB.rbegin(), End = BB.rend(); It != End; ++It) { - auto *I = &*It; + for (auto &I : llvm::reverse(BB)) { // Skip non-apply instructions, apply instructions with no // substitutions, apply instructions where we do not statically // know the called function, and apply instructions where we do // not have the body of the called function. - ApplySite Apply = ApplySite::isa(I); + ApplySite Apply = ApplySite::isa(&I); if (!Apply || !Apply.hasSubstitutions()) continue; @@ -81,7 +80,7 @@ bool GenericSpecializer::specializeAppliesInFunction(SILFunction &F) { if (!Callee->isDefinition()) { ORE.emit([&]() { using namespace OptRemark; - return RemarkMissed("NoDef", *I) + return RemarkMissed("NoDef", I) << "Unable to specialize generic function " << NV("Callee", Callee) << " since definition is not visible"; }); diff --git a/lib/SILOptimizer/Transforms/ObjectOutliner.cpp b/lib/SILOptimizer/Transforms/ObjectOutliner.cpp index 2da566a30041f..7f7289e195acd 100644 --- a/lib/SILOptimizer/Transforms/ObjectOutliner.cpp +++ b/lib/SILOptimizer/Transforms/ObjectOutliner.cpp @@ -35,17 +35,18 @@ class ObjectOutliner { return type.getNominalOrBoundGenericNominal() == ArrayDecl; } - bool isValidUseOfObject(SILInstruction *Val, - bool isCOWObject, - ApplyInst **FindStringCall = nullptr); + bool isValidUseOfObject(SILInstruction *Val, EndCOWMutationInst *toIgnore); + + ApplyInst *findFindStringCall(SILValue V); bool getObjectInitVals(SILValue Val, llvm::DenseMap &MemberStores, llvm::SmallVectorImpl &TailStores, unsigned NumTailTupleElements, - ApplyInst **FindStringCall); + EndCOWMutationInst *toIgnore); bool handleTailAddr(int TailIdx, SILInstruction *I, unsigned NumTailTupleElements, - llvm::SmallVectorImpl &TailStores); + llvm::SmallVectorImpl &TailStores, + EndCOWMutationInst *toIgnore); bool optimizeObjectAllocation(AllocRefInst *ARI); void replaceFindStringCall(ApplyInst *FindStringCall); @@ -116,13 +117,11 @@ static bool isValidInitVal(SILValue V) { } /// Check if a use of an object may prevent outlining the object. -/// -/// If \p isCOWObject is true, then the object reference is wrapped into a -/// COW container. Currently this is just Array. -/// If a use is a call to the findStringSwitchCase semantic call, the apply -/// is returned in \p FindStringCall. -bool ObjectOutliner::isValidUseOfObject(SILInstruction *I, bool isCOWObject, - ApplyInst **FindStringCall) { +bool ObjectOutliner::isValidUseOfObject(SILInstruction *I, + EndCOWMutationInst *toIgnore) { + if (I == toIgnore) + return true; + switch (I->getKind()) { case SILInstructionKind::DebugValueAddrInst: case SILInstructionKind::DebugValueInst: @@ -134,49 +133,22 @@ bool ObjectOutliner::isValidUseOfObject(SILInstruction *I, bool isCOWObject, case SILInstructionKind::SetDeallocatingInst: return true; - case SILInstructionKind::ReturnInst: - case SILInstructionKind::TryApplyInst: - case SILInstructionKind::PartialApplyInst: - case SILInstructionKind::StoreInst: - /// We don't have a representation for COW objects in SIL, so we do some - /// ad-hoc testing: We can ignore uses of a COW object if any use after - /// this will do a uniqueness checking before the object is modified. - return isCOWObject; - - case SILInstructionKind::ApplyInst: - if (!isCOWObject) - return false; - // There should only be a single call to findStringSwitchCase. But even - // if there are multiple calls, it's not problem - we'll just optimize the - // last one we find. - if (cast(I)->hasSemantics(semantics::FIND_STRING_SWITCH_CASE)) - *FindStringCall = cast(I); - return true; - - case SILInstructionKind::StructInst: - if (isCOWType(cast(I)->getType())) { - // The object is wrapped into a COW container. - isCOWObject = true; - } - break; - - case SILInstructionKind::UncheckedRefCastInst: case SILInstructionKind::StructElementAddrInst: case SILInstructionKind::AddressToPointerInst: - assert(!isCOWObject && "instruction cannot have a COW object as operand"); - break; - + case SILInstructionKind::StructInst: case SILInstructionKind::TupleInst: case SILInstructionKind::TupleExtractInst: case SILInstructionKind::EnumInst: - break; - case SILInstructionKind::StructExtractInst: - // To be on the safe side we don't consider the object as COW if it is - // extracted again from the COW container: the uniqueness check may be - // optimized away in this case. - isCOWObject = false; - break; + case SILInstructionKind::UncheckedRefCastInst: + case SILInstructionKind::UpcastInst: { + auto SVI = cast(I); + for (Operand *Use : getNonDebugUses(SVI)) { + if (!isValidUseOfObject(Use->getUser(), toIgnore)) + return false; + } + return true; + } case SILInstructionKind::BuiltinInst: { // Handle the case for comparing addresses. This occurs when the Array @@ -198,26 +170,51 @@ bool ObjectOutliner::isValidUseOfObject(SILInstruction *I, bool isCOWObject, default: return false; } +} - auto SVI = cast(I); - for (Operand *Use : getNonDebugUses(SVI)) { - if (!isValidUseOfObject(Use->getUser(), isCOWObject, FindStringCall)) - return false; +/// Finds a call to findStringSwitchCase in the uses of \p V. +ApplyInst *ObjectOutliner::findFindStringCall(SILValue V) { + for (Operand *use : V->getUses()) { + SILInstruction *user = use->getUser(); + switch (user->getKind()) { + case SILInstructionKind::ApplyInst: + // There should only be a single call to findStringSwitchCase. But even + // if there are multiple calls, it's not problem - we'll just optimize the + // last one we find. + if (cast(user)->hasSemantics(semantics::FIND_STRING_SWITCH_CASE)) + return cast(user); + break; + + case SILInstructionKind::StructInst: + case SILInstructionKind::TupleInst: + case SILInstructionKind::UncheckedRefCastInst: + case SILInstructionKind::UpcastInst: { + if (ApplyInst *foundCall = + findFindStringCall(cast(user))) { + return foundCall; + } + break; + } + + default: + break; + } } - return true; + return nullptr; } /// Handle the address of a tail element. bool ObjectOutliner::handleTailAddr(int TailIdx, SILInstruction *TailAddr, unsigned NumTailTupleElements, - llvm::SmallVectorImpl &TailStores) { + llvm::SmallVectorImpl &TailStores, + EndCOWMutationInst *toIgnore) { if (NumTailTupleElements > 0) { if (auto *TEA = dyn_cast(TailAddr)) { unsigned TupleIdx = TEA->getFieldNo(); assert(TupleIdx < NumTailTupleElements); for (Operand *Use : TEA->getUses()) { if (!handleTailAddr(TailIdx * NumTailTupleElements + TupleIdx, Use->getUser(), 0, - TailStores)) + TailStores, toIgnore)) return false; } return true; @@ -232,7 +229,7 @@ bool ObjectOutliner::handleTailAddr(int TailIdx, SILInstruction *TailAddr, } } } - return isValidUseOfObject(TailAddr, /*isCOWObject*/false); + return isValidUseOfObject(TailAddr, toIgnore); } /// Get the init values for an object's stored properties and its tail elements. @@ -240,12 +237,13 @@ bool ObjectOutliner::getObjectInitVals(SILValue Val, llvm::DenseMap &MemberStores, llvm::SmallVectorImpl &TailStores, unsigned NumTailTupleElements, - ApplyInst **FindStringCall) { + EndCOWMutationInst *toIgnore) { for (Operand *Use : Val->getUses()) { SILInstruction *User = Use->getUser(); if (auto *UC = dyn_cast(User)) { // Upcast is transparent. - if (!getObjectInitVals(UC, MemberStores, TailStores, NumTailTupleElements, FindStringCall)) + if (!getObjectInitVals(UC, MemberStores, TailStores, NumTailTupleElements, + toIgnore)) return false; } else if (auto *REA = dyn_cast(User)) { // The address of a stored property. @@ -255,7 +253,7 @@ bool ObjectOutliner::getObjectInitVals(SILValue Val, if (!isValidInitVal(SI->getSrc()) || MemberStores[REA->getField()]) return false; MemberStores[REA->getField()] = SI; - } else if (!isValidUseOfObject(ElemAddrUser, /*isCOWObject*/false)) { + } else if (!isValidUseOfObject(ElemAddrUser, toIgnore)) { return false; } } @@ -272,15 +270,17 @@ bool ObjectOutliner::getObjectInitVals(SILValue Val, TailIdx = Index->getValue().getZExtValue(); for (Operand *IAUse : IA->getUses()) { - if (!handleTailAddr(TailIdx, IAUse->getUser(), NumTailTupleElements, TailStores)) + if (!handleTailAddr(TailIdx, IAUse->getUser(), NumTailTupleElements, + TailStores, toIgnore)) return false; } // Without an index_addr it's the first tail element. - } else if (!handleTailAddr(/*TailIdx*/0, TailUser, NumTailTupleElements, TailStores)) { + } else if (!handleTailAddr(/*TailIdx*/0, TailUser, NumTailTupleElements, + TailStores, toIgnore)) { return false; } } - } else if (!isValidUseOfObject(User, /*isCOWObject*/false, FindStringCall)) { + } else if (!isValidUseOfObject(User, toIgnore)) { return false; } } @@ -302,10 +302,25 @@ class GlobalVariableMangler : public Mangle::ASTMangler { } }; +static EndCOWMutationInst *getEndCOWMutation(SILValue object) { + for (Operand *use : object->getUses()) { + SILInstruction *user = use->getUser(); + if (auto *upCast = dyn_cast(user)) { + // Look through upcast instructions. + if (EndCOWMutationInst *ecm = getEndCOWMutation(upCast)) + return ecm; + } else if (auto *ecm = dyn_cast(use->getUser())) { + return ecm; + } + } + return nullptr; +} + /// Try to convert an object allocation into a statically initialized object. /// /// In general this works for any class, but in practice it will only kick in -/// for array buffer objects. The use cases are array literals in a function. +/// for copy-on-write buffers, like array buffer objects. +/// The use cases are array literals in a function. /// For example: /// func getarray() -> [Int] { /// return [1, 2, 3] @@ -314,6 +329,12 @@ bool ObjectOutliner::optimizeObjectAllocation(AllocRefInst *ARI) { if (ARI->isObjC()) return false; + // Find the end_cow_mutation. Only for such COW buffer objects we do the + // transformation. + EndCOWMutationInst *endCOW = getEndCOWMutation(ARI); + if (!endCOW || endCOW->doKeepUnique()) + return false; + // Check how many tail allocated elements are on the object. ArrayRef TailCounts = ARI->getTailAllocatedCounts(); SILType TailType; @@ -363,12 +384,13 @@ bool ObjectOutliner::optimizeObjectAllocation(AllocRefInst *ARI) { } TailStores.resize(NumStores); - ApplyInst *FindStringCall = nullptr; // Get the initialization stores of the object's properties and tail // allocated elements. Also check if there are any "bad" uses of the object. - if (!getObjectInitVals(ARI, MemberStores, TailStores, NumTailTupleElems, &FindStringCall)) + if (!getObjectInitVals(ARI, MemberStores, TailStores, NumTailTupleElems, + endCOW)) { return false; + } // Is there a store for all the class properties? if (MemberStores.size() != Fields.size()) @@ -452,6 +474,11 @@ bool ObjectOutliner::optimizeObjectAllocation(AllocRefInst *ARI) { SILBuilder B(ARI); GlobalValueInst *GVI = B.createGlobalValue(ARI->getLoc(), Glob); B.createStrongRetain(ARI->getLoc(), GVI, B.getDefaultAtomicity()); + + ApplyInst *FindStringCall = findFindStringCall(endCOW); + endCOW->replaceAllUsesWith(endCOW->getOperand()); + ToRemove.push_back(endCOW); + llvm::SmallVector Worklist(ARI->use_begin(), ARI->use_end()); while (!Worklist.empty()) { auto *Use = Worklist.pop_back_val(); diff --git a/lib/SILOptimizer/Transforms/PruneVTables.cpp b/lib/SILOptimizer/Transforms/PruneVTables.cpp new file mode 100644 index 0000000000000..cbd9ce1288736 --- /dev/null +++ b/lib/SILOptimizer/Transforms/PruneVTables.cpp @@ -0,0 +1,72 @@ +//===--- PruneVTables.cpp - Prune unnecessary vtable entries --------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// +// +// Mark sil_vtable entries as [nonoverridden] when possible, so that we know +// at IRGen time they can be elided from runtime vtables. +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "prune-vtables" + +#include "swift/SILOptimizer/PassManager/Transforms.h" +#include "swift/SILOptimizer/Utils/InstOptUtils.h" + +using namespace swift; + +namespace { +class PruneVTables : public SILModuleTransform { + void runOnVTable(SILModule *M, + SILVTable *vtable) { + for (auto &entry : vtable->getMutableEntries()) { + // We don't need to worry about entries that are inherited, overridden, + // or have already been found to have no overrides. + if (entry.TheKind != SILVTable::Entry::Normal) { + continue; + } + + // The destructor entry must remain. + if (entry.Method.kind == SILDeclRef::Kind::Deallocator) { + continue; + } + + auto methodDecl = entry.Method.getAbstractFunctionDecl(); + if (!methodDecl) + continue; + + // Is the method declared final? + if (!methodDecl->isFinal()) { + // Are callees of this entry statically knowable? + if (!calleesAreStaticallyKnowable(*M, entry.Method)) + continue; + + // Does the method have any overrides in this module? + if (methodDecl->isOverridden()) + continue; + } + + entry.TheKind = SILVTable::Entry::NormalNonOverridden; + } + } + + void run() override { + SILModule *M = getModule(); + + for (auto &vtable : M->getVTables()) { + runOnVTable(M, vtable); + } + } +}; +} + +SILTransform *swift::createPruneVTables() { + return new PruneVTables(); +} diff --git a/lib/SILOptimizer/Transforms/SemanticARCOpts.cpp b/lib/SILOptimizer/Transforms/SemanticARCOpts.cpp index 8b22cc85b36af..f1fb26fe516a7 100644 --- a/lib/SILOptimizer/Transforms/SemanticARCOpts.cpp +++ b/lib/SILOptimizer/Transforms/SemanticARCOpts.cpp @@ -55,6 +55,7 @@ class OwnershipPhiOperand { enum Kind { Branch, Struct, + Tuple, }; private: @@ -67,6 +68,7 @@ class OwnershipPhiOperand { switch (op->getUser()->getKind()) { case SILInstructionKind::BranchInst: case SILInstructionKind::StructInst: + case SILInstructionKind::TupleInst: return {{const_cast(op)}}; default: return None; @@ -79,6 +81,8 @@ class OwnershipPhiOperand { return Kind::Branch; case SILInstructionKind::StructInst: return Kind::Struct; + case SILInstructionKind::TupleInst: + return Kind::Tuple; default: llvm_unreachable("unhandled case?!"); } @@ -104,6 +108,7 @@ class OwnershipPhiOperand { switch (getKind()) { case Kind::Branch: return true; + case Kind::Tuple: case Kind::Struct: return false; } @@ -121,6 +126,8 @@ class OwnershipPhiOperand { switch (getKind()) { case Kind::Struct: return visitor(cast(getInst())); + case Kind::Tuple: + return visitor(cast(getInst())); case Kind::Branch: { auto *br = cast(getInst()); unsigned opNum = getOperandNumber(); @@ -589,6 +596,11 @@ static SILValue convertIntroducerToGuaranteed(OwnedValueIntroducer introducer) { si->setOwnershipKind(ValueOwnershipKind::Guaranteed); return si; } + case OwnedValueIntroducerKind::Tuple: { + auto *ti = cast(introducer.value); + ti->setOwnershipKind(ValueOwnershipKind::Guaranteed); + return ti; + } case OwnedValueIntroducerKind::Copy: case OwnedValueIntroducerKind::LoadCopy: case OwnedValueIntroducerKind::Apply: diff --git a/lib/SILOptimizer/UtilityPasses/SerializeSILPass.cpp b/lib/SILOptimizer/UtilityPasses/SerializeSILPass.cpp index 11604e211c9d8..1965a825175c8 100644 --- a/lib/SILOptimizer/UtilityPasses/SerializeSILPass.cpp +++ b/lib/SILOptimizer/UtilityPasses/SerializeSILPass.cpp @@ -427,7 +427,7 @@ class SerializeSILPass : public SILModuleTransform { } for (auto &VT : M.getVTables()) { - VT.setSerialized(IsNotSerialized); + VT->setSerialized(IsNotSerialized); } } diff --git a/lib/SILOptimizer/Utils/ConstExpr.cpp b/lib/SILOptimizer/Utils/ConstExpr.cpp index 60db9517dd647..6829541fe2ff6 100644 --- a/lib/SILOptimizer/Utils/ConstExpr.cpp +++ b/lib/SILOptimizer/Utils/ConstExpr.cpp @@ -47,6 +47,8 @@ enum class WellKnownFunction { AllocateUninitializedArray, // Array._endMutation EndArrayMutation, + // _finalizeUninitializedArray + FinalizeUninitializedArray, // Array.append(_:) ArrayAppendElement, // String.init() @@ -75,6 +77,8 @@ static llvm::Optional classifyFunction(SILFunction *fn) { return WellKnownFunction::AllocateUninitializedArray; if (fn->hasSemanticsAttr(semantics::ARRAY_END_MUTATION)) return WellKnownFunction::EndArrayMutation; + if (fn->hasSemanticsAttr(semantics::ARRAY_FINALIZE_INTRINSIC)) + return WellKnownFunction::FinalizeUninitializedArray; if (fn->hasSemanticsAttr(semantics::ARRAY_APPEND_ELEMENT)) return WellKnownFunction::ArrayAppendElement; if (fn->hasSemanticsAttr(semantics::STRING_INIT_EMPTY)) @@ -961,6 +965,21 @@ ConstExprFunctionState::computeWellKnownCallResult(ApplyInst *apply, // _endMutation is a no-op. return None; } + case WellKnownFunction::FinalizeUninitializedArray: { + // This function has the following signature in SIL: + // (Array) -> Array + assert(conventions.getNumParameters() == 1 && + conventions.getNumDirectSILResults() == 1 && + conventions.getNumIndirectSILResults() == 0 && + "unexpected _finalizeUninitializedArray() signature"); + + auto result = getConstantValue(apply->getOperand(1)); + if (!result.isConstant()) + return result; + // Semantically, it's an identity function. + setValue(apply, result); + return None; + } case WellKnownFunction::ArrayAppendElement: { // This function has the following signature in SIL: // (@in Element, @inout Array) -> () diff --git a/lib/SILOptimizer/Utils/Generics.cpp b/lib/SILOptimizer/Utils/Generics.cpp index fd0a3fa40a3cb..2080755e6d74e 100644 --- a/lib/SILOptimizer/Utils/Generics.cpp +++ b/lib/SILOptimizer/Utils/Generics.cpp @@ -1939,89 +1939,94 @@ static void prepareCallArguments(ApplySite AI, SILBuilder &Builder, /// Create a new apply based on an old one, but with a different /// function being applied. -static ApplySite replaceWithSpecializedCallee(ApplySite AI, - SILValue Callee, - const ReabstractionInfo &ReInfo) { - SILBuilderWithScope Builder(AI.getInstruction()); - SILLocation Loc = AI.getLoc(); - SmallVector Arguments; - SILValue StoreResultTo; +static ApplySite replaceWithSpecializedCallee(ApplySite applySite, + SILValue callee, + const ReabstractionInfo &reInfo) { + SILBuilderWithScope builder(applySite.getInstruction()); + SILLocation loc = applySite.getLoc(); + SmallVector arguments; + SILValue resultOut; - prepareCallArguments(AI, Builder, ReInfo, Arguments, StoreResultTo); + prepareCallArguments(applySite, builder, reInfo, arguments, resultOut); // Create a substituted callee type. - auto CanFnTy = Callee->getType().castTo(); - SubstitutionMap Subs; - if (ReInfo.getSpecializedType()->isPolymorphic()) { - Subs = ReInfo.getCallerParamSubstitutionMap(); - Subs = SubstitutionMap::get(CanFnTy->getSubstGenericSignature(), Subs); - } - - auto CalleeSubstFnTy = - CanFnTy->substGenericArgs(*Callee->getModule(), Subs, - ReInfo.getResilienceExpansion()); - auto CalleeSILSubstFnTy = SILType::getPrimitiveObjectType(CalleeSubstFnTy); - SILFunctionConventions substConv(CalleeSubstFnTy, Builder.getModule()); - - if (auto *TAI = dyn_cast(AI)) { - SILBasicBlock *ResultBB = TAI->getNormalBB(); - assert(ResultBB->getSinglePredecessorBlock() == TAI->getParent()); - auto *NewTAI = Builder.createTryApply(Loc, Callee, Subs, Arguments, - ResultBB, TAI->getErrorBB()); - if (StoreResultTo) { + auto canFnTy = callee->getType().castTo(); + SubstitutionMap subs; + if (reInfo.getSpecializedType()->isPolymorphic()) { + subs = reInfo.getCallerParamSubstitutionMap(); + subs = SubstitutionMap::get(canFnTy->getSubstGenericSignature(), subs); + } + + auto calleeSubstFnTy = canFnTy->substGenericArgs( + *callee->getModule(), subs, reInfo.getResilienceExpansion()); + auto calleeSILSubstFnTy = SILType::getPrimitiveObjectType(calleeSubstFnTy); + SILFunctionConventions substConv(calleeSubstFnTy, builder.getModule()); + + switch (applySite.getKind()) { + case ApplySiteKind::TryApplyInst: { + auto *tai = cast(applySite); + SILBasicBlock *resultBlock = tai->getNormalBB(); + assert(resultBlock->getSinglePredecessorBlock() == tai->getParent()); + auto *newTAI = builder.createTryApply(loc, callee, subs, arguments, + resultBlock, tai->getErrorBB()); + if (resultOut) { assert(substConv.useLoweredAddresses()); // The original normal result of the try_apply is an empty tuple. - assert(ResultBB->getNumArguments() == 1); - Builder.setInsertionPoint(ResultBB->begin()); - fixUsedVoidType(ResultBB->getArgument(0), Loc, Builder); + assert(resultBlock->getNumArguments() == 1); + builder.setInsertionPoint(resultBlock->begin()); + fixUsedVoidType(resultBlock->getArgument(0), loc, builder); - SILArgument *Arg = ResultBB->replacePhiArgument( - 0, StoreResultTo->getType().getObjectType(), - ValueOwnershipKind::Owned); + SILArgument *arg = resultBlock->replacePhiArgument( + 0, resultOut->getType().getObjectType(), ValueOwnershipKind::Owned); // Store the direct result to the original result address. - Builder.createStore(Loc, Arg, StoreResultTo, + builder.createStore(loc, arg, resultOut, StoreOwnershipQualifier::Unqualified); } - return NewTAI; + return newTAI; } - if (auto *A = dyn_cast(AI)) { - auto *NewAI = Builder.createApply(Loc, Callee, Subs, Arguments, - A->isNonThrowing()); - if (StoreResultTo) { + case ApplySiteKind::ApplyInst: { + auto *ai = cast(applySite); + auto *newAI = + builder.createApply(loc, callee, subs, arguments, ai->isNonThrowing()); + if (resultOut) { assert(substConv.useLoweredAddresses()); - if (!CalleeSILSubstFnTy.isNoReturnFunction( - Builder.getModule(), Builder.getTypeExpansionContext())) { + if (!calleeSILSubstFnTy.isNoReturnFunction( + builder.getModule(), builder.getTypeExpansionContext())) { // Store the direct result to the original result address. - fixUsedVoidType(A, Loc, Builder); - Builder.createStore(Loc, NewAI, StoreResultTo, + fixUsedVoidType(ai, loc, builder); + builder.createStore(loc, newAI, resultOut, StoreOwnershipQualifier::Unqualified); } else { - Builder.createUnreachable(Loc); + builder.createUnreachable(loc); // unreachable should be the terminator instruction. // So, split the current basic block right after the // inserted unreachable instruction. - Builder.getInsertionPoint()->getParent()->split( - Builder.getInsertionPoint()); + builder.getInsertionPoint()->getParent()->split( + builder.getInsertionPoint()); } } - A->replaceAllUsesWith(NewAI); - return NewAI; + ai->replaceAllUsesWith(newAI); + return newAI; } - if (auto *A = dyn_cast(AI)) { - assert(!StoreResultTo); - auto *NewAI = Builder.createBeginApply(Loc, Callee, Subs, Arguments, - A->isNonThrowing()); - A->replaceAllUsesPairwiseWith(NewAI); - return NewAI; + case ApplySiteKind::BeginApplyInst: { + auto *bai = cast(applySite); + assert(!resultOut); + auto *newBAI = builder.createBeginApply(loc, callee, subs, arguments, + bai->isNonThrowing()); + bai->replaceAllUsesPairwiseWith(newBAI); + return newBAI; } - if (auto *PAI = dyn_cast(AI)) { - auto *NewPAI = Builder.createPartialApply( - Loc, Callee, Subs, Arguments, - PAI->getType().getAs()->getCalleeConvention(), - PAI->isOnStack()); - PAI->replaceAllUsesWith(NewPAI); - return NewPAI; + case ApplySiteKind::PartialApplyInst: { + auto *pai = cast(applySite); + auto *newPAI = builder.createPartialApply( + loc, callee, subs, arguments, + pai->getType().getAs()->getCalleeConvention(), + pai->isOnStack()); + pai->replaceAllUsesWith(newPAI); + return newPAI; } + } + llvm_unreachable("unhandled kind of apply"); } diff --git a/lib/Sema/BuilderTransform.cpp b/lib/Sema/BuilderTransform.cpp index b7ae0510c49c6..64a49bb512871 100644 --- a/lib/Sema/BuilderTransform.cpp +++ b/lib/Sema/BuilderTransform.cpp @@ -269,26 +269,12 @@ class BuilderClosureVisitor return; } - // If we aren't generating constraints, there's nothing to do. - if (!cs) - return; - - /// Generate constraints for each pattern binding entry - for (unsigned index : range(patternBinding->getNumPatternEntries())) { - // Type check the pattern. - auto pattern = patternBinding->getPattern(index); - auto contextualPattern = ContextualPattern::forRawPattern(pattern, dc); - Type patternType = TypeChecker::typeCheckPattern(contextualPattern); - - // Generate constraints for the initialization. - auto target = SolutionApplicationTarget::forInitialization( - patternBinding->getInit(index), dc, patternType, pattern, - /*bindPatternVarsOneWay=*/true); + // If there is a constraint system, generate constraints for the pattern + // binding. + if (cs) { + SolutionApplicationTarget target(patternBinding); if (cs->generateConstraints(target, FreeTypeVariableBinding::Disallow)) - continue; - - // Keep track of this binding entry. - applied.patternBindingEntries.insert({{patternBinding, index}, target}); + hadError = true; } } @@ -1035,11 +1021,11 @@ class BuilderClosureRewriter for (unsigned index : range(patternBinding->getNumPatternEntries())) { // Find the solution application target for this. auto knownTarget = - builderTransform.patternBindingEntries.find({patternBinding, index}); - assert(knownTarget != builderTransform.patternBindingEntries.end()); + *solution.getConstraintSystem().getSolutionApplicationTarget( + {patternBinding, index}); // Rewrite the target. - auto resultTarget = rewriteTarget(knownTarget->second); + auto resultTarget = rewriteTarget(knownTarget); if (!resultTarget) continue; diff --git a/lib/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp index ec5fb98be762d..b7d81bf2caa5d 100644 --- a/lib/Sema/CSApply.cpp +++ b/lib/Sema/CSApply.cpp @@ -3492,20 +3492,23 @@ namespace { Expr *visitIsExpr(IsExpr *expr) { // Turn the subexpression into an rvalue. auto &ctx = cs.getASTContext(); - auto toType = simplifyType(cs.getType(expr->getCastTypeLoc())); auto sub = cs.coerceToRValue(expr->getSubExpr()); - expr->setSubExpr(sub); - // Set the type we checked against. - expr->getCastTypeLoc().setType(toType); - auto fromType = cs.getType(sub); + // Simplify and update the type we checked against. + auto *const castTypeRepr = expr->getCastTypeRepr(); + + const auto fromType = cs.getType(sub); + const auto toType = simplifyType(cs.getType(castTypeRepr)); + expr->setCastType(toType); + cs.setType(castTypeRepr, toType); + auto castContextKind = SuppressDiagnostics ? CheckedCastContextKind::None : CheckedCastContextKind::IsExpr; auto castKind = TypeChecker::typeCheckCheckedCast( fromType, toType, castContextKind, cs.DC, expr->getLoc(), sub, - expr->getCastTypeLoc().getSourceRange()); + castTypeRepr->getSourceRange()); switch (castKind) { case CheckedCastKind::Unresolved: @@ -3556,13 +3559,9 @@ namespace { castKind == CheckedCastKind::ArrayDowncast || castKind == CheckedCastKind::DictionaryDowncast || castKind == CheckedCastKind::SetDowncast) { - auto toOptType = OptionalType::get(toType); - ConditionalCheckedCastExpr *cast = new (ctx) ConditionalCheckedCastExpr( - sub, expr->getLoc(), SourceLoc(), expr->getCastTypeLoc()); - cs.setType(cast, toOptType); - cs.setType(cast->getCastTypeLoc(), toType); - if (expr->isImplicit()) - cast->setImplicit(); + auto *const cast = ConditionalCheckedCastExpr::createImplicit( + ctx, sub, castTypeRepr, toType); + cs.setType(cast, cast->getType()); // Type-check this conditional case. Expr *result = handleConditionalCheckedCastExpr(cast, true); @@ -3823,7 +3822,7 @@ namespace { } bool hasForcedOptionalResult(ExplicitCastExpr *expr) { - auto *TR = expr->getCastTypeLoc().getTypeRepr(); + const auto *const TR = expr->getCastTypeRepr(); if (TR && TR->getKind() == TypeReprKind::ImplicitlyUnwrappedOptional) { auto *locator = cs.getConstraintLocator( expr, ConstraintLocator::ImplicitlyUnwrappedDisjunctionChoice); @@ -3848,18 +3847,19 @@ namespace { } Expr *visitCoerceExpr(CoerceExpr *expr, Optional choice) { - // Simplify the type we're casting to. - auto toType = simplifyType(cs.getType(expr->getCastTypeLoc())); - expr->getCastTypeLoc().setType(toType); - - auto &ctx = cs.getASTContext(); + // Simplify and update the type we're coercing to. + assert(expr->getCastTypeRepr()); + const auto toType = simplifyType(cs.getType(expr->getCastTypeRepr())); + expr->setCastType(toType); + cs.setType(expr->getCastTypeRepr(), toType); // If this is a literal that got converted into constructor call // lets put proper source information in place. if (expr->isLiteralInit()) { auto *literalInit = expr->getSubExpr(); if (auto *call = dyn_cast(literalInit)) { - call->getFn()->forEachChildExpr([&](Expr *subExpr) -> Expr * { + forEachExprInConstraintSystem(call->getFn(), + [&](Expr *subExpr) -> Expr * { auto *TE = dyn_cast(subExpr); if (!TE) return subExpr; @@ -3871,7 +3871,8 @@ namespace { if (!type->isEqual(toType)) return subExpr; - return cs.cacheType(TypeExpr::createImplicitHack(expr->getLoc(), toType, ctx)); + return cs.cacheType(TypeExpr::createImplicitHack( + expr->getLoc(), toType, cs.getASTContext())); }); } @@ -3933,26 +3934,29 @@ namespace { // Rewrite ForcedCheckedCastExpr based on what the solver computed. Expr *visitForcedCheckedCastExpr(ForcedCheckedCastExpr *expr) { - // Simplify the type we're casting to. - auto toType = simplifyType(cs.getType(expr->getCastTypeLoc())); - if (hasForcedOptionalResult(expr)) - toType = toType->getOptionalObjectType(); - - expr->getCastTypeLoc().setType(toType); - // The subexpression is always an rvalue. auto &ctx = cs.getASTContext(); auto sub = cs.coerceToRValue(expr->getSubExpr()); expr->setSubExpr(sub); + // Simplify and update the type we're casting to. + auto *const castTypeRepr = expr->getCastTypeRepr(); + + const auto fromType = cs.getType(sub); + auto toType = simplifyType(cs.getType(castTypeRepr)); + if (hasForcedOptionalResult(expr)) + toType = toType->getOptionalObjectType(); + + expr->setCastType(toType); + cs.setType(castTypeRepr, toType); + auto castContextKind = SuppressDiagnostics ? CheckedCastContextKind::None : CheckedCastContextKind::ForcedCast; - auto fromType = cs.getType(sub); - auto castKind = TypeChecker::typeCheckCheckedCast( + const auto castKind = TypeChecker::typeCheckCheckedCast( fromType, toType, castContextKind, cs.DC, expr->getLoc(), sub, - expr->getCastTypeLoc().getSourceRange()); + castTypeRepr->getSourceRange()); switch (castKind) { /// Invalid cast. case CheckedCastKind::Unresolved: @@ -3961,8 +3965,8 @@ namespace { case CheckedCastKind::BridgingCoercion: { if (cs.getType(sub)->isEqual(toType)) { ctx.Diags.diagnose(expr->getLoc(), diag::forced_downcast_noop, toType) - .fixItRemove(SourceRange( - expr->getLoc(), expr->getCastTypeLoc().getSourceRange().End)); + .fixItRemove(SourceRange(expr->getLoc(), + castTypeRepr->getSourceRange().End)); } else { ctx.Diags @@ -4007,25 +4011,28 @@ namespace { Expr *handleConditionalCheckedCastExpr(ConditionalCheckedCastExpr *expr, bool isInsideIsExpr = false) { - // Simplify the type we're casting to. - auto toType = simplifyType(cs.getType(expr->getCastTypeLoc())); - expr->getCastTypeLoc().setType(toType); - // The subexpression is always an rvalue. auto &ctx = cs.getASTContext(); auto sub = cs.coerceToRValue(expr->getSubExpr()); expr->setSubExpr(sub); + // Simplify and update the type we're casting to. + auto *const castTypeRepr = expr->getCastTypeRepr(); + + const auto fromType = cs.getType(sub); + const auto toType = simplifyType(cs.getType(castTypeRepr)); + expr->setCastType(toType); + cs.setType(castTypeRepr, toType); + bool isSubExprLiteral = isa(sub); auto castContextKind = (SuppressDiagnostics || isInsideIsExpr || isSubExprLiteral) ? CheckedCastContextKind::None : CheckedCastContextKind::ConditionalCast; - auto fromType = cs.getType(sub); auto castKind = TypeChecker::typeCheckCheckedCast( fromType, toType, castContextKind, cs.DC, expr->getLoc(), sub, - expr->getCastTypeLoc().getSourceRange()); + castTypeRepr->getSourceRange()); switch (castKind) { // Invalid cast. case CheckedCastKind::Unresolved: @@ -4047,7 +4054,7 @@ namespace { .diagnose(expr->getLoc(), diag::downcast_to_unrelated, fromType, toType) .highlight(sub->getSourceRange()) - .highlight(expr->getCastTypeLoc().getSourceRange()); + .highlight(castTypeRepr->getSourceRange()); } } expr->setCastKind(CheckedCastKind::ValueCast); @@ -5788,7 +5795,7 @@ static bool applyTypeToClosureExpr(ConstraintSystem &cs, cs.setType(CE, toType); // If this closure isn't type-checked in its enclosing expression, write - // theg type into the ClosureExpr directly here, since the visitor won't. + // the type into the ClosureExpr directly here, since the visitor won't. if (!shouldTypeCheckInEnclosingExpression(CE)) CE->setType(toType); @@ -8102,6 +8109,25 @@ ExprWalker::rewriteTarget(SolutionApplicationTarget target) { solution.setExprTypes(guardExpr); } + return target; + } else if (auto patternBinding = target.getAsPatternBinding()) { + ConstraintSystem &cs = solution.getConstraintSystem(); + for (unsigned index : range(patternBinding->getNumPatternEntries())) { + // Find the solution application target for this. + auto knownTarget = *cs.getSolutionApplicationTarget( + {patternBinding, index}); + + // Rewrite the target. + auto resultTarget = rewriteTarget(knownTarget); + if (!resultTarget) + return None; + + patternBinding->setPattern( + index, resultTarget->getInitializationPattern(), + resultTarget->getDeclContext()); + patternBinding->setInit(index, resultTarget->getAsExpr()); + } + return target; } else { auto fn = *target.getAsFunction(); @@ -8379,6 +8405,10 @@ SolutionApplicationTarget SolutionApplicationTarget::walk(ASTWalker &walker) { } return *this; + + case Kind::patternBinding: + return *this; } + llvm_unreachable("invalid target kind"); } diff --git a/lib/Sema/CSBindings.cpp b/lib/Sema/CSBindings.cpp index 76f5586f2d147..a05f865768a32 100644 --- a/lib/Sema/CSBindings.cpp +++ b/lib/Sema/CSBindings.cpp @@ -710,7 +710,8 @@ ConstraintSystem::getPotentialBindings(TypeVariableType *typeVar) const { } break; - case ConstraintKind::OneWayEqual: { + case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: { // Don't produce any bindings if this type variable is on the left-hand // side of a one-way binding. auto firstType = constraint->getFirstType(); diff --git a/lib/Sema/CSClosure.cpp b/lib/Sema/CSClosure.cpp index 7aafe866c370b..0fd1b69529a54 100644 --- a/lib/Sema/CSClosure.cpp +++ b/lib/Sema/CSClosure.cpp @@ -84,6 +84,7 @@ class ClosureConstraintGenerator if (!expr) return; + // FIXME: Use SolutionApplicationTarget? expr = cs.generateConstraints(expr, closure, /*isInputExpression=*/false); if (!expr) { hadError = true; @@ -330,8 +331,6 @@ SolutionApplicationToFunctionResult ConstraintSystem::applySolution( fn.setBody(newBody, /*isSingleExpression=*/false); if (closure) { - closure->setAppliedFunctionBuilder(); - closure->setTypeCheckedInEnclosingContext(); solution.setExprTypes(closure); } @@ -347,7 +346,6 @@ SolutionApplicationToFunctionResult ConstraintSystem::applySolution( solution, closure, closureFnType->getResult(), rewriteTarget); application.visit(fn.getBody()); - closure->setTypeCheckedInEnclosingContext(); return SolutionApplicationToFunctionResult::Success; } diff --git a/lib/Sema/CSDiagnostics.cpp b/lib/Sema/CSDiagnostics.cpp index 83357e9d8efcf..f83ffed73fc32 100644 --- a/lib/Sema/CSDiagnostics.cpp +++ b/lib/Sema/CSDiagnostics.cpp @@ -436,7 +436,7 @@ bool MissingConformanceFailure::diagnoseAsError() { } bool hasFix = false; - caseExpr->forEachChildExpr([&](Expr *expr) -> Expr * { + forEachExprInConstraintSystem(caseExpr, [&](Expr *expr) -> Expr * { hasFix |= anchors.count(expr); return hasFix ? nullptr : expr; }); @@ -2344,8 +2344,8 @@ bool ContextualFailure::diagnoseCoercionToUnrelatedType() const { auto anchor = getAnchor(); if (auto *coerceExpr = getAsExpr(anchor)) { - auto fromType = getType(coerceExpr->getSubExpr()); - auto toType = getType(&coerceExpr->getCastTypeLoc()); + const auto fromType = getType(coerceExpr->getSubExpr()); + const auto toType = getType(coerceExpr->getCastTypeRepr()); auto diagnostic = getDiagnosticFor(CTP_CoerceOperand, toType); @@ -3141,7 +3141,7 @@ bool MissingMemberFailure::diagnoseAsError() { bool hasUnresolvedPattern = false; if (auto *E = getAsExpr(anchor)) { - const_cast(E)->forEachChildExpr([&](Expr *expr) { + forEachExprInConstraintSystem(const_cast(E), [&](Expr *expr) { hasUnresolvedPattern |= isa(expr); return hasUnresolvedPattern ? nullptr : expr; }); @@ -3335,6 +3335,30 @@ bool MissingMemberFailure::diagnoseInLiteralCollectionContext() const { return false; } +bool UnintendedExtraGenericParamMemberFailure::diagnoseAsError() { + MissingMemberFailure::diagnoseAsError(); + + auto baseType = resolveType(getBaseType())->getWithoutSpecifierType(); + auto archetype = baseType->getMetatypeInstanceType()->castTo(); + auto genericTy = + archetype->mapTypeOutOfContext()->castTo(); + SourceLoc loc = genericTy->getDecl()->getSourceRange().End; + StringRef replacement; + + if (archetype->getConformsTo().size()) { + loc = loc.getAdvancedLoc( + archetype->getConformsTo().back()->getName().getLength()); + replacement = " &"; + } else { + loc = loc.getAdvancedLoc(archetype->getName().getLength()); + replacement = ":"; + } + emitDiagnosticAt(loc, diag::did_you_mean_generic_param_as_conformance, + ParamName, archetype) + .fixItReplaceChars(loc, loc.getAdvancedLoc(1), replacement); + return true; +} + bool InvalidMemberRefOnExistential::diagnoseAsError() { auto anchor = getRawAnchor(); @@ -4979,7 +5003,7 @@ bool MissingGenericArgumentsFailure::diagnoseParameter( } if (auto *CE = getAsExpr(getRawAnchor())) { - auto castTo = getType(&CE->getCastTypeLoc()); + const auto castTo = getType(CE->getCastTypeRepr()); auto *NTD = castTo->getAnyNominal(); emitDiagnosticAt(loc, diag::unbound_generic_parameter_cast, GP, NTD ? NTD->getDeclaredType() : castTo); @@ -5077,15 +5101,17 @@ bool MissingGenericArgumentsFailure::findArgumentLocations( llvm::function_ref callback) { using Callback = llvm::function_ref; - auto anchor = getRawAnchor(); - - TypeLoc typeLoc; - if (auto *TE = getAsExpr(anchor)) - typeLoc = TE->getTypeRepr(); - else if (auto *ECE = getAsExpr(anchor)) - typeLoc = ECE->getCastTypeLoc(); + auto *const typeRepr = [this]() -> TypeRepr * { + const auto anchor = getRawAnchor(); + if (const auto *TE = getAsExpr(anchor)) + return TE->getTypeRepr(); + else if (const auto *ECE = getAsExpr(anchor)) + return ECE->getCastTypeRepr(); + else + return nullptr; + }(); - if (!typeLoc.hasLocation()) + if (!typeRepr) return false; struct AssociateMissingParams : public ASTWalker { @@ -5140,7 +5166,7 @@ bool MissingGenericArgumentsFailure::findArgumentLocations( } associator(Parameters, callback); - typeLoc.getTypeRepr()->walk(associator); + typeRepr->walk(associator); return associator.allParamsAssigned(); } diff --git a/lib/Sema/CSDiagnostics.h b/lib/Sema/CSDiagnostics.h index be251b6da89e6..43306c0f08137 100644 --- a/lib/Sema/CSDiagnostics.h +++ b/lib/Sema/CSDiagnostics.h @@ -1039,7 +1039,7 @@ class InvalidMemberRefFailure : public FailureDiagnostic { /// let _: Int = s.foo(1, 2) // expected type is `(Int, Int) -> Int` /// } /// ``` -class MissingMemberFailure final : public InvalidMemberRefFailure { +class MissingMemberFailure : public InvalidMemberRefFailure { public: MissingMemberFailure(const Solution &solution, Type baseType, DeclNameRef memberName, ConstraintLocator *locator) @@ -1068,6 +1068,22 @@ class MissingMemberFailure final : public InvalidMemberRefFailure { DeclNameRef memberName); }; +class UnintendedExtraGenericParamMemberFailure final + : public MissingMemberFailure { + Identifier ParamName; + +public: + UnintendedExtraGenericParamMemberFailure(const Solution &solution, + Type baseType, + DeclNameRef memberName, + Identifier paramName, + ConstraintLocator *locator) + : MissingMemberFailure(solution, baseType, memberName, locator), + ParamName(paramName) {} + + bool diagnoseAsError() override; +}; + /// Diagnose cases where a member only accessible on generic constraints /// requiring conformance to a protocol is used on a value of the /// existential protocol type e.g. diff --git a/lib/Sema/CSFix.cpp b/lib/Sema/CSFix.cpp index ab31071816944..d638fb8c9e10d 100644 --- a/lib/Sema/CSFix.cpp +++ b/lib/Sema/CSFix.cpp @@ -147,12 +147,9 @@ CoerceToCheckedCast *CoerceToCheckedCast::attempt(ConstraintSystem &cs, if (!coerceExpr) return nullptr; - auto subExpr = coerceExpr->getSubExpr(); - auto castKind = - TypeChecker::typeCheckCheckedCast(fromType, toType, - CheckedCastContextKind::None, cs.DC, - coerceExpr->getLoc(), subExpr, - coerceExpr->getCastTypeLoc().getSourceRange()); + const auto castKind = TypeChecker::typeCheckCheckedCast( + fromType, toType, CheckedCastContextKind::None, cs.DC, + SourceLoc(), coerceExpr->getSubExpr(), SourceRange()); // Invalid cast. if (castKind == CheckedCastKind::Unresolved) @@ -531,6 +528,23 @@ DefineMemberBasedOnUse::create(ConstraintSystem &cs, Type baseType, DefineMemberBasedOnUse(cs, baseType, member, alreadyDiagnosed, locator); } +bool DefineMemberBasedOnUnintendedGenericParam::diagnose( + const Solution &solution, bool asNote) const { + UnintendedExtraGenericParamMemberFailure failure(solution, BaseType, Name, + ParamName, getLocator()); + return failure.diagnose(asNote); +} + +DefineMemberBasedOnUnintendedGenericParam * +DefineMemberBasedOnUnintendedGenericParam::create(ConstraintSystem &cs, + Type baseType, + DeclNameRef member, + Identifier paramName, + ConstraintLocator *locator) { + return new (cs.getAllocator()) DefineMemberBasedOnUnintendedGenericParam( + cs, baseType, member, paramName, locator); +} + AllowMemberRefOnExistential * AllowMemberRefOnExistential::create(ConstraintSystem &cs, Type baseType, ValueDecl *member, DeclNameRef memberName, diff --git a/lib/Sema/CSFix.h b/lib/Sema/CSFix.h index 093e8b96dea9d..191bfd7170dcf 100644 --- a/lib/Sema/CSFix.h +++ b/lib/Sema/CSFix.h @@ -884,6 +884,33 @@ class DefineMemberBasedOnUse final : public ConstraintFix { } }; +class DefineMemberBasedOnUnintendedGenericParam final : public ConstraintFix { + Type BaseType; + DeclNameRef Name; + Identifier ParamName; + + DefineMemberBasedOnUnintendedGenericParam(ConstraintSystem &cs, Type baseType, + DeclNameRef member, + Identifier paramName, + ConstraintLocator *locator) + : ConstraintFix(cs, FixKind::DefineMemberBasedOnUse, locator), + BaseType(baseType), Name(member), ParamName(paramName) {} + +public: + std::string getName() const override { + llvm::SmallVector scratch; + auto memberName = Name.getString(scratch); + return "allow access to invalid member '" + memberName.str() + + "' on archetype presumed intended to conform to protocol"; + } + + bool diagnose(const Solution &solution, bool asNote = false) const override; + + static DefineMemberBasedOnUnintendedGenericParam * + create(ConstraintSystem &cs, Type baseType, DeclNameRef member, + Identifier paramName, ConstraintLocator *locator); +}; + class AllowInvalidMemberRef : public ConstraintFix { Type BaseType; ValueDecl *Member; diff --git a/lib/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index 86cacf5c8afbf..15b1d5ee7a85a 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -1176,9 +1176,24 @@ namespace { virtual Type visitCodeCompletionExpr(CodeCompletionExpr *E) { CS.Options |= ConstraintSystemFlags::SuppressDiagnostics; - return CS.createTypeVariable(CS.getConstraintLocator(E), - TVO_CanBindToLValue | - TVO_CanBindToNoEscape); + auto locator = CS.getConstraintLocator(E); + auto ty = CS.createTypeVariable(locator, + TVO_CanBindToLValue | + TVO_CanBindToNoEscape); + + // Defaults to the type of the base expression if we have a base + // expression. + // FIXME: This is just to keep the old behavior where `foo(base.)` + // the argument is type checked to the type of the 'base'. Ideally, code + // completion expression should be defauled to 'UnresolvedType' + // regardless of the existence of the base expression. But the constraint + // system is simply not ready for that. + if (auto base = E->getBase()) { + CS.addConstraint(ConstraintKind::Defaultable, ty, CS.getType(base), + locator); + } + + return ty; } Type visitNilLiteralExpr(NilLiteralExpr *expr) { @@ -1478,17 +1493,16 @@ namespace { diag::super_with_no_base_class); } - Type resolveTypeReferenceInExpression(TypeRepr *repr) { - TypeLoc loc(repr); - return resolveTypeReferenceInExpression(loc); - } - - Type resolveTypeReferenceInExpression(TypeLoc &loc) { - TypeResolutionOptions options(TypeResolverContext::InExpression); + Type resolveTypeReferenceInExpression(TypeRepr *repr, + TypeResolverContext resCtx) { + TypeResolutionOptions options(resCtx); options |= TypeResolutionFlags::AllowUnboundGenerics; - bool hadError = TypeChecker::validateType( - loc, TypeResolution::forContextual(CS.DC, options)); - return hadError ? Type() : loc.getType(); + auto result = TypeResolution::forContextual(CS.DC, options) + .resolveType(repr); + if (!result || result->hasError()) { + return Type(); + } + return result; } Type visitTypeExpr(TypeExpr *E) { @@ -1500,7 +1514,8 @@ namespace { } else { auto *repr = E->getTypeRepr(); assert(repr && "Explicit node has no type repr!"); - type = resolveTypeReferenceInExpression(repr); + type = resolveTypeReferenceInExpression( + repr, TypeResolverContext::InExpression); } if (!type || type->hasError()) return Type(); @@ -2221,7 +2236,9 @@ namespace { return declaredTy; } - return resolveTypeReferenceInExpression(closure->getExplicitResultTypeRepr()); + return resolveTypeReferenceInExpression( + closure->getExplicitResultTypeRepr(), + TypeResolverContext::InExpression); }; Type resultTy; @@ -2518,8 +2535,8 @@ namespace { case PatternKind::Is: { auto isPattern = cast(pattern); - Type castType = - resolveTypeReferenceInExpression(isPattern->getCastTypeLoc()); + Type castType = resolveTypeReferenceInExpression( + isPattern->getCastTypeRepr(), TypeResolverContext::InExpression); if (!castType) return Type(); @@ -2576,10 +2593,16 @@ namespace { CS.getConstraintLocator(locator), TVO_CanBindToLValue | TVO_CanBindToNoEscape); FunctionRefKind functionRefKind = FunctionRefKind::Compound; - if (!enumPattern->getParentType().isNull()) { + if (enumPattern->getParentType() || enumPattern->getParentTypeRepr()) { // Resolve the parent type. - Type parentType = - resolveTypeReferenceInExpression(enumPattern->getParentType()); + Type parentType = [&]() -> Type { + if (auto preTy = enumPattern->getParentType()) { + return preTy; + } + return resolveTypeReferenceInExpression( + enumPattern->getParentTypeRepr(), + TypeResolverContext::InExpression); + }(); if (!parentType) return Type(); @@ -2744,10 +2767,10 @@ namespace { // of is-patterns applied to an irrefutable pattern. pattern = pattern->getSemanticsProvidingPattern(); while (auto isp = dyn_cast(pattern)) { - if (TypeChecker::validateType( - isp->getCastTypeLoc(), - TypeResolution::forContextual( - CS.DC, TypeResolverContext::InExpression))) { + Type castType = TypeResolution::forContextual( + CS.DC, TypeResolverContext::InExpression) + .resolveType(isp->getCastTypeRepr()); + if (!castType) { return false; } @@ -3068,18 +3091,17 @@ namespace { if (!fromExpr) // Either wasn't constructed correctly or wasn't folded. return nullptr; + auto *const repr = expr->getCastTypeRepr(); // Validate the resulting type. - TypeResolutionOptions options(TypeResolverContext::ExplicitCastExpr); - options |= TypeResolutionFlags::AllowUnboundGenerics; - if (TypeChecker::validateType( - expr->getCastTypeLoc(), - TypeResolution::forContextual(CS.DC, options))) + const auto type = resolveTypeReferenceInExpression( + repr, TypeResolverContext::ExplicitCastExpr); + if (!type) return nullptr; // Open the type we're casting to. - auto toType = CS.openUnboundGenericType(expr->getCastTypeLoc().getType(), - CS.getConstraintLocator(expr)); - CS.setType(expr->getCastTypeLoc(), toType); + const auto toType = + CS.openUnboundGenericType(type, CS.getConstraintLocator(expr)); + if (repr) CS.setType(repr, toType); auto fromType = CS.getType(fromExpr); auto locator = CS.getConstraintLocator(expr); @@ -3089,8 +3111,7 @@ namespace { // If the result type was declared IUO, add a disjunction for // bindings for the result of the coercion. - auto *TR = expr->getCastTypeLoc().getTypeRepr(); - if (TR && TR->getKind() == TypeReprKind::ImplicitlyUnwrappedOptional) + if (repr && repr->getKind() == TypeReprKind::ImplicitlyUnwrappedOptional) return createTypeVariableAndDisjunctionForIUOCoercion(toType, locator); return toType; @@ -3098,17 +3119,16 @@ namespace { Type visitCoerceExpr(CoerceExpr *expr) { // Validate the resulting type. - TypeResolutionOptions options(TypeResolverContext::ExplicitCastExpr); - options |= TypeResolutionFlags::AllowUnboundGenerics; - if (TypeChecker::validateType( - expr->getCastTypeLoc(), - TypeResolution::forContextual(CS.DC, options))) + auto *const repr = expr->getCastTypeRepr(); + const auto type = resolveTypeReferenceInExpression( + repr, TypeResolverContext::ExplicitCastExpr); + if (!type) return nullptr; // Open the type we're casting to. - auto toType = CS.openUnboundGenericType(expr->getCastTypeLoc().getType(), - CS.getConstraintLocator(expr)); - CS.setType(expr->getCastTypeLoc(), toType); + const auto toType = + CS.openUnboundGenericType(type, CS.getConstraintLocator(expr)); + if (repr) CS.setType(repr, toType); auto fromType = CS.getType(expr->getSubExpr()); auto locator = CS.getConstraintLocator(expr); @@ -3120,8 +3140,7 @@ namespace { // If the result type was declared IUO, add a disjunction for // bindings for the result of the coercion. - auto *TR = expr->getCastTypeLoc().getTypeRepr(); - if (TR && TR->getKind() == TypeReprKind::ImplicitlyUnwrappedOptional) + if (repr && repr->getKind() == TypeReprKind::ImplicitlyUnwrappedOptional) return createTypeVariableAndDisjunctionForIUOCoercion(toType, locator); return toType; @@ -3133,17 +3152,16 @@ namespace { return nullptr; // Validate the resulting type. - TypeResolutionOptions options(TypeResolverContext::ExplicitCastExpr); - options |= TypeResolutionFlags::AllowUnboundGenerics; - if (TypeChecker::validateType( - expr->getCastTypeLoc(), - TypeResolution::forContextual(CS.DC, options))) + auto *const repr = expr->getCastTypeRepr(); + const auto type = resolveTypeReferenceInExpression( + repr, TypeResolverContext::ExplicitCastExpr); + if (!type) return nullptr; // Open the type we're casting to. - auto toType = CS.openUnboundGenericType(expr->getCastTypeLoc().getType(), - CS.getConstraintLocator(expr)); - CS.setType(expr->getCastTypeLoc(), toType); + const auto toType = + CS.openUnboundGenericType(type, CS.getConstraintLocator(expr)); + if (repr) CS.setType(repr, toType); auto fromType = CS.getType(fromExpr); auto locator = CS.getConstraintLocator(expr); @@ -3152,8 +3170,7 @@ namespace { // If the result type was declared IUO, add a disjunction for // bindings for the result of the coercion. - auto *TR = expr->getCastTypeLoc().getTypeRepr(); - if (TR && TR->getKind() == TypeReprKind::ImplicitlyUnwrappedOptional) + if (repr && repr->getKind() == TypeReprKind::ImplicitlyUnwrappedOptional) return createTypeVariableAndDisjunctionForIUOCoercion( OptionalType::get(toType), locator); @@ -3163,18 +3180,17 @@ namespace { Type visitIsExpr(IsExpr *expr) { // Validate the type. auto &ctx = CS.getASTContext(); - TypeResolutionOptions options(TypeResolverContext::ExplicitCastExpr); - options |= TypeResolutionFlags::AllowUnboundGenerics; - if (TypeChecker::validateType( - expr->getCastTypeLoc(), - TypeResolution::forContextual(CS.DC, options))) + const auto type = resolveTypeReferenceInExpression( + expr->getCastTypeRepr(), + TypeResolverContext::ExplicitCastExpr); + if (!type) return nullptr; // Open up the type we're checking. // FIXME: Locator for the cast type? - auto toType = CS.openUnboundGenericType(expr->getCastTypeLoc().getType(), - CS.getConstraintLocator(expr)); - CS.setType(expr->getCastTypeLoc(), toType); + const auto toType = + CS.openUnboundGenericType(type, CS.getConstraintLocator(expr)); + CS.setType(expr->getCastTypeRepr(), toType); // Add a checked cast constraint. auto fromType = CS.getType(expr->getSubExpr()); @@ -3378,7 +3394,8 @@ namespace { if (auto *placeholderRepr = E->getPlaceholderTypeRepr()) { // Just resolve the referenced type. // FIXME: The type reference needs to be opened into context. - return resolveTypeReferenceInExpression(placeholderRepr); + return resolveTypeReferenceInExpression( + placeholderRepr, TypeResolverContext::InExpression); } auto locator = CS.getConstraintLocator(E); @@ -3448,7 +3465,8 @@ namespace { // If a root type was explicitly given, then resolve it now. if (auto rootRepr = E->getRootType()) { - auto rootObjectTy = resolveTypeReferenceInExpression(rootRepr); + auto rootObjectTy = resolveTypeReferenceInExpression( + rootRepr, TypeResolverContext::InExpression); if (!rootObjectTy || rootObjectTy->hasError()) return Type(); rootObjectTy = CS.openUnboundGenericType(rootObjectTy, locator); @@ -3892,6 +3910,13 @@ namespace { } } + // If this is a closure, only walk into its children if they + // are type-checked in the context of the enclosing expression. + if (auto closure = dyn_cast(expr)) { + if (!shouldTypeCheckInEnclosingExpression(closure)) + return { false, expr }; + } + // Now, we're ready to walk into sub expressions. return {true, expr}; } @@ -4031,12 +4056,6 @@ namespace { /// Ignore declarations. bool walkToDeclPre(Decl *decl) override { return false; } - - // Don't walk into statements. This handles the BraceStmt in - // non-single-expr closures, so we don't walk into their body. - std::pair walkToStmtPre(Stmt *S) override { - return { false, S }; - } }; class ConstraintWalker : public ASTWalker { @@ -4427,7 +4446,48 @@ bool ConstraintSystem::generateConstraints( return false; } - llvm_unreachable("BOOM"); + switch (target.kind) { + case SolutionApplicationTarget::Kind::expression: + llvm_unreachable("Handled above"); + + case SolutionApplicationTarget::Kind::caseLabelItem: + case SolutionApplicationTarget::Kind::function: + case SolutionApplicationTarget::Kind::stmtCondition: + llvm_unreachable("Handled separately"); + + case SolutionApplicationTarget::Kind::patternBinding: { + auto patternBinding = target.getAsPatternBinding(); + auto dc = target.getDeclContext(); + bool hadError = false; + + /// Generate constraints for each pattern binding entry + for (unsigned index : range(patternBinding->getNumPatternEntries())) { + // Type check the pattern. + auto pattern = patternBinding->getPattern(index); + auto contextualPattern = ContextualPattern::forRawPattern(pattern, dc); + Type patternType = TypeChecker::typeCheckPattern(contextualPattern); + + auto init = patternBinding->getInit(index); + if (!init) { + llvm_unreachable("Unsupported pattern binding entry"); + } + + // Generate constraints for the initialization. + auto target = SolutionApplicationTarget::forInitialization( + init, dc, patternType, pattern, + /*bindPatternVarsOneWay=*/true); + if (generateConstraints(target, FreeTypeVariableBinding::Disallow)) { + hadError = true; + continue; + } + + // Keep track of this binding entry. + setSolutionApplicationTarget({patternBinding, index}, target); + } + + return hadError; + } + } } Expr *ConstraintSystem::generateConstraints( diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 85aecf8352a9d..37e2639ccf9a3 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -15,13 +15,14 @@ // //===----------------------------------------------------------------------===// -#include "CSFix.h" #include "CSDiagnostics.h" +#include "CSFix.h" #include "ConstraintSystem.h" #include "swift/AST/ExistentialLayout.h" #include "swift/AST/GenericEnvironment.h" #include "swift/AST/GenericSignature.h" #include "swift/AST/Initializer.h" +#include "swift/AST/NameLookupRequests.h" #include "swift/AST/ParameterList.h" #include "swift/AST/PropertyWrappers.h" #include "swift/AST/ProtocolConformance.h" @@ -1322,6 +1323,7 @@ ConstraintSystem::matchTupleTypes(TupleType *tuple1, TupleType *tuple2, case ConstraintKind::FunctionInput: case ConstraintKind::FunctionResult: case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: case ConstraintKind::DefaultClosureType: llvm_unreachable("Not a conversion"); } @@ -1387,6 +1389,7 @@ static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1, case ConstraintKind::FunctionInput: case ConstraintKind::FunctionResult: case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: case ConstraintKind::DefaultClosureType: return false; } @@ -1548,7 +1551,7 @@ static bool fixMissingArguments(ConstraintSystem &cs, ASTNode anchor, // Something like `foo { x in }` or `foo { $0 }` if (auto *closure = getAsExpr(anchor)) { - closure->forEachChildExpr([&](Expr *expr) -> Expr * { + forEachExprInConstraintSystem(closure, [&](Expr *expr) -> Expr * { if (auto *UDE = dyn_cast(expr)) { if (!isParam(UDE->getBase())) return expr; @@ -1699,6 +1702,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2, case ConstraintKind::FunctionInput: case ConstraintKind::FunctionResult: case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: case ConstraintKind::DefaultClosureType: llvm_unreachable("Not a relational constraint"); } @@ -3043,11 +3047,12 @@ bool ConstraintSystem::repairFailures( // default values, let's see whether error is related to missing // explicit call. if (fnType->getNumParams() > 0) { - auto anchor = simplifyLocatorToAnchor(getConstraintLocator(locator)); - if (!anchor.is()) + auto *loc = getConstraintLocator(locator); + auto *anchor = getAsExpr(simplifyLocatorToAnchor(loc)); + if (!anchor) return false; - auto overload = findSelectedOverloadFor(getAsExpr(anchor)); + auto overload = findSelectedOverloadFor(anchor); if (!(overload && overload->choice.isDecl())) return false; @@ -4406,6 +4411,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind, case ConstraintKind::FunctionInput: case ConstraintKind::FunctionResult: case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: case ConstraintKind::DefaultClosureType: llvm_unreachable("Not a relational constraint"); } @@ -6928,6 +6934,54 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint( return recordFix(fix) ? SolutionKind::Error : SolutionKind::Solved; } + // If base is an archetype or metatype of archetype, check for an unintended + // extra generic parameter. + if (auto archetype = + baseTy->getMetatypeInstanceType()->getAs()) { + if (auto genericTy = + archetype->mapTypeOutOfContext()->getAs()) { + for (auto param : + archetype->getGenericEnvironment()->getGenericParams()) { + // Find a param at the same depth and one index past the type we're + // dealing with + if (param->getDepth() != genericTy->getDepth() || + param->getIndex() != genericTy->getIndex() + 1) + continue; + auto paramDecl = param->getDecl(); + if (!paramDecl) + continue; + + auto descriptor = UnqualifiedLookupDescriptor( + DeclNameRef(param->getName()), + paramDecl->getDeclContext()->getParentForLookup(), + paramDecl->getStartLoc(), + UnqualifiedLookupFlags::KnownPrivate | + UnqualifiedLookupFlags::TypeLookup); + auto lookup = evaluateOrDefault( + Context.evaluator, UnqualifiedLookupRequest{descriptor}, {}); + for (auto &result : lookup) { + if (auto proto = + dyn_cast_or_null(result.getValueDecl())) { + auto result = + baseTy->is() + ? solveWithNewBaseOrName(ExistentialMetatypeType::get( + proto->getDeclaredType()), + member) + : solveWithNewBaseOrName(proto->getDeclaredType(), + member); + if (result == SolutionKind::Solved) + return recordFix( + DefineMemberBasedOnUnintendedGenericParam::create( + *this, baseTy, member, param->getName(), + locator)) + ? SolutionKind::Error + : SolutionKind::Solved; + } + } + } + } + } + if (auto *funcType = baseTy->getAs()) { // We can't really suggest anything useful unless // function takes no arguments, otherwise it @@ -7121,9 +7175,16 @@ ConstraintSystem::simplifyOneWayConstraint( return SolutionKind::Solved; } - // Translate this constraint into a one-way binding constraint. - return matchTypes(first, secondSimplified, ConstraintKind::Equal, flags, - locator); + // Translate this constraint into an equality or bind-parameter constraint, + // as appropriate. + if (kind == ConstraintKind::OneWayEqual) { + return matchTypes(first, secondSimplified, ConstraintKind::Equal, flags, + locator); + } + + assert(kind == ConstraintKind::OneWayBindParam); + return matchTypes( + secondSimplified, first, ConstraintKind::BindParam, flags, locator); } static Type getFunctionBuilderTypeFor(ConstraintSystem &cs, unsigned paramIdx, @@ -7175,12 +7236,27 @@ bool ConstraintSystem::resolveClosure(TypeVariableType *typeVar, Type internalType; + bool oneWayConstraints = + getASTContext().TypeCheckerOpts.EnableOneWayClosureParameters; if (paramList->get(i)->getTypeRepr()) { // Internal type is the type used in the body of the closure, // so "external" type translates to it as follows: // - `Int...` -> `[Int]`, // - `inout Int` -> `@lvalue Int`. internalType = param.getParameterType(); + + // When there are type variables in the type and we have enabled + // one-way constraints, create a fresh type variable to handle the + // binding. + if (oneWayConstraints && internalType->hasTypeVariable()) { + auto *paramLoc = + getConstraintLocator(closure, LocatorPathElt::TupleElement(i)); + auto *typeVar = createTypeVariable(paramLoc, TVO_CanBindToLValue | + TVO_CanBindToNoEscape); + addConstraint( + ConstraintKind::OneWayBindParam, typeVar, internalType, paramLoc); + internalType = typeVar; + } } else { auto *paramLoc = getConstraintLocator(closure, LocatorPathElt::TupleElement(i)); @@ -7194,7 +7270,13 @@ bool ConstraintSystem::resolveClosure(TypeVariableType *typeVar, param.isVariadic() ? ArraySliceType::get(typeVar) : Type(typeVar); auto externalType = param.getOldType(); - addConstraint(ConstraintKind::BindParam, externalType, typeVar, paramLoc); + if (oneWayConstraints) { + addConstraint( + ConstraintKind::OneWayBindParam, typeVar, externalType, paramLoc); + } else { + addConstraint( + ConstraintKind::BindParam, externalType, typeVar, paramLoc); + } } setType(paramList->get(i), internalType); @@ -9397,7 +9479,7 @@ bool ConstraintSystem::recordFix(ConstraintFix *fix, unsigned impact) { bool found = false; if (auto *expr = getAsExpr(anchor)) { - expr->forEachChildExpr([&](Expr *subExpr) -> Expr * { + forEachExprInConstraintSystem(expr, [&](Expr *subExpr) -> Expr * { found |= anchors.count(subExpr); return subExpr; }); @@ -9759,6 +9841,7 @@ ConstraintSystem::addConstraintImpl(ConstraintKind kind, Type first, subflags, locator); case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: return simplifyOneWayConstraint(kind, first, second, subflags, locator); case ConstraintKind::ValueMember: @@ -10271,6 +10354,7 @@ ConstraintSystem::simplifyConstraint(const Constraint &constraint) { return SolutionKind::Unsolved; case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: return simplifyOneWayConstraint(constraint.getKind(), constraint.getFirstType(), constraint.getSecondType(), diff --git a/lib/Sema/CSSolver.cpp b/lib/Sema/CSSolver.cpp index 4c8f4c977ecd4..ebbd088bc646b 100644 --- a/lib/Sema/CSSolver.cpp +++ b/lib/Sema/CSSolver.cpp @@ -988,8 +988,7 @@ void ConstraintSystem::shrink(Expr *expr) { // let's allow collector discover it with assigned contextual type // of coercion, which allows collections to be solved in parts. if (auto collectionExpr = dyn_cast(childExpr)) { - auto castTypeLoc = coerceExpr->getCastTypeLoc(); - auto typeRepr = castTypeLoc.getTypeRepr(); + auto *const typeRepr = coerceExpr->getCastTypeRepr(); if (typeRepr && isSuitableCollection(typeRepr)) { auto resolution = TypeResolution::forContextual(CS.DC, None); @@ -1688,6 +1687,7 @@ void ConstraintSystem::ArgumentInfoCollector::walk(Type argType) { case ConstraintKind::ConformsTo: case ConstraintKind::Defaultable: case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: case ConstraintKind::DefaultClosureType: break; } diff --git a/lib/Sema/Constraint.cpp b/lib/Sema/Constraint.cpp index 99e433a171380..0756b06ba7b6d 100644 --- a/lib/Sema/Constraint.cpp +++ b/lib/Sema/Constraint.cpp @@ -66,6 +66,7 @@ Constraint::Constraint(ConstraintKind Kind, Type First, Type Second, case ConstraintKind::FunctionResult: case ConstraintKind::OpaqueUnderlyingType: case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: assert(!First.isNull()); assert(!Second.isNull()); break; @@ -138,6 +139,7 @@ Constraint::Constraint(ConstraintKind Kind, Type First, Type Second, Type Third, case ConstraintKind::FunctionResult: case ConstraintKind::OpaqueUnderlyingType: case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: case ConstraintKind::DefaultClosureType: llvm_unreachable("Wrong constructor"); @@ -265,6 +267,7 @@ Constraint *Constraint::clone(ConstraintSystem &cs) const { case ConstraintKind::FunctionResult: case ConstraintKind::OpaqueUnderlyingType: case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: case ConstraintKind::DefaultClosureType: return create(cs, getKind(), getFirstType(), getSecondType(), getLocator()); @@ -348,6 +351,7 @@ void Constraint::print(llvm::raw_ostream &Out, SourceManager *sm) const { case ConstraintKind::EscapableFunctionOf: Out << " @escaping type of "; break; case ConstraintKind::OpenedExistentialOf: Out << " opened archetype of "; break; case ConstraintKind::OneWayEqual: Out << " one-way bind to "; break; + case ConstraintKind::OneWayBindParam: Out << " one-way bind param to "; break; case ConstraintKind::DefaultClosureType: Out << " closure can default to "; break; @@ -564,6 +568,7 @@ gatherReferencedTypeVars(Constraint *constraint, case ConstraintKind::FunctionResult: case ConstraintKind::OpaqueUnderlyingType: case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: case ConstraintKind::DefaultClosureType: constraint->getFirstType()->getTypeVariables(typeVars); constraint->getSecondType()->getTypeVariables(typeVars); diff --git a/lib/Sema/Constraint.h b/lib/Sema/Constraint.h index 23e615fed081d..d13a95bb39889 100644 --- a/lib/Sema/Constraint.h +++ b/lib/Sema/Constraint.h @@ -161,6 +161,12 @@ enum class ConstraintKind : char { /// type). At that point, this constraint will be treated like an `Equal` /// constraint. OneWayEqual, + /// The second type is the type of a function parameter, and the first type + /// is the type of a reference to that function parameter within the body. + /// Once the second type has been fully determined (and mapped down to a + /// concrete type), this constraint will be treated like a 'BindParam' + /// constraint. + OneWayBindParam, /// If there is no contextual info e.g. `_ = { 42 }` default first type /// to a second type (inferred closure type). This is effectively a /// `Defaultable` constraint which a couple of differences: @@ -549,6 +555,7 @@ class Constraint final : public llvm::ilist_node, case ConstraintKind::OptionalObject: case ConstraintKind::OpaqueUnderlyingType: case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: case ConstraintKind::DefaultClosureType: return ConstraintClassification::Relational; @@ -669,7 +676,8 @@ class Constraint final : public llvm::ilist_node, /// Whether this is a one-way constraint. bool isOneWayConstraint() const { - return Kind == ConstraintKind::OneWayEqual; + return Kind == ConstraintKind::OneWayEqual || + Kind == ConstraintKind::OneWayBindParam; } /// Retrieve the overload choice for an overload-binding constraint. diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index d0ba3ca4a16d9..52eb827460772 100644 --- a/lib/Sema/ConstraintSystem.cpp +++ b/lib/Sema/ConstraintSystem.cpp @@ -590,6 +590,8 @@ static void extendDepthMap( Expr *expr, llvm::DenseMap> &depthMap) { class RecordingTraversal : public ASTWalker { + SmallVector Closures; + public: llvm::DenseMap> &DepthMap; unsigned Depth = 0; @@ -601,13 +603,37 @@ static void extendDepthMap( std::pair walkToExprPre(Expr *E) override { DepthMap[E] = {Depth, Parent.getAsExpr()}; ++Depth; + + if (auto CE = dyn_cast(E)) + Closures.push_back(CE); + return { true, E }; } Expr *walkToExprPost(Expr *E) override { + if (auto CE = dyn_cast(E)) { + assert(Closures.back() == CE); + Closures.pop_back(); + } + --Depth; return E; } + + std::pair walkToStmtPre(Stmt *S) override { + if (auto RS = dyn_cast(S)) { + // For return statements, treat the parent of the return expression + // as the closure itself. + if (RS->hasResult() && !Closures.empty()) { + llvm::SaveAndRestore SavedParent(Parent, Closures.back()); + auto E = RS->getResult(); + E->walk(*this); + return { false, S }; + } + } + + return { true, S }; + } }; RecordingTraversal traversal(depthMap); @@ -629,9 +655,9 @@ Optional> ConstraintSystem::getExprDepthAndParent( return None; } -Type ConstraintSystem::openUnboundGenericType(UnboundGenericType *unbound, - ConstraintLocatorBuilder locator, - OpenedTypeMap &replacements) { +Type +ConstraintSystem::openUnboundGenericType(UnboundGenericType *unbound, + ConstraintLocatorBuilder locator) { auto unboundDecl = unbound->getDecl(); auto parentTy = unbound->getParent(); if (parentTy) { @@ -641,6 +667,7 @@ Type ConstraintSystem::openUnboundGenericType(UnboundGenericType *unbound, } // Open up the generic type. + OpenedTypeMap replacements; openGeneric(unboundDecl->getDeclContext(), unboundDecl->getGenericSignature(), locator, replacements); @@ -764,8 +791,7 @@ Type ConstraintSystem::openUnboundGenericType( type = type.transform([&](Type type) -> Type { if (auto unbound = type->getAs()) { - OpenedTypeMap replacements; - return openUnboundGenericType(unbound, locator, replacements); + return openUnboundGenericType(unbound, locator); } return type; @@ -929,6 +955,72 @@ TypeVariableType *ConstraintSystem::isRepresentativeFor( return *member; } +static Optional> +getPropertyWrapperInformationFromOverload( + SelectedOverload resolvedOverload, DeclContext *DC, + llvm::function_ref>(VarDecl *)> + getInformation) { + if (auto *decl = + dyn_cast_or_null(resolvedOverload.choice.getDeclOrNull())) { + if (auto declInformation = getInformation(decl)) { + Type type; + VarDecl *memberDecl; + std::tie(memberDecl, type) = *declInformation; + if (Type baseType = resolvedOverload.choice.getBaseType()) { + type = + baseType->getTypeOfMember(DC->getParentModule(), memberDecl, type); + } + return std::make_pair(decl, type); + } + } + return None; +} + +Optional> +ConstraintSystem::getStorageWrapperInformation( + SelectedOverload resolvedOverload) { + return getPropertyWrapperInformationFromOverload( + resolvedOverload, DC, + [](VarDecl *decl) -> Optional> { + if (!decl->hasAttachedPropertyWrapper()) + return None; + + auto storageWrapper = decl->getPropertyWrapperStorageWrapper(); + if (!storageWrapper) + return None; + + return std::make_pair(storageWrapper, + storageWrapper->getInterfaceType()); + }); +} + +Optional> +ConstraintSystem::getPropertyWrapperInformation( + SelectedOverload resolvedOverload) { + return getPropertyWrapperInformationFromOverload( + resolvedOverload, DC, + [](VarDecl *decl) -> Optional> { + if (!decl->hasAttachedPropertyWrapper()) + return None; + + return std::make_pair(decl, + decl->getPropertyWrapperBackingPropertyType()); + }); +} + +Optional> +ConstraintSystem::getWrappedPropertyInformation( + SelectedOverload resolvedOverload) { + return getPropertyWrapperInformationFromOverload( + resolvedOverload, DC, + [](VarDecl *decl) -> Optional> { + if (auto wrapped = decl->getOriginalWrappedProperty()) + return std::make_pair(decl, wrapped->getInterfaceType()); + + return None; + }); +} + /// Does a var or subscript produce an l-value? /// /// \param baseType - the type of the base on which this object @@ -4297,9 +4389,12 @@ void SolutionApplicationTarget::maybeApplyPropertyWrapper() { isImplicit = true; } - auto typeExpr = TypeExpr::createImplicitHack( - outermostWrapperAttr->getTypeLoc().getLoc(), - outermostWrapperType, ctx); + SourceLoc typeLoc; + if (auto *repr = outermostWrapperAttr->getTypeRepr()) { + typeLoc = repr->getLoc(); + } + auto typeExpr = + TypeExpr::createImplicitHack(typeLoc, outermostWrapperType, ctx); backingInitializer = CallExpr::create( ctx, typeExpr, outermostArg, outermostWrapperAttr->getArgumentLabels(), @@ -4313,7 +4408,8 @@ void SolutionApplicationTarget::maybeApplyPropertyWrapper() { // the initializer type later. expression.wrappedVar = singleVar; expression.expression = backingInitializer; - expression.convertType = outermostWrapperAttr->getTypeLoc(); + expression.convertType = {outermostWrapperAttr->getTypeRepr(), + outermostWrapperAttr->getType()}; } SolutionApplicationTarget SolutionApplicationTarget::forInitialization( @@ -4525,7 +4621,7 @@ void ConstraintSystem::maybeProduceFallbackDiagnostic( SourceLoc constraints::getLoc(ASTNode anchor) { if (auto *E = anchor.dyn_cast()) { return E->getLoc(); - } else if (auto *T = anchor.dyn_cast()) { + } else if (auto *T = anchor.dyn_cast()) { return T->getLoc(); } else if (auto *V = anchor.dyn_cast()) { if (auto VD = dyn_cast(V)) diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index 1883272bb23c4..d458367f0f40b 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -724,13 +724,6 @@ struct AppliedBuilderTransform { /// The return expression, capturing the last value to be emitted. Expr *returnExpr = nullptr; - - using PatternEntry = std::pair; - - /// Mapping from specific pattern binding entries to the solution application - /// targets capturing their initialization. - llvm::DenseMap - patternBindingEntries; }; /// Describes the fixed score of a solution to the constraint system. @@ -855,8 +848,111 @@ struct ForEachStmtInfo { /// Key to the constraint solver's mapping from AST nodes to their corresponding /// solution application targets. -using SolutionApplicationTargetsKey = - PointerUnion; +class SolutionApplicationTargetsKey { +public: + enum class Kind { + empty, + tombstone, + stmtCondElement, + stmt, + patternBindingEntry, + }; + +private: + Kind kind; + + union { + const StmtConditionElement *stmtCondElement; + + const Stmt *stmt; + + struct PatternBindingEntry { + const PatternBindingDecl *patternBinding; + unsigned index; + } patternBindingEntry; + } storage; + +public: + SolutionApplicationTargetsKey(Kind kind) { + assert(kind == Kind::empty || kind == Kind::tombstone); + this->kind = kind; + } + + SolutionApplicationTargetsKey(const StmtConditionElement *stmtCondElement) { + kind = Kind::stmtCondElement; + storage.stmtCondElement = stmtCondElement; + } + + SolutionApplicationTargetsKey(const Stmt *stmt) { + kind = Kind::stmt; + storage.stmt = stmt; + } + + SolutionApplicationTargetsKey( + const PatternBindingDecl *patternBinding, unsigned index) { + kind = Kind::stmt; + storage.patternBindingEntry.patternBinding = patternBinding; + storage.patternBindingEntry.index = index; + } + + friend bool operator==( + SolutionApplicationTargetsKey lhs, SolutionApplicationTargetsKey rhs) { + if (lhs.kind != rhs.kind) + return false; + + switch (lhs.kind) { + case Kind::empty: + case Kind::tombstone: + return true; + + case Kind::stmtCondElement: + return lhs.storage.stmtCondElement == rhs.storage.stmtCondElement; + + case Kind::stmt: + return lhs.storage.stmt == rhs.storage.stmt; + + case Kind::patternBindingEntry: + return (lhs.storage.patternBindingEntry.patternBinding + == rhs.storage.patternBindingEntry.patternBinding) && + (lhs.storage.patternBindingEntry.index + == rhs.storage.patternBindingEntry.index); + } + } + + friend bool operator!=( + SolutionApplicationTargetsKey lhs, SolutionApplicationTargetsKey rhs) { + return !(lhs == rhs); + } + + unsigned getHashValue() const { + using llvm::hash_combine; + using llvm::DenseMapInfo; + + switch (kind) { + case Kind::empty: + case Kind::tombstone: + return llvm::DenseMapInfo::getHashValue(static_cast(kind)); + + case Kind::stmtCondElement: + return hash_combine( + DenseMapInfo::getHashValue(static_cast(kind)), + DenseMapInfo::getHashValue(storage.stmtCondElement)); + + case Kind::stmt: + return hash_combine( + DenseMapInfo::getHashValue(static_cast(kind)), + DenseMapInfo::getHashValue(storage.stmt)); + + case Kind::patternBindingEntry: + return hash_combine( + DenseMapInfo::getHashValue(static_cast(kind)), + DenseMapInfo::getHashValue( + storage.patternBindingEntry.patternBinding), + DenseMapInfo::getHashValue( + storage.patternBindingEntry.index)); + } + } +}; /// A complete solution to a constraint system. /// @@ -1238,13 +1334,16 @@ struct DynamicCallableMethods { /// Describes the target to which a constraint system's solution can be /// applied. class SolutionApplicationTarget { +public: enum class Kind { expression, function, stmtCondition, caseLabelItem, + patternBinding, } kind; +private: union { struct { /// The expression being type-checked. @@ -1306,6 +1405,8 @@ class SolutionApplicationTarget { CaseLabelItem *caseLabelItem; DeclContext *dc; } caseLabelItem; + + PatternBindingDecl *patternBinding; }; // If the pattern contains a single variable that has an attached @@ -1346,6 +1447,11 @@ class SolutionApplicationTarget { this->caseLabelItem.dc = dc; } + SolutionApplicationTarget(PatternBindingDecl *patternBinding) { + kind = Kind::patternBinding; + this->patternBinding = patternBinding; + } + /// Form a target for the initialization of a pattern from an expression. static SolutionApplicationTarget forInitialization( Expr *initializer, DeclContext *dc, Type patternType, Pattern *pattern, @@ -1371,6 +1477,7 @@ class SolutionApplicationTarget { case Kind::function: case Kind::stmtCondition: case Kind::caseLabelItem: + case Kind::patternBinding: return nullptr; } llvm_unreachable("invalid expression type"); @@ -1389,6 +1496,9 @@ class SolutionApplicationTarget { case Kind::caseLabelItem: return caseLabelItem.dc; + + case Kind::patternBinding: + return patternBinding->getDeclContext(); } llvm_unreachable("invalid decl context type"); } @@ -1540,6 +1650,7 @@ class SolutionApplicationTarget { case Kind::expression: case Kind::stmtCondition: case Kind::caseLabelItem: + case Kind::patternBinding: return None; case Kind::function: @@ -1553,6 +1664,7 @@ class SolutionApplicationTarget { case Kind::expression: case Kind::function: case Kind::caseLabelItem: + case Kind::patternBinding: return None; case Kind::stmtCondition: @@ -1566,6 +1678,7 @@ class SolutionApplicationTarget { case Kind::expression: case Kind::function: case Kind::stmtCondition: + case Kind::patternBinding: return None; case Kind::caseLabelItem: @@ -1574,6 +1687,19 @@ class SolutionApplicationTarget { llvm_unreachable("invalid case label type"); } + PatternBindingDecl *getAsPatternBinding() const { + switch (kind) { + case Kind::expression: + case Kind::function: + case Kind::stmtCondition: + case Kind::caseLabelItem: + return nullptr; + + case Kind::patternBinding: + return patternBinding; + } + } + BraceStmt *getFunctionBody() const { assert(kind == Kind::function); return function.body; @@ -1599,6 +1725,9 @@ class SolutionApplicationTarget { case Kind::caseLabelItem: return caseLabelItem.caseLabelItem->getSourceRange(); + + case Kind::patternBinding: + return patternBinding->getSourceRange(); } llvm_unreachable("invalid target type"); } @@ -1617,6 +1746,9 @@ class SolutionApplicationTarget { case Kind::caseLabelItem: return caseLabelItem.caseLabelItem->getStartLoc(); + + case Kind::patternBinding: + return patternBinding->getLoc(); } llvm_unreachable("invalid target type"); } @@ -2506,16 +2638,12 @@ class ConstraintSystem { /// map is used throughout the expression type checker in order to /// avoid mutating expressions until we know we have successfully /// type-checked them. - void setType(TypeLoc &L, Type T) { setType(ASTNode(&L), T); } - void setType(KeyPathExpr *KP, unsigned I, Type T) { assert(KP && "Expected non-null key path parameter!"); assert(T && "Expected non-null type!"); KeyPathComponentTypes[std::make_pair(KP, I)] = T.getPointer(); } - bool hasType(TypeLoc &L) const { return hasType(ASTNode(&L)); } - /// Check to see if we have a type for a node. bool hasType(ASTNode node) const { assert(!node.isNull() && "Expected non-null node"); @@ -2538,8 +2666,6 @@ class ConstraintSystem { return NodeTypes.find(node)->second; } - Type getType(TypeLoc &L) const { return getType(ASTNode(&L)); } - Type getType(const KeyPathExpr *KP, unsigned I) const { assert(hasType(KP, I) && "Expected type to have been set!"); return KeyPathComponentTypes.find(std::make_pair(KP, I))->second; @@ -2610,7 +2736,6 @@ class ConstraintSystem { void setSolutionApplicationTarget( SolutionApplicationTargetsKey key, SolutionApplicationTarget target) { - assert(key && "Expected non-null solution application target key!"); assert(solutionApplicationTargets.count(key) == 0 && "Already set this solution application target"); solutionApplicationTargets.insert({key, target}); @@ -3106,62 +3231,18 @@ class ConstraintSystem { /// Gets the VarDecl associateed with resolvedOverload, and the type of the /// storage wrapper if the decl has an associated storage wrapper. Optional> - getStorageWrapperInformation(SelectedOverload resolvedOverload) { - if (resolvedOverload.choice.isDecl()) { - if (auto *decl = dyn_cast(resolvedOverload.choice.getDecl())) { - if (decl->hasAttachedPropertyWrapper()) { - if (auto storageWrapper = decl->getPropertyWrapperStorageWrapper()) { - Type type = storageWrapper->getInterfaceType(); - if (Type baseType = resolvedOverload.choice.getBaseType()) { - type = baseType->getTypeOfMember(DC->getParentModule(), - storageWrapper, type); - } - return std::make_pair(decl, type); - } - } - } - } - return None; - } + getStorageWrapperInformation(SelectedOverload resolvedOverload); /// Gets the VarDecl associateed with resolvedOverload, and the type of the /// backing storage if the decl has an associated property wrapper. Optional> - getPropertyWrapperInformation(SelectedOverload resolvedOverload) { - if (resolvedOverload.choice.isDecl()) { - if (auto *decl = dyn_cast(resolvedOverload.choice.getDecl())) { - if (decl->hasAttachedPropertyWrapper()) { - auto wrapperTy = decl->getPropertyWrapperBackingPropertyType(); - if (Type baseType = resolvedOverload.choice.getBaseType()) { - wrapperTy = baseType->getTypeOfMember(DC->getParentModule(), - decl, wrapperTy); - } - return std::make_pair(decl, wrapperTy); - } - } - } - return None; - } + getPropertyWrapperInformation(SelectedOverload resolvedOverload); /// Gets the VarDecl, and the type of the type property that it wraps if /// resolved overload has a decl which is the backing storage for a /// property wrapper. Optional> - getWrappedPropertyInformation(SelectedOverload resolvedOverload) { - if (resolvedOverload.choice.isDecl()) { - if (auto *decl = dyn_cast(resolvedOverload.choice.getDecl())) { - if (auto wrapped = decl->getOriginalWrappedProperty()) { - Type type = wrapped->getInterfaceType(); - if (Type baseType = resolvedOverload.choice.getBaseType()) { - type = baseType->getTypeOfMember(DC->getParentModule(), - wrapped, type); - } - return std::make_pair(decl, type); - } - } - } - return None; - } + getWrappedPropertyInformation(SelectedOverload resolvedOverload); /// Merge the equivalence sets of the two type variables. /// @@ -3330,8 +3411,7 @@ class ConstraintSystem { /// /// \returns The opened type. Type openUnboundGenericType(UnboundGenericType *unbound, - ConstraintLocatorBuilder locator, - OpenedTypeMap &replacements); + ConstraintLocatorBuilder locator); /// "Open" the given type by replacing any occurrences of unbound /// generic types with bound generic types with fresh type variables as @@ -5493,6 +5573,33 @@ BraceStmt *applyFunctionBuilderTransform( /// of the parameter and result types without looking at the body. bool shouldTypeCheckInEnclosingExpression(ClosureExpr *expr); +/// Visit each subexpression that will be part of the constraint system +/// of the given expression, including those in closure bodies that will be +/// part of the constraint system. +void forEachExprInConstraintSystem( + Expr *expr, llvm::function_ref callback); + } // end namespace swift +namespace llvm { +template<> +struct DenseMapInfo { + using Key = swift::constraints::SolutionApplicationTargetsKey; + + static inline Key getEmptyKey() { + return Key(Key::Kind::empty); + } + static inline Key getTombstoneKey() { + return Key(Key::Kind::tombstone); + } + static inline unsigned getHashValue(Key key) { + return key.getHashValue(); + } + static bool isEqual(Key a, Key b) { + return a == b; + } +}; + +} + #endif // LLVM_SWIFT_SEMA_CONSTRAINT_SYSTEM_H diff --git a/lib/Sema/DerivedConformanceCodingKey.cpp b/lib/Sema/DerivedConformanceCodingKey.cpp index 7e06caaffe456..03a5a47335c59 100644 --- a/lib/Sema/DerivedConformanceCodingKey.cpp +++ b/lib/Sema/DerivedConformanceCodingKey.cpp @@ -212,8 +212,8 @@ deriveBodyCodingKey_enum_stringValue(AbstractFunctionDecl *strValDecl, void *) { } else { SmallVector cases; for (auto *elt : elements) { - auto *pat = new (C) EnumElementPattern(TypeLoc::withoutLoc(enumType), - SourceLoc(), DeclNameLoc(), + auto *baseTE = TypeExpr::createImplicit(enumType, C); + auto *pat = new (C) EnumElementPattern(baseTE, SourceLoc(), DeclNameLoc(), DeclNameRef(), elt, nullptr); pat->setImplicit(); diff --git a/lib/Sema/DerivedConformanceComparable.cpp b/lib/Sema/DerivedConformanceComparable.cpp index b43bc32ba7234..216db050d320b 100644 --- a/lib/Sema/DerivedConformanceComparable.cpp +++ b/lib/Sema/DerivedConformanceComparable.cpp @@ -137,20 +137,20 @@ deriveBodyComparable_enum_hasAssociatedValues_lt(AbstractFunctionDecl *ltDecl, v SmallVector lhsPayloadVars; auto lhsSubpattern = DerivedConformance::enumElementPayloadSubpattern(elt, 'l', ltDecl, lhsPayloadVars); - auto lhsElemPat = new (C) EnumElementPattern(TypeLoc::withoutLoc(enumType), - SourceLoc(), DeclNameLoc(), - DeclNameRef(), elt, - lhsSubpattern); + auto *lhsBaseTE = TypeExpr::createImplicit(enumType, C); + auto lhsElemPat = + new (C) EnumElementPattern(lhsBaseTE, SourceLoc(), DeclNameLoc(), + DeclNameRef(), elt, lhsSubpattern); lhsElemPat->setImplicit(); // .(let r0, let r1, ...) SmallVector rhsPayloadVars; auto rhsSubpattern = DerivedConformance::enumElementPayloadSubpattern(elt, 'r', ltDecl, rhsPayloadVars); - auto rhsElemPat = new (C) EnumElementPattern(TypeLoc::withoutLoc(enumType), - SourceLoc(), DeclNameLoc(), - DeclNameRef(), elt, - rhsSubpattern); + auto *rhsBaseTE = TypeExpr::createImplicit(enumType, C); + auto rhsElemPat = + new (C) EnumElementPattern(rhsBaseTE, SourceLoc(), DeclNameLoc(), + DeclNameRef(), elt, rhsSubpattern); rhsElemPat->setImplicit(); auto hasBoundDecls = !lhsPayloadVars.empty(); @@ -289,13 +289,13 @@ deriveComparable_lt( if (generatedIdentifier != C.Id_LessThanOperator) { auto comparable = C.getProtocol(KnownProtocolKind::Comparable); auto comparableType = comparable->getDeclaredType(); - auto comparableTypeLoc = TypeLoc::withoutLoc(comparableType); + auto comparableTypeExpr = TypeExpr::createImplicit(comparableType, C); SmallVector argumentLabels = { Identifier(), Identifier() }; auto comparableDeclName = DeclName(C, DeclBaseName(C.Id_LessThanOperator), argumentLabels); comparableDecl->getAttrs().add(new (C) ImplementsAttr(SourceLoc(), SourceRange(), - comparableTypeLoc, + comparableTypeExpr, comparableDeclName, DeclNameLoc())); } diff --git a/lib/Sema/DerivedConformanceEquatableHashable.cpp b/lib/Sema/DerivedConformanceEquatableHashable.cpp index c55e9117207ae..589c61b447d6e 100644 --- a/lib/Sema/DerivedConformanceEquatableHashable.cpp +++ b/lib/Sema/DerivedConformanceEquatableHashable.cpp @@ -259,20 +259,20 @@ deriveBodyEquatable_enum_hasAssociatedValues_eq(AbstractFunctionDecl *eqDecl, SmallVector lhsPayloadVars; auto lhsSubpattern = DerivedConformance::enumElementPayloadSubpattern(elt, 'l', eqDecl, lhsPayloadVars); - auto lhsElemPat = new (C) EnumElementPattern(TypeLoc::withoutLoc(enumType), - SourceLoc(), DeclNameLoc(), - DeclNameRef(), elt, - lhsSubpattern); + auto *lhsBaseTE = TypeExpr::createImplicit(enumType, C); + auto lhsElemPat = + new (C) EnumElementPattern(lhsBaseTE, SourceLoc(), DeclNameLoc(), + DeclNameRef(), elt, lhsSubpattern); lhsElemPat->setImplicit(); // .(let r0, let r1, ...) SmallVector rhsPayloadVars; auto rhsSubpattern = DerivedConformance::enumElementPayloadSubpattern(elt, 'r', eqDecl, rhsPayloadVars); - auto rhsElemPat = new (C) EnumElementPattern(TypeLoc::withoutLoc(enumType), - SourceLoc(), DeclNameLoc(), - DeclNameRef(), elt, - rhsSubpattern); + auto *rhsBaseTE = TypeExpr::createImplicit(enumType, C); + auto rhsElemPat = + new (C) EnumElementPattern(rhsBaseTE, SourceLoc(), DeclNameLoc(), + DeclNameRef(), elt, rhsSubpattern); rhsElemPat->setImplicit(); auto hasBoundDecls = !lhsPayloadVars.empty(); @@ -506,13 +506,13 @@ deriveEquatable_eq( if (generatedIdentifier != C.Id_EqualsOperator) { auto equatableProto = C.getProtocol(KnownProtocolKind::Equatable); auto equatableTy = equatableProto->getDeclaredType(); - auto equatableTypeLoc = TypeLoc::withoutLoc(equatableTy); + auto equatableTyExpr = TypeExpr::createImplicit(equatableTy, C); SmallVector argumentLabels = { Identifier(), Identifier() }; auto equalsDeclName = DeclName(C, DeclBaseName(C.Id_EqualsOperator), argumentLabels); eqDecl->getAttrs().add(new (C) ImplementsAttr(SourceLoc(), SourceRange(), - equatableTypeLoc, + equatableTyExpr, equalsDeclName, DeclNameLoc())); } @@ -748,12 +748,12 @@ deriveBodyHashable_enum_hasAssociatedValues_hashInto( // case A, B(Int), C(String, Int) // @derived func hash(into hasher: inout Hasher) { // switch self { - // case A: + // case .A: // hasher.combine(0) - // case B(let a0): + // case .B(let a0): // hasher.combine(1) // hasher.combine(a0) - // case C(let a0, let a1): + // case .C(let a0, let a1): // hasher.combine(2) // hasher.combine(a0) // hasher.combine(a1) @@ -783,10 +783,9 @@ deriveBodyHashable_enum_hasAssociatedValues_hashInto( auto payloadPattern = DerivedConformance::enumElementPayloadSubpattern(elt, 'a', hashIntoDecl, payloadVars); - auto pat = new (C) EnumElementPattern(TypeLoc::withoutLoc(enumType), - SourceLoc(), DeclNameLoc(), - DeclNameRef(elt->getBaseIdentifier()), - elt, payloadPattern); + auto pat = new (C) EnumElementPattern( + TypeExpr::createImplicit(enumType, C), SourceLoc(), DeclNameLoc(), + DeclNameRef(elt->getBaseIdentifier()), elt, payloadPattern); pat->setImplicit(); auto labelItem = CaseLabelItem(pat); diff --git a/lib/Sema/DerivedConformanceRawRepresentable.cpp b/lib/Sema/DerivedConformanceRawRepresentable.cpp index 1a5498e649014..beb22f6af4145 100644 --- a/lib/Sema/DerivedConformanceRawRepresentable.cpp +++ b/lib/Sema/DerivedConformanceRawRepresentable.cpp @@ -108,9 +108,9 @@ deriveBodyRawRepresentable_raw(AbstractFunctionDecl *toRawDecl, void *) { SmallVector cases; for (auto elt : enumDecl->getAllElements()) { - auto pat = new (C) EnumElementPattern(TypeLoc::withoutLoc(enumType), - SourceLoc(), DeclNameLoc(), - DeclNameRef(), elt, nullptr); + auto pat = new (C) + EnumElementPattern(TypeExpr::createImplicit(enumType, C), SourceLoc(), + DeclNameLoc(), DeclNameRef(), elt, nullptr); pat->setImplicit(); auto labelItem = CaseLabelItem(pat); diff --git a/lib/Sema/DerivedConformances.cpp b/lib/Sema/DerivedConformances.cpp index 46f6ad101ce1d..1dc13ba25bea5 100644 --- a/lib/Sema/DerivedConformances.cpp +++ b/lib/Sema/DerivedConformances.cpp @@ -548,9 +548,9 @@ DeclRefExpr *DerivedConformance::convertEnumToIndex(SmallVectorImpl &st SmallVector cases; for (auto elt : enumDecl->getAllElements()) { // generate: case .: - auto pat = new (C) EnumElementPattern(TypeLoc::withoutLoc(enumType), - SourceLoc(), DeclNameLoc(), - DeclNameRef(), elt, nullptr); + auto pat = new (C) + EnumElementPattern(TypeExpr::createImplicit(enumType, C), SourceLoc(), + DeclNameLoc(), DeclNameRef(), elt, nullptr); pat->setImplicit(); pat->setType(enumType); diff --git a/lib/Sema/MiscDiagnostics.cpp b/lib/Sema/MiscDiagnostics.cpp index de1584df14f7f..28c1b5b03e12c 100644 --- a/lib/Sema/MiscDiagnostics.cpp +++ b/lib/Sema/MiscDiagnostics.cpp @@ -86,14 +86,14 @@ static void diagSyntacticUseRestrictions(const Expr *E, const DeclContext *DC, bool walkToDeclPre(Decl *D) override { if (auto *closure = dyn_cast(D->getDeclContext())) - return closure->wasTypeCheckedInEnclosingContext(); + return !closure->wasSeparatelyTypeChecked(); return false; } bool walkToTypeReprPre(TypeRepr *T) override { return true; } - bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + bool shouldWalkIntoSeparatelyCheckedClosure(ClosureExpr *expr) override { + return false; } bool shouldWalkIntoTapExpression() override { return false; } @@ -1290,8 +1290,8 @@ static void diagRecursivePropertyAccess(const Expr *E, const DeclContext *DC) { cast(DRE->getDecl())->isSelfParameter(); } - bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + bool shouldWalkIntoSeparatelyCheckedClosure(ClosureExpr *expr) override { + return false; } bool shouldWalkIntoTapExpression() override { return false; } @@ -1459,12 +1459,12 @@ static void diagnoseImplicitSelfUseInClosure(const Expr *E, // Don't walk into nested decls. bool walkToDeclPre(Decl *D) override { if (auto *closure = dyn_cast(D->getDeclContext())) - return closure->wasTypeCheckedInEnclosingContext(); + return !closure->wasSeparatelyTypeChecked(); return false; } - bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + bool shouldWalkIntoSeparatelyCheckedClosure(ClosureExpr *expr) override { + return false; } bool shouldWalkIntoTapExpression() override { return false; } @@ -3265,8 +3265,8 @@ static void checkStmtConditionTrailingClosure(ASTContext &ctx, const Expr *E) { public: DiagnoseWalker(ASTContext &ctx) : Ctx(ctx) { } - bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + bool shouldWalkIntoSeparatelyCheckedClosure(ClosureExpr *expr) override { + return false; } bool shouldWalkIntoTapExpression() override { return false; } @@ -3415,8 +3415,8 @@ class ObjCSelectorWalker : public ASTWalker { ObjCSelectorWalker(const DeclContext *dc, Type selectorTy) : Ctx(dc->getASTContext()), DC(dc), SelectorTy(selectorTy) { } - bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + bool shouldWalkIntoSeparatelyCheckedClosure(ClosureExpr *expr) override { + return false; } bool shouldWalkIntoTapExpression() override { return false; } @@ -3759,7 +3759,7 @@ checkImplicitPromotionsInCondition(const StmtConditionElement &cond, diag::optional_check_promotion, subExpr->getType()) .highlight(subExpr->getSourceRange()) - .fixItReplace(TP->getTypeLoc().getSourceRange(), + .fixItReplace(TP->getTypeRepr()->getSourceRange(), ooType->getString()); return; } @@ -4155,8 +4155,8 @@ static void diagnoseUnintendedOptionalBehavior(const Expr *E, } } - bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + bool shouldWalkIntoSeparatelyCheckedClosure(ClosureExpr *expr) override { + return false; } bool shouldWalkIntoTapExpression() override { return false; } @@ -4231,8 +4231,8 @@ static void diagnoseDeprecatedWritableKeyPath(const Expr *E, } } - bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + bool shouldWalkIntoSeparatelyCheckedClosure(ClosureExpr *expr) override { + return false; } bool shouldWalkIntoTapExpression() override { return false; } @@ -4286,7 +4286,7 @@ static void maybeDiagnoseCallToKeyValueObserveMethod(const Expr *E, if (!property) return; auto propertyVar = cast(property); - if (propertyVar->isObjCDynamic() || + if (propertyVar->shouldUseObjCDispatch() || (propertyVar->isObjC() && propertyVar->getParsedAccessor(AccessorKind::Set))) return; diff --git a/lib/Sema/ResilienceDiagnostics.cpp b/lib/Sema/ResilienceDiagnostics.cpp index 79488edcae34e..ee8cf299ed2dc 100644 --- a/lib/Sema/ResilienceDiagnostics.cpp +++ b/lib/Sema/ResilienceDiagnostics.cpp @@ -81,7 +81,7 @@ bool TypeChecker::diagnoseInlinableDeclRefAccess(SourceLoc loc, // Dynamic declarations were mistakenly not checked in Swift 4.2. // Do enforce the restriction even in pre-Swift-5 modes if the module we're // building is resilient, though. - if (D->isObjCDynamic() && !Context.isSwiftVersionAtLeast(5) && + if (D->shouldUseObjCDispatch() && !Context.isSwiftVersionAtLeast(5) && !DC->getParentModule()->isResilient()) { return false; } diff --git a/lib/Sema/SourceLoader.cpp b/lib/Sema/SourceLoader.cpp index b535a6986391d..af59251f5e824 100644 --- a/lib/Sema/SourceLoader.cpp +++ b/lib/Sema/SourceLoader.cpp @@ -120,10 +120,9 @@ ModuleDecl *SourceLoader::loadModule(SourceLoc importLoc, importMod->setResilienceStrategy(ResilienceStrategy::Resilient); Ctx.LoadedModules[moduleID.Item] = importMod; - auto *importFile = new (Ctx) SourceFile(*importMod, SourceFileKind::Library, - bufferID, - Ctx.LangOpts.CollectParsedToken, - Ctx.LangOpts.BuildSyntaxTree); + auto *importFile = + new (Ctx) SourceFile(*importMod, SourceFileKind::Library, bufferID, + SourceFile::getDefaultParsingOptions(Ctx.LangOpts)); importMod->addFile(*importFile); performImportResolution(*importFile); importMod->setHasResolvedImports(); diff --git a/lib/Sema/TypeCheckAccess.cpp b/lib/Sema/TypeCheckAccess.cpp index c67093cd5c843..a3720d157e27f 100644 --- a/lib/Sema/TypeCheckAccess.cpp +++ b/lib/Sema/TypeCheckAccess.cpp @@ -526,7 +526,7 @@ class AccessControlChecker : public AccessControlCheckerBase, // Check the property wrapper types. for (auto attr : anyVar->getAttachedPropertyWrappers()) { - checkTypeAccess(attr->getTypeLoc(), anyVar, + checkTypeAccess(attr->getType(), attr->getTypeRepr(), anyVar, /*mayBeInferred=*/false, [&](AccessScope typeAccessScope, const TypeRepr *complainRepr, @@ -1152,7 +1152,7 @@ class UsableFromInlineChecker : public AccessControlCheckerBase, }); for (auto attr : anyVar->getAttachedPropertyWrappers()) { - checkTypeAccess(attr->getTypeLoc(), + checkTypeAccess(attr->getType(), attr->getTypeRepr(), fixedLayoutStructContext ? fixedLayoutStructContext : anyVar, /*mayBeInferred*/false, @@ -1827,7 +1827,7 @@ class ExportabilityChecker : public DeclVisitor { // Check the property wrapper types. for (auto attr : anyVar->getAttachedPropertyWrappers()) - checkType(attr->getTypeLoc(), anyVar, + checkType(attr->getType(), attr->getTypeRepr(), anyVar, getDiagnoser(anyVar, Reason::PropertyWrapper)); } diff --git a/lib/Sema/TypeCheckAttr.cpp b/lib/Sema/TypeCheckAttr.cpp index 934521b90670b..505232f6748ad 100644 --- a/lib/Sema/TypeCheckAttr.cpp +++ b/lib/Sema/TypeCheckAttr.cpp @@ -2615,7 +2615,7 @@ void AttributeChecker::visitDynamicReplacementAttr(DynamicReplacementAttr *attr) return; } - if (replacement->isNativeDynamic()) { + if (replacement->shouldUseNativeDynamicDispatch()) { diagnose(attr->getLocation(), diag::dynamic_replacement_must_not_be_dynamic, replacement->getBaseName()); attr->setInvalid(); @@ -2841,23 +2841,21 @@ void AttributeChecker::visitTypeEraserAttr(TypeEraserAttr *attr) { } void AttributeChecker::visitImplementsAttr(ImplementsAttr *attr) { - TypeLoc &ProtoTypeLoc = attr->getProtocolType(); - DeclContext *DC = D->getDeclContext(); - Type T = ProtoTypeLoc.getType(); - if (!T && ProtoTypeLoc.getTypeRepr()) { + Type T = attr->getProtocolType(); + if (!T && attr->getProtocolTypeRepr()) { TypeResolutionOptions options = None; options |= TypeResolutionFlags::AllowUnboundGenerics; - auto resolution = TypeResolution::forContextual(DC, options); - T = resolution.resolveType(ProtoTypeLoc.getTypeRepr()); - ProtoTypeLoc.setType(T); + T = TypeResolution::forContextual(DC, options) + .resolveType(attr->getProtocolTypeRepr()); } // Definite error-types were already diagnosed in resolveType. - if (T->hasError()) + if (!T || T->hasError()) return; + attr->setProtocolType(T); // Check that we got a ProtocolType. if (auto PT = T->getAs()) { @@ -2882,12 +2880,12 @@ void AttributeChecker::visitImplementsAttr(ImplementsAttr *attr) { diagnose(attr->getLocation(), diag::implements_attr_protocol_not_conformed_to, NTD->getName(), PD->getName()) - .highlight(ProtoTypeLoc.getTypeRepr()->getSourceRange()); + .highlight(attr->getProtocolTypeRepr()->getSourceRange()); } } else { diagnose(attr->getLocation(), diag::implements_attr_non_protocol_type) - .highlight(ProtoTypeLoc.getTypeRepr()->getSourceRange()); + .highlight(attr->getProtocolTypeRepr()->getSourceRange()); } } @@ -2925,11 +2923,11 @@ void AttributeChecker::visitCustomAttr(CustomAttr *attr) { // an unknown attribute. if (!nominal) { std::string typeName; - if (auto typeRepr = attr->getTypeLoc().getTypeRepr()) { + if (auto typeRepr = attr->getTypeRepr()) { llvm::raw_string_ostream out(typeName); typeRepr->print(out); } else { - typeName = attr->getTypeLoc().getType().getString(); + typeName = attr->getType().getString(); } diagnose(attr->getLocation(), diag::unknown_attribute, typeName); diff --git a/lib/Sema/TypeCheckAvailability.cpp b/lib/Sema/TypeCheckAvailability.cpp index 3cc7d89b10253..be05a54427f8a 100644 --- a/lib/Sema/TypeCheckAvailability.cpp +++ b/lib/Sema/TypeCheckAvailability.cpp @@ -1129,7 +1129,7 @@ static void findAvailabilityFixItNodes(SourceRange ReferenceRange, if (Expr *ParentExpr = Parent.getAsExpr()) { auto *ParentClosure = dyn_cast(ParentExpr); if (!ParentClosure || - !ParentClosure->wasTypeCheckedInEnclosingContext()) { + ParentClosure->wasSeparatelyTypeChecked()) { return false; } } else if (auto *ParentStmt = Parent.getAsStmt()) { @@ -2343,8 +2343,8 @@ class AvailabilityWalker : public ASTWalker { return true; } - bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + bool shouldWalkIntoSeparatelyCheckedClosure(ClosureExpr *expr) override { + return false; } bool shouldWalkIntoTapExpression() override { return false; } diff --git a/lib/Sema/TypeCheckCaptures.cpp b/lib/Sema/TypeCheckCaptures.cpp index 028585fc47c35..20a41c6953b7e 100644 --- a/lib/Sema/TypeCheckCaptures.cpp +++ b/lib/Sema/TypeCheckCaptures.cpp @@ -525,12 +525,11 @@ class FindCapturedVars : public ASTWalker { if (auto cast = dyn_cast(E)) { // If we failed to resolve the written type, we've emitted an // earlier diagnostic and should bail. - auto toTy = cast->getCastTypeLoc().getType(); + const auto toTy = cast->getCastType(); if (!toTy || toTy->hasError()) return false; - if (auto clas = dyn_cast_or_null( - cast->getCastTypeLoc().getType()->getAnyNominal())) { + if (auto clas = dyn_cast_or_null(toTy->getAnyNominal())) { if (clas->usesObjCGenericsModel()) { return false; } @@ -558,7 +557,7 @@ class FindCapturedVars : public ASTWalker { } if (auto *ECE = dyn_cast(E)) { - checkType(ECE->getCastTypeLoc().getType(), ECE->getLoc()); + checkType(ECE->getCastType(), ECE->getLoc()); return { true, E }; } diff --git a/lib/Sema/TypeCheckConstraints.cpp b/lib/Sema/TypeCheckConstraints.cpp index 845ec35715ddb..7435775298de8 100644 --- a/lib/Sema/TypeCheckConstraints.cpp +++ b/lib/Sema/TypeCheckConstraints.cpp @@ -1294,15 +1294,13 @@ namespace { } std::pair walkToStmtPre(Stmt *stmt) override { - // Never walk into statements. - return { false, stmt }; + return { true, stmt }; } }; } // end anonymous namespace /// Perform prechecking of a ClosureExpr before we dive into it. This returns -/// true for single-expression closures, where we want the body to be considered -/// part of this larger expression. +/// true when we want the body to be considered part of this larger expression. bool PreCheckExpression::walkToClosureExprPre(ClosureExpr *closure) { auto *PL = closure->getParameters(); @@ -1915,34 +1913,37 @@ Expr *PreCheckExpression::simplifyTypeConstructionWithLiteralArg(Expr *E) { if (!protocol) return nullptr; - TypeLoc typeLoc; + Type castTy; if (auto precheckedTy = typeExpr->getInstanceType()) { - typeLoc = TypeLoc(typeExpr->getTypeRepr(), precheckedTy); + castTy = precheckedTy; } else { - TypeResolutionOptions options(TypeResolverContext::InExpression); - options |= TypeResolutionFlags::AllowUnboundGenerics; + const auto options = + TypeResolutionOptions(TypeResolverContext::InExpression) | + TypeResolutionFlags::AllowUnboundGenerics | + TypeResolutionFlags::SilenceErrors; auto result = TypeResolution::forContextual(DC, options) .resolveType(typeExpr->getTypeRepr()); if (result->hasError()) return nullptr; - typeLoc = TypeLoc{typeExpr->getTypeRepr(), result}; + castTy = result; } - if (!typeLoc.getType() || !typeLoc.getType()->getAnyNominal()) + if (!castTy || !castTy->getAnyNominal()) return nullptr; // Don't bother to convert deprecated selector syntax. if (auto selectorTy = getASTContext().getSelectorType()) { - if (typeLoc.getType()->isEqual(selectorTy)) + if (castTy->isEqual(selectorTy)) return nullptr; } - auto *NTD = typeLoc.getType()->getAnyNominal(); SmallVector conformances; - return NTD->lookupConformance(DC->getParentModule(), protocol, conformances) + return castTy->getAnyNominal()->lookupConformance(DC->getParentModule(), + protocol, conformances) ? CoerceExpr::forLiteralInit(getASTContext(), argExpr, - call->getSourceRange(), typeLoc) + call->getSourceRange(), + typeExpr->getTypeRepr()) : nullptr; } @@ -3050,9 +3051,9 @@ void ConstraintSystem::print(raw_ostream &out, Expr *E) const { return getType(E); return Type(); }; - auto getTypeOfTypeLoc = [&](TypeLoc &TL) -> Type { - if (hasType(TL)) - return getType(TL); + auto getTypeOfTypeRepr = [&](TypeRepr *TR) -> Type { + if (hasType(TR)) + return getType(TR); return Type(); }; auto getTypeOfKeyPathComponent = [&](KeyPathExpr *KP, unsigned I) -> Type { @@ -3061,7 +3062,7 @@ void ConstraintSystem::print(raw_ostream &out, Expr *E) const { return Type(); }; - E->dump(out, getTypeOfExpr, getTypeOfTypeLoc, getTypeOfKeyPathComponent); + E->dump(out, getTypeOfExpr, getTypeOfTypeRepr, getTypeOfKeyPathComponent); } void ConstraintSystem::print(raw_ostream &out) const { @@ -3247,6 +3248,11 @@ CheckedCastKind TypeChecker::typeCheckCheckedCast(Type fromType, SourceLoc diagLoc, Expr *fromExpr, SourceRange diagToRange) { + // Determine whether we should suppress diagnostics. + const bool suppressDiagnostics = contextKind == CheckedCastContextKind::None; + assert((suppressDiagnostics || diagLoc.isValid()) && + "diagnostics require a valid source location"); + SourceRange diagFromRange; if (fromExpr) diagFromRange = fromExpr->getSourceRange(); @@ -3271,9 +3277,6 @@ CheckedCastKind TypeChecker::typeCheckCheckedCast(Type fromType, Type origFromType = fromType; Type origToType = toType; - // Determine whether we should suppress diagnostics. - bool suppressDiagnostics = (contextKind == CheckedCastContextKind::None); - auto &diags = dc->getASTContext().Diags; bool optionalToOptionalCast = false; @@ -3708,9 +3711,11 @@ CheckedCastKind TypeChecker::typeCheckCheckedCast(Type fromType, else fromRequiresClass = fromType->mayHaveSuperclass(); - // Casts between protocol metatypes only succeed if the type is existential. + // Casts between metatypes only succeed if none of the types are existentials + // or if one is an existential and the other is a generic type because there + // may be protocol conformances unknown at compile time. if (metatypeCast) { - if (toExistential || fromExistential) + if ((toExistential || fromExistential) && !(fromArchetype || toArchetype)) return failed(); } @@ -4061,3 +4066,30 @@ HasDynamicCallableAttributeRequest::evaluate(Evaluator &evaluator, bool swift::shouldTypeCheckInEnclosingExpression(ClosureExpr *expr) { return expr->hasSingleExpressionBody(); } + +void swift::forEachExprInConstraintSystem( + Expr *expr, llvm::function_ref callback) { + struct ChildWalker : ASTWalker { + llvm::function_ref callback; + + ChildWalker(llvm::function_ref callback) + : callback(callback) {} + + std::pair walkToExprPre(Expr *E) override { + if (auto closure = dyn_cast(E)) { + if (!shouldTypeCheckInEnclosingExpression(closure)) + return { false, callback(E) }; + } + return { true, callback(E) }; + } + + std::pair walkToPatternPre(Pattern *P) override { + return { false, P }; + } + bool walkToDeclPre(Decl *D) override { return false; } + bool walkToTypeReprPre(TypeRepr *T) override { return false; } + bool walkToTypeLocPre(TypeLoc &TL) override { return false; } + }; + + expr->walk(ChildWalker(callback)); +} diff --git a/lib/Sema/TypeCheckDecl.cpp b/lib/Sema/TypeCheckDecl.cpp index 6529f0ca38818..6a5f8c7ac3b56 100644 --- a/lib/Sema/TypeCheckDecl.cpp +++ b/lib/Sema/TypeCheckDecl.cpp @@ -838,7 +838,7 @@ NeedsNewVTableEntryRequest::evaluate(Evaluator &evaluator, // Final members are always be called directly. // Dynamic methods are always accessed by objc_msgSend(). - if (decl->isFinal() || decl->isObjCDynamic() || decl->hasClangNode()) + if (decl->isFinal() || decl->shouldUseObjCDispatch() || decl->hasClangNode()) return false; auto &ctx = dc->getASTContext(); @@ -868,7 +868,7 @@ NeedsNewVTableEntryRequest::evaluate(Evaluator &evaluator, auto base = decl->getOverriddenDecl(); - if (!base || base->hasClangNode() || base->isObjCDynamic()) + if (!base || base->hasClangNode() || base->shouldUseObjCDispatch()) return true; // As above, convenience initializers are not formally overridable in Swift diff --git a/lib/Sema/TypeCheckDeclObjC.cpp b/lib/Sema/TypeCheckDeclObjC.cpp index 47a6568ff5a08..835b3362080af 100644 --- a/lib/Sema/TypeCheckDeclObjC.cpp +++ b/lib/Sema/TypeCheckDeclObjC.cpp @@ -437,6 +437,14 @@ static bool checkObjCInExtensionContext(const ValueDecl *value, } if (classDecl->isGenericContext()) { + // We do allow one special case. A @_dynamicReplacement(for:) function. + // Currently, this is only supported if the replaced decl is from a + // module compiled with -enable-implicit-dynamic. + if (value->getDynamicallyReplacedDecl() && + value->getDynamicallyReplacedDecl() + ->getModuleContext() + ->isImplicitDynamicEnabled()) + return false; if (!classDecl->usesObjCGenericsModel()) { if (diagnose) { value->diagnose(diag::objc_in_generic_extension, diff --git a/lib/Sema/TypeCheckDeclOverride.cpp b/lib/Sema/TypeCheckDeclOverride.cpp index dc853a680bfaf..6a82bcd6630dd 100644 --- a/lib/Sema/TypeCheckDeclOverride.cpp +++ b/lib/Sema/TypeCheckDeclOverride.cpp @@ -1819,7 +1819,7 @@ static bool checkSingleOverride(ValueDecl *override, ValueDecl *base) { if (auto *baseDecl = dyn_cast(base->getDeclContext())) { if (!isAccessor && baseDecl->hasKnownSwiftImplementation() && - !base->isObjCDynamic() && + !base->shouldUseObjCDispatch() && isa(override->getDeclContext())) { diags.diagnose(override, diag::override_class_declaration_in_extension); diags.diagnose(base, diag::overridden_here); diff --git a/lib/Sema/TypeCheckPattern.cpp b/lib/Sema/TypeCheckPattern.cpp index d74a4841258bf..3cee1b6d1ce01 100644 --- a/lib/Sema/TypeCheckPattern.cpp +++ b/lib/Sema/TypeCheckPattern.cpp @@ -360,10 +360,17 @@ class ResolvePattern : public ASTVisitor(E->getElement(1)); if (!cast) return nullptr; - + Pattern *subPattern = getSubExprPattern(E->getElement(0)); - return new (Context) IsPattern(cast->getLoc(), cast->getCastTypeLoc(), - subPattern, CheckedCastKind::Unresolved); + if (cast->isImplicit()) { + return IsPattern::createImplicit(Context, cast->getCastType(), subPattern, + CheckedCastKind::Unresolved); + } + auto *TE = new (Context) TypeExpr(cast->getCastTypeRepr()); + if (auto castTy = cast->getType()) + TE->setType(MetatypeType::get(castTy)); + return new (Context) + IsPattern(cast->getLoc(), TE, subPattern, CheckedCastKind::Unresolved); } // Convert a paren expr to a pattern if it contains a pattern. @@ -476,13 +483,13 @@ class ResolvePattern : public ASTVisitorgetName(), ude->getLoc()); if (!referencedElement) return nullptr; - - // Build a TypeRepr from the head of the full path. - TypeLoc loc(repr); - loc.setType(ty); - return new (Context) EnumElementPattern( - loc, ude->getDotLoc(), ude->getNameLoc(), ude->getName(), - referencedElement, nullptr); + + auto *base = + TypeExpr::createForMemberDecl(repr, ude->getNameLoc(), enumDecl); + base->setType(MetatypeType::get(ty)); + return new (Context) + EnumElementPattern(base, ude->getDotLoc(), ude->getNameLoc(), + ude->getName(), referencedElement, nullptr); } // A DeclRef 'E' that refers to an enum element forms an EnumElementPattern. @@ -492,9 +499,10 @@ class ResolvePattern : public ASTVisitorgetParentEnum()->getDeclaredTypeInContext()); - return new (Context) EnumElementPattern(loc, SourceLoc(), de->getNameLoc(), + auto enumTy = elt->getParentEnum()->getDeclaredTypeInContext(); + auto *base = TypeExpr::createImplicit(enumTy, Context); + + return new (Context) EnumElementPattern(base, SourceLoc(), de->getNameLoc(), elt->createNameRef(), elt, nullptr); } Pattern *visitUnresolvedDeclRefExpr(UnresolvedDeclRefExpr *ude) { @@ -508,11 +516,11 @@ class ResolvePattern : public ASTVisitorgetLoc())) { auto *enumDecl = referencedElement->getParentEnum(); auto enumTy = enumDecl->getDeclaredTypeInContext(); - TypeLoc loc = TypeLoc::withoutLoc(enumTy); + auto *base = TypeExpr::createImplicit(enumTy, Context); - return new (Context) EnumElementPattern( - loc, SourceLoc(), ude->getNameLoc(), ude->getName(), - referencedElement, nullptr); + return new (Context) + EnumElementPattern(base, SourceLoc(), ude->getNameLoc(), + ude->getName(), referencedElement, nullptr); } @@ -542,7 +550,7 @@ class ResolvePattern : public ASTVisitorgetParentEnum(); - loc = TypeLoc::withoutLoc(enumDecl->getDeclaredTypeInContext()); + baseTE = TypeExpr::createImplicit(enumDecl->getDeclaredTypeInContext(), + Context); } else { TypeResolutionOptions options = None; options |= TypeResolutionFlags::AllowUnboundGenerics; @@ -566,7 +575,8 @@ class ResolvePattern : public ASTVisitor(enumTy->getAnyNominal())) + auto *enumDecl = dyn_cast_or_null(enumTy->getAnyNominal()); + if (!enumDecl) return nullptr; referencedElement @@ -576,18 +586,19 @@ class ResolvePattern : public ASTVisitorgetNameLoc(), enumDecl); + baseTE->setType(MetatypeType::get(enumTy)); } + assert(baseTE && baseTE->getType() && "Didn't initialize base expression?"); assert(!isa(tailComponent) && "should be handled above"); auto *subPattern = getSubExprPattern(ce->getArg()); return new (Context) EnumElementPattern( - loc, SourceLoc(), tailComponent->getNameLoc(), - tailComponent->getNameRef(), referencedElement, - subPattern); + baseTE, SourceLoc(), tailComponent->getNameLoc(), + tailComponent->getNameRef(), referencedElement, subPattern); } }; @@ -613,12 +624,10 @@ Pattern *TypeChecker::resolvePattern(Pattern *P, DeclContext *DC, if (auto *TE = dyn_cast(EP->getSubExpr())) { Context.Diags.diagnose(TE->getStartLoc(), diag::type_pattern_missing_is) .fixItInsert(TE->getStartLoc(), "is "); - - P = new (Context) IsPattern(TE->getStartLoc(), - TypeLoc(TE->getTypeRepr(), - TE->getInstanceType()), - /*subpattern*/nullptr, - CheckedCastKind::Unresolved); + + P = new (Context) + IsPattern(TE->getStartLoc(), TE, + /*subpattern*/ nullptr, CheckedCastKind::Unresolved); } // Look through a TypedPattern if present. @@ -662,44 +671,47 @@ Pattern *TypeChecker::resolvePattern(Pattern *P, DeclContext *DC, return P; } -static Type validateTypedPattern(TypeResolution resolution, - TypedPattern *TP, - TypeResolutionOptions options) { - TypeLoc TL = TP->getTypeLoc(); - - bool hadError; - +static Type validateTypedPattern(TypedPattern *TP, TypeResolution resolution) { + if (TP->hasType()) { + return TP->getType(); + } + // If the pattern declares an opaque type, and applies to a single // variable binding, then we can bind the opaque return type from the // property definition. auto &Context = resolution.getASTContext(); - auto *Repr = TL.getTypeRepr(); + auto *Repr = TP->getTypeRepr(); if (Repr && isa(Repr)) { auto named = dyn_cast( TP->getSubPattern()->getSemanticsProvidingPattern()); - if (named) { - auto *var = named->getDecl(); - auto opaqueDecl = var->getOpaqueResultTypeDecl(); - auto opaqueTy = (opaqueDecl - ? opaqueDecl->getDeclaredInterfaceType() - : ErrorType::get(Context)); - TL.setType(named->getDecl()->getDeclContext() - ->mapTypeIntoContext(opaqueTy)); - hadError = opaqueTy->hasError(); - } else { - Context.Diags.diagnose(TP->getLoc(), diag::opaque_type_unsupported_pattern); - hadError = true; + if (!named) { + Context.Diags.diagnose(TP->getLoc(), + diag::opaque_type_unsupported_pattern); + return ErrorType::get(Context); + } + + auto *var = named->getDecl(); + auto opaqueDecl = var->getOpaqueResultTypeDecl(); + if (!opaqueDecl) { + return ErrorType::get(Context); + } + + auto opaqueTy = opaqueDecl->getDeclaredInterfaceType(); + if (opaqueTy->hasError()) { + return ErrorType::get(Context); } - } else { - hadError = TypeChecker::validateType(TL, resolution); + + return named->getDecl()->getDeclContext()->mapTypeIntoContext(opaqueTy); } - if (hadError) { + auto ty = resolution.resolveType(Repr); + if (!ty || ty->hasError()) { return ErrorType::get(Context); } - assert(!dyn_cast_or_null(Repr)); - return TL.getType(); + assert(!dyn_cast_or_null(Repr) && + "Didn't resolve invalid type to error type!"); + return ty; } Type TypeChecker::typeCheckPattern(ContextualPattern pattern) { @@ -759,8 +771,7 @@ Type PatternTypeRequest::evaluate(Evaluator &evaluator, // that type. case PatternKind::Typed: { auto resolution = TypeResolution::forContextual(dc, options); - TypedPattern *TP = cast(P); - return validateTypedPattern(resolution, TP, options); + return validateTypedPattern(cast(P), resolution); } // A wildcard or name pattern cannot appear by itself in a context @@ -815,7 +826,7 @@ Type PatternTypeRequest::evaluate(Evaluator &evaluator, if (somePat->isImplicit() && isa(somePat->getSubPattern())) { auto resolution = TypeResolution::forContextual(dc, options); TypedPattern *TP = cast(somePat->getSubPattern()); - auto type = validateTypedPattern(resolution, TP, options); + auto type = validateTypedPattern(TP, resolution); if (type && !type->hasError()) { return OptionalType::get(type); } @@ -1199,11 +1210,10 @@ Pattern *TypeChecker::coercePatternToType(ContextualPattern pattern, auto EP = cast(P); if (auto *NLE = dyn_cast(EP->getSubExpr())) { auto *NoneEnumElement = Context.getOptionalNoneDecl(); - P = new (Context) EnumElementPattern(TypeLoc::withoutLoc(type), - NLE->getLoc(), - DeclNameLoc(NLE->getLoc()), - NoneEnumElement->createNameRef(), - NoneEnumElement, nullptr); + auto *BaseTE = TypeExpr::createImplicit(type, Context); + P = new (Context) EnumElementPattern( + BaseTE, NLE->getLoc(), DeclNameLoc(NLE->getLoc()), + NoneEnumElement->createNameRef(), NoneEnumElement, nullptr); return TypeChecker::coercePatternToType( pattern.forSubPattern(P, /*retainTopLevel=*/true), type, options); } @@ -1221,11 +1231,11 @@ Pattern *TypeChecker::coercePatternToType(ContextualPattern pattern, // Type-check the type parameter. TypeResolutionOptions paramOptions(TypeResolverContext::InExpression); - TypeResolution resolution = TypeResolution::forContextual(dc, paramOptions); - if (validateType(IP->getCastTypeLoc(), resolution)) + auto castType = TypeResolution::forContextual(dc, paramOptions) + .resolveType(IP->getCastTypeRepr()); + if (!castType || castType->hasError()) return nullptr; - - auto castType = IP->getCastTypeLoc().getType(); + IP->setCastType(castType); // Determine whether we have an imbalance in the number of optionals. SmallVector inputTypeOptionals; @@ -1233,36 +1243,32 @@ Pattern *TypeChecker::coercePatternToType(ContextualPattern pattern, SmallVector castTypeOptionals; castType->lookThroughAllOptionalTypes(castTypeOptionals); - // If we have extra optionals on the input type. Create ".Some" patterns - // wrapping the isa pattern to balance out the optionals. + // If we have extra optionals on the input type. Create ".some" patterns + // wrapping the is pattern to balance out the optionals. int numExtraOptionals = inputTypeOptionals.size()-castTypeOptionals.size(); if (numExtraOptionals > 0) { Pattern *sub = IP; - for (int i = 0; i < numExtraOptionals; ++i) { + auto extraOpts = + llvm::drop_begin(inputTypeOptionals, castTypeOptionals.size()); + for (auto extraOptTy : llvm::reverse(extraOpts)) { auto some = Context.getOptionalDecl()->getUniqueElement(/*hasVal*/true); - sub = new (Context) EnumElementPattern(TypeLoc(), - IP->getStartLoc(), - DeclNameLoc(IP->getEndLoc()), - some->createNameRef(), - nullptr, sub); + auto *base = TypeExpr::createImplicit(extraOptTy, Context); + sub = new (Context) EnumElementPattern( + base, IP->getStartLoc(), DeclNameLoc(IP->getEndLoc()), + some->createNameRef(), nullptr, sub); sub->setImplicit(); } P = sub; return coercePatternToType( - pattern.forSubPattern(P, /*retainTopLevle=*/true), type, options); + pattern.forSubPattern(P, /*retainTopLevel=*/true), type, options); } - - CheckedCastKind castKind - = TypeChecker::typeCheckCheckedCast(type, IP->getCastTypeLoc().getType(), - type->hasError() - ? CheckedCastContextKind::None - : CheckedCastContextKind::IsPattern, - dc, - IP->getLoc(), - nullptr, - IP->getCastTypeLoc().getSourceRange()); + CheckedCastKind castKind = TypeChecker::typeCheckCheckedCast( + type, IP->getCastType(), + type->hasError() ? CheckedCastContextKind::None + : CheckedCastContextKind::IsPattern, + dc, IP->getLoc(), nullptr, IP->getCastTypeRepr()->getSourceRange()); switch (castKind) { case CheckedCastKind::Unresolved: return nullptr; @@ -1272,8 +1278,7 @@ Pattern *TypeChecker::coercePatternToType(ContextualPattern pattern, // it is "useful" because it is providing a different type to the // sub-pattern. If this is an 'is' pattern or an 'as' pattern where the // types are the same, then produce a warning. - if (!IP->getSubPattern() || - type->isEqual(IP->getCastTypeLoc().getType())) { + if (!IP->getSubPattern() || type->isEqual(IP->getCastType())) { diags.diagnose(IP->getLoc(), diag::isa_is_always_true, IP->getSubPattern() ? "as" : "is"); } @@ -1286,7 +1291,7 @@ Pattern *TypeChecker::coercePatternToType(ContextualPattern pattern, case CheckedCastKind::SetDowncast: { diags.diagnose(IP->getLoc(), diag::isa_collection_downcast_pattern_value_unimplemented, - IP->getCastTypeLoc().getType()); + IP->getCastType()); return P; } @@ -1300,8 +1305,8 @@ Pattern *TypeChecker::coercePatternToType(ContextualPattern pattern, if (Pattern *sub = IP->getSubPattern()) { sub = coercePatternToType( pattern.forSubPattern(sub, /*retainTopLevel=*/false), - IP->getCastTypeLoc().getType(), - subOptions|TypeResolutionFlags::FromNonInferredPattern); + IP->getCastType(), + subOptions | TypeResolutionFlags::FromNonInferredPattern); if (!sub) return nullptr; @@ -1406,7 +1411,7 @@ Pattern *TypeChecker::coercePatternToType(ContextualPattern pattern, // coercing to. assert(!EEP->getParentType().isNull() && "enum with resolved element doesn't specify parent type?!"); - auto parentTy = EEP->getParentType().getType(); + auto parentTy = EEP->getParentType(); // If the type matches exactly, use it. if (parentTy->isEqual(type)) { enumTy = type; @@ -1520,18 +1525,12 @@ Pattern *TypeChecker::coercePatternToType(ContextualPattern pattern, EEP->setElementDecl(elt); EEP->setType(enumTy); - - // Ensure that the type of our TypeLoc is fully resolved. If an unbound - // generic type was spelled in the source (e.g. `case Optional.None:`) this - // will fill in the generic parameters. - EEP->getParentType().setType(enumTy); - + EEP->setParentType(enumTy); + // If we needed a cast, wrap the pattern in a cast pattern. if (castKind) { - auto isPattern = new (Context) IsPattern(SourceLoc(), - TypeLoc::withoutLoc(enumTy), - EEP, *castKind); - isPattern->setImplicit(); + auto isPattern = + IsPattern::createImplicit(Context, enumTy, EEP, *castKind); isPattern->setType(type); P = isPattern; } diff --git a/lib/Sema/TypeCheckPropertyWrapper.cpp b/lib/Sema/TypeCheckPropertyWrapper.cpp index ff7efa8af8ecb..5c1cdfc6f9987 100644 --- a/lib/Sema/TypeCheckPropertyWrapper.cpp +++ b/lib/Sema/TypeCheckPropertyWrapper.cpp @@ -556,16 +556,15 @@ Type AttachedPropertyWrapperTypeRequest::evaluate(Evaluator &evaluator, if (!customAttr) return Type(); - TypeResolutionOptions options(TypeResolverContext::PatternBindingDecl); - options |= TypeResolutionFlags::AllowUnboundGenerics; - - auto resolution = - TypeResolution::forContextual(var->getDeclContext(), options); - if (TypeChecker::validateType(customAttr->getTypeLoc(), resolution)) { + auto ty = evaluateOrDefault( + evaluator, + CustomAttrTypeRequest{customAttr, var->getDeclContext(), + CustomAttrTypeKind::PropertyDelegate}, + Type()); + if (!ty || ty->hasError()) { return ErrorType::get(var->getASTContext()); } - - return customAttr->getTypeLoc().getType(); + return ty; } Type @@ -720,12 +719,16 @@ Expr *swift::buildPropertyWrapperWrappedValueCall( : var->getAttachedPropertyWrapperType(i); if (!wrapperType) return nullptr; - - auto typeExpr = TypeExpr::createImplicitHack( - wrapperAttrs[i]->getTypeLoc().getLoc(), - wrapperType, ctx); - SourceLoc startLoc = wrapperAttrs[i]->getTypeLoc().getSourceRange().Start; + auto reprRange = SourceRange(); + if (auto *repr = wrapperAttrs[i]->getTypeRepr()) { + reprRange = repr->getSourceRange(); + } + + auto typeExpr = + TypeExpr::createImplicitHack(reprRange.Start, wrapperType, ctx); + + SourceLoc startLoc = reprRange.Start; // If there were no arguments provided for the attribute at this level, // call `init(wrappedValue:)` directly. @@ -745,7 +748,7 @@ Expr *swift::buildPropertyWrapperWrappedValueCall( auto endLoc = initializer->getEndLoc(); if (endLoc.isInvalid() && startLoc.isValid()) - endLoc = wrapperAttrs[i]->getTypeLoc().getSourceRange().End; + endLoc = reprRange.End; auto *init = CallExpr::create(ctx, typeExpr, startLoc, {initializer}, {argName}, @@ -781,7 +784,7 @@ Expr *swift::buildPropertyWrapperWrappedValueCall( auto endLoc = attr->getArg()->getEndLoc(); if (endLoc.isInvalid() && startLoc.isValid()) - endLoc = wrapperAttrs[i]->getTypeLoc().getSourceRange().End; + endLoc = reprRange.End; auto *init = CallExpr::create(ctx, typeExpr, startLoc, elements, elementNames, elementLocs, endLoc, diff --git a/lib/Sema/TypeCheckProtocol.cpp b/lib/Sema/TypeCheckProtocol.cpp index b3b7a9dc8a89c..b9cd51877744e 100644 --- a/lib/Sema/TypeCheckProtocol.cpp +++ b/lib/Sema/TypeCheckProtocol.cpp @@ -1039,7 +1039,7 @@ witnessHasImplementsAttrForExactRequirement(ValueDecl *witness, assert(requirement->isProtocolRequirement()); auto *PD = cast(requirement->getDeclContext()); if (auto A = witness->getAttrs().getAttribute()) { - if (Type T = A->getProtocolType().getType()) { + if (Type T = A->getProtocolType()) { if (auto ProtoTy = T->getAs()) { if (ProtoTy->getDecl() == PD) { return A->getMemberName() == requirement->getName(); diff --git a/lib/Sema/TypeCheckRequestFunctions.cpp b/lib/Sema/TypeCheckRequestFunctions.cpp index bf26315290381..cda70bdc3ee53 100644 --- a/lib/Sema/TypeCheckRequestFunctions.cpp +++ b/lib/Sema/TypeCheckRequestFunctions.cpp @@ -210,45 +210,109 @@ static Type inferFunctionBuilderType(ValueDecl *decl) { lookupDecl = accessor->getStorage(); } - // Determine all of the conformances within the same context as - // this declaration. If this declaration is a witness to any - // requirement within one of those protocols that has a function builder - // attached, use that function builder type. - auto idc = cast(dc->getAsDecl()); - auto conformances = evaluateOrDefault( - dc->getASTContext().evaluator, - LookupAllConformancesInContextRequest{idc}, { }); - // Find all of the potentially inferred function builder types. struct Match { - ProtocolConformance *conformance; - ValueDecl *requirement; + enum Kind { + Conformance, + DynamicReplacement, + } kind; + + union { + struct { + ProtocolConformance *conformance; + ValueDecl *requirement; + } conformanceMatch; + + ValueDecl *dynamicReplacement; + }; + Type functionBuilderType; - }; - SmallVector matches; - for (auto conformance : conformances) { - auto protocol = conformance->getProtocol(); - for (auto found : protocol->lookupDirect(lookupDecl->getName())) { - if (!isa(found->getDeclContext())) - continue; - auto requirement = dyn_cast(found); - if (!requirement) - continue; + static Match forConformance( + ProtocolConformance *conformance, + ValueDecl *requirement, + Type functionBuilderType) { + Match match; + match.kind = Conformance; + match.conformanceMatch.conformance = conformance; + match.conformanceMatch.requirement = requirement; + match.functionBuilderType = functionBuilderType; + return match; + } - Type functionBuilderType = requirement->getFunctionBuilderType(); - if (!functionBuilderType) - continue; + static Match forDynamicReplacement( + ValueDecl *dynamicReplacement, Type functionBuilderType) { + Match match; + match.kind = DynamicReplacement; + match.dynamicReplacement = dynamicReplacement; + match.functionBuilderType = functionBuilderType; + return match; + } - auto witness = conformance->getWitnessDecl(requirement); - if (witness != lookupDecl) - continue; + DeclName getSourceName() const { + switch (kind) { + case Conformance: + return conformanceMatch.conformance->getProtocol()->getName(); - // Substitute into the function builder type. - auto subs = conformance->getSubstitutions(decl->getModuleContext()); - Type subFunctionBuilderType = functionBuilderType.subst(subs); + case DynamicReplacement: + return dynamicReplacement->getName(); + } + } + }; + + // The set of matches from which we can infer function builder types. + SmallVector matches; - matches.push_back({conformance, requirement, subFunctionBuilderType}); + // Determine all of the conformances within the same context as + // this declaration. If this declaration is a witness to any + // requirement within one of those protocols that has a function builder + // attached, use that function builder type. + auto addConformanceMatches = [&matches](ValueDecl *lookupDecl) { + DeclContext *dc = lookupDecl->getDeclContext(); + auto idc = cast(dc->getAsDecl()); + auto conformances = evaluateOrDefault( + dc->getASTContext().evaluator, + LookupAllConformancesInContextRequest{idc}, { }); + + for (auto conformance : conformances) { + auto protocol = conformance->getProtocol(); + for (auto found : protocol->lookupDirect(lookupDecl->getName())) { + if (!isa(found->getDeclContext())) + continue; + + auto requirement = dyn_cast(found); + if (!requirement) + continue; + + Type functionBuilderType = requirement->getFunctionBuilderType(); + if (!functionBuilderType) + continue; + + auto witness = conformance->getWitnessDecl(requirement); + if (witness != lookupDecl) + continue; + + // Substitute into the function builder type. + auto subs = + conformance->getSubstitutions(lookupDecl->getModuleContext()); + Type subFunctionBuilderType = functionBuilderType.subst(subs); + + matches.push_back( + Match::forConformance( + conformance, requirement, subFunctionBuilderType)); + } + } + }; + + addConformanceMatches(lookupDecl); + + // Look for function builder types inferred through dynamic replacements. + if (auto replaced = lookupDecl->getDynamicallyReplacedDecl()) { + if (auto functionBuilderType = replaced->getFunctionBuilderType()) { + matches.push_back( + Match::forDynamicReplacement(replaced, functionBuilderType)); + } else { + addConformanceMatches(replaced); } } @@ -274,7 +338,8 @@ static Type inferFunctionBuilderType(ValueDecl *decl) { decl->diagnose( diag::function_builder_infer_pick_specific, match.functionBuilderType, - match.conformance->getProtocol()->getName()) + static_cast(match.kind), + match.getSourceName()) .fixItInsert( lookupDecl->getAttributeInsertionLoc(false), "@" + match.functionBuilderType.getString() + " "); @@ -297,9 +362,11 @@ Type FunctionBuilderTypeRequest::evaluate(Evaluator &evaluator, auto mutableAttr = const_cast(attr); auto dc = decl->getDeclContext(); auto &ctx = dc->getASTContext(); - Type type = resolveCustomAttrType(mutableAttr, dc, - CustomAttrTypeKind::NonGeneric); - if (!type) return Type(); + Type type = evaluateOrDefault( + evaluator, + CustomAttrTypeRequest{mutableAttr, dc, CustomAttrTypeKind::NonGeneric}, + Type()); + if (!type || type->hasError()) return Type(); auto nominal = type->getAnyNominal(); if (!nominal) { diff --git a/lib/Sema/TypeCheckStmt.cpp b/lib/Sema/TypeCheckStmt.cpp index 696646b17ae28..7151518f44551 100644 --- a/lib/Sema/TypeCheckStmt.cpp +++ b/lib/Sema/TypeCheckStmt.cpp @@ -143,7 +143,7 @@ namespace { // If the closure was type checked within its enclosing context, // we need to walk into it with a new sequence. // Otherwise, it'll have been separately type-checked. - if (CE->wasTypeCheckedInEnclosingContext()) + if (!CE->wasSeparatelyTypeChecked()) CE->getBody()->walk(ContextualizeClosures(CE)); TypeChecker::computeCaptures(CE); @@ -1976,6 +1976,7 @@ bool TypeChecker::typeCheckClosureBody(ClosureExpr *closure) { if (body) { closure->setBody(body, closure->hasSingleExpressionBody()); } + closure->setSeparatelyTypeChecked(); return HadError; } diff --git a/lib/Sema/TypeCheckStorage.cpp b/lib/Sema/TypeCheckStorage.cpp index adc999956ed4e..609c828010faa 100644 --- a/lib/Sema/TypeCheckStorage.cpp +++ b/lib/Sema/TypeCheckStorage.cpp @@ -1043,29 +1043,20 @@ static Expr *synthesizeCopyWithZoneCall(Expr *Val, VarDecl *VD, Call->setType(copyMethodType->getResult()); Call->setThrows(false); - TypeLoc ResultTy; - ResultTy.setType(VD->getType()); - // If we're working with non-optional types, we're forcing the cast. if (!isOptional) { - auto *Cast = - new (Ctx) ForcedCheckedCastExpr(Call, SourceLoc(), SourceLoc(), - TypeLoc::withoutLoc(underlyingType)); + auto *const Cast = + ForcedCheckedCastExpr::createImplicit(Ctx, Call, underlyingType); Cast->setCastKind(CheckedCastKind::ValueCast); - Cast->setType(underlyingType); - Cast->setImplicit(); return Cast; } // We're working with optional types, so perform a conditional checked // downcast. - auto *Cast = - new (Ctx) ConditionalCheckedCastExpr(Call, SourceLoc(), SourceLoc(), - TypeLoc::withoutLoc(underlyingType)); + auto *const Cast = + ConditionalCheckedCastExpr::createImplicit(Ctx, Call, underlyingType); Cast->setCastKind(CheckedCastKind::ValueCast); - Cast->setType(OptionalType::get(underlyingType)); - Cast->setImplicit(); // Use OptionalEvaluationExpr to evaluate the "?". auto *Result = new (Ctx) OptionalEvaluationExpr(Cast); @@ -2082,7 +2073,7 @@ RequiresOpaqueAccessorsRequest::evaluate(Evaluator &evaluator, } else if (dc->isModuleScopeContext()) { // Fixed-layout global variables don't require opaque accessors. - if (!var->isResilient() && !var->isNativeDynamic()) + if (!var->isResilient() && !var->shouldUseNativeDynamicDispatch()) return false; // Stored properties imported from Clang don't require opaque accessors. @@ -2127,7 +2118,7 @@ RequiresOpaqueModifyCoroutineRequest::evaluate(Evaluator &evaluator, // Dynamic storage does not have an opaque modify coroutine. if (dc->getSelfClassDecl()) - if (storage->isObjCDynamic()) + if (storage->shouldUseObjCDispatch()) return false; // Requirements of ObjC protocols don't have an opaque modify coroutine. @@ -2488,7 +2479,11 @@ PropertyWrapperMutabilityRequest::evaluate(Evaluator &, result.Getter = getGetterMutatingness(firstWrapper.*varMember); result.Setter = getSetterMutatingness(firstWrapper.*varMember, var->getInnermostDeclContext()); - + + auto getCustomAttrTypeLoc = [](const CustomAttr *CA) -> TypeLoc { + return { CA->getTypeRepr(), CA->getType() }; + }; + // Compose the traits of the following wrappers. for (unsigned i = 1; i < numWrappers && !isProjectedValue; ++i) { assert(var == originalVar); @@ -2505,8 +2500,8 @@ PropertyWrapperMutabilityRequest::evaluate(Evaluator &, auto &ctx = var->getASTContext(); ctx.Diags.diagnose(var->getAttachedPropertyWrappers()[i]->getLocation(), diag::property_wrapper_mutating_get_composed_to_get_only, - var->getAttachedPropertyWrappers()[i]->getTypeLoc(), - var->getAttachedPropertyWrappers()[i-1]->getTypeLoc()); + getCustomAttrTypeLoc(var->getAttachedPropertyWrappers()[i]), + getCustomAttrTypeLoc(var->getAttachedPropertyWrappers()[i-1])); return None; } @@ -2683,16 +2678,21 @@ PropertyWrapperBackingPropertyInfoRequest::evaluate(Evaluator &evaluator, pbd->setInit(0, initializer); pbd->setInitializerChecked(0); wrappedValue = findWrappedValuePlaceholder(initializer); - } else if (!parentPBD->isInitialized(patternNumber) && - wrapperInfo.defaultInit) { - // FIXME: Record this expression somewhere so that DI can perform the - // initialization itself. - auto typeExpr = TypeExpr::createImplicit(storageType, ctx); - Expr *initializer = CallExpr::createImplicit(ctx, typeExpr, {}, { }); - typeCheckSynthesizedWrapperInitializer(pbd, backingVar, parentPBD, - initializer); - pbd->setInit(0, initializer); - pbd->setInitializerChecked(0); + } else { + if (!parentPBD->isInitialized(patternNumber) && wrapperInfo.defaultInit) { + // FIXME: Record this expression somewhere so that DI can perform the + // initialization itself. + auto typeExpr = TypeExpr::createImplicit(storageType, ctx); + Expr *initializer = CallExpr::createImplicit(ctx, typeExpr, {}, { }); + typeCheckSynthesizedWrapperInitializer(pbd, backingVar, parentPBD, + initializer); + pbd->setInit(0, initializer); + pbd->setInitializerChecked(0); + } + + if (var->getOpaqueResultTypeDecl()) { + var->diagnose(diag::opaque_type_var_no_underlying_type); + } } // If there is a projection property (projectedValue) in the wrapper, diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp index 8c6753d888d95..3f368011f8aa1 100644 --- a/lib/Sema/TypeCheckType.cpp +++ b/lib/Sema/TypeCheckType.cpp @@ -1688,20 +1688,6 @@ static bool validateAutoClosureAttributeUse(DiagnosticEngine &Diags, return !isValid; } -bool TypeChecker::validateType(TypeLoc &Loc, TypeResolution resolution) { - // If we've already validated this type, don't do so again. - if (Loc.wasValidated()) - return Loc.isError(); - - if (auto *Stats = resolution.getASTContext().Stats) - ++Stats->getFrontendCounters().NumTypesValidated; - - auto type = resolution.resolveType(Loc.getTypeRepr()); - Loc.setType(type); - - return type->hasError(); -} - namespace { const auto DefaultParameterConvention = ParameterConvention::Direct_Unowned; const auto DefaultResultConvention = ResultConvention::Unowned; @@ -1997,6 +1983,9 @@ Type TypeResolver::resolveAttributedType(TypeAttributes &attrs, // Remember whether this is a function parameter. bool isParam = options.is(TypeResolverContext::FunctionInput); + // Remember whether this is a function result. + bool isResult = options.is(TypeResolverContext::FunctionResult); + // Remember whether this is a variadic function parameter. bool isVariadicFunctionParam = options.is(TypeResolverContext::VariadicFunctionInput) && @@ -2401,6 +2390,10 @@ Type TypeResolver::resolveAttributedType(TypeAttributes &attrs, } if (attrs.has(TAK_noDerivative)) { + // @noDerivative is only valid on function parameters, or on function + // results in SIL. + bool isNoDerivativeAllowed = + isParam || (isResult && (options & TypeResolutionFlags::SILType)); auto *SF = DC->getParentSourceFile(); if (SF && !isDifferentiableProgrammingEnabled(*SF)) { diagnose( @@ -2408,8 +2401,7 @@ Type TypeResolver::resolveAttributedType(TypeAttributes &attrs, diag::differentiable_programming_attr_used_without_required_module, TypeAttributes::getAttrName(TAK_noDerivative), Context.Id_Differentiation); - } else if (!isParam) { - // @noDerivative is only valid on parameters. + } else if (!isNoDerivativeAllowed) { diagnose(attrs.getLoc(TAK_noDerivative), (isVariadicFunctionParam ? diag::attr_not_on_variadic_parameters @@ -2652,7 +2644,9 @@ Type TypeResolver::resolveASTFunctionType( return Type(); } - Type outputTy = resolveType(repr->getResultTypeRepr(), options); + auto resultOptions = options.withoutContext(); + resultOptions.setContext(TypeResolverContext::FunctionResult); + Type outputTy = resolveType(repr->getResultTypeRepr(), resultOptions); if (!outputTy || outputTy->hasError()) return outputTy; // If this is a function type without parens around the parameter list, @@ -3099,6 +3093,9 @@ bool TypeResolver::resolveSingleSILResult(TypeRepr *repr, Type type; auto convention = DefaultResultConvention; bool isErrorResult = false; + auto differentiability = + SILResultDifferentiability::DifferentiableOrNotApplicable; + options.setContext(TypeResolverContext::FunctionResult); if (auto attrRepr = dyn_cast(repr)) { // Copy the attributes out; we're going to destructively modify them. @@ -3126,6 +3123,12 @@ bool TypeResolver::resolveSingleSILResult(TypeRepr *repr, convention = ResultConvention::Owned; } + // Recognize `@noDerivative`. + if (attrs.has(TAK_noDerivative)) { + attrs.clearAttribute(TAK_noDerivative); + differentiability = SILResultDifferentiability::NotDifferentiable; + } + // Recognize result conventions. bool hadError = false; auto checkFor = [&](TypeAttrKind tak, ResultConvention attrConv) { @@ -3160,7 +3163,8 @@ bool TypeResolver::resolveSingleSILResult(TypeRepr *repr, } assert(!isErrorResult || convention == ResultConvention::Owned); - SILResultInfo resolvedResult(type->getCanonicalType(), convention); + SILResultInfo resolvedResult(type->getCanonicalType(), convention, + differentiability); if (!isErrorResult) { ordinaryResults.push_back(resolvedResult); @@ -3394,7 +3398,7 @@ Type TypeResolver::resolveImplicitlyUnwrappedOptionalType( break; } - if (doDiag) { + if (doDiag && !options.contains(TypeResolutionFlags::SilenceErrors)) { // Prior to Swift 5, we allow 'as T!' and turn it into a disjunction. if (Context.isSwiftVersionAtLeast(5)) { diagnose(repr->getStartLoc(), @@ -3864,8 +3868,9 @@ void TypeChecker::checkUnsupportedProtocolType( visitor.visitRequirements(genericParams->getRequirements()); } -Type swift::resolveCustomAttrType(CustomAttr *attr, DeclContext *dc, - CustomAttrTypeKind typeKind) { +Type CustomAttrTypeRequest::evaluate(Evaluator &eval, CustomAttr *attr, + DeclContext *dc, + CustomAttrTypeKind typeKind) const { TypeResolutionOptions options(TypeResolverContext::PatternBindingDecl); // Property delegates allow their type to be an unbound generic. @@ -3873,15 +3878,13 @@ Type swift::resolveCustomAttrType(CustomAttr *attr, DeclContext *dc, options |= TypeResolutionFlags::AllowUnboundGenerics; ASTContext &ctx = dc->getASTContext(); - auto resolution = TypeResolution::forContextual(dc, options); - if (TypeChecker::validateType(attr->getTypeLoc(), resolution)) - return Type(); + auto type = TypeResolution::forContextual(dc, options) + .resolveType(attr->getTypeRepr()); // We always require the type to resolve to a nominal type. - Type type = attr->getTypeLoc().getType(); if (!type->getAnyNominal()) { assert(ctx.Diags.hadAnyError()); - return Type(); + return ErrorType::get(ctx); } return type; diff --git a/lib/Sema/TypeCheckType.h b/lib/Sema/TypeCheckType.h index 8613818fb17d3..b09e418464c2a 100644 --- a/lib/Sema/TypeCheckType.h +++ b/lib/Sema/TypeCheckType.h @@ -391,21 +391,6 @@ class TypeResolution { bool areSameType(Type type1, Type type2) const; }; -/// Kinds of types for CustomAttr. -enum class CustomAttrTypeKind { - /// The type is required to not be expressed in terms of - /// any contextual type parameters. - NonGeneric, - - /// Property delegates have some funky rules, like allowing - /// unbound generic types. - PropertyDelegate, -}; - -/// Attempt to resolve a concrete type for a custom attribute. -Type resolveCustomAttrType(CustomAttr *attr, DeclContext *dc, - CustomAttrTypeKind typeKind); - } // end namespace swift #endif /* SWIFT_SEMA_TYPE_CHECK_TYPE_H */ diff --git a/lib/Sema/TypeChecker.cpp b/lib/Sema/TypeChecker.cpp index 230adc8ca4e47..c8df3ebd2425a 100644 --- a/lib/Sema/TypeChecker.cpp +++ b/lib/Sema/TypeChecker.cpp @@ -424,7 +424,15 @@ bool swift::performTypeLocChecking(ASTContext &Ctx, TypeLoc &T, Optional suppression; if (!ProduceDiagnostics) suppression.emplace(Ctx.Diags); - return TypeChecker::validateType(T, resolution); + + // If we've already validated this type, don't do so again. + if (T.wasValidated()) { + return T.isError(); + } + + auto type = resolution.resolveType(T.getTypeRepr()); + T.setType(type); + return type->hasError(); } /// Expose TypeChecker's handling of GenericParamList to SIL parsing. diff --git a/lib/Serialization/Deserialization.cpp b/lib/Serialization/Deserialization.cpp index 028919584dfd6..67b5d043a4242 100644 --- a/lib/Serialization/Deserialization.cpp +++ b/lib/Serialization/Deserialization.cpp @@ -4329,9 +4329,8 @@ llvm::Error DeclDeserializer::deserializeDeclAttributes() { } else return deserialized.takeError(); } else { - Attr = CustomAttr::create(ctx, SourceLoc(), - TypeLoc::withoutLoc(deserialized.get()), - isImplicit); + auto *TE = TypeExpr::createImplicit(deserialized.get(), ctx); + Attr = CustomAttr::create(ctx, SourceLoc(), TE, isImplicit); } break; } @@ -4759,6 +4758,21 @@ Optional getActualResultConvention(uint8_t raw) { return None; } +/// Translate from the serialization SILResultDifferentiability enumerators, +/// which are guaranteed to be stable, to the AST ones. +static Optional +getActualSILResultDifferentiability(uint8_t raw) { + switch (serialization::SILResultDifferentiability(raw)) { +#define CASE(ID) \ + case serialization::SILResultDifferentiability::ID: \ + return swift::SILResultDifferentiability::ID; + CASE(DifferentiableOrNotApplicable) + CASE(NotDifferentiable) +#undef CASE + } + return None; +} + Type ModuleFile::getType(TypeID TID) { Expected deserialized = getTypeChecked(TID); if (!deserialized) { @@ -5417,7 +5431,7 @@ class TypeDeserializer { auto processParameter = [&](TypeID typeID, uint64_t rawConvention, - uint64_t ramDifferentiability) -> llvm::Expected { + uint64_t rawDifferentiability) -> llvm::Expected { auto convention = getActualParameterConvention(rawConvention); if (!convention) MF.fatal(); @@ -5428,7 +5442,7 @@ class TypeDeserializer { swift::SILParameterDifferentiability::DifferentiableOrNotApplicable; if (diffKind != DifferentiabilityKind::NonDifferentiable) { auto differentiabilityOpt = - getActualSILParameterDifferentiability(ramDifferentiability); + getActualSILParameterDifferentiability(rawDifferentiability); if (!differentiabilityOpt) MF.fatal(); differentiability = *differentiabilityOpt; @@ -5448,15 +5462,26 @@ class TypeDeserializer { return SILYieldInfo(type.get()->getCanonicalType(), *convention); }; - auto processResult = [&](TypeID typeID, uint64_t rawConvention) - -> llvm::Expected { + auto processResult = + [&](TypeID typeID, uint64_t rawConvention, + uint64_t rawDifferentiability) -> llvm::Expected { auto convention = getActualResultConvention(rawConvention); if (!convention) MF.fatal(); auto type = MF.getTypeChecked(typeID); if (!type) return type.takeError(); - return SILResultInfo(type.get()->getCanonicalType(), *convention); + auto differentiability = + swift::SILResultDifferentiability::DifferentiableOrNotApplicable; + if (diffKind != DifferentiabilityKind::NonDifferentiable) { + auto differentiabilityOpt = + getActualSILResultDifferentiability(rawDifferentiability); + if (!differentiabilityOpt) + MF.fatal(); + differentiability = *differentiabilityOpt; + } + return SILResultInfo(type.get()->getCanonicalType(), *convention, + differentiability); }; // Bounds check. FIXME: overflow @@ -5476,10 +5501,11 @@ class TypeDeserializer { for (unsigned i = 0; i != numParams; ++i) { auto typeID = variableData[nextVariableDataIndex++]; auto rawConvention = variableData[nextVariableDataIndex++]; - uint64_t differentiability = 0; + uint64_t rawDifferentiability = 0; if (diffKind != DifferentiabilityKind::NonDifferentiable) - differentiability = variableData[nextVariableDataIndex++]; - auto param = processParameter(typeID, rawConvention, differentiability); + rawDifferentiability = variableData[nextVariableDataIndex++]; + auto param = + processParameter(typeID, rawConvention, rawDifferentiability); if (!param) return param.takeError(); allParams.push_back(param.get()); @@ -5503,7 +5529,10 @@ class TypeDeserializer { for (unsigned i = 0; i != numResults; ++i) { auto typeID = variableData[nextVariableDataIndex++]; auto rawConvention = variableData[nextVariableDataIndex++]; - auto result = processResult(typeID, rawConvention); + uint64_t rawDifferentiability = 0; + if (diffKind != DifferentiabilityKind::NonDifferentiable) + rawDifferentiability = variableData[nextVariableDataIndex++]; + auto result = processResult(typeID, rawConvention, rawDifferentiability); if (!result) return result.takeError(); allResults.push_back(result.get()); @@ -5514,7 +5543,9 @@ class TypeDeserializer { if (hasErrorResult) { auto typeID = variableData[nextVariableDataIndex++]; auto rawConvention = variableData[nextVariableDataIndex++]; - auto maybeErrorResult = processResult(typeID, rawConvention); + uint64_t rawDifferentiability = 0; + auto maybeErrorResult = + processResult(typeID, rawConvention, rawDifferentiability); if (!maybeErrorResult) return maybeErrorResult.takeError(); errorResult = maybeErrorResult.get(); diff --git a/lib/Serialization/DeserializeSIL.cpp b/lib/Serialization/DeserializeSIL.cpp index a930d24d3d0b7..3d89dad463117 100644 --- a/lib/Serialization/DeserializeSIL.cpp +++ b/lib/Serialization/DeserializeSIL.cpp @@ -1044,8 +1044,8 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn, SILBasicBlock *BB, Builder.setInsertionPoint(BB); Builder.setCurrentDebugScope(Fn->getDebugScope()); unsigned RawOpCode = 0, TyCategory = 0, TyCategory2 = 0, TyCategory3 = 0, - Attr = 0, Attr2 = 0, NumSubs = 0, NumConformances = 0, - IsNonThrowingApply = 0; + Attr = 0, Attr2 = 0, Attr3 = 0, Attr4 = 0, NumSubs = 0, + NumConformances = 0, IsNonThrowingApply = 0; ValueID ValID, ValID2, ValID3; TypeID TyID, TyID2, TyID3; TypeID ConcreteTyID; @@ -1151,14 +1151,15 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn, SILBasicBlock *BB, break; case SIL_INST_DIFFERENTIABLE_FUNCTION: SILInstDifferentiableFunctionLayout::readRecord( - scratch, /*numParams*/ Attr, /*hasDerivativeFunctions*/ Attr2, - ListOfValues); + scratch, /*numParams*/ Attr, /*numResults*/ Attr2, + /*numDiffParams*/ Attr3, + /*hasDerivativeFunctions*/ Attr4, ListOfValues); RawOpCode = (unsigned)SILInstructionKind::DifferentiableFunctionInst; break; case SIL_INST_LINEAR_FUNCTION: - SILInstLinearFunctionLayout::readRecord( - scratch, /*numParams*/ Attr, /*hasTransposeFunction*/ Attr2, - ListOfValues); + SILInstLinearFunctionLayout::readRecord(scratch, /*numDiffParams*/ Attr, + /*hasTransposeFunction*/ Attr2, + ListOfValues); RawOpCode = (unsigned)SILInstructionKind::LinearFunctionInst; break; case SIL_INST_DIFFERENTIABLE_FUNCTION_EXTRACT: @@ -2622,19 +2623,28 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn, SILBasicBlock *BB, break; } case SILInstructionKind::DifferentiableFunctionInst: { - bool hasDerivativeFunctions = (bool)Attr2; + auto numParams = Attr; + auto numResults = Attr2; + auto numParamIndices = Attr3; + bool hasDerivativeFunctions = (bool)Attr4; unsigned numOperands = hasDerivativeFunctions ? 3 : 1; - auto numParamIndices = ListOfValues.size() - numOperands * 3; - assert(ListOfValues.size() == numParamIndices + numOperands * 3); + auto numResultIndices = + ListOfValues.size() - numOperands * 3 - numParamIndices; + assert(ListOfValues.size() == + numParamIndices + numResultIndices + numOperands * 3); auto rawParamIndices = map>(ListOfValues.take_front(numParamIndices), [](uint64_t i) { return (unsigned)i; }); - auto numParams = Attr; auto *paramIndices = IndexSubset::get(MF->getContext(), numParams, rawParamIndices); + auto rawResultIndices = map>( + ListOfValues.slice(numParamIndices, numResultIndices), + [](uint64_t i) { return (unsigned)i; }); + auto *resultIndices = + IndexSubset::get(MF->getContext(), numResults, rawResultIndices); SmallVector operands; - for (auto i = numParamIndices; i < numParamIndices + numOperands * 3; - i += 3) { + for (auto i = numParamIndices + numResultIndices; + i < numParamIndices + numOperands * 3; i += 3) { auto astTy = MF->getType(ListOfValues[i]); auto silTy = getSILType(astTy, (SILValueCategory)ListOfValues[i + 1], Fn); operands.push_back(getLocalValue(ListOfValues[i + 2], silTy)); @@ -2643,10 +2653,11 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn, SILBasicBlock *BB, if (hasDerivativeFunctions) derivativeFunctions = std::make_pair(operands[1], operands[2]); ResultVal = Builder.createDifferentiableFunction( - Loc, paramIndices, operands[0], derivativeFunctions); + Loc, paramIndices, resultIndices, operands[0], derivativeFunctions); break; } case SILInstructionKind::LinearFunctionInst: { + auto numDiffParams = Attr; bool hasLinearFunction = (bool)Attr2; unsigned numOperands = hasLinearFunction ? 2 : 1; auto numParamIndices = ListOfValues.size() - numOperands * 3; @@ -2654,9 +2665,8 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn, SILBasicBlock *BB, auto rawParamIndices = map>(ListOfValues.take_front(numParamIndices), [](uint64_t i) { return (unsigned)i; }); - auto numParams = Attr; auto *paramIndices = - IndexSubset::get(MF->getContext(), numParams, rawParamIndices); + IndexSubset::get(MF->getContext(), numDiffParams, rawParamIndices); SmallVector operands; for (auto i = numParamIndices; i < numParamIndices + numOperands * 3; i += 3) { diff --git a/lib/Serialization/ModuleFile.cpp b/lib/Serialization/ModuleFile.cpp index 524c264c0406f..95f3d883f788d 100644 --- a/lib/Serialization/ModuleFile.cpp +++ b/lib/Serialization/ModuleFile.cpp @@ -152,6 +152,9 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor, case options_block::ARE_PRIVATE_IMPORTS_ENABLED: extendedInfo.setPrivateImportsEnabled(true); break; + case options_block::IS_IMPLICIT_DYNAMIC_ENABLED: + extendedInfo.setImplicitDynamicEnabled(true); + break; case options_block::RESILIENCE_STRATEGY: unsigned Strategy; options_block::ResilienceStrategyLayout::readRecord(scratch, Strategy); diff --git a/lib/Serialization/ModuleFile.h b/lib/Serialization/ModuleFile.h index 9f233aa1f89dc..fcbcda07ac089 100644 --- a/lib/Serialization/ModuleFile.h +++ b/lib/Serialization/ModuleFile.h @@ -20,7 +20,6 @@ #include "swift/AST/FileUnit.h" #include "swift/AST/Module.h" #include "swift/AST/RawComment.h" -#include "swift/AST/TypeLoc.h" #include "swift/Serialization/Validation.h" #include "swift/Basic/LLVM.h" #include "clang/AST/Type.h" diff --git a/lib/Serialization/ModuleFormat.h b/lib/Serialization/ModuleFormat.h index c5ac6129a8889..cef301bc538ca 100644 --- a/lib/Serialization/ModuleFormat.h +++ b/lib/Serialization/ModuleFormat.h @@ -55,7 +55,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0; /// describe what change you made. The content of this comment isn't important; /// it just ensures a conflict if two people change the module format. /// Don't worry about adhering to the 80-column limit for this line. -const uint16_t SWIFTMODULE_VERSION_MINOR = 558; // SILVTable entry kind for non-overridden entries +const uint16_t SWIFTMODULE_VERSION_MINOR = 559; // Serialization of -implicit-dynamic /// A standard hash seed used for all string hashes in a serialized module. /// @@ -356,7 +356,7 @@ using ParameterConventionField = BCFixed<4>; // These IDs must \em not be renumbered or reordered without incrementing // the module version. enum class SILParameterDifferentiability : uint8_t { - DifferentiableOrNotApplicable, + DifferentiableOrNotApplicable = 0, NotDifferentiable, }; @@ -371,6 +371,13 @@ enum class ResultConvention : uint8_t { }; using ResultConventionField = BCFixed<3>; +// These IDs must \em not be renumbered or reordered without incrementing +// the module version. +enum class SILResultDifferentiability : uint8_t { + DifferentiableOrNotApplicable = 0, + NotDifferentiable, +}; + // These IDs must \em not be renumbered or reordered without incrementing // the module version. enum MetatypeRepresentation : uint8_t { @@ -768,7 +775,8 @@ namespace options_block { IS_SIB, IS_TESTABLE, RESILIENCE_STRATEGY, - ARE_PRIVATE_IMPORTS_ENABLED + ARE_PRIVATE_IMPORTS_ENABLED, + IS_IMPLICIT_DYNAMIC_ENABLED }; using SDKPathLayout = BCRecordLayout< @@ -794,6 +802,10 @@ namespace options_block { ARE_PRIVATE_IMPORTS_ENABLED >; + using IsImplicitDynamicEnabledLayout = BCRecordLayout< + IS_IMPLICIT_DYNAMIC_ENABLED + >; + using ResilienceStrategyLayout = BCRecordLayout< RESILIENCE_STRATEGY, BCFixed<2> diff --git a/lib/Serialization/SILFormat.h b/lib/Serialization/SILFormat.h index 154e50886fb63..5cee308de8e30 100644 --- a/lib/Serialization/SILFormat.h +++ b/lib/Serialization/SILFormat.h @@ -456,6 +456,8 @@ namespace sil_block { using SILInstDifferentiableFunctionLayout = BCRecordLayout< SIL_INST_DIFFERENTIABLE_FUNCTION, BCVBR<8>, // number of function parameters + BCVBR<8>, // number of function results + BCVBR<8>, // number of differentiability parameters BCFixed<1>, // has derivative functions? BCArray // parameter indices and operands >; diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index 445399bc36c90..2920b29971e44 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -903,6 +903,11 @@ void Serializer::writeHeader(const SerializationOptions &options) { PrivateImports.emit(ScratchRecord); } + if (M->isImplicitDynamicEnabled()) { + options_block::IsImplicitDynamicEnabledLayout ImplicitDynamic(Out); + ImplicitDynamic.emit(ScratchRecord); + } + if (M->getResilienceStrategy() != ResilienceStrategy::Default) { options_block::ResilienceStrategyLayout Strategy(Out); Strategy.emit(ScratchRecord, unsigned(M->getResilienceStrategy())); @@ -2383,9 +2388,9 @@ class Serializer::DeclSerializer : public DeclVisitor { case DAK_Custom: { auto abbrCode = S.DeclTypeAbbrCodes[CustomDeclAttrLayout::Code]; auto theAttr = cast(DA); - CustomDeclAttrLayout::emitRecord( - S.Out, S.ScratchRecord, abbrCode, theAttr->isImplicit(), - S.addTypeRef(theAttr->getTypeLoc().getType())); + CustomDeclAttrLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode, + theAttr->isImplicit(), + S.addTypeRef(theAttr->getType())); return; } @@ -2792,7 +2797,7 @@ class Serializer::DeclSerializer : public DeclVisitor { // its overrides after they've been compiled: if the declaration is '@objc' // and 'dynamic'. In that case, all accesses to the method or property will // go through the Objective-C method tables anyway. - if (overridden->hasClangNode() || overridden->isObjCDynamic()) + if (overridden->hasClangNode() || overridden->shouldUseObjCDispatch()) return false; return true; } @@ -3862,6 +3867,17 @@ static uint8_t getRawStableResultConvention(swift::ResultConvention rc) { llvm_unreachable("bad result convention kind"); } +/// Translate from AST SILResultDifferentiability enum to the Serialization enum +/// values, which are guaranteed to be stable. +static uint8_t +getRawSILResultDifferentiability(swift::SILResultDifferentiability pd) { + switch (pd) { + SIMPLE_CASE(SILResultDifferentiability, DifferentiableOrNotApplicable) + SIMPLE_CASE(SILResultDifferentiability, NotDifferentiable) + } + llvm_unreachable("bad result differentiability kind"); +} + #undef SIMPLE_CASE /// Find the typealias given a builtin type. @@ -4174,6 +4190,9 @@ class Serializer::TypeSerializer : public TypeVisitor { variableData.push_back(S.addTypeRef(result.getInterfaceType())); unsigned conv = getRawStableResultConvention(result.getConvention()); variableData.push_back(TypeID(conv)); + if (fnTy->isDifferentiable()) + variableData.push_back(TypeID( + getRawSILResultDifferentiability(result.getDifferentiability()))); } if (fnTy->hasErrorResult()) { auto abResult = fnTy->getErrorResult(); diff --git a/lib/Serialization/SerializeSIL.cpp b/lib/Serialization/SerializeSIL.cpp index 5c2da231e1263..8eeaff83c2aff 100644 --- a/lib/Serialization/SerializeSIL.cpp +++ b/lib/Serialization/SerializeSIL.cpp @@ -2166,8 +2166,11 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) { auto *dfi = cast(&SI); SmallVector trailingInfo; auto *paramIndices = dfi->getParameterIndices(); - for (unsigned idx : paramIndices->getIndices()) - trailingInfo.push_back(idx); + for (unsigned i : paramIndices->getIndices()) + trailingInfo.push_back(i); + auto *resultIndices = dfi->getResultIndices(); + for (unsigned i : resultIndices->getIndices()) + trailingInfo.push_back(i); for (auto &op : dfi->getAllOperands()) { auto val = op.get(); trailingInfo.push_back(S.addTypeRef(val->getType().getASTType())); @@ -2177,7 +2180,8 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) { SILInstDifferentiableFunctionLayout::emitRecord( Out, ScratchRecord, SILAbbrCodes[SILInstDifferentiableFunctionLayout::Code], - paramIndices->getCapacity(), dfi->hasDerivativeFunctions(), + paramIndices->getCapacity(), resultIndices->getCapacity(), + paramIndices->getNumIndices(), dfi->hasDerivativeFunctions(), trailingInfo); break; } @@ -2655,10 +2659,10 @@ void SILSerializer::writeSILBlock(const SILModule *SILMod) { // Go through all SILVTables in SILMod and write them if we should // serialize everything. // FIXME: Resilience: could write out vtable for fragile classes. - for (const SILVTable &vt : SILMod->getVTables()) { - if ((ShouldSerializeAll || vt.isSerialized()) && - SILMod->shouldSerializeEntitiesAssociatedWithDeclContext(vt.getClass())) - writeSILVTable(vt); + for (const auto &vt : SILMod->getVTables()) { + if ((ShouldSerializeAll || vt->isSerialized()) && + SILMod->shouldSerializeEntitiesAssociatedWithDeclContext(vt->getClass())) + writeSILVTable(*vt); } // Write out property descriptors. diff --git a/lib/Serialization/SerializedModuleLoader.cpp b/lib/Serialization/SerializedModuleLoader.cpp index 6a8c3be82b06b..8120f5d33cffa 100644 --- a/lib/Serialization/SerializedModuleLoader.cpp +++ b/lib/Serialization/SerializedModuleLoader.cpp @@ -690,6 +690,8 @@ FileUnit *SerializedModuleLoaderBase::loadAST( M.setTestingEnabled(); if (extendedInfo.arePrivateImportsEnabled()) M.setPrivateImportsEnabled(); + if (extendedInfo.isImplicitDynamicEnabled()) + M.setImplicitDynamicEnabled(); auto diagLocOrInvalid = diagLoc.getValueOr(SourceLoc()); loadInfo.status = diff --git a/lib/SymbolGraphGen/DeclarationFragmentPrinter.cpp b/lib/SymbolGraphGen/DeclarationFragmentPrinter.cpp index 36a40a8c174ca..4ef5f70b5ab4b 100644 --- a/lib/SymbolGraphGen/DeclarationFragmentPrinter.cpp +++ b/lib/SymbolGraphGen/DeclarationFragmentPrinter.cpp @@ -137,8 +137,11 @@ void DeclarationFragmentPrinter::printTypeRef(Type T, const TypeDecl *RefTo, PrintNameContext NameContext) { openFragment(FragmentKind::TypeIdentifier); printText(Name.str()); - llvm::raw_svector_ostream OS(USR); - ide::printDeclUSR(RefTo, OS); + USR.clear(); + if (Name.str() != "Self") { + llvm::raw_svector_ostream OS(USR); + ide::printDeclUSR(RefTo, OS); + } closeFragment(); } diff --git a/lib/SymbolGraphGen/Symbol.cpp b/lib/SymbolGraphGen/Symbol.cpp index 94d3c5bdb2801..96efe87adb5f8 100644 --- a/lib/SymbolGraphGen/Symbol.cpp +++ b/lib/SymbolGraphGen/Symbol.cpp @@ -125,8 +125,22 @@ void Symbol::serializeNames(llvm::json::OStream &OS) const { OS.attributeObject("names", [&](){ SmallVector, 8> PathComponents; getPathComponents(PathComponents); - - OS.attribute("title", PathComponents.back()); + + if (isa(VD)) { + SmallString<64> FullyQualifiedTitle; + + for (const auto *It = PathComponents.begin(); It != PathComponents.end(); ++It) { + if (It != PathComponents.begin()) { + FullyQualifiedTitle.push_back('.'); + } + FullyQualifiedTitle.append(*It); + } + + OS.attribute("title", FullyQualifiedTitle.str()); + } else { + OS.attribute("title", PathComponents.back()); + } + Graph->serializeNavigatorDeclarationFragments("navigator", *this, OS); Graph->serializeSubheadingDeclarationFragments("subHeading", *this, OS); // "prose": null diff --git a/lib/SymbolGraphGen/SymbolGraph.cpp b/lib/SymbolGraphGen/SymbolGraph.cpp index 44aee2e537f49..8ef75088237b8 100644 --- a/lib/SymbolGraphGen/SymbolGraph.cpp +++ b/lib/SymbolGraphGen/SymbolGraph.cpp @@ -52,7 +52,7 @@ PrintOptions SymbolGraph::getDeclarationFragmentsPrintOptions() const { Opts.PrintPropertyAccessors = true; Opts.PrintSubscriptAccessors = true; Opts.SkipUnderscoredKeywords = true; - Opts.SkipAttributes = true; + Opts.SkipAttributes = false; Opts.PrintOverrideKeyword = true; Opts.PrintImplicitAttrs = false; Opts.PrintFunctionRepresentationAttrs = @@ -61,13 +61,39 @@ PrintOptions SymbolGraph::getDeclarationFragmentsPrintOptions() const { Opts.SkipPrivateStdlibDecls = true; Opts.SkipUnderscoredStdlibProtocols = true; Opts.PrintGenericRequirements = true; + Opts.PrintInherited = false; Opts.ExclusiveAttrList.clear(); -#define DECL_ATTR(SPELLING, CLASS, OPTIONS, CODE) Opts.ExcludeAttrList.push_back(DAK_##CLASS); -#define TYPE_ATTR(X) Opts.ExcludeAttrList.push_back(TAK_##X); + llvm::StringMap ExcludeAttrs; + +#define DECL_ATTR(SPELLING, CLASS, OPTIONS, CODE) \ + if (StringRef(#SPELLING).startswith("_")) \ + ExcludeAttrs.insert(std::make_pair("DAK_" #CLASS, DAK_##CLASS)); +#define TYPE_ATTR(X) ExcludeAttrs.insert(std::make_pair("TAK_" #X, TAK_##X)); #include "swift/AST/Attr.def" + // Allow the following type attributes: + ExcludeAttrs.erase("TAK_autoclosure"); + ExcludeAttrs.erase("TAK_convention"); + ExcludeAttrs.erase("TAK_noescape"); + ExcludeAttrs.erase("TAK_escaping"); + ExcludeAttrs.erase("TAK_inout"); + + // Don't allow the following decl attributes: + // These can be large and are already included elsewhere in + // symbol graphs. + ExcludeAttrs.insert(std::make_pair("DAK_Available", DAK_Available)); + ExcludeAttrs.insert(std::make_pair("DAK_Inline", DAK_Inline)); + ExcludeAttrs.insert(std::make_pair("DAK_Inlinable", DAK_Inlinable)); + ExcludeAttrs.insert(std::make_pair("DAK_Prefix", DAK_Prefix)); + ExcludeAttrs.insert(std::make_pair("DAK_Postfix", DAK_Postfix)); + ExcludeAttrs.insert(std::make_pair("DAK_Infix", DAK_Infix)); + + for (const auto &Entry : ExcludeAttrs) { + Opts.ExcludeAttrList.push_back(Entry.getValue()); + } + return Opts; } @@ -86,11 +112,25 @@ SymbolGraph::getSubHeadingDeclarationFragmentsPrintOptions() const { Options.PrintSubscriptAccessors = false; //--------------------------------------------------------------------------// + Options.SkipAttributes = true; Options.VarInitializers = false; Options.PrintDefaultArgumentValue = false; Options.PrintEmptyArgumentNames = false; Options.PrintOverrideKeyword = false; Options.PrintGenericRequirements = false; + + #define DECL_ATTR(SPELLING, CLASS, OPTIONS, CODE) \ + Options.ExcludeAttrList.push_back(DAK_##CLASS); + #define TYPE_ATTR(X) \ + Options.ExcludeAttrList.push_back(TAK_##X); + #include "swift/AST/Attr.def" + + // Don't include these attributes in subheadings. + Options.ExcludeAttrList.push_back(DAK_Final); + Options.ExcludeAttrList.push_back(DAK_Mutating); + Options.ExcludeAttrList.push_back(DAK_NonMutating); + Options.ExcludeAttrList.push_back(TAK_escaping); + return Options; } diff --git a/lib/SymbolGraphGen/SymbolGraph.h b/lib/SymbolGraphGen/SymbolGraph.h index d3eb00539b597..e7d48fdf86309 100644 --- a/lib/SymbolGraphGen/SymbolGraph.h +++ b/lib/SymbolGraphGen/SymbolGraph.h @@ -226,6 +226,11 @@ struct SymbolGraph { /// Returns `true` if the declaration is a requirement of a protocol /// or is a default implementation of a protocol bool isRequirementOrDefaultImplementation(const ValueDecl *VD) const; + + /// Returns `true` if there are no nodes or edges in this graph. + bool empty() const { + return Nodes.empty() && Edges.empty(); + } }; } // end namespace symbolgraphgen diff --git a/lib/SymbolGraphGen/SymbolGraphGen.cpp b/lib/SymbolGraphGen/SymbolGraphGen.cpp index ba0996368455b..23be449aa796b 100644 --- a/lib/SymbolGraphGen/SymbolGraphGen.cpp +++ b/lib/SymbolGraphGen/SymbolGraphGen.cpp @@ -74,6 +74,9 @@ symbolgraphgen::emitSymbolGraphForModule(ModuleDecl *M, Success |= serializeSymbolGraph(Walker.MainGraph, Options); for (const auto &Entry : Walker.ExtendedModuleGraphs) { + if (Entry.getValue()->empty()) { + continue; + } Success |= serializeSymbolGraph(*Entry.getValue(), Options); } diff --git a/lib/SyntaxParse/SyntaxTreeCreator.cpp b/lib/SyntaxParse/SyntaxTreeCreator.cpp index 04ae25f660963..c5ed16ee76407 100644 --- a/lib/SyntaxParse/SyntaxTreeCreator.cpp +++ b/lib/SyntaxParse/SyntaxTreeCreator.cpp @@ -93,18 +93,20 @@ class SyntaxVerifier: public SyntaxVisitor { }; } // anonymous namespace -void SyntaxTreeCreator::acceptSyntaxRoot(OpaqueSyntaxNode rootN, - SourceFile &SF) { +Optional +SyntaxTreeCreator::realizeSyntaxRoot(OpaqueSyntaxNode rootN, + const SourceFile &SF) { auto raw = transferOpaqueNode(rootN); - SF.setSyntaxRoot(make(raw)); + auto rootNode = make(raw); // Verify the tree if specified. if (SF.getASTContext().LangOpts.VerifySyntaxTree) { ASTContext &ctx = SF.getASTContext(); SyntaxVerifier Verifier(ctx.SourceMgr, SF.getBufferID().getValue(), ctx.Diags); - Verifier.verify(SF.getSyntaxRoot()); + Verifier.verify(rootNode); } + return rootNode; } OpaqueSyntaxNode diff --git a/lib/TBDGen/TBDGen.cpp b/lib/TBDGen/TBDGen.cpp index 5ffd59ec41290..4967d90799466 100644 --- a/lib/TBDGen/TBDGen.cpp +++ b/lib/TBDGen/TBDGen.cpp @@ -637,7 +637,7 @@ void TBDGenVisitor::visitAbstractFunctionDecl(AbstractFunctionDecl *AFD) { addSymbol(SILDeclRef(AFD)); // Add the global function pointer for a dynamically replaceable function. - if (AFD->isNativeDynamic()) { + if (AFD->shouldUseNativeMethodReplacement()) { bool useAllocator = shouldUseAllocatorMangling(AFD); addSymbol(LinkEntity::forDynamicallyReplaceableFunctionVariable( AFD, useAllocator)); @@ -682,7 +682,7 @@ void TBDGenVisitor::visitFuncDecl(FuncDecl *FD) { if (auto opaqueResult = FD->getOpaqueResultTypeDecl()) { addSymbol(LinkEntity::forOpaqueTypeDescriptor(opaqueResult)); assert(opaqueResult->getNamingDecl() == FD); - if (FD->isNativeDynamic()) { + if (FD->shouldUseNativeDynamicDispatch()) { addSymbol(LinkEntity::forOpaqueTypeDescriptorAccessor(opaqueResult)); addSymbol(LinkEntity::forOpaqueTypeDescriptorAccessorImpl(opaqueResult)); addSymbol(LinkEntity::forOpaqueTypeDescriptorAccessorKey(opaqueResult)); diff --git a/stdlib/include/llvm/Support/SwapByteOrder.h b/stdlib/include/llvm/Support/SwapByteOrder.h index 890cb4690596b..19c600a896471 100644 --- a/stdlib/include/llvm/Support/SwapByteOrder.h +++ b/stdlib/include/llvm/Support/SwapByteOrder.h @@ -21,7 +21,7 @@ #include #endif -#if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__) +#if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__) || defined(__wasi__) #include #elif defined(_AIX) #include diff --git a/stdlib/private/StdlibUnittest/StdlibUnittest.swift b/stdlib/private/StdlibUnittest/StdlibUnittest.swift index 5804c98019e04..cbb62fd096fbc 100644 --- a/stdlib/private/StdlibUnittest/StdlibUnittest.swift +++ b/stdlib/private/StdlibUnittest/StdlibUnittest.swift @@ -1879,6 +1879,7 @@ public enum TestRunPredicate : CustomStringConvertible { case iOSAny(/*reason:*/ String) case iOSMajor(Int, reason: String) + case iOSMajorRange(ClosedRange, reason: String) case iOSMinor(Int, Int, reason: String) case iOSMinorRange(Int, ClosedRange, reason: String) case iOSBugFix(Int, Int, Int, reason: String) @@ -1888,6 +1889,7 @@ public enum TestRunPredicate : CustomStringConvertible { case tvOSAny(/*reason:*/ String) case tvOSMajor(Int, reason: String) + case tvOSMajorRange(ClosedRange, reason: String) case tvOSMinor(Int, Int, reason: String) case tvOSMinorRange(Int, ClosedRange, reason: String) case tvOSBugFix(Int, Int, Int, reason: String) @@ -1897,6 +1899,7 @@ public enum TestRunPredicate : CustomStringConvertible { case watchOSAny(/*reason:*/ String) case watchOSMajor(Int, reason: String) + case watchOSMajorRange(ClosedRange, reason: String) case watchOSMinor(Int, Int, reason: String) case watchOSMinorRange(Int, ClosedRange, reason: String) case watchOSBugFix(Int, Int, Int, reason: String) @@ -1948,6 +1951,8 @@ public enum TestRunPredicate : CustomStringConvertible { return "iOS(*, reason: \(reason))" case .iOSMajor(let major, let reason): return "iOS(\(major).*, reason: \(reason))" + case .iOSMajorRange(let range, let reason): + return "iOS([\(range)], reason: \(reason))" case .iOSMinor(let major, let minor, let reason): return "iOS(\(major).\(minor), reason: \(reason))" case .iOSMinorRange(let major, let minorRange, let reason): @@ -1964,6 +1969,8 @@ public enum TestRunPredicate : CustomStringConvertible { return "tvOS(*, reason: \(reason))" case .tvOSMajor(let major, let reason): return "tvOS(\(major).*, reason: \(reason))" + case .tvOSMajorRange(let range, let reason): + return "tvOS([\(range)], reason: \(reason))" case .tvOSMinor(let major, let minor, let reason): return "tvOS(\(major).\(minor), reason: \(reason))" case .tvOSMinorRange(let major, let minorRange, let reason): @@ -1980,6 +1987,8 @@ public enum TestRunPredicate : CustomStringConvertible { return "watchOS(*, reason: \(reason))" case .watchOSMajor(let major, let reason): return "watchOS(\(major).*, reason: \(reason))" + case .watchOSMajorRange(let range, let reason): + return "watchOS([\(range)], reason: \(reason))" case .watchOSMinor(let major, let minor, let reason): return "watchOS(\(major).\(minor), reason: \(reason))" case .watchOSMinorRange(let major, let minorRange, let reason): @@ -2094,6 +2103,14 @@ public enum TestRunPredicate : CustomStringConvertible { return false } + case .iOSMajorRange(let range, _): + switch _getRunningOSVersion() { + case .iOS(let major, _, _): + return range.contains(major) + default: + return false + } + case .iOSMinor(let major, let minor, _): switch _getRunningOSVersion() { case .iOS(major, minor, _): @@ -2150,6 +2167,14 @@ public enum TestRunPredicate : CustomStringConvertible { return false } + case .tvOSMajorRange(let range, _): + switch _getRunningOSVersion() { + case .tvOS(let major, _, _): + return range.contains(major) + default: + return false + } + case .tvOSMinor(let major, let minor, _): switch _getRunningOSVersion() { case .tvOS(major, minor, _): @@ -2206,6 +2231,14 @@ public enum TestRunPredicate : CustomStringConvertible { return false } + case .watchOSMajorRange(let range, _): + switch _getRunningOSVersion() { + case .watchOS(let major, _, _): + return range.contains(major) + default: + return false + } + case .watchOSMinor(let major, let minor, _): switch _getRunningOSVersion() { case .watchOS(major, minor, _): diff --git a/stdlib/public/SwiftShims/RefCount.h b/stdlib/public/SwiftShims/RefCount.h index 3b396cff9edc8..50bdb99695f25 100644 --- a/stdlib/public/SwiftShims/RefCount.h +++ b/stdlib/public/SwiftShims/RefCount.h @@ -1271,6 +1271,11 @@ class RefCounts { // Note that this is not equal to the number of outstanding weak pointers. uint32_t getWeakCount() const; +#ifndef NDEBUG + bool isImmutableCOWBuffer(); + bool setIsImmutableCOWBuffer(bool immutable); +#endif + // DO NOT TOUCH. // This exists for the benefits of the Refcounting.cpp tests. Do not use it // elsewhere. @@ -1301,6 +1306,11 @@ class HeapObjectSideTableEntry { std::atomic object; SideTableRefCounts refCounts; +#ifndef NDEBUG + // Used for runtime consistency checking of COW buffers. + bool immutableCOWBuffer = false; +#endif + public: HeapObjectSideTableEntry(HeapObject *newObject) : object(newObject), refCounts() @@ -1455,6 +1465,16 @@ class HeapObjectSideTableEntry { void *getSideTable() { return refCounts.getSideTable(); } + +#ifndef NDEBUG + bool isImmutableCOWBuffer() const { + return immutableCOWBuffer; + } + + void setIsImmutableCOWBuffer(bool immutable) { + immutableCOWBuffer = immutable; + } +#endif }; diff --git a/stdlib/public/core/Array.swift b/stdlib/public/core/Array.swift index bb7c72cd474a8..fd72700ca95b8 100644 --- a/stdlib/public/core/Array.swift +++ b/stdlib/public/core/Array.swift @@ -333,25 +333,38 @@ extension Array { @inlinable @_semantics("array.get_count") internal func _getCount() -> Int { - return _buffer.count + return _buffer.immutableCount } @inlinable @_semantics("array.get_capacity") internal func _getCapacity() -> Int { - return _buffer.capacity + return _buffer.immutableCapacity } @inlinable @_semantics("array.make_mutable") internal mutating func _makeMutableAndUnique() { - if _slowPath(!_buffer.isMutableAndUniquelyReferenced()) { + if _slowPath(!_buffer.beginCOWMutation()) { _buffer = _buffer._consumeAndCreateNew() } } + /// Marks the end of an Array mutation. + /// + /// After a call to `_endMutation` the buffer must not be mutated until a call + /// to `_makeMutableAndUnique`. + @_alwaysEmitIntoClient + @_semantics("array.end_mutation") + internal mutating func _endMutation() { + _buffer.endCOWMutation() + } + /// Check that the given `index` is valid for subscripting, i.e. /// `0 ≤ index < count`. + /// + /// This function is not used anymore, but must stay in the library for ABI + /// compatibility. @inlinable @inline(__always) internal func _checkSubscript_native(_ index: Int) { @@ -375,6 +388,16 @@ extension Array { return _DependenceToken() } + /// Check that the given `index` is valid for subscripting, i.e. + /// `0 ≤ index < count`. + /// + /// - Precondition: The buffer must be uniquely referenced and native. + @_alwaysEmitIntoClient + @_semantics("array.check_subscript") + internal func _checkSubscript_mutating(_ index: Int) { + _buffer._checkValidSubscriptMutating(index) + } + /// Check that the specified `index` is valid, i.e. `0 ≤ index ≤ count`. @inlinable @_semantics("array.check_index") @@ -402,7 +425,7 @@ extension Array { @inlinable @_semantics("array.get_element_address") internal func _getElementAddress(_ index: Int) -> UnsafeMutablePointer { - return _buffer.subscriptBaseAddress + index + return _buffer.firstElementAddress + index } } @@ -711,9 +734,10 @@ extension Array: RandomAccessCollection, MutableCollection { } _modify { _makeMutableAndUnique() // makes the array native, too - _checkSubscript_native(index) - let address = _buffer.subscriptBaseAddress + index + _checkSubscript_mutating(index) + let address = _buffer.mutableFirstElementAddress + index yield &address.pointee + _endMutation(); } } @@ -872,6 +896,7 @@ extension Array: RangeReplaceableCollection { p.initialize(to: repeatedValue) p += 1 } + _endMutation() } @inline(never) @@ -896,7 +921,7 @@ extension Array: RangeReplaceableCollection { // unnecessary uniqueness check. We disable inlining here to curb code // growth. _buffer = Array._allocateBufferUninitialized(minimumCapacity: count) - _buffer.count = count + _buffer.mutableCount = count } // Can't store count here because the buffer might be pointing to the // shared empty array. @@ -941,7 +966,7 @@ extension Array: RangeReplaceableCollection { internal mutating func _deallocateUninitialized() { // Set the count to zero and just release as normal. // Somewhat of a hack. - _buffer.count = 0 + _buffer.mutableCount = 0 } //===--- basic mutations ------------------------------------------------===// @@ -1019,6 +1044,7 @@ extension Array: RangeReplaceableCollection { public mutating func reserveCapacity(_ minimumCapacity: Int) { _reserveCapacityImpl(minimumCapacity: minimumCapacity, growForAppend: false) + _endMutation() } /// Reserves enough space to store `minimumCapacity` elements. @@ -1029,14 +1055,15 @@ extension Array: RangeReplaceableCollection { internal mutating func _reserveCapacityImpl( minimumCapacity: Int, growForAppend: Bool ) { - let isUnique = _buffer.isUniquelyReferenced() - if _slowPath(!isUnique || _getCapacity() < minimumCapacity) { + let isUnique = _buffer.beginCOWMutation() + if _slowPath(!isUnique || _buffer.mutableCapacity < minimumCapacity) { _createNewBuffer(bufferIsUnique: isUnique, - minimumCapacity: Swift.max(minimumCapacity, count), + minimumCapacity: Swift.max(minimumCapacity, _buffer.count), growForAppend: growForAppend) } - _internalInvariant(capacity >= minimumCapacity) - _internalInvariant(capacity == 0 || _buffer.isUniquelyReferenced()) + _internalInvariant(_buffer.mutableCapacity >= minimumCapacity) + _internalInvariant(_buffer.mutableCapacity == 0 || + _buffer.isUniquelyReferenced()) } /// Creates a new buffer, replacing the current buffer. @@ -1072,7 +1099,7 @@ extension Array: RangeReplaceableCollection { @inlinable @_semantics("array.make_mutable") internal mutating func _makeUniqueAndReserveCapacityIfNotUnique() { - if _slowPath(!_buffer.isMutableAndUniquelyReferenced()) { + if _slowPath(!_buffer.beginCOWMutation()) { _createNewBuffer(bufferIsUnique: false, minimumCapacity: count + 1, growForAppend: true) @@ -1082,15 +1109,6 @@ extension Array: RangeReplaceableCollection { @inlinable @_semantics("array.mutate_unknown") internal mutating func _reserveCapacityAssumingUniqueBuffer(oldCount: Int) { - // This is a performance optimization. This code used to be in an || - // statement in the _internalInvariant below. - // - // _internalInvariant(_buffer.capacity == 0 || - // _buffer.isMutableAndUniquelyReferenced()) - // - // SR-6437 - let capacity = _buffer.capacity == 0 - // Due to make_mutable hoisting the situation can arise where we hoist // _makeMutableAndUnique out of loop and use it to replace // _makeUniqueAndReserveCapacityIfNotUnique that preceeds this call. If the @@ -1100,11 +1118,11 @@ extension Array: RangeReplaceableCollection { // This specific case is okay because we will make the buffer unique in this // function because we request a capacity > 0 and therefore _copyToNewBuffer // will be called creating a new buffer. - _internalInvariant(capacity || - _buffer.isMutableAndUniquelyReferenced()) + let capacity = _buffer.mutableCapacity + _internalInvariant(capacity == 0 || _buffer.isMutableAndUniquelyReferenced()) - if _slowPath(oldCount + 1 > _buffer.capacity) { - _createNewBuffer(bufferIsUnique: true, + if _slowPath(oldCount + 1 > capacity) { + _createNewBuffer(bufferIsUnique: capacity > 0, minimumCapacity: oldCount + 1, growForAppend: true) } @@ -1117,10 +1135,10 @@ extension Array: RangeReplaceableCollection { newElement: __owned Element ) { _internalInvariant(_buffer.isMutableAndUniquelyReferenced()) - _internalInvariant(_buffer.capacity >= _buffer.count + 1) + _internalInvariant(_buffer.mutableCapacity >= _buffer.mutableCount + 1) - _buffer.count = oldCount + 1 - (_buffer.firstElementAddress + oldCount).initialize(to: newElement) + _buffer.mutableCount = oldCount + 1 + (_buffer.mutableFirstElementAddress + oldCount).initialize(to: newElement) } /// Adds a new element at the end of the array. @@ -1150,9 +1168,10 @@ extension Array: RangeReplaceableCollection { // Separating uniqueness check and capacity check allows hoisting the // uniqueness check out of a loop. _makeUniqueAndReserveCapacityIfNotUnique() - let oldCount = _getCount() + let oldCount = _buffer.mutableCount _reserveCapacityAssumingUniqueBuffer(oldCount: oldCount) _appendElementAssumeUniqueAndCapacity(oldCount, newElement: newElement) + _endMutation() } /// Adds the elements of a sequence to the end of the array. @@ -1176,14 +1195,19 @@ extension Array: RangeReplaceableCollection { public mutating func append(contentsOf newElements: __owned S) where S.Element == Element { + defer { + _endMutation() + } + let newElementsCount = newElements.underestimatedCount - reserveCapacityForAppend(newElementsCount: newElementsCount) + _reserveCapacityImpl(minimumCapacity: self.count + newElementsCount, + growForAppend: true) - let oldCount = self.count - let startNewElements = _buffer.firstElementAddress + oldCount + let oldCount = _buffer.mutableCount + let startNewElements = _buffer.mutableFirstElementAddress + oldCount let buf = UnsafeMutableBufferPointer( start: startNewElements, - count: self.capacity - oldCount) + count: _buffer.mutableCapacity - oldCount) var (remainder,writtenUpTo) = buf.initialize(from: newElements) @@ -1195,7 +1219,7 @@ extension Array: RangeReplaceableCollection { // This check prevents a data race writing to _swiftEmptyArrayStorage if writtenCount > 0 { - _buffer.count += writtenCount + _buffer.mutableCount = _buffer.mutableCount + writtenCount } if _slowPath(writtenUpTo == buf.endIndex) { @@ -1212,13 +1236,13 @@ extension Array: RangeReplaceableCollection { // there may be elements that didn't fit in the existing buffer, // append them in slow sequence-only mode - var newCount = _getCount() + var newCount = _buffer.mutableCount var nextItem = remainder.next() while nextItem != nil { - reserveCapacityForAppend(newElementsCount: 1) + _reserveCapacityAssumingUniqueBuffer(oldCount: newCount) - let currentCapacity = _getCapacity() - let base = _buffer.firstElementAddress + let currentCapacity = _buffer.mutableCapacity + let base = _buffer.mutableFirstElementAddress // fill while there is another item and spare capacity while let next = nextItem, newCount < currentCapacity { @@ -1226,7 +1250,7 @@ extension Array: RangeReplaceableCollection { newCount += 1 nextItem = remainder.next() } - _buffer.count = newCount + _buffer.mutableCount = newCount } } } @@ -1238,17 +1262,19 @@ extension Array: RangeReplaceableCollection { // for consistency, we need unique self even if newElements is empty. _reserveCapacityImpl(minimumCapacity: self.count + newElementsCount, growForAppend: true) + _endMutation() } @inlinable @_semantics("array.mutate_unknown") public mutating func _customRemoveLast() -> Element? { _makeMutableAndUnique() - let newCount = _getCount() - 1 + let newCount = _buffer.mutableCount - 1 _precondition(newCount >= 0, "Can't removeLast from an empty Array") - let pointer = (_buffer.firstElementAddress + newCount) + let pointer = (_buffer.mutableFirstElementAddress + newCount) let element = pointer.move() - _buffer.count = newCount + _buffer.mutableCount = newCount + _endMutation() return element } @@ -1272,14 +1298,15 @@ extension Array: RangeReplaceableCollection { @_semantics("array.mutate_unknown") public mutating func remove(at index: Int) -> Element { _makeMutableAndUnique() - let currentCount = _getCount() + let currentCount = _buffer.mutableCount _precondition(index < currentCount, "Index out of range") _precondition(index >= 0, "Index out of range") let newCount = currentCount - 1 - let pointer = (_buffer.firstElementAddress + index) + let pointer = (_buffer.mutableFirstElementAddress + index) let result = pointer.move() pointer.moveInitialize(from: pointer + 1, count: newCount - index) - _buffer.count = newCount + _buffer.mutableCount = newCount + _endMutation() return result } @@ -1449,7 +1476,8 @@ extension Array { buffer.baseAddress == firstElementAddress, "Can't reassign buffer in Array(unsafeUninitializedCapacity:initializingWith:)" ) - self._buffer.count = initializedCount + self._buffer.mutableCount = initializedCount + _endMutation() } try initializer(&buffer, &initializedCount) } @@ -1573,7 +1601,7 @@ extension Array { _ body: (inout UnsafeMutableBufferPointer) throws -> R ) rethrows -> R { _makeMutableAndUnique() - let count = self.count + let count = _buffer.mutableCount // Ensure that body can't invalidate the storage or its bounds by // moving self into a temporary working array. @@ -1588,7 +1616,7 @@ extension Array { (work, self) = (self, work) // Create an UnsafeBufferPointer over work that we can pass to body - let pointer = work._buffer.firstElementAddress + let pointer = work._buffer.mutableFirstElementAddress var inoutBufferPointer = UnsafeMutableBufferPointer( start: pointer, count: count) @@ -1600,6 +1628,7 @@ extension Array { "Array withUnsafeMutableBufferPointer: replacing the buffer is not allowed") (work, self) = (self, work) + _endMutation() } // Invoke the body. @@ -1689,8 +1718,10 @@ extension Array { let insertCount = newElements.count let growth = insertCount - eraseCount - reserveCapacityForAppend(newElementsCount: growth) + _reserveCapacityImpl(minimumCapacity: self.count + growth, + growForAppend: true) _buffer.replaceSubrange(subrange, with: insertCount, elementsOf: newElements) + _endMutation() } } diff --git a/stdlib/public/core/ArrayBuffer.swift b/stdlib/public/core/ArrayBuffer.swift index 9e959a9406e1f..29fd636ebc1d7 100644 --- a/stdlib/public/core/ArrayBuffer.swift +++ b/stdlib/public/core/ArrayBuffer.swift @@ -100,21 +100,55 @@ extension _ArrayBuffer { } /// Returns `true` iff this buffer's storage is uniquely-referenced. + /// + /// This function should only be used for internal sanity checks. + /// To guard a buffer mutation, use `beginCOWMutation`. @inlinable internal mutating func isUniquelyReferenced() -> Bool { if !_isClassOrObjCExistential(Element.self) { return _storage.isUniquelyReferencedUnflaggedNative() } - - // This is a performance optimization. This code used to be: - // - // return _storage.isUniquelyReferencedNative() && _isNative. - // - // SR-6437 - if !_storage.isUniquelyReferencedNative() { + return _storage.isUniquelyReferencedNative() && _isNative + } + + /// Returns `true` and puts the buffer in a mutable state iff the buffer's + /// storage is uniquely-referenced. + /// + /// - Precondition: The buffer must be immutable. + /// + /// - Warning: It's a requirement to call `beginCOWMutation` before the buffer + /// is mutated. + @_alwaysEmitIntoClient + internal mutating func beginCOWMutation() -> Bool { + let isUnique: Bool + if !_isClassOrObjCExistential(Element.self) { + isUnique = _storage.beginCOWMutationUnflaggedNative() + } else if !_storage.beginCOWMutationNative() { return false + } else { + isUnique = _isNative + } +#if INTERNAL_CHECKS_ENABLED + if isUnique { + _native.isImmutable = false } - return _isNative +#endif + return isUnique + } + + /// Puts the buffer in an immutable state. + /// + /// - Precondition: The buffer must be mutable. + /// + /// - Warning: After a call to `endCOWMutation` the buffer must not be mutated + /// until the next call of `beginCOWMutation`. + @_alwaysEmitIntoClient + @inline(__always) + internal mutating func endCOWMutation() { +#if INTERNAL_CHECKS_ENABLED + _native.isImmutable = true +#endif + _storage.endCOWMutation() } /// Convert to an NSArray. @@ -168,13 +202,13 @@ extension _ArrayBuffer { // As an optimization, if the original buffer is unique, we can just move // the elements instead of copying. let dest = newBuffer.firstElementAddress - dest.moveInitialize(from: firstElementAddress, + dest.moveInitialize(from: mutableFirstElementAddress, count: c) - _native.count = 0 + _native.mutableCount = 0 } else { _copyContents( subRange: 0.. NativeBuffer? { if _fastPath(isUniquelyReferenced()) { let b = _native - if _fastPath(b.capacity >= minimumCapacity) { + if _fastPath(b.mutableCapacity >= minimumCapacity) { return b } } @@ -310,12 +344,25 @@ extension _ArrayBuffer { return _native.firstElementAddress } + /// A mutable pointer to the first element. + /// + /// - Precondition: the buffer must be mutable. + @_alwaysEmitIntoClient + internal var mutableFirstElementAddress: UnsafeMutablePointer { + _internalInvariant(_isNative, "must be a native buffer") + return _native.mutableFirstElementAddress + } + @inlinable internal var firstElementAddressIfContiguous: UnsafeMutablePointer? { return _fastPath(_isNative) ? firstElementAddress : nil } /// The number of elements the buffer stores. + /// + /// This property is obsolete. It's only used for the ArrayBufferProtocol and + /// to keep backward compatibility. + /// Use `immutableCount` or `mutableCount` instead. @inlinable internal var count: Int { @inline(__always) @@ -327,6 +374,33 @@ extension _ArrayBuffer { _native.count = newValue } } + + /// The number of elements of the buffer. + /// + /// - Precondition: The buffer must be immutable. + @_alwaysEmitIntoClient + internal var immutableCount: Int { + return _fastPath(_isNative) ? _native.immutableCount : _nonNative.endIndex + } + + /// The number of elements of the buffer. + /// + /// - Precondition: The buffer must be mutable. + @_alwaysEmitIntoClient + internal var mutableCount: Int { + @inline(__always) + get { + _internalInvariant( + _isNative, + "attempting to get mutating-count of non-native buffer") + return _native.mutableCount + } + @inline(__always) + set { + _internalInvariant(_isNative, "attempting to update count of Cocoa array") + _native.mutableCount = newValue + } + } /// Traps if an inout violation is detected or if the buffer is /// native and the subscript is out of range. @@ -345,8 +419,6 @@ extension _ArrayBuffer { } } - // TODO: gyb this - /// Traps if an inout violation is detected or if the buffer is /// native and typechecked and the subscript is out of range. /// @@ -366,12 +438,42 @@ extension _ArrayBuffer { } } + /// Traps unless the given `index` is valid for subscripting, i.e. + /// `0 ≤ index < count`. + /// + /// - Precondition: The buffer must be mutable. + @_alwaysEmitIntoClient + internal func _checkValidSubscriptMutating(_ index: Int) { + _native._checkValidSubscriptMutating(index) + } + /// The number of elements the buffer can store without reallocation. + /// + /// This property is obsolete. It's only used for the ArrayBufferProtocol and + /// to keep backward compatibility. + /// Use `immutableCapacity` or `mutableCapacity` instead. @inlinable internal var capacity: Int { return _fastPath(_isNative) ? _native.capacity : _nonNative.endIndex } + /// The number of elements the buffer can store without reallocation. + /// + /// - Precondition: The buffer must be immutable. + @_alwaysEmitIntoClient + internal var immutableCapacity: Int { + return _fastPath(_isNative) ? _native.immutableCapacity : _nonNative.count + } + + /// The number of elements the buffer can store without reallocation. + /// + /// - Precondition: The buffer must be mutable. + @_alwaysEmitIntoClient + internal var mutableCapacity: Int { + _internalInvariant(_isNative, "attempting to get mutating-capacity of non-native buffer") + return _native.mutableCapacity + } + @inlinable @inline(__always) internal func getElement(_ i: Int, wasNativeTypeChecked: Bool) -> Element { diff --git a/stdlib/public/core/ArrayShared.swift b/stdlib/public/core/ArrayShared.swift index 3e7d5939bac03..28c1d25696c55 100644 --- a/stdlib/public/core/ArrayShared.swift +++ b/stdlib/public/core/ArrayShared.swift @@ -64,6 +64,17 @@ func _deallocateUninitializedArray( array._deallocateUninitialized() } +@_alwaysEmitIntoClient +@_semantics("array.finalize_intrinsic") +@_effects(readnone) +public // COMPILER_INTRINSIC +func _finalizeUninitializedArray( + _ array: __owned Array +) -> Array { + var mutableArray = array + mutableArray._endMutation() + return mutableArray +} extension Collection { // Utility method for collections that wish to implement diff --git a/stdlib/public/core/ArraySlice.swift b/stdlib/public/core/ArraySlice.swift index b0da6898cd5e0..8ce49b2f84dce 100644 --- a/stdlib/public/core/ArraySlice.swift +++ b/stdlib/public/core/ArraySlice.swift @@ -164,10 +164,20 @@ extension ArraySlice { @inlinable @_semantics("array.make_mutable") internal mutating func _makeMutableAndUnique() { - if _slowPath(!_buffer.isMutableAndUniquelyReferenced()) { + if _slowPath(!_buffer.beginCOWMutation()) { _buffer = _Buffer(copying: _buffer) } } + + /// Marks the end of a mutation. + /// + /// After a call to `_endMutation` the buffer must not be mutated until a call + /// to `_makeMutableAndUnique`. + @_alwaysEmitIntoClient + @_semantics("array.end_mutation") + internal mutating func _endMutation() { + _buffer.endCOWMutation() + } /// Check that the given `index` is valid for subscripting, i.e. /// `0 ≤ index < count`. @@ -537,6 +547,7 @@ extension ArraySlice: RandomAccessCollection, MutableCollection { _checkSubscript_native(index) let address = _buffer.subscriptBaseAddress + index yield &address.pointee + _endMutation(); } } @@ -688,12 +699,19 @@ extension ArraySlice: RangeReplaceableCollection { @inlinable @_semantics("array.init") public init(repeating repeatedValue: Element, count: Int) { - var p: UnsafeMutablePointer - (self, p) = ArraySlice._allocateUninitialized(count) - for _ in 0..= 0, "Can't construct ArraySlice with count < 0") + if count > 0 { + _buffer = ArraySlice._allocateBufferUninitialized(minimumCapacity: count) + _buffer.count = count + var p = _buffer.firstElementAddress + for _ in 0..( _uninitializedCount: count, minimumCapacity: minimumCapacity) @@ -820,6 +837,7 @@ extension ArraySlice: RangeReplaceableCollection { _buffer: newBuffer, shiftedToStartIndex: _buffer.startIndex) } _internalInvariant(capacity >= minimumCapacity) + _endMutation() } /// Copy the contents of the current buffer to a new unique mutable buffer. @@ -838,7 +856,7 @@ extension ArraySlice: RangeReplaceableCollection { @inlinable @_semantics("array.make_mutable") internal mutating func _makeUniqueAndReserveCapacityIfNotUnique() { - if _slowPath(!_buffer.isMutableAndUniquelyReferenced()) { + if _slowPath(!_buffer.beginCOWMutation()) { _copyToNewBuffer(oldCount: _buffer.count) } } @@ -846,15 +864,6 @@ extension ArraySlice: RangeReplaceableCollection { @inlinable @_semantics("array.mutate_unknown") internal mutating func _reserveCapacityAssumingUniqueBuffer(oldCount: Int) { - // This is a performance optimization. This code used to be in an || - // statement in the _internalInvariant below. - // - // _internalInvariant(_buffer.capacity == 0 || - // _buffer.isMutableAndUniquelyReferenced()) - // - // SR-6437 - let capacity = _buffer.capacity == 0 - // Due to make_mutable hoisting the situation can arise where we hoist // _makeMutableAndUnique out of loop and use it to replace // _makeUniqueAndReserveCapacityIfNotUnique that preceeds this call. If the @@ -864,10 +873,10 @@ extension ArraySlice: RangeReplaceableCollection { // This specific case is okay because we will make the buffer unique in this // function because we request a capacity > 0 and therefore _copyToNewBuffer // will be called creating a new buffer. - _internalInvariant(capacity || - _buffer.isMutableAndUniquelyReferenced()) + let capacity = _buffer.capacity + _internalInvariant(capacity == 0 || _buffer.isMutableAndUniquelyReferenced()) - if _slowPath(oldCount + 1 > _buffer.capacity) { + if _slowPath(oldCount + 1 > capacity) { _copyToNewBuffer(oldCount: oldCount) } } @@ -913,6 +922,7 @@ extension ArraySlice: RangeReplaceableCollection { let oldCount = _getCount() _reserveCapacityAssumingUniqueBuffer(oldCount: oldCount) _appendElementAssumeUniqueAndCapacity(oldCount, newElement: newElement) + _endMutation() } /// Adds the elements of a sequence to the end of the array. @@ -938,6 +948,7 @@ extension ArraySlice: RangeReplaceableCollection { let newElementsCount = newElements.underestimatedCount reserveCapacityForAppend(newElementsCount: newElementsCount) + _ = _buffer.beginCOWMutation() let oldCount = self.count let startNewElements = _buffer.firstElementAddress + oldCount @@ -949,7 +960,7 @@ extension ArraySlice: RangeReplaceableCollection { // trap on underflow from the sequence's underestimate: let writtenCount = buf.distance(from: buf.startIndex, to: writtenUpTo) - _precondition(newElementsCount <= writtenCount, + _precondition(newElementsCount <= writtenCount, "newElements.underestimatedCount was an overestimate") // can't check for overflow as sequences can underestimate @@ -963,6 +974,7 @@ extension ArraySlice: RangeReplaceableCollection { // append them in slow sequence-only mode _buffer._arrayAppendSequence(IteratorSequence(remainder)) } + _endMutation() } @inlinable @@ -1223,7 +1235,7 @@ extension ArraySlice { ) rethrows -> R { let count = self.count // Ensure unique storage - _buffer._outlinedMakeUniqueBuffer(bufferCount: count) + _makeMutableAndUnique() // Ensure that body can't invalidate the storage or its bounds by // moving self into a temporary working array. @@ -1250,6 +1262,7 @@ extension ArraySlice { "ArraySlice withUnsafeMutableBufferPointer: replacing the buffer is not allowed") (work, self) = (self, work) + _endMutation() } // Invoke the body. @@ -1340,14 +1353,13 @@ extension ArraySlice { let insertCount = newElements.count let growth = insertCount - eraseCount - if _buffer.requestUniqueMutableBackingBuffer( - minimumCapacity: oldCount + growth) != nil { - + if _buffer.beginCOWMutation() && _buffer.capacity >= oldCount + growth { _buffer.replaceSubrange( subrange, with: insertCount, elementsOf: newElements) } else { _buffer._arrayOutOfPlaceReplace(subrange, with: newElements, count: insertCount) } + _endMutation() } } diff --git a/stdlib/public/core/BridgeStorage.swift b/stdlib/public/core/BridgeStorage.swift index fcc971f8b6f76..33a7e33fe1c41 100644 --- a/stdlib/public/core/BridgeStorage.swift +++ b/stdlib/public/core/BridgeStorage.swift @@ -75,6 +75,12 @@ internal struct _BridgeStorage { return _isUnique(&rawValue) } + @_alwaysEmitIntoClient + @inline(__always) + internal mutating func beginCOWMutationNative() -> Bool { + return Bool(Builtin.beginCOWMutation(&rawValue)) + } + @inlinable internal var isNative: Bool { @inline(__always) get { @@ -131,6 +137,20 @@ internal struct _BridgeStorage { return _isUnique_native(&rawValue) } + @_alwaysEmitIntoClient + @inline(__always) + internal mutating func beginCOWMutationUnflaggedNative() -> Bool { + _internalInvariant(isNative) + return Bool(Builtin.beginCOWMutation_native(&rawValue)) + } + + @_alwaysEmitIntoClient + @inline(__always) + internal mutating func endCOWMutation() { + _internalInvariant(isNative) + Builtin.endCOWMutation(&rawValue) + } + @inlinable internal var objCInstance: ObjC { @inline(__always) get { diff --git a/stdlib/public/core/Builtin.swift b/stdlib/public/core/Builtin.swift index 8aceb9014df08..e3e472cd299ff 100644 --- a/stdlib/public/core/Builtin.swift +++ b/stdlib/public/core/Builtin.swift @@ -345,6 +345,16 @@ internal func _class_getInstancePositiveExtentSize(_ theClass: AnyClass) -> Int #endif } +#if INTERNAL_CHECKS_ENABLED +@usableFromInline +@_silgen_name("_swift_isImmutableCOWBuffer") +internal func _swift_isImmutableCOWBuffer(_ object: AnyObject) -> Bool + +@usableFromInline +@_silgen_name("_swift_setImmutableCOWBuffer") +internal func _swift_setImmutableCOWBuffer(_ object: AnyObject, _ immutable: Bool) -> Bool +#endif + @inlinable internal func _isValidAddress(_ address: UInt) -> Bool { // TODO: define (and use) ABI max valid pointer value @@ -683,6 +693,13 @@ func _isUnique_native(_ object: inout T) -> Bool { return Bool(Builtin.isUnique_native(&object)) } +@_alwaysEmitIntoClient +@_transparent +public // @testable +func _COWBufferForReading(_ object: T) -> T { + return Builtin.COWBufferForReading(object) +} + /// Returns `true` if type is a POD type. A POD type is a type that does not /// require any special handling on copying or destruction. @_transparent diff --git a/stdlib/public/core/Codable.swift b/stdlib/public/core/Codable.swift index 4b7fa1abea676..6e6f28ae47185 100644 --- a/stdlib/public/core/Codable.swift +++ b/stdlib/public/core/Codable.swift @@ -471,7 +471,7 @@ public protocol KeyedEncodingContainerProtocol { forKey key: Key ) -> UnkeyedEncodingContainer - /// Stores a new nested container for the default `super` key and returns A + /// Stores a new nested container for the default `super` key and returns a /// new encoder instance for encoding `super` into that container. /// /// Equivalent to calling `superEncoder(forKey:)` with @@ -480,7 +480,7 @@ public protocol KeyedEncodingContainerProtocol { /// - returns: A new encoder to pass to `super.encode(to:)`. mutating func superEncoder() -> Encoder - /// Stores a new nested container for the given key and returns A new encoder + /// Stores a new nested container for the given key and returns a new encoder /// instance for encoding `super` into that container. /// /// - parameter key: The key to encode `super` for. @@ -911,7 +911,7 @@ public struct KeyedEncodingContainer : return _box.nestedUnkeyedContainer(forKey: key) } - /// Stores a new nested container for the default `super` key and returns A + /// Stores a new nested container for the default `super` key and returns a /// new encoder instance for encoding `super` into that container. /// /// Equivalent to calling `superEncoder(forKey:)` with @@ -922,7 +922,7 @@ public struct KeyedEncodingContainer : return _box.superEncoder() } - /// Stores a new nested container for the given key and returns A new encoder + /// Stores a new nested container for the given key and returns a new encoder /// instance for encoding `super` into that container. /// /// - parameter key: The key to encode `super` for. diff --git a/stdlib/public/core/ContiguousArray.swift b/stdlib/public/core/ContiguousArray.swift index def207a400974..b854c18942745 100644 --- a/stdlib/public/core/ContiguousArray.swift +++ b/stdlib/public/core/ContiguousArray.swift @@ -54,23 +54,33 @@ extension ContiguousArray { @inlinable @_semantics("array.get_count") internal func _getCount() -> Int { - return _buffer.count + return _buffer.immutableCount } @inlinable @_semantics("array.get_capacity") internal func _getCapacity() -> Int { - return _buffer.capacity + return _buffer.immutableCapacity } @inlinable @_semantics("array.make_mutable") internal mutating func _makeMutableAndUnique() { - if _slowPath(!_buffer.isMutableAndUniquelyReferenced()) { + if _slowPath(!_buffer.beginCOWMutation()) { _buffer = _buffer._consumeAndCreateNew() } } + /// Marks the end of an Array mutation. + /// + /// After a call to `_endMutation` the buffer must not be mutated until a call + /// to `_makeMutableAndUnique`. + @_alwaysEmitIntoClient + @_semantics("array.end_mutation") + internal mutating func _endMutation() { + _buffer.endCOWMutation() + } + /// Check that the given `index` is valid for subscripting, i.e. /// `0 ≤ index < count`. @inlinable @@ -79,6 +89,16 @@ extension ContiguousArray { _buffer._checkValidSubscript(index) } + /// Check that the given `index` is valid for subscripting, i.e. + /// `0 ≤ index < count`. + /// + /// - Precondition: The buffer must be uniquely referenced and native. + @_alwaysEmitIntoClient + @_semantics("array.check_subscript") + internal func _checkSubscript_mutating(_ index: Int) { + _buffer._checkValidSubscriptMutating(index) + } + /// Check that the specified `index` is valid, i.e. `0 ≤ index ≤ count`. @inlinable @_semantics("array.check_index") @@ -90,7 +110,7 @@ extension ContiguousArray { @inlinable @_semantics("array.get_element_address") internal func _getElementAddress(_ index: Int) -> UnsafeMutablePointer { - return _buffer.subscriptBaseAddress + index + return _buffer.firstElementAddress + index } } @@ -387,9 +407,10 @@ extension ContiguousArray: RandomAccessCollection, MutableCollection { } _modify { _makeMutableAndUnique() - _checkSubscript_native(index) - let address = _buffer.subscriptBaseAddress + index + _checkSubscript_mutating(index) + let address = _buffer.mutableFirstElementAddress + index yield &address.pointee + _endMutation(); } } @@ -546,6 +567,7 @@ extension ContiguousArray: RangeReplaceableCollection { p.initialize(to: repeatedValue) p += 1 } + _endMutation() } @inline(never) @@ -570,7 +592,7 @@ extension ContiguousArray: RangeReplaceableCollection { // unnecessary uniqueness check. We disable inlining here to curb code // growth. _buffer = ContiguousArray._allocateBufferUninitialized(minimumCapacity: count) - _buffer.count = count + _buffer.mutableCount = count } // Can't store count here because the buffer might be pointing to the // shared empty array. @@ -657,6 +679,7 @@ extension ContiguousArray: RangeReplaceableCollection { public mutating func reserveCapacity(_ minimumCapacity: Int) { _reserveCapacityImpl(minimumCapacity: minimumCapacity, growForAppend: false) + _endMutation() } /// Reserves enough space to store `minimumCapacity` elements. @@ -666,14 +689,14 @@ extension ContiguousArray: RangeReplaceableCollection { internal mutating func _reserveCapacityImpl( minimumCapacity: Int, growForAppend: Bool ) { - let isUnique = _buffer.isUniquelyReferenced() - if _slowPath(!isUnique || _getCapacity() < minimumCapacity) { + let isUnique = _buffer.beginCOWMutation() + if _slowPath(!isUnique || _buffer.mutableCapacity < minimumCapacity) { _createNewBuffer(bufferIsUnique: isUnique, - minimumCapacity: Swift.max(minimumCapacity, count), + minimumCapacity: Swift.max(minimumCapacity, _buffer.count), growForAppend: growForAppend) } - _internalInvariant(capacity >= minimumCapacity) - _internalInvariant(capacity == 0 || _buffer.isUniquelyReferenced()) + _internalInvariant(_buffer.mutableCapacity >= minimumCapacity) + _internalInvariant(_buffer.mutableCapacity == 0 || _buffer.isUniquelyReferenced()) } /// Creates a new buffer, replacing the current buffer. @@ -711,7 +734,7 @@ extension ContiguousArray: RangeReplaceableCollection { @inlinable @_semantics("array.make_mutable") internal mutating func _makeUniqueAndReserveCapacityIfNotUnique() { - if _slowPath(!_buffer.isMutableAndUniquelyReferenced()) { + if _slowPath(!_buffer.beginCOWMutation()) { _createNewBuffer(bufferIsUnique: false, minimumCapacity: count + 1, growForAppend: true) @@ -721,15 +744,6 @@ extension ContiguousArray: RangeReplaceableCollection { @inlinable @_semantics("array.mutate_unknown") internal mutating func _reserveCapacityAssumingUniqueBuffer(oldCount: Int) { - // This is a performance optimization. This code used to be in an || - // statement in the _internalInvariant below. - // - // _internalInvariant(_buffer.capacity == 0 || - // _buffer.isMutableAndUniquelyReferenced()) - // - // SR-6437 - let capacity = _buffer.capacity == 0 - // Due to make_mutable hoisting the situation can arise where we hoist // _makeMutableAndUnique out of loop and use it to replace // _makeUniqueAndReserveCapacityIfNotUnique that preceeds this call. If the @@ -739,11 +753,11 @@ extension ContiguousArray: RangeReplaceableCollection { // This specific case is okay because we will make the buffer unique in this // function because we request a capacity > 0 and therefore _copyToNewBuffer // will be called creating a new buffer. - _internalInvariant(capacity || - _buffer.isMutableAndUniquelyReferenced()) + let capacity = _buffer.mutableCapacity + _internalInvariant(capacity == 0 || _buffer.isMutableAndUniquelyReferenced()) - if _slowPath(oldCount + 1 > _buffer.capacity) { - _createNewBuffer(bufferIsUnique: true, + if _slowPath(oldCount + 1 > capacity) { + _createNewBuffer(bufferIsUnique: capacity > 0, minimumCapacity: oldCount + 1, growForAppend: true) } @@ -756,10 +770,10 @@ extension ContiguousArray: RangeReplaceableCollection { newElement: __owned Element ) { _internalInvariant(_buffer.isMutableAndUniquelyReferenced()) - _internalInvariant(_buffer.capacity >= _buffer.count + 1) + _internalInvariant(_buffer.mutableCapacity >= _buffer.mutableCount + 1) - _buffer.count = oldCount + 1 - (_buffer.firstElementAddress + oldCount).initialize(to: newElement) + _buffer.mutableCount = oldCount + 1 + (_buffer.mutableFirstElementAddress + oldCount).initialize(to: newElement) } /// Adds a new element at the end of the array. @@ -789,9 +803,10 @@ extension ContiguousArray: RangeReplaceableCollection { // Separating uniqueness check and capacity check allows hoisting the // uniqueness check out of a loop. _makeUniqueAndReserveCapacityIfNotUnique() - let oldCount = _getCount() + let oldCount = _buffer.mutableCount _reserveCapacityAssumingUniqueBuffer(oldCount: oldCount) _appendElementAssumeUniqueAndCapacity(oldCount, newElement: newElement) + _endMutation() } /// Adds the elements of a sequence to the end of the array. @@ -815,14 +830,19 @@ extension ContiguousArray: RangeReplaceableCollection { public mutating func append(contentsOf newElements: __owned S) where S.Element == Element { + defer { + _endMutation() + } + let newElementsCount = newElements.underestimatedCount - reserveCapacityForAppend(newElementsCount: newElementsCount) + _reserveCapacityImpl(minimumCapacity: self.count + newElementsCount, + growForAppend: true) - let oldCount = self.count - let startNewElements = _buffer.firstElementAddress + oldCount + let oldCount = _buffer.mutableCount + let startNewElements = _buffer.mutableFirstElementAddress + oldCount let buf = UnsafeMutableBufferPointer( start: startNewElements, - count: self.capacity - oldCount) + count: _buffer.mutableCapacity - oldCount) var (remainder,writtenUpTo) = buf.initialize(from: newElements) @@ -834,19 +854,19 @@ extension ContiguousArray: RangeReplaceableCollection { // This check prevents a data race writing to _swiftEmptyArrayStorage if writtenCount > 0 { - _buffer.count += writtenCount + _buffer.mutableCount = _buffer.mutableCount + writtenCount } if writtenUpTo == buf.endIndex { // there may be elements that didn't fit in the existing buffer, // append them in slow sequence-only mode - var newCount = _getCount() + var newCount = _buffer.mutableCount var nextItem = remainder.next() while nextItem != nil { - reserveCapacityForAppend(newElementsCount: 1) + _reserveCapacityAssumingUniqueBuffer(oldCount: newCount) - let currentCapacity = _getCapacity() - let base = _buffer.firstElementAddress + let currentCapacity = _buffer.mutableCapacity + let base = _buffer.mutableFirstElementAddress // fill while there is another item and spare capacity while let next = nextItem, newCount < currentCapacity { @@ -854,7 +874,7 @@ extension ContiguousArray: RangeReplaceableCollection { newCount += 1 nextItem = remainder.next() } - _buffer.count = newCount + _buffer.mutableCount = newCount } } } @@ -866,17 +886,19 @@ extension ContiguousArray: RangeReplaceableCollection { // for consistency, we need unique self even if newElements is empty. _reserveCapacityImpl(minimumCapacity: self.count + newElementsCount, growForAppend: true) + _endMutation() } @inlinable @_semantics("array.mutate_unknown") public mutating func _customRemoveLast() -> Element? { _makeMutableAndUnique() - let newCount = _getCount() - 1 + let newCount = _buffer.mutableCount - 1 _precondition(newCount >= 0, "Can't removeLast from an empty ContiguousArray") - let pointer = (_buffer.firstElementAddress + newCount) + let pointer = (_buffer.mutableFirstElementAddress + newCount) let element = pointer.move() - _buffer.count = newCount + _buffer.mutableCount = newCount + _endMutation() return element } @@ -900,14 +922,15 @@ extension ContiguousArray: RangeReplaceableCollection { @_semantics("array.mutate_unknown") public mutating func remove(at index: Int) -> Element { _makeMutableAndUnique() - let currentCount = _getCount() + let currentCount = _buffer.mutableCount _precondition(index < currentCount, "Index out of range") _precondition(index >= 0, "Index out of range") - let newCount = _getCount() - 1 - let pointer = (_buffer.firstElementAddress + index) + let newCount = currentCount - 1 + let pointer = (_buffer.mutableFirstElementAddress + index) let result = pointer.move() pointer.moveInitialize(from: pointer + 1, count: newCount - index) - _buffer.count = newCount + _buffer.mutableCount = newCount + _endMutation() return result } @@ -1150,7 +1173,7 @@ extension ContiguousArray { _ body: (inout UnsafeMutableBufferPointer) throws -> R ) rethrows -> R { _makeMutableAndUnique() - let count = self.count + let count = _buffer.mutableCount // Ensure that body can't invalidate the storage or its bounds by // moving self into a temporary working array. @@ -1165,7 +1188,7 @@ extension ContiguousArray { (work, self) = (self, work) // Create an UnsafeBufferPointer over work that we can pass to body - let pointer = work._buffer.firstElementAddress + let pointer = work._buffer.mutableFirstElementAddress var inoutBufferPointer = UnsafeMutableBufferPointer( start: pointer, count: count) @@ -1177,6 +1200,7 @@ extension ContiguousArray { "ContiguousArray withUnsafeMutableBufferPointer: replacing the buffer is not allowed") (work, self) = (self, work) + _endMutation() } // Invoke the body. @@ -1267,8 +1291,10 @@ extension ContiguousArray { let insertCount = newElements.count let growth = insertCount - eraseCount - reserveCapacityForAppend(newElementsCount: growth) + _reserveCapacityImpl(minimumCapacity: self.count + growth, + growForAppend: true) _buffer.replaceSubrange(subrange, with: insertCount, elementsOf: newElements) + _endMutation() } } diff --git a/stdlib/public/core/ContiguousArrayBuffer.swift b/stdlib/public/core/ContiguousArrayBuffer.swift index db093fc29f09f..0519e44821b95 100644 --- a/stdlib/public/core/ContiguousArrayBuffer.swift +++ b/stdlib/public/core/ContiguousArrayBuffer.swift @@ -332,6 +332,15 @@ internal struct _ContiguousArrayBuffer: _ArrayBufferProtocol { Element.self)) } + /// A mutable pointer to the first element. + /// + /// - Precondition: The buffer must be mutable. + @_alwaysEmitIntoClient + internal var mutableFirstElementAddress: UnsafeMutablePointer { + return UnsafeMutablePointer(Builtin.projectTailElems(mutableOrEmptyStorage, + Element.self)) + } + @inlinable internal var firstElementAddressIfContiguous: UnsafeMutablePointer? { return firstElementAddress @@ -399,9 +408,94 @@ internal struct _ContiguousArrayBuffer: _ArrayBufferProtocol { @inline(__always) internal func getElement(_ i: Int) -> Element { _internalInvariant(i >= 0 && i < count, "Array index out of range") - return firstElementAddress[i] + let addr = UnsafePointer( + Builtin.projectTailElems(immutableStorage, Element.self)) + return addr[i] + } + + /// The storage of an immutable buffer. + /// + /// - Precondition: The buffer must be immutable. + @_alwaysEmitIntoClient + @inline(__always) + internal var immutableStorage : __ContiguousArrayStorageBase { +#if INTERNAL_CHECKS_ENABLED + _internalInvariant(isImmutable, "Array storage is not immutable") +#endif + return Builtin.COWBufferForReading(_storage) } + /// The storage of a mutable buffer. + /// + /// - Precondition: The buffer must be mutable. + @_alwaysEmitIntoClient + @inline(__always) + internal var mutableStorage : __ContiguousArrayStorageBase { +#if INTERNAL_CHECKS_ENABLED + _internalInvariant(isMutable, "Array storage is immutable") +#endif + return _storage + } + + /// The storage of a mutable or empty buffer. + /// + /// - Precondition: The buffer must be mutable or the empty array singleton. + @_alwaysEmitIntoClient + @inline(__always) + internal var mutableOrEmptyStorage : __ContiguousArrayStorageBase { +#if INTERNAL_CHECKS_ENABLED + _internalInvariant(isMutable || _storage.countAndCapacity.capacity == 0, + "Array storage is immutable and not empty") +#endif + return _storage + } + +#if INTERNAL_CHECKS_ENABLED + @_alwaysEmitIntoClient + internal var isImmutable: Bool { + get { +// TODO: Enable COW runtime checks by default (when INTERNAL_CHECKS_ENABLED +// is set). Currently there is a problem with remote AST which needs to be +// fixed. +#if ENABLE_COW_RUNTIME_CHECKS + if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) { + return capacity == 0 || _swift_isImmutableCOWBuffer(_storage) + } +#endif + return true + } + nonmutating set { +#if ENABLE_COW_RUNTIME_CHECKS + if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) { + if newValue { + if capacity > 0 { + let wasImmutable = _swift_setImmutableCOWBuffer(_storage, true) + _internalInvariant(!wasImmutable, + "re-setting immutable array buffer to immutable") + } + } else { + _internalInvariant(capacity > 0, + "setting empty array buffer to mutable") + let wasImmutable = _swift_setImmutableCOWBuffer(_storage, false) + _internalInvariant(wasImmutable, + "re-setting mutable array buffer to mutable") + } + } +#endif + } + } + + @_alwaysEmitIntoClient + internal var isMutable: Bool { +#if ENABLE_COW_RUNTIME_CHECKS + if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) { + return !_swift_isImmutableCOWBuffer(_storage) + } +#endif + return true + } +#endif + /// Get or set the value of the ith element. @inlinable internal subscript(i: Int) -> Element { @@ -424,6 +518,10 @@ internal struct _ContiguousArrayBuffer: _ArrayBufferProtocol { } /// The number of elements the buffer stores. + /// + /// This property is obsolete. It's only used for the ArrayBufferProtocol and + /// to keep backward compatibility. + /// Use `immutableCount` or `mutableCount` instead. @inlinable internal var count: Int { get { @@ -433,30 +531,97 @@ internal struct _ContiguousArrayBuffer: _ArrayBufferProtocol { _internalInvariant(newValue >= 0) _internalInvariant( - newValue <= capacity, + newValue <= mutableCapacity, + "Can't grow an array buffer past its capacity") + + mutableStorage.countAndCapacity.count = newValue + } + } + + /// The number of elements of the buffer. + /// + /// - Precondition: The buffer must be immutable. + @_alwaysEmitIntoClient + @inline(__always) + internal var immutableCount: Int { + return immutableStorage.countAndCapacity.count + } + + /// The number of elements of the buffer. + /// + /// - Precondition: The buffer must be mutable. + @_alwaysEmitIntoClient + internal var mutableCount: Int { + @inline(__always) + get { + return mutableOrEmptyStorage.countAndCapacity.count + } + @inline(__always) + nonmutating set { + _internalInvariant(newValue >= 0) + + _internalInvariant( + newValue <= mutableCapacity, "Can't grow an array buffer past its capacity") - _storage.countAndCapacity.count = newValue + mutableStorage.countAndCapacity.count = newValue } } /// Traps unless the given `index` is valid for subscripting, i.e. /// `0 ≤ index < count`. + /// + /// - Precondition: The buffer must be immutable. @inlinable @inline(__always) internal func _checkValidSubscript(_ index: Int) { _precondition( - (index >= 0) && (index < count), + (index >= 0) && (index < immutableCount), + "Index out of range" + ) + } + + /// Traps unless the given `index` is valid for subscripting, i.e. + /// `0 ≤ index < count`. + /// + /// - Precondition: The buffer must be mutable. + @_alwaysEmitIntoClient + @inline(__always) + internal func _checkValidSubscriptMutating(_ index: Int) { + _precondition( + (index >= 0) && (index < mutableCount), "Index out of range" ) } /// The number of elements the buffer can store without reallocation. + /// + /// This property is obsolete. It's only used for the ArrayBufferProtocol and + /// to keep backward compatibility. + /// Use `immutableCapacity` or `mutableCapacity` instead. @inlinable internal var capacity: Int { return _storage.countAndCapacity.capacity } + /// The number of elements the buffer can store without reallocation. + /// + /// - Precondition: The buffer must be immutable. + @_alwaysEmitIntoClient + @inline(__always) + internal var immutableCapacity: Int { + return immutableStorage.countAndCapacity.capacity + } + + /// The number of elements the buffer can store without reallocation. + /// + /// - Precondition: The buffer must be mutable. + @_alwaysEmitIntoClient + @inline(__always) + internal var mutableCapacity: Int { + return mutableOrEmptyStorage.countAndCapacity.capacity + } + /// Copy the elements in `bounds` from this buffer into uninitialized /// memory starting at `target`. Return a pointer "past the end" of the /// just-initialized memory. @@ -492,7 +657,7 @@ internal struct _ContiguousArrayBuffer: _ArrayBufferProtocol { get { return _SliceBuffer( owner: _storage, - subscriptBaseAddress: subscriptBaseAddress, + subscriptBaseAddress: firstElementAddress, indices: bounds, hasNativeBuffer: true) } @@ -503,14 +668,46 @@ internal struct _ContiguousArrayBuffer: _ArrayBufferProtocol { /// Returns `true` iff this buffer's storage is uniquely-referenced. /// - /// - Note: This does not mean the buffer is mutable. Other factors - /// may need to be considered, such as whether the buffer could be - /// some immutable Cocoa container. + /// This function should only be used for internal sanity checks. + /// To guard a buffer mutation, use `beginCOWMutation`. @inlinable internal mutating func isUniquelyReferenced() -> Bool { return _isUnique(&_storage) } + /// Returns `true` and puts the buffer in a mutable state iff the buffer's + /// storage is uniquely-referenced. + /// + /// - Precondition: The buffer must be immutable. + /// + /// - Warning: It's a requirement to call `beginCOWMutation` before the buffer + /// is mutated. + @_alwaysEmitIntoClient + internal mutating func beginCOWMutation() -> Bool { + if Bool(Builtin.beginCOWMutation(&_storage)) { +#if INTERNAL_CHECKS_ENABLED + isImmutable = false +#endif + return true + } + return false; + } + + /// Puts the buffer in an immutable state. + /// + /// - Precondition: The buffer must be mutable. + /// + /// - Warning: After a call to `endCOWMutation` the buffer must not be mutated + /// until the next call of `beginCOWMutation`. + @_alwaysEmitIntoClient + @inline(__always) + internal mutating func endCOWMutation() { +#if INTERNAL_CHECKS_ENABLED + isImmutable = true +#endif + Builtin.endCOWMutation(&_storage) + } + /// Creates and returns a new uniquely referenced buffer which is a copy of /// this buffer. /// @@ -553,14 +750,14 @@ internal struct _ContiguousArrayBuffer: _ArrayBufferProtocol { if bufferIsUnique { // As an optimization, if the original buffer is unique, we can just move // the elements instead of copying. - let dest = newBuffer.firstElementAddress + let dest = newBuffer.mutableFirstElementAddress dest.moveInitialize(from: firstElementAddress, count: c) - count = 0 + mutableCount = 0 } else { _copyContents( subRange: 0..( buf = UnsafeMutableBufferPointer( start: lhs.firstElementAddress + oldCount, count: rhs.count) - lhs.count = newCount + lhs.mutableCount = newCount } else { var newLHS = _ContiguousArrayBuffer( @@ -678,7 +875,7 @@ internal func += ( newLHS.firstElementAddress.moveInitialize( from: lhs.firstElementAddress, count: oldCount) - lhs.count = 0 + lhs.mutableCount = 0 (lhs, newLHS) = (newLHS, lhs) buf = UnsafeMutableBufferPointer( start: lhs.firstElementAddress + oldCount, @@ -779,7 +976,7 @@ internal func _copyCollectionToContiguousArray< return ContiguousArray() } - let result = _ContiguousArrayBuffer( + var result = _ContiguousArrayBuffer( _uninitializedCount: count, minimumCapacity: 0) @@ -796,6 +993,7 @@ internal func _copyCollectionToContiguousArray< _precondition(end == p.endIndex, "invalid Collection: less than 'count' elements in collection") + result.endCOWMutation() return ContiguousArray(_buffer: result) } @@ -847,7 +1045,7 @@ internal struct _UnsafePartiallyInitializedContiguousArrayBuffer { // Since count is always 0 there, this code does nothing anyway newResult.firstElementAddress.moveInitialize( from: result.firstElementAddress, count: result.capacity) - result.count = 0 + result.mutableCount = 0 } (result, newResult) = (newResult, result) } @@ -875,7 +1073,12 @@ internal struct _UnsafePartiallyInitializedContiguousArrayBuffer { @inline(__always) // For performance reasons. internal mutating func finish() -> ContiguousArray { // Adjust the initialized count of the buffer. - result.count = result.capacity - remainingCapacity + if (result.capacity != 0) { + result.mutableCount = result.capacity - remainingCapacity + } else { + _internalInvariant(remainingCapacity == 0) + _internalInvariant(result.count == 0) + } return finishWithOriginalCount() } @@ -894,6 +1097,7 @@ internal struct _UnsafePartiallyInitializedContiguousArrayBuffer { var finalResult = _ContiguousArrayBuffer() (finalResult, result) = (result, finalResult) remainingCapacity = 0 + finalResult.endCOWMutation() return ContiguousArray(_buffer: finalResult) } } diff --git a/stdlib/public/core/Prespecialize.swift b/stdlib/public/core/Prespecialize.swift index 1f3dff447070d..b4dd39d553a68 100644 --- a/stdlib/public/core/Prespecialize.swift +++ b/stdlib/public/core/Prespecialize.swift @@ -14,6 +14,18 @@ internal func _prespecialize() { consume(Array.self) consume(Array>.self) consume(Array>.self) +#if _runtime(_ObjC) + consume(_ArrayBuffer<()>.self) + consume(_ArrayBuffer<(Optional, Any)>.self) + consume(_ArrayBuffer.self) + consume(_ArrayBuffer.self) + consume(_ArrayBuffer>.self) + consume(_ArrayBuffer>.self) + consume(_ArrayBuffer.self) + consume(_ArrayBuffer.self) + consume(_ArrayBuffer>.self) + consume(_ArrayBuffer>.self) +#endif consume(ClosedRange.self) consume(ContiguousArray<(AnyHashable, Any)>.self) consume(ContiguousArray<(Optional, Any)>.self) @@ -22,6 +34,13 @@ internal func _prespecialize() { consume(ContiguousArray>.self) consume(ContiguousArray.self) consume(ContiguousArray.self) + consume(_ContiguousArrayStorage<(AnyHashable, Any)>.self) + consume(_ContiguousArrayStorage<(Optional, Any)>.self) + consume(_ContiguousArrayStorage.self) + consume(_ContiguousArrayStorage.self) + consume(_ContiguousArrayStorage>.self) + consume(_ContiguousArrayStorage.self) + consume(_ContiguousArrayStorage.self) consume(Dictionary.Index.self) consume(Dictionary.Iterator.self) consume(Dictionary.self) diff --git a/stdlib/public/core/SliceBuffer.swift b/stdlib/public/core/SliceBuffer.swift index d936250d0d359..fd19d31646218 100644 --- a/stdlib/public/core/SliceBuffer.swift +++ b/stdlib/public/core/SliceBuffer.swift @@ -176,17 +176,9 @@ internal struct _SliceBuffer minimumCapacity: Int ) -> NativeBuffer? { _invariantCheck() - // This is a performance optimization that was put in to ensure that at - // -Onone, copy of self we make to call _hasNativeBuffer is destroyed before - // we call isUniquelyReferenced. Otherwise, isUniquelyReferenced will always - // fail causing us to always copy. - // - // if _fastPath(_hasNativeBuffer && isUniquelyReferenced) { - // - // SR-6437 - let native = _hasNativeBuffer - let unique = isUniquelyReferenced() - if _fastPath(native && unique) { + // Note: with COW support it's already guaranteed to have a uniquely + // referenced buffer. This check is only needed for backward compatibility. + if _fastPath(isUniquelyReferenced()) { if capacity >= minimumCapacity { // Since we have the last reference, drop any inaccessible // trailing elements in the underlying storage. That will @@ -275,7 +267,7 @@ internal struct _SliceBuffer set { let growth = newValue - count if growth != 0 { - nativeBuffer.count += growth + nativeBuffer.mutableCount += growth self.endIndex += growth } _invariantCheck() @@ -304,11 +296,52 @@ internal struct _SliceBuffer return count } + /// Returns `true` iff this buffer's storage is uniquely-referenced. + /// + /// This function should only be used for internal sanity checks and for + /// backward compatibility. + /// To guard a buffer mutation, use `beginCOWMutation`. @inlinable internal mutating func isUniquelyReferenced() -> Bool { return isKnownUniquelyReferenced(&owner) } + /// Returns `true` and puts the buffer in a mutable state iff the buffer's + /// storage is uniquely-referenced. + /// + /// - Precondition: The buffer must be immutable. + /// + /// - Warning: It's a requirement to call `beginCOWMutation` before the buffer + /// is mutated. + @_alwaysEmitIntoClient + internal mutating func beginCOWMutation() -> Bool { + if !_hasNativeBuffer { + return false + } + if Bool(Builtin.beginCOWMutation(&owner)) { +#if INTERNAL_CHECKS_ENABLED + nativeBuffer.isImmutable = false +#endif + return true + } + return false; + } + + /// Puts the buffer in an immutable state. + /// + /// - Precondition: The buffer must be mutable. + /// + /// - Warning: After a call to `endCOWMutation` the buffer must not be mutated + /// until the next call of `beginCOWMutation`. + @_alwaysEmitIntoClient + @inline(__always) + internal mutating func endCOWMutation() { +#if INTERNAL_CHECKS_ENABLED + nativeBuffer.isImmutable = true +#endif + Builtin.endCOWMutation(&owner) + } + @inlinable internal func getElement(_ i: Int) -> Element { _internalInvariant(i >= startIndex, "slice index is out of range (before startIndex)") diff --git a/stdlib/public/core/String.swift b/stdlib/public/core/String.swift index 95961c5abdbdb..602bd96edee79 100644 --- a/stdlib/public/core/String.swift +++ b/stdlib/public/core/String.swift @@ -838,31 +838,32 @@ extension String { // make UTF-16 array beforehand let codeUnits = Array(self.utf16).withUnsafeBufferPointer { (uChars: UnsafeBufferPointer) -> Array in - var result = Array(repeating: 0, count: uChars.count) - let len = result.withUnsafeMutableBufferPointer { - (output) -> Int in - var err = __swift_stdlib_U_ZERO_ERROR - return Int(truncatingIfNeeded: + var length: Int = 0 + let result = Array(unsafeUninitializedCapacity: uChars.count) { + buffer, initializedCount in + var error = __swift_stdlib_U_ZERO_ERROR + length = Int(truncatingIfNeeded: __swift_stdlib_u_strToLower( - output.baseAddress._unsafelyUnwrappedUnchecked, - Int32(output.count), + buffer.baseAddress._unsafelyUnwrappedUnchecked, + Int32(buffer.count), uChars.baseAddress._unsafelyUnwrappedUnchecked, Int32(uChars.count), "", - &err)) + &error)) + initializedCount = min(length, uChars.count) } - if len > uChars.count { - var err = __swift_stdlib_U_ZERO_ERROR - result = Array(repeating: 0, count: len) - result.withUnsafeMutableBufferPointer { - output -> Void in + if length > uChars.count { + var error = __swift_stdlib_U_ZERO_ERROR + return Array(unsafeUninitializedCapacity: length) { + buffer, initializedCount in __swift_stdlib_u_strToLower( - output.baseAddress._unsafelyUnwrappedUnchecked, - Int32(output.count), + buffer.baseAddress._unsafelyUnwrappedUnchecked, + Int32(buffer.count), uChars.baseAddress._unsafelyUnwrappedUnchecked, Int32(uChars.count), "", - &err) + &error) + initializedCount = length } } return result @@ -898,31 +899,32 @@ extension String { // make UTF-16 array beforehand let codeUnits = Array(self.utf16).withUnsafeBufferPointer { (uChars: UnsafeBufferPointer) -> Array in - var result = Array(repeating: 0, count: uChars.count) - let len = result.withUnsafeMutableBufferPointer { - (output) -> Int in + var length: Int = 0 + let result = Array(unsafeUninitializedCapacity: uChars.count) { + buffer, initializedCount in var err = __swift_stdlib_U_ZERO_ERROR - return Int(truncatingIfNeeded: + length = Int(truncatingIfNeeded: __swift_stdlib_u_strToUpper( - output.baseAddress._unsafelyUnwrappedUnchecked, - Int32(output.count), + buffer.baseAddress._unsafelyUnwrappedUnchecked, + Int32(buffer.count), uChars.baseAddress._unsafelyUnwrappedUnchecked, Int32(uChars.count), "", &err)) + initializedCount = min(length, uChars.count) } - if len > uChars.count { + if length > uChars.count { var err = __swift_stdlib_U_ZERO_ERROR - result = Array(repeating: 0, count: len) - result.withUnsafeMutableBufferPointer { - output -> Void in + return Array(unsafeUninitializedCapacity: length) { + buffer, initializedCount in __swift_stdlib_u_strToUpper( - output.baseAddress._unsafelyUnwrappedUnchecked, - Int32(output.count), + buffer.baseAddress._unsafelyUnwrappedUnchecked, + Int32(buffer.count), uChars.baseAddress._unsafelyUnwrappedUnchecked, Int32(uChars.count), "", &err) + initializedCount = length } } return result diff --git a/stdlib/public/runtime/EnvironmentVariables.cpp b/stdlib/public/runtime/EnvironmentVariables.cpp index dfaf099d8a16f..0bcb7d9301abd 100644 --- a/stdlib/public/runtime/EnvironmentVariables.cpp +++ b/stdlib/public/runtime/EnvironmentVariables.cpp @@ -118,7 +118,7 @@ void printHelp(const char *extra) { // Initialization code. OnceToken_t swift::runtime::environment::initializeToken; -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__linux__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__) extern "C" char **environ; #define ENVIRON environ #elif defined(_WIN32) diff --git a/stdlib/public/runtime/HeapObject.cpp b/stdlib/public/runtime/HeapObject.cpp index 9c38b5ed1d5e5..c409c23731e16 100644 --- a/stdlib/public/runtime/HeapObject.cpp +++ b/stdlib/public/runtime/HeapObject.cpp @@ -887,6 +887,23 @@ WeakReference *swift::swift_weakTakeAssign(WeakReference *dest, #ifndef NDEBUG +/// Returns true if the "immutable" flag is set on \p object. +/// +/// Used for runtime consistency checking of COW buffers. +SWIFT_RUNTIME_EXPORT +bool _swift_isImmutableCOWBuffer(HeapObject *object) { + return object->refCounts.isImmutableCOWBuffer(); +} + +/// Sets the "immutable" flag on \p object to \p immutable and returns the old +/// value of the flag. +/// +/// Used for runtime consistency checking of COW buffers. +SWIFT_RUNTIME_EXPORT +bool _swift_setImmutableCOWBuffer(HeapObject *object, bool immutable) { + return object->refCounts.setIsImmutableCOWBuffer(immutable); +} + void HeapObject::dump() const { auto *Self = const_cast(this); printf("HeapObject: %p\n", Self); diff --git a/stdlib/public/runtime/KeyPaths.cpp b/stdlib/public/runtime/KeyPaths.cpp index ba3f221b923ac..faa6292413678 100644 --- a/stdlib/public/runtime/KeyPaths.cpp +++ b/stdlib/public/runtime/KeyPaths.cpp @@ -68,7 +68,7 @@ namespace { } // These functions are all implemented in the stdlib. Their type -// parameters are passed impliictly in the isa of the key path. +// parameters are passed implicitly in the isa of the key path. extern "C" SWIFT_CC(swift) void diff --git a/stdlib/public/runtime/Metadata.cpp b/stdlib/public/runtime/Metadata.cpp index 3bbc55b13f1ed..10f8d00f37ba1 100644 --- a/stdlib/public/runtime/Metadata.cpp +++ b/stdlib/public/runtime/Metadata.cpp @@ -5648,13 +5648,8 @@ static bool referencesAnonymousContext(Demangle::Node *node) { } void swift::verifyMangledNameRoundtrip(const Metadata *metadata) { - // Enable verification when a special environment variable is set. - // Some metatypes crash when going through the mangler or demangler. A - // lot of tests currently trigger those crashes, resulting in failing - // tests which are still usefully testing something else. This - // variable lets us easily turn on verification to find and fix these - // bugs. Remove this and leave it permanently on once everything works - // with it enabled. + // Enable verification when a special environment variable is set. This helps + // us stress test the mangler/demangler and type lookup machinery. if (!swift::runtime::environment::SWIFT_ENABLE_MANGLED_NAME_VERIFICATION()) return; diff --git a/stdlib/public/runtime/RefCount.cpp b/stdlib/public/runtime/RefCount.cpp index 4dc7394f92540..b38f334fb0e21 100644 --- a/stdlib/public/runtime/RefCount.cpp +++ b/stdlib/public/runtime/RefCount.cpp @@ -156,6 +156,28 @@ void _swift_stdlib_immortalize(void *obj) { heapObj->refCounts.setIsImmortal(true); } +#ifndef NDEBUG +// SideTableRefCountBits specialization intentionally does not exist. +template <> +bool RefCounts::isImmutableCOWBuffer() { + if (!hasSideTable()) + return false; + HeapObjectSideTableEntry *sideTable = allocateSideTable(false); + assert(sideTable); + return sideTable->isImmutableCOWBuffer(); +} + +template <> +bool RefCounts::setIsImmutableCOWBuffer(bool immutable) { + HeapObjectSideTableEntry *sideTable = allocateSideTable(false); + assert(sideTable); + bool oldValue = sideTable->isImmutableCOWBuffer(); + sideTable->setIsImmutableCOWBuffer(immutable); + return oldValue; +} + +#endif + // namespace swift } // namespace swift diff --git a/test/AutoDiff/IRGen/differentiable_function.sil b/test/AutoDiff/IRGen/differentiable_function.sil index 45588d1db0298..902693795502d 100644 --- a/test/AutoDiff/IRGen/differentiable_function.sil +++ b/test/AutoDiff/IRGen/differentiable_function.sil @@ -29,7 +29,7 @@ bb0: %jvpThick = thin_to_thick_function %jvp : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float) to $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float) %vjp = function_ref @f_vjp : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float) %vjpThick = thin_to_thick_function %vjp : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float) to $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float) - %result = differentiable_function [parameters 0] %origThick : $@callee_guaranteed (Float) -> Float with_derivative {%jvpThick : $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), %vjpThick : $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} + %result = differentiable_function [parameters 0] [results 0] %origThick : $@callee_guaranteed (Float) -> Float with_derivative {%jvpThick : $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), %vjpThick : $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} return %result : $@differentiable @callee_guaranteed (Float) -> Float } diff --git a/test/AutoDiff/SIL/Serialization/differentiable_function_type.swift b/test/AutoDiff/SIL/Serialization/differentiable_function_type.swift index e250cfe587626..b3cfa0c2a6c72 100644 --- a/test/AutoDiff/SIL/Serialization/differentiable_function_type.swift +++ b/test/AutoDiff/SIL/Serialization/differentiable_function_type.swift @@ -13,6 +13,7 @@ sil_stage raw import Swift import _Differentiation +// Normal `@differentiable` function type. sil @a : $@convention(thin) (@differentiable (Float) -> Float) -> @differentiable (Float) -> Float { bb0(%0 : $@differentiable (Float) -> Float): return %0 : $@differentiable (Float) -> Float @@ -23,6 +24,7 @@ bb0(%0 : $@differentiable (Float) -> Float): // CHECK: return [[ARG]] : $@differentiable (Float) -> Float // CHECK: } +// Linear `@differentiable` function type. sil @b : $@convention(thin) (@differentiable(linear) (Float) -> Float) -> @differentiable(linear) (Float) -> Float { bb0(%0 : $@differentiable(linear) (Float) -> Float): return %0 : $@differentiable(linear) (Float) -> Float @@ -33,6 +35,7 @@ bb0(%0 : $@differentiable(linear) (Float) -> Float): // CHECK: return [[ARG]] : $@differentiable(linear) (Float) -> Float // CHECK: } +// Normal `@differentiable` function type with `@noDerivative` parameters. sil @c : $@convention(thin) (@differentiable (Float, @noDerivative Float) -> Float) -> @differentiable (Float, @noDerivative Float) -> Float { bb0(%0 : $@differentiable (Float, @noDerivative Float) -> Float): return %0 : $@differentiable (Float, @noDerivative Float) -> Float @@ -43,6 +46,7 @@ bb0(%0 : $@differentiable (Float, @noDerivative Float) -> Float): // CHECK: return %0 : $@differentiable (Float, @noDerivative Float) -> Float // CHECK: } +// Linear `@differentiable` function type with `@noDerivative` parameters. sil @d : $@convention(thin) (@differentiable(linear) (Float, @noDerivative Float) -> Float) -> @differentiable(linear) (Float, @noDerivative Float) -> Float { bb0(%0 : $@differentiable(linear) (Float, @noDerivative Float) -> Float): return %0 : $@differentiable(linear) (Float, @noDerivative Float) -> Float @@ -52,3 +56,25 @@ bb0(%0 : $@differentiable(linear) (Float, @noDerivative Float) -> Float): // CHECK: bb0(%0 : $@differentiable(linear) (Float, @noDerivative Float) -> Float): // CHECK: return %0 : $@differentiable(linear) (Float, @noDerivative Float) -> Float // CHECK: } + +// Normal `@differentiable` function type with `@noDerivative` parameters and results. +sil @e : $@convention(thin) (@differentiable (Float, @noDerivative Float) -> (Float, @noDerivative Float)) -> @differentiable (Float, @noDerivative Float) -> (Float, @noDerivative Float) { +bb0(%0 : $@differentiable (Float, @noDerivative Float) -> (Float, @noDerivative Float)): + return %0 : $@differentiable (Float, @noDerivative Float) -> (Float, @noDerivative Float) +} + +// CHECK-LABEL: sil @e : $@convention(thin) (@differentiable (Float, @noDerivative Float) -> (Float, @noDerivative Float)) -> @differentiable (Float, @noDerivative Float) -> (Float, @noDerivative Float) { +// CHECK: bb0(%0 : $@differentiable (Float, @noDerivative Float) -> (Float, @noDerivative Float)): +// CHECK: return %0 : $@differentiable (Float, @noDerivative Float) -> (Float, @noDerivative Float) +// CHECK: } + +// Linear `@differentiable` function type with `@noDerivative` parameters and results. +sil @f : $@convention(thin) (@differentiable(linear) (Float, @noDerivative Float) -> (Float, @noDerivative Float)) -> @differentiable(linear) (Float, @noDerivative Float) -> (Float, @noDerivative Float) { +bb0(%0 : $@differentiable(linear) (Float, @noDerivative Float) -> (Float, @noDerivative Float)): + return %0 : $@differentiable(linear) (Float, @noDerivative Float) -> (Float, @noDerivative Float) +} + +// CHECK-LABEL: sil @f : $@convention(thin) (@differentiable(linear) (Float, @noDerivative Float) -> (Float, @noDerivative Float)) -> @differentiable(linear) (Float, @noDerivative Float) -> (Float, @noDerivative Float) { +// CHECK: bb0(%0 : $@differentiable(linear) (Float, @noDerivative Float) -> (Float, @noDerivative Float)): +// CHECK: return %0 : $@differentiable(linear) (Float, @noDerivative Float) -> (Float, @noDerivative Float) +// CHECK: } diff --git a/test/AutoDiff/SIL/differentiable_function_inst.sil b/test/AutoDiff/SIL/differentiable_function_inst.sil index 9bb43d71f7113..dec9293967abc 100644 --- a/test/AutoDiff/SIL/differentiable_function_inst.sil +++ b/test/AutoDiff/SIL/differentiable_function_inst.sil @@ -31,11 +31,24 @@ import _Differentiation sil @function : $@convention(thin) (Float) -> Float sil @function_vjp : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float) +sil @foo : $@convention(thin) (Float, Float, Float) -> (Float, Float) +sil @foo_vjp : $@convention(thin) (Float, Float, Float) -> (Float, Float, @owned @callee_guaranteed (Float) -> Float) + +sil @make_differentiable_func : $@convention(thin) () -> @differentiable @convention(thin) (Float, Float, @noDerivative Float) -> (Float, @noDerivative Float) { +// sil @make_differentiable_func : $@convention(thin) () -> () { +bb0: + %orig_fn = function_ref @foo : $@convention(thin) (Float, Float, Float) -> (Float, Float) + %vjp_fn = function_ref @foo_vjp : $@convention(thin) (Float, Float, Float) -> (Float, Float, @owned @callee_guaranteed (Float) -> Float) + %diff_fn = differentiable_function [parameters 0 1] [results 0] %orig_fn : $@convention(thin) (Float, Float, Float) -> (Float, Float) with_derivative {undef : $@convention(thin) (Float, Float, Float) -> (Float, Float, @owned @callee_guaranteed (Float) -> Float), %vjp_fn : $@convention(thin) (Float, Float, Float) -> (Float, Float, @owned @callee_guaranteed (Float) -> Float)} + %extracted_vjp = differentiable_function_extract [vjp] %diff_fn : $@differentiable @convention(thin) (Float, Float, @noDerivative Float) -> (Float, @noDerivative Float) + return %diff_fn : $@differentiable @convention(thin) (Float, Float, @noDerivative Float) -> (Float, @noDerivative Float) +} + sil @make_differentiable_function : $@convention(thin) () -> @differentiable @convention(thin) (Float) -> Float { bb0: %orig_fn = function_ref @function : $@convention(thin) (Float) -> Float %vjp_fn = function_ref @function_vjp : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float) - %diff_fn = differentiable_function [parameters 0] %orig_fn : $@convention(thin) (Float) -> Float with_derivative {undef : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), %vjp_fn : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} + %diff_fn = differentiable_function [parameters 0] [results 0] %orig_fn : $@convention(thin) (Float) -> Float with_derivative {undef : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), %vjp_fn : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} %extracted_vjp = differentiable_function_extract [vjp] %diff_fn : $@differentiable @convention(thin) (Float) -> Float %extracted_original = differentiable_function_extract [original] %diff_fn : $@differentiable @convention(thin) (Float) -> Float return %diff_fn : $@differentiable @convention(thin) (Float) -> Float @@ -44,7 +57,7 @@ bb0: // CHECK-SIL-LABEL: @make_differentiable_function : $@convention(thin) () -> @differentiable @convention(thin) (Float) -> Float { // CHECK-SIL: [[ORIG_FN:%.*]] = function_ref @function : $@convention(thin) (Float) -> Float // CHECK-SIL: [[VJP_FN:%.*]] = function_ref @function_vjp : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float) -// CHECK-SIL: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [[ORIG_FN]] : $@convention(thin) (Float) -> Float with_derivative {undef : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), [[VJP_FN]] : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} +// CHECK-SIL: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [results 0] [[ORIG_FN]] : $@convention(thin) (Float) -> Float with_derivative {undef : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), [[VJP_FN]] : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} // CHECK-SIL: [[EXTRACTED_VJP_FN:%.*]] = differentiable_function_extract [vjp] [[DIFF_FN]] : $@differentiable @convention(thin) (Float) -> Float // CHECK-SIL: [[EXTRACTED_ORIG_FN:%.*]] = differentiable_function_extract [original] [[DIFF_FN]] : $@differentiable @convention(thin) (Float) -> Float // CHECK-SIL: return [[DIFF_FN]] : $@differentiable @convention(thin) (Float) -> Float @@ -60,20 +73,20 @@ sil @examplemethod : $@convention(method) (Float, Float, Float) -> Float sil @test_roundtrip_parse : $@convention(thin) () -> () { bb0: %0 = function_ref @examplefunc : $@convention(thin) (Float, Float, Float) -> Float - %1 = differentiable_function [parameters 0 1 2] %0 : $@convention(thin) (Float, Float, Float) -> Float with_derivative {undef : $@convention(thin) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float, Float, Float) -> Float), undef : $@convention(thin) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float) -> (Float, Float, Float))} + %1 = differentiable_function [parameters 0 1 2] [results 0] %0 : $@convention(thin) (Float, Float, Float) -> Float with_derivative {undef : $@convention(thin) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float, Float, Float) -> Float), undef : $@convention(thin) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float) -> (Float, Float, Float))} // CHECK-SIL: %2 = differentiable_function_extract [vjp] %1 : $@differentiable @convention(thin) (Float, Float, Float) -> Float %2 = differentiable_function_extract [vjp] %1 : $@differentiable @convention(thin) (Float, Float, Float) -> Float - %3 = differentiable_function [parameters 0] %0 : $@convention(thin) (Float, Float, Float) -> Float with_derivative {undef : $@convention(thin) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), undef : $@convention(thin) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} + %3 = differentiable_function [parameters 0] [results 0] %0 : $@convention(thin) (Float, Float, Float) -> Float with_derivative {undef : $@convention(thin) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), undef : $@convention(thin) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} // CHECK-SIL: %4 = differentiable_function_extract [vjp] %3 : $@differentiable @convention(thin) (Float, @noDerivative Float, @noDerivative Float) -> Float %4 = differentiable_function_extract [vjp] %3 : $@differentiable @convention(thin) (Float, @noDerivative Float, @noDerivative Float) -> Float %5 = function_ref @examplemethod : $@convention(method) (Float, Float, Float) -> Float - %6 = differentiable_function [parameters 0 1 2] %5 : $@convention(method) (Float, Float, Float) -> Float with_derivative {undef : $@convention(method) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float, Float, Float) -> Float), undef : $@convention(method) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float) -> (Float, Float, Float))} + %6 = differentiable_function [parameters 0 1 2] [results 0] %5 : $@convention(method) (Float, Float, Float) -> Float with_derivative {undef : $@convention(method) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float, Float, Float) -> Float), undef : $@convention(method) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float) -> (Float, Float, Float))} // CHECK-SIL: %7 = differentiable_function_extract [vjp] %6 : $@differentiable @convention(method) (Float, Float, Float) -> Float %7 = differentiable_function_extract [vjp] %6 : $@differentiable @convention(method) (Float, Float, Float) -> Float - %8 = differentiable_function [parameters 0] %5 : $@convention(method) (Float, Float, Float) -> Float with_derivative {undef : $@convention(method) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), undef : $@convention(method) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} + %8 = differentiable_function [parameters 0] [results 0] %5 : $@convention(method) (Float, Float, Float) -> Float with_derivative {undef : $@convention(method) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), undef : $@convention(method) (Float, Float, Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} // CHECK-SIL: %9 = differentiable_function_extract [vjp] %8 : $@differentiable @convention(method) (Float, @noDerivative Float, @noDerivative Float) -> Float %9 = differentiable_function_extract [vjp] %8 : $@differentiable @convention(method) (Float, @noDerivative Float, @noDerivative Float) -> Float diff --git a/test/AutoDiff/SIL/linear_function_inst.sil b/test/AutoDiff/SIL/linear_function_inst.sil index b4323649cc8d8..46d335e909633 100644 --- a/test/AutoDiff/SIL/linear_function_inst.sil +++ b/test/AutoDiff/SIL/linear_function_inst.sil @@ -35,7 +35,7 @@ bb0(%0 : $Float, %1 : $Float): return %2 : $(Float, Float) } -sil @make_diff_func : $@convention(thin) () -> @differentiable(linear) @convention(thin) (Float, @noDerivative Float, @noDerivative Float) -> Float { +sil @make_linear_func : $@convention(thin) () -> @differentiable(linear) @convention(thin) (Float, @noDerivative Float, @noDerivative Float) -> Float { bb0: %orig = function_ref @foo : $@convention(thin) (Float, Float, Float) -> Float %linear_orig = linear_function [parameters 0] %orig : $@convention(thin) (Float, Float, Float) -> Float @@ -47,7 +47,7 @@ bb0: } -// CHECK-SIL-LABEL: sil @make_diff_func : $@convention(thin) () -> @differentiable(linear) @convention(thin) (Float, @noDerivative Float, @noDerivative Float) -> Float { +// CHECK-SIL-LABEL: sil @make_linear_func : $@convention(thin) () -> @differentiable(linear) @convention(thin) (Float, @noDerivative Float, @noDerivative Float) -> Float { // CHECK-SIL: bb0: // CHECK-SIL: [[ORIG:%.*]] = function_ref @foo : $@convention(thin) (Float, Float, Float) -> Float // CHECK-SIL: [[LIN_ORIG:%.*]] = linear_function [parameters 0] [[ORIG]] : $@convention(thin) (Float, Float, Float) -> Float diff --git a/test/AutoDiff/SILGen/differentiable_function.swift b/test/AutoDiff/SILGen/differentiable_function.swift index 9478ed2f86b4b..70be93417c5d9 100644 --- a/test/AutoDiff/SILGen/differentiable_function.swift +++ b/test/AutoDiff/SILGen/differentiable_function.swift @@ -120,7 +120,7 @@ func apply() { // CHECK-LABEL: @{{.*}}apply{{.*}} // CHECK: [[ORIG:%.*]] = function_ref @{{.*}}thin{{.*}} : $@convention(thin) (Float) -> Float // CHECK-NEXT: [[ORIG_THICK:%.*]] = thin_to_thick_function [[ORIG]] : $@convention(thin) (Float) -> Float to $@callee_guaranteed (Float) -> Float -// CHECK-NEXT: [[DIFFED:%.*]] = differentiable_function [parameters 0] [[ORIG_THICK]] : $@callee_guaranteed (Float) -> Float +// CHECK-NEXT: [[DIFFED:%.*]] = differentiable_function [parameters 0] [results 0] [[ORIG_THICK]] : $@callee_guaranteed (Float) -> Float // CHECK: [[ORIG:%.*]] = function_ref @{{.*}}thin{{.*}} : $@convention(thin) (Float) -> Float // CHECK-NEXT: [[ORIG_THICK:%.*]] = thin_to_thick_function [[ORIG]] : $@convention(thin) (Float) -> Float to $@callee_guaranteed (Float) -> Float // CHECK-NEXT: [[LIN:%.*]] = linear_function [parameters 0] [[ORIG_THICK]] : $@callee_guaranteed (Float) -> Float diff --git a/test/AutoDiff/SILGen/reabstraction.swift b/test/AutoDiff/SILGen/reabstraction.swift index 34742563aff39..c3accb2612740 100644 --- a/test/AutoDiff/SILGen/reabstraction.swift +++ b/test/AutoDiff/SILGen/reabstraction.swift @@ -20,7 +20,7 @@ func makeSignatureAbstract() { } // CHECK-LABEL: sil{{.*}}@makeSignatureAbstract -// CHECK: [[BEFORE:%.*]] = differentiable_function [parameters 0] +// CHECK: [[BEFORE:%.*]] = differentiable_function [parameters 0] [results 0] // CHECK: [[BEFORE_BORROWED:%.*]] = begin_borrow [[BEFORE]] // CHECK: [[ORIG_0:%.*]] = differentiable_function_extract [original] [[BEFORE_BORROWED]] // CHECK: [[ORIG_1:%.*]] = copy_value [[ORIG_0]] @@ -37,7 +37,7 @@ func makeSignatureAbstract() { // CHECK: [[VJP_THUNK:%.*]] = function_ref {{.*}} : $@convention(thin) (@in_guaranteed Float, @guaranteed @callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)) -> (@out Float, @owned @callee_guaranteed @substituted <τ_0_0, τ_0_1> (@in_guaranteed τ_0_0) -> @out τ_0_1 for ) // CHECK: [[VJP_2:%.*]] = partial_apply [callee_guaranteed] [[VJP_THUNK]]([[VJP_1]]) // CHECK: [[VJP_3:%.*]] = convert_function [[VJP_2]] -// CHECK: [[AFTER:%.*]] = differentiable_function [parameters 0] [[ORIG_3]] {{.*}} with_derivative {[[JVP_3]] {{.*}}, [[VJP_3]] {{.*}}} +// CHECK: [[AFTER:%.*]] = differentiable_function [parameters 0] [results 0] [[ORIG_3]] {{.*}} with_derivative {[[JVP_3]] {{.*}}, [[VJP_3]] {{.*}}} // CHECK: [[TRIGGER:%.*]] = function_ref @triggerReabstraction1 // CHECK: apply [[TRIGGER]]([[AFTER]]) @@ -64,7 +64,7 @@ func makeOpaque() { // CHECK: [[VJP_THUNK:%.*]] = function_ref {{.*}} : $@convention(thin) (@in_guaranteed Float, @guaranteed @callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)) -> (@out Float, @out @callee_guaranteed @substituted <τ_0_0, τ_0_1> (@in_guaranteed τ_0_0) -> @out τ_0_1 for ) // CHECK: [[VJP_2:%.*]] = partial_apply [callee_guaranteed] [[VJP_THUNK]]([[VJP_1]]) // CHECK: [[VJP_3:%.*]] = convert_function [[VJP_2]] -// CHECK: [[AFTER:%.*]] = differentiable_function [parameters 0] [[ORIG_3]] {{.*}} with_derivative {[[JVP_3]] {{.*}}, [[VJP_3]] {{.*}}} +// CHECK: [[AFTER:%.*]] = differentiable_function [parameters 0] [results 0] [[ORIG_3]] {{.*}} with_derivative {[[JVP_3]] {{.*}}, [[VJP_3]] {{.*}}} // CHECK: store [[AFTER]] to [init] [[STACK_ADDR]] // CHECK: [[TRIGGER:%.*]] = function_ref @triggerReabstraction2 // CHECK: apply [[TRIGGER]]<@differentiable (Float) -> Float>([[STACK_ADDR]]) @@ -79,4 +79,4 @@ func makeSignatureDirect() { // CHECK: [[ORIG_1:%.*]] = partial_apply [callee_guaranteed] [[ORIG_0]]() // CHECK: [[THUNK:%.*]] = function_ref {{.*}} : $@convention(thin) (Float, @guaranteed @callee_guaranteed (@in_guaranteed Float) -> @out Float) -> Float // CHECK: [[ORIG_2:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[ORIG_1]]) -// CHECK: differentiable_function [parameters 0] [[ORIG_2]] +// CHECK: differentiable_function [parameters 0] [results 0] [[ORIG_2]] diff --git a/test/AutoDiff/SILGen/vtable.swift b/test/AutoDiff/SILGen/vtable.swift index e936967b7ea5c..782a08b347de7 100644 --- a/test/AutoDiff/SILGen/vtable.swift +++ b/test/AutoDiff/SILGen/vtable.swift @@ -100,7 +100,7 @@ class SubSub: Sub {} // CHECK-LABEL: sil hidden [transparent] [thunk] [ossa] @AD__${{.*}}5SuperC6methody{{.*}}jvp_src_0_wrt_0_vtable_entry_thunk : $@convention(method) (Float, Float, @guaranteed Super) -> (Float, @owned @callee_guaranteed (Float) -> Float) { // CHECK: bb0(%0 : $Float, %1 : $Float, %2 : @guaranteed $Super): // CHECK: %3 = function_ref @$s6vtable5SuperC6methodyS2f_SftF : $@convention(method) (Float, Float, @guaranteed Super) -> Float -// CHECK: %4 = differentiable_function [parameters 0] %3 : $@convention(method) (Float, Float, @guaranteed Super) -> Float +// CHECK: %4 = differentiable_function [parameters 0] [results 0] %3 : $@convention(method) (Float, Float, @guaranteed Super) -> Float // CHECK: %5 = differentiable_function_extract [jvp] %4 : $@differentiable @convention(method) (Float, @noDerivative Float, @noDerivative @guaranteed Super) -> Float // CHECK: %6 = apply %5(%0, %1, %2) : $@convention(method) (Float, Float, @guaranteed Super) -> (Float, @owned @callee_guaranteed (Float) -> Float) // CHECK: return %6 : $(Float, @callee_guaranteed (Float) -> Float) diff --git a/test/AutoDiff/SILGen/witness_table.swift b/test/AutoDiff/SILGen/witness_table.swift index e3aca90682e63..6129c2d1ccf0e 100644 --- a/test/AutoDiff/SILGen/witness_table.swift +++ b/test/AutoDiff/SILGen/witness_table.swift @@ -36,28 +36,28 @@ struct Struct: Protocol { // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @AD__${{.*}}method{{.*}}_jvp_SUU : $@convention(witness_method: Protocol) (Float, Double, @in_guaranteed Struct) -> (Float, @owned @callee_guaranteed (Float) -> Float) { // CHECK: [[ORIG_FN:%.*]] = function_ref {{.*}}method{{.*}} : $@convention(method) (Float, Double, Struct) -> Float - // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [[ORIG_FN]] + // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [results 0] [[ORIG_FN]] // CHECK: [[JVP_FN:%.*]] = differentiable_function_extract [jvp] [[DIFF_FN]] // CHECK: apply [[JVP_FN]] // CHECK: } // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @AD__${{.*}}method{{.*}}_vjp_SUU : $@convention(witness_method: Protocol) (Float, Double, @in_guaranteed Struct) -> (Float, @owned @callee_guaranteed (Float) -> Float) { // CHECK: [[ORIG_FN:%.*]] = function_ref {{.*}}method{{.*}} : $@convention(method) (Float, Double, Struct) -> Float - // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [[ORIG_FN]] + // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [results 0] [[ORIG_FN]] // CHECK: [[VJP_FN:%.*]] = differentiable_function_extract [vjp] [[DIFF_FN]] // CHECK: apply [[VJP_FN]] // CHECK: } // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @AD__${{.*}}method{{.*}}_jvp_SSS : $@convention(witness_method: Protocol) (Float, Double, @in_guaranteed Struct) -> (Float, @owned @callee_guaranteed @substituted <τ_0_0> (Float, Double, @in_guaranteed τ_0_0) -> Float for ) { // CHECK: [[ORIG_FN:%.*]] = function_ref {{.*}}method{{.*}} : $@convention(method) (Float, Double, Struct) -> Float - // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0 1 2] [[ORIG_FN]] + // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0 1 2] [results 0] [[ORIG_FN]] // CHECK: [[JVP_FN:%.*]] = differentiable_function_extract [jvp] [[DIFF_FN]] // CHECK: apply [[JVP_FN]] // CHECK: } // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @AD__${{.*}}method{{.*}}_vjp_SSS : $@convention(witness_method: Protocol) (Float, Double, @in_guaranteed Struct) -> (Float, @owned @callee_guaranteed @substituted <τ_0_0> (Float) -> (Float, Double, @out τ_0_0) for ) { // CHECK: [[ORIG_FN:%.*]] = function_ref {{.*}}method{{.*}} : $@convention(method) (Float, Double, Struct) -> Float - // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0 1 2] [[ORIG_FN]] + // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0 1 2] [results 0] [[ORIG_FN]] // CHECK: [[VJP_FN:%.*]] = differentiable_function_extract [vjp] [[DIFF_FN]] // CHECK: apply [[VJP_FN]] // CHECK: } @@ -70,14 +70,14 @@ struct Struct: Protocol { // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @AD__${{.*}}property{{.*}}_jvp_S : $@convention(witness_method: Protocol) (@in_guaranteed Struct) -> (Float, @owned @callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> Float for ) { // CHECK: [[ORIG_FN:%.*]] = function_ref {{.*}}property{{.*}} : $@convention(method) (Struct) -> Float - // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [[ORIG_FN]] + // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [results 0] [[ORIG_FN]] // CHECK: [[JVP_FN:%.*]] = differentiable_function_extract [jvp] [[DIFF_FN]] // CHECK: apply [[JVP_FN]] // CHECK: } // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @AD__${{.*}}property{{.*}}_vjp_S : $@convention(witness_method: Protocol) (@in_guaranteed Struct) -> (Float, @owned @callee_guaranteed @substituted <τ_0_0> (Float) -> @out τ_0_0 for ) { // CHECK: [[ORIG_FN:%.*]] = function_ref {{.*}}property{{.*}} : $@convention(method) (Struct) -> Float - // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [[ORIG_FN]] + // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [results 0] [[ORIG_FN]] // CHECK: [[VJP_FN:%.*]] = differentiable_function_extract [vjp] [[DIFF_FN]] // CHECK: apply [[VJP_FN]] // CHECK: } @@ -90,14 +90,14 @@ struct Struct: Protocol { // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @AD__$s13witness_table6StructVAA8ProtocolA2aDPyS2f_SftcigTW_jvp_SUU : $@convention(witness_method: Protocol) (Float, Float, @in_guaranteed Struct) -> (Float, @owned @callee_guaranteed (Float) -> Float) { // CHECK: [[ORIG_FN:%.*]] = function_ref @$s13witness_table6StructVyS2f_Sftcig : $@convention(method) (Float, Float, Struct) -> Float - // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [[ORIG_FN]] + // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [results 0] [[ORIG_FN]] // CHECK: [[JVP_FN:%.*]] = differentiable_function_extract [jvp] [[DIFF_FN]] // CHECK: apply [[JVP_FN]] // CHECK: } // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @AD__$s13witness_table6StructVAA8ProtocolA2aDPyS2f_SftcigTW_vjp_SUU : $@convention(witness_method: Protocol) (Float, Float, @in_guaranteed Struct) -> (Float, @owned @callee_guaranteed (Float) -> Float) { // CHECK: [[ORIG_FN:%.*]] = function_ref @$s13witness_table6StructVyS2f_Sftcig : $@convention(method) (Float, Float, Struct) -> Float - // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [[ORIG_FN]] + // CHECK: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [results 0] [[ORIG_FN]] // CHECK: [[VJP_FN:%.*]] = differentiable_function_extract [vjp] [[DIFF_FN]] // CHECK: apply [[VJP_FN]] // CHECK: } diff --git a/test/AutoDiff/SILOptimizer/activity_analysis.swift b/test/AutoDiff/SILOptimizer/activity_analysis.swift index b4360484123a5..bb177b0d5bc97 100644 --- a/test/AutoDiff/SILOptimizer/activity_analysis.swift +++ b/test/AutoDiff/SILOptimizer/activity_analysis.swift @@ -16,7 +16,7 @@ func testNoDerivativeStructProjection(_ s: HasNoDerivativeProperty) -> Float { return tmp.x } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testNoDerivativeStructProjection{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testNoDerivativeStructProjection{{.*}} at (parameters=(0) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $HasNoDerivativeProperty // CHECK: [ACTIVE] %2 = alloc_stack $HasNoDerivativeProperty, var, name "tmp" // CHECK: [ACTIVE] %4 = begin_access [read] [static] %2 : $*HasNoDerivativeProperty @@ -39,7 +39,7 @@ func testNondifferentiableTupleElementAddr(_ x: T) -> T { return tuple.2.0 } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testNondifferentiableTupleElementAddr{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testNondifferentiableTupleElementAddr{{.*}} at (parameters=(0) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $*T // CHECK: [ACTIVE] %1 = argument of bb0 : $*T // CHECK: [ACTIVE] %3 = alloc_stack $(Int, Int, (T, Int), Int), var, name "tuple" @@ -73,7 +73,7 @@ func TF_781(_ x: Float, _ y: Float) -> Float { return result } -// CHECK-LABEL: [AD] Activity info for ${{.*}}TF_781{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}TF_781{{.*}} at (parameters=(0) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $Float // CHECK: [USEFUL] %1 = argument of bb0 : $Float // CHECK: [ACTIVE] %4 = alloc_stack $Float, var, name "result" @@ -100,7 +100,7 @@ func TF_954(_ x: Float) -> Float { return outer } -// CHECK-LABEL: [AD] Activity info for ${{.*}}TF_954{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}TF_954{{.*}} at (parameters=(0) results=(0)) // CHECK: bb0: // CHECK: [ACTIVE] %0 = argument of bb0 : $Float // CHECK: [ACTIVE] %2 = alloc_stack $Float, var, name "outer" @@ -135,7 +135,7 @@ func checked_cast_branch(_ x: Float) -> Float { return x * x } -// CHECK-LABEL: [AD] Activity info for ${{.*}}checked_cast_branch{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}checked_cast_branch{{.*}} at (parameters=(0) results=(0)) // CHECK: bb0: // CHECK: [ACTIVE] %0 = argument of bb0 : $Float // CHECK: [NONE] %2 = metatype $@thin Int.Type @@ -173,7 +173,7 @@ func checked_cast_addr_nonactive_result(_ x: T) -> T { return x } -// CHECK-LABEL: [AD] Activity info for ${{.*}}checked_cast_addr_nonactive_result{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}checked_cast_addr_nonactive_result{{.*}} at (parameters=(0) results=(0)) // CHECK: bb0: // CHECK: [ACTIVE] %0 = argument of bb0 : $*T // CHECK: [ACTIVE] %1 = argument of bb0 : $*T @@ -208,7 +208,7 @@ func checked_cast_addr_active_result(x: T) -> T { return x } -// CHECK-LABEL: [AD] Activity info for ${{.*}}checked_cast_addr_active_result{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}checked_cast_addr_active_result{{.*}} at (parameters=(0) results=(0)) // CHECK: bb0: // CHECK: [ACTIVE] %0 = argument of bb0 : $*T // CHECK: [ACTIVE] %1 = argument of bb0 : $*T @@ -243,7 +243,7 @@ func testArrayUninitializedIntrinsic(_ x: Float, _ y: Float) -> [Float] { return [x, y] } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsic{{.*}} at (source=0 parameters=(0 1)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsic{{.*}} at (parameters=(0 1) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $Float // CHECK: [ACTIVE] %1 = argument of bb0 : $Float // CHECK: [USEFUL] %4 = integer_literal $Builtin.Word, 2 @@ -254,13 +254,15 @@ func testArrayUninitializedIntrinsic(_ x: Float, _ y: Float) -> [Float] { // CHECK: [ACTIVE] %9 = pointer_to_address %8 : $Builtin.RawPointer to [strict] $*Float // CHECK: [VARIED] %11 = integer_literal $Builtin.Word, 1 // CHECK: [ACTIVE] %12 = index_addr %9 : $*Float, %11 : $Builtin.Word +// CHECK: [NONE] // function_ref _finalizeUninitializedArray(_:) +// CHECK: [ACTIVE] %15 = apply %14(%7) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0> @differentiable(where T: Differentiable) func testArrayUninitializedIntrinsicGeneric(_ x: T, _ y: T) -> [T] { return [x, y] } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsicGeneric{{.*}} at (source=0 parameters=(0 1)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsicGeneric{{.*}} at (parameters=(0 1) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $*T // CHECK: [ACTIVE] %1 = argument of bb0 : $*T // CHECK: [USEFUL] %4 = integer_literal $Builtin.Word, 2 @@ -271,6 +273,8 @@ func testArrayUninitializedIntrinsicGeneric(_ x: T, _ y: T) -> [T] { // CHECK: [ACTIVE] %9 = pointer_to_address %8 : $Builtin.RawPointer to [strict] $*T // CHECK: [VARIED] %11 = integer_literal $Builtin.Word, 1 // CHECK: [ACTIVE] %12 = index_addr %9 : $*T, %11 : $Builtin.Word +// CHECK: [NONE] // function_ref _finalizeUninitializedArray(_:) +// CHECK: [ACTIVE] %15 = apply %14(%7) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0> // TF-952: Test array literal initialized from an address (e.g. `var`). @differentiable @@ -279,7 +283,7 @@ func testArrayUninitializedIntrinsicAddress(_ x: Float, _ y: Float) -> [Float] { result = result * y return [result, result] } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsicAddress{{.*}} at (source=0 parameters=(0 1)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsicAddress{{.*}} at (parameters=(0 1) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $Float // CHECK: [ACTIVE] %1 = argument of bb0 : $Float // CHECK: [ACTIVE] %4 = alloc_stack $Float, var, name "result" @@ -298,13 +302,15 @@ func testArrayUninitializedIntrinsicAddress(_ x: Float, _ y: Float) -> [Float] { // CHECK: [VARIED] %24 = integer_literal $Builtin.Word, 1 // CHECK: [ACTIVE] %25 = index_addr %20 : $*Float, %24 : $Builtin.Word // CHECK: [ACTIVE] %26 = begin_access [read] [static] %4 : $*Float +// CHECK: [NONE] // function_ref _finalizeUninitializedArray(_:) +// CHECK: [ACTIVE] %30 = apply %29(%18) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0> // TF-952: Test array literal initialized with `apply` direct results. @differentiable func testArrayUninitializedIntrinsicFunctionResult(_ x: Float, _ y: Float) -> [Float] { return [x * y, x * y] } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsicFunctionResult{{.*}} at (source=0 parameters=(0 1)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsicFunctionResult{{.*}} at (parameters=(0 1) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $Float // CHECK: [ACTIVE] %1 = argument of bb0 : $Float // CHECK: [USEFUL] %4 = integer_literal $Builtin.Word, 2 @@ -320,6 +326,8 @@ func testArrayUninitializedIntrinsicFunctionResult(_ x: Float, _ y: Float) -> [F // CHECK: [USEFUL] %16 = metatype $@thin Float.Type // CHECK: [NONE] // function_ref static Float.* infix(_:_:) // CHECK: [ACTIVE] %18 = apply %17(%0, %1, %16) : $@convention(method) (Float, Float, @thin Float.Type) -> Float +// CHECK: [NONE] // function_ref _finalizeUninitializedArray(_:) +// CHECK: [ACTIVE] %21 = apply %20(%7) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0> // TF-975: Test nested array literals. @differentiable @@ -327,7 +335,7 @@ func testArrayUninitializedIntrinsicNested(_ x: Float, _ y: Float) -> [Float] { let array = [x, y] return [array[0], array[1]] } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsicNested{{.*}} at (source=0 parameters=(0 1)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsicNested{{.*}} at (parameters=(0 1) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $Float // CHECK: [ACTIVE] %1 = argument of bb0 : $Float // CHECK: [USEFUL] %4 = integer_literal $Builtin.Word, 2 @@ -338,28 +346,32 @@ func testArrayUninitializedIntrinsicNested(_ x: Float, _ y: Float) -> [Float] { // CHECK: [ACTIVE] %9 = pointer_to_address %8 : $Builtin.RawPointer to [strict] $*Float // CHECK: [VARIED] %11 = integer_literal $Builtin.Word, 1 // CHECK: [ACTIVE] %12 = index_addr %9 : $*Float, %11 : $Builtin.Word -// CHECK: [USEFUL] %15 = integer_literal $Builtin.Word, 2 +// CHECK: [NONE] // function_ref _finalizeUninitializedArray(_:) +// CHECK: [ACTIVE] %15 = apply %14(%7) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0> +// CHECK: [USEFUL] %17 = integer_literal $Builtin.Word, 2 // CHECK: [NONE] // function_ref _allocateUninitializedArray(_:) -// CHECK: [ACTIVE] %17 = apply %16(%15) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) -// CHECK: [ACTIVE] (**%18**, %19) = destructure_tuple %17 : $(Array, Builtin.RawPointer) -// CHECK: [VARIED] (%18, **%19**) = destructure_tuple %17 : $(Array, Builtin.RawPointer) -// CHECK: [ACTIVE] %20 = pointer_to_address %19 : $Builtin.RawPointer to [strict] $*Float -// CHECK: [ACTIVE] %21 = begin_borrow %7 : $Array -// CHECK: [USEFUL] %22 = integer_literal $Builtin.IntLiteral, 0 -// CHECK: [USEFUL] %23 = metatype $@thin Int.Type +// CHECK: [ACTIVE] %19 = apply %18(%17) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) +// CHECK: [ACTIVE] (**%20**, %21) = destructure_tuple %19 : $(Array, Builtin.RawPointer) +// CHECK: [VARIED] (%20, **%21**) = destructure_tuple %19 : $(Array, Builtin.RawPointer) +// CHECK: [ACTIVE] %22 = pointer_to_address %21 : $Builtin.RawPointer to [strict] $*Float +// CHECK: [ACTIVE] %23 = begin_borrow %15 : $Array +// CHECK: [USEFUL] %24 = integer_literal $Builtin.IntLiteral, 0 +// CHECK: [USEFUL] %25 = metatype $@thin Int.Type // CHECK: [NONE] // function_ref Int.init(_builtinIntegerLiteral:) -// CHECK: [USEFUL] %25 = apply %24(%22, %23) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int +// CHECK: [USEFUL] %27 = apply %26(%24, %25) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // CHECK: [NONE] // function_ref Array.subscript.getter -// CHECK: [NONE] %27 = apply %26(%20, %25, %21) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0 -// CHECK: [VARIED] %28 = integer_literal $Builtin.Word, 1 -// CHECK: [ACTIVE] %29 = index_addr %20 : $*Float, %28 : $Builtin.Word -// CHECK: [ACTIVE] %30 = begin_borrow %7 : $Array -// CHECK: [USEFUL] %31 = integer_literal $Builtin.IntLiteral, 1 -// CHECK: [USEFUL] %32 = metatype $@thin Int.Type +// CHECK: [NONE] %29 = apply %28(%22, %27, %23) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0 +// CHECK: [VARIED] %30 = integer_literal $Builtin.Word, 1 +// CHECK: [ACTIVE] %31 = index_addr %22 : $*Float, %30 : $Builtin.Word +// CHECK: [ACTIVE] %32 = begin_borrow %15 : $Array +// CHECK: [USEFUL] %33 = integer_literal $Builtin.IntLiteral, 1 +// CHECK: [USEFUL] %34 = metatype $@thin Int.Type // CHECK: [NONE] // function_ref Int.init(_builtinIntegerLiteral:) -// CHECK: [USEFUL] %34 = apply %33(%31, %32) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int +// CHECK: [USEFUL] %36 = apply %35(%33, %34) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // CHECK: [NONE] // function_ref Array.subscript.getter -// CHECK: [NONE] %36 = apply %35(%29, %34, %30) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0 +// CHECK: [NONE] %38 = apply %37(%31, %36, %32) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0 +// CHECK: [NONE] // function_ref _finalizeUninitializedArray(_:) +// CHECK: [ACTIVE] %40 = apply %39(%20) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0> // TF-978: Test array literal initialized with `apply` indirect results. struct Wrapper: Differentiable { @@ -369,7 +381,7 @@ struct Wrapper: Differentiable { func testArrayUninitializedIntrinsicApplyIndirectResult(_ x: T, _ y: T) -> [Wrapper] { return [Wrapper(value: x), Wrapper(value: y)] } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsicApplyIndirectResult{{.*}} at (source=0 parameters=(0 1)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsicApplyIndirectResult{{.*}} at (parameters=(0 1) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $*T // CHECK: [ACTIVE] %1 = argument of bb0 : $*T // CHECK: [USEFUL] %4 = integer_literal $Builtin.Word, 2 @@ -388,6 +400,8 @@ func testArrayUninitializedIntrinsicApplyIndirectResult(_ x: T, _ y: T) -> [W // CHECK: [ACTIVE] %19 = alloc_stack $T // CHECK: [NONE] // function_ref Wrapper.init(value:) // CHECK: [NONE] %22 = apply %21(%17, %19, %18) : $@convention(method) <τ_0_0 where τ_0_0 : Differentiable> (@in τ_0_0, @thin Wrapper<τ_0_0>.Type) -> @out Wrapper<τ_0_0> +// CHECK: [NONE] // function_ref _finalizeUninitializedArray(_:) +// CHECK: [ACTIVE] %25 = apply %24>(%7) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0> //===----------------------------------------------------------------------===// // `inout` argument differentiation @@ -399,7 +413,7 @@ extension Mut { mutating func mutatingMethod(_ x: Mut) {} } -// CHECK-LABEL: [AD] Activity info for ${{.*}}3MutV14mutatingMethodyyACF at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}3MutV14mutatingMethodyyACF at (parameters=(0) results=(0)) // CHECK: [VARIED] %0 = argument of bb0 : $Mut // CHECK: [USEFUL] %1 = argument of bb0 : $*Mut @@ -411,7 +425,7 @@ func nonActiveInoutArg(_ nonactive: inout Mut, _ x: Mut) { nonactive = x } -// CHECK-LABEL: [AD] Activity info for ${{.*}}17nonActiveInoutArgyyAA3MutVz_ADtF at (source=0 parameters=(1)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}17nonActiveInoutArgyyAA3MutVz_ADtF at (parameters=(1) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $*Mut // CHECK: [ACTIVE] %1 = argument of bb0 : $Mut // CHECK: [ACTIVE] %4 = begin_access [modify] [static] %0 : $*Mut @@ -426,7 +440,7 @@ func activeInoutArgMutatingMethod(_ x: Mut) -> Mut { return result } -// CHECK-LABEL: [AD] Activity info for ${{.*}}28activeInoutArgMutatingMethodyAA3MutVADF at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}28activeInoutArgMutatingMethodyAA3MutVADF at (parameters=(0) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $Mut // CHECK: [ACTIVE] %2 = alloc_stack $Mut, var, name "result" // CHECK: [ACTIVE] %4 = begin_access [read] [static] %2 : $*Mut @@ -444,7 +458,7 @@ func activeInoutArgMutatingMethodVar(_ nonactive: inout Mut, _ x: Mut) { nonactive = result } -// CHECK_LABEL: [AD] Activity info for ${{.*}}31activeInoutArgMutatingMethodVaryyAA3MutVz_ADtF at (source=0 parameters=(1)) +// CHECK_LABEL: [AD] Activity info for ${{.*}}31activeInoutArgMutatingMethodVaryyAA3MutVz_ADtF at (parameters=(1) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $*Mut // CHECK: [ACTIVE] %1 = argument of bb0 : $Mut // CHECK: [ACTIVE] %4 = alloc_stack $Mut, var, name "result" @@ -465,7 +479,7 @@ func activeInoutArgMutatingMethodTuple(_ nonactive: inout Mut, _ x: Mut) { nonactive = result.0 } -// CHECK-LABEL: [AD] Activity info for ${{.*}}33activeInoutArgMutatingMethodTupleyyAA3MutVz_ADtF at (source=0 parameters=(1)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}33activeInoutArgMutatingMethodTupleyyAA3MutVz_ADtF at (parameters=(1) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $*Mut // CHECK: [ACTIVE] %1 = argument of bb0 : $Mut // CHECK: [ACTIVE] %4 = alloc_stack $(Mut, Mut), var, name "result" @@ -493,7 +507,7 @@ func activeInoutArg(_ x: Float) -> Float { return result } -// CHECK-LABEL: [AD] Activity info for ${{.*}}activeInoutArg{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}activeInoutArg{{.*}} at (parameters=(0) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $Float // CHECK: [ACTIVE] %2 = alloc_stack $Float, var, name "result" // CHECK: [ACTIVE] %5 = begin_access [modify] [static] %2 : $*Float @@ -509,7 +523,7 @@ func activeInoutArgNonactiveInitialResult(_ x: Float) -> Float { return result } -// CHECK-LABEL: [AD] Activity info for ${{.*}}activeInoutArgNonactiveInitialResult{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}activeInoutArgNonactiveInitialResult{{.*}} at (parameters=(0) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $Float // CHECK: [ACTIVE] %2 = alloc_stack $Float, var, name "result" // CHECK: [NONE] // function_ref Float.init(_builtinIntegerLiteral:) @@ -539,7 +553,7 @@ func testTryApply(_ x: Float) -> Float { } // TF-433: differentiation diagnoses `try_apply` before activity info is printed. -// CHECK-NOT: [AD] Activity info for ${{.*}}testTryApply{{.*}} at (source=0 parameters=(0)) +// CHECK-NOT: [AD] Activity info for ${{.*}}testTryApply{{.*}} at (parameters=(0) results=(0)) //===----------------------------------------------------------------------===// // Coroutine differentiation (`begin_apply`) @@ -564,7 +578,7 @@ func testAccessorCoroutines(_ x: HasCoroutineAccessors) -> HasCoroutineAccessors return x } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testAccessorCoroutines{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testAccessorCoroutines{{.*}} at (parameters=(0) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $HasCoroutineAccessors // CHECK: [ACTIVE] %2 = alloc_stack $HasCoroutineAccessors, var, name "x" // CHECK: [ACTIVE] %4 = begin_access [read] [static] %2 : $*HasCoroutineAccessors @@ -596,7 +610,7 @@ func testBeginApplyActiveInoutArgument(array: [Float], x: Float) -> Float { return array[0] } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testBeginApplyActiveInoutArgument{{.*}} at (source=0 parameters=(0 1)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testBeginApplyActiveInoutArgument{{.*}} at (parameters=(0 1) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $Array // CHECK: [ACTIVE] %1 = argument of bb0 : $Float // CHECK: [ACTIVE] %4 = alloc_stack $Array, var, name "array" @@ -634,7 +648,7 @@ func testBeginApplyActiveButInitiallyNonactiveInoutArgument(x: Float) -> Float { return array[0] } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testBeginApplyActiveButInitiallyNonactiveInoutArgument{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testBeginApplyActiveButInitiallyNonactiveInoutArgument{{.*}} at (parameters=(0) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $Float // CHECK: [ACTIVE] %2 = alloc_stack $Array, var, name "array" // CHECK: [USEFUL] %3 = integer_literal $Builtin.Word, 1 @@ -647,24 +661,26 @@ func testBeginApplyActiveButInitiallyNonactiveInoutArgument(x: Float) -> Float { // CHECK: [USEFUL] %10 = metatype $@thin Float.Type // CHECK: [NONE] // function_ref Float.init(_builtinIntegerLiteral:) // CHECK: [USEFUL] %12 = apply %11(%9, %10) : $@convention(method) (Builtin.IntLiteral, @thin Float.Type) -> Float -// CHECK: [USEFUL] %15 = integer_literal $Builtin.IntLiteral, 0 -// CHECK: [USEFUL] %16 = metatype $@thin Int.Type +// CHECK: [NONE] // function_ref _finalizeUninitializedArray(_:) +// CHECK: [USEFUL] %15 = apply %14(%6) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0> +// CHECK: [USEFUL] %17 = integer_literal $Builtin.IntLiteral, 0 +// CHECK: [USEFUL] %18 = metatype $@thin Int.Type // CHECK: [NONE] // function_ref Int.init(_builtinIntegerLiteral:) -// CHECK: [USEFUL] %18 = apply %17(%15, %16) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int -// CHECK: [ACTIVE] %19 = begin_access [modify] [static] %2 : $*Array +// CHECK: [USEFUL] %20 = apply %19(%17, %18) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int +// CHECK: [ACTIVE] %21 = begin_access [modify] [static] %2 : $*Array // CHECK: [NONE] // function_ref Array.subscript.modify -// CHECK: [ACTIVE] (**%21**, %22) = begin_apply %20(%18, %19) : $@yield_once @convention(method) <τ_0_0> (Int, @inout Array<τ_0_0>) -> @yields @inout τ_0_0 -// CHECK: [VARIED] (%21, **%22**) = begin_apply %20(%18, %19) : $@yield_once @convention(method) <τ_0_0> (Int, @inout Array<τ_0_0>) -> @yields @inout τ_0_0 -// CHECK: [USEFUL] %26 = integer_literal $Builtin.IntLiteral, 0 -// CHECK: [USEFUL] %27 = metatype $@thin Int.Type +// CHECK: [ACTIVE] (**%23**, %24) = begin_apply %22(%20, %21) : $@yield_once @convention(method) <τ_0_0> (Int, @inout Array<τ_0_0>) -> @yields @inout τ_0_0 +// CHECK: [VARIED] (%23, **%24**) = begin_apply %22(%20, %21) : $@yield_once @convention(method) <τ_0_0> (Int, @inout Array<τ_0_0>) -> @yields @inout τ_0_0 +// CHECK: [USEFUL] %28 = integer_literal $Builtin.IntLiteral, 0 +// CHECK: [USEFUL] %29 = metatype $@thin Int.Type // CHECK: [NONE] // function_ref Int.init(_builtinIntegerLiteral:) -// CHECK: [USEFUL] %29 = apply %28(%26, %27) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int -// CHECK: [ACTIVE] %30 = begin_access [read] [static] %2 : $*Array -// CHECK: [ACTIVE] %31 = load_borrow %30 : $*Array -// CHECK: [ACTIVE] %32 = alloc_stack $Float +// CHECK: [USEFUL] %31 = apply %30(%28, %29) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int +// CHECK: [ACTIVE] %32 = begin_access [read] [static] %2 : $*Array +// CHECK: [ACTIVE] %33 = load_borrow %32 : $*Array +// CHECK: [ACTIVE] %34 = alloc_stack $Float // CHECK: [NONE] // function_ref Array.subscript.getter -// CHECK: [NONE] %34 = apply %33(%32, %29, %31) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0 -// CHECK: [ACTIVE] %35 = load [trivial] %32 : $*Float +// CHECK: [NONE] %36 = apply %35(%34, %31, %33) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0 +// CHECK: [ACTIVE] %37 = load [trivial] %34 : $*Float //===----------------------------------------------------------------------===// // Class differentiation @@ -683,7 +699,7 @@ class C: Differentiable { x * float } -// CHECK-LABEL: [AD] Activity info for ${{.*}}1CC6methodyS2fF at (source=0 parameters=(0 1)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}1CC6methodyS2fF at (parameters=(0 1) results=(0)) // CHECK: bb0: // CHECK: [ACTIVE] %0 = argument of bb0 : $Float // CHECK: [ACTIVE] %1 = argument of bb0 : $C @@ -702,7 +718,7 @@ func testClassModifyAccessor(_ c: inout C) { } // FIXME(TF-1176): Some values are incorrectly not marked as active: `%16`, etc. -// CHECK-LABEL: [AD] Activity info for ${{.*}}testClassModifyAccessor{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testClassModifyAccessor{{.*}} at (parameters=(0) results=(0)) // CHECK: [ACTIVE] %0 = argument of bb0 : $*C // CHECK: [NONE] %2 = metatype $@thin Float.Type // CHECK: [ACTIVE] %3 = begin_access [read] [static] %0 : $*C @@ -734,7 +750,7 @@ func testActiveOptional(_ x: Float) -> Float { return maybe! } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testActiveOptional{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testActiveOptional{{.*}} at (parameters=(0) results=(0)) // CHECK: bb0: // CHECK: [ACTIVE] %0 = argument of bb0 : $Float // CHECK: [ACTIVE] %2 = alloc_stack $Optional, var, name "maybe" @@ -777,7 +793,7 @@ func testActiveEnumValue(_ e: DirectEnum, _ x: Float) -> Float { } } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testActiveEnumValue{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testActiveEnumValue{{.*}} at (parameters=(0) results=(0)) // CHECK: bb0: // CHECK: [ACTIVE] %0 = argument of bb0 : $DirectEnum // CHECK: [USEFUL] %1 = argument of bb0 : $Float @@ -818,7 +834,7 @@ func testActiveEnumAddr(_ e: IndirectEnum) -> T { } } -// CHECK-LABEL: [AD] Activity info for ${{.*}}testActiveEnumAddr{{.*}} at (source=0 parameters=(0)) +// CHECK-LABEL: [AD] Activity info for ${{.*}}testActiveEnumAddr{{.*}} at (parameters=(0) results=(0)) // CHECK: bb0: // CHECK: [ACTIVE] %0 = argument of bb0 : $*T // CHECK: [ACTIVE] %1 = argument of bb0 : $*IndirectEnum @@ -827,10 +843,10 @@ func testActiveEnumAddr(_ e: IndirectEnum) -> T { // CHECK: [ACTIVE] %6 = unchecked_take_enum_data_addr %3 : $*IndirectEnum, #IndirectEnum.case1!enumelt // CHECK: [ACTIVE] %7 = alloc_stack $T, let, name "y1" // CHECK: bb2: -// CHECK: [ACTIVE] %14 = unchecked_take_enum_data_addr %3 : $*IndirectEnum, #IndirectEnum.case2!enumelt -// CHECK: [ACTIVE] %15 = tuple_element_addr %14 : $*(Float, T), 0 -// CHECK: [VARIED] %16 = load [trivial] %15 : $*Float -// CHECK: [ACTIVE] %17 = tuple_element_addr %14 : $*(Float, T), 1 -// CHECK: [ACTIVE] %18 = alloc_stack $T, let, name "y2" +// CHECK: [ACTIVE] {{.*}} = unchecked_take_enum_data_addr {{.*}} : $*IndirectEnum, #IndirectEnum.case2!enumelt +// CHECK: [ACTIVE] {{.*}} = tuple_element_addr {{.*}} : $*(Float, T), 0 +// CHECK: [VARIED] {{.*}} = load [trivial] {{.*}} : $*Float +// CHECK: [ACTIVE] {{.*}} = tuple_element_addr {{.*}} : $*(Float, T), 1 +// CHECK: [ACTIVE] {{.*}} = alloc_stack $T, let, name "y2" // CHECK: bb3: -// CHECK: [NONE] %25 = tuple () +// CHECK: [NONE] {{.*}} = tuple () diff --git a/test/AutoDiff/SILOptimizer/derivative_sil.swift b/test/AutoDiff/SILOptimizer/derivative_sil.swift index a3569b42c4c86..b4442b6800b99 100644 --- a/test/AutoDiff/SILOptimizer/derivative_sil.swift +++ b/test/AutoDiff/SILOptimizer/derivative_sil.swift @@ -31,7 +31,7 @@ func foo(_ x: Float) -> Float { // CHECK-SIL: [[ADD_ORIG_REF:%.*]] = function_ref @add : $@convention(method) (Float, Float, @thin Float.Type) -> Float // CHECK-SIL: [[ADD_JVP_REF:%.*]] = differentiability_witness_function [jvp] [parameters 0 1] [results 0] @add // CHECK-SIL: [[ADD_VJP_REF:%.*]] = differentiability_witness_function [vjp] [parameters 0 1] [results 0] @add -// CHECK-SIL: [[ADD_DIFF_FN:%.*]] = differentiable_function [parameters 0 1] [[ADD_ORIG_REF]] : $@convention(method) (Float, Float, @thin Float.Type) -> Float with_derivative {[[ADD_JVP_REF]] : $@convention(method) (Float, Float, @thin Float.Type) -> (Float, @owned @callee_guaranteed (Float, Float) -> Float), [[ADD_VJP_REF]] : $@convention(method) (Float, Float, @thin Float.Type) -> (Float, @owned @callee_guaranteed (Float) -> (Float, Float))} +// CHECK-SIL: [[ADD_DIFF_FN:%.*]] = differentiable_function [parameters 0 1] [results 0] [[ADD_ORIG_REF]] : $@convention(method) (Float, Float, @thin Float.Type) -> Float with_derivative {[[ADD_JVP_REF]] : $@convention(method) (Float, Float, @thin Float.Type) -> (Float, @owned @callee_guaranteed (Float, Float) -> Float), [[ADD_VJP_REF]] : $@convention(method) (Float, Float, @thin Float.Type) -> (Float, @owned @callee_guaranteed (Float) -> (Float, Float))} // CHECK-SIL: [[ADD_JVP_FN:%.*]] = differentiable_function_extract [jvp] [[ADD_DIFF_FN]] // CHECK-SIL: end_borrow [[ADD_DIFF_FN]] // CHECK-SIL: [[ADD_RESULT:%.*]] = apply [[ADD_JVP_FN]]([[X]], [[X]], {{.*}}) @@ -56,7 +56,7 @@ func foo(_ x: Float) -> Float { // CHECK-SIL: [[ADD_ORIG_REF:%.*]] = function_ref @add : $@convention(method) (Float, Float, @thin Float.Type) -> Float // CHECK-SIL: [[ADD_JVP_REF:%.*]] = differentiability_witness_function [jvp] [parameters 0 1] [results 0] @add // CHECK-SIL: [[ADD_VJP_REF:%.*]] = differentiability_witness_function [vjp] [parameters 0 1] [results 0] @add -// CHECK-SIL: [[ADD_DIFF_FN:%.*]] = differentiable_function [parameters 0 1] [[ADD_ORIG_REF]] : $@convention(method) (Float, Float, @thin Float.Type) -> Float with_derivative {[[ADD_JVP_REF]] : $@convention(method) (Float, Float, @thin Float.Type) -> (Float, @owned @callee_guaranteed (Float, Float) -> Float), [[ADD_VJP_REF]] : $@convention(method) (Float, Float, @thin Float.Type) -> (Float, @owned @callee_guaranteed (Float) -> (Float, Float))} +// CHECK-SIL: [[ADD_DIFF_FN:%.*]] = differentiable_function [parameters 0 1] [results 0] [[ADD_ORIG_REF]] : $@convention(method) (Float, Float, @thin Float.Type) -> Float with_derivative {[[ADD_JVP_REF]] : $@convention(method) (Float, Float, @thin Float.Type) -> (Float, @owned @callee_guaranteed (Float, Float) -> Float), [[ADD_VJP_REF]] : $@convention(method) (Float, Float, @thin Float.Type) -> (Float, @owned @callee_guaranteed (Float) -> (Float, Float))} // CHECK-SIL: [[ADD_VJP_FN:%.*]] = differentiable_function_extract [vjp] [[ADD_DIFF_FN]] // CHECK-SIL: end_borrow [[ADD_DIFF_FN]] // CHECK-SIL: [[ADD_RESULT:%.*]] = apply [[ADD_VJP_FN]]([[X]], [[X]], {{.*}}) diff --git a/test/AutoDiff/SILOptimizer/differentiation_function_canonicalization.sil b/test/AutoDiff/SILOptimizer/differentiation_function_canonicalization.sil index da24c907c916c..622a2dd0ad204 100644 --- a/test/AutoDiff/SILOptimizer/differentiation_function_canonicalization.sil +++ b/test/AutoDiff/SILOptimizer/differentiation_function_canonicalization.sil @@ -16,7 +16,7 @@ sil @test_function_ref : $@convention(thin) () -> () { bb0: %1 = function_ref @basic : $@convention(thin) (Float) -> Float %2 = thin_to_thick_function %1 : $@convention(thin) (Float) -> Float to $@callee_guaranteed (Float) -> Float - %3 = differentiable_function [parameters 0] %2 : $@callee_guaranteed (Float) -> Float + %3 = differentiable_function [parameters 0] [results 0] %2 : $@callee_guaranteed (Float) -> Float %void = tuple () return %void : $() } @@ -28,7 +28,7 @@ bb0: // CHECK: [[JVP_FN:%.*]] = thin_to_thick_function [[JVP_FN_REF]] // CHECK: [[VJP_FN_REF:%.*]] = differentiability_witness_function [vjp] [parameters 0] [results 0] @basic // CHECK: [[VJP_FN:%.*]] = thin_to_thick_function [[VJP_FN_REF]] -// CHECK: differentiable_function [parameters 0] [[ORIG_FN]] : $@callee_guaranteed (Float) -> Float with_derivative {[[JVP_FN]] : $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), [[VJP_FN]] : $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} +// CHECK: differentiable_function [parameters 0] [results 0] [[ORIG_FN]] : $@callee_guaranteed (Float) -> Float with_derivative {[[JVP_FN]] : $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), [[VJP_FN]] : $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} // CHECK: } // Test `differentiable_function_extract` instructions. @@ -36,7 +36,7 @@ bb0: sil @test_differentiable_function_extract : $@convention(thin) (@differentiable @callee_guaranteed (Float) -> Float) -> () { bb0(%0 : $@differentiable @callee_guaranteed (Float) -> Float): %1 = differentiable_function_extract [original] %0 : $@differentiable @callee_guaranteed (Float) -> Float - %2 = differentiable_function [parameters 0] %1 : $@callee_guaranteed (Float) -> Float + %2 = differentiable_function [parameters 0] [results 0] %1 : $@callee_guaranteed (Float) -> Float %void = tuple () return %void : $() } @@ -48,7 +48,7 @@ bb0(%0 : $@differentiable @callee_guaranteed (Float) -> Float): // CHECK: strong_retain [[JVP_FN]] // CHECK: [[VJP_FN:%.*]] = differentiable_function_extract [vjp] [[ARG]] // CHECK: strong_retain [[VJP_FN]] -// CHECK: differentiable_function [parameters 0] [[ORIG_FN]] : {{.*}} with_derivative {[[JVP_FN]] : {{.*}}, [[VJP_FN]] : {{.*}}} +// CHECK: differentiable_function [parameters 0] [results 0] [[ORIG_FN]] : {{.*}} with_derivative {[[JVP_FN]] : {{.*}}, [[VJP_FN]] : {{.*}}} // CHECK: } // Test `witness_method` instructions. @@ -61,7 +61,7 @@ protocol Protocol { sil @test_witness_method : $@convention(thin) (@in_guaranteed T) -> () { bb0(%0 : $*T): %1 = witness_method $T, #Protocol.method : (Self) -> (Float) -> Float : $@convention(witness_method: Protocol) <τ_0_0 where τ_0_0 : Protocol> (Float, @in_guaranteed τ_0_0) -> Float - %2 = differentiable_function [parameters 0] %1 : $@convention(witness_method: Protocol) <τ_0_0 where τ_0_0 : Protocol> (Float, @in_guaranteed τ_0_0) -> Float + %2 = differentiable_function [parameters 0] [results 0] %1 : $@convention(witness_method: Protocol) <τ_0_0 where τ_0_0 : Protocol> (Float, @in_guaranteed τ_0_0) -> Float %void = tuple () return %void : $() } @@ -70,14 +70,14 @@ bb0(%0 : $*T): // CHECK: [[ORIG_FN:%.*]] = witness_method $T, #Protocol.method // CHECK: [[JVP_FN:%.*]] = witness_method $T, #Protocol.method!jvp.SU // CHECK: [[VJP_FN:%.*]] = witness_method $T, #Protocol.method!vjp.SU -// CHECK: differentiable_function [parameters 0] [[ORIG_FN]] : {{.*}} with_derivative {[[JVP_FN]] : {{.*}}, [[VJP_FN]] : {{.*}}} +// CHECK: differentiable_function [parameters 0] [results 0] [[ORIG_FN]] : {{.*}} with_derivative {[[JVP_FN]] : {{.*}}, [[VJP_FN]] : {{.*}}} // CHECK: } sil @test_witness_method_partial_apply : $@convention(thin) (@in_guaranteed T) -> () { bb0(%0 : $*T): %1 = witness_method $T, #Protocol.method : (Self) -> (Float) -> Float : $@convention(witness_method: Protocol) <τ_0_0 where τ_0_0 : Protocol> (Float, @in_guaranteed τ_0_0) -> Float %2 = partial_apply [callee_guaranteed] %1(%0) : $@convention(witness_method: Protocol) <τ_0_0 where τ_0_0 : Protocol> (Float, @in_guaranteed τ_0_0) -> Float - %3 = differentiable_function [parameters 0] %2 : $@callee_guaranteed (Float) -> Float + %3 = differentiable_function [parameters 0] [results 0] %2 : $@callee_guaranteed (Float) -> Float %void = tuple () return %void : $() } @@ -96,7 +96,7 @@ bb0(%0 : $*T): // CHECK: [[VJP_FN_PARTIALLY_APPLIED:%.*]] = partial_apply [callee_guaranteed] [[VJP_FN]]([[ARGCOPY2]]) // CHECK: dealloc_stack [[ARGCOPY2]] // CHECK: dealloc_stack [[ARGCOPY1]] -// CHECK: differentiable_function [parameters 0] [[ORIG_FN_PARTIALLY_APPLIED]] : {{.*}} with_derivative {[[JVP_FN_PARTIALLY_APPLIED]] : {{.*}}, [[VJP_FN_PARTIALLY_APPLIED]] : {{.*}}} +// CHECK: differentiable_function [parameters 0] [results 0] [[ORIG_FN_PARTIALLY_APPLIED]] : {{.*}} with_derivative {[[JVP_FN_PARTIALLY_APPLIED]] : {{.*}}, [[VJP_FN_PARTIALLY_APPLIED]] : {{.*}}} // CHECK: } // Test `class_method` instructions. @@ -109,7 +109,7 @@ class Class { sil @test_class_method : $@convention(thin) (@guaranteed Class) -> () { bb0(%0 : $Class): %1 = class_method %0 : $Class, #Class.method : (Class) -> (Float) -> Float, $@convention(method) (Float, @guaranteed Class) -> Float - %2 = differentiable_function [parameters 0] %1 : $@convention(method) (Float, @guaranteed Class) -> Float + %2 = differentiable_function [parameters 0] [results 0] %1 : $@convention(method) (Float, @guaranteed Class) -> Float %void = tuple () return %void : $() } @@ -119,14 +119,14 @@ bb0(%0 : $Class): // CHECK: [[ORIG_FN:%.*]] = class_method [[ARG]] : $Class, #Class.method // CHECK: [[JVP_FN:%.*]] = class_method [[ARG]] : $Class, #Class.method!jvp.SU // CHECK: [[VJP_FN:%.*]] = class_method [[ARG]] : $Class, #Class.method!vjp.SU -// CHECK: differentiable_function [parameters 0] [[ORIG_FN]] : {{.*}} with_derivative {[[JVP_FN]] : {{.*}}, [[VJP_FN]] : {{.*}}} +// CHECK: differentiable_function [parameters 0] [results 0] [[ORIG_FN]] : {{.*}} with_derivative {[[JVP_FN]] : {{.*}}, [[VJP_FN]] : {{.*}}} // CHECK: } sil @test_class_method_partial_apply : $@convention(thin) (@guaranteed Class) -> () { bb0(%0 : $Class): %1 = class_method %0 : $Class, #Class.method : (Class) -> (Float) -> Float, $@convention(method) (Float, @guaranteed Class) -> Float %2 = partial_apply [callee_guaranteed] %1(%0) : $@convention(method) (Float, @guaranteed Class) -> Float - %3 = differentiable_function [parameters 0] %2 : $@callee_guaranteed (Float) -> Float + %3 = differentiable_function [parameters 0] [results 0] %2 : $@callee_guaranteed (Float) -> Float %void = tuple () return %void : $() } @@ -141,5 +141,5 @@ bb0(%0 : $Class): // CHECK: [[JVP_FN_PARTIALLY_APPLIED:%.*]] = partial_apply [callee_guaranteed] [[JVP_FN]]([[ARG]]) // CHECK: [[VJP_FN:%.*]] = class_method [[ARG]] : $Class, #Class.method!vjp.SU // CHECK: [[VJP_FN_PARTIALLY_APPLIED:%.*]] = partial_apply [callee_guaranteed] [[VJP_FN]]([[ARG]]) -// CHECK: differentiable_function [parameters 0] [[ORIG_FN_PARTIALLY_APPLIED]] : {{.*}} with_derivative {[[JVP_FN_PARTIALLY_APPLIED]] : {{.*}}, [[VJP_FN_PARTIALLY_APPLIED]] : {{.*}}} +// CHECK: differentiable_function [parameters 0] [results 0] [[ORIG_FN_PARTIALLY_APPLIED]] : {{.*}} with_derivative {[[JVP_FN_PARTIALLY_APPLIED]] : {{.*}}, [[VJP_FN_PARTIALLY_APPLIED]] : {{.*}}} // CHECK: } diff --git a/test/AutoDiff/SILOptimizer/differentiation_sil.swift b/test/AutoDiff/SILOptimizer/differentiation_sil.swift index afb600e487376..37b7348072510 100644 --- a/test/AutoDiff/SILOptimizer/differentiation_sil.swift +++ b/test/AutoDiff/SILOptimizer/differentiation_sil.swift @@ -29,7 +29,7 @@ func testDifferentiableFunction() { // CHECK-SILGEN-LABEL: sil hidden [ossa] @test_differentiable_function : $@convention(thin) () -> () { // CHECK-SILGEN: [[ORIG_FN_REF:%.*]] = function_ref @basic : $@convention(thin) (Float) -> Float // CHECK-SILGEN: [[ORIG_FN:%.*]] = thin_to_thick_function [[ORIG_FN_REF]] : $@convention(thin) (Float) -> Float to $@callee_guaranteed (Float) -> Float -// CHECK-SILGEN: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [[ORIG_FN]] : $@callee_guaranteed (Float) -> Float +// CHECK-SILGEN: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [results 0] [[ORIG_FN]] : $@callee_guaranteed (Float) -> Float // CHECK-SILGEN: } // CHECK-SIL-LABEL: sil hidden @test_differentiable_function : $@convention(thin) () -> () { @@ -39,5 +39,5 @@ func testDifferentiableFunction() { // CHECK-SIL: [[JVP_FN:%.*]] = thin_to_thick_function [[JVP_FN_REF]] // CHECK-SIL: [[VJP_FN_REF:%.*]] = differentiability_witness_function [vjp] [parameters 0] [results 0] @basic // CHECK-SIL: [[VJP_FN:%.*]] = thin_to_thick_function [[VJP_FN_REF]] -// CHECK-SIL: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [[ORIG_FN]] : $@callee_guaranteed (Float) -> Float with_derivative {[[JVP_FN]] : $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), [[VJP_FN]] : $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} +// CHECK-SIL: [[DIFF_FN:%.*]] = differentiable_function [parameters 0] [results 0] [[ORIG_FN]] : $@callee_guaranteed (Float) -> Float with_derivative {[[JVP_FN]] : $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), [[VJP_FN]] : $@callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)} // CHECK-SIL: } diff --git a/test/AutoDiff/SILOptimizer/differentiation_subset_parameters_thunk.swift b/test/AutoDiff/SILOptimizer/differentiation_subset_parameters_thunk.swift index 679fc83a00214..9e053c887f5e5 100644 --- a/test/AutoDiff/SILOptimizer/differentiation_subset_parameters_thunk.swift +++ b/test/AutoDiff/SILOptimizer/differentiation_subset_parameters_thunk.swift @@ -31,7 +31,7 @@ func differentiate_foo_wrt_0(_ x: Float) -> Float { // CHECK: [[FOO_VJP_FLOAT:%.*]] = partial_apply [callee_guaranteed] [[FOO_VJP]]() : $@convention(thin) <τ_0_0 where τ_0_0 : NumericDifferentiable> (@in_guaranteed τ_0_0, @in_guaranteed τ_0_0) -> (@out τ_0_0, @owned @callee_guaranteed @substituted <τ_0_0, τ_0_1, τ_0_2> (@in_guaranteed τ_0_0) -> (@out τ_0_1, @out τ_0_2) for <τ_0_0.TangentVector, τ_0_0.TangentVector, τ_0_0.TangentVector>) // CHECK: [[FOO_VJP_SUBSET_THUNK_THIN:%.*]] = function_ref @AD__orig_{{.*}}foo{{.*}}_src_0_wrt_0_vjp_subset_parameters_thunk : $@convention(thin) (@in_guaranteed Float, @in_guaranteed Float) -> (@out Float, @owned @callee_guaranteed (@in_guaranteed Float) -> @out Float) // CHECK: [[FOO_VJP_SUBSET_THUNK:%.*]] = thin_to_thick_function [[FOO_VJP_SUBSET_THUNK_THIN]] : $@convention(thin) (@in_guaranteed Float, @in_guaranteed Float) -> (@out Float, @owned @callee_guaranteed (@in_guaranteed Float) -> @out Float) to $@callee_guaranteed (@in_guaranteed Float, @in_guaranteed Float) -> (@out Float, @owned @callee_guaranteed (@in_guaranteed Float) -> @out Float) -// CHECK: [[FOO_DIFF:%.*]] = differentiable_function [parameters 0] [[FOO_FLOAT]] : $@callee_guaranteed (@in_guaranteed Float, @in_guaranteed Float) -> @out Float with_derivative {[[FOO_JVP_SUBSET_THUNK]] : $@callee_guaranteed (@in_guaranteed Float, @in_guaranteed Float) -> (@out Float, @owned @callee_guaranteed (@in_guaranteed Float) -> @out Float), [[FOO_VJP_SUBSET_THUNK]] : $@callee_guaranteed (@in_guaranteed Float, @in_guaranteed Float) -> (@out Float, @owned @callee_guaranteed (@in_guaranteed Float) -> @out Float)} +// CHECK: [[FOO_DIFF:%.*]] = differentiable_function [parameters 0] [results 0] [[FOO_FLOAT]] : $@callee_guaranteed (@in_guaranteed Float, @in_guaranteed Float) -> @out Float with_derivative {[[FOO_JVP_SUBSET_THUNK]] : $@callee_guaranteed (@in_guaranteed Float, @in_guaranteed Float) -> (@out Float, @owned @callee_guaranteed (@in_guaranteed Float) -> @out Float), [[FOO_VJP_SUBSET_THUNK]] : $@callee_guaranteed (@in_guaranteed Float, @in_guaranteed Float) -> (@out Float, @owned @callee_guaranteed (@in_guaranteed Float) -> @out Float)} // CHECK: } func inoutIndirect( diff --git a/test/AutoDiff/validation-test/simple_math.swift b/test/AutoDiff/validation-test/simple_math.swift index d1b323f7f2c78..68c4ce442d550 100644 --- a/test/AutoDiff/validation-test/simple_math.swift +++ b/test/AutoDiff/validation-test/simple_math.swift @@ -368,7 +368,21 @@ SimpleMathTests.test("ForceUnwrapping") { expectEqual((1, 2), forceUnwrap(Float(2))) } -// CHECK-LABEL: sil private [ossa] @AD__${{.*}}jumpTimesTwo{{.*}}pullback_src_0_wrt_0 : $@convention(thin) (Float, @owned _AD__$s4nullyycfU18_12jumpTimesTwoL_5modelSfAAyycfU18_14SmallTestModelL_V_tF_bb0__PB__src_0_wrt_0) -> SmallTestModel.TangentVector { +SimpleMathTests.test("Adjoint value accumulation for aggregate lhs and concrete rhs") { + // TF-943: Test adjoint value accumulation for aggregate lhs and concrete rhs. + struct SmallTestModel : Differentiable { + public var stored: Float = 3.0 + @differentiable public func callAsFunction() -> Float { return stored } + } + + func doubled(_ model: SmallTestModel) -> Float{ + return model() + model.stored + } + let grads = gradient(at: SmallTestModel(), in: doubled) + expectEqual(2.0, grads.stored) +} + +// CHECK-LABEL: sil private [ossa] @AD__${{.*}}doubled{{.*}}pullback_src_0_wrt_0 : $@convention(thin) (Float, @owned {{.*}}) -> SmallTestModel.TangentVector { // CHECK: bb0([[DX:%.*]] : $Float, [[PB_STRUCT:%.*]] : {{.*}}): // CHECK: ([[PB0:%.*]], [[PB1:%.*]]) = destructure_struct [[PB_STRUCT]] // CHECK: [[ADJ_TUPLE:%.*]] = apply [[PB1]]([[DX]]) : $@callee_guaranteed (Float) -> (Float, Float) @@ -387,18 +401,4 @@ SimpleMathTests.test("ForceUnwrapping") { // CHECK: return [[RES_STRUCT]] : $SmallTestModel.TangentVector // CHECK: } -SimpleMathTests.test("Struct") { - // TF-943: Test adjoint value accumulation for aggregate lhs and concrete rhs. - struct SmallTestModel : Differentiable { - public var jump: Float = 3.0 - @differentiable public func callAsFunction() -> Float { return jump } - } - - func jumpTimesTwo(model: SmallTestModel) -> Float{ - return model() + model.jump - } - let grads = gradient(at: SmallTestModel(), in: jumpTimesTwo) - expectEqual(2.0, grads.jump) -} - runAllTests() diff --git a/test/ClangImporter/availability_returns_twice.swift b/test/ClangImporter/availability_returns_twice.swift index 34379a8c13d9c..35b3ccba5a590 100644 --- a/test/ClangImporter/availability_returns_twice.swift +++ b/test/ClangImporter/availability_returns_twice.swift @@ -3,6 +3,7 @@ // In Android jmp_buf is int[16], which doesn't convert to &Int (SR-9136) // XFAIL: OS=linux-androideabi // XFAIL: OS=linux-android +// XFAIL: OS=openbsd #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) import Darwin diff --git a/test/ClangImporter/pch-bridging-header-deps-fine.swift b/test/ClangImporter/pch-bridging-header-deps-fine.swift index 670ba23db8d3a..4f21828ba3d32 100644 --- a/test/ClangImporter/pch-bridging-header-deps-fine.swift +++ b/test/ClangImporter/pch-bridging-header-deps-fine.swift @@ -10,13 +10,13 @@ // RUN: %target-swift-frontend -emit-pch -o %t.pch %/S/Inputs/chained-unit-test-bridging-header-to-pch.h // RUN: %target-swift-frontend -module-name test -c -emit-dependencies-path %t.d -emit-reference-dependencies-path %t.swiftdeps -primary-file %s -import-objc-header %t.pch // RUN: %FileCheck --check-prefix CHECK-DEPS %s < %t.d -// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck --check-prefix CHECK-SWIFTDEPS --enable-yaml-compatibility %s < %t-processed.swiftdeps // RUN: %FileCheck --check-prefix CHECK-SWIFTDEPS2 --enable-yaml-compatibility %s < %t-processed.swiftdeps // RUN: %target-swift-frontend -module-name test -c -emit-dependencies-path %t.persistent.d -emit-reference-dependencies-path %t.persistent.swiftdeps -primary-file %s -import-objc-header %/S/Inputs/chained-unit-test-bridging-header-to-pch.h -pch-output-dir %t/pch // RUN: %FileCheck --check-prefix CHECK-DEPS %s < %t.persistent.d -// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh <%t.persistent.swiftdeps >%t-processed.persistent.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.persistent.swiftdeps %t-processed.persistent.swiftdeps // RUN: %FileCheck --check-prefix CHECK-SWIFTDEPS --enable-yaml-compatibility %s < %t-processed.persistent.swiftdeps // RUN: %FileCheck --check-prefix CHECK-SWIFTDEPS2 --enable-yaml-compatibility %s < %t-processed.persistent.swiftdeps diff --git a/test/Constraints/fixes.swift b/test/Constraints/fixes.swift index fc6ac9fa29869..8a8aeb82c55ba 100644 --- a/test/Constraints/fixes.swift +++ b/test/Constraints/fixes.swift @@ -179,7 +179,7 @@ struct S1116 { let a1116: [S1116] = [] var s1116 = Set(1...10).subtracting(a1116.map({ $0.s })) // expected-error {{value of optional type 'Int?' must be unwrapped to a value of type 'Int'}} -// expected-note@-1{{coalesce using '??' to provide a default when the optional value contains 'nil'}} {{49-49=(}} {{53-53= ?? <#default value#>)}} +// expected-note@-1{{coalesce using '??' to provide a default when the optional value contains 'nil'}} {{53-53= ?? <#default value#>}} // expected-note@-2{{force-unwrap using '!' to abort execution if the optional value contains 'nil'}} {{53-53=!}} func makeArray(_ x: T) -> [T] { [x] } diff --git a/test/Constraints/function_builder_infer.swift b/test/Constraints/function_builder_infer.swift index 7444cbb179110..1715352d39424 100644 --- a/test/Constraints/function_builder_infer.swift +++ b/test/Constraints/function_builder_infer.swift @@ -184,3 +184,51 @@ struct TupleMeResolvedExplicit: Tupled, OtherTupled { return "hello" } } + +// Inference through dynamic replacement +struct DynamicTupled: Tupled { + dynamic var tuple: some Any { + return "hello" + } +} + +extension DynamicTupled { + @_dynamicReplacement(for: tuple) + var replacementTuple: some Any { + 1 + 3.14159 + "hello" + } +} + +struct DynamicTupled2: Tupled, OtherTupled { + dynamic var tuple: some Any { + return "hello" + } +} + +extension DynamicTupled2 { + @_dynamicReplacement(for: tuple) + var replacementTuple: some Any { // expected-error{{ambiguous function builder inferred for 'replacementTuple': 'TupleBuilder' or 'OtherTupleBuilder'}} + // expected-note@-1{{add an explicit 'return' statement to not use a function builder}} + // expected-note@-2{{apply function builder 'TupleBuilder' (inferred from protocol 'Tupled')}} + // expected-note@-3{{apply function builder 'OtherTupleBuilder' (inferred from protocol 'OtherTupled')}} + 1 + } +} + +struct DynamicTupled3 { + @TupleBuilder dynamic var dynamicTuple: some Any { + 0 + } +} + +extension DynamicTupled3: OtherTupled { + @_dynamicReplacement(for: dynamicTuple) + var tuple: some Any { // expected-error{{ambiguous function builder inferred for 'tuple': 'OtherTupleBuilder' or 'TupleBuilder'}} + // expected-note@-1{{add an explicit 'return' statement to not use a function builder}} + // expected-note@-2{{apply function builder 'OtherTupleBuilder' (inferred from protocol 'OtherTupled')}} + // expected-note@-3{{apply function builder 'TupleBuilder' (inferred from dynamic replacement of 'dynamicTuple')}} + 0 + } +} diff --git a/test/Constraints/one_way_closure_params.swift b/test/Constraints/one_way_closure_params.swift new file mode 100644 index 0000000000000..c62bb7256cb7b --- /dev/null +++ b/test/Constraints/one_way_closure_params.swift @@ -0,0 +1,8 @@ +// RUN: %target-typecheck-verify-swift -swift-version 4 -experimental-one-way-closure-params + +func testBasic() { + let _: (Float) -> Float = { $0 + 1 } + + let _ = { $0 + 1 } // expected-error{{unable to infer type of a closure parameter $0 in the current context}} +} + diff --git a/test/Constraints/patterns.swift b/test/Constraints/patterns.swift index a3a2de3f5ee24..d0ca8f7582397 100644 --- a/test/Constraints/patterns.swift +++ b/test/Constraints/patterns.swift @@ -486,12 +486,26 @@ func rdar63510989() { } enum E { - case foo(P?) + case single(P?) + case double(P??) + case triple(P???) } func test(e: E) { - if case .foo(_ as Value) = e {} // Ok - if case .foo(let v as Value) = e {} // Ok + if case .single(_ as Value) = e {} // Ok + if case .single(let v as Value) = e {} // Ok + // expected-warning@-1 {{immutable value 'v' was never used; consider replacing with '_' or removing it}} + if case .double(_ as Value) = e {} // Ok + if case .double(let v as Value) = e {} // Ok + // expected-warning@-1 {{immutable value 'v' was never used; consider replacing with '_' or removing it}} + if case .double(let v as Value?) = e {} // Ok + // expected-warning@-1 {{immutable value 'v' was never used; consider replacing with '_' or removing it}} + if case .triple(_ as Value) = e {} // Ok + if case .triple(let v as Value) = e {} // Ok + // expected-warning@-1 {{immutable value 'v' was never used; consider replacing with '_' or removing it}} + if case .triple(let v as Value?) = e {} // Ok + // expected-warning@-1 {{immutable value 'v' was never used; consider replacing with '_' or removing it}} + if case .triple(let v as Value??) = e {} // Ok // expected-warning@-1 {{immutable value 'v' was never used; consider replacing with '_' or removing it}} } } diff --git a/test/Constraints/sr12964.swift b/test/Constraints/sr12964.swift new file mode 100644 index 0000000000000..27d48299b144d --- /dev/null +++ b/test/Constraints/sr12964.swift @@ -0,0 +1,7 @@ +// RUN: %target-typecheck-verify-swift + +protocol P {} +typealias T = (P) -> Void +let x: T! = [1, 2, 3].reversed().reduce() +// expected-error@-1 {{no exact matches in call to instance method 'reduce'}} +// expected-note@-2 2{{candidate has partially matching parameter list}} diff --git a/test/DebugInfo/patternmatching.swift b/test/DebugInfo/patternmatching.swift index be7c23be940bf..365c7ed2e0101 100644 --- a/test/DebugInfo/patternmatching.swift +++ b/test/DebugInfo/patternmatching.swift @@ -3,6 +3,11 @@ // RUN: %FileCheck --check-prefix=CHECK-SCOPES %s < %t.ll // RUN: %target-swift-frontend -emit-sil -emit-verbose-sil -primary-file %s -o - | %FileCheck %s --check-prefix=SIL-CHECK + + + + +// This comment must be at line 10 for the test to work. func markUsed(_ t: T) {} // CHECK-SCOPES: define {{.*}}classifyPoint2 @@ -12,7 +17,7 @@ func classifyPoint2(_ p: (Double, Double)) { return input; // return_same gets called in both where statements } -switch p { + switch p { case (let x, let y) where // CHECK: call {{.*}}double {{.*}}return_same{{.*}}, !dbg ![[LOC1:.*]] // CHECK: br {{.*}}, label {{.*}}, label {{.*}}, !dbg ![[LOC2:.*]] @@ -25,40 +30,14 @@ switch p { // SIL-CHECK: dealloc_stack{{.*}}line:[[@LINE-1]]:17:cleanup // Verify that the branch has a location >= the cleanup. // SIL-CHECK-NEXT: br{{.*}}auto_gen - // CHECK-SCOPES: call void @llvm.dbg - // CHECK-SCOPES: call void @llvm.dbg - // CHECK-SCOPES: call void @llvm.dbg - // CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[X1:[0-9]+]], - // CHECK-SCOPES-SAME: !dbg ![[X1LOC:[0-9]+]] - // CHECK-SCOPES: call void @llvm.dbg - // CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[X2:[0-9]+]], - // CHECK-SCOPES-SAME: !dbg ![[X2LOC:[0-9]+]] - // CHECK-SCOPES: call void @llvm.dbg - // CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[X3:[0-9]+]], - // CHECK-SCOPES-SAME: !dbg ![[X3LOC:[0-9]+]] case (let x, let y) where x == -y: - // Verify that all variables end up in separate appropriate scopes. - // CHECK-SCOPES: ![[X1]] = !DILocalVariable(name: "x", scope: ![[SCOPE1:[0-9]+]], - // CHECK-SCOPES-SAME: line: [[@LINE-3]] - // CHECK-SCOPES: ![[X1LOC]] = !DILocation(line: [[@LINE-4]], column: 15, - // CHECK-SCOPES-SAME: scope: ![[SCOPE1]]) - // FIXME: ![[SCOPE1]] = distinct !DILexicalBlock({{.*}}line: [[@LINE-6]] markUsed(x) case (let x, let y) where x >= -10 && x < 10 && y >= -10 && y < 10: - // CHECK-SCOPES: ![[X2]] = !DILocalVariable(name: "x", scope: ![[SCOPE2:[0-9]+]], - // CHECK-SCOPES-SAME: line: [[@LINE-2]] - // CHECK-SCOPES: ![[X2LOC]] = !DILocation(line: [[@LINE-3]], column: 15, - // CHECK-SCOPES-SAME: scope: ![[SCOPE2]]) markUsed(x) case (let x, let y): - // CHECK-SCOPES: ![[X3]] = !DILocalVariable(name: "x", scope: ![[SCOPE3:[0-9]+]], - // CHECK-SCOPES-SAME: line: [[@LINE-2]] - // CHECK-SCOPES: ![[X3LOC]] = !DILocation(line: [[@LINE-3]], column: 15, - // CHECK-SCOPES-SAME: scope: ![[SCOPE3]]) markUsed(x) } - -switch p { + switch p { case (let x, let y) where x == 0: if y == 0 { markUsed(x) } else { markUsed(y) } // SIL-CHECK-NOT: br{{.*}}line:[[@LINE]]:31:cleanup @@ -66,7 +45,57 @@ switch p { if y == 0 { markUsed(x) } else { markUsed(y) } } // SIL-CHECK: br{{.*}}line:[[@LINE]]:5:cleanup -} + } + +// Test the scopes for the switch at line 20. + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[P:[0-9]+]], + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[X1:[0-9]+]], +// CHECK-SCOPES-SAME: !dbg ![[X1LOC:[0-9]+]] + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[Y1:[0-9]+]], +// CHECK-SCOPES-SAME: !dbg ![[Y1LOC:[0-9]+]] + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[X2:[0-9]+]], +// CHECK-SCOPES-SAME: !dbg ![[X2LOC:[0-9]+]] + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[Y2:[0-9]+]], +// CHECK-SCOPES-SAME: !dbg ![[Y2LOC:[0-9]+]] + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[X3:[0-9]+]], +// CHECK-SCOPES-SAME: !dbg ![[X3LOC:[0-9]+]] + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[Y3:[0-9]+]], +// CHECK-SCOPES-SAME: !dbg ![[Y3LOC:[0-9]+]] + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[X4:[0-9]+]], +// CHECK-SCOPES-SAME: !dbg ![[X4LOC:[0-9]+]] + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[Y4:[0-9]+]], +// CHECK-SCOPES-SAME: !dbg ![[Y4LOC:[0-9]+]] + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[X5:[0-9]+]], +// CHECK-SCOPES-SAME: !dbg ![[X5LOC:[0-9]+]] + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[Y5:[0-9]+]], +// CHECK-SCOPES-SAME: !dbg ![[Y5LOC:[0-9]+]] + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[X6:[0-9]+]], +// CHECK-SCOPES-SAME: !dbg ![[X6LOC:[0-9]+]] + +// CHECK-SCOPES: call void @llvm.dbg{{.*}}metadata ![[Y6:[0-9]+]], +// CHECK-SCOPES-SAME: !dbg ![[Y6LOC:[0-9]+]] + +// Verify that variables end up in separate appropriate scopes. + +// CHECK-SCOPES: ![[X1]] = {{.*}}name: "x", scope: ![[SCOPE1:[0-9]+]], {{.*}}line: 37 +// CHECK-SCOPES: ![[SCOPE1]] = distinct !DILexicalBlock(scope: ![[SWITCH1:[0-9]+]], {{.*}}line: 37 +// CHECK-SCOPES: ![[SWITCH1]] = distinct !DILexicalBlock({{.*}}, line: 20 +// CHECK-SCOPES: ![[X1LOC]] = {{.*}}line: 37 + +// CHECK-SCOPES: ![[Y1]] = {{.*}}name: "y", scope: ![[SCOPE1]], {{.*}}line: 37 +// CHECK-SCOPES: ![[Y1LOC]] = {{.*}}line: 37 // CHECK: !DILocation(line: [[@LINE+1]], } diff --git a/test/DebugInfo/patternvars.swift b/test/DebugInfo/patternvars.swift index 37d58fda07265..63aa133e1e93c 100644 --- a/test/DebugInfo/patternvars.swift +++ b/test/DebugInfo/patternvars.swift @@ -30,29 +30,25 @@ public func mangle(s: [UnicodeScalar]) -> [UnicodeScalar] { } // The patterns in the first case statement each define an anonymous variable, -// which shares the storage with the expression in the switch statement. Make -// sure we emit a dbg.value once per basic block. +// which shares the storage with the expression in the switch statement. + +// Do we care to expose these via lldb? // CHECK: define {{.*}}@"$s11patternvars6mangle1sSayAA13UnicodeScalarVGAF_tFA2EXEfU_" // CHECK: %[[VAL:[0-9]+]] = call swiftcc i32 @"$s11patternvars13UnicodeScalarV5values6UInt32Vvg"(i32 %0) -// CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %[[VAL]] // CHECK: {{[0-9]+}}: -// CHECK: call void @llvm.dbg.value(metadata i32 %[[VAL]] // CHECK-NOT: call void @llvm.dbg.value // CHECK-NOT: call void asm sideeffect "", "r" // CHECK: {{[0-9]+}}: -// CHECK: call void @llvm.dbg.value(metadata i32 %[[VAL]] // CHECK-NOT: call void @llvm.dbg.value // CHECK-NOT: call void asm sideeffect "", "r" // CHECK: {{[0-9]+}}: -// CHECK: call void @llvm.dbg.value(metadata i32 %[[VAL]] // CHECK-NOT: call void @llvm.dbg.value // CHECK-NOT: call void asm sideeffect "", "r" // CHECK: {{[0-9]+}}: -// CHECK: call void @llvm.dbg.value(metadata i32 %[[VAL]] // CHECK-NOT: call void @llvm.dbg.value // CHECK-NOT: call void asm sideeffect "", "r" diff --git a/test/Demangle/Inputs/manglings.txt b/test/Demangle/Inputs/manglings.txt index 877d1dcc9e554..0102b4499a523 100644 --- a/test/Demangle/Inputs/manglings.txt +++ b/test/Demangle/Inputs/manglings.txt @@ -358,4 +358,5 @@ $sSo17OS_dispatch_queueC4sync7executeyyyXE_tFTOTA ---> {T:$sSo17OS_dispatch_queu $sxq_Idgnr_D ---> @differentiable @callee_guaranteed (@in_guaranteed A) -> (@out B) $sxq_Ilgnr_D ---> @differentiable(linear) @callee_guaranteed (@in_guaranteed A) -> (@out B) $sS3fIedgyywd_D ---> @escaping @differentiable @callee_guaranteed (@unowned Swift.Float, @unowned @noDerivative Swift.Float) -> (@unowned Swift.Float) +$sS5fIedtyyywddw_D ---> @escaping @differentiable @convention(thin) (@unowned Swift.Float, @unowned Swift.Float, @unowned @noDerivative Swift.Float) -> (@unowned Swift.Float, @unowned @noDerivative Swift.Float) $syQo ---> $syQo diff --git a/test/Driver/Dependencies/Inputs/chained-additional-kinds/main.swift b/test/Driver/Dependencies/Inputs/chained-additional-kinds/main.swift deleted file mode 100644 index ac74ce9e2fd9a..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-additional-kinds/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -provides-dynamic-lookup: [z] diff --git a/test/Driver/Dependencies/Inputs/chained-additional-kinds/other.swift b/test/Driver/Dependencies/Inputs/chained-additional-kinds/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-additional-kinds/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/chained-additional-kinds/output.json b/test/Driver/Dependencies/Inputs/chained-additional-kinds/output.json deleted file mode 100644 index 78134f1ab01d1..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-additional-kinds/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "./yet-another.swift": { - "object": "./yet-another.o", - "swift-dependencies": "./yet-another.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/chained-additional-kinds/yet-another.swift b/test/Driver/Dependencies/Inputs/chained-additional-kinds/yet-another.swift deleted file mode 100644 index 635c9d672b8de..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-additional-kinds/yet-another.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-dynamic-lookup: [z] diff --git a/test/Driver/Dependencies/Inputs/chained-after-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/chained-after-fine/main.swiftdeps index ab68f2a75146f..c00e208418ef2 100644 Binary files a/test/Driver/Dependencies/Inputs/chained-after-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/chained-after-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/chained-after-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/chained-after-fine/other.swiftdeps index fdebaf57ebfb4..536f71123e364 100644 Binary files a/test/Driver/Dependencies/Inputs/chained-after-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/chained-after-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/chained-after-fine/yet-another.swiftdeps b/test/Driver/Dependencies/Inputs/chained-after-fine/yet-another.swiftdeps index 463b4dfae1c71..becd8c3d80bce 100644 Binary files a/test/Driver/Dependencies/Inputs/chained-after-fine/yet-another.swiftdeps and b/test/Driver/Dependencies/Inputs/chained-after-fine/yet-another.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/chained-after/main.swift b/test/Driver/Dependencies/Inputs/chained-after/main.swift deleted file mode 100644 index e0e8f251340b0..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-after/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -provides-nominal: [z] diff --git a/test/Driver/Dependencies/Inputs/chained-after/main.swiftdeps b/test/Driver/Dependencies/Inputs/chained-after/main.swiftdeps deleted file mode 100644 index af39a9cad8a70..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-after/main.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/chained-after/other.swift b/test/Driver/Dependencies/Inputs/chained-after/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-after/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/chained-after/other.swiftdeps b/test/Driver/Dependencies/Inputs/chained-after/other.swiftdeps deleted file mode 100644 index 37adc17c77e7c..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-after/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/chained-after/output.json b/test/Driver/Dependencies/Inputs/chained-after/output.json deleted file mode 100644 index 78134f1ab01d1..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-after/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "./yet-another.swift": { - "object": "./yet-another.o", - "swift-dependencies": "./yet-another.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/chained-after/yet-another.swift b/test/Driver/Dependencies/Inputs/chained-after/yet-another.swift deleted file mode 100644 index 16c64afc2b66a..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-after/yet-another.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-nominal: [z] diff --git a/test/Driver/Dependencies/Inputs/chained-after/yet-another.swiftdeps b/test/Driver/Dependencies/Inputs/chained-after/yet-another.swiftdeps deleted file mode 100644 index b52ded789ba00..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-after/yet-another.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-nominal: [z] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-fine/main.swiftdeps index 6269b88840fbf..b0069fd19351e 100644 Binary files a/test/Driver/Dependencies/Inputs/chained-private-after-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/chained-private-after-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-fine/other.swiftdeps index fdebaf57ebfb4..536f71123e364 100644 Binary files a/test/Driver/Dependencies/Inputs/chained-private-after-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/chained-private-after-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-fine/yet-another.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-fine/yet-another.swiftdeps index 6c6e6bd8f844a..a9ff90ae9f81a 100644 Binary files a/test/Driver/Dependencies/Inputs/chained-private-after-fine/yet-another.swiftdeps and b/test/Driver/Dependencies/Inputs/chained-private-after-fine/yet-another.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-fine/main.swiftdeps index 90cb9c17cc4b0..5ceab5eb5fda5 100644 Binary files a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-fine/other.swiftdeps index fdebaf57ebfb4..536f71123e364 100644 Binary files a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-fine/yet-another.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-fine/yet-another.swiftdeps index 045438f5550d6..f49792b949a85 100644 Binary files a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-fine/yet-another.swiftdeps and b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-fine/yet-another.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members-fine/main.swiftdeps index ad8a56b02c2e3..b43c0bf3f82f1 100644 Binary files a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members-fine/other.swiftdeps index ee50c4b42ca6f..89cfe736b46e3 100644 Binary files a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members-fine/yet-another.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members-fine/yet-another.swiftdeps index c279ebaf043ab..fd1bac5a8aeb1 100644 Binary files a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members-fine/yet-another.swiftdeps and b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members-fine/yet-another.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/main.swift b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/main.swift deleted file mode 100644 index 41c4459572e7d..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/main.swift +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies after compilation: -depends-nominal: [x, a, z] -depends-member: [[x, x], [a, a], [z, z]] -provides-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/main.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/main.swiftdeps deleted file mode 100644 index daf4f75424422..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/main.swiftdeps +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies before compilation: -depends-nominal: [x, a] -depends-member: [[x, x], !private [a, a]] -provides-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/other.swift b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/other.swift deleted file mode 100644 index 417f71c53c111..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-member: [[a, a]] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/other.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/other.swiftdeps deleted file mode 100644 index 8920d930bbc99..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-member: [[a, a]] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/output.json b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/output.json deleted file mode 100644 index 78134f1ab01d1..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "./yet-another.swift": { - "object": "./yet-another.o", - "swift-dependencies": "./yet-another.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swift b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swift deleted file mode 100644 index f4d83dcc59888..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swiftdeps deleted file mode 100644 index 813bf188859ef..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/main.swift b/test/Driver/Dependencies/Inputs/chained-private-after-multiple/main.swift deleted file mode 100644 index 63f1b24bea3d6..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [x, a, z] -provides-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/main.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-multiple/main.swiftdeps deleted file mode 100644 index 698632a11e988..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/main.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [x, !private a] -provides-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/other.swift b/test/Driver/Dependencies/Inputs/chained-private-after-multiple/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/other.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-multiple/other.swiftdeps deleted file mode 100644 index 37adc17c77e7c..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/output.json b/test/Driver/Dependencies/Inputs/chained-private-after-multiple/output.json deleted file mode 100644 index 78134f1ab01d1..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "./yet-another.swift": { - "object": "./yet-another.o", - "swift-dependencies": "./yet-another.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/yet-another.swift b/test/Driver/Dependencies/Inputs/chained-private-after-multiple/yet-another.swift deleted file mode 100644 index f4d83dcc59888..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/yet-another.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/yet-another.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after-multiple/yet-another.swiftdeps deleted file mode 100644 index 813bf188859ef..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after-multiple/yet-another.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after/main.swift b/test/Driver/Dependencies/Inputs/chained-private-after/main.swift deleted file mode 100644 index f1fd5b5cac497..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -provides-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after/main.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after/main.swiftdeps deleted file mode 100644 index 90ea1c0103992..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after/main.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [!private a] -provides-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after/other.swift b/test/Driver/Dependencies/Inputs/chained-private-after/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after/other.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after/other.swiftdeps deleted file mode 100644 index 37adc17c77e7c..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after/output.json b/test/Driver/Dependencies/Inputs/chained-private-after/output.json deleted file mode 100644 index 78134f1ab01d1..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "./yet-another.swift": { - "object": "./yet-another.o", - "swift-dependencies": "./yet-another.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/chained-private-after/yet-another.swift b/test/Driver/Dependencies/Inputs/chained-private-after/yet-another.swift deleted file mode 100644 index f4d83dcc59888..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after/yet-another.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/chained-private-after/yet-another.swiftdeps b/test/Driver/Dependencies/Inputs/chained-private-after/yet-another.swiftdeps deleted file mode 100644 index 813bf188859ef..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private-after/yet-another.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/chained-private/main.swift b/test/Driver/Dependencies/Inputs/chained-private/main.swift deleted file mode 100644 index 840f6e6236ae0..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [!private a] -provides-nominal: [z] diff --git a/test/Driver/Dependencies/Inputs/chained-private/other.swift b/test/Driver/Dependencies/Inputs/chained-private/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/chained-private/output.json b/test/Driver/Dependencies/Inputs/chained-private/output.json deleted file mode 100644 index 78134f1ab01d1..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "./yet-another.swift": { - "object": "./yet-another.o", - "swift-dependencies": "./yet-another.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/chained-private/yet-another.swift b/test/Driver/Dependencies/Inputs/chained-private/yet-another.swift deleted file mode 100644 index 16c64afc2b66a..0000000000000 --- a/test/Driver/Dependencies/Inputs/chained-private/yet-another.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-nominal: [z] diff --git a/test/Driver/Dependencies/Inputs/crash-simple-with-swiftdeps-fine/crash.swiftdeps b/test/Driver/Dependencies/Inputs/crash-simple-with-swiftdeps-fine/crash.swiftdeps index bf9965ea5ef76..61bb881eb1106 100644 Binary files a/test/Driver/Dependencies/Inputs/crash-simple-with-swiftdeps-fine/crash.swiftdeps and b/test/Driver/Dependencies/Inputs/crash-simple-with-swiftdeps-fine/crash.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/crash-simple-with-swiftdeps-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/crash-simple-with-swiftdeps-fine/main.swiftdeps index f8db87488755d..90c08952efcd8 100644 Binary files a/test/Driver/Dependencies/Inputs/crash-simple-with-swiftdeps-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/crash-simple-with-swiftdeps-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/crash-simple-with-swiftdeps-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/crash-simple-with-swiftdeps-fine/other.swiftdeps index 08e363ec1de1a..9f9f8bff887d6 100644 Binary files a/test/Driver/Dependencies/Inputs/crash-simple-with-swiftdeps-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/crash-simple-with-swiftdeps-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/crash-simple/crash.swift b/test/Driver/Dependencies/Inputs/crash-simple/crash.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/Dependencies/Inputs/crash-simple/crash.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/crash-simple/main.swift b/test/Driver/Dependencies/Inputs/crash-simple/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/Dependencies/Inputs/crash-simple/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/crash-simple/other.swift b/test/Driver/Dependencies/Inputs/crash-simple/other.swift deleted file mode 100644 index 33392ce138612..0000000000000 --- a/test/Driver/Dependencies/Inputs/crash-simple/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [!private a] diff --git a/test/Driver/Dependencies/Inputs/crash-simple/output.json b/test/Driver/Dependencies/Inputs/crash-simple/output.json deleted file mode 100644 index 55ef51f19bb04..0000000000000 --- a/test/Driver/Dependencies/Inputs/crash-simple/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./crash.swift": { - "object": "./crash.o", - "swift-dependencies": "./crash.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/fail-chained/a.swift b/test/Driver/Dependencies/Inputs/fail-chained/a.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-chained/a.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/fail-chained/b.swift b/test/Driver/Dependencies/Inputs/fail-chained/b.swift deleted file mode 100644 index d59fcfe0b442f..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-chained/b.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [b] diff --git a/test/Driver/Dependencies/Inputs/fail-chained/bad.swift b/test/Driver/Dependencies/Inputs/fail-chained/bad.swift deleted file mode 100644 index c0840ce567be8..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-chained/bad.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [bad] -depends-top-level: [a, !private b] diff --git a/test/Driver/Dependencies/Inputs/fail-chained/c.swift b/test/Driver/Dependencies/Inputs/fail-chained/c.swift deleted file mode 100644 index d12cec6b055d9..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-chained/c.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [c] -depends-top-level: [bad] diff --git a/test/Driver/Dependencies/Inputs/fail-chained/d.swift b/test/Driver/Dependencies/Inputs/fail-chained/d.swift deleted file mode 100644 index b91fec7759267..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-chained/d.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [d] -depends-top-level: [c] diff --git a/test/Driver/Dependencies/Inputs/fail-chained/e.swift b/test/Driver/Dependencies/Inputs/fail-chained/e.swift deleted file mode 100644 index c0214cc14725b..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-chained/e.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [e] -depends-top-level: [!private bad] diff --git a/test/Driver/Dependencies/Inputs/fail-chained/f.swift b/test/Driver/Dependencies/Inputs/fail-chained/f.swift deleted file mode 100644 index 661c5e0cf4558..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-chained/f.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [f] -depends-top-level: [e] diff --git a/test/Driver/Dependencies/Inputs/fail-chained/output.json b/test/Driver/Dependencies/Inputs/fail-chained/output.json deleted file mode 100644 index 438752aa2616a..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-chained/output.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "./a.swift": { - "object": "./a.o", - "swift-dependencies": "./a.swiftdeps" - }, - "./b.swift": { - "object": "./b.o", - "swift-dependencies": "./b.swiftdeps" - }, - "./c.swift": { - "object": "./c.o", - "swift-dependencies": "./c.swiftdeps" - }, - "./d.swift": { - "object": "./d.o", - "swift-dependencies": "./d.swiftdeps" - }, - "./e.swift": { - "object": "./e.o", - "swift-dependencies": "./e.swiftdeps" - }, - "./f.swift": { - "object": "./f.o", - "swift-dependencies": "./f.swiftdeps" - }, - "./bad.swift": { - "object": "./bad.o", - "swift-dependencies": "./bad.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/bad.swiftdeps b/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/bad.swiftdeps index 527f7825b3eaf..36923733d1d0f 100644 Binary files a/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/bad.swiftdeps and b/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/bad.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/depends-on-bad.swiftdeps b/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/depends-on-bad.swiftdeps index 7a6124707d076..e44dcd06e5153 100644 Binary files a/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/depends-on-bad.swiftdeps and b/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/depends-on-bad.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/depends-on-main.swiftdeps b/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/depends-on-main.swiftdeps index f5ff3de10eb27..8a8b4845d6453 100644 Binary files a/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/depends-on-main.swiftdeps and b/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/depends-on-main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/main.swiftdeps index 43ededaf30de4..dad602b6f208f 100644 Binary files a/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/fail-interface-hash-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash/bad.swift b/test/Driver/Dependencies/Inputs/fail-interface-hash/bad.swift deleted file mode 100644 index 1da95ae66e8d4..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-interface-hash/bad.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [bad] -interface-hash: "after" diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash/bad.swiftdeps b/test/Driver/Dependencies/Inputs/fail-interface-hash/bad.swiftdeps deleted file mode 100644 index 923f6689ba1a5..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-interface-hash/bad.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [bad] -interface-hash: "before" diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-bad.swift b/test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-bad.swift deleted file mode 100644 index 415ec3b051000..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-bad.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [bad] -interface-hash: "after" diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-bad.swiftdeps b/test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-bad.swiftdeps deleted file mode 100644 index 97afde93b75ca..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-bad.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [bad] -interface-hash: "before" diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-main.swift b/test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-main.swift deleted file mode 100644 index 2b781b861cb7e..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [main] -interface-hash: "after" diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-main.swiftdeps b/test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-main.swiftdeps deleted file mode 100644 index cd50d25b878a7..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-main.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [main] -interface-hash: "before" diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash/main.swift b/test/Driver/Dependencies/Inputs/fail-interface-hash/main.swift deleted file mode 100644 index 5b5f8d7f3346f..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-interface-hash/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [main] -interface-hash: "after" diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash/main.swiftdeps b/test/Driver/Dependencies/Inputs/fail-interface-hash/main.swiftdeps deleted file mode 100644 index 0ec59e418937a..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-interface-hash/main.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [main] -interface-hash: "before" diff --git a/test/Driver/Dependencies/Inputs/fail-interface-hash/output.json b/test/Driver/Dependencies/Inputs/fail-interface-hash/output.json deleted file mode 100644 index 981629c77c49e..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-interface-hash/output.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./bad.swift": { - "object": "./bad.o", - "swift-dependencies": "./bad.swiftdeps" - }, - "./depends-on-main.swift": { - "object": "./depends-on-main.o", - "swift-dependencies": "./depends-on-main.swiftdeps" - }, - "./depends-on-bad.swift": { - "object": "./depends-on-bad.o", - "swift-dependencies": "./depends-on-bad.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/fail-simple/bad.swift b/test/Driver/Dependencies/Inputs/fail-simple/bad.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-simple/bad.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/fail-simple/main.swift b/test/Driver/Dependencies/Inputs/fail-simple/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-simple/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/fail-simple/other.swift b/test/Driver/Dependencies/Inputs/fail-simple/other.swift deleted file mode 100644 index 33392ce138612..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-simple/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [!private a] diff --git a/test/Driver/Dependencies/Inputs/fail-simple/output.json b/test/Driver/Dependencies/Inputs/fail-simple/output.json deleted file mode 100644 index 32ad1dd72d6f7..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-simple/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./bad.swift": { - "object": "./bad.o", - "swift-dependencies": "./bad.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/bad.swiftdeps b/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/bad.swiftdeps index d9a1141f39ea6..e0e7e8c8d0002 100644 Binary files a/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/bad.swiftdeps and b/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/bad.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/depends-on-bad.swiftdeps b/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/depends-on-bad.swiftdeps index ff755423fc661..277862cfd4eeb 100644 Binary files a/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/depends-on-bad.swiftdeps and b/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/depends-on-bad.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/depends-on-main.swiftdeps b/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/depends-on-main.swiftdeps index 427c0381ec65f..78cf6d4581114 100644 Binary files a/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/depends-on-main.swiftdeps and b/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/depends-on-main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/main.swiftdeps index 5844ed2c32e39..898b323f45903 100644 Binary files a/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/fail-with-bad-deps-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/bad.swift b/test/Driver/Dependencies/Inputs/fail-with-bad-deps/bad.swift deleted file mode 100644 index 0f05e70d14710..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/bad.swift +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [bad] -interface-hash: "after" -garbage: "" diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/bad.swiftdeps b/test/Driver/Dependencies/Inputs/fail-with-bad-deps/bad.swiftdeps deleted file mode 100644 index 923f6689ba1a5..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/bad.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [bad] -interface-hash: "before" diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-bad.swift b/test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-bad.swift deleted file mode 100644 index 415ec3b051000..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-bad.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [bad] -interface-hash: "after" diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-bad.swiftdeps b/test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-bad.swiftdeps deleted file mode 100644 index 97afde93b75ca..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-bad.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [bad] -interface-hash: "before" diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-main.swift b/test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-main.swift deleted file mode 100644 index 2b781b861cb7e..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [main] -interface-hash: "after" diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-main.swiftdeps b/test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-main.swiftdeps deleted file mode 100644 index cd50d25b878a7..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-main.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [main] -interface-hash: "before" diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/main.swift b/test/Driver/Dependencies/Inputs/fail-with-bad-deps/main.swift deleted file mode 100644 index 5b5f8d7f3346f..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [main] -interface-hash: "after" diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/main.swiftdeps b/test/Driver/Dependencies/Inputs/fail-with-bad-deps/main.swiftdeps deleted file mode 100644 index 0ec59e418937a..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/main.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [main] -interface-hash: "before" diff --git a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/output.json b/test/Driver/Dependencies/Inputs/fail-with-bad-deps/output.json deleted file mode 100644 index 981629c77c49e..0000000000000 --- a/test/Driver/Dependencies/Inputs/fail-with-bad-deps/output.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./bad.swift": { - "object": "./bad.o", - "swift-dependencies": "./bad.swiftdeps" - }, - "./depends-on-main.swift": { - "object": "./depends-on-main.o", - "swift-dependencies": "./depends-on-main.swiftdeps" - }, - "./depends-on-bad.swift": { - "object": "./depends-on-bad.o", - "swift-dependencies": "./depends-on-bad.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/independent/main.swift b/test/Driver/Dependencies/Inputs/independent/main.swift deleted file mode 100644 index 133c84747fcc7..0000000000000 --- a/test/Driver/Dependencies/Inputs/independent/main.swift +++ /dev/null @@ -1 +0,0 @@ -# Dependencies after compilation: none diff --git a/test/Driver/Dependencies/Inputs/independent/other.swift b/test/Driver/Dependencies/Inputs/independent/other.swift deleted file mode 100644 index 133c84747fcc7..0000000000000 --- a/test/Driver/Dependencies/Inputs/independent/other.swift +++ /dev/null @@ -1 +0,0 @@ -# Dependencies after compilation: none diff --git a/test/Driver/Dependencies/Inputs/independent/output.json b/test/Driver/Dependencies/Inputs/independent/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/Dependencies/Inputs/independent/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/malformed-after-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/malformed-after-fine/main.swiftdeps index a9561fcf725d2..db076f86e69f6 100644 Binary files a/test/Driver/Dependencies/Inputs/malformed-after-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/malformed-after-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/malformed-after-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/malformed-after-fine/other.swiftdeps index 3d9348aa25859..b8f5d8f2999a3 100644 Binary files a/test/Driver/Dependencies/Inputs/malformed-after-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/malformed-after-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/malformed-after/main.swift b/test/Driver/Dependencies/Inputs/malformed-after/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/Dependencies/Inputs/malformed-after/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/malformed-after/main.swiftdeps b/test/Driver/Dependencies/Inputs/malformed-after/main.swiftdeps deleted file mode 100644 index af39a9cad8a70..0000000000000 --- a/test/Driver/Dependencies/Inputs/malformed-after/main.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/malformed-after/other.swift b/test/Driver/Dependencies/Inputs/malformed-after/other.swift deleted file mode 100644 index d8b260499b5cf..0000000000000 --- a/test/Driver/Dependencies/Inputs/malformed-after/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -*** This is not a valid YAML file *** diff --git a/test/Driver/Dependencies/Inputs/malformed-after/other.swiftdeps b/test/Driver/Dependencies/Inputs/malformed-after/other.swiftdeps deleted file mode 100644 index 671d72a260df8..0000000000000 --- a/test/Driver/Dependencies/Inputs/malformed-after/other.swiftdeps +++ /dev/null @@ -1 +0,0 @@ -# Dependencies before compilation: diff --git a/test/Driver/Dependencies/Inputs/malformed-after/output.json b/test/Driver/Dependencies/Inputs/malformed-after/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/Dependencies/Inputs/malformed-after/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml-fine/main.swiftdeps index a9561fcf725d2..db076f86e69f6 100644 Binary files a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml-fine/other.swiftdeps index 3d9348aa25859..b8f5d8f2999a3 100644 Binary files a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/main.swift b/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/main.swiftdeps b/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/main.swiftdeps deleted file mode 100644 index af39a9cad8a70..0000000000000 --- a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/main.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/other.swift b/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/other.swift deleted file mode 100644 index f9c364551ec7b..0000000000000 --- a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -bogus-entry: [] diff --git a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/other.swiftdeps b/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/other.swiftdeps deleted file mode 100644 index 671d72a260df8..0000000000000 --- a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/other.swiftdeps +++ /dev/null @@ -1 +0,0 @@ -# Dependencies before compilation: diff --git a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/output.json b/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/mutual-interface-hash-fine/does-change.swiftdeps b/test/Driver/Dependencies/Inputs/mutual-interface-hash-fine/does-change.swiftdeps index c3f3e8151be88..c40809bb79d82 100644 Binary files a/test/Driver/Dependencies/Inputs/mutual-interface-hash-fine/does-change.swiftdeps and b/test/Driver/Dependencies/Inputs/mutual-interface-hash-fine/does-change.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/mutual-interface-hash-fine/does-not-change.swiftdeps b/test/Driver/Dependencies/Inputs/mutual-interface-hash-fine/does-not-change.swiftdeps index 5dc734cb0e000..d62a86322d3a5 100644 Binary files a/test/Driver/Dependencies/Inputs/mutual-interface-hash-fine/does-not-change.swiftdeps and b/test/Driver/Dependencies/Inputs/mutual-interface-hash-fine/does-not-change.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/mutual-interface-hash/does-change.swift b/test/Driver/Dependencies/Inputs/mutual-interface-hash/does-change.swift deleted file mode 100644 index f17cf50119019..0000000000000 --- a/test/Driver/Dependencies/Inputs/mutual-interface-hash/does-change.swift +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -provides-top-level: [b] -interface-hash: "after" diff --git a/test/Driver/Dependencies/Inputs/mutual-interface-hash/does-change.swiftdeps b/test/Driver/Dependencies/Inputs/mutual-interface-hash/does-change.swiftdeps deleted file mode 100644 index c03cc687534c2..0000000000000 --- a/test/Driver/Dependencies/Inputs/mutual-interface-hash/does-change.swiftdeps +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] -provides-top-level: [b] -interface-hash: "before" diff --git a/test/Driver/Dependencies/Inputs/mutual-interface-hash/does-not-change.swift b/test/Driver/Dependencies/Inputs/mutual-interface-hash/does-not-change.swift deleted file mode 100644 index c585e8096db3e..0000000000000 --- a/test/Driver/Dependencies/Inputs/mutual-interface-hash/does-not-change.swift +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [b] -provides-top-level: [a] -interface-hash: "same" diff --git a/test/Driver/Dependencies/Inputs/mutual-interface-hash/does-not-change.swiftdeps b/test/Driver/Dependencies/Inputs/mutual-interface-hash/does-not-change.swiftdeps deleted file mode 100644 index c585e8096db3e..0000000000000 --- a/test/Driver/Dependencies/Inputs/mutual-interface-hash/does-not-change.swiftdeps +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [b] -provides-top-level: [a] -interface-hash: "same" diff --git a/test/Driver/Dependencies/Inputs/mutual-interface-hash/output.json b/test/Driver/Dependencies/Inputs/mutual-interface-hash/output.json deleted file mode 100644 index dfbb111fcdce4..0000000000000 --- a/test/Driver/Dependencies/Inputs/mutual-interface-hash/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./does-change.swift": { - "object": "./does-change.o", - "swift-dependencies": "./does-change.swiftdeps" - }, - "./does-not-change.swift": { - "object": "./does-not-change.o", - "swift-dependencies": "./does-not-change.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps-fine/main.swiftdeps index 0c0a447001ba3..75a007a0e5764 100644 Binary files a/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps-fine/other.swiftdeps index fedd90b310a49..3674d778d4983 100644 Binary files a/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/main.swift b/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/main.swift deleted file mode 100644 index 98f98ba6ec681..0000000000000 --- a/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -provides-top-level: [b] diff --git a/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/main.swiftdeps b/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/main.swiftdeps deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/other.swift b/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/other.swift deleted file mode 100644 index b6e0280958d77..0000000000000 --- a/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/other.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [b] -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/other.swiftdeps b/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/other.swiftdeps deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/output.json b/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/mutual/main.swift b/test/Driver/Dependencies/Inputs/mutual/main.swift deleted file mode 100644 index 98f98ba6ec681..0000000000000 --- a/test/Driver/Dependencies/Inputs/mutual/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -provides-top-level: [b] diff --git a/test/Driver/Dependencies/Inputs/mutual/other.swift b/test/Driver/Dependencies/Inputs/mutual/other.swift deleted file mode 100644 index b6e0280958d77..0000000000000 --- a/test/Driver/Dependencies/Inputs/mutual/other.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [b] -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/mutual/output.json b/test/Driver/Dependencies/Inputs/mutual/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/Dependencies/Inputs/mutual/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/nominal-members/a-ext.swift b/test/Driver/Dependencies/Inputs/nominal-members/a-ext.swift deleted file mode 100644 index d6babbe4fa788..0000000000000 --- a/test/Driver/Dependencies/Inputs/nominal-members/a-ext.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-member: [[a, "ext"]] diff --git a/test/Driver/Dependencies/Inputs/nominal-members/a.swift b/test/Driver/Dependencies/Inputs/nominal-members/a.swift deleted file mode 100644 index 6ee4213e33e98..0000000000000 --- a/test/Driver/Dependencies/Inputs/nominal-members/a.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [a] -provides-member: [[a, ""]] diff --git a/test/Driver/Dependencies/Inputs/nominal-members/depends-on-a-ext.swift b/test/Driver/Dependencies/Inputs/nominal-members/depends-on-a-ext.swift deleted file mode 100644 index fb570816a6a11..0000000000000 --- a/test/Driver/Dependencies/Inputs/nominal-members/depends-on-a-ext.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-member: [[a, "ext"], [a, ""]] -depends-nominal: [a] diff --git a/test/Driver/Dependencies/Inputs/nominal-members/depends-on-a-foo.swift b/test/Driver/Dependencies/Inputs/nominal-members/depends-on-a-foo.swift deleted file mode 100644 index 5455f16e4e9a2..0000000000000 --- a/test/Driver/Dependencies/Inputs/nominal-members/depends-on-a-foo.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-member: [[a, "foo"], [a, ""]] -depends-nominal: [a] diff --git a/test/Driver/Dependencies/Inputs/nominal-members/output.json b/test/Driver/Dependencies/Inputs/nominal-members/output.json deleted file mode 100644 index d4d6d49c54405..0000000000000 --- a/test/Driver/Dependencies/Inputs/nominal-members/output.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "./a.swift": { - "object": "./a.o", - "swift-dependencies": "./a.swiftdeps" - }, - "./a-ext.swift": { - "object": "./a-ext.o", - "swift-dependencies": "./a-ext.swiftdeps" - }, - "./depends-on-a-ext.swift": { - "object": "./depends-on-a-ext.o", - "swift-dependencies": "./depends-on-a-ext.swiftdeps" - }, - "./depends-on-a-foo.swift": { - "object": "./depends-on-a-foo.o", - "swift-dependencies": "./depends-on-a-foo.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-after-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-depends-after-fine/main.swiftdeps index 9183a8ba33282..0fbef28af95e2 100644 Binary files a/test/Driver/Dependencies/Inputs/one-way-depends-after-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/one-way-depends-after-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-after-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-depends-after-fine/other.swiftdeps index b0a83b5a9b5be..c49bc07e3e6eb 100644 Binary files a/test/Driver/Dependencies/Inputs/one-way-depends-after-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/one-way-depends-after-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-after/main.swift b/test/Driver/Dependencies/Inputs/one-way-depends-after/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-depends-after/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-after/main.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-depends-after/main.swiftdeps deleted file mode 100644 index 671d72a260df8..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-depends-after/main.swiftdeps +++ /dev/null @@ -1 +0,0 @@ -# Dependencies before compilation: diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-after/other.swift b/test/Driver/Dependencies/Inputs/one-way-depends-after/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-depends-after/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-after/other.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-depends-after/other.swiftdeps deleted file mode 100644 index 37adc17c77e7c..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-depends-after/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-after/output.json b/test/Driver/Dependencies/Inputs/one-way-depends-after/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-depends-after/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-before-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-depends-before-fine/main.swiftdeps index b21ca1bfe8e11..e64b80c08a116 100644 Binary files a/test/Driver/Dependencies/Inputs/one-way-depends-before-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/one-way-depends-before-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-before-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-depends-before-fine/other.swiftdeps index b0a83b5a9b5be..c49bc07e3e6eb 100644 Binary files a/test/Driver/Dependencies/Inputs/one-way-depends-before-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/one-way-depends-before-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-before/main.swift b/test/Driver/Dependencies/Inputs/one-way-depends-before/main.swift deleted file mode 100644 index d281641607776..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-depends-before/main.swift +++ /dev/null @@ -1 +0,0 @@ -# Dependencies after compilation: diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-before/main.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-depends-before/main.swiftdeps deleted file mode 100644 index af39a9cad8a70..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-depends-before/main.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-before/other.swift b/test/Driver/Dependencies/Inputs/one-way-depends-before/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-depends-before/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-before/other.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-depends-before/other.swiftdeps deleted file mode 100644 index 37adc17c77e7c..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-depends-before/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-depends-before/output.json b/test/Driver/Dependencies/Inputs/one-way-depends-before/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-depends-before/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/one-way-external/main.swift b/test/Driver/Dependencies/Inputs/one-way-external/main.swift deleted file mode 100644 index de7b922b068b8..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-external/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -depends-external: ["./main1-external", "./main2-external"] diff --git a/test/Driver/Dependencies/Inputs/one-way-external/main1-external b/test/Driver/Dependencies/Inputs/one-way-external/main1-external deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/Dependencies/Inputs/one-way-external/main2-external b/test/Driver/Dependencies/Inputs/one-way-external/main2-external deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/Dependencies/Inputs/one-way-external/other.swift b/test/Driver/Dependencies/Inputs/one-way-external/other.swift deleted file mode 100644 index fd31229634def..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-external/other.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] -depends-external: ["./other1-external", "./other2-external"] diff --git a/test/Driver/Dependencies/Inputs/one-way-external/other1-external b/test/Driver/Dependencies/Inputs/one-way-external/other1-external deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/Dependencies/Inputs/one-way-external/other2-external b/test/Driver/Dependencies/Inputs/one-way-external/other2-external deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/Dependencies/Inputs/one-way-external/output.json b/test/Driver/Dependencies/Inputs/one-way-external/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-external/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-after-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-provides-after-fine/main.swiftdeps index 2f22faafc626f..dad97a138822e 100644 Binary files a/test/Driver/Dependencies/Inputs/one-way-provides-after-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/one-way-provides-after-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-after-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-provides-after-fine/other.swiftdeps index 4e4cfd71a465a..b8f5d8f2999a3 100644 Binary files a/test/Driver/Dependencies/Inputs/one-way-provides-after-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/one-way-provides-after-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-after/main.swift b/test/Driver/Dependencies/Inputs/one-way-provides-after/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-provides-after/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-after/main.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-provides-after/main.swiftdeps deleted file mode 100644 index af39a9cad8a70..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-provides-after/main.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-after/other.swift b/test/Driver/Dependencies/Inputs/one-way-provides-after/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-provides-after/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-after/other.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-provides-after/other.swiftdeps deleted file mode 100644 index 671d72a260df8..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-provides-after/other.swiftdeps +++ /dev/null @@ -1 +0,0 @@ -# Dependencies before compilation: diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-after/output.json b/test/Driver/Dependencies/Inputs/one-way-provides-after/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-provides-after/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-before-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-provides-before-fine/main.swiftdeps index 2f22faafc626f..dad97a138822e 100644 Binary files a/test/Driver/Dependencies/Inputs/one-way-provides-before-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/one-way-provides-before-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-before-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-provides-before-fine/other.swiftdeps index b3fe2d3a5af0f..d1135f16bf7ca 100644 Binary files a/test/Driver/Dependencies/Inputs/one-way-provides-before-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/one-way-provides-before-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-before/main.swift b/test/Driver/Dependencies/Inputs/one-way-provides-before/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-provides-before/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-before/main.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-provides-before/main.swiftdeps deleted file mode 100644 index af39a9cad8a70..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-provides-before/main.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-before/other.swift b/test/Driver/Dependencies/Inputs/one-way-provides-before/other.swift deleted file mode 100644 index 133c84747fcc7..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-provides-before/other.swift +++ /dev/null @@ -1 +0,0 @@ -# Dependencies after compilation: none diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-before/other.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-provides-before/other.swiftdeps deleted file mode 100644 index 37adc17c77e7c..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-provides-before/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-provides-before/output.json b/test/Driver/Dependencies/Inputs/one-way-provides-before/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-provides-before/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps-fine/main.swiftdeps index f5b2d6b0dd35c..4553fd0ac029f 100644 Binary files a/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps-fine/main.swiftdeps and b/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps-fine/main.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps-fine/other.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps-fine/other.swiftdeps index bacf9fc59d6bd..297c9086c5ee0 100644 Binary files a/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps-fine/other.swiftdeps and b/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps-fine/other.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/main.swift b/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/main.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/main.swiftdeps deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/other.swift b/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/other.swiftdeps b/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/other.swiftdeps deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/output.json b/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/output.json deleted file mode 100644 index f2eb4d2dddbeb..0000000000000 --- a/test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps", - "swiftmodule": "./main.swiftmodule", - "swiftdoc": "./main.swiftdoc", - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps", - "swiftmodule": "./main.swiftmodule", - "swiftdoc": "./main.swiftdoc", - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/private-after-fine/a.swiftdeps b/test/Driver/Dependencies/Inputs/private-after-fine/a.swiftdeps index 9d80d172a2de4..9485d93775e8d 100644 Binary files a/test/Driver/Dependencies/Inputs/private-after-fine/a.swiftdeps and b/test/Driver/Dependencies/Inputs/private-after-fine/a.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/private-after-fine/b.swiftdeps b/test/Driver/Dependencies/Inputs/private-after-fine/b.swiftdeps index c256595b686c8..ed217d51bb8d0 100644 Binary files a/test/Driver/Dependencies/Inputs/private-after-fine/b.swiftdeps and b/test/Driver/Dependencies/Inputs/private-after-fine/b.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/private-after-fine/c.swiftdeps b/test/Driver/Dependencies/Inputs/private-after-fine/c.swiftdeps index 7aec07e89f1a4..b0bbb481d8f2f 100644 Binary files a/test/Driver/Dependencies/Inputs/private-after-fine/c.swiftdeps and b/test/Driver/Dependencies/Inputs/private-after-fine/c.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/private-after-fine/d.swiftdeps b/test/Driver/Dependencies/Inputs/private-after-fine/d.swiftdeps index 93de7a407514b..7866ec7f6385b 100644 Binary files a/test/Driver/Dependencies/Inputs/private-after-fine/d.swiftdeps and b/test/Driver/Dependencies/Inputs/private-after-fine/d.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/private-after-fine/e.swiftdeps b/test/Driver/Dependencies/Inputs/private-after-fine/e.swiftdeps index 9208ef0fb1be2..9caab3f2aac33 100644 Binary files a/test/Driver/Dependencies/Inputs/private-after-fine/e.swiftdeps and b/test/Driver/Dependencies/Inputs/private-after-fine/e.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/private-after-fine/f.swiftdeps b/test/Driver/Dependencies/Inputs/private-after-fine/f.swiftdeps index 993aae48b3a01..24bed2a42a7fa 100644 Binary files a/test/Driver/Dependencies/Inputs/private-after-fine/f.swiftdeps and b/test/Driver/Dependencies/Inputs/private-after-fine/f.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/private-after-fine/g.swiftdeps b/test/Driver/Dependencies/Inputs/private-after-fine/g.swiftdeps index cea259c341645..f6402b515dafd 100644 Binary files a/test/Driver/Dependencies/Inputs/private-after-fine/g.swiftdeps and b/test/Driver/Dependencies/Inputs/private-after-fine/g.swiftdeps differ diff --git a/test/Driver/Dependencies/Inputs/private-after/a.swift b/test/Driver/Dependencies/Inputs/private-after/a.swift deleted file mode 100644 index 76fb34c551d66..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/a.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [a] diff --git a/test/Driver/Dependencies/Inputs/private-after/a.swiftdeps b/test/Driver/Dependencies/Inputs/private-after/a.swiftdeps deleted file mode 100644 index bdaa467ec3944..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/a.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [a] diff --git a/test/Driver/Dependencies/Inputs/private-after/b.swift b/test/Driver/Dependencies/Inputs/private-after/b.swift deleted file mode 100644 index c1c455e32fbc9..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/b.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [b] -depends-nominal: [!private a, e] diff --git a/test/Driver/Dependencies/Inputs/private-after/b.swiftdeps b/test/Driver/Dependencies/Inputs/private-after/b.swiftdeps deleted file mode 100644 index af1427f6a149a..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/b.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [b] -depends-nominal: [!private a, e] diff --git a/test/Driver/Dependencies/Inputs/private-after/c.swift b/test/Driver/Dependencies/Inputs/private-after/c.swift deleted file mode 100644 index b5a1c6a68b3da..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/c.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [c] -depends-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/private-after/c.swiftdeps b/test/Driver/Dependencies/Inputs/private-after/c.swiftdeps deleted file mode 100644 index 2a25e2c419b0a..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/c.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [c] -depends-nominal: [b] diff --git a/test/Driver/Dependencies/Inputs/private-after/d.swift b/test/Driver/Dependencies/Inputs/private-after/d.swift deleted file mode 100644 index 2fbb8a2590de2..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/d.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [d] -depends-nominal: [a] diff --git a/test/Driver/Dependencies/Inputs/private-after/d.swiftdeps b/test/Driver/Dependencies/Inputs/private-after/d.swiftdeps deleted file mode 100644 index 2928bc43a566f..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/d.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [] -depends-nominal: [a] diff --git a/test/Driver/Dependencies/Inputs/private-after/e.swift b/test/Driver/Dependencies/Inputs/private-after/e.swift deleted file mode 100644 index 452c171d41792..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/e.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [e] -depends-nominal: [d] diff --git a/test/Driver/Dependencies/Inputs/private-after/e.swiftdeps b/test/Driver/Dependencies/Inputs/private-after/e.swiftdeps deleted file mode 100644 index def0f31b858c0..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/e.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [] -depends-nominal: [d] diff --git a/test/Driver/Dependencies/Inputs/private-after/f.swift b/test/Driver/Dependencies/Inputs/private-after/f.swift deleted file mode 100644 index 25d3cd0b35243..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/f.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [f] -depends-nominal: [!private e] diff --git a/test/Driver/Dependencies/Inputs/private-after/f.swiftdeps b/test/Driver/Dependencies/Inputs/private-after/f.swiftdeps deleted file mode 100644 index 6021e8d68af3d..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/f.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [f] -depends-nominal: [!private e] diff --git a/test/Driver/Dependencies/Inputs/private-after/g.swift b/test/Driver/Dependencies/Inputs/private-after/g.swift deleted file mode 100644 index 41e5867827600..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/g.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [g] -depends-nominal: [f] diff --git a/test/Driver/Dependencies/Inputs/private-after/g.swiftdeps b/test/Driver/Dependencies/Inputs/private-after/g.swiftdeps deleted file mode 100644 index ab44b478e1fba..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/g.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [g] -depends-nominal: [f] diff --git a/test/Driver/Dependencies/Inputs/private-after/output.json b/test/Driver/Dependencies/Inputs/private-after/output.json deleted file mode 100644 index c15439d5780e4..0000000000000 --- a/test/Driver/Dependencies/Inputs/private-after/output.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "./a.swift": { - "object": "./a.o", - "swift-dependencies": "./a.swiftdeps" - }, - "./b.swift": { - "object": "./b.o", - "swift-dependencies": "./b.swiftdeps" - }, - "./c.swift": { - "object": "./c.o", - "swift-dependencies": "./c.swiftdeps" - }, - "./d.swift": { - "object": "./d.o", - "swift-dependencies": "./d.swiftdeps" - }, - "./e.swift": { - "object": "./e.o", - "swift-dependencies": "./e.swiftdeps" - }, - "./f.swift": { - "object": "./f.o", - "swift-dependencies": "./f.swiftdeps" - }, - "./g.swift": { - "object": "./g.o", - "swift-dependencies": "./g.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/Dependencies/Inputs/update-dependencies-bad.py b/test/Driver/Dependencies/Inputs/update-dependencies-bad.py index 97585bd4779bf..dd5463259410f 100755 --- a/test/Driver/Dependencies/Inputs/update-dependencies-bad.py +++ b/test/Driver/Dependencies/Inputs/update-dependencies-bad.py @@ -22,9 +22,10 @@ import os import shutil import signal +import subprocess import sys -assert sys.argv[1] == '-frontend' +assert sys.argv[2] == '-frontend' primaryFile = sys.argv[sys.argv.index('-primary-file') + 1] @@ -36,7 +37,14 @@ try: depsFile = sys.argv[sys.argv.index( '-emit-reference-dependencies-path') + 1] - shutil.copyfile(primaryFile, depsFile) + + returncode = subprocess.call([sys.argv[1], "--from-yaml", + "--input-filename=" + primaryFile, + "--output-filename=" + depsFile]) + # If the input is not valid YAML, just copy it over verbatim; + # we're testing a case where we produced a corrupted output file. + if returncode != 0: + shutil.copyfile(primaryFile, depsFile) except ValueError: pass diff --git a/test/Driver/Dependencies/Inputs/update-dependencies.py b/test/Driver/Dependencies/Inputs/update-dependencies.py index 5f29e0541ce1d..c366439e01358 100755 --- a/test/Driver/Dependencies/Inputs/update-dependencies.py +++ b/test/Driver/Dependencies/Inputs/update-dependencies.py @@ -31,9 +31,10 @@ import os import shutil +import subprocess import sys -assert sys.argv[1] == '-frontend' +assert sys.argv[2] == '-frontend' # NB: The bitcode options automatically specify a -primary-file, even in cases # where we do not wish to use a dependencies file in the test. @@ -43,8 +44,13 @@ depsFile = sys.argv[sys.argv.index( '-emit-reference-dependencies-path') + 1] - # Replace the dependencies file with the input file. - shutil.copyfile(primaryFile, depsFile) + returncode = subprocess.call([sys.argv[1], "--from-yaml", + "--input-filename=" + primaryFile, + "--output-filename=" + depsFile]) + if returncode != 0: + # If the input is not valid YAML, just copy it over verbatim; + # we're testing a case where we produced a corrupted output file. + shutil.copyfile(primaryFile, depsFile) else: primaryFile = None diff --git a/test/Driver/Dependencies/bindings-build-record.swift b/test/Driver/Dependencies/bindings-build-record.swift index 95ffe59d0325f..8df39c3b5ee02 100644 --- a/test/Driver/Dependencies/bindings-build-record.swift +++ b/test/Driver/Dependencies/bindings-build-record.swift @@ -3,7 +3,7 @@ // RUN: cp -r %S/Inputs/bindings-build-record/* %t // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -driver-show-incremental -output-file-map %t/output.json 2>&1 |%FileCheck %s -check-prefix=MUST-EXEC +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -disable-direct-intramodule-dependencies -driver-show-incremental -output-file-map %t/output.json 2>&1 |%FileCheck %s -check-prefix=MUST-EXEC // MUST-EXEC-NOT: warning // MUST-EXEC: inputs: ["./main.swift"], output: {object: "./main.o", swift-dependencies: "./main.swiftdeps"} @@ -12,7 +12,7 @@ // MUST-EXEC: Disabling incremental build: could not read build record // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0], "./yet-another.swift": [443865900, 0]}, build_time: [443865901, 0]}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC // NO-EXEC: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: check-dependencies // NO-EXEC: inputs: ["./other.swift"], output: {{[{].*[}]}}, condition: check-dependencies @@ -20,26 +20,26 @@ // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": !private [443865900, 0], "./yet-another.swift": !dirty [443865900, 0]}, build_time: [443865901, 0]}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=BUILD-RECORD +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=BUILD-RECORD // BUILD-RECORD: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: check-dependencies{{$}} // BUILD-RECORD: inputs: ["./other.swift"], output: {{[{].*[}]}}, condition: run-without-cascading{{$}} // BUILD-RECORD: inputs: ["./yet-another.swift"], output: {{[{].*[}]$}} -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift ./added.swift -incremental -output-file-map %t/output.json 2>&1 > %t/added.txt +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift ./added.swift -incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json 2>&1 > %t/added.txt // RUN: %FileCheck %s -check-prefix=BUILD-RECORD < %t/added.txt // RUN: %FileCheck %s -check-prefix=FILE-ADDED < %t/added.txt // FILE-ADDED: inputs: ["./added.swift"], output: {{[{].*[}]}}, condition: newly-added{{$}} // RUN: %{python} %S/Inputs/touch.py 443865960 %t/main.swift -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=BUILD-RECORD-PLUS-CHANGE +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=BUILD-RECORD-PLUS-CHANGE // BUILD-RECORD-PLUS-CHANGE: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: run-without-cascading // BUILD-RECORD-PLUS-CHANGE: inputs: ["./other.swift"], output: {{[{].*[}]}}, condition: run-without-cascading{{$}} // BUILD-RECORD-PLUS-CHANGE: inputs: ["./yet-another.swift"], output: {{[{].*[}]$}} // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=FILE-REMOVED +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift -incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=FILE-REMOVED // FILE-REMOVED: inputs: ["./main.swift"], output: {{[{].*[}]$}} // FILE-REMOVED: inputs: ["./other.swift"], output: {{[{].*[}]$}} // FILE-REMOVED-NOT: yet-another.swift diff --git a/test/Driver/Dependencies/chained-additional-kinds-fine.swift b/test/Driver/Dependencies/chained-additional-kinds-fine.swift index 927c5e68ea6ab..7e260fc8ec952 100644 --- a/test/Driver/Dependencies/chained-additional-kinds-fine.swift +++ b/test/Driver/Dependencies/chained-additional-kinds-fine.swift @@ -4,23 +4,23 @@ // RUN: cp -r %S/Inputs/chained-additional-kinds-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift // CHECK-FIRST: Handled yet-another.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled other.swift // CHECK-THIRD-DAG: Handled main.swift // CHECK-THIRD-DAG: Handled yet-another.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./other.swift ./main.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s diff --git a/test/Driver/Dependencies/chained-after-fine.swift b/test/Driver/Dependencies/chained-after-fine.swift index 6c93abf1a78cd..520007d79a834 100644 --- a/test/Driver/Dependencies/chained-after-fine.swift +++ b/test/Driver/Dependencies/chained-after-fine.swift @@ -6,17 +6,17 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/chained-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Handled main.swift // CHECK-THIRD: Handled other.swift diff --git a/test/Driver/Dependencies/chained-fine.swift b/test/Driver/Dependencies/chained-fine.swift index fe22ec4eb49d5..27779098b6d86 100644 --- a/test/Driver/Dependencies/chained-fine.swift +++ b/test/Driver/Dependencies/chained-fine.swift @@ -4,29 +4,29 @@ // RUN: cp -r %S/Inputs/chained-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift // CHECK-FIRST: Handled yet-another.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled other.swift // CHECK-THIRD-DAG: Handled main.swift // CHECK-THIRD-DAG: Handled yet-another.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./other.swift ./main.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // RUN: touch -t 201401240008 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./yet-another.swift ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // RUN: touch -t 201401240009 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./yet-another.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./other.swift ./yet-another.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s diff --git a/test/Driver/Dependencies/chained-private-after-fine.swift b/test/Driver/Dependencies/chained-private-after-fine.swift index 2922d119c3469..bdc6588f348ee 100644 --- a/test/Driver/Dependencies/chained-private-after-fine.swift +++ b/test/Driver/Dependencies/chained-private-after-fine.swift @@ -6,17 +6,17 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/chained-private-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-DAG: Handled other.swift // CHECK-SECOND-DAG: Handled main.swift diff --git a/test/Driver/Dependencies/chained-private-after-multiple-fine.swift b/test/Driver/Dependencies/chained-private-after-multiple-fine.swift index 33c58d8509b1e..c8c7ad9da4c7e 100644 --- a/test/Driver/Dependencies/chained-private-after-multiple-fine.swift +++ b/test/Driver/Dependencies/chained-private-after-multiple-fine.swift @@ -6,7 +6,7 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v @@ -14,13 +14,13 @@ // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/chained-private-after-multiple-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-DAG: Handled other.swift // CHECK-SECOND-DAG: Handled main.swift diff --git a/test/Driver/Dependencies/chained-private-after-multiple-nominal-members-fine.swift b/test/Driver/Dependencies/chained-private-after-multiple-nominal-members-fine.swift index 2eabda610ba4c..a96078aa04d0f 100644 --- a/test/Driver/Dependencies/chained-private-after-multiple-nominal-members-fine.swift +++ b/test/Driver/Dependencies/chained-private-after-multiple-nominal-members-fine.swift @@ -6,17 +6,17 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/chained-private-after-multiple-nominal-members-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-DAG: Handled other.swift // CHECK-SECOND-DAG: Handled main.swift diff --git a/test/Driver/Dependencies/chained-private-fine.swift b/test/Driver/Dependencies/chained-private-fine.swift index 49ef764b23db1..346559efc86c4 100644 --- a/test/Driver/Dependencies/chained-private-fine.swift +++ b/test/Driver/Dependencies/chained-private-fine.swift @@ -4,19 +4,19 @@ // RUN: cp -r %S/Inputs/chained-private-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift // CHECK-FIRST: Handled yet-another.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v >%t/outputToCheck 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v >%t/outputToCheck 2>&1 // RUN: %FileCheck -check-prefix=CHECK-THIRD %s < %t/outputToCheck // Driver now schedules jobs in the order the inputs were given, but diff --git a/test/Driver/Dependencies/check-interface-implementation-fine.swift b/test/Driver/Dependencies/check-interface-implementation-fine.swift index 87da2c135a748..c81fa1bcb5d23 100644 --- a/test/Driver/Dependencies/check-interface-implementation-fine.swift +++ b/test/Driver/Dependencies/check-interface-implementation-fine.swift @@ -6,7 +6,7 @@ // RUN: cp -r %S/Inputs/check-interface-implementation-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./c.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./c.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps // CHECK-FIRST-NOT: warning @@ -20,7 +20,7 @@ // RUN: touch -t 201401240006 %t/a.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./bad.swift ./c.swift -module-name main -j1 -v -driver-show-incremental > %t/a.txt 2>&1 +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./bad.swift ./c.swift -module-name main -j1 -v -driver-show-incremental > %t/a.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-A %s < %t/a.txt // RUN: %FileCheck -check-prefix=NEGATIVE-A %s < %t/a.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-A %s < %t/main~buildrecord.swiftdeps @@ -33,7 +33,7 @@ // CHECK-RECORD-A-DAG: "./bad.swift": !private [ // CHECK-RECORD-A-DAG: "./c.swift": !private [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./bad.swift ./c.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix CHECK-BC %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./bad.swift ./c.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix CHECK-BC %s // CHECK-BC-NOT: Handled a.swift // CHECK-BC-DAG: Handled bad.swift diff --git a/test/Driver/Dependencies/crash-added-fine.swift b/test/Driver/Dependencies/crash-added-fine.swift index 005ff837ce798..f42e85e37cae6 100644 --- a/test/Driver/Dependencies/crash-added-fine.swift +++ b/test/Driver/Dependencies/crash-added-fine.swift @@ -4,13 +4,13 @@ // RUN: cp -r %S/Inputs/crash-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s // CHECK-INITIAL-NOT: warning // CHECK-INITIAL: Handled main.swift // CHECK-INITIAL: Handled other.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./crash.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./crash.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s // RUN: %FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps // CHECK-ADDED-NOT: Handled @@ -26,13 +26,13 @@ // RUN: cp -r %S/Inputs/crash-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s // RUN: %FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIXED %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIXED %s // CHECK-FIXED-DAG: Handled crash.swift // CHECK-FIXED-DAG: Handled main.swift diff --git a/test/Driver/Dependencies/crash-new-fine.swift b/test/Driver/Dependencies/crash-new-fine.swift index ef58ef511ae13..8afca50270449 100644 --- a/test/Driver/Dependencies/crash-new-fine.swift +++ b/test/Driver/Dependencies/crash-new-fine.swift @@ -6,7 +6,7 @@ // Initially compile all inputs, crash will fail. -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s // CHECK-NOT: warning // CHECK: Handled main.swift // CHECK: Handled crash.swift @@ -15,7 +15,7 @@ // Put crash.swift first to assure it gets scheduled first. // The others get queued, but not dispatched because crash crashes. -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BAD-ONLY %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BAD-ONLY %s // CHECK-BAD-ONLY-NOT: warning // CHECK-BAD-ONLY-NOT: Handled @@ -24,7 +24,7 @@ // Make crash succeed and all get compiled, exactly once. -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s // CHECK-OKAY: Handled main.swift // CHECK-OKAY: Handled crash.swift // CHECK-OKAY: Handled other.swift @@ -34,12 +34,12 @@ // RUN: touch -t 201401240006 %t/crash.swift // RUN: rm %t/crash.swiftdeps -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s // And repair crash: // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY-2 %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY-2 %s // CHECK-OKAY-2-DAG: Handled crash.swift // CHECK-OKAY-2-DAG: Handled other.swift @@ -51,7 +51,7 @@ // RUN: touch -t 201401240006 %t/main.swift // RUN: rm %t/main.swiftdeps -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NO-MAIN-SWIFTDEPS %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NO-MAIN-SWIFTDEPS %s // CHECK-NO-MAIN-SWIFTDEPS-NOT: warning // CHECK-NO-MAIN-SWIFTDEPS: Handled main.swift @@ -62,7 +62,7 @@ // Touch all files earlier than last compiled date in the build record. // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 -driver-show-incremental | %FileCheck -check-prefix=CHECK-CURRENT-WITH-CRASH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 -driver-show-incremental -disable-direct-intramodule-dependencies | %FileCheck -check-prefix=CHECK-CURRENT-WITH-CRASH %s // CHECK-CURRENT-WITH-CRASH: Handled main.swift // CHECK-CURRENT-WITH-CRASH: Handled crash.swift @@ -73,4 +73,4 @@ // RUN: touch -t 201401240006 %t/other.swift // RUN: rm %t/other.swiftdeps -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s diff --git a/test/Driver/Dependencies/crash-simple-fine.swift b/test/Driver/Dependencies/crash-simple-fine.swift index 73b1e4c215600..e796414b76093 100644 --- a/test/Driver/Dependencies/crash-simple-fine.swift +++ b/test/Driver/Dependencies/crash-simple-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/crash-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift @@ -12,7 +12,7 @@ // CHECK-FIRST: Handled other.swift // RUN: touch -t 201401240006 %t/crash.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: Handled crash.swift // CHECK-SECOND-NOT: Handled main.swift @@ -24,7 +24,7 @@ // CHECK-RECORD-DAG: "./main.swift": !private [ // CHECK-RECORD-DAG: "./other.swift": !private [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled main.swift // CHECK-THIRD-DAG: Handled crash.swift diff --git a/test/Driver/Dependencies/dependencies-preservation-fine.swift b/test/Driver/Dependencies/dependencies-preservation-fine.swift index 5f8167cf1f29d..02a8f94322726 100644 --- a/test/Driver/Dependencies/dependencies-preservation-fine.swift +++ b/test/Driver/Dependencies/dependencies-preservation-fine.swift @@ -6,7 +6,7 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json // RUN: %FileCheck -check-prefix CHECK-ORIGINAL %s < main~buildrecord.swiftdeps~ // CHECK-ORIGINAL: inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]} diff --git a/test/Driver/Dependencies/driver-show-incremental-arguments-fine.swift b/test/Driver/Dependencies/driver-show-incremental-arguments-fine.swift index 454e270ef3014..96da82a52a005 100644 --- a/test/Driver/Dependencies/driver-show-incremental-arguments-fine.swift +++ b/test/Driver/Dependencies/driver-show-incremental-arguments-fine.swift @@ -1,7 +1,7 @@ // REQUIRES: shell // Test that when: // -// 1. Using -incremental -v -driver-show-incremental, and... +// 1. Using -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental, and... // 2. ...the arguments passed to the Swift compiler version differ from the ones // used in the original compilation... // @@ -14,11 +14,11 @@ // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s // CHECK-INCREMENTAL-NOT: Incremental compilation has been disabled // CHECK-INCREMENTAL: Queuing (initial): {compile: main.o <= main.swift} -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -g -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-ARGS-MISMATCH %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-ARGS-MISMATCH %s // CHECK-ARGS-MISMATCH: Incremental compilation has been disabled{{.*}}different arguments // CHECK-ARGS-MISMATCH-NOT: Queuing (initial): {compile: main.o <= main.swift} diff --git a/test/Driver/Dependencies/driver-show-incremental-conflicting-arguments-fine.swift b/test/Driver/Dependencies/driver-show-incremental-conflicting-arguments-fine.swift index c1021b731b377..8d10999ba8bb7 100644 --- a/test/Driver/Dependencies/driver-show-incremental-conflicting-arguments-fine.swift +++ b/test/Driver/Dependencies/driver-show-incremental-conflicting-arguments-fine.swift @@ -1,7 +1,7 @@ // REQUIRES: shell // Test that when: // -// 1. Using -incremental -v -driver-show-incremental, but... +// 1. Using -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental, but... // 2. ...options that disable incremental compilation, such as whole module // optimization or bitcode embedding are specified... // @@ -14,19 +14,19 @@ // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s // CHECK-INCREMENTAL-NOT: Incremental compilation has been disabled // CHECK-INCREMENTAL: Queuing (initial): {compile: main.o <= main.swift} -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -whole-module-optimization -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-WMO %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -whole-module-optimization -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-WMO %s // CHECK-WMO: Incremental compilation has been disabled{{.*}}whole module optimization // CHECK-WMO-NOT: Queuing (initial): {compile: main.o <= main.swift} -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -embed-bitcode -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-BITCODE %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -embed-bitcode -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-BITCODE %s // CHECK-BITCODE: Incremental compilation has been disabled{{.*}}LLVM IR bitcode // CHECK-BITCODE-NOT: Queuing (initial): {compile: main.o <= main.swift} -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -whole-module-optimization -embed-bitcode -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-WMO-AND-BITCODE %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -whole-module-optimization -embed-bitcode -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-WMO-AND-BITCODE %s // CHECK-WMO-AND-BITCODE: Incremental compilation has been disabled{{.*}}whole module optimization // CHECK-WMO-AND-BITCODE-NOT: Incremental compilation has been disabled // CHECK-WMO-AND-BITCODE-NOT: Queuing (initial): {compile: main.o <= main.swift} diff --git a/test/Driver/Dependencies/driver-show-incremental-inputs-fine.swift b/test/Driver/Dependencies/driver-show-incremental-inputs-fine.swift index c85aef03beced..0fbae58d72600 100644 --- a/test/Driver/Dependencies/driver-show-incremental-inputs-fine.swift +++ b/test/Driver/Dependencies/driver-show-incremental-inputs-fine.swift @@ -14,11 +14,11 @@ // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s // CHECK-INCREMENTAL-NOT: Incremental compilation has been disabled // CHECK-INCREMENTAL: Queuing (initial): {compile: main.o <= main.swift} -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INPUTS-MISMATCH %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INPUTS-MISMATCH %s // CHECK-INPUTS-MISMATCH: Incremental compilation has been disabled{{.*}}inputs // CHECK-INPUTS-MISMATCH: ./other.swift // CHECK-INPUTS-MISMATCH-NOT: Queuing (initial): {compile: main.o <= main.swift} diff --git a/test/Driver/Dependencies/driver-show-incremental-malformed-fine.swift b/test/Driver/Dependencies/driver-show-incremental-malformed-fine.swift index 8b9ea8bb7a62c..69b58ec784c3e 100644 --- a/test/Driver/Dependencies/driver-show-incremental-malformed-fine.swift +++ b/test/Driver/Dependencies/driver-show-incremental-malformed-fine.swift @@ -1,7 +1,7 @@ // REQUIRES: shell // Test that when: // -// 1. Using -incremental -v -driver-show-incremental, and... +// 1. Using -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental, and... // 2. ...the build record file does not contain valid JSON... // // ...then the driver prints a message indicating that incremental compilation @@ -13,24 +13,24 @@ // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s // CHECK-INCREMENTAL-NOT: Incremental compilation has been enabled // CHECK-INCREMENTAL: Queuing (initial): {compile: main.o <= main.swift} // RUN: rm %t/main~buildrecord.swiftdeps && touch %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -g -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MALFORMED %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MALFORMED %s // RUN: echo 'foo' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -g -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MALFORMED %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MALFORMED %s // CHECK-MALFORMED: Incremental compilation has been disabled{{.*}}malformed build record file // CHECK-MALFORMED-NOT: Queuing (initial): {compile: main.o <= main.swift} // RUN: echo '{version, inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -g -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MISSING-KEY %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MISSING-KEY %s // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -g -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MISSING-KEY %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MISSING-KEY %s // CHECK-MISSING-KEY: Incremental compilation has been disabled{{.*}}malformed build record file{{.*}}Malformed value for key // CHECK-MISSING-KEY-NOT: Queuing (initial): {compile: main.o <= main.swift} diff --git a/test/Driver/Dependencies/driver-show-incremental-mutual-fine.swift b/test/Driver/Dependencies/driver-show-incremental-mutual-fine.swift index 3d741f84fd20e..3455fb2e484f4 100644 --- a/test/Driver/Dependencies/driver-show-incremental-mutual-fine.swift +++ b/test/Driver/Dependencies/driver-show-incremental-mutual-fine.swift @@ -4,16 +4,16 @@ // RUN: cp -r %S/Inputs/mutual-with-swiftdeps-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v -driver-show-incremental -disable-direct-intramodule-dependencies 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift // CHECK-FIRST: Disabling incremental build: could not read build record -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v -driver-show-incremental -disable-direct-intramodule-dependencies 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Queuing // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v -driver-show-incremental -disable-direct-intramodule-dependencies 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Queuing (initial): {compile: other.o <= other.swift} // CHECK-THIRD: Queuing because of the initial set: {compile: main.o <= main.swift} // CHECK-THIRD-NEXT: interface of top-level name 'a' in other.swift -> interface of source file main.swiftdeps diff --git a/test/Driver/Dependencies/driver-show-incremental-swift-version-fine.swift b/test/Driver/Dependencies/driver-show-incremental-swift-version-fine.swift index 257949b86de84..548c83e442b68 100644 --- a/test/Driver/Dependencies/driver-show-incremental-swift-version-fine.swift +++ b/test/Driver/Dependencies/driver-show-incremental-swift-version-fine.swift @@ -1,7 +1,7 @@ // REQUIRES: shell // Test that when: // -// 1. Using -incremental -v -driver-show-incremental, and... +// 1. Using -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental, and... // 2. ...the Swift compiler version used to perform the incremental // compilation differs the original compilation... // @@ -14,12 +14,12 @@ // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s // CHECK-INCREMENTAL-NOT: Incremental compilation has been enabled // CHECK-INCREMENTAL: Queuing (initial): {compile: main.o <= main.swift} // RUN: echo '{version: "bogus", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-VERSION-MISMATCH %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -v -driver-show-incremental -disable-direct-intramodule-dependencies -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-VERSION-MISMATCH %s // CHECK-VERSION-MISMATCH: Incremental compilation has been disabled{{.*}}compiler version mismatch // CHECK-VERSION-MISMATCH: Compiling with: // CHECK-VERSION-MISMATCH: Previously compiled with: bogus diff --git a/test/Driver/Dependencies/embed-bitcode-parallel-fine.swift b/test/Driver/Dependencies/embed-bitcode-parallel-fine.swift index 6de636653418f..a0b1a8edd8aa6 100644 --- a/test/Driver/Dependencies/embed-bitcode-parallel-fine.swift +++ b/test/Driver/Dependencies/embed-bitcode-parallel-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/fake-build-for-bitcode.py" -output-file-map %t/output.json -incremental ./main.swift ./other.swift -embed-bitcode -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/fake-build-for-bitcode.py" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./main.swift ./other.swift -embed-bitcode -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: {{^{$}} @@ -57,7 +57,7 @@ // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/fake-build-for-bitcode.py" -output-file-map %t/output.json -incremental ./main.swift ./other.swift -embed-bitcode -module-name main -j2 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/fake-build-for-bitcode.py" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./main.swift ./other.swift -embed-bitcode -module-name main -j2 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: "kind": "began" // CHECK-SECOND: "name": "compile" diff --git a/test/Driver/Dependencies/fail-added-fine.swift b/test/Driver/Dependencies/fail-added-fine.swift index 67739c86c7990..09d6b7bfba419 100644 --- a/test/Driver/Dependencies/fail-added-fine.swift +++ b/test/Driver/Dependencies/fail-added-fine.swift @@ -4,13 +4,13 @@ // RUN: cp -r %S/Inputs/fail-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s // CHECK-INITIAL-NOT: warning // CHECK-INITIAL: Handled main.swift // CHECK-INITIAL: Handled other.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s // RUN: %FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps // CHECK-ADDED-NOT: Handled @@ -26,7 +26,7 @@ // RUN: cp -r %S/Inputs/fail-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s // RUN: %FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps diff --git a/test/Driver/Dependencies/fail-chained-fine.swift b/test/Driver/Dependencies/fail-chained-fine.swift index e699bf9ab45fd..e222a83a9d903 100644 --- a/test/Driver/Dependencies/fail-chained-fine.swift +++ b/test/Driver/Dependencies/fail-chained-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/fail-chained-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps // CHECK-FIRST-NOT: warning @@ -26,7 +26,7 @@ // RUN: touch -t 201401240006 %t/a.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./bad.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift -module-name main -j1 -v > %t/a.txt 2>&1 +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./bad.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift -module-name main -j1 -v > %t/a.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-A %s < %t/a.txt // RUN: %FileCheck -check-prefix=NEGATIVE-A %s < %t/a.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-A %s < %t/main~buildrecord.swiftdeps @@ -47,7 +47,7 @@ // CHECK-RECORD-A-DAG: "./f.swift": [ // CHECK-RECORD-A-DAG: "./bad.swift": !private [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/a2.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/a2.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-A2 %s < %t/a2.txt // RUN: %FileCheck -check-prefix=NEGATIVE-A2 %s < %t/a2.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps @@ -65,10 +65,10 @@ // RUN: cp -r %S/Inputs/fail-chained-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/b.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/b.txt 2>&1 +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/b.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-B %s < %t/b.txt // RUN: %FileCheck -check-prefix=NEGATIVE-B %s < %t/b.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-B %s < %t/main~buildrecord.swiftdeps @@ -89,7 +89,7 @@ // CHECK-RECORD-B-DAG: "./f.swift": [ // CHECK-RECORD-B-DAG: "./bad.swift": !private [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/b2.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/b2.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-B2 %s < %t/b2.txt // RUN: %FileCheck -check-prefix=NEGATIVE-B2 %s < %t/b2.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps @@ -107,10 +107,10 @@ // RUN: cp -r %S/Inputs/fail-chained-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/bad.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./bad.swift ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift -module-name main -j1 -v > %t/bad.txt 2>&1 +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./bad.swift ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift -module-name main -j1 -v > %t/bad.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-BAD %s < %t/bad.txt // RUN: %FileCheck -check-prefix=NEGATIVE-BAD %s < %t/bad.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-A %s < %t/main~buildrecord.swiftdeps @@ -123,7 +123,7 @@ // NEGATIVE-BAD-NOT: Handled e.swift // NEGATIVE-BAD-NOT: Handled f.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/bad2.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/bad2.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-A2 %s < %t/bad2.txt // RUN: %FileCheck -check-prefix=NEGATIVE-A2 %s < %t/bad2.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps diff --git a/test/Driver/Dependencies/fail-interface-hash-fine.swift b/test/Driver/Dependencies/fail-interface-hash-fine.swift index 0db9636323ed4..2ecd51a5c0fe7 100644 --- a/test/Driver/Dependencies/fail-interface-hash-fine.swift +++ b/test/Driver/Dependencies/fail-interface-hash-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/fail-interface-hash-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift @@ -16,7 +16,7 @@ // RUN: cp -r %S/Inputs/fail-interface-hash-fine/*.swiftdeps %t // RUN: touch -t 201401240006 %t/bad.swift %t/main.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // RUN: %FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps // CHECK-SECOND: Handled main.swift @@ -29,7 +29,7 @@ // CHECK-RECORD-DAG: "./depends-on-main.swift": !private [ // CHECK-RECORD-DAG: "./depends-on-bad.swift": [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled bad // CHECK-THIRD-DAG: Handled depends-on-bad diff --git a/test/Driver/Dependencies/fail-new-fine.swift b/test/Driver/Dependencies/fail-new-fine.swift index dcb883a4ca321..7d8f82146ba99 100644 --- a/test/Driver/Dependencies/fail-new-fine.swift +++ b/test/Driver/Dependencies/fail-new-fine.swift @@ -4,20 +4,20 @@ // RUN: cp -r %S/Inputs/fail-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s // CHECK-NOT: warning // CHECK: Handled main.swift // CHECK: Handled bad.swift // CHECK-NOT: Handled other.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BAD-ONLY %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BAD-ONLY %s // CHECK-BAD-ONLY-NOT: warning // CHECK-BAD-ONLY-NOT: Handled // CHECK-BAD-ONLY: Handled bad.swift // CHECK-BAD-ONLY-NOT: Handled -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s // CHECK-OKAY: Handled main.swift // CHECK-OKAY: Handled bad.swift // CHECK-OKAY: Handled other.swift @@ -25,10 +25,10 @@ // RUN: touch -t 201401240006 %t/bad.swift // RUN: rm %t/bad.swiftdeps -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY-2 %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY-2 %s // CHECK-OKAY-2-DAG: Handled bad.swift // CHECK-OKAY-2-DAG: Handled other.swift @@ -36,10 +36,10 @@ // RUN: touch -t 201401240006 %t/main.swift // RUN: rm %t/main.swiftdeps -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s // RUN: touch -t 201401240006 %t/other.swift // RUN: rm %t/other.swiftdeps -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s diff --git a/test/Driver/Dependencies/fail-simple-fine.swift b/test/Driver/Dependencies/fail-simple-fine.swift index 1206662734ba9..662b0a03d0b98 100644 --- a/test/Driver/Dependencies/fail-simple-fine.swift +++ b/test/Driver/Dependencies/fail-simple-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/fail-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift @@ -12,7 +12,7 @@ // CHECK-FIRST: Handled other.swift // RUN: touch -t 201401240006 %t/bad.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // RUN: %FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps // CHECK-SECOND: Handled bad.swift @@ -23,7 +23,7 @@ // CHECK-RECORD-DAG: "./main.swift": !private [ // CHECK-RECORD-DAG: "./other.swift": !private [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled main.swift // CHECK-THIRD-DAG: Handled bad.swift diff --git a/test/Driver/Dependencies/fail-with-bad-deps-fine.swift b/test/Driver/Dependencies/fail-with-bad-deps-fine.swift index 27be26c09ddf4..d63519cd410a4 100644 --- a/test/Driver/Dependencies/fail-with-bad-deps-fine.swift +++ b/test/Driver/Dependencies/fail-with-bad-deps-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/fail-with-bad-deps-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift @@ -15,14 +15,14 @@ // Reset the .swiftdeps files. // RUN: cp -r %S/Inputs/fail-with-bad-deps-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NONE %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NONE %s // CHECK-NONE-NOT: Handled // Reset the .swiftdeps files. // RUN: cp -r %S/Inputs/fail-with-bad-deps-fine/*.swiftdeps %t // RUN: touch -t 201401240006 %t/bad.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BUILD-ALL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BUILD-ALL %s // CHECK-BUILD-ALL-NOT: warning // CHECK-BUILD-ALL: Handled bad.swift @@ -34,7 +34,7 @@ // RUN: cp -r %S/Inputs/fail-with-bad-deps-fine/*.swiftdeps %t // RUN: touch -t 201401240007 %t/bad.swift %t/main.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-WITH-FAIL %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-WITH-FAIL %s // RUN: %FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps // CHECK-WITH-FAIL: Handled main.swift @@ -47,4 +47,4 @@ // CHECK-RECORD-DAG: "./depends-on-main.swift": !private [ // CHECK-RECORD-DAG: "./depends-on-bad.swift": [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental ./bad.swift ./main.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BUILD-ALL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./bad.swift ./main.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BUILD-ALL %s diff --git a/test/Driver/Dependencies/file-added-fine.swift b/test/Driver/Dependencies/file-added-fine.swift index ae1bcebca7d08..741e0712cf478 100644 --- a/test/Driver/Dependencies/file-added-fine.swift +++ b/test/Driver/Dependencies/file-added-fine.swift @@ -4,16 +4,16 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-NOT: Handled other.swift // CHECK-THIRD: Handled main.swift diff --git a/test/Driver/Dependencies/independent-fine.swift b/test/Driver/Dependencies/independent-fine.swift index 6fab73f2a3ffb..7663ac10c8440 100644 --- a/test/Driver/Dependencies/independent-fine.swift +++ b/test/Driver/Dependencies/independent-fine.swift @@ -4,43 +4,43 @@ // RUN: cp -r %S/Inputs/independent-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: ls %t/main~buildrecord.swiftdeps // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/independent-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s // CHECK-FIRST-MULTI: Handled main.swift // CHECK-FIRST-MULTI: Handled other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // RUN: touch -t 201401240006 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/independent-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SINGLE %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SINGLE %s // CHECK-SINGLE: Handled main.swift // RUN: ls %t/main~buildrecord.swiftdeps diff --git a/test/Driver/Dependencies/independent-half-dirty-fine.swift b/test/Driver/Dependencies/independent-half-dirty-fine.swift index f26194d9be471..04a9c48811fdd 100644 --- a/test/Driver/Dependencies/independent-half-dirty-fine.swift +++ b/test/Driver/Dependencies/independent-half-dirty-fine.swift @@ -2,7 +2,7 @@ // RUN: cp -r %S/Inputs/independent-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift @@ -10,14 +10,14 @@ // RUN: touch -t 201401240005 %t/other.o // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled main.swift // CHECK-SECOND: Handled other.swift // CHECK-SECOND-NOT: Handled main.swift // RUN: rm %t/other.swiftdeps -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Handled main.swift // CHECK-THIRD: Handled other.swift diff --git a/test/Driver/Dependencies/independent-parseable-fine.swift b/test/Driver/Dependencies/independent-parseable-fine.swift index a5598145260c8..ff935d1950120 100644 --- a/test/Driver/Dependencies/independent-parseable-fine.swift +++ b/test/Driver/Dependencies/independent-parseable-fine.swift @@ -2,7 +2,7 @@ // RUN: cp -r %S/Inputs/independent-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: {{^{$}} @@ -17,7 +17,7 @@ // CHECK-FIRST: "output": "Handled main.swift{{(\\r)?}}\n" // CHECK-FIRST: {{^}$}} -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: {{^{$}} // CHECK-SECOND: "kind": "skipped" @@ -26,14 +26,14 @@ // CHECK-SECOND: {{^}$}} // RUN: touch -t 201401240006 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/independent-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s // CHECK-FIRST-MULTI: {{^{$}} // CHECK-FIRST-MULTI: "kind": "began" @@ -59,7 +59,7 @@ // CHECK-FIRST-MULTI: "output": "Handled other.swift{{(\\r)?}}\n" // CHECK-FIRST-MULTI: {{^}$}} -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND-MULTI %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND-MULTI %s // CHECK-SECOND-MULTI: {{^{$}} // CHECK-SECOND-MULTI: "kind": "skipped" @@ -74,5 +74,5 @@ // CHECK-SECOND-MULTI: {{^}$}} // RUN: touch -t 201401240006 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s diff --git a/test/Driver/Dependencies/malformed-but-valid-yaml-fine.swift b/test/Driver/Dependencies/malformed-but-valid-yaml-fine.swift index 376da6e325762..b231c8719afec 100644 --- a/test/Driver/Dependencies/malformed-but-valid-yaml-fine.swift +++ b/test/Driver/Dependencies/malformed-but-valid-yaml-fine.swift @@ -3,24 +3,24 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/malformed-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: Handled other.swift // CHECK-SECOND: Handled main.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Handled main.swift // CHECK-THIRD: Handled other.swift @@ -30,18 +30,18 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/malformed-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift diff --git a/test/Driver/Dependencies/malformed-fine.swift b/test/Driver/Dependencies/malformed-fine.swift index 1d3d149e1cfff..34f92709f2902 100644 --- a/test/Driver/Dependencies/malformed-fine.swift +++ b/test/Driver/Dependencies/malformed-fine.swift @@ -3,24 +3,24 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/malformed-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: Handled other.swift // CHECK-SECOND: Handled main.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Handled main.swift // CHECK-THIRD: Handled other.swift @@ -30,18 +30,18 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/malformed-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift diff --git a/test/Driver/Dependencies/moduleonly.swift b/test/Driver/Dependencies/moduleonly.swift index a2c38a2214e76..86eb8e16915b0 100644 --- a/test/Driver/Dependencies/moduleonly.swift +++ b/test/Driver/Dependencies/moduleonly.swift @@ -2,7 +2,7 @@ // RUN: cp -r %S/Inputs/moduleonly/* %t // RUN: touch -t 201801230045 %t/*.swift -// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK1 %s +// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -disable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK1 %s // RUN: test ! -f %t/buildrecord.swiftdeps // RUN: test -f %t/buildrecord.swiftdeps~moduleonly @@ -10,7 +10,7 @@ // CHECK1-DAG: -primary-file ./bar.swift // CHECK1-DAG: -primary-file ./baz.swift -// RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK2 %s +// RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental -disable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK2 %s // RUN: test -f %t/buildrecord.swiftdeps // RUN: test -f %t/buildrecord.swiftdeps~moduleonly @@ -18,7 +18,7 @@ // CHECK2-DAG: -primary-file ./bar.swift // CHECK2-DAG: -primary-file ./baz.swift -// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK3 %s +// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -disable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK3 %s // RUN: test -f %t/buildrecord.swiftdeps~moduleonly // RUN: test -f %t/buildrecord.swiftdeps @@ -27,20 +27,20 @@ // CHECK3-NOT: -primary-file ./baz.swift // RUN: touch -t 201801230123 %t/bar.swift -// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK4 %s +// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -disable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK4 %s // CHECK4-NOT: -primary-file ./foo.swift // CHECK4-NOT: -primary-file ./baz.swift // CHECK4-DAG: -primary-file ./bar.swift // RUN: touch -t 201801230145 %t/baz.swift -// RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK5 %s +// RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental -disable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK5 %s // CHECK5-NOT: -primary-file ./foo.swift // CHECK5-DAG: -primary-file ./bar.swift // CHECK5-DAG: -primary-file ./baz.swift -// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK6 %s +// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -disable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK6 %s // CHECK6-NOT: -primary-file ./foo.swift // CHECK6-NOT: -primary-file ./bar.swift @@ -52,7 +52,7 @@ // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/moduleonly/* %t // RUN: touch -t 201801230045 %t/*.swift -// RUN: cd %t && %target-build-swift -c -g -output-file-map ./output.json -incremental ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 +// RUN: cd %t && %target-build-swift -c -g -output-file-map ./output.json -incremental -disable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 // RUN: test ! -f %t/buildrecord.swiftdeps~moduleonly // RUN: test -f %t/buildrecord.swiftdeps // RUN: test ! -f %t/foo~partial.swiftmodule @@ -62,7 +62,7 @@ // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/moduleonly/* %t // RUN: touch -t 201801230045 %t/*.swift -// RUN: cd %t && %target-build-swift -emit-library -g -output-file-map ./output.json -incremental ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 +// RUN: cd %t && %target-build-swift -emit-library -g -output-file-map ./output.json -incremental -disable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 // RUN: test ! -f %t/buildrecord.swiftdeps~moduleonly // RUN: test -f %t/buildrecord.swiftdeps // RUN: test -f %t/foo~partial.swiftmodule @@ -74,12 +74,12 @@ // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/moduleonly/* %t // RUN: touch -t 201801230045 %t/*.swift -// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 +// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -disable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 // RUN: cp -f %t/testmodule.swiftmodule %t-moduleonly.swiftmodule // RUN: cp -f %t/testmodule.swiftdoc %t-moduleonly.swiftdoc // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/moduleonly/* %t // RUN: touch -t 201801230045 %t/*.swift -// RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 +// RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental -disable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 // RUN: diff %t/testmodule.swiftmodule %t-moduleonly.swiftmodule // RUN: diff %t/testmodule.swiftdoc %t-moduleonly.swiftdoc diff --git a/test/Driver/Dependencies/mutual-fine.swift b/test/Driver/Dependencies/mutual-fine.swift index a0e8868cc180b..a85759ff05610 100644 --- a/test/Driver/Dependencies/mutual-fine.swift +++ b/test/Driver/Dependencies/mutual-fine.swift @@ -4,21 +4,21 @@ // RUN: cp -r %S/Inputs/mutual-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Handled main.swift // CHECK-THIRD: Handled other.swift // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s diff --git a/test/Driver/Dependencies/mutual-interface-hash-fine.swift b/test/Driver/Dependencies/mutual-interface-hash-fine.swift index 20a956553c044..035a3b57b77c2 100644 --- a/test/Driver/Dependencies/mutual-interface-hash-fine.swift +++ b/test/Driver/Dependencies/mutual-interface-hash-fine.swift @@ -5,17 +5,17 @@ // RUN: touch -t 201401240005 %t/* // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/mutual-interface-hash-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s // CHECK-CLEAN-NOT: Handled // RUN: touch -t 201401240006 %t/does-change.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CHANGE %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CHANGE %s // CHECK-CHANGE-DAG: Handled does-change.swift // CHECK-CHANGE-DAG: Handled does-not-change.swift @@ -24,7 +24,7 @@ // RUN: cp -r %S/Inputs/mutual-interface-hash-fine/*.swiftdeps %t // RUN: touch -t 201401240006 %t/does-not-change.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NO-CHANGE %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NO-CHANGE %s // CHECK-NO-CHANGE-NOT: Handled // CHECK-NO-CHANGE: Handled does-not-change.swift @@ -36,7 +36,7 @@ // Make sure the files really were dependent on one another. // RUN: touch -t 201401240007 %t/does-not-change.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REBUILD-DEPENDENTS %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REBUILD-DEPENDENTS %s // CHECK-REBUILD-DEPENDENTS-DAG: Handled does-not-change.swift // CHECK-REBUILD-DEPENDENTS-DAG: Handled does-change.swift @@ -47,4 +47,4 @@ // RUN: cp -r %S/Inputs/mutual-interface-hash-fine/*.swiftdeps %t // RUN: sed -E -e 's/"[^"]*does-not-change.swift":/& !dirty/' -i.prev %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REBUILD-DEPENDENTS %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REBUILD-DEPENDENTS %s diff --git a/test/Driver/Dependencies/nominal-members-fine.swift b/test/Driver/Dependencies/nominal-members-fine.swift index 7c1578f80de91..a9f36d3855661 100644 --- a/test/Driver/Dependencies/nominal-members-fine.swift +++ b/test/Driver/Dependencies/nominal-members-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/nominal-members-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s // CHECK-INITIAL-NOT: warning // CHECK-INITIAL: Handled a.swift @@ -12,12 +12,12 @@ // CHECK-INITIAL: Handled depends-on-a-foo.swift // CHECK-INITIAL: Handled depends-on-a-ext.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s // CHECK-CLEAN-NOT: Handled // RUN: touch -t 201401240006 %t/a.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v > %t/touched-a.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v > %t/touched-a.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-TOUCHED-A %s < %t/touched-a.txt // RUN: %FileCheck -check-prefix=NEGATIVE-TOUCHED-A %s < %t/touched-a.txt @@ -26,11 +26,11 @@ // CHECK-TOUCHED-A-DAG: Handled depends-on-a-ext.swift // NEGATIVE-TOUCHED-A-NOT: Handled a-ext.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s // RUN: touch -t 201401240007 %t/a-ext.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-TOUCHED-EXT %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-TOUCHED-EXT %s // CHECK-TOUCHED-EXT-NOT: Handled // CHECK-TOUCHED-EXT: Handled a-ext.swift diff --git a/test/Driver/Dependencies/one-way-depends-after-fine.swift b/test/Driver/Dependencies/one-way-depends-after-fine.swift index 2909800b307fd..115717e731e6a 100644 --- a/test/Driver/Dependencies/one-way-depends-after-fine.swift +++ b/test/Driver/Dependencies/one-way-depends-after-fine.swift @@ -6,25 +6,25 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-depends-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled main.swift // CHECK-SECOND: Handled other.swift // CHECK-SECOND-NOT: Handled main.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // RUN: %empty-directory(%t) @@ -32,25 +32,25 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-depends-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-NOT: Handled other.swift // CHECK-THIRD: Handled main.swift // CHECK-THIRD-NOT: Handled other.swift // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // RUN: touch -t 201401240008 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-DAG: Handled other.swift // CHECK-FOURTH-DAG: Handled main.swift diff --git a/test/Driver/Dependencies/one-way-depends-before-fine.swift b/test/Driver/Dependencies/one-way-depends-before-fine.swift index a8b52bf063523..3a19bc78b8f54 100644 --- a/test/Driver/Dependencies/one-way-depends-before-fine.swift +++ b/test/Driver/Dependencies/one-way-depends-before-fine.swift @@ -6,24 +6,24 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-depends-before-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: Handled main.swift // CHECK-SECOND: Handled other.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-NOT: Handled main.swift // CHECK-THIRD: Handled other.swift @@ -35,22 +35,22 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-depends-before-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift // CHECK-FOURTH-NOT: Handled other.swift // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // RUN: touch -t 201401240008 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s diff --git a/test/Driver/Dependencies/one-way-external-delete-fine.swift b/test/Driver/Dependencies/one-way-external-delete-fine.swift index 106249269b30a..e86a46b512d43 100644 --- a/test/Driver/Dependencies/one-way-external-delete-fine.swift +++ b/test/Driver/Dependencies/one-way-external-delete-fine.swift @@ -2,13 +2,13 @@ // RUN: cp -r %S/Inputs/one-way-external-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled @@ -17,7 +17,7 @@ // RUN: touch -t 201401240006 %t/*.o // RUN: touch -t 201401240004 %t/*-external // RUN: rm %t/other1-external -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled other.swift // CHECK-THIRD-DAG: Handled main.swift @@ -27,14 +27,14 @@ // RUN: cp -r %S/Inputs/one-way-external-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240005 %t/* // RUN: touch -t 201401240006 %t/*.o // RUN: touch -t 201401240004 %t/*-external // RUN: rm %t/main1-external -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift diff --git a/test/Driver/Dependencies/one-way-external-fine.swift b/test/Driver/Dependencies/one-way-external-fine.swift index 65e8790fb792d..6135e0bd10c01 100644 --- a/test/Driver/Dependencies/one-way-external-fine.swift +++ b/test/Driver/Dependencies/one-way-external-fine.swift @@ -8,13 +8,13 @@ // RUN: cp -r %S/Inputs/one-way-external-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled @@ -23,7 +23,7 @@ // RUN: touch -t 201401240006 %t/*.o // RUN: touch -t 201401240004 %t/*-external // RUN: touch -t 203704010005 %t/other1-external -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled other.swift // CHECK-THIRD-DAG: Handled main.swift @@ -32,14 +32,14 @@ // RUN: touch -t 201401240006 %t/*.o // RUN: touch -t 201401240004 %t/*-external // RUN: touch -t 203704010005 %t/other2-external -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // RUN: touch -t 201401240005 %t/* // RUN: touch -t 201401240006 %t/*.o // RUN: touch -t 201401240004 %t/*-external // RUN: touch -t 203704010005 %t/main1-external -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift @@ -49,4 +49,4 @@ // RUN: touch -t 201401240006 %t/*.o // RUN: touch -t 201401240004 %t/*-external // RUN: touch -t 203704010005 %t/main2-external -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s diff --git a/test/Driver/Dependencies/one-way-fine.swift b/test/Driver/Dependencies/one-way-fine.swift index e20fab4a0a6af..ecc889bcf651f 100644 --- a/test/Driver/Dependencies/one-way-fine.swift +++ b/test/Driver/Dependencies/one-way-fine.swift @@ -4,34 +4,34 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Handled main.swift // CHECK-THIRD: Handled other.swift // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift // CHECK-FOURTH-NOT: Handled other.swift // RUN: rm %t/main.o -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // RUN: rm %t/other.o -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIFTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIFTH %s // CHECK-FIFTH-NOT: Handled main.swift // CHECK-FIFTH: Handled other.swift @@ -41,34 +41,34 @@ // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // Try modifying the inputs /backwards/ in time rather than forwards. // RUN: touch -t 201401240004 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // RUN: touch -t 201401240004 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FIRST %s // CHECK-REV-FIRST: Handled other.swift // CHECK-REV-FIRST: Handled main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-SECOND %s // CHECK-REV-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FIRST %s // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FOURTH %s // CHECK-REV-FOURTH-NOT: Handled other.swift // CHECK-REV-FOURTH: Handled main.swift diff --git a/test/Driver/Dependencies/one-way-merge-module-fine.swift b/test/Driver/Dependencies/one-way-merge-module-fine.swift index 850bc9ecd370f..de41a215d5502 100644 --- a/test/Driver/Dependencies/one-way-merge-module-fine.swift +++ b/test/Driver/Dependencies/one-way-merge-module-fine.swift @@ -4,14 +4,14 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift // CHECK-FIRST: Produced master.swiftmodule -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: warning // CHECK-SECOND-NOT: Handled diff --git a/test/Driver/Dependencies/one-way-parallel-fine.swift b/test/Driver/Dependencies/one-way-parallel-fine.swift index a135f7795ece3..b5aced8140697 100644 --- a/test/Driver/Dependencies/one-way-parallel-fine.swift +++ b/test/Driver/Dependencies/one-way-parallel-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: {{^{$}} @@ -32,7 +32,7 @@ // CHECK-FIRST: {{^}$}} // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j2 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j2 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: {{^{$}} // CHECK-SECOND: "kind": "began" diff --git a/test/Driver/Dependencies/one-way-parseable-fine.swift b/test/Driver/Dependencies/one-way-parseable-fine.swift index e4a34e75617ae..de2d0d4edba60 100644 --- a/test/Driver/Dependencies/one-way-parseable-fine.swift +++ b/test/Driver/Dependencies/one-way-parseable-fine.swift @@ -2,7 +2,7 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: {{^{$}} @@ -29,7 +29,7 @@ // CHECK-FIRST: "output": "Handled other.swift{{(\\r)?}}\n" // CHECK-FIRST: {{^}$}} -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: {{^{$}} // CHECK-SECOND: "kind": "skipped" @@ -44,7 +44,7 @@ // CHECK-SECOND: {{^}$}} // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: {{^{$}} // CHECK-THIRD: "kind": "began" @@ -71,7 +71,7 @@ // CHECK-THIRD: {{^}$}} // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH: {{^{$}} // CHECK-FOURTH: "kind": "began" diff --git a/test/Driver/Dependencies/one-way-provides-after-fine.swift b/test/Driver/Dependencies/one-way-provides-after-fine.swift index 8fdce70275ab0..bf4466605e15c 100644 --- a/test/Driver/Dependencies/one-way-provides-after-fine.swift +++ b/test/Driver/Dependencies/one-way-provides-after-fine.swift @@ -6,42 +6,42 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-provides-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-DAG: Handled other.swift // CHECK-SECOND-DAG: Handled main.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/one-way-provides-after-fine/* %t // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-provides-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // RUN: touch -t 201401240008 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-NOT: Handled other.swift // CHECK-THIRD: Handled main.swift diff --git a/test/Driver/Dependencies/one-way-provides-before-fine.swift b/test/Driver/Dependencies/one-way-provides-before-fine.swift index f4d0179301d0c..5f00a4e3d26f6 100644 --- a/test/Driver/Dependencies/one-way-provides-before-fine.swift +++ b/test/Driver/Dependencies/one-way-provides-before-fine.swift @@ -6,24 +6,24 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-provides-before-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: Handled main.swift // CHECK-SECOND: Handled other.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-NOT: Handled main.swift // CHECK-THIRD: Handled other.swift @@ -34,18 +34,18 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-provides-before-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift diff --git a/test/Driver/Dependencies/one-way-while-editing-fine.swift b/test/Driver/Dependencies/one-way-while-editing-fine.swift index 195a7ffa046fb..e2be06aa56fa7 100644 --- a/test/Driver/Dependencies/one-way-while-editing-fine.swift +++ b/test/Driver/Dependencies/one-way-while-editing-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/modify-non-primary-files.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/modify-non-primary-files.py" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s // CHECK: Handled main.swift // CHECK: Handled other.swift @@ -12,14 +12,14 @@ // CHECK: error: input file 'other.swift' was modified during the build // CHECK-NOT: error -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-RECOVER %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-RECOVER %s // CHECK-RECOVER: Handled main.swift // CHECK-RECOVER: Handled other.swift // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/modify-non-primary-files.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REVERSED %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/modify-non-primary-files.py" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REVERSED %s // CHECK-REVERSED: Handled other.swift // CHECK-REVERSED: Handled main.swift @@ -27,7 +27,7 @@ // CHECK-REVERSED: error: input file 'main.swift' was modified during the build // CHECK-REVERSED-NOT: error -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REVERSED-RECOVER %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REVERSED-RECOVER %s // CHECK-REVERSED-RECOVER-NOT: Handled other.swift // CHECK-REVERSED-RECOVER: Handled main.swift diff --git a/test/Driver/Dependencies/only-skip-once.swift b/test/Driver/Dependencies/only-skip-once.swift index f3b590549cc97..548155b9e32bb 100644 --- a/test/Driver/Dependencies/only-skip-once.swift +++ b/test/Driver/Dependencies/only-skip-once.swift @@ -1,10 +1,10 @@ -// XFAIL: linux +// XFAIL: linux, openbsd // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/only-skip-once/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %target-swiftc_driver -driver-show-job-lifecycle -output-file-map %t/output-file-map.json -incremental main.swift file1.swift file2.swift -j1 2>%t/stderr.txt | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %target-swiftc_driver -driver-show-job-lifecycle -output-file-map %t/output-file-map.json -incremental -disable-direct-intramodule-dependencies main.swift file1.swift file2.swift -j1 2>%t/stderr.txt | %FileCheck -check-prefix=CHECK-INITIAL %s // CHECK-INITIAL: Job finished: {compile: main.o <= main.swift} // CHECK-INITIAL: Job finished: {compile: file1.o <= file1.swift} @@ -12,7 +12,7 @@ // CHECK-INITIAL: Job finished: {link: main <= main.o file1.o file2.o} // RUN: touch -t 201401240006 %t/file2.swift -// RUN: cd %t && %target-swiftc_driver -driver-show-job-lifecycle -output-file-map %t/output-file-map.json -incremental main.swift file1.swift file2.swift -j1 2>%t/stderr.txt | %FileCheck -check-prefix=CHECK-REBUILD %s +// RUN: cd %t && %target-swiftc_driver -driver-show-job-lifecycle -output-file-map %t/output-file-map.json -incremental -disable-direct-intramodule-dependencies main.swift file1.swift file2.swift -j1 2>%t/stderr.txt | %FileCheck -check-prefix=CHECK-REBUILD %s // We should skip the main and file1 rebuilds here, but we should only note skipping them _once_ // CHECK-REBUILD: Job finished: {compile: file2.o <= file2.swift} diff --git a/test/Driver/Dependencies/private-after-fine.swift b/test/Driver/Dependencies/private-after-fine.swift index d37b887c2a4e7..1b85933b1112d 100644 --- a/test/Driver/Dependencies/private-after-fine.swift +++ b/test/Driver/Dependencies/private-after-fine.swift @@ -6,18 +6,18 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/private-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s // CHECK-INITIAL-NOT: warning // CHECK-INITIAL-NOT: Handled // RUN: touch -t 201401240006 %t/a.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v > %t/a.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v > %t/a.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-A %s < %t/a.txt // RUN: %FileCheck -check-prefix=CHECK-A-NEG %s < %t/a.txt @@ -35,13 +35,13 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/private-after-fine/*.swiftdeps %t // RUN: touch -t 201401240006 %t/f.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v > %t/f.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v > %t/f.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-F %s < %t/f.txt // RUN: %FileCheck -check-prefix=CHECK-F-NEG %s < %t/f.txt diff --git a/test/Driver/Dependencies/private-fine.swift b/test/Driver/Dependencies/private-fine.swift index 3dc48f6816633..3ed93c79568b2 100644 --- a/test/Driver/Dependencies/private-fine.swift +++ b/test/Driver/Dependencies/private-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/private-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s // CHECK-INITIAL-NOT: warning // CHECK-INITIAL: Handled a.swift @@ -14,7 +14,7 @@ // CHECK-INITIAL: Handled e.swift // RUN: touch -t 201401240006 %t/a.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/a.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/a.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-A %s < %t/a.txt // RUN: %FileCheck -check-prefix=CHECK-A-NEG %s < %t/a.txt @@ -25,7 +25,7 @@ // CHECK-A-NEG-NOT: Handled e.swift // RUN: touch -t 201401240006 %t/b.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/b.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/b.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-B %s < %t/b.txt // RUN: %FileCheck -check-prefix=CHECK-B-NEG %s < %t/b.txt @@ -36,7 +36,7 @@ // CHECK-B-NEG-NOT: Handled e.swift // RUN: touch -t 201401240006 %t/c.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/c.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/c.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-C %s < %t/c.txt // RUN: %FileCheck -check-prefix=CHECK-C-NEG %s < %t/c.txt @@ -47,7 +47,7 @@ // CHECK-C-NEG-NOT: Handled e.swift // RUN: touch -t 201401240006 %t/d.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/d.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/d.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-D %s < %t/d.txt // RUN: %FileCheck -check-prefix=CHECK-D-NEG %s < %t/d.txt @@ -58,7 +58,7 @@ // CHECK-D-NEG-NOT: Handled e.swift // RUN: touch -t 201401240006 %t/e.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/e.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/e.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-E %s < %t/e.txt // RUN: %FileCheck -check-prefix=CHECK-E-NEG %s < %t/e.txt @@ -75,7 +75,7 @@ // CHECK-E-NEG-NOT: Handled b.swift // RUN: touch -t 201401240007 %t/a.swift %t/e.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/ae.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/ae.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-AE %s < %t/ae.txt // RUN: %FileCheck -check-prefix=CHECK-AE-NEG %s < %t/ae.txt diff --git a/test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/main.swift b/test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/main.swift deleted file mode 100644 index ac74ce9e2fd9a..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -provides-dynamic-lookup: [z] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/other.swift b/test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/output.json b/test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/output.json deleted file mode 100644 index 78134f1ab01d1..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "./yet-another.swift": { - "object": "./yet-another.o", - "swift-dependencies": "./yet-another.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/yet-another.swift b/test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/yet-another.swift deleted file mode 100644 index 635c9d672b8de..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/yet-another.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-dynamic-lookup: [z] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-after-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-after-fine/main.swiftdeps index ab68f2a75146f..c00e208418ef2 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/chained-after-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/chained-after-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/chained-after-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-after-fine/other.swiftdeps index fdebaf57ebfb4..536f71123e364 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/chained-after-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/chained-after-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/chained-after-fine/yet-another.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-after-fine/yet-another.swiftdeps index 463b4dfae1c71..becd8c3d80bce 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/chained-after-fine/yet-another.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/chained-after-fine/yet-another.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/chained-after/main.swift b/test/Driver/PrivateDependencies/Inputs/chained-after/main.swift deleted file mode 100644 index e0e8f251340b0..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-after/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -provides-nominal: [z] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-after/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-after/main.swiftdeps deleted file mode 100644 index af39a9cad8a70..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-after/main.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-after/other.swift b/test/Driver/PrivateDependencies/Inputs/chained-after/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-after/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-after/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-after/other.swiftdeps deleted file mode 100644 index 37adc17c77e7c..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-after/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-after/output.json b/test/Driver/PrivateDependencies/Inputs/chained-after/output.json deleted file mode 100644 index 78134f1ab01d1..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-after/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "./yet-another.swift": { - "object": "./yet-another.o", - "swift-dependencies": "./yet-another.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/chained-after/yet-another.swift b/test/Driver/PrivateDependencies/Inputs/chained-after/yet-another.swift deleted file mode 100644 index 16c64afc2b66a..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-after/yet-another.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-nominal: [z] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-after/yet-another.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-after/yet-another.swiftdeps deleted file mode 100644 index b52ded789ba00..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-after/yet-another.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-nominal: [z] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-fine/main.swiftdeps index 6269b88840fbf..b0069fd19351e 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/chained-private-after-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/chained-private-after-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-fine/other.swiftdeps index fdebaf57ebfb4..536f71123e364 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/chained-private-after-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/chained-private-after-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-fine/yet-another.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-fine/yet-another.swiftdeps index 6c6e6bd8f844a..a9ff90ae9f81a 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/chained-private-after-fine/yet-another.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/chained-private-after-fine/yet-another.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-fine/main.swiftdeps index 90cb9c17cc4b0..5ceab5eb5fda5 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-fine/other.swiftdeps index fdebaf57ebfb4..536f71123e364 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-fine/yet-another.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-fine/yet-another.swiftdeps index 045438f5550d6..f49792b949a85 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-fine/yet-another.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-fine/yet-another.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members-fine/main.swiftdeps index ad8a56b02c2e3..b43c0bf3f82f1 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members-fine/other.swiftdeps index ee50c4b42ca6f..89cfe736b46e3 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members-fine/yet-another.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members-fine/yet-another.swiftdeps index c279ebaf043ab..fd1bac5a8aeb1 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members-fine/yet-another.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members-fine/yet-another.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/main.swift b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/main.swift deleted file mode 100644 index 41c4459572e7d..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/main.swift +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies after compilation: -depends-nominal: [x, a, z] -depends-member: [[x, x], [a, a], [z, z]] -provides-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/main.swiftdeps deleted file mode 100644 index daf4f75424422..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/main.swiftdeps +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies before compilation: -depends-nominal: [x, a] -depends-member: [[x, x], !private [a, a]] -provides-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/other.swift b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/other.swift deleted file mode 100644 index 417f71c53c111..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-member: [[a, a]] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/other.swiftdeps deleted file mode 100644 index 8920d930bbc99..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-member: [[a, a]] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/output.json b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/output.json deleted file mode 100644 index 78134f1ab01d1..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "./yet-another.swift": { - "object": "./yet-another.o", - "swift-dependencies": "./yet-another.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swift b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swift deleted file mode 100644 index f4d83dcc59888..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swiftdeps deleted file mode 100644 index 813bf188859ef..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/main.swift b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/main.swift deleted file mode 100644 index 63f1b24bea3d6..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [x, a, z] -provides-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/main.swiftdeps deleted file mode 100644 index 698632a11e988..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/main.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [x, !private a] -provides-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/other.swift b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/other.swiftdeps deleted file mode 100644 index 37adc17c77e7c..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/output.json b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/output.json deleted file mode 100644 index 78134f1ab01d1..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "./yet-another.swift": { - "object": "./yet-another.o", - "swift-dependencies": "./yet-another.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/yet-another.swift b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/yet-another.swift deleted file mode 100644 index f4d83dcc59888..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/yet-another.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/yet-another.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/yet-another.swiftdeps deleted file mode 100644 index 813bf188859ef..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/yet-another.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after/main.swift b/test/Driver/PrivateDependencies/Inputs/chained-private-after/main.swift deleted file mode 100644 index f1fd5b5cac497..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -provides-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after/main.swiftdeps deleted file mode 100644 index 90ea1c0103992..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after/main.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [!private a] -provides-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after/other.swift b/test/Driver/PrivateDependencies/Inputs/chained-private-after/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after/other.swiftdeps deleted file mode 100644 index 37adc17c77e7c..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after/output.json b/test/Driver/PrivateDependencies/Inputs/chained-private-after/output.json deleted file mode 100644 index 78134f1ab01d1..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "./yet-another.swift": { - "object": "./yet-another.o", - "swift-dependencies": "./yet-another.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after/yet-another.swift b/test/Driver/PrivateDependencies/Inputs/chained-private-after/yet-another.swift deleted file mode 100644 index f4d83dcc59888..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after/yet-another.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private-after/yet-another.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-private-after/yet-another.swiftdeps deleted file mode 100644 index 813bf188859ef..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private-after/yet-another.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private/main.swift b/test/Driver/PrivateDependencies/Inputs/chained-private/main.swift deleted file mode 100644 index 840f6e6236ae0..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [!private a] -provides-nominal: [z] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private/other.swift b/test/Driver/PrivateDependencies/Inputs/chained-private/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private/output.json b/test/Driver/PrivateDependencies/Inputs/chained-private/output.json deleted file mode 100644 index 78134f1ab01d1..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "./yet-another.swift": { - "object": "./yet-another.o", - "swift-dependencies": "./yet-another.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/chained-private/yet-another.swift b/test/Driver/PrivateDependencies/Inputs/chained-private/yet-another.swift deleted file mode 100644 index 16c64afc2b66a..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/chained-private/yet-another.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-nominal: [z] diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps-fine/crash.swiftdeps b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps-fine/crash.swiftdeps index bf9965ea5ef76..61bb881eb1106 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps-fine/crash.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps-fine/crash.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps-fine/main.swiftdeps index f8db87488755d..90c08952efcd8 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps-fine/other.swiftdeps index 08e363ec1de1a..9f9f8bff887d6 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/crash.swift b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/crash.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/crash.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/crash.swiftdeps b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/crash.swiftdeps deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/main.swift b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/main.swiftdeps deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/other.swift b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/other.swift deleted file mode 100644 index 33392ce138612..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [!private a] diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/other.swiftdeps deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/output.json b/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/output.json deleted file mode 100644 index 55ef51f19bb04..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./crash.swift": { - "object": "./crash.o", - "swift-dependencies": "./crash.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple/crash.swift b/test/Driver/PrivateDependencies/Inputs/crash-simple/crash.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/crash-simple/crash.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple/main.swift b/test/Driver/PrivateDependencies/Inputs/crash-simple/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/crash-simple/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple/other.swift b/test/Driver/PrivateDependencies/Inputs/crash-simple/other.swift deleted file mode 100644 index 33392ce138612..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/crash-simple/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [!private a] diff --git a/test/Driver/PrivateDependencies/Inputs/crash-simple/output.json b/test/Driver/PrivateDependencies/Inputs/crash-simple/output.json deleted file mode 100644 index 55ef51f19bb04..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/crash-simple/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./crash.swift": { - "object": "./crash.o", - "swift-dependencies": "./crash.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/fail-chained/a.swift b/test/Driver/PrivateDependencies/Inputs/fail-chained/a.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-chained/a.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/fail-chained/b.swift b/test/Driver/PrivateDependencies/Inputs/fail-chained/b.swift deleted file mode 100644 index d59fcfe0b442f..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-chained/b.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/fail-chained/bad.swift b/test/Driver/PrivateDependencies/Inputs/fail-chained/bad.swift deleted file mode 100644 index c0840ce567be8..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-chained/bad.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [bad] -depends-top-level: [a, !private b] diff --git a/test/Driver/PrivateDependencies/Inputs/fail-chained/c.swift b/test/Driver/PrivateDependencies/Inputs/fail-chained/c.swift deleted file mode 100644 index d12cec6b055d9..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-chained/c.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [c] -depends-top-level: [bad] diff --git a/test/Driver/PrivateDependencies/Inputs/fail-chained/d.swift b/test/Driver/PrivateDependencies/Inputs/fail-chained/d.swift deleted file mode 100644 index b91fec7759267..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-chained/d.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [d] -depends-top-level: [c] diff --git a/test/Driver/PrivateDependencies/Inputs/fail-chained/e.swift b/test/Driver/PrivateDependencies/Inputs/fail-chained/e.swift deleted file mode 100644 index c0214cc14725b..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-chained/e.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [e] -depends-top-level: [!private bad] diff --git a/test/Driver/PrivateDependencies/Inputs/fail-chained/f.swift b/test/Driver/PrivateDependencies/Inputs/fail-chained/f.swift deleted file mode 100644 index 661c5e0cf4558..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-chained/f.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [f] -depends-top-level: [e] diff --git a/test/Driver/PrivateDependencies/Inputs/fail-chained/output.json b/test/Driver/PrivateDependencies/Inputs/fail-chained/output.json deleted file mode 100644 index 438752aa2616a..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-chained/output.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "./a.swift": { - "object": "./a.o", - "swift-dependencies": "./a.swiftdeps" - }, - "./b.swift": { - "object": "./b.o", - "swift-dependencies": "./b.swiftdeps" - }, - "./c.swift": { - "object": "./c.o", - "swift-dependencies": "./c.swiftdeps" - }, - "./d.swift": { - "object": "./d.o", - "swift-dependencies": "./d.swiftdeps" - }, - "./e.swift": { - "object": "./e.o", - "swift-dependencies": "./e.swiftdeps" - }, - "./f.swift": { - "object": "./f.o", - "swift-dependencies": "./f.swiftdeps" - }, - "./bad.swift": { - "object": "./bad.o", - "swift-dependencies": "./bad.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/bad.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/bad.swiftdeps index 527f7825b3eaf..36923733d1d0f 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/bad.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/bad.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/depends-on-bad.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/depends-on-bad.swiftdeps index 7a6124707d076..e44dcd06e5153 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/depends-on-bad.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/depends-on-bad.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/depends-on-main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/depends-on-main.swiftdeps index f5ff3de10eb27..8a8b4845d6453 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/depends-on-main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/depends-on-main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/main.swiftdeps index 43ededaf30de4..dad602b6f208f 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/bad.swift b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/bad.swift deleted file mode 100644 index 1da95ae66e8d4..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/bad.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [bad] -interface-hash: "after" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/bad.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/bad.swiftdeps deleted file mode 100644 index 923f6689ba1a5..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/bad.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [bad] -interface-hash: "before" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-bad.swift b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-bad.swift deleted file mode 100644 index 415ec3b051000..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-bad.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [bad] -interface-hash: "after" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-bad.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-bad.swiftdeps deleted file mode 100644 index 97afde93b75ca..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-bad.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [bad] -interface-hash: "before" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-main.swift b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-main.swift deleted file mode 100644 index 2b781b861cb7e..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [main] -interface-hash: "after" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-main.swiftdeps deleted file mode 100644 index cd50d25b878a7..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-main.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [main] -interface-hash: "before" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/main.swift b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/main.swift deleted file mode 100644 index 5b5f8d7f3346f..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [main] -interface-hash: "after" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/main.swiftdeps deleted file mode 100644 index 0ec59e418937a..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/main.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [main] -interface-hash: "before" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/output.json b/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/output.json deleted file mode 100644 index 981629c77c49e..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-interface-hash/output.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./bad.swift": { - "object": "./bad.o", - "swift-dependencies": "./bad.swiftdeps" - }, - "./depends-on-main.swift": { - "object": "./depends-on-main.o", - "swift-dependencies": "./depends-on-main.swiftdeps" - }, - "./depends-on-bad.swift": { - "object": "./depends-on-bad.o", - "swift-dependencies": "./depends-on-bad.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/fail-simple/bad.swift b/test/Driver/PrivateDependencies/Inputs/fail-simple/bad.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-simple/bad.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/fail-simple/main.swift b/test/Driver/PrivateDependencies/Inputs/fail-simple/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-simple/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/fail-simple/other.swift b/test/Driver/PrivateDependencies/Inputs/fail-simple/other.swift deleted file mode 100644 index 33392ce138612..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-simple/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [!private a] diff --git a/test/Driver/PrivateDependencies/Inputs/fail-simple/output.json b/test/Driver/PrivateDependencies/Inputs/fail-simple/output.json deleted file mode 100644 index 32ad1dd72d6f7..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-simple/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./bad.swift": { - "object": "./bad.o", - "swift-dependencies": "./bad.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/bad.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/bad.swiftdeps index d9a1141f39ea6..e0e7e8c8d0002 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/bad.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/bad.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/depends-on-bad.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/depends-on-bad.swiftdeps index ff755423fc661..277862cfd4eeb 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/depends-on-bad.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/depends-on-bad.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/depends-on-main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/depends-on-main.swiftdeps index 427c0381ec65f..78cf6d4581114 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/depends-on-main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/depends-on-main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/main.swiftdeps index 5844ed2c32e39..898b323f45903 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/bad.swift b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/bad.swift deleted file mode 100644 index 0f05e70d14710..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/bad.swift +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [bad] -interface-hash: "after" -garbage: "" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/bad.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/bad.swiftdeps deleted file mode 100644 index 923f6689ba1a5..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/bad.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [bad] -interface-hash: "before" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-bad.swift b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-bad.swift deleted file mode 100644 index 415ec3b051000..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-bad.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [bad] -interface-hash: "after" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-bad.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-bad.swiftdeps deleted file mode 100644 index 97afde93b75ca..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-bad.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [bad] -interface-hash: "before" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-main.swift b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-main.swift deleted file mode 100644 index 2b781b861cb7e..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [main] -interface-hash: "after" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-main.swiftdeps deleted file mode 100644 index cd50d25b878a7..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-main.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [main] -interface-hash: "before" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/main.swift b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/main.swift deleted file mode 100644 index 5b5f8d7f3346f..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [main] -interface-hash: "after" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/main.swiftdeps deleted file mode 100644 index 0ec59e418937a..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/main.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [main] -interface-hash: "before" diff --git a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/output.json b/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/output.json deleted file mode 100644 index 981629c77c49e..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/output.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./bad.swift": { - "object": "./bad.o", - "swift-dependencies": "./bad.swiftdeps" - }, - "./depends-on-main.swift": { - "object": "./depends-on-main.o", - "swift-dependencies": "./depends-on-main.swiftdeps" - }, - "./depends-on-bad.swift": { - "object": "./depends-on-bad.o", - "swift-dependencies": "./depends-on-bad.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/independent/main.swift b/test/Driver/PrivateDependencies/Inputs/independent/main.swift deleted file mode 100644 index 133c84747fcc7..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/independent/main.swift +++ /dev/null @@ -1 +0,0 @@ -# Dependencies after compilation: none diff --git a/test/Driver/PrivateDependencies/Inputs/independent/other.swift b/test/Driver/PrivateDependencies/Inputs/independent/other.swift deleted file mode 100644 index 133c84747fcc7..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/independent/other.swift +++ /dev/null @@ -1 +0,0 @@ -# Dependencies after compilation: none diff --git a/test/Driver/PrivateDependencies/Inputs/independent/output.json b/test/Driver/PrivateDependencies/Inputs/independent/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/independent/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-after-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/malformed-after-fine/main.swiftdeps index a9561fcf725d2..db076f86e69f6 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/malformed-after-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/malformed-after-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-after-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/malformed-after-fine/other.swiftdeps index 3d9348aa25859..b8f5d8f2999a3 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/malformed-after-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/malformed-after-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-after/main.swift b/test/Driver/PrivateDependencies/Inputs/malformed-after/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/malformed-after/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-after/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/malformed-after/main.swiftdeps deleted file mode 100644 index af39a9cad8a70..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/malformed-after/main.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-after/other.swift b/test/Driver/PrivateDependencies/Inputs/malformed-after/other.swift deleted file mode 100644 index d8b260499b5cf..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/malformed-after/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -*** This is not a valid YAML file *** diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-after/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/malformed-after/other.swiftdeps deleted file mode 100644 index 671d72a260df8..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/malformed-after/other.swiftdeps +++ /dev/null @@ -1 +0,0 @@ -# Dependencies before compilation: diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-after/output.json b/test/Driver/PrivateDependencies/Inputs/malformed-after/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/malformed-after/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml-fine/main.swiftdeps index a9561fcf725d2..db076f86e69f6 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml-fine/other.swiftdeps index 3d9348aa25859..b8f5d8f2999a3 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/main.swift b/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/main.swiftdeps deleted file mode 100644 index af39a9cad8a70..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/main.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/other.swift b/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/other.swift deleted file mode 100644 index f9c364551ec7b..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -bogus-entry: [] diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/other.swiftdeps deleted file mode 100644 index 671d72a260df8..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/other.swiftdeps +++ /dev/null @@ -1 +0,0 @@ -# Dependencies before compilation: diff --git a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/output.json b/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash-fine/does-change.swiftdeps b/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash-fine/does-change.swiftdeps index c3f3e8151be88..c40809bb79d82 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash-fine/does-change.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash-fine/does-change.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash-fine/does-not-change.swiftdeps b/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash-fine/does-not-change.swiftdeps index 5dc734cb0e000..d62a86322d3a5 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash-fine/does-not-change.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash-fine/does-not-change.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-change.swift b/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-change.swift deleted file mode 100644 index f17cf50119019..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-change.swift +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -provides-top-level: [b] -interface-hash: "after" diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-change.swiftdeps b/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-change.swiftdeps deleted file mode 100644 index c03cc687534c2..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-change.swiftdeps +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] -provides-top-level: [b] -interface-hash: "before" diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-not-change.swift b/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-not-change.swift deleted file mode 100644 index c585e8096db3e..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-not-change.swift +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [b] -provides-top-level: [a] -interface-hash: "same" diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-not-change.swiftdeps b/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-not-change.swiftdeps deleted file mode 100644 index c585e8096db3e..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-not-change.swiftdeps +++ /dev/null @@ -1,4 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [b] -provides-top-level: [a] -interface-hash: "same" diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/output.json b/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/output.json deleted file mode 100644 index dfbb111fcdce4..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./does-change.swift": { - "object": "./does-change.o", - "swift-dependencies": "./does-change.swiftdeps" - }, - "./does-not-change.swift": { - "object": "./does-not-change.o", - "swift-dependencies": "./does-not-change.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps-fine/main.swiftdeps index 0c0a447001ba3..75a007a0e5764 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps-fine/other.swiftdeps index fedd90b310a49..3674d778d4983 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/main.swift b/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/main.swift deleted file mode 100644 index 98f98ba6ec681..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -provides-top-level: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/main.swiftdeps deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/other.swift b/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/other.swift deleted file mode 100644 index b6e0280958d77..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/other.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [b] -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/other.swiftdeps deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/output.json b/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/mutual/main.swift b/test/Driver/PrivateDependencies/Inputs/mutual/main.swift deleted file mode 100644 index 98f98ba6ec681..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/mutual/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -provides-top-level: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/mutual/other.swift b/test/Driver/PrivateDependencies/Inputs/mutual/other.swift deleted file mode 100644 index b6e0280958d77..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/mutual/other.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [b] -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/mutual/output.json b/test/Driver/PrivateDependencies/Inputs/mutual/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/mutual/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/nominal-members/a-ext.swift b/test/Driver/PrivateDependencies/Inputs/nominal-members/a-ext.swift deleted file mode 100644 index d6babbe4fa788..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/nominal-members/a-ext.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-member: [[a, "ext"]] diff --git a/test/Driver/PrivateDependencies/Inputs/nominal-members/a.swift b/test/Driver/PrivateDependencies/Inputs/nominal-members/a.swift deleted file mode 100644 index 6ee4213e33e98..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/nominal-members/a.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [a] -provides-member: [[a, ""]] diff --git a/test/Driver/PrivateDependencies/Inputs/nominal-members/depends-on-a-ext.swift b/test/Driver/PrivateDependencies/Inputs/nominal-members/depends-on-a-ext.swift deleted file mode 100644 index fb570816a6a11..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/nominal-members/depends-on-a-ext.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-member: [[a, "ext"], [a, ""]] -depends-nominal: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/nominal-members/depends-on-a-foo.swift b/test/Driver/PrivateDependencies/Inputs/nominal-members/depends-on-a-foo.swift deleted file mode 100644 index 5455f16e4e9a2..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/nominal-members/depends-on-a-foo.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-member: [[a, "foo"], [a, ""]] -depends-nominal: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/nominal-members/output.json b/test/Driver/PrivateDependencies/Inputs/nominal-members/output.json deleted file mode 100644 index d4d6d49c54405..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/nominal-members/output.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "./a.swift": { - "object": "./a.o", - "swift-dependencies": "./a.swiftdeps" - }, - "./a-ext.swift": { - "object": "./a-ext.o", - "swift-dependencies": "./a-ext.swiftdeps" - }, - "./depends-on-a-ext.swift": { - "object": "./depends-on-a-ext.o", - "swift-dependencies": "./depends-on-a-ext.swiftdeps" - }, - "./depends-on-a-foo.swift": { - "object": "./depends-on-a-foo.o", - "swift-dependencies": "./depends-on-a-foo.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-depends-after-fine/main.swiftdeps index 9183a8ba33282..0fbef28af95e2 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/one-way-depends-after-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-depends-after-fine/other.swiftdeps index b0a83b5a9b5be..c49bc07e3e6eb 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/one-way-depends-after-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/main.swift b/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/main.swiftdeps deleted file mode 100644 index 671d72a260df8..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/main.swiftdeps +++ /dev/null @@ -1 +0,0 @@ -# Dependencies before compilation: diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/other.swift b/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/other.swiftdeps deleted file mode 100644 index 37adc17c77e7c..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/output.json b/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-depends-after/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-depends-before-fine/main.swiftdeps index b21ca1bfe8e11..e64b80c08a116 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/one-way-depends-before-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-depends-before-fine/other.swiftdeps index b0a83b5a9b5be..c49bc07e3e6eb 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/one-way-depends-before-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/main.swift b/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/main.swift deleted file mode 100644 index d281641607776..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/main.swift +++ /dev/null @@ -1 +0,0 @@ -# Dependencies after compilation: diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/main.swiftdeps deleted file mode 100644 index af39a9cad8a70..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/main.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/other.swift b/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/other.swiftdeps deleted file mode 100644 index 37adc17c77e7c..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/output.json b/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-depends-before/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-external/main.swift b/test/Driver/PrivateDependencies/Inputs/one-way-external/main.swift deleted file mode 100644 index de7b922b068b8..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-external/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] -depends-external: ["./main1-external", "./main2-external"] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-external/main1-external b/test/Driver/PrivateDependencies/Inputs/one-way-external/main1-external deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-external/main2-external b/test/Driver/PrivateDependencies/Inputs/one-way-external/main2-external deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-external/other.swift b/test/Driver/PrivateDependencies/Inputs/one-way-external/other.swift deleted file mode 100644 index fd31229634def..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-external/other.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] -depends-external: ["./other1-external", "./other2-external"] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-external/other1-external b/test/Driver/PrivateDependencies/Inputs/one-way-external/other1-external deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-external/other2-external b/test/Driver/PrivateDependencies/Inputs/one-way-external/other2-external deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-external/output.json b/test/Driver/PrivateDependencies/Inputs/one-way-external/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-external/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-provides-after-fine/main.swiftdeps index 2f22faafc626f..dad97a138822e 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/one-way-provides-after-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-provides-after-fine/other.swiftdeps index 4e4cfd71a465a..b8f5d8f2999a3 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/one-way-provides-after-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/main.swift b/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/main.swiftdeps deleted file mode 100644 index af39a9cad8a70..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/main.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/other.swift b/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/other.swiftdeps deleted file mode 100644 index 671d72a260df8..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/other.swiftdeps +++ /dev/null @@ -1 +0,0 @@ -# Dependencies before compilation: diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/output.json b/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-provides-after/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-provides-before-fine/main.swiftdeps index 2f22faafc626f..dad97a138822e 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/one-way-provides-before-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-provides-before-fine/other.swiftdeps index b3fe2d3a5af0f..d1135f16bf7ca 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/one-way-provides-before-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/main.swift b/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/main.swiftdeps deleted file mode 100644 index af39a9cad8a70..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/main.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/other.swift b/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/other.swift deleted file mode 100644 index 133c84747fcc7..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/other.swift +++ /dev/null @@ -1 +0,0 @@ -# Dependencies after compilation: none diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/other.swiftdeps deleted file mode 100644 index 37adc17c77e7c..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/other.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/output.json b/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/output.json deleted file mode 100644 index f847af2da52ff..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-provides-before/output.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps" - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps-fine/main.swiftdeps index f5b2d6b0dd35c..4553fd0ac029f 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps-fine/main.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps-fine/main.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps-fine/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps-fine/other.swiftdeps index bacf9fc59d6bd..297c9086c5ee0 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps-fine/other.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps-fine/other.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/main.swift b/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/main.swift deleted file mode 100644 index c6dd8d475b207..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -depends-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/main.swiftdeps deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/other.swift b/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/other.swift deleted file mode 100644 index 7e7daa298c540..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/other.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-top-level: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/other.swiftdeps b/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/other.swiftdeps deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/output.json b/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/output.json deleted file mode 100644 index f2eb4d2dddbeb..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/output.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "./main.swift": { - "object": "./main.o", - "swift-dependencies": "./main.swiftdeps", - "swiftmodule": "./main.swiftmodule", - "swiftdoc": "./main.swiftdoc", - }, - "./other.swift": { - "object": "./other.o", - "swift-dependencies": "./other.swiftdeps", - "swiftmodule": "./main.swiftmodule", - "swiftdoc": "./main.swiftdoc", - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/private-after-fine/a.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after-fine/a.swiftdeps index 9d80d172a2de4..9485d93775e8d 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/private-after-fine/a.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/private-after-fine/a.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/private-after-fine/b.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after-fine/b.swiftdeps index c256595b686c8..ed217d51bb8d0 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/private-after-fine/b.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/private-after-fine/b.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/private-after-fine/c.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after-fine/c.swiftdeps index 7aec07e89f1a4..b0bbb481d8f2f 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/private-after-fine/c.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/private-after-fine/c.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/private-after-fine/d.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after-fine/d.swiftdeps index 93de7a407514b..7866ec7f6385b 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/private-after-fine/d.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/private-after-fine/d.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/private-after-fine/e.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after-fine/e.swiftdeps index 9208ef0fb1be2..9caab3f2aac33 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/private-after-fine/e.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/private-after-fine/e.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/private-after-fine/f.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after-fine/f.swiftdeps index 993aae48b3a01..24bed2a42a7fa 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/private-after-fine/f.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/private-after-fine/f.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/private-after-fine/g.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after-fine/g.swiftdeps index cea259c341645..f6402b515dafd 100644 Binary files a/test/Driver/PrivateDependencies/Inputs/private-after-fine/g.swiftdeps and b/test/Driver/PrivateDependencies/Inputs/private-after-fine/g.swiftdeps differ diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/a.swift b/test/Driver/PrivateDependencies/Inputs/private-after/a.swift deleted file mode 100644 index 76fb34c551d66..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/a.swift +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/a.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after/a.swiftdeps deleted file mode 100644 index bdaa467ec3944..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/a.swiftdeps +++ /dev/null @@ -1,2 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/b.swift b/test/Driver/PrivateDependencies/Inputs/private-after/b.swift deleted file mode 100644 index c1c455e32fbc9..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/b.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [b] -depends-nominal: [!private a, e] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/b.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after/b.swiftdeps deleted file mode 100644 index af1427f6a149a..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/b.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [b] -depends-nominal: [!private a, e] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/c.swift b/test/Driver/PrivateDependencies/Inputs/private-after/c.swift deleted file mode 100644 index b5a1c6a68b3da..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/c.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [c] -depends-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/c.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after/c.swiftdeps deleted file mode 100644 index 2a25e2c419b0a..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/c.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [c] -depends-nominal: [b] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/d.swift b/test/Driver/PrivateDependencies/Inputs/private-after/d.swift deleted file mode 100644 index 2fbb8a2590de2..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/d.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [d] -depends-nominal: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/d.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after/d.swiftdeps deleted file mode 100644 index 2928bc43a566f..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/d.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [] -depends-nominal: [a] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/e.swift b/test/Driver/PrivateDependencies/Inputs/private-after/e.swift deleted file mode 100644 index 452c171d41792..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/e.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [e] -depends-nominal: [d] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/e.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after/e.swiftdeps deleted file mode 100644 index def0f31b858c0..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/e.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [] -depends-nominal: [d] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/f.swift b/test/Driver/PrivateDependencies/Inputs/private-after/f.swift deleted file mode 100644 index 25d3cd0b35243..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/f.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [f] -depends-nominal: [!private e] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/f.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after/f.swiftdeps deleted file mode 100644 index 6021e8d68af3d..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/f.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [f] -depends-nominal: [!private e] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/g.swift b/test/Driver/PrivateDependencies/Inputs/private-after/g.swift deleted file mode 100644 index 41e5867827600..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/g.swift +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies after compilation: -provides-nominal: [g] -depends-nominal: [f] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/g.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after/g.swiftdeps deleted file mode 100644 index ab44b478e1fba..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/g.swiftdeps +++ /dev/null @@ -1,3 +0,0 @@ -# Dependencies before compilation: -provides-nominal: [g] -depends-nominal: [f] diff --git a/test/Driver/PrivateDependencies/Inputs/private-after/output.json b/test/Driver/PrivateDependencies/Inputs/private-after/output.json deleted file mode 100644 index c15439d5780e4..0000000000000 --- a/test/Driver/PrivateDependencies/Inputs/private-after/output.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "./a.swift": { - "object": "./a.o", - "swift-dependencies": "./a.swiftdeps" - }, - "./b.swift": { - "object": "./b.o", - "swift-dependencies": "./b.swiftdeps" - }, - "./c.swift": { - "object": "./c.o", - "swift-dependencies": "./c.swiftdeps" - }, - "./d.swift": { - "object": "./d.o", - "swift-dependencies": "./d.swiftdeps" - }, - "./e.swift": { - "object": "./e.o", - "swift-dependencies": "./e.swiftdeps" - }, - "./f.swift": { - "object": "./f.o", - "swift-dependencies": "./f.swiftdeps" - }, - "./g.swift": { - "object": "./g.o", - "swift-dependencies": "./g.swiftdeps" - }, - "": { - "swift-dependencies": "./main~buildrecord.swiftdeps" - } -} diff --git a/test/Driver/PrivateDependencies/Inputs/update-dependencies-bad.py b/test/Driver/PrivateDependencies/Inputs/update-dependencies-bad.py index 97585bd4779bf..dd5463259410f 100755 --- a/test/Driver/PrivateDependencies/Inputs/update-dependencies-bad.py +++ b/test/Driver/PrivateDependencies/Inputs/update-dependencies-bad.py @@ -22,9 +22,10 @@ import os import shutil import signal +import subprocess import sys -assert sys.argv[1] == '-frontend' +assert sys.argv[2] == '-frontend' primaryFile = sys.argv[sys.argv.index('-primary-file') + 1] @@ -36,7 +37,14 @@ try: depsFile = sys.argv[sys.argv.index( '-emit-reference-dependencies-path') + 1] - shutil.copyfile(primaryFile, depsFile) + + returncode = subprocess.call([sys.argv[1], "--from-yaml", + "--input-filename=" + primaryFile, + "--output-filename=" + depsFile]) + # If the input is not valid YAML, just copy it over verbatim; + # we're testing a case where we produced a corrupted output file. + if returncode != 0: + shutil.copyfile(primaryFile, depsFile) except ValueError: pass diff --git a/test/Driver/PrivateDependencies/Inputs/update-dependencies.py b/test/Driver/PrivateDependencies/Inputs/update-dependencies.py index 5f29e0541ce1d..c366439e01358 100755 --- a/test/Driver/PrivateDependencies/Inputs/update-dependencies.py +++ b/test/Driver/PrivateDependencies/Inputs/update-dependencies.py @@ -31,9 +31,10 @@ import os import shutil +import subprocess import sys -assert sys.argv[1] == '-frontend' +assert sys.argv[2] == '-frontend' # NB: The bitcode options automatically specify a -primary-file, even in cases # where we do not wish to use a dependencies file in the test. @@ -43,8 +44,13 @@ depsFile = sys.argv[sys.argv.index( '-emit-reference-dependencies-path') + 1] - # Replace the dependencies file with the input file. - shutil.copyfile(primaryFile, depsFile) + returncode = subprocess.call([sys.argv[1], "--from-yaml", + "--input-filename=" + primaryFile, + "--output-filename=" + depsFile]) + if returncode != 0: + # If the input is not valid YAML, just copy it over verbatim; + # we're testing a case where we produced a corrupted output file. + shutil.copyfile(primaryFile, depsFile) else: primaryFile = None diff --git a/test/Driver/PrivateDependencies/bindings-build-record.swift b/test/Driver/PrivateDependencies/bindings-build-record.swift index 917e1af5b84b9..2db8a0f4164d8 100644 --- a/test/Driver/PrivateDependencies/bindings-build-record.swift +++ b/test/Driver/PrivateDependencies/bindings-build-record.swift @@ -3,7 +3,7 @@ // RUN: cp -r %S/Inputs/bindings-build-record/* %t // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -experimental-private-intransitive-dependencies -driver-show-incremental -output-file-map %t/output.json 2>&1 |%FileCheck %s -check-prefix=MUST-EXEC +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -enable-direct-intramodule-dependencies -driver-show-incremental -output-file-map %t/output.json 2>&1 |%FileCheck %s -check-prefix=MUST-EXEC // MUST-EXEC-NOT: warning // MUST-EXEC: inputs: ["./main.swift"], output: {object: "./main.o", swift-dependencies: "./main.swiftdeps"} @@ -12,7 +12,7 @@ // MUST-EXEC: Disabling incremental build: could not read build record // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0], "./yet-another.swift": [443865900, 0]}, build_time: [443865901, 0]}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -experimental-private-intransitive-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -enable-direct-intramodule-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC // NO-EXEC: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: check-dependencies // NO-EXEC: inputs: ["./other.swift"], output: {{[{].*[}]}}, condition: check-dependencies @@ -20,33 +20,33 @@ // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": !private [443865900, 0], "./yet-another.swift": !dirty [443865900, 0]}, build_time: [443865901, 0]}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -experimental-private-intransitive-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=BUILD-RECORD +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -enable-direct-intramodule-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=BUILD-RECORD // BUILD-RECORD: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: check-dependencies{{$}} // BUILD-RECORD: inputs: ["./other.swift"], output: {{[{].*[}]}}, condition: run-without-cascading{{$}} // BUILD-RECORD: inputs: ["./yet-another.swift"], output: {{[{].*[}]$}} -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift ./added.swift -incremental -experimental-private-intransitive-dependencies -output-file-map %t/output.json 2>&1 > %t/added.txt +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift ./added.swift -incremental -enable-direct-intramodule-dependencies -output-file-map %t/output.json 2>&1 > %t/added.txt // RUN: %FileCheck %s -check-prefix=BUILD-RECORD < %t/added.txt // RUN: %FileCheck %s -check-prefix=FILE-ADDED < %t/added.txt // FILE-ADDED: inputs: ["./added.swift"], output: {{[{].*[}]}}, condition: newly-added{{$}} // RUN: %{python} %S/Inputs/touch.py 443865960 %t/main.swift -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -experimental-private-intransitive-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=BUILD-RECORD-PLUS-CHANGE +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -enable-direct-intramodule-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=BUILD-RECORD-PLUS-CHANGE // BUILD-RECORD-PLUS-CHANGE: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: run-without-cascading // BUILD-RECORD-PLUS-CHANGE: inputs: ["./other.swift"], output: {{[{].*[}]}}, condition: run-without-cascading{{$}} // BUILD-RECORD-PLUS-CHANGE: inputs: ["./yet-another.swift"], output: {{[{].*[}]$}} // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift -incremental -experimental-private-intransitive-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=FILE-REMOVED +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift -incremental -enable-direct-intramodule-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=FILE-REMOVED // FILE-REMOVED: inputs: ["./main.swift"], output: {{[{].*[}]$}} // FILE-REMOVED: inputs: ["./other.swift"], output: {{[{].*[}]$}} // FILE-REMOVED-NOT: yet-another.swift // RUN: echo '{version: "bogus", inputs: {"./main.swift": [443865900, 0], "./other.swift": !private [443865900, 0], "./yet-another.swift": !dirty [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -experimental-private-intransitive-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=INVALID-RECORD +// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -enable-direct-intramodule-dependencies -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=INVALID-RECORD // INVALID-RECORD-NOT: warning // INVALID-RECORD: inputs: ["./main.swift"], output: {{[{].*[}]$}} diff --git a/test/Driver/PrivateDependencies/chained-additional-kinds-fine.swift b/test/Driver/PrivateDependencies/chained-additional-kinds-fine.swift index 02da13c88b0e7..bf93187d4207a 100644 --- a/test/Driver/PrivateDependencies/chained-additional-kinds-fine.swift +++ b/test/Driver/PrivateDependencies/chained-additional-kinds-fine.swift @@ -4,23 +4,23 @@ // RUN: cp -r %S/Inputs/chained-additional-kinds-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift // CHECK-FIRST: Handled yet-another.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled other.swift // CHECK-THIRD-DAG: Handled main.swift // CHECK-THIRD-DAG: Handled yet-another.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./other.swift ./main.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./other.swift ./main.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s diff --git a/test/Driver/PrivateDependencies/chained-after-fine.swift b/test/Driver/PrivateDependencies/chained-after-fine.swift index d99c9b8335432..6bbfaff140f18 100644 --- a/test/Driver/PrivateDependencies/chained-after-fine.swift +++ b/test/Driver/PrivateDependencies/chained-after-fine.swift @@ -6,17 +6,17 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/chained-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Handled main.swift // CHECK-THIRD: Handled other.swift diff --git a/test/Driver/PrivateDependencies/chained-fine.swift b/test/Driver/PrivateDependencies/chained-fine.swift index 74cce9d5593b1..08f75db2d475f 100644 --- a/test/Driver/PrivateDependencies/chained-fine.swift +++ b/test/Driver/PrivateDependencies/chained-fine.swift @@ -4,29 +4,29 @@ // RUN: cp -r %S/Inputs/chained-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift // CHECK-FIRST: Handled yet-another.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled other.swift // CHECK-THIRD-DAG: Handled main.swift // CHECK-THIRD-DAG: Handled yet-another.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./other.swift ./main.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./other.swift ./main.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // RUN: touch -t 201401240008 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./yet-another.swift ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./yet-another.swift ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // RUN: touch -t 201401240009 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./other.swift ./yet-another.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./other.swift ./yet-another.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s diff --git a/test/Driver/PrivateDependencies/chained-private-after-fine.swift b/test/Driver/PrivateDependencies/chained-private-after-fine.swift index d7a7d0e018d86..5e5a007abea23 100644 --- a/test/Driver/PrivateDependencies/chained-private-after-fine.swift +++ b/test/Driver/PrivateDependencies/chained-private-after-fine.swift @@ -6,17 +6,17 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/chained-private-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-DAG: Handled other.swift // CHECK-SECOND-DAG: Handled main.swift diff --git a/test/Driver/PrivateDependencies/chained-private-after-multiple-fine.swift b/test/Driver/PrivateDependencies/chained-private-after-multiple-fine.swift index 1cb65a96b4e0b..76fcb8f05b9e7 100644 --- a/test/Driver/PrivateDependencies/chained-private-after-multiple-fine.swift +++ b/test/Driver/PrivateDependencies/chained-private-after-multiple-fine.swift @@ -6,7 +6,7 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v @@ -14,13 +14,13 @@ // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/chained-private-after-multiple-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-DAG: Handled other.swift // CHECK-SECOND-DAG: Handled main.swift diff --git a/test/Driver/PrivateDependencies/chained-private-after-multiple-nominal-members-fine.swift b/test/Driver/PrivateDependencies/chained-private-after-multiple-nominal-members-fine.swift index 21f0da8f63818..78d02c537c540 100644 --- a/test/Driver/PrivateDependencies/chained-private-after-multiple-nominal-members-fine.swift +++ b/test/Driver/PrivateDependencies/chained-private-after-multiple-nominal-members-fine.swift @@ -6,17 +6,17 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/chained-private-after-multiple-nominal-members-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-DAG: Handled other.swift // CHECK-SECOND-DAG: Handled main.swift diff --git a/test/Driver/PrivateDependencies/chained-private-fine.swift b/test/Driver/PrivateDependencies/chained-private-fine.swift index f8e52acf65323..f286de7ba7522 100644 --- a/test/Driver/PrivateDependencies/chained-private-fine.swift +++ b/test/Driver/PrivateDependencies/chained-private-fine.swift @@ -4,19 +4,19 @@ // RUN: cp -r %S/Inputs/chained-private-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift // CHECK-FIRST: Handled yet-another.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v >%t/outputToCheck 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v >%t/outputToCheck 2>&1 // RUN: %FileCheck -check-prefix=CHECK-THIRD %s < %t/outputToCheck // Driver now schedules jobs in the order the inputs were given, but diff --git a/test/Driver/PrivateDependencies/check-interface-implementation-fine.swift b/test/Driver/PrivateDependencies/check-interface-implementation-fine.swift index e9d6e2f81e5b8..4aa32c6d90f67 100644 --- a/test/Driver/PrivateDependencies/check-interface-implementation-fine.swift +++ b/test/Driver/PrivateDependencies/check-interface-implementation-fine.swift @@ -6,7 +6,7 @@ // RUN: cp -r %S/Inputs/check-interface-implementation-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./c.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./c.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps // CHECK-FIRST-NOT: warning @@ -20,7 +20,7 @@ // RUN: touch -t 201401240006 %t/a.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./bad.swift ./c.swift -module-name main -j1 -v -driver-show-incremental > %t/a.txt 2>&1 +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./bad.swift ./c.swift -module-name main -j1 -v -driver-show-incremental > %t/a.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-A %s < %t/a.txt // RUN: %FileCheck -check-prefix=NEGATIVE-A %s < %t/a.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-A %s < %t/main~buildrecord.swiftdeps @@ -33,7 +33,7 @@ // CHECK-RECORD-A-DAG: "./bad.swift": !private [ // CHECK-RECORD-A-DAG: "./c.swift": !private [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./bad.swift ./c.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix CHECK-BC %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./bad.swift ./c.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix CHECK-BC %s // CHECK-BC-NOT: Handled a.swift // CHECK-BC-DAG: Handled bad.swift diff --git a/test/Driver/PrivateDependencies/crash-added-fine.swift b/test/Driver/PrivateDependencies/crash-added-fine.swift index 486eb36c3316d..6c44728f6ad6a 100644 --- a/test/Driver/PrivateDependencies/crash-added-fine.swift +++ b/test/Driver/PrivateDependencies/crash-added-fine.swift @@ -4,13 +4,13 @@ // RUN: cp -r %S/Inputs/crash-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s // CHECK-INITIAL-NOT: warning // CHECK-INITIAL: Handled main.swift // CHECK-INITIAL: Handled other.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./crash.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./crash.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s // RUN: %FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps // CHECK-ADDED-NOT: Handled @@ -26,13 +26,13 @@ // RUN: cp -r %S/Inputs/crash-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s // RUN: %FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIXED %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIXED %s // CHECK-FIXED-DAG: Handled crash.swift // CHECK-FIXED-DAG: Handled main.swift diff --git a/test/Driver/PrivateDependencies/crash-new-fine.swift b/test/Driver/PrivateDependencies/crash-new-fine.swift index aebdbe181d7a4..1d07151753e9a 100644 --- a/test/Driver/PrivateDependencies/crash-new-fine.swift +++ b/test/Driver/PrivateDependencies/crash-new-fine.swift @@ -6,7 +6,7 @@ // Initially compile all inputs, crash will fail. -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s // CHECK-NOT: warning // CHECK: Handled main.swift // CHECK: Handled crash.swift @@ -15,7 +15,7 @@ // Put crash.swift first to assure it gets scheduled first. // The others get queued, but not dispatched because crash crashes. -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BAD-ONLY %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BAD-ONLY %s // CHECK-BAD-ONLY-NOT: warning // CHECK-BAD-ONLY-NOT: Handled @@ -24,7 +24,7 @@ // Make crash succeed and all get compiled, exactly once. -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s // CHECK-OKAY: Handled main.swift // CHECK-OKAY: Handled crash.swift // CHECK-OKAY: Handled other.swift @@ -34,12 +34,12 @@ // RUN: touch -t 201401240006 %t/crash.swift // RUN: rm %t/crash.swiftdeps -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s // And repair crash: // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY-2 %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY-2 %s // CHECK-OKAY-2-DAG: Handled crash.swift // CHECK-OKAY-2-DAG: Handled other.swift @@ -51,7 +51,7 @@ // RUN: touch -t 201401240006 %t/main.swift // RUN: rm %t/main.swiftdeps -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NO-MAIN-SWIFTDEPS %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NO-MAIN-SWIFTDEPS %s // CHECK-NO-MAIN-SWIFTDEPS-NOT: warning // CHECK-NO-MAIN-SWIFTDEPS: Handled main.swift @@ -62,7 +62,7 @@ // Touch all files earlier than last compiled date in the build record. // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 -driver-show-incremental | %FileCheck -check-prefix=CHECK-CURRENT-WITH-CRASH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 -driver-show-incremental | %FileCheck -check-prefix=CHECK-CURRENT-WITH-CRASH %s // CHECK-CURRENT-WITH-CRASH: Handled main.swift // CHECK-CURRENT-WITH-CRASH: Handled crash.swift @@ -73,4 +73,4 @@ // RUN: touch -t 201401240006 %t/other.swift // RUN: rm %t/other.swiftdeps -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s diff --git a/test/Driver/PrivateDependencies/crash-simple-fine.swift b/test/Driver/PrivateDependencies/crash-simple-fine.swift index 78fb778ba4ab8..c04b3d7c01676 100644 --- a/test/Driver/PrivateDependencies/crash-simple-fine.swift +++ b/test/Driver/PrivateDependencies/crash-simple-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/crash-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift @@ -12,7 +12,7 @@ // CHECK-FIRST: Handled other.swift // RUN: touch -t 201401240006 %t/crash.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: Handled crash.swift // CHECK-SECOND-NOT: Handled main.swift @@ -24,7 +24,7 @@ // CHECK-RECORD-DAG: "./main.swift": !private [ // CHECK-RECORD-DAG: "./other.swift": !private [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled main.swift // CHECK-THIRD-DAG: Handled crash.swift diff --git a/test/Driver/PrivateDependencies/dependencies-preservation-fine.swift b/test/Driver/PrivateDependencies/dependencies-preservation-fine.swift index 3cd6e1305022a..52bdac2a03606 100644 --- a/test/Driver/PrivateDependencies/dependencies-preservation-fine.swift +++ b/test/Driver/PrivateDependencies/dependencies-preservation-fine.swift @@ -6,7 +6,7 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -output-file-map %t/output.json +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -output-file-map %t/output.json // RUN: %FileCheck -check-prefix CHECK-ORIGINAL %s < main~buildrecord.swiftdeps~ // CHECK-ORIGINAL: inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]} diff --git a/test/Driver/PrivateDependencies/driver-show-incremental-arguments-fine.swift b/test/Driver/PrivateDependencies/driver-show-incremental-arguments-fine.swift index 454e270ef3014..3316c39fbd2ef 100644 --- a/test/Driver/PrivateDependencies/driver-show-incremental-arguments-fine.swift +++ b/test/Driver/PrivateDependencies/driver-show-incremental-arguments-fine.swift @@ -14,11 +14,11 @@ // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s // CHECK-INCREMENTAL-NOT: Incremental compilation has been disabled // CHECK-INCREMENTAL: Queuing (initial): {compile: main.o <= main.swift} -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -g -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-ARGS-MISMATCH %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -g -c ./main.swift ./other.swift -module-name main -incremental -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-ARGS-MISMATCH %s // CHECK-ARGS-MISMATCH: Incremental compilation has been disabled{{.*}}different arguments // CHECK-ARGS-MISMATCH-NOT: Queuing (initial): {compile: main.o <= main.swift} diff --git a/test/Driver/PrivateDependencies/driver-show-incremental-conflicting-arguments-fine.swift b/test/Driver/PrivateDependencies/driver-show-incremental-conflicting-arguments-fine.swift index 7a6168864bcf5..aa30eb0bfd20c 100644 --- a/test/Driver/PrivateDependencies/driver-show-incremental-conflicting-arguments-fine.swift +++ b/test/Driver/PrivateDependencies/driver-show-incremental-conflicting-arguments-fine.swift @@ -14,19 +14,19 @@ // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s // CHECK-INCREMENTAL-NOT: Incremental compilation has been disabled // CHECK-INCREMENTAL: Queuing (initial): {compile: main.o <= main.swift} -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -whole-module-optimization -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-WMO %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -whole-module-optimization -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-WMO %s // CHECK-WMO: Incremental compilation has been disabled{{.*}}whole module optimization // CHECK-WMO-NOT: Queuing (initial): {compile: main.o <= main.swift} -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -embed-bitcode -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-BITCODE %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -embed-bitcode -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-BITCODE %s // CHECK-BITCODE: Incremental compilation has been disabled{{.*}}LLVM IR bitcode // CHECK-BITCODE-NOT: Queuing (initial): {compile: main.o <= main.swift} -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -whole-module-optimization -embed-bitcode -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-WMO-AND-BITCODE %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -whole-module-optimization -embed-bitcode -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-WMO-AND-BITCODE %s // CHECK-WMO-AND-BITCODE: Incremental compilation has been disabled{{.*}}whole module optimization // CHECK-WMO-AND-BITCODE-NOT: Incremental compilation has been disabled // CHECK-WMO-AND-BITCODE-NOT: Queuing (initial): {compile: main.o <= main.swift} diff --git a/test/Driver/PrivateDependencies/driver-show-incremental-inputs-fine.swift b/test/Driver/PrivateDependencies/driver-show-incremental-inputs-fine.swift index a37a804dedf49..83c515d558766 100644 --- a/test/Driver/PrivateDependencies/driver-show-incremental-inputs-fine.swift +++ b/test/Driver/PrivateDependencies/driver-show-incremental-inputs-fine.swift @@ -14,11 +14,11 @@ // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s // CHECK-INCREMENTAL-NOT: Incremental compilation has been disabled // CHECK-INCREMENTAL: Queuing (initial): {compile: main.o <= main.swift} -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INPUTS-MISMATCH %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INPUTS-MISMATCH %s // CHECK-INPUTS-MISMATCH: Incremental compilation has been disabled{{.*}}inputs // CHECK-INPUTS-MISMATCH: ./other.swift // CHECK-INPUTS-MISMATCH-NOT: Queuing (initial): {compile: main.o <= main.swift} diff --git a/test/Driver/PrivateDependencies/driver-show-incremental-malformed-fine.swift b/test/Driver/PrivateDependencies/driver-show-incremental-malformed-fine.swift index ea0355171a5d4..063fb166b155c 100644 --- a/test/Driver/PrivateDependencies/driver-show-incremental-malformed-fine.swift +++ b/test/Driver/PrivateDependencies/driver-show-incremental-malformed-fine.swift @@ -13,24 +13,24 @@ // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s // CHECK-INCREMENTAL-NOT: Incremental compilation has been enabled // CHECK-INCREMENTAL: Queuing (initial): {compile: main.o <= main.swift} // RUN: rm %t/main~buildrecord.swiftdeps && touch %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -g -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MALFORMED %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -g -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MALFORMED %s // RUN: echo 'foo' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -g -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MALFORMED %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -g -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MALFORMED %s // CHECK-MALFORMED: Incremental compilation has been disabled{{.*}}malformed build record file // CHECK-MALFORMED-NOT: Queuing (initial): {compile: main.o <= main.swift} // RUN: echo '{version, inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -g -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MISSING-KEY %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -g -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MISSING-KEY %s // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -g -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MISSING-KEY %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -g -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-MISSING-KEY %s // CHECK-MISSING-KEY: Incremental compilation has been disabled{{.*}}malformed build record file{{.*}}Malformed value for key // CHECK-MISSING-KEY-NOT: Queuing (initial): {compile: main.o <= main.swift} diff --git a/test/Driver/PrivateDependencies/driver-show-incremental-mutual-fine.swift b/test/Driver/PrivateDependencies/driver-show-incremental-mutual-fine.swift index ef34a9aa976a7..5449fb09c7746 100644 --- a/test/Driver/PrivateDependencies/driver-show-incremental-mutual-fine.swift +++ b/test/Driver/PrivateDependencies/driver-show-incremental-mutual-fine.swift @@ -4,16 +4,16 @@ // RUN: cp -r %S/Inputs/mutual-with-swiftdeps-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift // CHECK-FIRST: Disabling incremental build: could not read build record -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Queuing // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v -driver-show-incremental 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Queuing (initial): {compile: other.o <= other.swift} // CHECK-THIRD: Queuing because of the initial set: {compile: main.o <= main.swift} // CHECK-THIRD-NEXT: interface of top-level name 'a' in other.swift -> interface of source file main.swiftdeps diff --git a/test/Driver/PrivateDependencies/driver-show-incremental-swift-version-fine.swift b/test/Driver/PrivateDependencies/driver-show-incremental-swift-version-fine.swift index 1a747c19cb0c5..0d23556e76336 100644 --- a/test/Driver/PrivateDependencies/driver-show-incremental-swift-version-fine.swift +++ b/test/Driver/PrivateDependencies/driver-show-incremental-swift-version-fine.swift @@ -14,12 +14,12 @@ // RUN: %{python} %S/Inputs/touch.py 443865900 %t/* // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-INCREMENTAL %s // CHECK-INCREMENTAL-NOT: Incremental compilation has been enabled // CHECK-INCREMENTAL: Queuing (initial): {compile: main.o <= main.swift} // RUN: echo '{version: "bogus", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0]}}' > %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -c ./main.swift ./other.swift -module-name main -incremental -experimental-private-intransitive-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-VERSION-MISMATCH %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -c ./main.swift ./other.swift -module-name main -incremental -enable-direct-intramodule-dependencies -v -driver-show-incremental -output-file-map %t/output.json | %FileCheck --check-prefix CHECK-VERSION-MISMATCH %s // CHECK-VERSION-MISMATCH: Incremental compilation has been disabled{{.*}}compiler version mismatch // CHECK-VERSION-MISMATCH: Compiling with: // CHECK-VERSION-MISMATCH: Previously compiled with: bogus diff --git a/test/Driver/PrivateDependencies/embed-bitcode-parallel-fine.swift b/test/Driver/PrivateDependencies/embed-bitcode-parallel-fine.swift index b79f2296c15d4..50112643381ca 100644 --- a/test/Driver/PrivateDependencies/embed-bitcode-parallel-fine.swift +++ b/test/Driver/PrivateDependencies/embed-bitcode-parallel-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/fake-build-for-bitcode.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./main.swift ./other.swift -embed-bitcode -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/fake-build-for-bitcode.py" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./main.swift ./other.swift -embed-bitcode -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: {{^{$}} @@ -57,7 +57,7 @@ // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/fake-build-for-bitcode.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./main.swift ./other.swift -embed-bitcode -module-name main -j2 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/fake-build-for-bitcode.py" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./main.swift ./other.swift -embed-bitcode -module-name main -j2 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: "kind": "began" // CHECK-SECOND: "name": "compile" diff --git a/test/Driver/PrivateDependencies/fail-added-fine.swift b/test/Driver/PrivateDependencies/fail-added-fine.swift index 7524a704cfe1c..96fd48459944b 100644 --- a/test/Driver/PrivateDependencies/fail-added-fine.swift +++ b/test/Driver/PrivateDependencies/fail-added-fine.swift @@ -4,13 +4,13 @@ // RUN: cp -r %S/Inputs/fail-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s // CHECK-INITIAL-NOT: warning // CHECK-INITIAL: Handled main.swift // CHECK-INITIAL: Handled other.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s // RUN: %FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps // CHECK-ADDED-NOT: Handled @@ -26,7 +26,7 @@ // RUN: cp -r %S/Inputs/fail-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s // RUN: %FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps diff --git a/test/Driver/PrivateDependencies/fail-chained-fine.swift b/test/Driver/PrivateDependencies/fail-chained-fine.swift index 48e8d0d46797f..bb3178849247e 100644 --- a/test/Driver/PrivateDependencies/fail-chained-fine.swift +++ b/test/Driver/PrivateDependencies/fail-chained-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/fail-chained-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps // CHECK-FIRST-NOT: warning @@ -26,7 +26,7 @@ // RUN: touch -t 201401240006 %t/a.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./bad.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift -module-name main -j1 -v > %t/a.txt 2>&1 +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./bad.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift -module-name main -j1 -v > %t/a.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-A %s < %t/a.txt // RUN: %FileCheck -check-prefix=NEGATIVE-A %s < %t/a.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-A %s < %t/main~buildrecord.swiftdeps @@ -47,7 +47,7 @@ // CHECK-RECORD-A-DAG: "./f.swift": [ // CHECK-RECORD-A-DAG: "./bad.swift": !private [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/a2.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/a2.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-A2 %s < %t/a2.txt // RUN: %FileCheck -check-prefix=NEGATIVE-A2 %s < %t/a2.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps @@ -65,10 +65,10 @@ // RUN: cp -r %S/Inputs/fail-chained-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/b.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/b.txt 2>&1 +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/b.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-B %s < %t/b.txt // RUN: %FileCheck -check-prefix=NEGATIVE-B %s < %t/b.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-B %s < %t/main~buildrecord.swiftdeps @@ -89,7 +89,7 @@ // CHECK-RECORD-B-DAG: "./f.swift": [ // CHECK-RECORD-B-DAG: "./bad.swift": !private [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/b2.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/b2.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-B2 %s < %t/b2.txt // RUN: %FileCheck -check-prefix=NEGATIVE-B2 %s < %t/b2.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps @@ -107,10 +107,10 @@ // RUN: cp -r %S/Inputs/fail-chained-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/bad.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./bad.swift ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift -module-name main -j1 -v > %t/bad.txt 2>&1 +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./bad.swift ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift -module-name main -j1 -v > %t/bad.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-BAD %s < %t/bad.txt // RUN: %FileCheck -check-prefix=NEGATIVE-BAD %s < %t/bad.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-A %s < %t/main~buildrecord.swiftdeps @@ -123,7 +123,7 @@ // NEGATIVE-BAD-NOT: Handled e.swift // NEGATIVE-BAD-NOT: Handled f.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/bad2.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/bad2.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-A2 %s < %t/bad2.txt // RUN: %FileCheck -check-prefix=NEGATIVE-A2 %s < %t/bad2.txt // RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps diff --git a/test/Driver/PrivateDependencies/fail-interface-hash-fine.swift b/test/Driver/PrivateDependencies/fail-interface-hash-fine.swift index ce18f93643294..53c52594063a2 100644 --- a/test/Driver/PrivateDependencies/fail-interface-hash-fine.swift +++ b/test/Driver/PrivateDependencies/fail-interface-hash-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/fail-interface-hash-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift @@ -16,7 +16,7 @@ // RUN: cp -r %S/Inputs/fail-interface-hash-fine/*.swiftdeps %t // RUN: touch -t 201401240006 %t/bad.swift %t/main.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // RUN: %FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps // CHECK-SECOND: Handled main.swift @@ -29,7 +29,7 @@ // CHECK-RECORD-DAG: "./depends-on-main.swift": !private [ // CHECK-RECORD-DAG: "./depends-on-bad.swift": [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled bad // CHECK-THIRD-DAG: Handled depends-on-bad diff --git a/test/Driver/PrivateDependencies/fail-new-fine.swift b/test/Driver/PrivateDependencies/fail-new-fine.swift index 67efd284e82da..b3c917f498628 100644 --- a/test/Driver/PrivateDependencies/fail-new-fine.swift +++ b/test/Driver/PrivateDependencies/fail-new-fine.swift @@ -4,20 +4,20 @@ // RUN: cp -r %S/Inputs/fail-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s // CHECK-NOT: warning // CHECK: Handled main.swift // CHECK: Handled bad.swift // CHECK-NOT: Handled other.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BAD-ONLY %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BAD-ONLY %s // CHECK-BAD-ONLY-NOT: warning // CHECK-BAD-ONLY-NOT: Handled // CHECK-BAD-ONLY: Handled bad.swift // CHECK-BAD-ONLY-NOT: Handled -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s // CHECK-OKAY: Handled main.swift // CHECK-OKAY: Handled bad.swift // CHECK-OKAY: Handled other.swift @@ -25,10 +25,10 @@ // RUN: touch -t 201401240006 %t/bad.swift // RUN: rm %t/bad.swiftdeps -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY-2 %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY-2 %s // CHECK-OKAY-2-DAG: Handled bad.swift // CHECK-OKAY-2-DAG: Handled other.swift @@ -36,10 +36,10 @@ // RUN: touch -t 201401240006 %t/main.swift // RUN: rm %t/main.swiftdeps -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s // RUN: touch -t 201401240006 %t/other.swift // RUN: rm %t/other.swiftdeps -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s diff --git a/test/Driver/PrivateDependencies/fail-simple-fine.swift b/test/Driver/PrivateDependencies/fail-simple-fine.swift index 2aad6dc989cf1..1d4cb299605e7 100644 --- a/test/Driver/PrivateDependencies/fail-simple-fine.swift +++ b/test/Driver/PrivateDependencies/fail-simple-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/fail-simple-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift @@ -12,7 +12,7 @@ // CHECK-FIRST: Handled other.swift // RUN: touch -t 201401240006 %t/bad.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // RUN: %FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps // CHECK-SECOND: Handled bad.swift @@ -23,7 +23,7 @@ // CHECK-RECORD-DAG: "./main.swift": !private [ // CHECK-RECORD-DAG: "./other.swift": !private [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled main.swift // CHECK-THIRD-DAG: Handled bad.swift diff --git a/test/Driver/PrivateDependencies/fail-with-bad-deps-fine.swift b/test/Driver/PrivateDependencies/fail-with-bad-deps-fine.swift index 497742a31e001..8639ba7d45d17 100644 --- a/test/Driver/PrivateDependencies/fail-with-bad-deps-fine.swift +++ b/test/Driver/PrivateDependencies/fail-with-bad-deps-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/fail-with-bad-deps-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift @@ -15,14 +15,14 @@ // Reset the .swiftdeps files. // RUN: cp -r %S/Inputs/fail-with-bad-deps-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NONE %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NONE %s // CHECK-NONE-NOT: Handled // Reset the .swiftdeps files. // RUN: cp -r %S/Inputs/fail-with-bad-deps-fine/*.swiftdeps %t // RUN: touch -t 201401240006 %t/bad.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BUILD-ALL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BUILD-ALL %s // CHECK-BUILD-ALL-NOT: warning // CHECK-BUILD-ALL: Handled bad.swift @@ -34,7 +34,7 @@ // RUN: cp -r %S/Inputs/fail-with-bad-deps-fine/*.swiftdeps %t // RUN: touch -t 201401240007 %t/bad.swift %t/main.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-WITH-FAIL %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-WITH-FAIL %s // RUN: %FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps // CHECK-WITH-FAIL: Handled main.swift @@ -47,4 +47,4 @@ // CHECK-RECORD-DAG: "./depends-on-main.swift": !private [ // CHECK-RECORD-DAG: "./depends-on-bad.swift": [ -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./bad.swift ./main.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BUILD-ALL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./bad.swift ./main.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BUILD-ALL %s diff --git a/test/Driver/PrivateDependencies/file-added-fine.swift b/test/Driver/PrivateDependencies/file-added-fine.swift index 4cc0a906c0760..b5138e158e222 100644 --- a/test/Driver/PrivateDependencies/file-added-fine.swift +++ b/test/Driver/PrivateDependencies/file-added-fine.swift @@ -4,16 +4,16 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-NOT: Handled other.swift // CHECK-THIRD: Handled main.swift diff --git a/test/Driver/PrivateDependencies/independent-fine.swift b/test/Driver/PrivateDependencies/independent-fine.swift index 4e8e9878842ef..c57fe2a2f2ee4 100644 --- a/test/Driver/PrivateDependencies/independent-fine.swift +++ b/test/Driver/PrivateDependencies/independent-fine.swift @@ -4,43 +4,43 @@ // RUN: cp -r %S/Inputs/independent-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: ls %t/main~buildrecord.swiftdeps // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/independent-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s // CHECK-FIRST-MULTI: Handled main.swift // CHECK-FIRST-MULTI: Handled other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // RUN: touch -t 201401240006 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/independent-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SINGLE %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SINGLE %s // CHECK-SINGLE: Handled main.swift // RUN: ls %t/main~buildrecord.swiftdeps diff --git a/test/Driver/PrivateDependencies/independent-half-dirty-fine.swift b/test/Driver/PrivateDependencies/independent-half-dirty-fine.swift index ae79d0f17189b..07abdbcff5cd6 100644 --- a/test/Driver/PrivateDependencies/independent-half-dirty-fine.swift +++ b/test/Driver/PrivateDependencies/independent-half-dirty-fine.swift @@ -2,7 +2,7 @@ // RUN: cp -r %S/Inputs/independent-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift @@ -10,14 +10,14 @@ // RUN: touch -t 201401240005 %t/other.o // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled main.swift // CHECK-SECOND: Handled other.swift // CHECK-SECOND-NOT: Handled main.swift // RUN: rm %t/other.swiftdeps -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Handled main.swift // CHECK-THIRD: Handled other.swift diff --git a/test/Driver/PrivateDependencies/independent-parseable-fine.swift b/test/Driver/PrivateDependencies/independent-parseable-fine.swift index bf7ecc998a7bc..988306b5509e5 100644 --- a/test/Driver/PrivateDependencies/independent-parseable-fine.swift +++ b/test/Driver/PrivateDependencies/independent-parseable-fine.swift @@ -2,7 +2,7 @@ // RUN: cp -r %S/Inputs/independent-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: {{^{$}} @@ -17,7 +17,7 @@ // CHECK-FIRST: "output": "Handled main.swift{{(\\r)?}}\n" // CHECK-FIRST: {{^}$}} -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: {{^{$}} // CHECK-SECOND: "kind": "skipped" @@ -26,14 +26,14 @@ // CHECK-SECOND: {{^}$}} // RUN: touch -t 201401240006 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/independent-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s // CHECK-FIRST-MULTI: {{^{$}} // CHECK-FIRST-MULTI: "kind": "began" @@ -59,7 +59,7 @@ // CHECK-FIRST-MULTI: "output": "Handled other.swift{{(\\r)?}}\n" // CHECK-FIRST-MULTI: {{^}$}} -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND-MULTI %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND-MULTI %s // CHECK-SECOND-MULTI: {{^{$}} // CHECK-SECOND-MULTI: "kind": "skipped" @@ -74,5 +74,5 @@ // CHECK-SECOND-MULTI: {{^}$}} // RUN: touch -t 201401240006 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s diff --git a/test/Driver/PrivateDependencies/malformed-but-valid-yaml-fine.swift b/test/Driver/PrivateDependencies/malformed-but-valid-yaml-fine.swift index 6e2a558672b18..94d9ca70fe42c 100644 --- a/test/Driver/PrivateDependencies/malformed-but-valid-yaml-fine.swift +++ b/test/Driver/PrivateDependencies/malformed-but-valid-yaml-fine.swift @@ -3,24 +3,24 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/malformed-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: Handled other.swift // CHECK-SECOND: Handled main.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Handled main.swift // CHECK-THIRD: Handled other.swift @@ -30,18 +30,18 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/malformed-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift diff --git a/test/Driver/PrivateDependencies/malformed-fine.swift b/test/Driver/PrivateDependencies/malformed-fine.swift index ae0c610544edd..e778a0b6cfaee 100644 --- a/test/Driver/PrivateDependencies/malformed-fine.swift +++ b/test/Driver/PrivateDependencies/malformed-fine.swift @@ -3,24 +3,24 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/malformed-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: Handled other.swift // CHECK-SECOND: Handled main.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Handled main.swift // CHECK-THIRD: Handled other.swift @@ -30,18 +30,18 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/malformed-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift diff --git a/test/Driver/PrivateDependencies/moduleonly.swift b/test/Driver/PrivateDependencies/moduleonly.swift index 4b08eae71123b..e71c4c4192e93 100644 --- a/test/Driver/PrivateDependencies/moduleonly.swift +++ b/test/Driver/PrivateDependencies/moduleonly.swift @@ -2,7 +2,7 @@ // RUN: cp -r %S/Inputs/moduleonly/* %t // RUN: touch -t 201801230045 %t/*.swift -// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -experimental-private-intransitive-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK1 %s +// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -enable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK1 %s // RUN: test ! -f %t/buildrecord.swiftdeps // RUN: test -f %t/buildrecord.swiftdeps~moduleonly @@ -10,7 +10,7 @@ // CHECK1-DAG: -primary-file ./bar.swift // CHECK1-DAG: -primary-file ./baz.swift -// RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental -experimental-private-intransitive-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK2 %s +// RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental -enable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK2 %s // RUN: test -f %t/buildrecord.swiftdeps // RUN: test -f %t/buildrecord.swiftdeps~moduleonly @@ -18,7 +18,7 @@ // CHECK2-DAG: -primary-file ./bar.swift // CHECK2-DAG: -primary-file ./baz.swift -// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -experimental-private-intransitive-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK3 %s +// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -enable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK3 %s // RUN: test -f %t/buildrecord.swiftdeps~moduleonly // RUN: test -f %t/buildrecord.swiftdeps @@ -27,20 +27,20 @@ // CHECK3-NOT: -primary-file ./baz.swift // RUN: touch -t 201801230123 %t/bar.swift -// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -experimental-private-intransitive-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK4 %s +// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -enable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK4 %s // CHECK4-NOT: -primary-file ./foo.swift // CHECK4-NOT: -primary-file ./baz.swift // CHECK4-DAG: -primary-file ./bar.swift // RUN: touch -t 201801230145 %t/baz.swift -// RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental -experimental-private-intransitive-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK5 %s +// RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental -enable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK5 %s // CHECK5-NOT: -primary-file ./foo.swift // CHECK5-DAG: -primary-file ./bar.swift // CHECK5-DAG: -primary-file ./baz.swift -// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -experimental-private-intransitive-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK6 %s +// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -enable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 | %FileCheck -check-prefix=CHECK6 %s // CHECK6-NOT: -primary-file ./foo.swift // CHECK6-NOT: -primary-file ./bar.swift @@ -52,7 +52,7 @@ // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/moduleonly/* %t // RUN: touch -t 201801230045 %t/*.swift -// RUN: cd %t && %target-build-swift -c -g -output-file-map ./output.json -incremental -experimental-private-intransitive-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 +// RUN: cd %t && %target-build-swift -c -g -output-file-map ./output.json -incremental -enable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 // RUN: test ! -f %t/buildrecord.swiftdeps~moduleonly // RUN: test -f %t/buildrecord.swiftdeps // RUN: test ! -f %t/foo~partial.swiftmodule @@ -62,7 +62,7 @@ // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/moduleonly/* %t // RUN: touch -t 201801230045 %t/*.swift -// RUN: cd %t && %target-build-swift -emit-library -g -output-file-map ./output.json -incremental -experimental-private-intransitive-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 +// RUN: cd %t && %target-build-swift -emit-library -g -output-file-map ./output.json -incremental -enable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 // RUN: test ! -f %t/buildrecord.swiftdeps~moduleonly // RUN: test -f %t/buildrecord.swiftdeps // RUN: test -f %t/foo~partial.swiftmodule @@ -74,12 +74,12 @@ // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/moduleonly/* %t // RUN: touch -t 201801230045 %t/*.swift -// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -experimental-private-intransitive-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 +// RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental -enable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 // RUN: cp -f %t/testmodule.swiftmodule %t-moduleonly.swiftmodule // RUN: cp -f %t/testmodule.swiftdoc %t-moduleonly.swiftdoc // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/moduleonly/* %t // RUN: touch -t 201801230045 %t/*.swift -// RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental -experimental-private-intransitive-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 +// RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental -enable-direct-intramodule-dependencies ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1 // RUN: diff %t/testmodule.swiftmodule %t-moduleonly.swiftmodule // RUN: diff %t/testmodule.swiftdoc %t-moduleonly.swiftdoc diff --git a/test/Driver/PrivateDependencies/mutual-fine.swift b/test/Driver/PrivateDependencies/mutual-fine.swift index 5407eb3bcb87c..b3352f87f50d1 100644 --- a/test/Driver/PrivateDependencies/mutual-fine.swift +++ b/test/Driver/PrivateDependencies/mutual-fine.swift @@ -4,21 +4,21 @@ // RUN: cp -r %S/Inputs/mutual-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Handled main.swift // CHECK-THIRD: Handled other.swift // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s diff --git a/test/Driver/PrivateDependencies/mutual-interface-hash-fine.swift b/test/Driver/PrivateDependencies/mutual-interface-hash-fine.swift index 5a35a3db0f20a..2c1b85b77814d 100644 --- a/test/Driver/PrivateDependencies/mutual-interface-hash-fine.swift +++ b/test/Driver/PrivateDependencies/mutual-interface-hash-fine.swift @@ -5,17 +5,17 @@ // RUN: touch -t 201401240005 %t/* // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/mutual-interface-hash-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s // CHECK-CLEAN-NOT: Handled // RUN: touch -t 201401240006 %t/does-change.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CHANGE %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CHANGE %s // CHECK-CHANGE-DAG: Handled does-change.swift // CHECK-CHANGE-DAG: Handled does-not-change.swift @@ -24,7 +24,7 @@ // RUN: cp -r %S/Inputs/mutual-interface-hash-fine/*.swiftdeps %t // RUN: touch -t 201401240006 %t/does-not-change.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NO-CHANGE %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NO-CHANGE %s // CHECK-NO-CHANGE-NOT: Handled // CHECK-NO-CHANGE: Handled does-not-change.swift @@ -36,7 +36,7 @@ // Make sure the files really were dependent on one another. // RUN: touch -t 201401240007 %t/does-not-change.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies -driver-always-rebuild-dependents ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REBUILD-DEPENDENTS %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies -driver-always-rebuild-dependents ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REBUILD-DEPENDENTS %s // CHECK-REBUILD-DEPENDENTS-DAG: Handled does-not-change.swift // CHECK-REBUILD-DEPENDENTS-DAG: Handled does-change.swift @@ -47,4 +47,4 @@ // RUN: cp -r %S/Inputs/mutual-interface-hash-fine/*.swiftdeps %t // RUN: sed -E -e 's/"[^"]*does-not-change.swift":/& !dirty/' -i.prev %t/main~buildrecord.swiftdeps -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -experimental-private-intransitive-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REBUILD-DEPENDENTS %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -enable-direct-intramodule-dependencies ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REBUILD-DEPENDENTS %s diff --git a/test/Driver/PrivateDependencies/nominal-members-fine.swift b/test/Driver/PrivateDependencies/nominal-members-fine.swift index 29a943e1619e2..036a42b45807f 100644 --- a/test/Driver/PrivateDependencies/nominal-members-fine.swift +++ b/test/Driver/PrivateDependencies/nominal-members-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/nominal-members-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s // CHECK-INITIAL-NOT: warning // CHECK-INITIAL: Handled a.swift @@ -12,12 +12,12 @@ // CHECK-INITIAL: Handled depends-on-a-foo.swift // CHECK-INITIAL: Handled depends-on-a-ext.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s // CHECK-CLEAN-NOT: Handled // RUN: touch -t 201401240006 %t/a.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v > %t/touched-a.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v > %t/touched-a.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-TOUCHED-A %s < %t/touched-a.txt // RUN: %FileCheck -check-prefix=NEGATIVE-TOUCHED-A %s < %t/touched-a.txt @@ -26,11 +26,11 @@ // CHECK-TOUCHED-A-DAG: Handled depends-on-a-ext.swift // NEGATIVE-TOUCHED-A-NOT: Handled a-ext.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s // RUN: touch -t 201401240007 %t/a-ext.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-TOUCHED-EXT %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-TOUCHED-EXT %s // CHECK-TOUCHED-EXT-NOT: Handled // CHECK-TOUCHED-EXT: Handled a-ext.swift diff --git a/test/Driver/PrivateDependencies/one-way-depends-after-fine.swift b/test/Driver/PrivateDependencies/one-way-depends-after-fine.swift index 2909800b307fd..2c14d121f0f96 100644 --- a/test/Driver/PrivateDependencies/one-way-depends-after-fine.swift +++ b/test/Driver/PrivateDependencies/one-way-depends-after-fine.swift @@ -6,25 +6,25 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-depends-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled main.swift // CHECK-SECOND: Handled other.swift // CHECK-SECOND-NOT: Handled main.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // RUN: %empty-directory(%t) @@ -32,25 +32,25 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-depends-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-NOT: Handled other.swift // CHECK-THIRD: Handled main.swift // CHECK-THIRD-NOT: Handled other.swift // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // RUN: touch -t 201401240008 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-DAG: Handled other.swift // CHECK-FOURTH-DAG: Handled main.swift diff --git a/test/Driver/PrivateDependencies/one-way-depends-before-fine.swift b/test/Driver/PrivateDependencies/one-way-depends-before-fine.swift index 20f561b1656f1..d3c45cfda9a1b 100644 --- a/test/Driver/PrivateDependencies/one-way-depends-before-fine.swift +++ b/test/Driver/PrivateDependencies/one-way-depends-before-fine.swift @@ -6,24 +6,24 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-depends-before-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: Handled main.swift // CHECK-SECOND: Handled other.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-NOT: Handled main.swift // CHECK-THIRD: Handled other.swift @@ -35,22 +35,22 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-depends-before-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift // CHECK-FOURTH-NOT: Handled other.swift // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // RUN: touch -t 201401240008 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s diff --git a/test/Driver/PrivateDependencies/one-way-external-delete-fine.swift b/test/Driver/PrivateDependencies/one-way-external-delete-fine.swift index 6273e5a6b8228..c10b5febb09d8 100644 --- a/test/Driver/PrivateDependencies/one-way-external-delete-fine.swift +++ b/test/Driver/PrivateDependencies/one-way-external-delete-fine.swift @@ -2,13 +2,13 @@ // RUN: cp -r %S/Inputs/one-way-external-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled @@ -17,7 +17,7 @@ // RUN: touch -t 201401240006 %t/*.o // RUN: touch -t 201401240004 %t/*-external // RUN: rm %t/other1-external -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled other.swift // CHECK-THIRD-DAG: Handled main.swift @@ -27,14 +27,14 @@ // RUN: cp -r %S/Inputs/one-way-external-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240005 %t/* // RUN: touch -t 201401240006 %t/*.o // RUN: touch -t 201401240004 %t/*-external // RUN: rm %t/main1-external -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift diff --git a/test/Driver/PrivateDependencies/one-way-external-fine.swift b/test/Driver/PrivateDependencies/one-way-external-fine.swift index 307fed4496843..dc4544bac4404 100644 --- a/test/Driver/PrivateDependencies/one-way-external-fine.swift +++ b/test/Driver/PrivateDependencies/one-way-external-fine.swift @@ -8,13 +8,13 @@ // RUN: cp -r %S/Inputs/one-way-external-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled @@ -23,7 +23,7 @@ // RUN: touch -t 201401240006 %t/*.o // RUN: touch -t 201401240004 %t/*-external // RUN: touch -t 203704010005 %t/other1-external -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-DAG: Handled other.swift // CHECK-THIRD-DAG: Handled main.swift @@ -32,14 +32,14 @@ // RUN: touch -t 201401240006 %t/*.o // RUN: touch -t 201401240004 %t/*-external // RUN: touch -t 203704010005 %t/other2-external -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // RUN: touch -t 201401240005 %t/* // RUN: touch -t 201401240006 %t/*.o // RUN: touch -t 201401240004 %t/*-external // RUN: touch -t 203704010005 %t/main1-external -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift @@ -49,4 +49,4 @@ // RUN: touch -t 201401240006 %t/*.o // RUN: touch -t 201401240004 %t/*-external // RUN: touch -t 203704010005 %t/main2-external -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s diff --git a/test/Driver/PrivateDependencies/one-way-fine.swift b/test/Driver/PrivateDependencies/one-way-fine.swift index dc8d2b7fba083..2c1aaf2bf353a 100644 --- a/test/Driver/PrivateDependencies/one-way-fine.swift +++ b/test/Driver/PrivateDependencies/one-way-fine.swift @@ -4,34 +4,34 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: Handled main.swift // CHECK-THIRD: Handled other.swift // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift // CHECK-FOURTH-NOT: Handled other.swift // RUN: rm %t/main.o -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // RUN: rm %t/other.o -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIFTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIFTH %s // CHECK-FIFTH-NOT: Handled main.swift // CHECK-FIFTH: Handled other.swift @@ -41,34 +41,34 @@ // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // Try modifying the inputs /backwards/ in time rather than forwards. // RUN: touch -t 201401240004 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // RUN: touch -t 201401240004 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FIRST %s // CHECK-REV-FIRST: Handled other.swift // CHECK-REV-FIRST: Handled main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-SECOND %s // CHECK-REV-SECOND-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FIRST %s // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FOURTH %s // CHECK-REV-FOURTH-NOT: Handled other.swift // CHECK-REV-FOURTH: Handled main.swift diff --git a/test/Driver/PrivateDependencies/one-way-merge-module-fine.swift b/test/Driver/PrivateDependencies/one-way-merge-module-fine.swift index 2fffc4567d1bc..b5e2da7cca40e 100644 --- a/test/Driver/PrivateDependencies/one-way-merge-module-fine.swift +++ b/test/Driver/PrivateDependencies/one-way-merge-module-fine.swift @@ -4,14 +4,14 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: Handled main.swift // CHECK-FIRST: Handled other.swift // CHECK-FIRST: Produced master.swiftmodule -// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-NOT: warning // CHECK-SECOND-NOT: Handled diff --git a/test/Driver/PrivateDependencies/one-way-parallel-fine.swift b/test/Driver/PrivateDependencies/one-way-parallel-fine.swift index b77396a067998..8ff7c9a318dbb 100644 --- a/test/Driver/PrivateDependencies/one-way-parallel-fine.swift +++ b/test/Driver/PrivateDependencies/one-way-parallel-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: {{^{$}} @@ -32,7 +32,7 @@ // CHECK-FIRST: {{^}$}} // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j2 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j2 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: {{^{$}} // CHECK-SECOND: "kind": "began" diff --git a/test/Driver/PrivateDependencies/one-way-parseable-fine.swift b/test/Driver/PrivateDependencies/one-way-parseable-fine.swift index 64978565fcfa6..82bd1cfc2b3f8 100644 --- a/test/Driver/PrivateDependencies/one-way-parseable-fine.swift +++ b/test/Driver/PrivateDependencies/one-way-parseable-fine.swift @@ -2,7 +2,7 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST: {{^{$}} @@ -29,7 +29,7 @@ // CHECK-FIRST: "output": "Handled other.swift{{(\\r)?}}\n" // CHECK-FIRST: {{^}$}} -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: {{^{$}} // CHECK-SECOND: "kind": "skipped" @@ -44,7 +44,7 @@ // CHECK-SECOND: {{^}$}} // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD: {{^{$}} // CHECK-THIRD: "kind": "began" @@ -71,7 +71,7 @@ // CHECK-THIRD: {{^}$}} // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH: {{^{$}} // CHECK-FOURTH: "kind": "began" diff --git a/test/Driver/PrivateDependencies/one-way-provides-after-fine.swift b/test/Driver/PrivateDependencies/one-way-provides-after-fine.swift index 34766c4b22ba1..d33e9fdd3cfef 100644 --- a/test/Driver/PrivateDependencies/one-way-provides-after-fine.swift +++ b/test/Driver/PrivateDependencies/one-way-provides-after-fine.swift @@ -6,42 +6,42 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-provides-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND-DAG: Handled other.swift // CHECK-SECOND-DAG: Handled main.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/one-way-provides-after-fine/* %t // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-provides-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // RUN: touch -t 201401240008 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-NOT: Handled other.swift // CHECK-THIRD: Handled main.swift diff --git a/test/Driver/PrivateDependencies/one-way-provides-before-fine.swift b/test/Driver/PrivateDependencies/one-way-provides-before-fine.swift index 1b45170789187..5b1951b6549a3 100644 --- a/test/Driver/PrivateDependencies/one-way-provides-before-fine.swift +++ b/test/Driver/PrivateDependencies/one-way-provides-before-fine.swift @@ -6,24 +6,24 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-provides-before-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // CHECK-FIRST-NOT: warning // CHECK-FIRST-NOT: Handled // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s // CHECK-SECOND: Handled main.swift // CHECK-SECOND: Handled other.swift // RUN: touch -t 201401240007 %t/other.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s // CHECK-THIRD-NOT: Handled main.swift // CHECK-THIRD: Handled other.swift @@ -34,18 +34,18 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/one-way-provides-before-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: touch -t 201401240006 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // RUN: touch -t 201401240007 %t/main.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s // CHECK-FOURTH-NOT: Handled other.swift // CHECK-FOURTH: Handled main.swift diff --git a/test/Driver/PrivateDependencies/one-way-while-editing-fine.swift b/test/Driver/PrivateDependencies/one-way-while-editing-fine.swift index 0c7f1183992b8..2b7d04de643aa 100644 --- a/test/Driver/PrivateDependencies/one-way-while-editing-fine.swift +++ b/test/Driver/PrivateDependencies/one-way-while-editing-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/one-way-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/modify-non-primary-files.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/modify-non-primary-files.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s // CHECK: Handled main.swift // CHECK: Handled other.swift @@ -12,14 +12,14 @@ // CHECK: error: input file 'other.swift' was modified during the build // CHECK-NOT: error -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-RECOVER %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-RECOVER %s // CHECK-RECOVER: Handled main.swift // CHECK-RECOVER: Handled other.swift // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/modify-non-primary-files.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REVERSED %s +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/modify-non-primary-files.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REVERSED %s // CHECK-REVERSED: Handled other.swift // CHECK-REVERSED: Handled main.swift @@ -27,7 +27,7 @@ // CHECK-REVERSED: error: input file 'main.swift' was modified during the build // CHECK-REVERSED-NOT: error -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REVERSED-RECOVER %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REVERSED-RECOVER %s // CHECK-REVERSED-RECOVER-NOT: Handled other.swift // CHECK-REVERSED-RECOVER: Handled main.swift diff --git a/test/Driver/PrivateDependencies/only-skip-once.swift b/test/Driver/PrivateDependencies/only-skip-once.swift index 32909c35f2d90..2e08f1645cbd0 100644 --- a/test/Driver/PrivateDependencies/only-skip-once.swift +++ b/test/Driver/PrivateDependencies/only-skip-once.swift @@ -1,10 +1,10 @@ -// XFAIL: linux +// XFAIL: linux, openbsd // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/only-skip-once/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %target-swiftc_driver -driver-show-job-lifecycle -output-file-map %t/output-file-map.json -incremental -experimental-private-intransitive-dependencies main.swift file1.swift file2.swift -j1 2>%t/stderr.txt | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %target-swiftc_driver -driver-show-job-lifecycle -output-file-map %t/output-file-map.json -incremental -enable-direct-intramodule-dependencies main.swift file1.swift file2.swift -j1 2>%t/stderr.txt | %FileCheck -check-prefix=CHECK-INITIAL %s // CHECK-INITIAL: Job finished: {compile: main.o <= main.swift} // CHECK-INITIAL: Job finished: {compile: file1.o <= file1.swift} @@ -12,7 +12,7 @@ // CHECK-INITIAL: Job finished: {link: main <= main.o file1.o file2.o} // RUN: touch -t 201401240006 %t/file2.swift -// RUN: cd %t && %target-swiftc_driver -driver-show-job-lifecycle -output-file-map %t/output-file-map.json -incremental -experimental-private-intransitive-dependencies main.swift file1.swift file2.swift -j1 2>%t/stderr.txt | %FileCheck -check-prefix=CHECK-REBUILD %s +// RUN: cd %t && %target-swiftc_driver -driver-show-job-lifecycle -output-file-map %t/output-file-map.json -incremental -enable-direct-intramodule-dependencies main.swift file1.swift file2.swift -j1 2>%t/stderr.txt | %FileCheck -check-prefix=CHECK-REBUILD %s // We should skip the main and file1 rebuilds here, but we should only note skipping them _once_ // CHECK-REBUILD: Job finished: {compile: file2.o <= file2.swift} diff --git a/test/Driver/PrivateDependencies/private-after-fine.swift b/test/Driver/PrivateDependencies/private-after-fine.swift index 27b4b80e4f28c..a9fd575eedfb4 100644 --- a/test/Driver/PrivateDependencies/private-after-fine.swift +++ b/test/Driver/PrivateDependencies/private-after-fine.swift @@ -6,18 +6,18 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/private-after-fine/*.swiftdeps %t -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s // CHECK-INITIAL-NOT: warning // CHECK-INITIAL-NOT: Handled // RUN: touch -t 201401240006 %t/a.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v > %t/a.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v > %t/a.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-A %s < %t/a.txt // RUN: %FileCheck -check-prefix=CHECK-A-NEG %s < %t/a.txt @@ -35,13 +35,13 @@ // RUN: touch -t 201401240005 %t/*.swift // Generate the build record... -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v // ...then reset the .swiftdeps files. // RUN: cp -r %S/Inputs/private-after-fine/*.swiftdeps %t // RUN: touch -t 201401240006 %t/f.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v > %t/f.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v > %t/f.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-F %s < %t/f.txt // RUN: %FileCheck -check-prefix=CHECK-F-NEG %s < %t/f.txt diff --git a/test/Driver/PrivateDependencies/private-fine.swift b/test/Driver/PrivateDependencies/private-fine.swift index 9d0234d2a02a7..90a46a7fdf288 100644 --- a/test/Driver/PrivateDependencies/private-fine.swift +++ b/test/Driver/PrivateDependencies/private-fine.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/private-fine/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s // CHECK-INITIAL-NOT: warning // CHECK-INITIAL: Handled a.swift @@ -14,7 +14,7 @@ // CHECK-INITIAL: Handled e.swift // RUN: touch -t 201401240006 %t/a.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/a.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/a.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-A %s < %t/a.txt // RUN: %FileCheck -check-prefix=CHECK-A-NEG %s < %t/a.txt @@ -25,7 +25,7 @@ // CHECK-A-NEG-NOT: Handled e.swift // RUN: touch -t 201401240006 %t/b.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/b.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/b.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-B %s < %t/b.txt // RUN: %FileCheck -check-prefix=CHECK-B-NEG %s < %t/b.txt @@ -36,7 +36,7 @@ // CHECK-B-NEG-NOT: Handled e.swift // RUN: touch -t 201401240006 %t/c.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/c.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/c.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-C %s < %t/c.txt // RUN: %FileCheck -check-prefix=CHECK-C-NEG %s < %t/c.txt @@ -47,7 +47,7 @@ // CHECK-C-NEG-NOT: Handled e.swift // RUN: touch -t 201401240006 %t/d.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/d.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/d.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-D %s < %t/d.txt // RUN: %FileCheck -check-prefix=CHECK-D-NEG %s < %t/d.txt @@ -58,7 +58,7 @@ // CHECK-D-NEG-NOT: Handled e.swift // RUN: touch -t 201401240006 %t/e.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/e.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/e.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-E %s < %t/e.txt // RUN: %FileCheck -check-prefix=CHECK-E-NEG %s < %t/e.txt @@ -75,7 +75,7 @@ // CHECK-E-NEG-NOT: Handled b.swift // RUN: touch -t 201401240007 %t/a.swift %t/e.swift -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -experimental-private-intransitive-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/ae.txt 2>&1 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-direct-intramodule-dependencies ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/ae.txt 2>&1 // RUN: %FileCheck -check-prefix=CHECK-AE %s < %t/ae.txt // RUN: %FileCheck -check-prefix=CHECK-AE-NEG %s < %t/ae.txt diff --git a/test/Driver/PrivateDependencies/whole-module-build-record.swift b/test/Driver/PrivateDependencies/whole-module-build-record.swift index 61e67ea924945..fbe76d0ff23dd 100644 --- a/test/Driver/PrivateDependencies/whole-module-build-record.swift +++ b/test/Driver/PrivateDependencies/whole-module-build-record.swift @@ -4,7 +4,7 @@ // RUN: cp -r %S/Inputs/one-way/* %t // RUN: touch -t 201401240005 %t/* -// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/fake-build-whole-module.py" -output-file-map %t/output.json -whole-module-optimization -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/fake-build-whole-module.py" -output-file-map %t/output.json -whole-module-optimization -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s // RUN: %FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps // CHECK-FIRST-NOT: warning @@ -15,6 +15,6 @@ // RUN: touch -t 201401240006 %t/other.swift -// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/../Inputs/fail.py" -output-file-map %t/output.json -whole-module-optimization -experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/../Inputs/fail.py" -output-file-map %t/output.json -whole-module-optimization -enable-direct-intramodule-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 // Just don't crash. diff --git a/test/Driver/createCompilerInvocation.swift b/test/Driver/createCompilerInvocation.swift index 0151cd7ea6cfa..1f9bec4fe9c3a 100644 --- a/test/Driver/createCompilerInvocation.swift +++ b/test/Driver/createCompilerInvocation.swift @@ -7,3 +7,36 @@ // CHECK-FAIL: error: unable to create a CompilerInvocation // CHECK-NOWARN-NOT: warning + +// RUN: %swift-ide-test_plain -test-createCompilerInvocation \ +// RUN: -module-name foo -emit-module -emit-module-path %t/foo.swiftmodule -emit-objc-header -emit-objc-header-path %t/foo.h -enable-library-evolution -emit-module-interface -emit-module-interface-path %t/foo.swiftinterface -emit-library -emit-tbd -emit-tbd-path %t/foo.tbd -emit-dependencies -serialize-diagnostics %s \ +// RUN: 2>&1 | %FileCheck %s --check-prefix=NORMAL_ARGS --implicit-check-not="error: " +// NORMAL_ARGS: Frontend Arguments BEGIN +// NORMAL_ARGS-DAG: -o{{$}} +// NORMAL_ARGS-DAG: foo-{{[a-z0-9]+}}.o +// NORMAL_ARGS-DAG: -c{{$}} +// NORMAL_ARGS-DAG: -module-name +// NORMAL_ARGS-DAG: -emit-module-path +// NORMAL_ARGS-DAG: -emit-module-doc-path +// NORMAL_ARGS-DAG: -emit-module-source-info-path +// NORMAL_ARGS-DAG: -emit-module-interface-path +// NORMAL_ARGS-DAG: -emit-objc-header-path +// NORMAL_ARGS-DAG: -emit-tbd-path +// NORMAL_ARGS-DAG: -serialize-diagnostics-path +// NORMAL_ARGS: Frontend Arguments END + +// RUN: %swift-ide-test_plain -test-createCompilerInvocation -force-no-outputs \ +// RUN: -module-name foo -emit-module -emit-module-path %t/foo.swiftmodule -emit-objc-header -emit-objc-header-path %t/foo.h -enable-library-evolution -emit-module-interface -emit-module-interface-path %t/foo.swiftinterface -emit-library -emit-tbd -emit-tbd-path %t/foo.tbd -emit-dependencies -serialize-diagnostics %s \ +// RUN: 2>&1 > %t.nooutput_args +// RUN: %FileCheck %s --check-prefix=NOOUTPUT_ARGS --implicit-check-not="error: " < %t.nooutput_args +// RUN: %FileCheck %s --check-prefix=NOOUTPUT_ARGS_NEG --implicit-check-not="error: " < %t.nooutput_args +// NOOUTPUT_ARGS_NEG-NOT: -o{{$}} +// NOOUTPUT_ARGS_NEG-NOT: foo-{{[a-z0-9]+}}.o +// NOOUTPUT_ARGS_NEG-NOT: -o{{$}} +// NOOUTPUT_ARGS_NEG-NOT: -emit +// NOOUTPUT_ARGS_NEG-NOT: -serialize-diagnostics + +// NOOUTPUT_ARGS: Frontend Arguments BEGIN +// NOOUTPUT_ARGS-DAG: -typecheck +// NOOUTPUT_ARGS-DAG: -module-name +// NOOUTPUT_ARGS: Frontend Arguments END diff --git a/test/Driver/parseable_output.swift b/test/Driver/parseable_output.swift index a22cd53d22aac..1c3f02bb54963 100644 --- a/test/Driver/parseable_output.swift +++ b/test/Driver/parseable_output.swift @@ -1,6 +1,6 @@ // RUN: %swiftc_driver_plain -emit-executable %s -o %t.out -emit-module -emit-module-path %t.swiftmodule -emit-objc-header-path %t.h -serialize-diagnostics -emit-dependencies -parseable-output -driver-skip-execution 2>&1 | %FileCheck %s -// XFAIL: freebsd, linux +// XFAIL: freebsd, openbsd, linux // CHECK: {{[1-9][0-9]*}} // CHECK-NEXT: { diff --git a/test/Driver/parseable_output_unicode.swift b/test/Driver/parseable_output_unicode.swift index 2e3b1d9f6398a..fba7dbbb05d84 100644 --- a/test/Driver/parseable_output_unicode.swift +++ b/test/Driver/parseable_output_unicode.swift @@ -2,7 +2,7 @@ // RUN: cat "%S/Inputs/unicode.txt" >> %t.rsp // RUN: %swiftc_driver_plain -emit-executable @%t.rsp -o %t.out -emit-module -emit-module-path %t.swiftmodule -emit-objc-header-path %t.h -serialize-diagnostics -emit-dependencies -parseable-output -driver-skip-execution 2>&1 | %FileCheck %s -// XFAIL: freebsd, linux +// XFAIL: freebsd, openbsd, linux // CHECK: {{[1-9][0-9]*}} // CHECK-NEXT: { diff --git a/test/Driver/sdk-apple.swift b/test/Driver/sdk-apple.swift index 4de653c3ca0b6..228657231d4ea 100644 --- a/test/Driver/sdk-apple.swift +++ b/test/Driver/sdk-apple.swift @@ -1,4 +1,4 @@ -// XFAIL: freebsd, linux, windows +// XFAIL: freebsd, openbsd, linux, windows // Test SDK detection for immediate mode. // RUN: %empty-directory(%t) diff --git a/test/Frontend/Fingerprints/class-fingerprint.swift b/test/Frontend/Fingerprints/class-fingerprint.swift index 99c8bbeebbd30..48bcae8d5f0b2 100644 --- a/test/Frontend/Fingerprints/class-fingerprint.swift +++ b/test/Frontend/Fingerprints/class-fingerprint.swift @@ -16,7 +16,7 @@ // Seeing weird failure on CI, so set the mod times // RUN: touch -t 200101010101 %t/*.swift -// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1 +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1 // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps @@ -29,7 +29,7 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2 +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2 // Save for debugging: // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps @@ -53,7 +53,7 @@ // Seeing weird failure on CI, so set the mod times // RUN: touch -t 200101010101 %t/*.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3 // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps @@ -67,13 +67,8 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4 // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps -// RUN: %FileCheck -check-prefix=CHECK-MAINB-RECOMPILED %s < %t/output4 - -// CHECK-MAINB-RECOMPILED-NOT: Queuing because of dependencies discovered later: {compile: usesB.o <= usesB.swift} -// CHECK-MAINB-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesA.o <= usesA.swift} -// CHECK-MAINB-RECOMPILED-NOT: Queuing because of dependencies discovered later: {compile: usesB.o <= usesB.swift} - +// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output4 diff --git a/test/Frontend/Fingerprints/enum-fingerprint.swift b/test/Frontend/Fingerprints/enum-fingerprint.swift index 87564d0461242..9c851417a3423 100644 --- a/test/Frontend/Fingerprints/enum-fingerprint.swift +++ b/test/Frontend/Fingerprints/enum-fingerprint.swift @@ -16,7 +16,7 @@ // Seeing weird failure on CI, so set the mod times // RUN: touch -t 200101010101 %t/*.swift -// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1 +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1 // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps @@ -29,7 +29,7 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2 +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2 // Save for debugging: // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps @@ -53,7 +53,7 @@ // Seeing weird failure on CI, so set the mod times // RUN: touch -t 200101010101 %t/*.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3 // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps @@ -67,13 +67,8 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4 // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps -// RUN: %FileCheck -check-prefix=CHECK-MAINB-RECOMPILED %s < %t/output4 - -// CHECK-MAINB-RECOMPILED-NOT: Queuing because of dependencies discovered later: {compile: usesB.o <= usesB.swift} -// CHECK-MAINB-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesA.o <= usesA.swift} -// CHECK-MAINB-RECOMPILED-NOT: Queuing because of dependencies discovered later: {compile: usesB.o <= usesB.swift} - +// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output4 diff --git a/test/Frontend/Fingerprints/extension-adds-member.swift b/test/Frontend/Fingerprints/extension-adds-member.swift index 1bac527921a73..80344ee827c49 100644 --- a/test/Frontend/Fingerprints/extension-adds-member.swift +++ b/test/Frontend/Fingerprints/extension-adds-member.swift @@ -21,7 +21,7 @@ // RUN: touch -t 200101010101 %t/*.swift -// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output1 +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output1 // Change one type, but uses of all types get recompiled @@ -33,7 +33,7 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output2 +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output2 // This test checks for the status quo; it would be OK to be more conservative @@ -60,7 +60,7 @@ // Seeing weird failure on CI, so set the mod times // RUN: touch -t 200101010101 %t/*.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output3 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output3 // Change one type, only uses of that type get recompiled @@ -71,7 +71,7 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output4 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output4 // RUN: %FileCheck -check-prefix=CHECK-RECOMPILED-W %s < %t/output4 // RUN: %FileCheck -check-prefix=CHECK-NOT-RECOMPILED-W %s < %t/output4 diff --git a/test/Frontend/Fingerprints/protocol-fingerprint.swift b/test/Frontend/Fingerprints/protocol-fingerprint.swift index 4bf913339d776..25146291407b7 100644 --- a/test/Frontend/Fingerprints/protocol-fingerprint.swift +++ b/test/Frontend/Fingerprints/protocol-fingerprint.swift @@ -16,7 +16,7 @@ // Seeing weird failure on CI, so set the mod times // RUN: touch -t 200101010101 %t/*.swift -// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1 +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1 // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps @@ -29,7 +29,7 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2 +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2 // Save for debugging: // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps @@ -53,7 +53,7 @@ // Seeing weird failure on CI, so set the mod times // RUN: touch -t 200101010101 %t/*.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3 // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps @@ -67,13 +67,9 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4 // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps -// RUN: %FileCheck -check-prefix=CHECK-MAINB-RECOMPILED %s < %t/output4 - -// CHECK-MAINB-RECOMPILED-NOT: Queuing because of dependencies discovered later: {compile: usesB.o <= usesB.swift} -// CHECK-MAINB-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesA.o <= usesA.swift} -// CHECK-MAINB-RECOMPILED-NOT: Queuing because of dependencies discovered later: {compile: usesB.o <= usesB.swift} +// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output4 diff --git a/test/Frontend/Fingerprints/struct-fingerprint.swift b/test/Frontend/Fingerprints/struct-fingerprint.swift index cc6cfb28547a4..40de452e25aab 100644 --- a/test/Frontend/Fingerprints/struct-fingerprint.swift +++ b/test/Frontend/Fingerprints/struct-fingerprint.swift @@ -16,7 +16,7 @@ // Seeing weird failure on CI, so set the mod times // RUN: touch -t 200101010101 %t/*.swift -// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1 +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1 // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps @@ -29,7 +29,7 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2 +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2 // Save for debugging: // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps @@ -53,7 +53,7 @@ // Seeing weird failure on CI, so set the mod times // RUN: touch -t 200101010101 %t/*.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3 // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps @@ -67,13 +67,8 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4 // only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps -// RUN: %FileCheck -check-prefix=CHECK-MAINB-RECOMPILED %s < %t/output4 - -// CHECK-MAINB-RECOMPILED-NOT: Queuing because of dependencies discovered later: {compile: usesB.o <= usesB.swift} -// CHECK-MAINB-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesA.o <= usesA.swift} -// CHECK-MAINB-RECOMPILED-NOT: Queuing because of dependencies discovered later: {compile: usesB.o <= usesB.swift} - +// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output4 diff --git a/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/definesAB-after.swift b/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/definesAB-after.swift new file mode 100644 index 0000000000000..8070b0fb4f9ee --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/definesAB-after.swift @@ -0,0 +1,5 @@ +class A { + var x = 17 +} +class B { +} diff --git a/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/definesAB-before.swift b/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/definesAB-before.swift new file mode 100644 index 0000000000000..878a9dc917cb2 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/definesAB-before.swift @@ -0,0 +1,4 @@ +class A { +} +class B { +} diff --git a/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/main.swift b/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/main.swift new file mode 100644 index 0000000000000..8b137891791fe --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/main.swift @@ -0,0 +1 @@ + diff --git a/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/ofm.json b/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/ofm.json new file mode 100644 index 0000000000000..42d8972a2c390 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/ofm.json @@ -0,0 +1,22 @@ +{ + "main.swift": { + "object": "./main.o", + "swift-dependencies": "./main.swiftdeps" + }, + "definesAB.swift": { + "object": "./definesAB.o", + "swift-dependencies": "./definesAB.swiftdeps" + }, + "usesA.swift": { + "object": "./usesA.o", + "swift-dependencies": "./usesA.swiftdeps" + }, + "usesB.swift": { + "object": "./usesB.o", + "swift-dependencies": "./usesB.swiftdeps" + }, + "": { + "swift-dependencies": "./main~buildrecord.swiftdeps" + } +} + diff --git a/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/usesA.swift b/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/usesA.swift new file mode 100644 index 0000000000000..d947cb11b9830 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/usesA.swift @@ -0,0 +1 @@ +let a = A() diff --git a/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/usesB.swift b/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/usesB.swift new file mode 100644 index 0000000000000..ecff1d6a467fc --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/usesB.swift @@ -0,0 +1 @@ +let b = B() diff --git a/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/definesAB-after.swift b/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/definesAB-after.swift new file mode 100644 index 0000000000000..600087c46ac79 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/definesAB-after.swift @@ -0,0 +1,7 @@ +enum A { + case a1 + var pi: Int {3} +} +enum B { + case a1 +} diff --git a/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/definesAB-before.swift b/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/definesAB-before.swift new file mode 100644 index 0000000000000..6fd9bc435e51b --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/definesAB-before.swift @@ -0,0 +1,6 @@ +enum A { + case a1 +} +enum B { + case a1 +} diff --git a/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/main.swift b/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/main.swift new file mode 100644 index 0000000000000..8b137891791fe --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/main.swift @@ -0,0 +1 @@ + diff --git a/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/ofm.json b/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/ofm.json new file mode 100644 index 0000000000000..42d8972a2c390 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/ofm.json @@ -0,0 +1,22 @@ +{ + "main.swift": { + "object": "./main.o", + "swift-dependencies": "./main.swiftdeps" + }, + "definesAB.swift": { + "object": "./definesAB.o", + "swift-dependencies": "./definesAB.swiftdeps" + }, + "usesA.swift": { + "object": "./usesA.o", + "swift-dependencies": "./usesA.swiftdeps" + }, + "usesB.swift": { + "object": "./usesB.o", + "swift-dependencies": "./usesB.swiftdeps" + }, + "": { + "swift-dependencies": "./main~buildrecord.swiftdeps" + } +} + diff --git a/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/usesA.swift b/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/usesA.swift new file mode 100644 index 0000000000000..4e498195442e0 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/usesA.swift @@ -0,0 +1 @@ +let a = A.a1 diff --git a/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/usesB.swift b/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/usesB.swift new file mode 100644 index 0000000000000..99d8c6f8ce72b --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/usesB.swift @@ -0,0 +1 @@ +let b = B.a1 diff --git a/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/definesAB-after.swift b/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/definesAB-after.swift new file mode 100644 index 0000000000000..1ef4d58a82e7d --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/definesAB-after.swift @@ -0,0 +1,9 @@ +struct A { +} +struct B { +} +extension A { + var x: Int {17} +} +extension B { +} diff --git a/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/definesAB-before.swift b/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/definesAB-before.swift new file mode 100644 index 0000000000000..9a8e36dc90d98 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/definesAB-before.swift @@ -0,0 +1,8 @@ +struct A { +} +struct B { +} +extension A { +} +extension B { +} diff --git a/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/main.swift b/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/main.swift new file mode 100644 index 0000000000000..8b137891791fe --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/main.swift @@ -0,0 +1 @@ + diff --git a/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/ofm.json b/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/ofm.json new file mode 100644 index 0000000000000..42d8972a2c390 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/ofm.json @@ -0,0 +1,22 @@ +{ + "main.swift": { + "object": "./main.o", + "swift-dependencies": "./main.swiftdeps" + }, + "definesAB.swift": { + "object": "./definesAB.o", + "swift-dependencies": "./definesAB.swiftdeps" + }, + "usesA.swift": { + "object": "./usesA.o", + "swift-dependencies": "./usesA.swiftdeps" + }, + "usesB.swift": { + "object": "./usesB.o", + "swift-dependencies": "./usesB.swiftdeps" + }, + "": { + "swift-dependencies": "./main~buildrecord.swiftdeps" + } +} + diff --git a/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/usesA.swift b/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/usesA.swift new file mode 100644 index 0000000000000..d947cb11b9830 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/usesA.swift @@ -0,0 +1 @@ +let a = A() diff --git a/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/usesB.swift b/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/usesB.swift new file mode 100644 index 0000000000000..ecff1d6a467fc --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/usesB.swift @@ -0,0 +1 @@ +let b = B() diff --git a/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/definesAB-after.swift b/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/definesAB-after.swift new file mode 100644 index 0000000000000..572874907e7f4 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/definesAB-after.swift @@ -0,0 +1,5 @@ +protocol A { + var x: Int {get} +} +protocol B { +} diff --git a/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/definesAB-before.swift b/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/definesAB-before.swift new file mode 100644 index 0000000000000..4d9f0e46ac19a --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/definesAB-before.swift @@ -0,0 +1,4 @@ +protocol A { +} +protocol B { +} diff --git a/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/main.swift b/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/main.swift new file mode 100644 index 0000000000000..8b137891791fe --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/main.swift @@ -0,0 +1 @@ + diff --git a/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/ofm.json b/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/ofm.json new file mode 100644 index 0000000000000..42d8972a2c390 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/ofm.json @@ -0,0 +1,22 @@ +{ + "main.swift": { + "object": "./main.o", + "swift-dependencies": "./main.swiftdeps" + }, + "definesAB.swift": { + "object": "./definesAB.o", + "swift-dependencies": "./definesAB.swiftdeps" + }, + "usesA.swift": { + "object": "./usesA.o", + "swift-dependencies": "./usesA.swiftdeps" + }, + "usesB.swift": { + "object": "./usesB.o", + "swift-dependencies": "./usesB.swiftdeps" + }, + "": { + "swift-dependencies": "./main~buildrecord.swiftdeps" + } +} + diff --git a/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/usesA.swift b/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/usesA.swift new file mode 100644 index 0000000000000..83c36da794bac --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/usesA.swift @@ -0,0 +1,3 @@ +struct SA: A { + var x = 3 +} diff --git a/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/usesB.swift b/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/usesB.swift new file mode 100644 index 0000000000000..f3a3076b7ac11 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/usesB.swift @@ -0,0 +1,2 @@ +struct SB: B { +} diff --git a/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/definesAB-after.swift b/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/definesAB-after.swift new file mode 100644 index 0000000000000..cd62af38d1cbe --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/definesAB-after.swift @@ -0,0 +1,5 @@ +struct A { + var x = 17 +} +struct B { +} diff --git a/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/definesAB-before.swift b/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/definesAB-before.swift new file mode 100644 index 0000000000000..c085264d20767 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/definesAB-before.swift @@ -0,0 +1,4 @@ +struct A { +} +struct B { +} diff --git a/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/main.swift b/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/main.swift new file mode 100644 index 0000000000000..8b137891791fe --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/main.swift @@ -0,0 +1 @@ + diff --git a/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/ofm.json b/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/ofm.json new file mode 100644 index 0000000000000..42d8972a2c390 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/ofm.json @@ -0,0 +1,22 @@ +{ + "main.swift": { + "object": "./main.o", + "swift-dependencies": "./main.swiftdeps" + }, + "definesAB.swift": { + "object": "./definesAB.o", + "swift-dependencies": "./definesAB.swiftdeps" + }, + "usesA.swift": { + "object": "./usesA.o", + "swift-dependencies": "./usesA.swiftdeps" + }, + "usesB.swift": { + "object": "./usesB.o", + "swift-dependencies": "./usesB.swiftdeps" + }, + "": { + "swift-dependencies": "./main~buildrecord.swiftdeps" + } +} + diff --git a/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/usesA.swift b/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/usesA.swift new file mode 100644 index 0000000000000..d947cb11b9830 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/usesA.swift @@ -0,0 +1 @@ +let a = A() diff --git a/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/usesB.swift b/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/usesB.swift new file mode 100644 index 0000000000000..ecff1d6a467fc --- /dev/null +++ b/test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/usesB.swift @@ -0,0 +1 @@ +let b = B() diff --git a/test/Frontend/PrivateFingerprints/class-fingerprint.swift b/test/Frontend/PrivateFingerprints/class-fingerprint.swift new file mode 100644 index 0000000000000..b52c7809df951 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/class-fingerprint.swift @@ -0,0 +1,73 @@ + +// Test per-type-body fingerprints for classes +// + +// ============================================================================= +// Without the fingerprints +// ============================================================================= + +// Establish status quo + + +// RUN: %empty-directory(%t) +// RUN: cp %S/Inputs/class-fingerprint/* %t +// RUN: cp %t/definesAB{-before,}.swift + +// Seeing weird failure on CI, so set the mod times +// RUN: touch -t 200101010101 %t/*.swift + +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1 + +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps + +// Change one type, but uses of all types get recompiled + +// RUN: cp %t/definesAB{-after,}.swift + +// Seeing weird failure on CI, so ensure that definesAB.swift is newer +// RUN: touch -t 200201010101 %t/* +// RUN: touch -t 200101010101 %t/*.swift +// RUN: touch -t 200301010101 %t/definesAB.swift + +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2 + +// Save for debugging: +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps + +// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output2 + +// CHECK-MAINAB-RECOMPILED: Queuing (initial): {compile: definesAB.o <= definesAB.swift} +// CHECK-MAINAB-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesA.o <= usesA.swift} + +// ============================================================================= +// With the fingerprints +// ============================================================================= + +// Establish status quo + +// RUN: %empty-directory(%t) +// RUN: cp %S/Inputs/class-fingerprint/* %t +// RUN: cp %t/definesAB{-before,}.swift + +// Seeing weird failure on CI, so set the mod times +// RUN: touch -t 200101010101 %t/*.swift + +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3 + +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps + + +// Change one type, only uses of that type get recompiled + +// RUN: cp %t/definesAB{-after,}.swift + +// Seeing weird failure on CI, so ensure that definesAB.swift is newer +// RUN: touch -t 200201010101 %t/* +// RUN: touch -t 200101010101 %t/*.swift +// RUN: touch -t 200301010101 %t/definesAB.swift + +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4 + +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps + +// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output4 diff --git a/test/Frontend/PrivateFingerprints/enum-fingerprint.swift b/test/Frontend/PrivateFingerprints/enum-fingerprint.swift new file mode 100644 index 0000000000000..44747dee30b41 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/enum-fingerprint.swift @@ -0,0 +1,73 @@ + +// Test per-type-body fingerprints for enums +// + +// ============================================================================= +// Without the fingerprints +// ============================================================================= + +// Establish status quo + + +// RUN: %empty-directory(%t) +// RUN: cp %S/Inputs/enum-fingerprint/* %t +// RUN: cp %t/definesAB{-before,}.swift + +// Seeing weird failure on CI, so set the mod times +// RUN: touch -t 200101010101 %t/*.swift + +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1 + +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps + +// Change one type, but uses of all types get recompiled + +// RUN: cp %t/definesAB{-after,}.swift + +// Seeing weird failure on CI, so ensure that definesAB.swift is newer +// RUN: touch -t 200201010101 %t/* +// RUN: touch -t 200101010101 %t/*.swift +// RUN: touch -t 200301010101 %t/definesAB.swift + +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2 + +// Save for debugging: +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps + +// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output2 + +// CHECK-MAINAB-RECOMPILED: Queuing (initial): {compile: definesAB.o <= definesAB.swift} +// CHECK-MAINAB-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesA.o <= usesA.swift} + +// ============================================================================= +// With the fingerprints +// ============================================================================= + +// Establish status quo + +// RUN: %empty-directory(%t) +// RUN: cp %S/Inputs/enum-fingerprint/* %t +// RUN: cp %t/definesAB{-before,}.swift + +// Seeing weird failure on CI, so set the mod times +// RUN: touch -t 200101010101 %t/*.swift + +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3 + +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps + + +// Change one type, only uses of that type get recompiled + +// RUN: cp %t/definesAB{-after,}.swift + +// Seeing weird failure on CI, so ensure that definesAB.swift is newer +// RUN: touch -t 200201010101 %t/* +// RUN: touch -t 200101010101 %t/*.swift +// RUN: touch -t 200301010101 %t/definesAB.swift + +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4 + +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps + +// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output4 diff --git a/test/Frontend/PrivateFingerprints/extension-adds-member.swift b/test/Frontend/PrivateFingerprints/extension-adds-member.swift new file mode 100644 index 0000000000000..1bac527921a73 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/extension-adds-member.swift @@ -0,0 +1,83 @@ + +// Test per-type-body fingerprints using simple extensions +// +// If the parser is allowed to use a body fingerprint for an extension +// this test will fail because usesA.swift won't be recompiled for the +// last step. + + +// ============================================================================= +// Without the fingerprints +// ============================================================================= + +// Establish status quo + + +// RUN: %empty-directory(%t) +// RUN: cp %S/Inputs/extension-adds-member/* %t +// RUN: cp %t/definesAB{-before,}.swift + +// Seeing weird failure on CI, so set the mod times +// RUN: touch -t 200101010101 %t/*.swift + + +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output1 + + +// Change one type, but uses of all types get recompiled + +// RUN: cp %t/definesAB{-after,}.swift + +// Seeing weird failure on CI, so ensure that definesAB.swift is newer +// RUN: touch -t 200201010101 %t/* +// RUN: touch -t 200101010101 %t/*.swift +// RUN: touch -t 200301010101 %t/definesAB.swift + +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output2 + + +// This test checks for the status quo; it would be OK to be more conservative + +// RUN: %FileCheck -check-prefix=CHECK-RECOMPILED-WO %s < %t/output2 +// CHECK-RECOMPILED-WO: {compile: definesAB.o <= definesAB.swift} +// CHECK-RECOMPILED-WO: {compile: usesA.o <= usesA.swift} +// CHECK-RECOMPILED-WO: {compile: usesB.o <= usesB.swift} + +// RUN: %FileCheck -check-prefix=CHECK-NOT-RECOMPILED-WO %s < %t/output2 +// CHECK-NOT-RECOMPILED-WO-NOT: {compile: main.o <= main.swift} + + +// ============================================================================= +// With the fingerprints +// ============================================================================= + +// Establish status quo + +// RUN: %empty-directory(%t) +// RUN: cp %S/Inputs/extension-adds-member/* %t +// RUN: cp %t/definesAB{-before,}.swift + +// Seeing weird failure on CI, so set the mod times +// RUN: touch -t 200101010101 %t/*.swift + +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output3 + +// Change one type, only uses of that type get recompiled + +// RUN: cp %t/definesAB{-after,}.swift + +// Seeing weird failure on CI, so ensure that definesAB.swift is newer +// RUN: touch -t 200201010101 %t/* +// RUN: touch -t 200101010101 %t/*.swift +// RUN: touch -t 200301010101 %t/definesAB.swift + +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output4 + +// RUN: %FileCheck -check-prefix=CHECK-RECOMPILED-W %s < %t/output4 +// RUN: %FileCheck -check-prefix=CHECK-NOT-RECOMPILED-W %s < %t/output4 + +// CHECK-RECOMPILED-W: {compile: definesAB.o <= definesAB.swift} +// CHECK-RECOMPILED-W: {compile: usesA.o <= usesA.swift} + + +// CHECK-NOT-RECOMPILED-W-NOT: {compile: main.o <= main.swift} diff --git a/test/Frontend/PrivateFingerprints/protocol-fingerprint.swift b/test/Frontend/PrivateFingerprints/protocol-fingerprint.swift new file mode 100644 index 0000000000000..b2a54125f0444 --- /dev/null +++ b/test/Frontend/PrivateFingerprints/protocol-fingerprint.swift @@ -0,0 +1,74 @@ + +// Test per-type-body fingerprints: the protocol case. +// + +// ============================================================================= +// Without the fingerprints +// ============================================================================= + +// Establish status quo + + +// RUN: %empty-directory(%t) +// RUN: cp %S/Inputs/protocol-fingerprint/* %t +// RUN: cp %t/definesAB{-before,}.swift + +// Seeing weird failure on CI, so set the mod times +// RUN: touch -t 200101010101 %t/*.swift + +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1 + +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps + +// Change one type, but uses of all types get recompiled + +// RUN: cp %t/definesAB{-after,}.swift + +// Seeing weird failure on CI, so ensure that definesAB.swift is newer +// RUN: touch -t 200201010101 %t/* +// RUN: touch -t 200101010101 %t/*.swift +// RUN: touch -t 200301010101 %t/definesAB.swift + +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2 + +// Save for debugging: +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps + +// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output2 + +// CHECK-MAINAB-RECOMPILED: Queuing (initial): {compile: definesAB.o <= definesAB.swift} +// CHECK-MAINAB-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesA.o <= usesA.swift} + +// ============================================================================= +// With the fingerprints +// ============================================================================= + +// Establish status quo + +// RUN: %empty-directory(%t) +// RUN: cp %S/Inputs/protocol-fingerprint/* %t +// RUN: cp %t/definesAB{-before,}.swift + +// Seeing weird failure on CI, so set the mod times +// RUN: touch -t 200101010101 %t/*.swift + +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3 + +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps + + +// Change one type, only uses of that type get recompiled + +// RUN: cp %t/definesAB{-after,}.swift + +// Seeing weird failure on CI, so ensure that definesAB.swift is newer +// RUN: touch -t 200201010101 %t/* +// RUN: touch -t 200101010101 %t/*.swift +// RUN: touch -t 200301010101 %t/definesAB.swift + +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4 + +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps + +// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output4 + diff --git a/test/Frontend/PrivateFingerprints/struct-fingerprint.swift b/test/Frontend/PrivateFingerprints/struct-fingerprint.swift new file mode 100644 index 0000000000000..ea9e7a153956e --- /dev/null +++ b/test/Frontend/PrivateFingerprints/struct-fingerprint.swift @@ -0,0 +1,73 @@ + +// Test per-type-body fingerprints for structs +// + +// ============================================================================= +// Without the fingerprints +// ============================================================================= + +// Establish status quo + + +// RUN: %empty-directory(%t) +// RUN: cp %S/Inputs/struct-fingerprint/* %t +// RUN: cp %t/definesAB{-before,}.swift + +// Seeing weird failure on CI, so set the mod times +// RUN: touch -t 200101010101 %t/*.swift + +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1 + +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps + +// Change one type, but uses of all types get recompiled + +// RUN: cp %t/definesAB{-after,}.swift + +// Seeing weird failure on CI, so ensure that definesAB.swift is newer +// RUN: touch -t 200201010101 %t/* +// RUN: touch -t 200101010101 %t/*.swift +// RUN: touch -t 200301010101 %t/definesAB.swift + +// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2 + +// Save for debugging: +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps + +// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output2 + +// CHECK-MAINAB-RECOMPILED: Queuing (initial): {compile: definesAB.o <= definesAB.swift} +// CHECK-MAINAB-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesA.o <= usesA.swift} + +// ============================================================================= +// With the fingerprints +// ============================================================================= + +// Establish status quo + +// RUN: %empty-directory(%t) +// RUN: cp %S/Inputs/struct-fingerprint/* %t +// RUN: cp %t/definesAB{-before,}.swift + +// Seeing weird failure on CI, so set the mod times +// RUN: touch -t 200101010101 %t/*.swift + +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3 + +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps + + +// Change one type, only uses of that type get recompiled + +// RUN: cp %t/definesAB{-after,}.swift + +// Seeing weird failure on CI, so ensure that definesAB.swift is newer +// RUN: touch -t 200201010101 %t/* +// RUN: touch -t 200101010101 %t/*.swift +// RUN: touch -t 200301010101 %t/definesAB.swift + +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4 + +// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps + +// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output4 diff --git a/test/Frontend/dependencies-fine.swift b/test/Frontend/dependencies-fine.swift index 883ee07ebbcc8..f7256e925cfb0 100644 --- a/test/Frontend/dependencies-fine.swift +++ b/test/Frontend/dependencies-fine.swift @@ -6,12 +6,12 @@ // RUN: %target-swift-frontend -emit-dependencies-path - -resolve-imports "%S/../Inputs/empty file.swift" | %FileCheck -check-prefix=CHECK-BASIC %s // RUN: %target-swift-frontend -emit-reference-dependencies-path - -typecheck -primary-file "%S/../Inputs/empty file.swift" > %t.swiftdeps -// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-BASIC-YAML %s <%t-processed.swiftdeps // RUN: %target-swift-frontend -emit-dependencies-path %t.d -emit-reference-dependencies-path %t.swiftdeps -typecheck -primary-file "%S/../Inputs/empty file.swift" // RUN: %FileCheck -check-prefix=CHECK-BASIC %s < %t.d -// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-BASIC-YAML %s < %t-processed.swiftdeps // CHECK-BASIC-LABEL: - : @@ -48,7 +48,7 @@ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -disable-objc-attr-requires-foundation-module -import-objc-header %S/Inputs/dependencies/extra-header.h -track-system-dependencies -emit-dependencies-path - -resolve-imports %s | %FileCheck -check-prefix=CHECK-IMPORT-TRACK-SYSTEM %s // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -disable-objc-attr-requires-foundation-module -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-reference-dependencies-path %t.swiftdeps -typecheck -primary-file %s -// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-IMPORT-YAML %s <%t-processed.swiftdeps // CHECK-IMPORT-LABEL: - : diff --git a/test/Frontend/dependencies-preservation-fine.swift b/test/Frontend/dependencies-preservation-fine.swift index 03f88fc1c2bf6..4e2a29865a789 100644 --- a/test/Frontend/dependencies-preservation-fine.swift +++ b/test/Frontend/dependencies-preservation-fine.swift @@ -11,7 +11,7 @@ // First, produce the dependency files and verify their contents. // RUN: %target-swift-frontend -emit-reference-dependencies-path %t.swiftdeps -typecheck -primary-file "%S/../Inputs/empty file.swift" -// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK %s < %t-processed.swiftdeps // CHECK-NOT: topLevel{{.*}}EmptyStruct{{.*}}true @@ -22,7 +22,7 @@ // file. // RUN: %target-swift-frontend -emit-reference-dependencies-path %t.swiftdeps -typecheck -primary-file %S/../Inputs/global_resilience.swift // RUN: %FileCheck -check-prefix=CHECK %s < %t.swiftdeps~ -// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-OVERWRITTEN %s < %t-processed.swiftdeps // CHECK-OVERWRITTEN:topLevel{{.*}}EmptyStruct{{.*}}true diff --git a/test/Frontend/embed-bitcode.swift b/test/Frontend/embed-bitcode.swift index 6ae5fcb85bbc8..9f59002b56109 100644 --- a/test/Frontend/embed-bitcode.swift +++ b/test/Frontend/embed-bitcode.swift @@ -8,6 +8,7 @@ // UNSUPPORTED: OS=linux-gnu // UNSUPPORTED: OS=linux-gnueabihf // UNSUPPORTED: OS=freebsd +// UNSUPPORTED: OS=openbsd // UNSUPPORTED: OS=windows-msvc // MARKER: Contents of (__LLVM,__bitcode) section diff --git a/test/IDE/complete_enum_elements.swift b/test/IDE/complete_enum_elements.swift index 01a5138abee84..7f4097efb0a9c 100644 --- a/test/IDE/complete_enum_elements.swift +++ b/test/IDE/complete_enum_elements.swift @@ -29,7 +29,7 @@ // RUN: %FileCheck %s -check-prefix=FOO_ENUM_DOT_ELEMENTS < %t.enum.txt // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_SW_WITH_QUAL_1 > %t.enum.txt -// RUN: %FileCheck %s -check-prefix=FOO_ENUM_DOT < %t.enum.txt +// RUN: %FileCheck %s -check-prefix=FOO_ENUM_DOT_CONTEXT < %t.enum.txt // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_SW_EXPR_ERROR_1 > %t.enum.txt // RUN: %FileCheck %s -check-prefix=FOO_ENUM_DOT < %t.enum.txt @@ -116,6 +116,17 @@ enum FooEnum: CaseIterable { // FOO_ENUM_DOT-NEXT: Decl[StaticVar]/CurrNominal: allCases[#[FooEnum]#]{{; name=.+$}} // FOO_ENUM_DOT-NEXT: End completions +// FOO_ENUM_DOT_CONTEXT: Begin completions +// FOO_ENUM_DOT_CONTEXT-NEXT: Keyword[self]/CurrNominal: self[#FooEnum.Type#]; name=self +// FOO_ENUM_DOT_CONTEXT-NEXT: Keyword/CurrNominal: Type[#FooEnum.Type#]; name=Type +// FOO_ENUM_DOT_CONTEXT-NEXT: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: Foo1[#FooEnum#]{{; name=.+$}} +// FOO_ENUM_DOT_CONTEXT-NEXT: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: Foo2[#FooEnum#]{{; name=.+$}} +// FOO_ENUM_DOT_CONTEXT-NEXT: Decl[StaticVar]/CurrNominal/TypeRelation[Identical]: alias1[#FooEnum#]{{; name=.+$}} +// FOO_ENUM_DOT_CONTEXT-NEXT: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): FooEnum#})[#(into: inout Hasher) -> Void#]{{; name=.+$}} +// FOO_ENUM_DOT_CONTEXT-NEXT: Decl[TypeAlias]/CurrNominal: AllCases[#[FooEnum]#]{{; name=.+$}} +// FOO_ENUM_DOT_CONTEXT-NEXT: Decl[StaticVar]/CurrNominal: allCases[#[FooEnum]#]{{; name=.+$}} +// FOO_ENUM_DOT_CONTEXT-NEXT: End completions + // FOO_ENUM_DOT_INVALID: Begin completions // FOO_ENUM_DOT_INVALID-NEXT: Keyword[self]/CurrNominal: self[#FooEnum.Type#]; name=self // FOO_ENUM_DOT_INVALID-NEXT: Keyword/CurrNominal: Type[#FooEnum.Type#]; name=Type diff --git a/test/IDE/complete_rdar63965160.swift b/test/IDE/complete_rdar63965160.swift new file mode 100644 index 0000000000000..41dd721ffb8d6 --- /dev/null +++ b/test/IDE/complete_rdar63965160.swift @@ -0,0 +1,38 @@ +// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=STRINGLITERAL | %FileCheck %s +// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=NORMAL | %FileCheck %s + +protocol View {} + +@_functionBuilder +struct Builder { + static func buildBlock(_ c0: C0) -> C0 {} + static func buildBlock(_ c0: C0, _ c1: C1) -> C1 {} + static func buildBlock(_ c0: C0, _ c1: C1, _ c2: C2) -> C1 {} +} + +struct ForEach: View where Data: RandomAccessCollection { + init(_ dat: Data, @Builder content: (Data.Element) -> Content) {} +} + +struct Text: View { + init(_ text: String) {} +} + +struct Value { + var name: String +} + +func test(values: [Value]) { + _ = ForEach(values) { value in + Text("foobar") + Text("value \(value.#^STRINGLITERAL^#)") + } + _ = ForEach(values) { value in + Text("foobar") + Text(value.#^NORMAL^#) + } +} +// CHECK: Begin completions, 2 items +// CHECK-DAG: Keyword[self]/CurrNominal: self[#Value#]; +// CHECK-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[{{Convertible|Identical}}]: name[#String#]; +// CHECK: End completions diff --git a/test/IDE/complete_skipbody.swift b/test/IDE/complete_skipbody.swift index 9b9d3f61e13b2..728e9f342f2f4 100644 --- a/test/IDE/complete_skipbody.swift +++ b/test/IDE/complete_skipbody.swift @@ -49,7 +49,7 @@ let globalValue = globalValueOpt! let FORBIDDEN_globalVar = 1 -switch glovalValue.x { +switch globalValue.x { case let x where x < 2: if x == globalValue.#^TOPLEVEL^# {} default: @@ -58,6 +58,6 @@ default: // CHECK: Begin completions, 3 items // CHECK-DAG: Keyword[self]/CurrNominal: self[#MyStruct#]; name=self -// CHECK-DAG: Decl[InstanceVar]/CurrNominal: x[#Int#]; name=x -// CHECK-DAG: Decl[InstanceVar]/CurrNominal: y[#Int#]; name=y +// CHECK-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[Identical]: x[#Int#]; name=x +// CHECK-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[Identical]: y[#Int#]; name=y // CHECK: End completions diff --git a/test/IDE/complete_subscript.swift b/test/IDE/complete_subscript.swift index afd47cb1fb798..dfb74fafc1c0b 100644 --- a/test/IDE/complete_subscript.swift +++ b/test/IDE/complete_subscript.swift @@ -16,6 +16,7 @@ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUPER_IN_STATICMETHOD | %FileCheck %s -check-prefix=SUPER_IN_STATICMETHOD // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LABELED_SUBSCRIPT | %FileCheck %s -check-prefix=LABELED_SUBSCRIPT +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TUPLE | %FileCheck %s -check-prefix=TUPLE struct MyStruct { static subscript(x: Int, static defValue: T) -> MyStruct { @@ -62,6 +63,7 @@ func test1() { let _ = MyStruct()[#^INSTANCE_INT_BRACKET^# // INSTANCE_INT_BRACKET: Begin completions // INSTANCE_INT_BRACKET-DAG: Decl[Subscript]/CurrNominal: ['[']{#(x): Int#}, {#instance: Int#}[']'][#Int#]; +// INSTANCE_INT_BRACKET-DAG: Pattern/CurrModule: ['[']{#keyPath: KeyPath, Value>#}[']'][#Value#]; // INSTANCE_INT_BRACKET: End completions } func test2(value: MyStruct) { @@ -87,6 +89,7 @@ func test2(value: MyStruct) { let _ = value[#^INSTANCE_ARCHETYPE_BRACKET^# // INSTANCE_ARCHETYPE_BRACKET: Begin completions // INSTANCE_ARCHETYPE_BRACKET-DAG: Decl[Subscript]/CurrNominal: ['[']{#(x): Int#}, {#instance: U#}[']'][#Int#]; +// INSTANCE_ARCHETYPE_BRACKET-DAG: Pattern/CurrModule: ['[']{#keyPath: KeyPath, Value>#}[']'][#Value#]; // INSTANCE_ARCHETYPE_BRACKET: End completions let _ = MyStruct[42, #^METATYPE_LABEL^# @@ -110,14 +113,16 @@ class Derived: Base { func testInstance() { let _ = self[#^SELF_IN_INSTANCEMETHOD^#] -// SELF_IN_INSTANCEMETHOD: Begin completions, 2 items +// SELF_IN_INSTANCEMETHOD: Begin completions, 3 items // SELF_IN_INSTANCEMETHOD-DAG: Decl[Subscript]/CurrNominal: ['[']{#derivedInstance: Int#}[']'][#Int#]; // SELF_IN_INSTANCEMETHOD-DAG: Decl[Subscript]/Super: ['[']{#instance: Int#}[']'][#Int#]; +// SELF_IN_INSTANCEMETHOD-DAG: Pattern/CurrModule: ['[']{#keyPath: KeyPath#}[']'][#Value#]; // SELF_IN_INSTANCEMETHOD: End completions let _ = super[#^SUPER_IN_INSTANCEMETHOD^#] -// SUPER_IN_INSTANCEMETHOD: Begin completions, 1 items -// SUPER_IN_INSTANCEMETHOD-DAG: Decl[Subscript]/CurrNominal: ['[']{#instance: Int#}[']'][#Int#]; +// SUPER_IN_INSTANCEMETHOD: Begin completions, 2 items +// SUPER_IN_INSTANCEMETHOD-DAG: Decl[Subscript]/CurrNominal: ['[']{#instance: Int#}[']'][#Int#]; +// SUPER_IN_INSTANCEMETHOD-DAG: Pattern/CurrModule: ['[']{#keyPath: KeyPath#}[']'][#Value#]; // SUPER_IN_INSTANCEMETHOD: End completions } @@ -130,7 +135,7 @@ class Derived: Base { let _ = super[#^SUPER_IN_STATICMETHOD^#] // SUPER_IN_STATICMETHOD: Begin completions, 1 items -// SUPER_IN_STATICMETHOD-DAG: Decl[Subscript]/CurrNominal: ['[']{#static: Int#}[']'][#Int#]; +// SUPER_IN_STATICMETHOD-DAG: Decl[Subscript]/CurrNominal: ['[']{#static: Int#}[']'][#Int#]; // SUPER_IN_STATICMETHOD: End completions } } @@ -140,7 +145,15 @@ struct MyStruct1 { } func testSubscriptCallSig(val: MyStruct1) { val[#^LABELED_SUBSCRIPT^# -// LABELED_SUBSCRIPT: Begin completions, 1 items -// LABELED_SUBSCRIPT: Decl[Subscript]/CurrNominal: ['[']{#idx1: Int#}, {#idx2: Comparable#}[']'][#Int!#]; +// LABELED_SUBSCRIPT: Begin completions, 2 items +// LABELED_SUBSCRIPT-DAG: Decl[Subscript]/CurrNominal: ['[']{#idx1: Int#}, {#idx2: Comparable#}[']'][#Int!#]; +// LABELED_SUBSCRIPT-DAG: Pattern/CurrModule: ['[']{#keyPath: KeyPath, Value>#}[']'][#Value#]; // LABELED_SUBSCRIPT: End completions } + +func testSubcscriptTuple(val: (x: Int, String)) { + val[#^TUPLE^#] +// TUPLE: Begin completions, 1 items +// TUPLE-DAG: Pattern/CurrModule: ['[']{#keyPath: KeyPath<(x: Int, String), Value>#}[']'][#Value#]; +// TUPLE: End completions +} diff --git a/test/IDE/print_synthesized_extensions.swift b/test/IDE/print_synthesized_extensions.swift index 55a42676c393e..0b2cec63473f4 100644 --- a/test/IDE/print_synthesized_extensions.swift +++ b/test/IDE/print_synthesized_extensions.swift @@ -237,21 +237,21 @@ extension S13 : P5 { public func foo1() {} } -// CHECK1: extension S1 where Self.P2T1 : P2 { +// CHECK1: extension S1 where T : P2 { // CHECK1-NEXT: public func p2member() // CHECK1-NEXT: public func ef1(t: T) // CHECK1-NEXT: public func ef2(t: S2) // CHECK1-NEXT: } -// CHECK2: extension S1 where Self.T1 : P3 { +// CHECK2: extension S1 where T : P3 { // CHECK2-NEXT: public func p3Func(i: Int) -> Int // CHECK2-NEXT: } -// CHECK3: extension S1 where Self.T1 == Int { +// CHECK3: extension S1 where T == Int { // CHECK3-NEXT: public func p1IntFunc(i: Int) -> Int // CHECK3-NEXT: } -// CHECK4: extension S1 where Self.T1 == S9<Int> { +// CHECK4: extension S1 where T == S9<Int> { // CHECK4-NEXT: public func S9IntFunc() // CHECK4-NEXT: } diff --git a/test/IDE/structure.swift b/test/IDE/structure.swift index a4fb7a755f754..f77798697ef0e 100644 --- a/test/IDE/structure.swift +++ b/test/IDE/structure.swift @@ -285,9 +285,9 @@ struct Tuples { completion(a: 1) { (x: Any, y: Int) -> Int in return x as! Int + y } -// CHECK: completion(a: 1) { (x: Any, y: Int) -> Int in +// CHECK: completion(a: 1) { (x: Any, y: Int) -> Int in // CHECK: return x as! Int + y -// CHECK: } +// CHECK: } myFunc(foo: 0, bar: baz == 0) @@ -321,14 +321,14 @@ thirdCall(""" """) // CHECK: thirdCall(""" // CHECK-NEXT: \(""" -// CHECK-NEXT: \({ +// CHECK-NEXT: \({ // CHECK-NEXT: return a() -// CHECK-NEXT: }()) +// CHECK-NEXT: }()) // CHECK-NEXT: """) // CHECK-NEXT: """) fourthCall(a: @escaping () -> Int) // CHECK: fourthCall(a: @escaping () -> Int) -// CHECK: foo { [unowned self, x] in _ } +// CHECK: foo { [unowned self, x] in _ } foo { [unowned self, x] in _ } diff --git a/test/IRGen/abitypes.swift b/test/IRGen/abitypes.swift index b8f920752c6ef..b542eaedf1153 100644 --- a/test/IRGen/abitypes.swift +++ b/test/IRGen/abitypes.swift @@ -1,7 +1,7 @@ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi %s -emit-ir -enable-objc-interop | %FileCheck -check-prefix=%target-cpu-%target-os %s // FIXME: rdar://problem/19648117 Needs splitting objc parts out -// XFAIL: linux, windows +// XFAIL: linux, windows, openbsd import gadget import Foundation diff --git a/test/IRGen/address_sanitizer_recover.swift b/test/IRGen/address_sanitizer_recover.swift index 259fbbb5b5da8..efbf4cf2d5f60 100644 --- a/test/IRGen/address_sanitizer_recover.swift +++ b/test/IRGen/address_sanitizer_recover.swift @@ -1,3 +1,4 @@ +// REQUIRES: asan_runtime // RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-recover=address %s | %FileCheck %s -check-prefix=ASAN_RECOVER // RUN: %target-swift-frontend -emit-ir -sanitize=address %s | %FileCheck %s -check-prefix=ASAN_NO_RECOVER // RUN: %target-swift-frontend -emit-ir -sanitize-recover=address %s | %FileCheck %s -check-prefix=NO_ASAN_RECOVER diff --git a/test/IRGen/asan-attributes.swift b/test/IRGen/asan-attributes.swift index a4402ac7ff242..64f3ee6970418 100644 --- a/test/IRGen/asan-attributes.swift +++ b/test/IRGen/asan-attributes.swift @@ -1,3 +1,4 @@ +// REQUIRES: asan_runtime // This test verifies that we add the function attributes used by ASan. // RUN: %target-swift-frontend -emit-ir -sanitize=address %s | %FileCheck %s -check-prefix=ASAN diff --git a/test/IRGen/associated_type_witness.swift b/test/IRGen/associated_type_witness.swift index 0af07e62363b9..2fa5fc429cab5 100644 --- a/test/IRGen/associated_type_witness.swift +++ b/test/IRGen/associated_type_witness.swift @@ -93,6 +93,16 @@ struct Pair : P, Q {} // GLOBAL-SAME: @"symbolic{{.*}}23associated_type_witness4PairV{{.*}}" // GLOBAL-SAME: ] +// Protocol conformance descriptor for Computed : Assocked. +// GLOBAL-LABEL: @"$s23associated_type_witness8ComputedVyxq_GAA8AssockedAAMc" = hidden constant +// GLOBAL-SAME: i16 4, +// GLOBAL-SAME: i16 1, + +// No instantiator function +// GLOBAL-SAME: i32 0, +// GLOBAL-SAME: i32 trunc (i64 sub (i64 ptrtoint ([16 x i8*]* [[PRIVATE:@.*]] to i64), i64 ptrtoint +// GLOBAL-SAME: } + struct Computed : Assocked { typealias Assoc = Pair } @@ -117,6 +127,14 @@ protocol DerivedFromSimpleAssoc : HasSimpleAssoc {} // GLOBAL-SAME: @"$s23associated_type_witness15GenericComputedVyxGAA22DerivedFromSimpleAssocAAMc" // GLOBAL-SAME: i8* null +// Protocol conformance descriptor for GenericComputed : DerivedFromSimpleAssoc. +// GLOBAL-LABEL: @"$s23associated_type_witness15GenericComputedVyxGAA22DerivedFromSimpleAssocAAMc" = hidden constant +// GLOBAL-SAME: i16 2, +// GLOBAL-SAME: i16 1, + +// Relative reference to instantiator function +// GLOBAL-SAME: i32 trunc (i64 sub (i64 ptrtoint (void (i8**, %swift.type*, i8**)* @"$s23associated_type_witness15GenericComputedVyxGAA22DerivedFromSimpleAssocAAWI" to i64), + // Relative reference to private data struct GenericComputed : DerivedFromSimpleAssoc { typealias Assoc = PBox @@ -155,7 +173,6 @@ extension ValidatorType { // MARK: Failing example extension Validator where T == String { - // GLOBAL: @"symbolic _____ySS__G 23associated_type_witness9ValidatorVAASSRszlE1VV7FailureV" struct V: ValidatorType { typealias Data = T // or String @@ -163,21 +180,6 @@ extension Validator where T == String { } } +// GLOBAL-LABEL: @"symbolic _____ySS__G 23associated_type_witness9ValidatorVAASSRszlE1VV7FailureV" -// Protocol conformance descriptor for Computed : Assocked. -// GLOBAL-LABEL: @"$s23associated_type_witness8ComputedVyxq_GAA8AssockedAAMc" = hidden constant -// GLOBAL-SAME: i16 4, -// GLOBAL-SAME: i16 1, -// No instantiator function -// GLOBAL-SAME: i32 0, -// GLOBAL-SAME: i32 trunc (i64 sub (i64 ptrtoint ([16 x i8*]* [[PRIVATE:@.*]] to i64), i64 ptrtoint -// GLOBAL-SAME: } - -// Protocol conformance descriptor for GenericComputed : DerivedFromSimpleAssoc. -// GLOBAL-LABEL: @"$s23associated_type_witness15GenericComputedVyxGAA22DerivedFromSimpleAssocAAMc" = hidden constant -// GLOBAL-SAME: i16 2, -// GLOBAL-SAME: i16 1, - -// Relative reference to instantiator function -// GLOBAL-SAME: i32 trunc (i64 sub (i64 ptrtoint (void (i8**, %swift.type*, i8**)* @"$s23associated_type_witness15GenericComputedVyxGAA22DerivedFromSimpleAssocAAWI" to i64), diff --git a/test/IRGen/big_types_corner_cases.swift b/test/IRGen/big_types_corner_cases.swift index 543f0a3f51290..f956b23f7effe 100644 --- a/test/IRGen/big_types_corner_cases.swift +++ b/test/IRGen/big_types_corner_cases.swift @@ -136,11 +136,9 @@ public func enumCallee(_ x: LargeEnum) { case .Empty2: break } } -// CHECK-LABEL-64: define{{( dllexport)?}}{{( protected)?}} swiftcc void @"$s22big_types_corner_cases10enumCalleeyAA9LargeEnumOF"(%T22big_types_corner_cases9LargeEnumO* noalias nocapture dereferenceable({{.*}}) %0) #0 { +// CHECK-64-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @"$s22big_types_corner_cases10enumCalleeyyAA9LargeEnumOF"(%T22big_types_corner_cases9LargeEnumO* noalias nocapture dereferenceable({{.*}}) %0) #0 { // CHECK-64: alloca %T22big_types_corner_cases9LargeEnumO05InnerF0O // CHECK-64: alloca %T22big_types_corner_cases9LargeEnumO -// CHECK-64: call void @llvm.memcpy.p0i8.p0i8.i64 -// CHECK-64: call void @llvm.memcpy.p0i8.p0i8.i64 // CHECK-64: $ss5print_9separator10terminatoryypd_S2StF // CHECK-64: ret void diff --git a/test/IRGen/c_globals.swift b/test/IRGen/c_globals.swift index f19f9f4a8d566..271ff817ee369 100644 --- a/test/IRGen/c_globals.swift +++ b/test/IRGen/c_globals.swift @@ -56,12 +56,12 @@ public func testCaptureGlobal() { // CHECK-armv7k-WIN-DAG: attributes [[CLANG_FUNC_ATTR]] = { noinline nounwind {{.*}}"frame-pointer"="all"{{.*}} // CHECK-armv7k-WIN-DAG: attributes [[SWIFT_FUNC_ATTR]] = { {{.*}}"frame-pointer"="all" {{.*}}"target-cpu" -// CHECK-arm64-SYSV-DAG: attributes [[CLANG_FUNC_ATTR]] = { noinline nounwind {{.*}}"frame-pointer"="non-leaf"{{.*}} -// CHECK-arm64-SYSV-DAG: attributes [[SWIFT_FUNC_ATTR]] = { {{.*}}"frame-pointer"="non-leaf" {{.*}}"target-cpu" -// CHECK-arm64-WIN-DAG: attributes [[CLANG_FUNC_ATTR]] = { noinline nounwind {{.*}}"frame-pointer"="non-leaf"{{.*}} -// CHECK-arm64-WIN-DAG: attributes [[SWIFT_FUNC_ATTR]] = { {{.*}}"frame-pointer"="non-leaf" {{.*}}"target-cpu" +// CHECK-arm64-SYSV-DAG: attributes [[CLANG_FUNC_ATTR]] = { noinline nounwind {{.*}}"frame-pointer"="all"{{.*}} +// CHECK-arm64-SYSV-DAG: attributes [[SWIFT_FUNC_ATTR]] = { {{.*}}"frame-pointer"="all" {{.*}}"target-cpu" +// CHECK-arm64-WIN-DAG: attributes [[CLANG_FUNC_ATTR]] = { noinline nounwind {{.*}}"frame-pointer"="all"{{.*}} +// CHECK-arm64-WIN-DAG: attributes [[SWIFT_FUNC_ATTR]] = { {{.*}}"frame-pointer"="all" {{.*}}"target-cpu" -// CHECK-arm64e-SYSV-DAG: attributes [[CLANG_FUNC_ATTR]] = { noinline nounwind {{.*}}"frame-pointer"="non-leaf"{{.*}} -// CHECK-arm64e-SYSV-DAG: attributes [[SWIFT_FUNC_ATTR]] = { {{.*}}"frame-pointer"="non-leaf" {{.*}}"target-cpu" -// CHECK-arm64e-WIN-DAG: attributes [[CLANG_FUNC_ATTR]] = { noinline nounwind {{.*}}"frame-pointer"="non-leaf"{{.*}} -// CHECK-arm64e-WIN-DAG: attributes [[SWIFT_FUNC_ATTR]] = { {{.*}}"frame-pointer"="non-leaf" {{.*}}"target-cpu" +// CHECK-arm64e-SYSV-DAG: attributes [[CLANG_FUNC_ATTR]] = { noinline nounwind {{.*}}"frame-pointer"="all"{{.*}} +// CHECK-arm64e-SYSV-DAG: attributes [[SWIFT_FUNC_ATTR]] = { {{.*}}"frame-pointer"="all" {{.*}}"target-cpu" +// CHECK-arm64e-WIN-DAG: attributes [[CLANG_FUNC_ATTR]] = { noinline nounwind {{.*}}"frame-pointer"="all"{{.*}} +// CHECK-arm64e-WIN-DAG: attributes [[SWIFT_FUNC_ATTR]] = { {{.*}}"frame-pointer"="all" {{.*}}"target-cpu" diff --git a/test/IRGen/conditional_conformance_typemetadata.swift b/test/IRGen/conditional_conformance_typemetadata.swift new file mode 100644 index 0000000000000..2072714fd6e0d --- /dev/null +++ b/test/IRGen/conditional_conformance_typemetadata.swift @@ -0,0 +1,16 @@ +// RUN: %target-swift-frontend -O -emit-ir %s +// RUN: %target-swift-frontend -O -primary-file %s -emit-ir + +// Make sure that we don't crash in IRGen because the only reference to the type +// E is in the protocol conformance descriptor describing the conditional +// conformace. + +private enum E {} + +private protocol P { associatedtype AT } + +private struct S {} + +extension S: P where A == E { typealias AT = B } + +print(S.AT.self) diff --git a/test/IRGen/lazy_metadata_no_reflection.swift b/test/IRGen/lazy_metadata_no_reflection.swift index e9896a4bfd776..f1ad1a0f2ae1b 100644 --- a/test/IRGen/lazy_metadata_no_reflection.swift +++ b/test/IRGen/lazy_metadata_no_reflection.swift @@ -34,5 +34,5 @@ public func forceMetadata() { takeMetadata(HasPropertyType.self) } -// CHECK-LABEL: @"$s4test1SVMn" = hidden constant // CHECK-LABEL: @"$s4test1SVSQAAMc" = hidden constant +// CHECK-LABEL: @"$s4test1SVMn" = hidden constant diff --git a/test/IRGen/module_hash.swift b/test/IRGen/module_hash.swift index bb05847d3c552..90db61b6f4003 100644 --- a/test/IRGen/module_hash.swift +++ b/test/IRGen/module_hash.swift @@ -1,3 +1,4 @@ +// REQUIRES: fuzzer_runtime // RUN: %empty-directory(%t) diff --git a/test/IRGen/newtype.swift b/test/IRGen/newtype.swift index 93848b30ba68c..c913c9593e26c 100644 --- a/test/IRGen/newtype.swift +++ b/test/IRGen/newtype.swift @@ -1,6 +1,8 @@ // RUN: %empty-directory(%t) // RUN: %build-irgen-test-overlays -// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t -I %S/../IDE/Inputs/custom-modules) %s -emit-ir | %FileCheck %s -DINT=i%target-ptrsize +// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t -I %S/../IDE/Inputs/custom-modules) %s -emit-ir > %t/out.ll +// RUN: %FileCheck %s -DINT=i%target-ptrsize < %t/out.ll +// RUN: %FileCheck %s -check-prefix=CHECK-CC -DINT=i%target-ptrsize < %t/out.ll // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t -I %S/../IDE/Inputs/custom-modules) %s -emit-ir -O | %FileCheck %s -check-prefix=OPT -DINT=i%target-ptrsize import CoreFoundation import Foundation @@ -84,22 +86,6 @@ public func compareABIs() { takeMyABINewTypeNonNullNS(newNS!) takeMyABIOldTypeNonNullNS(oldNS!) - // Make sure that the calling conventions align correctly, that is we don't - // have double-indirection or anything else like that - // CHECK: declare %struct.__CFString* @getMyABINewType() - // CHECK: declare %struct.__CFString* @getMyABIOldType() - // - // CHECK: declare void @takeMyABINewType(%struct.__CFString*) - // CHECK: declare void @takeMyABIOldType(%struct.__CFString*) - // - // CHECK: declare void @takeMyABINewTypeNonNull(%struct.__CFString*) - // CHECK: declare void @takeMyABIOldTypeNonNull(%struct.__CFString*) - // - // CHECK: declare %0* @getMyABINewTypeNS() - // CHECK: declare %0* @getMyABIOldTypeNS() - // - // CHECK: declare void @takeMyABINewTypeNonNullNS(%0*) - // CHECK: declare void @takeMyABIOldTypeNonNullNS(%0*) } // OPT-LABEL: define swiftcc i1 @"$s7newtype12compareInitsSbyF" @@ -233,4 +219,20 @@ public func mutateRef() { // OPT: ret void } +// Make sure that the calling conventions align correctly, that is we don't +// have double-indirection or anything else like that +// CHECK-CC: declare %struct.__CFString* @getMyABINewType() +// CHECK-CC: declare %struct.__CFString* @getMyABIOldType() +// +// CHECK-CC: declare void @takeMyABINewType(%struct.__CFString*) +// CHECK-CC: declare void @takeMyABIOldType(%struct.__CFString*) +// +// CHECK-CC: declare void @takeMyABINewTypeNonNull(%struct.__CFString*) +// CHECK-CC: declare void @takeMyABIOldTypeNonNull(%struct.__CFString*) +// +// CHECK-CC: declare %0* @getMyABINewTypeNS() +// CHECK-CC: declare %0* @getMyABIOldTypeNS() +// +// CHECK-CC: declare void @takeMyABINewTypeNonNullNS(%0*) +// CHECK-CC: declare void @takeMyABIOldTypeNonNullNS(%0*) diff --git a/test/IRGen/prespecialized-metadata/Inputs/class-open-0argument.swift b/test/IRGen/prespecialized-metadata/Inputs/class-open-0argument.swift new file mode 100644 index 0000000000000..b1e577621d384 --- /dev/null +++ b/test/IRGen/prespecialized-metadata/Inputs/class-open-0argument.swift @@ -0,0 +1,8 @@ +open class Ancestor1 { + public let value: Int + + public init(_ value: Int) { + self.value = value + } +} + diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_distinct_generic_class.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_distinct_generic_class.swift index 5fc16d3e9f8dd..f045e31e2f5e2 100644 --- a/test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_distinct_generic_class.swift +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_distinct_generic_class.swift @@ -339,8 +339,8 @@ doit() // CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_4]]LLCyAA9Argument1ACLLCySiGAA9Argument2ACLLCySSGGMb"([[INT]] {{%[0-9]+}}) {{#[0-9]}} { // CHECK: entry: -// CHECK-unknown: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) -// CHECK-unknown: call swiftcc %swift.metadata_response @"$s4main9Argument2[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] 0) +// CHECK: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) +// CHECK: call swiftcc %swift.metadata_response @"$s4main9Argument2[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] 0) // CHECK-unknown: ret // CHECK-apple: [[INITIALIZED_CLASS:%[0-9]+]] = call %objc_class* @objc_opt_self( // : %objc_class* bitcast ( @@ -385,8 +385,6 @@ doit() // : ) // : ) // CHECK-apple: [[INITIALIZED_METADATA:%[0-9]+]] = bitcast %objc_class* [[INITIALIZED_CLASS]] to %swift.type* -// CHECK-apple: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) -// CHECK-apple: call swiftcc %swift.metadata_response @"$s4main9Argument2[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] 0) // CHECK-apple: [[PARTIAL_METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[INITIALIZED_METADATA]], 0 // CHECK-apple: [[METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[PARTIAL_METADATA_RESPONSE]], [[INT]] 0, 1 // CHECK-apple: ret %swift.metadata_response [[METADATA_RESPONSE]] diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_same_generic_class_different_value.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_same_generic_class_different_value.swift index 4374ca2f3aa46..3ff7c47b16878 100644 --- a/test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_same_generic_class_different_value.swift +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_same_generic_class_different_value.swift @@ -329,8 +329,8 @@ doit() // CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_4]]LLCyAA9Argument1ACLLCySiGAFySSGGMb"([[INT]] {{%[0-9]+}}) {{#[0-9]}} { // CHECK: entry: -// CHECK-unknown: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) -// CHECK-unknown: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] 0) +// CHECK: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) +// CHECK: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] 0) // CHECK-unknown: ret // CHECK-apple: [[INITIALIZED_CLASS:%[0-9]+]] = call %objc_class* @objc_opt_self( // : %objc_class* bitcast ( @@ -375,8 +375,6 @@ doit() // : ) // : ) // CHECK-apple: [[INITIALIZED_METADATA:%[0-9]+]] = bitcast %objc_class* [[INITIALIZED_CLASS]] to %swift.type* -// CHECK-apple: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) -// CHECK-apple: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] 0) // CHECK-apple: [[PARTIAL_METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[INITIALIZED_METADATA]], 0 // CHECK-apple: [[METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[PARTIAL_METADATA_RESPONSE]], [[INT]] 0, 1 // CHECK-apple: ret %swift.metadata_response [[METADATA_RESPONSE]] diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_same_generic_class_same_value.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_same_generic_class_same_value.swift index 10b4e5cbd2a0a..7efc10cb2d1a5 100644 --- a/test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_same_generic_class_same_value.swift +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_same_generic_class_same_value.swift @@ -329,8 +329,8 @@ doit() // CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_4]]LLCyAA9Argument1ACLLCySiGAGGMb"([[INT]] {{%[0-9]+}}) {{#[0-9]}} { // CHECK: entry: -// CHECK-unknown: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) -// CHECK-unknown-NOT: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) +// CHECK: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) +// CHECK-NOT: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) // CHECK-unknown: ret // CHECK-apple: [[INITIALIZED_CLASS:%[0-9]+]] = call %objc_class* @objc_opt_self( // : %objc_class* bitcast ( @@ -375,8 +375,6 @@ doit() // : ) // : ) // CHECK-apple: [[INITIALIZED_METADATA:%[0-9]+]] = bitcast %objc_class* [[INITIALIZED_CLASS]] to %swift.type* -// CHECK-apple: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) -// CHECK-apple-NOT: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) // CHECK-apple: [[PARTIAL_METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[INITIALIZED_METADATA]], 0 // CHECK-apple: [[METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[PARTIAL_METADATA_RESPONSE]], [[INT]] 0, 1 // CHECK-apple: ret %swift.metadata_response [[METADATA_RESPONSE]] diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_con_int-2nd_anc_gen-1st-arg_con_double.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_con_int-2nd_anc_gen-1st-arg_con_double.swift index 1c35c2082e709..402898bc25d73 100644 --- a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_con_int-2nd_anc_gen-1st-arg_con_double.swift +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_con_int-2nd_anc_gen-1st-arg_con_double.swift @@ -332,13 +332,12 @@ doit() // CHECK: ; Function Attrs: noinline nounwind readnone // CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]CySSGMb"([[INT]] {{%[0-9]+}}) #{{[0-9]+}} { // CHECK: entry: -// CHECK-unknown: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) +// CHECK: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) +// CHECK-NOT: call swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) // CHECK-unknown: ret // CHECK-apple: [[INITIALIZED_CLASS:%[0-9]+]] = call %objc_class* @objc_opt_self( // CHECK-SAME: @"$s4main5Value[[UNIQUE_ID_1]]CySSGMf" // CHECK-apple: [[INITIALIZED_METADATA:%[0-9]+]] = bitcast %objc_class* [[INITIALIZED_CLASS]] to %swift.type* -// CHECK-apple: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) -// CHECK-NOT: call swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) // CHECK-apple: [[PARTIAL_METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[INITIALIZED_METADATA]], 0 // CHECK-apple: [[METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[PARTIAL_METADATA_RESPONSE]], [[INT]] 0, 1 // CHECK-apple: ret %swift.metadata_response [[METADATA_RESPONSE]] diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_con_int-2nd_anc_gen-1st-arg_subclass_arg.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_con_int-2nd_anc_gen-1st-arg_subclass_arg.swift index fb1ca4b5a3a6a..e3579a782d7e0 100644 --- a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_con_int-2nd_anc_gen-1st-arg_subclass_arg.swift +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_con_int-2nd_anc_gen-1st-arg_subclass_arg.swift @@ -317,13 +317,12 @@ doit() // CHECK: ; Function Attrs: noinline nounwind readnone // CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]CySSGMb"([[INT]] {{%[0-9]+}}) #{{[0-9]+}} { // CHECK: entry: -// CHECK-unknown: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) +// CHECK: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) +// CHECK-NOT: call swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) // CHECK-unknown: ret // CHECK-apple: [[INITIALIZED_CLASS:%[0-9]+]] = call %objc_class* @objc_opt_self( // CHECK-SAME: @"$s4main5Value[[UNIQUE_ID_1]]CySSGMf" // CHECK-apple: [[INITIALIZED_METADATA:%[0-9]+]] = bitcast %objc_class* [[INITIALIZED_CLASS]] to %swift.type* -// CHECK-apple: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) -// CHECK-NOT: call swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) // CHECK-apple: [[PARTIAL_METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[INITIALIZED_METADATA]], 0 // CHECK-apple: [[METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[PARTIAL_METADATA_RESPONSE]], [[INT]] 0, 1 // CHECK-apple: ret %swift.metadata_response [[METADATA_RESPONSE]] diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_subclass_arg-2nd_anc_gen-1st-arg_con_int.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_subclass_arg-2nd_anc_gen-1st-arg_con_int.swift index 49b0c2df9cab1..fbbe8d06720fc 100644 --- a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_subclass_arg-2nd_anc_gen-1st-arg_con_int.swift +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_subclass_arg-2nd_anc_gen-1st-arg_con_int.swift @@ -321,13 +321,12 @@ doit() // CHECK: ; Function Attrs: noinline nounwind readnone // CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] {{%[0-9]+}}) #{{[0-9]+}} { // CHECK: entry: -// CHECK-unknown: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] 0) +// CHECK: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] 0) +// CHECK-NOT: call swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) // CHECK-unknown: ret // CHECK-apple: [[INITIALIZED_CLASS:%[0-9]+]] = call %objc_class* @objc_opt_self( // CHECK-SAME: @"$s4main5Value[[UNIQUE_ID_1]]LLCySSGMf" // CHECK-apple: [[INITIALIZED_METADATA:%[0-9]+]] = bitcast %objc_class* [[INITIALIZED_CLASS]] to %swift.type* -// CHECK-apple: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] 0) -// CHECK-NOT: call swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) // CHECK-apple: [[PARTIAL_METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[INITIALIZED_METADATA]], 0 // CHECK-apple: [[METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[PARTIAL_METADATA_RESPONSE]], [[INT]] 0, 1 // CHECK-apple: ret %swift.metadata_response [[METADATA_RESPONSE]] diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_subcls_arg-2nd_anc_gen-1st-arg_subcls_arg.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_subcls_arg-2nd_anc_gen-1st-arg_subcls_arg.swift index 161947afd3481..c6083b4647e43 100644 --- a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_subcls_arg-2nd_anc_gen-1st-arg_subcls_arg.swift +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_subcls_arg-2nd_anc_gen-1st-arg_subcls_arg.swift @@ -309,13 +309,12 @@ doit() // CHECK: ; Function Attrs: noinline nounwind readnone // CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] {{%[0-9]+}}) {{#[0-9]+}} { // CHECK: entry: -// CHECK-unknown: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) +// CHECK: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) +// CHECK-NOT: call swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) // CHECK-unknown: ret // CHECK-apple: [[INITIALIZED_CLASS:%[0-9]+]] = call %objc_class* @objc_opt_self( // CHECK-SAME: @"$s4main5Value[[UNIQUE_ID_1]]LLCySiGMf" // CHECK-apple: [[INITIALIZED_METADATA:%[0-9]+]] = bitcast %objc_class* [[INITIALIZED_CLASS]] to %swift.type* -// CHECK-apple: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) -// CHECK-NOT: call swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) // CHECK-apple: [[PARTIAL_METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[INITIALIZED_METADATA]], 0 // CHECK-apple: [[METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[PARTIAL_METADATA_RESPONSE]], [[INT]] 0, 1 // CHECK-apple: ret %swift.metadata_response [[METADATA_RESPONSE]] diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_constant_int.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_constant_int.swift index 949345f3bd7c4..fe625d4dfdeff 100644 --- a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_constant_int.swift +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_constant_int.swift @@ -9,7 +9,7 @@ // CHECK: @"$s4main9Ancestor1[[UNIQUE_ID_1:[A-Za-z_0-9]+]]CySiGMf" = // CHECK: @"$s4main5Value[[UNIQUE_ID_1]]CySSGMf" = linkonce_odr hidden // CHECK-apple-SAME: global -// CHECK-unknown-SMAE: constant +// CHECK-unknown-SAME: constant // CHECK-SAME: <{ // CHECK-SAME: void ( // CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]C* @@ -208,7 +208,7 @@ doit() // CHECK: ; Function Attrs: noinline nounwind readnone // CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]CySSGMb"([[INT]] {{%[0-9]+}}) {{#[0-9]+}} { // CHECK-NEXT: entry: -// CHECK-unknown: [[SUPER_CLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) +// CHECK: [[SUPER_CLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) // CHECK-unknown: ret // CHECK-apple: [[THIS_CLASS_METADATA:%[0-9]+]] = call %objc_class* @objc_opt_self( // : %objc_class* bitcast ( @@ -258,7 +258,6 @@ doit() // : ) // : ) // CHECK-apple: [[THIS_TYPE_METADATA:%[0-9]+]] = bitcast %objc_class* [[THIS_CLASS_METADATA]] to %swift.type* -// CHECK-apple: [[SUPER_CLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) // CHECK-apple: [[RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[THIS_TYPE_METADATA]], 0 // CHECK-apple: [[COMPLETE_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response %5, [[INT]] 0, 1 // CHECK-apple: ret %swift.metadata_response [[COMPLETE_RESPONSE]] diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_subclass_argument.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_subclass_argument.swift index 2619e3aec47d2..248ec77302280 100644 --- a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_subclass_argument.swift +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_subclass_argument.swift @@ -265,7 +265,7 @@ doit() // CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]CySiGMb" // CHECK-NEXT: entry: -// CHECK-unknown: [[SUPER_CLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) +// CHECK: [[SUPER_CLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) // CHECK-apple: [[THIS_CLASS_METADATA:%[0-9]+]] = call %objc_class* @objc_opt_self( // CHECK-apple: %objc_class* bitcast ( // CHECK-unknown: ret @@ -305,7 +305,6 @@ doit() // : ) // : ) // CHECK-apple: [[THIS_TYPE_METADATA:%[0-9]+]] = bitcast %objc_class* [[THIS_CLASS_METADATA]] to %swift.type* -// CHECK-apple: [[SUPER_CLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0) // CHECK-apple: [[RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[THIS_TYPE_METADATA]], 0 // CHECK-apple: [[COMPLETE_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[RESPONSE]], [[INT]] 0, 1 // CHECK-apple: ret %swift.metadata_response [[COMPLETE_RESPONSE]] diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_superclass.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_superclass.swift index 141c1283041a9..db94ac2a480f3 100644 --- a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_superclass.swift +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_generic-1argument-1st_argument_superclass.swift @@ -9,7 +9,7 @@ // CHECK: @"$s4main9Ancestor1[[UNIQUE_ID_1:[A-Za-z_0-9]+]]LLCyADySSGGMf" = // CHECK: @"$s4main5Value[[UNIQUE_ID_1]]LLCyAA9Ancestor1ACLLCySSGGMf" = linkonce_odr hidden // CHECK-apple-SAME: global -// CHECK-unknown-SMAE: constant +// CHECK-unknown-SAME: constant // CHECK-SAME: <{ // CHECK-SAME: void ( // CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* @@ -265,8 +265,8 @@ doit() // CHECK: ; Function Attrs: noinline nounwind readnone // CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCyAA9Ancestor1ACLLCySSGGMb"([[INT]] {{%[0-9]+}}) {{#[0-9]+}} { // CHECK-NEXT: entry: -// CHECK-unknown: [[ARGUMENT_CLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] 0) -// CHECK-unknown: [[SUPER_CLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCyADySSGGMb"([[INT]] 0) +// CHECK: [[ARGUMENT_CLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] 0) +// CHECK: [[SUPER_CLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCyADySSGGMb"([[INT]] 0) // CHECK-unknown: ret // CHECK-apple: [[THIS_CLASS_METADATA:%[0-9]+]] = call %objc_class* @objc_opt_self( // : %objc_class* bitcast ( @@ -311,8 +311,6 @@ doit() // : ) // CHECK-apple: ) // CHECK-apple: [[THIS_TYPE_METADATA:%[0-9]+]] = bitcast %objc_class* [[THIS_CLASS_METADATA]] to %swift.type* -// CHECK-apple: [[ARGUMENT_CLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCySSGMb"([[INT]] 0) -// CHECK-apple: [[SUPER_CLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCyADySSGGMb"([[INT]] 0) // CHECK-apple: [[RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[THIS_TYPE_METADATA]], 0 // CHECK-apple: [[COMPLETE_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[RESPONSE]], [[INT]] 0, 1 // CHECK-apple: ret %swift.metadata_response [[COMPLETE_RESPONSE]] diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_nongeneric-external-nonresilient.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_nongeneric-external-nonresilient.swift new file mode 100644 index 0000000000000..69dac11039380 --- /dev/null +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_nongeneric-external-nonresilient.swift @@ -0,0 +1,220 @@ +// RUN: %empty-directory(%t) + +// RUN: %target-build-swift -emit-library -module-name TestModule -module-link-name TestModule %S/Inputs/class-open-0argument.swift -emit-module-interface -swift-version 5 -o %t/%target-library-name(TestModule) +// RUN: %target-swift-frontend -prespecialize-generic-metadata -target %module-target-future -emit-ir -I %t -L %t %s | %FileCheck %s -DINT=i%target-ptrsize -DALIGNMENT=%target-alignment --check-prefix=CHECK --check-prefix=CHECK-%target-vendor + +// REQUIRES: OS=macosx || OS=ios || OS=tvos || OS=watchos || OS=linux-gnu +// UNSUPPORTED: CPU=i386 && OS=ios +// UNSUPPORTED: CPU=armv7 && OS=ios +// UNSUPPORTED: CPU=armv7s && OS=ios + +import TestModule + +// CHECK: @"$s4main5Value[[UNIQUE_ID_1:[A-Za-z_0-9]+]]LLCySiGMf" = linkonce_odr hidden +// CHECK-apple-SAME: global +// CHECK-unknown-SAME: constant +// CHECK-SAME: <{ +// CHECK-SAME: void ( +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* +// CHECK-SAME: )*, +// CHECK-SAME: i8**, +// : [[INT]], +// CHECK-SAME: %swift.type*, +// CHECK-apple-SAME: %swift.opaque*, +// CHECK-apple-SAME: %swift.opaque*, +// CHECK-apple-SAME: [[INT]], +// CHECK-SAME: i32, +// CHECK-SAME: i32, +// CHECK-SAME: i32, +// CHECK-SAME: i16, +// CHECK-SAME: i16, +// CHECK-SAME: i32, +// CHECK-SAME: i32, +// CHECK-SAME: %swift.type_descriptor*, +// CHECK-SAME: void ( +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* +// CHECK-SAME: )*, +// CHECK-SAME: [[INT]], +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// CHECK-SAME: [[INT]], +// CHECK-SAME: %swift.type* +// CHECK-SAME: )*, +// CHECK-SAME: %swift.type*, +// CHECK-SAME: [[INT]] +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// CHECK-SAME: %swift.opaque*, +// CHECK-SAME: %swift.type* +// CHECK-SAME: )* +// CHECK-SAME:}> <{ +// CHECK-SAME: void ( +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCfD +// CHECK-SAME: $sBoWV +// CHECK-apple-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCySiGMM +// CHECK-unknown-SAME: [[INT]] 0, +// CHECK-SAME: $s10TestModule9Ancestor1CN +// CHECK-apple-SAME: %swift.opaque* @_objc_empty_cache, +// CHECK-apple-SAME: %swift.opaque* null, +// CHECK-apple-SAME: [[INT]] add ( +// CHECK-apple-SAME: [[INT]] ptrtoint ( +// CHECK-apple-SAME: { +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: i32, +// : i32, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i8*, +// : i8*, +// CHECK-apple-SAME: { +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: [ +// CHECK-apple-SAME: 1 x { +// CHECK-apple-SAME: [[INT]]*, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: i32 +// CHECK-apple-SAME: } +// CHECK-apple-SAME: ] +// CHECK-apple-SAME: }*, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i8* +// CHECK-apple-SAME: }* @_DATA__TtC4mainP[[UNIQUE_ID_1]]5Value to [[INT]] +// CHECK-apple-SAME: ), +// CHECK-apple-SAME: [[INT]] 2 +// CHECK-apple-SAME: ), +// CHECK-SAME: i32 26, +// CHECK-SAME: i32 0, +// CHECK-SAME: i32 {{(32|16)}}, +// CHECK-SAME: i16 {{(7|3)}}, +// CHECK-SAME: i16 0, +// CHECK-apple-SAME: i32 {{(136|80)}}, +// CHECK-unknown-SAME: i32 112, +// CHECK-SAME: i32 {{(16|8)}}, +// CHECK-SAME: %swift.type_descriptor* bitcast ( +// : <{ +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i16, +// : i16, +// : i16, +// : i16, +// : i8, +// : i8, +// : i8, +// : i8, +// : i32, +// : i32, +// : %swift.method_descriptor, +// : i32, +// : %swift.method_override_descriptor +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCMn +// CHECK-SAME: ), +// CHECK-SAME: void ( +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCfE +// CHECK-SAME: [[INT]] {{16|8}}, +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// CHECK-SAME: [[INT]], +// CHECK-SAME: %swift.type* +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCyADyxGSicfC +// CHECK-SAME: %swift.type* @"$sSiN", +// CHECK-SAME: [[INT]] {{24|12}} +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// CHECK-SAME: %swift.opaque*, +// CHECK-SAME: %swift.type* +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLC5firstADyxGx_tcfC +// CHECK-SAME:}>, +// CHECK-SAME:align [[ALIGNMENT]] + +fileprivate class Value : Ancestor1 { + let first_Value: First + + init(first: First) { + self.first_Value = first + super.init(32) + } +} + +@inline(never) +func consume(_ t: T) { + withExtendedLifetime(t) { t in + } +} + +func doit() { + consume( Value(first: 13) ) +} +doit() + +// CHECK-LABEL: define hidden swiftcc void @"$s4main4doityyF"() +// CHECK: call swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCySiGMb" +// CHECK: } + +// CHECK: ; Function Attrs: noinline nounwind readnone +// CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] {{%[0-9]+}}) {{#[0-9]+}} { +// CHECK-NEXT: entry: +// CHECK: [[SUPERCLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s10TestModule9Ancestor1CMa"([[INT]] 0) +// CHECK-unknown: ret +// CHECK-apple: [[THIS_CLASS_METADATA:%[0-9]+]] = call %objc_class* @objc_opt_self( +// : %objc_class* bitcast ( +// : %swift.type* getelementptr inbounds ( +// : %swift.full_heapmetadata, +// : %swift.full_heapmetadata* bitcast ( +// : <{ +// : void ( +// : %T4main5Value[[UNIQUE_ID_1]]LLC* +// : )*, +// : i8**, +// : i64, +// : %swift.type*, +// : %swift.opaque*, +// : %swift.opaque*, +// : i64, +// : i32, +// : i32, +// : i32, +// : i16, +// : i16, +// : i32, +// : i32, +// : %swift.type_descriptor*, +// : void ( +// : %T4main5Value[[UNIQUE_ID_1]]LLC* +// : )*, +// : i64, +// : %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// : i64, +// : %swift.type* +// : )*, +// : %swift.type*, +// : i64, +// : %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// : %swift.opaque*, +// : %swift.type* +// : )* +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCySiGMf +// : ), +// : i32 0, +// : i32 2 +// : ) to %objc_class* +// : ) +// : ) +// CHECK-apple: [[THIS_TYPE_METADATA:%[0-9]+]] = bitcast %objc_class* [[THIS_CLASS_METADATA]] to %swift.type* +// CHECK-apple: [[RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[THIS_TYPE_METADATA]], 0 +// CHECK-apple: [[COMPLETE_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[RESPONSE]], [[INT]] 0, 1 +// CHECK-apple: ret %swift.metadata_response [[COMPLETE_RESPONSE]] +// CHECK: } diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_nongeneric-external-resilient.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_nongeneric-external-resilient.swift new file mode 100644 index 0000000000000..26e84f7acb306 --- /dev/null +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_nongeneric-external-resilient.swift @@ -0,0 +1,37 @@ +// RUN: %empty-directory(%t) + +// RUN: %target-build-swift -emit-library -module-name TestModule -module-link-name TestModule %S/Inputs/class-open-0argument.swift -emit-module-interface -swift-version 5 -o %t/%target-library-name(TestModule) -enable-library-evolution +// RUN: %target-swift-frontend -prespecialize-generic-metadata -target %module-target-future -emit-ir -I %t -L %t %s | %FileCheck %s -DINT=i%target-ptrsize -DALIGNMENT=%target-alignment --check-prefix=CHECK --check-prefix=CHECK-%target-vendor + +// REQUIRES: OS=macosx || OS=ios || OS=tvos || OS=watchos || OS=linux-gnu +// UNSUPPORTED: CPU=i386 && OS=ios +// UNSUPPORTED: CPU=armv7 && OS=ios +// UNSUPPORTED: CPU=armv7s && OS=ios + +import TestModule + +// CHECK-NOT: @"$s4main5Value{{[A-Za-z_0-9]+}}LLCySiGMf" = + +fileprivate class Value : Ancestor1 { + let first_Value: First + + init(first: First) { + self.first_Value = first + super.init(32) + } +} + +@inline(never) +func consume(_ t: T) { + withExtendedLifetime(t) { t in + } +} + +func doit() { + consume( Value(first: 13) ) +} +doit() + +// CHECK-LABEL: define hidden swiftcc void @"$s4main4doityyF"() +// CHECK: call %swift.type* @__swift_instantiateConcreteTypeFromMangledName({ i32, i32 }* @"$s4main5Value{{[A-Za-z_0-9]+}}LLCySiGMD") +// CHECK: } diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_nongeneric-fileprivate.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_nongeneric-fileprivate.swift new file mode 100644 index 0000000000000..3f998316005ef --- /dev/null +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_nongeneric-fileprivate.swift @@ -0,0 +1,305 @@ +// RUN: %swift -prespecialize-generic-metadata -target %module-target-future -emit-ir %s | %FileCheck %s -DINT=i%target-ptrsize -DALIGNMENT=%target-alignment --check-prefix=CHECK --check-prefix=CHECK-%target-vendor + +// REQUIRES: OS=macosx || OS=ios || OS=tvos || OS=watchos || OS=linux-gnu +// UNSUPPORTED: CPU=i386 && OS=ios +// UNSUPPORTED: CPU=armv7 && OS=ios +// UNSUPPORTED: CPU=armv7s && OS=ios + + +// CHECK: @"$s4main5Value[[UNIQUE_ID_1:[A-Za-z_0-9]+]]LLCySiGMf" = linkonce_odr hidden +// CHECK-apple-SAME: global +// CHECK-unknown-SAME: constant +// CHECK-SAME: <{ +// CHECK-SAME: void ( +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* +// CHECK-SAME: )*, +// CHECK-SAME: i8**, +// : [[INT]], +// CHECK-SAME: %swift.type*, +// CHECK-apple-SAME: %swift.opaque*, +// CHECK-apple-SAME: %swift.opaque*, +// CHECK-apple-SAME: [[INT]], +// CHECK-SAME: i32, +// CHECK-SAME: i32, +// CHECK-SAME: i32, +// CHECK-SAME: i16, +// CHECK-SAME: i16, +// CHECK-SAME: i32, +// CHECK-SAME: i32, +// CHECK-SAME: %swift.type_descriptor*, +// CHECK-SAME: void ( +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* +// CHECK-SAME: )*, +// CHECK-SAME: [[INT]], +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// CHECK-SAME: [[INT]], +// CHECK-SAME: %swift.type* +// CHECK-SAME: )*, +// CHECK-SAME: %swift.type*, +// CHECK-SAME: [[INT]] +// CHECK-SAME:}> <{ +// CHECK-SAME: void ( +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCfD +// CHECK-SAME: $sBoWV +// CHECK-apple-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCySiGMM +// CHECK-unknown-SAME: [[INT]] 0, +// : %swift.type* bitcast ( +// : [[INT]]* getelementptr inbounds ( +// : <{ +// : void ( +// : %T4main9Ancestor1[[UNIQUE_ID_1]]LLC* +// : )*, +// : i8**, +// : [[INT]], +// : %objc_class*, +// : %swift.type*, +// : %swift.opaque*, +// : %swift.opaque*, +// : [[INT]], +// : i32, +// : i32, +// : i32, +// : i16, +// : i16, +// : i32, +// : i32, +// : <{ +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : %swift.method_descriptor +// : }>*, +// : i8*, +// : [[INT]], +// : %T4main9Ancestor1[[UNIQUE_ID_1]]LLC* ( +// : [[INT]], +// : %swift.type* +// : )* +// : }>, +// : <{ +// : void ( +// : %T4main9Ancestor1[[UNIQUE_ID_1]]LLC* +// : )*, +// : i8**, +// : [[INT]], +// : %objc_class*, +// : %swift.type*, +// : %swift.opaque*, +// : %swift.opaque*, +// : [[INT]], +// : i32, +// : i32, +// : i32, +// : i16, +// : i16, +// : i32, +// : i32, +// : <{ +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : %swift.method_descriptor +// : }>*, +// : i8*, +// : [[INT]], +// : %T4main9Ancestor1[[UNIQUE_ID_1]]LLC* ( +// : [[INT]], +// : %swift.type* +// : )* +// CHECK-SAME: $s4main9Ancestor1[[UNIQUE_ID_1]]LLCMf +// : i32 0, +// : i32 2 +// : ) to %swift.type* +// : ), +// CHECK-apple-SAME: %swift.opaque* @_objc_empty_cache, +// CHECK-apple-SAME: %swift.opaque* null, +// CHECK-apple-SAME: [[INT]] add ( +// CHECK-apple-SAME: [[INT]] ptrtoint ( +// CHECK-apple-SAME: { +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: i32, +// : i32, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i8*, +// : i8*, +// CHECK-apple-SAME: { +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: [ +// CHECK-apple-SAME: 1 x { +// CHECK-apple-SAME: [[INT]]*, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: i32 +// CHECK-apple-SAME: } +// CHECK-apple-SAME: ] +// CHECK-apple-SAME: }*, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i8* +// CHECK-apple-SAME: }* @_DATA__TtC4mainP[[UNIQUE_ID_1]]5Value to [[INT]] +// CHECK-apple-SAME: ), +// CHECK-apple-SAME: [[INT]] 2 +// CHECK-apple-SAME: ), +// CHECK-SAME: i32 26, +// CHECK-SAME: i32 0, +// CHECK-SAME: i32 {{(32|16)}}, +// CHECK-SAME: i16 {{(7|3)}}, +// CHECK-SAME: i16 0, +// CHECK-apple-SAME: i32 {{(136|80)}}, +// CHECK-unknown-SAME: i32 112, +// CHECK-SAME: i32 {{(16|8)}}, +// : %swift.type_descriptor* bitcast ( +// : <{ +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i16, +// : i16, +// : i16, +// : i16, +// : i8, +// : i8, +// : i8, +// : i8, +// : i32, +// : %swift.method_override_descriptor +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCMn +// CHECK-SAME: ), +// CHECK-SAME: void ( +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCfE +// CHECK-SAME: [[INT]] {{16|8}}, +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// CHECK-SAME: [[INT]], +// CHECK-SAME: %swift.type* +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLC5firstADyxGSi_tcfC +// CHECK-SAME: %swift.type* @"$sSiN", +// CHECK-SAME: [[INT]] {{24|12}} +// CHECK-SAME:}>, +// CHECK-SAME:align [[ALIGNMENT]] + + +fileprivate class Ancestor1 { + let first_Ancestor1: Int + + init(first: Int) { + self.first_Ancestor1 = first + } +} + +fileprivate class Value : Ancestor1 { + let first_Value: First + + init(first: First) { + self.first_Value = first + super.init(first: 32) + } +} + +@inline(never) +func consume(_ t: T) { + withExtendedLifetime(t) { t in + } +} + +func doit() { + consume( Value(first: 13) ) +} +doit() + +// CHECK-LABEL: define hidden swiftcc void @"$s4main4doityyF"() +// CHECK: call swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCySiGMb" +// CHECK: } + +// CHECK: define internal swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCMa" + +// CHECK: ; Function Attrs: noinline nounwind readnone +// CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] {{%[0-9]+}}) {{#[0-9]+}} { +// CHECK-NEXT: entry: +// CHECK: [[SUPERCLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]LLCMa"([[INT]] 0) +// CHECK-unknown: ret +// CHECK-apple: [[THIS_CLASS_METADATA:%[0-9]+]] = call %objc_class* @objc_opt_self( +// : %objc_class* bitcast ( +// : %swift.type* getelementptr inbounds ( +// : %swift.full_heapmetadata, +// : %swift.full_heapmetadata* bitcast ( +// : <{ +// : void ( +// : %T4main5Value[[UNIQUE_ID_1]]LLC* +// : )*, +// : i8**, +// : i64, +// : %swift.type*, +// : %swift.opaque*, +// : %swift.opaque*, +// : i64, +// : i32, +// : i32, +// : i32, +// : i16, +// : i16, +// : i32, +// : i32, +// : %swift.type_descriptor*, +// : void ( +// : %T4main5Value[[UNIQUE_ID_1]]LLC* +// : )*, +// : i64, +// : %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// : i64, +// : %swift.type* +// : )*, +// : %swift.type*, +// : i64, +// : %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// : %swift.opaque*, +// : %swift.type* +// : )* +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCySiGMf +// : ), +// : i32 0, +// : i32 2 +// : ) to %objc_class* +// : ) +// : ) +// CHECK-apple: [[THIS_TYPE_METADATA:%[0-9]+]] = bitcast %objc_class* [[THIS_CLASS_METADATA]] to %swift.type* +// CHECK-apple: [[RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[THIS_TYPE_METADATA]], 0 +// CHECK-apple: [[COMPLETE_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[RESPONSE]], [[INT]] 0, 1 +// CHECK-apple: ret %swift.metadata_response [[COMPLETE_RESPONSE]] +// CHECK: } + + diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-2ancestor-1du-1st_ancestor_generic-fileprivate-2nd_ancestor_nongeneric.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-2ancestor-1du-1st_ancestor_generic-fileprivate-2nd_ancestor_nongeneric.swift new file mode 100644 index 0000000000000..e429d59278289 --- /dev/null +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-2ancestor-1du-1st_ancestor_generic-fileprivate-2nd_ancestor_nongeneric.swift @@ -0,0 +1,276 @@ +// RUN: %empty-directory(%t) + +// RUN: %target-swift-frontend -prespecialize-generic-metadata -target %module-target-future -emit-ir -I %t -L %t %s | %FileCheck %s -DINT=i%target-ptrsize -DALIGNMENT=%target-alignment --check-prefix=CHECK --check-prefix=CHECK-%target-vendor + +// REQUIRES: OS=macosx || OS=ios || OS=tvos || OS=watchos || OS=linux-gnu +// UNSUPPORTED: CPU=i386 && OS=ios +// UNSUPPORTED: CPU=armv7 && OS=ios +// UNSUPPORTED: CPU=armv7s && OS=ios + +// CHECK: @"$s4main5Value[[UNIQUE_ID_1:[A-Za-z_0-9]+]]LLCySiGMf" = linkonce_odr hidden +// CHECK-apple-SAME: global +// CHECK-unknown-SAME: constant +// CHECK-SAME: <{ +// CHECK-SAME: void ( +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* +// CHECK-SAME: )*, +// CHECK-SAME: i8**, +// : [[INT]], +// CHECK-SAME: %swift.type*, +// CHECK-apple-SAME: %swift.opaque*, +// CHECK-apple-SAME: %swift.opaque*, +// CHECK-apple-SAME: [[INT]], +// CHECK-SAME: i32, +// CHECK-SAME: i32, +// CHECK-SAME: i32, +// CHECK-SAME: i16, +// CHECK-SAME: i16, +// CHECK-SAME: i32, +// CHECK-SAME: i32, +// CHECK-SAME: %swift.type_descriptor*, +// CHECK-SAME: void ( +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* +// CHECK-SAME: )*, +// CHECK-SAME: [[INT]], +// CHECK-SAME: %T4main9Ancestor2[[UNIQUE_ID_1]]LLC* ( +// CHECK-SAME: [[INT]], +// CHECK-SAME: %swift.type* +// CHECK-SAME: )*, +// CHECK-SAME: %swift.type*, +// CHECK-SAME: [[INT]] +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// CHECK-SAME: %swift.opaque*, +// CHECK-SAME: %swift.type* +// CHECK-SAME: )* +// CHECK-SAME: %swift.type*, +// CHECK-SAME: [[INT]] +// CHECK-SAME:}> <{ +// CHECK-SAME: void ( +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCfD +// CHECK-SAME: $sBoWV +// CHECK-apple-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCySiGMM +// CHECK-unknown-SAME: [[INT]] 0, +// : %swift.type* getelementptr inbounds ( +// : %swift.full_heapmetadata, +// : %swift.full_heapmetadata* bitcast ( +// : <{ +// : void ( +// : %T4main9Ancestor2[[UNIQUE_ID_1]]LLC* +// : )*, +// : i8**, +// : [[INT]], +// : %swift.type*, +// : %swift.opaque*, +// : %swift.opaque*, +// : [[INT]], +// : i32, +// : i32, +// : i32, +// : i16, +// : i16, +// : i32, +// : i32, +// : %swift.type_descriptor*, +// : void ( +// : %T4main9Ancestor2[[UNIQUE_ID_1]]LLC* +// : )*, +// : [[INT]], +// : %T4main9Ancestor2[[UNIQUE_ID_1]]LLC* ( +// : [[INT]], +// : %swift.type* +// : )*, +// : %swift.type*, +// : [[INT]], +// : %T4main9Ancestor2[[UNIQUE_ID_1]]LLC* ( +// : %swift.opaque*, +// : %swift.type* +// : )* +// : }>* @"$s4main9Ancestor2[[UNIQUE_ID_1]]LLCySiGMf" to %swift.full_heapmetadata* +// : ), +// : i32 0, +// : i32 2 +// : ), +// CHECK-apple-SAME: %swift.opaque* @_objc_empty_cache, +// CHECK-apple-SAME: %swift.opaque* null, +// CHECK-apple-SAME: [[INT]] add ( +// CHECK-apple-SAME: [[INT]] ptrtoint ( +// CHECK-apple-SAME: { +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: i32, +// : i32, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i8*, +// : i8*, +// CHECK-apple-SAME: { +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: [ +// CHECK-apple-SAME: 1 x { +// CHECK-apple-SAME: [[INT]]*, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i32, +// CHECK-apple-SAME: i32 +// CHECK-apple-SAME: } +// CHECK-apple-SAME: ] +// CHECK-apple-SAME: }*, +// CHECK-apple-SAME: i8*, +// CHECK-apple-SAME: i8* +// CHECK-apple-SAME: }* @_DATA__TtC4mainP[[UNIQUE_ID_1]]5Value to [[INT]] +// CHECK-apple-SAME: ), +// CHECK-apple-SAME: [[INT]] 2 +// CHECK-apple-SAME: ), +// CHECK-SAME: i32 26, +// CHECK-SAME: i32 0, +// CHECK-SAME: i32 {{(40|20)}}, +// CHECK-SAME: i16 {{(7|3)}}, +// CHECK-SAME: i16 0, +// CHECK-apple-SAME: i32 {{(152|88)}}, +// CHECK-unknown-SAME: i32 128, +// CHECK-SAME: i32 {{(16|8)}}, +// : %swift.type_descriptor* bitcast ( +// : <{ +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i32, +// : i16, +// : i16, +// : i16, +// : i16, +// : i8, +// : i8, +// : i8, +// : i8, +// : i32, +// : %swift.method_override_descriptor +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_2:[A-Za-z_0-9]+]]LLCMn +// CHECK-SAME: ), +// CHECK-SAME: void ( +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCfE +// CHECK-SAME: [[INT]] {{16|8}}, +// CHECK-SAME: %T4main9Ancestor2[[UNIQUE_ID_1]]LLC* ( +// CHECK-SAME: [[INT]], +// CHECK-SAME: %swift.type* +// CHECK-SAME: $s4main9Ancestor2[[UNIQUE_ID_1]]LLCyADyxGSicfC +// CHECK-SAME: %swift.type* @"$sSiN", +// CHECK-SAME: [[INT]] {{24|12}} +// CHECK-SAME: %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// CHECK-SAME: %swift.opaque*, +// CHECK-SAME: %swift.type* +// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLC5firstADyxGx_tcfC +// CHECK-SAME: %swift.type* @"$sSiN", +// CHECK-SAME: [[INT]] {{32|16}} +// CHECK-SAME:}>, +// CHECK-SAME:align [[ALIGNMENT]] + +fileprivate class Ancestor1 { + let first_Ancestor1: Int + + init(_ int: Int) { + self.first_Ancestor1 = int + } +} + +fileprivate class Ancestor2 : Ancestor1 { + let first_Ancestor2: First + + init(first: First) { + self.first_Ancestor2 = first + super.init(7573672) + } +} + +fileprivate class Value : Ancestor2 { + let first_Value: First + + override init(first: First) { + self.first_Value = first + super.init(first: first) + } +} + +@inline(never) +func consume(_ t: T) { + withExtendedLifetime(t) { t in + } +} + +func doit() { + consume( Value(first: 13) ) +} +doit() + +// CHECK-LABEL: define hidden swiftcc void @"$s4main4doityyF"() +// CHECK: call swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCySiGMb" +// CHECK: } + +// CHECK: ; Function Attrs: noinline nounwind readnone +// CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] {{%[0-9]+}}) {{#[0-9]+}} { +// CHECK-NEXT: entry: +// CHECK: [[SUPERCLASS_METADATA:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0) +// CHECK-unknown: ret +// CHECK-apple: [[THIS_CLASS_METADATA:%[0-9]+]] = call %objc_class* @objc_opt_self( +// : %objc_class* bitcast ( +// : %swift.type* getelementptr inbounds ( +// : %swift.full_heapmetadata, +// : %swift.full_heapmetadata* bitcast ( +// : <{ +// : void ( +// : %T4main5Value[[UNIQUE_ID_1]]LLC* +// : )*, +// : i8**, +// : i64, +// : %swift.type*, +// : %swift.opaque*, +// : %swift.opaque*, +// : i64, +// : i32, +// : i32, +// : i32, +// : i16, +// : i16, +// : i32, +// : i32, +// : %swift.type_descriptor*, +// : void ( +// : %T4main5Value[[UNIQUE_ID_1]]LLC* +// : )*, +// : i64, +// : %T4main9Ancestor2[[UNIQUE_ID_1]]LLC* ( +// : i64, +// : %swift.type* +// : )*, +// : %swift.type*, +// : i64, +// : %T4main5Value[[UNIQUE_ID_1]]LLC* ( +// : %swift.opaque*, +// : %swift.type* +// : )*, +// : %swift.type*, +// : i64 +// CHECK-SAME: }>* @"$s4main5Value[[UNIQUE_ID_1]]LLCySiGMf" to %swift.full_heapmetadata* +// : ), +// : i32 0, +// : i32 2 +// : ) to %objc_class* +// : ) +// : ) +// CHECK-apple: [[THIS_TYPE_METADATA:%[0-9]+]] = bitcast %objc_class* [[THIS_CLASS_METADATA]] to %swift.type* +// CHECK-apple: [[RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, %swift.type* [[THIS_TYPE_METADATA]], 0 +// CHECK-apple: [[COMPLETE_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[RESPONSE]], [[INT]] 0, 1 +// CHECK-apple: ret %swift.metadata_response [[COMPLETE_RESPONSE]] +// CHECK: } diff --git a/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-2ancestor-1du-1st_ancestor_nongeneric-fileprivate-2nd_ancestor_generic.swift b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-2ancestor-1du-1st_ancestor_nongeneric-fileprivate-2nd_ancestor_generic.swift new file mode 100644 index 0000000000000..025e1ea48261a --- /dev/null +++ b/test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-2ancestor-1du-1st_ancestor_nongeneric-fileprivate-2nd_ancestor_generic.swift @@ -0,0 +1,51 @@ +// RUN: %empty-directory(%t) + +// RUN: %target-swift-frontend -prespecialize-generic-metadata -target %module-target-future -emit-ir -I %t -L %t %s | %FileCheck %s -DINT=i%target-ptrsize -DALIGNMENT=%target-alignment --check-prefix=CHECK --check-prefix=CHECK-%target-vendor + +// REQUIRES: OS=macosx || OS=ios || OS=tvos || OS=watchos || OS=linux-gnu +// UNSUPPORTED: CPU=i386 && OS=ios +// UNSUPPORTED: CPU=armv7 && OS=ios +// UNSUPPORTED: CPU=armv7s && OS=ios + +fileprivate class Ancestor1 { + let first_Ancestor1: First + + init(first: First) { + self.first_Ancestor1 = first + } +} + +fileprivate class Ancestor2 : Ancestor1 { + let first_Ancestor2: Int + + override init(first: Int) { + self.first_Ancestor2 = first + super.init(first: first) + } +} + +fileprivate class Value : Ancestor2 { + let first_Value: First + + init(first: First) { + self.first_Value = first + super.init(first: 7373748) + } +} + +@inline(never) +func consume(_ t: T) { + withExtendedLifetime(t) { t in + } +} + +func doit() { + consume( Value(first: 13) ) +} +doit() + +// TODO: Prespecialize Value. + +// CHECK-LABEL: define hidden swiftcc void @"$s4main4doityyF"() +// CHECK: call %swift.type* @__swift_instantiateConcreteTypeFromMangledName({ i32, i32 }* @"$s4main5Value{{[A-Za-z_0-9]+}}LLCySiGMD") +// CHECK: } diff --git a/test/IRGen/protocol_conformance_records.swift b/test/IRGen/protocol_conformance_records.swift index a2adbef23aa54..fce8f2d76d559 100644 --- a/test/IRGen/protocol_conformance_records.swift +++ b/test/IRGen/protocol_conformance_records.swift @@ -108,10 +108,6 @@ public struct Concrete : AssociateConformance { // -- no flags are set, and no generic witness table follows // CHECK-SAME: i32 0 } -// CHECK-LABEL: @"\01l_protocols" -// CHECK-SAME: @"$s28protocol_conformance_records8RuncibleMp" -// CHECK-SAME: @"$s28protocol_conformance_records5SpoonMp" - public protocol Spoon { } // Conditional conformances @@ -167,6 +163,10 @@ extension Dependent : Associate { public typealias X = (T, T) } +// CHECK-LABEL: @"\01l_protocols" +// CHECK-SAME: @"$s28protocol_conformance_records8RuncibleMp" +// CHECK-SAME: @"$s28protocol_conformance_records5SpoonMp" + // CHECK-LABEL: @"\01l_protocol_conformances" = private constant // CHECK-SAME: @"$s28protocol_conformance_records15NativeValueTypeVAA8RuncibleAAMc" // CHECK-SAME: @"$s28protocol_conformance_records15NativeClassTypeCAA8RuncibleAAMc" diff --git a/test/IRGen/protocol_resilience.sil b/test/IRGen/protocol_resilience.sil index 43379afcd51d2..ca055c97834fd 100644 --- a/test/IRGen/protocol_resilience.sil +++ b/test/IRGen/protocol_resilience.sil @@ -11,6 +11,24 @@ import SwiftShims import resilient_protocol +// Protocol conformance descriptor for ResilientConformingType : OtherResilientProtocol + +// CHECK: @"$s19protocol_resilience23ResilientConformingTypeV010resilient_A005OtherC8ProtocolAAMc" = + +// CHECK-SAME: i32 131072, + +// -- number of witness table entries +// CHECK-SAME: i16 0, + +// -- size of private area + 'requires instantiation' bit +// CHECK-SAME: i16 1, + +// -- instantiator function +// CHECK-SAME: i32 0 + +// CHECK-SAME: } + + // Protocol descriptor for ResilientProtocol // CHECK: [[RESILIENT_PROTOCOL_NAME:@.*]] = private constant [18 x i8] c"ResilientProtocol\00 @@ -88,23 +106,6 @@ protocol InternalProtocol { // CHECK-NOT: @"$s19protocol_resilience26ConformsWithResilientAssocVAA03HaseF0AAWp" = {{(protected )?}}internal -// Protocol conformance descriptor for ResilientConformingType : OtherResilientProtocol - -// CHECK: @"$s19protocol_resilience23ResilientConformingTypeV010resilient_A005OtherC8ProtocolAAMc" = - -// CHECK-SAME: i32 131072, - -// -- number of witness table entries -// CHECK-SAME: i16 0, - -// -- size of private area + 'requires instantiation' bit -// CHECK-SAME: i16 1, - -// -- instantiator function -// CHECK-SAME: i32 0 - -// CHECK-SAME: } - // ConformsWithRequirements protocol conformance descriptor // CHECK: "$s19protocol_resilience24ConformsWithRequirementsV010resilient_A008ProtocoldE0AAMc" = hidden constant { diff --git a/test/IRGen/reflection_metadata.swift b/test/IRGen/reflection_metadata.swift index 6fb4080cff057..c398506055f0d 100644 --- a/test/IRGen/reflection_metadata.swift +++ b/test/IRGen/reflection_metadata.swift @@ -7,9 +7,9 @@ // STRIP_REFLECTION_NAMES_DAG: section "{{[^"]*swift5_assocty|.sw5asty\$B}} // STRIP_REFLECTION_NAMES-DAG: section "{{[^"]*swift5_capture|.sw5cptr\$B}} // STRIP_REFLECTION_NAMES-DAG: section "{{[^"]*swift5_typeref|.sw5tyrf\$B}} +// STRIP_REFLECTION_NAMES-DAG: private constant [6 x i8] c"Inner\00", section "{{[^"]*swift5_reflstr|.sw5rfst\$B}} // STRIP_REFLECTION_NAMES-NOT: section "{{[^"]*swift5_reflstr|.sw5rfst\$B}} // STRIP_REFLECTION_NAMES-NOT: section "{{[^"]*swift5_builtin|.sw5bltn\$B}} - // STRIP_REFLECTION_NAMES-DAG: @"$s19reflection_metadata10MyProtocol_pMF" = internal constant {{.*}}section "{{[^"]*swift5_fieldmd|.sw5flmd\$B}} // STRIP_REFLECTION_METADATA-NOT: section "{{[^"]*swift5_reflect|.sw5rfst\$B}} diff --git a/test/IRGen/sanitize_coverage.swift b/test/IRGen/sanitize_coverage.swift index 556cc3af1b848..27ef3f9e5325e 100644 --- a/test/IRGen/sanitize_coverage.swift +++ b/test/IRGen/sanitize_coverage.swift @@ -1,3 +1,4 @@ +// REQUIRES: asan_runtime // RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=func %s | %FileCheck %s -check-prefix=SANCOV // RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=bb %s | %FileCheck %s -check-prefix=SANCOV // RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge %s | %FileCheck %s -check-prefix=SANCOV @@ -10,7 +11,7 @@ #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) import Darwin -#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) +#elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) import Glibc #elseif os(Windows) import MSVCRT diff --git a/test/IRGen/tsan-attributes.swift b/test/IRGen/tsan-attributes.swift index 74b652b0a6e5c..192052770b951 100644 --- a/test/IRGen/tsan-attributes.swift +++ b/test/IRGen/tsan-attributes.swift @@ -1,3 +1,4 @@ +// REQUIRES: tsan_runtime // This test verifies that we add the function attributes used by TSan. // RUN: %target-swift-frontend -emit-ir -sanitize=thread %s | %FileCheck %s -check-prefix=TSAN diff --git a/test/IRGen/tsan_coroutines.swift b/test/IRGen/tsan_coroutines.swift index 5c0b053fcd13b..63ff783dc6747 100644 --- a/test/IRGen/tsan_coroutines.swift +++ b/test/IRGen/tsan_coroutines.swift @@ -1,3 +1,4 @@ +// REQUIRES: tsan_runtime // This test case used to crash when tsan ran before co-routine lowering. // RUN: %target-swift-frontend -emit-ir -sanitize=thread %s | %FileCheck %s diff --git a/test/IRGen/unmanaged_objc_throw_func.swift b/test/IRGen/unmanaged_objc_throw_func.swift index 128b41b3999f7..43dd9c2bce925 100644 --- a/test/IRGen/unmanaged_objc_throw_func.swift +++ b/test/IRGen/unmanaged_objc_throw_func.swift @@ -15,11 +15,11 @@ import Foundation // CHECK-NEXT: %[[T2:.+]] = extractvalue { %swift.bridge*, i8* } %[[T0]], 1 // CHECK-NEXT: %[[T3:.+]] = bitcast i8* %[[T2]] to %TSi* // CHECK-NEXT: %._value = getelementptr inbounds %TSi, %TSi* %[[T3]], i32 0, i32 0 - // CHECK-NEXT: store i{{32|64}} 1, i{{32|64}}* %._value, align {{[0-9]+}} - // CHECK-NEXT: %[[T4:.+]] = call swiftcc %TSo7NSArrayC* @"$sSa10FoundationE19_bridgeToObjectiveCSo7NSArrayCyF"(%swift.bridge* %[[T1]], %swift.type* @"$sSiN") + // CHECK: %[[T7:.+]] = call swiftcc %swift.bridge* @"$ss27_finalizeUninitializedArrayySayxGABnlF"(%swift.bridge* %[[T1]], %swift.type* @"$sSiN") + // CHECK: %[[T4:.+]] = call swiftcc %TSo7NSArrayC* @"$sSa10FoundationE19_bridgeToObjectiveCSo7NSArrayCyF"(%swift.bridge* %[[T7]], %swift.type* @"$sSiN") // CHECK-NEXT: %[[T5:.+]] = bitcast %TSo7NSArrayC* %[[T4]] to %TSo10CFArrayRefa* // CHECK-NEXT: store %TSo10CFArrayRefa* %[[T5]] - // CHECK-NEXT: call void @swift_bridgeObjectRelease(%swift.bridge* %[[T1]]) #{{[0-9]+}} + // CHECK-NEXT: call void @swift_bridgeObjectRelease(%swift.bridge* %{{[0-9]+}}) #{{[0-9]+}} // CHECK-NEXT: %[[T6:.+]] = bitcast %TSo10CFArrayRefa* %[[T5]] to i8* // CHECK-NEXT: call void @llvm.objc.release(i8* %[[T6]]) // CHECK-NEXT: ret %TSo10CFArrayRefa* %[[T5]] diff --git a/test/Incremental/Dependencies/private-function-fine.swift b/test/Incremental/Dependencies/private-function-fine.swift index c1337019a65bc..81d2594b9a02a 100644 --- a/test/Incremental/Dependencies/private-function-fine.swift +++ b/test/Incremental/Dependencies/private-function-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -disable-direct-intramodule-dependencies -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -disable-direct-intramodule-dependencies -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private func testParamType(_: InterestingType) {} diff --git a/test/Incremental/Dependencies/private-function-return-type-fine.swift b/test/Incremental/Dependencies/private-function-return-type-fine.swift index 2e8e517e7c7e9..70efbdb644918 100644 --- a/test/Incremental/Dependencies/private-function-return-type-fine.swift +++ b/test/Incremental/Dependencies/private-function-return-type-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -disable-direct-intramodule-dependencies -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -disable-direct-intramodule-dependencies -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private func testReturnType() -> InterestingType { fatalError() } diff --git a/test/Incremental/Dependencies/private-protocol-conformer-ext-fine.swift b/test/Incremental/Dependencies/private-protocol-conformer-ext-fine.swift index 0688c573d42e5..49330bda51a75 100644 --- a/test/Incremental/Dependencies/private-protocol-conformer-ext-fine.swift +++ b/test/Incremental/Dependencies/private-protocol-conformer-ext-fine.swift @@ -3,11 +3,11 @@ // XFAIL OS=windows // RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps // RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private struct Test {} diff --git a/test/Incremental/Dependencies/private-protocol-conformer-fine.swift b/test/Incremental/Dependencies/private-protocol-conformer-fine.swift index 2e62737c2d710..53341cbd708db 100644 --- a/test/Incremental/Dependencies/private-protocol-conformer-fine.swift +++ b/test/Incremental/Dependencies/private-protocol-conformer-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -disable-direct-intramodule-dependencies -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -disable-direct-intramodule-dependencies -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private struct Test : InterestingProto {} diff --git a/test/Incremental/Dependencies/private-struct-member-fine.swift b/test/Incremental/Dependencies/private-struct-member-fine.swift index b66e08ece8ded..51bf1a8008d3f 100644 --- a/test/Incremental/Dependencies/private-struct-member-fine.swift +++ b/test/Incremental/Dependencies/private-struct-member-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -disable-direct-intramodule-dependencies -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -disable-direct-intramodule-dependencies -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private struct Wrapper { diff --git a/test/Incremental/Dependencies/private-subscript-fine.swift b/test/Incremental/Dependencies/private-subscript-fine.swift index ff8efe16e50e7..61ab508d1e7bd 100644 --- a/test/Incremental/Dependencies/private-subscript-fine.swift +++ b/test/Incremental/Dependencies/private-subscript-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -disable-direct-intramodule-dependencies -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -disable-direct-intramodule-dependencies -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps struct Wrapper { diff --git a/test/Incremental/Dependencies/private-typealias-fine.swift b/test/Incremental/Dependencies/private-typealias-fine.swift index e78e73e9a9f5b..3b4491ea33677 100644 --- a/test/Incremental/Dependencies/private-typealias-fine.swift +++ b/test/Incremental/Dependencies/private-typealias-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -disable-direct-intramodule-dependencies -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -disable-direct-intramodule-dependencies -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private struct Wrapper { diff --git a/test/Incremental/Dependencies/private-var-fine.swift b/test/Incremental/Dependencies/private-var-fine.swift index 764216859efc5..d5d0901800d2b 100644 --- a/test/Incremental/Dependencies/private-var-fine.swift +++ b/test/Incremental/Dependencies/private-var-fine.swift @@ -2,13 +2,13 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private var privateVar: InterestingType { fatalError() } diff --git a/test/Incremental/Dependencies/reference-dependencies-consistency-fine.swift b/test/Incremental/Dependencies/reference-dependencies-consistency-fine.swift index 669e7753143de..fbe79d58a7190 100644 --- a/test/Incremental/Dependencies/reference-dependencies-consistency-fine.swift +++ b/test/Incremental/Dependencies/reference-dependencies-consistency-fine.swift @@ -10,7 +10,7 @@ // RUN: echo 'fileprivate var v: String { return "\(x)" }; fileprivate let x = "a"' >%t/1.swift // RUN: echo 'fileprivate var v: String { return "\(x)" }; fileprivate let x = "a"' >%t/2.swift // -// RUN: %target-swift-frontend -typecheck -primary-file %t/1.swift -primary-file %t/2.swift -emit-reference-dependencies-path %t/1.swiftdeps -emit-reference-dependencies-path %t/2.swiftdeps +// RUN: %target-swift-frontend -typecheck -disable-direct-intramodule-dependencies -primary-file %t/1.swift -primary-file %t/2.swift -emit-reference-dependencies-path %t/1.swiftdeps -emit-reference-dependencies-path %t/2.swiftdeps // // Sequence numbers can vary // RUN: sed -e 's/[0-9][0-9]*/N/g' -e 's/N, //g' -e '/^ *$/d' <%t/1.swiftdeps | sort >%t/1-processed.swiftdeps diff --git a/test/Incremental/Dependencies/reference-dependencies-dynamic-lookup-fine.swift b/test/Incremental/Dependencies/reference-dependencies-dynamic-lookup-fine.swift index 5e2a804a3ca25..092b0e2f1e56b 100644 --- a/test/Incremental/Dependencies/reference-dependencies-dynamic-lookup-fine.swift +++ b/test/Incremental/Dependencies/reference-dependencies-dynamic-lookup-fine.swift @@ -4,12 +4,12 @@ // RUN: %empty-directory(%t) // RUN: cp %s %t/main.swift -// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -primary-file %t/main.swift -emit-reference-dependencies-path - > %t.swiftdeps +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -primary-file %t/main.swift -disable-direct-intramodule-dependencies -emit-reference-dependencies-path - > %t.swiftdeps // Check that the output is deterministic. -// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -primary-file %t/main.swift -emit-reference-dependencies-path - > %t-2.swiftdeps -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t-2.swiftdeps >%t-2-processed.swiftdeps +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -primary-file %t/main.swift -disable-direct-intramodule-dependencies -emit-reference-dependencies-path - > %t-2.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t-2.swiftdeps %t-2-processed.swiftdeps // RUN: diff %t-processed.swiftdeps %t-2-processed.swiftdeps // RUN: %FileCheck %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/reference-dependencies-errors.swift b/test/Incremental/Dependencies/reference-dependencies-errors.swift index 72dc06066331f..b7f6e82ab34cc 100644 --- a/test/Incremental/Dependencies/reference-dependencies-errors.swift +++ b/test/Incremental/Dependencies/reference-dependencies-errors.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) // RUN: cp %s %t/main.swift -// RUN: not %target-swift-frontend -typecheck -primary-file %t/main.swift -emit-reference-dependencies-path - > %t.swiftdeps +// RUN: not %target-swift-frontend -typecheck -disable-direct-intramodule-dependencies -primary-file %t/main.swift -emit-reference-dependencies-path - > %t.swiftdeps associatedtype Baz case bar diff --git a/test/Incremental/Dependencies/reference-dependencies-fine.swift b/test/Incremental/Dependencies/reference-dependencies-fine.swift index 77c1d8bc6a2e6..81de9852e34d9 100644 --- a/test/Incremental/Dependencies/reference-dependencies-fine.swift +++ b/test/Incremental/Dependencies/reference-dependencies-fine.swift @@ -6,13 +6,13 @@ // RUN: cp %s %t/main.swift // Need -fine-grained-dependency-include-intrafile to be invarient wrt type-body-fingerprints enabled/disabled -// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-helper.swift -emit-reference-dependencies-path - > %t.swiftdeps +// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -disable-direct-intramodule-dependencies -primary-file %t/main.swift %S/../Inputs/reference-dependencies-helper.swift -emit-reference-dependencies-path - > %t.swiftdeps // Check that the output is deterministic. -// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-helper.swift -emit-reference-dependencies-path - > %t-2.swiftdeps +// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -disable-direct-intramodule-dependencies -primary-file %t/main.swift %S/../Inputs/reference-dependencies-helper.swift -emit-reference-dependencies-path - > %t-2.swiftdeps // Merge each entry onto one line and sort to overcome order differences -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t-2.swiftdeps >%t-2-processed.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t-2.swiftdeps %t-2-processed.swiftdeps // RUN: diff %t-processed.swiftdeps %t-2-processed.swiftdeps // RUN: %FileCheck -check-prefix=NEGATIVE %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/reference-dependencies-members-fine.swift b/test/Incremental/Dependencies/reference-dependencies-members-fine.swift index 5c90284ea2cf8..27a25ead26d7b 100644 --- a/test/Incremental/Dependencies/reference-dependencies-members-fine.swift +++ b/test/Incremental/Dependencies/reference-dependencies-members-fine.swift @@ -6,11 +6,11 @@ // RUN: cp %s %t/main.swift // Need -fine-grained-dependency-include-intrafile to be invarient wrt type-body-fingerprints enabled/disabled -// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - > %t.swiftdeps +// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-members-helper.swift -disable-direct-intramodule-dependencies -emit-reference-dependencies-path - > %t.swiftdeps -// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - > %t-2.swiftdeps -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t-2.swiftdeps >%t-2-processed.swiftdeps +// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-members-helper.swift -disable-direct-intramodule-dependencies -emit-reference-dependencies-path - > %t-2.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t-2.swiftdeps %t-2-processed.swiftdeps // RUN: diff %t-processed.swiftdeps %t-2-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-function-fine.swift b/test/Incremental/PrivateDependencies/private-function-fine.swift index 2faaa24cd690c..701993af63a37 100644 --- a/test/Incremental/PrivateDependencies/private-function-fine.swift +++ b/test/Incremental/PrivateDependencies/private-function-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private func testParamType(_: InterestingType) {} diff --git a/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift b/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift index 0ae374461af8c..b519f71d2972b 100644 --- a/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift +++ b/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private func testReturnType() -> InterestingType { fatalError() } diff --git a/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift b/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift index 1b638a1865b91..5a8ad95c8ea38 100644 --- a/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift +++ b/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private struct Test {} diff --git a/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift b/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift index f50ab48ef4226..7b417286438a3 100644 --- a/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift +++ b/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private struct Test : InterestingProto {} diff --git a/test/Incremental/PrivateDependencies/private-struct-member-fine.swift b/test/Incremental/PrivateDependencies/private-struct-member-fine.swift index c0e961a85b660..0f29734faa0a5 100644 --- a/test/Incremental/PrivateDependencies/private-struct-member-fine.swift +++ b/test/Incremental/PrivateDependencies/private-struct-member-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private struct Wrapper { diff --git a/test/Incremental/PrivateDependencies/private-subscript-fine.swift b/test/Incremental/PrivateDependencies/private-subscript-fine.swift index c634d6c81c96a..d33ec6232d1e1 100644 --- a/test/Incremental/PrivateDependencies/private-subscript-fine.swift +++ b/test/Incremental/PrivateDependencies/private-subscript-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps struct Wrapper { diff --git a/test/Incremental/PrivateDependencies/private-typealias-fine.swift b/test/Incremental/PrivateDependencies/private-typealias-fine.swift index 438f4798f5109..20cabd8eb0464 100644 --- a/test/Incremental/PrivateDependencies/private-typealias-fine.swift +++ b/test/Incremental/PrivateDependencies/private-typealias-fine.swift @@ -2,12 +2,12 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private struct Wrapper { diff --git a/test/Incremental/PrivateDependencies/private-var-fine.swift b/test/Incremental/PrivateDependencies/private-var-fine.swift index 588c13d333124..3a849b4c1267a 100644 --- a/test/Incremental/PrivateDependencies/private-var-fine.swift +++ b/test/Incremental/PrivateDependencies/private-var-fine.swift @@ -2,13 +2,13 @@ // Also uses awk: // XFAIL OS=windows -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DOLD -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps -// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW +// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/InterestingType.swift -DNEW -emit-reference-dependencies-path %t.swiftdeps -module-name main -enable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps private var privateVar: InterestingType { fatalError() } diff --git a/test/Incremental/PrivateDependencies/reference-dependencies-consistency-fine.swift b/test/Incremental/PrivateDependencies/reference-dependencies-consistency-fine.swift index 16997589dba88..93c9dae3e34c8 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-consistency-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-consistency-fine.swift @@ -10,7 +10,7 @@ // RUN: echo 'fileprivate var v: String { return "\(x)" }; fileprivate let x = "a"' >%t/1.swift // RUN: echo 'fileprivate var v: String { return "\(x)" }; fileprivate let x = "a"' >%t/2.swift // -// RUN: %target-swift-frontend -typecheck -primary-file %t/1.swift -primary-file %t/2.swift -emit-reference-dependencies-path %t/1.swiftdeps -emit-reference-dependencies-path %t/2.swiftdeps -experimental-private-intransitive-dependencies +// RUN: %target-swift-frontend -typecheck -primary-file %t/1.swift -primary-file %t/2.swift -emit-reference-dependencies-path %t/1.swiftdeps -emit-reference-dependencies-path %t/2.swiftdeps -enable-direct-intramodule-dependencies // // Sequence numbers can vary // RUN: sed -e 's/[0-9][0-9]*/N/g' -e 's/N, //g' -e '/^ *$/d' <%t/1.swiftdeps | sort >%t/1-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/reference-dependencies-dynamic-lookup-fine.swift b/test/Incremental/PrivateDependencies/reference-dependencies-dynamic-lookup-fine.swift index 4d8dac6b7a9a6..c4c42c752ecf7 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-dynamic-lookup-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-dynamic-lookup-fine.swift @@ -4,12 +4,12 @@ // RUN: %empty-directory(%t) // RUN: cp %s %t/main.swift -// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -primary-file %t/main.swift -emit-reference-dependencies-path - -experimental-private-intransitive-dependencies > %t.swiftdeps +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -primary-file %t/main.swift -emit-reference-dependencies-path - -enable-direct-intramodule-dependencies > %t.swiftdeps // Check that the output is deterministic. -// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -primary-file %t/main.swift -emit-reference-dependencies-path - -experimental-private-intransitive-dependencies > %t-2.swiftdeps -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t-2.swiftdeps >%t-2-processed.swiftdeps +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -primary-file %t/main.swift -emit-reference-dependencies-path - -enable-direct-intramodule-dependencies > %t-2.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t-2.swiftdeps %t-2-processed.swiftdeps // RUN: diff %t-processed.swiftdeps %t-2-processed.swiftdeps // RUN: %FileCheck %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/reference-dependencies-errors.swift b/test/Incremental/PrivateDependencies/reference-dependencies-errors.swift index 4bc2fc47e0721..fcf80f6129fde 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-errors.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-errors.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) // RUN: cp %s %t/main.swift -// RUN: not %target-swift-frontend -typecheck -primary-file %t/main.swift -emit-reference-dependencies-path - -experimental-private-intransitive-dependencies > %t.swiftdeps +// RUN: not %target-swift-frontend -typecheck -primary-file %t/main.swift -emit-reference-dependencies-path - -enable-direct-intramodule-dependencies > %t.swiftdeps associatedtype Baz case bar diff --git a/test/Incremental/PrivateDependencies/reference-dependencies-fine.swift b/test/Incremental/PrivateDependencies/reference-dependencies-fine.swift index c02d11e7c97a2..eb05e967c9c4f 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-fine.swift @@ -6,13 +6,13 @@ // RUN: cp %s %t/main.swift // Need -fine-grained-dependency-include-intrafile to be invarient wrt type-body-fingerprints enabled/disabled -// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-helper.swift -emit-reference-dependencies-path - -experimental-private-intransitive-dependencies > %t.swiftdeps +// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-helper.swift -emit-reference-dependencies-path - -enable-direct-intramodule-dependencies > %t.swiftdeps // Check that the output is deterministic. -// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-helper.swift -emit-reference-dependencies-path - -experimental-private-intransitive-dependencies > %t-2.swiftdeps +// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-helper.swift -emit-reference-dependencies-path - -enable-direct-intramodule-dependencies > %t-2.swiftdeps // Merge each entry onto one line and sort to overcome order differences -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t-2.swiftdeps >%t-2-processed.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t-2.swiftdeps %t-2-processed.swiftdeps // RUN: diff %t-processed.swiftdeps %t-2-processed.swiftdeps // RUN: %FileCheck -check-prefix=NEGATIVE %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift b/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift index 6c89ab21ec192..84e8f31141749 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift @@ -6,11 +6,11 @@ // RUN: cp %s %t/main.swift // Need -fine-grained-dependency-include-intrafile to be invarient wrt type-body-fingerprints enabled/disabled -// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - -experimental-private-intransitive-dependencies > %t.swiftdeps +// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - -enable-direct-intramodule-dependencies > %t.swiftdeps -// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - -experimental-private-intransitive-dependencies > %t-2.swiftdeps -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps -// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t-2.swiftdeps >%t-2-processed.swiftdeps +// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - -enable-direct-intramodule-dependencies > %t-2.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps +// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t-2.swiftdeps %t-2-processed.swiftdeps // RUN: diff %t-processed.swiftdeps %t-2-processed.swiftdeps diff --git a/test/Incremental/Verifier/multi-file-private/Inputs/Derived.swift b/test/Incremental/Verifier/multi-file-private/Inputs/Derived.swift index fafad458fc140..2041fe02bb52b 100644 --- a/test/Incremental/Verifier/multi-file-private/Inputs/Derived.swift +++ b/test/Incremental/Verifier/multi-file-private/Inputs/Derived.swift @@ -1,18 +1,21 @@ final public class OpenSubclass: OpenBase {} // expected-provides {{OpenSubclass}} expected-private-superclass {{main.OpenBase}} // expected-provides {{OpenBase}} // expected-private-member {{main.OpenBase.init}} +// expected-private-member {{main.OpenBase.deinit}} // expected-private-member {{main.OpenSubclass.init}} // expected-private-member {{main.OpenSubclass.deinit}} final public class PublicSubclass: PublicBase {} // expected-provides {{PublicSubclass}} expected-private-superclass {{main.PublicBase}} // expected-provides {{PublicBase}} // expected-private-member {{main.PublicBase.init}} +// expected-private-member {{main.PublicBase.deinit}} // expected-private-member {{main.PublicSubclass.init}} // expected-private-member {{main.PublicSubclass.deinit}} final internal class InternalSubclass: InternalBase {} // expected-provides {{InternalSubclass}} expected-private-superclass {{main.InternalBase}} // expected-provides {{InternalBase}} // expected-private-member {{main.InternalBase.init}} +// expected-private-member {{main.InternalBase.deinit}} // expected-private-member {{main.InternalSubclass.init}} // expected-private-member {{main.InternalSubclass.deinit}} diff --git a/test/Incremental/Verifier/multi-file-private/Inputs/Inner.swift b/test/Incremental/Verifier/multi-file-private/Inputs/Inner.swift new file mode 100644 index 0000000000000..b11217fcf15ff --- /dev/null +++ b/test/Incremental/Verifier/multi-file-private/Inputs/Inner.swift @@ -0,0 +1,14 @@ +// expected-provides{{Inner}} +// expected-private-member{{main.Inner.init}} +public struct Inner {} + +// expected-provides{{Foo}} +public typealias Foo = () -> (Inner) + +// expected-provides{{blah}} +public func blah(foo: Foo) {} + +// expected-provides{{defaultFoo}} +public var defaultFoo: Foo = { + return Inner() +} diff --git a/test/Incremental/Verifier/multi-file-private/Inputs/UsesInner.swift b/test/Incremental/Verifier/multi-file-private/Inputs/UsesInner.swift new file mode 100644 index 0000000000000..e76ff40174706 --- /dev/null +++ b/test/Incremental/Verifier/multi-file-private/Inputs/UsesInner.swift @@ -0,0 +1,8 @@ +// expected-provides{{Inner}} +// expected-provides{{defaultFoo}} +// expected-provides{{blah}} +// expected-provides{{Foo}} +// expected-provides{{??}} +public func blah(foo: Foo?) { + blah(foo: foo ?? defaultFoo) +} diff --git a/test/Incremental/Verifier/multi-file-private/main.swift b/test/Incremental/Verifier/multi-file-private/main.swift index 336b4a79df7b8..7c99c41979e90 100644 --- a/test/Incremental/Verifier/multi-file-private/main.swift +++ b/test/Incremental/Verifier/multi-file-private/main.swift @@ -1,7 +1,7 @@ // RUN: %empty-directory(%t) // RUN: %{python} %S/../gen-output-file-map.py -o %t %S/Inputs -r %t.resp -// RUN: cd %t && %target-swiftc_driver -typecheck -output-file-map %t/output.json -incremental -module-name main -experimental-private-intransitive-dependencies -verify-incremental-dependencies @%t.resp -// RUN: cd %t && %target-swiftc_driver -typecheck -output-file-map %t/output.json -incremental -enable-batch-mode -module-name main -experimental-private-intransitive-dependencies -verify-incremental-dependencies @%t.resp +// RUN: cd %t && %target-swiftc_driver -c -output-file-map %t/output.json -incremental -module-name main -enable-direct-intramodule-dependencies -verify-incremental-dependencies @%t.resp +// RUN: cd %t && %target-swiftc_driver -c -output-file-map %t/output.json -incremental -enable-batch-mode -module-name main -enable-direct-intramodule-dependencies -verify-incremental-dependencies @%t.resp // N.B. These tests are meant to continue to expand to more and more input files // as more kinds of cross-type dependencies are discovered. This will naturally diff --git a/test/Incremental/Verifier/multi-file/Inputs/Derived.swift b/test/Incremental/Verifier/multi-file/Inputs/Derived.swift index 1246ad927544c..681779673e085 100644 --- a/test/Incremental/Verifier/multi-file/Inputs/Derived.swift +++ b/test/Incremental/Verifier/multi-file/Inputs/Derived.swift @@ -1,18 +1,21 @@ final public class OpenSubclass: OpenBase {} // expected-provides {{OpenSubclass}} expected-cascading-superclass {{main.OpenBase}} // expected-provides {{OpenBase}} // expected-cascading-member {{main.OpenBase.init}} +// expected-private-member {{main.OpenBase.deinit}} // expected-cascading-member {{main.OpenSubclass.init}} // expected-private-member {{main.OpenSubclass.deinit}} final public class PublicSubclass: PublicBase {} // expected-provides {{PublicSubclass}} expected-cascading-superclass {{main.PublicBase}} // expected-provides {{PublicBase}} // expected-cascading-member {{main.PublicBase.init}} +// expected-private-member {{main.PublicBase.deinit}} // expected-cascading-member {{main.PublicSubclass.init}} // expected-private-member {{main.PublicSubclass.deinit}} final internal class InternalSubclass: InternalBase {} // expected-provides {{InternalSubclass}} expected-cascading-superclass {{main.InternalBase}} // expected-provides {{InternalBase}} // expected-cascading-member {{main.InternalBase.init}} +// expected-private-member {{main.InternalBase.deinit}} // expected-cascading-member {{main.InternalSubclass.init}} // expected-private-member {{main.InternalSubclass.deinit}} diff --git a/test/Incremental/Verifier/multi-file/Inputs/Inner.swift b/test/Incremental/Verifier/multi-file/Inputs/Inner.swift new file mode 100644 index 0000000000000..88bfc015a4fd8 --- /dev/null +++ b/test/Incremental/Verifier/multi-file/Inputs/Inner.swift @@ -0,0 +1,14 @@ +// expected-provides{{Inner}} +// expected-cascading-member{{main.Inner.init}} +public struct Inner {} + +// expected-provides{{Foo}} +public typealias Foo = () -> (Inner) + +// expected-provides{{blah}} +public func blah(foo: Foo) {} + +// expected-provides{{defaultFoo}} +public var defaultFoo: Foo = { + return Inner() +} diff --git a/test/Incremental/Verifier/multi-file/Inputs/UsesInner.swift b/test/Incremental/Verifier/multi-file/Inputs/UsesInner.swift new file mode 100644 index 0000000000000..3a1c5ab4d8ad9 --- /dev/null +++ b/test/Incremental/Verifier/multi-file/Inputs/UsesInner.swift @@ -0,0 +1,14 @@ +// FIXME: This dependency ONLY occurs with private dependencies. Otherwise we +// rely on the interface hash changing to cause this file to be rebuilt, which +// will *not* work with type fingerprints enabled. +// See rdar://63984581 +// fixme-provides{{Inner}} + +// expected-provides{{defaultFoo}} +// expected-provides{{blah}} +// expected-provides{{Optional}} +// expected-provides{{Foo}} +// expected-provides{{??}} +public func blah(foo: Optional) { + blah(foo: foo ?? defaultFoo) +} diff --git a/test/Incremental/Verifier/multi-file/main.swift b/test/Incremental/Verifier/multi-file/main.swift index 6647e0ac84663..24904da530e38 100644 --- a/test/Incremental/Verifier/multi-file/main.swift +++ b/test/Incremental/Verifier/multi-file/main.swift @@ -1,7 +1,7 @@ // RUN: %empty-directory(%t) // RUN: %{python} %S/../gen-output-file-map.py -o %t %S/Inputs -r %t.resp -// RUN: cd %t && %target-swiftc_driver -typecheck -output-file-map %t/output.json -incremental -module-name main -verify-incremental-dependencies @%t.resp -// RUN: cd %t && %target-swiftc_driver -typecheck -output-file-map %t/output.json -incremental -enable-batch-mode -module-name main -verify-incremental-dependencies @%t.resp +// RUN: cd %t && %target-swiftc_driver -c -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -module-name main -verify-incremental-dependencies @%t.resp +// RUN: cd %t && %target-swiftc_driver -c -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -enable-batch-mode -module-name main -verify-incremental-dependencies @%t.resp // N.B. These tests are meant to continue to expand to more and more input files // as more kinds of cross-type dependencies are discovered. This will naturally diff --git a/test/Incremental/Verifier/single-file-private/AnyObject.swift b/test/Incremental/Verifier/single-file-private/AnyObject.swift index 6f04c986b52d3..2e80b90832cab 100644 --- a/test/Incremental/Verifier/single-file-private/AnyObject.swift +++ b/test/Incremental/Verifier/single-file-private/AnyObject.swift @@ -9,7 +9,7 @@ // RUN: %empty-directory(%t) // RUN: %{python} %S/../gen-output-file-map.py -o %t %S -// RUN: cd %t && %target-swiftc_driver -typecheck -output-file-map %t/output.json -incremental -module-name main -experimental-private-intransitive-dependencies -verify-incremental-dependencies %s +// RUN: cd %t && %target-swiftc_driver -typecheck -output-file-map %t/output.json -incremental -module-name main -enable-direct-intramodule-dependencies -verify-incremental-dependencies %s import Foundation diff --git a/test/Incremental/Verifier/single-file-private/Conformances.swift b/test/Incremental/Verifier/single-file-private/Conformances.swift index 47f81267ba316..0e7260878b25f 100644 --- a/test/Incremental/Verifier/single-file-private/Conformances.swift +++ b/test/Incremental/Verifier/single-file-private/Conformances.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) // RUN: %{python} %S/../gen-output-file-map.py -o %t %S -// RUN: cd %t && %target-swiftc_driver -typecheck -output-file-map %t/output.json -incremental -module-name main -experimental-private-intransitive-dependencies -verify-incremental-dependencies %s +// RUN: cd %t && %target-swiftc_driver -typecheck -output-file-map %t/output.json -incremental -module-name main -enable-direct-intramodule-dependencies -verify-incremental-dependencies %s public protocol PublicProtocol { } // expected-provides {{PublicProtocol}} internal protocol InternalProtocol { } // expected-provides {{InternalProtocol}} diff --git a/test/Incremental/Verifier/single-file/AnyObject.swift b/test/Incremental/Verifier/single-file/AnyObject.swift index b5c17f3a27fd7..63a5e55f68007 100644 --- a/test/Incremental/Verifier/single-file/AnyObject.swift +++ b/test/Incremental/Verifier/single-file/AnyObject.swift @@ -9,7 +9,7 @@ // RUN: %empty-directory(%t) // RUN: %{python} %S/../gen-output-file-map.py -o %t %S -// RUN: cd %t && %target-swiftc_driver -typecheck -output-file-map %t/output.json -incremental -module-name main -verify-incremental-dependencies %s +// RUN: cd %t && %target-swiftc_driver -typecheck -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -module-name main -verify-incremental-dependencies %s import Foundation diff --git a/test/Incremental/Verifier/single-file/Conformances.swift b/test/Incremental/Verifier/single-file/Conformances.swift index a3363fbebb431..6da7ff91ffb13 100644 --- a/test/Incremental/Verifier/single-file/Conformances.swift +++ b/test/Incremental/Verifier/single-file/Conformances.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) // RUN: %{python} %S/../gen-output-file-map.py -o %t %S -// RUN: cd %t && %target-swiftc_driver -typecheck -output-file-map %t/output.json -incremental -module-name main -verify-incremental-dependencies %s +// RUN: cd %t && %target-swiftc_driver -typecheck -output-file-map %t/output.json -incremental -disable-direct-intramodule-dependencies -module-name main -verify-incremental-dependencies %s public protocol PublicProtocol { } // expected-provides {{PublicProtocol}} internal protocol InternalProtocol { } // expected-provides {{InternalProtocol}} diff --git a/test/Incremental/superfluous-cascade.swift b/test/Incremental/superfluous-cascade.swift index 41efae9d96957..e9d26f9b40507 100644 --- a/test/Incremental/superfluous-cascade.swift +++ b/test/Incremental/superfluous-cascade.swift @@ -9,7 +9,7 @@ // RUN: cp %t/definesPoint{-before,}.swift // RUN: touch -t 200101010101 %t/*.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json >&output1 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json >&output1 // Change one type - the cascading edge causes us to rebuild everything but main @@ -18,7 +18,7 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesPoint.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json >&output2 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json >&output2 // RUN: %FileCheck -check-prefix=CHECK-STATUS-QUO-RECOMPILED %s < %t/output2 @@ -37,7 +37,7 @@ // RUN: cp %t/definesPoint{-before,}.swift // RUN: touch -t 200101010101 %t/*.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json -experimental-private-intransitive-dependencies >&output3 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json -enable-direct-intramodule-dependencies >&output3 // Change one type - now only the user of that type rebuilds @@ -46,7 +46,7 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesPoint.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json -experimental-private-intransitive-dependencies >&output4 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json -enable-direct-intramodule-dependencies >&output4 // RUN: %FileCheck -check-prefix=CHECK-PRIVATE-RECOMPILED %s --dump-input=always < %t/output4 diff --git a/test/Inputs/process_fine_grained_swiftdeps.sh b/test/Inputs/process_fine_grained_swiftdeps.sh index 9d3426ccbd047..fb91c3875e95e 100755 --- a/test/Inputs/process_fine_grained_swiftdeps.sh +++ b/test/Inputs/process_fine_grained_swiftdeps.sh @@ -4,4 +4,6 @@ # # Also sort for consistency, since the node order can vary. -awk '/kind:/ {k = $2}; /aspect:/ {a = $2}; /context:/ {c = $2}; /name/ {n = $2}; /sequenceNumber/ {s = $2}; /isProvides:/ {print k, a, c, n, $2}' | sort +${1} --to-yaml --input-filename=${2} --output-filename=${3}.tmp + +awk '/kind:/ {k = $2}; /aspect:/ {a = $2}; /context:/ {c = $2}; /name/ {n = $2}; /sequenceNumber/ {s = $2}; /isProvides:/ {print k, a, c, n, $2}' < ${3}.tmp | sort > ${3} \ No newline at end of file diff --git a/test/Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh b/test/Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh index 80bb392c22cfb..2e117cd7a35d5 100755 --- a/test/Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh +++ b/test/Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh @@ -4,4 +4,6 @@ # # Also sort for consistency, since the node order can vary. -awk '/kind:/ {k = $2; f = ""}; /aspect:/ {a = $2}; /context:/ {c = $2}; /name/ {n = $2}; /sequenceNumber/ {s = $2}; /fingerprint:/ {f = $2 }; /isProvides:/ {isP = $2; print k, a, c, n, isP, f}' | sort +${1} --to-yaml --input-filename=${2} --output-filename=${3}.tmp + +awk '/kind:/ {k = $2; f = ""}; /aspect:/ {a = $2}; /context:/ {c = $2}; /name/ {n = $2}; /sequenceNumber/ {s = $2}; /fingerprint:/ {f = $2 }; /isProvides:/ {isP = $2; print k, a, c, n, isP, f}' < ${3}.tmp | sort > ${3} diff --git a/test/InterfaceHash/added_method-type-fingerprints.swift b/test/InterfaceHash/added_method-type-fingerprints.swift index 7b51e1f67b758..6776e086a7559 100644 --- a/test/InterfaceHash/added_method-type-fingerprints.swift +++ b/test/InterfaceHash/added_method-type-fingerprints.swift @@ -9,10 +9,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: not diff %t/{a,b}-processed.swiftdeps >%t/diffs diff --git a/test/InterfaceHash/added_private_class_private_property-type-fingerprints.swift b/test/InterfaceHash/added_private_class_private_property-type-fingerprints.swift index cf3a104cc71b1..5ba9627ce2731 100644 --- a/test/InterfaceHash/added_private_class_private_property-type-fingerprints.swift +++ b/test/InterfaceHash/added_private_class_private_property-type-fingerprints.swift @@ -6,10 +6,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: not diff %t/{a,b}-processed.swiftdeps >%t/diffs diff --git a/test/InterfaceHash/added_private_class_property-type-fingerprints.swift b/test/InterfaceHash/added_private_class_property-type-fingerprints.swift index f4e01619c1b76..d087848dd323f 100644 --- a/test/InterfaceHash/added_private_class_property-type-fingerprints.swift +++ b/test/InterfaceHash/added_private_class_property-type-fingerprints.swift @@ -6,10 +6,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: not diff %t/{a,b}-processed.swiftdeps >%t/diffs diff --git a/test/InterfaceHash/added_private_enum_private_property-type-fingerprints.swift b/test/InterfaceHash/added_private_enum_private_property-type-fingerprints.swift index 9ad0b28d56449..ed898ffdce3d1 100644 --- a/test/InterfaceHash/added_private_enum_private_property-type-fingerprints.swift +++ b/test/InterfaceHash/added_private_enum_private_property-type-fingerprints.swift @@ -9,10 +9,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: not diff %t/{a,b}-processed.swiftdeps >%t/diffs diff --git a/test/InterfaceHash/added_private_enum_property-type-fingerprints.swift b/test/InterfaceHash/added_private_enum_property-type-fingerprints.swift index c8220f6f9a54b..0589feefd6214 100644 --- a/test/InterfaceHash/added_private_enum_property-type-fingerprints.swift +++ b/test/InterfaceHash/added_private_enum_property-type-fingerprints.swift @@ -9,10 +9,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: not diff %t/{a,b}-processed.swiftdeps >%t/diffs diff --git a/test/InterfaceHash/added_private_method-type-fingerprints.swift b/test/InterfaceHash/added_private_method-type-fingerprints.swift index c0c60206d9c92..f6b8236e94b64 100644 --- a/test/InterfaceHash/added_private_method-type-fingerprints.swift +++ b/test/InterfaceHash/added_private_method-type-fingerprints.swift @@ -9,10 +9,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: not diff %t/{a,b}-processed.swiftdeps >%t/diffs diff --git a/test/InterfaceHash/added_private_method_value_types-type-fingerprints.swift b/test/InterfaceHash/added_private_method_value_types-type-fingerprints.swift index 42fee00e31bf0..8499fbd0ea835 100644 --- a/test/InterfaceHash/added_private_method_value_types-type-fingerprints.swift +++ b/test/InterfaceHash/added_private_method_value_types-type-fingerprints.swift @@ -9,10 +9,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: not diff %t/{a,b}-processed.swiftdeps >%t/diffs diff --git a/test/InterfaceHash/added_private_protocol_method-type-fingerprints.swift b/test/InterfaceHash/added_private_protocol_method-type-fingerprints.swift index c0ccd54a11771..f029cdb8b803d 100644 --- a/test/InterfaceHash/added_private_protocol_method-type-fingerprints.swift +++ b/test/InterfaceHash/added_private_protocol_method-type-fingerprints.swift @@ -9,10 +9,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: not diff %t/{a,b}-processed.swiftdeps >%t/diffs diff --git a/test/InterfaceHash/added_private_protocol_property-type-fingerprints.swift b/test/InterfaceHash/added_private_protocol_property-type-fingerprints.swift index c27cee3752b83..4a51a0df7957b 100644 --- a/test/InterfaceHash/added_private_protocol_property-type-fingerprints.swift +++ b/test/InterfaceHash/added_private_protocol_property-type-fingerprints.swift @@ -9,10 +9,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: not diff %t/{a,b}-processed.swiftdeps >%t/diffs diff --git a/test/InterfaceHash/added_private_struct_private_property-type-fingerprints.swift b/test/InterfaceHash/added_private_struct_private_property-type-fingerprints.swift index 47e371aff0901..b5d20cf3b317c 100644 --- a/test/InterfaceHash/added_private_struct_private_property-type-fingerprints.swift +++ b/test/InterfaceHash/added_private_struct_private_property-type-fingerprints.swift @@ -9,10 +9,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: not diff %t/{a,b}-processed.swiftdeps >%t/diffs diff --git a/test/InterfaceHash/added_private_struct_property-type-fingerprints.swift b/test/InterfaceHash/added_private_struct_property-type-fingerprints.swift index bd92b5dfbe37f..f27418b9036ff 100644 --- a/test/InterfaceHash/added_private_struct_property-type-fingerprints.swift +++ b/test/InterfaceHash/added_private_struct_property-type-fingerprints.swift @@ -9,10 +9,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: not diff %t/{a,b}-processed.swiftdeps >%t/diffs diff --git a/test/InterfaceHash/edited_method_body-type-fingerprints.swift b/test/InterfaceHash/edited_method_body-type-fingerprints.swift index 10ae3e000c09f..726a36d8ba931 100644 --- a/test/InterfaceHash/edited_method_body-type-fingerprints.swift +++ b/test/InterfaceHash/edited_method_body-type-fingerprints.swift @@ -9,10 +9,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: cmp %t/{a,b}-processed.swiftdeps diff --git a/test/InterfaceHash/edited_property_getter-type-fingerprints.swift b/test/InterfaceHash/edited_property_getter-type-fingerprints.swift index 0a0b5fdaaff54..9024944bd865c 100644 --- a/test/InterfaceHash/edited_property_getter-type-fingerprints.swift +++ b/test/InterfaceHash/edited_property_getter-type-fingerprints.swift @@ -9,10 +9,10 @@ // RUN: %{python} %utils/split_file.py -o %t %s // RUN: cp %t/{a,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/a-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/a-processed.swiftdeps // RUN: cp %t/{b,x}.swift // RUN: %target-swift-frontend -typecheck -enable-type-fingerprints -primary-file %t/x.swift -emit-reference-dependencies-path %t/x.swiftdeps -module-name main -// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh <%t/x.swiftdeps >%t/b-processed.swiftdeps +// RUN: %S/../Inputs/process_fine_grained_swiftdeps_with_fingerprints.sh %swift-dependency-tool %t/x.swiftdeps %t/b-processed.swiftdeps // RUN: cmp %t/{a,b}-processed.swiftdeps diff --git a/test/Profiler/instrprof_tsan.swift b/test/Profiler/instrprof_tsan.swift index e3b373f75c219..bbf96cb060625 100644 --- a/test/Profiler/instrprof_tsan.swift +++ b/test/Profiler/instrprof_tsan.swift @@ -1,3 +1,4 @@ +// REQUIRES: tsan_runtime // RUN: %target-swift-frontend -emit-ir -profile-generate -sanitize=thread %s | %FileCheck %s // TSan is only supported on 64 bit. diff --git a/test/Prototypes/CollectionTransformers.swift b/test/Prototypes/CollectionTransformers.swift index 2506daafd2377..84dcafe4c04c6 100644 --- a/test/Prototypes/CollectionTransformers.swift +++ b/test/Prototypes/CollectionTransformers.swift @@ -200,7 +200,7 @@ import Darwin import Dispatch // FIXME: port to Linux. -// XFAIL: linux, windows +// XFAIL: linux, windows, openbsd // A wrapper for pthread_t with platform-independent interface. public struct _stdlib_pthread_t : Equatable, Hashable { diff --git a/test/Runtime/environment_variables.swift b/test/Runtime/environment_variables.swift index 8f772339d3011..c62a74c4b5e74 100644 --- a/test/Runtime/environment_variables.swift +++ b/test/Runtime/environment_variables.swift @@ -1,9 +1,12 @@ // RUN: %empty-directory(%t) // RUN: %target-build-swift %s -o %t/main // RUN: %target-codesign %t/main + +// REQUIRES: executable_test + // RUN: env %env-SWIFT_DEBUG_HELP=YES %env-SWIFT_DEBUG_SOME_UNKNOWN_VARIABLE=42 %env-SWIFT_DEBUG_ENABLE_METADATA_ALLOCATION_ITERATION=YES %env-SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT=abc %env-SWIFT_DETERMINISTIC_HASHING=whatever %env-SWIFT_ENABLE_MANGLED_NAME_VERIFICATION=YES %target-run %t/main 2>&1 | %FileCheck %s --dump-input fail -// CHECK-DAG: {{Warning: unknown environment variable SWIFT_DEBUG_SOME_UNKNOWN_VARIABLE|Using getenv to read variables. Unknown variables will not be flagged.}} +// CHECK-DAG: {{Warning: unknown environment variable SWIFT_DEBUG_SOME_UNKNOWN_VARIABLE|Using getenv to read variables. Unknown SWIFT_DEBUG_ variables will not be flagged.}} // CHECK-DAG: Warning: cannot parse value SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT=abc, defaulting to 2. // CHECK-DAG: Warning: cannot parse value SWIFT_DETERMINISTIC_HASHING=whatever, defaulting to false. // CHECK-DAG: Swift runtime debugging: diff --git a/test/SILGen/Inputs/objc_dynamic_replacement_ext.swift b/test/SILGen/Inputs/objc_dynamic_replacement_ext.swift new file mode 100644 index 0000000000000..7823f67597b19 --- /dev/null +++ b/test/SILGen/Inputs/objc_dynamic_replacement_ext.swift @@ -0,0 +1,16 @@ +import Foundation + +public class Generic: NSObject { + @objc public dynamic func foo() {} + + @objc public dynamic var x: Int { + get { + return 0; + } + set { + print("noop") + } + } + + @objc public dynamic var y: Int = 0 +} diff --git a/test/SILGen/arguments.swift b/test/SILGen/arguments.swift index 30a8fc708164d..fdd26f1594c9a 100644 --- a/test/SILGen/arguments.swift +++ b/test/SILGen/arguments.swift @@ -14,6 +14,10 @@ func _allocateUninitializedArray(_: Builtin.Word) Builtin.int_trap() } +func _finalizeUninitializedArray(_ a: Array) -> Array { + return a +} + func _deallocateUninitializedArray(_: Array) {} var i:Int, f:Float, c:UnicodeScalar diff --git a/test/SILGen/errors.swift b/test/SILGen/errors.swift index 8919cb24009b5..4d78895fa4ab9 100644 --- a/test/SILGen/errors.swift +++ b/test/SILGen/errors.swift @@ -107,7 +107,6 @@ func dont_return(_ argument: T) throws -> T { // Catch HomeworkError.CatAteIt. // CHECK: [[MATCH]]([[T0:%.*]] : @owned $Cat): -// CHECK-NEXT: debug_value // CHECK-NEXT: [[BORROWED_T0:%.*]] = begin_borrow [[T0]] // CHECK-NEXT: [[T0_COPY:%.*]] = copy_value [[BORROWED_T0]] // CHECK-NEXT: end_borrow [[BORROWED_T0]] @@ -314,7 +313,6 @@ func all_together_now_four(_ flag: Bool) throws -> Cat? { // Catch HomeworkError.CatAteIt. // CHECK: [[MATCH_ATE]]([[T0:%.*]] : @owned $Cat): -// CHECK-NEXT: debug_value // CHECK-NEXT: [[T0_COPY:%.*]] = copy_value [[T0]] // CHECK-NEXT: destroy_value [[T0]] // CHECK-NEXT: dealloc_stack [[DEST_TEMP]] @@ -325,7 +323,6 @@ func all_together_now_four(_ flag: Bool) throws -> Cat? { // Catch HomeworkError.CatHidIt. // CHECK: [[MATCH_HID]]([[T0:%.*]] : @owned $Cat): -// CHECK-NEXT: debug_value // CHECK-NEXT: [[T0_COPY:%.*]] = copy_value [[T0]] // CHECK-NEXT: destroy_value [[T0]] // CHECK-NEXT: dealloc_stack [[DEST_TEMP]] @@ -335,6 +332,7 @@ func all_together_now_four(_ flag: Bool) throws -> Cat? { // CHECK-NEXT: br [[EXTRACT]]([[T0_COPY]] : $Cat) // CHECK: [[EXTRACT]]([[CAT:%.*]] : @owned $Cat): +// CHECK-NEXT: debug_value [[CAT]] : $Cat, let, name "theCat" // CHECK-NEXT: [[BORROWED_CAT:%.*]] = begin_borrow [[CAT]] : $Cat // CHECK-NEXT: [[COPIED_CAT:%.*]] = copy_value [[BORROWED_CAT]] : $Cat // CHECK-NEXT: end_borrow [[BORROWED_CAT]] : $Cat @@ -639,10 +637,12 @@ func test_variadic(_ cat: Cat) throws { // CHECK: [[NORM_3]]([[CAT3:%.*]] : @owned $Cat): // CHECK-NEXT: store [[CAT3]] to [init] [[ELT3]] // Complete the call and return. +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARRAY:%.*]] = apply [[FIN_FN]]([[ARRAY]]) // CHECK: [[TAKE_FN:%.*]] = function_ref @$s6errors14take_many_catsyyAA3CatCd_tKF : $@convention(thin) (@guaranteed Array) -> @error Error -// CHECK-NEXT: try_apply [[TAKE_FN]]([[ARRAY]]) : $@convention(thin) (@guaranteed Array) -> @error Error, normal [[NORM_CALL:bb[0-9]+]], error [[ERR_CALL:bb[0-9]+]] +// CHECK-NEXT: try_apply [[TAKE_FN]]([[FIN_ARRAY]]) : $@convention(thin) (@guaranteed Array) -> @error Error, normal [[NORM_CALL:bb[0-9]+]], error [[ERR_CALL:bb[0-9]+]] // CHECK: [[NORM_CALL]]([[T0:%.*]] : $()): -// CHECK-NEXT: destroy_value [[ARRAY]] +// CHECK-NEXT: destroy_value [[FIN_ARRAY]] // CHECK-NEXT: [[T0:%.*]] = tuple () // CHECK-NEXT: return // Failure from element 0. @@ -671,7 +671,7 @@ func test_variadic(_ cat: Cat) throws { // CHECK-NEXT: br [[RETHROW]]([[ERROR]] : $Error) // Failure from call. // CHECK: [[ERR_CALL]]([[ERROR:%.*]] : @owned $Error): -// CHECK-NEXT: destroy_value [[ARRAY]] +// CHECK-NEXT: destroy_value [[FIN_ARRAY]] // CHECK-NEXT: br [[RETHROW]]([[ERROR]] : $Error) // Rethrow. // CHECK: [[RETHROW]]([[ERROR:%.*]] : @owned $Error): diff --git a/test/SILGen/keypaths.swift b/test/SILGen/keypaths.swift index dfa89dbd806b6..7c1e88cff14a4 100644 --- a/test/SILGen/keypaths.swift +++ b/test/SILGen/keypaths.swift @@ -470,19 +470,25 @@ func test_variadics() { // CHECK: [[FN_REF:%[0-9]+]] = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF // CHECK: [[MAKE_ARR:%[0-9]+]] = apply [[FN_REF]]([[ARR_COUNT]]) // CHECK: ([[ARR:%[0-9]+]], %{{[0-9]+}}) = destructure_tuple [[MAKE_ARR]] : $(Array, Builtin.RawPointer) - // CHECK: keypath $KeyPath, (root $SubscriptVariadic1; gettable_property $Int, id @$s8keypaths18SubscriptVariadic1VyS2id_tcig : $@convention(method) (@guaranteed Array, SubscriptVariadic1) -> Int, getter @$s8keypaths18SubscriptVariadic1VyS2id_tcipACTK : $@convention(thin) (@in_guaranteed SubscriptVariadic1, UnsafeRawPointer) -> @out Int, indices [%$0 : $Array : $Array], indices_equals @$sSaySiGTH : $@convention(thin) (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$sSaySiGTh : $@convention(thin) (UnsafeRawPointer) -> Int) ([[ARR]]) + // CHECK: [[FIN_REF:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK: [[FIN_ARR:%[0-9]+]] = apply [[FIN_REF]]([[ARR]]) + // CHECK: keypath $KeyPath, (root $SubscriptVariadic1; gettable_property $Int, id @$s8keypaths18SubscriptVariadic1VyS2id_tcig : $@convention(method) (@guaranteed Array, SubscriptVariadic1) -> Int, getter @$s8keypaths18SubscriptVariadic1VyS2id_tcipACTK : $@convention(thin) (@in_guaranteed SubscriptVariadic1, UnsafeRawPointer) -> @out Int, indices [%$0 : $Array : $Array], indices_equals @$sSaySiGTH : $@convention(thin) (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$sSaySiGTh : $@convention(thin) (UnsafeRawPointer) -> Int) ([[FIN_ARR]]) _ = \SubscriptVariadic1.[1, 2, 3] // CHECK: [[ARR_COUNT:%[0-9]+]] = integer_literal $Builtin.Word, 1 // CHECK: [[FN_REF:%[0-9]+]] = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF // CHECK: [[MAKE_ARR:%[0-9]+]] = apply [[FN_REF]]([[ARR_COUNT]]) // CHECK: ([[ARR:%[0-9]+]], %{{[0-9]+}}) = destructure_tuple [[MAKE_ARR]] : $(Array, Builtin.RawPointer) - // CHECK: keypath $KeyPath, (root $SubscriptVariadic1; gettable_property $Int, id @$s8keypaths18SubscriptVariadic1VyS2id_tcig : $@convention(method) (@guaranteed Array, SubscriptVariadic1) -> Int, getter @$s8keypaths18SubscriptVariadic1VyS2id_tcipACTK : $@convention(thin) (@in_guaranteed SubscriptVariadic1, UnsafeRawPointer) -> @out Int, indices [%$0 : $Array : $Array], indices_equals @$sSaySiGTH : $@convention(thin) (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$sSaySiGTh : $@convention(thin) (UnsafeRawPointer) -> Int) ([[ARR]]) + // CHECK: [[FIN_REF:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK: [[FIN_ARR:%[0-9]+]] = apply [[FIN_REF]]([[ARR]]) + // CHECK: keypath $KeyPath, (root $SubscriptVariadic1; gettable_property $Int, id @$s8keypaths18SubscriptVariadic1VyS2id_tcig : $@convention(method) (@guaranteed Array, SubscriptVariadic1) -> Int, getter @$s8keypaths18SubscriptVariadic1VyS2id_tcipACTK : $@convention(thin) (@in_guaranteed SubscriptVariadic1, UnsafeRawPointer) -> @out Int, indices [%$0 : $Array : $Array], indices_equals @$sSaySiGTH : $@convention(thin) (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$sSaySiGTh : $@convention(thin) (UnsafeRawPointer) -> Int) ([[FIN_ARR]]) _ = \SubscriptVariadic1.[1] // CHECK: [[ARR_COUNT:%[0-9]+]] = integer_literal $Builtin.Word, 0 // CHECK: [[FN_REF:%[0-9]+]] = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF // CHECK: [[MAKE_ARR:%[0-9]+]] = apply [[FN_REF]]([[ARR_COUNT]]) // CHECK: ([[ARR:%[0-9]+]], %{{[0-9]+}}) = destructure_tuple [[MAKE_ARR]] : $(Array, Builtin.RawPointer) - // CHECK: keypath $KeyPath, (root $SubscriptVariadic1; gettable_property $Int, id @$s8keypaths18SubscriptVariadic1VyS2id_tcig : $@convention(method) (@guaranteed Array, SubscriptVariadic1) -> Int, getter @$s8keypaths18SubscriptVariadic1VyS2id_tcipACTK : $@convention(thin) (@in_guaranteed SubscriptVariadic1, UnsafeRawPointer) -> @out Int, indices [%$0 : $Array : $Array], indices_equals @$sSaySiGTH : $@convention(thin) (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$sSaySiGTh : $@convention(thin) (UnsafeRawPointer) -> Int) ([[ARR]]) + // CHECK: [[FIN_REF:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK: [[FIN_ARR:%[0-9]+]] = apply [[FIN_REF]]([[ARR]]) + // CHECK: keypath $KeyPath, (root $SubscriptVariadic1; gettable_property $Int, id @$s8keypaths18SubscriptVariadic1VyS2id_tcig : $@convention(method) (@guaranteed Array, SubscriptVariadic1) -> Int, getter @$s8keypaths18SubscriptVariadic1VyS2id_tcipACTK : $@convention(thin) (@in_guaranteed SubscriptVariadic1, UnsafeRawPointer) -> @out Int, indices [%$0 : $Array : $Array], indices_equals @$sSaySiGTH : $@convention(thin) (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$sSaySiGTh : $@convention(thin) (UnsafeRawPointer) -> Int) ([[FIN_ARR]]) _ = \SubscriptVariadic1.[] _ = \SubscriptVariadic2.["", "1"] @@ -491,7 +497,9 @@ func test_variadics() { // CHECK: [[FN_REF:%[0-9]+]] = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF // CHECK: [[MAKE_ARR:%[0-9]+]] = apply [[FN_REF]]([[ARR_COUNT]]) // CHECK: ([[ARR:%[0-9]+]], %{{[0-9]+}}) = destructure_tuple [[MAKE_ARR]] : $(Array, Builtin.RawPointer) - // CHECK: keypath $KeyPath, (root $SubscriptVariadic2; gettable_property $String, id @$s8keypaths18SubscriptVariadic2Vyxxd_tcs26ExpressibleByStringLiteralRzluig : $@convention(method) <τ_0_0 where τ_0_0 : ExpressibleByStringLiteral> (@guaranteed Array<τ_0_0>, SubscriptVariadic2) -> @out τ_0_0, getter @$s8keypaths18SubscriptVariadic2Vyxxd_tcs26ExpressibleByStringLiteralRzluipACSSTK : $@convention(thin) (@in_guaranteed SubscriptVariadic2, UnsafeRawPointer) -> @out String, indices [%$0 : $Array : $Array], indices_equals @$sSaySSGTH : $@convention(thin) (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$sSaySSGTh : $@convention(thin) (UnsafeRawPointer) -> Int) ([[ARR]]) + // CHECK: [[FIN_REF:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK: [[FIN_ARR:%[0-9]+]] = apply [[FIN_REF]]([[ARR]]) + // CHECK: keypath $KeyPath, (root $SubscriptVariadic2; gettable_property $String, id @$s8keypaths18SubscriptVariadic2Vyxxd_tcs26ExpressibleByStringLiteralRzluig : $@convention(method) <τ_0_0 where τ_0_0 : ExpressibleByStringLiteral> (@guaranteed Array<τ_0_0>, SubscriptVariadic2) -> @out τ_0_0, getter @$s8keypaths18SubscriptVariadic2Vyxxd_tcs26ExpressibleByStringLiteralRzluipACSSTK : $@convention(thin) (@in_guaranteed SubscriptVariadic2, UnsafeRawPointer) -> @out String, indices [%$0 : $Array : $Array], indices_equals @$sSaySSGTH : $@convention(thin) (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$sSaySSGTh : $@convention(thin) (UnsafeRawPointer) -> Int) ([[FIN_ARR]]) _ = \SubscriptVariadic2.["", #function] _ = \SubscriptVariadic3.[""] diff --git a/test/SILGen/literals.swift b/test/SILGen/literals.swift index e173d94f02ce1..0b8f2bc833410 100644 --- a/test/SILGen/literals.swift +++ b/test/SILGen/literals.swift @@ -57,9 +57,11 @@ class TakesArrayLiteral : ExpressibleByArrayLiteral { // CHECK: [[IDX1:%.*]] = integer_literal $Builtin.Word, 1 // CHECK: [[POINTER1:%.*]] = index_addr [[POINTER]] : $*Int, [[IDX1]] : $Builtin.Word // CHECK: store [[TMP:%.*]] to [trivial] [[POINTER1]] +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]([[ARR]]) // CHECK: [[METATYPE:%.*]] = metatype $@thick TakesArrayLiteral.Type -// CHECK: [[CTOR:%.*]] = class_method %15 : $@thick TakesArrayLiteral.Type, #TakesArrayLiteral.init!allocator : (TakesArrayLiteral.Type) -> (Element...) -> TakesArrayLiteral, $@convention(method) -// CHECK: [[RESULT:%.*]] = apply [[CTOR]]([[ARR]], [[METATYPE]]) +// CHECK: [[CTOR:%.*]] = class_method [[METATYPE]] : $@thick TakesArrayLiteral.Type, #TakesArrayLiteral.init!allocator : (TakesArrayLiteral.Type) -> (Element...) -> TakesArrayLiteral, $@convention(method) +// CHECK: [[RESULT:%.*]] = apply [[CTOR]]([[FIN_ARR]], [[METATYPE]]) // CHECK: return [[RESULT]] func returnsCustomArray() -> TakesArrayLiteral { // Use temporary to simplify generated_sil @@ -79,9 +81,11 @@ class Klass {} // CHECK: [[CTOR:%.*]] = function_ref @$s8literals5KlassCACycfC : $@convention(method) (@thick Klass.Type) -> @owned Klass // CHECK: [[TMP:%.*]] = apply [[CTOR]]([[KLASS_METATYPE]]) : $@convention(method) (@thick Klass.Type) -> @owned Klass // CHECK: store [[TMP]] to [init] [[POINTER]] +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]([[ARR]]) // CHECK: [[METATYPE:%.*]] = metatype $@thick TakesArrayLiteral.Type // CHECK: [[CTOR:%.*]] = class_method [[METATYPE]] : $@thick TakesArrayLiteral.Type, #TakesArrayLiteral.init!allocator : (TakesArrayLiteral.Type) -> (Element...) -> TakesArrayLiteral, $@convention(method) -// CHECK: [[RESULT:%.*]] = apply [[CTOR]]([[ARR]], [[METATYPE]]) +// CHECK: [[RESULT:%.*]] = apply [[CTOR]]([[FIN_ARR]], [[METATYPE]]) // CHECK: return [[RESULT]] func returnsClassElementArray() -> TakesArrayLiteral { return [Klass()] @@ -98,9 +102,11 @@ struct Foo { // CHECK: ([[ARR:%.*]], [[ADDRESS:%.*]]) = destructure_tuple [[ARR_TMP]] // CHECK: [[POINTER:%.*]] = pointer_to_address [[ADDRESS]] // CHECK: copy_addr %0 to [initialization] [[POINTER]] : $*Foo +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]>([[ARR]]) // CHECK: [[METATYPE:%.*]] = metatype $@thick TakesArrayLiteral>.Type // CHECK: [[CTOR:%.*]] = class_method [[METATYPE]] : $@thick TakesArrayLiteral>.Type, #TakesArrayLiteral.init!allocator : (TakesArrayLiteral.Type) -> (Element...) -> TakesArrayLiteral, $@convention(method) -// CHECK: [[RESULT:%.*]] = apply [[CTOR]]>([[ARR]], [[METATYPE]]) +// CHECK: [[RESULT:%.*]] = apply [[CTOR]]>([[FIN_ARR]], [[METATYPE]]) // CHECK: return [[RESULT]] func returnsAddressOnlyElementArray(t: Foo) -> TakesArrayLiteral> { return [t] @@ -113,9 +119,11 @@ func returnsAddressOnlyElementArray(t: Foo) -> TakesArrayLiteral> { // CHECK: ([[ARR:%.*]], [[ADDRESS:%.*]]) = destructure_tuple [[ARR_TMP]] // CHECK: [[POINTER:%.*]] = pointer_to_address [[ADDRESS]] // CHECK: copy_addr %0 to [initialization] [[POINTER]] : $*Foo +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]>([[ARR]]) // CHECK: [[METATYPE:%.*]] = metatype $@thick TakesArrayLiteral>.Type // CHECK: [[CTOR:%.*]] = class_method [[METATYPE]] : $@thick TakesArrayLiteral>.Type, #TakesArrayLiteral.init!allocator : (TakesArrayLiteral.Type) -> (Element...) -> TakesArrayLiteral, $@convention(method) -// CHECK: [[RESULT:%.*]] = apply [[CTOR]]>([[ARR]], [[METATYPE]]) +// CHECK: [[RESULT:%.*]] = apply [[CTOR]]>([[FIN_ARR]], [[METATYPE]]) // CHECK: return [[RESULT]] extension Foo { func returnsArrayFromSelf() -> TakesArrayLiteral> { @@ -132,9 +140,11 @@ extension Foo { // CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] %0 : $*Foo // CHECK: copy_addr [[ACCESS]] to [initialization] [[POINTER]] : $*Foo // CHECK: end_access [[ACCESS]] : $*Foo +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]>([[ARR]]) // CHECK: [[METATYPE:%.*]] = metatype $@thick TakesArrayLiteral>.Type // CHECK: [[CTOR:%.*]] = class_method [[METATYPE]] : $@thick TakesArrayLiteral>.Type, #TakesArrayLiteral.init!allocator : (TakesArrayLiteral.Type) -> (Element...) -> TakesArrayLiteral, $@convention(method) -// CHECK: [[RESULT:%.*]] = apply [[CTOR]]>([[ARR]], [[METATYPE]]) +// CHECK: [[RESULT:%.*]] = apply [[CTOR]]>([[FIN_ARR]], [[METATYPE]]) // CHECK: return [[RESULT]] extension Foo { mutating func returnsArrayFromMutatingSelf() -> TakesArrayLiteral> { @@ -159,9 +169,11 @@ struct Foo2 { // CHECK: [[CTOR:%.*]] = function_ref @$s8literals4Foo2V1kAcA5KlassC_tcfC : $@convention(method) (@owned Klass, @thin Foo2.Type) -> @owned Foo2 // CHECK: [[TMP:%.*]] = apply [[CTOR]]([[K]], [[METATYPE_FOO2]]) : $@convention(method) (@owned Klass, @thin Foo2.Type) -> @owned Foo2 // store [[TMP]] to [init] [[POINTER]] : $*Foo2 +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]([[ARR]]) // CHECK: [[METATYPE:%.*]] = metatype $@thick TakesArrayLiteral.Type // CHECK: [[CTOR:%.*]] = class_method [[METATYPE]] : $@thick TakesArrayLiteral.Type, #TakesArrayLiteral.init!allocator : (TakesArrayLiteral.Type) -> (Element...) -> TakesArrayLiteral, $@convention(method) -// CHECK: [[RESULT:%.*]] = apply [[CTOR]]([[ARR]], [[METATYPE]]) +// CHECK: [[RESULT:%.*]] = apply [[CTOR]]([[FIN_ARR]], [[METATYPE]]) // CHECK: return [[RESULT]] func returnsNonTrivialStruct() -> TakesArrayLiteral { return [Foo2(k: Klass())] @@ -180,10 +192,12 @@ func returnsNonTrivialStruct() -> TakesArrayLiteral { // CHECK: [[TMP:%.*]] = apply [[OTHER_FN]]([[ACCESS]]) : $@convention(method) (@inout NestedLValuePath) -> @owned NestedLValuePath // CHECK: end_access [[ACCESS]] : $*NestedLValuePath // CHECK: store [[TMP]] to [init] [[POINTER]] : $*NestedLValuePath +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]([[ARR]]) // CHECK: [[METATYPE:%.*]] = metatype $@thick TakesArrayLiteral.Type // CHECK: [[CTOR:%.*]] = class_method [[METATYPE]] : $@thick TakesArrayLiteral.Type, #TakesArrayLiteral.init!allocator : (TakesArrayLiteral.Type) -> (Element...) -> TakesArrayLiteral, $@convention(method) -// CHECK: [[ARR_RESULT:%.*]] = apply [[CTOR]]([[ARR]], [[METATYPE]]) -// CHECK: [[CTOR:%.*]] = function_ref @$s8literals16NestedLValuePathV3arrAcA17TakesArrayLiteralCyACG_tcfC : $@convention(method) (@owned TakesArrayLiteral, @thin NestedLValuePath.Type) -> @owned NestedLValuePath // user: %18 +// CHECK: [[ARR_RESULT:%.*]] = apply [[CTOR]]([[FIN_ARR]], [[METATYPE]]) +// CHECK: [[CTOR:%.*]] = function_ref @$s8literals16NestedLValuePathV3arrAcA17TakesArrayLiteralCyACG_tcfC : $@convention(method) (@owned TakesArrayLiteral, @thin NestedLValuePath.Type) -> @owned NestedLValuePath // CHECK: [[RESULT:%.*]] = apply [[CTOR]]([[ARR_RESULT]], [[METATYPE_NESTED]]) : $@convention(method) (@owned TakesArrayLiteral, @thin NestedLValuePath.Type) -> @owned NestedLValuePath // CHECK: [[ACCESS:%.*]] = begin_access [modify] [unknown] %0 : $*NestedLValuePath // CHECK: assign [[RESULT]] to [[ACCESS]] : $*NestedLValuePath @@ -214,9 +228,11 @@ protocol WrapsSelfInArray {} // CHECK: [[EXISTENTIAL:%.*]] = init_existential_addr [[POINTER]] : $*WrapsSelfInArray, $Self // CHECK: copy_addr [[ACCESS]] to [initialization] [[EXISTENTIAL]] : $*Self // CHECK: end_access [[ACCESS]] : $*Self +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]([[ARR]]) // CHECK: [[METATYPE:%.*]] = metatype $@thick TakesArrayLiteral.Type // CHECK: [[CTOR:%.*]] = class_method [[METATYPE]] : $@thick TakesArrayLiteral.Type, #TakesArrayLiteral.init!allocator : (TakesArrayLiteral.Type) -> (Element...) -> TakesArrayLiteral, $@convention(method) -// CHECK: [[RESULT:%.*]] = apply [[CTOR]]([[ARR]], [[METATYPE]]) +// CHECK: [[RESULT:%.*]] = apply [[CTOR]]([[FIN_ARR]], [[METATYPE]]) // CHECK: return [[RESULT]] extension WrapsSelfInArray { mutating func wrapInArray() -> TakesArrayLiteral { @@ -245,7 +261,9 @@ func makeBasic() -> T { return T() } // CHECK: try_apply [[FN]]([[POINTER1]]) : {{.*}} normal bb1, error bb2 // CHECK: bb1([[TMP:%.*]] : $()): -// CHECK: return [[ARR]] +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]([[ARR]]) +// CHECK: return [[FIN_ARR]] // CHECK: bb2([[ERR:%.*]] : @owned $Error): // CHECK: destroy_addr [[POINTER]] : $*T @@ -278,9 +296,11 @@ class TakesDictionaryLiteral : ExpressibleByDictionaryLiteral { // CHECK: [[VALUE_ADDR:%.*]] = tuple_element_addr [[TUPLE_ADDR1]] : $*(Int, Int), 1 // CHECK: store [[TMP]] to [trivial] [[KEY_ADDR]] : $*Int // CHECK: store [[TMP]] to [trivial] [[VALUE_ADDR]] : $*Int +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]<(Int, Int)>([[ARR]]) // CHECK: [[METATYPE:%.*]] = metatype $@thick TakesDictionaryLiteral.Type // CHECK: [[CTOR:%.*]] = class_method [[METATYPE]] : $@thick TakesDictionaryLiteral.Type, #TakesDictionaryLiteral.init!allocator : (TakesDictionaryLiteral.Type) -> ((Key, Value)...) -> TakesDictionaryLiteral, $@convention(method) <τ_0_0, τ_0_1> (@owned Array<(τ_0_0, τ_0_1)>, @thick TakesDictionaryLiteral<τ_0_0, τ_0_1>.Type) -> @owned TakesDictionaryLiteral<τ_0_0, τ_0_1> -// CHECK: [[RESULT:%.*]] = apply [[CTOR]](%8, %21) +// CHECK: [[RESULT:%.*]] = apply [[CTOR]]([[FIN_ARR]], [[METATYPE]]) // CHECK: return [[RESULT]] func returnsCustomDictionary() -> TakesDictionaryLiteral { diff --git a/test/SILGen/objc_bridging_array.swift b/test/SILGen/objc_bridging_array.swift index 33c7d136797c8..77d58276290f3 100644 --- a/test/SILGen/objc_bridging_array.swift +++ b/test/SILGen/objc_bridging_array.swift @@ -25,11 +25,13 @@ func setChildren(p: Parent, c: Child) { // CHECK: [[BUFFER:%.*]] = pointer_to_address [[BUFFER_PTR]] : $Builtin.RawPointer to [strict] $*Child // CHECK: [[CHILD:%.*]] = copy_value %1 : $Child // CHECK: store [[CHILD]] to [init] [[BUFFER]] : $*Child +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]([[ARRAY]]) // CHECK: [[FN:%.*]] = function_ref @$sSa10FoundationE19_bridgeToObjectiveCSo7NSArrayCyF : $@convention(method) <τ_0_0> (@guaranteed Array<τ_0_0>) -> @owned NSArray -// CHECK: [[BORROW_ARRAY:%.*]] = begin_borrow [[ARRAY]] : $Array +// CHECK: [[BORROW_ARRAY:%.*]] = begin_borrow [[FIN_ARR]] : $Array // CHECK: [[BRIDGED_ARRAY:%.*]] = apply [[FN]]([[BORROW_ARRAY]]) : $@convention(method) <τ_0_0> (@guaranteed Array<τ_0_0>) -> @owned NSArray // CHECK: end_borrow [[BORROW_ARRAY]] : $Array -// CHECK: destroy_value [[ARRAY]] : $Array +// CHECK: destroy_value [[FIN_ARR]] : $Array // CHECK: [[FN:%.*]] = objc_method [[COPIED]] : $[[OPENED_TYPE]], #Parent.children!setter.foreign : (Self) -> ([Child]) -> (), $@convention(objc_method) <τ_0_0 where τ_0_0 : Parent> (NSArray, τ_0_0) -> () // CHECK: apply [[FN]]<[[OPENED_TYPE]]>([[BRIDGED_ARRAY]], [[COPIED]]) : $@convention(objc_method) <τ_0_0 where τ_0_0 : Parent> (NSArray, τ_0_0) -> () // CHECK: destroy_value [[BRIDGED_ARRAY]] : $NSArray diff --git a/test/SILGen/objc_dynamic_replacement_ext.swift b/test/SILGen/objc_dynamic_replacement_ext.swift new file mode 100644 index 0000000000000..736ed735c892f --- /dev/null +++ b/test/SILGen/objc_dynamic_replacement_ext.swift @@ -0,0 +1,81 @@ +// RUN: %empty-directory(%t) +// RUN: %target-swift-emit-silgen -module-name SomeModule %S/Inputs/objc_dynamic_replacement_ext.swift -swift-version 5 -enable-implicit-dynamic | %FileCheck %s --check-prefix=IMPORT +// RUN: %target-swift-emit-silgen -module-name SomeModule %S/Inputs/objc_dynamic_replacement_ext.swift -swift-version 5 | %FileCheck %s --check-prefix=NO +// RUN: %target-swift-frontend -module-name SomeModule -emit-module -emit-module-path=%t/SomeModule.swiftmodule %S/Inputs/objc_dynamic_replacement_ext.swift -swift-version 5 -validate-tbd-against-ir=all +// RUN: %target-swift-frontend -module-name SomeModule -emit-module -emit-module-path=%t/SomeModule.swiftmodule %S/Inputs/objc_dynamic_replacement_ext.swift -swift-version 5 -enable-implicit-dynamic -validate-tbd-against-ir=all +// RUN: %target-swift-emit-silgen -I %t %s -swift-version 5 | %FileCheck %s +// RUN: %target-swift-emit-ir -I %t %s -swift-version 5 -validate-tbd-against-ir=all + +// REQUIRES: objc_interop + +import Foundation +import SomeModule + +// Make sure we support replacing @objc dynamic methods in generic classes. +// Normally we would disallow such methods in extensions because we don't +// support emitting objc categories for native generic classes. We special case +// @_dynamicReplacements for such methods and use the native dynamic replacement +// mechanism instead. + +// In imported file: +// public class Generic: NSObject { +// @objc public dynamic func foo() {} +// @objc public dynamic var x: Int { +// get { +// return 0; +// } +// set { +// print("noop") +// } +// } +// @objc public dynamic var y: Int = 0 +// } + +// IMPORT-DAG: sil [dynamically_replacable] [ossa] @$s10SomeModule7GenericC3fooyyF : $@convention(method) (@guaranteed Generic) -> () +// IMPORT-DAG: sil [thunk] [ossa] @$s10SomeModule7GenericC3fooyyFTo : $@convention(objc_method) (Generic) -> () + +// IMPORT-DAG: sil [thunk] [ossa] @$s10SomeModule7GenericC1xSivgTo : $@convention(objc_method) (Generic) -> Int +// IMPORT-DAG: sil [dynamically_replacable] [ossa] @$s10SomeModule7GenericC1xSivg : $@convention(method) (@guaranteed Generic) -> Int +// IMPORT-DAG: sil [thunk] [ossa] @$s10SomeModule7GenericC1xSivsTo : $@convention(objc_method) (Int, Generic) -> () +// IMPORT-DAG: sil [dynamically_replacable] [ossa] @$s10SomeModule7GenericC1xSivs : $@convention(method) (Int, @guaranteed Generic) -> () + +// NO-DAG: sil [thunk] [ossa] @$s10SomeModule7GenericC1xSivgTo : $@convention(objc_method) (Generic) -> Int +// NO-DAG: sil [ossa] @$s10SomeModule7GenericC1xSivg : $@convention(method) (@guaranteed Generic) -> Int +// NO-DAG: sil [thunk] [ossa] @$s10SomeModule7GenericC1xSivsTo : $@convention(objc_method) (Int, Generic) -> () +// NO-DAG: sil [ossa] @$s10SomeModule7GenericC1xSivs : $@convention(method) (Int, @guaranteed Generic) -> () + +// IMPORT-DAG: sil [thunk] [ossa] @$s10SomeModule7GenericC1ySivgTo : $@convention(objc_method) (Generic) -> Int +// IMPORT-DAG: sil [dynamically_replacable] [ossa] @$s10SomeModule7GenericC1ySivg : $@convention(method) (@guaranteed Generic) -> Int +// IMPORT-DAG: sil [thunk] [ossa] @$s10SomeModule7GenericC1ySivsTo : $@convention(objc_method) (Int, Generic) -> () +// IMPORT-DAG: sil [dynamically_replacable] [ossa] @$s10SomeModule7GenericC1ySivs : $@convention(method) (Int, @guaranteed Generic) -> () + +extension Generic { + @_dynamicReplacement(for: foo()) public func __replacement__foo() {} +// CHECK-DAG: sil [dynamic_replacement_for "$s10SomeModule7GenericC3fooyyF"] [ossa] @$s10SomeModule7GenericC28objc_dynamic_replacement_extE02__F5__fooyyF : $@convention(method) (@guaranteed Generic) -> () +// CHECK-NOT: sil {{.*}} @$s10SomeModule7GenericC28objc_dynamic_replacement_extE02__F5__fooyyFTo : $@convention(objc_method) (Generic) -> () + + @_dynamicReplacement(for: x) public var __replacement_x : Int { + get { + return 0; + } + set { + print("noop") + } + } +// CHECK-NOT: sil {{.*}} @$s10SomeModule7GenericC28objc_dynamic_replacement_extE02__F2_xSivgTo : $@convention(objc_method) (Generic) -> Int +// CHECK-DAG: sil [dynamic_replacement_for "$s10SomeModule7GenericC1xSivg"] [ossa] @$s10SomeModule7GenericC28objc_dynamic_replacement_extE02__F2_xSivg : $@convention(method) (@guaranteed Generic) -> Int +// CHECK-NOT: sil {{.*}} @$s10SomeModule7GenericC28objc_dynamic_replacement_extE02__F2_xSivsTo : $@convention(objc_method) (Int, Generic) -> () +// CHECK-DAG: sil [dynamic_replacement_for "$s10SomeModule7GenericC1xSivs"] [ossa] @$s10SomeModule7GenericC28objc_dynamic_replacement_extE02__F2_xSivs : $@convention(method) (Int, @guaranteed Generic) -> () + + @_dynamicReplacement(for: y) public var __replacement_y : Int { + get { + return 7; + } + set { + } + } +// CHECK-NOT: sil {{.*}} @$s10SomeModule7GenericC28objc_dynamic_replacement_extE02__F2_ySivgTo : $@convention(objc_method) (Generic) -> Int +// CHECK-DAG: sil [dynamic_replacement_for "$s10SomeModule7GenericC1ySivg"] [ossa] @$s10SomeModule7GenericC28objc_dynamic_replacement_extE02__F2_ySivg : $@convention(method) (@guaranteed Generic) -> Int +// CHECK-NOT: sil {{.*}} @$s10SomeModule7GenericC28objc_dynamic_replacement_extE02__F2_ySivsTo : $@convention(objc_method) (Int, Generic) -> () +// CHECK-DAG: sil [dynamic_replacement_for "$s10SomeModule7GenericC1ySivs"] [ossa] @$s10SomeModule7GenericC28objc_dynamic_replacement_extE02__F2_ySivs : $@convention(method) (Int, @guaranteed Generic) -> () +} diff --git a/test/SILGen/scalar_to_tuple_args.swift b/test/SILGen/scalar_to_tuple_args.swift index a549998b8f8da..67888cc061196 100644 --- a/test/SILGen/scalar_to_tuple_args.swift +++ b/test/SILGen/scalar_to_tuple_args.swift @@ -58,14 +58,18 @@ tupleWithDefaults(x: (x,x)) // CHECK: [[ADDR:%.*]] = pointer_to_address [[MEMORY]] // CHECK: [[READ:%.*]] = begin_access [read] [dynamic] [[X_ADDR]] : $*Int // CHECK: copy_addr [[READ]] to [initialization] [[ADDR]] +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]([[ARRAY]]) // CHECK: [[VARIADIC_FIRST:%.*]] = function_ref @$s20scalar_to_tuple_args13variadicFirstyySid_tF -// CHECK: apply [[VARIADIC_FIRST]]([[ARRAY]]) +// CHECK: apply [[VARIADIC_FIRST]]([[FIN_ARR]]) variadicFirst(x) // CHECK: [[READ:%.*]] = begin_access [read] [dynamic] [[X_ADDR]] : $*Int // CHECK: [[X:%.*]] = load [trivial] [[READ]] // CHECK: [[ALLOC_ARRAY:%.*]] = apply {{.*}} -> (@owned Array<τ_0_0>, Builtin.RawPointer) // CHECK: ([[ARRAY:%.*]], [[MEMORY:%.*]]) = destructure_tuple [[ALLOC_ARRAY]] +// CHECK: [[FIN_FN:%.*]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF +// CHECK: [[FIN_ARR:%.*]] = apply [[FIN_FN]]([[ARRAY]]) // CHECK: [[VARIADIC_SECOND:%.*]] = function_ref @$s20scalar_to_tuple_args14variadicSecondyySi_SidtF -// CHECK: apply [[VARIADIC_SECOND]]([[X]], [[ARRAY]]) +// CHECK: apply [[VARIADIC_SECOND]]([[X]], [[FIN_ARR]]) variadicSecond(x) diff --git a/test/SILGen/switch-case-debug-descriptions.swift b/test/SILGen/switch-case-debug-descriptions.swift new file mode 100644 index 0000000000000..d7b26f76f3771 --- /dev/null +++ b/test/SILGen/switch-case-debug-descriptions.swift @@ -0,0 +1,57 @@ +// RUN: %target-swift-emit-silgen -module-name switch %s -Xllvm -sil-print-debuginfo | %FileCheck %s -check-prefix=SCOPE + +enum E { + case one(String) + case two(String) + case three(Int) +} + +func test1(_ e: E) { + switch e { // SCOPE: sil_scope [[test1_switch:[0-9]+]] {{.*}}:[[@LINE]]:3 + case .one(let payload), .two(let payload): // SCOPE-NEXT: sil_scope [[test1_case1:[0-9]+]] {{.*}}:[[@LINE]]:3 parent [[test1_switch]] + print(payload) // SCOPE-NEXT: sil_scope {{.*}}:[[@LINE]]:5 parent [[test1_case1]] + case .three(let payload): // SCOPE-NEXT: sil_scope [[test1_case2:[0-9]+]] {{.*}}:[[@LINE]]:3 parent [[test1_switch]] + print(payload) // SCOPE-NEXT: sil_scope {{.*}}:[[@LINE]]:5 parent [[test1_case2]] + } +} + +func test2(_ e: E) { + switch e { // SCOPE: sil_scope [[test2_switch:[0-9]+]] {{.*}}:[[@LINE]]:3 + case .one(let x): // SCOPE-NEXT: sil_scope [[test2_case1:[0-9]+]] {{.*}}:[[@LINE]]:3 parent [[test2_switch]] + print(x) // SCOPE-NEXT: sil_scope {{.*}}:[[@LINE]]:5 parent [[test2_case1]] + case .two(let x): // SCOPE-NEXT: sil_scope [[test2_case2:[0-9]+]] {{.*}}:[[@LINE]]:3 parent [[test2_switch]] + print(x) // SCOPE-NEXT: sil_scope {{.*}}:[[@LINE]]:5 parent [[test2_case2]] + case .three(let x): // SCOPE-NEXT: sil_scope [[test2_case3:[0-9]+]] {{.*}}:[[@LINE]]:3 parent [[test2_switch]] + print(x) // SCOPE-NEXT: sil_scope {{.*}}:[[@LINE]]:5 parent [[test2_case3]] + } +} + +func test3(_ e: E) { + switch e { // SCOPE: sil_scope [[test3_switch:[0-9]+]] {{.*}}:[[@LINE]]:3 + case .one: // SCOPE-NEXT: sil_scope [[test3_case1:[0-9]+]] {{.*}}:[[@LINE]]:3 parent [[test3_switch]] + print(1) // SCOPE-NEXT: sil_scope {{.*}}:[[@LINE]]:5 parent [[test3_case1]] + case .three(let x): // SCOPE-NEXT: sil_scope [[test3_case2:[0-9]+]] {{.*}}:[[@LINE]]:3 parent [[test3_switch]] + print(x) // SCOPE-NEXT: sil_scope {{.*}}:[[@LINE]]:5 parent [[test3_case2]] + default: // SCOPE-NEXT: sil_scope [[test3_case3:[0-9]+]] {{.*}}:[[@LINE]]:3 parent [[test3_switch]] + print("error") // SCOPE-NEXT: sil_scope {{.*}}:[[@LINE]]:5 parent [[test3_case3]] + } +} + +func test4(_ e: E) { + switch e { // SCOPE: sil_scope [[test4_switch:[0-9]+]] {{.*}}:[[@LINE]]:3 + case .one(let x): // SCOPE-NEXT: sil_scope [[test4_case1:[0-9]+]] {{.*}}:[[@LINE]]:3 parent [[test4_switch]] + print(x) // SCOPE-NEXT: sil_scope {{.*}}:[[@LINE]]:5 parent [[test4_case1]] + fallthrough + case .two(let x): // SCOPE-NEXT: sil_scope [[test4_case2:[0-9]+]] {{.*}}:[[@LINE]]:3 parent [[test4_switch]] + print(x) // SCOPE-NEXT: sil_scope {{.*}}:[[@LINE]]:5 parent [[test4_case2]] + fallthrough + default: + print("default") // SCOPE-NEXT: sil_scope [[test4_default:[0-9]+]] {{.*}}:[[@LINE]]:5 parent [[test4_switch]] + // SCOPE: string_literal utf8 "default", {{.*}} scope [[test4_default]] + } +} + +test1(E.one("payload1")) +test2(E.two("payload2")) +test3(E.three(3)) +test4(E.one("payload1")) diff --git a/test/SILGen/switch.swift b/test/SILGen/switch.swift index a89153cbcfaef..619b3db0126c4 100644 --- a/test/SILGen/switch.swift +++ b/test/SILGen/switch.swift @@ -1062,14 +1062,13 @@ func testMultiPatternsWithOuterScopeSameNamedVar(base: Int?, filter: Int?) { print("both: \(base), \(filter)") case (.some(let base), .none), (.none, .some(let base)): // CHECK: bb3: - // CHECK-NEXT: debug_value %8 : $Int, let, name "base" // CHECK-NEXT: br bb6(%8 : $Int) // CHECK: bb5([[OTHER_BASE:%.*]] : $Int) - // CHECK-NEXT: debug_value [[OTHER_BASE]] : $Int, let, name "base" // CHECK-NEXT: br bb6([[OTHER_BASE]] : $Int) // CHECK: bb6([[ARG:%.*]] : $Int): + // CHECK-NEXT: debug_value [[ARG]] : $Int, let, name "base" print("single: \(base)") default: print("default") diff --git a/test/SILGen/switch_debuginfo.swift b/test/SILGen/switch_debuginfo.swift index c461d5ec570df..1a96950cb0228 100644 --- a/test/SILGen/switch_debuginfo.swift +++ b/test/SILGen/switch_debuginfo.swift @@ -19,14 +19,10 @@ func isOn(_ b: Binary) -> Bool { // CHECK-LABEL: sil hidden [ossa] @$s16switch_debuginfo5test11iySi_tF func test1(i: Int) { switch i { - // CHECK-NOT: [[LOC]]:[[@LINE+1]] - case 0: // CHECK: debug_value {{.*}} : $Int, let, name "$match", [[LOC]]:[[@LINE]] - // CHECK-NOT: [[LOC]]:[[@LINE-1]] + case 0: // CHECK-NOT: [[LOC]]:[[@LINE]] nop1() - - // CHECK-NOT: [[LOC]]:[[@LINE+1]] - case 1: // CHECK: debug_value {{.*}} : $Int, let, name "$match", [[LOC]]:[[@LINE]] - // CHECK-NOT: [[LOC]]:[[@LINE-1]] + + case 1: // CHECK-NOT: [[LOC]]:[[@LINE]] nop1() default: // CHECK-NOT: [[LOC]]:[[@LINE]] diff --git a/test/SILGen/switch_fallthrough.swift b/test/SILGen/switch_fallthrough.swift index 141e9d89acb04..77b5c5cf3e626 100644 --- a/test/SILGen/switch_fallthrough.swift +++ b/test/SILGen/switch_fallthrough.swift @@ -149,10 +149,10 @@ func test5() { case (foo(), let n): // CHECK: cond_br {{%.*}}, [[YES_SECOND_CONDITION:bb[0-9]+]], {{bb[0-9]+}} // CHECK: [[YES_SECOND_CONDITION]]: - // CHECK: debug_value [[SECOND_N:%.*]] : $Int, let, name "n" - // CHECK: br [[CASE2]]([[SECOND_N]] : $Int) + // CHECK: br [[CASE2]]([[SECOND_N:%.*]] : $Int) // CHECK: [[CASE2]]([[INCOMING_N:%.*]] : $Int): + // CHECK: debug_value [[INCOMING_N]] : $Int, let, name "n" // CHECK: [[Z:%.*]] = function_ref @$s18switch_fallthrough1zyySiF // CHECK: apply [[Z]]([[INCOMING_N]]) : $@convention(thin) (Int) -> () // CHECK: br [[CONT:bb[0-9]+]] diff --git a/test/SILGen/switch_isa.swift b/test/SILGen/switch_isa.swift index b73abc34fd697..e7e4a9271b4a4 100644 --- a/test/SILGen/switch_isa.swift +++ b/test/SILGen/switch_isa.swift @@ -69,6 +69,8 @@ func guardFn(_ l: D, _ r: D) -> Bool { return true } // CHECK: cond_br {{%.*}}, [[GUARD_YES:bb[0-9]+]], [[GUARD_NO:bb[0-9]+]] // // CHECK: [[GUARD_YES]]: +// CHECK-NEXT: debug_value [[R2]] +// CHECK-NEXT: debug_value [[L2]] // CHECK-NEXT: destroy_value [[L2]] // CHECK-NEXT: destroy_value [[R2]] // CHECK-NEXT: end_borrow [[BORROWED_TUP]] diff --git a/test/SILGen/switch_multiple_entry_address_only.swift b/test/SILGen/switch_multiple_entry_address_only.swift index 6b66f1dfa26ab..507986eb13e0a 100644 --- a/test/SILGen/switch_multiple_entry_address_only.swift +++ b/test/SILGen/switch_multiple_entry_address_only.swift @@ -91,6 +91,7 @@ func multipleLabelsVar(e: E) { // CHECK-NEXT: br bb3 // CHECK: bb3: + // CHECK-NEXT: debug_value_addr [[X_PHI]] : $*Any, var, name "x" // CHECK-NEXT: [[ANY_BOX:%.*]] = alloc_box ${ var Any }, var, name "x" // CHECK-NEXT: [[BOX_PAYLOAD:%.*]] = project_box [[ANY_BOX]] : ${ var Any }, 0 // CHECK-NEXT: copy_addr [take] [[X_PHI]] to [initialization] [[BOX_PAYLOAD]] diff --git a/test/SILGen/switch_var.swift b/test/SILGen/switch_var.swift index 94b08bab4d676..f2694fb99feaa 100644 --- a/test/SILGen/switch_var.swift +++ b/test/SILGen/switch_var.swift @@ -537,14 +537,13 @@ func test_multiple_patterns1() { case (0, let x), (let x, 0): // CHECK: cond_br {{%.*}}, [[FIRST_MATCH_CASE:bb[0-9]+]], [[FIRST_FAIL:bb[0-9]+]] // CHECK: [[FIRST_MATCH_CASE]]: - // CHECK: debug_value [[FIRST_X:%.*]] : - // CHECK: br [[CASE_BODY:bb[0-9]+]]([[FIRST_X]] : $Int) + // CHECK: br [[CASE_BODY:bb[0-9]+]]([[FIRST_X:%.*]] : $Int) // CHECK: [[FIRST_FAIL]]: // CHECK: cond_br {{%.*}}, [[SECOND_MATCH_CASE:bb[0-9]+]], [[SECOND_FAIL:bb[0-9]+]] // CHECK: [[SECOND_MATCH_CASE]]: - // CHECK: debug_value [[SECOND_X:%.*]] : - // CHECK: br [[CASE_BODY]]([[SECOND_X]] : $Int) + // CHECK: br [[CASE_BODY]]([[SECOND_X:%.*]] : $Int) // CHECK: [[CASE_BODY]]([[BODY_VAR:%.*]] : $Int): + // CHECK: debug_value [[BODY_VAR]] : $Int, let, name "x" // CHECK: [[A:%.*]] = function_ref @$s10switch_var1a1xySi_tF // CHECK: apply [[A]]([[BODY_VAR]]) a(x: x) diff --git a/test/SILGen/tsan_instrumentation.swift b/test/SILGen/tsan_instrumentation.swift index 8ab0e5e70086c..e5d35d5b28a6c 100644 --- a/test/SILGen/tsan_instrumentation.swift +++ b/test/SILGen/tsan_instrumentation.swift @@ -1,3 +1,4 @@ +// REQUIRES: tsan_runtime // RUN: %target-swift-emit-silgen -sanitize=thread %s | %FileCheck %s // TSan is only supported on 64 bit. diff --git a/test/SILOptimizer/OSLogMandatoryOptTest.sil b/test/SILOptimizer/OSLogMandatoryOptTest.sil index 470958372f323..3fefcf0d78cf7 100644 --- a/test/SILOptimizer/OSLogMandatoryOptTest.sil +++ b/test/SILOptimizer/OSLogMandatoryOptTest.sil @@ -414,11 +414,13 @@ bb0: // CHECK: [[INDEX2:%[0-9]+]] = integer_literal $Builtin.Word, 2 // CHECK: [[INDEXADDR2:%[0-9]+]] = index_addr [[STORAGEADDR]] : $*Int64, [[INDEX2]] : $Builtin.Word // CHECK: store [[ELEM3INT]] to [trivial] [[INDEXADDR2]] : $*Int64 - // CHECK: [[BORROW:%[0-9]+]] = begin_borrow [[ARRAY]] + // CHECK: [[FINALIZEREF:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK: [[FINALIZED:%[0-9]+]] = apply [[FINALIZEREF]]([[ARRAY]]) + // CHECK: [[BORROW:%[0-9]+]] = begin_borrow [[FINALIZED]] // CHECK: [[USEREF:%[0-9]+]] = function_ref @useArray // CHECK: apply [[USEREF]]([[BORROW]]) // CHECK: end_borrow [[BORROW]] - // CHECK: destroy_value [[ARRAY]] : $Array + // CHECK: destroy_value [[FINALIZED]] : $Array } /// A stub for OSLogMessage.init. The optimization is driven by this function. @@ -538,11 +540,13 @@ bb0: // CHECK: ([[ARRAY:%[0-9]+]], [[STORAGEPTR:%[0-9]+]]) = destructure_tuple [[TUPLE]] // CHECK: [[STORAGEADDR:%[0-9]+]] = pointer_to_address [[STORAGEPTR]] : $Builtin.RawPointer to [strict] $*String // CHECK: store [[STRINGCONST]] to [init] [[STORAGEADDR]] : $*String - // CHECK: [[BORROW:%[0-9]+]] = begin_borrow [[ARRAY]] + // CHECK: [[FINALIZEREF:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK: [[FINALIZED:%[0-9]+]] = apply [[FINALIZEREF]]([[ARRAY]]) + // CHECK: [[BORROW:%[0-9]+]] = begin_borrow [[FINALIZED]] // CHECK: [[USEREF:%[0-9]+]] = function_ref @useArrayString // CHECK: apply [[USEREF]]([[BORROW]]) // CHECK: end_borrow [[BORROW]] - // CHECK: destroy_value [[ARRAY]] : $Array + // CHECK: destroy_value [[FINALIZED]] : $Array } sil [ossa] [Onone] [_semantics "constant_evaluable"] [_semantics "oslog.message.init_stub"] @oslogMessageArrayInterpolationInit : $@convention(thin) (@owned OSLogInterpolationArrayStub) diff --git a/test/SILOptimizer/OSLogMandatoryOptTest.swift b/test/SILOptimizer/OSLogMandatoryOptTest.swift index 3ea45c0a316a7..a41a1ad7ba34f 100644 --- a/test/SILOptimizer/OSLogMandatoryOptTest.swift +++ b/test/SILOptimizer/OSLogMandatoryOptTest.swift @@ -56,7 +56,9 @@ func testSimpleInterpolation() { // We need to wade through some borrows and copy values here. // CHECK-DAG: [[ARGSARRAY2]] = begin_borrow [[ARGSARRAY3:%[0-9]+]] // CHECK-DAG: [[ARGSARRAY3]] = copy_value [[ARGSARRAY4:%[0-9]+]] - // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[ARGSARRAY:%[0-9]+]] + // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[FINARR:%[0-9]+]] + // CHECK-DAG: [[FINARRFUNC:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK-DAG: [[FINARR]] = apply [[FINARRFUNC]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARGSARRAY:%[0-9]+]]) // CHECK-DAG: ([[ARGSARRAY]], {{%.*}}) = destructure_tuple [[ARRAYINITRES:%[0-9]+]] // CHECK-DAG: [[ARRAYINITRES]] = apply [[ARRAYINIT:%[0-9]+]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARRAYSIZE:%[0-9]+]]) // CHECK-DAG: [[ARRAYINIT]] = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF @@ -105,7 +107,9 @@ func testInterpolationWithFormatOptions() { // CHECK-DAG: store_borrow [[ARGSARRAY2:%[0-9]+]] to [[ARGSARRAYADDR]] // CHECK-DAG: [[ARGSARRAY2]] = begin_borrow [[ARGSARRAY3:%[0-9]+]] // CHECK-DAG: [[ARGSARRAY3]] = copy_value [[ARGSARRAY4:%[0-9]+]] - // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[ARGSARRAY:%[0-9]+]] + // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[FINARR:%[0-9]+]] + // CHECK-DAG: [[FINARRFUNC:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK-DAG: [[FINARR]] = apply [[FINARRFUNC]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARGSARRAY:%[0-9]+]]) // CHECK-DAG: ([[ARGSARRAY]], {{%.*}}) = destructure_tuple [[ARRAYINITRES:%[0-9]+]] // CHECK-DAG: [[ARRAYINITRES]] = apply [[ARRAYINIT:%[0-9]+]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARRAYSIZE:%[0-9]+]]) // CHECK-DAG: [[ARRAYINIT]] = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF @@ -156,7 +160,9 @@ func testInterpolationWithFormatOptionsAndPrivacy() { // CHECK-DAG: store_borrow [[ARGSARRAY2:%[0-9]+]] to [[ARGSARRAYADDR]] // CHECK-DAG: [[ARGSARRAY2]] = begin_borrow [[ARGSARRAY3:%[0-9]+]] // CHECK-DAG: [[ARGSARRAY3]] = copy_value [[ARGSARRAY4:%[0-9]+]] - // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[ARGSARRAY:%[0-9]+]] + // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[FINARR:%[0-9]+]] + // CHECK-DAG: [[FINARRFUNC:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK-DAG: [[FINARR]] = apply [[FINARRFUNC]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARGSARRAY:%[0-9]+]]) // CHECK-DAG: ([[ARGSARRAY]], {{%.*}}) = destructure_tuple [[ARRAYINITRES:%[0-9]+]] // CHECK-DAG: [[ARRAYINITRES]] = apply [[ARRAYINIT:%[0-9]+]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARRAYSIZE:%[0-9]+]]) // CHECK-DAG: [[ARRAYINIT]] = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF @@ -213,7 +219,9 @@ func testInterpolationWithMultipleArguments() { // CHECK-DAG: store_borrow [[ARGSARRAY2:%[0-9]+]] to [[ARGSARRAYADDR]] // CHECK-DAG: [[ARGSARRAY2]] = begin_borrow [[ARGSARRAY3:%[0-9]+]] // CHECK-DAG: [[ARGSARRAY3]] = copy_value [[ARGSARRAY4:%[0-9]+]] - // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[ARGSARRAY:%[0-9]+]] + // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[FINARR:%[0-9]+]] + // CHECK-DAG: [[FINARRFUNC:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK-DAG: [[FINARR]] = apply [[FINARRFUNC]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARGSARRAY:%[0-9]+]]) // CHECK-DAG: ([[ARGSARRAY]], {{%.*}}) = destructure_tuple [[ARRAYINITRES:%[0-9]+]] // CHECK-DAG: [[ARRAYINITRES]] = apply [[ARRAYINIT:%[0-9]+]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARRAYSIZE:%[0-9]+]]) // CHECK-DAG: [[ARRAYINIT]] = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF @@ -359,7 +367,9 @@ func testMessageWithTooManyArguments() { // CHECK-DAG: store_borrow [[ARGSARRAY2:%[0-9]+]] to [[ARGSARRAYADDR]] // CHECK-DAG: [[ARGSARRAY2]] = begin_borrow [[ARGSARRAY3:%[0-9]+]] // CHECK-DAG: [[ARGSARRAY3]] = copy_value [[ARGSARRAY4:%[0-9]+]] - // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[ARGSARRAY:%[0-9]+]] + // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[FINARR:%[0-9]+]] + // CHECK-DAG: [[FINARRFUNC:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK-DAG: [[FINARR]] = apply [[FINARRFUNC]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARGSARRAY:%[0-9]+]]) // CHECK-DAG: ([[ARGSARRAY]], {{%.*}}) = destructure_tuple [[ARRAYINITRES:%[0-9]+]] // CHECK-DAG: [[ARRAYINITRES]] = apply [[ARRAYINIT:%[0-9]+]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARRAYSIZE:%[0-9]+]]) // CHECK-DAG: [[ARRAYINIT]] = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF @@ -452,7 +462,9 @@ func testDynamicStringArguments() { // CHECK-DAG: store_borrow [[ARGSARRAY2:%[0-9]+]] to [[ARGSARRAYADDR]] // CHECK-DAG: [[ARGSARRAY2]] = begin_borrow [[ARGSARRAY3:%[0-9]+]] // CHECK-DAG: [[ARGSARRAY3]] = copy_value [[ARGSARRAY4:%[0-9]+]] - // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[ARGSARRAY:%[0-9]+]] + // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[FINARR:%[0-9]+]] + // CHECK-DAG: [[FINARRFUNC:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK-DAG: [[FINARR]] = apply [[FINARRFUNC]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARGSARRAY:%[0-9]+]]) // CHECK-DAG: ([[ARGSARRAY]], {{%.*}}) = destructure_tuple [[ARRAYINITRES:%[0-9]+]] // CHECK-DAG: [[ARRAYINITRES]] = apply [[ARRAYINIT:%[0-9]+]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARRAYSIZE:%[0-9]+]]) // CHECK-DAG: [[ARRAYINIT]] = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF @@ -508,7 +520,9 @@ func testNSObjectInterpolation() { // CHECK-DAG: store_borrow [[ARGSARRAY2:%[0-9]+]] to [[ARGSARRAYADDR]] // CHECK-DAG: [[ARGSARRAY2]] = begin_borrow [[ARGSARRAY3:%[0-9]+]] // CHECK-DAG: [[ARGSARRAY3]] = copy_value [[ARGSARRAY4:%[0-9]+]] - // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[ARGSARRAY:%[0-9]+]] + // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[FINARR:%[0-9]+]] + // CHECK-DAG: [[FINARRFUNC:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK-DAG: [[FINARR]] = apply {{.*}}<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARGSARRAY:%[0-9]+]]) // CHECK-DAG: ([[ARGSARRAY]], {{%.*}}) = destructure_tuple [[ARRAYINITRES:%[0-9]+]] // CHECK-DAG: [[ARRAYINITRES]] = apply [[ARRAYINIT:%[0-9]+]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARRAYSIZE:%[0-9]+]]) // CHECK-DAG: [[ARRAYINIT]] = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF @@ -559,7 +573,9 @@ func testDoubleInterpolation() { // CHECK-DAG: store_borrow [[ARGSARRAY2:%[0-9]+]] to [[ARGSARRAYADDR]] // CHECK-DAG: [[ARGSARRAY2]] = begin_borrow [[ARGSARRAY3:%[0-9]+]] // CHECK-DAG: [[ARGSARRAY3]] = copy_value [[ARGSARRAY4:%[0-9]+]] - // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[ARGSARRAY:%[0-9]+]] + // CHECK-DAG: [[ARGSARRAY4]] = begin_borrow [[FINARR:%[0-9]+]] + // CHECK-DAG: [[FINARRFUNC:%[0-9]+]] = function_ref @$ss27_finalizeUninitializedArrayySayxGABnlF + // CHECK-DAG: [[FINARR]] = apply [[FINARRFUNC]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARGSARRAY:%[0-9]+]]) // CHECK-DAG: ([[ARGSARRAY]], {{%.*}}) = destructure_tuple [[ARRAYINITRES:%[0-9]+]] // CHECK-DAG: [[ARRAYINITRES]] = apply [[ARRAYINIT:%[0-9]+]]<(inout UnsafeMutablePointer, inout Array) -> ()>([[ARRAYSIZE:%[0-9]+]]) // CHECK-DAG: [[ARRAYINIT]] = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF diff --git a/test/SILOptimizer/cast_optimizer_conditional_conformance.sil b/test/SILOptimizer/cast_optimizer_conditional_conformance.sil index fd6659b286866..87688a532e593 100644 --- a/test/SILOptimizer/cast_optimizer_conditional_conformance.sil +++ b/test/SILOptimizer/cast_optimizer_conditional_conformance.sil @@ -35,13 +35,10 @@ extension S1 : HasFoo where T == UInt8 { // CHECK: [[EXIS:%.*]] = alloc_stack $HasFoo // CHECK: [[S1:%.*]] = alloc_stack $S1 // CHECK: store %0 to [[S1]] : $*S1 -// CHECK: [[OPT:%.*]] = alloc_stack $Optional -// CHECK: [[INIT_DATA:%.*]] = init_enum_data_addr [[OPT]] : $*Optional, #Optional.some!enumelt -// CHECK: [[EXIS_ADDR:%.*]] = init_existential_addr [[INIT_DATA]] : $*HasFoo, $S1 +// CHECK: [[HASFOO:%.*]] = alloc_stack $HasFoo +// CHECK: [[EXIS_ADDR:%.*]] = init_existential_addr [[HASFOO]] : $*HasFoo, $S1 // CHECK: copy_addr [take] [[S1]] to [initialization] [[EXIS_ADDR]] : $*S1 -// CHECK: inject_enum_addr [[OPT]] : $*Optional, #Optional.some!enumelt -// CHECK: [[DATA:%.*]] = unchecked_take_enum_data_addr [[OPT]] : $*Optional, #Optional.some!enumelt -// CHECK: copy_addr [take] [[DATA]] to [initialization] [[EXIS]] : $*HasFoo +// CHECK: copy_addr [take] [[HASFOO]] to [initialization] [[EXIS]] : $*HasFoo // CHECK: [[OPEN_EXIS_ADDR:%.*]] = open_existential_addr immutable_access [[EXIS]] : $*HasFoo to $*@opened("4E16CBC0-FD9F-11E8-A311-D0817AD9F6DD") HasFoo // CHECK: [[OPEN_ADDR:%.*]] = unchecked_addr_cast [[OPEN_EXIS_ADDR]] : $*@opened("4E16CBC0-FD9F-11E8-A311-D0817AD9F6DD") HasFoo to $*S1 // CHECK: [[F:%.*]] = function_ref @witnessS1 : $@convention(witness_method: HasFoo) (@in_guaranteed S1) -> () @@ -171,13 +168,10 @@ struct IsP : P {} // CHECK: [[EXIS:%.*]] = alloc_stack $HasFoo // CHECK: [[S2:%.*]] = alloc_stack $S2 // CHECK: store %0 to [[S2]] : $*S2 -// CHECK: [[OPT:%.*]] = alloc_stack $Optional -// CHECK: [[INIT_DATA:%.*]] = init_enum_data_addr [[OPT]] : $*Optional, #Optional.some!enumelt -// CHECK: [[EXIS_ADDR:%.*]] = init_existential_addr [[INIT_DATA]] : $*HasFoo, $S2 +// CHECK: [[HASFOO:%.*]] = alloc_stack $HasFoo +// CHECK: [[EXIS_ADDR:%.*]] = init_existential_addr [[HASFOO]] : $*HasFoo, $S2 // CHECK: copy_addr [take] [[S2]] to [initialization] [[EXIS_ADDR]] : $*S2 -// CHECK: inject_enum_addr [[OPT]] : $*Optional, #Optional.some!enumelt -// CHECK: [[DATA:%.*]] = unchecked_take_enum_data_addr [[OPT]] : $*Optional, #Optional.some!enumelt -// CHECK: copy_addr [take] [[DATA]] to [initialization] [[EXIS]] : $*HasFoo +// CHECK: copy_addr [take] [[HASFOO]] to [initialization] [[EXIS]] : $*HasFoo // CHECK: [[OPEN_EXIS_ADDR:%.*]] = open_existential_addr immutable_access [[EXIS]] : $*HasFoo to $*@opened("4E16D1CE-FD9F-11E8-A311-D0817AD9F6DD") HasFoo // CHECK: [[OPEN_ADDR:%.*]] = unchecked_addr_cast [[OPEN_EXIS_ADDR]] : $*@opened("4E16D1CE-FD9F-11E8-A311-D0817AD9F6DD") HasFoo to $*S2 // CHECK: [[F:%.*]] = function_ref @$s9witnessS24main3IsPV_Tg5 : $@convention(witness_method: HasFoo) (S2) -> () @@ -246,13 +240,10 @@ extension S3 : HasFoo where T : AnyObject { // CHECK: [[EXIS:%.*]] = alloc_stack $HasFoo // CHECK: [[S3:%.*]] = alloc_stack $S3 // CHECK: store %0 to [[S3]] : $*S3 -// CHECK: [[OPT:%.*]] = alloc_stack $Optional -// CHECK: [[INIT_DATA:%.*]] = init_enum_data_addr [[OPT]] : $*Optional, #Optional.some!enumelt -// CHECK: [[EXIS_ADDR:%.*]] = init_existential_addr [[INIT_DATA]] : $*HasFoo, $S3 +// CHECK: [[HASFOO:%.*]] = alloc_stack $HasFoo +// CHECK: [[EXIS_ADDR:%.*]] = init_existential_addr [[HASFOO]] : $*HasFoo, $S3 // CHECK: copy_addr [take] [[S3]] to [initialization] [[EXIS_ADDR]] : $*S3 -// CHECK: inject_enum_addr [[OPT]] : $*Optional, #Optional.some!enumelt -// CHECK: [[DATA:%.*]] = unchecked_take_enum_data_addr [[OPT]] : $*Optional, #Optional.some!enumelt -// CHECK: copy_addr [take] [[DATA]] to [initialization] [[EXIS]] : $*HasFoo +// CHECK: copy_addr [take] [[HASFOO]] to [initialization] [[EXIS]] : $*HasFoo // CHECK: [[OPEN_EXIS_ADDR:%.*]] = open_existential_addr immutable_access [[EXIS]] : $*HasFoo to $*@opened("4E16D5E8-FD9F-11E8-A311-D0817AD9F6DD") HasFoo // CHECK: [[OPEN_ADDR:%.*]] = unchecked_addr_cast [[OPEN_EXIS_ADDR]] : $*@opened("4E16D5E8-FD9F-11E8-A311-D0817AD9F6DD") HasFoo to $*S3 // CHECK: [[F:%.*]] = function_ref @$s9witnessS34main1CC_Tg5 : $@convention(witness_method: HasFoo) (S3) -> () @@ -319,13 +310,10 @@ extension S4 : HasFoo where T : C { // CHECK: [[EXIS:%.*]] = alloc_stack $HasFoo // CHECK: [[S3:%.*]] = alloc_stack $S4 // CHECK: store %0 to [[S3]] : $*S4 -// CHECK: [[OPT:%.*]] = alloc_stack $Optional -// CHECK: [[INIT_DATA:%.*]] = init_enum_data_addr [[OPT]] : $*Optional, #Optional.some!enumelt -// CHECK: [[EXIS_ADDR:%.*]] = init_existential_addr [[INIT_DATA]] : $*HasFoo, $S4 +// CHECK: [[HASFOO:%.*]] = alloc_stack $HasFoo +// CHECK: [[EXIS_ADDR:%.*]] = init_existential_addr [[HASFOO]] : $*HasFoo, $S4 // CHECK: copy_addr [take] [[S3]] to [initialization] [[EXIS_ADDR]] : $*S4 -// CHECK: inject_enum_addr [[OPT]] : $*Optional, #Optional.some!enumelt -// CHECK: [[DATA:%.*]] = unchecked_take_enum_data_addr [[OPT]] : $*Optional, #Optional.some!enumelt -// CHECK: copy_addr [take] [[DATA]] to [initialization] [[EXIS]] : $*HasFoo +// CHECK: copy_addr [take] [[HASFOO]] to [initialization] [[EXIS]] : $*HasFoo // CHECK: [[OPEN_EXIS_ADDR:%.*]] = open_existential_addr immutable_access [[EXIS]] : $*HasFoo to $*@opened("4E16E402-FD9F-11E8-A311-D0817AD9F6DD") HasFoo // CHECK: [[OPEN_ADDR:%.*]] = unchecked_addr_cast [[OPEN_EXIS_ADDR]] : $*@opened("4E16E402-FD9F-11E8-A311-D0817AD9F6DD") HasFoo to $*S4 // CHECK: [[F:%.*]] = function_ref @$s9witnessS44main4SubCC_Tg5 : $@convention(witness_method: HasFoo) (S4) -> () diff --git a/test/SILOptimizer/cowarray_opt.sil b/test/SILOptimizer/cowarray_opt.sil index 10ad28c6e0bf2..77873a8536090 100644 --- a/test/SILOptimizer/cowarray_opt.sil +++ b/test/SILOptimizer/cowarray_opt.sil @@ -46,6 +46,7 @@ class MyArrayStorage { } sil [_semantics "array.make_mutable"] @array_make_mutable : $@convention(method) (@inout MyArray) -> () +sil [_semantics "array.end_mutation"] @array_end_mutation : $@convention(method) (@inout MyArray) -> () sil [_semantics "array.get_count"] @guaranteed_array_get_count : $@convention(method) (@guaranteed MyArray) -> Int sil [_semantics "array.get_capacity"] @guaranteed_array_get_capacity : $@convention(method) (@guaranteed MyArray) -> Int sil [_semantics "array.mutate_unknown"] @array_unknown_mutate : $@convention(method) (@inout MyArray) -> () @@ -59,11 +60,14 @@ sil @unknown : $@convention(thin) () -> () // CHECK-LABEL: sil @simple_hoist // CHECK: bb0([[ARRAY:%[0-9]+]] -// CHECK: [[FUN:%[0-9]+]] = function_ref @array_make_mutable -// CHECK: apply [[FUN]]([[ARRAY]] -// CHECK: bb1 -// CHECK-NOT: array_make_mutable -// CHECK-NOT: apply [[FUN]] +// CHECK: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: bb1: +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: } // end sil function 'simple_hoist' sil @simple_hoist : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> () { bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): debug_value_addr %0 : $*MyArray @@ -73,24 +77,29 @@ bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): bb1: %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%0) : $@convention(method) (@inout MyArray) -> () + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%0) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb1, bb2 bb2: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK-LABEL: sil @hoist_ignoring_paired_retain_release_and_hoist -// CHECK: bb0( -// CHECK-NOT: br bb -// CHECK: [[MM:%.*]] = function_ref @array_make_mutable -// CHECK-NOT: br bb -// CHECK: apply [[MM]] -// CHECK: br bb1 +// CHECK: bb0([[ARRAY:%[0-9]+]] +// CHECK: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]]([[ARRAY]] // CHECK: bb1: -// CHECK-NOT: apply +// CHECK: retain +// CHECK: release +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: apply [[EM]]([[ARRAY]] // CHECK: cond_br {{.*}}, bb1 +// CHECK: } // end sil function 'hoist_ignoring_paired_retain_release_and_hoist' sil @hoist_ignoring_paired_retain_release_and_hoist : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> () { bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): %2 = load %0 : $*MyArray @@ -103,11 +112,13 @@ bb1: release_value %2 : $MyArray %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%0) : $@convention(method) (@inout MyArray) -> () + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%0) : $@convention(method) (@inout MyArray) -> () cond_br %3, bb1, bb2 bb2: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK-LABEL: sil @hoist_blocked_by_unpaired_retain_release_1 @@ -129,11 +140,13 @@ bb1: %4 = load %0 : $*MyArray %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%0) : $@convention(method) (@inout MyArray) -> () + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%0) : $@convention(method) (@inout MyArray) -> () cond_br %3, bb1, bb2 bb2: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK-LABEL: sil @hoist_blocked_by_unpaired_retain_release_2 @@ -151,32 +164,37 @@ bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): bb1: %10 = load %0 : $*MyArray %11 = load %0 : $*MyArray - %8 = struct_extract %10 : $MyArray, #MyArray.buffer - %9 = struct_extract %11 : $MyArray, #MyArray.buffer - retain_value %8 : $ArrayIntBuffer - retain_value %9 : $ArrayIntBuffer - release_value %9 : $ArrayIntBuffer + %12 = struct_extract %10 : $MyArray, #MyArray.buffer + %13 = struct_extract %11 : $MyArray, #MyArray.buffer + retain_value %12 : $ArrayIntBuffer + retain_value %13 : $ArrayIntBuffer + release_value %13 : $ArrayIntBuffer %3 = load %1 : $*Builtin.Int1 %4 = load %0 : $*MyArray %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%0) : $@convention(method) (@inout MyArray) -> () + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%0) : $@convention(method) (@inout MyArray) -> () cond_br %3, bb1, bb2 bb2: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK-LABEL: sil @hoist_not_blocked_by_unpaired_release -// CHECK: bb0( -// CHECK-NOT: br bb -// CHECK: [[MM:%.*]] = function_ref @array_make_mutable -// CHECK-NOT: br bb -// CHECK: apply [[MM]] -// CHECK: br bb1 +// CHECK: bb0([[ARRAY:%[0-9]+]] +// CHECK: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]]([[ARRAY]] // CHECK: bb1: -// CHECK-NOT: apply -// CHECK: cond_br {{.*}}, bb1 +// CHECK: load +// CHECK: load +// CHECK: release +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: } // end sil function 'hoist_not_blocked_by_unpaired_release' sil @hoist_not_blocked_by_unpaired_release : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> () { bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): %2 = load %0 : $*MyArray @@ -188,11 +206,13 @@ bb1: release_value %2 : $MyArray %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%0) : $@convention(method) (@inout MyArray) -> () + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%0) : $@convention(method) (@inout MyArray) -> () cond_br %3, bb1, bb2 bb2: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK-LABEL: sil @dont_hoist_if_executed_conditionally @@ -215,8 +235,10 @@ bb2: // If this block is never taken, then hoisting to bb0 would change the value of %p3. %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%0) : $@convention(method) (@inout MyArray) -> () - %7 = load %0 : $*MyArray - br bb4(%7 : $MyArray) + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%0) : $@convention(method) (@inout MyArray) -> () + %9 = load %0 : $*MyArray + br bb4(%9 : $MyArray) bb3: br bb4(%p1 : $MyArray) @@ -229,15 +251,20 @@ bb5(%p3 : $MyArray): } // CHECK-LABEL: sil @cow_should_ignore_mark_dependence_addrproj_use : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> () { -// CHECK: bb0( -// CHECK-NOT: br bb -// CHECK: [[MM:%.*]] = function_ref @array_make_mutable -// CHECK-NOT: br bb -// CHECK: apply [[MM]] -// CHECK: br bb1 +// CHECK: bb0([[ARRAY:%[0-9]+]] +// CHECK: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]]([[ARRAY]] // CHECK: bb1: -// CHECK-NOT: apply -// CHECK: cond_br {{.*}}, bb1 +// CHECK: retain +// CHECK: load +// CHECK: load +// CHECK: release +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: mark_dependence +// CHECK: } // end sil function 'cow_should_ignore_mark_dependence_addrproj_use' sil @cow_should_ignore_mark_dependence_addrproj_use : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> () { bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): %999 = struct_element_addr %0 : $*MyArray, #MyArray.buffer @@ -253,24 +280,31 @@ bb1: release_value %2 : $MyArray %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%0) : $@convention(method) (@inout MyArray) -> () + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%0) : $@convention(method) (@inout MyArray) -> () mark_dependence %1 : $*Builtin.Int1 on %99999 : $Builtin.NativeObject cond_br %3, bb1, bb2 bb2: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK-LABEL: sil @cow_should_ignore_mark_dependence_value : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> () { -// CHECK: bb0( -// CHECK-NOT: br bb -// CHECK: [[MM:%.*]] = function_ref @array_make_mutable -// CHECK-NOT: br bb -// CHECK: apply [[MM]] -// CHECK: br bb1 +// CHECK: bb0([[ARRAY:%[0-9]+]] +// CHECK: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]]([[ARRAY]] // CHECK: bb1: -// CHECK-NOT: apply -// CHECK: cond_br {{.*}}, bb1 +// CHECK: retain +// CHECK: load +// CHECK: load +// CHECK: release +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: mark_dependence +// CHECK: } // end sil function 'cow_should_ignore_mark_dependence_value' sil @cow_should_ignore_mark_dependence_value : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> () { bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): %2 = load %0 : $*MyArray @@ -283,24 +317,32 @@ bb1: release_value %2 : $MyArray %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%0) : $@convention(method) (@inout MyArray) -> () + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%0) : $@convention(method) (@inout MyArray) -> () mark_dependence %1 : $*Builtin.Int1 on %2 : $MyArray cond_br %3, bb1, bb2 bb2: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK-LABEL: sil @cow_should_ignore_enum : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> () { -// CHECK: bb0( -// CHECK-NOT: br bb -// CHECK: [[MM:%.*]] = function_ref @array_make_mutable -// CHECK-NOT: br bb -// CHECK: apply [[MM]] -// CHECK: br bb1 +// CHECK: bb0([[ARRAY:%[0-9]+]] +// CHECK: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]]([[ARRAY]] // CHECK: bb1: -// CHECK-NOT: apply -// CHECK: cond_br {{.*}}, bb1 +// CHECK: retain +// CHECK: load +// CHECK: load +// CHECK: release +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: enum +// CHECK: mark_dependence +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: } // end sil function 'cow_should_ignore_enum' sil @cow_should_ignore_enum : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> () { bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): %2 = load %0 : $*MyArray @@ -313,32 +355,25 @@ bb1: release_value %2 : $MyArray %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%0) : $@convention(method) (@inout MyArray) -> () - %8 = enum $Optional>, #Optional.some!enumelt, %2 : $MyArray - mark_dependence %1 : $*Builtin.Int1 on %8 : $Optional> + %e = enum $Optional>, #Optional.some!enumelt, %2 : $MyArray + mark_dependence %1 : $*Builtin.Int1 on %e : $Optional> + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%0) : $@convention(method) (@inout MyArray) -> () cond_br %3, bb1, bb2 bb2: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK-LABEL: sil @cow_should_ignore_guaranteed_semantic_call_sequence : $@convention(thin) (@guaranteed MyArrayContainer, Builtin.NativeObject) -> () { // CHECK: bb0 -// CHECK: [[F:%.*]] = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () -// CHECK: apply [[F]]( +// CHECK-DAG: [[MM:%[0-9]+]] = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () +// CHECK-DAG: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[MM]]( +// CHECK: apply [[EM]]( // CHECK: bb1: -// CHECK: bb2: -// CHECK-NOT: apply [[F]]( -// CHECK: bb3: -// CHECK: bb4: -// CHECK-NOT: apply [[F]]( -// CHECK: bb5: -// CHECK: bb6: -// CHECK-NOT: apply [[F]]( -// CHECK: bb7: -// CHECK: bb8: -// CHECK-NOT: apply [[F]]( -// CHECK: bb9: +// CHECK: } // end sil function 'cow_should_ignore_guaranteed_semantic_call_sequence' sil @cow_should_ignore_guaranteed_semantic_call_sequence : $@convention(thin) (@guaranteed MyArrayContainer, Builtin.NativeObject) -> () { bb0(%0 : $MyArrayContainer, %00 : $Builtin.NativeObject): %1 = ref_element_addr %0 : $MyArrayContainer, #MyArrayContainer.array @@ -347,6 +382,7 @@ bb0(%0 : $MyArrayContainer, %00 : $Builtin.NativeObject): %4 = function_ref @guaranteed_array_get_capacity : $@convention(method) (@guaranteed MyArray) -> Int %5 = function_ref @unknown : $@convention(thin) () -> () %6 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () br bb1 bb1: @@ -356,6 +392,7 @@ bb1: apply %4(%2) : $@convention(method) (@guaranteed MyArray) -> Int release_value %2 : $MyArray apply %6(%1) : $@convention(method) (@inout MyArray) -> () + apply %7(%1) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb1, bb2 bb2: @@ -369,6 +406,7 @@ bb3: fix_lifetime %0 : $MyArrayContainer release_value %2 : $MyArray apply %6(%1) : $@convention(method) (@inout MyArray) -> () + apply %7(%1) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb4, bb3 bb4: @@ -382,6 +420,7 @@ bb5: apply %4(%2) : $@convention(method) (@guaranteed MyArray) -> Int release_value %2 : $MyArray apply %6(%1) : $@convention(method) (@inout MyArray) -> () + apply %7(%1) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb5, bb6 bb6: @@ -395,6 +434,7 @@ bb7: apply %4(%2) : $@convention(method) (@guaranteed MyArray) -> Int release_value %2 : $MyArray apply %6(%1) : $@convention(method) (@inout MyArray) -> () + apply %7(%1) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb7, bb8 bb8: @@ -409,21 +449,30 @@ bb9: release_value %00 : $Builtin.NativeObject release_value %2 : $MyArray apply %6(%1) : $@convention(method) (@inout MyArray) -> () + apply %7(%1) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb9, bb10 bb10: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK: sil @cow_handle_array_address_load -// CHECK: bb0({{.*}}): -// CHECK: apply -// CHECK: br bb1 +// CHECK: bb0([[ARRAY:%[0-9]+]] +// CHECK: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]]([[ARRAY]] // CHECK: bb1: -// CHECK-NOT: apply -// CHECK: bb2 - +// CHECK: load +// CHECK: retain +// CHECK: load +// CHECK: release +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: enum +// CHECK: mark_dependence +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: } // end sil function 'cow_handle_array_address_load' sil @cow_handle_array_address_load : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> () { bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): %2 = load %0 : $*MyArray @@ -434,13 +483,15 @@ bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): bb1: %6 = load %4 : $*Builtin.NativeObject strong_retain %6 : $Builtin.NativeObject - %8 = load %1 : $*Builtin.Int1 + %l = load %1 : $*Builtin.Int1 strong_release %6 : $Builtin.NativeObject %10 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %11 = apply %10(%0) : $@convention(method) (@inout MyArray) -> () %12 = enum $Optional>, #Optional.some!enumelt, %2 : $MyArray %13 = mark_dependence %1 : $*Builtin.Int1 on %12 : $Optional> - cond_br %8, bb1, bb2 + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%0) : $@convention(method) (@inout MyArray) -> () + cond_br %l, bb1, bb2 bb2: %15 = tuple () @@ -468,6 +519,7 @@ bb0(%0 : $MyArrayContainer, %00 : $Builtin.NativeObject): %5 = function_ref @unknown : $@convention(thin) () -> () %6 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %7 = function_ref @array_unknown_mutate : $@convention(method) (@inout MyArray) -> () + %9 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () br bb1 bb1: @@ -478,6 +530,7 @@ bb1: apply %4(%2) : $@convention(method) (@guaranteed MyArray) -> Int release_value %2 : $MyArray apply %6(%1) : $@convention(method) (@inout MyArray) -> () + apply %9(%1) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb1, bb2 bb2: @@ -490,6 +543,7 @@ bb3: apply %4(%2) : $@convention(method) (@guaranteed MyArray) -> Int release_value %2 : $MyArray apply %6(%1) : $@convention(method) (@inout MyArray) -> () + apply %9(%1) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb3, bb4 bb4: @@ -516,14 +570,18 @@ struct MyInt { } // CHECK-LABEL: sil @hoist_projections -// CHECK: bb0([[CONTAINER:%[0-9]+]] -// CHECK: [[CONTAINER2:%.*]] = struct_element_addr [[CONTAINER]] : $*ContainerContainer -// CHECK: [[ARRAY:%.*]] = struct_element_addr [[CONTAINER2]] : $*Container, -// CHECK: [[FUN:%[0-9]+]] = function_ref @array_make_mutable -// CHECK: apply [[FUN]]([[ARRAY]] -// CHECK: bb1 -// CHECK-NOT: array_make_mutable -// CHECK-NOT: apply [[FUN]] +// CHECK: bb0 +// CHECK: [[SE:%[0-9]+]] = struct_element_addr %0 +// CHECK: [[ARRAY:%[0-9]+]] = struct_element_addr [[SE]] +// CHECK: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: bb1: +// CHECK: bb2({{.*}}): +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: } // end sil function 'hoist_projections' sil @hoist_projections : $@convention(thin) (@inout ContainerContainer, @inout Builtin.Int1) -> () { bb0(%0 : $*ContainerContainer, %1 : $*Builtin.Int1): br bb1 @@ -536,19 +594,29 @@ bb3(%3: $*Container): %4 = struct_element_addr %3 : $*Container, #Container.array %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%4) : $@convention(method) (@inout MyArray) -> () + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%4) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb1, bb2 bb2: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK-LABEL: sil @hoist_non_unary_projections -// CHECK: index_addr -// CHECK: struct_element_addr +// CHECK: bb0 +// CHECK: [[SE:%[0-9]+]] = struct_element_addr %0 +// CHECK: [[IA:%[0-9]+]] = index_addr [[SE]] +// CHECK: [[ARRAY:%[0-9]+]] = struct_element_addr [[IA]] +// CHECK: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]]([[ARRAY]] // CHECK: bb1: -// CHECK-NOT: index_addr -// CHECK-NOT: struct_element_addr +// CHECK: bb2({{.*}}): +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: } // end sil function 'hoist_non_unary_projections' sil @hoist_non_unary_projections : $@convention(thin) (@inout ContainerContainer, @inout Builtin.Int1) -> () { bb0(%0 : $*ContainerContainer, %1 : $*Builtin.Int1): %i = integer_literal $Builtin.Int32, 0 @@ -563,22 +631,28 @@ bb2(%3: $*Container): %4 = struct_element_addr %3i : $*Container, #Container.array %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%4) : $@convention(method) (@inout MyArray) -> () + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%4) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb1, bb3 bb3: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK-LABEL: sil @hoist_projections2 -// CHECK: bb0([[CONTAINER:%[0-9]+]] -// CHECK: [[CONTAINER2:%.*]] = struct_element_addr [[CONTAINER]] : $*ContainerContainer -// CHECK: [[ARRAY:%.*]] = struct_element_addr [[CONTAINER2]] : $*Container, -// CHECK: [[FUN:%[0-9]+]] = function_ref @array_make_mutable -// CHECK: apply [[FUN]]([[ARRAY]] -// CHECK: bb1 -// CHECK-NOT: array_make_mutable -// CHECK-NOT: apply [[FUN]] +// CHECK: bb0 +// CHECK: [[SE:%[0-9]+]] = struct_element_addr %0 +// CHECK: [[ARRAY:%[0-9]+]] = struct_element_addr [[SE]] +// CHECK: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: bb1: +// CHECK: bb2({{.*}}): +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: apply [[EM]] +// CHECK: } // end sil function 'hoist_projections2' sil @hoist_projections2 : $@convention(thin) (@inout ContainerContainer, @inout Builtin.Int1) -> () { bb0(%0 : $*ContainerContainer, %1 : $*Builtin.Int1): br bb1 @@ -591,22 +665,27 @@ bb1: bb3(%4 : $*MyArray): %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%4) : $@convention(method) (@inout MyArray) -> () + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%4) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb1, bb2 bb2: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK-LABEL: sil @hoist_projections3 -// CHECK: bb0([[CONTAINER:%[0-9]+]] -// CHECK: [[CONTAINER2:%.*]] = struct_element_addr [[CONTAINER]] : $*ContainerContainer -// CHECK: [[ARRAY:%.*]] = struct_element_addr [[CONTAINER2]] : $*Container, -// CHECK: [[FUN:%[0-9]+]] = function_ref @array_make_mutable -// CHECK: apply [[FUN]]([[ARRAY]] -// CHECK: bb1 -// CHECK-NOT: array_make_mutable -// CHECK-NOT: apply [[FUN]] +// CHECK: bb0 +// CHECK: [[SE:%[0-9]+]] = struct_element_addr %0 +// CHECK: [[ARRAY:%[0-9]+]] = struct_element_addr [[SE]] +// CHECK: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: bb1: +// CHECK: apply [[MM]]([[ARRAY]] +// CHECK: apply [[EM]]([[ARRAY]] +// CHECK: } // end sil function 'hoist_projections3' sil @hoist_projections3 : $@convention(thin) (@inout ContainerContainer, @inout Builtin.Int1) -> () { bb0(%0 : $*ContainerContainer, %1 : $*Builtin.Int1): br bb1 @@ -616,26 +695,35 @@ bb1: %3 = struct_element_addr %2 : $*Container, #Container.array %5 = function_ref @array_make_mutable : $@convention(method) (@inout MyArray) -> () %6 = apply %5(%3) : $@convention(method) (@inout MyArray) -> () + %7 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %8 = apply %7(%3) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb1, bb2 bb2: - %7 = tuple() - return %7 : $() + %r = tuple() + return %r : $() } // CHECK-LABEL: sil @hoist_array2d -// CHECK: bb0({{.*}}): -// CHECK: apply -// CHECK-NEXT: load -// CHECK-NEXT: struct_extract -// CHECK-NEXT: struct_extract -// CHECK-NEXT: unchecked_ref_cast -// CHECK-NEXT: ref_tail_addr -// CHECK-NEXT: index_addr -// CHECK-NEXT: apply -// CHECK-NEXT: br bb1 -// CHECK: bb1: -// CHECK-NOT: apply +// CHECK: bb0 +// CHECK-DAG: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK-DAG: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[MM]](%0) +// CHECK: apply [[EM]](%0) +// CHECK: [[L:%[0-9]+]] = load %0 +// CHECK: [[SE1:%[0-9]+]] = struct_extract [[L]] +// CHECK: [[SE2:%[0-9]+]] = struct_extract [[SE1]] +// CHECK: [[CAST:%[0-9]+]] = unchecked_ref_cast [[SE2]] +// CHECK: [[TA:%[0-9]+]] = ref_tail_addr [[CAST]] +// CHECK: [[ARR2:%[0-9]+]] = index_addr [[TA]] +// CHECK: apply [[MM]]([[ARR2]] +// CHECK: apply [[EM]]([[ARR2]] +// CHECK: bb1: +// CHECK: apply [[MM]](%0) +// CHECK: apply [[MM]]([[ARR2]] +// CHECK: apply [[EM]]([[ARR2]] +// CHECK: apply [[EM]](%0) +// CHECK: } // end sil function 'hoist_array2d' sil @hoist_array2d : $@convention(thin) (@inout MyArray) -> () { bb0(%0 : $*MyArray): %2 = load %0 : $*MyArray @@ -652,6 +740,9 @@ bb1: %11 = ref_tail_addr %10 : $MyArrayStorage, $MyArray %12 = index_addr %11 : $*MyArray, %3 : $Builtin.Word %13 = apply %5(%12) : $@convention(method) (@inout MyArray) -> () + %14 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %15 = apply %14(%12) : $@convention(method) (@inout MyArray) -> () + %16 = apply %14(%0) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb1, bb2 bb2: @@ -660,14 +751,23 @@ bb2: } // CHECK-LABEL: sil @dont_hoist_inner_mutating_outer -// CHECK: bb0({{.*}}): -// CHECK: apply -// CHECK-NOT: apply -// CHECK: bb1: -// CHECK: apply -// CHECK: apply -// CHECK-NOT: apply -// CHECK: return +// CHECK: bb0 +// CHECK-DAG: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]](%0) +// CHECK-DAG: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]](%0) +// CHECK: bb1: +// CHECK: apply [[MM]](%0) +// CHECK: [[L:%[0-9]+]] = load %0 +// CHECK: [[SE1:%[0-9]+]] = struct_extract [[L]] +// CHECK: [[SE2:%[0-9]+]] = struct_extract [[SE1]] +// CHECK: [[CAST:%[0-9]+]] = unchecked_ref_cast [[SE2]] +// CHECK: [[TA:%[0-9]+]] = ref_tail_addr [[CAST]] +// CHECK: [[ARR2:%[0-9]+]] = index_addr [[TA]] +// CHECK: apply [[MM]]([[ARR2]] +// CHECK: apply [[EM]]([[ARR2]] +// CHECK: apply [[EM]](%0) +// CHECK: } // end sil function 'dont_hoist_inner_mutating_outer' sil @dont_hoist_inner_mutating_outer : $@convention(thin) (@inout MyArray) -> () { bb0(%0 : $*MyArray): %2 = load %0 : $*MyArray @@ -685,7 +785,10 @@ bb1: %11 = ref_tail_addr %10 : $MyArrayStorage, $MyArray %12 = index_addr %11 : $*MyArray, %3 : $Builtin.Word %13 = apply %5(%12) : $@convention(method) (@inout MyArray) -> () - apply %4(%0) : $@convention(method) (@inout MyArray) -> () + %14 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %15 = apply %14(%12) : $@convention(method) (@inout MyArray) -> () + %16 = apply %4(%0) : $@convention(method) (@inout MyArray) -> () + %17 = apply %14(%0) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb1, bb2 bb2: @@ -694,13 +797,23 @@ bb2: } // CHECK-LABEL: sil @dont_hoist_inner_variant_index -// CHECK: bb0({{.*}}): -// CHECK: apply -// CHECK-NOT: apply -// CHECK: bb1: -// CHECK: apply -// CHECK-NOT: apply -// CHECK: return +// CHECK: bb0 +// CHECK-DAG: [[MM:%[0-9]+]] = function_ref @array_make_mutable +// CHECK: apply [[MM]](%0) +// CHECK-DAG: [[EM:%[0-9]+]] = function_ref @array_end_mutation +// CHECK: apply [[EM]](%0) +// CHECK: bb1: +// CHECK: apply [[MM]](%0) +// CHECK: [[L:%[0-9]+]] = load %0 +// CHECK: [[SE1:%[0-9]+]] = struct_extract [[L]] +// CHECK: [[SE2:%[0-9]+]] = struct_extract [[SE1]] +// CHECK: [[CAST:%[0-9]+]] = unchecked_ref_cast [[SE2]] +// CHECK: [[TA:%[0-9]+]] = ref_tail_addr [[CAST]] +// CHECK: [[ARR2:%[0-9]+]] = index_addr [[TA]] +// CHECK: apply [[MM]]([[ARR2]] +// CHECK: apply [[EM]]([[ARR2]] +// CHECK: apply [[EM]](%0) +// CHECK: } // end sil function 'dont_hoist_inner_variant_index' sil @dont_hoist_inner_variant_index : $@convention(thin) (@inout MyArray, @inout Builtin.Word) -> () { bb0(%0 : $*MyArray, %1 : $*Builtin.Word): %2 = load %0 : $*MyArray @@ -717,6 +830,9 @@ bb1: %11 = ref_tail_addr %10 : $MyArrayStorage, $MyArray %12 = index_addr %11 : $*MyArray, %4 : $Builtin.Word %13 = apply %5(%12) : $@convention(method) (@inout MyArray) -> () + %14 = function_ref @array_end_mutation : $@convention(method) (@inout MyArray) -> () + %15 = apply %14(%12) : $@convention(method) (@inout MyArray) -> () + %17 = apply %14(%0) : $@convention(method) (@inout MyArray) -> () cond_br undef, bb1, bb2 bb2: diff --git a/test/SILOptimizer/globalopt-iter.sil b/test/SILOptimizer/globalopt-iter.sil index 7e35d907d34c6..f1392b9b72ecd 100644 --- a/test/SILOptimizer/globalopt-iter.sil +++ b/test/SILOptimizer/globalopt-iter.sil @@ -19,8 +19,9 @@ class E : B { } sil @patatino : $@convention(thin) () -> () { %0 = integer_literal $Builtin.Word, 0 %1 = alloc_ref [tail_elems $Int64 * %0 : $Builtin.Word] $B - set_deallocating %1 : $B - dealloc_ref %1 : $B + %2 = end_cow_mutation %1 : $B + set_deallocating %2 : $B + dealloc_ref %2 : $B %45 = tuple () return %45 : $() } diff --git a/test/SILOptimizer/licm.sil b/test/SILOptimizer/licm.sil index 153834ffc0f62..6823dda54a085 100644 --- a/test/SILOptimizer/licm.sil +++ b/test/SILOptimizer/licm.sil @@ -355,6 +355,28 @@ bb4: return %10 : $() } +sil @potential_escape : $@convention(thin) (@guaranteed RefElemClass) -> () + +// CHECK-LABEL: sil @dont_hoist_begin_cow_mutation +// CHECK: bb1: +// CHECK-NEXT: begin_cow_mutation +// CHECK-NEXT: end_cow_mutation +// CHECK-NEXT: apply +sil @dont_hoist_begin_cow_mutation : $@convention(thin) (@owned RefElemClass) -> @owned RefElemClass { +bb0(%0 : $RefElemClass): + br bb1 + +bb1: + (%u, %m) = begin_cow_mutation %0 : $RefElemClass + %b = end_cow_mutation %m : $RefElemClass + %f = function_ref @potential_escape : $@convention(thin) (@guaranteed RefElemClass) -> () + %a = apply %f(%b) : $@convention(thin) (@guaranteed RefElemClass) -> () + cond_br undef, bb1, bb2 + +bb2: + return %b : $RefElemClass +} + // CHECK-LABEL: sil @hoist_load_and_store // CHECK: [[V1:%[0-9]+]] = load %0 // CHECK: br bb1([[V1]] : $Int32) diff --git a/test/SILOptimizer/objectoutliner.sil b/test/SILOptimizer/objectoutliner.sil index 5849310d06afe..fe9f45372645b 100644 --- a/test/SILOptimizer/objectoutliner.sil +++ b/test/SILOptimizer/objectoutliner.sil @@ -6,9 +6,10 @@ sil_stage canonical import Builtin import Swift -class Obj { +class Base { } + +class Obj : Base { @_hasStorage var value: Int64 - init() } // CHECK-LABEL: sil_global private @outline_global_simpleTv_ : $Obj = { @@ -41,7 +42,30 @@ bb0: %7 = alloc_ref [tail_elems $Int64 * %0 : $Builtin.Word] $Obj %9 = ref_element_addr %7 : $Obj, #Obj.value store %4 to %9 : $*Int64 - strong_release %7 : $Obj + %10 = end_cow_mutation %7 : $Obj + strong_release %10 : $Obj + %r = tuple () + return %r : $() +} + +// CHECK-LABEL: sil @outline_global_with_upcast +// CHECK: [[G:%[0-9]+]] = global_value @outline_global_with_upcastTv_ : $Obj +// CHECK: strong_retain [[G]] : $Obj +// CHECK: [[C:%[0-9]+]] = upcast [[G]] : $Obj to $Base +// CHECK-NOT: store +// CHECK: strong_release [[C]] : $Base +// CHECK: return +sil @outline_global_with_upcast : $@convention(thin) () -> () { +bb0: + %0 = integer_literal $Builtin.Word, 0 + %1 = integer_literal $Builtin.Int64, 1 + %4 = struct $Int64 (%1 : $Builtin.Int64) + %7 = alloc_ref [tail_elems $Int64 * %0 : $Builtin.Word] $Obj + %8 = upcast %7 : $Obj to $Base + %9 = ref_element_addr %7 : $Obj, #Obj.value + store %4 to %9 : $*Int64 + %10 = end_cow_mutation %8 : $Base + strong_release %10 : $Base %r = tuple () return %r : $() } @@ -70,7 +94,8 @@ bb0: %19 = integer_literal $Builtin.Word, 1 %20 = index_addr %15 : $*Int64, %19 : $Builtin.Word store %6 to %20 : $*Int64 - strong_release %7 : $Obj + %21 = end_cow_mutation %7 : $Obj + strong_release %21 : $Obj %r = tuple () return %r : $() } @@ -90,8 +115,9 @@ bb0: %5 = alloc_ref [tail_elems $Int64 * %0 : $Builtin.Word] $Obj %6 = ref_element_addr %5 : $Obj, #Obj.value store %4 to %6 : $*Int64 - set_deallocating %5 : $Obj - dealloc_ref %5 : $Obj + %10 = end_cow_mutation %5 : $Obj + set_deallocating %10 : $Obj + dealloc_ref %10 : $Obj %r = tuple () return %r : $() } @@ -107,7 +133,8 @@ bb0: %7 = alloc_ref $Obj %9 = ref_element_addr %7 : $Obj, #Obj.value store %4 to %9 : $*Int64 - strong_release %7 : $Obj + %10 = end_cow_mutation %7 : $Obj + strong_release %10 : $Obj %r = tuple () return %r : $() } @@ -125,7 +152,8 @@ bb0: %9 = ref_element_addr %7 : $Obj, #Obj.value store %4 to %9 : $*Int64 store %4 to %9 : $*Int64 - strong_release %7 : $Obj + %10 = end_cow_mutation %7 : $Obj + strong_release %10 : $Obj %r = tuple () return %r : $() } @@ -140,7 +168,8 @@ bb0: %4 = struct $Int64 (%1 : $Builtin.Int64) %7 = alloc_ref [tail_elems $Int64 * %0 : $Builtin.Word] $Obj %9 = ref_element_addr %7 : $Obj, #Obj.value - strong_release %7 : $Obj + %10 = end_cow_mutation %7 : $Obj + strong_release %10 : $Obj %r = tuple () return %r : $() } @@ -156,7 +185,8 @@ bb0: %7 = alloc_ref [objc] $Obj %9 = ref_element_addr %7 : $Obj, #Obj.value store %4 to %9 : $*Int64 - strong_release %7 : $Obj + %10 = end_cow_mutation %7 : $Obj + strong_release %10 : $Obj %r = tuple () return %r : $() } @@ -177,7 +207,8 @@ bb0: %10 = address_to_pointer %9 : $*Int64 to $Builtin.RawPointer %f = function_ref @take_pointer : $@convention(thin) (Builtin.RawPointer) -> () %a = apply %f(%10) : $@convention(thin) (Builtin.RawPointer) -> () - strong_release %7 : $Obj + %12 = end_cow_mutation %7 : $Obj + strong_release %12 : $Obj %r = tuple () return %r : $() } @@ -215,7 +246,8 @@ bb0: store %4 to %9 : $*Int64 %15 = ref_tail_addr %7 : $Obj, $Int64 store %5 to %15 : $*Int64 - strong_release %7 : $Obj + %16 = end_cow_mutation %7 : $Obj + strong_release %16 : $Obj %r = tuple () return %r : $() } @@ -241,7 +273,8 @@ bb0: %19 = integer_literal $Builtin.Word, 1 %20 = index_addr %15 : $*Int64, %19 : $Builtin.Word store %6 to %20 : $*Int64 - strong_release %7 : $Obj + %21 = end_cow_mutation %7 : $Obj + strong_release %21 : $Obj %r = tuple () return %r : $() } diff --git a/test/SILOptimizer/ome_ignore_stdlib.sil b/test/SILOptimizer/ome_ignore_stdlib.sil new file mode 100644 index 0000000000000..297af05ecf8cb --- /dev/null +++ b/test/SILOptimizer/ome_ignore_stdlib.sil @@ -0,0 +1,13 @@ +// RUN: %target-sil-opt -non-stdlib-non-transparent-func-ownership-model-eliminator %s | %FileCheck %s +// RUN: %target-sil-opt -non-stdlib-non-transparent-func-ownership-model-eliminator %s -module-name Swift | %FileCheck -check-prefix=STDLIB-CHECK %s + +// CHECK-NOT: [ossa] +// STDLIB-CHECK: [ossa] + +sil_stage canonical + +sil [ossa] @my_ossa : $@convention(thin) () -> () { +bb0: + %9999 = tuple() + return %9999 : $() +} diff --git a/test/SILOptimizer/optional_of_existential.swift b/test/SILOptimizer/optional_of_existential.swift new file mode 100644 index 0000000000000..892d376759666 --- /dev/null +++ b/test/SILOptimizer/optional_of_existential.swift @@ -0,0 +1,26 @@ +// RUN: %target-swift-frontend -O -module-name=test -emit-sil -primary-file %s | %FileCheck %s + +protocol P { associatedtype A = Int } +protocol Q : P {} + +protocol B { var x: Int { get } } +struct Y {} +extension Y : B where T : Q { var x: Int { 0 }} + +extension P { + var z: Int? { (Y() as? B)?.x } +} + +struct X : Q { + +// Check that this getter can be folded to a simple "return 0" + +// CHECK-LABEL: sil hidden @$s4test1XV0A2MeSiSgvg : $@convention(method) (X) -> Optional { +// CHECK: bb0(%0 : $X): +// CHECK-NEXT: integer_literal ${{.*}}, 0 +// CHECK-NEXT: struct $Int +// CHECK-NEXT: enum $Optional, #Optional.some!enumelt +// CHECK-NEXT: return %3 : $Optional +// CHECK-NEXT: } // end sil function '$s4test1XV0A2MeSiSgvg' + var testMe: Int? { z } +} diff --git a/test/SILOptimizer/pointer_conversion.swift b/test/SILOptimizer/pointer_conversion.swift index a26333b86acf8..f62d706affc31 100644 --- a/test/SILOptimizer/pointer_conversion.swift +++ b/test/SILOptimizer/pointer_conversion.swift @@ -1,5 +1,5 @@ // RUN: %target-swift-frontend -emit-sil -O %s | %FileCheck %s -// REQUIRES: optimized_stdlib +// REQUIRES: optimized_stdlib,swift_stdlib_no_asserts // Opaque, unoptimizable functions to call. @_silgen_name("takesConstRawPointer") @@ -86,23 +86,14 @@ public func testMutableArrayToOptional() { public func arrayLiteralPromotion() { takesConstRawPointer([-41,-42,-43,-44]) - // Stack allocate the array. - // TODO: When stdlib checks are enabled, this becomes heap allocated... :-( - // CHECK: alloc_ref {{.*}}[tail_elems $Int * {{.*}} : $Builtin.Word] $_ContiguousArrayStorage - - // Store the elements. - // CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, -41 - // CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, -42 - // CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, -43 - // CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, -44 - - // Call the function. - // CHECK: [[PTR:%.+]] = mark_dependence - + // Outline the array literal. + // CHECK: [[ARR:%.+]] = global_value + // CHECK: [[CAST:%.+]] = upcast [[ARR]] + // CHECK: [[TADDR:%.+]] = ref_tail_addr [[CAST]] + // CHECK: [[RAWPTR:%.+]] = address_to_pointer [[TADDR]] + // CHECK: [[UNSAFEPTR:%.+]] = struct $UnsafeRawPointer ([[RAWPTR]] + // CHECK: [[PTR:%.+]] = mark_dependence [[UNSAFEPTR]] // CHECK: [[FN:%.+]] = function_ref @takesConstRawPointer // CHECK: apply [[FN]]([[PTR]]) - - // Release the heap value. - // CHECK: strong_release } diff --git a/test/SILOptimizer/prune-vtables.sil b/test/SILOptimizer/prune-vtables.sil new file mode 100644 index 0000000000000..ae793db599aa1 --- /dev/null +++ b/test/SILOptimizer/prune-vtables.sil @@ -0,0 +1,152 @@ +// RUN: %target-sil-opt -prune-vtables %s | %FileCheck --check-prefix=NOWMO %s +// RUN: %target-sil-opt -wmo -prune-vtables %s | %FileCheck --check-prefix=WMO %s + +sil_stage canonical + +private class PrivateA { + func noOverrides() {} + func yesOverrides() {} + final func isFinal() {} +} + +sil @PrivateA_noOverrides : $@convention(method) (@guaranteed PrivateA) -> () +sil @PrivateA_yesOverrides : $@convention(method) (@guaranteed PrivateA) -> () +sil @PrivateA_isFinal : $@convention(method) (@guaranteed PrivateA) -> () + +// NOWMO-LABEL: sil_vtable PrivateA { +// NOWMO: #PrivateA.noOverrides{{.*}} [nonoverridden] +// NOWMO-NOT: #PrivateA.yesOverrides{{.*}} [nonoverridden] +// NOWMO: #PrivateA.isFinal{{.*}} [nonoverridden] + +// WMO-LABEL: sil_vtable PrivateA { +// WMO: #PrivateA.noOverrides{{.*}} [nonoverridden] +// WMO-NOT: #PrivateA.yesOverrides{{.*}} [nonoverridden] +// WMO: #PrivateA.isFinal{{.*}} [nonoverridden] +sil_vtable PrivateA { + #PrivateA.noOverrides: @PrivateA_noOverrides + #PrivateA.yesOverrides: @PrivateA_yesOverrides + #PrivateA.isFinal: @PrivateA_isFinal +} + +private class PrivateB: PrivateA { + override func yesOverrides() {} +} + +sil @PrivateB_yesOverrides : $@convention(method) (@guaranteed PrivateB) -> () + +sil_vtable PrivateB { + #PrivateA.noOverrides: @PrivateA_noOverrides [inherited] + #PrivateA.yesOverrides: @PrivateB_yesOverrides [override] + #PrivateA.isFinal: @PrivateA_isFinal [inherited] +} + +internal class InternalA { + func noOverrides() {} + func yesOverrides() {} + final func isFinal() {} +} + +sil @InternalA_noOverrides : $@convention(method) (@guaranteed InternalA) -> () +sil @InternalA_yesOverrides : $@convention(method) (@guaranteed InternalA) -> () +sil @InternalA_isFinal : $@convention(method) (@guaranteed InternalA) -> () + +// NOWMO-LABEL: sil_vtable InternalA { +// NOWMO-NOT: #InternalA.noOverrides{{.*}} [nonoverridden] +// NOWMO-NOT: #InternalA.yesOverrides{{.*}} [nonoverridden] +// NOWMO: #InternalA.isFinal{{.*}} [nonoverridden] + +// WMO-LABEL: sil_vtable InternalA { +// WMO: #InternalA.noOverrides{{.*}} [nonoverridden] +// WMO-NOT: #InternalA.yesOverrides{{.*}} [nonoverridden] +// WMO: #InternalA.isFinal{{.*}} [nonoverridden] +sil_vtable InternalA { + #InternalA.noOverrides: @InternalA_noOverrides + #InternalA.yesOverrides: @InternalA_yesOverrides + #InternalA.isFinal: @InternalA_isFinal +} + +internal class InternalB: InternalA { + override func yesOverrides() {} +} + +sil @InternalB_yesOverrides : $@convention(method) (@guaranteed InternalB) -> () + +sil_vtable InternalB { + #InternalA.noOverrides: @InternalA_noOverrides [inherited] + #InternalA.yesOverrides: @InternalB_yesOverrides [override] + #InternalA.isFinal: @InternalA_isFinal [inherited] +} + +public class PublicA { + public func noOverrides() {} + public func yesOverrides() {} + public final func isFinal() {} +} + +sil @PublicA_noOverrides : $@convention(method) (@guaranteed PublicA) -> () +sil @PublicA_yesOverrides : $@convention(method) (@guaranteed PublicA) -> () +sil @PublicA_isFinal : $@convention(method) (@guaranteed PublicA) -> () + +// NOWMO-LABEL: sil_vtable PublicA { +// NOWMO-NOT: #PublicA.noOverrides{{.*}} [nonoverridden] +// NOWMO-NOT: #PublicA.yesOverrides{{.*}} [nonoverridden] +// NOWMO: #PublicA.isFinal{{.*}} [nonoverridden] + +// WMO-LABEL: sil_vtable PublicA { +// WMO: #PublicA.noOverrides{{.*}} [nonoverridden] +// WMO-NOT: #PublicA.yesOverrides{{.*}} [nonoverridden] +// WMO: #PublicA.isFinal{{.*}} [nonoverridden] +sil_vtable PublicA { + #PublicA.noOverrides: @PublicA_noOverrides + #PublicA.yesOverrides: @PublicA_yesOverrides + #PublicA.isFinal: @PublicA_isFinal +} + +public class PublicB: PublicA { + public override func yesOverrides() {} +} + +sil @PublicB_yesOverrides : $@convention(method) (@guaranteed PublicB) -> () + +sil_vtable PublicB { + #PublicA.noOverrides: @PublicA_noOverrides [inherited] + #PublicA.yesOverrides: @PublicB_yesOverrides [override] + #PublicA.isFinal: @PublicA_isFinal [inherited] +} + +open class OpenA { + open func noOverrides() {} + open func yesOverrides() {} + public final func isFinal() {} +} + +sil @OpenA_noOverrides : $@convention(method) (@guaranteed OpenA) -> () +sil @OpenA_yesOverrides : $@convention(method) (@guaranteed OpenA) -> () +sil @OpenA_isFinal : $@convention(method) (@guaranteed OpenA) -> () + +// NOWMO-LABEL: sil_vtable OpenA { +// NOWMO-NOT: #OpenA.noOverrides{{.*}} [nonoverridden] +// NOWMO-NOT: #OpenA.yesOverrides{{.*}} [nonoverridden] +// NOWMO: #OpenA.isFinal{{.*}} [nonoverridden] + +// WMO-LABEL: sil_vtable OpenA { +// WMO-NOT: #OpenA.noOverrides{{.*}} [nonoverridden] +// WMO-NOT: #OpenA.yesOverrides{{.*}} [nonoverridden] +// WMO: #OpenA.isFinal{{.*}} [nonoverridden] +sil_vtable OpenA { + #OpenA.noOverrides: @OpenA_noOverrides + #OpenA.yesOverrides: @OpenA_yesOverrides + #OpenA.isFinal: @OpenA_isFinal +} + +open class OpenB: OpenA { + open override func yesOverrides() {} +} + +sil @OpenB_yesOverrides : $@convention(method) (@guaranteed OpenB) -> () + +sil_vtable OpenB { + #OpenA.noOverrides: @PublicA_noOverrides [inherited] + #OpenA.yesOverrides: @OpenB_yesOverrides [override] + #OpenA.isFinal: @PublicA_isFinal [inherited] +} diff --git a/test/SILOptimizer/semantic-arc-opts-canonical.sil b/test/SILOptimizer/semantic-arc-opts-canonical.sil index 9da28deee23a9..10d4f07699762 100644 --- a/test/SILOptimizer/semantic-arc-opts-canonical.sil +++ b/test/SILOptimizer/semantic-arc-opts-canonical.sil @@ -323,8 +323,6 @@ bb0(%0 : @guaranteed $StructMemberTest): // multiple trivial arguments), we can. // // CHECK-LABEL: sil [ossa] @multiple_arg_forwarding_inst_test : $@convention(thin) (@guaranteed Builtin.NativeObject, @guaranteed Builtin.NativeObject, Builtin.Int32) -> () { -// CHECK: copy_value -// CHECK: copy_value // CHECK-NOT: copy_value // CHECK: } // end sil function 'multiple_arg_forwarding_inst_test' sil [ossa] @multiple_arg_forwarding_inst_test : $@convention(thin) (@guaranteed Builtin.NativeObject, @guaranteed Builtin.NativeObject, Builtin.Int32) -> () { diff --git a/test/SILOptimizer/semantic-arc-opts.sil b/test/SILOptimizer/semantic-arc-opts.sil index f36740dc8c9d2..aac4e3eb35ddf 100644 --- a/test/SILOptimizer/semantic-arc-opts.sil +++ b/test/SILOptimizer/semantic-arc-opts.sil @@ -347,13 +347,7 @@ bb0(%0 : @guaranteed $StructMemberTest): return %7 : $Builtin.Int32 } -// Make sure that in a case where we have multiple non-trivial values passed to -// a forwarding instruction we do not optimize... but if we only have one (and -// multiple trivial arguments), we can. -// // CHECK-LABEL: sil [ossa] @multiple_arg_forwarding_inst_test : $@convention(thin) (@guaranteed Builtin.NativeObject, @guaranteed Builtin.NativeObject, Builtin.Int32) -> () { -// CHECK: copy_value -// CHECK: copy_value // CHECK-NOT: copy_value // CHECK: } // end sil function 'multiple_arg_forwarding_inst_test' sil [ossa] @multiple_arg_forwarding_inst_test : $@convention(thin) (@guaranteed Builtin.NativeObject, @guaranteed Builtin.NativeObject, Builtin.Int32) -> () { @@ -2560,4 +2554,17 @@ bb0(%0 : @guaranteed $Builtin.NativeObject, %1 : @guaranteed $Builtin.NativeObje destroy_value %2 : $NativeObjectPair %9999 = tuple() return %9999 : $() -} \ No newline at end of file +} + +// CHECK-LABEL: sil [ossa] @tuple_with_multiple_nontrivial_operands : $@convention(thin) (@guaranteed Builtin.NativeObject, @guaranteed Builtin.NativeObject) -> () { +// CHECK-NOT: copy_value +// CHECK: } // end sil function 'tuple_with_multiple_nontrivial_operands' +sil [ossa] @tuple_with_multiple_nontrivial_operands : $@convention(thin) (@guaranteed Builtin.NativeObject, @guaranteed Builtin.NativeObject) -> () { +bb0(%0 : @guaranteed $Builtin.NativeObject, %1 : @guaranteed $Builtin.NativeObject): + %0a = copy_value %0 : $Builtin.NativeObject + %1a = copy_value %1 : $Builtin.NativeObject + %2 = tuple (%0a : $Builtin.NativeObject, %1a : $Builtin.NativeObject) + destroy_value %2 : $(Builtin.NativeObject, Builtin.NativeObject) + %9999 = tuple() + return %9999 : $() +} diff --git a/test/SILOptimizer/sil_combine_concrete_existential.sil b/test/SILOptimizer/sil_combine_concrete_existential.sil index 5264b38cc73ca..196f58ee0cf6c 100644 --- a/test/SILOptimizer/sil_combine_concrete_existential.sil +++ b/test/SILOptimizer/sil_combine_concrete_existential.sil @@ -183,11 +183,10 @@ sil @$s37witness_return_optional_indirect_self1SVACycfC : $@convention(method) ( // CHECK: [[R1:%.*]] = alloc_stack $Optional<@opened("83DE9694-7315-11E8-955C-ACDE48001122") PPP> // CHECK: [[W1:%.*]] = witness_method $S, #PPP.returnsOptionalIndirect : (Self) -> () -> Self? : $@convention(witness_method: PPP) <τ_0_0 where τ_0_0 : PPP> (@in_guaranteed τ_0_0) -> @out Optional<τ_0_0> // CHECK: apply [[W1]]<@opened("83DE9694-7315-11E8-955C-ACDE48001122") PPP>([[R1]], [[O1]]) : $@convention(witness_method: PPP) <τ_0_0 where τ_0_0 : PPP> (@in_guaranteed τ_0_0) -> @out Optional<τ_0_0> -// CHECK: inject_enum_addr [[OE1:%.*]] : $*Optional, #Optional.some!enumelt -// CHECK: [[E1:%.*]] = unchecked_take_enum_data_addr [[OE1]] : $*Optional, #Optional.some!enumelt -// CHECK: [[O2:%.*]] = open_existential_addr immutable_access [[E1]] : $*PPP to $*@opened("83DE97CA-7315-11E8-955C-ACDE48001122") PPP +// CHECK: [[E1:%.*]] = unchecked_take_enum_data_addr +// CHECK: [[O2:%.*]] = open_existential_addr immutable_access {{.*}} : $*PPP to $*@opened("83DE97CA-7315-11E8-955C-ACDE48001122") PPP // CHECK: [[R2:%.*]] = alloc_stack $Optional<@opened("83DE97CA-7315-11E8-955C-ACDE48001122") PPP> -// CHECK: [[W2:%.*]] = witness_method $@opened("83DE97CA-7315-11E8-955C-ACDE48001122") PPP, #PPP.returnsOptionalIndirect : (Self) -> () -> Self?, %19 : $*@opened("83DE97CA-7315-11E8-955C-ACDE48001122") PPP : $@convention(witness_method: PPP) <τ_0_0 where τ_0_0 : PPP> (@in_guaranteed τ_0_0) -> @out Optional<τ_0_0> +// CHECK: [[W2:%.*]] = witness_method $@opened("{{.*}}") PPP, #PPP.returnsOptionalIndirect // CHECK: apply [[W2]]<@opened("83DE97CA-7315-11E8-955C-ACDE48001122") PPP>([[R2]], [[O2]]) : $@convention(witness_method: PPP) <τ_0_0 where τ_0_0 : PPP> (@in_guaranteed τ_0_0) -> @out Optional<τ_0_0> // CHECK-LABEL: } // end sil function '$s37witness_return_optional_indirect_self37testWitnessReturnOptionalIndirectSelfyyF' sil @$s37witness_return_optional_indirect_self37testWitnessReturnOptionalIndirectSelfyyF : $@convention(thin) () -> () { @@ -463,13 +462,10 @@ sil [transparent] [reabstraction_thunk] @testDevirtExistentialEnumThunk : $@conv // // CHECK-LABEL: sil shared [noinline] @testDevirtExistentialEnum : $@convention(thin) (@guaranteed Array) -> () { // CHECK: [[ALLOC_EXISTENTIAL:%.*]] = alloc_stack $ContiguousBytes -// CHECK: [[ALLOC_ENUM:%.*]] = alloc_stack $Optional -// CHECK: [[ENUM:%.*]] = init_enum_data_addr [[ALLOC_ENUM]] : $*Optional, #Optional.some!enumelt -// CHECK: [[INIT_DATA:%.*]] = init_existential_addr [[ENUM]] : $*ContiguousBytes, $Array +// CHECK: [[ALLOC_ENUM:%.*]] = alloc_stack $ContiguousBytes +// CHECK: [[INIT_DATA:%.*]] = init_existential_addr [[ALLOC_ENUM]] : $*ContiguousBytes, $Array // CHECK: store %0 to [[INIT_DATA]] : $*Array -// CHECK: inject_enum_addr [[ALLOC_ENUM]] : $*Optional, #Optional.some!enumelt -// CHECK: [[TAKE_DATA:%.*]] = unchecked_take_enum_data_addr [[ALLOC_ENUM]] : $*Optional, #Optional.some!enumelt -// CHECK: copy_addr [take] [[TAKE_DATA]] to [initialization] [[ALLOC_EXISTENTIAL]] : $*ContiguousBytes +// CHECK: copy_addr [take] [[ALLOC_ENUM]] to [initialization] [[ALLOC_EXISTENTIAL]] : $*ContiguousBytes // CHECK: [[OPENED:%.*]] = open_existential_addr immutable_access [[ALLOC_EXISTENTIAL]] : $*ContiguousBytes to $*@opened("8402EC1A-F35D-11E8-950A-D0817AD9F6DD") ContiguousBytes // CHECK: [[THUNK:%.*]] = function_ref @testDevirtExistentialEnumThunk : $@convention(thin) (UnsafeRawBufferPointer) -> (@out (), @error Error) // CHECK: [[TTF:%.*]] = thin_to_thick_function [[THUNK:%.*]] : $@convention(thin) (UnsafeRawBufferPointer) -> (@out (), @error Error) to $@noescape @callee_guaranteed (UnsafeRawBufferPointer) -> (@out (), @error Error) diff --git a/test/SILOptimizer/sil_combine_enum_addr.sil b/test/SILOptimizer/sil_combine_enum_addr.sil index 13d2101941b5f..7cf7f96280898 100644 --- a/test/SILOptimizer/sil_combine_enum_addr.sil +++ b/test/SILOptimizer/sil_combine_enum_addr.sil @@ -6,8 +6,8 @@ import Builtin import Swift // CHECK-LABEL: sil @convert_inject_enum_addr_select_enum_addr_into_cond_br : $@convention(thin) (@in Int, @inout _Stdout) -> () -// CHECK: init_existential_addr -// CHECK: inject_enum_addr +// CHECK-NOT: init_existential_addr +// CHECK-NOT: inject_enum_addr // CHECK-NOT: select_enum_addr // CHECK-NOT: bb1 // CHECK-NOT: unchecked_take_enum_data_addr @@ -42,8 +42,8 @@ bb2: // CHECK-LABEL: sil @convert_inject_enum_addr_switch_enum_addr_into_cond_br : $@convention(thin) (@in Int, @inout _Stdout) -> () -// CHECK: init_existential_addr -// CHECK: inject_enum_addr +// CHECK-NOT: init_existential_addr +// CHECK-NOT: inject_enum_addr // CHECK-NOT: switch_enum_addr // CHECK-NOT: bb1 // CHECK-NOT: unchecked_take_enum_data_addr diff --git a/test/SILOptimizer/sil_combine_enums.sil b/test/SILOptimizer/sil_combine_enums.sil index 3db3783701d74..03378b8025f95 100644 --- a/test/SILOptimizer/sil_combine_enums.sil +++ b/test/SILOptimizer/sil_combine_enums.sil @@ -140,9 +140,10 @@ bb0(%0 : $*G): // CHECK: enum $Optional, #Optional.some!enumelt // CHECK-NOT: inject_enum_addr // CHECK: return -sil @canonicalize_init_enum_data_addr : $@convention(thin) (@inout Int32, Builtin.Int32) -> Int32 { -bb0(%0 : $*Int32, %1 : $Builtin.Int32): +sil @canonicalize_init_enum_data_addr : $@convention(thin) (@inout Int32, Builtin.Int32, Optional) -> Int32 { +bb0(%0 : $*Int32, %1 : $Builtin.Int32, %2 : $Optional): %s1 = alloc_stack $Optional + store %2 to %s1 : $*Optional %e1 = init_enum_data_addr %s1 : $*Optional, #Optional.some!enumelt %v = load %0 : $*Int32 store %v to %e1 : $*Int32 @@ -163,9 +164,10 @@ bb0(%0 : $*Int32, %1 : $Builtin.Int32): // CHECK: enum $Optional, #Optional.some!enumelt // CHECK-NOT: inject_enum_addr // CHECK: return -sil @canonicalize_init_enum_data_addr_diff_basic_blocks : $@convention(thin) (@inout Int32, Builtin.Int32) -> Int32 { -bb0(%0 : $*Int32, %1 : $Builtin.Int32): +sil @canonicalize_init_enum_data_addr_diff_basic_blocks : $@convention(thin) (@inout Int32, Builtin.Int32, Optional) -> Int32 { +bb0(%0 : $*Int32, %1 : $Builtin.Int32, %2 : $Optional): %s1 = alloc_stack $Optional + store %2 to %s1 : $*Optional %e1 = init_enum_data_addr %s1 : $*Optional, #Optional.some!enumelt %v = load %0 : $*Int32 store %v to %e1 : $*Int32 @@ -496,3 +498,114 @@ bb0(%0 : $Int, %1 : $Int): return %r : $Optional<(Int, Int)> } +enum MP { + case A(S) + case B(S) +} + +sil @take_s : $@convention(thin) (@in S) -> () +sil @use_mp : $@convention(thin) (@in_guaranteed MP) -> () + +// CHECK-LABEL: sil @expand_alloc_stack_of_enum1 +// CHECK: [[A:%[0-9]+]] = alloc_stack $S +// CHECK: bb1: +// CHECK-NEXT: store %0 to [[A]] +// CHECK: bb2: +// CHECK-NEXT: store %0 to [[A]] +// CHECK: bb3: +// CHECK: apply {{%[0-9]+}}([[A]]) +// CHECK: } // end sil function 'expand_alloc_stack_of_enum1' +sil @expand_alloc_stack_of_enum1 : $@convention(method) (S) -> () { +bb0(%0 : $S): + %1 = alloc_stack $MP + cond_br undef, bb1, bb2 +bb1: + %2 = init_enum_data_addr %1 : $*MP, #MP.A!enumelt + store %0 to %2 : $*S + inject_enum_addr %1 : $*MP, #MP.A!enumelt + br bb3 +bb2: + %3 = init_enum_data_addr %1 : $*MP, #MP.A!enumelt + store %0 to %3 : $*S + inject_enum_addr %1 : $*MP, #MP.A!enumelt + br bb3 +bb3: + %7 = unchecked_take_enum_data_addr %1 : $*MP, #MP.A!enumelt + %8 = function_ref @take_s : $@convention(thin) (@in S) -> () + %9 = apply %8(%7) : $@convention(thin) (@in S) -> () + dealloc_stack %1 : $*MP + %11 = tuple () + return %11 : $() +} + +// CHECK-LABEL: sil @expand_alloc_stack_of_enum_without_take +// CHECK: [[A:%[0-9]+]] = alloc_stack $S +// CHECK: bb1: +// CHECK-NEXT: store %0 to [[A]] +// CHECK: bb2: +// CHECK-NEXT: store %0 to [[A]] +// CHECK: bb3: +// CHECK: destroy_addr [[A]] +// CHECK: } // end sil function 'expand_alloc_stack_of_enum_without_take' +sil @expand_alloc_stack_of_enum_without_take : $@convention(method) (S) -> () { +bb0(%0 : $S): + %1 = alloc_stack $MP + cond_br undef, bb1, bb2 +bb1: + %2 = init_enum_data_addr %1 : $*MP, #MP.A!enumelt + store %0 to %2 : $*S + inject_enum_addr %1 : $*MP, #MP.A!enumelt + br bb3 +bb2: + %3 = init_enum_data_addr %1 : $*MP, #MP.A!enumelt + store %0 to %3 : $*S + inject_enum_addr %1 : $*MP, #MP.A!enumelt + br bb3 +bb3: + destroy_addr %1 : $*MP + dealloc_stack %1 : $*MP + %11 = tuple () + return %11 : $() +} + +// CHECK-LABEL: sil @dont_expand_alloc_stack_of_enum_multiple_cases +// CHECK: alloc_stack $MP +// CHECK: } // end sil function 'dont_expand_alloc_stack_of_enum_multiple_cases' +sil @dont_expand_alloc_stack_of_enum_multiple_cases : $@convention(method) (S) -> () { +bb0(%0 : $S): + %1 = alloc_stack $MP + cond_br undef, bb1, bb2 +bb1: + %2 = init_enum_data_addr %1 : $*MP, #MP.A!enumelt + store %0 to %2 : $*S + inject_enum_addr %1 : $*MP, #MP.A!enumelt + br bb3 +bb2: + %3 = init_enum_data_addr %1 : $*MP, #MP.B!enumelt + store %0 to %3 : $*S + inject_enum_addr %1 : $*MP, #MP.B!enumelt + br bb3 +bb3: + destroy_addr %1 : $*MP + dealloc_stack %1 : $*MP + %11 = tuple () + return %11 : $() +} + +// CHECK-LABEL: sil @dont_expand_alloc_stack_of_enum_unknown_use +// CHECK: alloc_stack $MP +// CHECK: } // end sil function 'dont_expand_alloc_stack_of_enum_unknown_use' +sil @dont_expand_alloc_stack_of_enum_unknown_use : $@convention(method) (S) -> () { +bb0(%0 : $S): + %1 = alloc_stack $MP + %2 = init_enum_data_addr %1 : $*MP, #MP.A!enumelt + store %0 to %2 : $*S + inject_enum_addr %1 : $*MP, #MP.A!enumelt + %8 = function_ref @use_mp : $@convention(thin) (@in_guaranteed MP) -> () + %9 = apply %8(%1) : $@convention(thin) (@in_guaranteed MP) -> () + destroy_addr %1 : $*MP + dealloc_stack %1 : $*MP + %11 = tuple () + return %11 : $() +} + diff --git a/test/SILOptimizer/stack_promotion_escaping.swift b/test/SILOptimizer/stack_promotion_escaping.swift index 781ad54a27b93..af28c91453882 100644 --- a/test/SILOptimizer/stack_promotion_escaping.swift +++ b/test/SILOptimizer/stack_promotion_escaping.swift @@ -1,4 +1,5 @@ // RUN: %target-swift-frontend -parse-as-library -O -module-name=test %s -emit-sil | %FileCheck %s +// REQUIRES: optimized_stdlib,swift_stdlib_no_asserts final class Item {} diff --git a/test/ScanDependencies/Inputs/Swift/E.swiftcrossimport/SubE.swiftoverlay b/test/ScanDependencies/Inputs/Swift/E.swiftcrossimport/SubE.swiftoverlay new file mode 100644 index 0000000000000..ebf51d6dc9bb9 --- /dev/null +++ b/test/ScanDependencies/Inputs/Swift/E.swiftcrossimport/SubE.swiftoverlay @@ -0,0 +1,5 @@ +%YAML 1.2 +--- +version: 1 +modules: + - name: _cross_import_E diff --git a/test/ScanDependencies/Inputs/Swift/_cross_import_E.swiftinterface b/test/ScanDependencies/Inputs/Swift/_cross_import_E.swiftinterface new file mode 100644 index 0000000000000..4d1a725a4f44f --- /dev/null +++ b/test/ScanDependencies/Inputs/Swift/_cross_import_E.swiftinterface @@ -0,0 +1,6 @@ +// swift-interface-format-version: 1.0 +// swift-module-flags: -module-name _cross_import_E +import Swift +import E +import SubE +public func funcCrossImportE() {} diff --git a/test/ScanDependencies/module_deps.swift b/test/ScanDependencies/module_deps.swift index 3e11657ec02d4..1f8d498a90c6d 100644 --- a/test/ScanDependencies/module_deps.swift +++ b/test/ScanDependencies/module_deps.swift @@ -80,6 +80,9 @@ import SubE // CHECK-NEXT: { // CHECK-NEXT: "swift": "A" // CHECK-NEXT: } +// CHECK-NEXT: { +// CHECK-NEXT: "swift": "_cross_import_E" +// CHECK-NEXT: } // CHECK: "bridgingHeader": // CHECK-NEXT: "path": diff --git a/test/Sema/diag_constantness_check_os_log.swift b/test/Sema/diag_constantness_check_os_log.swift index 57bc1ee002173..59703a27f6248 100644 --- a/test/Sema/diag_constantness_check_os_log.swift +++ b/test/Sema/diag_constantness_check_os_log.swift @@ -73,6 +73,10 @@ func testValidLogCalls(x: Int) { func testTypeIncorrectLogCalls() { let message = "test message" + class TestClass { + } + let x = TestClass() + _osLogTestHelper(message) // expected-error@-1 {{cannot convert value of type 'String' to expected argument type 'OSLogMessage'}} _osLogTestHelper("prefix" + "\(x)") @@ -81,9 +85,6 @@ func testTypeIncorrectLogCalls() { // expected-error@-1 {{cannot convert value of type 'String' to expected argument type '(String, UnsafeBufferPointer) -> Void'}} // expected-error@-2 {{missing argument label 'assertion:' in call}} - class TestClass { - } - let x = TestClass() _osLogTestHelper("\(x, format: .hex)") //expected-error@-1 {{no exact matches in call to instance method 'appendInterpolation'}} diff --git a/test/Sema/diag_erroneous_iuo.swift b/test/Sema/diag_erroneous_iuo.swift index 52ba97d6b82d0..b6dbdfafa8508 100644 --- a/test/Sema/diag_erroneous_iuo.swift +++ b/test/Sema/diag_erroneous_iuo.swift @@ -116,7 +116,7 @@ _ = [Int!]() // expected-error {{'!' is not allowed here; perhaps '?' was intend let _: [Int!] = [1] // expected-error {{'!' is not allowed here; perhaps '?' was intended?}}{{12-13=?}} _ = Optional(nil) // expected-error {{'!' is not allowed here; perhaps '?' was intended?}}{{17-18=?}} let _: Optional = nil // expected-error {{'!' is not allowed here; perhaps '?' was intended?}}{{20-21=?}} -_ = Int!?(0) // expected-error 3 {{'!' is not allowed here; perhaps '?' was intended?}}{{8-9=?}} +_ = Int!?(0) // expected-error {{'!' is not allowed here; perhaps '?' was intended?}}{{8-9=?}} let _: Int!? = 0 // expected-error {{'!' is not allowed here; perhaps '?' was intended?}}{{11-12=?}} _ = ( Int!, // expected-error {{'!' is not allowed here; perhaps '?' was intended?}}{{6-7=?}} diff --git a/test/Sema/diag_unintended_generic_param.swift b/test/Sema/diag_unintended_generic_param.swift new file mode 100644 index 0000000000000..5aa97f07cdb46 --- /dev/null +++ b/test/Sema/diag_unintended_generic_param.swift @@ -0,0 +1,24 @@ +// RUN: %target-typecheck-verify-swift + +protocol Proto { + init?(string: String) + func foo() +} + +struct TypedFoo { + // expected-note@-1 {{did you mean to declare 'Proto' as a protocol conformance for 'T'?}} {{28-29= &}} + func foo(value: String) { + if let str = T.init(string:value) { // expected-error {{type 'T' has no member 'init'}} + print(str) + } + } +} + +func bar(arg: T) { // expected-error {{generic parameter 'Proto' is not used in function signature}} + // expected-note@-1 {{did you mean to declare 'Proto' as a protocol conformance for 'T'?}} {{11-12=:}} + arg.foo() // expected-error {{value of type 'T' has no member 'foo'}} +} + +func baz(arg: T) { // expected-error {{generic parameter 'Proto' is not used in function signature}} + arg.ugh() // expected-error {{value of type 'T' has no member 'ugh'}} +} diff --git a/test/SourceKit/DocSupport/doc_clang_module.swift.response b/test/SourceKit/DocSupport/doc_clang_module.swift.response index 7397dc33ebcb0..5e57ce4087762 100644 --- a/test/SourceKit/DocSupport/doc_clang_module.swift.response +++ b/test/SourceKit/DocSupport/doc_clang_module.swift.response @@ -65,7 +65,7 @@ struct FooRuncingOptions : OptionSet { extension FooRuncingOptions { - @inlinable init(_ sequence: S) where S : Sequence, Self.Element == S.Element + @inlinable init(_ sequence: S) where S : Sequence, FooRuncingOptions == S.Element @inlinable mutating func subtract(_ other: FooRuncingOptions) @@ -1314,3479 +1314,3474 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.length: 8 }, { - key.kind: source.lang.swift.ref.generic_type_param, - key.name: "Self", - key.usr: "s:s10SetAlgebraP4Selfxmfp", + key.kind: source.lang.swift.ref.struct, + key.name: "FooRuncingOptions", + key.usr: "c:@E@FooRuncingOptions", key.offset: 1547, - key.length: 4 - }, - { - key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 1552, - key.length: 7 + key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 1563, + key.offset: 1568, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 1565, + key.offset: 1570, key.length: 7 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 1578, + key.offset: 1583, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 1589, + key.offset: 1594, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 1598, + key.offset: 1603, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 1603, + key.offset: 1608, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 1612, + key.offset: 1617, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 1614, + key.offset: 1619, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 1621, + key.offset: 1626, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 1645, + key.offset: 1650, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 1656, + key.offset: 1661, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 1661, + key.offset: 1666, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 1670, + key.offset: 1675, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 1673, + key.offset: 1678, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 1680, + key.offset: 1685, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "Bool", key.usr: "s:Sb", - key.offset: 1702, + key.offset: 1707, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 1712, + key.offset: 1717, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 1723, + key.offset: 1728, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 1728, + key.offset: 1733, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 1739, + key.offset: 1744, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 1742, + key.offset: 1747, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 1749, + key.offset: 1754, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "Bool", key.usr: "s:Sb", - key.offset: 1771, + key.offset: 1776, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 1781, + key.offset: 1786, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 1792, + key.offset: 1797, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 1797, + key.offset: 1802, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 1808, + key.offset: 1813, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 1813, + key.offset: 1818, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 1820, + key.offset: 1825, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "Bool", key.usr: "s:Sb", - key.offset: 1842, + key.offset: 1847, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 1852, + key.offset: 1857, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 1863, + key.offset: 1868, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 1868, + key.offset: 1873, key.length: 11 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 1880, + key.offset: 1885, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 1882, + key.offset: 1887, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 1889, + key.offset: 1894, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 1911, + key.offset: 1916, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 1934, + key.offset: 1939, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 1945, + key.offset: 1950, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 1949, + key.offset: 1954, key.length: 7 }, { key.kind: source.lang.swift.ref.struct, key.name: "Bool", key.usr: "s:Sb", - key.offset: 1958, + key.offset: 1963, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 1965, + key.offset: 1970, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 1976, + key.offset: 1981, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 1987, + key.offset: 1992, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 1992, + key.offset: 1997, key.length: 16 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2009, + key.offset: 2014, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2012, + key.offset: 2017, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2019, + key.offset: 2024, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "Bool", key.usr: "s:Sb", - key.offset: 2041, + key.offset: 2046, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2051, + key.offset: 2056, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2062, + key.offset: 2067, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2067, + key.offset: 2072, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2082, + key.offset: 2087, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2085, + key.offset: 2090, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2092, + key.offset: 2097, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "Bool", key.usr: "s:Sb", - key.offset: 2114, + key.offset: 2119, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2122, + key.offset: 2127, key.length: 9 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2132, + key.offset: 2137, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2157, + key.offset: 2162, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2168, + key.offset: 2173, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2173, + key.offset: 2178, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2179, + key.offset: 2184, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2181, + key.offset: 2186, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2188, + key.offset: 2193, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2210, + key.offset: 2215, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2233, + key.offset: 2238, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2244, + key.offset: 2249, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2249, + key.offset: 2254, key.length: 12 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2262, + key.offset: 2267, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2264, + key.offset: 2269, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2271, + key.offset: 2276, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2293, + key.offset: 2298, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2316, + key.offset: 2321, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2327, + key.offset: 2332, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2332, + key.offset: 2337, key.length: 19 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2352, + key.offset: 2357, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2354, + key.offset: 2359, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2361, + key.offset: 2366, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2383, + key.offset: 2388, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2404, + key.offset: 2409, key.length: 9 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2414, + key.offset: 2419, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2439, + key.offset: 2444, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2450, + key.offset: 2455, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2455, + key.offset: 2460, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2464, + key.offset: 2469, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2466, + key.offset: 2471, key.length: 6 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2474, + key.offset: 2479, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "Bool", key.usr: "s:Sb", - key.offset: 2496, + key.offset: 2501, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2506, + key.offset: 2511, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2517, + key.offset: 2522, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2526, + key.offset: 2531, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2531, + key.offset: 2536, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2538, + key.offset: 2543, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2540, + key.offset: 2545, key.length: 9 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2551, + key.offset: 2556, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2574, + key.offset: 2579, key.length: 8 }, { key.kind: source.lang.swift.ref.struct, key.name: "Bool", key.usr: "s:Sb", - key.offset: 2584, + key.offset: 2589, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2590, + key.offset: 2595, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2609, + key.offset: 2614, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2633, + key.offset: 2638, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2644, + key.offset: 2649, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2653, + key.offset: 2658, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2658, + key.offset: 2663, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2665, + key.offset: 2670, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2667, + key.offset: 2672, key.length: 6 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2675, + key.offset: 2680, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2697, + key.offset: 2702, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2721, + key.offset: 2726, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2732, + key.offset: 2737, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2741, + key.offset: 2746, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2746, + key.offset: 2751, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2753, + key.offset: 2758, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2758, + key.offset: 2763, key.length: 9 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2769, + key.offset: 2774, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2791, + key.offset: 2796, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2813, + key.offset: 2818, key.length: 9 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2823, + key.offset: 2828, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2848, + key.offset: 2853, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2859, + key.offset: 2864, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2871, + key.offset: 2876, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2882, + key.offset: 2887, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2891, + key.offset: 2896, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2896, + key.offset: 2901, key.length: 9 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2906, + key.offset: 2911, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2908, + key.offset: 2913, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2915, + key.offset: 2920, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2939, + key.offset: 2944, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 2950, + key.offset: 2955, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2959, + key.offset: 2964, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2964, + key.offset: 2969, key.length: 16 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2981, + key.offset: 2986, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2983, + key.offset: 2988, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 2990, + key.offset: 2995, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 3014, + key.offset: 3019, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 3025, + key.offset: 3030, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3034, + key.offset: 3039, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3039, + key.offset: 3044, key.length: 23 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3063, + key.offset: 3068, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3065, + key.offset: 3070, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", key.usr: "c:@E@FooRuncingOptions", - key.offset: 3072, + key.offset: 3077, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3093, + key.offset: 3098, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3100, + key.offset: 3105, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3118, + key.offset: 3123, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3122, + key.offset: 3127, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3125, + key.offset: 3130, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3136, + key.offset: 3141, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3140, + key.offset: 3145, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Double", key.usr: "s:Sd", - key.offset: 3143, + key.offset: 3148, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3155, + key.offset: 3160, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3167, + key.offset: 3172, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3172, + key.offset: 3177, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3174, + key.offset: 3179, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3177, + key.offset: 3182, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3184, + key.offset: 3189, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3186, + key.offset: 3191, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Double", key.usr: "s:Sd", - key.offset: 3189, + key.offset: 3194, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3199, + key.offset: 3204, key.length: 9 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3209, + key.offset: 3214, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "UnsafeMutablePointer", key.usr: "s:Sp", - key.offset: 3229, + key.offset: 3234, key.length: 20 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooStruct1", key.usr: "c:@S@FooStruct1", - key.offset: 3250, + key.offset: 3255, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3262, + key.offset: 3267, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3269, + key.offset: 3274, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3287, + key.offset: 3292, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3291, + key.offset: 3296, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3294, + key.offset: 3299, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3305, + key.offset: 3310, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3309, + key.offset: 3314, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Double", key.usr: "s:Sd", - key.offset: 3312, + key.offset: 3317, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3324, + key.offset: 3329, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3336, + key.offset: 3341, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3341, + key.offset: 3346, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3343, + key.offset: 3348, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3346, + key.offset: 3351, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3353, + key.offset: 3358, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3355, + key.offset: 3360, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Double", key.usr: "s:Sd", - key.offset: 3358, + key.offset: 3363, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3368, + key.offset: 3373, key.length: 9 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3378, + key.offset: 3383, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooStruct2", key.usr: "c:@S@FooStruct2", - key.offset: 3398, + key.offset: 3403, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3409, + key.offset: 3414, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3416, + key.offset: 3421, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3441, + key.offset: 3446, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3445, + key.offset: 3450, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3448, + key.offset: 3453, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3459, + key.offset: 3464, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3463, + key.offset: 3468, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Double", key.usr: "s:Sd", - key.offset: 3466, + key.offset: 3471, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3478, + key.offset: 3483, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3490, + key.offset: 3495, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3495, + key.offset: 3500, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3497, + key.offset: 3502, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3500, + key.offset: 3505, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3507, + key.offset: 3512, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3509, + key.offset: 3514, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Double", key.usr: "s:Sd", - key.offset: 3512, + key.offset: 3517, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3522, + key.offset: 3527, key.length: 9 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3532, + key.offset: 3537, key.length: 11 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3546, + key.offset: 3551, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3552, + key.offset: 3557, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3556, + key.offset: 3561, key.length: 9 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3567, + key.offset: 3572, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3573, + key.offset: 3578, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3578, + key.offset: 3583, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3587, + key.offset: 3592, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3589, + key.offset: 3594, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3592, + key.offset: 3597, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3602, + key.offset: 3607, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3608, + key.offset: 3613, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3613, + key.offset: 3618, key.length: 22 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3636, + key.offset: 3641, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3638, + key.offset: 3643, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3641, + key.offset: 3646, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3651, + key.offset: 3656, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3657, + key.offset: 3662, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3662, + key.offset: 3667, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3671, + key.offset: 3676, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3673, + key.offset: 3678, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3676, + key.offset: 3681, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3683, + key.offset: 3688, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3685, + key.offset: 3690, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Float", key.usr: "s:Sf", - key.offset: 3688, + key.offset: 3693, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3695, + key.offset: 3700, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3697, + key.offset: 3702, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Double", key.usr: "s:Sd", - key.offset: 3700, + key.offset: 3705, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3708, + key.offset: 3713, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3710, + key.offset: 3715, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "UnsafeMutablePointer", key.usr: "s:Sp", - key.offset: 3713, + key.offset: 3718, key.length: 20 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3734, + key.offset: 3739, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3746, + key.offset: 3751, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3752, + key.offset: 3757, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3757, + key.offset: 3762, key.length: 16 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3774, + key.offset: 3779, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3776, + key.offset: 3781, key.length: 3 }, { key.kind: source.lang.swift.ref.struct, key.name: "Float", key.usr: "s:Sf", - key.offset: 3783, + key.offset: 3788, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3793, + key.offset: 3798, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3802, + key.offset: 3807, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3807, + key.offset: 3812, key.length: 26 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 3834, + key.offset: 3839, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 3836, + key.offset: 3841, key.length: 4 }, { key.kind: source.lang.swift.ref.struct, key.name: "Float", key.usr: "s:Sf", - key.offset: 3844, + key.offset: 3849, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 3854, + key.offset: 3859, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3863, + key.offset: 3868, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3868, + key.offset: 3873, key.length: 16 }, { key.kind: source.lang.swift.ref.enum, key.name: "Never", key.usr: "s:s5NeverO", - key.offset: 3890, + key.offset: 3895, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3896, + key.offset: 3901, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3901, + key.offset: 3906, key.length: 16 }, { key.kind: source.lang.swift.ref.enum, key.name: "Never", key.usr: "s:s5NeverO", - key.offset: 3923, + key.offset: 3928, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3929, + key.offset: 3934, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3934, + key.offset: 3939, key.length: 19 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3956, + key.offset: 3961, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3961, + key.offset: 3966, key.length: 19 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 3983, + key.offset: 3988, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 3988, + key.offset: 3993, key.length: 19 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4010, + key.offset: 4015, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4015, + key.offset: 4020, key.length: 19 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4037, + key.offset: 4042, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4042, + key.offset: 4047, key.length: 19 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4064, + key.offset: 4069, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4069, + key.offset: 4074, key.length: 32 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 4102, + key.offset: 4107, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 4104, + key.offset: 4109, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 4107, + key.offset: 4112, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 4117, + key.offset: 4122, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4123, + key.offset: 4128, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4132, + key.offset: 4137, key.length: 15 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4155, + key.offset: 4160, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4160, + key.offset: 4165, key.length: 12 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4180, + key.offset: 4185, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4185, + key.offset: 4190, key.length: 33 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4226, + key.offset: 4231, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4231, + key.offset: 4236, key.length: 33 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4272, + key.offset: 4277, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4279, + key.offset: 4284, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4284, + key.offset: 4289, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4309, + key.offset: 4314, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4313, + key.offset: 4318, key.length: 12 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 4327, + key.offset: 4332, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4335, + key.offset: 4340, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4339, + key.offset: 4344, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4350, + key.offset: 4355, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4354, + key.offset: 4359, key.length: 12 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 4368, + key.offset: 4373, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4376, + key.offset: 4381, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4380, + key.offset: 4385, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4391, + key.offset: 4396, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4395, + key.offset: 4400, key.length: 12 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 4409, + key.offset: 4414, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4417, + key.offset: 4422, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4425, + key.offset: 4430, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4434, + key.offset: 4439, key.length: 18 }, { key.kind: source.lang.swift.ref.protocol, key.name: "FooProtocolBase", key.usr: "c:objc(pl)FooProtocolBase", - key.offset: 4455, + key.offset: 4460, key.length: 15 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4475, + key.offset: 4480, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4481, + key.offset: 4486, key.length: 12 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4501, + key.offset: 4506, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4506, + key.offset: 4511, key.length: 20 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4534, + key.offset: 4539, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4539, + key.offset: 4544, key.length: 20 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 4560, + key.offset: 4565, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 4562, + key.offset: 4567, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4572, + key.offset: 4577, key.length: 3 }, { key.kind: source.lang.swift.ref.class, key.name: "FooClassBase", key.usr: "c:objc(cs)FooClassBase", - key.offset: 4581, + key.offset: 4586, key.length: 12 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4600, + key.offset: 4605, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 4613, + key.offset: 4618, key.length: 11 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4625, + key.offset: 4630, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 4631, + key.offset: 4636, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 4637, + key.offset: 4642, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Float", key.usr: "s:Sf", - key.offset: 4640, + key.offset: 4645, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4652, + key.offset: 4657, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4657, + key.offset: 4662, key.length: 29 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4694, + key.offset: 4699, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4700, + key.offset: 4705, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4705, + key.offset: 4710, key.length: 17 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4730, + key.offset: 4735, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4735, + key.offset: 4740, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4755, + key.offset: 4760, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4765, + key.offset: 4770, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4770, + key.offset: 4775, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4790, + key.offset: 4795, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4800, + key.offset: 4805, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4805, + key.offset: 4810, key.length: 15 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4826, + key.offset: 4831, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4836, + key.offset: 4841, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4841, + key.offset: 4846, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4861, + key.offset: 4866, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4868, + key.offset: 4873, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4874, + key.offset: 4879, key.length: 15 }, { key.kind: source.lang.swift.ref.class, key.name: "FooClassBase", key.usr: "c:objc(cs)FooClassBase", - key.offset: 4892, + key.offset: 4897, key.length: 12 }, { key.kind: source.lang.swift.ref.protocol, key.name: "FooProtocolDerived", key.usr: "c:objc(pl)FooProtocolDerived", - key.offset: 4906, + key.offset: 4911, key.length: 18 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4932, + key.offset: 4937, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4936, + key.offset: 4941, key.length: 12 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 4950, + key.offset: 4955, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4961, + key.offset: 4966, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4965, + key.offset: 4970, key.length: 12 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 4979, + key.offset: 4984, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 4990, + key.offset: 4995, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 4994, + key.offset: 4999, key.length: 12 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5008, + key.offset: 5013, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5016, + key.offset: 5021, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5027, + key.offset: 5032, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5032, + key.offset: 5037, key.length: 16 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5056, + key.offset: 5061, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5061, + key.offset: 5066, key.length: 16 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 5078, + key.offset: 5083, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 5080, + key.offset: 5085, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5083, + key.offset: 5088, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5095, + key.offset: 5100, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5100, + key.offset: 5105, key.length: 16 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 5117, + key.offset: 5122, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 5119, + key.offset: 5124, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5122, + key.offset: 5127, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 5129, + key.offset: 5134, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 5135, + key.offset: 5140, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5138, + key.offset: 5143, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5150, + key.offset: 5155, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5155, + key.offset: 5160, key.length: 29 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5192, + key.offset: 5197, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5198, + key.offset: 5203, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5203, + key.offset: 5208, key.length: 13 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5224, + key.offset: 5229, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5229, + key.offset: 5234, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5249, + key.offset: 5254, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5259, + key.offset: 5264, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5264, + key.offset: 5269, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5284, + key.offset: 5289, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5294, + key.offset: 5299, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5299, + key.offset: 5304, key.length: 15 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5320, + key.offset: 5325, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5330, + key.offset: 5335, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5335, + key.offset: 5340, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5355, + key.offset: 5360, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5362, + key.offset: 5367, key.length: 9 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5372, + key.offset: 5377, key.length: 13 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5388, + key.offset: 5393, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5394, + key.offset: 5399, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5398, + key.offset: 5403, key.length: 11 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5411, + key.offset: 5416, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5419, + key.offset: 5424, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5425, + key.offset: 5430, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5429, + key.offset: 5434, key.length: 11 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5442, + key.offset: 5447, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5450, + key.offset: 5455, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5456, + key.offset: 5461, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5460, + key.offset: 5465, key.length: 11 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5473, + key.offset: 5478, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5481, + key.offset: 5486, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5487, + key.offset: 5492, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5491, + key.offset: 5496, key.length: 11 }, { key.kind: source.lang.swift.ref.struct, key.name: "UInt32", key.usr: "s:s6UInt32V", - key.offset: 5504, + key.offset: 5509, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5513, + key.offset: 5518, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5519, + key.offset: 5524, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5523, + key.offset: 5528, key.length: 11 }, { key.kind: source.lang.swift.ref.struct, key.name: "UInt64", key.usr: "s:s6UInt64V", - key.offset: 5536, + key.offset: 5541, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5545, + key.offset: 5550, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5551, + key.offset: 5556, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5555, + key.offset: 5560, key.length: 11 }, { key.kind: source.lang.swift.ref.typealias, key.name: "typedef_int_t", key.usr: "c:Foo.h@T@typedef_int_t", - key.offset: 5568, + key.offset: 5573, key.length: 13 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5584, + key.offset: 5589, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5590, + key.offset: 5595, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5594, + key.offset: 5599, key.length: 11 }, { key.kind: source.lang.swift.ref.typealias, key.name: "typedef_int_t", key.usr: "c:Foo.h@T@typedef_int_t", - key.offset: 5607, + key.offset: 5612, key.length: 13 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5623, + key.offset: 5628, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5629, + key.offset: 5634, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5633, + key.offset: 5638, key.length: 11 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int8", key.usr: "s:s4Int8V", - key.offset: 5646, + key.offset: 5651, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5653, + key.offset: 5658, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5659, + key.offset: 5664, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5663, + key.offset: 5668, key.length: 11 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5676, + key.offset: 5681, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5684, + key.offset: 5689, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5690, + key.offset: 5695, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5694, + key.offset: 5699, key.length: 12 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int16", key.usr: "s:s5Int16V", - key.offset: 5708, + key.offset: 5713, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5716, + key.offset: 5721, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5722, + key.offset: 5727, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5726, + key.offset: 5731, key.length: 12 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.offset: 5740, + key.offset: 5745, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5746, + key.offset: 5751, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5752, + key.offset: 5757, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5756, + key.offset: 5761, key.length: 12 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5770, + key.offset: 5775, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5778, + key.offset: 5783, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5784, + key.offset: 5789, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5788, + key.offset: 5793, key.length: 13 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5803, + key.offset: 5808, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5811, + key.offset: 5816, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5817, + key.offset: 5822, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5821, + key.offset: 5826, key.length: 18 }, { key.kind: source.lang.swift.ref.struct, key.name: "UInt64", key.usr: "s:s6UInt64V", - key.offset: 5841, + key.offset: 5846, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5850, + key.offset: 5855, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5856, + key.offset: 5861, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5860, + key.offset: 5865, key.length: 16 }, { key.kind: source.lang.swift.ref.struct, key.name: "UInt32", key.usr: "s:s6UInt32V", - key.offset: 5878, + key.offset: 5883, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5887, + key.offset: 5892, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5893, + key.offset: 5898, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5897, + key.offset: 5902, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5916, + key.offset: 5921, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5924, + key.offset: 5929, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5930, + key.offset: 5935, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5934, + key.offset: 5939, key.length: 17 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 5953, + key.offset: 5958, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5961, + key.offset: 5966, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5967, + key.offset: 5972, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5972, + key.offset: 5977, key.length: 16 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 5991, + key.offset: 5996, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 5996, + key.offset: 6001, key.length: 21 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6020, + key.offset: 6025, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6027, + key.offset: 6032, key.length: 15 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6050, + key.offset: 6055, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6054, + key.offset: 6059, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 6057, + key.offset: 6062, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6068, + key.offset: 6073, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6080, + key.offset: 6085, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 6085, + key.offset: 6090, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 6087, + key.offset: 6092, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 6090, + key.offset: 6095, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6099, + key.offset: 6104, key.length: 9 }, { key.kind: source.lang.swift.ref.class, key.name: "FooClassBase", key.usr: "c:objc(cs)FooClassBase", - key.offset: 6109, + key.offset: 6114, key.length: 12 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6129, + key.offset: 6134, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6134, + key.offset: 6139, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6154, + key.offset: 6159, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6161, + key.offset: 6166, key.length: 9 }, { key.kind: source.lang.swift.ref.class, key.name: "FooClassBase", key.usr: "c:objc(cs)FooClassBase", - key.offset: 6171, + key.offset: 6176, key.length: 12 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6191, + key.offset: 6196, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6196, + key.offset: 6201, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6216, + key.offset: 6221, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6226, + key.offset: 6231, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6231, + key.offset: 6236, key.length: 15 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6252, + key.offset: 6257, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6259, + key.offset: 6264, key.length: 9 }, { key.kind: source.lang.swift.ref.class, key.name: "FooClassBase", key.usr: "c:objc(cs)FooClassBase", - key.offset: 6269, + key.offset: 6274, key.length: 12 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6289, + key.offset: 6294, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6294, + key.offset: 6299, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6314, + key.offset: 6319, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6321, + key.offset: 6326, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6330, + key.offset: 6335, key.length: 13 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6348, + key.offset: 6353, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6354, + key.offset: 6359, key.length: 21 }, { key.kind: source.lang.swift.ref.protocol, key.name: "_InternalProt", key.usr: "c:objc(pl)_InternalProt", - key.offset: 6378, + key.offset: 6383, key.length: 13 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6396, + key.offset: 6401, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6402, + key.offset: 6407, key.length: 25 }, { key.kind: source.lang.swift.ref.class, key.name: "FooClassBase", key.usr: "c:objc(cs)FooClassBase", - key.offset: 6430, + key.offset: 6435, key.length: 12 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 6450, + key.offset: 6455, key.length: 15 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6466, + key.offset: 6471, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6470, + key.offset: 6475, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 6482, + key.offset: 6487, key.length: 9 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 6498, + key.offset: 6503, key.length: 15 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6514, + key.offset: 6519, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6518, + key.offset: 6523, key.length: 16 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 6536, + key.offset: 6541, key.length: 9 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6552, + key.offset: 6557, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6556, + key.offset: 6561, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6568, + key.offset: 6573, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6578, + key.offset: 6583, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6582, + key.offset: 6587, key.length: 9 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6593, + key.offset: 6598, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6603, + key.offset: 6608, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6607, + key.offset: 6612, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6617, + key.offset: 6622, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 6627, + key.offset: 6632, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6632, + key.offset: 6637, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6636, + key.offset: 6641, key.length: 7 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 6645, + key.offset: 6650, key.length: 9 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6661, + key.offset: 6666, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6665, + key.offset: 6670, key.length: 6 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 6673, + key.offset: 6678, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6684, + key.offset: 6689, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6689, + key.offset: 6694, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6709, + key.offset: 6714, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6719, + key.offset: 6724, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6724, + key.offset: 6729, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6744, + key.offset: 6749, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6754, + key.offset: 6759, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6759, + key.offset: 6764, key.length: 15 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6780, + key.offset: 6785, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6790, + key.offset: 6795, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6795, + key.offset: 6800, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6815, + key.offset: 6820, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6822, + key.offset: 6827, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6826, + key.offset: 6831, key.length: 7 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6838, + key.offset: 6843, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6844, + key.offset: 6849, key.length: 21 }, { key.kind: source.lang.swift.ref.class, key.name: "FooClassBase", key.usr: "c:objc(cs)FooClassBase", - key.offset: 6868, + key.offset: 6873, key.length: 12 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 6888, + key.offset: 6893, key.length: 11 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6900, + key.offset: 6905, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 6906, + key.offset: 6911, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 6910, + key.offset: 6915, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 6913, + key.offset: 6918, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6925, + key.offset: 6930, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6930, + key.offset: 6935, key.length: 11 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6949, + key.offset: 6954, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6954, + key.offset: 6959, key.length: 16 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 6978, + key.offset: 6983, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 6983, + key.offset: 6988, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7001, + key.offset: 7006, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7006, + key.offset: 7011, key.length: 22 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7036, + key.offset: 7041, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7041, + key.offset: 7046, key.length: 22 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7071, + key.offset: 7076, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7076, + key.offset: 7081, key.length: 21 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7105, + key.offset: 7110, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7110, + key.offset: 7115, key.length: 23 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7141, + key.offset: 7146, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7146, + key.offset: 7151, key.length: 25 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7179, + key.offset: 7184, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7184, + key.offset: 7189, key.length: 25 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7217, + key.offset: 7222, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7222, + key.offset: 7227, key.length: 24 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7254, + key.offset: 7259, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7259, + key.offset: 7264, key.length: 26 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7293, + key.offset: 7298, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7298, + key.offset: 7303, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7318, + key.offset: 7323, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7328, + key.offset: 7333, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7333, + key.offset: 7338, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7353, + key.offset: 7358, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7363, + key.offset: 7368, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7368, + key.offset: 7373, key.length: 15 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7389, + key.offset: 7394, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7399, + key.offset: 7404, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7404, + key.offset: 7409, key.length: 14 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7424, + key.offset: 7429, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7431, + key.offset: 7436, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7437, + key.offset: 7442, key.length: 9 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7451, + key.offset: 7456, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7456, + key.offset: 7461, key.length: 16 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 7473, + key.offset: 7478, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 7475, + key.offset: 7480, key.length: 1 }, { key.kind: source.lang.swift.ref.class, key.name: "FooCFType", key.usr: "c:Foo.h@T@FooCFTypeRef", - key.offset: 7478, + key.offset: 7483, key.length: 9 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7490, + key.offset: 7495, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7495, + key.offset: 7500, key.length: 21 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.offset: 7519, + key.offset: 7524, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7530, + key.offset: 7535, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7535, + key.offset: 7540, key.length: 13 }, { key.kind: source.lang.swift.syntaxtype.number, - key.offset: 7551, + key.offset: 7556, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7558, + key.offset: 7563, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7563, + key.offset: 7568, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.number, - key.offset: 7576, + key.offset: 7581, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 7583, + key.offset: 7588, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7594, + key.offset: 7599, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7598, + key.offset: 7603, key.length: 9 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.offset: 7609, + key.offset: 7614, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7615, + key.offset: 7620, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.attribute.builtin, - key.offset: 7626, + key.offset: 7631, key.length: 10 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7637, + key.offset: 7642, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7642, + key.offset: 7647, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 7647, + key.offset: 7652, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 7652, + key.offset: 7657, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7660, + key.offset: 7665, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "Hasher", key.usr: "s:s6HasherV", - key.offset: 7666, + key.offset: 7671, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7679, + key.offset: 7684, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7686, + key.offset: 7691, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 7695, + key.offset: 7700, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 7697, + key.offset: 7702, key.length: 3 }, { key.kind: source.lang.swift.ref.enum, key.name: "ABAuthorizationStatus", key.usr: "c:@E@ABAuthorizationStatus", - key.offset: 7702, + key.offset: 7707, key.length: 21 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 7725, + key.offset: 7730, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 7727, + key.offset: 7732, key.length: 3 }, { key.kind: source.lang.swift.ref.enum, key.name: "ABAuthorizationStatus", key.usr: "c:@E@ABAuthorizationStatus", - key.offset: 7732, + key.offset: 7737, key.length: 21 }, { key.kind: source.lang.swift.ref.struct, key.name: "Bool", key.usr: "s:Sb", - key.offset: 7758, + key.offset: 7763, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7765, + key.offset: 7770, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7770, + key.offset: 7775, key.length: 11 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 7782, + key.offset: 7787, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 7784, + key.offset: 7789, key.length: 1 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 7787, + key.offset: 7792, key.length: 5 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int32", key.usr: "s:s5Int32V", - key.offset: 7797, + key.offset: 7802, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7803, + key.offset: 7808, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7810, + key.offset: 7815, key.length: 11 }, { key.kind: source.lang.swift.ref.protocol, key.name: "Equatable", key.usr: "s:SQ", - key.offset: 7824, + key.offset: 7829, key.length: 9 }, { key.kind: source.lang.swift.ref.protocol, key.name: "RawRepresentable", key.usr: "s:SY", - key.offset: 7835, + key.offset: 7840, key.length: 16 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7859, + key.offset: 7864, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 7864, + key.offset: 7869, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 7866, + key.offset: 7871, key.length: 8 }, { key.kind: source.lang.swift.ref.struct, key.name: "UInt32", key.usr: "s:s6UInt32V", - key.offset: 7876, + key.offset: 7881, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7889, + key.offset: 7894, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 7894, + key.offset: 7899, key.length: 8 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 7903, + key.offset: 7908, key.length: 8 }, { key.kind: source.lang.swift.ref.struct, key.name: "UInt32", key.usr: "s:s6UInt32V", - key.offset: 7913, + key.offset: 7918, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7926, + key.offset: 7931, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 7930, + key.offset: 7935, key.length: 8 }, { key.kind: source.lang.swift.ref.struct, key.name: "UInt32", key.usr: "s:s6UInt32V", - key.offset: 7940, + key.offset: 7945, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7952, + key.offset: 7957, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 7959, + key.offset: 7964, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 7968, + key.offset: 7973, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 7970, + key.offset: 7975, key.length: 3 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooSubEnum1", key.usr: "c:@E@FooSubEnum1", - key.offset: 7975, + key.offset: 7980, key.length: 11 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 7988, + key.offset: 7993, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 7990, + key.offset: 7995, key.length: 3 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooSubEnum1", key.usr: "c:@E@FooSubEnum1", - key.offset: 7995, + key.offset: 8000, key.length: 11 }, { key.kind: source.lang.swift.ref.struct, key.name: "Bool", key.usr: "s:Sb", - key.offset: 8011, + key.offset: 8016, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 8018, + key.offset: 8023, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 8022, + key.offset: 8027, key.length: 12 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooSubEnum1", key.usr: "c:@E@FooSubEnum1", - key.offset: 8036, + key.offset: 8041, key.length: 11 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 8050, + key.offset: 8055, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 8056, + key.offset: 8061, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 8060, + key.offset: 8065, key.length: 12 }, { key.kind: source.lang.swift.ref.struct, key.name: "FooSubEnum1", key.usr: "c:@E@FooSubEnum1", - key.offset: 8074, + key.offset: 8079, key.length: 11 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 8088, + key.offset: 8093, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 8094, + key.offset: 8099, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 8098, + key.offset: 8103, key.length: 25 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.offset: 8125, + key.offset: 8130, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 8131, + key.offset: 8136, key.length: 3 } ] @@ -5273,7 +5268,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "init(arrayLiteral:)", key.usr: "s:s10SetAlgebraPs7ElementQz012ArrayLiteralC0RtzrlE05arrayE0xAFd_tcfc::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s10SetAlgebraPs7ElementQz012ArrayLiteralC0RtzrlE05arrayE0xAFd_tcfc", - key.doc.full_as_xml: "init(arrayLiteral:)s:s10SetAlgebraPs7ElementQz012ArrayLiteralC0RtzrlE05arrayE0xAFd_tcfc@inlinable init(arrayLiteral: Self.Element...)Creates a set containing the elements of the given array literal.arrayLiteralinA list of elements of the new set.Do not call this initializer directly. It is used by the compiler when you use an array literal. Instead, create a new set using an array literal as its value by enclosing a comma-separated list of values in square brackets. You can use an array literal anywhere a set is expected by the type context.Here, a set of strings is created from an array literal holding only strings:", + key.doc.full_as_xml: "init(arrayLiteral:)s:s10SetAlgebraPs7ElementQz012ArrayLiteralC0RtzrlE05arrayE0xAFd_tcfc::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable init(arrayLiteral: FooRuncingOptions...)Creates a set containing the elements of the given array literal.arrayLiteralinA list of elements of the new set.Do not call this initializer directly. It is used by the compiler when you use an array literal. Instead, create a new set using an array literal as its value by enclosing a comma-separated list of values in square brackets. You can use an array literal anywhere a set is expected by the type context.Here, a set of strings is created from an array literal holding only strings:", key.offset: 1390, key.length: 64, key.fully_annotated_decl: "@inlinable init(arrayLiteral: FooRuncingOptions...)", @@ -5293,8 +5288,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.extension.struct, key.doc.full_as_xml: "extension FooRuncingOptionsSetAlgebra requirements for which default implementations are supplied.A type conforming to SetAlgebra can implement any of these initializers or methods, and those implementations will be used in lieu of these defaults.", key.offset: 1458, - key.length: 662, - key.fully_annotated_generic_signature: "<Self where Self : SetAlgebra>", + key.length: 667, + key.fully_annotated_decl: "extension FooRuncingOptions", key.extends: { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", @@ -5316,13 +5311,13 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.description: "S : Sequence" }, { - key.description: "Self.Element == S.Element" + key.description: "FooRuncingOptions == S.Element" } ], - key.doc.full_as_xml: "init(_:)s:s10SetAlgebraPsEyxqd__ncSTRd__7ElementQyd__ACRtzlufc@inlinable init<S>(_ sequence: S) where S : Sequence, Self.Element == S.ElementCreates a new set from a finite sequence of items.sequenceinThe elements to use as members of the new set.Use this initializer to create a new set from an existing sequence, like an array or a range:", + key.doc.full_as_xml: "init(_:)s:s10SetAlgebraPsEyxqd__ncSTRd__7ElementQyd__ACRtzlufc::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable init<S>(_ sequence: S) where S : Sequence, FooRuncingOptions == S.ElementCreates a new set from a finite sequence of items.sequenceinThe elements to use as members of the new set.Use this initializer to create a new set from an existing sequence, like an array or a range:", key.offset: 1493, - key.length: 79, - key.fully_annotated_decl: "@inlinable init<S>(_ sequence: S) where S : Sequence, Self.Element == S.Element", + key.length: 84, + key.fully_annotated_decl: "@inlinable init<S>(_ sequence: S) where S : Sequence, FooRuncingOptions == S.Element", key.entities: [ { key.kind: source.lang.swift.decl.var.local, @@ -5338,8 +5333,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "subtract(_:)", key.usr: "s:s10SetAlgebraPsE8subtractyyxF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s10SetAlgebraPsE8subtractyyxF", - key.doc.full_as_xml: "subtract(_:)s:s10SetAlgebraPsE8subtractyyxF@inlinable mutating func subtract(_ other: Self)Removes the elements of the given set from this set.otherinA set of the same type as the current set.In the following example, the elements of the employees set that are also members of the neighbors set are removed. In particular, the names "Bethany" and "Eric" are removed from employees.", - key.offset: 1578, + key.doc.full_as_xml: "subtract(_:)s:s10SetAlgebraPsE8subtractyyxF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable mutating func subtract(_ other: FooRuncingOptions)Removes the elements of the given set from this set.otherinA set of the same type as the current set.In the following example, the elements of the employees set that are also members of the neighbors set are removed. In particular, the names "Bethany" and "Eric" are removed from employees.", + key.offset: 1583, key.length: 61, key.fully_annotated_decl: "@inlinable mutating func subtract(_ other: FooRuncingOptions)", key.entities: [ @@ -5347,7 +5342,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "other", - key.offset: 1621, + key.offset: 1626, key.length: 17 } ] @@ -5357,8 +5352,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "isSubset(of:)", key.usr: "s:s10SetAlgebraPsE8isSubset2ofSbx_tF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s10SetAlgebraPsE8isSubset2ofSbx_tF", - key.doc.full_as_xml: "isSubset(of:)s:s10SetAlgebraPsE8isSubset2ofSbx_tF@inlinable func isSubset(of other: Self) -> BoolReturns a Boolean value that indicates whether the set is a subset of another set.otherinA set of the same type as the current set.true if the set is a subset of other; otherwise, false.Set A is a subset of another set B if every member of A is also a member of B.", - key.offset: 1645, + key.doc.full_as_xml: "isSubset(of:)s:s10SetAlgebraPsE8isSubset2ofSbx_tF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable func isSubset(of other: FooRuncingOptions) -> BoolReturns a Boolean value that indicates whether the set is a subset of another set.otherinA set of the same type as the current set.true if the set is a subset of other; otherwise, false.Set A is a subset of another set B if every member of A is also a member of B.", + key.offset: 1650, key.length: 61, key.fully_annotated_decl: "@inlinable func isSubset(of other: FooRuncingOptions) -> Bool", key.entities: [ @@ -5366,7 +5361,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "of", key.name: "other", - key.offset: 1680, + key.offset: 1685, key.length: 17 } ] @@ -5376,8 +5371,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "isSuperset(of:)", key.usr: "s:s10SetAlgebraPsE10isSuperset2ofSbx_tF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s10SetAlgebraPsE10isSuperset2ofSbx_tF", - key.doc.full_as_xml: "isSuperset(of:)s:s10SetAlgebraPsE10isSuperset2ofSbx_tF@inlinable func isSuperset(of other: Self) -> BoolReturns a Boolean value that indicates whether the set is a superset of the given set.otherinA set of the same type as the current set.true if the set is a superset of other; otherwise, false.Set A is a superset of another set B if every member of B is also a member of A.", - key.offset: 1712, + key.doc.full_as_xml: "isSuperset(of:)s:s10SetAlgebraPsE10isSuperset2ofSbx_tF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable func isSuperset(of other: FooRuncingOptions) -> BoolReturns a Boolean value that indicates whether the set is a superset of the given set.otherinA set of the same type as the current set.true if the set is a superset of other; otherwise, false.Set A is a superset of another set B if every member of B is also a member of A.", + key.offset: 1717, key.length: 63, key.fully_annotated_decl: "@inlinable func isSuperset(of other: FooRuncingOptions) -> Bool", key.entities: [ @@ -5385,7 +5380,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "of", key.name: "other", - key.offset: 1749, + key.offset: 1754, key.length: 17 } ] @@ -5395,8 +5390,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "isDisjoint(with:)", key.usr: "s:s10SetAlgebraPsE10isDisjoint4withSbx_tF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s10SetAlgebraPsE10isDisjoint4withSbx_tF", - key.doc.full_as_xml: "isDisjoint(with:)s:s10SetAlgebraPsE10isDisjoint4withSbx_tF@inlinable func isDisjoint(with other: Self) -> BoolReturns a Boolean value that indicates whether the set has no members in common with the given set.otherinA set of the same type as the current set.true if the set has no elements in common with other; otherwise, false.In the following example, the employees set is disjoint with the visitors set because no name appears in both sets.", - key.offset: 1781, + key.doc.full_as_xml: "isDisjoint(with:)s:s10SetAlgebraPsE10isDisjoint4withSbx_tF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable func isDisjoint(with other: FooRuncingOptions) -> BoolReturns a Boolean value that indicates whether the set has no members in common with the given set.otherinA set of the same type as the current set.true if the set has no elements in common with other; otherwise, false.In the following example, the employees set is disjoint with the visitors set because no name appears in both sets.", + key.offset: 1786, key.length: 65, key.fully_annotated_decl: "@inlinable func isDisjoint(with other: FooRuncingOptions) -> Bool", key.entities: [ @@ -5404,7 +5399,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "with", key.name: "other", - key.offset: 1820, + key.offset: 1825, key.length: 17 } ] @@ -5414,8 +5409,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "subtracting(_:)", key.usr: "s:s10SetAlgebraPsE11subtractingyxxF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s10SetAlgebraPsE11subtractingyxxF", - key.doc.full_as_xml: "subtracting(_:)s:s10SetAlgebraPsE11subtractingyxxF@inlinable func subtracting(_ other: Self) -> SelfReturns a new set containing the elements of this set that do not occur in the given set.otherinA set of the same type as the current set.A new set.In the following example, the nonNeighbors set is made up of the elements of the employees set that are not elements of neighbors:", - key.offset: 1852, + key.doc.full_as_xml: "subtracting(_:)s:s10SetAlgebraPsE11subtractingyxxF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable func subtracting(_ other: FooRuncingOptions) -> FooRuncingOptionsReturns a new set containing the elements of this set that do not occur in the given set.otherinA set of the same type as the current set.A new set.In the following example, the nonNeighbors set is made up of the elements of the employees set that are not elements of neighbors:", + key.offset: 1857, key.length: 76, key.fully_annotated_decl: "@inlinable func subtracting(_ other: FooRuncingOptions) -> FooRuncingOptions", key.entities: [ @@ -5423,7 +5418,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "other", - key.offset: 1889, + key.offset: 1894, key.length: 17 } ] @@ -5433,8 +5428,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "isEmpty", key.usr: "s:s10SetAlgebraPsE7isEmptySbvp::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s10SetAlgebraPsE7isEmptySbvp", - key.doc.full_as_xml: "isEmptys:s10SetAlgebraPsE7isEmptySbvp@inlinable var isEmpty: Bool { get }A Boolean value that indicates whether the set has no elements.", - key.offset: 1934, + key.doc.full_as_xml: "isEmptys:s10SetAlgebraPsE7isEmptySbvp::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable var isEmpty: Bool { get }A Boolean value that indicates whether the set has no elements.", + key.offset: 1939, key.length: 36, key.fully_annotated_decl: "@inlinable var isEmpty: Bool { get }" }, @@ -5443,8 +5438,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "isStrictSuperset(of:)", key.usr: "s:s10SetAlgebraPsE16isStrictSuperset2ofSbx_tF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s10SetAlgebraPsE16isStrictSuperset2ofSbx_tF", - key.doc.full_as_xml: "isStrictSuperset(of:)s:s10SetAlgebraPsE16isStrictSuperset2ofSbx_tF@inlinable func isStrictSuperset(of other: Self) -> BoolReturns a Boolean value that indicates whether this set is a strict superset of the given set.otherinA set of the same type as the current set.true if the set is a strict superset of other; otherwise, false.Set A is a strict superset of another set B if every member of B is also a member of A and A contains at least one element that is not a member of B.", - key.offset: 1976, + key.doc.full_as_xml: "isStrictSuperset(of:)s:s10SetAlgebraPsE16isStrictSuperset2ofSbx_tF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable func isStrictSuperset(of other: FooRuncingOptions) -> BoolReturns a Boolean value that indicates whether this set is a strict superset of the given set.otherinA set of the same type as the current set.true if the set is a strict superset of other; otherwise, false.Set A is a strict superset of another set B if every member of B is also a member of A and A contains at least one element that is not a member of B.", + key.offset: 1981, key.length: 69, key.fully_annotated_decl: "@inlinable func isStrictSuperset(of other: FooRuncingOptions) -> Bool", key.entities: [ @@ -5452,7 +5447,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "of", key.name: "other", - key.offset: 2019, + key.offset: 2024, key.length: 17 } ] @@ -5462,8 +5457,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "isStrictSubset(of:)", key.usr: "s:s10SetAlgebraPsE14isStrictSubset2ofSbx_tF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s10SetAlgebraPsE14isStrictSubset2ofSbx_tF", - key.doc.full_as_xml: "isStrictSubset(of:)s:s10SetAlgebraPsE14isStrictSubset2ofSbx_tF@inlinable func isStrictSubset(of other: Self) -> BoolReturns a Boolean value that indicates whether this set is a strict subset of the given set.otherinA set of the same type as the current set.true if the set is a strict subset of other; otherwise, false.Set A is a strict subset of another set B if every member of A is also a member of B and B contains at least one element that is not a member of A.", - key.offset: 2051, + key.doc.full_as_xml: "isStrictSubset(of:)s:s10SetAlgebraPsE14isStrictSubset2ofSbx_tF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable func isStrictSubset(of other: FooRuncingOptions) -> BoolReturns a Boolean value that indicates whether this set is a strict subset of the given set.otherinA set of the same type as the current set.true if the set is a strict subset of other; otherwise, false.Set A is a strict subset of another set B if every member of A is also a member of B and B contains at least one element that is not a member of A.", + key.offset: 2056, key.length: 67, key.fully_annotated_decl: "@inlinable func isStrictSubset(of other: FooRuncingOptions) -> Bool", key.entities: [ @@ -5471,7 +5466,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "of", key.name: "other", - key.offset: 2092, + key.offset: 2097, key.length: 17 } ] @@ -5481,9 +5476,9 @@ var FooSubUnnamedEnumeratorA1: Int { get } { key.kind: source.lang.swift.decl.extension.struct, key.doc.full_as_xml: "extension FooRuncingOptionsOptionSet requirements for which default implementations are supplied.A type conforming to OptionSet can implement any of these initializers or methods, and those implementations will be used in lieu of these defaults.", - key.offset: 2122, + key.offset: 2127, key.length: 280, - key.fully_annotated_generic_signature: "<Self where Self : OptionSet>", + key.fully_annotated_decl: "extension FooRuncingOptions", key.extends: { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", @@ -5495,8 +5490,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "union(_:)", key.usr: "s:s9OptionSetPsE5unionyxxF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s9OptionSetPsE5unionyxxF", - key.doc.full_as_xml: "union(_:)s:s9OptionSetPsE5unionyxxF@inlinable func union(_ other: Self) -> SelfReturns a new option set of the elements contained in this set, in the given set, or in both.otherinAn option set.A new option set made up of the elements contained in this set, in other, or in both.This example uses the union(_:) method to add two more shipping options to the default set.", - key.offset: 2157, + key.doc.full_as_xml: "union(_:)s:s9OptionSetPsE5unionyxxF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable func union(_ other: FooRuncingOptions) -> FooRuncingOptionsReturns a new option set of the elements contained in this set, in the given set, or in both.otherinAn option set.A new option set made up of the elements contained in this set, in other, or in both.This example uses the union(_:) method to add two more shipping options to the default set.", + key.offset: 2162, key.length: 70, key.fully_annotated_decl: "@inlinable func union(_ other: FooRuncingOptions) -> FooRuncingOptions", key.entities: [ @@ -5504,7 +5499,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "other", - key.offset: 2188, + key.offset: 2193, key.length: 17 } ] @@ -5514,8 +5509,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "intersection(_:)", key.usr: "s:s9OptionSetPsE12intersectionyxxF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s9OptionSetPsE12intersectionyxxF", - key.doc.full_as_xml: "intersection(_:)s:s9OptionSetPsE12intersectionyxxF@inlinable func intersection(_ other: Self) -> SelfReturns a new option set with only the elements contained in both this set and the given set.otherinAn option set.A new option set with only the elements contained in both this set and other.This example uses the intersection(_:) method to limit the available shipping options to what can be used with a PO Box destination.", - key.offset: 2233, + key.doc.full_as_xml: "intersection(_:)s:s9OptionSetPsE12intersectionyxxF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable func intersection(_ other: FooRuncingOptions) -> FooRuncingOptionsReturns a new option set with only the elements contained in both this set and the given set.otherinAn option set.A new option set with only the elements contained in both this set and other.This example uses the intersection(_:) method to limit the available shipping options to what can be used with a PO Box destination.", + key.offset: 2238, key.length: 77, key.fully_annotated_decl: "@inlinable func intersection(_ other: FooRuncingOptions) -> FooRuncingOptions", key.entities: [ @@ -5523,7 +5518,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "other", - key.offset: 2271, + key.offset: 2276, key.length: 17 } ] @@ -5533,8 +5528,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "symmetricDifference(_:)", key.usr: "s:s9OptionSetPsE19symmetricDifferenceyxxF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s9OptionSetPsE19symmetricDifferenceyxxF", - key.doc.full_as_xml: "symmetricDifference(_:)s:s9OptionSetPsE19symmetricDifferenceyxxF@inlinable func symmetricDifference(_ other: Self) -> SelfReturns a new option set with the elements contained in this set or in the given set, but not in both.otherinAn option set.A new option set with only the elements contained in either this set or other, but not in both.", - key.offset: 2316, + key.doc.full_as_xml: "symmetricDifference(_:)s:s9OptionSetPsE19symmetricDifferenceyxxF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable func symmetricDifference(_ other: FooRuncingOptions) -> FooRuncingOptionsReturns a new option set with the elements contained in this set or in the given set, but not in both.otherinAn option set.A new option set with only the elements contained in either this set or other, but not in both.", + key.offset: 2321, key.length: 84, key.fully_annotated_decl: "@inlinable func symmetricDifference(_ other: FooRuncingOptions) -> FooRuncingOptions", key.entities: [ @@ -5542,7 +5537,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "other", - key.offset: 2361, + key.offset: 2366, key.length: 17 } ] @@ -5551,15 +5546,10 @@ var FooSubUnnamedEnumeratorA1: Int { get } }, { key.kind: source.lang.swift.decl.extension.struct, - key.generic_requirements: [ - { - key.description: "Self == Self.Element" - } - ], - key.doc.full_as_xml: "extension FooRuncingOptions where Self == Self.ElementOptionSet requirements for which default implementations are supplied when Element == Self, which is the default.A type conforming to OptionSet can implement any of these initializers or methods, and those implementations will be used in lieu of these defaults.", - key.offset: 2404, + key.doc.full_as_xml: "extension FooRuncingOptionsOptionSet requirements for which default implementations are supplied when Element == Self, which is the default.A type conforming to OptionSet can implement any of these initializers or methods, and those implementations will be used in lieu of these defaults.", + key.offset: 2409, key.length: 407, - key.fully_annotated_generic_signature: "<Self where Self : OptionSet, Self == Self.Element>", + key.fully_annotated_decl: "extension FooRuncingOptions", key.extends: { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", @@ -5571,8 +5561,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "contains(_:)", key.usr: "s:s9OptionSetPs7ElementQzRszrlE8containsySbxF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s9OptionSetPs7ElementQzRszrlE8containsySbxF", - key.doc.full_as_xml: "contains(_:)s:s9OptionSetPs7ElementQzRszrlE8containsySbxF@inlinable func contains(_ member: Self) -> BoolReturns a Boolean value that indicates whether a given element is a member of the option set.memberinThe element to look for in the option set.true if the option set contains member; otherwise, false.This example uses the contains(_:) method to check whether next-day shipping is in the availableOptions instance.", - key.offset: 2439, + key.doc.full_as_xml: "contains(_:)s:s9OptionSetPs7ElementQzRszrlE8containsySbxF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable func contains(_ member: FooRuncingOptions) -> BoolReturns a Boolean value that indicates whether a given element is a member of the option set.memberinThe element to look for in the option set.true if the option set contains member; otherwise, false.This example uses the contains(_:) method to check whether next-day shipping is in the availableOptions instance.", + key.offset: 2444, key.length: 61, key.fully_annotated_decl: "@inlinable func contains(_ member: FooRuncingOptions) -> Bool", key.entities: [ @@ -5580,7 +5570,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "member", - key.offset: 2474, + key.offset: 2479, key.length: 17 } ] @@ -5590,8 +5580,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "insert(_:)", key.usr: "s:s9OptionSetPs7ElementQzRszrlE6insertySb8inserted_x17memberAfterInserttxF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s9OptionSetPs7ElementQzRszrlE6insertySb8inserted_x17memberAfterInserttxF", - key.doc.full_as_xml: "insert(_:)s:s9OptionSetPs7ElementQzRszrlE6insertySb8inserted_x17memberAfterInserttxF@inlinable mutating func insert(_ newMember: Self.Element) -> (inserted: Bool, memberAfterInsert: Self.Element)Adds the given element to the option set if it is not already a member.newMemberinThe element to insert.(true, newMember) if newMember was not contained in self. Otherwise, returns (false, oldMember), where oldMember is the member of the set equal to newMember.In the following example, the .secondDay shipping option is added to the freeOptions option set if purchasePrice is greater than 50.0. For the ShippingOptions declaration, see the OptionSet protocol discussion. 50 {]]>", - key.offset: 2506, + key.doc.full_as_xml: "insert(_:)s:s9OptionSetPs7ElementQzRszrlE6insertySb8inserted_x17memberAfterInserttxF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable mutating func insert(_ newMember: FooRuncingOptions) -> (inserted: Bool, memberAfterInsert: FooRuncingOptions)Adds the given element to the option set if it is not already a member.newMemberinThe element to insert.(true, newMember) if newMember was not contained in self. Otherwise, returns (false, oldMember), where oldMember is the member of the set equal to newMember.In the following example, the .secondDay shipping option is added to the freeOptions option set if purchasePrice is greater than 50.0. For the ShippingOptions declaration, see the OptionSet protocol discussion. 50 {]]>", + key.offset: 2511, key.length: 121, key.fully_annotated_decl: "@discardableResult @inlinable mutating func insert(_ newMember: FooRuncingOptions) -> (inserted: Bool, memberAfterInsert: FooRuncingOptions)", key.entities: [ @@ -5599,7 +5589,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "newMember", - key.offset: 2551, + key.offset: 2556, key.length: 17 } ] @@ -5609,8 +5599,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "remove(_:)", key.usr: "s:s9OptionSetPs7ElementQzRszrlE6removeyxSgxF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s9OptionSetPs7ElementQzRszrlE6removeyxSgxF", - key.doc.full_as_xml: "remove(_:)s:s9OptionSetPs7ElementQzRszrlE6removeyxSgxF@inlinable mutating func remove(_ member: Self.Element) -> Self.Element?Removes the given element and all elements subsumed by it.memberinThe element of the set to remove.The intersection of [member] and the set, if the intersection was nonempty; otherwise, nil.In the following example, the .priority shipping option is removed from the options option set. Attempting to remove the same shipping option a second time results in nil, because options no longer contains .priority as a member.In the next example, the .express element is passed to remove(_:). Although .express is not a member of options, .express subsumes the remaining .secondDay element of the option set. Therefore, options is emptied and the intersection between .express and options is returned.", - key.offset: 2633, + key.doc.full_as_xml: "remove(_:)s:s9OptionSetPs7ElementQzRszrlE6removeyxSgxF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable mutating func remove(_ member: FooRuncingOptions) -> FooRuncingOptions?Removes the given element and all elements subsumed by it.memberinThe element of the set to remove.The intersection of [member] and the set, if the intersection was nonempty; otherwise, nil.In the following example, the .priority shipping option is removed from the options option set. Attempting to remove the same shipping option a second time results in nil, because options no longer contains .priority as a member.In the next example, the .express element is passed to remove(_:). Although .express is not a member of options, .express subsumes the remaining .secondDay element of the option set. Therefore, options is emptied and the intersection between .express and options is returned.", + key.offset: 2638, key.length: 82, key.fully_annotated_decl: "@discardableResult @inlinable mutating func remove(_ member: FooRuncingOptions) -> FooRuncingOptions?", key.entities: [ @@ -5618,7 +5608,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "member", - key.offset: 2675, + key.offset: 2680, key.length: 17 } ] @@ -5628,8 +5618,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "update(with:)", key.usr: "s:s9OptionSetPs7ElementQzRszrlE6update4withxSgx_tF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s9OptionSetPs7ElementQzRszrlE6update4withxSgx_tF", - key.doc.full_as_xml: "update(with:)s:s9OptionSetPs7ElementQzRszrlE6update4withxSgx_tF@inlinable mutating func update(with newMember: Self.Element) -> Self.Element?Inserts the given element into the set.The intersection of [newMember] and the set if the intersection was nonempty; otherwise, nil.If newMember is not contained in the set but subsumes current members of the set, the subsumed members are returned.", - key.offset: 2721, + key.doc.full_as_xml: "update(with:)s:s9OptionSetPs7ElementQzRszrlE6update4withxSgx_tF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable mutating func update(with newMember: FooRuncingOptions) -> FooRuncingOptions?Inserts the given element into the set.The intersection of [newMember] and the set if the intersection was nonempty; otherwise, nil.If newMember is not contained in the set but subsumes current members of the set, the subsumed members are returned.", + key.offset: 2726, key.length: 88, key.fully_annotated_decl: "@discardableResult @inlinable mutating func update(with newMember: FooRuncingOptions) -> FooRuncingOptions?", key.entities: [ @@ -5637,7 +5627,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "with", key.name: "newMember", - key.offset: 2769, + key.offset: 2774, key.length: 17 } ] @@ -5646,15 +5636,10 @@ var FooSubUnnamedEnumeratorA1: Int { get } }, { key.kind: source.lang.swift.decl.extension.struct, - key.generic_requirements: [ - { - key.description: "Self.RawValue : FixedWidthInteger" - } - ], - key.doc.full_as_xml: "extension FooRuncingOptions where Self.RawValue : FixedWidthIntegerOptionSet requirements for which default implementations are supplied when RawValue conforms to FixedWidthInteger, which is the usual case. Each distinct bit of an option set’s .rawValue corresponds to a disjoint value of the OptionSet.A type conforming to OptionSet can implement any of these initializers or methods, and those implementations will be used in lieu of these defaults.union is implemented as a bitwise “or” (|) of rawValuesintersection is implemented as a bitwise “and” (&) of rawValuessymmetricDifference is implemented as a bitwise “exclusive or” (^) of rawValues", - key.offset: 2813, + key.doc.full_as_xml: "extension FooRuncingOptionsOptionSet requirements for which default implementations are supplied when RawValue conforms to FixedWidthInteger, which is the usual case. Each distinct bit of an option set’s .rawValue corresponds to a disjoint value of the OptionSet.A type conforming to OptionSet can implement any of these initializers or methods, and those implementations will be used in lieu of these defaults.union is implemented as a bitwise “or” (|) of rawValuesintersection is implemented as a bitwise “and” (&) of rawValuessymmetricDifference is implemented as a bitwise “exclusive or” (^) of rawValues", + key.offset: 2818, key.length: 279, - key.fully_annotated_generic_signature: "<Self where Self : OptionSet, Self.RawValue : FixedWidthInteger>", + key.fully_annotated_decl: "extension FooRuncingOptions", key.extends: { key.kind: source.lang.swift.ref.struct, key.name: "FooRuncingOptions", @@ -5666,8 +5651,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "init()", key.usr: "s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlExycfc::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlExycfc", - key.doc.full_as_xml: "init()s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlExycfc@inlinable init()Creates an empty option set.This initializer creates an option set with a raw value of zero.", - key.offset: 2848, + key.doc.full_as_xml: "init()s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlExycfc::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable init()Creates an empty option set.This initializer creates an option set with a raw value of zero.", + key.offset: 2853, key.length: 17, key.fully_annotated_decl: "@inlinable init()" }, @@ -5676,8 +5661,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "formUnion(_:)", key.usr: "s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE9formUnionyyxF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE9formUnionyyxF", - key.doc.full_as_xml: "formUnion(_:)s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE9formUnionyyxF@inlinable mutating func formUnion(_ other: Self)Inserts the elements of another set into this option set.otherinAn option set.This method is implemented as a | (bitwise OR) operation on the two sets’ raw values.", - key.offset: 2871, + key.doc.full_as_xml: "formUnion(_:)s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE9formUnionyyxF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable mutating func formUnion(_ other: FooRuncingOptions)Inserts the elements of another set into this option set.otherinAn option set.This method is implemented as a | (bitwise OR) operation on the two sets’ raw values.", + key.offset: 2876, key.length: 62, key.fully_annotated_decl: "@inlinable mutating func formUnion(_ other: FooRuncingOptions)", key.entities: [ @@ -5685,7 +5670,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "other", - key.offset: 2915, + key.offset: 2920, key.length: 17 } ] @@ -5695,8 +5680,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "formIntersection(_:)", key.usr: "s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE16formIntersectionyyxF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE16formIntersectionyyxF", - key.doc.full_as_xml: "formIntersection(_:)s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE16formIntersectionyyxF@inlinable mutating func formIntersection(_ other: Self)Removes all elements of this option set that are not also present in the given set.otherinAn option set.This method is implemented as a & (bitwise AND) operation on the two sets’ raw values.", - key.offset: 2939, + key.doc.full_as_xml: "formIntersection(_:)s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE16formIntersectionyyxF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable mutating func formIntersection(_ other: FooRuncingOptions)Removes all elements of this option set that are not also present in the given set.otherinAn option set.This method is implemented as a & (bitwise AND) operation on the two sets’ raw values.", + key.offset: 2944, key.length: 69, key.fully_annotated_decl: "@inlinable mutating func formIntersection(_ other: FooRuncingOptions)", key.entities: [ @@ -5704,7 +5689,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "other", - key.offset: 2990, + key.offset: 2995, key.length: 17 } ] @@ -5714,8 +5699,8 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "formSymmetricDifference(_:)", key.usr: "s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE23formSymmetricDifferenceyyxF::SYNTHESIZED::c:@E@FooRuncingOptions", key.original_usr: "s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE23formSymmetricDifferenceyyxF", - key.doc.full_as_xml: "formSymmetricDifference(_:)s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE23formSymmetricDifferenceyyxF@inlinable mutating func formSymmetricDifference(_ other: Self)Replaces this set with a new set containing all elements contained in either this set or the given set, but not in both.otherinAn option set.This method is implemented as a ^ (bitwise XOR) operation on the two sets’ raw values.", - key.offset: 3014, + key.doc.full_as_xml: "formSymmetricDifference(_:)s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE23formSymmetricDifferenceyyxF::SYNTHESIZED::c:@E@FooRuncingOptions@inlinable mutating func formSymmetricDifference(_ other: FooRuncingOptions)Replaces this set with a new set containing all elements contained in either this set or the given set, but not in both.otherinAn option set.This method is implemented as a ^ (bitwise XOR) operation on the two sets’ raw values.", + key.offset: 3019, key.length: 76, key.fully_annotated_decl: "@inlinable mutating func formSymmetricDifference(_ other: FooRuncingOptions)", key.entities: [ @@ -5723,7 +5708,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "other", - key.offset: 3072, + key.offset: 3077, key.length: 17 } ] @@ -5734,7 +5719,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.struct, key.name: "FooStruct1", key.usr: "c:@S@FooStruct1", - key.offset: 3093, + key.offset: 3098, key.length: 105, key.fully_annotated_decl: "struct FooStruct1", key.entities: [ @@ -5742,7 +5727,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "x", key.usr: "c:@S@FooStruct1@FI@x", - key.offset: 3118, + key.offset: 3123, key.length: 12, key.fully_annotated_decl: "var x: Int32" }, @@ -5750,7 +5735,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "y", key.usr: "c:@S@FooStruct1@FI@y", - key.offset: 3136, + key.offset: 3141, key.length: 13, key.fully_annotated_decl: "var y: Double" }, @@ -5758,7 +5743,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init()", key.usr: "s:So10FooStruct1VABycfc", - key.offset: 3155, + key.offset: 3160, key.length: 6, key.fully_annotated_decl: "init()" }, @@ -5766,7 +5751,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init(x:y:)", key.usr: "s:So10FooStruct1V1x1yABs5Int32V_Sdtcfc", - key.offset: 3167, + key.offset: 3172, key.length: 29, key.fully_annotated_decl: "init(x: Int32, y: Double)", key.entities: [ @@ -5774,14 +5759,14 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "x", key.name: "x", - key.offset: 3177, + key.offset: 3182, key.length: 5 }, { key.kind: source.lang.swift.decl.var.local, key.keyword: "y", key.name: "y", - key.offset: 3189, + key.offset: 3194, key.length: 6 } ] @@ -5792,7 +5777,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.typealias, key.name: "FooStruct1Pointer", key.usr: "c:Foo.h@T@FooStruct1Pointer", - key.offset: 3199, + key.offset: 3204, key.length: 62, key.fully_annotated_decl: "typealias FooStruct1Pointer = UnsafeMutablePointer<FooStruct1>", key.conforms: [ @@ -5807,7 +5792,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.struct, key.name: "FooStruct2", key.usr: "c:@S@FooStruct2", - key.offset: 3262, + key.offset: 3267, key.length: 105, key.fully_annotated_decl: "struct FooStruct2", key.entities: [ @@ -5815,7 +5800,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "x", key.usr: "c:@S@FooStruct2@FI@x", - key.offset: 3287, + key.offset: 3292, key.length: 12, key.fully_annotated_decl: "var x: Int32" }, @@ -5823,7 +5808,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "y", key.usr: "c:@S@FooStruct2@FI@y", - key.offset: 3305, + key.offset: 3310, key.length: 13, key.fully_annotated_decl: "var y: Double" }, @@ -5831,7 +5816,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init()", key.usr: "s:So10FooStruct2VABycfc", - key.offset: 3324, + key.offset: 3329, key.length: 6, key.fully_annotated_decl: "init()" }, @@ -5839,7 +5824,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init(x:y:)", key.usr: "s:So10FooStruct2V1x1yABs5Int32V_Sdtcfc", - key.offset: 3336, + key.offset: 3341, key.length: 29, key.fully_annotated_decl: "init(x: Int32, y: Double)", key.entities: [ @@ -5847,14 +5832,14 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "x", key.name: "x", - key.offset: 3346, + key.offset: 3351, key.length: 5 }, { key.kind: source.lang.swift.decl.var.local, key.keyword: "y", key.name: "y", - key.offset: 3358, + key.offset: 3363, key.length: 6 } ] @@ -5865,7 +5850,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.typealias, key.name: "FooStructTypedef1", key.usr: "c:Foo.h@T@FooStructTypedef1", - key.offset: 3368, + key.offset: 3373, key.length: 40, key.fully_annotated_decl: "typealias FooStructTypedef1 = FooStruct2" }, @@ -5873,7 +5858,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.struct, key.name: "FooStructTypedef2", key.usr: "c:@SA@FooStructTypedef2", - key.offset: 3409, + key.offset: 3414, key.length: 112, key.fully_annotated_decl: "struct FooStructTypedef2", key.entities: [ @@ -5881,7 +5866,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "x", key.usr: "c:@SA@FooStructTypedef2@FI@x", - key.offset: 3441, + key.offset: 3446, key.length: 12, key.fully_annotated_decl: "var x: Int32" }, @@ -5889,7 +5874,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "y", key.usr: "c:@SA@FooStructTypedef2@FI@y", - key.offset: 3459, + key.offset: 3464, key.length: 13, key.fully_annotated_decl: "var y: Double" }, @@ -5897,7 +5882,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init()", key.usr: "s:So17FooStructTypedef2aABycfc", - key.offset: 3478, + key.offset: 3483, key.length: 6, key.fully_annotated_decl: "init()" }, @@ -5905,7 +5890,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init(x:y:)", key.usr: "s:So17FooStructTypedef2a1x1yABs5Int32V_Sdtcfc", - key.offset: 3490, + key.offset: 3495, key.length: 29, key.fully_annotated_decl: "init(x: Int32, y: Double)", key.entities: [ @@ -5913,14 +5898,14 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "x", key.name: "x", - key.offset: 3500, + key.offset: 3505, key.length: 5 }, { key.kind: source.lang.swift.decl.var.local, key.keyword: "y", key.name: "y", - key.offset: 3512, + key.offset: 3517, key.length: 6 } ] @@ -5932,7 +5917,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "FooTypedef1", key.usr: "c:Foo.h@T@FooTypedef1", key.doc.full_as_xml: "FooTypedef1c:Foo.h@T@FooTypedef1typealias FooTypedef1 = Int32 Aaa. FooTypedef1. Bbb.", - key.offset: 3522, + key.offset: 3527, key.length: 29, key.fully_annotated_decl: "typealias FooTypedef1 = Int32", key.conforms: [ @@ -5958,7 +5943,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "fooIntVar", key.usr: "c:@fooIntVar", key.doc.full_as_xml: "fooIntVarc:@fooIntVarvar fooIntVar: Int32 Aaa. fooIntVar. Bbb.", - key.offset: 3552, + key.offset: 3557, key.length: 20, key.fully_annotated_decl: "var fooIntVar: Int32" }, @@ -5967,7 +5952,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "fooFunc1(_:)", key.usr: "c:@F@fooFunc1", key.doc.full_as_xml: "fooFunc1c:@F@fooFunc1func fooFunc1(_ a: Int32) -> Int32 Aaa. fooFunc1. Bbb.", - key.offset: 3573, + key.offset: 3578, key.length: 34, key.fully_annotated_decl: "func fooFunc1(_ a: Int32) -> Int32", key.entities: [ @@ -5975,7 +5960,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "a", - key.offset: 3592, + key.offset: 3597, key.length: 5 } ] @@ -5984,14 +5969,14 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.free, key.name: "fooFunc1AnonymousParam(_:)", key.usr: "c:@F@fooFunc1AnonymousParam", - key.offset: 3608, + key.offset: 3613, key.length: 48, key.fully_annotated_decl: "func fooFunc1AnonymousParam(_: Int32) -> Int32", key.entities: [ { key.kind: source.lang.swift.decl.var.local, key.keyword: "_", - key.offset: 3641, + key.offset: 3646, key.length: 5 } ] @@ -6000,7 +5985,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.free, key.name: "fooFunc3(_:_:_:_:)", key.usr: "c:@F@fooFunc3", - key.offset: 3657, + key.offset: 3662, key.length: 94, key.fully_annotated_decl: "func fooFunc3(_ a: Int32, _ b: Float, _ c: Double, _ d: UnsafeMutablePointer<Int32>!) -> Int32", key.entities: [ @@ -6008,28 +5993,28 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "a", - key.offset: 3676, + key.offset: 3681, key.length: 5 }, { key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "b", - key.offset: 3688, + key.offset: 3693, key.length: 5 }, { key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "c", - key.offset: 3700, + key.offset: 3705, key.length: 6 }, { key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "d", - key.offset: 3713, + key.offset: 3718, key.length: 28 } ] @@ -6038,7 +6023,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.free, key.name: "fooFuncWithBlock(_:)", key.usr: "c:@F@fooFuncWithBlock", - key.offset: 3752, + key.offset: 3757, key.length: 49, key.fully_annotated_decl: "func fooFuncWithBlock(_ blk: ((Float) -> Int32)!)", key.entities: [ @@ -6046,7 +6031,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "blk", - key.offset: 3781, + key.offset: 3786, key.length: 19 } ] @@ -6055,7 +6040,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.free, key.name: "fooFuncWithFunctionPointer(_:)", key.usr: "c:@F@fooFuncWithFunctionPointer", - key.offset: 3802, + key.offset: 3807, key.length: 60, key.fully_annotated_decl: "func fooFuncWithFunctionPointer(_ fptr: ((Float) -> Int32)!)", key.entities: [ @@ -6063,7 +6048,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "fptr", - key.offset: 3842, + key.offset: 3847, key.length: 19 } ] @@ -6072,7 +6057,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.free, key.name: "fooFuncNoreturn1()", key.usr: "c:@F@fooFuncNoreturn1", - key.offset: 3863, + key.offset: 3868, key.length: 32, key.fully_annotated_decl: "func fooFuncNoreturn1() -> Never" }, @@ -6080,7 +6065,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.free, key.name: "fooFuncNoreturn2()", key.usr: "c:@F@fooFuncNoreturn2", - key.offset: 3896, + key.offset: 3901, key.length: 32, key.fully_annotated_decl: "func fooFuncNoreturn2() -> Never" }, @@ -6089,7 +6074,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "fooFuncWithComment1()", key.usr: "c:@F@fooFuncWithComment1", key.doc.full_as_xml: "fooFuncWithComment1c:@F@fooFuncWithComment1func fooFuncWithComment1() Aaa. fooFuncWithComment1. Bbb. Ccc. Ddd.", - key.offset: 3929, + key.offset: 3934, key.length: 26, key.fully_annotated_decl: "func fooFuncWithComment1()" }, @@ -6098,7 +6083,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "fooFuncWithComment2()", key.usr: "c:@F@fooFuncWithComment2", key.doc.full_as_xml: "fooFuncWithComment2c:@F@fooFuncWithComment2func fooFuncWithComment2() Aaa. fooFuncWithComment2. Bbb.", - key.offset: 3956, + key.offset: 3961, key.length: 26, key.fully_annotated_decl: "func fooFuncWithComment2()" }, @@ -6107,7 +6092,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "fooFuncWithComment3()", key.usr: "c:@F@fooFuncWithComment3", key.doc.full_as_xml: "fooFuncWithComment3c:@F@fooFuncWithComment3func fooFuncWithComment3() Aaa. fooFuncWithComment3. Bbb. Ccc.", - key.offset: 3983, + key.offset: 3988, key.length: 26, key.fully_annotated_decl: "func fooFuncWithComment3()" }, @@ -6116,7 +6101,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "fooFuncWithComment4()", key.usr: "c:@F@fooFuncWithComment4", key.doc.full_as_xml: "fooFuncWithComment4c:@F@fooFuncWithComment4func fooFuncWithComment4() Aaa. fooFuncWithComment4. Bbb. Ddd.", - key.offset: 4010, + key.offset: 4015, key.length: 26, key.fully_annotated_decl: "func fooFuncWithComment4()" }, @@ -6125,7 +6110,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "fooFuncWithComment5()", key.usr: "c:@F@fooFuncWithComment5", key.doc.full_as_xml: "fooFuncWithComment5c:@F@fooFuncWithComment5func fooFuncWithComment5() Aaa. fooFuncWithComment5. Bbb. Ccc. Ddd.", - key.offset: 4037, + key.offset: 4042, key.length: 26, key.fully_annotated_decl: "func fooFuncWithComment5()" }, @@ -6134,7 +6119,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "redeclaredInMultipleModulesFunc1(_:)", key.usr: "c:@F@redeclaredInMultipleModulesFunc1", key.doc.full_as_xml: "redeclaredInMultipleModulesFunc1c:@F@redeclaredInMultipleModulesFunc1func redeclaredInMultipleModulesFunc1(_ a: Int32) -> Int32 Aaa. redeclaredInMultipleModulesFunc1. Bbb.", - key.offset: 4064, + key.offset: 4069, key.length: 58, key.fully_annotated_decl: "func redeclaredInMultipleModulesFunc1(_ a: Int32) -> Int32", key.entities: [ @@ -6142,7 +6127,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "a", - key.offset: 4107, + key.offset: 4112, key.length: 5 } ] @@ -6152,7 +6137,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "FooProtocolBase", key.usr: "c:objc(pl)FooProtocolBase", key.doc.full_as_xml: "FooProtocolBasec:objc(pl)FooProtocolBaseprotocol FooProtocolBase Aaa. FooProtocolBase. Bbb.", - key.offset: 4123, + key.offset: 4128, key.length: 301, key.fully_annotated_decl: "protocol FooProtocolBase", key.entities: [ @@ -6161,7 +6146,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "fooProtoFunc()", key.usr: "c:objc(pl)FooProtocolBase(im)fooProtoFunc", key.doc.full_as_xml: "fooProtoFuncc:objc(pl)FooProtocolBase(im)fooProtoFuncfunc fooProtoFunc() Aaa. fooProtoFunc. Bbb. Ccc.", - key.offset: 4155, + key.offset: 4160, key.length: 19, key.fully_annotated_decl: "func fooProtoFunc()" }, @@ -6170,7 +6155,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "fooProtoFuncWithExtraIndentation1()", key.usr: "c:objc(pl)FooProtocolBase(im)fooProtoFuncWithExtraIndentation1", key.doc.full_as_xml: "fooProtoFuncWithExtraIndentation1c:objc(pl)FooProtocolBase(im)fooProtoFuncWithExtraIndentation1func fooProtoFuncWithExtraIndentation1() Aaa. fooProtoFuncWithExtraIndentation1. Bbb. Ccc.", - key.offset: 4180, + key.offset: 4185, key.length: 40, key.fully_annotated_decl: "func fooProtoFuncWithExtraIndentation1()" }, @@ -6179,7 +6164,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "fooProtoFuncWithExtraIndentation2()", key.usr: "c:objc(pl)FooProtocolBase(im)fooProtoFuncWithExtraIndentation2", key.doc.full_as_xml: "fooProtoFuncWithExtraIndentation2c:objc(pl)FooProtocolBase(im)fooProtoFuncWithExtraIndentation2func fooProtoFuncWithExtraIndentation2() Aaa. fooProtoFuncWithExtraIndentation2. Bbb. Ccc.", - key.offset: 4226, + key.offset: 4231, key.length: 40, key.fully_annotated_decl: "func fooProtoFuncWithExtraIndentation2()" }, @@ -6187,7 +6172,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.static, key.name: "fooProtoClassFunc()", key.usr: "c:objc(pl)FooProtocolBase(cm)fooProtoClassFunc", - key.offset: 4272, + key.offset: 4277, key.length: 31, key.fully_annotated_decl: "static func fooProtoClassFunc()" }, @@ -6195,7 +6180,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "fooProperty1", key.usr: "c:objc(pl)FooProtocolBase(py)fooProperty1", - key.offset: 4309, + key.offset: 4314, key.length: 35, key.fully_annotated_decl: "var fooProperty1: Int32 { get set }" }, @@ -6203,7 +6188,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "fooProperty2", key.usr: "c:objc(pl)FooProtocolBase(py)fooProperty2", - key.offset: 4350, + key.offset: 4355, key.length: 35, key.fully_annotated_decl: "var fooProperty2: Int32 { get set }" }, @@ -6211,7 +6196,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "fooProperty3", key.usr: "c:objc(pl)FooProtocolBase(py)fooProperty3", - key.offset: 4391, + key.offset: 4396, key.length: 31, key.fully_annotated_decl: "var fooProperty3: Int32 { get }" } @@ -6221,7 +6206,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.protocol, key.name: "FooProtocolDerived", key.usr: "c:objc(pl)FooProtocolDerived", - key.offset: 4425, + key.offset: 4430, key.length: 49, key.fully_annotated_decl: "protocol FooProtocolDerived : FooProtocolBase", key.conforms: [ @@ -6236,7 +6221,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.class, key.name: "FooClassBase", key.usr: "c:objc(cs)FooClassBase", - key.offset: 4475, + key.offset: 4480, key.length: 392, key.fully_annotated_decl: "class FooClassBase", key.entities: [ @@ -6244,7 +6229,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "fooBaseInstanceFunc0()", key.usr: "c:objc(cs)FooClassBase(im)fooBaseInstanceFunc0", - key.offset: 4501, + key.offset: 4506, key.length: 27, key.fully_annotated_decl: "func fooBaseInstanceFunc0()" }, @@ -6252,7 +6237,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "fooBaseInstanceFunc1(_:)", key.usr: "c:objc(cs)FooClassBase(im)fooBaseInstanceFunc1:", - key.offset: 4534, + key.offset: 4539, key.length: 60, key.fully_annotated_decl: "func fooBaseInstanceFunc1(_ anObject: Any!) -> FooClassBase!", key.entities: [ @@ -6260,7 +6245,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "anObject", - key.offset: 4572, + key.offset: 4577, key.length: 4 } ] @@ -6269,7 +6254,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init()", key.usr: "c:objc(cs)FooClassBase(im)init", - key.offset: 4600, + key.offset: 4605, key.length: 7, key.fully_annotated_decl: "init!()" }, @@ -6277,7 +6262,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init(float:)", key.usr: "c:objc(cs)FooClassBase(im)initWithFloat:", - key.offset: 4613, + key.offset: 4618, key.length: 33, key.fully_annotated_decl: "convenience init!(float f: Float)", key.entities: [ @@ -6285,7 +6270,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "float", key.name: "f", - key.offset: 4640, + key.offset: 4645, key.length: 5 } ] @@ -6294,7 +6279,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "fooBaseInstanceFuncOverridden()", key.usr: "c:objc(cs)FooClassBase(im)fooBaseInstanceFuncOverridden", - key.offset: 4652, + key.offset: 4657, key.length: 36, key.fully_annotated_decl: "func fooBaseInstanceFuncOverridden()" }, @@ -6302,7 +6287,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.class, key.name: "fooBaseClassFunc0()", key.usr: "c:objc(cs)FooClassBase(cm)fooBaseClassFunc0", - key.offset: 4694, + key.offset: 4699, key.length: 30, key.fully_annotated_decl: "class func fooBaseClassFunc0()" }, @@ -6310,7 +6295,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "_internalMeth1()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth1", - key.offset: 4730, + key.offset: 4735, key.length: 29, key.fully_annotated_decl: "func _internalMeth1() -> Any!" }, @@ -6318,7 +6303,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "_internalMeth2()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth2", - key.offset: 4765, + key.offset: 4770, key.length: 29, key.fully_annotated_decl: "func _internalMeth2() -> Any!" }, @@ -6326,7 +6311,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "nonInternalMeth()", key.usr: "c:objc(cs)FooClassBase(im)nonInternalMeth", - key.offset: 4800, + key.offset: 4805, key.length: 30, key.fully_annotated_decl: "func nonInternalMeth() -> Any!" }, @@ -6334,7 +6319,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "_internalMeth3()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth3", - key.offset: 4836, + key.offset: 4841, key.length: 29, key.fully_annotated_decl: "func _internalMeth3() -> Any!" } @@ -6345,7 +6330,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "FooClassDerived", key.usr: "c:objc(cs)FooClassDerived", key.doc.full_as_xml: "FooClassDerivedc:objc(cs)FooClassDerivedclass FooClassDerived : FooClassBase, FooProtocolDerived Aaa. FooClassDerived. Bbb.", - key.offset: 4868, + key.offset: 4873, key.length: 493, key.fully_annotated_decl: "class FooClassDerived : FooClassBase, FooProtocolDerived", key.inherits: [ @@ -6367,7 +6352,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "fooProperty1", key.usr: "c:objc(cs)FooClassDerived(py)fooProperty1", - key.offset: 4932, + key.offset: 4937, key.length: 23, key.fully_annotated_decl: "var fooProperty1: Int32 { get set }" }, @@ -6375,7 +6360,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "fooProperty2", key.usr: "c:objc(cs)FooClassDerived(py)fooProperty2", - key.offset: 4961, + key.offset: 4966, key.length: 23, key.fully_annotated_decl: "var fooProperty2: Int32 { get set }" }, @@ -6383,7 +6368,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "fooProperty3", key.usr: "c:objc(cs)FooClassDerived(py)fooProperty3", - key.offset: 4990, + key.offset: 4995, key.length: 31, key.fully_annotated_decl: "var fooProperty3: Int32 { get }" }, @@ -6391,7 +6376,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "fooInstanceFunc0()", key.usr: "c:objc(cs)FooClassDerived(im)fooInstanceFunc0", - key.offset: 5027, + key.offset: 5032, key.length: 23, key.fully_annotated_decl: "func fooInstanceFunc0()" }, @@ -6399,7 +6384,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "fooInstanceFunc1(_:)", key.usr: "c:objc(cs)FooClassDerived(im)fooInstanceFunc1:", - key.offset: 5056, + key.offset: 5061, key.length: 33, key.fully_annotated_decl: "func fooInstanceFunc1(_ a: Int32)", key.entities: [ @@ -6407,7 +6392,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "a", - key.offset: 5083, + key.offset: 5088, key.length: 5 } ] @@ -6416,7 +6401,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "fooInstanceFunc2(_:withB:)", key.usr: "c:objc(cs)FooClassDerived(im)fooInstanceFunc2:withB:", - key.offset: 5095, + key.offset: 5100, key.length: 49, key.fully_annotated_decl: "func fooInstanceFunc2(_ a: Int32, withB b: Int32)", key.entities: [ @@ -6424,14 +6409,14 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "a", - key.offset: 5122, + key.offset: 5127, key.length: 5 }, { key.kind: source.lang.swift.decl.var.local, key.keyword: "withB", key.name: "b", - key.offset: 5138, + key.offset: 5143, key.length: 5 } ] @@ -6440,7 +6425,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "fooBaseInstanceFuncOverridden()", key.usr: "c:objc(cs)FooClassDerived(im)fooBaseInstanceFuncOverridden", - key.offset: 5150, + key.offset: 5155, key.length: 36, key.fully_annotated_decl: "func fooBaseInstanceFuncOverridden()", key.inherits: [ @@ -6455,7 +6440,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.class, key.name: "fooClassFunc0()", key.usr: "c:objc(cs)FooClassDerived(cm)fooClassFunc0", - key.offset: 5192, + key.offset: 5197, key.length: 26, key.fully_annotated_decl: "class func fooClassFunc0()" }, @@ -6464,7 +6449,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "_internalMeth1()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth1::SYNTHESIZED::c:objc(cs)FooClassDerived", key.original_usr: "c:objc(cs)FooClassBase(im)_internalMeth1", - key.offset: 5224, + key.offset: 5229, key.length: 29, key.fully_annotated_decl: "func _internalMeth1() -> Any!" }, @@ -6473,7 +6458,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "_internalMeth2()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth2::SYNTHESIZED::c:objc(cs)FooClassDerived", key.original_usr: "c:objc(cs)FooClassBase(im)_internalMeth2", - key.offset: 5259, + key.offset: 5264, key.length: 29, key.fully_annotated_decl: "func _internalMeth2() -> Any!" }, @@ -6482,7 +6467,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "nonInternalMeth()", key.usr: "c:objc(cs)FooClassBase(im)nonInternalMeth::SYNTHESIZED::c:objc(cs)FooClassDerived", key.original_usr: "c:objc(cs)FooClassBase(im)nonInternalMeth", - key.offset: 5294, + key.offset: 5299, key.length: 30, key.fully_annotated_decl: "func nonInternalMeth() -> Any!" }, @@ -6491,7 +6476,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "_internalMeth3()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth3::SYNTHESIZED::c:objc(cs)FooClassDerived", key.original_usr: "c:objc(cs)FooClassBase(im)_internalMeth3", - key.offset: 5330, + key.offset: 5335, key.length: 29, key.fully_annotated_decl: "func _internalMeth3() -> Any!" } @@ -6501,7 +6486,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.typealias, key.name: "typedef_int_t", key.usr: "c:Foo.h@T@typedef_int_t", - key.offset: 5362, + key.offset: 5367, key.length: 31, key.fully_annotated_decl: "typealias typedef_int_t = Int32", key.conforms: [ @@ -6526,7 +6511,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_1", key.usr: "c:Foo.h@3836@macro@FOO_MACRO_1", - key.offset: 5394, + key.offset: 5399, key.length: 30, key.fully_annotated_decl: "var FOO_MACRO_1: Int32 { get }" }, @@ -6534,7 +6519,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_2", key.usr: "c:Foo.h@3858@macro@FOO_MACRO_2", - key.offset: 5425, + key.offset: 5430, key.length: 30, key.fully_annotated_decl: "var FOO_MACRO_2: Int32 { get }" }, @@ -6542,7 +6527,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_3", key.usr: "c:Foo.h@3880@macro@FOO_MACRO_3", - key.offset: 5456, + key.offset: 5461, key.length: 30, key.fully_annotated_decl: "var FOO_MACRO_3: Int32 { get }" }, @@ -6550,7 +6535,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_4", key.usr: "c:Foo.h@3944@macro@FOO_MACRO_4", - key.offset: 5487, + key.offset: 5492, key.length: 31, key.fully_annotated_decl: "var FOO_MACRO_4: UInt32 { get }" }, @@ -6558,7 +6543,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_5", key.usr: "c:Foo.h@3976@macro@FOO_MACRO_5", - key.offset: 5519, + key.offset: 5524, key.length: 31, key.fully_annotated_decl: "var FOO_MACRO_5: UInt64 { get }" }, @@ -6566,7 +6551,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_6", key.usr: "c:Foo.h@4018@macro@FOO_MACRO_6", - key.offset: 5551, + key.offset: 5556, key.length: 38, key.fully_annotated_decl: "var FOO_MACRO_6: typedef_int_t { get }" }, @@ -6574,7 +6559,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_7", key.usr: "c:Foo.h@4059@macro@FOO_MACRO_7", - key.offset: 5590, + key.offset: 5595, key.length: 38, key.fully_annotated_decl: "var FOO_MACRO_7: typedef_int_t { get }" }, @@ -6582,7 +6567,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_8", key.usr: "c:Foo.h@4100@macro@FOO_MACRO_8", - key.offset: 5629, + key.offset: 5634, key.length: 29, key.fully_annotated_decl: "var FOO_MACRO_8: Int8 { get }" }, @@ -6590,7 +6575,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_9", key.usr: "c:Foo.h@4131@macro@FOO_MACRO_9", - key.offset: 5659, + key.offset: 5664, key.length: 30, key.fully_annotated_decl: "var FOO_MACRO_9: Int32 { get }" }, @@ -6598,7 +6583,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_10", key.usr: "c:Foo.h@4161@macro@FOO_MACRO_10", - key.offset: 5690, + key.offset: 5695, key.length: 31, key.fully_annotated_decl: "var FOO_MACRO_10: Int16 { get }" }, @@ -6606,7 +6591,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_11", key.usr: "c:Foo.h@4195@macro@FOO_MACRO_11", - key.offset: 5722, + key.offset: 5727, key.length: 29, key.fully_annotated_decl: "var FOO_MACRO_11: Int { get }" }, @@ -6614,7 +6599,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_OR", key.usr: "c:Foo.h@4228@macro@FOO_MACRO_OR", - key.offset: 5752, + key.offset: 5757, key.length: 31, key.fully_annotated_decl: "var FOO_MACRO_OR: Int32 { get }" }, @@ -6622,7 +6607,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_AND", key.usr: "c:Foo.h@4277@macro@FOO_MACRO_AND", - key.offset: 5784, + key.offset: 5789, key.length: 32, key.fully_annotated_decl: "var FOO_MACRO_AND: Int32 { get }" }, @@ -6630,7 +6615,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_BITWIDTH", key.usr: "c:Foo.h@4327@macro@FOO_MACRO_BITWIDTH", - key.offset: 5817, + key.offset: 5822, key.length: 38, key.fully_annotated_decl: "var FOO_MACRO_BITWIDTH: UInt64 { get }" }, @@ -6638,7 +6623,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_SIGNED", key.usr: "c:Foo.h@4382@macro@FOO_MACRO_SIGNED", - key.offset: 5856, + key.offset: 5861, key.length: 36, key.fully_annotated_decl: "var FOO_MACRO_SIGNED: UInt32 { get }" }, @@ -6646,7 +6631,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_REDEF_1", key.usr: "c:Foo.h@4593@macro@FOO_MACRO_REDEF_1", - key.offset: 5893, + key.offset: 5898, key.length: 36, key.fully_annotated_decl: "var FOO_MACRO_REDEF_1: Int32 { get }" }, @@ -6654,7 +6639,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_MACRO_REDEF_2", key.usr: "c:Foo.h@4650@macro@FOO_MACRO_REDEF_2", - key.offset: 5930, + key.offset: 5935, key.length: 36, key.fully_annotated_decl: "var FOO_MACRO_REDEF_2: Int32 { get }" }, @@ -6662,7 +6647,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.free, key.name: "theLastDeclInFoo()", key.usr: "c:@F@theLastDeclInFoo", - key.offset: 5967, + key.offset: 5972, key.length: 23, key.fully_annotated_decl: "func theLastDeclInFoo()" }, @@ -6670,7 +6655,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.free, key.name: "_internalTopLevelFunc()", key.usr: "c:@F@_internalTopLevelFunc", - key.offset: 5991, + key.offset: 5996, key.length: 28, key.fully_annotated_decl: "func _internalTopLevelFunc()" }, @@ -6678,7 +6663,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.struct, key.name: "_InternalStruct", key.usr: "c:@S@_InternalStruct", - key.offset: 6020, + key.offset: 6025, key.length: 78, key.fully_annotated_decl: "struct _InternalStruct", key.entities: [ @@ -6686,7 +6671,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "x", key.usr: "c:@S@_InternalStruct@FI@x", - key.offset: 6050, + key.offset: 6055, key.length: 12, key.fully_annotated_decl: "var x: Int32" }, @@ -6694,7 +6679,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init()", key.usr: "s:So15_InternalStructVABycfc", - key.offset: 6068, + key.offset: 6073, key.length: 6, key.fully_annotated_decl: "init()" }, @@ -6702,7 +6687,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init(x:)", key.usr: "s:So15_InternalStructV1xABs5Int32V_tcfc", - key.offset: 6080, + key.offset: 6085, key.length: 16, key.fully_annotated_decl: "init(x: Int32)", key.entities: [ @@ -6710,7 +6695,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "x", key.name: "x", - key.offset: 6090, + key.offset: 6095, key.length: 5 } ] @@ -6719,8 +6704,9 @@ var FooSubUnnamedEnumeratorA1: Int { get } }, { key.kind: source.lang.swift.decl.extension.class, - key.offset: 6099, + key.offset: 6104, key.length: 61, + key.fully_annotated_decl: "extension FooClassBase", key.extends: { key.kind: source.lang.swift.ref.class, key.name: "FooClassBase", @@ -6731,7 +6717,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "_internalMeth1()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth1", - key.offset: 6129, + key.offset: 6134, key.length: 29, key.fully_annotated_decl: "func _internalMeth1() -> Any!" } @@ -6739,8 +6725,9 @@ var FooSubUnnamedEnumeratorA1: Int { get } }, { key.kind: source.lang.swift.decl.extension.class, - key.offset: 6161, + key.offset: 6166, key.length: 97, + key.fully_annotated_decl: "extension FooClassBase", key.extends: { key.kind: source.lang.swift.ref.class, key.name: "FooClassBase", @@ -6751,7 +6738,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "_internalMeth2()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth2", - key.offset: 6191, + key.offset: 6196, key.length: 29, key.fully_annotated_decl: "func _internalMeth2() -> Any!" }, @@ -6759,7 +6746,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "nonInternalMeth()", key.usr: "c:objc(cs)FooClassBase(im)nonInternalMeth", - key.offset: 6226, + key.offset: 6231, key.length: 30, key.fully_annotated_decl: "func nonInternalMeth() -> Any!" } @@ -6767,8 +6754,9 @@ var FooSubUnnamedEnumeratorA1: Int { get } }, { key.kind: source.lang.swift.decl.extension.class, - key.offset: 6259, + key.offset: 6264, key.length: 61, + key.fully_annotated_decl: "extension FooClassBase", key.extends: { key.kind: source.lang.swift.ref.class, key.name: "FooClassBase", @@ -6779,7 +6767,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "_internalMeth3()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth3", - key.offset: 6289, + key.offset: 6294, key.length: 29, key.fully_annotated_decl: "func _internalMeth3() -> Any!" } @@ -6789,7 +6777,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.protocol, key.name: "_InternalProt", key.usr: "c:objc(pl)_InternalProt", - key.offset: 6321, + key.offset: 6326, key.length: 26, key.fully_annotated_decl: "protocol _InternalProt" }, @@ -6797,7 +6785,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.class, key.name: "ClassWithInternalProt", key.usr: "c:objc(cs)ClassWithInternalProt", - key.offset: 6348, + key.offset: 6353, key.length: 47, key.fully_annotated_decl: "class ClassWithInternalProt : _InternalProt", key.conforms: [ @@ -6812,7 +6800,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.class, key.name: "FooClassPropertyOwnership", key.usr: "c:objc(cs)FooClassPropertyOwnership", - key.offset: 6396, + key.offset: 6401, key.length: 425, key.fully_annotated_decl: "class FooClassPropertyOwnership : FooClassBase", key.inherits: [ @@ -6827,7 +6815,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "assignable", key.usr: "c:objc(cs)FooClassPropertyOwnership(py)assignable", - key.offset: 6450, + key.offset: 6455, key.length: 42, key.fully_annotated_decl: "unowned(unsafe) var assignable: AnyObject! { get set }" }, @@ -6835,7 +6823,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "unsafeAssignable", key.usr: "c:objc(cs)FooClassPropertyOwnership(py)unsafeAssignable", - key.offset: 6498, + key.offset: 6503, key.length: 48, key.fully_annotated_decl: "unowned(unsafe) var unsafeAssignable: AnyObject! { get set }" }, @@ -6843,7 +6831,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "retainable", key.usr: "c:objc(cs)FooClassPropertyOwnership(py)retainable", - key.offset: 6552, + key.offset: 6557, key.length: 20, key.fully_annotated_decl: "var retainable: Any! { get set }" }, @@ -6851,7 +6839,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "strongRef", key.usr: "c:objc(cs)FooClassPropertyOwnership(py)strongRef", - key.offset: 6578, + key.offset: 6583, key.length: 19, key.fully_annotated_decl: "var strongRef: Any! { get set }" }, @@ -6859,7 +6847,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "copyable", key.usr: "c:objc(cs)FooClassPropertyOwnership(py)copyable", - key.offset: 6603, + key.offset: 6608, key.length: 18, key.fully_annotated_decl: "var copyable: Any! { get set }" }, @@ -6867,7 +6855,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "weakRef", key.usr: "c:objc(cs)FooClassPropertyOwnership(py)weakRef", - key.offset: 6627, + key.offset: 6632, key.length: 28, key.fully_annotated_decl: "weak var weakRef: AnyObject! { get set }" }, @@ -6875,7 +6863,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "scalar", key.usr: "c:objc(cs)FooClassPropertyOwnership(py)scalar", - key.offset: 6661, + key.offset: 6666, key.length: 17, key.fully_annotated_decl: "var scalar: Int32 { get set }" }, @@ -6884,7 +6872,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "_internalMeth1()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth1::SYNTHESIZED::c:objc(cs)FooClassPropertyOwnership", key.original_usr: "c:objc(cs)FooClassBase(im)_internalMeth1", - key.offset: 6684, + key.offset: 6689, key.length: 29, key.fully_annotated_decl: "func _internalMeth1() -> Any!" }, @@ -6893,7 +6881,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "_internalMeth2()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth2::SYNTHESIZED::c:objc(cs)FooClassPropertyOwnership", key.original_usr: "c:objc(cs)FooClassBase(im)_internalMeth2", - key.offset: 6719, + key.offset: 6724, key.length: 29, key.fully_annotated_decl: "func _internalMeth2() -> Any!" }, @@ -6902,7 +6890,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "nonInternalMeth()", key.usr: "c:objc(cs)FooClassBase(im)nonInternalMeth::SYNTHESIZED::c:objc(cs)FooClassPropertyOwnership", key.original_usr: "c:objc(cs)FooClassBase(im)nonInternalMeth", - key.offset: 6754, + key.offset: 6759, key.length: 30, key.fully_annotated_decl: "func nonInternalMeth() -> Any!" }, @@ -6911,7 +6899,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "_internalMeth3()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth3::SYNTHESIZED::c:objc(cs)FooClassPropertyOwnership", key.original_usr: "c:objc(cs)FooClassBase(im)_internalMeth3", - key.offset: 6790, + key.offset: 6795, key.length: 29, key.fully_annotated_decl: "func _internalMeth3() -> Any!" } @@ -6921,7 +6909,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FOO_NIL", key.usr: "c:Foo.h@5439@macro@FOO_NIL", - key.offset: 6822, + key.offset: 6827, key.length: 15, key.fully_annotated_decl: "var FOO_NIL: ()", key.attributes: [ @@ -6937,7 +6925,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.class, key.name: "FooUnavailableMembers", key.usr: "c:objc(cs)FooUnavailableMembers", - key.offset: 6838, + key.offset: 6843, key.length: 592, key.fully_annotated_decl: "class FooUnavailableMembers : FooClassBase", key.inherits: [ @@ -6952,7 +6940,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init(int:)", key.usr: "c:objc(cs)FooUnavailableMembers(cm)unavailableMembersWithInt:", - key.offset: 6888, + key.offset: 6893, key.length: 31, key.fully_annotated_decl: "convenience init!(int i: Int32)", key.entities: [ @@ -6960,7 +6948,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "int", key.name: "i", - key.offset: 6913, + key.offset: 6918, key.length: 5 } ] @@ -6969,7 +6957,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "unavailable()", key.usr: "c:objc(cs)FooUnavailableMembers(im)unavailable", - key.offset: 6925, + key.offset: 6930, key.length: 18, key.fully_annotated_decl: "func unavailable()", key.attributes: [ @@ -6985,7 +6973,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "swiftUnavailable()", key.usr: "c:objc(cs)FooUnavailableMembers(im)swiftUnavailable", - key.offset: 6949, + key.offset: 6954, key.length: 23, key.fully_annotated_decl: "func swiftUnavailable()", key.attributes: [ @@ -7000,7 +6988,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "deprecated()", key.usr: "c:objc(cs)FooUnavailableMembers(im)deprecated", - key.offset: 6978, + key.offset: 6983, key.length: 17, key.fully_annotated_decl: "func deprecated()", key.attributes: [ @@ -7016,7 +7004,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "availabilityIntroduced()", key.usr: "c:objc(cs)FooUnavailableMembers(im)availabilityIntroduced", - key.offset: 7001, + key.offset: 7006, key.length: 29, key.fully_annotated_decl: "func availabilityIntroduced()", key.attributes: [ @@ -7031,7 +7019,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "availabilityDeprecated()", key.usr: "c:objc(cs)FooUnavailableMembers(im)availabilityDeprecated", - key.offset: 7036, + key.offset: 7041, key.length: 29, key.fully_annotated_decl: "func availabilityDeprecated()", key.attributes: [ @@ -7050,7 +7038,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "availabilityObsoleted()", key.usr: "c:objc(cs)FooUnavailableMembers(im)availabilityObsoleted", - key.offset: 7071, + key.offset: 7076, key.length: 28, key.fully_annotated_decl: "func availabilityObsoleted()", key.attributes: [ @@ -7066,7 +7054,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "availabilityUnavailable()", key.usr: "c:objc(cs)FooUnavailableMembers(im)availabilityUnavailable", - key.offset: 7105, + key.offset: 7110, key.length: 30, key.fully_annotated_decl: "func availabilityUnavailable()", key.attributes: [ @@ -7082,7 +7070,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "availabilityIntroducedMsg()", key.usr: "c:objc(cs)FooUnavailableMembers(im)availabilityIntroducedMsg", - key.offset: 7141, + key.offset: 7146, key.length: 32, key.fully_annotated_decl: "func availabilityIntroducedMsg()", key.attributes: [ @@ -7098,7 +7086,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "availabilityDeprecatedMsg()", key.usr: "c:objc(cs)FooUnavailableMembers(im)availabilityDeprecatedMsg", - key.offset: 7179, + key.offset: 7184, key.length: 32, key.fully_annotated_decl: "func availabilityDeprecatedMsg()", key.attributes: [ @@ -7117,7 +7105,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "availabilityObsoletedMsg()", key.usr: "c:objc(cs)FooUnavailableMembers(im)availabilityObsoletedMsg", - key.offset: 7217, + key.offset: 7222, key.length: 31, key.fully_annotated_decl: "func availabilityObsoletedMsg()", key.attributes: [ @@ -7134,7 +7122,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.method.instance, key.name: "availabilityUnavailableMsg()", key.usr: "c:objc(cs)FooUnavailableMembers(im)availabilityUnavailableMsg", - key.offset: 7254, + key.offset: 7259, key.length: 33, key.fully_annotated_decl: "func availabilityUnavailableMsg()", key.attributes: [ @@ -7152,7 +7140,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "_internalMeth1()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth1::SYNTHESIZED::c:objc(cs)FooUnavailableMembers", key.original_usr: "c:objc(cs)FooClassBase(im)_internalMeth1", - key.offset: 7293, + key.offset: 7298, key.length: 29, key.fully_annotated_decl: "func _internalMeth1() -> Any!" }, @@ -7161,7 +7149,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "_internalMeth2()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth2::SYNTHESIZED::c:objc(cs)FooUnavailableMembers", key.original_usr: "c:objc(cs)FooClassBase(im)_internalMeth2", - key.offset: 7328, + key.offset: 7333, key.length: 29, key.fully_annotated_decl: "func _internalMeth2() -> Any!" }, @@ -7170,7 +7158,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "nonInternalMeth()", key.usr: "c:objc(cs)FooClassBase(im)nonInternalMeth::SYNTHESIZED::c:objc(cs)FooUnavailableMembers", key.original_usr: "c:objc(cs)FooClassBase(im)nonInternalMeth", - key.offset: 7363, + key.offset: 7368, key.length: 30, key.fully_annotated_decl: "func nonInternalMeth() -> Any!" }, @@ -7179,7 +7167,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "_internalMeth3()", key.usr: "c:objc(cs)FooClassBase(im)_internalMeth3::SYNTHESIZED::c:objc(cs)FooUnavailableMembers", key.original_usr: "c:objc(cs)FooClassBase(im)_internalMeth3", - key.offset: 7399, + key.offset: 7404, key.length: 29, key.fully_annotated_decl: "func _internalMeth3() -> Any!" } @@ -7189,7 +7177,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.class, key.name: "FooCFType", key.usr: "c:Foo.h@T@FooCFTypeRef", - key.offset: 7431, + key.offset: 7436, key.length: 19, key.fully_annotated_decl: "class FooCFType" }, @@ -7197,14 +7185,14 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.free, key.name: "FooCFTypeRelease(_:)", key.usr: "c:@F@FooCFTypeRelease", - key.offset: 7451, + key.offset: 7456, key.length: 38, key.fully_annotated_decl: "func FooCFTypeRelease(_: FooCFType!)", key.entities: [ { key.kind: source.lang.swift.decl.var.local, key.keyword: "_", - key.offset: 7478, + key.offset: 7483, key.length: 10 } ], @@ -7221,7 +7209,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.enum, key.name: "ABAuthorizationStatus", key.usr: "c:@E@ABAuthorizationStatus", - key.offset: 7490, + key.offset: 7495, key.length: 274, key.fully_annotated_decl: "enum ABAuthorizationStatus : Int", key.inherits: [ @@ -7236,7 +7224,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.enumelement, key.name: "notDetermined", key.usr: "c:@E@ABAuthorizationStatus@kABAuthorizationStatusNotDetermined", - key.offset: 7530, + key.offset: 7535, key.length: 22, key.fully_annotated_decl: "case notDetermined = 0", key.attributes: [ @@ -7251,7 +7239,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.enumelement, key.name: "restricted", key.usr: "c:@E@ABAuthorizationStatus@kABAuthorizationStatusRestricted", - key.offset: 7558, + key.offset: 7563, key.length: 19, key.fully_annotated_decl: "case restricted = 1", key.attributes: [ @@ -7267,7 +7255,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "hashValue", key.usr: "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::c:@E@ABAuthorizationStatus", key.original_usr: "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp", - key.offset: 7583, + key.offset: 7588, key.length: 37, key.fully_annotated_decl: "@inlinable var hashValue: Int { get }" }, @@ -7276,7 +7264,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "hash(into:)", key.usr: "s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::c:@E@ABAuthorizationStatus", key.original_usr: "s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF", - key.offset: 7626, + key.offset: 7631, key.length: 47, key.fully_annotated_decl: "@inlinable func hash(into hasher: inout Hasher)", key.entities: [ @@ -7284,7 +7272,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "into", key.name: "hasher", - key.offset: 7666, + key.offset: 7671, key.length: 6 } ] @@ -7294,7 +7282,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "!=(_:_:)", key.usr: "s:SQsE2neoiySbx_xtFZ::SYNTHESIZED::c:@E@ABAuthorizationStatus", key.original_usr: "s:SQsE2neoiySbx_xtFZ", - key.offset: 7679, + key.offset: 7684, key.length: 83, key.fully_annotated_decl: "static func != (lhs: ABAuthorizationStatus, rhs: ABAuthorizationStatus) -> Bool", key.entities: [ @@ -7302,14 +7290,14 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "lhs", - key.offset: 7702, + key.offset: 7707, key.length: 21 }, { key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "rhs", - key.offset: 7732, + key.offset: 7737, key.length: 21 } ] @@ -7328,7 +7316,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.free, key.name: "fooSubFunc1(_:)", key.usr: "c:@F@fooSubFunc1", - key.offset: 7765, + key.offset: 7770, key.length: 37, key.fully_annotated_decl: "func fooSubFunc1(_ a: Int32) -> Int32", key.entities: [ @@ -7336,7 +7324,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "a", - key.offset: 7787, + key.offset: 7792, key.length: 5 } ], @@ -7346,7 +7334,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.struct, key.name: "FooSubEnum1", key.usr: "c:@E@FooSubEnum1", - key.offset: 7803, + key.offset: 7808, key.length: 214, key.fully_annotated_decl: "struct FooSubEnum1 : Equatable, RawRepresentable", key.conforms: [ @@ -7366,7 +7354,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init(_:)", key.usr: "s:So11FooSubEnum1VyABs6UInt32Vcfc", - key.offset: 7859, + key.offset: 7864, key.length: 24, key.fully_annotated_decl: "init(_ rawValue: UInt32)", key.entities: [ @@ -7374,7 +7362,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "rawValue", - key.offset: 7876, + key.offset: 7881, key.length: 6 } ] @@ -7383,7 +7371,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.function.constructor, key.name: "init(rawValue:)", key.usr: "s:So11FooSubEnum1V8rawValueABs6UInt32V_tcfc", - key.offset: 7889, + key.offset: 7894, key.length: 31, key.fully_annotated_decl: "init(rawValue: UInt32)", key.entities: [ @@ -7391,7 +7379,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "rawValue", key.name: "rawValue", - key.offset: 7913, + key.offset: 7918, key.length: 6 } ] @@ -7400,7 +7388,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.instance, key.name: "rawValue", key.usr: "s:So11FooSubEnum1V8rawValues6UInt32Vvp", - key.offset: 7926, + key.offset: 7931, key.length: 20, key.fully_annotated_decl: "var rawValue: UInt32" }, @@ -7409,7 +7397,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.name: "!=(_:_:)", key.usr: "s:SQsE2neoiySbx_xtFZ::SYNTHESIZED::c:@E@FooSubEnum1", key.original_usr: "s:SQsE2neoiySbx_xtFZ", - key.offset: 7952, + key.offset: 7957, key.length: 63, key.fully_annotated_decl: "static func != (lhs: FooSubEnum1, rhs: FooSubEnum1) -> Bool", key.entities: [ @@ -7417,14 +7405,14 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "lhs", - key.offset: 7975, + key.offset: 7980, key.length: 11 }, { key.kind: source.lang.swift.decl.var.local, key.keyword: "_", key.name: "rhs", - key.offset: 7995, + key.offset: 8000, key.length: 11 } ] @@ -7436,7 +7424,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FooSubEnum1X", key.usr: "c:@E@FooSubEnum1@FooSubEnum1X", - key.offset: 8018, + key.offset: 8023, key.length: 37, key.fully_annotated_decl: "var FooSubEnum1X: FooSubEnum1 { get }", key.modulename: "Foo.FooSub" @@ -7445,7 +7433,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FooSubEnum1Y", key.usr: "c:@E@FooSubEnum1@FooSubEnum1Y", - key.offset: 8056, + key.offset: 8061, key.length: 37, key.fully_annotated_decl: "var FooSubEnum1Y: FooSubEnum1 { get }", key.modulename: "Foo.FooSub" @@ -7454,7 +7442,7 @@ var FooSubUnnamedEnumeratorA1: Int { get } key.kind: source.lang.swift.decl.var.global, key.name: "FooSubUnnamedEnumeratorA1", key.usr: "c:@Ea@FooSubUnnamedEnumeratorA1@FooSubUnnamedEnumeratorA1", - key.offset: 8094, + key.offset: 8099, key.length: 42, key.fully_annotated_decl: "var FooSubUnnamedEnumeratorA1: Int { get }", key.modulename: "Foo.FooSub" diff --git a/test/SourceKit/DocSupport/doc_source_file.swift.response b/test/SourceKit/DocSupport/doc_source_file.swift.response index 59e8f3a02ed77..145cd58017620 100644 --- a/test/SourceKit/DocSupport/doc_source_file.swift.response +++ b/test/SourceKit/DocSupport/doc_source_file.swift.response @@ -1960,6 +1960,7 @@ key.kind: source.lang.swift.decl.extension.class, key.offset: 649, key.length: 112, + key.fully_annotated_decl: "extension CC : Prot", key.conforms: [ { key.kind: source.lang.swift.ref.protocol, diff --git a/test/SourceKit/DocSupport/doc_swift_module.swift.response b/test/SourceKit/DocSupport/doc_swift_module.swift.response index 7e67bda8e3a59..c35a607481291 100644 --- a/test/SourceKit/DocSupport/doc_swift_module.swift.response +++ b/test/SourceKit/DocSupport/doc_swift_module.swift.response @@ -190,7 +190,7 @@ struct S3 : cake.P5 where Wrapped : cake.P5 { typealias Element = Wrapped.Element } -extension S3 { +extension S3 where Wrapped : P6 { var null: Wrapped.Element? { get } } @@ -1792,158 +1792,175 @@ func shouldPrintAnyAsKeyword(x x: Any) }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2280, + key.offset: 2273, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 2279, + key.length: 7 + }, + { + key.kind: source.lang.swift.ref.protocol, + key.name: "P6", + key.usr: "s:4cake2P6P", + key.offset: 2289, + key.length: 2 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 2299, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2284, + key.offset: 2303, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 2290, + key.offset: 2309, key.length: 7 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 2298, + key.offset: 2317, key.length: 7 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2309, + key.offset: 2328, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2318, + key.offset: 2337, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2323, + key.offset: 2342, key.length: 6 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2330, + key.offset: 2349, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2334, + key.offset: 2353, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2338, + key.offset: 2357, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2340, + key.offset: 2359, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 2344, + key.offset: 2363, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2348, + key.offset: 2367, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2350, + key.offset: 2369, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 2354, + key.offset: 2373, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2358, + key.offset: 2377, key.length: 5 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 2364, + key.offset: 2383, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 2369, + key.offset: 2388, key.length: 4 }, { key.kind: source.lang.swift.ref.protocol, key.name: "Prot", key.usr: "s:4cake4ProtP", - key.offset: 2374, + key.offset: 2393, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 2380, + key.offset: 2399, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 2385, + key.offset: 2404, key.length: 4 }, { key.kind: source.lang.swift.ref.class, key.name: "C1", key.usr: "s:4cake2C1C", - key.offset: 2390, + key.offset: 2409, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 2394, + key.offset: 2413, key.length: 2 }, { key.kind: source.lang.swift.syntaxtype.typeidentifier, - key.offset: 2397, + key.offset: 2416, key.length: 7 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.offset: 2408, + key.offset: 2427, key.length: 3 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2413, + key.offset: 2432, key.length: 4 }, { key.kind: source.lang.swift.syntaxtype.identifier, - key.offset: 2418, + key.offset: 2437, key.length: 23 }, { key.kind: source.lang.swift.syntaxtype.argument, - key.offset: 2442, + key.offset: 2461, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.parameter, - key.offset: 2444, + key.offset: 2463, key.length: 1 }, { key.kind: source.lang.swift.syntaxtype.keyword, - key.offset: 2447, + key.offset: 2466, key.length: 3 } ] @@ -2172,6 +2189,7 @@ func shouldPrintAnyAsKeyword(x x: Any) key.doc.full_as_xml: "@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)\nextension C1some comments", key.offset: 473, key.length: 37, + key.fully_annotated_decl: "extension C1", key.extends: { key.kind: source.lang.swift.ref.class, key.name: "C1", @@ -2214,6 +2232,7 @@ func shouldPrintAnyAsKeyword(x x: Any) key.kind: source.lang.swift.decl.extension.class, key.offset: 512, key.length: 105, + key.fully_annotated_decl: "extension C1 : P4", key.conforms: [ { key.kind: source.lang.swift.ref.protocol, @@ -2266,17 +2285,9 @@ func shouldPrintAnyAsKeyword(x x: Any) }, { key.kind: source.lang.swift.decl.extension.enum, - key.generic_requirements: [ - { - key.description: "Self : Hashable" - }, - { - key.description: "Self.RawValue : Hashable" - } - ], key.offset: 619, key.length: 187, - key.fully_annotated_generic_signature: "<Self where Self : Hashable, Self : RawRepresentable, Self.RawValue : Hashable>", + key.fully_annotated_decl: "extension C1.C1Cases", key.extends: { key.kind: source.lang.swift.ref.enum, key.name: "C1Cases", @@ -2429,6 +2440,7 @@ func shouldPrintAnyAsKeyword(x x: Any) key.doc.full_as_xml: "@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)\nextension C2some comments", key.offset: 982, key.length: 37, + key.fully_annotated_decl: "extension C2", key.extends: { key.kind: source.lang.swift.ref.class, key.name: "C2", @@ -2472,6 +2484,7 @@ func shouldPrintAnyAsKeyword(x x: Any) key.kind: source.lang.swift.decl.extension.class, key.offset: 1021, key.length: 95, + key.fully_annotated_decl: "extension C2 : P4", key.conforms: [ { key.kind: source.lang.swift.ref.protocol, @@ -2623,7 +2636,7 @@ func shouldPrintAnyAsKeyword(x x: Any) key.kind: source.lang.swift.decl.extension.protocol, key.offset: 1343, key.length: 54, - key.fully_annotated_generic_signature: "<Self where Self : P>", + key.fully_annotated_decl: "extension P", key.extends: { key.kind: source.lang.swift.ref.protocol, key.name: "P", @@ -2727,7 +2740,7 @@ func shouldPrintAnyAsKeyword(x x: Any) key.kind: source.lang.swift.decl.extension.protocol, key.offset: 1582, key.length: 53, - key.fully_annotated_generic_signature: "<Self where Self : P6>", + key.fully_annotated_decl: "extension P6", key.extends: { key.kind: source.lang.swift.ref.protocol, key.name: "P6", @@ -2790,7 +2803,7 @@ func shouldPrintAnyAsKeyword(x x: Any) key.kind: source.lang.swift.decl.extension.protocol, key.offset: 1741, key.length: 79, - key.fully_annotated_generic_signature: "<Self where Self : Prot>", + key.fully_annotated_decl: "extension Prot", key.extends: { key.kind: source.lang.swift.ref.protocol, key.name: "Prot", @@ -2834,7 +2847,7 @@ func shouldPrintAnyAsKeyword(x x: Any) ], key.offset: 1822, key.length: 63, - key.fully_annotated_generic_signature: "<Self where Self : Prot, Self.Element == Int>", + key.fully_annotated_decl: "extension Prot where Self.Element == Int", key.extends: { key.kind: source.lang.swift.ref.protocol, key.name: "Prot", @@ -2925,7 +2938,7 @@ func shouldPrintAnyAsKeyword(x x: Any) key.kind: source.lang.swift.decl.extension.enum, key.offset: 2031, key.length: 76, - key.fully_annotated_generic_signature: "<Self where Self : Equatable>", + key.fully_annotated_decl: "extension S1.SE", key.extends: { key.kind: source.lang.swift.ref.enum, key.name: "SE", @@ -3035,9 +3048,14 @@ func shouldPrintAnyAsKeyword(x x: Any) }, { key.kind: source.lang.swift.decl.extension.struct, + key.generic_requirements: [ + { + key.description: "Wrapped : P6" + } + ], key.offset: 2260, - key.length: 56, - key.fully_annotated_generic_signature: "<Self where Self : P6>", + key.length: 75, + key.fully_annotated_decl: "extension S3 where Wrapped : P6", key.extends: { key.kind: source.lang.swift.ref.struct, key.name: "S3", @@ -3049,7 +3067,7 @@ func shouldPrintAnyAsKeyword(x x: Any) key.name: "null", key.usr: "s:4cake2P6PAAE4null7ElementQzSgvp::SYNTHESIZED::s:4cake2S3V", key.original_usr: "s:4cake2P6PAAE4null7ElementQzSgvp", - key.offset: 2280, + key.offset: 2299, key.length: 34, key.fully_annotated_decl: "var null: Wrapped.Element? { get }" } @@ -3078,7 +3096,7 @@ func shouldPrintAnyAsKeyword(x x: Any) key.description: "T1.Element == Int" } ], - key.offset: 2318, + key.offset: 2337, key.length: 93, key.fully_annotated_decl: "func genfoo<T1, T2>(x ix: T1, y iy: T2) where T1 : Prot, T2 : C1, T1.Element == Int", key.entities: [ @@ -3086,14 +3104,14 @@ func shouldPrintAnyAsKeyword(x x: Any) key.kind: source.lang.swift.decl.var.local, key.keyword: "x", key.name: "ix", - key.offset: 2344, + key.offset: 2363, key.length: 2 }, { key.kind: source.lang.swift.decl.var.local, key.keyword: "y", key.name: "iy", - key.offset: 2354, + key.offset: 2373, key.length: 2 } ] @@ -3102,7 +3120,7 @@ func shouldPrintAnyAsKeyword(x x: Any) key.kind: source.lang.swift.decl.function.free, key.name: "shouldPrintAnyAsKeyword(x:)", key.usr: "s:4cake23shouldPrintAnyAsKeyword1xyyp_tF", - key.offset: 2413, + key.offset: 2432, key.length: 38, key.fully_annotated_decl: "func shouldPrintAnyAsKeyword(x: Any)", key.entities: [ @@ -3110,7 +3128,7 @@ func shouldPrintAnyAsKeyword(x x: Any) key.kind: source.lang.swift.decl.var.local, key.keyword: "x", key.name: "x", - key.offset: 2447, + key.offset: 2466, key.length: 3 } ] diff --git a/test/SourceKit/DocSupport/doc_swift_module1.swift.response b/test/SourceKit/DocSupport/doc_swift_module1.swift.response index 1c310d0e35a8b..9b28e4596672a 100644 --- a/test/SourceKit/DocSupport/doc_swift_module1.swift.response +++ b/test/SourceKit/DocSupport/doc_swift_module1.swift.response @@ -767,7 +767,7 @@ extension Dictionary.Keys where Key : cake1.P1 { key.kind: source.lang.swift.decl.extension.protocol, key.offset: 166, key.length: 35, - key.fully_annotated_generic_signature: "<Self where Self : InitProto>", + key.fully_annotated_decl: "extension InitProto", key.extends: { key.kind: source.lang.swift.ref.protocol, key.name: "InitProto", @@ -946,7 +946,7 @@ extension Dictionary.Keys where Key : cake1.P1 { key.kind: source.lang.swift.decl.extension.protocol, key.offset: 511, key.length: 118, - key.fully_annotated_generic_signature: "<Self where Self : P2>", + key.fully_annotated_decl: "extension P2", key.extends: { key.kind: source.lang.swift.ref.protocol, key.name: "P2", @@ -1025,7 +1025,7 @@ extension Dictionary.Keys where Key : cake1.P1 { ], key.offset: 631, key.length: 64, - key.fully_annotated_generic_signature: "<Self where Self : P2, Self : P3>", + key.fully_annotated_decl: "extension P2 where Self : P3", key.extends: { key.kind: source.lang.swift.ref.protocol, key.name: "P2", @@ -1078,7 +1078,7 @@ extension Dictionary.Keys where Key : cake1.P1 { ], key.offset: 737, key.length: 45, - key.fully_annotated_generic_signature: "<Key, Value where Key : Hashable>", + key.fully_annotated_decl: "extension Dictionary.Keys", key.extends: { key.kind: source.lang.swift.ref.struct, key.name: "Keys", @@ -1107,7 +1107,7 @@ extension Dictionary.Keys where Key : cake1.P1 { ], key.offset: 784, key.length: 66, - key.fully_annotated_generic_signature: "<Key, Value where Key : Hashable, Key : P1>", + key.fully_annotated_decl: "extension Dictionary.Keys where Key : P1", key.extends: { key.kind: source.lang.swift.ref.struct, key.name: "Keys", diff --git a/test/SourceKit/DocSupport/doc_system_module_underscored.swift b/test/SourceKit/DocSupport/doc_system_module_underscored.swift new file mode 100644 index 0000000000000..66c5264820b75 --- /dev/null +++ b/test/SourceKit/DocSupport/doc_system_module_underscored.swift @@ -0,0 +1,8 @@ + +// RUN: %empty-directory(%t) +// RUN: %empty-directory(%t/mcp) +// RUN: %empty-directory(%t/UnderscoredProto.framework/Modules/UnderscoredProto.swiftmodule) +// RUN: cp %S/../Inputs/UnderscoredProto.swiftinterface %t/UnderscoredProto.framework/Modules/UnderscoredProto.swiftmodule/%module-target-triple.swiftinterface + +// RUN: %sourcekitd-test -req=doc-info -synthesized-extension -module UnderscoredProto -- -target %target-triple -Fsystem %t -module-cache-path %t/mcp > %t.response +// RUN: %diff -u %s.response %t.response diff --git a/test/SourceKit/DocSupport/doc_system_module_underscored.swift.response b/test/SourceKit/DocSupport/doc_system_module_underscored.swift.response new file mode 100644 index 0000000000000..9a6cc0b30316d --- /dev/null +++ b/test/SourceKit/DocSupport/doc_system_module_underscored.swift.response @@ -0,0 +1,1763 @@ +import SwiftOnoneSupport + +struct A { + + func fromA(takesT takesT: T) + + func fromAExtension(takesT takesT: T) + + func fromProtoExtension() +} + +extension A { + + func fromDeprecatedProtoExtension() +} + +extension A where T == String { + + typealias Elem = Int + + func fromAConditionalExtension(takesTIfString takesTIfString: T) + + func fromProto2Extension(takesElem takesElem: Int) +} + +extension A { + + func fromDeprecatedConditionalProto2Extension(takesElemInt takesElemInt: Int) +} + +class B { + + func fromB(takesT takesT: T) + + typealias Elem = String + + func fromProtoExtension() + + func fromProto2Extension(takesElem takesElem: String) + + func fromConditionalProto2Extension(takesElemIfString takesElemIfString: String) +} + +extension B { + + func fromDeprecatedProtoExtension() +} + +class C : B where U : Equatable { + + func fromC(takesUIfEquatable takesUIfEquatable: U) + + typealias Elem1 = V + + typealias Elem2 = U + + func fromCConditionlExtension(takesU takesU: U) + + typealias Elem = String + + func fromProtoExtension() + + func fromProto2Extension(takesElem takesElem: String) + + func fromConditionalProto2Extension(takesElemIfString takesElemIfString: String) + + func fromProto4Extension(takesElem2IfEquatable takesElem2IfEquatable: U) + + func fromProto3Extension(takesElem1 takesElem1: V) + + func fromProto3Extension(takesElem2 takesElem2: U) +} + +extension C { + + func fromDeprecatedProtoExtension() +} + +extension C where U : Hashable { + + func fromProto4Extension(takesElem2IfHashable takesElem2IfHashable: U) +} + +struct D { + + func fromD(takesT takesT: T, takesU takesU: U) +} + +extension D where T : Equatable { + + typealias Item = T +} + +extension D where T : Other1, T : Equatable { + + func fromSomeProtoExtensionSplitConditions(takesItemIfOther1 takesItemIfOther1: T) +} + +protocol Other1 { +} + + +[ + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 0, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 7, + key.length: 17 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 26, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 33, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 35, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 45, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 50, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 56, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 63, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 71, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 79, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 84, + key.length: 14 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 99, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 106, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 114, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 122, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 127, + key.length: 18 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 151, + key.length: 9 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "A", + key.usr: "s:16UnderscoredProto1AV", + key.offset: 161, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 170, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 175, + key.length: 28 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 209, + key.length: 9 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "A", + key.usr: "s:16UnderscoredProto1AV", + key.offset: 219, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 221, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 227, + key.length: 1 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "String", + key.usr: "s:SS", + key.offset: 232, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 246, + key.length: 9 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 256, + key.length: 4 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.offset: 263, + key.length: 3 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 272, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 277, + key.length: 25 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 303, + key.length: 14 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 318, + key.length: 14 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 334, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 342, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 347, + key.length: 19 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 367, + key.length: 9 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 377, + key.length: 9 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.offset: 388, + key.length: 3 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 396, + key.length: 9 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "A", + key.usr: "s:16UnderscoredProto1AV", + key.offset: 406, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 415, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 420, + key.length: 40 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 461, + key.length: 12 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 474, + key.length: 12 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.offset: 488, + key.length: 3 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 496, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 502, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 504, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 514, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 519, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 525, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 532, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 540, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 548, + key.length: 9 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 558, + key.length: 4 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "String", + key.usr: "s:SS", + key.offset: 565, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 577, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 582, + key.length: 18 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 608, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 613, + key.length: 19 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 633, + key.length: 9 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 643, + key.length: 9 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "String", + key.usr: "s:SS", + key.offset: 654, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 667, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 672, + key.length: 30 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 703, + key.length: 17 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 721, + key.length: 17 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "String", + key.usr: "s:SS", + key.offset: 740, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 751, + key.length: 9 + }, + { + key.kind: source.lang.swift.ref.class, + key.name: "B", + key.usr: "s:16UnderscoredProto1BC", + key.offset: 761, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 770, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 775, + key.length: 28 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 809, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 815, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 817, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 820, + key.length: 1 + }, + { + key.kind: source.lang.swift.ref.class, + key.name: "B", + key.usr: "s:16UnderscoredProto1BC", + key.offset: 825, + key.length: 1 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "String", + key.usr: "s:SS", + key.offset: 827, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 835, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 841, + key.length: 1 + }, + { + key.kind: source.lang.swift.ref.protocol, + key.name: "Equatable", + key.usr: "s:SQ", + key.offset: 845, + key.length: 9 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 862, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 867, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 873, + key.length: 17 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 891, + key.length: 17 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 910, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 918, + key.length: 9 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 928, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 936, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 943, + key.length: 9 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 953, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 961, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 968, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 973, + key.length: 24 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 998, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 1005, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1013, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1021, + key.length: 9 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1031, + key.length: 4 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "String", + key.usr: "s:SS", + key.offset: 1038, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1050, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1055, + key.length: 18 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1081, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1086, + key.length: 19 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 1106, + key.length: 9 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 1116, + key.length: 9 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "String", + key.usr: "s:SS", + key.offset: 1127, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1140, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1145, + key.length: 30 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 1176, + key.length: 17 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 1194, + key.length: 17 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "String", + key.usr: "s:SS", + key.offset: 1213, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1226, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1231, + key.length: 19 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 1251, + key.length: 21 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 1273, + key.length: 21 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1296, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1304, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1309, + key.length: 19 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 1329, + key.length: 10 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 1340, + key.length: 10 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1352, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1360, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1365, + key.length: 19 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 1385, + key.length: 10 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 1396, + key.length: 10 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1408, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1414, + key.length: 9 + }, + { + key.kind: source.lang.swift.ref.class, + key.name: "C", + key.usr: "s:16UnderscoredProto1CC", + key.offset: 1424, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1433, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1438, + key.length: 28 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1472, + key.length: 9 + }, + { + key.kind: source.lang.swift.ref.class, + key.name: "C", + key.usr: "s:16UnderscoredProto1CC", + key.offset: 1482, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1484, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1490, + key.length: 1 + }, + { + key.kind: source.lang.swift.ref.protocol, + key.name: "Hashable", + key.usr: "s:SH", + key.offset: 1494, + key.length: 8 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1510, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1515, + key.length: 19 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 1535, + key.length: 20 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 1556, + key.length: 20 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1578, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1584, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1591, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1593, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1596, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1606, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1611, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 1617, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 1624, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1632, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 1635, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 1642, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1650, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1656, + key.length: 9 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "D", + key.usr: "s:16UnderscoredProto1DV", + key.offset: 1666, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1668, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1674, + key.length: 1 + }, + { + key.kind: source.lang.swift.ref.protocol, + key.name: "Equatable", + key.usr: "s:SQ", + key.offset: 1678, + key.length: 9 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1695, + key.length: 9 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1705, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1712, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1717, + key.length: 9 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "D", + key.usr: "s:16UnderscoredProto1DV", + key.offset: 1727, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1729, + key.length: 5 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1735, + key.length: 1 + }, + { + key.kind: source.lang.swift.ref.protocol, + key.name: "Other1", + key.usr: "s:16UnderscoredProto6Other1P", + key.offset: 1739, + key.length: 6 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1747, + key.length: 1 + }, + { + key.kind: source.lang.swift.ref.protocol, + key.name: "Equatable", + key.usr: "s:SQ", + key.offset: 1751, + key.length: 9 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1768, + key.length: 4 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1773, + key.length: 37 + }, + { + key.kind: source.lang.swift.syntaxtype.argument, + key.offset: 1811, + key.length: 17 + }, + { + key.kind: source.lang.swift.syntaxtype.parameter, + key.offset: 1829, + key.length: 17 + }, + { + key.kind: source.lang.swift.syntaxtype.typeidentifier, + key.offset: 1848, + key.length: 1 + }, + { + key.kind: source.lang.swift.syntaxtype.keyword, + key.offset: 1854, + key.length: 8 + }, + { + key.kind: source.lang.swift.syntaxtype.identifier, + key.offset: 1863, + key.length: 6 + } +] +[ + { + key.kind: source.lang.swift.decl.struct, + key.name: "A", + key.usr: "s:16UnderscoredProto1AV", + key.generic_params: [ + { + key.name: "T" + } + ], + key.offset: 26, + key.length: 123, + key.fully_annotated_decl: "struct A<T>", + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromA(takesT:)", + key.usr: "s:16UnderscoredProto1AV5fromA6takesTyx_tF", + key.offset: 45, + key.length: 28, + key.fully_annotated_decl: "func fromA(takesT: T)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesT", + key.name: "takesT", + key.offset: 71, + key.length: 1 + } + ] + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromAExtension(takesT:)", + key.usr: "s:16UnderscoredProto1AV14fromAExtension6takesTyx_tF", + key.offset: 79, + key.length: 37, + key.fully_annotated_decl: "func fromAExtension(takesT: T)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesT", + key.name: "takesT", + key.offset: 114, + key.length: 1 + } + ] + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromProtoExtension()", + key.usr: "s:16UnderscoredProto01_aB0PAAE04fromB9ExtensionyyF::SYNTHESIZED::s:16UnderscoredProto1AV", + key.original_usr: "s:16UnderscoredProto01_aB0PAAE04fromB9ExtensionyyF", + key.offset: 122, + key.length: 25, + key.fully_annotated_decl: "func fromProtoExtension()" + } + ] + }, + { + key.kind: source.lang.swift.decl.extension.struct, + key.offset: 151, + key.length: 56, + key.fully_annotated_decl: "extension A", + key.extends: { + key.kind: source.lang.swift.ref.struct, + key.name: "A", + key.usr: "s:16UnderscoredProto1AV" + }, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromDeprecatedProtoExtension()", + key.usr: "s:16UnderscoredProto01_aB0PAAE014fromDeprecatedB9ExtensionyyF::SYNTHESIZED::s:16UnderscoredProto1AV", + key.original_usr: "s:16UnderscoredProto01_aB0PAAE014fromDeprecatedB9ExtensionyyF", + key.offset: 170, + key.length: 35, + key.fully_annotated_decl: "func fromDeprecatedProtoExtension()" + } + ], + key.attributes: [ + { + key.kind: source.lang.swift.attribute.availability, + key.is_deprecated: 1 + } + ], + key.is_deprecated: 1 + }, + { + key.kind: source.lang.swift.decl.extension.struct, + key.generic_requirements: [ + { + key.description: "T == String" + } + ], + key.offset: 209, + key.length: 185, + key.fully_annotated_decl: "extension A : _UnderscoredProto2 where T == String", + key.conforms: [ + { + key.kind: source.lang.swift.ref.protocol, + key.name: "_UnderscoredProto2", + key.usr: "s:16UnderscoredProto01_A6Proto2P" + } + ], + key.extends: { + key.kind: source.lang.swift.ref.struct, + key.name: "A", + key.usr: "s:16UnderscoredProto1AV" + }, + key.entities: [ + { + key.kind: source.lang.swift.decl.typealias, + key.name: "Elem", + key.usr: "s:16UnderscoredProto1AVAASSRszlE4Elema", + key.offset: 246, + key.length: 20, + key.fully_annotated_decl: "typealias Elem = Int", + key.conforms: [ + { + key.kind: source.lang.swift.ref.protocol, + key.name: "FixedWidthInteger", + key.usr: "s:s17FixedWidthIntegerP" + }, + { + key.kind: source.lang.swift.ref.protocol, + key.name: "SignedInteger", + key.usr: "s:SZ" + }, + { + key.kind: source.lang.swift.ref.protocol, + key.name: "_ExpressibleByBuiltinIntegerLiteral", + key.usr: "s:s35_ExpressibleByBuiltinIntegerLiteralP" + } + ] + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromAConditionalExtension(takesTIfString:)", + key.usr: "s:16UnderscoredProto1AVAASSRszlE25fromAConditionalExtension14takesTIfStringySS_tF", + key.offset: 272, + key.length: 64, + key.fully_annotated_decl: "func fromAConditionalExtension(takesTIfString: T)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesTIfString", + key.name: "takesTIfString", + key.offset: 334, + key.length: 1 + } + ] + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromProto2Extension(takesElem:)", + key.usr: "s:16UnderscoredProto01_A6Proto2PAAE04fromC9Extension9takesElemy0G0Qz_tF::SYNTHESIZED::s:16UnderscoredProto1AV", + key.original_usr: "s:16UnderscoredProto01_A6Proto2PAAE04fromC9Extension9takesElemy0G0Qz_tF", + key.offset: 342, + key.length: 50, + key.fully_annotated_decl: "func fromProto2Extension(takesElem: Int)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesElem", + key.name: "takesElem", + key.offset: 388, + key.length: 3 + } + ] + } + ] + }, + { + key.kind: source.lang.swift.decl.extension.struct, + key.offset: 396, + key.length: 98, + key.fully_annotated_decl: "extension A", + key.extends: { + key.kind: source.lang.swift.ref.struct, + key.name: "A", + key.usr: "s:16UnderscoredProto1AV" + }, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromDeprecatedConditionalProto2Extension(takesElemInt:)", + key.usr: "s:16UnderscoredProto01_A6Proto2PAASi4ElemRtzrlE025fromDeprecatedConditionalC9Extension05takesD3IntySi_tF::SYNTHESIZED::s:16UnderscoredProto1AV", + key.original_usr: "s:16UnderscoredProto01_A6Proto2PAASi4ElemRtzrlE025fromDeprecatedConditionalC9Extension05takesD3IntySi_tF", + key.offset: 415, + key.length: 77, + key.fully_annotated_decl: "func fromDeprecatedConditionalProto2Extension(takesElemInt: Int)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesElemInt", + key.name: "takesElemInt", + key.offset: 488, + key.length: 3 + } + ] + } + ], + key.attributes: [ + { + key.kind: source.lang.swift.attribute.availability, + key.is_deprecated: 1 + } + ], + key.is_deprecated: 1 + }, + { + key.kind: source.lang.swift.decl.class, + key.name: "B", + key.usr: "s:16UnderscoredProto1BC", + key.generic_params: [ + { + key.name: "T" + } + ], + key.offset: 496, + key.length: 253, + key.fully_annotated_decl: "class B<T> : _UnderscoredProto", + key.conforms: [ + { + key.kind: source.lang.swift.ref.protocol, + key.name: "_UnderscoredProto", + key.usr: "s:16UnderscoredProto01_aB0P" + } + ], + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromB(takesT:)", + key.usr: "s:16UnderscoredProto1BC5fromB6takesTyx_tF", + key.offset: 514, + key.length: 28, + key.fully_annotated_decl: "func fromB(takesT: T)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesT", + key.name: "takesT", + key.offset: 540, + key.length: 1 + } + ] + }, + { + key.kind: source.lang.swift.decl.typealias, + key.name: "Elem", + key.usr: "s:16UnderscoredProto1BC4Elema", + key.offset: 548, + key.length: 23, + key.fully_annotated_decl: "typealias Elem = String" + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromProtoExtension()", + key.usr: "s:16UnderscoredProto01_aB0PAAE04fromB9ExtensionyyF::SYNTHESIZED::s:16UnderscoredProto1BC", + key.original_usr: "s:16UnderscoredProto01_aB0PAAE04fromB9ExtensionyyF", + key.offset: 577, + key.length: 25, + key.fully_annotated_decl: "func fromProtoExtension()" + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromProto2Extension(takesElem:)", + key.usr: "s:16UnderscoredProto01_A6Proto2PAAE04fromC9Extension9takesElemy0G0Qz_tF::SYNTHESIZED::s:16UnderscoredProto1BC", + key.original_usr: "s:16UnderscoredProto01_A6Proto2PAAE04fromC9Extension9takesElemy0G0Qz_tF", + key.offset: 608, + key.length: 53, + key.fully_annotated_decl: "func fromProto2Extension(takesElem: String)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesElem", + key.name: "takesElem", + key.offset: 654, + key.length: 6 + } + ] + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromConditionalProto2Extension(takesElemIfString:)", + key.usr: "s:16UnderscoredProto01_A6Proto2PAASS4ElemRtzrlE015fromConditionalC9Extension05takesD8IfStringySS_tF::SYNTHESIZED::s:16UnderscoredProto1BC", + key.original_usr: "s:16UnderscoredProto01_A6Proto2PAASS4ElemRtzrlE015fromConditionalC9Extension05takesD8IfStringySS_tF", + key.offset: 667, + key.length: 80, + key.fully_annotated_decl: "func fromConditionalProto2Extension(takesElemIfString: String)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesElemIfString", + key.name: "takesElemIfString", + key.offset: 740, + key.length: 6 + } + ] + } + ] + }, + { + key.kind: source.lang.swift.decl.extension.class, + key.offset: 751, + key.length: 56, + key.fully_annotated_decl: "extension B", + key.extends: { + key.kind: source.lang.swift.ref.class, + key.name: "B", + key.usr: "s:16UnderscoredProto1BC" + }, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromDeprecatedProtoExtension()", + key.usr: "s:16UnderscoredProto01_aB0PAAE014fromDeprecatedB9ExtensionyyF::SYNTHESIZED::s:16UnderscoredProto1BC", + key.original_usr: "s:16UnderscoredProto01_aB0PAAE014fromDeprecatedB9ExtensionyyF", + key.offset: 770, + key.length: 35, + key.fully_annotated_decl: "func fromDeprecatedProtoExtension()" + } + ], + key.attributes: [ + { + key.kind: source.lang.swift.attribute.availability, + key.is_deprecated: 1 + } + ], + key.is_deprecated: 1 + }, + { + key.kind: source.lang.swift.decl.class, + key.name: "C", + key.usr: "s:16UnderscoredProto1CC", + key.generic_params: [ + { + key.name: "U" + }, + { + key.name: "V" + } + ], + key.generic_requirements: [ + { + key.description: "U : Equatable" + } + ], + key.offset: 809, + key.length: 603, + key.fully_annotated_decl: "class C<U, V> : B<String> where U : Equatable", + key.inherits: [ + { + key.kind: source.lang.swift.ref.class, + key.name: "B", + key.usr: "s:16UnderscoredProto1BC" + } + ], + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromC(takesUIfEquatable:)", + key.usr: "s:16UnderscoredProto1CC5fromC17takesUIfEquatableyx_tF", + key.offset: 862, + key.length: 50, + key.fully_annotated_decl: "func fromC(takesUIfEquatable: U)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesUIfEquatable", + key.name: "takesUIfEquatable", + key.offset: 910, + key.length: 1 + } + ] + }, + { + key.kind: source.lang.swift.decl.typealias, + key.name: "Elem1", + key.usr: "s:16UnderscoredProto1CC5Elem1a", + key.offset: 918, + key.length: 19, + key.fully_annotated_decl: "typealias Elem1 = V", + key.conforms: [ + { + key.kind: source.lang.swift.ref.associatedtype, + key.name: "Elem1", + key.usr: "s:16UnderscoredProto01_A6Proto3P5Elem1Qa" + } + ] + }, + { + key.kind: source.lang.swift.decl.typealias, + key.name: "Elem2", + key.usr: "s:16UnderscoredProto1CC5Elem2a", + key.offset: 943, + key.length: 19, + key.fully_annotated_decl: "typealias Elem2 = U", + key.conforms: [ + { + key.kind: source.lang.swift.ref.associatedtype, + key.name: "Elem2", + key.usr: "s:16UnderscoredProto01_A6Proto3P5Elem2Qa" + } + ] + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromCConditionlExtension(takesU:)", + key.usr: "s:16UnderscoredProto1CC24fromCConditionlExtension6takesUyx_tF", + key.offset: 968, + key.length: 47, + key.fully_annotated_decl: "func fromCConditionlExtension(takesU: U)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesU", + key.name: "takesU", + key.offset: 1013, + key.length: 1 + } + ] + }, + { + key.kind: source.lang.swift.decl.typealias, + key.name: "Elem", + key.usr: "s:16UnderscoredProto1BC4Elema::SYNTHESIZED::s:16UnderscoredProto1CC", + key.original_usr: "s:16UnderscoredProto1BC4Elema", + key.offset: 1021, + key.length: 23, + key.fully_annotated_decl: "typealias Elem = String" + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromProtoExtension()", + key.usr: "s:16UnderscoredProto01_aB0PAAE04fromB9ExtensionyyF::SYNTHESIZED::s:16UnderscoredProto1CC", + key.original_usr: "s:16UnderscoredProto01_aB0PAAE04fromB9ExtensionyyF", + key.offset: 1050, + key.length: 25, + key.fully_annotated_decl: "func fromProtoExtension()" + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromProto2Extension(takesElem:)", + key.usr: "s:16UnderscoredProto01_A6Proto2PAAE04fromC9Extension9takesElemy0G0Qz_tF::SYNTHESIZED::s:16UnderscoredProto1CC", + key.original_usr: "s:16UnderscoredProto01_A6Proto2PAAE04fromC9Extension9takesElemy0G0Qz_tF", + key.offset: 1081, + key.length: 53, + key.fully_annotated_decl: "func fromProto2Extension(takesElem: String)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesElem", + key.name: "takesElem", + key.offset: 1127, + key.length: 6 + } + ] + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromConditionalProto2Extension(takesElemIfString:)", + key.usr: "s:16UnderscoredProto01_A6Proto2PAASS4ElemRtzrlE015fromConditionalC9Extension05takesD8IfStringySS_tF::SYNTHESIZED::s:16UnderscoredProto1CC", + key.original_usr: "s:16UnderscoredProto01_A6Proto2PAASS4ElemRtzrlE015fromConditionalC9Extension05takesD8IfStringySS_tF", + key.offset: 1140, + key.length: 80, + key.fully_annotated_decl: "func fromConditionalProto2Extension(takesElemIfString: String)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesElemIfString", + key.name: "takesElemIfString", + key.offset: 1213, + key.length: 6 + } + ] + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromProto4Extension(takesElem2IfEquatable:)", + key.usr: "s:16UnderscoredProto01_A6Proto4PAAE04fromC9Extension21takesElem2IfEquatabley0G0Qz_tF::SYNTHESIZED::s:16UnderscoredProto1CC", + key.original_usr: "s:16UnderscoredProto01_A6Proto4PAAE04fromC9Extension21takesElem2IfEquatabley0G0Qz_tF", + key.offset: 1226, + key.length: 72, + key.fully_annotated_decl: "func fromProto4Extension(takesElem2IfEquatable: U)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesElem2IfEquatable", + key.name: "takesElem2IfEquatable", + key.offset: 1296, + key.length: 1 + } + ] + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromProto3Extension(takesElem1:)", + key.usr: "s:16UnderscoredProto01_A6Proto3PAAE04fromC9Extension10takesElem1y0G0Qz_tF::SYNTHESIZED::s:16UnderscoredProto1CC", + key.original_usr: "s:16UnderscoredProto01_A6Proto3PAAE04fromC9Extension10takesElem1y0G0Qz_tF", + key.offset: 1304, + key.length: 50, + key.fully_annotated_decl: "func fromProto3Extension(takesElem1: V)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesElem1", + key.name: "takesElem1", + key.offset: 1352, + key.length: 1 + } + ] + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromProto3Extension(takesElem2:)", + key.usr: "s:16UnderscoredProto01_A6Proto3PAAE04fromC9Extension10takesElem2y0G0Qz_tF::SYNTHESIZED::s:16UnderscoredProto1CC", + key.original_usr: "s:16UnderscoredProto01_A6Proto3PAAE04fromC9Extension10takesElem2y0G0Qz_tF", + key.offset: 1360, + key.length: 50, + key.fully_annotated_decl: "func fromProto3Extension(takesElem2: U)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesElem2", + key.name: "takesElem2", + key.offset: 1408, + key.length: 1 + } + ] + } + ] + }, + { + key.kind: source.lang.swift.decl.extension.class, + key.offset: 1414, + key.length: 56, + key.fully_annotated_decl: "extension C", + key.extends: { + key.kind: source.lang.swift.ref.class, + key.name: "C", + key.usr: "s:16UnderscoredProto1CC" + }, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromDeprecatedProtoExtension()", + key.usr: "s:16UnderscoredProto01_aB0PAAE014fromDeprecatedB9ExtensionyyF::SYNTHESIZED::s:16UnderscoredProto1CC", + key.original_usr: "s:16UnderscoredProto01_aB0PAAE014fromDeprecatedB9ExtensionyyF", + key.offset: 1433, + key.length: 35, + key.fully_annotated_decl: "func fromDeprecatedProtoExtension()" + } + ], + key.attributes: [ + { + key.kind: source.lang.swift.attribute.availability, + key.is_deprecated: 1 + } + ], + key.is_deprecated: 1 + }, + { + key.kind: source.lang.swift.decl.extension.class, + key.generic_requirements: [ + { + key.description: "U : Hashable" + } + ], + key.offset: 1472, + key.length: 110, + key.fully_annotated_decl: "extension C where U : Hashable", + key.extends: { + key.kind: source.lang.swift.ref.class, + key.name: "C", + key.usr: "s:16UnderscoredProto1CC" + }, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromProto4Extension(takesElem2IfHashable:)", + key.usr: "s:16UnderscoredProto01_A6Proto4PAASH5Elem2RpzrlE04fromC9Extension05takesD10IfHashableyAE_tF::SYNTHESIZED::s:16UnderscoredProto1CC", + key.original_usr: "s:16UnderscoredProto01_A6Proto4PAASH5Elem2RpzrlE04fromC9Extension05takesD10IfHashableyAE_tF", + key.offset: 1510, + key.length: 70, + key.fully_annotated_decl: "func fromProto4Extension(takesElem2IfHashable: U)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesElem2IfHashable", + key.name: "takesElem2IfHashable", + key.offset: 1578, + key.length: 1 + } + ] + } + ] + }, + { + key.kind: source.lang.swift.decl.struct, + key.name: "D", + key.usr: "s:16UnderscoredProto1DV", + key.generic_params: [ + { + key.name: "T" + }, + { + key.name: "U" + } + ], + key.offset: 1584, + key.length: 70, + key.fully_annotated_decl: "struct D<T, U>", + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromD(takesT:takesU:)", + key.usr: "s:16UnderscoredProto1DV5fromD6takesT0D1Uyx_q_tF", + key.offset: 1606, + key.length: 46, + key.fully_annotated_decl: "func fromD(takesT: T, takesU: U)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesT", + key.name: "takesT", + key.offset: 1632, + key.length: 1 + }, + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesU", + key.name: "takesU", + key.offset: 1650, + key.length: 1 + } + ] + } + ] + }, + { + key.kind: source.lang.swift.decl.extension.struct, + key.generic_requirements: [ + { + key.description: "T : Equatable" + } + ], + key.offset: 1656, + key.length: 59, + key.fully_annotated_decl: "extension D : _SomeProto where T : Equatable", + key.conforms: [ + { + key.kind: source.lang.swift.ref.protocol, + key.name: "_SomeProto", + key.usr: "s:16UnderscoredProto05_SomeB0P" + } + ], + key.extends: { + key.kind: source.lang.swift.ref.struct, + key.name: "D", + key.usr: "s:16UnderscoredProto1DV" + }, + key.entities: [ + { + key.kind: source.lang.swift.decl.typealias, + key.name: "Item", + key.usr: "s:16UnderscoredProto1DVAASQRzrlE4Itema", + key.offset: 1695, + key.length: 18, + key.fully_annotated_decl: "typealias Item = T", + key.conforms: [ + { + key.kind: source.lang.swift.ref.associatedtype, + key.name: "Item", + key.usr: "s:16UnderscoredProto05_SomeB0P4ItemQa" + } + ] + } + ] + }, + { + key.kind: source.lang.swift.decl.extension.struct, + key.generic_requirements: [ + { + key.description: "T : Other1" + }, + { + key.description: "T : Equatable" + } + ], + key.offset: 1717, + key.length: 135, + key.fully_annotated_decl: "extension D where T : Other1, T : Equatable", + key.extends: { + key.kind: source.lang.swift.ref.struct, + key.name: "D", + key.usr: "s:16UnderscoredProto1DV" + }, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "fromSomeProtoExtensionSplitConditions(takesItemIfOther1:)", + key.usr: "s:16UnderscoredProto05_SomeB0PA2A6Other14ItemRpzrlE04fromcB24ExtensionSplitConditions05takese2IfD0yAF_tF::SYNTHESIZED::s:16UnderscoredProto1DV", + key.original_usr: "s:16UnderscoredProto05_SomeB0PA2A6Other14ItemRpzrlE04fromcB24ExtensionSplitConditions05takese2IfD0yAF_tF", + key.offset: 1768, + key.length: 82, + key.fully_annotated_decl: "func fromSomeProtoExtensionSplitConditions(takesItemIfOther1: T)", + key.entities: [ + { + key.kind: source.lang.swift.decl.var.local, + key.keyword: "takesItemIfOther1", + key.name: "takesItemIfOther1", + key.offset: 1848, + key.length: 1 + } + ] + } + ] + }, + { + key.kind: source.lang.swift.decl.protocol, + key.name: "Other1", + key.usr: "s:16UnderscoredProto6Other1P", + key.offset: 1854, + key.length: 19, + key.fully_annotated_decl: "protocol Other1" + } +] diff --git a/test/SourceKit/Inputs/UnderscoredProto.swiftinterface b/test/SourceKit/Inputs/UnderscoredProto.swiftinterface new file mode 100644 index 0000000000000..ba812ee128cba --- /dev/null +++ b/test/SourceKit/Inputs/UnderscoredProto.swiftinterface @@ -0,0 +1,101 @@ +// swift-interface-format-version: 1.0 +// swift-module-flags: -swift-version 5 -enable-library-evolution -module-name UnderscoredProto + +public protocol _UnderscoredProto {} +public protocol _UnderscoredProto2 { + associatedtype Elem +} + +public extension _UnderscoredProto { + func fromProtoExtension() +} + +public extension _UnderscoredProto2 { + func fromProto2Extension(takesElem: Elem) +} + +@available(*, deprecated, message: "") +public extension _UnderscoredProto { + func fromDeprecatedProtoExtension(){} +} + +public extension _UnderscoredProto2 where Elem == String { + func fromConditionalProto2Extension(takesElemIfString: Elem) +} + +@available(*, deprecated, message: "") +public extension _UnderscoredProto2 where Elem == Int { + func fromDeprecatedConditionalProto2Extension(takesElemInt: Elem) +} + +public struct A { + public func fromA(takesT: T) +} + +extension A { + public func fromAExtension(takesT: T) +} + +extension A : _UnderscoredProto {} + +extension A : _UnderscoredProto2 where T == String { + public typealias Elem = Int + public func fromAConditionalExtension(takesTIfString: T) +} + +public class B: _UnderscoredProto { + public func fromB(takesT: T) +} + +extension B: _UnderscoredProto2 { + public typealias Elem = String +} + +public class C: B where U: Equatable { + public func fromC(takesUIfEquatable: U) +} + +public protocol _UnderscoredProto3 { + associatedtype Elem1 + associatedtype Elem2 +} +extension _UnderscoredProto3 { + public func fromProto3Extension(takesElem1: Elem1) + public func fromProto3Extension(takesElem2: Elem2) +} + +public protocol _UnderscoredProto4: _UnderscoredProto3 where Elem2: Equatable {} +extension _UnderscoredProto4 { + public func fromProto4Extension(takesElem2IfEquatable: Elem2) +} + +extension _UnderscoredProto4 where Elem2: Hashable { + public func fromProto4Extension(takesElem2IfHashable: Elem2) +} + +extension C: _UnderscoredProto4 { + public typealias Elem1 = V + public typealias Elem2 = U + public func fromCConditionlExtension(takesU: U) +} + + +public struct D { + public func fromD(takesT: T, takesU: U) +} + +public protocol Other1 {} +public protocol _SomeProto { + associatedtype Item +} + +extension _SomeProto where Item: Other1 { + public func fromSomeProtoExtensionSplitConditions(takesItemIfOther1: Item) +} + +extension D: _SomeProto where T: Equatable { + public typealias Item = T + +} + + diff --git a/test/SourceKit/Misc/handle-filelist-driver-args.swift b/test/SourceKit/Misc/handle-filelist-driver-args.swift new file mode 100644 index 0000000000000..81617e8483b99 --- /dev/null +++ b/test/SourceKit/Misc/handle-filelist-driver-args.swift @@ -0,0 +1,8 @@ +let x = 10 +x.littleEndian + +// RUN: %empty-directory(%t) +// RUN: echo %s > %t/tmp.SwiftFileList +// RUN: %target-swiftc_driver -typecheck @%t/tmp.SwiftFileList +// RUN: %sourcekitd-test -req=complete -pos=2:3 %s -- @%t/tmp.SwiftFileList | %FileCheck %s -check-prefix=COMPLETE +// COMPLETE: littleEndian diff --git a/test/SourceKit/Misc/no-driver-outputs.swift b/test/SourceKit/Misc/no-driver-outputs.swift new file mode 100644 index 0000000000000..f3e11065eb183 --- /dev/null +++ b/test/SourceKit/Misc/no-driver-outputs.swift @@ -0,0 +1,29 @@ +// REQUIRES: shell + +// RUN: %empty-directory(%t) +// RUN: env TMPDIR=%t __XPC_TMPDIR=%t %sourcekitd-test -req=syntax-map %s +// RUN: ls %t/ | count 0 + +// RUN: %empty-directory(%t) +// RUN: env TMPDIR=%t __XPC_TMPDIR=%t %sourcekitd-test -req=syntax-map %s -- %s +// RUN: ls %t/ | count 0 + +// RUN: %empty-directory(%t) +// RUN: env TMPDIR=%t __XPC_TMPDIR=%t %sourcekitd-test -req=syntax-map %s -- %s -c -o %t/foo.o +// RUN: ls %t/ | count 0 + +// RUN: %empty-directory(%t) +// RUN: env TMPDIR=%t __XPC_TMPDIR=%t %sourcekitd-test -req=sema %s -- %s +// RUN: ls %t/ | count 0 + +// RUN: %empty-directory(%t) +// RUN: env TMPDIR=%t __XPC_TMPDIR=%t %sourcekitd-test -req=sema %s -- %s -c -o %t/foo.o +// RUN: ls %t/ | count 0 + +// RUN: %empty-directory(%t) +// RUN: env TMPDIR=%t __XPC_TMPDIR=%t %sourcekitd-test -req=sema %s -- %s -emit-module -module-name main -emit-module-path %t/main.swiftmodule -emit-module-interface -enable-library-evolution -emit-module-interface-path %t/main.swiftinterface -emit-objc-header -emit-objc-header-path %t/main.h -c -o %t/foo.o +// RUN: ls %t/ | count 0 + +// RUN: %empty-directory(%t) +// RUN: env TMPDIR=%t __XPC_TMPDIR=%t %sourcekitd-test -req=sema %s -- %s -emit-module -module-name main -emit-module-path %t/main.swiftmodule -emit-executable -o %t/foo +// RUN: ls %t/ | count 0 diff --git a/test/SymbolGraph/EmptyExtension.swift b/test/SymbolGraph/EmptyExtension.swift new file mode 100644 index 0000000000000..df1f8d271d19b --- /dev/null +++ b/test/SymbolGraph/EmptyExtension.swift @@ -0,0 +1,8 @@ +// RUN: %empty-directory(%t) +// RUN: %target-build-swift %s -module-name EmptyExtension -emit-module -emit-module-path %t/ +// RUN: %target-swift-symbolgraph-extract -module-name EmptyExtension -I %t -pretty-print -output-dir %t +// RUN: %{python} -c 'import os.path; import sys; sys.exit(1 if os.path.exists(sys.argv[1]) else 0)' %t/EmptyExtension@Swift.symbols.json + +extension Sequence { + func foo() {} +} diff --git a/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/Function.swift b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/Function.swift index a23284f1a1f34..8433f4afd76f6 100644 --- a/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/Function.swift +++ b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/Function.swift @@ -6,7 +6,7 @@ public func foo(f: @escaping () -> (), ext int: Int = 2, s: S) where S: Sequence {} // CHECK-LABEL:{{^ }}"declarationFragments": [ -// CHECK-NEXT: { +// CHECK: { // CHECK-NEXT: "kind": "keyword", // CHECK-NEXT: "spelling": "func" // CHECK-NEXT: }, @@ -36,7 +36,15 @@ public func foo(f: @escaping () -> (), ext int: Int = 2, s: S) where S: Seque // CHECK-NEXT: }, // CHECK-NEXT: { // CHECK-NEXT: "kind": "text", -// CHECK-NEXT: "spelling": ": () -> (), " +// CHECK-NEXT: "spelling": ": " +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "keyword", +// CHECK-NEXT: "spelling": "@escaping" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": " () -> (), " // CHECK-NEXT: }, // CHECK-NEXT: { // CHECK-NEXT: "kind": "externalParam", diff --git a/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/MultipleAttributes.swift b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/MultipleAttributes.swift new file mode 100644 index 0000000000000..3f350cbc4531b --- /dev/null +++ b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/MultipleAttributes.swift @@ -0,0 +1,44 @@ +// RUN: %empty-directory(%t) +// RUN: %target-build-swift %s -module-name MultipleAttributes -emit-module -emit-module-path %t/ +// RUN: %target-swift-symbolgraph-extract -module-name MultipleAttributes -I %t -pretty-print -output-dir %t +// RUN: %FileCheck %s --input-file %t/MultipleAttributes.symbols.json + +@frozen @propertyWrapper +public struct S { + public init() {} + public var wrappedValue: Int { + return 0 + } +} + +// CHECK-LABEL: "precise": "s:18MultipleAttributes1SV" +// CHECK: "declarationFragments": [ +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "attribute", +// CHECK-NEXT: "spelling": "@frozen" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": " " +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "attribute", +// CHECK-NEXT: "spelling": "@propertyWrapper" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": " " +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "keyword", +// CHECK-NEXT: "spelling": "struct" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": " " +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "identifier", +// CHECK-NEXT: "spelling": "S" +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/Never.swift b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/Never.swift new file mode 100644 index 0000000000000..fad7042fa730e --- /dev/null +++ b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/Never.swift @@ -0,0 +1,37 @@ +// RUN: %empty-directory(%t) +// RUN: %target-build-swift %s -module-name Never -emit-module -emit-module-path %t/ +// RUN: %target-swift-symbolgraph-extract -module-name Never -I %t -pretty-print -output-dir %t +// RUN: %FileCheck %s --input-file %t/Never.symbols.json --match-full-lines --strict-whitespace + +// REQUIRES: OS=macosx + +// Attributes that should never appear anywhere in the symbol graph. + +@available(macOS, deprecated) +public func deprecated() {} + +@inlinable +public func inlinable() {} + +@inline(never) +public func inline() {} + +public struct S { + public static prefix func ..<(s: S) -> S { + return s + } + public static func +(a: S, b: S) -> S { + return a + } + public static postfix func ++(s: S) -> S { + return s + } +} + +// CHECK-NOT: @available +// CHECK-NOT: @inlinable +// CHECK-NOT: @inline +// CHECK-NOT: "spelling": "prefix" +// CHECK-NOT: "spelling": "postfix" +// CHECK-NOT: "spelling": "infix" + diff --git a/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/NominalTypes.swift b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/NominalTypes.swift index 31e5c69fc1e6b..0de978c0b304d 100644 --- a/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/NominalTypes.swift +++ b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/NominalTypes.swift @@ -6,11 +6,21 @@ // RUN: %FileCheck %s --input-file %t/NominalTypes.symbols.json --check-prefix=ENUM // RUN: %FileCheck %s --input-file %t/NominalTypes.symbols.json --check-prefix=TYPEALIAS -public struct S where T: Sequence {} +public protocol P {} + +@frozen public struct S : P where T: Sequence {} // STRUCT-LABEL: "precise": "s:12NominalTypes1SV", // STRUCT: "declarationFragments": [ // STRUCT-NEXT: { +// STRUCT-NEXT: "kind": "attribute", +// STRUCT-NEXT: "spelling": "@frozen" +// STRUCT-NEXT: }, +// STRUCT-NEXT: { +// STRUCT-NEXT: "kind": "text", +// STRUCT-NEXT: "spelling": " " +// STRUCT-NEXT: }, +// STRUCT-NEXT: { // STRUCT-NEXT: "kind": "keyword", // STRUCT-NEXT: "spelling": "struct" // STRUCT-NEXT: }, diff --git a/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/SelfNotLinked.swift b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/SelfNotLinked.swift new file mode 100644 index 0000000000000..63cdea78f401a --- /dev/null +++ b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/SelfNotLinked.swift @@ -0,0 +1,47 @@ +// RUN: %empty-directory(%t) +// RUN: %target-build-swift %s -module-name SelfNotLinked -emit-module -emit-module-path %t/ +// RUN: %target-swift-symbolgraph-extract -module-name SelfNotLinked -I %t -pretty-print -output-dir %t +// RUN: %FileCheck %s --input-file %t/SelfNotLinked@Swift.symbols.json --match-full-lines --strict-whitespace + +extension Sequence where Self : Collection { + public func foo(x: Self) {} +} + +// CHECK-LABEL: "precise": "s:ST13SelfNotLinkedSlRzrlE3foo1xyx_tF", +// CHECK: "declarationFragments": [ +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "keyword", +// CHECK-NEXT: "spelling": "func" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": " " +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "identifier", +// CHECK-NEXT: "spelling": "foo" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": "(" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "externalParam", +// CHECK-NEXT: "spelling": "x" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": ": " +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "typeIdentifier", +// CHECK-NEXT: "spelling": "Self" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": ")" +// CHECK-NEXT: } +// CHECK-NEXT: ], +// CHECK-NEXT: "accessLevel": "public" +// CHECK-NEXT: } +// CHECK-NEXT: ], diff --git a/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Subheading/Function.swift b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Subheading/Function.swift index fb3f52a1f90e7..d72f85976c1eb 100644 --- a/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Subheading/Function.swift +++ b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Subheading/Function.swift @@ -11,66 +11,66 @@ public func foo(f: @escaping () -> (), ext int: Int = 2, s: S) where S: Seque // CHECK: names // CHECK-NEXT: "title": "foo(f:ext:s:)" // CHECK: "subHeading": [ -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "keyword", -// CHECK-NEXT: "spelling": "func" -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "text", -// CHECK-NEXT: "spelling": " " -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "identifier", -// CHECK-NEXT: "spelling": "foo" -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "text", -// CHECK-NEXT: "spelling": "<" -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "genericParameter", -// CHECK-NEXT: "spelling": "S" -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "text", -// CHECK-NEXT: "spelling": ">(" -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "externalParam", -// CHECK-NEXT: "spelling": "f" -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "text", -// CHECK-NEXT: "spelling": ": () -> (), " -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "externalParam", -// CHECK-NEXT: "spelling": "ext" -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "text", -// CHECK-NEXT: "spelling": ": " -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "typeIdentifier", -// CHECK-NEXT: "spelling": "Int", -// CHECK-NEXT: "preciseIdentifier": "s:Si" -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "text", -// CHECK-NEXT: "spelling": ", " -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "externalParam", -// CHECK-NEXT: "spelling": "s" -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "text", -// CHECK-NEXT: "spelling": ": S" -// CHECK-NEXT: }, -// CHECK-NEXT: { -// CHECK-NEXT: "kind": "text", -// CHECK-NEXT: "spelling": ")" -// CHECK-NEXT: } +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "keyword", +// CHECK-NEXT: "spelling": "func" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": " " +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "identifier", +// CHECK-NEXT: "spelling": "foo" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": "<" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "genericParameter", +// CHECK-NEXT: "spelling": "S" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": ">(" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "externalParam", +// CHECK-NEXT: "spelling": "f" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": ": () -> (), " +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "externalParam", +// CHECK-NEXT: "spelling": "ext" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": ": " +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "typeIdentifier", +// CHECK-NEXT: "spelling": "Int", +// CHECK-NEXT: "preciseIdentifier": "s:Si" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": ", " +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "externalParam", +// CHECK-NEXT: "spelling": "s" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": ": S" +// CHECK-NEXT: }, +// CHECK-NEXT: { +// CHECK-NEXT: "kind": "text", +// CHECK-NEXT: "spelling": ")" +// CHECK-NEXT: } // CHECK-NEXT: ] diff --git a/test/SymbolGraph/Symbols/Names.swift b/test/SymbolGraph/Symbols/Names.swift index 888cca8784b90..88ed6102377a5 100644 --- a/test/SymbolGraph/Symbols/Names.swift +++ b/test/SymbolGraph/Symbols/Names.swift @@ -2,8 +2,30 @@ // RUN: %target-build-swift %s -module-name Names -emit-module -emit-module-path %t/ // RUN: %target-swift-symbolgraph-extract -module-name Names -I %t -pretty-print -output-dir %t // RUN: %FileCheck %s --input-file %t/Names.symbols.json +// RUN: %FileCheck %s --input-file %t/Names.symbols.json --check-prefix=FUNC +// RUN: %FileCheck %s --input-file %t/Names.symbols.json --check-prefix=INNERTYPE +// RUN: %FileCheck %s --input-file %t/Names.symbols.json --check-prefix=INNERTYPEALIAS -public struct MyStruct {} +public struct MyStruct { + public struct InnerStruct {} + public typealias InnerTypeAlias = InnerStruct + + public func foo() {} +} + +// CHECK-LABEL: "precise": "s:5Names8MyStructV" // CHECK: names // CHECK-NEXT: "title": "MyStruct" + +// FUNC-LABEL: "precise": "s:5Names8MyStructV3fooyyF", +// FUNC: names +// FUNC-NEXT: "title": "foo()" + +// INNERTYPE-LABEL: "precise": "s:5Names8MyStructV05InnerC0V" +// INNERTYPE: names +// INNERTYPE-NEXT: "title": "MyStruct.InnerStruct" + +// INNERTYPEALIAS-LABEL: "precise": "s:5Names8MyStructV14InnerTypeAliasa" +// INNERTYPEALIAS: names +// INNERTYPEALIAS-NEXT: "title": "MyStruct.InnerTypeAlias" diff --git a/test/SymbolGraph/Symbols/SkipsPublicUnderscore.swift b/test/SymbolGraph/Symbols/SkipsPublicUnderscore.swift index 9f1d06757498d..719df07b91b6e 100644 --- a/test/SymbolGraph/Symbols/SkipsPublicUnderscore.swift +++ b/test/SymbolGraph/Symbols/SkipsPublicUnderscore.swift @@ -7,6 +7,7 @@ public protocol PublicProtocol {} // CHECK-NOT: precise:{{.*}}_ProtocolShouldntAppear // CHECK-NOT: precise:{{.*}}PublicProtocol +@_show_in_interface public protocol _ProtocolShouldntAppear {} // CHECK-NOT: _ShouldntAppear diff --git a/test/api-digester/Inputs/Foo-new-version/foo.h b/test/api-digester/Inputs/Foo-new-version/foo.h index b307b23510839..536a81f66ee9e 100644 --- a/test/api-digester/Inputs/Foo-new-version/foo.h +++ b/test/api-digester/Inputs/Foo-new-version/foo.h @@ -17,3 +17,13 @@ @interface ClangInterface: NSObject - (void)someFunction; @end + +@interface PhotoSettings: NSObject ++ (instancetype)photoSettingsWithFormat:(int)format; ++ (instancetype)photoSettingsWithNumber:(int)number; +@end + +@interface PhotoBracketSettings : PhotoSettings ++ (instancetype)photoBracketSettingsWithRawPixelFormatType:(int)rawPixelFormatType processedFormat:(int)processedFormat; ++ (instancetype)photoBracketSettingsWithNumber:(int)number; +@end diff --git a/test/api-digester/Inputs/Foo/foo.h b/test/api-digester/Inputs/Foo/foo.h index 93bcc41eb96be..54922ce83ac4e 100644 --- a/test/api-digester/Inputs/Foo/foo.h +++ b/test/api-digester/Inputs/Foo/foo.h @@ -11,3 +11,13 @@ @interface ClangInterface: NSObject - (void)someFunction; @end + +@interface PhotoSettings: NSObject ++ (instancetype)photoSettingsWithFormat:(int)format; ++ (instancetype)photoSettingsWithNumber:(int)number; +@end + +@interface PhotoBracketSettings : PhotoSettings ++ (instancetype)photoBracketSettingsWithRawPixelFormatType:(int)rawPixelFormatType processedFormat:(int)processedFormat; ++ (instancetype)photoBracketSettingsWithNumber:(int)number; +@end diff --git a/test/api-digester/Outputs/clang-module-dump.txt b/test/api-digester/Outputs/clang-module-dump.txt index d6d9a22418752..9fcffbebb038b 100644 --- a/test/api-digester/Outputs/clang-module-dump.txt +++ b/test/api-digester/Outputs/clang-module-dump.txt @@ -201,6 +201,340 @@ "ObjC", "Dynamic" ] + }, + { + "kind": "TypeDecl", + "name": "PhotoBracketSettings", + "printedName": "PhotoBracketSettings", + "children": [ + { + "kind": "Constructor", + "name": "init", + "printedName": "init(rawPixelFormatType:processedFormat:)", + "children": [ + { + "kind": "TypeNominal", + "name": "Optional", + "printedName": "Foo.PhotoBracketSettings?", + "children": [ + { + "kind": "TypeNominal", + "name": "PhotoBracketSettings", + "printedName": "Foo.PhotoBracketSettings", + "usr": "c:objc(cs)PhotoBracketSettings" + } + ], + "usr": "s:Sq" + }, + { + "kind": "TypeNominal", + "name": "Int32", + "printedName": "Swift.Int32", + "usr": "s:s5Int32V" + }, + { + "kind": "TypeNominal", + "name": "Int32", + "printedName": "Swift.Int32", + "usr": "s:s5Int32V" + } + ], + "declKind": "Constructor", + "usr": "c:objc(cs)PhotoBracketSettings(cm)photoBracketSettingsWithRawPixelFormatType:processedFormat:", + "moduleName": "Foo", + "objc_name": "photoBracketSettingsWithRawPixelFormatType:processedFormat:", + "declAttributes": [ + "ObjC", + "Dynamic" + ], + "init_kind": "ConvenienceFactory" + }, + { + "kind": "Constructor", + "name": "init", + "printedName": "init(number:)", + "children": [ + { + "kind": "TypeNominal", + "name": "Optional", + "printedName": "Foo.PhotoBracketSettings?", + "children": [ + { + "kind": "TypeNominal", + "name": "PhotoBracketSettings", + "printedName": "Foo.PhotoBracketSettings", + "usr": "c:objc(cs)PhotoBracketSettings" + } + ], + "usr": "s:Sq" + }, + { + "kind": "TypeNominal", + "name": "Int32", + "printedName": "Swift.Int32", + "usr": "s:s5Int32V" + } + ], + "declKind": "Constructor", + "usr": "c:objc(cs)PhotoBracketSettings(cm)photoBracketSettingsWithNumber:", + "moduleName": "Foo", + "objc_name": "photoBracketSettingsWithNumber:", + "declAttributes": [ + "ObjC", + "Dynamic" + ], + "init_kind": "ConvenienceFactory" + }, + { + "kind": "Constructor", + "name": "init", + "printedName": "init(format:)", + "children": [ + { + "kind": "TypeNominal", + "name": "Optional", + "printedName": "Foo.PhotoBracketSettings?", + "children": [ + { + "kind": "TypeNominal", + "name": "PhotoBracketSettings", + "printedName": "Foo.PhotoBracketSettings", + "usr": "c:objc(cs)PhotoBracketSettings" + } + ], + "usr": "s:Sq" + }, + { + "kind": "TypeNominal", + "name": "Int32", + "printedName": "Swift.Int32", + "usr": "s:s5Int32V" + } + ], + "declKind": "Constructor", + "usr": "c:objc(cs)PhotoSettings(cm)photoSettingsWithFormat:", + "moduleName": "Foo", + "overriding": true, + "implicit": true, + "objc_name": "photoSettingsWithFormat:", + "declAttributes": [ + "Override", + "ObjC", + "Dynamic" + ], + "init_kind": "ConvenienceFactory" + }, + { + "kind": "Constructor", + "name": "init", + "printedName": "init()", + "children": [ + { + "kind": "TypeNominal", + "name": "PhotoBracketSettings", + "printedName": "Foo.PhotoBracketSettings", + "usr": "c:objc(cs)PhotoBracketSettings" + } + ], + "declKind": "Constructor", + "usr": "c:objc(cs)NSObject(im)init", + "moduleName": "Foo", + "overriding": true, + "implicit": true, + "objc_name": "init", + "declAttributes": [ + "Override", + "ObjC", + "Dynamic" + ], + "init_kind": "Designated" + } + ], + "declKind": "Class", + "usr": "c:objc(cs)PhotoBracketSettings", + "moduleName": "Foo", + "isOpen": true, + "objc_name": "PhotoBracketSettings", + "declAttributes": [ + "ObjC", + "Dynamic" + ], + "superclassUsr": "c:objc(cs)PhotoSettings", + "inheritsConvenienceInitializers": true, + "superclassNames": [ + "Foo.PhotoSettings", + "ObjectiveC.NSObject" + ], + "conformances": [ + { + "kind": "Conformance", + "name": "NSObjectProtocol", + "printedName": "NSObjectProtocol", + "usr": "c:objc(pl)NSObject" + }, + { + "kind": "Conformance", + "name": "Equatable", + "printedName": "Equatable", + "usr": "s:SQ" + }, + { + "kind": "Conformance", + "name": "Hashable", + "printedName": "Hashable", + "usr": "s:SH" + }, + { + "kind": "Conformance", + "name": "CVarArg", + "printedName": "CVarArg", + "usr": "s:s7CVarArgP" + } + ] + }, + { + "kind": "TypeDecl", + "name": "PhotoSettings", + "printedName": "PhotoSettings", + "children": [ + { + "kind": "Constructor", + "name": "init", + "printedName": "init(format:)", + "children": [ + { + "kind": "TypeNominal", + "name": "Optional", + "printedName": "Foo.PhotoSettings?", + "children": [ + { + "kind": "TypeNominal", + "name": "PhotoSettings", + "printedName": "Foo.PhotoSettings", + "usr": "c:objc(cs)PhotoSettings" + } + ], + "usr": "s:Sq" + }, + { + "kind": "TypeNominal", + "name": "Int32", + "printedName": "Swift.Int32", + "usr": "s:s5Int32V" + } + ], + "declKind": "Constructor", + "usr": "c:objc(cs)PhotoSettings(cm)photoSettingsWithFormat:", + "moduleName": "Foo", + "objc_name": "photoSettingsWithFormat:", + "declAttributes": [ + "ObjC", + "Dynamic" + ], + "init_kind": "ConvenienceFactory" + }, + { + "kind": "Constructor", + "name": "init", + "printedName": "init(number:)", + "children": [ + { + "kind": "TypeNominal", + "name": "Optional", + "printedName": "Foo.PhotoSettings?", + "children": [ + { + "kind": "TypeNominal", + "name": "PhotoSettings", + "printedName": "Foo.PhotoSettings", + "usr": "c:objc(cs)PhotoSettings" + } + ], + "usr": "s:Sq" + }, + { + "kind": "TypeNominal", + "name": "Int32", + "printedName": "Swift.Int32", + "usr": "s:s5Int32V" + } + ], + "declKind": "Constructor", + "usr": "c:objc(cs)PhotoSettings(cm)photoSettingsWithNumber:", + "moduleName": "Foo", + "objc_name": "photoSettingsWithNumber:", + "declAttributes": [ + "ObjC", + "Dynamic" + ], + "init_kind": "ConvenienceFactory" + }, + { + "kind": "Constructor", + "name": "init", + "printedName": "init()", + "children": [ + { + "kind": "TypeNominal", + "name": "PhotoSettings", + "printedName": "Foo.PhotoSettings", + "usr": "c:objc(cs)PhotoSettings" + } + ], + "declKind": "Constructor", + "usr": "c:objc(cs)NSObject(im)init", + "moduleName": "Foo", + "overriding": true, + "implicit": true, + "objc_name": "init", + "declAttributes": [ + "Override", + "ObjC", + "Dynamic" + ], + "init_kind": "Designated" + } + ], + "declKind": "Class", + "usr": "c:objc(cs)PhotoSettings", + "moduleName": "Foo", + "isOpen": true, + "objc_name": "PhotoSettings", + "declAttributes": [ + "ObjC", + "Dynamic" + ], + "superclassUsr": "c:objc(cs)NSObject", + "inheritsConvenienceInitializers": true, + "superclassNames": [ + "ObjectiveC.NSObject" + ], + "conformances": [ + { + "kind": "Conformance", + "name": "NSObjectProtocol", + "printedName": "NSObjectProtocol", + "usr": "c:objc(pl)NSObject" + }, + { + "kind": "Conformance", + "name": "Equatable", + "printedName": "Equatable", + "usr": "s:SQ" + }, + { + "kind": "Conformance", + "name": "Hashable", + "printedName": "Hashable", + "usr": "s:SH" + }, + { + "kind": "Conformance", + "name": "CVarArg", + "printedName": "CVarArg", + "usr": "s:s7CVarArgP" + } + ] } ], "json_format_version": 6 diff --git a/test/decl/class/circular_inheritance.swift b/test/decl/class/circular_inheritance.swift index fb53f95a29f27..edfdf396c569b 100644 --- a/test/decl/class/circular_inheritance.swift +++ b/test/decl/class/circular_inheritance.swift @@ -2,11 +2,6 @@ // RUN: mkdir -p %t/stats-dir // RUN: %target-typecheck-verify-swift // RUN: not %target-swift-frontend -typecheck -debug-cycles %s -build-request-dependency-graph -output-request-graphviz %t.dot -stats-output-dir %t/stats-dir 2> %t.cycles -// RUN: %FileCheck %s < %t.cycles -// RUN: %FileCheck -check-prefix CHECK-DOT %s < %t.dot - -// Check that we produced superclass type requests. -// RUN: %{python} %utils/process-stats-dir.py --evaluate 'SuperclassTypeRequest == 18' %t/stats-dir class Left // expected-error {{circular reference}} expected-note {{through reference here}} : Right.Hand { // expected-note {{through reference here}} diff --git a/test/decl/var/property_wrappers.swift b/test/decl/var/property_wrappers.swift index 51c06e93ecfcb..313d35685f51a 100644 --- a/test/decl/var/property_wrappers.swift +++ b/test/decl/var/property_wrappers.swift @@ -1972,4 +1972,4 @@ public struct NonVisibleImplicitInit { public var wrappedValue: Bool { return false } -} \ No newline at end of file +} diff --git a/test/decl/var/property_wrappers_opaque.swift b/test/decl/var/property_wrappers_opaque.swift new file mode 100644 index 0000000000000..966b259f318c1 --- /dev/null +++ b/test/decl/var/property_wrappers_opaque.swift @@ -0,0 +1,27 @@ +// RUN: %target-typecheck-verify-swift -swift-version 5 -disable-availability-checking + +protocol P { } + +@propertyWrapper +struct WrapperWithDefaultInit { + private var stored: T? + + var wrappedValue: T { + get { stored! } + set { stored = newValue } + } + + init() { + self.stored = nil + } +} + +// FB7699647 - crash with opaque result type and property wrappers. +struct FB7699647 { + @WrapperWithDefaultInit var property: some P // expected-error{{property declares an opaque return type, but cannot infer the underlying type from its initializer expression}} + @WrapperWithDefaultInit() var otherProperty: some P // expected-error{{property declares an opaque return type, but cannot infer the underlying type from its initializer expression}} +} + +struct FB7699647b { + @WrapperWithDefaultInit var property: some P // expected-error{{property declares an opaque return type, but cannot infer the underlying type from its initializer expression}} +} diff --git a/test/expr/cast/metatype_casts.swift b/test/expr/cast/metatype_casts.swift index 68a4a1748992d..b515727b6528f 100644 --- a/test/expr/cast/metatype_casts.swift +++ b/test/expr/cast/metatype_casts.swift @@ -49,3 +49,10 @@ use(C.self as P.Type) // expected-error{{cannot convert value of type 'C.Type' t use(E.self as P.Protocol) // expected-error{{cannot convert value of type 'E.Type' to type 'P.Protocol' in coercion}} use(E.self as P.Type) + +// SR-12946 +func SR12946(_ e: T) { + _ = AnyObject.self is T.Type // OK +} + +SR12946(1 as AnyObject) diff --git a/test/lit.cfg b/test/lit.cfg index 1bdc5cf705e8f..81c20d27225ad 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -146,7 +146,7 @@ config.test_format = swift_test.SwiftTest(coverage_mode=config.coverage_mode, # suffixes: A list of file extensions to treat as test files. config.suffixes = ['.swift', '.ll', '.sil', '.gyb', '.m', '.c', - '.swiftinterface', '.test-sh'] + '.swiftinterface', '.test-sh', '.test'] # excludes: A list of directories to exclude from the testsuite. The 'Inputs' # subdirectories contain auxiliary inputs for various tests in their parent @@ -162,10 +162,21 @@ config.test_source_root = os.path.dirname(__file__) # test_exec_root: The root path where tests should be run. swift_obj_root = getattr(config, 'swift_obj_root', None) +# cmake. The path to the cmake executable we used to configure swift. +assert(config.cmake) +config.substitutions.append( ('%cmake', config.cmake) ) +lit_config.note('Using cmake: ' + config.cmake) + # Set llvm_{src,obj}_root for use by others. config.llvm_src_root = getattr(config, 'llvm_src_root', None) config.llvm_obj_root = getattr(config, 'llvm_obj_root', None) +if platform.system() == 'OpenBSD': + llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) + if not llvm_libs_dir: + lit_config.fatal('No LLVM libs dir set.') + config.environment['LD_LIBRARY_PATH'] = llvm_libs_dir + def append_to_env_path(directory): config.environment['PATH'] = \ os.path.pathsep.join((directory, config.environment['PATH'])) @@ -236,6 +247,7 @@ config.sil_nm = inferSwiftBinary('sil-nm') config.sil_passpipeline_dumper = inferSwiftBinary('sil-passpipeline-dumper') config.lldb_moduleimport_test = inferSwiftBinary('lldb-moduleimport-test') config.swift_ide_test = inferSwiftBinary('swift-ide-test') +config.swift_dependency_tool = inferSwiftBinary('swift-dependency-tool') config.swift_syntax_test = inferSwiftBinary('swift-syntax-test') if 'syntax_parser_lib' in config.available_features: config.swift_syntax_parser_test = inferSwiftBinary('swift-syntax-parser-test') @@ -387,6 +399,7 @@ config.substitutions.append( ('%lldb-moduleimport-test-with-sdk', config.substitutions.append( ('%swift-dump-pcm', "%r -dump-pcm" % config.swiftc) ) config.substitutions.append( ('%swift-ide-test_plain', config.swift_ide_test) ) config.substitutions.append( ('%swift-ide-test', "%r %s %s -swift-version %s" % (config.swift_ide_test, mcp_opt, ccp_opt, swift_version)) ) +config.substitutions.append( ('%swift-dependency-tool', config.swift_dependency_tool) ) config.substitutions.append( ('%swift-syntax-test', config.swift_syntax_test) ) if 'syntax_parser_lib' in config.available_features: config.substitutions.append( ('%swift-syntax-parser-test', config.swift_syntax_parser_test) ) diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index a3b4188eb030f..8ae8fb95a8fcd 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -14,6 +14,7 @@ import os import platform import sys +config.cmake = "@CMAKE_COMMAND@" config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" diff --git a/test/refactoring/MemberwiseInit/Outputs/generate_memberwise/class_members.swift.expected b/test/refactoring/MemberwiseInit/Outputs/generate_memberwise/class_members.swift.expected index 8745fd7235738..cb446e83ecae6 100644 --- a/test/refactoring/MemberwiseInit/Outputs/generate_memberwise/class_members.swift.expected +++ b/test/refactoring/MemberwiseInit/Outputs/generate_memberwise/class_members.swift.expected @@ -1,11 +1,13 @@ class Person { -internal init(firstName: String? = nil, lastName: String? = nil, age: Int? = nil, planet: String = "Earth", solarSystem: String = "Milky Way", avgHeight: Int = 175) { +internal init(firstName: String? = nil, lastName: String? = nil, age: Int? = nil, planet: String = "Earth", solarSystem: String = "Milky Way", avgHeight: Int = 175, location: @escaping () -> Place = { fatalError() }, secondLocation: (() -> Place)? = nil) { self.firstName = firstName self.lastName = lastName self.age = age self.planet = planet self.solarSystem = solarSystem self.avgHeight = avgHeight +self.location = location +self.secondLocation = secondLocation } var firstName: String! @@ -15,9 +17,12 @@ self.avgHeight = avgHeight var avgHeight = 175 let line = #line, file = #file, handle = #dsohandle lazy var idea: Idea = { fatalError() }() + var location: () -> Place = { fatalError() } + var secondLocation: (() -> Place)! } struct Place { + typealias Callback = () -> () let person: Person let street: String let apartment: Optional @@ -25,6 +30,7 @@ struct Place { let state: String let postalCode: Int let plusFour: Int? + let callback: Callback } protocol Thing { diff --git a/test/refactoring/MemberwiseInit/Outputs/generate_memberwise/struct_members.swift.expected b/test/refactoring/MemberwiseInit/Outputs/generate_memberwise/struct_members.swift.expected index f16631713528f..710d9b7d82977 100644 --- a/test/refactoring/MemberwiseInit/Outputs/generate_memberwise/struct_members.swift.expected +++ b/test/refactoring/MemberwiseInit/Outputs/generate_memberwise/struct_members.swift.expected @@ -6,10 +6,12 @@ class Person { var avgHeight = 175 let line = #line, file = #file, handle = #dsohandle lazy var idea: Idea = { fatalError() }() + var location: () -> Place = { fatalError() } + var secondLocation: (() -> Place)! } struct Place { -internal init(person: Person, street: String, apartment: Optional, city: String, state: String, postalCode: Int, plusFour: Int?) { +internal init(person: Person, street: String, apartment: Optional, city: String, state: String, postalCode: Int, plusFour: Int?, callback: @escaping Place.Callback) { self.person = person self.street = street self.apartment = apartment @@ -17,8 +19,10 @@ self.city = city self.state = state self.postalCode = postalCode self.plusFour = plusFour +self.callback = callback } + typealias Callback = () -> () let person: Person let street: String let apartment: Optional @@ -26,6 +30,7 @@ self.plusFour = plusFour let state: String let postalCode: Int let plusFour: Int? + let callback: Callback } protocol Thing { diff --git a/test/refactoring/MemberwiseInit/generate_memberwise.swift b/test/refactoring/MemberwiseInit/generate_memberwise.swift index f63e7294dc914..ab3b426e95a4f 100644 --- a/test/refactoring/MemberwiseInit/generate_memberwise.swift +++ b/test/refactoring/MemberwiseInit/generate_memberwise.swift @@ -6,9 +6,12 @@ class Person { var avgHeight = 175 let line = #line, file = #file, handle = #dsohandle lazy var idea: Idea = { fatalError() }() + var location: () -> Place = { fatalError() } + var secondLocation: (() -> Place)! } struct Place { + typealias Callback = () -> () let person: Person let street: String let apartment: Optional @@ -16,6 +19,7 @@ struct Place { let state: String let postalCode: Int let plusFour: Int? + let callback: Callback } protocol Thing { @@ -30,7 +34,7 @@ enum Idea { // RUN: %refactor -memberwise-init -source-filename %s -pos=1:8 > %t.result/generate_memberwise.swift // RUN: diff -u %S/Outputs/generate_memberwise/class_members.swift.expected %t.result/generate_memberwise.swift -// RUN: %refactor -memberwise-init -source-filename %s -pos=11:8 > %t.result/struct_members.swift +// RUN: %refactor -memberwise-init -source-filename %s -pos=13:8 > %t.result/struct_members.swift // RUN: diff -u %S/Outputs/generate_memberwise/struct_members.swift.expected %t.result/struct_members.swift // RUN: not %refactor -memberwise-init -source-filename %s -pos=21:10 > %t.result/protocol_members.swift diff --git a/test/stdlib/simd.swift.gyb b/test/stdlib/simd.swift.gyb index 19953ae6598c8..26fafc6817027 100644 --- a/test/stdlib/simd.swift.gyb +++ b/test/stdlib/simd.swift.gyb @@ -2,7 +2,7 @@ // REQUIRES: executable_test // FIXME: No simd module on linux rdar://problem/20795411 -// XFAIL: linux, windows +// XFAIL: linux, windows, openbsd import simd import StdlibUnittest diff --git a/test/stdlib/simd_diagnostics.swift b/test/stdlib/simd_diagnostics.swift index 2aa1be085bc37..16d48b7bbac4d 100644 --- a/test/stdlib/simd_diagnostics.swift +++ b/test/stdlib/simd_diagnostics.swift @@ -1,7 +1,7 @@ // RUN: %target-typecheck-verify-swift // FIXME: No simd module on linux rdar://problem/20795411 -// XFAIL: linux, windows +// XFAIL: linux, windows, openbsd import simd diff --git a/test/stdlib/symbol-visibility-darwin.test-sh b/test/stdlib/symbol-visibility-darwin.test-sh new file mode 100644 index 0000000000000..e0ddc648fe7cb --- /dev/null +++ b/test/stdlib/symbol-visibility-darwin.test-sh @@ -0,0 +1,21 @@ +// Ensure that we do not export any weak symbols from the dylibs. +// +// Weak symbols require additional work from the loader to resolve the symbol at +// load time and can cause ODR violations as well as unexpected symbol +// satisfaction because the weak symbol may be used from a separate module. + +// RUN: %empty-directory(%t) + +// RUN: %llvm-nm --defined-only --extern-only --demangle %platform-dylib-dir/%target-library-name(swiftCore) > %t/swiftCore-all.txt +// RUN: %llvm-nm --defined-only --extern-only --no-weak --demangle %platform-dylib-dir/%target-library-name(swiftCore) > %t/swiftCore-no-weak.txt +// RUN: diff -u %t/swiftCore-all.txt %t/swiftCore-no-weak.txt + +// RUN: %llvm-nm --defined-only --extern-only --demangle %platform-dylib-dir/%target-library-name(swiftRemoteMirror) > %t/swiftRemoteMirror-all.txt +// RUN: %llvm-nm --defined-only --extern-only --no-weak --demangle %platform-dylib-dir/%target-library-name(swiftRemoteMirror) > %t/swiftRemoteMirror-no-weak.txt +// RUN: diff -u %t/swiftRemoteMirror-all.txt %t/swiftRemoteMirror-no-weak.txt + +// NOTE: swiftDemanging is not checked because it is incorportated into +// swiftCore and swiftRemoteMirror. Both of those checks ensure that the +// symbols are handled properly. + +// REQUIRES: VENDOR=apple diff --git a/test/stdlib/symbol-visibility-linux.test-sh b/test/stdlib/symbol-visibility-linux.test-sh new file mode 100644 index 0000000000000..fd80eb8b3f3c3 --- /dev/null +++ b/test/stdlib/symbol-visibility-linux.test-sh @@ -0,0 +1,60 @@ +// Ensure that we do not export any weak symbols from the dylibs. +// +// Weak symbols require additional work from the loader to resolve the symbol at +// load time and can cause ODR violations as well as unexpected symbol +// satisfaction because the weak symbol may be used from a separate module. + +// NOTE: this test is fragile. It is dependent on the specifics of the GNU C++ +// runtime. The C++ headers from the runtime explicitly force the weak symbols +// to be publicly visible without allowing the user to control the visibility. +// We explicitly filter out the ones that we see being leaked after manually +// validating that they are being leaked because of the forceful nature of +// libstdc++. + +// RUN: %empty-directory(%t) + +// RUN: %llvm-nm --defined-only --extern-only %platform-dylib-dir/%target-library-name(swiftCore) \ +// RUN: | grep -v -e _ZNSt6vectorIjSaIjEE6insertEN9__gnu_cxx17__normal_iteratorIPKjS1_EERS4_ \ +// RUN: -e _ZNSt6vectorIjSaIjEE13_M_insert_auxIJRKjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_ \ +// RUN: -e _ZNSt6vectorIjSaIjEE13_M_insert_auxIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_ \ +// RUN: -e _ZNSt6vectorISt10unique_ptrIKvSt8functionIFvPS1_EEESaIS6_EE19_M_emplace_back_auxIJS6_EEEvDpOT_ \ +// RUN: -e _ZNSt6vectorISt10unique_ptrIKvSt8functionIFvPS1_EEESaIS6_EE17_M_realloc_insertIJS6_EEEvN9__gnu_cxx17__normal_iteratorIPS6_S8_EEDpOT_ \ +// RUN: -e _ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z \ +// RUN: -e _ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEDnEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA1_cEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA8_cEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA24_cEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA32_cEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA40_cEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA88_cEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA104_cEEEvv \ +// RUN: > %t/swiftCore-all.txt +// RUN: %llvm-nm --defined-only --extern-only --no-weak %platform-dylib-dir/%target-library-name(swiftCore) > %t/swiftCore-no-weak.txt +// RUN: diff -u %t/swiftCore-all.txt %t/swiftCore-no-weak.txt + +// RUN: %llvm-nm --defined-only --extern-only %platform-dylib-dir/%target-library-name(swiftRemoteMirror) \ +// RUN: | grep -v -e _ZNSt6vectorIjSaIjEE6insertEN9__gnu_cxx17__normal_iteratorIPKjS1_EERS4_ \ +// RUN: -e _ZNSt6vectorIjSaIjEE13_M_insert_auxIJRKjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_ \ +// RUN: -e _ZNSt6vectorIjSaIjEE13_M_insert_auxIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_ \ +// RUN: -e _ZNSt6vectorISt10unique_ptrIKvSt8functionIFvPS1_EEESaIS6_EE19_M_emplace_back_auxIJS6_EEEvDpOT_ \ +// RUN: -e _ZNSt6vectorISt10unique_ptrIKvSt8functionIFvPS1_EEESaIS6_EE17_M_realloc_insertIJS6_EEEvN9__gnu_cxx17__normal_iteratorIPS6_S8_EEDpOT_ \ +// RUN: -e _ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z \ +// RUN: -e _ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEDnEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA1_cEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA8_cEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA24_cEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA32_cEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA40_cEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA88_cEEEvv \ +// RUN: -e _ZSt16__once_call_implISt12_Bind_simpleIFPFvPvEPA104_cEEEvv \ +// RUN: > %t/swiftRemoteMirror-all.txt +// RUN: %llvm-nm --defined-only --extern-only --no-weak %platform-dylib-dir/%target-library-name(swiftRemoteMirror) > %t/swiftRemoteMirror-no-weak.txt +// RUN: diff -u %t/swiftRemoteMirror-all.txt %t/swiftRemoteMirror-no-weak.txt + +// NOTE: swiftDemanging is not checked because it is incorportated into +// swiftCore and swiftRemoteMirror. Both of those checks ensure that the +// symbols are handled properly. + +// REQUIRES: OS=linux-gnu diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index ede02f0068bb7..2ace899dbdcde 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -17,6 +17,7 @@ endif() add_swift_tool_subdirectory(driver) add_swift_tool_subdirectory(sil-opt) +add_swift_tool_subdirectory(swift-dependency-tool) add_swift_tool_subdirectory(swift-ide-test) add_swift_tool_subdirectory(swift-remoteast-test) add_swift_tool_subdirectory(swift-demangle) diff --git a/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp b/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp index 8e52cf782dc17..eba624bce0d32 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp @@ -507,7 +507,7 @@ bool SwiftASTManager::initCompilerInvocation( bool HadError = driver::getSingleFrontendInvocationFromDriverArguments( Args, Diags, [&](ArrayRef FrontendArgs) { return Invocation.parseArgs(FrontendArgs, Diags); - }); + }, /*ForceNoOutputs=*/true); // Remove the StreamDiagConsumer as it's no longer needed. Diags.removeConsumer(DiagConsumer); diff --git a/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp b/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp index e9749ad813e70..7fb63fd0e8aab 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp @@ -260,7 +260,9 @@ struct SourceTextInfo { } // end anonymous namespace -static void initDocGenericParams(const Decl *D, DocEntityInfo &Info) { +static void initDocGenericParams(const Decl *D, DocEntityInfo &Info, + TypeOrExtensionDecl SynthesizedTarget, + bool IsSynthesizedExt) { auto *GC = D->getAsGenericContext(); if (!GC) return; @@ -276,36 +278,107 @@ static void initDocGenericParams(const Decl *D, DocEntityInfo &Info) { if (ParentSig && ParentSig->isEqual(GenericSig)) return; + + // If we have a synthesized target, map from its base type into the this + // declaration's innermost type context, or if we're dealing with the + // synthesized extention itself rather than a member, into its extended + // nominal (the extension's own requirements shouldn't be considered in the + // substitution). + SubstitutionMap SubMap; + Type BaseType; + if (SynthesizedTarget) { + BaseType = SynthesizedTarget.getBaseNominal()->getDeclaredInterfaceType(); + if (!BaseType->isExistentialType()) { + DeclContext *DC; + if (IsSynthesizedExt) + DC = cast(D)->getExtendedNominal(); + else + DC = D->getInnermostDeclContext()->getInnermostTypeContext(); + auto *M = DC->getParentModule(); + SubMap = BaseType->getContextSubstitutionMap(M, DC); + } + } + + auto SubstTypes = [&](Type Ty) { + return Ty.subst(SubMap, SubstFlags::DesugarMemberTypes); + }; + // FIXME: Not right for extensions of nested generic types if (GC->isGeneric()) { for (auto *GP : GenericSig->getInnermostGenericParams()) { if (GP->getDecl()->isImplicit()) continue; + Type TypeToPrint = GP; + if (!SubMap.empty()) { + if (auto ArgTy = SubstTypes(GP)) { + if (!ArgTy->hasError()) { + // Ignore parameter that aren't generic after substitution + if (!ArgTy->is() && !ArgTy->isTypeParameter()) + continue; + TypeToPrint = ArgTy; + } + } + } DocGenericParam Param; - Param.Name = std::string(GP->getName()); + Param.Name = TypeToPrint->getString(); Info.GenericParams.push_back(Param); } } - ProtocolDecl *proto = nullptr; + ProtocolDecl *Proto = nullptr; if (auto *typeDC = GC->getInnermostTypeContext()) - proto = typeDC->getSelfProtocolDecl(); + Proto = typeDC->getSelfProtocolDecl(); - for (auto &Req : GenericSig->getRequirements()) { - // Skip protocol Self requirement. - if (proto && + for (auto Req: GenericSig->getRequirements()) { + if (Proto && Req.getKind() == RequirementKind::Conformance && - Req.getFirstType()->isEqual(proto->getSelfInterfaceType()) && - Req.getSecondType()->getAnyNominal() == proto) + Req.getFirstType()->isEqual(Proto->getSelfInterfaceType()) && + Req.getSecondType()->getAnyNominal() == Proto) continue; + auto First = Req.getFirstType(); + Type Second; + if (Req.getKind() != RequirementKind::Layout) + Second = Req.getSecondType(); + + if (!SubMap.empty()) { + Type SubFirst = SubstTypes(First); + if (!SubFirst->hasError()) + First = SubFirst; + if (Second) { + Type SubSecond = SubstTypes(Second); + if (!SubSecond->hasError()) + Second = SubSecond; + // Ignore requirements that don't involve a generic after substitution. + if (!(First->is() || First->isTypeParameter()) && + !(Second->is() || Second->isTypeParameter())) + continue; + } + } + std::string ReqStr; - PrintOptions Opts; llvm::raw_string_ostream OS(ReqStr); - Req.print(OS, Opts); + PrintOptions Opts; + if (Req.getKind() != RequirementKind::Layout) { + Requirement(Req.getKind(), First, Second).print(OS, Opts); + } else { + Requirement(Req.getKind(), First, Req.getLayoutConstraint()).print(OS, Opts); + } OS.flush(); Info.GenericRequirements.push_back(std::move(ReqStr)); } + + if (IsSynthesizedExt) { + // If there's a conditional conformance on the base type that 'enabled' this + // extension, we need to print its requirements too. + if (auto *EnablingExt = dyn_cast(SynthesizedTarget.getAsDecl())) { + if (EnablingExt->isConstrainedExtension()) { + initDocGenericParams(EnablingExt, Info, + /*Target=*/EnablingExt->getExtendedNominal(), + /*IsSynthesizedExtension*/false); + } + } + } } static bool initDocEntityInfo(const Decl *D, @@ -376,29 +449,12 @@ static bool initDocEntityInfo(const Decl *D, llvm::SmallString<128> DocBuffer; { llvm::raw_svector_ostream OSS(DocBuffer); - ide::getDocumentationCommentAsXML(D, OSS); + ide::getDocumentationCommentAsXML(D, OSS, SynthesizedTarget); } - StringRef DocRef = (StringRef)DocBuffer; - if (IsSynthesizedExtension && - DocRef.find("") != StringRef::npos) { - StringRef Open = "extension "; - assert(DocRef.find(Open) != StringRef::npos); - auto FirstPart = DocRef.substr(0, DocRef.find(Open) + (Open).size()); - auto SecondPart = DocRef.substr(FirstPart.size()); - auto ExtendedName = ((const ExtensionDecl*)D)->getExtendedNominal() - ->getName().str(); - assert(SecondPart.startswith(ExtendedName)); - SecondPart = SecondPart.substr(ExtendedName.size()); - llvm::SmallString<128> UpdatedDocBuffer; - UpdatedDocBuffer.append(FirstPart); - UpdatedDocBuffer.append(SynthesizedTargetNTD->getName().str()); - UpdatedDocBuffer.append(SecondPart); - OS << UpdatedDocBuffer; - } else - OS << DocBuffer; + OS << DocBuffer; } - initDocGenericParams(D, Info); + initDocGenericParams(D, Info, SynthesizedTarget, IsSynthesizedExtension); llvm::raw_svector_ostream LocalizationKeyOS(Info.LocalizationKey); ide::getLocalizationKey(D, LocalizationKeyOS); @@ -410,14 +466,13 @@ static bool initDocEntityInfo(const Decl *D, VD, SynthesizedTarget, OS); else SwiftLangSupport::printFullyAnnotatedDeclaration(VD, Type(), OS); - } else if (auto *E = dyn_cast(D)) { - if (auto Sig = E->getGenericSignature()) { - // The extension under printing is potentially part of a synthesized - // extension. Thus it's hard to print the fully annotated decl. We - // need to at least print the generic signature here. - llvm::raw_svector_ostream OS(Info.FullyAnnotatedGenericSig); - SwiftLangSupport::printFullyAnnotatedGenericReq(Sig, OS); - } + } else if (auto *ED = dyn_cast(D)) { + llvm::raw_svector_ostream OS(Info.FullyAnnotatedDecl); + if (SynthesizedTarget) + SwiftLangSupport::printFullyAnnotatedSynthesizedDeclaration( + ED, SynthesizedTarget, OS); + else + SwiftLangSupport::printFullyAnnotatedDeclaration(ED, OS); } if (DeclaringModForCrossImport) { @@ -808,15 +863,13 @@ static bool makeParserAST(CompilerInstance &CI, StringRef Text, Invocation.getFrontendOptions().InputsAndOutputs.clearInputs(); Invocation.setModuleName("main"); Invocation.setInputKind(InputFileKind::Swift); + Invocation.getLangOptions().DisablePoundIfEvaluation = true; std::unique_ptr Buf; Buf = llvm::MemoryBuffer::getMemBuffer(Text, ""); Invocation.getFrontendOptions().InputsAndOutputs.addInput( InputFile(Buf.get()->getBufferIdentifier(), false, Buf.get())); - if (CI.setup(Invocation)) - return true; - CI.performParseOnly(); - return false; + return CI.setup(Invocation); } static void collectFuncEntities(std::vector &Ents, @@ -1406,7 +1459,6 @@ SourceFile *SwiftLangSupport::getSyntacticSourceFile( Error = "Compiler invocation set up failed"; return nullptr; } - ParseCI.performParseOnly(/*EvaluateConditionals*/true); SourceFile *SF = nullptr; unsigned BufferID = ParseCI.getInputBufferIDs().back(); diff --git a/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp b/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp index 741da8b022c19..336417b300ecb 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp @@ -719,9 +719,7 @@ class SwiftDocumentSyntaxInfo { } void parse() { - auto root = Parser->parse(); - if (SynTreeCreator) - SynTreeCreator->acceptSyntaxRoot(root, Parser->getSourceFile()); + Parser->parse(); } SourceFile &getSourceFile() { @@ -1615,27 +1613,9 @@ class PlaceholderExpansionScanner { bool walkToExprPre(Expr *E) override { auto SR = E->getSourceRange(); - if (SR.isValid() && SM.rangeContainsTokenLoc(SR, TargetLoc)) { - if (auto closure = dyn_cast(E)) { - if (closure->hasSingleExpressionBody()) { - // Treat a single-expression body like a brace statement and reset - // the enclosing context. Note: when the placeholder is the whole - // body it is handled specially as wrapped in braces by - // shouldUseTrailingClosureInTuple(). - auto SR = closure->getSingleExpressionBody()->getSourceRange(); - if (SR.isValid() && SR.Start != TargetLoc && - SM.rangeContainsTokenLoc(SR, TargetLoc)) { - OuterStmt = nullptr; - OuterExpr = nullptr; - EnclosingCallAndArg = {nullptr, nullptr}; - return true; - } - } - } - - if (!checkCallExpr(E) && !EnclosingCallAndArg.first) { - OuterExpr = E; - } + if (SR.isValid() && SM.rangeContainsTokenLoc(SR, TargetLoc) && + !checkCallExpr(E) && !EnclosingCallAndArg.first) { + OuterExpr = E; } return true; } @@ -1646,11 +1626,30 @@ class PlaceholderExpansionScanner { return true; } + /// Whether this statement body consists of only an implicit "return", + /// possibly within braces. + bool isImplicitReturnBody(Stmt *S) { + if (auto RS = dyn_cast(S)) + return RS->isImplicit() && RS->getSourceRange().Start == TargetLoc; + + if (auto BS = dyn_cast(S)) { + if (BS->getNumElements() == 1) { + if (auto innerS = BS->getFirstElement().dyn_cast()) + return isImplicitReturnBody(innerS); + } + } + + return false; + } + bool walkToStmtPre(Stmt *S) override { auto SR = S->getSourceRange(); - if (SR.isValid() && SM.rangeContainsTokenLoc(SR, TargetLoc)) { + if (SR.isValid() && SM.rangeContainsTokenLoc(SR, TargetLoc) && + !isImplicitReturnBody(S)) { // A statement inside an expression - e.g. `foo({ if ... })` - resets // the enclosing context. + // + // ... unless it's an implicit return. OuterExpr = nullptr; EnclosingCallAndArg = {nullptr, nullptr}; @@ -1766,7 +1765,6 @@ class PlaceholderExpansionScanner { ArrayRef trailingClosures)> MultiClosureCallback, std::function NonClosureCallback) { - SourceLoc PlaceholderStartLoc = SM.getLocForOffset(BufID, Offset); // See if the placeholder is encapsulated with an EditorPlaceholderExpr diff --git a/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp b/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp index 1e9a578011da1..bcbe8d7241599 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp @@ -234,15 +234,13 @@ static bool makeParserAST(CompilerInstance &CI, StringRef Text, Invocation.getFrontendOptions().InputsAndOutputs.clearInputs(); Invocation.setModuleName("main"); Invocation.setInputKind(InputFileKind::Swift); + Invocation.getLangOptions().DisablePoundIfEvaluation = true; std::unique_ptr Buf; Buf = llvm::MemoryBuffer::getMemBuffer(Text, ""); Invocation.getFrontendOptions().InputsAndOutputs.addInput( InputFile(Buf.get()->getBufferIdentifier(), false, Buf.get())); - if (CI.setup(Invocation)) - return true; - CI.performParseOnly(); - return false; + return CI.setup(Invocation); } static void reportSyntacticAnnotations(CompilerInstance &CI, diff --git a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.h b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.h index ed616892598fb..54ec93e8cc149 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.h +++ b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.h @@ -420,14 +420,18 @@ class SwiftLangSupport : public LangSupport { swift::Type BaseTy, llvm::raw_ostream &OS); + static void printFullyAnnotatedDeclaration(const swift::ExtensionDecl *VD, + llvm::raw_ostream &OS); + static void printFullyAnnotatedSynthesizedDeclaration(const swift::ValueDecl *VD, swift::TypeOrExtensionDecl Target, llvm::raw_ostream &OS); static void - printFullyAnnotatedGenericReq(const swift::GenericSignature Sig, - llvm::raw_ostream &OS); + printFullyAnnotatedSynthesizedDeclaration(const swift::ExtensionDecl *ED, + swift::TypeOrExtensionDecl Target, + llvm::raw_ostream &OS); /// Print 'description' or 'sourcetext' the given \p VD to \p OS. If /// \p usePlaceholder is \c true, call argument positions are substituted with diff --git a/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp b/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp index af7daf2e74257..0b24a343de4ec 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp @@ -457,12 +457,11 @@ void SwiftLangSupport::printFullyAnnotatedDeclaration(const ValueDecl *VD, VD->print(Printer, PO); } -void SwiftLangSupport::printFullyAnnotatedGenericReq( - const swift::GenericSignature Sig, llvm::raw_ostream &OS) { - assert(Sig); +void SwiftLangSupport::printFullyAnnotatedDeclaration(const ExtensionDecl *ED, + raw_ostream &OS) { FullyAnnotatedDeclarationPrinter Printer(OS); PrintOptions PO = PrintOptions::printQuickHelpDeclaration(); - Sig->print(Printer, PO); + ED->print(Printer, PO); } void SwiftLangSupport::printFullyAnnotatedSynthesizedDeclaration( @@ -475,6 +474,15 @@ void SwiftLangSupport::printFullyAnnotatedSynthesizedDeclaration( VD->print(Printer, PO); } +void SwiftLangSupport::printFullyAnnotatedSynthesizedDeclaration( + const swift::ExtensionDecl *ED, TypeOrExtensionDecl Target, + llvm::raw_ostream &OS) { + FullyAnnotatedDeclarationPrinter Printer(OS); + PrintOptions PO = PrintOptions::printQuickHelpDeclaration(); + PO.initForSynthesizedExtension(Target); + ED->print(Printer, PO); +} + template void walkRelatedDecls(const ValueDecl *VD, const FnTy &Fn) { llvm::SmallDenseMap NamesSeen; diff --git a/tools/libSwiftSyntaxParser/libSwiftSyntaxParser.cpp b/tools/libSwiftSyntaxParser/libSwiftSyntaxParser.cpp index b564b77981556..faa447f817b01 100644 --- a/tools/libSwiftSyntaxParser/libSwiftSyntaxParser.cpp +++ b/tools/libSwiftSyntaxParser/libSwiftSyntaxParser.cpp @@ -189,6 +189,12 @@ class CLibParseActions : public SyntaxParseActions { return getNodeHandler()(&node); } + Optional realizeSyntaxRoot(OpaqueSyntaxNode root, + const SourceFile &SF) override { + // We don't support realizing syntax nodes from the C layout. + return None; + } + void discardRecordedNode(OpaqueSyntaxNode node) override { // FIXME: This method should not be called at all. } diff --git a/tools/sil-nm/SILNM.cpp b/tools/sil-nm/SILNM.cpp index ab7a8eee4147b..f8c0810ed5285 100644 --- a/tools/sil-nm/SILNM.cpp +++ b/tools/sil-nm/SILNM.cpp @@ -126,8 +126,8 @@ static void nmModule(SILModule *M) { { std::vector VTableNames; llvm::transform(M->getVTables(), std::back_inserter(VTableNames), - [](const SILVTable &VT) -> StringRef { - return VT.getClass()->getName().str(); + [](const SILVTable *VT) -> StringRef { + return VT->getClass()->getName().str(); }); printAndSortNames(VTableNames, 'V'); } diff --git a/tools/swift-dependency-tool/CMakeLists.txt b/tools/swift-dependency-tool/CMakeLists.txt new file mode 100644 index 0000000000000..5b4f1f86626c5 --- /dev/null +++ b/tools/swift-dependency-tool/CMakeLists.txt @@ -0,0 +1,10 @@ +add_swift_host_tool(swift-dependency-tool + swift-dependency-tool.cpp + SWIFT_COMPONENT tools +) +target_link_libraries(swift-dependency-tool + PRIVATE + swiftAST + swiftParse + swiftClangImporter) + diff --git a/tools/swift-dependency-tool/swift-dependency-tool.cpp b/tools/swift-dependency-tool/swift-dependency-tool.cpp new file mode 100644 index 0000000000000..fd60d63c85070 --- /dev/null +++ b/tools/swift-dependency-tool/swift-dependency-tool.cpp @@ -0,0 +1,123 @@ +//===--- swift-dependency-tool.cpp - Convert binary swiftdeps to YAML -----===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +#include "swift/AST/FileSystem.h" +#include "swift/AST/FineGrainedDependencies.h" +#include "swift/AST/DiagnosticEngine.h" +#include "swift/AST/FineGrainedDependencyFormat.h" +#include "swift/Basic/SourceManager.h" +#include "swift/Basic/LLVMInitialize.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/YAMLParser.h" + +using namespace swift; +using namespace fine_grained_dependencies; + +enum class ActionType : unsigned { + None, + BinaryToYAML, + YAMLToBinary +}; + +namespace options { + +static llvm::cl::OptionCategory Category("swift-dependency-tool Options"); + +static llvm::cl::opt +InputFilename("input-filename", + llvm::cl::desc("Name of the input file"), + llvm::cl::cat(Category)); + +static llvm::cl::opt +OutputFilename("output-filename", + llvm::cl::desc("Name of the output file"), + llvm::cl::cat(Category)); + +static llvm::cl::opt +Action(llvm::cl::desc("Mode:"), llvm::cl::init(ActionType::None), + llvm::cl::cat(Category), + llvm::cl::values( + clEnumValN(ActionType::BinaryToYAML, + "to-yaml", "Convert new binary .swiftdeps format to YAML"), + clEnumValN(ActionType::YAMLToBinary, + "from-yaml", "Convert YAML to new binary .swiftdeps format"))); + +} + +int main(int argc, char *argv[]) { + PROGRAM_START(argc, argv); + INITIALIZE_LLVM(); + + llvm::cl::HideUnrelatedOptions(options::Category); + llvm::cl::ParseCommandLineOptions(argc, argv, "Swift Dependency Tool\n"); + + SourceManager sourceMgr; + DiagnosticEngine diags(sourceMgr); + + switch (options::Action) { + case ActionType::None: { + llvm::errs() << "action required\n"; + llvm::cl::PrintHelpMessage(); + return 1; + } + + case ActionType::BinaryToYAML: { + auto fg = SourceFileDepGraph::loadFromPath(options::InputFilename); + if (!fg) { + llvm::errs() << "Failed to read dependency file\n"; + return 1; + } + + bool hadError = + withOutputFile(diags, options::OutputFilename, + [&](llvm::raw_pwrite_stream &out) { + out << fg->yamlProlog(/*hadError=*/false); + llvm::yaml::Output yamlWriter(out); + yamlWriter << *fg; + return false; + }); + + if (hadError) { + llvm::errs() << "Failed to write YAML swiftdeps\n"; + } + break; + } + + case ActionType::YAMLToBinary: { + auto bufferOrError = llvm::MemoryBuffer::getFile(options::InputFilename); + if (!bufferOrError) { + llvm::errs() << "Failed to read dependency file\n"; + return 1; + } + + auto &buffer = *bufferOrError.get(); + + SourceFileDepGraph fg; + llvm::yaml::Input yamlReader(llvm::MemoryBufferRef(buffer), nullptr); + yamlReader >> fg; + if (yamlReader.error()) { + llvm::errs() << "Failed to parse YAML swiftdeps\n"; + return 1; + } + + if (writeFineGrainedDependencyGraph(diags, options::OutputFilename, fg)) { + llvm::errs() << "Failed to write binary swiftdeps\n"; + return 1; + } + + break; + } + } + + return 0; +} diff --git a/tools/swift-ide-test/swift-ide-test.cpp b/tools/swift-ide-test/swift-ide-test.cpp index 08a8b008e60a2..a0401c1581dc1 100644 --- a/tools/swift-ide-test/swift-ide-test.cpp +++ b/tools/swift-ide-test/swift-ide-test.cpp @@ -1707,6 +1707,9 @@ static int doPrintAST(const CompilerInvocation &InitInvok, CompilerInvocation Invocation(InitInvok); Invocation.getFrontendOptions().InputsAndOutputs.addInputFile(SourceFilename); + if (!RunTypeChecker) + Invocation.getLangOptions().DisablePoundIfEvaluation = true; + CompilerInstance CI; // Display diagnostics to stderr. @@ -1724,9 +1727,7 @@ static int doPrintAST(const CompilerInvocation &InitInvok, CI.getMainModule()->setDebugClient(DebuggerClient.get()); } - if (!RunTypeChecker) - CI.performParseOnly(); - else + if (RunTypeChecker) CI.performSema(); if (MangledNameToFind.empty()) { @@ -3224,7 +3225,7 @@ static int doPrintUSRs(const CompilerInvocation &InitInvok, return 0; } -static int doTestCreateCompilerInvocation(ArrayRef Args) { +static int doTestCreateCompilerInvocation(ArrayRef Args, bool ForceNoOutputs) { PrintingDiagnosticConsumer PDC; SourceManager SM; DiagnosticEngine Diags(SM); @@ -3233,8 +3234,13 @@ static int doTestCreateCompilerInvocation(ArrayRef Args) { CompilerInvocation CI; bool HadError = driver::getSingleFrontendInvocationFromDriverArguments( Args, Diags, [&](ArrayRef FrontendArgs) { + llvm::outs() << "Frontend Arguments BEGIN\n"; + for (const char *arg : FrontendArgs) { + llvm::outs() << arg << "\n"; + } + llvm::outs() << "Frontend Arguments END\n"; return CI.parseArgs(FrontendArgs, Diags); - }); + }, ForceNoOutputs); if (HadError) { llvm::errs() << "error: unable to create a CompilerInvocation\n"; @@ -3272,8 +3278,13 @@ int main(int argc, char *argv[]) { // llvm::cl::ParseCommandLineOptions. StringRef FirstArg(argv[1]); if (FirstArg == "-test-createCompilerInvocation") { + bool ForceNoOutputs = false; ArrayRef Args(argv + 2, argc - 2); - return doTestCreateCompilerInvocation(Args); + if (argc > 2 && StringRef(argv[2]) == "-force-no-outputs") { + ForceNoOutputs = true; + Args = Args.drop_front(); + } + return doTestCreateCompilerInvocation(Args, ForceNoOutputs); } } diff --git a/tools/swift-refactor/swift-refactor.cpp b/tools/swift-refactor/swift-refactor.cpp index 2bc77c2b7d684..06c1f5db45ce7 100644 --- a/tools/swift-refactor/swift-refactor.cpp +++ b/tools/swift-refactor/swift-refactor.cpp @@ -268,7 +268,7 @@ int main(int argc, char *argv[]) { switch (options::Action) { case RefactoringKind::GlobalRename: case RefactoringKind::FindGlobalRenameRanges: - CI.performParseOnly(/*EvaluateConditionals*/true); + // No type-checking required. break; default: CI.performSema(); diff --git a/tools/swift-syntax-test/swift-syntax-test.cpp b/tools/swift-syntax-test/swift-syntax-test.cpp index a6fb8ad47f403..c492162111927 100644 --- a/tools/swift-syntax-test/swift-syntax-test.cpp +++ b/tools/swift-syntax-test/swift-syntax-test.cpp @@ -609,7 +609,10 @@ int parseFile( Invocation.getLangOptions().ParseForSyntaxTreeOnly = true; Invocation.getLangOptions().VerifySyntaxTree = options::VerifySyntaxTree; Invocation.getLangOptions().RequestEvaluatorGraphVizPath = options::GraphVisPath; + Invocation.getLangOptions().DisablePoundIfEvaluation = true; + Invocation.getFrontendOptions().InputsAndOutputs.addInputFile(InputFileName); + if (InputFileName.endswith(".swiftinterface")) Invocation.setInputKind(InputFileKind::SwiftModuleInterface); Invocation.setMainExecutablePath( @@ -633,9 +636,6 @@ int parseFile( assert(BufferIDs.size() == 1 && "Only expecting to process one source file"); unsigned BufferID = BufferIDs.front(); - // Parse the actual source file - Instance.performParseOnly(); - SourceFile *SF = nullptr; for (auto Unit : Instance.getMainModule()->getFiles()) { SF = dyn_cast(Unit); @@ -645,6 +645,9 @@ int parseFile( } assert(SF && "No source file"); + // Force parsing to populate the syntax cache. + (void)SF->getSyntaxRoot(); + // In case the action specific callback succeeds, we output this error code int InternalExitCode = EXIT_SUCCESS; diff --git a/unittests/AST/ArithmeticEvaluator.cpp b/unittests/AST/ArithmeticEvaluator.cpp index 00c3a495d9a32..34a0f735cafdd 100644 --- a/unittests/AST/ArithmeticEvaluator.cpp +++ b/unittests/AST/ArithmeticEvaluator.cpp @@ -222,7 +222,7 @@ TEST(ArithmeticEvaluator, Simple) { LangOptions opts; opts.DebugDumpCycles = false; opts.BuildRequestDependencyGraph = true; - opts.EnableExperientalPrivateIntransitiveDependencies = false; + opts.DirectIntramoduleDependencies = false; Evaluator evaluator(diags, opts); evaluator.registerRequestFunctions(Zone::ArithmeticEvaluator, arithmeticRequestFunctions); @@ -349,7 +349,7 @@ TEST(ArithmeticEvaluator, Cycle) { LangOptions opts; opts.DebugDumpCycles = false; opts.BuildRequestDependencyGraph = false; - opts.EnableExperientalPrivateIntransitiveDependencies = false; + opts.DirectIntramoduleDependencies = false; Evaluator evaluator(diags, opts); evaluator.registerRequestFunctions(Zone::ArithmeticEvaluator, arithmeticRequestFunctions); diff --git a/unittests/AST/TestContext.cpp b/unittests/AST/TestContext.cpp index eb2439f3bc27e..9cd85e28bd428 100644 --- a/unittests/AST/TestContext.cpp +++ b/unittests/AST/TestContext.cpp @@ -43,7 +43,7 @@ TestContext::TestContext(ShouldDeclareOptionalTypes optionals) Ctx.LoadedModules[stdlibID] = module; FileForLookups = new (Ctx) SourceFile(*module, SourceFileKind::Library, - /*buffer*/ None, /*keeps token*/ false); + /*buffer*/ None); module->addFile(*FileForLookups); if (optionals == DeclareOptionalTypes) { @@ -53,7 +53,11 @@ TestContext::TestContext(ShouldDeclareOptionalTypes optionals) optionalTypes.push_back(createOptionalType( Ctx, FileForLookups, Ctx.getIdentifier("ImplicitlyUnwrappedOptional"))); + auto result = SourceFileParsingResult{ + Ctx.AllocateCopy(optionalTypes), /*tokens*/ None, + /*interfaceHash*/ None, /*syntaxRoot*/ None}; + Ctx.evaluator.cacheOutput(ParseSourceFileRequest{FileForLookups}, - Ctx.AllocateCopy(optionalTypes)); + std::move(result)); } } diff --git a/unittests/Driver/TypeBodyFingerprintsDependencyGraphTests.cpp b/unittests/Driver/TypeBodyFingerprintsDependencyGraphTests.cpp index b42543e57136e..c47007edc4297 100644 --- a/unittests/Driver/TypeBodyFingerprintsDependencyGraphTests.cpp +++ b/unittests/Driver/TypeBodyFingerprintsDependencyGraphTests.cpp @@ -807,10 +807,10 @@ TEST(ModuleDepGraph, UseFingerprints) { { const auto jobs = simulateReload(graph, &job0, {{NodeKind::nominal, {"A1@11", "A2@2"}}}); - EXPECT_EQ(2u, jobs.size()); + EXPECT_EQ(3u, jobs.size()); EXPECT_TRUE(contains(jobs, &job0)); EXPECT_TRUE(contains(jobs, &job1)); - EXPECT_FALSE(contains(jobs, &job2)); + EXPECT_TRUE(contains(jobs, &job2)); EXPECT_FALSE(contains(jobs, &job3)); } } diff --git a/utils/build-presets.ini b/utils/build-presets.ini index d51ca412f28f6..d8f302ffe4cc1 100644 --- a/utils/build-presets.ini +++ b/utils/build-presets.ini @@ -39,6 +39,7 @@ build-ninja build-swift-stdlib-unittest-extra +install-llvm install-swift # Path to the root of the installation filesystem. @@ -391,6 +392,7 @@ skip-test-ios skip-test-tvos skip-test-watchos +install-llvm install-swift install-llbuild install-swiftpm @@ -602,6 +604,7 @@ llbuild swiftpm indexstore-db sourcekit-lsp +install-llvm install-swift install-llbuild install-swiftpm @@ -790,6 +793,7 @@ libcxx dash-dash build-ninja +install-llvm install-swift install-lldb install-llbuild @@ -908,6 +912,7 @@ host-test extra-cmake-options=-DSWIFT_ENABLE_LLD_LINKER:BOOL=OFF install-prefix=/usr +install-llvm install-swift install-libicu install-libcxx @@ -1016,6 +1021,7 @@ build-subdir=buildbot_linux dash-dash +install-llvm install-swift install-lldb install-llbuild @@ -1076,6 +1082,7 @@ indexstore-db sourcekit-lsp dash-dash +install-llvm install-swift install-llbuild install-libicu @@ -1117,6 +1124,7 @@ build-subdir=buildbot_incremental_tsan_libdispatch_test llvm-cmake-options=-DLLVM_INSTALL_UTILS=ON llvm-install-components=all +install-llvm libdispatch-cmake-options=-DENABLE_SWIFT=OFF libdispatch @@ -1208,6 +1216,7 @@ verbose-build build-ninja build-swift-stdlib-unittest-extra +install-llvm install-swift install-lldb install-llbuild @@ -1433,6 +1442,7 @@ build-swift-stdlib-unittest-extra libcxx # Install swift and libcxx +install-llvm install-swift install-libcxx @@ -1481,6 +1491,7 @@ swiftsyntax-verify-generated-files # Build sourcekit-lsp & indexstore-db indexstore-db sourcekit-lsp +install-llvm install-swift install-llbuild install-swiftpm @@ -1547,6 +1558,7 @@ libcxx llbuild swiftpm +install-llvm install-swift install-llbuild install-swiftpm @@ -1793,6 +1805,7 @@ install-foundation install-libdispatch install-libicu install-libcxx +install-llvm install-swift install-llbuild install-swiftpm @@ -1828,6 +1841,7 @@ skip-build-cmark skip-build-llvm skip-build-llbuild skip-build-benchmarks +install-llvm install-swift install-prefix=%(install_toolchain_dir)s/usr build-swift-examples=0 @@ -2245,6 +2259,7 @@ no-assertions build-libparser-only verbose-build darwin-install-extract-symbols +install-llvm install-swift @@ -2338,6 +2353,7 @@ build-ninja llbuild swiftpm install-llbuild +install-llvm install-swift install-swiftpm reconfigure diff --git a/utils/build-script b/utils/build-script index 93ae848fa1fa9..4d47122f20c03 100755 --- a/utils/build-script +++ b/utils/build-script @@ -35,6 +35,7 @@ from build_swift.build_swift.constants import SWIFT_SOURCE_ROOT import six +from swift_build_support.swift_build_support import build_graph from swift_build_support.swift_build_support import products from swift_build_support.swift_build_support import shell from swift_build_support.swift_build_support import targets @@ -375,6 +376,10 @@ class BuildScriptInvocation(object): self.build_libparser_only = args.build_libparser_only + @property + def install_all(self): + return self.args.install_all or self.args.infer_dependencies + def build_ninja(self): if not os.path.exists(self.workspace.source_dir("ninja")): fatal_error( @@ -451,7 +456,13 @@ class BuildScriptInvocation(object): ] # Compute any product specific cmake arguments. - for product_class in self.compute_product_classes(): + # + # NOTE: The sum(list(...)) is b/c compute_product_classes returns a + # tuple of lists of which the first is the build-script-impl products + # and the second is the non-build-script-impl-products. It guarantees + # that when we concatenate these two lists together we get a valid + # dependency graph. + for product_class in sum(list(self.compute_product_classes()), []): if not product_class.is_build_script_impl_product(): continue @@ -542,20 +553,28 @@ class BuildScriptInvocation(object): # Currently we do not build external benchmarks by default. if args.build_external_benchmarks: impl_args += ["--skip-build-external-benchmarks=0"] - if not args.build_foundation: - impl_args += ["--skip-build-foundation"] - if not args.build_xctest: - impl_args += ["--skip-build-xctest"] - if not args.build_lldb: - impl_args += ["--skip-build-lldb"] - if not args.build_llbuild: - impl_args += ["--skip-build-llbuild"] - if not args.build_libcxx: - impl_args += ["--skip-build-libcxx"] - if not args.build_libdispatch: - impl_args += ["--skip-build-libdispatch"] - if not args.build_libicu: - impl_args += ["--skip-build-libicu"] + + # Then add subproject install flags that either skip building them /or/ + # if we are going to build them and install_all is set, we also install + # them. + conditional_subproject_configs = [ + (args.build_cmark, "cmark"), + (args.build_llvm, "llvm"), + (args.build_swift, "swift"), + (args.build_foundation, "foundation"), + (args.build_xctest, "xctest"), + (args.build_lldb, "lldb"), + (args.build_llbuild, "llbuild"), + (args.build_libcxx, "libcxx"), + (args.build_libdispatch, "libdispatch"), + (args.build_libicu, "libicu") + ] + for (should_build, string_name) in conditional_subproject_configs: + if not should_build and not self.args.infer_dependencies: + impl_args += ["--skip-build-{}".format(string_name)] + elif self.install_all: + impl_args += ["--install-{}".format(string_name)] + if args.build_swift_dynamic_stdlib: impl_args += ["--build-swift-dynamic-stdlib"] if args.build_swift_static_stdlib: @@ -746,6 +765,11 @@ class BuildScriptInvocation(object): os.path.abspath(args.coverage_db) ] + if args.llvm_install_components: + impl_args += [ + "--llvm-install-components=%s" % args.llvm_install_components + ] + # Compute the set of host-specific variables, which we pass through to # the build script via environment variables. host_specific_variables = self.compute_host_specific_variables() @@ -793,33 +817,44 @@ class BuildScriptInvocation(object): return options def compute_product_classes(self): - """compute_product_classes() -> list + """compute_product_classes() -> (list, list) + + Compute the list first of all build-script-impl products and then all + non-build-script-impl products. It is assumed that concatenating the two + lists together will result in a valid dependency graph for the + compilation. - Compute the list of all Product classes used in this build. This list - is constructed in dependency order. """ # FIXME: This is a weird division (returning a list of class objects), # but it matches the existing structure of the `build-script-impl`. - - product_classes = [] - product_classes.append(products.CMark) - product_classes.append(products.LLVM) + impl_product_classes = [] + if self.args.build_cmark: + impl_product_classes.append(products.CMark) + if self.args.build_llvm: + impl_product_classes.append(products.LLVM) if self.args.build_libcxx: - product_classes.append(products.LibCXX) + impl_product_classes.append(products.LibCXX) if self.args.build_libicu: - product_classes.append(products.LibICU) - product_classes.append(products.Swift) + impl_product_classes.append(products.LibICU) + if self.args.build_swift: + impl_product_classes.append(products.Swift) if self.args.build_lldb: - product_classes.append(products.LLDB) + impl_product_classes.append(products.LLDB) if self.args.build_libdispatch: - product_classes.append(products.LibDispatch) + impl_product_classes.append(products.LibDispatch) if self.args.build_foundation: - product_classes.append(products.Foundation) + impl_product_classes.append(products.Foundation) if self.args.build_xctest: - product_classes.append(products.XCTest) + impl_product_classes.append(products.XCTest) if self.args.build_llbuild: - product_classes.append(products.LLBuild) + impl_product_classes.append(products.LLBuild) + # Sanity check that all of our impl classes are actually + # build_script_impl products. + for prod in impl_product_classes: + assert(prod.is_build_script_impl_product()) + + product_classes = [] if self.args.build_swiftpm: product_classes.append(products.SwiftPM) if self.args.build_swiftsyntax: @@ -844,7 +879,36 @@ class BuildScriptInvocation(object): product_classes.append(products.SwiftInspect) if self.args.tsan_libdispatch_test: product_classes.append(products.TSanLibDispatch) - return product_classes + # Sanity check that all of our non-impl classes are actually + # not build_script_impl products. + for prod in product_classes: + assert(not prod.is_build_script_impl_product()) + + # Now that we have our two lists of product_classes, if we are asked to + # infer dependencies, infer the dependencies now and then re-split the + # list. + if self.args.infer_dependencies: + combined = impl_product_classes + product_classes + + # Now that we have produced the schedule, resplit. We require our + # dependencies to respect our build-script-impl property. This means + # that no build-script-impl products can have dependencies on + # non-build-script-impl products. Otherwise, it would be unsafe to + # re-order build-script-impl products in front of non + # build-script-impl products. + impl_product_classes = [] + product_classes = [] + is_darwin = platform.system() == 'Darwin' + final_schedule = build_graph.produce_scheduled_build(combined)[0] + for p in final_schedule: + if is_darwin and p.is_nondarwin_only_build_product(): + continue + + if p.is_build_script_impl_product(): + impl_product_classes.append(p) + else: + product_classes.append(p) + return (impl_product_classes, product_classes) def execute(self): """Execute the invocation with the configured arguments.""" @@ -872,10 +936,7 @@ class BuildScriptInvocation(object): # # FIXME: This should really be per-host, but the current structure # matches that of `build-script-impl`. - product_classes = self.compute_product_classes() - - impl_product_classes = [cls for cls in product_classes - if cls.is_build_script_impl_product()] + (impl_product_classes, product_classes) = self.compute_product_classes() # Execute each "pass". @@ -935,7 +996,8 @@ class BuildScriptInvocation(object): print("--- Running tests for %s ---" % product_name) product.test(host_target) print("--- Finished tests for %s ---" % product_name) - if product.should_install(host_target): + if product.should_install(host_target) or \ + (self.install_all and product.should_build(host_target)): print("--- Installing %s ---" % product_name) product.install(host_target) diff --git a/utils/build-script-impl b/utils/build-script-impl index 41c5fa5572948..e7414a74486e5 100755 --- a/utils/build-script-impl +++ b/utils/build-script-impl @@ -2656,12 +2656,13 @@ for host in "${ALL_HOSTS[@]}"; do fi ;; llvm) - if [[ -z "${LLVM_INSTALL_COMPONENTS}" ]] ; then + if [[ -z "${INSTALL_LLVM}" ]] ; then continue fi - if [[ "${LLVM_INSTALL_COMPONENTS}" == "all" ]]; then + + if [[ "${LLVM_INSTALL_COMPONENTS}" == "all" ]] ; then INSTALL_TARGETS=install - else + elif [[ -n "${LLVM_INSTALL_COMPONENTS}" ]] ; then INSTALL_TARGETS=install-$(echo ${LLVM_INSTALL_COMPONENTS} | sed -E 's/;/ install-/g') fi ;; diff --git a/utils/build_swift/build_swift/defaults.py b/utils/build_swift/build_swift/defaults.py index 59e35ab815a11..c864deea795f3 100644 --- a/utils/build_swift/build_swift/defaults.py +++ b/utils/build_swift/build_swift/defaults.py @@ -14,6 +14,7 @@ from __future__ import absolute_import, unicode_literals +import os import platform from . import shell @@ -113,6 +114,19 @@ def _default_swift_lto_link_jobs(): SWIFT_MAX_PARALLEL_LTO_LINK_JOBS = _default_swift_lto_link_jobs() +def llvm_install_components(): + """Convenience function for getting the default llvm install components for + platforms. + """ + components = ['llvm-cov', 'llvm-profdata', 'IndexStore', 'clang', + 'clang-resource-headers', 'compiler-rt', 'clangd'] + if os.sys.platform == 'darwin': + components.extend(['llvm-dsymutil']) + else: + components.extend(['lld']) + return ';'.join(components) + + # Options that can only be "configured" by editing this file. # # These options are not exposed as command line options on purpose. If you diff --git a/utils/build_swift/build_swift/driver_arguments.py b/utils/build_swift/build_swift/driver_arguments.py index fbf4f633c221e..04d5eef190834 100644 --- a/utils/build_swift/build_swift/driver_arguments.py +++ b/utils/build_swift/build_swift/driver_arguments.py @@ -345,6 +345,8 @@ def create_argument_parser(): help='the path to install debug symbols into') option('--install-destdir', store_path, help='the path to use as the filesystem root for the installation') + option('--install-all', toggle_true, + help='Assume all built products should be installed') option(['-j', '--jobs'], store_int('build_jobs'), default=multiprocessing.cpu_count(), @@ -497,6 +499,10 @@ def create_argument_parser(): option('--coverage-db', store_path, help='coverage database to use when prioritizing testing') + option('--llvm-install-components', store, + default=defaults.llvm_install_components(), + help='A semi-colon split list of llvm components to install') + # ------------------------------------------------------------------------- in_group('Host and cross-compilation targets') @@ -541,6 +547,9 @@ def create_argument_parser(): # ------------------------------------------------------------------------- in_group('Options to select projects') + option('--infer', store_true('infer_dependencies'), + help='Infer any downstream dependencies from enabled projects') + option(['-l', '--lldb'], store_true('build_lldb'), help='build LLDB') @@ -1092,6 +1101,16 @@ def create_argument_parser(): # ------------------------------------------------------------------------- in_group('Build-script-impl arguments (for disambiguation)') + + # We need to represent these options so that we can skip installing them if + # the user is running in install-all mode. + option('--skip-build-cmark', toggle_false('build_cmark'), + help='skip building cmark') + option('--skip-build-llvm', toggle_false('build_llvm'), + help='skip building llvm') + option('--skip-build-swift', toggle_false('build_swift'), + help='skip building swift') + # We need to list --skip-test-swift explicitly because otherwise argparse # will auto-expand arguments like --skip-test-swift to the only known # argument --skip-test-swiftevolve. diff --git a/utils/build_swift/tests/build_swift/test_presets.py b/utils/build_swift/tests/build_swift/test_presets.py index 2436a5bd66153..2668d7a8d790f 100644 --- a/utils/build_swift/tests/build_swift/test_presets.py +++ b/utils/build_swift/tests/build_swift/test_presets.py @@ -39,6 +39,7 @@ 'extra_swift_args': '', 'install_destdir': '/tmp/install', 'install_symroot': '/tmp/install/symroot', + 'install_all': False, 'install_toolchain_dir': '/tmp/install/toolchain', 'install_prefix': '/usr', 'installable_package': '/tmp/install/pkg', diff --git a/utils/build_swift/tests/expected_options.py b/utils/build_swift/tests/expected_options.py index 7da789ba0984b..160fdcd8e2fe5 100644 --- a/utils/build_swift/tests/expected_options.py +++ b/utils/build_swift/tests/expected_options.py @@ -61,6 +61,9 @@ 'build_cygwin': True, 'build_external_benchmarks': False, 'build_foundation': False, + 'build_cmark': True, + 'build_swift': True, + 'build_llvm': True, 'build_freebsd': True, 'build_ios': True, 'build_ios_device': False, @@ -159,9 +162,11 @@ 'host_test': False, 'only_executable_test': False, 'only_non_executable_test': False, + 'infer_dependencies': False, 'install_prefix': targets.install_prefix(), 'install_symroot': None, 'install_destdir': None, + 'install_all': False, 'ios': False, 'ios_all': False, 'legacy_impl': False, @@ -236,7 +241,8 @@ 'validation_test': None, 'verbose_build': False, 'watchos': False, - 'watchos_all': False + 'watchos_all': False, + 'llvm_install_components': defaults.llvm_install_components(), } @@ -481,6 +487,7 @@ class BuildScriptImplOption(_BaseOption): SetTrueOption('-p', dest='build_swiftpm'), SetTrueOption('--legacy-impl', dest='legacy_impl'), + SetTrueOption('--infer', dest='infer_dependencies'), EnableOption('--android'), EnableOption('--build-external-benchmarks'), @@ -536,6 +543,10 @@ class BuildScriptImplOption(_BaseOption): EnableOption('--watchos'), EnableOption('--xctest', dest='build_xctest'), + DisableOption('--skip-build-cmark', dest='build_cmark'), + DisableOption('--skip-build-llvm', dest='build_llvm'), + DisableOption('--skip-build-swift', dest='build_swift'), + DisableOption('--skip-build-android', dest='build_android'), DisableOption('--skip-build-benchmarks', dest='build_benchmarks'), DisableOption('--skip-build-cygwin', dest='build_cygwin'), @@ -631,6 +642,7 @@ class BuildScriptImplOption(_BaseOption): PathOption('--install-prefix'), PathOption('--install-symroot'), PathOption('--install-destdir'), + EnableOption('--install-all'), PathOption('--symbols-package'), PathOption('--cmake-c-launcher'), PathOption('--cmake-cxx-launcher'), @@ -675,4 +687,6 @@ class BuildScriptImplOption(_BaseOption): IgnoreOption('--ios-all'), IgnoreOption('--tvos-all'), IgnoreOption('--watchos-all'), + + StrOption('--llvm-install-components'), ] diff --git a/utils/swift_build_support/swift_build_support/build_graph.py b/utils/swift_build_support/swift_build_support/build_graph.py new file mode 100644 index 0000000000000..70f2ecccb739a --- /dev/null +++ b/utils/swift_build_support/swift_build_support/build_graph.py @@ -0,0 +1,164 @@ +# swift_build_support/build_graph.py ----------------------------*- python -*- +# +# This source file is part of the Swift.org open source project +# +# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See https://swift.org/LICENSE.txt for license information +# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +# +# ---------------------------------------------------------------------------- +# +# This is a simple implementation of an acyclic build graph. We require no +# cycles, so we just perform a reverse post order traversal to get a topological +# ordering. We check during the reverse post order traversal that we do not +# visit any node multiple times. +# +# Nodes are assumed to be a product's class. +# +# ---------------------------------------------------------------------------- + + +def _get_po_ordered_nodes(root, invertedDepMap): + # Then setup our worklist/visited node set. + worklist = [root] + visitedNodes = set([]) + # TODO: Can we unify po_ordered_nodes and visitedNodes in some way? + po_ordered_nodes = [] + + # Until we no longer have nodes to visit... + while not len(worklist) == 0: + # First grab the last element of the worklist. If we have already + # visited this node, just pop it and skip it. + # + # DISCUSSION: Consider the following build graph: + # + # A -> [C, B] + # B -> [C] + # + # In this case, we will most likely get the following worklist + # before actually processing anything: + # + # A, C, B, C + # + # In this case, we want to ignore the initial C pushed onto the + # worklist by visiting A since we will have visited C already due to + # the edge from B -> C. + node = worklist[-1] + if node in visitedNodes: + worklist.pop() + continue + + # Then grab the dependents of our node. + deps = invertedDepMap.get(node, set([])) + assert(isinstance(deps, set)) + + # Then visit those and see if we have not visited any of them. Push + # any such nodes onto the worklist and continue. If we have already + # visited all of our dependents, then we can actually process this + # node. + foundDep = False + for d in deps: + if d not in visitedNodes: + foundDep = True + worklist.append(d) + if foundDep: + continue + + # Now process the node by popping it off the worklist, adding it to + # the visited nodes set, and append it to the po_ordered_nodes in + # its final position. + worklist.pop() + visitedNodes.add(node) + po_ordered_nodes.append(node) + return po_ordered_nodes + + +class BuildDAG(object): + + def __init__(self): + self.root = None + + # A map from a node to a list of nodes that depend on the given node. + # + # NOTE: This is an inverted dependency map implying that the root will + # be a "final element" of the graph. + self.invertedDepMap = {} + + def add_edge(self, pred, succ): + self.invertedDepMap.setdefault(pred, set([succ])) \ + .add(succ) + + def set_root(self, root): + # Assert that we always only have one root. + assert(self.root is None) + self.root = root + + def produce_schedule(self): + # Grab the root and make sure it is not None + root = self.root + assert(root is not None) + + # Then perform a post order traversal from root using our inverted + # dependency map to compute a list of our nodes in post order. + # + # NOTE: The index of each node in this list is the post order number of + # the node. + po_ordered_nodes = _get_po_ordered_nodes(root, self.invertedDepMap) + + # Ok, we have our post order list. We want to provide our user a reverse + # post order, so we take our array and construct a dictionary of an + # enumeration of the list. This will give us a dictionary mapping our + # product names to their reverse post order number. + rpo_ordered_nodes = list(reversed(po_ordered_nodes)) + node_to_rpot_map = dict((y, x) for x, y in enumerate(rpo_ordered_nodes)) + + # Now before we return our rpo_ordered_nodes and our node_to_rpot_map, lets + # verify that we didn't find any cycles. We can do this by traversing + # our dependency graph in reverse post order and making sure all + # dependencies of each node we visit has a later reverse post order + # number than the node we are checking. + for n, node in enumerate(rpo_ordered_nodes): + for dep in self.invertedDepMap.get(node, []): + if node_to_rpot_map[dep] < n: + print('n: {}. node: {}.'.format(n, node)) + print('dep: {}.'.format(dep)) + print('inverted dependency map: {}'.format(self.invertedDepMap)) + print('rpo ordered nodes: {}'.format(rpo_ordered_nodes)) + print('rpo node to rpo number map: {}'.format(node_to_rpot_map)) + raise RuntimeError('Found cycle in build graph!') + + return (rpo_ordered_nodes, node_to_rpot_map) + + +def produce_scheduled_build(input_product_classes): + """For a given a subset input_input_product_classes of + all_input_product_classes, compute a topological ordering of the + input_input_product_classes + topological closures that respects the + dependency graph. + """ + dag = BuildDAG() + worklist = list(input_product_classes) + visited = set(input_product_classes) + + # Construct the DAG. + while len(worklist) > 0: + entry = worklist.pop() + deps = entry.get_dependencies() + if len(deps) == 0: + dag.set_root(entry) + for d in deps: + dag.add_edge(d, entry) + if d not in visited: + worklist.append(d) + visited = visited.union(deps) + + # Then produce the schedule. + schedule = dag.produce_schedule() + + # Finally check that all of our input_product_classes are in the schedule. + if len(set(input_product_classes) - set(schedule[0])) != 0: + raise RuntimeError('Found disconnected graph?!') + + return schedule diff --git a/utils/swift_build_support/swift_build_support/cmake.py b/utils/swift_build_support/swift_build_support/cmake.py index 876caf175392a..85a97dfa747e2 100644 --- a/utils/swift_build_support/swift_build_support/cmake.py +++ b/utils/swift_build_support/swift_build_support/cmake.py @@ -272,7 +272,7 @@ def check_cmake_version(self, source_root, build_root): cmake_binary = 'cmake' installed_ver = self.installed_cmake_version(cmake_binary) - if installed_ver > self.cmake_source_version(cmake_source_dir): + if installed_ver >= self.cmake_source_version(cmake_source_dir): return else: # Build CMake from source and return the path to the executable. diff --git a/utils/swift_build_support/swift_build_support/products/benchmarks.py b/utils/swift_build_support/swift_build_support/products/benchmarks.py index 65232f8060fdc..cac1e241e4451 100644 --- a/utils/swift_build_support/swift_build_support/products/benchmarks.py +++ b/utils/swift_build_support/swift_build_support/products/benchmarks.py @@ -13,7 +13,17 @@ import os import platform +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llbuild +from . import llvm from . import product +from . import swift +from . import swiftpm +from . import xctest from .. import shell from .. import targets @@ -57,6 +67,19 @@ def should_install(self, host_target): def install(self, host_target): pass + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM] + def run_build_script_helper(host_target, product, args): toolchain_path = args.install_destdir diff --git a/utils/swift_build_support/swift_build_support/products/cmark.py b/utils/swift_build_support/swift_build_support/products/cmark.py index d6a189dbb405d..cac4f2e03d1b9 100644 --- a/utils/swift_build_support/swift_build_support/products/cmark.py +++ b/utils/swift_build_support/swift_build_support/products/cmark.py @@ -14,4 +14,15 @@ class CMark(product.Product): - pass + @classmethod + def is_build_script_impl_product(cls): + """is_build_script_impl_product -> bool + + Whether this product is produced by build-script-impl. + """ + return True + + # This is the root of the build-graph, so it doesn't have any dependencies. + @classmethod + def get_dependencies(cls): + return [] diff --git a/utils/swift_build_support/swift_build_support/products/foundation.py b/utils/swift_build_support/swift_build_support/products/foundation.py index d3d626fbd8120..99a362ac82693 100644 --- a/utils/swift_build_support/swift_build_support/products/foundation.py +++ b/utils/swift_build_support/swift_build_support/products/foundation.py @@ -10,10 +10,24 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import libcxx +from . import libdispatch +from . import libicu +from . import llvm from . import product +from . import swift class Foundation(product.Product): + @classmethod + def is_build_script_impl_product(cls): + """is_build_script_impl_product -> bool + + Whether this product is produced by build-script-impl. + """ + return True + @classmethod def product_source_name(cls): """product_source_name() -> str @@ -21,3 +35,16 @@ def product_source_name(cls): The name of the source code directory of this product. """ return "swift-corelibs-foundation" + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch] + + @classmethod + def is_nondarwin_only_build_product(cls): + return True diff --git a/utils/swift_build_support/swift_build_support/products/indexstoredb.py b/utils/swift_build_support/swift_build_support/products/indexstoredb.py index 6bd7d2b6f566f..65d720c4889fa 100644 --- a/utils/swift_build_support/swift_build_support/products/indexstoredb.py +++ b/utils/swift_build_support/swift_build_support/products/indexstoredb.py @@ -12,7 +12,18 @@ import os +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llbuild +from . import llvm from . import product +from . import swift +from . import swiftpm +from . import swiftsyntax +from . import xctest from .. import shell from .. import targets @@ -45,6 +56,20 @@ def should_install(self, host_target): def install(self, host_target): pass + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM, + swiftsyntax.SwiftSyntax] + def run_build_script_helper(action, host_target, product, args, sanitize_all=False): diff --git a/utils/swift_build_support/swift_build_support/products/libcxx.py b/utils/swift_build_support/swift_build_support/products/libcxx.py index 38b9d2f8e37aa..d26b8bda83cf7 100644 --- a/utils/swift_build_support/swift_build_support/products/libcxx.py +++ b/utils/swift_build_support/swift_build_support/products/libcxx.py @@ -10,8 +10,21 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import llvm from . import product class LibCXX(product.Product): - pass + @classmethod + def is_build_script_impl_product(cls): + """is_build_script_impl_product -> bool + + Whether this product is produced by build-script-impl. + """ + return True + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM] diff --git a/utils/swift_build_support/swift_build_support/products/libdispatch.py b/utils/swift_build_support/swift_build_support/products/libdispatch.py index bf20ccc013673..62bf2475948d5 100644 --- a/utils/swift_build_support/swift_build_support/products/libdispatch.py +++ b/utils/swift_build_support/swift_build_support/products/libdispatch.py @@ -10,10 +10,23 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import libcxx +from . import libicu +from . import llvm from . import product +from . import swift class LibDispatch(product.Product): + @classmethod + def is_build_script_impl_product(cls): + """is_build_script_impl_product -> bool + + Whether this product is produced by build-script-impl. + """ + return True + @classmethod def product_source_name(cls): """product_source_name() -> str @@ -21,3 +34,15 @@ def product_source_name(cls): The name of the source code directory of this product. """ return "swift-corelibs-libdispatch" + + @classmethod + def is_nondarwin_only_build_product(cls): + return True + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift] diff --git a/utils/swift_build_support/swift_build_support/products/libicu.py b/utils/swift_build_support/swift_build_support/products/libicu.py index 36c13f1c1ca4e..39e1b60262f70 100644 --- a/utils/swift_build_support/swift_build_support/products/libicu.py +++ b/utils/swift_build_support/swift_build_support/products/libicu.py @@ -10,10 +10,21 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import libcxx +from . import llvm from . import product class LibICU(product.Product): + @classmethod + def is_build_script_impl_product(cls): + """is_build_script_impl_product -> bool + + Whether this product is produced by build-script-impl. + """ + return True + @classmethod def product_source_name(cls): """product_source_name() -> str @@ -21,3 +32,13 @@ def product_source_name(cls): The name of the source code directory of this product. """ return "icu" + + @classmethod + def is_nondarwin_only_build_product(cls): + return True + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX] diff --git a/utils/swift_build_support/swift_build_support/products/llbuild.py b/utils/swift_build_support/swift_build_support/products/llbuild.py index d1b4a1db96973..e723b03ecb199 100644 --- a/utils/swift_build_support/swift_build_support/products/llbuild.py +++ b/utils/swift_build_support/swift_build_support/products/llbuild.py @@ -10,8 +10,33 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llvm from . import product +from . import swift +from . import xctest class LLBuild(product.Product): - pass + @classmethod + def is_build_script_impl_product(cls): + """is_build_script_impl_product -> bool + + Whether this product is produced by build-script-impl. + """ + return True + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest] diff --git a/utils/swift_build_support/swift_build_support/products/lldb.py b/utils/swift_build_support/swift_build_support/products/lldb.py index bf35be0a1cddd..73a9017bbe407 100644 --- a/utils/swift_build_support/swift_build_support/products/lldb.py +++ b/utils/swift_build_support/swift_build_support/products/lldb.py @@ -10,8 +10,27 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import libcxx +from . import libicu +from . import llvm from . import product +from . import swift class LLDB(product.Product): - pass + @classmethod + def is_build_script_impl_product(cls): + """is_build_script_impl_product -> bool + + Whether this product is produced by build-script-impl. + """ + return True + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift] diff --git a/utils/swift_build_support/swift_build_support/products/llvm.py b/utils/swift_build_support/swift_build_support/products/llvm.py index 3d23c2e3b162e..1bc27bc89e38a 100644 --- a/utils/swift_build_support/swift_build_support/products/llvm.py +++ b/utils/swift_build_support/swift_build_support/products/llvm.py @@ -10,6 +10,7 @@ # # ---------------------------------------------------------------------------- +from . import cmark from . import product from ..cmake import CMakeOptions @@ -34,6 +35,14 @@ def __init__(self, args, toolchain, source_dir, build_dir): # Add the cmake options for compiler version information. self.cmake_options.extend(self._version_flags) + @classmethod + def is_build_script_impl_product(cls): + """is_build_script_impl_product -> bool + + Whether this product is produced by build-script-impl. + """ + return True + @property def _compiler_vendor_flags(self): if self.args.compiler_vendor == "none": @@ -57,3 +66,7 @@ def _version_flags(self): 'CLANG_REPOSITORY_STRING', "clang-{}".format(self.args.clang_compiler_version)) return result + + @classmethod + def get_dependencies(cls): + return [cmark.CMark] diff --git a/utils/swift_build_support/swift_build_support/products/playgroundsupport.py b/utils/swift_build_support/swift_build_support/products/playgroundsupport.py index 81d53d841664b..0e98b442b14be 100644 --- a/utils/swift_build_support/swift_build_support/products/playgroundsupport.py +++ b/utils/swift_build_support/swift_build_support/products/playgroundsupport.py @@ -13,7 +13,18 @@ import os import re +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llbuild +from . import lldb +from . import llvm from . import product +from . import swift +from . import swiftpm +from . import xctest from .. import shell from .. import targets @@ -110,3 +121,17 @@ def install(self, host_target): "TOOLCHAIN_INSTALL_DIR={}".format(toolchain_prefix), "BUILD_PLAYGROUND_LOGGER_TESTS=NO", ]) + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + lldb.LLDB, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM] diff --git a/utils/swift_build_support/swift_build_support/products/product.py b/utils/swift_build_support/swift_build_support/products/product.py index 135ddac71b2ef..ed4c944bc008e 100644 --- a/utils/swift_build_support/swift_build_support/products/product.py +++ b/utils/swift_build_support/swift_build_support/products/product.py @@ -55,7 +55,7 @@ def is_build_script_impl_product(cls): Whether this product is produced by build-script-impl. """ - return True + raise NotImplementedError @classmethod def is_swiftpm_unified_build_product(cls): @@ -66,6 +66,18 @@ def is_swiftpm_unified_build_product(cls): """ return False + @classmethod + def is_nondarwin_only_build_product(cls): + """Returns true if this target should be skipped in darwin builds when + inferring dependencies. + """ + return False + + @classmethod + def get_dependencies(cls): + """Return a list of products that this product depends upon""" + raise NotImplementedError + def should_build(self, host_target): """should_build() -> Bool diff --git a/utils/swift_build_support/swift_build_support/products/pythonkit.py b/utils/swift_build_support/swift_build_support/products/pythonkit.py index a422027ca216d..05f5b72c5468d 100644 --- a/utils/swift_build_support/swift_build_support/products/pythonkit.py +++ b/utils/swift_build_support/swift_build_support/products/pythonkit.py @@ -12,7 +12,17 @@ import os +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llbuild +from . import llvm from . import product +from . import swift +from . import swiftpm +from . import xctest from .. import shell from .. import targets @@ -79,3 +89,16 @@ def install(self, host_target): '--build', self.build_dir, '--target', 'install', ]) + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM] diff --git a/utils/swift_build_support/swift_build_support/products/skstresstester.py b/utils/swift_build_support/swift_build_support/products/skstresstester.py index 1db633c553234..ae79373d99c7c 100644 --- a/utils/swift_build_support/swift_build_support/products/skstresstester.py +++ b/utils/swift_build_support/swift_build_support/products/skstresstester.py @@ -1,4 +1,3 @@ - # swift_build_support/products/skstresstester.py -----------------*- python -*- # # This source file is part of the Swift.org open source project @@ -16,7 +15,18 @@ from build_swift.build_swift.constants import MULTIROOT_DATA_FILE_PATH +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llbuild +from . import llvm from . import product +from . import swift +from . import swiftpm +from . import swiftsyntax +from . import xctest from .. import shell @@ -90,3 +100,17 @@ def install(self, host_target): self.run_build_script_helper('install', [ '--prefix', install_prefix ]) + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM, + swiftsyntax.SwiftSyntax] diff --git a/utils/swift_build_support/swift_build_support/products/sourcekitlsp.py b/utils/swift_build_support/swift_build_support/products/sourcekitlsp.py index 92b121f17a56c..aa3d22602aeac 100644 --- a/utils/swift_build_support/swift_build_support/products/sourcekitlsp.py +++ b/utils/swift_build_support/swift_build_support/products/sourcekitlsp.py @@ -10,8 +10,18 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import foundation from . import indexstoredb +from . import libcxx +from . import libdispatch +from . import libicu +from . import llbuild +from . import llvm from . import product +from . import swift +from . import swiftpm +from . import xctest class SourceKitLSP(product.Product): @@ -44,3 +54,16 @@ def should_install(self, host_target): def install(self, host_target): indexstoredb.run_build_script_helper( 'install', host_target, self, self.args) + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM] diff --git a/utils/swift_build_support/swift_build_support/products/swift.py b/utils/swift_build_support/swift_build_support/products/swift.py index e4259b018ef54..fda688c8bf999 100644 --- a/utils/swift_build_support/swift_build_support/products/swift.py +++ b/utils/swift_build_support/swift_build_support/products/swift.py @@ -10,6 +10,10 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import libcxx +from . import libicu +from . import llvm from . import product from ..cmake import CMakeOptions @@ -45,6 +49,14 @@ def __init__(self, args, toolchain, source_dir, build_dir): self.cmake_options.extend( self._enable_experimental_differentiable_programming) + @classmethod + def is_build_script_impl_product(cls): + """is_build_script_impl_product -> bool + + Whether this product is produced by build-script-impl. + """ + return True + @property def _runtime_sanitizer_flags(self): sanitizer_list = [] @@ -121,3 +133,10 @@ def _stdlibcore_exclusivity_checking_flags(self): def _enable_experimental_differentiable_programming(self): return [('SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING:BOOL', self.args.enable_experimental_differentiable_programming)] + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU] diff --git a/utils/swift_build_support/swift_build_support/products/swiftevolve.py b/utils/swift_build_support/swift_build_support/products/swiftevolve.py index 579e90b6e0b4f..efebc85e1b6f9 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftevolve.py +++ b/utils/swift_build_support/swift_build_support/products/swiftevolve.py @@ -10,7 +10,18 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llbuild +from . import llvm from . import skstresstester +from . import swift +from . import swiftpm +from . import swiftsyntax +from . import xctest class SwiftEvolve(skstresstester.SKStressTester): @@ -35,3 +46,18 @@ def should_test(self, host_target): def should_install(self, host_target): return self.args.install_swiftevolve + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM, + swiftsyntax.SwiftSyntax, + skstresstester.SKStressTester] diff --git a/utils/swift_build_support/swift_build_support/products/swiftinspect.py b/utils/swift_build_support/swift_build_support/products/swiftinspect.py index 758c4f97806ef..b2c54190f1b1e 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftinspect.py +++ b/utils/swift_build_support/swift_build_support/products/swiftinspect.py @@ -13,7 +13,17 @@ import os import platform +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llbuild +from . import llvm from . import product +from . import swift +from . import swiftpm +from . import xctest from .. import shell from .. import targets @@ -49,6 +59,19 @@ def should_install(self, host_target): def install(self, host_target): pass + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM] + def run_build_script_helper(host_target, product, args): toolchain_path = args.install_destdir diff --git a/utils/swift_build_support/swift_build_support/products/swiftpm.py b/utils/swift_build_support/swift_build_support/products/swiftpm.py index 1825fa6ac1938..48c18256629b5 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftpm.py +++ b/utils/swift_build_support/swift_build_support/products/swiftpm.py @@ -12,7 +12,16 @@ import os +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llbuild +from . import llvm from . import product +from . import swift +from . import xctest from .. import shell @@ -93,3 +102,15 @@ def install(self, host_target): self.run_bootstrap_script('install', host_target, [ '--prefix', install_prefix ]) + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild] diff --git a/utils/swift_build_support/swift_build_support/products/swiftsyntax.py b/utils/swift_build_support/swift_build_support/products/swiftsyntax.py index 6ed06c5b6ff9a..9dd6a8436b30f 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftsyntax.py +++ b/utils/swift_build_support/swift_build_support/products/swiftsyntax.py @@ -14,7 +14,17 @@ from build_swift.build_swift.constants import MULTIROOT_DATA_FILE_PATH +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llbuild +from . import llvm from . import product +from . import swift +from . import swiftpm +from . import xctest from .. import shell @@ -91,3 +101,16 @@ def install(self, target_name): self.run_swiftsyntax_build_script(target=target_name, additional_params=additional_params) + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM] diff --git a/utils/swift_build_support/swift_build_support/products/tensorflow.py b/utils/swift_build_support/swift_build_support/products/tensorflow.py index bbfe3174a4c82..6c458156d6f9e 100644 --- a/utils/swift_build_support/swift_build_support/products/tensorflow.py +++ b/utils/swift_build_support/swift_build_support/products/tensorflow.py @@ -12,7 +12,17 @@ import os +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llbuild +from . import llvm from . import product +from . import swift +from . import swiftpm +from . import xctest from .. import shell from .. import targets @@ -79,3 +89,16 @@ def install(self, host_target): '--build', self.build_dir, '--target', 'install', ]) + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM] diff --git a/utils/swift_build_support/swift_build_support/products/tsan_libdispatch.py b/utils/swift_build_support/swift_build_support/products/tsan_libdispatch.py index be1ecd620453b..09b8eccaa8d1a 100644 --- a/utils/swift_build_support/swift_build_support/products/tsan_libdispatch.py +++ b/utils/swift_build_support/swift_build_support/products/tsan_libdispatch.py @@ -12,7 +12,17 @@ import os +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llbuild +from . import llvm from . import product +from . import swift +from . import swiftpm +from . import xctest from .. import shell @@ -78,3 +88,16 @@ def should_install(self, host_target): def install(self, host_target): pass + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM] diff --git a/utils/swift_build_support/swift_build_support/products/xctest.py b/utils/swift_build_support/swift_build_support/products/xctest.py index 5cbe24b75e942..56eda1461a72c 100644 --- a/utils/swift_build_support/swift_build_support/products/xctest.py +++ b/utils/swift_build_support/swift_build_support/products/xctest.py @@ -10,10 +10,25 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import llvm from . import product +from . import swift class XCTest(product.Product): + @classmethod + def is_build_script_impl_product(cls): + """is_build_script_impl_product -> bool + + Whether this product is produced by build-script-impl. + """ + return True + @classmethod def product_source_name(cls): """product_source_name() -> str @@ -21,3 +36,17 @@ def product_source_name(cls): The name of the source code directory of this product. """ return "swift-corelibs-xctest" + + @classmethod + def get_dependencies(cls): + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + libdispatch.LibDispatch, + foundation.Foundation] + + @classmethod + def is_nondarwin_only_build_product(cls): + return True diff --git a/utils/swift_build_support/tests/test_build_graph.py b/utils/swift_build_support/tests/test_build_graph.py new file mode 100644 index 0000000000000..71121281fd65a --- /dev/null +++ b/utils/swift_build_support/tests/test_build_graph.py @@ -0,0 +1,59 @@ +# test_build_graph.py - Test the build_graph using mocks --------*- python -*- +# +# This source file is part of the Swift.org open source project +# +# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See https://swift.org/LICENSE.txt for license information +# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors + + +from __future__ import absolute_import, unicode_literals + +import unittest + +from swift_build_support import build_graph + + +class ProductMock(object): + def __init__(self, name): + self.name = name + self.deps = [] + + def get_dependencies(self): + return self.deps + + def __repr__(self): + return "".format(self.name) + + +def get_products(): + products = { + "cmark": ProductMock("cmark"), + "llvm": ProductMock("llvm"), + "swift": ProductMock("swift"), + "swiftpm": ProductMock("swiftpm"), + "libMockSwiftPM": ProductMock("libMockSwiftPM"), + "libMockCMark": ProductMock("libMockCMark"), + "libMockSwiftPM2": ProductMock("libMockSwiftPM2"), + } + + products['llvm'].deps.extend([products['cmark']]) + products['swift'].deps.extend([products['llvm']]) + products['swiftpm'].deps.extend([products['llvm'], products['swift']]) + products['libMockSwiftPM'].deps.extend([products['swiftpm']]) + products['libMockCMark'].deps.extend([products['cmark']]) + products['libMockSwiftPM2'].deps.extend([products['swiftpm'], products['cmark']]) + + return products + + +class BuildGraphTestCase(unittest.TestCase): + + def test_simple_build_graph(self): + products = get_products() + selectedProducts = [products['swiftpm']] + schedule = build_graph.produce_scheduled_build(selectedProducts) + names = [x.name for x in schedule[0]] + self.assertEquals(['cmark', 'llvm', 'swift', 'swiftpm'], names) diff --git a/validation-test/BuildSystem/infer_implies_install_all.test b/validation-test/BuildSystem/infer_implies_install_all.test new file mode 100644 index 0000000000000..48b570c66ec12 --- /dev/null +++ b/validation-test/BuildSystem/infer_implies_install_all.test @@ -0,0 +1,12 @@ +# RUN: %empty-directory(%t) +# RUN: mkdir -p %t +# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --infer --swiftpm --cmake %cmake 2>&1 | %FileCheck %s + +# REQUIRES: standalone_build + +# CHECK: --- Installing cmark --- +# CHECK: --- Installing llvm --- +# CHECK: --- Installing swift --- +# CHECK: --- Installing llbuild --- +# CHECK: --- Building swiftpm --- +# CHECK: --- Installing swiftpm --- diff --git a/validation-test/BuildSystem/install_all.test b/validation-test/BuildSystem/install_all.test new file mode 100644 index 0000000000000..63d0ca62f3f9a --- /dev/null +++ b/validation-test/BuildSystem/install_all.test @@ -0,0 +1,9 @@ +# RUN: %empty-directory(%t) +# RUN: mkdir -p %t +# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --install-all --cmake %cmake 2>&1 | %FileCheck %s + +# REQUIRES: standalone_test + +# CHECK: --- Installing cmark --- +# CHECK: --- Installing llvm --- +# CHECK: --- Installing swift --- diff --git a/validation-test/BuildSystem/install_all_linux.test b/validation-test/BuildSystem/install_all_linux.test new file mode 100644 index 0000000000000..60dd5ab950ab0 --- /dev/null +++ b/validation-test/BuildSystem/install_all_linux.test @@ -0,0 +1,14 @@ +# RUN: %empty-directory(%t) +# RUN: mkdir -p %t +# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --install-all --llbuild --swiftpm --foundation --libdispatch --cmake %cmake 2>&1 | %FileCheck %s + +# REQUIRES: standalone_build +# REQUIRES: OS=linux-gnu + +# CHECK-DAG: --- Installing cmark --- +# CHECK-DAG: --- Installing swift --- +# CHECK-DAG: --- Installing llvm --- +# CHECK-DAG: --- Installing llbuild --- +# CHECK-DAG: --- Installing foundation --- +# CHECK-DAG: --- Installing libdispatch --- +# CHECK-DAG: --- Installing swiftpm --- diff --git a/validation-test/BuildSystem/skip_cmark_swift_llvm.test b/validation-test/BuildSystem/skip_cmark_swift_llvm.test new file mode 100644 index 0000000000000..223410c03ab0a --- /dev/null +++ b/validation-test/BuildSystem/skip_cmark_swift_llvm.test @@ -0,0 +1,35 @@ +# REQUIRES: standalone_test + +# RUN: %empty-directory(%t) +# RUN: mkdir -p %t +# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --install-all --cmake %cmake --skip-build-cmark 2>&1 | %FileCheck --check-prefix=SKIP-CMARK-CHECK %s + +# RUN: %empty-directory(%t) +# RUN: mkdir -p %t +# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --install-all --cmake %cmake --skip-build-llvm 2>&1 | %FileCheck --check-prefix=SKIP-LLVM-CHECK %s + +# RUN: %empty-directory(%t) +# RUN: mkdir -p %t +# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --install-all --cmake %cmake --skip-build-swift 2>&1 | %FileCheck --check-prefix=SKIP-SWIFT-CHECK %s + +# SKIP-CMARK-CHECK-NOT: cmake --build {{.*}}cmark- +# SKIP-CMARK-CHECK: cmake --build {{.*}}llvm- +# SKIP-CMARK-CHECK: cmake --build {{.*}}swift- +# SKIP-CMARK-CHECK-NOT: --- Installing cmark --- +# SKIP-CMARK-CHECK: --- Installing llvm --- +# SKIP-CMARK-CHECK: --- Installing swift --- + +# SKIP-LLVM-CHECK: cmake --build {{.*}}cmark- +# SKIP-LLVM-CHECK-NOT: cmake --build {{.*}}llvm- +# SKIP-LLVM-CHECK: cmake --build {{.*}}swift- +# SKIP-LLVM-CHECK: --- Installing cmark --- +# SKIP-LLVM-CHECK-NOT: --- Installing llvm --- +# SKIP-LLVM-CHECK: --- Installing swift --- + +# SKIP-SWIFT-CHECK: cmake --build {{.*}}cmark- +# SKIP-SWIFT-CHECK: cmake --build {{.*}}llvm- +# SKIP-SWIFT-CHECK-NOT: cmake --build {{.*}}swift- +# SKIP-SWIFT-CHECK: --- Installing cmark --- +# SKIP-SWIFT-CHECK: --- Installing llvm --- +# SKIP-SWIFT-CHECK-NOT: --- Installing swift --- + diff --git a/validation-test/compiler_crashers/28653-child-source-range-not-contained-within-its-parent.swift b/validation-test/compiler_crashers_fixed/28653-child-source-range-not-contained-within-its-parent.swift similarity index 87% rename from validation-test/compiler_crashers/28653-child-source-range-not-contained-within-its-parent.swift rename to validation-test/compiler_crashers_fixed/28653-child-source-range-not-contained-within-its-parent.swift index 1cee0babeb915..8e8fbe2ab3afb 100644 --- a/validation-test/compiler_crashers/28653-child-source-range-not-contained-within-its-parent.swift +++ b/validation-test/compiler_crashers_fixed/28653-child-source-range-not-contained-within-its-parent.swift @@ -5,7 +5,7 @@ // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// RUN: not --crash %target-swift-frontend %s -emit-ir +// RUN: not %target-swift-frontend %s -emit-ir // REQUIRES: swift_ast_verifier switch{case.b(u){ diff --git a/validation-test/lit.site.cfg.in b/validation-test/lit.site.cfg.in index 3666329b720d6..343ddb16bb1de 100644 --- a/validation-test/lit.site.cfg.in +++ b/validation-test/lit.site.cfg.in @@ -13,6 +13,7 @@ import sys import platform +config.cmake = "@CMAKE_COMMAND@" config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" diff --git a/validation-test/stdlib/SwiftNativeNSBase.swift b/validation-test/stdlib/SwiftNativeNSBase.swift index 6b2af4c2cad23..a8d875adfe5df 100644 --- a/validation-test/stdlib/SwiftNativeNSBase.swift +++ b/validation-test/stdlib/SwiftNativeNSBase.swift @@ -47,7 +47,15 @@ func classChain(of cls: AnyClass) -> [String] { var SwiftNativeNSBaseTestSuite = TestSuite("SwiftNativeNSBase") -SwiftNativeNSBaseTestSuite.test("UnwantedCdtors") { +SwiftNativeNSBaseTestSuite.test("UnwantedCdtors") + .skip(.osxMinorRange(10, 0...15, reason: "lazy objc naming is not available on these OSes")) + .skip(.iOSMajorRange(0...13, reason: "lazy objc naming is not available on these OSes")) + .skip(.tvOSMajorRange(0...13, reason: "lazy objc naming is not available on these OSes")) + .skip(.watchOSMajorRange(0...6, reason: "lazy objc naming is not available on these OSes")) + .skip(.iOSSimulatorAny(/*Range(0...13), reason: */"lazy objc naming is not available on these OSes")) + .skip(.tvOSSimulatorAny(/*TODO: 0...13, reason: */"lazy objc naming is not available on these OSes")) + .skip(.watchOSSimulatorAny(/*TODO: 0...6, reason: */"lazy objc naming is not available on these OSes")) + .code { expectTrue(TestSwiftNativeNSBase_UnwantedCdtors()) }