From 3a2e9975d6617d7b39be97e4574319988d1323f3 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 9 Jan 2020 10:28:09 -0800 Subject: [PATCH 001/222] Adapt to upstream LLVM changes. --- include/swift/AST/Evaluator.h | 2 +- lib/AST/Expr.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/swift/AST/Evaluator.h b/include/swift/AST/Evaluator.h index 4b4e89a8e3c43..654fc49ca5e85 100644 --- a/include/swift/AST/Evaluator.h +++ b/include/swift/AST/Evaluator.h @@ -354,7 +354,7 @@ class Evaluator { // Check for a cycle. if (checkDependency(getCanonicalRequest(request))) { return llvm::Error( - llvm::make_unique>(request, *this)); + std::make_unique>(request, *this)); } // Make sure we remove this from the set of active requests once we're diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 72dde8c11666a..e3bc4d0a34512 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -807,15 +807,15 @@ APInt BuiltinIntegerWidth::parse(StringRef text, unsigned radix, bool negate, static APFloat getFloatLiteralValue(bool IsNegative, StringRef Text, const llvm::fltSemantics &Semantics) { APFloat Val(Semantics); - APFloat::opStatus Res = + auto Res = Val.convertFromString(Text, llvm::APFloat::rmNearestTiesToEven); - assert(Res != APFloat::opInvalidOp && "Sema didn't reject invalid number"); - (void)Res; + assert(Res && "Sema didn't reject invalid number"); + consumeError(Res.takeError()); if (IsNegative) { auto NegVal = APFloat::getZero(Semantics, /*negative*/ true); Res = NegVal.subtract(Val, llvm::APFloat::rmNearestTiesToEven); - assert(Res != APFloat::opInvalidOp && "Sema didn't reject invalid number"); - (void)Res; + assert(Res && "Sema didn't reject invalid number"); + consumeError(Res.takeError()); return NegVal; } return Val; From f2310cff379ce86bedea308f199ef2b72d3a16ce Mon Sep 17 00:00:00 2001 From: Shoaib Meenai Date: Mon, 14 Oct 2019 16:55:29 -0700 Subject: [PATCH 002/222] [Statistic] Adjust for LLVM r374490 Use appropriate member functions instead of accessing Value directly. --- lib/Sema/CSSolver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Sema/CSSolver.cpp b/lib/Sema/CSSolver.cpp index a6e70c84f934a..83d687125491b 100644 --- a/lib/Sema/CSSolver.cpp +++ b/lib/Sema/CSSolver.cpp @@ -410,11 +410,11 @@ ConstraintSystem::SolverState::~SolverState() { // Update the "largest" statistics if this system is larger than the // previous one. // FIXME: This is not at all thread-safe. - if (NumStatesExplored > LargestNumStatesExplored.Value) { - LargestSolutionAttemptNumber.Value = SolutionAttempt-1; + if (NumStatesExplored > LargestNumStatesExplored.getValue()) { + LargestSolutionAttemptNumber = SolutionAttempt-1; ++LargestSolutionAttemptNumber; #define CS_STATISTIC(Name, Description) \ - JOIN2(Largest,Name).Value = Name-1; \ + JOIN2(Largest,Name) = Name-1; \ ++JOIN2(Largest,Name); #include "ConstraintSolverStats.def" } From 10cd0fc1b7dac5d68ac11510081fc0cd44bffc54 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 10 Jan 2020 09:58:27 -0800 Subject: [PATCH 003/222] Adapt to upstream LLVM changes. (cherry picked from commit 06906ab6b9f17038d05ed6667761ddac6beade6b) --- lib/IRGen/IRGenDebugInfo.cpp | 3 ++- test/DebugInfo/basic.swift | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index efc41025a8d0b..59a3b75da9305 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -2311,7 +2311,8 @@ void IRGenDebugInfoImpl::emitGlobalVariableDeclaration( if (!Var) Expr = DBuilder.createConstantValueExpression(0); auto *GV = DBuilder.createGlobalVariableExpression( - MainModule, Name, LinkageName, File, L.Line, DITy, IsLocalToUnit, Expr); + MainModule, Name, LinkageName, File, L.Line, DITy, IsLocalToUnit, true, + Expr); if (Var) Var->addDebugInfo(GV); } diff --git a/test/DebugInfo/basic.swift b/test/DebugInfo/basic.swift index e8ab11b2f4236..9be8bc95e24d7 100644 --- a/test/DebugInfo/basic.swift +++ b/test/DebugInfo/basic.swift @@ -85,7 +85,7 @@ func foo(_ a: Int64, _ b: Int64) -> Int64 { // CHECK-DAG: ![[MAINMODULE]] = !DIModule({{.*}}, name: "basic" // DWARF Version -// DWARF-CHECK-DAG: i32 2, !"Dwarf Version", i32 4} +// DWARF-CHECK-DAG: i32 7, !"Dwarf Version", i32 4} // CV-CHECK-DAG: i32 2, !"CodeView", i32 1} // Debug Info Version From 612c53be8fca9c4a29172759808683db2f1594ad Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Tue, 14 Jan 2020 11:33:04 -0800 Subject: [PATCH 004/222] Update testcase for upstream LLVM changes. (cherry picked from commit 8ed230fb73bc63aa3cae54d9d6f1a4bacc829417) --- test/DebugInfo/ErrorVar.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/DebugInfo/ErrorVar.swift b/test/DebugInfo/ErrorVar.swift index b66f3d877cde5..ca921180dce4a 100644 --- a/test/DebugInfo/ErrorVar.swift +++ b/test/DebugInfo/ErrorVar.swift @@ -11,7 +11,10 @@ enum MyError : Error { // thrown error we create a shadow stack location holding the address of the // location that holds the pointer to the error instead. func simple(_ placeholder: Int64) throws -> () { - // CHECK: define {{.*}}void @"$s8ErrorVar6simpleyys5Int64VKF"(i64, %swift.refcounted* swiftself, %swift.error** noalias nocapture dereferenceable(4)) + // CHECK: define {{.*}}void @"$s8ErrorVar6simpleyys5Int64VKF"( + // CHECK-SAME: i64 + // CHECK-SAME: %swift.refcounted* {{.*}}swiftself + // CHECK-SAME: %swift.error** noalias nocapture dereferenceable(4) // CHECK: call void @llvm.dbg.declare // CHECK: call void @llvm.dbg.declare({{.*}}, metadata ![[ERROR:[0-9]+]], metadata !DIExpression(DW_OP_deref)) // CHECK: ![[ERRTY:.*]] = !DICompositeType({{.*}}identifier: "$ss5Error_pD" From 18b03171c4a56027c549a4baaaefa973ad906f56 Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Thu, 16 Jan 2020 10:14:35 +0100 Subject: [PATCH 005/222] Fix build after removal of PointerUnion3/4 Commit 2948ec5ca98f8593584f2117bc92fe8d75f6f098 removed the PointerUnion3 and PointerUnion4 aliases and migrated everything to the variadic template. Let's do the same here to get the build running. --- include/swift/AST/ClangNode.h | 4 ++-- include/swift/SIL/SILLocation.h | 2 +- lib/Sema/ConstraintSystem.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/swift/AST/ClangNode.h b/include/swift/AST/ClangNode.h index cbf120840b661..608ba9ada8af4 100644 --- a/include/swift/AST/ClangNode.h +++ b/include/swift/AST/ClangNode.h @@ -48,8 +48,8 @@ class ClangNode { template using Box = detail::ClangNodeBox; - llvm::PointerUnion4, Box, - Box, Box> Ptr; + llvm::PointerUnion, Box, + Box, Box> Ptr; public: ClangNode() = default; diff --git a/include/swift/SIL/SILLocation.h b/include/swift/SIL/SILLocation.h index 60bedd6f8ef31..92e68396b03f9 100644 --- a/include/swift/SIL/SILLocation.h +++ b/include/swift/SIL/SILLocation.h @@ -65,7 +65,7 @@ class SILLocation { using type = Pattern; }; - using ASTNodeTy = llvm::PointerUnion4; + using ASTNodeTy = llvm::PointerUnion; public: enum LocationKind : unsigned { diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index 75d1aad3ca788..3a86a70558595 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -749,8 +749,8 @@ struct Score { /// An AST node that can gain type information while solving. using TypedNode = - llvm::PointerUnion3; + llvm::PointerUnion; /// Display a score. llvm::raw_ostream &operator<<(llvm::raw_ostream &out, const Score &score); From 334ec53c178b90a61766847d54d2f39678ddb45c Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Thu, 16 Jan 2020 11:05:57 +0100 Subject: [PATCH 006/222] Fix Python 3.x error in Tuple.swift.gyb due concatenating "range + list" This was failing with the following error on my Python3 system: FAILED: stdlib/public/core/8/Tuple.swift cd /home/teemperor/work/swift/swift/stdlib/public/core && /usr/bin/cmake -E make_directory /home/teemperor/work/swift/build/Ninja-ReleaseAssert+stdlib-Release/swift-linux-x86_64/stdlib/public/core/8 && /usr/bin/python /home/teemperor/work/swift/swift/utils/gyb -DunicodeGraphemeBreakPropertyFile=/home/teemperor/work/swift/swift/utils/UnicodeData/GraphemeBreakProperty.txt -DunicodeGraphemeBreakTestFile=/home/teemperor/work/swift/swift/utils/UnicodeData/GraphemeBreakTest.txt -DCMAKE_SIZEOF_VOID_P=8 -o /home/teemperor/work/swift/build/Ninja-ReleaseAssert+stdlib-Release/swift-linux-x86_64/stdlib/public/core/8/Tuple.swift.tmp Tuple.swift.gyb && /usr/bin/cmake -E copy_if_different /home/teemperor/work/swift/build/Ninja-ReleaseAssert+stdlib-Release/swift-linux-x86_64/stdlib/public/core/8/Tuple.swift.tmp /home/teemperor/work/swift/build/Ninja-ReleaseAssert+stdlib-Release/swift-linux-x86_64/stdlib/public/core/8/Tuple.swift && /usr/bin/cmake -E remove /home/teemperor/work/swift/build/Ninja-ReleaseAssert+stdlib-Release/swift-linux-x86_64/stdlib/public/core/8/Tuple.swift.tmp Traceback (most recent call last): File "/home/teemperor/work/swift/swift/utils/gyb", line 3, in gyb.main() File "/home/teemperor/work/swift/swift/utils/gyb.py", line 1263, in main args.target.write(execute_template(ast, args.line_directive, **bindings)) File "/home/teemperor/work/swift/swift/utils/gyb.py", line 1131, in execute_template ast.execute(execution_context) File "/home/teemperor/work/swift/swift/utils/gyb.py", line 635, in execute x.execute(context) File "/home/teemperor/work/swift/swift/utils/gyb.py", line 721, in execute result = eval(self.code, context.local_bindings) File "/home/teemperor/work/swift/swift/stdlib/public/core/Tuple.swift.gyb", line 109, in % typeParams = [chr(ord("A") + i) for i in range(arity)] File "/home/teemperor/work/swift/swift/utils/gyb.py", line 635, in execute x.execute(context) File "/home/teemperor/work/swift/swift/utils/gyb.py", line 721, in execute result = eval(self.code, context.local_bindings) File "/home/teemperor/work/swift/swift/stdlib/public/core/Tuple.swift.gyb", line 114, in % greaterTuple = "(\"a\", {})".format(", ".join(map(str, range(1, arity - 1) + [arity]))) TypeError: unsupported operand type(s) for +: 'range' and 'list' This commit just converts the range to a list so we can concatenate this on Python 3.x (where the implicit conversion from range to list is no longer possible). --- stdlib/public/core/Tuple.swift.gyb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/public/core/Tuple.swift.gyb b/stdlib/public/core/Tuple.swift.gyb index 29548c92d0e17..63d7ee25f0c96 100644 --- a/stdlib/public/core/Tuple.swift.gyb +++ b/stdlib/public/core/Tuple.swift.gyb @@ -111,7 +111,7 @@ public func >=(lhs: (), rhs: ()) -> Bool { % equatableTypeParams = ", ".join(["{}: Equatable".format(c) for c in typeParams]) % originalTuple = "(\"a\", {})".format(", ".join(map(str, range(1, arity)))) -% greaterTuple = "(\"a\", {})".format(", ".join(map(str, range(1, arity - 1) + [arity]))) +% greaterTuple = "(\"a\", {})".format(", ".join(map(str, list(range(1, arity - 1)) + [arity]))) /// Returns a Boolean value indicating whether the corresponding components of /// two tuples are equal. From 1577506f3198af05281e23f1482548507d441fe7 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 10 Jan 2020 17:03:00 -0800 Subject: [PATCH 007/222] Reflection: Implement a TypeRef -> Demangle tree adapter. To allow more pervasive use of TypeRefs in LLDB, we need a way to build mangled names from TypeRef pointers to allow round-tripping between TypeRefs and AST types. The goal is to experiment with making lldb::CompilerType backed by TypeRefs instead of AST types. (cherry picked from commit ea2b5eced9824b570b55d3acfe812f87ee502f96) --- include/swift/Reflection/TypeRef.h | 3 + stdlib/public/Reflection/TypeRef.cpp | 289 ++++++++++++++++++ .../SwiftRemoteMirror/SwiftRemoteMirror.cpp | 12 + stdlib/public/runtime/Demangle.cpp | 5 +- validation-test/Reflection/existentials.swift | 44 +++ .../Reflection/existentials_objc.swift | 5 + 6 files changed, 356 insertions(+), 2 deletions(-) diff --git a/include/swift/Reflection/TypeRef.h b/include/swift/Reflection/TypeRef.h index d0c3d3249557a..a6f161825c23b 100644 --- a/include/swift/Reflection/TypeRef.h +++ b/include/swift/Reflection/TypeRef.h @@ -150,6 +150,9 @@ class alignas(void *) TypeRef { void dump() const; void dump(FILE *file, unsigned Indent = 0) const; + /// Build a demangle tree from this TypeRef. + Demangle::NodePointer getDemangling(Demangle::Demangler &Dem) const; + bool isConcrete() const; bool isConcreteAfterSubstitutions(const GenericArgumentMap &Subs) const; diff --git a/stdlib/public/Reflection/TypeRef.cpp b/stdlib/public/Reflection/TypeRef.cpp index 3503dd1e79e91..154f5837571b7 100644 --- a/stdlib/public/Reflection/TypeRef.cpp +++ b/stdlib/public/Reflection/TypeRef.cpp @@ -376,6 +376,295 @@ void TypeRef::dump(FILE *file, unsigned Indent) const { fprintf(file, "\n"); } +class DemanglingForTypeRef + : public TypeRefVisitor { + Demangle::Demangler &Dem; + +public: + DemanglingForTypeRef(Demangle::Demangler &Dem) : Dem(Dem) {} + + Demangle::NodePointer visitBuiltinTypeRef(const BuiltinTypeRef *B) { + return Dem.demangleType(B->getMangledName()); + } + + Demangle::NodePointer visitNominalTypeRef(const NominalTypeRef *N) { + if (auto parent = N->getParent()) + assert(false && "not implemented"); + return Dem.demangleType(N->getMangledName()); + } + + Demangle::NodePointer + visitBoundGenericTypeRef(const BoundGenericTypeRef *BG) { + Node::Kind nodeKind; + Node::Kind genericNodeKind; + if (BG->isStruct()) { + nodeKind = Node::Kind::Structure; + genericNodeKind = Node::Kind::BoundGenericStructure; + } else if (BG->isEnum()) { + nodeKind = Node::Kind::Enum; + genericNodeKind = Node::Kind::BoundGenericEnum; + } else if (BG->isClass()) { + nodeKind = Node::Kind::Class; + genericNodeKind = Node::Kind::BoundGenericClass; + } else { + nodeKind = Node::Kind::OtherNominalType; + genericNodeKind = Node::Kind::BoundGenericOtherNominalType; + } + auto unspecializedType = Dem.demangleType(BG->getMangledName()); + + auto genericArgsList = Dem.createNode(Node::Kind::TypeList); + for (auto param : BG->getGenericParams()) + genericArgsList->addChild(visit(param), Dem); + + auto genericNode = Dem.createNode(genericNodeKind); + genericNode->addChild(unspecializedType, Dem); + genericNode->addChild(genericArgsList, Dem); + + if (auto parent = BG->getParent()) + assert(false && "not implemented"); + + auto top = Dem.createNode(Node::Kind::Type); + top->addChild(genericNode, Dem); + return top; + } + + Demangle::NodePointer visitTupleTypeRef(const TupleTypeRef *T) { + auto tuple = Dem.createNode(Node::Kind::Tuple); + if (T->isVariadic()) { + auto tupleElt = Dem.createNode(Node::Kind::TupleElement); + tupleElt->addChild(Dem.createNode(Node::Kind::VariadicMarker), Dem); + tuple->addChild(tupleElt, Dem); + return tuple; + } + + for (auto element : T->getElements()) { + auto tupleElt = Dem.createNode(Node::Kind::TupleElement); + tupleElt->addChild(visit(element), Dem); + tuple->addChild(tupleElt, Dem); + } + return tuple; + } + + Demangle::NodePointer visitFunctionTypeRef(const FunctionTypeRef *F) { + Node::Kind kind; + switch (F->getFlags().getConvention()) { + case FunctionMetadataConvention::Swift: + kind = !F->getFlags().isEscaping() ? Node::Kind::NoEscapeFunctionType + : Node::Kind::FunctionType; + break; + case FunctionMetadataConvention::Block: + kind = Node::Kind::ObjCBlock; + break; + case FunctionMetadataConvention::Thin: + kind = Node::Kind::ThinFunctionType; + break; + case FunctionMetadataConvention::CFunctionPointer: + kind = Node::Kind::CFunctionPointer; + break; + } + + SmallVector, 8> inputs; + for (const auto ¶m : F->getParameters()) { + auto flags = param.getFlags(); + auto input = visit(param.getType()); + + auto wrapInput = [&](Node::Kind kind) { + auto parent = Dem.createNode(kind); + parent->addChild(input, Dem); + input = parent; + }; + switch (flags.getValueOwnership()) { + case ValueOwnership::Default: + /* nothing */ + break; + case ValueOwnership::InOut: + wrapInput(Node::Kind::InOut); + break; + case ValueOwnership::Shared: + wrapInput(Node::Kind::Shared); + break; + case ValueOwnership::Owned: + wrapInput(Node::Kind::Owned); + break; + } + + inputs.push_back({input, flags.isVariadic()}); + } + NodePointer totalInput = nullptr; + // FIXME: this is copy&paste from Demangle.cpp + switch (inputs.size()) { + case 1: { + auto singleParam = inputs.front(); + + // If the sole unlabeled parameter has a non-tuple type, encode + // the parameter list as a single type. + if (!singleParam.second) { + auto singleType = singleParam.first; + if (singleType->getKind() == Node::Kind::Type) + singleType = singleType->getFirstChild(); + if (singleType->getKind() != Node::Kind::Tuple) { + totalInput = singleParam.first; + break; + } + } + + // Otherwise it requires a tuple wrapper. + LLVM_FALLTHROUGH; + } + + // This covers both none and multiple parameters. + default: + auto tuple = Dem.createNode(Node::Kind::Tuple); + for (auto &input : inputs) { + NodePointer eltType; + bool isVariadic; + std::tie(eltType, isVariadic) = input; + + // Tuple element := variadic-marker label? type + auto tupleElt = Dem.createNode(Node::Kind::TupleElement); + + if (isVariadic) + tupleElt->addChild(Dem.createNode(Node::Kind::VariadicMarker), Dem); + + if (eltType->getKind() == Node::Kind::Type) { + tupleElt->addChild(eltType, Dem); + } else { + auto type = Dem.createNode(Node::Kind::Type); + type->addChild(eltType, Dem); + tupleElt->addChild(type, Dem); + } + + tuple->addChild(tupleElt, Dem); + } + totalInput = tuple; + break; + } + + NodePointer parameters = Dem.createNode(Node::Kind::ArgumentTuple); + NodePointer paramType = Dem.createNode(Node::Kind::Type); + + paramType->addChild(totalInput, Dem); + parameters->addChild(paramType, Dem); + + NodePointer resultTy = visit(F->getResult()); + NodePointer result = Dem.createNode(Node::Kind::ReturnType); + result->addChild(resultTy, Dem); + + auto funcNode = Dem.createNode(kind); + if (F->getFlags().throws()) + funcNode->addChild(Dem.createNode(Node::Kind::ThrowsAnnotation), Dem); + funcNode->addChild(parameters, Dem); + funcNode->addChild(result, Dem); + return funcNode; + } + + Demangle::NodePointer + visitProtocolCompositionTypeRef(const ProtocolCompositionTypeRef *PC) { + auto type_list = Dem.createNode(Node::Kind::TypeList); + for (auto protocol : PC->getProtocols()) + type_list->addChild(visit(protocol), Dem); + + auto proto_list = Dem.createNode(Node::Kind::ProtocolList); + proto_list->addChild(type_list, Dem); + + auto node = proto_list; + if (auto superclass = PC->getSuperclass()) { + node = Dem.createNode(Node::Kind::ProtocolListWithClass); + node->addChild(proto_list, Dem); + node->addChild(visit(superclass), Dem); + } else if (PC->hasExplicitAnyObject()) { + node = Dem.createNode(Node::Kind::ProtocolListWithAnyObject); + node->addChild(proto_list, Dem); + } + auto typeNode = Dem.createNode(Node::Kind::Type); + typeNode->addChild(node, Dem); + return typeNode; + } + + Demangle::NodePointer visitMetatypeTypeRef(const MetatypeTypeRef *M) { + auto node = Dem.createNode(Node::Kind::Metatype); + assert(!M->wasAbstract() && "not implemented"); + node->addChild(visit(M->getInstanceType()), Dem); + auto typeNode = Dem.createNode(Node::Kind::Type); + typeNode->addChild(node, Dem); + return typeNode; + } + + Demangle::NodePointer + visitExistentialMetatypeTypeRef(const ExistentialMetatypeTypeRef *EM) { + auto node = Dem.createNode(Node::Kind::Metatype); + node->addChild(visit(EM->getInstanceType()), Dem); + return node; + } + + Demangle::NodePointer + visitGenericTypeParameterTypeRef(const GenericTypeParameterTypeRef *GTP) { + assert(false && "not tested"); + auto node = Dem.createNode(Node::Kind::DependentGenericParamType); + node->addChild(Dem.createNode(Node::Kind::Index, GTP->getDepth()), Dem); + node->addChild(Dem.createNode(Node::Kind::Index, GTP->getIndex()), Dem); + return node; + } + + Demangle::NodePointer + visitDependentMemberTypeRef(const DependentMemberTypeRef *DM) { + assert(false && "not tested"); + assert(DM->getProtocol().empty() && "not implemented"); + auto node = Dem.createNode(Node::Kind::DependentMemberType); + node->addChild(visit(DM->getBase()), Dem); + node->addChild(Dem.createNode(Node::Kind::Identifier, DM->getMember()), + Dem); + return node; + } + + Demangle::NodePointer visitForeignClassTypeRef(const ForeignClassTypeRef *F) { + assert(false && "not implemented"); + return nullptr; + } + + Demangle::NodePointer visitObjCClassTypeRef(const ObjCClassTypeRef *OC) { + auto module = Dem.createNode(Node::Kind::Module, MANGLING_MODULE_OBJC); + auto node = Dem.createNode(Node::Kind::Class); + node->addChild(module, Dem); + node->addChild(Dem.createNode(Node::Kind::Identifier, OC->getName()), Dem); + return node; + } + + Demangle::NodePointer + visitObjCProtocolTypeRef(const ObjCProtocolTypeRef *OC) { + auto module = Dem.createNode(Node::Kind::Module, MANGLING_MODULE_OBJC); + auto node = Dem.createNode(Node::Kind::Protocol); + node->addChild(module, Dem); + node->addChild(Dem.createNode(Node::Kind::Identifier, OC->getName()), Dem); + auto typeNode = Dem.createNode(Node::Kind::Type); + typeNode->addChild(node, Dem); + return typeNode; + } + +#define REF_STORAGE(Name, name, ...) \ + Demangle::NodePointer visit##Name##StorageTypeRef( \ + const Name##StorageTypeRef *US) { \ + auto node = Dem.createNode(Node::Kind::Name); \ + node->addChild(visit(US->getType()), Dem); \ + return node; \ + } +#include "swift/AST/ReferenceStorage.def" + + Demangle::NodePointer visitSILBoxTypeRef(const SILBoxTypeRef *SB) { + auto node = Dem.createNode(Node::Kind::SILBoxType); + node->addChild(visit(SB->getBoxedType()), Dem); + return node; + } + + Demangle::NodePointer visitOpaqueTypeRef(const OpaqueTypeRef *O) { + return Dem.createNode(Node::Kind::OpaqueType); + } +}; + +Demangle::NodePointer TypeRef::getDemangling(Demangle::Demangler &Dem) const { + return DemanglingForTypeRef(Dem).visit(this); +} + bool TypeRef::isConcrete() const { GenericArgumentMap Subs; return TypeRefIsConcrete(Subs).visit(this); diff --git a/stdlib/public/SwiftRemoteMirror/SwiftRemoteMirror.cpp b/stdlib/public/SwiftRemoteMirror/SwiftRemoteMirror.cpp index 9cfda37a6c4b9..c73d7194e101c 100644 --- a/stdlib/public/SwiftRemoteMirror/SwiftRemoteMirror.cpp +++ b/stdlib/public/SwiftRemoteMirror/SwiftRemoteMirror.cpp @@ -19,6 +19,7 @@ SWIFT_REMOTE_MIRROR_LINKAGE unsigned long long swift_reflection_classIsSwiftMask = 2; } +#include "swift/Demangling/Demangler.h" #include "swift/Reflection/ReflectionContext.h" #include "swift/Reflection/TypeLowering.h" #include "swift/Remote/CMemoryReader.h" @@ -431,6 +432,17 @@ void swift_reflection_dumpInfoForTypeRef(SwiftReflectionContextRef ContextRef, fprintf(stdout, "\n"); } else { TI->dump(stdout); + Demangle::Demangler Dem; + std::string MangledName = mangleNode(TR->getDemangling(Dem)); + fprintf(stdout, "Mangled name: %s%s\n", MANGLING_PREFIX_STR, + MangledName.c_str()); +#ifndef NDEBUG + auto *Reconstructed = reinterpret_cast( + swift_reflection_typeRefForMangledTypeName( + ContextRef, MangledName.c_str(), MangledName.size())); + assert(mangleNode(TR->getDemangling(Dem)) == MangledName && + "round-trip diff"); +#endif } } diff --git a/stdlib/public/runtime/Demangle.cpp b/stdlib/public/runtime/Demangle.cpp index c71bc385613f5..f082e47e015aa 100644 --- a/stdlib/public/runtime/Demangle.cpp +++ b/stdlib/public/runtime/Demangle.cpp @@ -10,12 +10,13 @@ // //===----------------------------------------------------------------------===// -#include "swift/Basic/Range.h" +#include "Private.h" #include "swift/ABI/TypeIdentity.h" +#include "swift/Basic/Range.h" +#include "swift/Reflection/TypeRef.h" #include "swift/Runtime/Metadata.h" #include "swift/Runtime/Portability.h" #include "swift/Strings.h" -#include "Private.h" #include diff --git a/validation-test/Reflection/existentials.swift b/validation-test/Reflection/existentials.swift index a1f131c38ab87..99af19706d9be 100644 --- a/validation-test/Reflection/existentials.swift +++ b/validation-test/Reflection/existentials.swift @@ -67,6 +67,7 @@ reflect(any: mc) // CHECK-64-NEXT: (struct Swift.Int)) // CHECK-64: Type info: // CHECK-64: (reference kind=strong refcounting=native) +// CHECK-64: Mangled name: $s12existentials7MyClassCyS2iG // CHECK-32: Reflecting an existential. // CHECK-32: Instance pointer in child address space: 0x{{[0-9a-fA-F]+}} @@ -76,6 +77,7 @@ reflect(any: mc) // CHECK-32-NEXT: (struct Swift.Int)) // CHECK-32: Type info: // CHECK-32: (reference kind=strong refcounting=native) +// CHECK-32: Mangled name: $s12existentials7MyClassCyS2iG // This value fits in the 3-word buffer in the container. var smallStruct = MyStruct(x: 1, y: 2, z: 3) @@ -103,6 +105,7 @@ reflect(any: smallStruct) // CHECK-64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=0 bitwise_takable=1 // CHECK-64-NEXT: (field name=_value offset=0 // CHECK-64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0 bitwise_takable=1))))) +// CHECK-64-NEXT: Mangled name: $s12existentials8MyStructVyS3iG // CHECK-32: Reflecting an existential. // CHECK-32: Instance pointer in child address space: 0x{{[0-9a-fA-F]+}} @@ -126,6 +129,7 @@ reflect(any: smallStruct) // CHECK-32-NEXT: (struct size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1 // CHECK-32-NEXT: (field name=_value offset=0 // CHECK-32-NEXT: (builtin size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1))))) +// CHECK-32-NEXT: Mangled name: $s12existentials8MyStructVyS3iG // This value will be copied into a heap buffer, with a // pointer to it in the existential. @@ -192,6 +196,7 @@ reflect(any: largeStruct) // CHECK-64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=0 bitwise_takable=1 // CHECK-64-NEXT: (field name=_value offset=0 // CHECK-64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0 bitwise_takable=1))))))) +// CHECK-64-NEXT: Mangled name: $s12existentials8MyStructVySi_S2itSi_S2itSi_S2itG // CHECK-32: Reflecting an existential. // CHECK-32: Instance pointer in child address space: 0x{{[0-9a-fA-F]+}} @@ -253,6 +258,41 @@ reflect(any: largeStruct) // CHECK-32-NEXT: (struct size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1 // CHECK-32-NEXT: (field name=_value offset=0 // CHECK-32-NEXT: (builtin size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1))))))) +// CHECK-32-NEXT: Mangled name: $s12existentials8MyStructVySi_S2itSi_S2itSi_S2itG + +// Function type: +reflect(any: {largeStruct}) +// CHECK-64: Mangled name: $s12existentials8MyStructVySi_S2itSi_S2itSi_S2itGyc +// CHECK-32: Mangled name: $s12existentials8MyStructVySi_S2itSi_S2itSi_S2itGyc + +// Protocol composition: +protocol P {} +protocol Q {} +protocol Composition : P, Q {} +struct S : Composition {} +func getComposition() -> P & Q { return S() } +reflect(any: getComposition()) +// CHECK-64: Mangled name: $s12existentials1P_AA1Qp +// CHECK-32: Mangled name: $s12existentials1P_AA1Qp + +// Metatype: +reflect(any: Int.self) +// CHECK-64: Mangled name: $sSim +// CHECK-32: Mangled name: $sSim + +protocol WithType { + associatedtype T + func f() -> T +} +struct S1 : WithType { + typealias T = Int + func f() -> Int { return 0 } +} +func getWithType(_ t: T) where T: WithType { + reflect(any: T.self) +} +getWithType(S1()) + var he = HasError(singleError: MyError(), errorInComposition: MyError(), customError: MyCustomError(), customErrorInComposition: MyCustomError()) reflect(any: he) @@ -290,6 +330,7 @@ reflect(any: he) // CHECK-64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=1 bitwise_takable=1)) // CHECK-64-NEXT: (field name=wtable offset=40 // CHECK-64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=1 bitwise_takable=1))))) +// CHECK-64-NEXT: Mangled name: $s12existentials8HasErrorV // CHECK-32: Reflecting an existential. // CHECK-32: Instance pointer in child address space: 0x{{[0-9a-fA-F]+}} @@ -324,6 +365,7 @@ reflect(any: he) // CHECK-32-NEXT: (builtin size=4 alignment=4 stride=4 num_extra_inhabitants=1 bitwise_takable=1)) // CHECK-32-NEXT: (field name=wtable offset=20 // CHECK-32-NEXT: (builtin size=4 alignment=4 stride=4 num_extra_inhabitants=1 bitwise_takable=1))))) +// CHECK-32-NEXT: Mangled name: $s12existentials8HasErrorV reflect(error: MyError()) @@ -338,6 +380,7 @@ reflect(error: MyError()) // CHECK-64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=0 bitwise_takable=1 // CHECK-64-NEXT: (field name=_value offset=0 // CHECK-64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0 bitwise_takable=1))))) +// CHECK-64-NEXT: Mangled name: $s12existentials7MyErrorV // CHECK-32: Reflecting an error existential. // CHECK-32: Instance pointer in child address space: 0x{{[0-9a-fA-F]+}} @@ -350,5 +393,6 @@ reflect(error: MyError()) // CHECK-32-NEXT: (struct size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1 // CHECK-32-NEXT: (field name=_value offset=0 // CHECK-32-NEXT: (builtin size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1))))) +// CHECK-32-NEXT: Mangled name: $s12existentials7MyErrorV doneReflecting() diff --git a/validation-test/Reflection/existentials_objc.swift b/validation-test/Reflection/existentials_objc.swift index 143c07ed2f1e0..b631fe61061c8 100644 --- a/validation-test/Reflection/existentials_objc.swift +++ b/validation-test/Reflection/existentials_objc.swift @@ -27,6 +27,11 @@ if #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) { // CHECK: Type reference: // CHECK: (objective_c_class name=__NSCFNumber) reflect(object: NSNumber(123)) + + // Objective-C protocol: + // CHECK: Type info: + // CHECK: $sSo9NSCopying_Xl + reflect(any: { () -> NSCopying in NSString("abc") }()) } else { // The Swift 5.0 libraries don't support this test. class SkipTheTest {} From 984247abfc6ff7b9e11cf11605e6262ec01de058 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 21 Jan 2020 20:22:44 -0800 Subject: [PATCH 008/222] [build-script] Disable LZMA for swift-lldb (cherry picked from commit 774dd07c0e811dbfea5423b8e83790fecce6b5ab) --- utils/build-script-impl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/build-script-impl b/utils/build-script-impl index 05da81a05c59e..8997f825aaf96 100755 --- a/utils/build-script-impl +++ b/utils/build-script-impl @@ -1893,10 +1893,11 @@ for host in "${ALL_HOSTS[@]}"; do -DLLVM_DIR:PATH=${llvm_build_dir}/lib/cmake/llvm -DClang_DIR:PATH=${llvm_build_dir}/lib/cmake/clang -DSwift_DIR:PATH=${swift_build_dir}/lib/cmake/swift - -DLLDB_ENABLE_LUA=OFF - -DLLDB_ENABLE_PYTHON=ON - -DLLDB_ENABLE_LIBEDIT=ON -DLLDB_ENABLE_CURSES=ON + -DLLDB_ENABLE_LIBEDIT=ON + -DLLDB_ENABLE_PYTHON=ON + -DLLDB_ENABLE_LZMA=OFF + -DLLDB_ENABLE_LUA=OFF -DLLDB_PATH_TO_SWIFT_SOURCE:PATH="${SWIFT_SOURCE_DIR}" -DLLDB_IS_BUILDBOT_BUILD:BOOL="${LLDB_IS_BUILDBOT_BUILD}" -DLLDB_BUILD_DATE:STRING="\"${LLDB_BUILD_DATE}\"" From 5b5d2f600fde4a7b76c13ca203b68cc4619c1d8a Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Wed, 22 Jan 2020 14:34:19 -0800 Subject: [PATCH 009/222] Adjust to upstream changes Commit 7b30370e5bcf569fcdc15204d4c592163fd78cb3 from llvm-project changed DIBuilder::createModule. Adjust accordingly. --- lib/IRGen/IRGenDebugInfo.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 1e047b2060f00..dc673907a0b86 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -661,8 +661,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { StringRef Sysroot = IGM.Context.SearchPathOpts.SDKPath; llvm::DIModule *M = - DBuilder.createModule(Parent, Name, ConfigMacros, RemappedIncludePath, - Sysroot); + DBuilder.createModule(Parent, Name, ConfigMacros, RemappedIncludePath); DIModuleCache.insert({Key, llvm::TrackingMDNodeRef(M)}); return M; } From 06a829c72e102c827985ee9f2b653f55c5b63b8c Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Tue, 28 Jan 2020 19:32:52 -0800 Subject: [PATCH 010/222] IRGenDebugInfo: Pass Sysroot to DIBuilder::createModule (#29524) --- lib/IRGen/IRGenDebugInfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 8fffd34ac6ef6..0fb4e53d302c8 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -660,8 +660,8 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { } StringRef Sysroot = IGM.Context.SearchPathOpts.SDKPath; - llvm::DIModule *M = - DBuilder.createModule(Parent, Name, ConfigMacros, RemappedIncludePath); + llvm::DIModule *M = DBuilder.createModule(Parent, Name, ConfigMacros, + RemappedIncludePath, Sysroot); DIModuleCache.insert({Key, llvm::TrackingMDNodeRef(M)}); return M; } From d1e6438cbb6aa4c9359d02f58995b29e0779fee2 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Fri, 31 Jan 2020 13:08:04 -0800 Subject: [PATCH 011/222] Revert "IRGenDebugInfo: Pass Sysroot to DIBuilder::createModule (#29524)" (#29572) This reverts commit 06a829c72e102c827985ee9f2b653f55c5b63b8c. --- lib/IRGen/IRGenDebugInfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 0fb4e53d302c8..8fffd34ac6ef6 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -660,8 +660,8 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { } StringRef Sysroot = IGM.Context.SearchPathOpts.SDKPath; - llvm::DIModule *M = DBuilder.createModule(Parent, Name, ConfigMacros, - RemappedIncludePath, Sysroot); + llvm::DIModule *M = + DBuilder.createModule(Parent, Name, ConfigMacros, RemappedIncludePath); DIModuleCache.insert({Key, llvm::TrackingMDNodeRef(M)}); return M; } From 4a4a5fabb035844cfea18057e02809f4ebf4dd0b Mon Sep 17 00:00:00 2001 From: Fred Riss Date: Fri, 31 Jan 2020 15:31:25 -0800 Subject: [PATCH 012/222] Adapt the llvm.org DIBuilder API change. --- lib/IRGen/IRGenDebugInfo.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 8fffd34ac6ef6..743cbb7eae615 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -659,7 +659,6 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { } } - StringRef Sysroot = IGM.Context.SearchPathOpts.SDKPath; llvm::DIModule *M = DBuilder.createModule(Parent, Name, ConfigMacros, RemappedIncludePath); DIModuleCache.insert({Key, llvm::TrackingMDNodeRef(M)}); @@ -1691,13 +1690,18 @@ IRGenDebugInfoImpl::IRGenDebugInfoImpl(const IRGenOptions &Opts, DBuilder.createFile(DebugPrefixMap.remapPath(SourcePath), DebugPrefixMap.remapPath(Opts.DebugCompilationDir)); + llvm::StringRef SysRoot = IGM.Context.SearchPathOpts.SDKPath; TheCU = DBuilder.createCompileUnit( Lang, MainFile, Producer, Opts.shouldOptimize(), Opts.getDebugFlags(PD), MajorRuntimeVersion, SplitName, Opts.DebugInfoLevel > IRGenDebugInfoLevel::LineTables ? llvm::DICompileUnit::FullDebug - : llvm::DICompileUnit::LineTablesOnly); + : llvm::DICompileUnit::LineTablesOnly, + /* DWOId */ 0, /* SplitDebugInlining */ true, + /* DebugInfoForProfiling */ false, + llvm::DICompileUnit::DebugNameTableKind::Default, + /* RangesBaseAddress */ false, SysRoot); // Because the swift compiler relies on Clang to setup the Module, // the clang CU is always created first. Several dwarf-reading From a3afd8b1554cc4956233c33dad2b4ce46bafb0e3 Mon Sep 17 00:00:00 2001 From: Fred Riss Date: Fri, 31 Jan 2020 15:31:50 -0800 Subject: [PATCH 013/222] Adapt to llvm.org StringRef API change --- include/swift/ABI/TypeIdentity.h | 20 ++++----- include/swift/AST/Identifier.h | 4 +- include/swift/Basic/LangOptions.h | 2 +- include/swift/Demangling/TypeDecoder.h | 6 +-- include/swift/Remote/MetadataReader.h | 2 +- include/swift/SIL/SILFunction.h | 2 +- lib/AST/ASTContext.cpp | 2 +- lib/AST/ASTPrinter.cpp | 4 +- lib/AST/DiagnosticEngine.cpp | 2 +- lib/AST/FineGrainedDependencies.cpp | 2 +- ...endenciesSourceFileDepGraphConstructor.cpp | 44 +++++++++---------- lib/AST/Module.cpp | 2 +- lib/AST/SwiftNameTranslation.cpp | 2 +- lib/AST/USRGeneration.cpp | 6 +-- lib/ASTSectionImporter/ASTSectionImporter.cpp | 2 +- lib/Basic/SourceLoc.cpp | 2 +- lib/ClangImporter/ClangImporter.cpp | 19 ++++---- lib/Demangling/NodePrinter.cpp | 5 ++- lib/Demangling/OldRemangler.cpp | 2 +- lib/Driver/CoarseGrainedDependencyGraph.cpp | 7 +-- lib/Driver/Driver.cpp | 42 ++++++++++-------- .../FineGrainedDependencyDriverGraph.cpp | 24 +++++----- lib/Driver/Job.cpp | 20 ++++----- lib/Driver/ParseableOutput.cpp | 8 ++-- lib/Driver/SourceComparator.cpp | 4 +- lib/Driver/ToolChains.cpp | 8 ++-- .../ArgsToFrontendOptionsConverter.cpp | 4 +- .../ArgsToFrontendOutputsConverter.cpp | 12 ++--- lib/Frontend/CompilerInvocation.cpp | 41 +++++++++-------- lib/Frontend/DiagnosticVerifier.cpp | 2 +- lib/Frontend/Frontend.cpp | 2 +- lib/Frontend/ModuleInterfaceBuilder.cpp | 6 +-- lib/Frontend/ModuleInterfaceLoader.cpp | 13 +++--- lib/FrontendTool/FrontendTool.cpp | 39 ++++++++-------- lib/IDE/APIDigesterData.cpp | 4 +- lib/IDE/CodeCompletion.cpp | 22 +++++----- lib/IDE/CodeCompletionCache.cpp | 6 +-- lib/IDE/Formatting.cpp | 7 +-- lib/IDE/ModuleInterfacePrinting.cpp | 2 +- lib/IDE/REPLCodeCompletion.cpp | 4 +- lib/IDE/Refactoring.cpp | 9 ++-- lib/IDE/Utils.cpp | 10 ++--- lib/IRGen/GenMeta.cpp | 8 ++-- lib/IRGen/GenObjC.cpp | 2 +- lib/IRGen/GenReflection.cpp | 2 +- lib/IRGen/Linking.cpp | 2 +- lib/IRGen/MetadataRequest.cpp | 2 +- lib/Index/IndexRecord.cpp | 19 ++++---- lib/LLVMPasses/LLVMInlineTree.cpp | 11 ++--- lib/Migrator/APIDiffMigratorPass.cpp | 13 +++--- lib/Migrator/EditorAdapter.cpp | 2 +- lib/Migrator/FixitApplyDiagnosticConsumer.cpp | 2 +- lib/Migrator/MigrationState.cpp | 4 +- lib/Migrator/Migrator.cpp | 5 ++- lib/ParseSIL/ParseSIL.cpp | 2 +- lib/RemoteAST/RemoteAST.cpp | 6 +-- lib/SIL/SILConstants.cpp | 2 +- lib/SIL/SILCoverageMap.cpp | 2 +- lib/SIL/SILDeclRef.cpp | 6 +-- lib/SILGen/SILGenApply.cpp | 2 +- lib/SILGen/SILGenGlobalVariable.cpp | 2 +- .../LoopTransforms/ArrayPropertyOpt.cpp | 2 +- .../Mandatory/DIMemoryUseCollector.cpp | 2 +- .../Mandatory/DefiniteInitialization.cpp | 2 +- lib/SILOptimizer/PassManager/PassManager.cpp | 4 +- lib/Sema/CSDiagnostics.cpp | 4 +- lib/Sema/CalleeCandidateInfo.cpp | 10 ++--- lib/Sema/InstrumenterSupport.cpp | 3 +- lib/Sema/TypeCheckType.cpp | 2 +- lib/Serialization/SerializeDoc.cpp | 4 +- lib/Serialization/SerializedModuleLoader.cpp | 2 +- lib/TBDGen/TBDGen.cpp | 2 +- stdlib/public/Reflection/TypeRefBuilder.cpp | 23 +++++----- .../include/SourceKit/Support/Logging.h | 2 +- .../SourceKit/lib/Core/NotificationCenter.cpp | 4 +- .../lib/Support/ImmutableTextBuffer.cpp | 2 +- tools/SourceKit/lib/Support/UIDRegistry.cpp | 3 +- .../lib/SwiftLang/CodeCompletionOrganizer.cpp | 8 ++-- .../lib/SwiftLang/SwiftASTManager.cpp | 12 ++--- .../lib/SwiftLang/SwiftCompletion.cpp | 2 +- .../lib/SwiftLang/SwiftDocSupport.cpp | 10 ++--- tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp | 6 +-- .../lib/SwiftLang/SwiftEditorInterfaceGen.cpp | 20 ++++----- .../SourceKit/lib/SwiftLang/SwiftIndexing.cpp | 2 +- .../lib/SwiftLang/SwiftLangSupport.cpp | 6 +-- .../lib/SwiftLang/SwiftSourceDocInfo.cpp | 6 +-- .../tools/complete-test/complete-test.cpp | 6 +-- .../tools/sourcekitd-test/sourcekitd-test.cpp | 26 +++++------ .../bin/InProc/sourcekitdInProc.cpp | 2 +- .../sourcekitd/bin/XPC/Service/XPCService.cpp | 2 +- .../sourcekitd/lib/API/DocStructureArray.cpp | 8 ++-- .../tools/sourcekitd/lib/API/Requests.cpp | 16 +++---- .../lib/API/sourcekitdAPI-Common.cpp | 2 +- tools/driver/autolink_extract_main.cpp | 5 ++- tools/driver/modulewrap_main.cpp | 5 ++- tools/driver/swift_indent_main.cpp | 5 ++- .../lldb-moduleimport-test.cpp | 2 +- .../SILFunctionExtractor.cpp | 6 +-- .../ModuleAnalyzerNodes.cpp | 2 +- tools/swift-demangle/swift-demangle.cpp | 4 +- tools/swift-ide-test/XMLValidator.cpp | 2 +- tools/swift-refactor/swift-refactor.cpp | 2 +- 102 files changed, 389 insertions(+), 369 deletions(-) diff --git a/include/swift/ABI/TypeIdentity.h b/include/swift/ABI/TypeIdentity.h index 129417b3f36b6..a25b8be2d7ab8 100644 --- a/include/swift/ABI/TypeIdentity.h +++ b/include/swift/ABI/TypeIdentity.h @@ -129,16 +129,16 @@ class TypeImportInfo { value = value.drop_front(1); switch (component) { -#define case_setIfNonEmpty(FIELD) \ - case TypeImportComponent::FIELD: \ - check(!value.empty(), "incoming value of " #FIELD " was empty"); \ - check(FIELD.empty(), #FIELD " was already set"); \ - FIELD = value; \ - return true; \ - - case_setIfNonEmpty(ABIName) - case_setIfNonEmpty(SymbolNamespace) - case_setIfNonEmpty(RelatedEntityName) +#define case_setIfNonEmpty(FIELD) \ + case TypeImportComponent::FIELD: \ + check(!value.empty(), "incoming value of " #FIELD " was empty"); \ + check(FIELD.empty(), #FIELD " was already set"); \ + FIELD = StringType(value); \ + return true; + + case_setIfNonEmpty(ABIName) + case_setIfNonEmpty(SymbolNamespace) + case_setIfNonEmpty(RelatedEntityName) #undef case_setIfNonEmpty #undef check diff --git a/include/swift/AST/Identifier.h b/include/swift/AST/Identifier.h index 05b595d3953eb..e6d1ed4d398ac 100644 --- a/include/swift/AST/Identifier.h +++ b/include/swift/AST/Identifier.h @@ -83,7 +83,9 @@ class Identifier { const char *get() const { return Pointer; } StringRef str() const { return Pointer; } - + + explicit operator std::string() const { return std::string(Pointer); } + unsigned getLength() const { assert(Pointer != nullptr && "Tried getting length of empty identifier"); return ::strlen(Pointer); diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h index c125f046281c9..e550ec114d209 100644 --- a/include/swift/Basic/LangOptions.h +++ b/include/swift/Basic/LangOptions.h @@ -363,7 +363,7 @@ namespace swift { /// compiler flag. void addCustomConditionalCompilationFlag(StringRef Name) { assert(!Name.empty()); - CustomConditionalCompilationFlags.push_back(Name); + CustomConditionalCompilationFlags.push_back(Name.str()); } /// Determines if a given conditional compilation flag has been set. diff --git a/include/swift/Demangling/TypeDecoder.h b/include/swift/Demangling/TypeDecoder.h index 3d1af5b91f369..79450a6c9c591 100644 --- a/include/swift/Demangling/TypeDecoder.h +++ b/include/swift/Demangling/TypeDecoder.h @@ -384,7 +384,7 @@ class TypeDecoder { } case NodeKind::BuiltinTypeName: { auto mangledName = Demangle::mangleNode(Node); - return Builder.createBuiltinType(Node->getText(), mangledName); + return Builder.createBuiltinType(Node->getText().str(), mangledName); } case NodeKind::Metatype: case NodeKind::ExistentialMetatype: { @@ -683,12 +683,12 @@ class TypeDecoder { auto assocTypeChild = Node->getChild(1); auto member = assocTypeChild->getFirstChild()->getText(); if (assocTypeChild->getNumChildren() < 2) - return Builder.createDependentMemberType(member, base); + return Builder.createDependentMemberType(member.str(), base); auto protocol = decodeMangledProtocolType(assocTypeChild->getChild(1)); if (!protocol) return BuiltType(); - return Builder.createDependentMemberType(member, base, protocol); + return Builder.createDependentMemberType(member.str(), base, protocol); } case NodeKind::DependentAssociatedTypeRef: { if (Node->getNumChildren() < 2) diff --git a/include/swift/Remote/MetadataReader.h b/include/swift/Remote/MetadataReader.h index c117a4d15aba5..6fd8a575398e1 100644 --- a/include/swift/Remote/MetadataReader.h +++ b/include/swift/Remote/MetadataReader.h @@ -799,7 +799,7 @@ class MetadataReader { #if SWIFT_OBJC_INTEROP BuiltProtocolDecl objcProtocol(StringRef name) { - return builder.createObjCProtocolDecl(name); + return builder.createObjCProtocolDecl(name.str()); } #endif } resolver{Builder}; diff --git a/include/swift/SIL/SILFunction.h b/include/swift/SIL/SILFunction.h index 12087cac3151b..3cad495b25887 100644 --- a/include/swift/SIL/SILFunction.h +++ b/include/swift/SIL/SILFunction.h @@ -678,7 +678,7 @@ class SILFunction void addSemanticsAttr(StringRef Ref) { if (hasSemanticsAttr(Ref)) return; - SemanticsAttrSet.push_back(Ref); + SemanticsAttrSet.push_back(Ref.str()); std::sort(SemanticsAttrSet.begin(), SemanticsAttrSet.end()); } diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 822901ed7a57f..49f58c521e0af 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1434,7 +1434,7 @@ void ASTContext::addSearchPath(StringRef searchPath, bool isFramework, if (isFramework) SearchPathOpts.FrameworkSearchPaths.push_back({searchPath, isSystem}); else - SearchPathOpts.ImportSearchPaths.push_back(searchPath); + SearchPathOpts.ImportSearchPaths.push_back(searchPath.str()); if (auto *clangLoader = getClangModuleLoader()) clangLoader->addSearchPath(searchPath, isFramework, isSystem); diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index eeabdf4de8a65..ae3739661aaa8 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -265,7 +265,7 @@ std::string ASTPrinter::sanitizeUtf8(StringRef Text) { } Data += Step; } - return Builder.str(); + return std::string(Builder); } void ASTPrinter::anchor() {} @@ -4491,7 +4491,7 @@ AnyFunctionType::getParamListAsString(ArrayRef Params, SmallString<16> Scratch; llvm::raw_svector_ostream OS(Scratch); AnyFunctionType::printParams(Params, OS); - return OS.str(); + return std::string(OS.str()); } void LayoutConstraintInfo::print(raw_ostream &OS, diff --git a/lib/AST/DiagnosticEngine.cpp b/lib/AST/DiagnosticEngine.cpp index 56aa08790966a..6825407c765e2 100644 --- a/lib/AST/DiagnosticEngine.cpp +++ b/lib/AST/DiagnosticEngine.cpp @@ -989,7 +989,7 @@ void DiagnosticEngine::emitDiagnostic(const Diagnostic &diagnostic) { while (associatedNotes && *associatedNotes) { SmallString<128> notePath(getDiagnosticDocumentationPath()); llvm::sys::path::append(notePath, *associatedNotes); - educationalNotePaths.push_back(notePath.str()); + educationalNotePaths.push_back(notePath.str().str()); associatedNotes++; } info->EducationalNotePaths = educationalNotePaths; diff --git a/lib/AST/FineGrainedDependencies.cpp b/lib/AST/FineGrainedDependencies.cpp index 69256f1cffc93..b7425b3cad153 100644 --- a/lib/AST/FineGrainedDependencies.cpp +++ b/lib/AST/FineGrainedDependencies.cpp @@ -201,7 +201,7 @@ std::string DependencyKey::humanReadableName() const { return demangleTypeAsContext(context) + "." + name; case NodeKind::externalDepend: case NodeKind::sourceFileProvide: - return llvm::sys::path::filename(name); + return llvm::sys::path::filename(name).str(); case NodeKind::potentialMember: return demangleTypeAsContext(context) + ".*"; case NodeKind::nominal: diff --git a/lib/AST/FineGrainedDependenciesSourceFileDepGraphConstructor.cpp b/lib/AST/FineGrainedDependenciesSourceFileDepGraphConstructor.cpp index eba5fe33192bb..68ac9c293a2e7 100644 --- a/lib/AST/FineGrainedDependenciesSourceFileDepGraphConstructor.cpp +++ b/lib/AST/FineGrainedDependenciesSourceFileDepGraphConstructor.cpp @@ -77,11 +77,11 @@ SourceFileDepGraph::loadFromBuffer(llvm::MemoryBuffer &buffer) { //============================================================================== template static std::string getBaseName(const DeclT *decl) { - return decl->getBaseName().userFacingName(); + return decl->getBaseName().userFacingName().str(); } template static std::string getName(const DeclT *decl) { - return DeclBaseName(decl->getName()).userFacingName(); + return DeclBaseName(decl->getName()).userFacingName().str(); } static std::string mangleTypeAsContext(const NominalTypeDecl *NTD) { @@ -376,7 +376,7 @@ std::string DependencyKey::computeNameForProvidedEntity(StringRef swiftDeps) { assert(!swiftDeps.empty()); - return swiftDeps; + return swiftDeps.str(); } template <> @@ -438,28 +438,29 @@ std::string DependencyKey::computeNameForProvidedEntity< template <> DependencyKey DependencyKey::createDependedUponKey(StringRef name) { - return DependencyKey(NodeKind::topLevel, DeclAspect::interface, "", name); + return DependencyKey(NodeKind::topLevel, DeclAspect::interface, "", + name.str()); } template <> DependencyKey DependencyKey::createDependedUponKey(StringRef name) { return DependencyKey(NodeKind::dynamicLookup, DeclAspect::interface, "", - name); + name.str()); } template <> DependencyKey DependencyKey::createDependedUponKey(StringRef name) { return DependencyKey(NodeKind::externalDepend, DeclAspect::interface, "", - name); + name.str()); } template <> DependencyKey DependencyKey::createDependedUponKey(StringRef mangledName) { - return DependencyKey(NodeKind::nominal, DeclAspect::interface, mangledName, - ""); + return DependencyKey(NodeKind::nominal, DeclAspect::interface, + mangledName.str(), ""); } DependencyKey DependencyKey::createDependedUponKey(StringRef mangledHolderName, @@ -467,8 +468,8 @@ DependencyKey DependencyKey::createDependedUponKey(StringRef mangledHolderName, const bool isMemberBlank = memberBaseName.empty(); const auto kind = isMemberBlank ? NodeKind::potentialMember : NodeKind::member; - return DependencyKey(kind, DeclAspect::interface, mangledHolderName, - isMemberBlank ? "" : memberBaseName); + return DependencyKey(kind, DeclAspect::interface, mangledHolderName.str(), + isMemberBlank ? "" : memberBaseName.str()); } //============================================================================== @@ -578,11 +579,11 @@ class SourceFileDepGraphConstructor { SourceFileDeclFinder declFinder(SF, includePrivateDeps); std::vector> topLevelDepends; for (const auto &p: SF->getReferencedNameTracker()->getTopLevelNames()) - topLevelDepends.push_back(std::make_pair(p.getFirst().userFacingName(), p.getSecond())); + topLevelDepends.push_back(std::make_pair(p.getFirst().userFacingName().str(), p.getSecond())); std::vector> dynamicLookupDepends; for (const auto &p: SF->getReferencedNameTracker()->getDynamicLookupNames()) - dynamicLookupDepends.push_back(std::make_pair(p.getFirst().userFacingName(), p.getSecond())); + dynamicLookupDepends.push_back(std::make_pair(p.getFirst().userFacingName().str(), p.getSecond())); std::vector, bool>> memberDepends; for (const auto &p: SF->getReferencedNameTracker()->getUsedMembers()) { @@ -592,7 +593,7 @@ class SourceFileDepGraphConstructor { std::make_pair( std::make_tuple( mangleTypeAsContext(p.getFirst().first), - emptyOrUserFacingName, + emptyOrUserFacingName.str(), declIsPrivate(p.getFirst().first)), p.getSecond())); } @@ -906,7 +907,7 @@ static std::vector> getSimpleDepends(ArrayRef simpleNames) { std::vector> result; for (std::string n : simpleNames) - result.push_back({stripPrefix(n), cascades((n))}); + result.push_back({stripPrefix(n).str(), cascades((n))}); return result; } @@ -924,19 +925,18 @@ getCompoundDepends( for (std::string n : simpleNames) { // (On Linux, the compiler needs more verbosity than: // result.push_back({{n, "", false}, cascades(n)}); - result.push_back( - std::make_pair(std::make_tuple(stripPrefix(n), std::string(), false), - cascades(n))); + result.push_back(std::make_pair( + std::make_tuple(stripPrefix(n).str(), std::string(), false), + cascades(n))); } for (auto &p : compoundNames) { // Likewise, for Linux expand the following out: // result.push_back( // {{p.first, p.second, isPrivate(p.second)}, cascades(p.first)}); - result.push_back( - std::make_pair(std::make_tuple(stripPrefix(p.first), - stripPrefix(p.second), - isPrivate(p.second)), - cascades(p.first))); + result.push_back(std::make_pair(std::make_tuple(stripPrefix(p.first).str(), + stripPrefix(p.second).str(), + isPrivate(p.second)), + cascades(p.first))); } return result; } diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp index b08b2de0ab806..201d3f9f32630 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -1914,7 +1914,7 @@ StringRef ModuleEntity::getName() const { std::string ModuleEntity::getFullName() const { assert(!Mod.isNull()); if (auto SwiftMod = Mod.dyn_cast()) - return SwiftMod->getName().str(); + return std::string(SwiftMod->getName()); return getClangModule(Mod)->getFullModuleName(); } diff --git a/lib/AST/SwiftNameTranslation.cpp b/lib/AST/SwiftNameTranslation.cpp index dc4db68081d12..53109c7192277 100644 --- a/lib/AST/SwiftNameTranslation.cpp +++ b/lib/AST/SwiftNameTranslation.cpp @@ -71,7 +71,7 @@ getErrorDomainStringForObjC(const EnumDecl *ED) { outerTypes.push_back(D); } - std::string buffer = ED->getParentModule()->getNameStr(); + std::string buffer = ED->getParentModule()->getNameStr().str(); for (auto D : llvm::reverse(outerTypes)) { buffer += "."; buffer += D->getNameStr(); diff --git a/lib/AST/USRGeneration.cpp b/lib/AST/USRGeneration.cpp index 7f30e930391cb..9148ba8ecbf54 100644 --- a/lib/AST/USRGeneration.cpp +++ b/lib/AST/USRGeneration.cpp @@ -214,7 +214,7 @@ swift::USRGenerationRequest::evaluate(Evaluator &evaluator, if (auto ClangD = ClangN.getAsDecl()) { bool Ignore = clang::index::generateUSRForDecl(ClangD, Buffer); if (!Ignore) { - return Buffer.str(); + return std::string(Buffer); } else { return std::string(); } @@ -228,7 +228,7 @@ swift::USRGenerationRequest::evaluate(Evaluator &evaluator, ClangMacroInfo->getDefinitionLoc(), Importer.getClangASTContext().getSourceManager(), Buffer); if (!Ignore) - return Buffer.str(); + return std::string(Buffer); else return std::string(); } @@ -237,7 +237,7 @@ swift::USRGenerationRequest::evaluate(Evaluator &evaluator, if (printObjCUSR(D, OS)) { return std::string(); } else { - return OS.str(); + return std::string(OS.str()); } } diff --git a/lib/ASTSectionImporter/ASTSectionImporter.cpp b/lib/ASTSectionImporter/ASTSectionImporter.cpp index d3797d3020b23..0b0b4b6701eeb 100644 --- a/lib/ASTSectionImporter/ASTSectionImporter.cpp +++ b/lib/ASTSectionImporter/ASTSectionImporter.cpp @@ -47,7 +47,7 @@ bool swift::parseASTSection(MemoryBufferSerializedModuleLoader &Loader, // Register the memory buffer. Loader.registerMemoryBuffer(info.name, std::move(bitstream)); - foundModules.push_back(info.name); + foundModules.push_back(info.name.str()); } } else { llvm::dbgs() << "Unable to load module"; diff --git a/lib/Basic/SourceLoc.cpp b/lib/Basic/SourceLoc.cpp index 76547ff2e91f6..819fd17c260fb 100644 --- a/lib/Basic/SourceLoc.cpp +++ b/lib/Basic/SourceLoc.cpp @@ -105,7 +105,7 @@ bool SourceManager::openVirtualFile(SourceLoc loc, StringRef name, } CharSourceRange range = CharSourceRange(*this, loc, end); - VirtualFiles[end.Value.getPointer()] = { range, name, lineOffset }; + VirtualFiles[end.Value.getPointer()] = {range, name.str(), lineOffset}; CachedVFile = {nullptr, nullptr}; return true; } diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index f1c7656773a66..83ca32ac82ff1 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -481,9 +481,8 @@ getNormalInvocationArguments(std::vector &invocationArgStrs, if (!llvm::sys::fs::exists(shimsPath)) { shimsPath = searchPathOpts.SDKPath; llvm::sys::path::append(shimsPath, "usr", "lib", "swift", "shims"); - invocationArgStrs.insert(invocationArgStrs.end(), { - "-isystem", shimsPath.str() - }); + invocationArgStrs.insert(invocationArgStrs.end(), + {"-isystem", std::string(shimsPath)}); } // Construct the invocation arguments for the current target. @@ -638,7 +637,7 @@ getNormalInvocationArguments(std::vector &invocationArgStrs, llvm::sys::path::native(path); invocationArgStrs.push_back("-isystem"); - invocationArgStrs.push_back(path.str()); + invocationArgStrs.push_back(std::string(path)); } else { // On Darwin, Clang uses -isysroot to specify the include // system root. On other targets, it seems to use --sysroot. @@ -747,7 +746,7 @@ addCommonInvocationArguments(std::vector &invocationArgStrs, // Set the Clang resource directory to the path we computed. invocationArgStrs.push_back("-resource-dir"); - invocationArgStrs.push_back(resourceDir.str()); + invocationArgStrs.push_back(std::string(resourceDir)); } else { invocationArgStrs.push_back("-resource-dir"); invocationArgStrs.push_back(overrideResourceDir); @@ -1532,7 +1531,7 @@ ClangImporter::emitBridgingPCH(StringRef headerPath, auto &FrontendOpts = invocation.getFrontendOpts(); FrontendOpts.Inputs = {inputFile}; - FrontendOpts.OutputFile = outputPCHPath; + FrontendOpts.OutputFile = outputPCHPath.str(); FrontendOpts.ProgramAction = clang::frontend::GeneratePCH; auto action = wrapActionForIndexingIfEnabled( @@ -1556,7 +1555,7 @@ bool ClangImporter::emitPrecompiledModule(StringRef moduleMapPath, auto LangOpts = invocation.getLangOpts(); LangOpts->setCompilingModule(clang::LangOptions::CMK_ModuleMap); - LangOpts->ModuleName = moduleName; + LangOpts->ModuleName = moduleName.str(); LangOpts->CurrentModule = LangOpts->ModuleName; auto language = getLanguageFromOptions(LangOpts); @@ -1566,8 +1565,8 @@ bool ClangImporter::emitPrecompiledModule(StringRef moduleMapPath, auto &FrontendOpts = invocation.getFrontendOpts(); FrontendOpts.Inputs = {inputFile}; - FrontendOpts.OriginalModuleMap = moduleMapPath; - FrontendOpts.OutputFile = outputPath; + FrontendOpts.OriginalModuleMap = moduleMapPath.str(); + FrontendOpts.OutputFile = outputPath.str(); FrontendOpts.ProgramAction = clang::frontend::GenerateModule; auto action = wrapActionForIndexingIfEnabled( @@ -1595,7 +1594,7 @@ bool ClangImporter::dumpPrecompiledModule(StringRef modulePath, auto &FrontendOpts = invocation.getFrontendOpts(); FrontendOpts.Inputs = {inputFile}; - FrontendOpts.OutputFile = outputPath; + FrontendOpts.OutputFile = outputPath.str(); auto action = std::make_unique(); dumpInstance->ExecuteAction(*action); diff --git a/lib/Demangling/NodePrinter.cpp b/lib/Demangling/NodePrinter.cpp index 94a5247a7063c..67f34a6214292 100644 --- a/lib/Demangling/NodePrinter.cpp +++ b/lib/Demangling/NodePrinter.cpp @@ -691,7 +691,7 @@ class NodePrinter { auto Label = LabelList->getChild(Index); assert(Label && (Label->getKind() == Node::Kind::Identifier || Label->getKind() == Node::Kind::FirstElementMarker)); - return Label->getKind() == Node::Kind::Identifier ? Label->getText() + return Label->getKind() == Node::Kind::Identifier ? Label->getText().str() : "_"; }; @@ -1121,7 +1121,8 @@ NodePointer NodePrinter::print(NodePointer Node, bool asPrefixContext) { return nullptr; case Node::Kind::Suffix: if (Options.DisplayUnmangledSuffix) { - Printer << " with unmangled suffix " << QuotedString(Node->getText()); + Printer << " with unmangled suffix " + << QuotedString(Node->getText().str()); } return nullptr; case Node::Kind::Initializer: diff --git a/lib/Demangling/OldRemangler.cpp b/lib/Demangling/OldRemangler.cpp index 26ed34e4b6abd..2e5dce48aee67 100644 --- a/lib/Demangling/OldRemangler.cpp +++ b/lib/Demangling/OldRemangler.cpp @@ -48,7 +48,7 @@ namespace { } void setAnonymousContextDiscriminator(StringRef discriminator) { - AnonymousContextDiscriminator = discriminator; + AnonymousContextDiscriminator = discriminator.str(); } std::string takeAnonymousContextDiscriminator() { diff --git a/lib/Driver/CoarseGrainedDependencyGraph.cpp b/lib/Driver/CoarseGrainedDependencyGraph.cpp index 476006f922213..617d0c77ffe7b 100644 --- a/lib/Driver/CoarseGrainedDependencyGraph.cpp +++ b/lib/Driver/CoarseGrainedDependencyGraph.cpp @@ -268,7 +268,7 @@ CoarseGrainedDependencyGraphImpl::loadFromBuffer(const void *node, }); if (iter == provides.end()) - provides.push_back({name, kind}); + provides.push_back({name.str(), kind}); else iter->kindMask |= kind; @@ -276,7 +276,8 @@ CoarseGrainedDependencyGraphImpl::loadFromBuffer(const void *node, }; auto interfaceHashCallback = [this, node](StringRef hash) -> LoadResult { - auto insertResult = InterfaceHashes.insert(std::make_pair(node, hash)); + auto insertResult = + InterfaceHashes.insert(std::make_pair(node, hash.str())); if (insertResult.second) { // Treat a newly-added hash as up-to-date. This includes the initial @@ -286,7 +287,7 @@ CoarseGrainedDependencyGraphImpl::loadFromBuffer(const void *node, auto iter = insertResult.first; if (hash != iter->second) { - iter->second = hash; + iter->second = hash.str(); return LoadResult::AffectsDownstream; } diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 0432e58a6d4d4..2d81975ca0182 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1626,7 +1626,7 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args, // REPL mode should always use the REPL module. OI.ModuleName = "REPL"; } else if (const Arg *A = Args.getLastArg(options::OPT_o)) { - OI.ModuleName = llvm::sys::path::stem(A->getValue()); + OI.ModuleName = llvm::sys::path::stem(A->getValue()).str(); if ((OI.LinkAction == LinkKind::DynamicLibrary || OI.LinkAction == LinkKind::StaticLibrary) && !llvm::sys::path::extension(A->getValue()).empty() && @@ -1635,7 +1635,8 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args, OI.ModuleName.erase(0, strlen("lib")); } } else if (Inputs.size() == 1) { - OI.ModuleName = llvm::sys::path::stem(Inputs.front().second->getValue()); + OI.ModuleName = + llvm::sys::path::stem(Inputs.front().second->getValue()).str(); } if (!Lexer::isIdentifier(OI.ModuleName) || @@ -2160,10 +2161,10 @@ bool Driver::handleImmediateArgs(const ArgList &Args, const ToolChain &TC) { if (const Arg *A = Args.getLastArg(options::OPT_driver_use_frontend_path)) { DriverExecutable = A->getValue(); std::string commandString = - Args.getLastArgValue(options::OPT_driver_use_frontend_path); + Args.getLastArgValue(options::OPT_driver_use_frontend_path).str(); SmallVector commandArgs; StringRef(commandString).split(commandArgs, ';', -1, false); - DriverExecutable = commandArgs[0]; + DriverExecutable = commandArgs[0].str(); DriverExecutableArgs.assign(std::begin(commandArgs) + 1, std::end(commandArgs)); } @@ -2795,26 +2796,29 @@ Job *Driver::buildJobsForAction(Compilation &C, const JobAction *JA, [] { llvm::outs() << ", "; }); if (!InputActions.empty() && !J->getInputs().empty()) llvm::outs() << ", "; - interleave(J->getInputs().begin(), J->getInputs().end(), - [](const Job *Input) { - auto FileNames = Input->getOutput().getPrimaryOutputFilenames(); - interleave(FileNames.begin(), FileNames.end(), - [](const std::string &FileName) { - llvm::outs() << '"' << FileName << '"'; - }, - [] { llvm::outs() << ", "; }); - }, - [] { llvm::outs() << ", "; }); + interleave( + J->getInputs().begin(), J->getInputs().end(), + [](const Job *Input) { + auto FileNames = Input->getOutput().getPrimaryOutputFilenames(); + interleave( + FileNames.begin(), FileNames.end(), + [](StringRef FileName) { + llvm::outs() << '"' << FileName << '"'; + }, + [] { llvm::outs() << ", "; }); + }, + [] { llvm::outs() << ", "; }); llvm::outs() << "], output: {"; auto OutputFileNames = J->getOutput().getPrimaryOutputFilenames(); StringRef TypeName = file_types::getTypeName(J->getOutput().getPrimaryOutputType()); - interleave(OutputFileNames.begin(), OutputFileNames.end(), - [TypeName](const std::string &FileName) { - llvm::outs() << TypeName << ": \"" << FileName << '"'; - }, - [] { llvm::outs() << ", "; }); + interleave( + OutputFileNames.begin(), OutputFileNames.end(), + [TypeName](StringRef FileName) { + llvm::outs() << TypeName << ": \"" << FileName << '"'; + }, + [] { llvm::outs() << ", "; }); file_types::forAllTypes([&J](file_types::ID Ty) { StringRef AdditionalOutput = diff --git a/lib/Driver/FineGrainedDependencyDriverGraph.cpp b/lib/Driver/FineGrainedDependencyDriverGraph.cpp index 5bda1956f9b4c..78660d9bb4da5 100644 --- a/lib/Driver/FineGrainedDependencyDriverGraph.cpp +++ b/lib/Driver/FineGrainedDependencyDriverGraph.cpp @@ -54,8 +54,8 @@ ModuleDepGraph::simulateLoad(const Job *cmd, assert(!swiftDeps.empty()); StringRef interfaceHash = swiftDeps; auto sfdg = SourceFileDepGraph::simulateLoad( - swiftDeps, includePrivateDeps, hadCompilationError, interfaceHash, - simpleNames, compoundNames); + swiftDeps.str(), includePrivateDeps, hadCompilationError, + interfaceHash.str(), simpleNames, compoundNames); return loadFromSourceFileDepGraph(cmd, sfdg); } @@ -106,8 +106,8 @@ ModuleDepGraph::Changes ModuleDepGraph::loadFromPath(const Job *Cmd, return None; auto r = loadFromBuffer(Cmd, *buffer.get()); assert(path == getSwiftDeps(Cmd) && "Should be reading the job's swiftdeps"); - assert(!r || !nodeMap[path].empty() && - "Must have a node for the whole file"); + assert(!r || + !nodeMap[path.str()].empty() && "Must have a node for the whole file"); if (emitFineGrainedDependencyDotFileAfterEveryImport) emitDotFileForJob(diags, Cmd); if (verifyFineGrainedDependencyGraphAfterEveryImport) @@ -132,7 +132,7 @@ ModuleDepGraph::Changes ModuleDepGraph::loadFromSourceFileDepGraph( } bool ModuleDepGraph::haveAnyNodesBeenTraversedIn(const Job *cmd) const { - const StringRef swiftDeps = getSwiftDeps(cmd); + std::string swiftDeps = getSwiftDeps(cmd).str(); // optimization const auto fileKey = DependencyKey::createKeyForWholeSourceFile(swiftDeps); @@ -251,7 +251,7 @@ ModuleDepGraph::Changes ModuleDepGraph::integrate(const SourceFileDepGraph &g, FrontendStatsTracer tracer(stats, "fine-grained-dependencies-integrate"); // When done, disappearedNodes contains the nodes which no longer exist. - auto disappearedNodes = nodeMap[swiftDepsOfJob]; + auto disappearedNodes = nodeMap[swiftDepsOfJob.str()]; // When done, changeDependencyKeys contains a list of keys that changed // as a result of this integration. auto changedNodes = std::unordered_set(); @@ -299,7 +299,7 @@ ModuleDepGraph::PreexistingNodeIfAny ModuleDepGraph::findPreexistingMatch( } if (integrand->getIsProvides()) { const auto &preexistingNodeInPlaceIter = - matches->find(swiftDepsOfCompilationToBeIntegrated); + matches->find(swiftDepsOfCompilationToBeIntegrated.str()); if (preexistingNodeInPlaceIter != matches->end()) return std::make_pair(LocationOfPreexistingNode::here, preexistingNodeInPlaceIter->second); @@ -388,7 +388,7 @@ bool ModuleDepGraph::recordWhatUseDependsUpon( usesByDef[def->getKey()].insert(moduleUseNode).second; if (isNewUse && def->getKey().getKind() == NodeKind::externalDepend) { StringRef externalSwiftDeps = def->getKey().getName(); - externalDependencies.insert(externalSwiftDeps); + externalDependencies.insert(externalSwiftDeps.str()); useHasNewExternalDependency = true; } }); @@ -432,7 +432,7 @@ void ModuleDepGraph::forCorrespondingImplementationOfProvidedInterface( const auto &interfaceKey = interfaceNode->getKey(); const DependencyKey implementationKey( interfaceKey.getKind(), DeclAspect::implementation, - interfaceKey.getContext(), interfaceKey.getName()); + interfaceKey.getContext().str(), interfaceKey.getName().str()); if (const auto implementationNode = nodeMap.find(swiftDeps, implementationKey)) fn(implementationNode.getValue()); @@ -463,7 +463,7 @@ void ModuleDepGraph::forEachArc( void ModuleDepGraph::forEachNodeInJob( StringRef swiftDeps, function_ref fn) const { - if (const auto *nodesByKeys = nodeMap.find(swiftDeps).getPtrOrNull()) { + if (const auto *nodesByKeys = nodeMap.find(swiftDeps.str()).getPtrOrNull()) { for (const auto &keyAndNode : *nodesByKeys) fn(keyAndNode.second); } @@ -532,7 +532,7 @@ void ModuleDepGraph::emitDotFileForJob(DiagnosticEngine &diags, } void ModuleDepGraph::emitDotFile(DiagnosticEngine &diags, StringRef baseName) { - unsigned seqNo = dotFileSequenceNumber[baseName]++; + unsigned seqNo = dotFileSequenceNumber[baseName.str()]++; std::string fullName = baseName.str() + "-post-integration." + std::to_string(seqNo) + ".dot"; withOutputFile(diags, fullName, [&](llvm::raw_ostream &out) { @@ -630,7 +630,7 @@ void ModuleDepGraph::verifyNodeIsInRightEntryInNodeMap( void ModuleDepGraph::verifyExternalDependencyUniqueness( const DependencyKey &key) const { assert((key.getKind() != NodeKind::externalDepend || - externalDependencies.count(key.getName()) == 1) && + externalDependencies.count(key.getName().str()) == 1) && "Ensure each external dependency is tracked exactly once"); } diff --git a/lib/Driver/Job.cpp b/lib/Driver/Job.cpp index c6362335de7d8..85be25f007778 100644 --- a/lib/Driver/Job.cpp +++ b/lib/Driver/Job.cpp @@ -67,9 +67,9 @@ void CommandOutput::ensureEntry(StringRef PrimaryInputFile, assert(Type != file_types::TY_Nothing); auto &M = DerivedOutputMap.getOrCreateOutputMapForInput(PrimaryInputFile); if (Overwrite) { - M[Type] = OutputFile; + M[Type] = OutputFile.str(); } else { - auto res = M.insert(std::make_pair(Type, OutputFile)); + auto res = M.insert(std::make_pair(Type, OutputFile.str())); if (res.second) { // New entry, no need to compare. } else { @@ -408,20 +408,16 @@ void Job::printSummary(raw_ostream &os) const { } os << "{" << getSource().getClassName() << ": "; - interleave(Outputs, - [&](const std::string &Arg) { - os << llvm::sys::path::filename(Arg); - }, - [&] { os << ' '; }); + interleave( + Outputs, [&](StringRef Arg) { os << llvm::sys::path::filename(Arg); }, + [&] { os << ' '; }); if (actual_out > limit) { os << " ... " << (actual_out-limit) << " more"; } os << " <= "; - interleave(Inputs, - [&](const std::string &Arg) { - os << llvm::sys::path::filename(Arg); - }, - [&] { os << ' '; }); + interleave( + Inputs, [&](StringRef Arg) { os << llvm::sys::path::filename(Arg); }, + [&] { os << ' '; }); if (actual_in > limit) { os << " ... " << (actual_in-limit) << " more"; } diff --git a/lib/Driver/ParseableOutput.cpp b/lib/Driver/ParseableOutput.cpp index 0b110daad12ec..0277c4c10075b 100644 --- a/lib/Driver/ParseableOutput.cpp +++ b/lib/Driver/ParseableOutput.cpp @@ -48,7 +48,7 @@ namespace json { template <> struct ScalarEnumerationTraits { static void enumeration(Output &out, file_types::ID &value) { file_types::forAllTypes([&](file_types::ID ty) { - std::string typeName = file_types::getTypeName(ty); + std::string typeName = file_types::getTypeName(ty).str(); out.enumCase(value, typeName.c_str(), ty); }); } @@ -125,7 +125,7 @@ class DetailedCommandBasedMessage : public CommandBasedMessage { if (const auto *BJAction = dyn_cast(&Cmd.getSource())) { Inputs.push_back(CommandInput(OutFiles[BJAction->getInputIndex()])); } else { - for (const std::string FileName : OutFiles) { + for (llvm::StringRef FileName : OutFiles) { Inputs.push_back(CommandInput(FileName)); } } @@ -134,8 +134,8 @@ class DetailedCommandBasedMessage : public CommandBasedMessage { // TODO: set up Outputs appropriately. file_types::ID PrimaryOutputType = Cmd.getOutput().getPrimaryOutputType(); if (PrimaryOutputType != file_types::TY_Nothing) { - for (const std::string OutputFileName : Cmd.getOutput(). - getPrimaryOutputFilenames()) { + for (llvm::StringRef OutputFileName : + Cmd.getOutput().getPrimaryOutputFilenames()) { Outputs.push_back(OutputPair(PrimaryOutputType, OutputFileName)); } } diff --git a/lib/Driver/SourceComparator.cpp b/lib/Driver/SourceComparator.cpp index 2fccb91e779b6..4b2d3674036f6 100644 --- a/lib/Driver/SourceComparator.cpp +++ b/lib/Driver/SourceComparator.cpp @@ -70,7 +70,7 @@ SourceComparator::buildEquivalenceClasses() { std::unordered_map> rhsMap; for (auto index = regionsToCompare.start.rhs(); index < regionsToCompare.end.rhs(); ++index) - rhsMap[linesToCompare.rhs()[index]].push_back(index); + rhsMap[linesToCompare.rhs()[index].str()].push_back(index); return rhsMap; } @@ -86,7 +86,7 @@ SourceComparator::buildDAGOfSubsequences( for (auto i = regionsToCompare.start.lhs(); i < regionsToCompare.end.lhs(); ++i) { // What lines in rhs does the ith line in lhs match? - auto iter = rhsMap.find(linesToCompare.lhs()[i]); + auto iter = rhsMap.find(linesToCompare.lhs()[i].str()); if (iter == rhsMap.end()) continue; // no match in rhs auto &res = iter->second; diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 7ce44bb05a9c7..c8e0ec762be3e 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -1256,13 +1256,13 @@ void ToolChain::getRuntimeLibraryPaths(SmallVectorImpl &runtimeLibP StringRef SDKPath, bool shared) const { SmallString<128> scratchPath; getResourceDirPath(scratchPath, args, shared); - runtimeLibPaths.push_back(scratchPath.str()); + runtimeLibPaths.push_back(std::string(scratchPath)); // If there's a secondary resource dir, add it too. scratchPath.clear(); getSecondaryResourceDirPath(scratchPath, runtimeLibPaths[0]); if (!scratchPath.empty()) - runtimeLibPaths.push_back(scratchPath.str()); + runtimeLibPaths.push_back(std::string(scratchPath)); if (!SDKPath.empty()) { if (!scratchPath.empty()) { @@ -1271,12 +1271,12 @@ void ToolChain::getRuntimeLibraryPaths(SmallVectorImpl &runtimeLibP scratchPath = SDKPath; llvm::sys::path::append(scratchPath, "System", "iOSSupport"); llvm::sys::path::append(scratchPath, "usr", "lib", "swift"); - runtimeLibPaths.push_back(scratchPath.str()); + runtimeLibPaths.push_back(std::string(scratchPath)); } scratchPath = SDKPath; llvm::sys::path::append(scratchPath, "usr", "lib", "swift"); - runtimeLibPaths.push_back(scratchPath.str()); + runtimeLibPaths.push_back(std::string(scratchPath)); } } diff --git a/lib/Frontend/ArgsToFrontendOptionsConverter.cpp b/lib/Frontend/ArgsToFrontendOptionsConverter.cpp index 0958d6df7b64d..88802315cb7fc 100644 --- a/lib/Frontend/ArgsToFrontendOptionsConverter.cpp +++ b/lib/Frontend/ArgsToFrontendOptionsConverter.cpp @@ -457,7 +457,7 @@ bool ArgsToFrontendOptionsConverter::computeFallbackModuleName() { } // In order to pass some tests, must leave ModuleName empty. if (!Opts.InputsAndOutputs.hasInputs()) { - Opts.ModuleName = StringRef(); + Opts.ModuleName = std::string(); // FIXME: This is a bug that should not happen, but does in tests. // The compiler should bail out earlier, where "no frontend action was // selected". @@ -474,7 +474,7 @@ bool ArgsToFrontendOptionsConverter::computeFallbackModuleName() { ? outputFilenames->front() : Opts.InputsAndOutputs.getFilenameOfFirstInput(); - Opts.ModuleName = llvm::sys::path::stem(nameToStem); + Opts.ModuleName = llvm::sys::path::stem(nameToStem).str(); return false; } diff --git a/lib/Frontend/ArgsToFrontendOutputsConverter.cpp b/lib/Frontend/ArgsToFrontendOutputsConverter.cpp index fac378995366f..78b6f728a2c1d 100644 --- a/lib/Frontend/ArgsToFrontendOutputsConverter.cpp +++ b/lib/Frontend/ArgsToFrontendOutputsConverter.cpp @@ -222,7 +222,7 @@ OutputFilesComputer::deriveOutputFileFromParts(StringRef dir, llvm::SmallString<128> path(dir); llvm::sys::path::append(path, base); llvm::sys::path::replace_extension(path, Suffix); - return path.str(); + return std::string(path); } SupplementaryOutputPathsComputer::SupplementaryOutputPathsComputer( @@ -502,11 +502,13 @@ void SupplementaryOutputPathsComputer::deriveModulePathParameters( RequestedAction == FrontendOptions::ActionType::MergeModules || RequestedAction == FrontendOptions::ActionType::EmitModuleOnly || isSIB; - extension = file_types::getExtension( - isSIB ? file_types::TY_SIB : file_types::TY_SwiftModuleFile); + extension = file_types::getExtension(isSIB ? file_types::TY_SIB + : file_types::TY_SwiftModuleFile) + .str(); - mainOutputIfUsable = - canUseMainOutputForModule && !OutputFiles.empty() ? mainOutputFile : ""; + mainOutputIfUsable = canUseMainOutputForModule && !OutputFiles.empty() + ? mainOutputFile.str() + : ""; } static SupplementaryOutputPaths diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 40762133ccb58..08d231305f567 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -56,7 +56,7 @@ void CompilerInvocation::setMainExecutablePath(StringRef Path) { llvm::sys::path::remove_filename(DiagnosticDocsPath); // Remove /bin llvm::sys::path::append(DiagnosticDocsPath, "share", "doc", "swift", "diagnostics"); - DiagnosticOpts.DiagnosticDocumentationPath = DiagnosticDocsPath.str(); + DiagnosticOpts.DiagnosticDocumentationPath = std::string(DiagnosticDocsPath); } /// If we haven't explicitly passed -prebuilt-module-cache-path, set it to @@ -82,7 +82,7 @@ static void setDefaultPrebuiltCacheIfNecessary( platform = getPlatformNameForTriple(triple); } llvm::sys::path::append(defaultPrebuiltPath, platform, "prebuilt-modules"); - frontendOpts.PrebuiltModuleCachePath = defaultPrebuiltPath.str(); + frontendOpts.PrebuiltModuleCachePath = std::string(defaultPrebuiltPath); } static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts, @@ -95,7 +95,7 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts, llvm::sys::path::append(LibPath, LibSubDir); SearchPathOpts.RuntimeLibraryPaths.clear(); - SearchPathOpts.RuntimeLibraryPaths.push_back(LibPath.str()); + SearchPathOpts.RuntimeLibraryPaths.push_back(std::string(LibPath)); if (Triple.isOSDarwin()) SearchPathOpts.RuntimeLibraryPaths.push_back(DARWIN_OS_LIBRARY_PATH); @@ -109,14 +109,14 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts, if (!Triple.isOSDarwin()) llvm::sys::path::append(LibPath, swift::getMajorArchitectureName(Triple)); - SearchPathOpts.RuntimeLibraryImportPaths.push_back(LibPath.str()); + SearchPathOpts.RuntimeLibraryImportPaths.push_back(std::string(LibPath)); if (!SearchPathOpts.SDKPath.empty()) { if (tripleIsMacCatalystEnvironment(Triple)) { LibPath = SearchPathOpts.SDKPath; llvm::sys::path::append(LibPath, "System", "iOSSupport"); llvm::sys::path::append(LibPath, "usr", "lib", "swift"); - SearchPathOpts.RuntimeLibraryImportPaths.push_back(LibPath.str()); + SearchPathOpts.RuntimeLibraryImportPaths.push_back(std::string(LibPath)); } LibPath = SearchPathOpts.SDKPath; @@ -125,7 +125,7 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts, llvm::sys::path::append(LibPath, getPlatformNameForTriple(Triple)); llvm::sys::path::append(LibPath, swift::getMajorArchitectureName(Triple)); } - SearchPathOpts.RuntimeLibraryImportPaths.push_back(LibPath.str()); + SearchPathOpts.RuntimeLibraryImportPaths.push_back(std::string(LibPath)); } } @@ -178,7 +178,7 @@ setBridgingHeaderFromFrontendOptions(ClangImporterOptions &ImporterOpts, } void CompilerInvocation::setRuntimeResourcePath(StringRef Path) { - SearchPathOpts.RuntimeResourcePath = Path; + SearchPathOpts.RuntimeResourcePath = Path.str(); updateRuntimeLibraryPaths(SearchPathOpts, LangOpts.Target); } @@ -703,9 +703,8 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts, // Provide a working directory to Clang as well if there are any -Xcc // options, in case some of them are search-related. But do it at the // beginning, so that an explicit -Xcc -working-directory will win. - Opts.ExtraArgs.insert(Opts.ExtraArgs.begin(), { - "-working-directory", workingDirectory - }); + Opts.ExtraArgs.insert(Opts.ExtraArgs.begin(), + {"-working-directory", workingDirectory.str()}); } Opts.InferImportAsMember |= Args.hasArg(OPT_enable_infer_import_as_member); @@ -748,10 +747,10 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts, auto resolveSearchPath = [workingDirectory](StringRef searchPath) -> std::string { if (workingDirectory.empty() || path::is_absolute(searchPath)) - return searchPath; + return searchPath.str(); SmallString<64> fullPath{workingDirectory}; path::append(fullPath, searchPath); - return fullPath.str(); + return std::string(fullPath); }; for (const Arg *A : Args.filtered(OPT_I)) { @@ -1142,7 +1141,7 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args, // TODO: Should we support -fdebug-compilation-dir? llvm::SmallString<256> cwd; llvm::sys::fs::current_path(cwd); - Opts.DebugCompilationDir = cwd.str(); + Opts.DebugCompilationDir = std::string(cwd); } if (const Arg *A = Args.getLastArg(options::OPT_debug_info_format)) { @@ -1182,7 +1181,7 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args, for (const Arg *A : Args.filtered(OPT_Xcc)) { StringRef Opt = A->getValue(); if (Opt.startswith("-D") || Opt.startswith("-U")) - Opts.ClangDefines.push_back(Opt); + Opts.ClangDefines.push_back(Opt.str()); } for (const Arg *A : Args.filtered(OPT_l, OPT_framework)) { @@ -1226,7 +1225,7 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args, Opts.FunctionSections = Args.hasArg(OPT_function_sections); if (Args.hasArg(OPT_autolink_force_load)) - Opts.ForceLoadSymbolName = Args.getLastArgValue(OPT_module_link_name); + Opts.ForceLoadSymbolName = Args.getLastArgValue(OPT_module_link_name).str(); Opts.ModuleName = FrontendOpts.ModuleName; @@ -1459,8 +1458,8 @@ static bool ParseMigratorArgs(MigratorOptions &Opts, llvm::SmallString<128> authoredDataPath(basePath); llvm::sys::path::append(authoredDataPath, getScriptFileName("overlay", langVer)); // Add authored list first to take higher priority. - Opts.APIDigesterDataStorePaths.push_back(authoredDataPath.str()); - Opts.APIDigesterDataStorePaths.push_back(dataPath.str()); + Opts.APIDigesterDataStorePaths.push_back(std::string(authoredDataPath)); + Opts.APIDigesterDataStorePaths.push_back(std::string(dataPath)); } } @@ -1589,12 +1588,12 @@ CompilerInvocation::loadFromSerializedAST(StringRef data) { LangOpts.EffectiveLanguageVersion = info.compatibilityVersion; setTargetTriple(info.targetTriple); if (!extendedInfo.getSDKPath().empty()) - setSDKPath(extendedInfo.getSDKPath()); + setSDKPath(extendedInfo.getSDKPath().str()); auto &extraClangArgs = getClangImporterOptions().ExtraArgs; - extraClangArgs.insert(extraClangArgs.end(), - extendedInfo.getExtraClangImporterOptions().begin(), - extendedInfo.getExtraClangImporterOptions().end()); + for (StringRef Arg : extendedInfo.getExtraClangImporterOptions()) + extraClangArgs.push_back(Arg.str()); + return info.status; } diff --git a/lib/Frontend/DiagnosticVerifier.cpp b/lib/Frontend/DiagnosticVerifier.cpp index affacf1b309d3..9d0655cf39a30 100644 --- a/lib/Frontend/DiagnosticVerifier.cpp +++ b/lib/Frontend/DiagnosticVerifier.cpp @@ -350,7 +350,7 @@ bool DiagnosticVerifier::verifyFile(unsigned BufferID, llvm::SmallString<256> Buf; Expected.MessageRange = MatchStart.slice(2, End); Expected.MessageStr = - Lexer::getEncodedStringSegment(Expected.MessageRange, Buf); + Lexer::getEncodedStringSegment(Expected.MessageRange, Buf).str(); if (PrevExpectedContinuationLine) Expected.LineNo = PrevExpectedContinuationLine; else diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index 96234f6fc0ccd..b7a21176276a7 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -721,7 +721,7 @@ void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) { } if (shouldImplicityImportSwiftOnoneSupportModule(Invocation)) { Invocation.getFrontendOptions().ImplicitImportModuleNames.push_back( - SWIFT_ONONE_SUPPORT); + SWIFT_ONONE_SUPPORT.str()); } const ImplicitImports implicitImports(*this); diff --git a/lib/Frontend/ModuleInterfaceBuilder.cpp b/lib/Frontend/ModuleInterfaceBuilder.cpp index 2f7a40f255c21..14dd87b51bfe7 100644 --- a/lib/Frontend/ModuleInterfaceBuilder.cpp +++ b/lib/Frontend/ModuleInterfaceBuilder.cpp @@ -77,7 +77,7 @@ void ModuleInterfaceBuilder::configureSubInvocationInputsAndOutputs( SOPs.ModuleOutputPath = OutPath.str(); // Pick a primary output path that will cause problems to use. - StringRef MainOut = "/"; + std::string MainOut = "/"; SubFEOpts.InputsAndOutputs .setMainAndSupplementaryOutputs({MainOut}, {SOPs}); } @@ -98,7 +98,7 @@ void ModuleInterfaceBuilder::configureSubInvocation( subInvocation.setModuleName(moduleName); subInvocation.setClangModuleCachePath(moduleCachePath); subInvocation.getFrontendOptions().PrebuiltModuleCachePath = - prebuiltCachePath; + prebuiltCachePath.str(); subInvocation.getFrontendOptions().TrackSystemDeps = trackSystemDependencies; // Respect the detailed-record preprocessor setting of the parent context. @@ -346,7 +346,7 @@ bool ModuleInterfaceBuilder::buildSwiftModuleInternal( // Setup the callbacks for serialization, which can occur during the // optimization pipeline. SerializationOptions SerializationOpts; - std::string OutPathStr = OutPath; + std::string OutPathStr = OutPath.str(); SerializationOpts.OutputPath = OutPathStr.c_str(); SerializationOpts.ModuleLinkName = FEOpts.ModuleLinkName; SerializationOpts.AutolinkForceLoad = diff --git a/lib/Frontend/ModuleInterfaceLoader.cpp b/lib/Frontend/ModuleInterfaceLoader.cpp index 9c925a58cda04..c696d5135cd77 100644 --- a/lib/Frontend/ModuleInterfaceLoader.cpp +++ b/lib/Frontend/ModuleInterfaceLoader.cpp @@ -46,14 +46,13 @@ std::string swift::getModuleCachePathFromClang(const clang::CompilerInstance &Clang) { if (!Clang.hasPreprocessor()) return ""; - std::string SpecificModuleCachePath = Clang.getPreprocessor() - .getHeaderSearchInfo() - .getModuleCachePath(); + std::string SpecificModuleCachePath = + Clang.getPreprocessor().getHeaderSearchInfo().getModuleCachePath().str(); // The returned-from-clang module cache path includes a suffix directory // that is specific to the clang version and invocation; we want the // directory above that. - return llvm::sys::path::parent_path(SpecificModuleCachePath); + return llvm::sys::path::parent_path(SpecificModuleCachePath).str(); } #pragma mark - Forwarding Modules @@ -241,7 +240,7 @@ struct ModuleRebuildInfo { for (auto &mod : outOfDateModules) { if (mod.path == path) return mod; } - outOfDateModules.push_back({path, None, ModuleKind::Normal, {}, {}}); + outOfDateModules.push_back({path.str(), None, ModuleKind::Normal, {}, {}}); return outOfDateModules.back(); } @@ -261,14 +260,14 @@ struct ModuleRebuildInfo { /// at \c modulePath. void addOutOfDateDependency(StringRef modulePath, StringRef depPath) { getOrInsertOutOfDateModule(modulePath) - .outOfDateDependencies.push_back(depPath); + .outOfDateDependencies.push_back(depPath.str()); } /// Registers a missing dependency at \c depPath for the module /// at \c modulePath. void addMissingDependency(StringRef modulePath, StringRef depPath) { getOrInsertOutOfDateModule(modulePath) - .missingDependencies.push_back(depPath); + .missingDependencies.push_back(depPath.str()); } /// Determines if we saw the given module path and registered is as out of diff --git a/lib/FrontendTool/FrontendTool.cpp b/lib/FrontendTool/FrontendTool.cpp index 9b2fc8fc8ff13..43c48110e28b7 100644 --- a/lib/FrontendTool/FrontendTool.cpp +++ b/lib/FrontendTool/FrontendTool.cpp @@ -96,7 +96,7 @@ using namespace swift; static std::string displayName(StringRef MainExecutablePath) { - std::string Name = llvm::sys::path::stem(MainExecutablePath); + std::string Name = llvm::sys::path::stem(MainExecutablePath).str(); Name += " -frontend"; return Name; } @@ -313,21 +313,20 @@ static void computeSwiftModuleTraceInfo( // this is good enough. : buffer.str(); - traceInfo.push_back({ - /*Name=*/ - depMod->getName(), - /*Path=*/ - realDepPath, - // TODO: There is an edge case which is not handled here. - // When we build a framework using -import-underlying-module, or an - // app/test using -import-objc-header, we should look at the direct - // imports of the bridging modules, and mark those as our direct - // imports. - /*IsImportedDirectly=*/ - importedModules.find(depMod) != importedModules.end(), - /*SupportsLibraryEvolution=*/ - depMod->isResilient() - }); + traceInfo.push_back( + {/*Name=*/ + depMod->getName(), + /*Path=*/ + realDepPath.str(), + // TODO: There is an edge case which is not handled here. + // When we build a framework using -import-underlying-module, or an + // app/test using -import-objc-header, we should look at the direct + // imports of the bridging modules, and mark those as our direct + // imports. + /*IsImportedDirectly=*/ + importedModules.find(depMod) != importedModules.end(), + /*SupportsLibraryEvolution=*/ + depMod->isResilient()}); buffer.clear(); continue; @@ -434,9 +433,7 @@ static bool emitLoadedModuleTraceIfNeeded(ModuleDecl *mainModule, LoadedModuleTraceFormat trace = { /*version=*/LoadedModuleTraceFormat::CurrentVersion, /*name=*/mainModule->getName(), - /*arch=*/ctxt.LangOpts.Target.getArchName(), - swiftModules - }; + /*arch=*/ctxt.LangOpts.Target.getArchName().str(), swiftModules}; // raw_fd_ostream is unbuffered, and we may have multiple processes writing, // so first write to memory and then dump the buffer to the trace file. @@ -590,7 +587,7 @@ class JSONFixitWriter if (!(FixitAll || shouldTakeFixit(Info))) return; for (const auto &Fix : Info.FixIts) { - AllEdits.push_back({SM, Fix.getRange(), Fix.getText()}); + AllEdits.push_back({SM, Fix.getRange(), Fix.getText().str()}); } } @@ -1703,7 +1700,7 @@ static bool dumpAPI(ModuleDecl *Mod, StringRef OutDir) { SmallString<256> Path = OutDir; StringRef Filename = SF->getFilename(); path::append(Path, path::filename(Filename)); - return Path.str(); + return std::string(Path); }; std::unordered_set Filenames; diff --git a/lib/IDE/APIDigesterData.cpp b/lib/IDE/APIDigesterData.cpp index 97c15e773dde7..83ffc6f6bda35 100644 --- a/lib/IDE/APIDigesterData.cpp +++ b/lib/IDE/APIDigesterData.cpp @@ -87,7 +87,7 @@ CommonDiffItem(SDKNodeKind NodeKind, NodeAnnotation DiffKind, ChildIndex.split(Pieces, ":"); std::transform(Pieces.begin(), Pieces.end(), std::back_inserter(ChildIndexPieces), - [](StringRef Piece) { return std::stoi(Piece); }); + [](StringRef Piece) { return std::stoi(Piece.str()); }); } StringRef swift::ide::api::CommonDiffItem::head() { @@ -319,7 +319,7 @@ static StringRef getScalarString(llvm::yaml::Node *N) { }; static int getScalarInt(llvm::yaml::Node *N) { - return std::stoi(cast(N)->getRawValue()); + return std::stoi(cast(N)->getRawValue().str()); }; static APIDiffItem* diff --git a/lib/IDE/CodeCompletion.cpp b/lib/IDE/CodeCompletion.cpp index f8e20c52b1e38..d924ac3b27eb6 100644 --- a/lib/IDE/CodeCompletion.cpp +++ b/lib/IDE/CodeCompletion.cpp @@ -5565,7 +5565,7 @@ void CodeCompletionCallbacksImpl::doneParsing() { std::vector AccessPath; for (auto Piece : Path) { - AccessPath.push_back(Piece.Item.str()); + AccessPath.push_back(std::string(Piece.Item)); } StringRef ModuleFilename = TheModule->getModuleFilename(); @@ -5574,15 +5574,17 @@ void CodeCompletionCallbacksImpl::doneParsing() { if (!ModuleFilename.empty()) { auto &Ctx = TheModule->getASTContext(); CodeCompletionCache::Key K{ - ModuleFilename, TheModule->getName().str(), AccessPath, - Request.NeedLeadingDot, - SF.hasTestableOrPrivateImport( - AccessLevel::Internal, TheModule, - SourceFile::ImportQueryKind::TestableOnly), - SF.hasTestableOrPrivateImport( - AccessLevel::Internal, TheModule, - SourceFile::ImportQueryKind::PrivateOnly), - Ctx.LangOpts.CodeCompleteInitsInPostfixExpr}; + ModuleFilename.str(), + std::string(TheModule->getName()), + AccessPath, + Request.NeedLeadingDot, + SF.hasTestableOrPrivateImport( + AccessLevel::Internal, TheModule, + SourceFile::ImportQueryKind::TestableOnly), + SF.hasTestableOrPrivateImport( + AccessLevel::Internal, TheModule, + SourceFile::ImportQueryKind::PrivateOnly), + Ctx.LangOpts.CodeCompleteInitsInPostfixExpr}; using PairType = llvm::DenseSet>::iterator; diff --git a/lib/IDE/CodeCompletionCache.cpp b/lib/IDE/CodeCompletionCache.cpp index dd63357194c35..44632bc5b9bbd 100644 --- a/lib/IDE/CodeCompletionCache.cpp +++ b/lib/IDE/CodeCompletionCache.cpp @@ -437,7 +437,7 @@ static std::string getName(StringRef cacheDirectory, llvm::APInt(64, uint64_t(hash)).toStringUnsigned(hashStr, /*Radix*/ 36); OSS << "-" << hashStr << ".completions"; - return name.str(); + return std::string(name); } Optional @@ -490,8 +490,8 @@ OnDiskCodeCompletionCache::getFromFile(StringRef filename) { return None; // Make up a key for readCachedModule. - CodeCompletionCache::Key K{filename, "", {}, false, - false, false, false}; + CodeCompletionCache::Key K{filename.str(), "", {}, false, + false, false, false}; // Read the cached results. auto V = CodeCompletionCache::createValue(); diff --git a/lib/IDE/Formatting.cpp b/lib/IDE/Formatting.cpp index 714116fce3ee1..f0344a4bbc026 100644 --- a/lib/IDE/Formatting.cpp +++ b/lib/IDE/Formatting.cpp @@ -901,8 +901,9 @@ class CodeFormatter { } if (FC.IsInStringLiteral()) { - return std::make_pair(LineRange(LineIndex, 1), - swift::ide::getTextForLine(LineIndex, Text, /*Trim*/false)); + return std::make_pair( + LineRange(LineIndex, 1), + swift::ide::getTextForLine(LineIndex, Text, /*Trim*/ false).str()); } // Take the current indent position of the outer context, then add another @@ -950,7 +951,7 @@ class CodeFormatter { IndentedLine.assign(ExpandedIndent / FmtOptions.TabWidth, '\t'); else IndentedLine.assign(ExpandedIndent, ' '); - IndentedLine.append(Line); + IndentedLine.append(Line.str()); // Return affected line range, which can later be more than one line. LineRange range = LineRange(LineIndex, 1); diff --git a/lib/IDE/ModuleInterfacePrinting.cpp b/lib/IDE/ModuleInterfacePrinting.cpp index b061bebbfa362..975ea7b7243a4 100644 --- a/lib/IDE/ModuleInterfacePrinting.cpp +++ b/lib/IDE/ModuleInterfacePrinting.cpp @@ -159,7 +159,7 @@ static void printTypeNameToString(Type Ty, std::string &Text) { SmallString<128> Buffer; llvm::raw_svector_ostream OS(Buffer); Ty->print(OS); - Text = OS.str(); + Text = std::string(OS.str()); } bool swift::ide:: diff --git a/lib/IDE/REPLCodeCompletion.cpp b/lib/IDE/REPLCodeCompletion.cpp index 247ddb4d0e473..0ac30c82388ea 100644 --- a/lib/IDE/REPLCodeCompletion.cpp +++ b/lib/IDE/REPLCodeCompletion.cpp @@ -248,7 +248,7 @@ void REPLCompletions::populate(SourceFile &SF, StringRef EnteredCode) { if (!Tokens.empty()) { Token &LastToken = Tokens.back(); if (LastToken.is(tok::identifier) || LastToken.isKeyword()) { - Prefix = LastToken.getText(); + Prefix = LastToken.getText().str(); unsigned Offset = Ctx.SourceMgr.getLocOffsetInBuffer(LastToken.getLoc(), BufferID); @@ -275,7 +275,7 @@ StringRef REPLCompletions::getRoot() const { return Root.getValue(); } - std::string RootStr = CookedResults[0].InsertableString; + std::string RootStr = CookedResults[0].InsertableString.str(); for (auto R : CookedResults) { if (R.NumBytesToErase != 0) { RootStr.resize(0); diff --git a/lib/IDE/Refactoring.cpp b/lib/IDE/Refactoring.cpp index 8ceded06c3da7..22e2aaed29a51 100644 --- a/lib/IDE/Refactoring.cpp +++ b/lib/IDE/Refactoring.cpp @@ -2986,8 +2986,11 @@ static std::string insertUnderscore(StringRef Text) { static void insertUnderscoreInDigits(StringRef Digits, llvm::raw_ostream &OS) { - std::string BeforePoint, AfterPoint; - std::tie(BeforePoint, AfterPoint) = Digits.split('.'); + StringRef BeforePointRef, AfterPointRef; + std::tie(BeforePointRef, AfterPointRef) = Digits.split('.'); + + std::string BeforePoint(BeforePointRef); + std::string AfterPoint(AfterPointRef); // Insert '_' for the part before the decimal point. std::reverse(BeforePoint.begin(), BeforePoint.end()); @@ -3486,7 +3489,7 @@ refactorSwiftModule(ModuleDecl *M, RefactoringOptions Opts, // Use the default name if not specified. if (Opts.PreferredName.empty()) { - Opts.PreferredName = getDefaultPreferredName(Opts.Kind); + Opts.PreferredName = getDefaultPreferredName(Opts.Kind).str(); } switch (Opts.Kind) { diff --git a/lib/IDE/Utils.cpp b/lib/IDE/Utils.cpp index a52c6570e178f..1df42ce54e976 100644 --- a/lib/IDE/Utils.cpp +++ b/lib/IDE/Utils.cpp @@ -345,7 +345,7 @@ bool ide::initInvocationByClangArguments(ArrayRef ArgList, llvm::SmallString<64> Str; Str += "-fmodule-name="; Str += ClangInvok->getLangOpts()->CurrentModule; - CCArgs.push_back(Str.str()); + CCArgs.push_back(std::string(Str)); } if (PPOpts.DetailedRecord) { @@ -354,7 +354,7 @@ bool ide::initInvocationByClangArguments(ArrayRef ArgList, if (!ClangInvok->getFrontendOpts().Inputs.empty()) { Invok.getFrontendOptions().ImplicitObjCHeaderPath = - ClangInvok->getFrontendOpts().Inputs[0].getFile(); + ClangInvok->getFrontendOpts().Inputs[0].getFile().str(); } return false; @@ -497,7 +497,7 @@ static std::string getPlistEntry(const llvm::Twine &Path, StringRef KeyName) { std::tie(CurLine, Lines) = Lines.split('\n'); unsigned Begin = CurLine.find("") + strlen(""); unsigned End = CurLine.find(""); - return CurLine.substr(Begin, End-Begin); + return CurLine.substr(Begin, End - Begin).str(); } } @@ -508,7 +508,7 @@ std::string ide::getSDKName(StringRef Path) { std::string Name = getPlistEntry(llvm::Twine(Path)+"/SDKSettings.plist", "CanonicalName"); if (Name.empty() && Path.endswith(".sdk")) { - Name = llvm::sys::path::filename(Path).drop_back(strlen(".sdk")); + Name = llvm::sys::path::filename(Path).drop_back(strlen(".sdk")).str(); } return Name; } @@ -850,7 +850,7 @@ struct swift::ide::SourceEditJsonConsumer::Implementation { } void accept(SourceManager &SM, CharSourceRange Range, llvm::StringRef Text) { - AllEdits.push_back({SM, Range, Text}); + AllEdits.push_back({SM, Range, Text.str()}); } }; diff --git a/lib/IRGen/GenMeta.cpp b/lib/IRGen/GenMeta.cpp index 392b6c4159f10..87e3eaa4a71fc 100644 --- a/lib/IRGen/GenMeta.cpp +++ b/lib/IRGen/GenMeta.cpp @@ -992,10 +992,10 @@ namespace { abiName = synthesizedTypeAttr->originalTypeName; getMutableImportInfo().RelatedEntityName = - synthesizedTypeAttr->getManglingName(); + std::string(synthesizedTypeAttr->getManglingName()); - // Otherwise, if this was imported from a Clang declaration, use that - // declaration's name as the ABI name. + // Otherwise, if this was imported from a Clang declaration, use that + // declaration's name as the ABI name. } else if (auto clangDecl = Mangle::ASTMangler::getClangDeclForMangling(Type)) { abiName = clangDecl->getName(); @@ -1012,7 +1012,7 @@ namespace { // If the ABI name differs from the user-facing name, add it as // an override. if (!abiName.empty() && abiName != UserFacingName) { - getMutableImportInfo().ABIName = abiName; + getMutableImportInfo().ABIName = std::string(abiName); } } diff --git a/lib/IRGen/GenObjC.cpp b/lib/IRGen/GenObjC.cpp index 77ce2bedaedf6..90802888dcd1a 100644 --- a/lib/IRGen/GenObjC.cpp +++ b/lib/IRGen/GenObjC.cpp @@ -511,7 +511,7 @@ llvm::Constant *IRGenModule::getAddrOfObjCSelectorRef(SILDeclRef method) { std::string IRGenModule::getObjCSelectorName(SILDeclRef method) { assert(method.isForeign); - return Selector(method).str(); + return Selector(method).str().str(); } static llvm::Value *emitSuperArgument(IRGenFunction &IGF, diff --git a/lib/IRGen/GenReflection.cpp b/lib/IRGen/GenReflection.cpp index 04b269a990675..aef601ddbdf05 100644 --- a/lib/IRGen/GenReflection.cpp +++ b/lib/IRGen/GenReflection.cpp @@ -1193,7 +1193,7 @@ static std::string getReflectionSectionName(IRGenModule &IGM, OS << "__TEXT,__swift5_" << LongName << ", regular, no_dead_strip"; break; } - return OS.str(); + return std::string(OS.str()); } const char *IRGenModule::getFieldTypeMetadataSectionName() { diff --git a/lib/IRGen/Linking.cpp b/lib/IRGen/Linking.cpp index 19cb5949d15aa..cdb164789cbaa 100644 --- a/lib/IRGen/Linking.cpp +++ b/lib/IRGen/Linking.cpp @@ -405,7 +405,7 @@ std::string LinkEntity::mangleAsString() const { } case Kind::SILGlobalVariable: - return getSILGlobalVariable()->getName(); + return getSILGlobalVariable()->getName().str(); case Kind::ReflectionBuiltinDescriptor: return mangler.mangleReflectionBuiltinDescriptor(getType()); diff --git a/lib/IRGen/MetadataRequest.cpp b/lib/IRGen/MetadataRequest.cpp index 5b9f33dbb2cd3..fd7296018dfaf 100644 --- a/lib/IRGen/MetadataRequest.cpp +++ b/lib/IRGen/MetadataRequest.cpp @@ -300,7 +300,7 @@ llvm::Constant *IRGenModule::getAddrOfStringForMetadataRef( llvm::Constant *IRGenModule::getAddrOfStringForTypeRef(StringRef str, MangledTypeRefRole role){ - return getAddrOfStringForTypeRef(SymbolicMangling{str, {}}, role); + return getAddrOfStringForTypeRef(SymbolicMangling{str.str(), {}}, role); } llvm::Constant *IRGenModule::getAddrOfStringForTypeRef( diff --git a/lib/Index/IndexRecord.cpp b/lib/Index/IndexRecord.cpp index 08367ca19c899..c05fcaa6d4a29 100644 --- a/lib/Index/IndexRecord.cpp +++ b/lib/Index/IndexRecord.cpp @@ -337,8 +337,9 @@ recordSourceFile(SourceFile *SF, StringRef indexStorePath, llvm::function_ref callback) { std::string recordFile; bool failed = false; - auto consumer = makeRecordingConsumer(SF->getFilename(), indexStorePath, - &diags, &recordFile, &failed); + auto consumer = + makeRecordingConsumer(SF->getFilename().str(), indexStorePath.str(), + &diags, &recordFile, &failed); indexSourceFile(SF, *consumer); if (!failed && !recordFile.empty()) @@ -407,13 +408,13 @@ static void addModuleDependencies(ArrayRef imports, case FileUnitKind::ClangModule: { auto *LFU = cast(FU); if (auto F = fileMgr.getFile(LFU->getFilename())) { - std::string moduleName = mod->getNameStr(); + std::string moduleName = mod->getNameStr().str(); bool withoutUnitName = true; if (FU->getKind() == FileUnitKind::ClangModule) { withoutUnitName = false; auto clangModUnit = cast(LFU); if (auto clangMod = clangModUnit->getUnderlyingClangModule()) { - moduleName = clangMod->getTopLevelModuleName(); + moduleName = clangMod->getTopLevelModuleName().str(); // FIXME: clang's -Rremarks do not seem to go through Swift's // diagnostic emitter. clang::index::emitIndexDataForModuleFile(clangMod, @@ -455,7 +456,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module, DiagnosticEngine &diags, IndexUnitWriter &parentUnitWriter) { StringRef filename = module->getModuleFilename(); - std::string moduleName = module->getNameStr(); + std::string moduleName = module->getNameStr().str(); std::string error; auto isUptodateOpt = parentUnitWriter.isUnitUpToDateForOutputFile(/*FilePath=*/filename, @@ -477,7 +478,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module, if (!module->isStdlibModule()) { std::string recordFile; bool failed = false; - auto consumer = makeRecordingConsumer(filename, indexStorePath, + auto consumer = makeRecordingConsumer(filename.str(), indexStorePath.str(), &diags, &recordFile, &failed); indexModule(module, *consumer); @@ -522,7 +523,9 @@ emitDataForSwiftSerializedModule(ModuleDecl *module, appendGroupNameForFilename(groupName, fileNameWithGroup); std::string outRecordFile; - failed = failed || writeRecord(tracker, fileNameWithGroup.str(), indexStorePath, &diags, outRecordFile); + failed = + failed || writeRecord(tracker, std::string(fileNameWithGroup), + indexStorePath.str(), &diags, outRecordFile); if (failed) return false; records.emplace_back(outRecordFile, moduleName.str()); @@ -538,7 +541,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module, // FIXME: Get real values for the following. StringRef swiftVersion; StringRef sysrootPath = clangCI.getHeaderSearchOpts().Sysroot; - std::string indexUnitToken = module->getModuleFilename(); + std::string indexUnitToken = module->getModuleFilename().str(); // For indexing serialized modules 'debug compilation' is irrelevant, so // set it to true by default. bool isDebugCompilation = true; diff --git a/lib/LLVMPasses/LLVMInlineTree.cpp b/lib/LLVMPasses/LLVMInlineTree.cpp index f998f6d624c92..5fc584c9fd5a7 100644 --- a/lib/LLVMPasses/LLVMInlineTree.cpp +++ b/lib/LLVMPasses/LLVMInlineTree.cpp @@ -19,17 +19,18 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "llvm-inlinetree" +#include "swift/Basic/Range.h" +#include "swift/Demangling/Demangle.h" #include "swift/LLVMPasses/Passes.h" -#include "llvm/IR/Instructions.h" -#include "llvm/IR/Function.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/IR/DebugInfoMetadata.h" +#include "llvm/IR/Function.h" +#include "llvm/IR/Instructions.h" #include "llvm/Pass.h" +#include "llvm/Support/Allocator.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/ADT/SmallSet.h" -#include "swift/Demangling/Demangle.h" -#include "swift/Basic/Range.h" using namespace llvm; using namespace swift; diff --git a/lib/Migrator/APIDiffMigratorPass.cpp b/lib/Migrator/APIDiffMigratorPass.cpp index 0cc1870cbd9ff..203a573d49727 100644 --- a/lib/Migrator/APIDiffMigratorPass.cpp +++ b/lib/Migrator/APIDiffMigratorPass.cpp @@ -340,7 +340,7 @@ struct APIDiffMigratorPass : public ASTMigratorPass, public SourceEntityWalker { if (auto CI = dyn_cast(Item)) { if (CI->isRename() && (CI->NodeKind == SDKNodeKind::DeclVar || CI->NodeKind == SDKNodeKind::DeclType)) { - Text = CI->getNewName(); + Text = CI->getNewName().str(); return true; } } @@ -385,7 +385,8 @@ struct APIDiffMigratorPass : public ASTMigratorPass, public SourceEntityWalker { SF->getTopLevelDecls(TopDecls); for (auto *D: TopDecls) { if (auto *FD = dyn_cast(D)) { - InsertedFunctions.insert(FD->getBaseName().getIdentifier().str()); + InsertedFunctions.insert( + std::string(FD->getBaseName().getIdentifier())); } } @@ -393,7 +394,7 @@ struct APIDiffMigratorPass : public ASTMigratorPass, public SourceEntityWalker { for (auto &Cur: HelperFuncInfo) { if (Cur.ExpressionToWrap) continue; - auto FuncName = Cur.getFuncName(); + auto FuncName = Cur.getFuncName().str(); // Avoid inserting the helper function if it's already present. if (!InsertedFunctions.count(FuncName)) { Editor.insert(FileEndLoc, Cur.getFuncDef()); @@ -427,7 +428,7 @@ struct APIDiffMigratorPass : public ASTMigratorPass, public SourceEntityWalker { // from type alias to raw-value representable. if (isRecognizedTypeAliasChange(Cur.ExpressionToWrap)) continue; - auto FuncName = Cur.getFuncName(); + auto FuncName = Cur.getFuncName().str(); // Avoid inserting the helper function if it's already present. if (!InsertedFunctions.count(FuncName)) { @@ -937,8 +938,8 @@ struct APIDiffMigratorPass : public ASTMigratorPass, public SourceEntityWalker { " {key, value in (key.rawValue, value)})"); break; case NodeAnnotation::SimpleStringRepresentableUpdate: - Segs = {"", "", RawType}; - Segs.push_back(NewType); + Segs = {"", "", RawType.str()}; + Segs.push_back(NewType.str()); Segs.push_back((Twine("\treturn ") + NewType + "(rawValue: input)").str()); Segs.push_back("\treturn input.rawValue"); break; diff --git a/lib/Migrator/EditorAdapter.cpp b/lib/Migrator/EditorAdapter.cpp index ee77d52ecd39b..5e867a3cb1d1b 100644 --- a/lib/Migrator/EditorAdapter.cpp +++ b/lib/Migrator/EditorAdapter.cpp @@ -33,7 +33,7 @@ EditorAdapter::cacheReplacement(CharSourceRange Range, StringRef Text) const { return false; unsigned SwiftBufferID, Offset; std::tie(SwiftBufferID, Offset) = getLocInfo(Range.getStart()); - Replacement R { Offset, Range.getByteLength(), Text }; + Replacement R{Offset, Range.getByteLength(), Text.str()}; if (Replacements.count(R)) { return true; } else { diff --git a/lib/Migrator/FixitApplyDiagnosticConsumer.cpp b/lib/Migrator/FixitApplyDiagnosticConsumer.cpp index 896ee28fa452c..eb250a7ef2c7f 100644 --- a/lib/Migrator/FixitApplyDiagnosticConsumer.cpp +++ b/lib/Migrator/FixitApplyDiagnosticConsumer.cpp @@ -58,7 +58,7 @@ void FixitApplyDiagnosticConsumer::handleDiagnostic( continue; // Ignore pre-applied equivalents. - Replacement R { Offset, Length, Text }; + Replacement R{Offset, Length, Text.str()}; if (Replacements.count(R)) { continue; } else { diff --git a/lib/Migrator/MigrationState.cpp b/lib/Migrator/MigrationState.cpp index b5b28d987edda..5493a29f4742f 100644 --- a/lib/Migrator/MigrationState.cpp +++ b/lib/Migrator/MigrationState.cpp @@ -25,11 +25,11 @@ using namespace swift::migrator; #pragma mark - MigrationState std::string MigrationState::getInputText() const { - return SrcMgr.getEntireTextForBuffer(InputBufferID); + return SrcMgr.getEntireTextForBuffer(InputBufferID).str(); } std::string MigrationState::getOutputText() const { - return SrcMgr.getEntireTextForBuffer(OutputBufferID); + return SrcMgr.getEntireTextForBuffer(OutputBufferID).str(); } static bool quickDumpText(StringRef OutFilename, StringRef Text) { diff --git a/lib/Migrator/Migrator.cpp b/lib/Migrator/Migrator.cpp index 58bee5ab44379..e6ab9f6fa85b2 100644 --- a/lib/Migrator/Migrator.cpp +++ b/lib/Migrator/Migrator.cpp @@ -279,7 +279,8 @@ void printRemap(const StringRef OriginalFilename, assert(!OriginalFilename.empty()); diff_match_patch DMP; - const auto Diffs = DMP.diff_main(InputText, OutputText, /*checkLines=*/false); + const auto Diffs = + DMP.diff_main(InputText.str(), OutputText.str(), /*checkLines=*/false); OS << "["; @@ -354,7 +355,7 @@ void printRemap(const StringRef OriginalFilename, continue; Current.Offset -= 1; Current.Remove += 1; - Current.Text = InputText.substr(Current.Offset, 1); + Current.Text = InputText.substr(Current.Offset, 1).str(); } for (auto Rep = Replacements.begin(); Rep != Replacements.end(); ++Rep) { diff --git a/lib/ParseSIL/ParseSIL.cpp b/lib/ParseSIL/ParseSIL.cpp index 987474fd363fc..a4acee3481aaa 100644 --- a/lib/ParseSIL/ParseSIL.cpp +++ b/lib/ParseSIL/ParseSIL.cpp @@ -1102,7 +1102,7 @@ static bool parseDeclSILOptional(bool *isTransparent, // Drop the double quotes. StringRef rawString = SP.P.Tok.getText().drop_front().drop_back(); - Semantics->push_back(rawString); + Semantics->push_back(rawString.str()); SP.P.consumeToken(tok::string_literal); SP.P.parseToken(tok::r_square, diag::expected_in_attribute_list); diff --git a/lib/RemoteAST/RemoteAST.cpp b/lib/RemoteAST/RemoteAST.cpp index 943a1dad7babe..512cc4e66411c 100644 --- a/lib/RemoteAST/RemoteAST.cpp +++ b/lib/RemoteAST/RemoteAST.cpp @@ -133,7 +133,7 @@ class RemoteASTContextImpl { return getOffsetOfTupleElement(tupleType, optMetadata, memberName); } else { return Result::emplaceFailure(Failure::TypeHasNoSuchMember, - memberName); + memberName.str()); } } @@ -207,7 +207,7 @@ class RemoteASTContextImpl { // Use a specialized diagnostic if we couldn't find any such member. if (!member) { - return fail(Failure::TypeHasNoSuchMember, memberName); + return fail(Failure::TypeHasNoSuchMember, memberName.str()); } return fail(Failure::Unknown); @@ -329,7 +329,7 @@ class RemoteASTContextImpl { unsigned targetIndex; if (memberName.getAsInteger(10, targetIndex) || targetIndex >= type->getNumElements()) - return fail(Failure::TypeHasNoSuchMember, memberName); + return fail(Failure::TypeHasNoSuchMember, memberName.str()); // Fast path: element 0 is always at offset 0. if (targetIndex == 0) diff --git a/lib/SIL/SILConstants.cpp b/lib/SIL/SILConstants.cpp index 093b55ed0af97..d31a35bde86e0 100644 --- a/lib/SIL/SILConstants.cpp +++ b/lib/SIL/SILConstants.cpp @@ -131,7 +131,7 @@ void SymbolicValue::print(llvm::raw_ostream &os, unsigned indent) const { case RK_Closure: { SymbolicClosure *clo = getClosure(); SILFunction *target = clo->getTarget(); - std::string targetName = target->getName(); + std::string targetName = target->getName().str(); os << "closure: target: " << targetName; ArrayRef args = clo->getCaptures(); os << " captures [\n"; diff --git a/lib/SIL/SILCoverageMap.cpp b/lib/SIL/SILCoverageMap.cpp index 449ca98953129..6b4bed71bfecb 100644 --- a/lib/SIL/SILCoverageMap.cpp +++ b/lib/SIL/SILCoverageMap.cpp @@ -34,7 +34,7 @@ SILCoverageMap::create(SILModule &M, StringRef Filename, StringRef Name, // Store a copy of the names so that we own the lifetime. CM->Filename = M.allocateCopy(Filename); CM->Name = M.allocateCopy(Name); - CM->PGOFuncName = M.allocateCopy(PGOFuncName); + CM->PGOFuncName = M.allocateCopy(PGOFuncName).str(); // Since we have two arrays, we need to manually tail allocate each of them, // rather than relying on the flexible array trick. diff --git a/lib/SIL/SILDeclRef.cpp b/lib/SIL/SILDeclRef.cpp index b524432785176..d6de976bd5429 100644 --- a/lib/SIL/SILDeclRef.cpp +++ b/lib/SIL/SILDeclRef.cpp @@ -698,7 +698,7 @@ std::string SILDeclRef::mangle(ManglingKind MKind) const { mangleClangDecl(SS, namedClangDecl, getDecl()->getASTContext()); return SS.str(); } - return namedClangDecl->getName(); + return namedClangDecl->getName().str(); } } } @@ -732,13 +732,13 @@ std::string SILDeclRef::mangle(ManglingKind MKind) const { if (!NameA->Name.empty() && !isForeignToNativeThunk() && !isNativeToForeignThunk() && !isCurried) { - return NameA->Name; + return NameA->Name.str(); } // Use a given cdecl name for native-to-foreign thunks. if (auto CDeclA = getDecl()->getAttrs().getAttribute()) if (isNativeToForeignThunk()) { - return CDeclA->Name; + return CDeclA->Name.str(); } // Otherwise, fall through into the 'other decl' case. diff --git a/lib/SILGen/SILGenApply.cpp b/lib/SILGen/SILGenApply.cpp index fcdbcffd06c9f..f62c24b0e8a54 100644 --- a/lib/SILGen/SILGenApply.cpp +++ b/lib/SILGen/SILGenApply.cpp @@ -4884,7 +4884,7 @@ std::string SILGenFunction::getMagicFileString(SourceLoc loc) { auto path = getMagicFilePathString(loc); if (!getASTContext().LangOpts.EnableConcisePoundFile) - return path; + return path.str(); auto value = llvm::sys::path::filename(path).str(); value += " ("; diff --git a/lib/SILGen/SILGenGlobalVariable.cpp b/lib/SILGen/SILGenGlobalVariable.cpp index ed9b3c500cbc5..75d13470da839 100644 --- a/lib/SILGen/SILGenGlobalVariable.cpp +++ b/lib/SILGen/SILGenGlobalVariable.cpp @@ -29,7 +29,7 @@ SILGlobalVariable *SILGenModule::getSILGlobalVariable(VarDecl *gDecl, { auto SILGenName = gDecl->getAttrs().getAttribute(); if (SILGenName && !SILGenName->Name.empty()) { - mangledName = SILGenName->Name; + mangledName = SILGenName->Name.str(); } else { Mangle::ASTMangler NewMangler; mangledName = NewMangler.mangleGlobalVariableFull(gDecl); diff --git a/lib/SILOptimizer/LoopTransforms/ArrayPropertyOpt.cpp b/lib/SILOptimizer/LoopTransforms/ArrayPropertyOpt.cpp index d00580b7c4c00..c6f21f5eff6f0 100644 --- a/lib/SILOptimizer/LoopTransforms/ArrayPropertyOpt.cpp +++ b/lib/SILOptimizer/LoopTransforms/ArrayPropertyOpt.cpp @@ -509,7 +509,7 @@ static Identifier getBinaryFunction(StringRef Name, SILType IntSILTy, auto IntTy = IntSILTy.castTo(); unsigned NumBits = IntTy->getWidth().getFixedWidth(); // Name is something like: add_Int64 - std::string NameStr = Name; + std::string NameStr(Name); NameStr += "_Int" + llvm::utostr(NumBits); return C.getIdentifier(NameStr); } diff --git a/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp b/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp index 1aff133106e81..00ed41f14eb8c 100644 --- a/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp +++ b/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp @@ -351,7 +351,7 @@ DIMemoryObjectInfo::getPathStringToElement(unsigned Element, Result = "self"; else if (ValueDecl *VD = dyn_cast_or_null(getLoc().getAsASTNode())) - Result = VD->getBaseName().getIdentifier().str(); + Result = std::string(VD->getBaseName().getIdentifier()); else Result = ""; diff --git a/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp b/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp index 1574b966d0e12..7ff49267d79f4 100644 --- a/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp +++ b/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp @@ -2111,7 +2111,7 @@ static Identifier getBinaryFunction(StringRef Name, SILType IntSILTy, auto IntTy = IntSILTy.castTo(); unsigned NumBits = IntTy->getWidth().getFixedWidth(); // Name is something like: add_Int64 - std::string NameStr = Name; + std::string NameStr(Name); NameStr += "_Int" + llvm::utostr(NumBits); return C.getIdentifier(NameStr); diff --git a/lib/SILOptimizer/PassManager/PassManager.cpp b/lib/SILOptimizer/PassManager/PassManager.cpp index ef2e70b71957f..4fb639128dbff 100644 --- a/lib/SILOptimizer/PassManager/PassManager.cpp +++ b/lib/SILOptimizer/PassManager/PassManager.cpp @@ -738,7 +738,7 @@ void SILPassManager::resetAndRemoveTransformations() { } void SILPassManager::setStageName(llvm::StringRef NextStage) { - StageName = NextStage; + StageName = NextStage.str(); } StringRef SILPassManager::getStageName() const { @@ -940,7 +940,7 @@ namespace llvm { std::string getNodeLabel(const CallGraph::Node *Node, const CallGraph *Graph) { - std::string Label = Node->F->getName(); + std::string Label = Node->F->getName().str(); wrap(Label, Node->NumCallSites); return Label; } diff --git a/lib/Sema/CSDiagnostics.cpp b/lib/Sema/CSDiagnostics.cpp index f16fb16bdbe17..7ee28d115d83d 100644 --- a/lib/Sema/CSDiagnostics.cpp +++ b/lib/Sema/CSDiagnostics.cpp @@ -5473,7 +5473,7 @@ bool ArgumentMismatchFailure::diagnoseUseOfReferenceEqualityOperator() const { // comparison with nil is illegal, albeit for different reasons spelled // out by the diagnosis. if (isa(lhs) || isa(rhs)) { - std::string revisedName = name.str(); + std::string revisedName = std::string(name); revisedName.pop_back(); auto loc = binaryOp->getLoc(); @@ -5600,7 +5600,7 @@ bool ArgumentMismatchFailure::diagnoseArchetypeMismatch() const { OS << " '" << decl->getFullName() << "'"; } - return OS.str(); + return std::string(OS.str()); }; emitDiagnostic( diff --git a/lib/Sema/CalleeCandidateInfo.cpp b/lib/Sema/CalleeCandidateInfo.cpp index bb38a77300d7c..fd720d702193e 100644 --- a/lib/Sema/CalleeCandidateInfo.cpp +++ b/lib/Sema/CalleeCandidateInfo.cpp @@ -568,7 +568,7 @@ void CalleeCandidateInfo::collectCalleeCandidates(Expr *fn, if (auto declRefExpr = dyn_cast(fn)) { auto decl = declRefExpr->getDecl(); candidates.push_back({ decl, skipCurriedSelf(decl) }); - declName = decl->getBaseName().userFacingName(); + declName = decl->getBaseName().userFacingName().str(); return; } @@ -589,7 +589,7 @@ void CalleeCandidateInfo::collectCalleeCandidates(Expr *fn, } if (!candidates.empty()) - declName = candidates[0].getDecl()->getBaseName().userFacingName(); + declName = candidates[0].getDecl()->getBaseName().userFacingName().str(); return; } @@ -677,7 +677,7 @@ void CalleeCandidateInfo::collectCalleeCandidates(Expr *fn, // base uncurried by one level, and we refer to the name of the member, not to // the name of any base. if (auto UDE = dyn_cast(fn)) { - declName = UDE->getName().getBaseName().userFacingName(); + declName = UDE->getName().getBaseName().userFacingName().str(); hasCurriedSelf = true; // If base is a module or metatype, this is just a simple @@ -738,7 +738,7 @@ void CalleeCandidateInfo::collectCalleeCandidates(Expr *fn, if (candidates.empty()) continue; if (declName.empty()) - declName = candidates[0].getDecl()->getBaseName().userFacingName(); + declName = candidates[0].getDecl()->getBaseName().userFacingName().str(); return; } @@ -873,7 +873,7 @@ CalleeCandidateInfo::CalleeCandidateInfo(Type baseType, } if (!candidates.empty()) - declName = candidates[0].getDecl()->getBaseName().userFacingName(); + declName = candidates[0].getDecl()->getBaseName().userFacingName().str(); } CalleeCandidateInfo &CalleeCandidateInfo:: diff --git a/lib/Sema/InstrumenterSupport.cpp b/lib/Sema/InstrumenterSupport.cpp index 9cac1aeb20bd7..1041651892ff2 100644 --- a/lib/Sema/InstrumenterSupport.cpp +++ b/lib/Sema/InstrumenterSupport.cpp @@ -82,7 +82,8 @@ InstrumenterBase::InstrumenterBase(ASTContext &C, DeclContext *DC) const std::string filePrefix = "_pg_file_"; // Setup Module identifier - std::string moduleName = TypeCheckDC->getParentModule()->getName().str(); + std::string moduleName = + std::string(TypeCheckDC->getParentModule()->getName()); Identifier moduleIdentifier = Context.getIdentifier(builtinPrefix + modulePrefix + moduleName); diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp index 483c9db23cb4d..dfc006b48f034 100644 --- a/lib/Sema/TypeCheckType.cpp +++ b/lib/Sema/TypeCheckType.cpp @@ -1048,7 +1048,7 @@ static std::string getDeclNameFromContext(DeclContext *dc, } return result; } else { - return nominal->getName().str(); + return std::string(nominal->getName()); } } diff --git a/lib/Serialization/SerializeDoc.cpp b/lib/Serialization/SerializeDoc.cpp index 5947e1b5c7495..3fa8c010b81cb 100644 --- a/lib/Serialization/SerializeDoc.cpp +++ b/lib/Serialization/SerializeDoc.cpp @@ -64,7 +64,7 @@ class YamlGroupInputParser { if (!ParentName.empty()) { CombinedName = (llvm::Twine(ParentName) + Separator + GroupName).str(); } else { - CombinedName = GroupName; + CombinedName = GroupName.str(); } for (llvm::yaml::Node &Entry : *Value) { @@ -75,7 +75,7 @@ class YamlGroupInputParser { GroupNameAndFileName.append(CombinedName); GroupNameAndFileName.append(Separator); GroupNameAndFileName.append(llvm::sys::path::stem(FileName)); - Map[FileName] = GroupNameAndFileName.str(); + Map[FileName] = std::string(GroupNameAndFileName); } else if (Entry.getType() == llvm::yaml::Node::NodeKind::NK_Mapping) { if (parseRoot(Map, &Entry, CombinedName)) return true; diff --git a/lib/Serialization/SerializedModuleLoader.cpp b/lib/Serialization/SerializedModuleLoader.cpp index 1e9594f75ed15..8cd863cde09ba 100644 --- a/lib/Serialization/SerializedModuleLoader.cpp +++ b/lib/Serialization/SerializedModuleLoader.cpp @@ -433,7 +433,7 @@ std::string SerializedModuleBaseName::getName(file_types::ID fileTy) const { result += '.'; result += file_types::getExtension(fileTy); - return result.str(); + return std::string(result); } bool diff --git a/lib/TBDGen/TBDGen.cpp b/lib/TBDGen/TBDGen.cpp index 675c9d2a3faea..7c5607e908600 100644 --- a/lib/TBDGen/TBDGen.cpp +++ b/lib/TBDGen/TBDGen.cpp @@ -282,7 +282,7 @@ void TBDGenVisitor::addLinkerDirectiveSymbolsLdPrevious(StringRef name, if (!IntroVer.hasValue()) continue; auto PlatformNumber = getLinkerPlatformId(Ver); - auto It = previousInstallNameMap->find(Ver.ModuleName); + auto It = previousInstallNameMap->find(Ver.ModuleName.str()); if (It == previousInstallNameMap->end()) { Ctx.Diags.diagnose(SourceLoc(), diag::cannot_find_install_name, Ver.ModuleName, getLinkerPlatformName(Ver)); diff --git a/stdlib/public/Reflection/TypeRefBuilder.cpp b/stdlib/public/Reflection/TypeRefBuilder.cpp index b2e2a7d27afbd..84f1226c95e87 100644 --- a/stdlib/public/Reflection/TypeRefBuilder.cpp +++ b/stdlib/public/Reflection/TypeRefBuilder.cpp @@ -88,7 +88,7 @@ TypeRefBuilder::normalizeReflectionName(RemoteRef reflectionName) { } // Fall back to the raw string. - return getTypeRefString(reflectionName); + return getTypeRefString(reflectionName).str(); } /// Determine whether the given reflection protocol name matches. @@ -106,7 +106,7 @@ lookupTypeWitness(const std::string &MangledTypeName, TypeRefID key; key.addString(MangledTypeName); key.addString(Member); - key.addString(Protocol); + key.addString(Protocol.str()); auto found = AssociatedTypeCache.find(key); if (found != AssociatedTypeCache.end()) return found->second; @@ -128,7 +128,8 @@ lookupTypeWitness(const std::string &MangledTypeName, for (auto &AssocTyRef : *AssocTyDescriptor.getLocalBuffer()) { auto AssocTy = AssocTyDescriptor.getField(AssocTyRef); if (Member.compare( - getTypeRefString(readTypeRef(AssocTy, AssocTy->Name))) != 0) + getTypeRefString(readTypeRef(AssocTy, AssocTy->Name)).str()) != + 0) continue; auto SubstitutedTypeName = readTypeRef(AssocTy, @@ -218,7 +219,7 @@ bool TypeRefBuilder::getFieldTypeRefs( // Empty cases of enums do not have a type if (FD->isEnum() && !Field->hasMangledTypeName()) { - Fields.push_back(FieldTypeInfo::forEmptyCase(FieldName)); + Fields.push_back(FieldTypeInfo::forEmptyCase(FieldName.str())); continue; } @@ -230,11 +231,12 @@ bool TypeRefBuilder::getFieldTypeRefs( auto Substituted = Unsubstituted->subst(*this, *Subs); if (FD->isEnum() && Field->isIndirectCase()) { - Fields.push_back(FieldTypeInfo::forIndirectCase(FieldName, Substituted)); + Fields.push_back( + FieldTypeInfo::forIndirectCase(FieldName.str(), Substituted)); continue; } - Fields.push_back(FieldTypeInfo::forField(FieldName, Substituted)); + Fields.push_back(FieldTypeInfo::forField(FieldName.str(), Substituted)); } return true; } @@ -320,7 +322,7 @@ TypeRefBuilder::getClosureContextInfo(RemoteRef CD) { if (MSR->hasMangledMetadataSource()) { auto MangledMetadataSource = getTypeRefString(readTypeRef(MSR, MSR->MangledMetadataSource)); - MS = MetadataSource::decode(MSB, MangledMetadataSource); + MS = MetadataSource::decode(MSB, MangledMetadataSource.str()); } Info.MetadataSources.push_back({TR, MS}); @@ -391,9 +393,10 @@ void TypeRefBuilder::dumpAssociatedTypeSection(FILE *file) { for (const auto &associatedTypeRef : *descriptor.getLocalBuffer()) { auto associatedType = descriptor.getField(associatedTypeRef); - - std::string name = getTypeRefString( - readTypeRef(associatedType, associatedType->Name)); + + std::string name = + getTypeRefString(readTypeRef(associatedType, associatedType->Name)) + .str(); fprintf(file, "typealias %s = ", name.c_str()); dumpTypeRef( readTypeRef(associatedType, associatedType->SubstitutedTypeName), file); diff --git a/tools/SourceKit/include/SourceKit/Support/Logging.h b/tools/SourceKit/include/SourceKit/Support/Logging.h index 662577be9f320..0421e319a167a 100644 --- a/tools/SourceKit/include/SourceKit/Support/Logging.h +++ b/tools/SourceKit/include/SourceKit/Support/Logging.h @@ -67,7 +67,7 @@ class Logger : public llvm::RefCountedBase { return LoggingLevel >= LogLevel; } static void enableLogging(StringRef Name, Level LogLevel) { - LoggerName = Name; + LoggerName = Name.str(); LoggingLevel = LogLevel; } diff --git a/tools/SourceKit/lib/Core/NotificationCenter.cpp b/tools/SourceKit/lib/Core/NotificationCenter.cpp index e7e2e163a7ffc..c6fdfac609e21 100644 --- a/tools/SourceKit/lib/Core/NotificationCenter.cpp +++ b/tools/SourceKit/lib/Core/NotificationCenter.cpp @@ -34,8 +34,8 @@ void NotificationCenter::postDocumentUpdateNotification( { llvm::sys::ScopedLock L(Mtx); recvs = DocUpdReceivers; - } - std::string docName = DocumentName; + } + std::string docName = DocumentName.str(); auto sendNote = [recvs, docName]{ for (auto &Fn : recvs) Fn(docName); diff --git a/tools/SourceKit/lib/Support/ImmutableTextBuffer.cpp b/tools/SourceKit/lib/Support/ImmutableTextBuffer.cpp index 69e9725b7f455..460ef667f8a16 100644 --- a/tools/SourceKit/lib/Support/ImmutableTextBuffer.cpp +++ b/tools/SourceKit/lib/Support/ImmutableTextBuffer.cpp @@ -124,7 +124,7 @@ bool ImmutableTextSnapshot::foreachReplaceUntil( static std::atomic Generation{ 0 }; EditableTextBuffer::EditableTextBuffer(StringRef Filename, StringRef Text) { - this->Filename = Filename; + this->Filename = Filename.str(); Root = new ImmutableTextBuffer(Filename, Text, ++Generation); CurrUpd = Root; } diff --git a/tools/SourceKit/lib/Support/UIDRegistry.cpp b/tools/SourceKit/lib/Support/UIDRegistry.cpp index 023268de3caf6..a6f0a057c768f 100644 --- a/tools/SourceKit/lib/Support/UIDRegistry.cpp +++ b/tools/SourceKit/lib/Support/UIDRegistry.cpp @@ -10,9 +10,10 @@ // //===----------------------------------------------------------------------===// -#include "SourceKit/Support/UIdent.h" #include "SourceKit/Support/Concurrency.h" +#include "SourceKit/Support/UIdent.h" #include "llvm/ADT/StringMap.h" +#include "llvm/Support/Allocator.h" #include "llvm/Support/raw_ostream.h" #include #include diff --git a/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp b/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp index f07046c625cff..0ed7876b1739a 100644 --- a/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp +++ b/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp @@ -396,15 +396,15 @@ static StringRef copyString(llvm::BumpPtrAllocator &allocator, StringRef str) { static std::unique_ptr make_group(StringRef name) { auto g = std::make_unique(); - g->name = name; - g->description = name; + g->name = name.str(); + g->description = name.str(); return g; } static std::unique_ptr make_result(Completion *result) { auto r = std::make_unique(result); - r->name = result->getName(); - r->description = result->getDescription(); + r->name = result->getName().str(); + r->description = result->getDescription().str(); return r; } diff --git a/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp b/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp index 1e2b1fd10a211..9448f5abef40f 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp @@ -461,7 +461,7 @@ static FrontendInputsAndOutputs resolveSymbolicLinksInInputs( llvm::SmallString<64> Err; llvm::raw_svector_ostream OS(Err); OS << "'" << PrimaryFile << "' is not part of the input files"; - Error = OS.str(); + Error = std::string(OS.str()); return replacementInputsAndOutputs; } @@ -501,7 +501,7 @@ bool SwiftASTManager::initCompilerInvocation( Diags.removeConsumer(DiagConsumer); if (HadError) { - Error = ErrOS.str(); + Error = std::string(ErrOS.str()); return true; } @@ -683,7 +683,7 @@ static FileContent getFileContentFromSnap(ImmutableTextSnapshotRef Snap, bool IsPrimary, StringRef FilePath) { auto Buf = llvm::MemoryBuffer::getMemBufferCopy( Snap->getBuffer()->getText(), FilePath); - return FileContent(Snap, FilePath, std::move(Buf), IsPrimary, + return FileContent(Snap, FilePath.str(), std::move(Buf), IsPrimary, Snap->getStamp()); } @@ -699,8 +699,8 @@ FileContent SwiftASTManager::Implementation::getFileContent( // FIXME: Is there a way to get timestamp and buffer for a file atomically ? auto Stamp = getBufferStamp(FilePath, FileSystem); auto Buffer = getMemoryBuffer(FilePath, FileSystem, Error); - return FileContent(nullptr, UnresolvedPath, std::move(Buffer), IsPrimary, - Stamp); + return FileContent(nullptr, UnresolvedPath.str(), std::move(Buffer), + IsPrimary, Stamp); } BufferStamp SwiftASTManager::Implementation::getBufferStamp( @@ -902,7 +902,7 @@ static void collectModuleDependencies(ModuleDecl *TopMod, // getModuleFilename() (by returning an empty path). Note that such modules // may be heterogeneous. { - std::string Path = Mod->getModuleFilename(); + std::string Path = Mod->getModuleFilename().str(); if (Path.empty() || Path == TopMod->getModuleFilename()) continue; // this is a submodule. Filenames.push_back(std::move(Path)); diff --git a/tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp b/tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp index f5a716ad61775..d63acacb0a14e 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp @@ -1064,7 +1064,7 @@ static void transformAndForwardResults( }); auto *inputBuf = session->getBuffer(); - std::string str = inputBuf->getBuffer().slice(0, offset); + std::string str = inputBuf->getBuffer().slice(0, offset).str(); { llvm::raw_string_ostream OSS(str); SwiftToSourceKitCompletionAdapter::getResultSourceText( diff --git a/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp b/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp index 9e7616216ddab..943998dbe32e1 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp @@ -274,7 +274,7 @@ static void initDocGenericParams(const Decl *D, DocEntityInfo &Info) { if (GP->getDecl()->isImplicit()) continue; DocGenericParam Param; - Param.Name = GP->getName().str(); + Param.Name = std::string(GP->getName()); Info.GenericParams.push_back(Param); } @@ -959,7 +959,7 @@ static bool getModuleInterfaceInfo(ASTContext &Ctx, StringRef ModuleName, AnnotatingPrinter Printer(OS); printModuleInterface(M, None, TraversalOptions, Printer, Options, true); - Info.Text = OS.str(); + Info.Text = std::string(OS.str()); Info.TopEntities = std::move(Printer.TopEntities); Info.References = std::move(Printer.References); return false; @@ -1080,7 +1080,7 @@ static bool getSourceTextInfo(CompilerInstance &CI, Walker.walk(*CI.getMainModule()); CharSourceRange FullRange = SM.getRangeForBuffer(BufID); - Info.Text = SM.extractText(FullRange); + Info.Text = SM.extractText(FullRange).str(); Info.TopEntities = std::move(Walker.TopEntities); Info.References = std::move(Walker.References); return false; @@ -1168,8 +1168,8 @@ class RequestRefactoringEditConsumer::Implementation { R.StartLine, R.StartColumn, R.EndLine, R.EndColumn, R.ArgIndex }; }); - return {Start.first, Start.second, End.first, End.second, R.Text, - std::move(SubRanges)}; + return {Start.first, Start.second, End.first, + End.second, R.Text.str(), std::move(SubRanges)}; }); unsigned End = AllEdits.size(); StartEnds.emplace_back(Start, End); diff --git a/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp b/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp index 8914b992bcc22..b24d9183ec249 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp @@ -108,7 +108,7 @@ void EditorDiagConsumer::handleDiagnostic(SourceManager &SM, DiagnosticEngine::formatDiagnosticText(Out, Info.FormatString, Info.FormatArgs); } - SKInfo.Description = Text.str(); + SKInfo.Description = std::string(Text); Optional BufferIDOpt; if (Info.Loc.isValid()) { @@ -148,7 +148,7 @@ void EditorDiagConsumer::handleDiagnostic(SourceManager &SM, SKInfo.Offset = SM.getLocOffsetInBuffer(Info.Loc, BufferID); std::tie(SKInfo.Line, SKInfo.Column) = SM.getLineAndColumn(Info.Loc, BufferID); - SKInfo.Filename = SM.getDisplayNameForLoc(Info.Loc); + SKInfo.Filename = SM.getDisplayNameForLoc(Info.Loc).str(); for (auto R : Info.Ranges) { if (R.isInvalid() || SM.findBufferContainingLoc(R.getStart()) != BufferID) @@ -165,7 +165,7 @@ void EditorDiagConsumer::handleDiagnostic(SourceManager &SM, unsigned Offset = SM.getLocOffsetInBuffer(F.getRange().getStart(), BufferID); unsigned Length = F.getRange().getByteLength(); - SKInfo.Fixits.push_back({Offset, Length, F.getText()}); + SKInfo.Fixits.push_back({Offset, Length, F.getText().str()}); } } else { SKInfo.Filename = ""; diff --git a/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp b/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp index 475629e4a22db..7275933fb6b2c 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp @@ -137,7 +137,7 @@ class AnnotatingPrinter : public StreamPrinter { llvm::raw_svector_ostream OS(Buf); auto TargetNTD = Target.getBaseNominal(); if (!SwiftLangSupport::printUSR(TargetNTD, OS)) { - TargetUSR = OS.str(); + TargetUSR = std::string(OS.str()); } } @@ -336,7 +336,7 @@ static bool getModuleInterfaceInfo(ASTContext &Ctx, Printer, Options, Group.hasValue() && SynthesizedExtensions); - Info.Text = OS.str(); + Info.Text = std::string(OS.str()); return false; } @@ -356,7 +356,7 @@ static bool getHeaderInterfaceInfo(ASTContext &Ctx, AnnotatingPrinter Printer(Info, OS); printHeaderInterface(HeaderName, Ctx, Printer, Options); - Info.Text = OS.str(); + Info.Text = std::string(OS.str()); return false; } @@ -367,9 +367,9 @@ SwiftInterfaceGenContext::createForSwiftSource(StringRef DocumentName, CompilerInvocation Invocation, std::string &ErrMsg) { SwiftInterfaceGenContextRef IFaceGenCtx{ new SwiftInterfaceGenContext() }; - IFaceGenCtx->Impl.DocumentName = DocumentName; + IFaceGenCtx->Impl.DocumentName = DocumentName.str(); IFaceGenCtx->Impl.IsModule = true; - IFaceGenCtx->Impl.ModuleOrHeaderName = SourceFileName; + IFaceGenCtx->Impl.ModuleOrHeaderName = SourceFileName.str(); IFaceGenCtx->Impl.AstUnit = AstUnit; PrintOptions Options = PrintOptions::printSwiftFileInterface(); @@ -377,7 +377,7 @@ SwiftInterfaceGenContext::createForSwiftSource(StringRef DocumentName, llvm::raw_svector_ostream OS(Text); AnnotatingPrinter Printer(IFaceGenCtx->Impl.Info, OS); printSwiftSourceInterface(AstUnit->getPrimarySourceFile(), Printer, Options); - IFaceGenCtx->Impl.Info.Text = OS.str(); + IFaceGenCtx->Impl.Info.Text = std::string(OS.str()); if (makeParserAST(IFaceGenCtx->Impl.TextCI, IFaceGenCtx->Impl.Info.Text, Invocation)) { ErrMsg = "Error during syntactic parsing"; @@ -396,9 +396,9 @@ SwiftInterfaceGenContext::create(StringRef DocumentName, bool SynthesizedExtensions, Optional InterestedUSR) { SwiftInterfaceGenContextRef IFaceGenCtx{ new SwiftInterfaceGenContext() }; - IFaceGenCtx->Impl.DocumentName = DocumentName; + IFaceGenCtx->Impl.DocumentName = DocumentName.str(); IFaceGenCtx->Impl.IsModule = IsModule; - IFaceGenCtx->Impl.ModuleOrHeaderName = ModuleOrHeaderName; + IFaceGenCtx->Impl.ModuleOrHeaderName = ModuleOrHeaderName.str(); IFaceGenCtx->Impl.Invocation = Invocation; CompilerInstance &CI = IFaceGenCtx->Impl.Instance; @@ -457,7 +457,7 @@ SwiftInterfaceGenContext::createForTypeInterface(CompilerInvocation Invocation, std::string &ErrorMsg) { SwiftInterfaceGenContextRef IFaceGenCtx{ new SwiftInterfaceGenContext() }; IFaceGenCtx->Impl.IsModule = false; - IFaceGenCtx->Impl.ModuleOrHeaderName = TypeUSR; + IFaceGenCtx->Impl.ModuleOrHeaderName = TypeUSR.str(); IFaceGenCtx->Impl.Invocation = Invocation; CompilerInstance &CI = IFaceGenCtx->Impl.Instance; SourceTextInfo &Info = IFaceGenCtx->Impl.Info; @@ -491,7 +491,7 @@ SwiftInterfaceGenContext::createForTypeInterface(CompilerInvocation Invocation, if (ide::printTypeInterface(Module, TypeUSR, Printer, IFaceGenCtx->Impl.DocumentName, ErrorMsg)) return nullptr; - IFaceGenCtx->Impl.Info.Text = OS.str(); + IFaceGenCtx->Impl.Info.Text = std::string(OS.str()); if (makeParserAST(IFaceGenCtx->Impl.TextCI, IFaceGenCtx->Impl.Info.Text, Invocation)) { ErrorMsg = "Error during syntactic parsing"; diff --git a/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp b/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp index 8c74396273932..95279377493a0 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp @@ -217,7 +217,7 @@ static void initTraceInfoImpl(trace::SwiftInvocation &SwiftArgs, ArrayRef Args) { llvm::raw_string_ostream OS(SwiftArgs.Args.Arguments); interleave(Args, [&OS](StringRef arg) { OS << arg; }, [&OS] { OS << ' '; }); - SwiftArgs.Args.PrimaryFile = InputFile; + SwiftArgs.Args.PrimaryFile = InputFile.str(); } void trace::initTraceInfo(trace::SwiftInvocation &SwiftArgs, diff --git a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp index 6ae23afd709ce..4feb051df26e7 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp @@ -262,7 +262,7 @@ SwiftLangSupport::SwiftLangSupport(SourceKit::Context &SKCtx) CCCache(new SwiftCompletionCache) { llvm::SmallString<128> LibPath(SKCtx.getRuntimeLibPath()); llvm::sys::path::append(LibPath, "swift"); - RuntimeResourcePath = LibPath.str(); + RuntimeResourcePath = std::string(LibPath); Stats = std::make_shared(); EditorDocuments = std::make_shared(); @@ -897,11 +897,11 @@ void SwiftLangSupport::printMemberDeclDescription(const swift::ValueDecl *VD, } std::string SwiftLangSupport::resolvePathSymlinks(StringRef FilePath) { - std::string InputPath = FilePath; + std::string InputPath = FilePath.str(); llvm::SmallString<256> output; if (llvm::sys::fs::real_path(InputPath, output)) return InputPath; - return output.str(); + return std::string(output); } void SwiftLangSupport::getStatistics(StatisticsReceiver receiver) { diff --git a/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp b/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp index 92db039a37e85..1813dafadc3fc 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp @@ -631,7 +631,7 @@ static bool passCursorInfoForModule(ModuleEntity Mod, SwiftInterfaceGenMap &IFaceGenContexts, const CompilerInvocation &Invok, std::function &)> Receiver) { - std::string Name = Mod.getName(); + std::string Name = Mod.getName().str(); std::string FullName = Mod.getFullName(); CursorInfoData Info; Info.Kind = SwiftLangSupport::getUIDForModuleRef(); @@ -916,7 +916,7 @@ static bool passCursorInfoForDecl(SourceFile* SF, if (ClangMod) ModuleName = ClangMod->getFullModuleName(); } else if (VD->getLoc().isInvalid() && VD->getModuleContext() != MainModule) { - ModuleName = VD->getModuleContext()->getName().str(); + ModuleName = std::string(VD->getModuleContext()->getName()); } StringRef ModuleInterfaceName; if (auto IFaceGenRef = Lang.getIFaceGenContexts().find(ModuleName, Invok)) @@ -2165,7 +2165,7 @@ semanticRefactoring(StringRef Filename, SemanticRefactoringInfo Info, Opts.Range.Line = Info.Line; Opts.Range.Column = Info.Column; Opts.Range.Length = Info.Length; - Opts.PreferredName = Info.PreferredName; + Opts.PreferredName = Info.PreferredName.str(); RequestRefactoringEditConsumer EditConsumer(Receiver); refactorSwiftModule(MainModule, Opts, EditConsumer, EditConsumer); diff --git a/tools/SourceKit/tools/complete-test/complete-test.cpp b/tools/SourceKit/tools/complete-test/complete-test.cpp index 3579a813e3112..7bab09ad673b8 100644 --- a/tools/SourceKit/tools/complete-test/complete-test.cpp +++ b/tools/SourceKit/tools/complete-test/complete-test.cpp @@ -253,7 +253,7 @@ static bool parseOptions(ArrayRef args, TestOptions &options, } options.showTopNonLiteral = uval; } else if (opt == "module-cache-path") { - options.moduleCachePath = value; + options.moduleCachePath = value.str(); } } @@ -403,7 +403,7 @@ removeCodeCompletionTokens(StringRef Input, StringRef TokenName, StringRef next = StringRef(fullMatch).split(',').second; while (next != "") { auto split = next.split(','); - prefixes.push_back(split.first); + prefixes.push_back(split.first.str()); next = split.second; } } @@ -695,7 +695,7 @@ static bool codeCompleteRequest(sourcekitd_uid_t requestUID, const char *name, static bool readPopularAPIList(StringRef filename, std::vector &result) { - std::ifstream in(filename); + std::ifstream in(filename.str()); if (!in.is_open()) { llvm::errs() << "error opening '" << filename << "'\n"; return true; diff --git a/tools/SourceKit/tools/sourcekitd-test/sourcekitd-test.cpp b/tools/SourceKit/tools/sourcekitd-test/sourcekitd-test.cpp index 2188f711a48dc..d326c98491b8f 100644 --- a/tools/SourceKit/tools/sourcekitd-test/sourcekitd-test.cpp +++ b/tools/SourceKit/tools/sourcekitd-test/sourcekitd-test.cpp @@ -290,7 +290,7 @@ static inline std::string getInterfaceGenDocumentName() { llvm::SmallString<64> path = llvm::StringRef("/"); llvm::sys::fs::make_absolute(path); llvm::sys::path::native(path); - return path.str(); + return std::string(path); } static int printAnnotations(); @@ -305,7 +305,7 @@ static void addCodeCompleteOptions(sourcekitd_object_t Req, TestOptions &Opts) { for (auto &Opt : Opts.RequestOptions) { auto KeyValue = StringRef(Opt).split('='); std::string KeyStr("key.codecomplete."); - KeyStr.append(KeyValue.first); + KeyStr.append(KeyValue.first.str()); sourcekitd_uid_t Key = sourcekitd_uid_get_from_cstr(KeyStr.c_str()); // FIXME: more robust way to determine the option type. @@ -326,7 +326,7 @@ static void addCodeCompleteOptions(sourcekitd_object_t Req, TestOptions &Opts) { static bool readPopularAPIList(StringRef filename, std::vector &result) { - std::ifstream in(filename); + std::ifstream in(filename.str()); if (!in.is_open()) { llvm::errs() << "error opening '" << filename << "'\n"; return true; @@ -441,7 +441,7 @@ static int setExpectedTypes(const sourcekitd_test::TestOptions &Opts, auto typenames = sourcekitd_request_array_create(nullptr, 0); for (auto &name : expectedTypeNames) { - std::string n = name; + std::string n = name.str(); sourcekitd_request_array_set_string(typenames, SOURCEKITD_ARRAY_APPEND, n.c_str()); } sourcekitd_request_dictionary_set_value(Req, KeyExpectedTypes, typenames); @@ -489,13 +489,13 @@ static int handleTestInvocation(TestOptions Opts, TestOptions &InitOpts) { AbsSourceFile += SourceFile; llvm::sys::fs::make_absolute(AbsSourceFile); llvm::sys::path::native(AbsSourceFile); - SourceFile = AbsSourceFile.str(); + SourceFile = std::string(AbsSourceFile); } std::string SemaName = !Opts.Name.empty() ? Opts.Name : SourceFile; if (!Opts.TextInputFile.empty()) { auto Buf = getBufferForFilename(Opts.TextInputFile, Opts.VFSFiles); - Opts.SourceText = Buf->getBuffer(); + Opts.SourceText = Buf->getBuffer().str(); } std::unique_ptr SourceBuf; @@ -755,13 +755,13 @@ static int handleTestInvocation(TestOptions Opts, TestOptions &InitOpts) { return 1; } if (!BaseName.empty()) { - std::string S = BaseName; + std::string S = BaseName.str(); sourcekitd_request_dictionary_set_string(Req, KeyBaseName, S.c_str()); } if (!ArgPieces.empty()) { sourcekitd_object_t Arr = sourcekitd_request_array_create(nullptr, 0); for (StringRef A : ArgPieces) { - std::string S = A; + std::string S = A.str(); sourcekitd_request_array_set_string(Arr, SOURCEKITD_ARRAY_APPEND, S.c_str()); } @@ -1278,7 +1278,7 @@ static bool handleResponse(sourcekitd_response_t Resp, const TestOptions &Opts, for (auto &FmtOpt : Opts.RequestOptions) { auto KeyValue = StringRef(FmtOpt).split('='); std::string KeyStr("key.editor.format."); - KeyStr.append(KeyValue.first); + KeyStr.append(KeyValue.first.str()); sourcekitd_uid_t Key = sourcekitd_uid_get_from_cstr(KeyStr.c_str()); int64_t Value = 0; KeyValue.second.getAsInteger(0, Value); @@ -1476,10 +1476,10 @@ static void printCursorInfo(sourcekitd_variant_t Info, StringRef FilenameIn, return; } - std::string Filename = FilenameIn; + std::string Filename = FilenameIn.str(); llvm::SmallString<256> output; if (!llvm::sys::fs::real_path(Filename, output)) - Filename = output.str(); + Filename = std::string(output); const char *Kind = sourcekitd_uid_get_string_ptr(KindUID); const char *USR = sourcekitd_variant_dictionary_get_string(Info, KeyUSR); @@ -1648,10 +1648,10 @@ static void printRangeInfo(sourcekitd_variant_t Info, StringRef FilenameIn, return; } - std::string Filename = FilenameIn; + std::string Filename = FilenameIn.str(); llvm::SmallString<256> output; if (llvm::sys::fs::real_path(Filename, output)) - Filename = output.str(); + Filename = std::string(output); sourcekitd_variant_t OffsetObj = sourcekitd_variant_dictionary_get_value(Info, KeyOffset); diff --git a/tools/SourceKit/tools/sourcekitd/bin/InProc/sourcekitdInProc.cpp b/tools/SourceKit/tools/sourcekitd/bin/InProc/sourcekitdInProc.cpp index 67d1e8cc72872..3afed31e7c9ca 100644 --- a/tools/SourceKit/tools/sourcekitd/bin/InProc/sourcekitdInProc.cpp +++ b/tools/SourceKit/tools/sourcekitd/bin/InProc/sourcekitdInProc.cpp @@ -101,7 +101,7 @@ std::string sourcekitd::getRuntimeLibPath() { llvm_unreachable("Call to dladdr() failed"); // We now have the path to the shared lib, move to the parent 'lib' path. - return llvm::sys::path::parent_path(info.dli_fname); + return llvm::sys::path::parent_path(info.dli_fname).str(); #endif } diff --git a/tools/SourceKit/tools/sourcekitd/bin/XPC/Service/XPCService.cpp b/tools/SourceKit/tools/sourcekitd/bin/XPC/Service/XPCService.cpp index 9c80853ae2f6b..c14c0b248fc46 100644 --- a/tools/SourceKit/tools/sourcekitd/bin/XPC/Service/XPCService.cpp +++ b/tools/SourceKit/tools/sourcekitd/bin/XPC/Service/XPCService.cpp @@ -204,7 +204,7 @@ std::string sourcekitd::getRuntimeLibPath() { StringRef Path = MainExePath; for (unsigned i = 0; i < MainExeLibNestingLevel; ++i) Path = llvm::sys::path::parent_path(Path); - return Path; + return Path.str(); } static void sourcekitdServer_peer_event_handler(xpc_connection_t peer, diff --git a/tools/SourceKit/tools/sourcekitd/lib/API/DocStructureArray.cpp b/tools/SourceKit/tools/sourcekitd/lib/API/DocStructureArray.cpp index bd8faa51058ab..63b622d4986d8 100644 --- a/tools/SourceKit/tools/sourcekitd/lib/API/DocStructureArray.cpp +++ b/tools/SourceKit/tools/sourcekitd/lib/API/DocStructureArray.cpp @@ -193,10 +193,10 @@ void DocStructureArrayBuilder::beginSubStructure( BodyLength, DocOffset, DocLength, - DisplayName, - TypeName, - RuntimeName, - SelectorName, + DisplayName.str(), + TypeName.str(), + RuntimeName.str(), + SelectorName.str(), impl.addInheritedTypes(InheritedTypes), impl.addAttrs(Attrs), {}, // elements diff --git a/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp b/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp index 483a2ac2998a0..a665c4e22d988 100644 --- a/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp +++ b/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp @@ -701,7 +701,7 @@ void handleRequestImpl(sourcekitd_object_t ReqObj, ResponseReceiver Rec) { std::string swiftVer; Optional swiftVerValStr = Req.getString(KeySwiftVersion); if (swiftVerValStr.hasValue()) { - swiftVer = swiftVerValStr.getValue(); + swiftVer = swiftVerValStr.getValue().str(); } else { Optional swiftVerVal = Req.getOptionalInt64(KeySwiftVersion); if (swiftVerVal.hasValue()) @@ -833,7 +833,7 @@ void handleRequestImpl(sourcekitd_object_t ReqObj, ResponseReceiver Rec) { err = createErrorRequestInvalid("missing 'key.name'"); return true; } - CCInfo.Name = *Name; + CCInfo.Name = (*Name).str(); sourcekitd_uid_t Kind = dict.getUID(KeyKind); if (!Kind) { @@ -1271,7 +1271,7 @@ static sourcekitd_response_t indexSource(StringRef Filename, } void SKIndexingConsumer::failed(StringRef ErrDescription) { - ErrorDescription = ErrDescription; + ErrorDescription = ErrDescription.str(); } bool SKIndexingConsumer::startDependency(UIdent Kind, @@ -1581,7 +1581,7 @@ void SKDocConsumer::addDocEntityInfoToDict(const DocEntityInfo &Info, } void SKDocConsumer::failed(StringRef ErrDescription) { - ErrorDescription = ErrDescription; + ErrorDescription = ErrDescription.str(); } bool SKDocConsumer::handleSourceText(StringRef Text) { @@ -1952,7 +1952,7 @@ codeComplete(llvm::MemoryBuffer *InputBuf, int64_t Offset, } void SKCodeCompletionConsumer::failed(StringRef ErrDescription) { - ErrorDescription = ErrDescription; + ErrorDescription = ErrDescription.str(); } void SKCodeCompletionConsumer::setCompletionKind(UIdent kind) { @@ -2131,7 +2131,7 @@ codeCompleteUpdate(StringRef name, int64_t offset, } void SKGroupedCodeCompletionConsumer::failed(StringRef ErrDescription) { - ErrorDescription = ErrDescription; + ErrorDescription = ErrDescription.str(); } bool SKGroupedCodeCompletionConsumer::handleResult(const CodeCompletionInfo &R) { @@ -2247,7 +2247,7 @@ static sourcekitd_response_t typeContextInfo(llvm::MemoryBuffer *InputBuf, } void failed(StringRef ErrDescription) override { - ErrorDescription = ErrDescription; + ErrorDescription = ErrDescription.str(); } bool isError() const { return ErrorDescription.hasValue(); } @@ -2300,7 +2300,7 @@ conformingMethodList(llvm::MemoryBuffer *InputBuf, int64_t Offset, } void failed(StringRef ErrDescription) override { - ErrorDescription = ErrDescription; + ErrorDescription = ErrDescription.str(); } bool isError() const { return ErrorDescription.hasValue(); } diff --git a/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-Common.cpp b/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-Common.cpp index 7b0cd6eefb05e..3bf9d8894761c 100644 --- a/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-Common.cpp +++ b/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-Common.cpp @@ -786,7 +786,7 @@ bool YAMLRequestParser::parseArray(sourcekitd_object_t Array, void YAMLRequestParser::initError(StringRef Desc, llvm::yaml::Node *Node, std::string &Error) { - Error = Desc; + Error = Desc.str(); Error += " at: "; llvm::SMRange Range = Node->getSourceRange(); StringRef Text(Range.Start.getPointer(), diff --git a/tools/driver/autolink_extract_main.cpp b/tools/driver/autolink_extract_main.cpp index d025564f8e0de..76825313eb3f1 100644 --- a/tools/driver/autolink_extract_main.cpp +++ b/tools/driver/autolink_extract_main.cpp @@ -80,7 +80,8 @@ class AutolinkExtractInvocation { } if (ParsedArgs.getLastArg(OPT_help)) { - std::string ExecutableName = llvm::sys::path::stem(MainExecutablePath); + std::string ExecutableName = + llvm::sys::path::stem(MainExecutablePath).str(); Table->PrintHelp(llvm::outs(), ExecutableName.c_str(), "Swift Autolink Extract", options::AutolinkExtractOption, 0, /*ShowAllAliases*/false); @@ -138,7 +139,7 @@ extractLinkerFlagsFromObjectFile(const llvm::object::ObjectFile *ObjectFile, SectionData->split(SplitFlags, llvm::StringRef("\0", 1), -1, /*KeepEmpty=*/false); for (const auto &Flag : SplitFlags) - LinkerFlags.push_back(Flag); + LinkerFlags.push_back(Flag.str()); } } return false; diff --git a/tools/driver/modulewrap_main.cpp b/tools/driver/modulewrap_main.cpp index 57e4f64996613..adcaf542ff69a 100644 --- a/tools/driver/modulewrap_main.cpp +++ b/tools/driver/modulewrap_main.cpp @@ -90,7 +90,8 @@ class ModuleWrapInvocation { } if (ParsedArgs.getLastArg(OPT_help)) { - std::string ExecutableName = llvm::sys::path::stem(MainExecutablePath); + std::string ExecutableName = + llvm::sys::path::stem(MainExecutablePath).str(); Table->PrintHelp(llvm::outs(), ExecutableName.c_str(), "Swift Module Wrapper", options::ModuleWrapOption, 0, /*ShowAllAliases*/false); @@ -159,7 +160,7 @@ int modulewrap_main(ArrayRef Args, const char *Argv0, SmallString<128> RuntimeResourcePath; CompilerInvocation::computeRuntimeResourcePathFromExecutablePath( MainExecutablePath, RuntimeResourcePath); - SearchPathOpts.RuntimeResourcePath = RuntimeResourcePath.str(); + SearchPathOpts.RuntimeResourcePath = std::string(RuntimeResourcePath); SourceManager SrcMgr; TypeCheckerOptions TypeCheckOpts; diff --git a/tools/driver/swift_indent_main.cpp b/tools/driver/swift_indent_main.cpp index bb44ea8a085b4..d5280177a0ab7 100644 --- a/tools/driver/swift_indent_main.cpp +++ b/tools/driver/swift_indent_main.cpp @@ -147,7 +147,8 @@ class SwiftIndentInvocation { } if (ParsedArgs.getLastArg(OPT_help)) { - std::string ExecutableName = llvm::sys::path::stem(MainExecutablePath); + std::string ExecutableName = + llvm::sys::path::stem(MainExecutablePath).str(); Table->PrintHelp(llvm::outs(), ExecutableName.c_str(), "Swift Format Tool", options::SwiftIndentOption, 0, /*ShowAllAliases*/false); @@ -183,7 +184,7 @@ class SwiftIndentInvocation { LineRanges.push_back("1:" + std::to_string(UINT_MAX)); } - std::string Output = Doc.memBuffer().getBuffer(); + std::string Output = Doc.memBuffer().getBuffer().str(); for (unsigned Range = 0; Range < LineRanges.size(); ++Range) { unsigned FromLine; unsigned ToLine; diff --git a/tools/lldb-moduleimport-test/lldb-moduleimport-test.cpp b/tools/lldb-moduleimport-test/lldb-moduleimport-test.cpp index e3dc90678712f..4523df82f1f42 100644 --- a/tools/lldb-moduleimport-test/lldb-moduleimport-test.cpp +++ b/tools/lldb-moduleimport-test/lldb-moduleimport-test.cpp @@ -293,7 +293,7 @@ int main(int argc, char **argv) { // Infer SDK and Target triple from the module. if (!extendedInfo.getSDKPath().empty()) - Invocation.setSDKPath(extendedInfo.getSDKPath()); + Invocation.setSDKPath(extendedInfo.getSDKPath().str()); Invocation.setTargetTriple(info.targetTriple); Invocation.setModuleName("lldbtest"); diff --git a/tools/sil-func-extractor/SILFunctionExtractor.cpp b/tools/sil-func-extractor/SILFunctionExtractor.cpp index 33d0082c8b352..43c0dcd0b25bd 100644 --- a/tools/sil-func-extractor/SILFunctionExtractor.cpp +++ b/tools/sil-func-extractor/SILFunctionExtractor.cpp @@ -142,7 +142,7 @@ static void getFunctionNames(std::vector &Names) { if (Token.empty()) { break; } - Names.push_back(Token); + Names.push_back(Token.str()); Buffer = NewBuffer; } } @@ -153,12 +153,12 @@ static bool stringInSortedArray( llvm::function_ref &&cmp) { if (list.empty()) return false; - auto iter = std::lower_bound(list.begin(), list.end(), str, cmp); + auto iter = std::lower_bound(list.begin(), list.end(), str.str(), cmp); // If we didn't find str, return false. if (list.end() == iter) return false; - return !cmp(str, *iter); + return !cmp(str.str(), *iter); } void removeUnwantedFunctions(SILModule *M, ArrayRef MangledNames, diff --git a/tools/swift-api-digester/ModuleAnalyzerNodes.cpp b/tools/swift-api-digester/ModuleAnalyzerNodes.cpp index 3f5fea81e5244..0174384085815 100644 --- a/tools/swift-api-digester/ModuleAnalyzerNodes.cpp +++ b/tools/swift-api-digester/ModuleAnalyzerNodes.cpp @@ -592,7 +592,7 @@ SDKNode* SDKNode::constructSDKNode(SDKContext &Ctx, }; static auto getAsInt = [&](llvm::yaml::Node *N) -> int { - return std::stoi(cast(N)->getRawValue()); + return std::stoi(cast(N)->getRawValue().str()); }; static auto getAsBool = [&](llvm::yaml::Node *N) -> bool { auto txt = cast(N)->getRawValue(); diff --git a/tools/swift-demangle/swift-demangle.cpp b/tools/swift-demangle/swift-demangle.cpp index 3c71f54cd91fc..f6468b7366a59 100644 --- a/tools/swift-demangle/swift-demangle.cpp +++ b/tools/swift-demangle/swift-demangle.cpp @@ -125,7 +125,7 @@ static void demangle(llvm::raw_ostream &os, llvm::StringRef name, // the old mangling scheme. // This makes it easier to share the same database between the // mangling and demangling tests. - remangled = name; + remangled = name.str(); } else { remangled = swift::Demangle::mangleNode(pointer); unsigned prefixLen = swift::Demangle::getManglingPrefixLength(remangled); @@ -148,7 +148,7 @@ static void demangle(llvm::raw_ostream &os, llvm::StringRef name, llvm::outs() << remangled; return; } else if (RemangleRtMode) { - std::string remangled = name; + std::string remangled = name.str(); if (pointer) { remangled = swift::Demangle::mangleNodeOld(pointer); } diff --git a/tools/swift-ide-test/XMLValidator.cpp b/tools/swift-ide-test/XMLValidator.cpp index 48637acd0af2f..24f8985a3fef5 100644 --- a/tools/swift-ide-test/XMLValidator.cpp +++ b/tools/swift-ide-test/XMLValidator.cpp @@ -39,7 +39,7 @@ XMLValidator::~XMLValidator() { delete Impl; } void XMLValidator::setSchema(StringRef FileName) { assert(Impl->SchemaFileName.empty()); - Impl->SchemaFileName = FileName; + Impl->SchemaFileName = FileName.str(); } XMLValidator::Status XMLValidator::validate(const std::string &XML) { diff --git a/tools/swift-refactor/swift-refactor.cpp b/tools/swift-refactor/swift-refactor.cpp index 22c885b97c2cb..690e16c23eabf 100644 --- a/tools/swift-refactor/swift-refactor.cpp +++ b/tools/swift-refactor/swift-refactor.cpp @@ -285,7 +285,7 @@ int main(int argc, char *argv[]) { SourceManager &SM = SF->getASTContext().SourceMgr; unsigned BufferID = SF->getBufferID().getValue(); - std::string Buffer = SM.getRangeForBuffer(BufferID).str(); + std::string Buffer = SM.getRangeForBuffer(BufferID).str().str(); auto Start = getLocsByLabelOrPosition(options::LineColumnPair, Buffer); if (Start.empty()) { From 1fa3a310131845ddf5169ec606500371f5904c7d Mon Sep 17 00:00:00 2001 From: Shoaib Meenai Date: Tue, 4 Feb 2020 18:02:35 -0800 Subject: [PATCH 014/222] [SourceKit] Adjust for LLVM StringRef change (#29625) StringRef needs an explicit conversion to std::string now. --- .../tools/sourcekitd/bin/InProc/sourcekitdInProc.cpp | 2 +- .../tools/sourcekitd/lib/API/sourcekitdAPI-InProc.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/SourceKit/tools/sourcekitd/bin/InProc/sourcekitdInProc.cpp b/tools/SourceKit/tools/sourcekitd/bin/InProc/sourcekitdInProc.cpp index 3afed31e7c9ca..13c8a7c245168 100644 --- a/tools/SourceKit/tools/sourcekitd/bin/InProc/sourcekitdInProc.cpp +++ b/tools/SourceKit/tools/sourcekitd/bin/InProc/sourcekitdInProc.cpp @@ -93,7 +93,7 @@ std::string sourcekitd::getRuntimeLibPath() { llvm_unreachable("call to GetModuleFileNameA failed"); libPath = llvm::sys::path::parent_path(llvm::sys::path::parent_path(path)); llvm::sys::path::append(libPath, "lib"); - return libPath.str(); + return libPath.str().str(); #else // This silly cast below avoids a C++ warning. Dl_info info; diff --git a/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-InProc.cpp b/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-InProc.cpp index fe93d733c538b..a1324125c6019 100644 --- a/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-InProc.cpp +++ b/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-InProc.cpp @@ -633,7 +633,7 @@ void ResponseBuilder::Dictionary::set(UIdent Key, const char *Str) { void ResponseBuilder::Dictionary::set(UIdent Key, StringRef Str) { static_cast(Impl)->set(SKDUIDFromUIdent(Key), - new SKDString(Str)); + new SKDString(std::string(Str))); } void ResponseBuilder::Dictionary::set(UIdent Key, const std::string &Str) { @@ -649,7 +649,7 @@ void ResponseBuilder::Dictionary::set(SourceKit::UIdent Key, ArrayRef Strs) { auto ArrayObject = new SKDArray(); for (auto Str : Strs) { - ArrayObject->set(SOURCEKITD_ARRAY_APPEND, new SKDString(Str)); + ArrayObject->set(SOURCEKITD_ARRAY_APPEND, new SKDString(std::string(Str))); } static_cast(Impl)->set(SKDUIDFromUIdent(Key), ArrayObject); } From 3d3e19223b58abc4eaab1576ff3f82d9024216f3 Mon Sep 17 00:00:00 2001 From: Puyan Lotfi Date: Mon, 10 Feb 2020 18:23:20 -0500 Subject: [PATCH 015/222] Handling strict conversion criteria for StringRef to std::string from TOT llvm. --- lib/Frontend/ModuleInterfaceBuilder.cpp | 2 +- tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Frontend/ModuleInterfaceBuilder.cpp b/lib/Frontend/ModuleInterfaceBuilder.cpp index 83a89487ea32f..b276ecd961cd9 100644 --- a/lib/Frontend/ModuleInterfaceBuilder.cpp +++ b/lib/Frontend/ModuleInterfaceBuilder.cpp @@ -346,7 +346,7 @@ bool ModuleInterfaceBuilder::buildSwiftModuleInternal( // Setup the callbacks for serialization, which can occur during the // optimization pipeline. SerializationOptions SerializationOpts; - std::string OutPathStr = OutPath; + std::string OutPathStr = OutPath.str(); SerializationOpts.EnableNestedTypeLookupTable = FEOpts.EnableSerializationNestedTypeLookupTable; SerializationOpts.OutputPath = OutPathStr.c_str(); diff --git a/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp b/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp index 2daa27f7efcc0..5020459797e34 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp @@ -916,7 +916,7 @@ static bool passCursorInfoForDecl(SourceFile* SF, if (ClangMod) ModuleName = ClangMod->getFullModuleName(); } else if (VD->getLoc().isInvalid() && VD->getModuleContext() != MainModule) { - ModuleName = VD->getModuleContext()->getName().str(); + ModuleName = VD->getModuleContext()->getName().str().str(); } StringRef ModuleInterfaceName; if (auto IFaceGenRef = Lang.getIFaceGenContexts().find(ModuleName, Invok)) From 728e8a1bde9b5e2ae219427dca70ff689e2f200a Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Fri, 14 Feb 2020 13:52:26 +0100 Subject: [PATCH 016/222] Adapt to API change that moved Sysroot attribute to CompileUnit Commit 7b30370e5bcf569fcdc15204d4c592163fd78cb3 changed the Sysroot attribute to the CompileUnit which broke the build. --- lib/IRGen/IRGenDebugInfo.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 6363398bdf82c..c65f43d5b8e5b 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -659,10 +659,8 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { } } - StringRef Sysroot = IGM.Context.SearchPathOpts.SDKPath; llvm::DIModule *M = - DBuilder.createModule(Parent, Name, ConfigMacros, RemappedIncludePath, - Sysroot); + DBuilder.createModule(Parent, Name, ConfigMacros, RemappedIncludePath); DIModuleCache.insert({Key, llvm::TrackingMDNodeRef(M)}); return M; } @@ -1692,6 +1690,7 @@ IRGenDebugInfoImpl::IRGenDebugInfoImpl(const IRGenOptions &Opts, DBuilder.createFile(DebugPrefixMap.remapPath(SourcePath), DebugPrefixMap.remapPath(Opts.DebugCompilationDir)); + StringRef Sysroot = IGM.Context.SearchPathOpts.SDKPath; TheCU = DBuilder.createCompileUnit( Lang, MainFile, Producer, Opts.shouldOptimize(), Opts.getDebugFlags(PD), @@ -1702,7 +1701,7 @@ IRGenDebugInfoImpl::IRGenDebugInfoImpl(const IRGenOptions &Opts, /* DWOId */ 0, /* SplitDebugInlining */ true, /* DebugInfoForProfiling */ false, llvm::DICompileUnit::DebugNameTableKind::Default, - /* RangesBaseAddress */ false); + /* RangesBaseAddress */ false, Sysroot); // Because the swift compiler relies on Clang to setup the Module, // the clang CU is always created first. Several dwarf-reading From 4469a6819e041d1bd58dbc5a6ca2cc19b7767b23 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 17 Feb 2020 09:51:58 -0800 Subject: [PATCH 017/222] [IRGen] Adjust for upstream API change --- lib/IRGen/IRGenDebugInfo.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 6363398bdf82c..bc1f52f4bc3c0 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -659,10 +659,8 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { } } - StringRef Sysroot = IGM.Context.SearchPathOpts.SDKPath; llvm::DIModule *M = - DBuilder.createModule(Parent, Name, ConfigMacros, RemappedIncludePath, - Sysroot); + DBuilder.createModule(Parent, Name, ConfigMacros, RemappedIncludePath); DIModuleCache.insert({Key, llvm::TrackingMDNodeRef(M)}); return M; } From ccd9ed2aaa3f77065578677c83252754c61c7eec Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Mon, 17 Feb 2020 10:05:30 -0800 Subject: [PATCH 018/222] Resolve master -> master-next Merge Conflicts (#29884) * [Stdlib] Eagerly realize EmptyDictionarySingleton and EmptySetSingleton. These objects can escape into ObjC without their class being realized first, which can cause a crash if the unrealized class gets passed into the ObjC runtime. rdar://problem/59295395 * Reorganization of SourceFileDepGraph building and mocking. * Further reorganization. * [ConstraintSystem] Removing check related to ArgumentMismatch in CSDiag. * [docs] Updating TypeChecker.rst * hash templates for linux * Fix string memory bug * SILCombine: fix a miscompile in the alloc_stack optimization which causes a use-after-free. A "copy_addr [take] %src to [initialization] %alloc_stack" is replaced by a "destroy_addr %src" if the alloc_stack is otherwise dead. This is okay as long as the "moved" object is kept alive otherwise. This can break if a retain of %src is moved after the copy_addr. It cannot happen with OSSA. So as soon as we have OSSA, we can remove the check again. rdar://problem/59509229 Co-authored-by: Mike Ash Co-authored-by: David Ungar Co-authored-by: Luciano Almeida Co-authored-by: eeckstein Co-authored-by: Pavel Yaskevich --- docs/TypeChecker.rst | 1 - include/swift/AST/FineGrainedDependencies.h | 95 +- .../swift/AST/SourceFileDepGraphConstructor.h | 172 +++ .../Driver/FineGrainedDependencyDriverGraph.h | 16 +- lib/AST/FineGrainedDependencies.cpp | 42 +- lib/AST/SourceFileDepGraphConstructor.cpp | 1191 +++++++++-------- .../FineGrainedDependencyDriverGraph.cpp | 72 +- .../SILCombiner/SILCombinerMiscVisitors.cpp | 48 +- lib/Sema/ConstraintSystem.cpp | 15 +- stdlib/public/core/DictionaryStorage.swift | 1 + stdlib/public/core/SetStorage.swift | 1 + test/SILOptimizer/sil_combine.sil | 101 ++ .../sil_combine_alloc_stack.swift | 43 + .../EmptyCollectionSingletonRealization.swift | 48 + unittests/Driver/CMakeLists.txt | 1 + .../FineGrainedDependencyGraphTests.cpp | 578 ++++---- .../MockingFineGrainedDependencyGraphs.cpp | 89 ++ .../MockingFineGrainedDependencyGraphs.h | 103 ++ ...peBodyFingerprintsDependencyGraphTests.cpp | 619 +++++---- 19 files changed, 1943 insertions(+), 1293 deletions(-) create mode 100644 include/swift/AST/SourceFileDepGraphConstructor.h create mode 100644 test/SILOptimizer/sil_combine_alloc_stack.swift create mode 100644 test/stdlib/EmptyCollectionSingletonRealization.swift create mode 100644 unittests/Driver/MockingFineGrainedDependencyGraphs.cpp create mode 100644 unittests/Driver/MockingFineGrainedDependencyGraphs.h diff --git a/docs/TypeChecker.rst b/docs/TypeChecker.rst index b41381b24d1de..1deeaeb8441e5 100644 --- a/docs/TypeChecker.rst +++ b/docs/TypeChecker.rst @@ -985,4 +985,3 @@ The things in the queue yet to be ported are: - Missing explicit ``Self.`` and ``self.`` - Logic related to overload candidate ranking (``CalleeCandidateInfo``) - - ``diagnoseParameterErrors`` diff --git a/include/swift/AST/FineGrainedDependencies.h b/include/swift/AST/FineGrainedDependencies.h index 5f3424a189e84..6163e829191d7 100644 --- a/include/swift/AST/FineGrainedDependencies.h +++ b/include/swift/AST/FineGrainedDependencies.h @@ -93,14 +93,20 @@ template class Memoizer { public: Memoizer() = default; + Optional findExisting(KeyT key) { + auto iter = memos.find(key); + if (iter != memos.end()) + return iter->second; + return None; + } + /// \p createFn must create a \ref ValueT that corresponds to the \ref KeyT /// passed into it. ValueT findExistingOrCreateIfNew(KeyT key, function_ref createFn) { - auto iter = memos.find(key); - if (iter != memos.end()) - return iter->second; + if (auto existing = findExisting(key)) + return existing.getValue(); ValueT v = createFn(key); (void)insert(key, v); return v; @@ -372,6 +378,7 @@ const std::string NodeKindNames[]{ "topLevel", "nominal", "potentialMember", "member", "dynamicLookup", "externalDepend", "sourceFileProvide"}; + /// Instead of the status quo scheme of two kinds of "Depends", cascading and /// non-cascading this code represents each entity ("Provides" in the status /// quo), by a pair of nodes. One node represents the "implementation." If the @@ -391,6 +398,7 @@ template void forEachAspect(FnT fn) { fn(DeclAspect(i)); } + /// A pair of nodes that represent the two aspects of a given entity. /// Templated in order to serve for either SourceFileDepGraphNodes or /// ModuleDepGraphNodes. @@ -499,10 +507,23 @@ class DependencyKey { } bool isInterface() const { return getAspect() == DeclAspect::interface; } + /// Create just the interface half of the keys for a provided Decl or Decl + /// pair + template + static DependencyKey createForProvidedEntityInterface(Entity); + /// Given some type of provided entity compute the context field of the key. template static std::string computeContextForProvidedEntity(Entity); + DependencyKey correspondingImplementation() const { + return withAspect(DeclAspect::implementation); + } + + DependencyKey withAspect(DeclAspect aspect) const { + return DependencyKey(kind, aspect, context, name); + } + /// Given some type of provided entity compute the name field of the key. template static std::string computeNameForProvidedEntity(Entity); @@ -514,7 +535,8 @@ class DependencyKey { template static DependencyKey createDependedUponKey(StringRef); - static DependencyKey createKeyForWholeSourceFile(StringRef swiftDeps); + static DependencyKey createKeyForWholeSourceFile(DeclAspect, + StringRef swiftDeps); std::string humanReadableName() const; @@ -555,6 +577,14 @@ struct std::hash { return size_t(aspect); } }; +template <> +struct std::hash { + size_t + operator()(const swift::fine_grained_dependencies::NodeKind kind) const { + return size_t(kind); + } +}; + namespace swift { namespace fine_grained_dependencies { @@ -616,6 +646,10 @@ class DepGraphNode { /// See SourceFileDepGraphNode::SourceFileDepGraphNode(...) and /// ModuleDepGraphNode::ModuleDepGraphNode(...) Don't set swiftDeps on /// creation because this field can change if a node is moved. + DepGraphNode(DependencyKey key, Optional fingerprint) + : DepGraphNode(key, fingerprint ? fingerprint->str() + : Optional()) {} + DepGraphNode(DependencyKey key, Optional fingerprint) : key(key), fingerprint(fingerprint) {} DepGraphNode(const DepGraphNode &other) = default; @@ -627,8 +661,12 @@ class DepGraphNode { const DependencyKey &getKey() const { return key; } - const Optional &getFingerprint() const { return fingerprint; } - + const Optional getFingerprint() const { + if (fingerprint) { + return StringRef(fingerprint.getValue()); + } + return None; + } /// When driver reads a SourceFileDepGraphNode, it may be a node that was /// created to represent a name-lookup (a.k.a a "depend") in the frontend. In /// that case, the node represents an entity that resides in some other file @@ -637,7 +675,9 @@ class DepGraphNode { /// (someday) have a fingerprint. In order to preserve the /// ModuleDepGraphNode's identity but bring its fingerprint up to date, it /// needs to set the fingerprint *after* the node has been created. - void setFingerprint(Optional fp) { fingerprint = fp; } + void setFingerprint(Optional fp) { + fingerprint = fp ? fp->str() : Optional(); + } SWIFT_DEBUG_DUMP; void dump(llvm::raw_ostream &os) const; @@ -684,7 +724,7 @@ class SourceFileDepGraphNode : public DepGraphNode { SourceFileDepGraphNode() : DepGraphNode(), sequenceNumber(~0) {} /// Used by the frontend to build nodes. - SourceFileDepGraphNode(DependencyKey key, Optional fingerprint, + SourceFileDepGraphNode(DependencyKey key, Optional fingerprint, bool isProvides) : DepGraphNode(key, fingerprint), isProvides(isProvides) { assert(key.verify()); @@ -780,34 +820,6 @@ class SourceFileDepGraph { SourceFileDepGraph(const SourceFileDepGraph &g) = delete; SourceFileDepGraph(SourceFileDepGraph &&g) = default; - /// Simulate loading for unit testing: - /// \param swiftDepsFileName The name of the swiftdeps file of the phony job - /// \param includePrivateDeps Whether the graph includes intra-file arcs - /// \param hadCompilationError Simulate a compilation error - /// \param interfaceHash The interface hash of the simulated graph - /// \param simpleNamesByRDK A map of vectors of names keyed by reference - /// dependency key \param compoundNamesByRDK A map of (mangledHolder, - /// baseName) pairs keyed by reference dependency key. For single-name - /// dependencies, an initial underscore indicates that the name does not - /// cascade. For compound names, it is the first name, the holder which - /// indicates non-cascading. For member names, an initial underscore indicates - /// file-privacy. - static SourceFileDepGraph - simulateLoad(std::string swiftDepsFileName, const bool includePrivateDeps, - const bool hadCompilationError, std::string interfaceHash, - llvm::StringMap> simpleNamesByRDK, - llvm::StringMap>> - compoundNamesByRDK); - - static constexpr char noncascadingOrPrivatePrefix = '#'; - static constexpr char nameFingerprintSeparator = ','; - - static std::string noncascading(std::string name); - - LLVM_ATTRIBUTE_UNUSED - static std::string privatize(std::string name); - - /// Nodes are owned by the graph. ~SourceFileDepGraph() { forEachNode([&](SourceFileDepGraphNode *n) { delete n; }); @@ -851,12 +863,15 @@ class SourceFileDepGraph { /// The frontend creates a pair of nodes for every tracked Decl and the source /// file itself. InterfaceAndImplementationPair - findExistingNodePairOrCreateAndAddIfNew( - NodeKind k, const ContextNameFingerprint &contextNameFingerprint); + findExistingNodePairOrCreateAndAddIfNew(const DependencyKey &interfaceKey, + Optional fingerprint); + + NullablePtr + findExistingNode(const DependencyKey &key); SourceFileDepGraphNode * - findExistingNodeOrCreateIfNew(DependencyKey key, - const Optional &fingerprint, + findExistingNodeOrCreateIfNew(const DependencyKey &key, + const Optional fingerprint, bool isProvides); /// \p Use is the Node that must be rebuilt when \p def changes. diff --git a/include/swift/AST/SourceFileDepGraphConstructor.h b/include/swift/AST/SourceFileDepGraphConstructor.h new file mode 100644 index 0000000000000..3598b40bc9e89 --- /dev/null +++ b/include/swift/AST/SourceFileDepGraphConstructor.h @@ -0,0 +1,172 @@ +//===----- SourceFileDepGraphConstructor.h ----------------------*- C++ -*-===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2018 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_SOURCE_FILE_DEP_GRAPH_CONSTRUCTOR_H +#define SWIFT_AST_SOURCE_FILE_DEP_GRAPH_CONSTRUCTOR_H + +#include + +namespace swift { +namespace fine_grained_dependencies { +/// Abstract class for building a \c SourceFileDepGraph from either a real +/// \c SourceFile or a unit test +class SourceFileDepGraphConstructor { +protected: + /// To match the existing system, set this to false. + /// To include even private entities and get intra-file info, set to true. + const bool includePrivateDeps; + + /// If there was an error, cannot get accurate info. + const bool hadCompilationError; + + /// The name of the swiftDeps file. + const std::string swiftDeps; + + /// The fingerprint of the whole file + const std::string fileFingerprint; + + /// For debugging + const bool emitDotFileAfterConstruction; + + DiagnosticEngine &diags; + + /// Graph under construction + SourceFileDepGraph g; + +public: + /// Expose this layer to enable faking up a constructor for testing. + /// See the instance variable comments for explanation. + SourceFileDepGraphConstructor(bool includePrivateDeps, + bool hadCompilationError, StringRef swiftDeps, + StringRef fileFingerprint, + bool emitDotFileAfterConstruction, + DiagnosticEngine &diags); + + virtual ~SourceFileDepGraphConstructor() = default; + + /// Create a SourceFileDepGraph. + SourceFileDepGraph construct(); + +private: + void addSourceFileNodesToGraph(); + + /// Add the "provides" nodes when mocking up a graph + virtual void addAllDefinedDecls() = 0; + + /// Add the "depends" nodes and arcs when mocking a graph + virtual void addAllUsedDecls() = 0; + +protected: + /// Add an pair of interface, implementation nodes to the graph, which + /// represent some \c Decl defined in this source file. \param key the + /// interface key of the pair + void addADefinedDecl(const DependencyKey &key, + Optional fingerprint); + + void addAUsedDecl(const DependencyKey &def, const DependencyKey &use); +}; + +/// Constructs a SourceFileDepGraph from a *real* \c SourceFile +/// Reads the information provided by the frontend and builds the +/// SourceFileDepGraph + +class RealSourceFileDepGraphConstructor : public SourceFileDepGraphConstructor { + SourceFile *const SF; + const DependencyTracker &depTracker; + +public: + RealSourceFileDepGraphConstructor(SourceFile *SF, StringRef outputPath, + const DependencyTracker &depTracker, + bool alsoEmitDotFile); + + ~RealSourceFileDepGraphConstructor() override = default; + +private: + static std::string getFingerprint(SourceFile *SF); + + static bool computeIncludePrivateDeps(SourceFile *SF); + static std::string getInterfaceHash(SourceFile *SF); + + void addAllDefinedDecls() override; + void addAllUsedDecls() override; + + /// Given an array of Decls or pairs of them in \p declsOrPairs + /// create node pairs for context and name + template + void addAllDefinedDeclsOfAGivenType(std::vector &contentsVec); + + /// At present, only nominals, protocols, and extensions have (body) + /// fingerprints + static Optional + getFingerprintIfAny(std::pair); + static Optional getFingerprintIfAny(const Decl *d); +}; + +using DependencyDescriptions = + std::unordered_multimap>; + +class MockSourceFileDepGraphConstructor : public SourceFileDepGraphConstructor { + const DependencyDescriptions dependencyDescriptions; + +public: + MockSourceFileDepGraphConstructor( + bool includePrivateDeps, bool hadCompilationError, StringRef swiftDeps, + StringRef fileFingerprint, bool emitDotFileAfterConstruction, + const DependencyDescriptions &dependencyDescriptions, + DiagnosticEngine &diags) + : SourceFileDepGraphConstructor(includePrivateDeps, hadCompilationError, + swiftDeps, fileFingerprint, + emitDotFileAfterConstruction, diags), + dependencyDescriptions(dependencyDescriptions) {} + + ~MockSourceFileDepGraphConstructor() override = default; + +private: + void addAllDefinedDecls() override; + void addAllUsedDecls() override; + + /// For brevity, unit tests specify dependencies by NodeKind, + /// but for processing, the kind is needed for each entry. + void forEachEntry(function_ref fn); + + static const char *defUseSeparator; + static bool isADefinedDecl(StringRef s); + + void addADefinedDecl(StringRef s, NodeKind kind); + void addAUsedDecl(StringRef s, NodeKind kind); + + Optional> parseAUsedDecl(StringRef s, + NodeKind); + + /// Parse and return an interface \c DependencyKey + Optional parseADefinedDecl(StringRef s, NodeKind, DeclAspect); + + DependencyKey computeUseKey(StringRef s, bool isCascadingUse); + + /// Return true if when the name appears in a unit test, it represents a + /// context, not a baseName. Return false if a single name is a baseName, + /// without context Return None if there shoud be two names + static Optional singleNameIsContext(NodeKind kind); + + static constexpr char nameContextSeparator = ','; + + static constexpr char fingerprintSeparator = '@'; + + static std::string parseContext(const StringRef s, const NodeKind kind); + + static std::string parseName(const StringRef s, const NodeKind kind); +}; + +} // namespace fine_grained_dependencies +} // namespace swift + +#endif // SWIFT_AST_SOURCE_FILE_DEP_GRAPH_CONSTRUCTOR_H diff --git a/include/swift/Driver/FineGrainedDependencyDriverGraph.h b/include/swift/Driver/FineGrainedDependencyDriverGraph.h index 36ab089d6c029..71ecc27c506b6 100644 --- a/include/swift/Driver/FineGrainedDependencyDriverGraph.h +++ b/include/swift/Driver/FineGrainedDependencyDriverGraph.h @@ -57,8 +57,7 @@ class ModuleDepGraphNode : public DepGraphNode { bool hasBeenTracedAsADependent = false; public: - ModuleDepGraphNode(const DependencyKey &key, - Optional fingerprint, + ModuleDepGraphNode(const DependencyKey &key, Optional fingerprint, Optional swiftDeps) : DepGraphNode(key, fingerprint), swiftDeps(swiftDeps) {} @@ -187,11 +186,13 @@ class ModuleDepGraph { /// files for the same name distinct, keep a sequence number for each name. std::unordered_map dotFileSequenceNumber; +public: const bool verifyFineGrainedDependencyGraphAfterEveryImport; const bool emitFineGrainedDependencyDotFileAfterEveryImport; const bool EnableTypeFingerprints; +private: /// If tracing dependencies, holds a vector used to hold the current path /// def - use/def - use/def - ... Optional> currentPathIfTracing; @@ -336,15 +337,6 @@ class ModuleDepGraph { const SourceFileDepGraph &, DiagnosticEngine &); - /// Also for unit tests - Changes - simulateLoad(const driver::Job *cmd, - llvm::StringMap> simpleNames, - llvm::StringMap>> - compoundNames = {}, - const bool includePrivateDeps = false, - const bool hadCompilationError = false); - private: /// Read a SourceFileDepGraph belonging to \p job from \p buffer @@ -515,6 +507,8 @@ class ModuleDepGraph { /// Record a new (to this graph) Job. void registerJob(const driver::Job *); + std::vector getAllJobs() const; + /// Find jobs that were previously not known to need compilation but that /// depend on \c externalDependency. std::vector diff --git a/lib/AST/FineGrainedDependencies.cpp b/lib/AST/FineGrainedDependencies.cpp index 62c57a4d25900..b3f9c752b0e80 100644 --- a/lib/AST/FineGrainedDependencies.cpp +++ b/lib/AST/FineGrainedDependencies.cpp @@ -103,17 +103,20 @@ void SourceFileDepGraph::forEachArc( InterfaceAndImplementationPair SourceFileDepGraph::findExistingNodePairOrCreateAndAddIfNew( - NodeKind k, const ContextNameFingerprint &contextNameFingerprint) { - const std::string &context = std::get<0>(contextNameFingerprint); - const std::string &name = std::get<1>(contextNameFingerprint); - const Optional &fingerprint = - std::get<2>(contextNameFingerprint); - auto *interfaceNode = findExistingNodeOrCreateIfNew( - DependencyKey(k, DeclAspect::interface, context, name), fingerprint, - true /* = isProvides */); + const DependencyKey &interfaceKey, Optional fingerprint) { + + // Optimization for whole-file users: + if (interfaceKey.getKind() == NodeKind::sourceFileProvide && + !allNodes.empty()) + return getSourceFileNodePair(); + + assert(interfaceKey.isInterface()); + const DependencyKey implementationKey = + interfaceKey.correspondingImplementation(); + auto *interfaceNode = findExistingNodeOrCreateIfNew(interfaceKey, fingerprint, + true /* = isProvides */); auto *implementationNode = findExistingNodeOrCreateIfNew( - DependencyKey(k, DeclAspect::implementation, context, name), fingerprint, - true /* = isProvides */); + implementationKey, fingerprint, true /* = isProvides */); InterfaceAndImplementationPair nodePair{ interfaceNode, implementationNode}; @@ -136,7 +139,7 @@ SourceFileDepGraph::findExistingNodePairOrCreateAndAddIfNew( } SourceFileDepGraphNode *SourceFileDepGraph::findExistingNodeOrCreateIfNew( - DependencyKey key, const Optional &fingerprint, + const DependencyKey &key, const Optional fingerprint, const bool isProvides) { SourceFileDepGraphNode *result = memoizedNodes.findExistingOrCreateIfNew( key, [&](DependencyKey key) -> SourceFileDepGraphNode * { @@ -164,20 +167,25 @@ SourceFileDepGraphNode *SourceFileDepGraph::findExistingNodeOrCreateIfNew( return result; } +NullablePtr +SourceFileDepGraph::findExistingNode(const DependencyKey &key) { + auto existing = memoizedNodes.findExisting(key); + return existing ? existing.getValue() : NullablePtr(); +} + std::string DependencyKey::demangleTypeAsContext(StringRef s) { return swift::Demangle::demangleTypeAsString(s.str()); } -DependencyKey -DependencyKey::createKeyForWholeSourceFile(const StringRef swiftDeps) { +DependencyKey DependencyKey::createKeyForWholeSourceFile(DeclAspect aspect, + StringRef swiftDeps) { assert(!swiftDeps.empty()); - const auto context = DependencyKey::computeContextForProvidedEntity< + const std::string context = DependencyKey::computeContextForProvidedEntity< NodeKind::sourceFileProvide>(swiftDeps); - const auto name = + const std::string name = DependencyKey::computeNameForProvidedEntity( swiftDeps); - return DependencyKey(NodeKind::sourceFileProvide, DeclAspect::interface, - context, name); + return DependencyKey(NodeKind::sourceFileProvide, aspect, context, name); } //============================================================================== diff --git a/lib/AST/SourceFileDepGraphConstructor.cpp b/lib/AST/SourceFileDepGraphConstructor.cpp index 7019e224edca7..3c9894b669391 100644 --- a/lib/AST/SourceFileDepGraphConstructor.cpp +++ b/lib/AST/SourceFileDepGraphConstructor.cpp @@ -25,6 +25,7 @@ #include "swift/AST/ModuleLoader.h" #include "swift/AST/NameLookup.h" #include "swift/AST/SourceFile.h" +#include "swift/AST/SourceFileDepGraphConstructor.h" #include "swift/AST/Types.h" #include "swift/Basic/FileSystem.h" #include "swift/Basic/LLVM.h" @@ -46,16 +47,78 @@ using namespace swift; using namespace fine_grained_dependencies; +//============================================================================== +// MARK: SourceFileDepGraphConstructor - client interface +//============================================================================== + +SourceFileDepGraphConstructor::SourceFileDepGraphConstructor( + bool includePrivateDeps, bool hadCompilationError, StringRef swiftDeps, + StringRef fileFingerprint, bool emitDotFileAfterConstruction, + DiagnosticEngine &diags) + : includePrivateDeps(includePrivateDeps), + hadCompilationError(hadCompilationError), swiftDeps(swiftDeps.str()), + fileFingerprint(fileFingerprint.str()), + emitDotFileAfterConstruction(emitDotFileAfterConstruction), diags(diags) { +} + +SourceFileDepGraph SourceFileDepGraphConstructor::construct() { + addSourceFileNodesToGraph(); + if (!hadCompilationError) { + addAllDefinedDecls(); + addAllUsedDecls(); + } + assert(g.verify()); + if (emitDotFileAfterConstruction) + g.emitDotFile(swiftDeps, diags); + return std::move(g); +} + +//============================================================================== +// MARK: SourceFileDepGraphConstructor - adding a defined or used Decl +//============================================================================== +void SourceFileDepGraphConstructor::addSourceFileNodesToGraph() { + g.findExistingNodePairOrCreateAndAddIfNew( + DependencyKey::createKeyForWholeSourceFile(DeclAspect::interface, + swiftDeps), + StringRef(fileFingerprint)); +} + +void SourceFileDepGraphConstructor::addADefinedDecl( + const DependencyKey &interfaceKey, Optional fingerprint) { + + auto nodePair = + g.findExistingNodePairOrCreateAndAddIfNew(interfaceKey, fingerprint); + // Since the current type fingerprints only include tokens in the body, + // when the interface hash changes, it is possible that the type in the + // file has changed. + g.addArc(g.getSourceFileNodePair().getInterface(), nodePair.getInterface()); +} + +void SourceFileDepGraphConstructor::addAUsedDecl(const DependencyKey &defKey, + const DependencyKey &useKey) { + auto *defNode = + g.findExistingNodeOrCreateIfNew(defKey, None, false /* = !isProvides */); + auto nullableUse = g.findExistingNode(useKey); + assert(nullableUse.isNonNull() && "Use must be an already-added provides"); + auto *useNode = nullableUse.get(); + assert(useNode->getIsProvides() && "Use (using node) must be a provides"); + g.addArc(defNode, useNode); +} + +//============================================================================== +// MARK: Constructing from a SourceFile +//============================================================================== + //============================================================================== // MARK: Helpers for key construction that must be in frontend //============================================================================== template static std::string getBaseName(const DeclT *decl) { - return decl->getBaseName().userFacingName().str(); + return decl->getBaseName().userFacingName(); } template static std::string getName(const DeclT *decl) { - return DeclBaseName(decl->getName()).userFacingName().str(); + return DeclBaseName(decl->getName()).userFacingName(); } static std::string mangleTypeAsContext(const NominalTypeDecl *NTD) { @@ -135,6 +198,239 @@ static bool allInheritedProtocolsArePrivate(const ExtensionDecl *ED) { extendedTypeIsPrivate); } +//============================================================================== +// MARK: DependencyKey - creation for Decls +//============================================================================== + +template +DependencyKey DependencyKey::createForProvidedEntityInterface(Entity entity) { + return DependencyKey( + kindArg, DeclAspect::interface, + DependencyKey::computeContextForProvidedEntity(entity), + DependencyKey::computeNameForProvidedEntity(entity)); +} + +//============================================================================== +// MARK: computeContextForProvidedEntity +//============================================================================== + +template +std::string DependencyKey::computeContextForProvidedEntity(Entity) { + // Context field is not used for most kinds + return ""; +} + +// \ref nominal dependencies are created from a Decl and use the context field. +template <> +std::string DependencyKey::computeContextForProvidedEntity< + NodeKind::nominal, NominalTypeDecl const *>(NominalTypeDecl const *D) { + return mangleTypeAsContext(D); +} + +/// \ref potentialMember dependencies are created from a Decl and use the +/// context field. +template <> +std::string +DependencyKey::computeContextForProvidedEntity( + const NominalTypeDecl *D) { + return mangleTypeAsContext(D); +} + +template <> +std::string DependencyKey::computeContextForProvidedEntity< + NodeKind::member, const NominalTypeDecl *>(const NominalTypeDecl *holder) { + return mangleTypeAsContext(holder); +} + +/// \ref member dependencies are created from a pair and use the context field. +template <> +std::string DependencyKey::computeContextForProvidedEntity< + NodeKind::member, std::pair>( + std::pair holderAndMember) { + return computeContextForProvidedEntity( + holderAndMember.first); +} + +// Linux compiler requires the following: +template std::string + DependencyKey::computeContextForProvidedEntity(StringRef); + +//============================================================================== +// MARK: computeNameForProvidedEntity +//============================================================================== + +template <> +std::string +DependencyKey::computeNameForProvidedEntity(StringRef swiftDeps) { + assert(!swiftDeps.empty()); + return swiftDeps; +} + +template <> +std::string +DependencyKey::computeNameForProvidedEntity( + const PrecedenceGroupDecl *D) { + return ::getName(D); +} +template <> +std::string DependencyKey::computeNameForProvidedEntity< + NodeKind::topLevel, FuncDecl const *>(const FuncDecl *D) { + return ::getName(D); +} +template <> +std::string DependencyKey::computeNameForProvidedEntity< + NodeKind::topLevel, OperatorDecl const *>(const OperatorDecl *D) { + return ::getName(D); +} +template <> +std::string DependencyKey::computeNameForProvidedEntity< + NodeKind::topLevel, NominalTypeDecl const *>(const NominalTypeDecl *D) { + return ::getName(D); +} +template <> +std::string DependencyKey::computeNameForProvidedEntity< + NodeKind::topLevel, ValueDecl const *>(const ValueDecl *D) { + return getBaseName(D); +} +template <> +std::string DependencyKey::computeNameForProvidedEntity< + NodeKind::dynamicLookup, ValueDecl const *>(const ValueDecl *D) { + return getBaseName(D); +} +template <> +std::string DependencyKey::computeNameForProvidedEntity< + NodeKind::nominal, NominalTypeDecl const *>(const NominalTypeDecl *D) { + return ""; +} +template <> +std::string +DependencyKey::computeNameForProvidedEntity( + const NominalTypeDecl *D) { + return ""; +} + +template <> +std::string DependencyKey::computeNameForProvidedEntity< + NodeKind::member, std::pair>( + std::pair holderAndMember) { + return getBaseName(holderAndMember.second); +} + +//============================================================================== +// MARK: createDependedUponKey +//============================================================================== + +template <> +DependencyKey +DependencyKey::createDependedUponKey(StringRef name) { + return DependencyKey(NodeKind::topLevel, DeclAspect::interface, "", name); +} + +template <> +DependencyKey +DependencyKey::createDependedUponKey(StringRef name) { + return DependencyKey(NodeKind::dynamicLookup, DeclAspect::interface, "", + name); +} + +template <> +DependencyKey +DependencyKey::createDependedUponKey(StringRef name) { + return DependencyKey(NodeKind::externalDepend, DeclAspect::interface, "", + name); +} + +template <> +DependencyKey +DependencyKey::createDependedUponKey(StringRef mangledName) { + return DependencyKey(NodeKind::nominal, DeclAspect::interface, mangledName, + ""); +} + +DependencyKey DependencyKey::createDependedUponKey(StringRef mangledHolderName, + StringRef memberBaseName) { + const bool isMemberBlank = memberBaseName.empty(); + const auto kind = + isMemberBlank ? NodeKind::potentialMember : NodeKind::member; + return DependencyKey(kind, DeclAspect::interface, mangledHolderName, + isMemberBlank ? "" : memberBaseName); +} + +//============================================================================== +// MARK: Entry point into frontend graph construction +//============================================================================== + +bool fine_grained_dependencies::emitReferenceDependencies( + DiagnosticEngine &diags, SourceFile *const SF, + const DependencyTracker &depTracker, StringRef outputPath, + const bool alsoEmitDotFile) { + + // Before writing to the dependencies file path, preserve any previous file + // that may have been there. No error handling -- this is just a nicety, it + // doesn't matter if it fails. + llvm::sys::fs::rename(outputPath, outputPath + "~"); + + SourceFileDepGraph g = RealSourceFileDepGraphConstructor( + 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; + }); + + // If path is stdout, cannot read it back, so check for "-" + assert(outputPath == "-" || g.verifyReadsWhatIsWritten(outputPath)); + + if (alsoEmitDotFile) + g.emitDotFile(outputPath, diags); + + return hadError; +} + +//============================================================================== +// MARK: RealSourceFileDepGraphConstructor +//============================================================================== + +RealSourceFileDepGraphConstructor::RealSourceFileDepGraphConstructor( + SourceFile *SF, StringRef outputPath, const DependencyTracker &depTracker, + const bool alsoEmitDotFile) + : SourceFileDepGraphConstructor(computeIncludePrivateDeps(SF), + SF->getASTContext().hadError(), outputPath, + getInterfaceHash(SF), alsoEmitDotFile, + SF->getASTContext().Diags), + SF(SF), depTracker(depTracker) {} + +bool RealSourceFileDepGraphConstructor::computeIncludePrivateDeps( + SourceFile *SF) { + // Since, when fingerprints are enabled, + // the parser diverts token hashing into per-body fingerprints + // before it can know if a difference is in a private type, + // in order to be able to test the changed fingerprints + // we force the inclusion of private declarations when fingerprints + // are enabled. + return SF->getASTContext() + .LangOpts.FineGrainedDependenciesIncludeIntrafileOnes || + SF->getASTContext().LangOpts.EnableTypeFingerprints; +} + +/// Centralize the invariant that the fingerprint of the whole file is the +/// interface hash +std::string RealSourceFileDepGraphConstructor::getFingerprint(SourceFile *SF) { + return getInterfaceHash(SF); +} + +//============================================================================== +// MARK: RealSourceFileDepGraphConstructor - adding collections of defined Decls +//============================================================================== //============================================================================== // MARK: SourceFileDeclFinder //============================================================================== @@ -300,653 +596,360 @@ struct SourceFileDeclFinder { }; } // namespace -//============================================================================== -// MARK: computeContextForProvidedEntity -//============================================================================== - -template -std::string DependencyKey::computeContextForProvidedEntity(Entity) { - // Context field is not used for most kinds - return ""; -} - -// \ref nominal dependencies are created from a Decl and use the context field. -template <> -std::string DependencyKey::computeContextForProvidedEntity< - NodeKind::nominal, NominalTypeDecl const *>(NominalTypeDecl const *D) { - return mangleTypeAsContext(D); -} - -/// \ref potentialMember dependencies are created from a Decl and use the -/// context field. -template <> -std::string -DependencyKey::computeContextForProvidedEntity( - const NominalTypeDecl *D) { - return mangleTypeAsContext(D); -} - -/// \ref member dependencies are created from a pair and use the context field. -template <> -std::string DependencyKey::computeContextForProvidedEntity< - NodeKind::member, std::pair>( - std::pair holderAndMember) { - return mangleTypeAsContext(holderAndMember.first); -} - -// Linux compiler requires the following: -template -std::string -DependencyKey::computeContextForProvidedEntity(StringRef); - -//============================================================================== -// MARK: computeNameForProvidedEntity -//============================================================================== +void RealSourceFileDepGraphConstructor::addAllDefinedDecls() { + // TODO: express the multiple provides and depends streams with variadic + // templates -template <> -std::string -DependencyKey::computeNameForProvidedEntity(StringRef swiftDeps) { - assert(!swiftDeps.empty()); - return swiftDeps.str(); -} + // Many kinds of Decls become top-level depends. -template <> -std::string -DependencyKey::computeNameForProvidedEntity( - const PrecedenceGroupDecl *D) { - return ::getName(D); -} -template <> -std::string DependencyKey::computeNameForProvidedEntity< - NodeKind::topLevel, FuncDecl const *>(const FuncDecl *D) { - return ::getName(D); -} -template <> -std::string DependencyKey::computeNameForProvidedEntity< - NodeKind::topLevel, OperatorDecl const *>(const OperatorDecl *D) { - return ::getName(D); -} -template <> -std::string DependencyKey::computeNameForProvidedEntity< - NodeKind::topLevel, NominalTypeDecl const *>(const NominalTypeDecl *D) { - return ::getName(D); -} -template <> -std::string DependencyKey::computeNameForProvidedEntity< - NodeKind::topLevel, ValueDecl const *>(const ValueDecl *D) { - return getBaseName(D); -} -template <> -std::string DependencyKey::computeNameForProvidedEntity< - NodeKind::dynamicLookup, ValueDecl const *>(const ValueDecl *D) { - return getBaseName(D); -} -template <> -std::string DependencyKey::computeNameForProvidedEntity< - NodeKind::nominal, NominalTypeDecl const *>(const NominalTypeDecl *D) { - return ""; -} -template <> -std::string -DependencyKey::computeNameForProvidedEntity( - const NominalTypeDecl *D) { - return ""; -} + SourceFileDeclFinder declFinder(SF, includePrivateDeps); -template <> -std::string DependencyKey::computeNameForProvidedEntity< - NodeKind::member, std::pair>( - std::pair holderAndMember) { - return getBaseName(holderAndMember.second); + addAllDefinedDeclsOfAGivenType( + declFinder.precedenceGroups); + addAllDefinedDeclsOfAGivenType( + declFinder.memberOperatorDecls); + addAllDefinedDeclsOfAGivenType(declFinder.operators); + addAllDefinedDeclsOfAGivenType(declFinder.topNominals); + addAllDefinedDeclsOfAGivenType(declFinder.topValues); + addAllDefinedDeclsOfAGivenType(declFinder.allNominals); + addAllDefinedDeclsOfAGivenType( + declFinder.potentialMemberHolders); + addAllDefinedDeclsOfAGivenType( + declFinder.valuesInExtensions); + addAllDefinedDeclsOfAGivenType( + declFinder.classMembers); +} + +/// Given an array of Decls or pairs of them in \p declsOrPairs +/// create node pairs for context and name +template +void RealSourceFileDepGraphConstructor::addAllDefinedDeclsOfAGivenType( + std::vector &contentsVec) { + for (const auto declOrPair : contentsVec) { + Optional fp = getFingerprintIfAny(declOrPair); + addADefinedDecl( + DependencyKey::createForProvidedEntityInterface(declOrPair), + fp ? StringRef(fp.getValue()) : Optional()); + } } //============================================================================== -// MARK: createDependedUponKey +// MARK: RealSourceFileDepGraphConstructor - adding collections of used Decls //============================================================================== -template <> -DependencyKey -DependencyKey::createDependedUponKey(StringRef name) { - return DependencyKey(NodeKind::topLevel, DeclAspect::interface, "", - name.str()); -} - -template <> -DependencyKey -DependencyKey::createDependedUponKey(StringRef name) { - return DependencyKey(NodeKind::dynamicLookup, DeclAspect::interface, "", - name.str()); -} - -template <> -DependencyKey -DependencyKey::createDependedUponKey(StringRef name) { - return DependencyKey(NodeKind::externalDepend, DeclAspect::interface, "", - name.str()); -} - -template <> -DependencyKey -DependencyKey::createDependedUponKey(StringRef mangledName) { - return DependencyKey(NodeKind::nominal, DeclAspect::interface, - mangledName.str(), ""); -} - -DependencyKey DependencyKey::createDependedUponKey(StringRef mangledHolderName, - StringRef memberBaseName) { - const bool isMemberBlank = memberBaseName.empty(); - const auto kind = - isMemberBlank ? NodeKind::potentialMember : NodeKind::member; - return DependencyKey(kind, DeclAspect::interface, mangledHolderName.str(), - isMemberBlank ? "" : memberBaseName.str()); -} +namespace { +/// Extracts uses out of a SourceFile +class UsedDeclEnumerator { + SourceFile *SF; + const DependencyTracker &depTracker; + StringRef swiftDeps; -//============================================================================== -// MARK: SourceFileDepGraphConstructor -//============================================================================== + /// Cache these for efficiency + const DependencyKey sourceFileInterface; + const DependencyKey sourceFileImplementation; -namespace { + const bool includeIntrafileDeps; -/// Reads the information provided by the frontend and builds the -/// SourceFileDepGraph -class SourceFileDepGraphConstructor { - /// Name of the swiftDeps file, for inclusion in the constructed graph. - StringRef swiftDeps; // TODO rm? - - /// To match the existing system, set this to false. - /// To include even private entities and get intra-file info, set to true. - const bool includePrivateDeps; - - /// If there was an error, cannot get accurate info. - const bool hadCompilationError; - - /// Functions as the fingerprint of the entire file - const std::string interfaceHash; - - /// Top-level base names of decls that are depended-upon and a flag indicating - /// if the dependency "cascades" - const std::vector> topLevelDepends; - - /// A mangled nominal name and the member base name that are depended-upon, - /// a flag indicating if the member is private to its enclosing file, and - /// a flag indicating if the dependency cascades. - const std::vector, bool>> - dependsWithContexts; - - /// The base name of a class member depended-upon for dynamic lookup, and a - /// cascades flag. - const std::vector> dynamicLookupDepends; - - /// The paths of swiftdeps files of other modules that are depended-upon. - const std::vector externalDependencies; - - /// Provided names - std::vector precedenceGroups; - std::vector memberOperatorDecls; - std::vector operators; - std::vector topNominals; - std::vector topValues; - std::vector allNominals; - std::vector potentialMemberHolders; - std::vector valuesInExtensions; - std::vector classMembers; - - /// Graph under construction - SourceFileDepGraph g; + function_ref createDefUse; public: - /// Expose this layer to enable faking up a constructor for testing. - /// See the instance variable comments for explanation. - // clang-format off - SourceFileDepGraphConstructor( - StringRef swiftDeps, - bool includePrivateDeps, - bool hadCompilationError, - const std::string &interfaceHash, - ArrayRef> topLevelDepends, - ArrayRef, bool>> - dependsWithContexts, - ArrayRef> dynamicLookupDepends, - ArrayRef externalDependencies, - - ArrayRef precedenceGroups, - ArrayRef memberOperatorDecls, - ArrayRef operators, - ArrayRef topNominals, - ArrayRef topValues, - ArrayRef allNominals, - ArrayRef potentialMemberHolders, - ArrayRef valuesInExtensions, - ArrayRef classMembers - ) : - swiftDeps(swiftDeps), - includePrivateDeps(includePrivateDeps), - hadCompilationError(hadCompilationError), - - interfaceHash(interfaceHash), - topLevelDepends(topLevelDepends), - dependsWithContexts(dependsWithContexts), - dynamicLookupDepends(dynamicLookupDepends), - externalDependencies(externalDependencies), - - precedenceGroups(precedenceGroups), - memberOperatorDecls(memberOperatorDecls), - operators(operators), - topNominals(topNominals), - topValues(topValues), - allNominals(allNominals), - potentialMemberHolders(potentialMemberHolders), - valuesInExtensions(valuesInExtensions), - classMembers(classMembers) - {} - -// clang-format off -static SourceFileDepGraphConstructor -forSourceFile( - SourceFile *SF, - const DependencyTracker &depTracker, - StringRef swiftDeps, - const bool includePrivateDeps, - const bool hadCompilationError) { -// clang-format on - - SourceFileDeclFinder declFinder(SF, includePrivateDeps); - std::vector> topLevelDepends; - for (const auto &p: SF->getReferencedNameTracker()->getTopLevelNames()) - topLevelDepends.push_back(std::make_pair(p.getFirst().userFacingName().str(), p.getSecond())); - - std::vector> dynamicLookupDepends; - for (const auto &p: SF->getReferencedNameTracker()->getDynamicLookupNames()) - dynamicLookupDepends.push_back(std::make_pair(p.getFirst().userFacingName().str(), p.getSecond())); - - std::vector, bool>> dependsWithContexts; - for (const auto &p: SF->getReferencedNameTracker()->getUsedMembers()) { - const auto &member = p.getFirst().second; - StringRef emptyOrUserFacingName = member.empty() ? "" : member.userFacingName(); - dependsWithContexts.push_back( - std::make_pair( - std::make_tuple( - mangleTypeAsContext(p.getFirst().first), - emptyOrUserFacingName.str(), - declIsPrivate(p.getFirst().first)), - p.getSecond())); - } + UsedDeclEnumerator( + SourceFile *SF, const DependencyTracker &depTracker, StringRef swiftDeps, + bool includeIntrafileDeps, + function_ref + createDefUse) + : SF(SF), depTracker(depTracker), swiftDeps(swiftDeps), + sourceFileInterface(DependencyKey::createKeyForWholeSourceFile( + DeclAspect::interface, swiftDeps)), + sourceFileImplementation(DependencyKey::createKeyForWholeSourceFile( + DeclAspect::implementation, swiftDeps)), + includeIntrafileDeps(includeIntrafileDeps), createDefUse(createDefUse) { + } - return SourceFileDepGraphConstructor( - swiftDeps, - includePrivateDeps, - hadCompilationError, - - getInterfaceHash(SF), - topLevelDepends, - dependsWithContexts, - dynamicLookupDepends, - depTracker.getDependencies(), - - namesForProvidersOfAGivenType(declFinder.precedenceGroups), - namesForProvidersOfAGivenType(declFinder.memberOperatorDecls), - namesForProvidersOfAGivenType(declFinder.operators), - namesForProvidersOfAGivenType(declFinder.topNominals), - namesForProvidersOfAGivenType(declFinder.topValues), - namesForProvidersOfAGivenType(declFinder.allNominals), - namesForProvidersOfAGivenType(declFinder.potentialMemberHolders), - namesForProvidersOfAGivenType(declFinder.valuesInExtensions), - namesForProvidersOfAGivenType(declFinder.classMembers) - ); - } - // clang-format on - - /// Construct the graph and return it. - SourceFileDepGraph construct() { - // Order matters here, each function adds state used by the next one. - addSourceFileNodesToGraph(); - if (!hadCompilationError) { - addProviderNodesToGraph(); - addDependencyArcsToGraph(); - } - assert(g.verify()); - return std::move(g); +public: + void enumerateAllUses() { + enumerateSimpleUses( + SF->getReferencedNameTracker()->getTopLevelNames()); + enumerateSimpleUses( + SF->getReferencedNameTracker()->getDynamicLookupNames()); + enumerateExternalUses(); + enumerateCompoundUses(); } private: - std::string getSourceFileFingerprint() const { return interfaceHash; } - - static std::string getInterfaceHash(SourceFile *SF) { - llvm::SmallString<32> interfaceHash; - SF->getInterfaceHash(interfaceHash); - return interfaceHash.str().str(); - } - - /// Also sets sourceFileNodes - void addSourceFileNodesToGraph(); - /// Uses sourceFileNodes - void addProviderNodesToGraph(); - /// Uses provides nodes for intra-graph dependences - void addDependencyArcsToGraph(); - - /// Given an array of Decls or pairs of them in \p declsOrPairs - /// create string pairs for context and name - template - static std::vector - namesForProvidersOfAGivenType(std::vector &contentsVec) { - std::vector result; - for (const auto declOrPair : contentsVec) - result.push_back( - std::make_tuple( - DependencyKey::computeContextForProvidedEntity(declOrPair), - DependencyKey::computeNameForProvidedEntity(declOrPair), - getFingerprintIfAny(declOrPair))); - return result; + void enumerateUse(NodeKind kind, StringRef context, StringRef name, + bool isCascadingUse) { + // Assume that what is depended-upon is the interface + createDefUse(DependencyKey(kind, DeclAspect::interface, context, name), + isCascadingUse ? sourceFileInterface + : sourceFileImplementation); } - - static Optional - getFingerprintIfAny(std::pair) { - return None; + template + void enumerateSimpleUses(llvm::DenseMap cascadesByName) { + for (const auto &p : cascadesByName) + enumerateUse(kind, "", p.getFirst().userFacingName(), p.getSecond()); } - static Optional getFingerprintIfAny(const Decl *d) { - if (const auto *idc = dyn_cast(d)) - return idc->getBodyFingerprint(); - return None; + + void enumerateCompoundUses() { + enumerateNominalUses(std::move(computeHoldersOfCascadingMembers())); + enumerateMemberUses(); } - template - void addAllProviderNodesOfAGivenType( - ArrayRef contextNameFingerprints) { - for (const auto &contextNameFingerprint : contextNameFingerprints) { - auto p = g.findExistingNodePairOrCreateAndAddIfNew( - kind, contextNameFingerprint); - // Since the current type fingerprints only include tokens in the body, - // when the interface hash changes, it is possible that the type in the - // file has changed. - g.addArc(g.getSourceFileNodePair().getInterface(), p.getInterface()); + std::unordered_set computeHoldersOfCascadingMembers() { + std::unordered_set holdersOfCascadingMembers; + for (const auto &p : SF->getReferencedNameTracker()->getUsedMembers()) { + { + bool isPrivate = declIsPrivate(p.getFirst().first); + if (isPrivate && !includeIntrafileDeps) + continue; + } + std::string context = + DependencyKey::computeContextForProvidedEntity( + p.getFirst().first); + bool isCascading = p.getSecond(); + if (isCascading) + holdersOfCascadingMembers.insert(context); } + return holdersOfCascadingMembers; } - /// Given a map of names and isCascades, add the resulting dependencies to the - /// graph. - template - void addAllDependenciesFrom(ArrayRef> names) { - for (const auto &p : names) - recordThatThisWholeFileDependsOn( - DependencyKey::createDependedUponKey(p.first), p.second); - } - - /// Given a map of holder-and-member-names and isCascades, add the resulting - /// dependencies to the graph. - void addAllDependenciesFrom( - ArrayRef, bool>>); - - /// Given an array of external swiftDeps files, add the resulting external - /// dependencies to the graph. - void addAllDependenciesFrom(ArrayRef externals) { - for (const auto &s : externals) - recordThatThisWholeFileDependsOn( - DependencyKey::createDependedUponKey(s), - true); - } - - /// In the status quo, we don't get to know which provided entities are - /// affected by a particular dependency; we only get to know that the whole - /// file must be recompiled if said def changes. However if \p cascades is - /// true, then every other file that depends upon something provided here must - /// be recompiled, too. - void recordThatThisWholeFileDependsOn(const DependencyKey &, bool cascades); -}; -} // namespace + void enumerateNominalUses( + const std::unordered_set &&holdersOfCascadingMembers) { + for (const auto &p : SF->getReferencedNameTracker()->getUsedMembers()) { + { + bool isPrivate = declIsPrivate(p.getFirst().first); + if (isPrivate && !includeIntrafileDeps) + continue; + } + const NominalTypeDecl *nominal = p.getFirst().first; -void SourceFileDepGraphConstructor::addAllDependenciesFrom( - ArrayRef, bool>> - members) { + std::string context = + DependencyKey::computeContextForProvidedEntity( + nominal); + const bool isCascadingUse = holdersOfCascadingMembers.count(context) != 0; + enumerateUse(NodeKind::nominal, context, "", isCascadingUse); + } + } - llvm::StringSet<> holdersOfCascadingMembers; - for (const auto &entry : members) { - if (!includePrivateDeps && std::get<2>(entry.first)) - continue; - if (entry.second) - holdersOfCascadingMembers.insert(std::get<0>(entry.first)); + void enumerateMemberUses() { + for (const auto &p : SF->getReferencedNameTracker()->getUsedMembers()) { + const NominalTypeDecl *nominal = p.getFirst().first; + const auto rawName = p.getFirst().second; + const bool isPotentialMember = rawName.empty(); + const bool isCascadingUse = p.getSecond(); + if (isPotentialMember) { + std::string context = DependencyKey::computeContextForProvidedEntity< + NodeKind::potentialMember>(nominal); + enumerateUse(NodeKind::potentialMember, context, "", isCascadingUse); + } else { + std::string context = + DependencyKey::computeContextForProvidedEntity( + nominal); + StringRef name = rawName.userFacingName(); + enumerateUse(NodeKind::member, context, name, isCascadingUse); + } + } } - for (const auto &entry : members) { - if (!includePrivateDeps && std::get<2>(entry.first)) - continue; - recordThatThisWholeFileDependsOn( - DependencyKey::createDependedUponKey( - std::get<0>(entry.first)), - holdersOfCascadingMembers.count(std::get<0>(entry.first)) != 0); - recordThatThisWholeFileDependsOn( - DependencyKey::createDependedUponKey(std::get<0>(entry.first), - std::get<1>(entry.first)), - entry.second); + + void enumerateExternalUses() { + // external dependencies always cascade + for (StringRef s : depTracker.getDependencies()) + enumerateUse(NodeKind::externalDepend, "", s, true); } +}; +} // end namespace + +void RealSourceFileDepGraphConstructor::addAllUsedDecls() { + UsedDeclEnumerator(SF, depTracker, swiftDeps, includePrivateDeps, + [&](const DependencyKey &def, const DependencyKey &use) { + addAUsedDecl(def, use); + }) + .enumerateAllUses(); } //============================================================================== -// MARK: SourceFileDepGraphConstructor: Adding nodes to the graph +// MARK: RealSourceFileDepGraphConstructor - adding individual defined Decls //============================================================================== -void SourceFileDepGraphConstructor::addSourceFileNodesToGraph() { - g.findExistingNodePairOrCreateAndAddIfNew( - NodeKind::sourceFileProvide, - ContextNameFingerprint(DependencyKey::computeContextForProvidedEntity< - NodeKind::sourceFileProvide>(swiftDeps), - DependencyKey::computeNameForProvidedEntity< - NodeKind::sourceFileProvide>(swiftDeps), - getSourceFileFingerprint())); +std::string +RealSourceFileDepGraphConstructor::getInterfaceHash(SourceFile *SF) { + llvm::SmallString<32> interfaceHash; + SF->getInterfaceHash(interfaceHash); + return interfaceHash.str().str(); +} + +/// At present, only nominals, protocols, and extensions have (body) +/// fingerprints +Optional RealSourceFileDepGraphConstructor::getFingerprintIfAny( + std::pair) { + return None; +} +Optional +RealSourceFileDepGraphConstructor::getFingerprintIfAny(const Decl *d) { + if (const auto *idc = dyn_cast(d)) { + auto result = idc->getBodyFingerprint(); + assert((!result || !result->empty()) && + "Fingerprint should never be empty"); + return result; + } + return None; } -void SourceFileDepGraphConstructor::addProviderNodesToGraph() { - // TODO: express the multiple provides and depends streams with variadic - // templates - - // Many kinds of Decls become top-level depends. - addAllProviderNodesOfAGivenType(precedenceGroups); - addAllProviderNodesOfAGivenType(memberOperatorDecls); - addAllProviderNodesOfAGivenType(operators); - addAllProviderNodesOfAGivenType(topNominals); - addAllProviderNodesOfAGivenType(topValues); - - addAllProviderNodesOfAGivenType(allNominals); - - addAllProviderNodesOfAGivenType( - potentialMemberHolders); - addAllProviderNodesOfAGivenType(valuesInExtensions); +//============================================================================== +// MARK: MockSourceFileDepGraphConstructor - adding collections of Decls +//============================================================================== - addAllProviderNodesOfAGivenType(classMembers); +void MockSourceFileDepGraphConstructor::forEachEntry( + function_ref fn) { + for (const auto &kindAndEntries : dependencyDescriptions) { + for (StringRef s : kindAndEntries.second) + fn(kindAndEntries.first, s); + } } -void SourceFileDepGraphConstructor::addDependencyArcsToGraph() { - // TODO: express the multiple provides and depends streams with variadic - // templates - addAllDependenciesFrom(topLevelDepends); - addAllDependenciesFrom(dependsWithContexts); - addAllDependenciesFrom(dynamicLookupDepends); - addAllDependenciesFrom(externalDependencies); +void MockSourceFileDepGraphConstructor::addAllDefinedDecls() { + forEachEntry([&](NodeKind kind, StringRef s) { + if (isADefinedDecl(s)) + addADefinedDecl(s, kind); + }); } -void SourceFileDepGraphConstructor::recordThatThisWholeFileDependsOn( - const DependencyKey &key, bool cascades) { - SourceFileDepGraphNode *def = - g.findExistingNodeOrCreateIfNew(key, None, false /* = !isProvides */); - g.addArc(def, g.getSourceFileNodePair().useDependingOnCascading(cascades)); -} +void MockSourceFileDepGraphConstructor::addAllUsedDecls() { + forEachEntry([&](NodeKind kind, StringRef s) { + if (!isADefinedDecl(s)) + addAUsedDecl(s, kind); + }); +}; //============================================================================== -// Entry point from the Frontend to this whole system +// MARK: MockSourceFileDepGraphConstructor - adding individual Decls //============================================================================== -bool fine_grained_dependencies::emitReferenceDependencies( - DiagnosticEngine &diags, SourceFile *const SF, - const DependencyTracker &depTracker, StringRef outputPath, - const bool alsoEmitDotFile) { - - // Before writing to the dependencies file path, preserve any previous file - // that may have been there. No error handling -- this is just a nicety, it - // doesn't matter if it fails. - llvm::sys::fs::rename(outputPath, outputPath + "~"); - // Since, when fingerprints are enabled, - // the parser diverts token hashing into per-body fingerprints - // before it can know if a difference is in a private type, - // in order to be able to test the changed fingerprints - // we force the inclusion of private declarations when fingerprints - // are enabled. - const bool includeIntrafileDeps = - SF->getASTContext() - .LangOpts.FineGrainedDependenciesIncludeIntrafileOnes || - SF->getASTContext().LangOpts.EnableTypeFingerprints; - const bool hadCompilationError = SF->getASTContext().hadError(); - auto gc = SourceFileDepGraphConstructor::forSourceFile( - SF, depTracker, outputPath, includeIntrafileDeps, hadCompilationError); - SourceFileDepGraph g = gc.construct(); +void MockSourceFileDepGraphConstructor::addADefinedDecl(StringRef s, + const NodeKind kind) { + const Optional key = + parseADefinedDecl(s, kind, DeclAspect::interface); + if (!key) + return; + StringRef fingerprintString = s.split(fingerprintSeparator).second; + const Optional fingerprint = fingerprintString.empty() + ? Optional() + : StringRef(fingerprintString); + + SourceFileDepGraphConstructor::addADefinedDecl(key.getValue(), fingerprint); + } - const bool hadError = - withOutputFile(diags, outputPath, [&](llvm::raw_pwrite_stream &out) { - out << g.yamlProlog(hadCompilationError); - llvm::yaml::Output yamlWriter(out); - yamlWriter << g; - return false; - }); + void MockSourceFileDepGraphConstructor::addAUsedDecl(const StringRef s, + const NodeKind kind) { + const auto defAndUseKeys = parseAUsedDecl(s, kind); + if (defAndUseKeys) { + SourceFileDepGraphConstructor::addAUsedDecl(defAndUseKeys->first, + defAndUseKeys->second); + } + } - // If path is stdout, cannot read it back, so check for "-" - assert(outputPath == "-" || g.verifyReadsWhatIsWritten(outputPath)); + DependencyKey + MockSourceFileDepGraphConstructor::computeUseKey(StringRef s, + const bool isCascadingUse) { + // For now, in unit tests, mock uses are always nominal + static const NodeKind kindOfUse = NodeKind::nominal; + const DeclAspect aspectOfUse = + isCascadingUse ? DeclAspect::interface : DeclAspect::implementation; + + if (!s.empty()) + return parseADefinedDecl(s, kindOfUse, aspectOfUse).getValue(); + StringRef swiftDepsRef(swiftDeps); + return DependencyKey(NodeKind::sourceFileProvide, aspectOfUse, + DependencyKey::computeContextForProvidedEntity< + NodeKind::sourceFileProvide>(swiftDepsRef), + DependencyKey::computeNameForProvidedEntity< + NodeKind::sourceFileProvide>(swiftDepsRef)); + } - if (alsoEmitDotFile) - g.emitDotFile(outputPath, diags); + //============================================================================== + // MARK: SourceFileDepGraphConstructor - parsing + //============================================================================== - return hadError; -} + const char *MockSourceFileDepGraphConstructor::defUseSeparator = "->"; -//============================================================================== -// Entry point from the unit tests -//============================================================================== -static StringRef stripPrefix(const StringRef name) { - return name.ltrim(SourceFileDepGraph::noncascadingOrPrivatePrefix); -} -static StringRef stripFingerprint(const StringRef nameAndFingerprint) { - return nameAndFingerprint.split(SourceFileDepGraph::nameFingerprintSeparator) - .first; -} -static StringRef stripName(const StringRef nameAndFingerprint) { - return nameAndFingerprint.split(SourceFileDepGraph::nameFingerprintSeparator) - .second; -} -static std::string extractName(const StringRef prefixNameFingerprint) { - return stripFingerprint(stripPrefix(prefixNameFingerprint)).str(); -} -static Optional extractFingerprint( - const StringRef prefixNameFingerprint) { - const auto fp = stripName(stripPrefix(prefixNameFingerprint)); - return fp.empty() ? None : Optional(fp.str()); -} - -static std::vector -getBaseNameProvides(ArrayRef simpleNames) { - std::vector result; - for (StringRef n : simpleNames) - result.push_back(ContextNameFingerprint("", extractName(n), - extractFingerprint(n))); - return result; -} + bool MockSourceFileDepGraphConstructor::isADefinedDecl(StringRef s) { + return s.find(defUseSeparator) == StringRef::npos; + } -static std::vector -getMangledHolderProvides(ArrayRef simpleNames) { - std::vector result; - for (StringRef n : simpleNames) - result.push_back(ContextNameFingerprint(extractName(n), "", - extractFingerprint(n))); - return result; -} + Optional MockSourceFileDepGraphConstructor::parseADefinedDecl( + StringRef s, const NodeKind kind, const DeclAspect aspect) { + static const char *privatePrefix = "#"; -static std::vector getCompoundProvides( - ArrayRef> compoundNames) { - std::vector result; - for (const auto &p : compoundNames) - result.push_back(ContextNameFingerprint(extractName(p.first), - extractName(p.second), - extractFingerprint(p.second))); - return result; -} + const bool isPrivate = s.consume_front(privatePrefix); + if (isPrivate && !includePrivateDeps) + return None; + const std::string context = + parseContext(s.split(fingerprintSeparator).first, kind); + std::string name = parseName(s.split(fingerprintSeparator).first, kind); -static bool cascades(const std::string &s) { - return s.empty() || s[0] != SourceFileDepGraph::noncascadingOrPrivatePrefix; -} - -// Use '_' as a prefix for a file-private member -static bool isPrivate(const std::string &s) { - return !s.empty() && s[0] == SourceFileDepGraph::noncascadingOrPrivatePrefix; -} + return DependencyKey(kind, aspect, context, name); + } -static std::vector> -getSimpleDepends(ArrayRef simpleNames) { - std::vector> result; - for (std::string n : simpleNames) - result.push_back({stripPrefix(n).str(), cascades((n))}); - return result; -} + Optional> + MockSourceFileDepGraphConstructor::parseAUsedDecl(const StringRef argString, + const NodeKind kind) { + static const char *noncascadingPrefix = "#"; + static const char *privateHolderPrefix = "~"; + + StringRef s = argString; + const bool isCascadingUse = !s.consume_front(noncascadingPrefix); + // Someday, we might differentiate. + const DeclAspect aspectOfDefUsed = DeclAspect::interface; + + const bool isHolderPrivate = s.consume_front(privateHolderPrefix); + if (!includePrivateDeps && isHolderPrivate) + return None; + const auto defUseStrings = s.split(defUseSeparator); + const auto context = parseContext(defUseStrings.first, kind); + const auto name = parseName(defUseStrings.first, kind); + + const DependencyKey defKey = + DependencyKey(kind, aspectOfDefUsed, context, name); + + return std::make_pair(defKey, + computeUseKey(defUseStrings.second, isCascadingUse)); + } -static std::vector -getExternalDepends(ArrayRef simpleNames) { - return simpleNames; -} -static std::vector, bool>> -getCompoundDepends( - ArrayRef simpleNames, - ArrayRef> compoundNames) { - std::vector, bool>> - result; - for (std::string n : simpleNames) { - // (On Linux, the compiler needs more verbosity than: - // result.push_back({{n, "", false}, cascades(n)}); - result.push_back(std::make_pair( - std::make_tuple(stripPrefix(n).str(), std::string(), false), - cascades(n))); - } - for (auto &p : compoundNames) { - // Likewise, for Linux expand the following out: - // result.push_back( - // {{p.first, p.second, isPrivate(p.second)}, cascades(p.first)}); - result.push_back(std::make_pair(std::make_tuple(stripPrefix(p.first).str(), - stripPrefix(p.second).str(), - isPrivate(p.second)), - cascades(p.first))); + Optional + MockSourceFileDepGraphConstructor::singleNameIsContext(const NodeKind kind) { + switch (kind) { + case NodeKind::nominal: + case NodeKind::potentialMember: + return true; + case NodeKind::topLevel: + case NodeKind::dynamicLookup: + case NodeKind::externalDepend: + case NodeKind::sourceFileProvide: + return false; + case NodeKind::member: + return None; + case NodeKind::kindCount: + llvm_unreachable("impossible case"); + } } - return result; -} - -SourceFileDepGraph SourceFileDepGraph::simulateLoad( - std::string swiftDepsFilename, const bool includePrivateDeps, - const bool hadCompilationError, std::string interfaceHash, - llvm::StringMap> simpleNamesByRDK, - llvm::StringMap>> - compoundNamesByRDK) { - using namespace reference_dependency_keys; + std::string + MockSourceFileDepGraphConstructor::parseContext(const StringRef s, + const NodeKind kind) { + return !singleNameIsContext(kind) + ? s.split(nameContextSeparator).first.str() + : singleNameIsContext(kind).getValue() ? s.str() : ""; + } - // clang-format off - SourceFileDepGraphConstructor c( - swiftDepsFilename, - includePrivateDeps, - hadCompilationError, - interfaceHash, - getSimpleDepends(simpleNamesByRDK[dependsTopLevel]), - getCompoundDepends(simpleNamesByRDK[dependsNominal], - compoundNamesByRDK[dependsMember]), - getSimpleDepends(simpleNamesByRDK[dependsDynamicLookup]), - getExternalDepends(simpleNamesByRDK[dependsExternal]), - {}, // precedence groups - {}, // memberOperatorDecls - {}, // operators - {}, // topNominals - getBaseNameProvides(simpleNamesByRDK[providesTopLevel]), // topValues - getMangledHolderProvides(simpleNamesByRDK[providesNominal]), // allNominals - getMangledHolderProvides(simpleNamesByRDK[providesNominal]), // potentialMemberHolders - getCompoundProvides(compoundNamesByRDK[providesMember]), // valuesInExtensions - getBaseNameProvides(simpleNamesByRDK[providesDynamicLookup]) // classMembers - ); - // clang-format on - return c.construct(); -} + std::string + MockSourceFileDepGraphConstructor::parseName(const StringRef s, + const NodeKind kind) { + const std::string name = + !singleNameIsContext(kind) + ? s.split(nameContextSeparator).second.str() + : singleNameIsContext(kind).getValue() ? "" : s.str(); + assert(kind != NodeKind::member || + !name.empty() && "Should be a potentialMember"); + return name; + } diff --git a/lib/Driver/FineGrainedDependencyDriverGraph.cpp b/lib/Driver/FineGrainedDependencyDriverGraph.cpp index 97902d396c356..f44e3c7d3aa58 100644 --- a/lib/Driver/FineGrainedDependencyDriverGraph.cpp +++ b/lib/Driver/FineGrainedDependencyDriverGraph.cpp @@ -43,44 +43,6 @@ using namespace swift::driver; //============================================================================== // MARK: Affordances to unit tests //============================================================================== -/// Initial underscore makes non-cascading, on member means private. - ModuleDepGraph::Changes -ModuleDepGraph::simulateLoad(const Job *cmd, - llvm::StringMap> simpleNames, - llvm::StringMap>> - compoundNames, - const bool includePrivateDeps, - const bool hadCompilationError) { - StringRef swiftDeps = - cmd->getOutput().getAdditionalOutputForType(file_types::TY_SwiftDeps); - assert(!swiftDeps.empty()); - StringRef interfaceHash = swiftDeps; - auto sfdg = SourceFileDepGraph::simulateLoad( - swiftDeps.str(), includePrivateDeps, hadCompilationError, - interfaceHash.str(), simpleNames, compoundNames); - - SourceManager sm; - DiagnosticEngine diags(sm); - // help for debugging: emit imported file, too - if (emitFineGrainedDependencyDotFileAfterEveryImport) { - sfdg.emitDotFile(swiftDeps, diags); - } - - return loadFromSourceFileDepGraph(cmd, sfdg, diags); -} - -std::string SourceFileDepGraph::noncascading(std::string name) { - std::string s{SourceFileDepGraph::noncascadingOrPrivatePrefix}; - s += name; - return s; -} - -LLVM_ATTRIBUTE_UNUSED -std::string SourceFileDepGraph::privatize(std::string name) { - std::string s{SourceFileDepGraph::noncascadingOrPrivatePrefix}; - s += name; - return s; -} LLVM_ATTRIBUTE_UNUSED std::vector @@ -115,12 +77,8 @@ ModuleDepGraph::Changes ModuleDepGraph::loadFromPath(const Job *Cmd, return None; auto r = loadFromBuffer(Cmd, *buffer.get(), diags); assert(path == getSwiftDeps(Cmd) && "Should be reading the job's swiftdeps"); - assert(!r || - !nodeMap[path.str()].empty() && "Must have a node for the whole file"); - if (emitFineGrainedDependencyDotFileAfterEveryImport) - emitDotFileForJob(diags, Cmd); - if (verifyFineGrainedDependencyGraphAfterEveryImport) - verify(); + assert(!r || !nodeMap[path].empty() && + "Must have a node for the whole file"); return r; } @@ -149,10 +107,11 @@ ModuleDepGraph::Changes ModuleDepGraph::loadFromSourceFileDepGraph( } bool ModuleDepGraph::haveAnyNodesBeenTraversedIn(const Job *cmd) const { - std::string swiftDeps = getSwiftDeps(cmd).str(); + const StringRef swiftDeps = getSwiftDeps(cmd); // optimization - const auto fileKey = DependencyKey::createKeyForWholeSourceFile(swiftDeps); + const auto fileKey = DependencyKey::createKeyForWholeSourceFile( + DeclAspect::interface, swiftDeps); if (const auto fileNode = nodeMap.find(swiftDeps, fileKey)) { if (fileNode && fileNode.getValue()->getHasBeenTraced()) return true; @@ -222,6 +181,13 @@ void ModuleDepGraph::registerJob(const Job *job) { jobsBySwiftDeps.insert(std::make_pair(getSwiftDeps(job), job)); } +std::vector ModuleDepGraph::getAllJobs() const { + std::vector jobs; + for (auto const &entry : jobsBySwiftDeps) + jobs.push_back(entry.second); + return jobs; +} + std::vector ModuleDepGraph::getExternalDependencies() const { return std::vector(externalDependencies.begin(), externalDependencies.end()); @@ -268,7 +234,7 @@ ModuleDepGraph::Changes ModuleDepGraph::integrate(const SourceFileDepGraph &g, FrontendStatsTracer tracer(stats, "fine-grained-dependencies-integrate"); // When done, disappearedNodes contains the nodes which no longer exist. - auto disappearedNodes = nodeMap[swiftDepsOfJob.str()]; + auto disappearedNodes = nodeMap[swiftDepsOfJob]; // When done, changeDependencyKeys contains a list of keys that changed // as a result of this integration. // Or if the integration failed, None. @@ -324,7 +290,7 @@ ModuleDepGraph::PreexistingNodeIfAny ModuleDepGraph::findPreexistingMatch( } if (integrand->getIsProvides()) { const auto &preexistingNodeInPlaceIter = - matches->find(swiftDepsOfCompilationToBeIntegrated.str()); + matches->find(swiftDepsOfCompilationToBeIntegrated); if (preexistingNodeInPlaceIter != matches->end()) return std::make_pair(LocationOfPreexistingNode::here, preexistingNodeInPlaceIter->second); @@ -420,7 +386,7 @@ bool ModuleDepGraph::recordWhatUseDependsUpon( usesByDef[def->getKey()].insert(moduleUseNode).second; if (isNewUse && def->getKey().getKind() == NodeKind::externalDepend) { StringRef externalSwiftDeps = def->getKey().getName(); - externalDependencies.insert(externalSwiftDeps.str()); + externalDependencies.insert(externalSwiftDeps); useHasNewExternalDependency = true; } }); @@ -464,7 +430,7 @@ void ModuleDepGraph::forCorrespondingImplementationOfProvidedInterface( const auto &interfaceKey = interfaceNode->getKey(); const DependencyKey implementationKey( interfaceKey.getKind(), DeclAspect::implementation, - interfaceKey.getContext().str(), interfaceKey.getName().str()); + interfaceKey.getContext(), interfaceKey.getName()); if (const auto implementationNode = nodeMap.find(swiftDeps, implementationKey)) fn(implementationNode.getValue()); @@ -495,7 +461,7 @@ void ModuleDepGraph::forEachArc( void ModuleDepGraph::forEachNodeInJob( StringRef swiftDeps, function_ref fn) const { - if (const auto *nodesByKeys = nodeMap.find(swiftDeps.str()).getPtrOrNull()) { + if (const auto *nodesByKeys = nodeMap.find(swiftDeps).getPtrOrNull()) { for (const auto &keyAndNode : *nodesByKeys) fn(keyAndNode.second); } @@ -564,7 +530,7 @@ void ModuleDepGraph::emitDotFileForJob(DiagnosticEngine &diags, } void ModuleDepGraph::emitDotFile(DiagnosticEngine &diags, StringRef baseName) { - unsigned seqNo = dotFileSequenceNumber[baseName.str()]++; + unsigned seqNo = dotFileSequenceNumber[baseName]++; std::string fullName = baseName.str() + "-post-integration." + std::to_string(seqNo) + ".dot"; withOutputFile(diags, fullName, [&](llvm::raw_ostream &out) { @@ -670,7 +636,7 @@ void ModuleDepGraph::verifyNodeIsInRightEntryInNodeMap( void ModuleDepGraph::verifyExternalDependencyUniqueness( const DependencyKey &key) const { assert((key.getKind() != NodeKind::externalDepend || - externalDependencies.count(key.getName().str()) == 1) && + externalDependencies.count(key.getName()) == 1) && "Ensure each external dependency is tracked exactly once"); } diff --git a/lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp b/lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp index 194c0b8181e5a..4a4742e6c49cd 100644 --- a/lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp +++ b/lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp @@ -417,6 +417,36 @@ struct AllocStackAnalyzer : SILInstructionVisitor { } // end anonymous namespace +/// Returns true if there is a retain instruction between \p from and the +/// destroy or deallocation of \p alloc. +static bool somethingIsRetained(SILInstruction *from, AllocStackInst *alloc) { + llvm::SmallVector workList; + llvm::SmallPtrSet handled; + workList.push_back(from); + while (!workList.empty()) { + SILInstruction *start = workList.pop_back_val(); + for (auto iter = start->getIterator(), end = start->getParent()->end(); + iter != end; + ++iter) { + SILInstruction *inst = &*iter; + if (isa(inst) || isa(inst)) { + return true; + } + if ((isa(inst) || isa(inst)) && + inst->getOperand(0) == alloc) { + break; + } + if (isa(inst)) { + for (SILBasicBlock *succ : start->getParent()->getSuccessors()) { + if (handled.insert(succ).second) + workList.push_back(&*succ->begin()); + } + } + } + } + return false; +} + SILInstruction *SILCombiner::visitAllocStackInst(AllocStackInst *AS) { // If we are testing SILCombine and we are asked not to eliminate // alloc_stacks, just return. @@ -477,6 +507,7 @@ SILInstruction *SILCombiner::visitAllocStackInst(AllocStackInst *AS) { // // TODO: Do we not remove purely dead live ranges here? Seems like we should. SmallPtrSet ToDelete; + SmallVector takingCopies; for (auto *Op : AS->getUses()) { // Replace a copy_addr [take] %src ... by a destroy_addr %src if %src is @@ -484,8 +515,7 @@ SILInstruction *SILCombiner::visitAllocStackInst(AllocStackInst *AS) { // Otherwise, just delete the copy_addr. if (auto *CopyAddr = dyn_cast(Op->getUser())) { if (CopyAddr->isTakeOfSrc() && CopyAddr->getSrc() != AS) { - Builder.setInsertionPoint(CopyAddr); - Builder.createDestroyAddr(CopyAddr->getLoc(), CopyAddr->getSrc()); + takingCopies.push_back(CopyAddr); } } @@ -506,6 +536,20 @@ SILInstruction *SILCombiner::visitAllocStackInst(AllocStackInst *AS) { ToDelete.insert(Op->getUser()); } + // Check if a retain is moved after the copy_addr. If the retained object + // happens to be the source of the copy_addr it might be only kept alive by + // the stack location. This cannot happen with OSSA. + // TODO: remove this check once we have OSSA. + for (CopyAddrInst *copy : takingCopies) { + if (somethingIsRetained(copy, AS)) + return nullptr; + } + + for (CopyAddrInst *copy : takingCopies) { + SILBuilderWithScope destroyBuilder(copy, Builder.getBuilderContext()); + destroyBuilder.createDestroyAddr(copy->getLoc(), copy->getSrc()); + } + // Erase the 'live-range' for (auto *Inst : ToDelete) { Inst->replaceAllUsesOfAllResultsWithUndef(); diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index dcba5942accd3..5146536179cb9 100644 --- a/lib/Sema/ConstraintSystem.cpp +++ b/lib/Sema/ConstraintSystem.cpp @@ -3743,19 +3743,10 @@ ConstraintSystem::getFunctionArgApplyInfo(ConstraintLocator *locator) { } else { // If we didn't resolve an overload for the callee, we should be dealing // with a call of an arbitrary function expr. - if (auto *call = dyn_cast(anchor)) { - assert(!shouldHaveDirectCalleeOverload(call) && + auto *call = cast(anchor); + assert(!shouldHaveDirectCalleeOverload(call) && "Should we have resolved a callee for this?"); - rawFnType = getType(call->getFn()); - } else if (auto *apply = dyn_cast(anchor)) { - // FIXME: ArgumentMismatchFailure is currently used from CSDiag, meaning - // we can end up a BinaryExpr here with an unresolved callee. It should be - // possible to remove this once we've gotten rid of the old CSDiag logic - // and just assert that we have a CallExpr. - rawFnType = getType(apply->getFn()); - } else { - return None; - } + rawFnType = getType(call->getFn()); } // Try to resolve the function type by loading lvalues and looking through diff --git a/stdlib/public/core/DictionaryStorage.swift b/stdlib/public/core/DictionaryStorage.swift index ac931fd2ed51c..bd5c9d583036d 100644 --- a/stdlib/public/core/DictionaryStorage.swift +++ b/stdlib/public/core/DictionaryStorage.swift @@ -117,6 +117,7 @@ internal class __RawDictionaryStorage: __SwiftNativeNSDictionary { // renamed. The old name must not be used in the new runtime. @_fixed_layout @usableFromInline +@_objc_non_lazy_realization internal class __EmptyDictionarySingleton: __RawDictionaryStorage { @nonobjc internal override init(_doNotCallMe: ()) { diff --git a/stdlib/public/core/SetStorage.swift b/stdlib/public/core/SetStorage.swift index 44936c806e1c2..f5c889ce93c1b 100644 --- a/stdlib/public/core/SetStorage.swift +++ b/stdlib/public/core/SetStorage.swift @@ -112,6 +112,7 @@ internal class __RawSetStorage: __SwiftNativeNSSet { // The old names must not be used in the new runtime. @_fixed_layout @usableFromInline +@_objc_non_lazy_realization internal class __EmptySetSingleton: __RawSetStorage { @nonobjc override internal init(_doNotCallMe: ()) { diff --git a/test/SILOptimizer/sil_combine.sil b/test/SILOptimizer/sil_combine.sil index 7ff913b806830..627b0da622557 100644 --- a/test/SILOptimizer/sil_combine.sil +++ b/test/SILOptimizer/sil_combine.sil @@ -2640,6 +2640,107 @@ bb0(%0 : $*B): return %4 : $() } +// CHECK-LABEL: sil @moved_retain_prevents_alloc_stack_deletion1 +// CHECK: copy_addr +// CHECK: strong_retain +// CHECK: destroy_addr +// CHECK: } // end sil function 'moved_retain_prevents_alloc_stack_deletion1' +sil @moved_retain_prevents_alloc_stack_deletion1 : $@convention(thin) (@guaranteed B) -> () { +bb0(%0 : $B): + %3 = alloc_stack $B + %4 = alloc_stack $B + store %0 to %4 : $*B + copy_addr [take] %4 to [initialization] %3 : $*B + dealloc_stack %4 : $*B + strong_retain %0 : $B + destroy_addr %3 : $*B + dealloc_stack %3 : $*B + %14 = tuple () + return %14 : $() +} + +// CHECK-LABEL: sil @moved_retain_prevents_alloc_stack_deletion2 +// CHECK: copy_addr +// CHECK: bb1: +// CHECK: strong_retain +// CHECK: destroy_addr +// CHECK: bb2: +// CHECK: strong_retain +// CHECK: destroy_addr +// CHECK: } // end sil function 'moved_retain_prevents_alloc_stack_deletion2' +sil @moved_retain_prevents_alloc_stack_deletion2 : $@convention(thin) (@guaranteed B) -> () { +bb0(%0 : $B): + %3 = alloc_stack $B + %4 = alloc_stack $B + store %0 to %4 : $*B + copy_addr [take] %4 to [initialization] %3 : $*B + dealloc_stack %4 : $*B + cond_br undef, bb1, bb2 +bb1: + strong_retain %0 : $B + destroy_addr %3 : $*B + dealloc_stack %3 : $*B + br bb3 +bb2: + strong_retain %0 : $B + destroy_addr %3 : $*B + dealloc_stack %3 : $*B + br bb3 +bb3: + %14 = tuple () + return %14 : $() +} + +// CHECK-LABEL: sil @retain_is_after_stack_location +// CHECK-NOT: copy_addr +// CHECK: } // end sil function 'retain_is_after_stack_location' +sil @retain_is_after_stack_location : $@convention(thin) (@guaranteed B) -> () { +bb0(%0 : $B): + %3 = alloc_stack $B + %4 = alloc_stack $B + store %0 to %4 : $*B + copy_addr [take] %4 to [initialization] %3 : $*B + dealloc_stack %4 : $*B + cond_br undef, bb1, bb2 +bb1: + destroy_addr %3 : $*B + strong_retain %0 : $B + dealloc_stack %3 : $*B + br bb3 +bb2: + destroy_addr %3 : $*B + strong_retain %0 : $B + dealloc_stack %3 : $*B + br bb3 +bb3: + %14 = tuple () + return %14 : $() +} + +// CHECK-LABEL: sil @moved_retain_prevents_alloc_stack_deletion3 +// CHECK: copy_addr +// CHECK: bb2: +// CHECK: strong_retain +// CHECK: destroy_addr +// CHECK: } // end sil function 'moved_retain_prevents_alloc_stack_deletion3' +sil @moved_retain_prevents_alloc_stack_deletion3 : $@convention(thin) (@guaranteed B) -> () { +bb0(%0 : $B): + %3 = alloc_stack $B + %4 = alloc_stack $B + store %0 to %4 : $*B + copy_addr [take] %4 to [initialization] %3 : $*B + dealloc_stack %4 : $*B + br bb1 +bb1: + cond_br undef, bb1, bb2 +bb2: + strong_retain %0 : $B + destroy_addr %3 : $*B + dealloc_stack %3 : $*B + %14 = tuple () + return %14 : $() +} + protocol someProtocol { var i: Int { get } } diff --git a/test/SILOptimizer/sil_combine_alloc_stack.swift b/test/SILOptimizer/sil_combine_alloc_stack.swift new file mode 100644 index 0000000000000..134a1e7f51916 --- /dev/null +++ b/test/SILOptimizer/sil_combine_alloc_stack.swift @@ -0,0 +1,43 @@ +// RUN: %empty-directory(%t) +// RUN: %target-build-swift -O %s -o %t/a.out +// RUN: %target-run %t/a.out | %FileCheck %s + +protocol E { + func f() -> Bool +} + +final class K { + deinit { + print("deinit") + } +} + + +struct X : E { + var x: K + func f() -> Bool { return true } +} + +func g(_ x : T) -> Bool { + if let y = x as? E { return y.f() } + return false +} + +// CHECK that there is no use-after-free in this function. +@inline(never) +func foo(_ x: X) -> Bool { + return g(x) +} + +@inline(never) +func testit() { + let x = X(x: K()) + _ = foo(x) + print(x) +} + +// CHECK: X(x: a.K) +// CHECK: deinit +testit() + + diff --git a/test/stdlib/EmptyCollectionSingletonRealization.swift b/test/stdlib/EmptyCollectionSingletonRealization.swift new file mode 100644 index 0000000000000..2993262622a6c --- /dev/null +++ b/test/stdlib/EmptyCollectionSingletonRealization.swift @@ -0,0 +1,48 @@ +// 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 +// +//===----------------------------------------------------------------------===// +// +// RUN: %target-run-simple-swift | %FileCheck %s +// REQUIRES: executable_test +// REQUIRES: objc_interop + +import Foundation + +// Test to make sure that empty collections don't cause a crash if we smuggle +// them into the ObjC runtime without doing anything that would trigger +// realization. The ObjC runtime expects all classes to have been realized +// (i.e. runtime data structures initialized, triggered the first time a class +// is accessed or used) before being queried in any way. +// +// Note: this test deliberately avoids StdlibUnittest to make sure +// no other code runs that might inadvertently trigger realization behind our +// back. + +@objc protocol P {} + +do { + let d: [NSObject: NSObject] = [:] + let c: AnyClass? = object_getClass(d) + let conforms = class_conformsToProtocol(c, P.self) + print("Dictionary: ", conforms) // CHECK: Dictionary: false +} + +do { + let a: [NSObject] = [] + let c: AnyClass? = object_getClass(a) + let p = objc_getProtocol("NSObject") + let conforms = class_conformsToProtocol(c, p) + print("Array:", conforms) // CHECK: Array: false +} + +do { + let s: Set = [] + let c: AnyClass? = object_getClass(s) + let p = objc_getProtocol("NSObject") + let conforms = class_conformsToProtocol(c, p) + print("Set:", conforms) // CHECK: Set: false +} \ No newline at end of file diff --git a/unittests/Driver/CMakeLists.txt b/unittests/Driver/CMakeLists.txt index 586053c4d71b7..18ccbdcd14b6e 100644 --- a/unittests/Driver/CMakeLists.txt +++ b/unittests/Driver/CMakeLists.txt @@ -1,6 +1,7 @@ add_swift_unittest(SwiftDriverTests CoarseGrainedDependencyGraphTests.cpp FineGrainedDependencyGraphTests.cpp + MockingFineGrainedDependencyGraphs.cpp TypeBodyFingerprintsDependencyGraphTests.cpp ) diff --git a/unittests/Driver/FineGrainedDependencyGraphTests.cpp b/unittests/Driver/FineGrainedDependencyGraphTests.cpp index 28e8286866d9e..40b98ca1adff4 100644 --- a/unittests/Driver/FineGrainedDependencyGraphTests.cpp +++ b/unittests/Driver/FineGrainedDependencyGraphTests.cpp @@ -1,23 +1,21 @@ +#include "MockingFineGrainedDependencyGraphs.h" #include "swift/Basic/ReferenceDependencyKeys.h" #include "swift/Driver/CoarseGrainedDependencyGraph.h" #include "swift/Driver/FineGrainedDependencyDriverGraph.h" #include "swift/Driver/Job.h" #include "gtest/gtest.h" -// This file adapts the unit tests from the older, coarse-grained, dependency -// graph to the new fine-grained graph. - -// \c findJobsToRecompileWhenWholeJobChanges and \c -// findExternallyDependentUntracedJobs may include jobs in their result that -// would be excluded in the coarse-grained graph. But since these will be jobs -// that have already been scheduled, downstream mechanisms will filter them out. +// A version of \c ModuleDepGraphTests.cpp that tests things with +// type-body fingerprints disabled. +// +// In order to get the test macros to work right, it seems that the tests +// must be copied-and-pasted, sigh. using namespace swift; -using namespace reference_dependency_keys; using namespace fine_grained_dependencies; +using namespace mocking_fine_grained_dependency_graphs; using Job = driver::Job; - static OutputFileMap OFM; static Job @@ -41,39 +39,31 @@ static bool contains(const Range &range, const T &value) { std::end(range); } -TEST(ModuleDepGraph, BasicLoad) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); - - EXPECT_TRUE(graph.simulateLoad( &job0, {{dependsTopLevel, {"a", "b"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"c", "d"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{providesTopLevel, {"e", "f"}}})); - EXPECT_TRUE(graph.simulateLoad( &job3, {{providesNominal, {"g", "h"}}})); - EXPECT_TRUE( - graph.simulateLoad( &job4, {{providesDynamicLookup, {"i", "j"}}})); - EXPECT_TRUE(graph.simulateLoad( &job5, {{dependsDynamicLookup, {"k", "l"}}})); - EXPECT_TRUE(graph.simulateLoad( &job6, {}, - {{providesMember, {{"m", "mm"}, {"n", "nn"}}}})); - EXPECT_TRUE(graph.simulateLoad( &job7, {}, - {{dependsMember, {{"o", "oo"}, {"p", "pp"}}}})); - EXPECT_TRUE( - graph.simulateLoad( &job8, {{dependsExternal, {"/foo", "/bar"}}})); - - EXPECT_TRUE(graph.simulateLoad( &job9, - {{providesNominal, {"a", "b"}}, - {providesTopLevel, {"b", "c"}}, - {dependsNominal, {"c", "d"}}, - {dependsTopLevel, {"d", "a"}}})); -} - -TEST(ModuleDepGraph, IndependentNodes) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); - - EXPECT_TRUE(graph.simulateLoad( - &job0, {{dependsTopLevel, {"a"}}, {providesTopLevel, {"a0"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsTopLevel, {"b"}}, {providesTopLevel, {"b0"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job2, {{dependsTopLevel, {"c"}}, {providesTopLevel, {"c0"}}})); +TEST(ModuleDepGraphWithoutFingerprints, BasicLoad) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); + + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a->", "b->"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"c->", "d->"}}}); + simulateLoad(graph, &job2, {{NodeKind::topLevel, {"e", "f"}}}); + simulateLoad(graph, &job3, {{NodeKind::nominal, {"g", "h"}}}); + simulateLoad(graph, &job4, {{NodeKind::dynamicLookup, {"i", "j"}}}); + simulateLoad(graph, &job5, {{NodeKind::dynamicLookup, {"k->", "l->"}}}); + simulateLoad(graph, &job6, {{NodeKind::member, {"m,mm", "n,nn"}}}); + simulateLoad(graph, &job7, {{NodeKind::member, {"o,oo->", "p,pp->"}}}); + simulateLoad(graph, &job8, + {{NodeKind::externalDepend, {"/foo->", "/bar->"}}}); + + simulateLoad(graph, &job9, + {{NodeKind::nominal, {"a", "b", "c->", "d->"}}, + {NodeKind::topLevel, {"b", "c", "d->", "a->"}}}); +} + +TEST(ModuleDepGraphWithoutFingerprints, IndependentNodes) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); + + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a0", "a->"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"b0", "b->"}}}); + simulateLoad(graph, &job2, {{NodeKind::topLevel, {"c0", "c->"}}}); EXPECT_EQ(1u, graph.findJobsToRecompileWhenWholeJobChanges(&job0).size()); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); @@ -97,41 +87,36 @@ TEST(ModuleDepGraph, IndependentNodes) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraph, IndependentDepKinds) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, IndependentDepKinds) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{dependsNominal, {"a"}}, {providesNominal, {"b"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsTopLevel, {"b"}}, {providesTopLevel, {"a"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a", "a->"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"a", "b->"}}}); EXPECT_EQ(1u, graph.findJobsToRecompileWhenWholeJobChanges(&job0).size()); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, IndependentDepKinds2) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, IndependentDepKinds2) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{dependsNominal, {"a"}}, {providesNominal, {"b"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsTopLevel, {"b"}}, {providesTopLevel, {"a"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a->", "b"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"b->", "a"}}}); EXPECT_EQ(1u, graph.findJobsToRecompileWhenWholeJobChanges(&job1).size()); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, IndependentMembers) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, IndependentMembers) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE( - graph.simulateLoad( &job0, {}, {{providesMember, {{"a", "aa"}}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {}, {{dependsMember, {{"a", "bb"}}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {}, {{dependsMember, {{"a", ""}}}})); - EXPECT_TRUE(graph.simulateLoad( &job3, {}, {{dependsMember, {{"b", "aa"}}}})); - EXPECT_TRUE(graph.simulateLoad( &job4, {}, {{dependsMember, {{"b", "bb"}}}})); + simulateLoad(graph, &job0, {{NodeKind::member, {"a,aa"}}}); + simulateLoad(graph, &job1, {{NodeKind::member, {"a,bb->"}}}); + simulateLoad(graph, &job2, {{NodeKind::potentialMember, {"a"}}}); + simulateLoad(graph, &job3, {{NodeKind::member, {"b,aa->"}}}); + simulateLoad(graph, &job4, {{NodeKind::member, {"b,bb->"}}}); EXPECT_EQ(1u, graph.findJobsToRecompileWhenWholeJobChanges(&job0).size()); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); @@ -141,12 +126,11 @@ TEST(ModuleDepGraph, IndependentMembers) { EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job4)); } -TEST(ModuleDepGraph, SimpleDependent) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, SimpleDependent) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{providesTopLevel, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsTopLevel, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"x->", "b->", "z->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); EXPECT_EQ(2u, jobs.size()); @@ -160,17 +144,16 @@ TEST(ModuleDepGraph, SimpleDependent) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, SimpleDependentReverse) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, SimpleDependentReverse) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( &job0, {{dependsTopLevel, {"a", "b", "c"}}})); - EXPECT_TRUE( - graph.simulateLoad( &job1, {{providesTopLevel, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a->", "b->", "c->"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"x", "b", "z"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); EXPECT_EQ(2u, jobs.size()); - EXPECT_EQ(&job0, jobs.front()); + EXPECT_TRUE(contains(jobs, &job0)); } EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); @@ -184,11 +167,11 @@ TEST(ModuleDepGraph, SimpleDependentReverse) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, SimpleDependent2) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, SimpleDependent2) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"x->", "b->", "z->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -203,12 +186,12 @@ TEST(ModuleDepGraph, SimpleDependent2) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, SimpleDependent3) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, SimpleDependent3) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{providesNominal, {"a"}}, {providesTopLevel, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"a"}}})); + simulateLoad(graph, &job0, + {{NodeKind::nominal, {"a"}}, {NodeKind::topLevel, {"a"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"a->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -223,12 +206,12 @@ TEST(ModuleDepGraph, SimpleDependent3) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, SimpleDependent4) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, SimpleDependent4) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsNominal, {"a"}}, {dependsTopLevel, {"a"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a"}}}); + simulateLoad(graph, &job1, + {{NodeKind::nominal, {"a->"}}, {NodeKind::topLevel, {"a->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -243,13 +226,13 @@ TEST(ModuleDepGraph, SimpleDependent4) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, SimpleDependent5) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, SimpleDependent5) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{providesNominal, {"a"}}, {providesTopLevel, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsNominal, {"a"}}, {dependsTopLevel, {"a"}}})); + simulateLoad(graph, &job0, + {{NodeKind::nominal, {"a"}}, {NodeKind::topLevel, {"a"}}}); + simulateLoad(graph, &job1, + {{NodeKind::nominal, {"a->"}}, {NodeKind::topLevel, {"a->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -265,13 +248,12 @@ TEST(ModuleDepGraph, SimpleDependent5) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, SimpleDependent6) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, SimpleDependent6) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{providesDynamicLookup, {"a", "b", "c"}}})); - EXPECT_TRUE( - graph.simulateLoad( &job1, {{dependsDynamicLookup, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::dynamicLookup, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, + {{NodeKind::dynamicLookup, {"x->", "b->", "z->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); EXPECT_EQ(2u, jobs.size()); @@ -285,15 +267,12 @@ TEST(ModuleDepGraph, SimpleDependent6) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, SimpleDependentMember) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, SimpleDependentMember) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( - &job0, {}, - {{providesMember, {{"a", "aa"}, {"b", "bb"}, {"c", "cc"}}}})); - EXPECT_TRUE( - graph.simulateLoad( &job1, {}, - {{dependsMember, {{"x", "xx"}, {"b", "bb"}, {"z", "zz"}}}})); + simulateLoad(graph, &job0, {{NodeKind::member, {"a,aa", "b,bb", "c,cc"}}}); + simulateLoad(graph, &job1, + {{NodeKind::member, {"x,xx->", "b,bb->", "z,zz->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -308,12 +287,12 @@ TEST(ModuleDepGraph, SimpleDependentMember) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, MultipleDependentsSame) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, MultipleDependentsSame) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"x", "b", "z"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"q", "b", "s"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"x->", "b->", "z->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"q->", "b->", "s->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -331,12 +310,12 @@ TEST(ModuleDepGraph, MultipleDependentsSame) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraph, MultipleDependentsDifferent) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, MultipleDependentsDifferent) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"x", "b", "z"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"q", "r", "c"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"x->", "b->", "z->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"q->", "r->", "c->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -354,13 +333,12 @@ TEST(ModuleDepGraph, MultipleDependentsDifferent) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraph, ChainedDependents) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, ChainedDependents) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsNominal, {"x", "b"}}, {providesNominal, {"z"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"z"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"x->", "b->", "z"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"z->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -378,13 +356,12 @@ TEST(ModuleDepGraph, ChainedDependents) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraph, ChainedNoncascadingDependents) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, ChainedNoncascadingDependents) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsNominal, {"x", "b"}}, {providesNominal, {SourceFileDepGraph::noncascading("z")}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {SourceFileDepGraph::noncascading("z")}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"x->", "b->", "#z"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"#z->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -402,15 +379,14 @@ TEST(ModuleDepGraph, ChainedNoncascadingDependents) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraph, ChainedNoncascadingDependents2) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, ChainedNoncascadingDependents2) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{providesTopLevel, {"a", SourceFileDepGraph::noncascading("b"), "c"}}})); - EXPECT_TRUE( - graph.simulateLoad( &job1, - {{dependsTopLevel, {"x", SourceFileDepGraph::noncascading("b")}}, {providesNominal, {"z"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"z"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b", "c"}}}); + simulateLoad( + graph, &job1, + {{NodeKind::topLevel, {"x->", "#b->"}}, {NodeKind::nominal, {"z"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"z->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -422,19 +398,15 @@ TEST(ModuleDepGraph, ChainedNoncascadingDependents2) { EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraph, MarkTwoNodes) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, MarkTwoNodes) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesTopLevel, {"a", "b"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsTopLevel, {"a"}}, {providesTopLevel, {"z"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsTopLevel, {"z"}}})); - EXPECT_TRUE( - graph.simulateLoad( &job10, - {{providesTopLevel, {"y", "z"}}, {dependsTopLevel, {"q"}}})); - EXPECT_TRUE(graph.simulateLoad( &job11, {{dependsTopLevel, {"y"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job12, {{dependsTopLevel, {"q"}}, {providesTopLevel, {"q"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"a->", "z"}}}); + simulateLoad(graph, &job2, {{NodeKind::topLevel, {"z->"}}}); + simulateLoad(graph, &job10, {{NodeKind::topLevel, {"y", "z", "q->"}}}); + simulateLoad(graph, &job11, {{NodeKind::topLevel, {"y->"}}}); + simulateLoad(graph, &job12, {{NodeKind::topLevel, {"q->", "q"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -464,12 +436,12 @@ TEST(ModuleDepGraph, MarkTwoNodes) { EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job12)); } -TEST(ModuleDepGraph, MarkOneNodeTwice) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, MarkOneNodeTwice) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"b"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"a->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"b->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -480,11 +452,8 @@ TEST(ModuleDepGraph, MarkOneNodeTwice) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); - // Reload 0. - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"b"}}})); - { - auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); + auto jobs = simulateReload(graph, &job0, {{NodeKind::nominal, {"b"}}}); EXPECT_EQ(2u, jobs.size()); EXPECT_TRUE(contains(jobs, &job2)); } @@ -493,12 +462,12 @@ TEST(ModuleDepGraph, MarkOneNodeTwice) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraph, MarkOneNodeTwice2) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, MarkOneNodeTwice2) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"b"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"a->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"b->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -509,11 +478,8 @@ TEST(ModuleDepGraph, MarkOneNodeTwice2) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); - // Reload 0. - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a", "b"}}})); - { - auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); + auto jobs = simulateReload(graph, &job0, {{NodeKind::nominal, {"a", "b"}}}); EXPECT_EQ(2u, jobs.size()); EXPECT_TRUE(contains(jobs, &job2)); } @@ -522,12 +488,12 @@ TEST(ModuleDepGraph, MarkOneNodeTwice2) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraph, ReloadDetectsChange) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, ReloadDetectsChange) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"b"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"a->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"b->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); EXPECT_EQ(1u, jobs.size()); @@ -537,41 +503,27 @@ TEST(ModuleDepGraph, ReloadDetectsChange) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); - // Reload 1. - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsNominal, {"a"}}, {providesNominal, {"b"}}})); - - { - auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); - EXPECT_EQ(1u, jobs.size()); - EXPECT_TRUE(contains(jobs, &job0)); - } - EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); - EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); - EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); - - // Re-mark 1. { - auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); + auto jobs = + simulateReload(graph, &job1, {{NodeKind::nominal, {"b", "a->"}}}); EXPECT_EQ(2u, jobs.size()); EXPECT_TRUE(contains(jobs, &job1)); EXPECT_TRUE(contains(jobs, &job2)); } - - EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); + EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraph, NotTransitiveOnceMarked) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, NotTransitiveOnceMarked) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"b"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"a->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"b->"}}}); { - const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); + const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); EXPECT_EQ(1u, jobs.size()); EXPECT_TRUE(contains(jobs, &job1)); } @@ -579,41 +531,25 @@ TEST(ModuleDepGraph, NotTransitiveOnceMarked) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); - // Reload 1. - EXPECT_TRUE(graph.simulateLoad( &job1, - {{dependsNominal, {"a"}}, {providesNominal, {"b"}}})); - { - const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); - EXPECT_EQ(1u, jobs.size()); - EXPECT_TRUE(contains(jobs, &job0)); - } - EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); - EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); - EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); - - // Re-mark 1. - { - auto found = graph.findJobsToRecompileWhenWholeJobChanges(&job1); - EXPECT_EQ(2u, found.size()); - EXPECT_TRUE(contains(found, &job1)); - EXPECT_TRUE(contains(found, &job2)); + const auto jobs = + simulateReload(graph, &job1, {{NodeKind::nominal, {"b", "a->"}}}); + EXPECT_EQ(2u, jobs.size()); + EXPECT_TRUE(contains(jobs, &job1)); + EXPECT_TRUE(contains(jobs, &job2)); } - EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); + EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraph, DependencyLoops) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, DependencyLoops) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( - &job0, - {{providesTopLevel, {"a", "b", "c"}}, {dependsTopLevel, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, - {{providesTopLevel, {"x"}}, {dependsTopLevel, {"x", "b", "z"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsTopLevel, {"x"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b", "c", "a->"}}}); + simulateLoad(graph, &job1, + {{NodeKind::topLevel, {"x", "x->", "b->", "z->"}}}); + simulateLoad(graph, &job2, {{NodeKind::topLevel, {"x->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -634,12 +570,11 @@ TEST(ModuleDepGraph, DependencyLoops) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraph, MarkIntransitive) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, MarkIntransitive) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{providesTopLevel, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsTopLevel, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"x->", "b->", "z->"}}}); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job1)); @@ -653,23 +588,21 @@ TEST(ModuleDepGraph, MarkIntransitive) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, MarkIntransitiveTwice) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, MarkIntransitiveTwice) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{providesTopLevel, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsTopLevel, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"x->", "b->", "z->"}}}); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, MarkIntransitiveThenIndirect) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, MarkIntransitiveThenIndirect) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{providesTopLevel, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsTopLevel, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"x->", "b->", "z->"}}}); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job1)); @@ -684,11 +617,11 @@ TEST(ModuleDepGraph, MarkIntransitiveThenIndirect) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, SimpleExternal) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, SimpleExternal) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{dependsExternal, {"/foo", "/bar"}}})); + simulateLoad(graph, &job0, + {{NodeKind::externalDepend, {"/foo->", "/bar->"}}}); EXPECT_TRUE(contains(graph.getExternalDependencies(), "/foo")); EXPECT_TRUE(contains(graph.getExternalDependencies(), "/bar")); @@ -705,11 +638,11 @@ TEST(ModuleDepGraph, SimpleExternal) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); } -TEST(ModuleDepGraph, SimpleExternal2) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, SimpleExternal2) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{dependsExternal, {"/foo", "/bar"}}})); + simulateLoad(graph, &job0, + {{NodeKind::externalDepend, {"/foo->", "/bar->"}}}); EXPECT_EQ(1u, graph.findExternallyDependentUntracedJobs("/bar").size()); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); @@ -718,13 +651,15 @@ TEST(ModuleDepGraph, SimpleExternal2) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); } -TEST(ModuleDepGraph, ChainedExternal) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, ChainedExternal) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{dependsExternal, {"/foo"}}, {providesTopLevel, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsExternal, {"/bar"}}, {dependsTopLevel, {"a"}}})); + simulateLoad( + graph, &job0, + {{NodeKind::externalDepend, {"/foo->"}}, {NodeKind::topLevel, {"a"}}}); + simulateLoad( + graph, &job1, + {{NodeKind::externalDepend, {"/bar->"}}, {NodeKind::topLevel, {"a->"}}}); EXPECT_TRUE(contains(graph.getExternalDependencies(), "/foo")); EXPECT_TRUE(contains(graph.getExternalDependencies(), "/bar")); @@ -746,13 +681,15 @@ TEST(ModuleDepGraph, ChainedExternal) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, ChainedExternalReverse) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, ChainedExternalReverse) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{dependsExternal, {"/foo"}}, {providesTopLevel, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsExternal, {"/bar"}}, {dependsTopLevel, {"a"}}})); + simulateLoad( + graph, &job0, + {{NodeKind::externalDepend, {"/foo->"}}, {NodeKind::topLevel, {"a"}}}); + simulateLoad( + graph, &job1, + {{NodeKind::externalDepend, {"/bar->"}}, {NodeKind::topLevel, {"a->"}}}); { auto jobs = graph.findExternallyDependentUntracedJobs("/bar"); @@ -769,19 +706,21 @@ TEST(ModuleDepGraph, ChainedExternalReverse) { { auto jobs = graph.findExternallyDependentUntracedJobs("/foo"); EXPECT_EQ(1u, jobs.size()); - EXPECT_EQ(&job0, jobs.front()); + EXPECT_TRUE(contains(jobs, &job0)); } EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraph, ChainedExternalPreMarked) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, ChainedExternalPreMarked) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{dependsExternal, {"/foo"}}, {providesTopLevel, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsExternal, {"/bar"}}, {dependsTopLevel, {"a"}}})); + simulateLoad( + graph, &job0, + {{NodeKind::externalDepend, {"/foo->"}}, {NodeKind::topLevel, {"a"}}}); + simulateLoad( + graph, &job1, + {{NodeKind::externalDepend, {"/bar->"}}, {NodeKind::topLevel, {"a->"}}}); { auto jobs = graph.findExternallyDependentUntracedJobs("/foo"); @@ -793,34 +732,105 @@ TEST(ModuleDepGraph, ChainedExternalPreMarked) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } - -TEST(ModuleDepGraph, MutualInterfaceHash) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); - graph.simulateLoad( &job0, { - {providesTopLevel, {"a"}}, - {dependsTopLevel, {"b"}} - }); - graph.simulateLoad( &job1, { - {dependsTopLevel, {"a"}}, - {providesTopLevel, {"b"}} - }); +TEST(ModuleDepGraphWithoutFingerprints, MutualInterfaceHash) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b->"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"a->", "b"}}}); const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); EXPECT_TRUE(contains(jobs, &job1)); } -TEST(ModuleDepGraph, DisabledTypeBodyFingerprints) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ false); +TEST(ModuleDepGraphWithoutFingerprints, DisabledTypeBodyFingerprints) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); - graph.simulateLoad(&job0, {{dependsNominal, {"B2"}}}); - graph.simulateLoad(&job1, {{providesNominal, {"B1", "B2"}}}); - graph.simulateLoad(&job2, {{dependsNominal, {"B1"}}}); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"B2->"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"B1", "B2"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"B1->"}}}); { - const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); - EXPECT_EQ(3u, jobs.size()); + const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); + EXPECT_EQ(3u, jobs.size()); + EXPECT_TRUE(contains(jobs, &job0)); + EXPECT_TRUE(contains(jobs, &job1)); + EXPECT_TRUE(contains(jobs, &job2)); + } +} + +TEST(ModuleDepGraphWithoutFingerprints, BaselineForPrintsAndCrossType) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); + + // Because when A1 changes, B1 and not B2 is affected, only jobs1 and job2 + // should be recompiled, except type fingerprints is off! + + simulateLoad(graph, &job0, {{NodeKind::nominal, {"A1", "A2"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"B1", "A1->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"C1", "A2->"}}}); + simulateLoad(graph, &job3, {{NodeKind::nominal, {"D1"}}}); + + { + const auto jobs = simulateReload( + graph, &job0, {{NodeKind::nominal, {"A1", "A2"}}}, "changed"); + EXPECT_EQ(3u, jobs.size()); + EXPECT_TRUE(contains(jobs, &job0)); + EXPECT_TRUE(contains(jobs, &job1)); + EXPECT_TRUE(contains(jobs, &job2)); + EXPECT_FALSE(contains(jobs, &job3)); + } +} + +TEST(ModuleDepGraphWithoutFingerprints, LoadFailsWithFingerprint) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); + EXPECT_FALSE( + getChangesForSimulatedLoad(graph, &job0, {{NodeKind::nominal, {"A@1"}}})); +} + +TEST(ModuleDepGraphWithoutFingerprints, IgnoreFingerprints) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); + + simulateLoad(graph, &job0, {{NodeKind::nominal, {"A1", "A2"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"B1", "A1->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"C1", "A2->"}}}); + simulateLoad(graph, &job3, {{NodeKind::nominal, {"D1"}}}); + + { + const auto jobs = + simulateReload(graph, &job0, {{NodeKind::nominal, {"A1@11", "A2@2"}}}); + EXPECT_EQ(4u, jobs.size()); + EXPECT_TRUE(contains(jobs, &job0)); + EXPECT_TRUE(contains(jobs, &job1)); + EXPECT_TRUE(contains(jobs, &job2)); + EXPECT_TRUE(contains(jobs, &job3)); + } +} + +TEST(ModuleDepGraphWithoutFingerprints, CrossTypeDependencyBaseline) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"A"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"B", "C", "A->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"B->"}}}); + simulateLoad(graph, &job3, {{NodeKind::nominal, {"C->"}}}); + + const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); EXPECT_TRUE(contains(jobs, &job0)); EXPECT_TRUE(contains(jobs, &job1)); EXPECT_TRUE(contains(jobs, &job2)); - } + EXPECT_TRUE(contains(jobs, &job3)); +} + +TEST(ModuleDepGraphWithoutFingerprints, CrossTypeDependency) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/false); + // Because of the cross-type dependency, A->B, + // when A changes, only B is dirtied in job1. + + simulateLoad(graph, &job0, {{NodeKind::nominal, {"A"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"B", "C", "A->B"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"B->"}}}); + simulateLoad(graph, &job3, {{NodeKind::nominal, {"C->"}}}); + + const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); + EXPECT_TRUE(contains(jobs, &job0)); + EXPECT_TRUE(contains(jobs, &job1)); + EXPECT_TRUE(contains(jobs, &job2)); + EXPECT_FALSE(contains(jobs, &job3)); } diff --git a/unittests/Driver/MockingFineGrainedDependencyGraphs.cpp b/unittests/Driver/MockingFineGrainedDependencyGraphs.cpp new file mode 100644 index 0000000000000..f9d1caaa14e72 --- /dev/null +++ b/unittests/Driver/MockingFineGrainedDependencyGraphs.cpp @@ -0,0 +1,89 @@ +//===--------------- MockingFineGraonedDependencyGraphs.cpp ---------------===// +// +// 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 "MockingFineGrainedDependencyGraphs.h" +#include "swift/AST/DiagnosticEngine.h" +#include "swift/AST/SourceFileDepGraphConstructor.h" +#include "swift/Basic/ReferenceDependencyKeys.h" +#include "swift/Basic/SourceManager.h" + +#include +#include + +using namespace swift; +using namespace fine_grained_dependencies; +using namespace mocking_fine_grained_dependency_graphs; + +void mocking_fine_grained_dependency_graphs::simulateLoad( + ModuleDepGraph &g, const driver::Job *cmd, + const DependencyDescriptions &dependencyDescriptions, + StringRef interfaceHashIfNonEmpty, const bool includePrivateDeps, + const bool hadCompilationError) { + const auto changes = getChangesForSimulatedLoad( + g, cmd, dependencyDescriptions, interfaceHashIfNonEmpty, + includePrivateDeps, hadCompilationError); + assert(changes && "simulated load should always succeed"); +} + +ModuleDepGraph::Changes +mocking_fine_grained_dependency_graphs::getChangesForSimulatedLoad( + ModuleDepGraph &g, const driver::Job *cmd, + const DependencyDescriptions &dependencyDescriptions, + StringRef interfaceHashIfNonEmpty, const bool includePrivateDeps, + const bool hadCompilationError) { + StringRef swiftDeps = + cmd->getOutput().getAdditionalOutputForType(file_types::TY_SwiftDeps); + assert(!swiftDeps.empty()); + StringRef interfaceHash = + interfaceHashIfNonEmpty.empty() ? swiftDeps : interfaceHashIfNonEmpty; + + SourceManager sm; + DiagnosticEngine diags(sm); + + auto sfdg = + MockSourceFileDepGraphConstructor( + includePrivateDeps, hadCompilationError, swiftDeps, interfaceHash, + g.emitFineGrainedDependencyDotFileAfterEveryImport, + dependencyDescriptions, diags) + .construct(); + + return g.loadFromSourceFileDepGraph(cmd, sfdg, diags); +} + +std::vector +mocking_fine_grained_dependency_graphs::simulateReload( + ModuleDepGraph &g, const driver::Job *cmd, + const DependencyDescriptions &dependencyDescriptions, + StringRef interfaceHashIfNonEmpty, const bool includePrivateDeps, + const bool hadCompilationError) { + const auto changedNodes = getChangesForSimulatedLoad( + g, cmd, dependencyDescriptions, interfaceHashIfNonEmpty, + includePrivateDeps, hadCompilationError); + if (!changedNodes) + return g.getAllJobs(); + return g.findJobsToRecompileWhenNodesChange(changedNodes.getValue()); +} + +LLVM_ATTRIBUTE_UNUSED +std::vector +mocking_fine_grained_dependency_graphs::printJobsForDebugging( + const std::vector &jobs) { + llvm::errs() << "\nprintForDebugging: "; + for (auto *j : jobs) { + const auto swiftDeps = + j->getOutput().getAdditionalOutputForType(file_types::TY_SwiftDeps); + assert(!swiftDeps.empty()); + llvm::errs() << "job" << swiftDeps << " "; + } + llvm::errs() << "\n"; + return jobs; +} diff --git a/unittests/Driver/MockingFineGrainedDependencyGraphs.h b/unittests/Driver/MockingFineGrainedDependencyGraphs.h new file mode 100644 index 0000000000000..72cb3e6018241 --- /dev/null +++ b/unittests/Driver/MockingFineGrainedDependencyGraphs.h @@ -0,0 +1,103 @@ +//===----------- MockingFineGrainedDependencyGraphs.h -----------*- 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 MOCKING_FINE_GRAINED_DEPENDENCY_GRAPHS_H +#define MOCKING_FINE_GRAINED_DEPENDENCY_GRAPHS_H + +#include "swift/AST/FineGrainedDependencies.h" +#include "swift/AST/SourceFileDepGraphConstructor.h" +#include "swift/Driver/FineGrainedDependencyDriverGraph.h" + +namespace swift { +namespace fine_grained_dependencies { + +/// Affordances for testing the \c SourceFileDepGraph and \c ModuleFileDepGraph +/// +/// Because fine-grained swiftdeps files are somewhat verbose, this file +/// provides affordances to mock them up in a concise fashion. + +namespace mocking_fine_grained_dependency_graphs { + +/// Simulate loading for unit testing, as if the driver is reading the swiftdeps +/// file for the first time. +/// +/// \param g The graph to load into. +/// \param cmd The \c Job whose dependency info will be loaded. +/// \param dependencyDescriptions Dependency info, see below +/// \param interfaceHashIfNonEmpty If non-empty, overrides the default simulated +/// interface hash \param includePrivateDeps Include file-private declarations +/// in the dependency information. \param hadCompilationError Simulate a +/// compilation error. +/// +/// Fails an assertion if the information is not valid (for instance a +/// fingerprint where it should not be). +/// +/// *Dependency info format:* +/// A list of entries, each of which is keyed by a \c NodeKind and contains a +/// list of dependency nodes. +/// +/// *Dependency node format:* +/// Each node here is either a "provides" (i.e. a declaration provided by the +/// file) or a "depends" (i.e. a declaration that is depended upon). +/// +/// For "provides" (i.e. declarations provided by the source file): +/// = [#][@], +/// where the '#' prefix indicates that the declaration is file-private. +/// +/// = | , +/// where is a mangled type name, and is a base-name. +/// +/// For "depends" (i.e. uses of declarations in the source file): +/// [#][~]->[] +/// where the '#' prefix indicates that the use does not cascade, +/// the '~' prefix indicates that the holder is private, +/// is the depended-upon declaration and the optional +/// is the dependent declaration if known. If not known, the +/// use will be the entire file. + +void simulateLoad(ModuleDepGraph &g, const driver::Job *cmd, + const DependencyDescriptions &dependencyDescriptions, + StringRef interfaceHashIfNonEmpty = StringRef(), + const bool includePrivateDeps = true, + const bool hadCompilationError = false); + +/// Same as \ref simulateLoad, but returns the specifically changed nodes or +/// None if the load failed. + +ModuleDepGraph::Changes +getChangesForSimulatedLoad(ModuleDepGraph &g, const driver::Job *cmd, + const DependencyDescriptions &dependencyDescriptions, + StringRef interfaceHashIfNonEmpty = StringRef(), + const bool includePrivateDeps = true, + const bool hadCompilationError = false); + +/// Simulates the driver reloading a swiftdeps file after a job has run. +/// Returns the jobs that must now be run, possibly redundantly including \p +/// cmd. +/// +/// See \ref simulateLoad for a parameter description. + +std::vector +simulateReload(ModuleDepGraph &g, const driver::Job *cmd, + const DependencyDescriptions &dependencyDescriptions, + StringRef interfaceHashIfNonEmpty = StringRef(), + const bool includePrivateDeps = true, + const bool hadCompilationError = false); + +std::vector +printJobsForDebugging(const std::vector &jobs); + +} // end namespace mocking_fine_grained_dependency_graphs +} // namespace fine_grained_dependencies +} // end namespace swift + +#endif /* MOCKING_FINE_GRAINED_DEPENDENCY_GRAPHS_H */ diff --git a/unittests/Driver/TypeBodyFingerprintsDependencyGraphTests.cpp b/unittests/Driver/TypeBodyFingerprintsDependencyGraphTests.cpp index 041cc9c2ee416..c19fd1313457f 100644 --- a/unittests/Driver/TypeBodyFingerprintsDependencyGraphTests.cpp +++ b/unittests/Driver/TypeBodyFingerprintsDependencyGraphTests.cpp @@ -1,3 +1,4 @@ +#include "MockingFineGrainedDependencyGraphs.h" #include "swift/Basic/ReferenceDependencyKeys.h" #include "swift/Driver/CoarseGrainedDependencyGraph.h" #include "swift/Driver/FineGrainedDependencyDriverGraph.h" @@ -7,17 +8,22 @@ // This file adapts the unit tests from the older, coarse-grained, dependency // graph to the new fine-grained graph. -// \c findJobsToRecompileWhenWholeJobChanges and \c -// findExternallyDependentUntracedJobs may include jobs in their result that +// \c findJobsToRecompileWhenWholeJobChanges, +// \c findExternallyDependentUntracedJobs, and \c simulateReload +// may include jobs in their result that // would be excluded in the coarse-grained graph. But since these will be jobs // that have already been scheduled, downstream mechanisms will filter them out. +// To debug a test, create the \c ModuleDepGraph and pass true as the second +// argument to the constructor, then find the dot files in the directory +// where the tests run, +// and inspect them with, e.g. OmniGraffle. + using namespace swift; -using namespace reference_dependency_keys; using namespace fine_grained_dependencies; +using namespace mocking_fine_grained_dependency_graphs; using Job = driver::Job; - static OutputFileMap OFM; static Job @@ -41,39 +47,31 @@ static bool contains(const Range &range, const T &value) { std::end(range); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, BasicLoad) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, BasicLoad) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{dependsTopLevel, {"a", "b"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"c", "d"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{providesTopLevel, {"e", "f"}}})); - EXPECT_TRUE(graph.simulateLoad( &job3, {{providesNominal, {"g", "h"}}})); - EXPECT_TRUE( - graph.simulateLoad( &job4, {{providesDynamicLookup, {"i", "j"}}})); - EXPECT_TRUE(graph.simulateLoad( &job5, {{dependsDynamicLookup, {"k", "l"}}})); - EXPECT_TRUE(graph.simulateLoad( &job6, {}, - {{providesMember, {{"m", "mm"}, {"n", "nn"}}}})); - EXPECT_TRUE(graph.simulateLoad( &job7, {}, - {{dependsMember, {{"o", "oo"}, {"p", "pp"}}}})); - EXPECT_TRUE( - graph.simulateLoad( &job8, {{dependsExternal, {"/foo", "/bar"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a->", "b->"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"c->", "d->"}}}); + simulateLoad(graph, &job2, {{NodeKind::topLevel, {"e", "f"}}}); + simulateLoad(graph, &job3, {{NodeKind::nominal, {"g", "h"}}}); + simulateLoad(graph, &job4, {{NodeKind::dynamicLookup, {"i", "j"}}}); + simulateLoad(graph, &job5, {{NodeKind::dynamicLookup, {"k->", "l->"}}}); + simulateLoad(graph, &job6, {{NodeKind::member, {"m,mm", "n,nn"}}}); + simulateLoad(graph, &job7, {{NodeKind::member, {"o,oo->", "p,pp->"}}}); + simulateLoad(graph, &job8, + {{NodeKind::externalDepend, {"/foo->", "/bar->"}}}); - EXPECT_TRUE(graph.simulateLoad( &job9, - {{providesNominal, {"a", "b"}}, - {providesTopLevel, {"b", "c"}}, - {dependsNominal, {"c", "d"}}, - {dependsTopLevel, {"d", "a"}}})); + simulateLoad(graph, &job9, + {{NodeKind::nominal, {"a", "b", "c->", "d->"}}, + {NodeKind::topLevel, {"b", "c", "d->", "a->"}}}); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, IndependentNodes) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, IndependentNodes) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{dependsTopLevel, {"a"}}, {providesTopLevel, {"a0"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsTopLevel, {"b"}}, {providesTopLevel, {"b0"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job2, {{dependsTopLevel, {"c"}}, {providesTopLevel, {"c0"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a0", "a->"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"b0", "b->"}}}); + simulateLoad(graph, &job2, {{NodeKind::topLevel, {"c0", "c->"}}}); EXPECT_EQ(1u, graph.findJobsToRecompileWhenWholeJobChanges(&job0).size()); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); @@ -97,41 +95,36 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, IndependentNodes) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, IndependentDepKinds) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, IndependentDepKinds) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{dependsNominal, {"a"}}, {providesNominal, {"b"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsTopLevel, {"b"}}, {providesTopLevel, {"a"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a", "a->"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"a", "b->"}}}); EXPECT_EQ(1u, graph.findJobsToRecompileWhenWholeJobChanges(&job0).size()); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, IndependentDepKinds2) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, IndependentDepKinds2) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{dependsNominal, {"a"}}, {providesNominal, {"b"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsTopLevel, {"b"}}, {providesTopLevel, {"a"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a->", "b"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"b->", "a"}}}); EXPECT_EQ(1u, graph.findJobsToRecompileWhenWholeJobChanges(&job1).size()); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, IndependentMembers) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, IndependentMembers) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE( - graph.simulateLoad( &job0, {}, {{providesMember, {{"a", "aa"}}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {}, {{dependsMember, {{"a", "bb"}}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {}, {{dependsMember, {{"a", ""}}}})); - EXPECT_TRUE(graph.simulateLoad( &job3, {}, {{dependsMember, {{"b", "aa"}}}})); - EXPECT_TRUE(graph.simulateLoad( &job4, {}, {{dependsMember, {{"b", "bb"}}}})); + simulateLoad(graph, &job0, {{NodeKind::member, {"a,aa"}}}); + simulateLoad(graph, &job1, {{NodeKind::member, {"a,bb->"}}}); + simulateLoad(graph, &job2, {{NodeKind::potentialMember, {"a"}}}); + simulateLoad(graph, &job3, {{NodeKind::member, {"b,aa->"}}}); + simulateLoad(graph, &job4, {{NodeKind::member, {"b,bb->"}}}); EXPECT_EQ(1u, graph.findJobsToRecompileWhenWholeJobChanges(&job0).size()); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); @@ -141,12 +134,11 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, IndependentMembers) { EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job4)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependent) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, SimpleDependent) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{providesTopLevel, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsTopLevel, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"x->", "b->", "z->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); EXPECT_EQ(2u, jobs.size()); @@ -160,17 +152,16 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependent) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependentReverse) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, SimpleDependentReverse) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{dependsTopLevel, {"a", "b", "c"}}})); - EXPECT_TRUE( - graph.simulateLoad( &job1, {{providesTopLevel, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a->", "b->", "c->"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"x", "b", "z"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); EXPECT_EQ(2u, jobs.size()); - EXPECT_EQ(&job0, jobs.front()); + EXPECT_TRUE(contains(jobs, &job0)); } EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); @@ -184,11 +175,11 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependentReverse) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependent2) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, SimpleDependent2) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"x->", "b->", "z->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -203,12 +194,12 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependent2) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependent3) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, SimpleDependent3) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{providesNominal, {"a"}}, {providesTopLevel, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"a"}}})); + simulateLoad(graph, &job0, + {{NodeKind::nominal, {"a"}}, {NodeKind::topLevel, {"a"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"a->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -223,12 +214,12 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependent3) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependent4) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, SimpleDependent4) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsNominal, {"a"}}, {dependsTopLevel, {"a"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a"}}}); + simulateLoad(graph, &job1, + {{NodeKind::nominal, {"a->"}}, {NodeKind::topLevel, {"a->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -243,13 +234,13 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependent4) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependent5) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, SimpleDependent5) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{providesNominal, {"a"}}, {providesTopLevel, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsNominal, {"a"}}, {dependsTopLevel, {"a"}}})); + simulateLoad(graph, &job0, + {{NodeKind::nominal, {"a"}}, {NodeKind::topLevel, {"a"}}}); + simulateLoad(graph, &job1, + {{NodeKind::nominal, {"a->"}}, {NodeKind::topLevel, {"a->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -265,13 +256,12 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependent5) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependent6) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, SimpleDependent6) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{providesDynamicLookup, {"a", "b", "c"}}})); - EXPECT_TRUE( - graph.simulateLoad( &job1, {{dependsDynamicLookup, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::dynamicLookup, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, + {{NodeKind::dynamicLookup, {"x->", "b->", "z->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); EXPECT_EQ(2u, jobs.size()); @@ -285,15 +275,12 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependent6) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependentMember) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, SimpleDependentMember) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( - &job0, {}, - {{providesMember, {{"a", "aa"}, {"b", "bb"}, {"c", "cc"}}}})); - EXPECT_TRUE( - graph.simulateLoad( &job1, {}, - {{dependsMember, {{"x", "xx"}, {"b", "bb"}, {"z", "zz"}}}})); + simulateLoad(graph, &job0, {{NodeKind::member, {"a,aa", "b,bb", "c,cc"}}}); + simulateLoad(graph, &job1, + {{NodeKind::member, {"x,xx->", "b,bb->", "z,zz->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -308,12 +295,12 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleDependentMember) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, MultipleDependentsSame) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, MultipleDependentsSame) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"x", "b", "z"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"q", "b", "s"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"x->", "b->", "z->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"q->", "b->", "s->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -331,12 +318,12 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, MultipleDependentsSame) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, MultipleDependentsDifferent) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, MultipleDependentsDifferent) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"x", "b", "z"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"q", "r", "c"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"x->", "b->", "z->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"q->", "r->", "c->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -354,13 +341,12 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, MultipleDependentsDifferent) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, ChainedDependents) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, ChainedDependents) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsNominal, {"x", "b"}}, {providesNominal, {"z"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"z"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"x->", "b->", "z"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"z->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -378,13 +364,12 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, ChainedDependents) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, ChainedNoncascadingDependents) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, ChainedNoncascadingDependents) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsNominal, {"x", "b"}}, {providesNominal, {SourceFileDepGraph::noncascading("z")}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {SourceFileDepGraph::noncascading("z")}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"x->", "b->", "#z"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"#z->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -402,15 +387,14 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, ChainedNoncascadingDependents) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, ChainedNoncascadingDependents2) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, ChainedNoncascadingDependents2) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{providesTopLevel, {"a", SourceFileDepGraph::noncascading("b"), "c"}}})); - EXPECT_TRUE( - graph.simulateLoad( &job1, - {{dependsTopLevel, {"x", SourceFileDepGraph::noncascading("b")}}, {providesNominal, {"z"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"z"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b", "c"}}}); + simulateLoad( + graph, &job1, + {{NodeKind::topLevel, {"x->", "#b->"}}, {NodeKind::nominal, {"z"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"z->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -422,19 +406,15 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, ChainedNoncascadingDependents2) { EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkTwoNodes) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, MarkTwoNodes) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesTopLevel, {"a", "b"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsTopLevel, {"a"}}, {providesTopLevel, {"z"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsTopLevel, {"z"}}})); - EXPECT_TRUE( - graph.simulateLoad( &job10, - {{providesTopLevel, {"y", "z"}}, {dependsTopLevel, {"q"}}})); - EXPECT_TRUE(graph.simulateLoad( &job11, {{dependsTopLevel, {"y"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job12, {{dependsTopLevel, {"q"}}, {providesTopLevel, {"q"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"a->", "z"}}}); + simulateLoad(graph, &job2, {{NodeKind::topLevel, {"z->"}}}); + simulateLoad(graph, &job10, {{NodeKind::topLevel, {"y", "z", "q->"}}}); + simulateLoad(graph, &job11, {{NodeKind::topLevel, {"y->"}}}); + simulateLoad(graph, &job12, {{NodeKind::topLevel, {"q->", "q"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -464,12 +444,12 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkTwoNodes) { EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job12)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkOneNodeTwice) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, MarkOneNodeTwice) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"b"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"a->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"b->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -480,11 +460,8 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkOneNodeTwice) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); - // Reload 0. - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"b"}}})); - { - auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); + auto jobs = simulateReload(graph, &job0, {{NodeKind::nominal, {"b"}}}); EXPECT_EQ(2u, jobs.size()); EXPECT_TRUE(contains(jobs, &job2)); } @@ -493,12 +470,12 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkOneNodeTwice) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkOneNodeTwice2) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, MarkOneNodeTwice2) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"b"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"a->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"b->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -509,11 +486,8 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkOneNodeTwice2) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); - // Reload 0. - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a", "b"}}})); - { - auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); + auto jobs = simulateReload(graph, &job0, {{NodeKind::nominal, {"a", "b"}}}); EXPECT_EQ(2u, jobs.size()); EXPECT_TRUE(contains(jobs, &job2)); } @@ -522,12 +496,12 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkOneNodeTwice2) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, ReloadDetectsChange) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, ReloadDetectsChange) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"b"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"a->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"b->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); EXPECT_EQ(1u, jobs.size()); @@ -537,41 +511,27 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, ReloadDetectsChange) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); - // Reload 1. - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsNominal, {"a"}}, {providesNominal, {"b"}}})); - - { - auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); - EXPECT_EQ(1u, jobs.size()); - EXPECT_TRUE(contains(jobs, &job0)); - } - EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); - EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); - EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); - - // Re-mark 1. { - auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); + auto jobs = + simulateReload(graph, &job1, {{NodeKind::nominal, {"b", "a->"}}}); EXPECT_EQ(2u, jobs.size()); EXPECT_TRUE(contains(jobs, &job1)); EXPECT_TRUE(contains(jobs, &job2)); } - - EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); + EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, NotTransitiveOnceMarked) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, NotTransitiveOnceMarked) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( &job0, {{providesNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsNominal, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsNominal, {"b"}}})); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"a"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"a->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"b->"}}}); { - const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); + const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); EXPECT_EQ(1u, jobs.size()); EXPECT_TRUE(contains(jobs, &job1)); } @@ -579,41 +539,25 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, NotTransitiveOnceMarked) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); - // Reload 1. - EXPECT_TRUE(graph.simulateLoad( &job1, - {{dependsNominal, {"a"}}, {providesNominal, {"b"}}})); - - { - const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); - EXPECT_EQ(1u, jobs.size()); - EXPECT_TRUE(contains(jobs, &job0)); - } - EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); - EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); - EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job2)); - - // Re-mark 1. { - auto found = graph.findJobsToRecompileWhenWholeJobChanges(&job1); - EXPECT_EQ(2u, found.size()); - EXPECT_TRUE(contains(found, &job1)); - EXPECT_TRUE(contains(found, &job2)); + const auto jobs = + simulateReload(graph, &job1, {{NodeKind::nominal, {"b", "a->"}}}); + EXPECT_EQ(2u, jobs.size()); + EXPECT_TRUE(contains(jobs, &job1)); + EXPECT_TRUE(contains(jobs, &job2)); } - EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); + EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, DependencyLoops) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, DependencyLoops) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( - &job0, - {{providesTopLevel, {"a", "b", "c"}}, {dependsTopLevel, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, - {{providesTopLevel, {"x"}}, {dependsTopLevel, {"x", "b", "z"}}})); - EXPECT_TRUE(graph.simulateLoad( &job2, {{dependsTopLevel, {"x"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b", "c", "a->"}}}); + simulateLoad(graph, &job1, + {{NodeKind::topLevel, {"x", "x->", "b->", "z->"}}}); + simulateLoad(graph, &job2, {{NodeKind::topLevel, {"x->"}}}); { auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); @@ -634,12 +578,11 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, DependencyLoops) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job2)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkIntransitive) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, MarkIntransitive) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{providesTopLevel, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsTopLevel, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"x->", "b->", "z->"}}}); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job1)); @@ -653,23 +596,21 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkIntransitive) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkIntransitiveTwice) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, MarkIntransitiveTwice) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{providesTopLevel, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsTopLevel, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"x->", "b->", "z->"}}}); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkIntransitiveThenIndirect) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, MarkIntransitiveThenIndirect) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{providesTopLevel, {"a", "b", "c"}}})); - EXPECT_TRUE(graph.simulateLoad( &job1, {{dependsTopLevel, {"x", "b", "z"}}})); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b", "c"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"x->", "b->", "z->"}}}); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_FALSE(graph.haveAnyNodesBeenTraversedIn(&job1)); @@ -684,11 +625,11 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, MarkIntransitiveThenIndirect) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleExternal) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, SimpleExternal) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{dependsExternal, {"/foo", "/bar"}}})); + simulateLoad(graph, &job0, + {{NodeKind::externalDepend, {"/foo->", "/bar->"}}}); EXPECT_TRUE(contains(graph.getExternalDependencies(), "/foo")); EXPECT_TRUE(contains(graph.getExternalDependencies(), "/bar")); @@ -705,11 +646,11 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleExternal) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleExternal2) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, SimpleExternal2) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE( - graph.simulateLoad( &job0, {{dependsExternal, {"/foo", "/bar"}}})); + simulateLoad(graph, &job0, + {{NodeKind::externalDepend, {"/foo->", "/bar->"}}}); EXPECT_EQ(1u, graph.findExternallyDependentUntracedJobs("/bar").size()); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); @@ -718,13 +659,15 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, SimpleExternal2) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, ChainedExternal) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, ChainedExternal) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{dependsExternal, {"/foo"}}, {providesTopLevel, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsExternal, {"/bar"}}, {dependsTopLevel, {"a"}}})); + simulateLoad( + graph, &job0, + {{NodeKind::externalDepend, {"/foo->"}}, {NodeKind::topLevel, {"a"}}}); + simulateLoad( + graph, &job1, + {{NodeKind::externalDepend, {"/bar->"}}, {NodeKind::topLevel, {"a->"}}}); EXPECT_TRUE(contains(graph.getExternalDependencies(), "/foo")); EXPECT_TRUE(contains(graph.getExternalDependencies(), "/bar")); @@ -746,13 +689,15 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, ChainedExternal) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, ChainedExternalReverse) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, ChainedExternalReverse) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{dependsExternal, {"/foo"}}, {providesTopLevel, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsExternal, {"/bar"}}, {dependsTopLevel, {"a"}}})); + simulateLoad( + graph, &job0, + {{NodeKind::externalDepend, {"/foo->"}}, {NodeKind::topLevel, {"a"}}}); + simulateLoad( + graph, &job1, + {{NodeKind::externalDepend, {"/bar->"}}, {NodeKind::topLevel, {"a->"}}}); { auto jobs = graph.findExternallyDependentUntracedJobs("/bar"); @@ -769,19 +714,21 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, ChainedExternalReverse) { { auto jobs = graph.findExternallyDependentUntracedJobs("/foo"); EXPECT_EQ(1u, jobs.size()); - EXPECT_EQ(&job0, jobs.front()); + EXPECT_TRUE(contains(jobs, &job0)); } EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job0)); EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } -TEST(ModuleDepGraphWithTypeBodyFingerprints, ChainedExternalPreMarked) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); +TEST(ModuleDepGraph, ChainedExternalPreMarked) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); - EXPECT_TRUE(graph.simulateLoad( - &job0, {{dependsExternal, {"/foo"}}, {providesTopLevel, {"a"}}})); - EXPECT_TRUE(graph.simulateLoad( - &job1, {{dependsExternal, {"/bar"}}, {dependsTopLevel, {"a"}}})); + simulateLoad( + graph, &job0, + {{NodeKind::externalDepend, {"/foo->"}}, {NodeKind::topLevel, {"a"}}}); + simulateLoad( + graph, &job1, + {{NodeKind::externalDepend, {"/bar->"}}, {NodeKind::topLevel, {"a->"}}}); { auto jobs = graph.findExternallyDependentUntracedJobs("/foo"); @@ -793,39 +740,153 @@ TEST(ModuleDepGraphWithTypeBodyFingerprints, ChainedExternalPreMarked) { EXPECT_TRUE(graph.haveAnyNodesBeenTraversedIn(&job1)); } - -TEST(ModuleDepGraphWithTypeBodyFingerprints, MutualInterfaceHash) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); - graph.simulateLoad( &job0, { - {providesTopLevel, {"a"}}, - {dependsTopLevel, {"b"}} - }); - graph.simulateLoad( &job1, { - {dependsTopLevel, {"a"}}, - {providesTopLevel, {"b"}} - }); +TEST(ModuleDepGraph, MutualInterfaceHash) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); + simulateLoad(graph, &job0, {{NodeKind::topLevel, {"a", "b->"}}}); + simulateLoad(graph, &job1, {{NodeKind::topLevel, {"a->", "b"}}}); const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); EXPECT_TRUE(contains(jobs, &job1)); } TEST(ModuleDepGraph, EnabledTypeBodyFingerprints) { - ModuleDepGraph graph(/*EnableTypeFingerprints=*/ true); + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); + + simulateLoad(graph, &job0, {{NodeKind::nominal, {"B2->"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"B1", "B2"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"B1->"}}}); + + { + const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job1); + EXPECT_EQ(3u, jobs.size()); + EXPECT_TRUE(contains(jobs, &job0)); + EXPECT_TRUE(contains(jobs, &job1)); + EXPECT_TRUE(contains(jobs, &job2)); + } +} - graph.simulateLoad(&job0, {{dependsNominal, {"B2"}}}); - graph.simulateLoad(&job1, {{providesNominal, {"B1", "B2"}}}); - graph.simulateLoad(&job2, {{dependsNominal, {"B1"}}}); +TEST(ModuleDepGraph, BaselineForPrintsAndCrossType) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); + // Because when A1 changes, B1 and not B2 is affected, only jobs1 and job2 + // should be recompiled, except type fingerprints is off! + + simulateLoad(graph, &job0, {{NodeKind::nominal, {"A1", "A2"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"B1", "A1->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"C1", "A2->"}}}); + simulateLoad(graph, &job3, {{NodeKind::nominal, {"D1"}}}); - const DependencyKey k = DependencyKey(NodeKind::nominal, - DeclAspect::interface, "B1", ""); - std::vector changedNodes; - graph.forEachMatchingNode( - k, - [&](ModuleDepGraphNode* n) {changedNodes.push_back(n);}); { - const auto jobs = graph.findJobsToRecompileWhenNodesChange(changedNodes); + const auto jobs = simulateReload( + graph, &job0, {{NodeKind::nominal, {"A1", "A2"}}}, "changed"); + EXPECT_EQ(3u, jobs.size()); + EXPECT_TRUE(contains(jobs, &job0)); + EXPECT_TRUE(contains(jobs, &job1)); EXPECT_TRUE(contains(jobs, &job2)); - EXPECT_FALSE(contains(jobs, &job0)); - } + EXPECT_FALSE(contains(jobs, &job3)); + } +} + +TEST(ModuleDepGraph, LoadPassesWithFingerprint) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); + EXPECT_TRUE( + getChangesForSimulatedLoad(graph, &job0, {{NodeKind::nominal, {"A@1"}}})); +} + +TEST(ModuleDepGraph, UseFingerprints) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); + + // Because when A1 changes, B1 and not B2 is affected, only jobs1 and job2 + // should be recompiled, except type fingerprints is off! + + simulateLoad(graph, &job0, {{NodeKind::nominal, {"A1@1", "A2@2"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"B1", "A1->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"C1", "A2->"}}}); + simulateLoad(graph, &job3, {{NodeKind::nominal, {"D1"}}}); + + { + const auto jobs = + simulateReload(graph, &job0, {{NodeKind::nominal, {"A1@11", "A2@2"}}}); + EXPECT_EQ(2u, jobs.size()); + EXPECT_TRUE(contains(jobs, &job0)); + EXPECT_TRUE(contains(jobs, &job1)); + EXPECT_FALSE(contains(jobs, &job2)); + EXPECT_FALSE(contains(jobs, &job3)); + } +} + +TEST(ModuleDepGraph, CrossTypeDependencyBaseline) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"A"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"B", "C", "A->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"B->"}}}); + simulateLoad(graph, &job3, {{NodeKind::nominal, {"C->"}}}); + + const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); + EXPECT_TRUE(contains(jobs, &job0)); + EXPECT_TRUE(contains(jobs, &job1)); + EXPECT_TRUE(contains(jobs, &job2)); + EXPECT_TRUE(contains(jobs, &job3)); +} + +TEST(ModuleDepGraph, CrossTypeDependency) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); + // Because of the cross-type dependency, A->B, + // when A changes, only B is dirtied in job1. + + simulateLoad(graph, &job0, {{NodeKind::nominal, {"A"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"B", "C", "A->B"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"B->"}}}); + simulateLoad(graph, &job3, {{NodeKind::nominal, {"C->"}}}); + + const auto jobs = graph.findJobsToRecompileWhenWholeJobChanges(&job0); + EXPECT_TRUE(contains(jobs, &job0)); + EXPECT_TRUE(contains(jobs, &job1)); + EXPECT_TRUE(contains(jobs, &job2)); + EXPECT_FALSE(contains(jobs, &job3)); +} + +TEST(ModuleDepGraph, CrossTypeDependencyBaselineWithFingerprints) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); + simulateLoad(graph, &job0, {{NodeKind::nominal, {"A1@1", "A2@2"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"B1", "C1", "A1->"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"B1->"}}}); + simulateLoad(graph, &job3, {{NodeKind::nominal, {"C1->"}}}); + simulateLoad(graph, &job4, {{NodeKind::nominal, {"B2", "C2", "A2->"}}}); + simulateLoad(graph, &job5, {{NodeKind::nominal, {"B2->"}}}); + simulateLoad(graph, &job6, {{NodeKind::nominal, {"C2->"}}}); + + const auto jobs = + simulateReload(graph, &job0, {{NodeKind::nominal, {"A1@11", "A2@2"}}}); + EXPECT_TRUE(contains(jobs, &job0)); + EXPECT_TRUE(contains(jobs, &job1)); + EXPECT_TRUE(contains(jobs, &job2)); + EXPECT_TRUE(contains(jobs, &job3)); + EXPECT_FALSE(contains(jobs, &job4)); + EXPECT_FALSE(contains(jobs, &job5)); + EXPECT_FALSE(contains(jobs, &job6)); +} + +TEST(ModuleDepGraph, CrossTypeDependencyWithFingerprints) { + ModuleDepGraph graph(/*EnableTypeFingerprints=*/true); + // Because of the cross-type dependency, A->B, + // when A changes, only B is dirtied in job1. + + simulateLoad(graph, &job0, {{NodeKind::nominal, {"A1@1", "A2@2"}}}); + simulateLoad(graph, &job1, {{NodeKind::nominal, {"B1", "C1", "A1->B1"}}}); + simulateLoad(graph, &job2, {{NodeKind::nominal, {"B1->"}}}); + simulateLoad(graph, &job3, {{NodeKind::nominal, {"C1->"}}}); + simulateLoad(graph, &job4, {{NodeKind::nominal, {"B2", "C2", "A2->B2"}}}); + simulateLoad(graph, &job5, {{NodeKind::nominal, {"B2->"}}}); + simulateLoad(graph, &job6, {{NodeKind::nominal, {"C2->"}}}); + + const auto jobs = + simulateReload(graph, &job0, {{NodeKind::nominal, {"A1@11", "A2@2"}}}); + EXPECT_TRUE(contains(jobs, &job0)); + EXPECT_TRUE(contains(jobs, &job1)); + EXPECT_TRUE(contains(jobs, &job2)); + EXPECT_FALSE(contains(jobs, &job3)); + EXPECT_FALSE(contains(jobs, &job4)); + EXPECT_FALSE(contains(jobs, &job5)); + EXPECT_FALSE(contains(jobs, &job6)); } From 3dedcce62011587e1abeb49249dd1176948c526a Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Mon, 17 Feb 2020 18:41:59 -0800 Subject: [PATCH 019/222] Add missing StringRef -> std::string conversions (#29892) --- lib/AST/SourceFileDepGraphConstructor.cpp | 20 +++++++++---------- .../FineGrainedDependencyDriverGraph.cpp | 18 ++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/AST/SourceFileDepGraphConstructor.cpp b/lib/AST/SourceFileDepGraphConstructor.cpp index 3c9894b669391..79c86de59a663 100644 --- a/lib/AST/SourceFileDepGraphConstructor.cpp +++ b/lib/AST/SourceFileDepGraphConstructor.cpp @@ -114,11 +114,11 @@ void SourceFileDepGraphConstructor::addAUsedDecl(const DependencyKey &defKey, //============================================================================== template static std::string getBaseName(const DeclT *decl) { - return decl->getBaseName().userFacingName(); + return decl->getBaseName().userFacingName().str(); } template static std::string getName(const DeclT *decl) { - return DeclBaseName(decl->getName()).userFacingName(); + return DeclBaseName(decl->getName()).userFacingName().str(); } static std::string mangleTypeAsContext(const NominalTypeDecl *NTD) { @@ -266,7 +266,7 @@ std::string DependencyKey::computeNameForProvidedEntity(StringRef swiftDeps) { assert(!swiftDeps.empty()); - return swiftDeps; + return swiftDeps.str(); } template <> @@ -328,27 +328,27 @@ std::string DependencyKey::computeNameForProvidedEntity< template <> DependencyKey DependencyKey::createDependedUponKey(StringRef name) { - return DependencyKey(NodeKind::topLevel, DeclAspect::interface, "", name); + return DependencyKey(NodeKind::topLevel, DeclAspect::interface, "", name.str()); } template <> DependencyKey DependencyKey::createDependedUponKey(StringRef name) { return DependencyKey(NodeKind::dynamicLookup, DeclAspect::interface, "", - name); + name.str()); } template <> DependencyKey DependencyKey::createDependedUponKey(StringRef name) { return DependencyKey(NodeKind::externalDepend, DeclAspect::interface, "", - name); + name.str()); } template <> DependencyKey DependencyKey::createDependedUponKey(StringRef mangledName) { - return DependencyKey(NodeKind::nominal, DeclAspect::interface, mangledName, + return DependencyKey(NodeKind::nominal, DeclAspect::interface, mangledName.str(), ""); } @@ -357,8 +357,8 @@ DependencyKey DependencyKey::createDependedUponKey(StringRef mangledHolderName, const bool isMemberBlank = memberBaseName.empty(); const auto kind = isMemberBlank ? NodeKind::potentialMember : NodeKind::member; - return DependencyKey(kind, DeclAspect::interface, mangledHolderName, - isMemberBlank ? "" : memberBaseName); + return DependencyKey(kind, DeclAspect::interface, mangledHolderName.str(), + isMemberBlank ? "" : memberBaseName.str()); } //============================================================================== @@ -680,7 +680,7 @@ class UsedDeclEnumerator { void enumerateUse(NodeKind kind, StringRef context, StringRef name, bool isCascadingUse) { // Assume that what is depended-upon is the interface - createDefUse(DependencyKey(kind, DeclAspect::interface, context, name), + createDefUse(DependencyKey(kind, DeclAspect::interface, context.str(), name.str()), isCascadingUse ? sourceFileInterface : sourceFileImplementation); } diff --git a/lib/Driver/FineGrainedDependencyDriverGraph.cpp b/lib/Driver/FineGrainedDependencyDriverGraph.cpp index f44e3c7d3aa58..cac4636591c65 100644 --- a/lib/Driver/FineGrainedDependencyDriverGraph.cpp +++ b/lib/Driver/FineGrainedDependencyDriverGraph.cpp @@ -77,7 +77,7 @@ ModuleDepGraph::Changes ModuleDepGraph::loadFromPath(const Job *Cmd, return None; auto r = loadFromBuffer(Cmd, *buffer.get(), diags); assert(path == getSwiftDeps(Cmd) && "Should be reading the job's swiftdeps"); - assert(!r || !nodeMap[path].empty() && + assert(!r || !nodeMap[path.str()].empty() && "Must have a node for the whole file"); return r; } @@ -112,7 +112,7 @@ bool ModuleDepGraph::haveAnyNodesBeenTraversedIn(const Job *cmd) const { // optimization const auto fileKey = DependencyKey::createKeyForWholeSourceFile( DeclAspect::interface, swiftDeps); - if (const auto fileNode = nodeMap.find(swiftDeps, fileKey)) { + if (const auto fileNode = nodeMap.find(swiftDeps.str(), fileKey)) { if (fileNode && fileNode.getValue()->getHasBeenTraced()) return true; } @@ -234,7 +234,7 @@ ModuleDepGraph::Changes ModuleDepGraph::integrate(const SourceFileDepGraph &g, FrontendStatsTracer tracer(stats, "fine-grained-dependencies-integrate"); // When done, disappearedNodes contains the nodes which no longer exist. - auto disappearedNodes = nodeMap[swiftDepsOfJob]; + auto disappearedNodes = nodeMap[swiftDepsOfJob.str()]; // When done, changeDependencyKeys contains a list of keys that changed // as a result of this integration. // Or if the integration failed, None. @@ -290,7 +290,7 @@ ModuleDepGraph::PreexistingNodeIfAny ModuleDepGraph::findPreexistingMatch( } if (integrand->getIsProvides()) { const auto &preexistingNodeInPlaceIter = - matches->find(swiftDepsOfCompilationToBeIntegrated); + matches->find(swiftDepsOfCompilationToBeIntegrated.str()); if (preexistingNodeInPlaceIter != matches->end()) return std::make_pair(LocationOfPreexistingNode::here, preexistingNodeInPlaceIter->second); @@ -386,7 +386,7 @@ bool ModuleDepGraph::recordWhatUseDependsUpon( usesByDef[def->getKey()].insert(moduleUseNode).second; if (isNewUse && def->getKey().getKind() == NodeKind::externalDepend) { StringRef externalSwiftDeps = def->getKey().getName(); - externalDependencies.insert(externalSwiftDeps); + externalDependencies.insert(externalSwiftDeps.str()); useHasNewExternalDependency = true; } }); @@ -430,7 +430,7 @@ void ModuleDepGraph::forCorrespondingImplementationOfProvidedInterface( const auto &interfaceKey = interfaceNode->getKey(); const DependencyKey implementationKey( interfaceKey.getKind(), DeclAspect::implementation, - interfaceKey.getContext(), interfaceKey.getName()); + interfaceKey.getContext().str(), interfaceKey.getName().str()); if (const auto implementationNode = nodeMap.find(swiftDeps, implementationKey)) fn(implementationNode.getValue()); @@ -461,7 +461,7 @@ void ModuleDepGraph::forEachArc( void ModuleDepGraph::forEachNodeInJob( StringRef swiftDeps, function_ref fn) const { - if (const auto *nodesByKeys = nodeMap.find(swiftDeps).getPtrOrNull()) { + if (const auto *nodesByKeys = nodeMap.find(swiftDeps.str()).getPtrOrNull()) { for (const auto &keyAndNode : *nodesByKeys) fn(keyAndNode.second); } @@ -530,7 +530,7 @@ void ModuleDepGraph::emitDotFileForJob(DiagnosticEngine &diags, } void ModuleDepGraph::emitDotFile(DiagnosticEngine &diags, StringRef baseName) { - unsigned seqNo = dotFileSequenceNumber[baseName]++; + unsigned seqNo = dotFileSequenceNumber[baseName.str()]++; std::string fullName = baseName.str() + "-post-integration." + std::to_string(seqNo) + ".dot"; withOutputFile(diags, fullName, [&](llvm::raw_ostream &out) { @@ -636,7 +636,7 @@ void ModuleDepGraph::verifyNodeIsInRightEntryInNodeMap( void ModuleDepGraph::verifyExternalDependencyUniqueness( const DependencyKey &key) const { assert((key.getKind() != NodeKind::externalDepend || - externalDependencies.count(key.getName()) == 1) && + externalDependencies.count(key.getName().str()) == 1) && "Ensure each external dependency is tracked exactly once"); } From 487fbddfdb10967ad87aab310b1180b26911277c Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Fri, 21 Feb 2020 13:07:51 +0100 Subject: [PATCH 020/222] Fix compilation error after removal of implicit StringRef -> std::string conversion --- lib/AST/FrontendSourceFileDepGraphFactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/AST/FrontendSourceFileDepGraphFactory.cpp b/lib/AST/FrontendSourceFileDepGraphFactory.cpp index 0ccb1e9d27f24..eabbbe319d27f 100644 --- a/lib/AST/FrontendSourceFileDepGraphFactory.cpp +++ b/lib/AST/FrontendSourceFileDepGraphFactory.cpp @@ -688,7 +688,7 @@ class UsedDeclEnumerator { std::string context = DependencyKey::computeContextForProvidedEntity( nominal); - std::string name = rawName.userFacingName(); + std::string name = rawName.userFacingName().str(); enumerateUse(NodeKind::member, context, name, isCascadingUse); } } From ea4204244ccfea2133973d6531282d7a48675595 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 3 Mar 2020 12:33:57 -0800 Subject: [PATCH 021/222] Adjust for LLVM commit 21390eab4c05 SCCIterator::hasLoop was renamed SCCIterator::hasCycle --- lib/SILOptimizer/IPO/GlobalOpt.cpp | 2 +- lib/SILOptimizer/Transforms/AccessEnforcementOpts.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/SILOptimizer/IPO/GlobalOpt.cpp b/lib/SILOptimizer/IPO/GlobalOpt.cpp index b338a12522244..54a7fdcfeef06 100644 --- a/lib/SILOptimizer/IPO/GlobalOpt.cpp +++ b/lib/SILOptimizer/IPO/GlobalOpt.cpp @@ -284,7 +284,7 @@ bool SILGlobalOpt::isInLoop(SILBasicBlock *CurBB) { if (LoopCheckedFunctions.insert(F).second) { for (auto I = scc_begin(F); !I.isAtEnd(); ++I) { - if (I.hasLoop()) + if (I.hasCycle()) for (SILBasicBlock *BB : *I) LoopBlocks.insert(BB); } diff --git a/lib/SILOptimizer/Transforms/AccessEnforcementOpts.cpp b/lib/SILOptimizer/Transforms/AccessEnforcementOpts.cpp index 8aadfb4ce1f93..bf6e4a5f0743c 100644 --- a/lib/SILOptimizer/Transforms/AccessEnforcementOpts.cpp +++ b/lib/SILOptimizer/Transforms/AccessEnforcementOpts.cpp @@ -1020,7 +1020,7 @@ static bool mergeAccesses( info.id = 0; for (auto sccIt = scc_begin(F); !sccIt.isAtEnd(); ++sccIt) { ++info.id; - info.hasLoop = sccIt.hasLoop(); + info.hasLoop = sccIt.hasCycle(); for (auto *bb : *sccIt) { blockToSCCMap.insert(std::make_pair(bb, info)); } From 17b25bad5de1890a89726fa478cd881f2c340413 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 3 Mar 2020 12:36:09 -0800 Subject: [PATCH 022/222] Include clang SourceManager header where needed These files were using clang::SourceManager with only a forward declaration. Most likely another header was previously including the SourceManager header so that these files got the header included transitively. --- lib/AST/ASTPrinter.cpp | 1 + lib/IDE/SwiftSourceDocInfo.cpp | 1 + lib/PrintAsObjC/DeclAndTypePrinter.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index 060e51630fe59..74dcd70486fdc 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -46,6 +46,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/DeclObjC.h" #include "clang/Basic/Module.h" +#include "clang/Basic/SourceManager.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ConvertUTF.h" diff --git a/lib/IDE/SwiftSourceDocInfo.cpp b/lib/IDE/SwiftSourceDocInfo.cpp index a60e6ab70e276..5b48f6499153f 100644 --- a/lib/IDE/SwiftSourceDocInfo.cpp +++ b/lib/IDE/SwiftSourceDocInfo.cpp @@ -24,6 +24,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" #include "clang/Basic/Module.h" +#include "clang/Basic/SourceManager.h" #include "clang/Index/USRGeneration.h" #include "clang/Lex/Lexer.h" #include "clang/Basic/CharInfo.h" diff --git a/lib/PrintAsObjC/DeclAndTypePrinter.cpp b/lib/PrintAsObjC/DeclAndTypePrinter.cpp index 0b609510f66c7..6b0e8154940a0 100644 --- a/lib/PrintAsObjC/DeclAndTypePrinter.cpp +++ b/lib/PrintAsObjC/DeclAndTypePrinter.cpp @@ -32,6 +32,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/DeclObjC.h" #include "clang/Basic/CharInfo.h" +#include "clang/Basic/SourceManager.h" using namespace swift; using namespace swift::objc_translation; From 030f70b7034e0ef72ece702e8c7ead7b82e00ef7 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 3 Mar 2020 12:38:47 -0800 Subject: [PATCH 023/222] Include llvm Debug header where used Most likely another header was including the header so TypeLayout.h got it transitively. --- lib/IRGen/TypeLayout.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/IRGen/TypeLayout.h b/lib/IRGen/TypeLayout.h index 04543d146190d..0427b31475521 100644 --- a/lib/IRGen/TypeLayout.h +++ b/lib/IRGen/TypeLayout.h @@ -16,6 +16,7 @@ #include "TypeInfo.h" #include "swift/SIL/SILType.h" #include "llvm/ADT/FoldingSet.h" +#include "llvm/Support/Debug.h" namespace swift { namespace irgen { From 69ae40eada1401f12cee3083930ebc9024642c20 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 3 Mar 2020 12:39:50 -0800 Subject: [PATCH 024/222] Include llvm StringMap header where used Most likely another header was previously including StringMap.h so FrontendInputsAndOutputs.h got it transitively. --- include/swift/Frontend/FrontendInputsAndOutputs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/swift/Frontend/FrontendInputsAndOutputs.h b/include/swift/Frontend/FrontendInputsAndOutputs.h index b1bbeb0129457..aee55c70b3104 100644 --- a/include/swift/Frontend/FrontendInputsAndOutputs.h +++ b/include/swift/Frontend/FrontendInputsAndOutputs.h @@ -18,6 +18,7 @@ #include "swift/Frontend/InputFile.h" #include "llvm/ADT/Hashing.h" #include "llvm/ADT/MapVector.h" +#include "llvm/ADT/StringMap.h" #include #include From 4a004de39da438fc0103ff86350b8f9f259df286 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 3 Mar 2020 12:40:54 -0800 Subject: [PATCH 025/222] Include llvm Error header where used Most likely another header was including Error.h so SimpleRequest.h got the header transitively. --- include/swift/AST/SimpleRequest.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/swift/AST/SimpleRequest.h b/include/swift/AST/SimpleRequest.h index 018163f541630..6058c38b3a6ba 100644 --- a/include/swift/AST/SimpleRequest.h +++ b/include/swift/AST/SimpleRequest.h @@ -24,6 +24,7 @@ #include "swift/Basic/TypeID.h" #include "llvm/ADT/Hashing.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/Support/Error.h" #include #include From 9c99dd39d563cb47519f6be16375ff1da6e2628f Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 3 Mar 2020 12:41:43 -0800 Subject: [PATCH 026/222] Include llvm PointerLikeTypeTraits header where used Most likely another header was including this so SILNode.h was getting the header transitively. --- include/swift/SIL/SILNode.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/swift/SIL/SILNode.h b/include/swift/SIL/SILNode.h index c5820ef1e59b9..70f77db7ff815 100644 --- a/include/swift/SIL/SILNode.h +++ b/include/swift/SIL/SILNode.h @@ -19,6 +19,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/ADT/DenseMapInfo.h" +#include "llvm/Support/PointerLikeTypeTraits.h" #include "swift/Basic/InlineBitfield.h" #include "swift/Basic/LLVM.h" #include From ef9ecd87b43f520d0a545c5d7a9721cc08cdc3b4 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 3 Mar 2020 12:42:42 -0800 Subject: [PATCH 027/222] More explicit StringRef to std::string conversions --- lib/AST/ReferencedNameTracker.cpp | 2 +- lib/Frontend/PrintingDiagnosticConsumer.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/AST/ReferencedNameTracker.cpp b/lib/AST/ReferencedNameTracker.cpp index 74494ae53f8f6..8bd4922802f4b 100644 --- a/lib/AST/ReferencedNameTracker.cpp +++ b/lib/AST/ReferencedNameTracker.cpp @@ -136,7 +136,7 @@ void ReferencedNameTracker::enumerateMemberUses( std::string context = DependencyKey::computeContextForProvidedEntity( nominal); - std::string name = rawName.userFacingName(); + std::string name = std::string(rawName.userFacingName()); enumerateUsedDecl(NodeKind::member, context, name, isCascadingUse); } } diff --git a/lib/Frontend/PrintingDiagnosticConsumer.cpp b/lib/Frontend/PrintingDiagnosticConsumer.cpp index 929b5b13d166a..0aeb195247e32 100644 --- a/lib/Frontend/PrintingDiagnosticConsumer.cpp +++ b/lib/Frontend/PrintingDiagnosticConsumer.cpp @@ -254,7 +254,7 @@ namespace { void addMessage(SourceManager &SM, SourceLoc Loc, DiagnosticKind Kind, StringRef Message) { - Messages.push_back({lineByteOffsetForLoc(SM, Loc), Kind, Message}); + Messages.push_back({lineByteOffsetForLoc(SM, Loc), Kind, std::string(Message)}); } void addHighlight(SourceManager &SM, CharSourceRange Range) { @@ -264,7 +264,7 @@ namespace { void addFixIt(SourceManager &SM, CharSourceRange Range, StringRef Text) { FixIts.push_back({lineByteOffsetForLoc(SM, Range.getStart()), - lineByteOffsetForLoc(SM, Range.getEnd()), Text}); + lineByteOffsetForLoc(SM, Range.getEnd()), std::string(Text)}); } void render(unsigned LineNumberIndent, raw_ostream &Out) { From a489c40fd7c3dd52c140c9f4d3d5858fbcc25838 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 3 Mar 2020 12:44:50 -0800 Subject: [PATCH 028/222] Adjust for LLVM commit dd1ea9de2e3e3 --- lib/IRGen/GenCoverage.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/IRGen/GenCoverage.cpp b/lib/IRGen/GenCoverage.cpp index 239e507177074..12dbdfb718c0d 100644 --- a/lib/IRGen/GenCoverage.cpp +++ b/lib/IRGen/GenCoverage.cpp @@ -145,6 +145,7 @@ void IRGenModule::emitCoverageMapping() { auto *RecordsVal = llvm::ConstantArray::get(RecordsTy, FunctionRecords); // Create the coverage data header. + const unsigned NRecords = 0; llvm::Type *CovDataHeaderTypes[] = { #define COVMAP_HEADER(Type, LLVMType, Name, Init) LLVMType, #include "llvm/ProfileData/InstrProfData.inc" From 224c612fc01677a01aaf5846189a5cfd5de472b0 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 3 Mar 2020 14:14:59 -0800 Subject: [PATCH 029/222] Follow-up change to PR30186 `std::string(...)` -> `.str()` --- lib/AST/ReferencedNameTracker.cpp | 2 +- lib/Frontend/PrintingDiagnosticConsumer.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/AST/ReferencedNameTracker.cpp b/lib/AST/ReferencedNameTracker.cpp index 8bd4922802f4b..601a69710f691 100644 --- a/lib/AST/ReferencedNameTracker.cpp +++ b/lib/AST/ReferencedNameTracker.cpp @@ -136,7 +136,7 @@ void ReferencedNameTracker::enumerateMemberUses( std::string context = DependencyKey::computeContextForProvidedEntity( nominal); - std::string name = std::string(rawName.userFacingName()); + std::string name = rawName.userFacingName().str(); enumerateUsedDecl(NodeKind::member, context, name, isCascadingUse); } } diff --git a/lib/Frontend/PrintingDiagnosticConsumer.cpp b/lib/Frontend/PrintingDiagnosticConsumer.cpp index 0aeb195247e32..2bf880ab6039c 100644 --- a/lib/Frontend/PrintingDiagnosticConsumer.cpp +++ b/lib/Frontend/PrintingDiagnosticConsumer.cpp @@ -254,7 +254,7 @@ namespace { void addMessage(SourceManager &SM, SourceLoc Loc, DiagnosticKind Kind, StringRef Message) { - Messages.push_back({lineByteOffsetForLoc(SM, Loc), Kind, std::string(Message)}); + Messages.push_back({lineByteOffsetForLoc(SM, Loc), Kind, Message.str()}); } void addHighlight(SourceManager &SM, CharSourceRange Range) { @@ -264,7 +264,7 @@ namespace { void addFixIt(SourceManager &SM, CharSourceRange Range, StringRef Text) { FixIts.push_back({lineByteOffsetForLoc(SM, Range.getStart()), - lineByteOffsetForLoc(SM, Range.getEnd()), std::string(Text)}); + lineByteOffsetForLoc(SM, Range.getEnd()), Text.str()}); } void render(unsigned LineNumberIndent, raw_ostream &Out) { From 61f4c32bc89f48f97339e95de3b8f9176e6268d2 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Tue, 3 Mar 2020 14:58:20 -0800 Subject: [PATCH 030/222] [Coverage] Port GenCoverage to the new format Totally untested, as tests are not really close to building on master-next at the moment. --- lib/IRGen/GenCoverage.cpp | 144 ++++++++++++++++++-------------------- 1 file changed, 70 insertions(+), 74 deletions(-) diff --git a/lib/IRGen/GenCoverage.cpp b/lib/IRGen/GenCoverage.cpp index 12dbdfb718c0d..93432458d897c 100644 --- a/lib/IRGen/GenCoverage.cpp +++ b/lib/IRGen/GenCoverage.cpp @@ -22,19 +22,23 @@ #include "llvm/IR/Constants.h" #include "llvm/IR/Module.h" #include "llvm/IR/Type.h" -#include "llvm/ProfileData/InstrProf.h" #include "llvm/ProfileData/Coverage/CoverageMappingWriter.h" +#include "llvm/ProfileData/InstrProf.h" #include "llvm/Support/FileSystem.h" +// This selects the coverage mapping format defined when `InstrProfData.inc` +// is textually included. +#define COVMAP_V3 + using namespace swift; using namespace irgen; -using llvm::coverage::CovMapVersion; using llvm::coverage::CounterMappingRegion; +using llvm::coverage::CovMapVersion; -static std::string getCoverageSection(IRGenModule &IGM) { - return llvm::getInstrProfSectionName(llvm::IPSK_covmap, - IGM.Triple.getObjectFormat()); +static std::string getInstrProfSection(IRGenModule &IGM, + llvm::InstrProfSectKind SK) { + return llvm::getInstrProfSectionName(SK, IGM.Triple.getObjectFormat()); } void IRGenModule::emitCoverageMapping() { @@ -61,8 +65,6 @@ void IRGenModule::emitCoverageMapping() { Files.push_back(M->getFile()); // Awkwardly munge absolute filenames into a vector of StringRefs. - // TODO: This is heinous - the same thing is happening in clang, but the API - // really needs to be cleaned up for both. llvm::SmallVector FilenameStrs; llvm::SmallVector FilenameRefs; for (StringRef Name : Files) { @@ -72,33 +74,31 @@ void IRGenModule::emitCoverageMapping() { FilenameRefs.push_back(FilenameStrs.back()); } - // Encode the filenames first. - std::string FilenamesAndCoverageMappings; - llvm::raw_string_ostream OS(FilenamesAndCoverageMappings); - llvm::coverage::CoverageFilenamesSectionWriter(FilenameRefs).write(OS); - size_t FilenamesSize = OS.str().size(); - size_t CurrentSize, PrevSize = FilenamesSize; - - // Now we need to build up the list of function records. + // Encode the filenames. + std::string Filenames; llvm::LLVMContext &Ctx = LLVMContext; - auto *Int32Ty = llvm::Type::getInt32Ty(Ctx); + { + llvm::raw_string_ostream OS(Filenames); + llvm::coverage::CoverageFilenamesSectionWriter(FilenameRefs).write(OS); + } + auto *FilenamesVal = + llvm::ConstantDataArray::getString(Ctx, Filenames, false); + const int64_t FilenamesRef = llvm::IndexedInstrProf::ComputeHash(Filenames); + const size_t FilenamesSize = Filenames.size(); - llvm::Type *FunctionRecordTypes[] = { -#define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) LLVMType, -#include "llvm/ProfileData/InstrProfData.inc" -#undef COVMAP_FUNC_RECORD - }; + // Emit the function records. + auto *Int32Ty = llvm::Type::getInt32Ty(Ctx); + for (const auto &M : Mappings) { + StringRef NameValue = M->getPGOFuncName(); + assert(!NameValue.empty() && "Expected a named record"); + uint64_t FuncHash = M->getHash(); - auto FunctionRecordTy = - llvm::StructType::get(Ctx, llvm::makeArrayRef(FunctionRecordTypes), - /*isPacked=*/true); + const uint64_t NameHash = llvm::IndexedInstrProf::ComputeHash(NameValue); + std::string FuncRecordName = "__covrec_" + llvm::utohexstr(NameHash); - std::vector FunctionRecords; - std::vector Regions; - for (const auto &M : Mappings) { unsigned FileID = std::find(Files.begin(), Files.end(), M->getFile()) - Files.begin(); - Regions.clear(); + std::vector Regions; for (const auto &MR : M->getMappedRegions()) Regions.emplace_back(CounterMappingRegion::makeRegion( MR.Counter, /*FileID=*/0, MR.StartLine, MR.StartCol, MR.EndLine, @@ -107,74 +107,70 @@ void IRGenModule::emitCoverageMapping() { ArrayRef VirtualFileMapping(FileID); llvm::coverage::CoverageMappingWriter W(VirtualFileMapping, M->getExpressions(), Regions); - W.write(OS); - - CurrentSize = OS.str().size(); - unsigned MappingLen = CurrentSize - PrevSize; - StringRef CoverageMapping(OS.str().c_str() + PrevSize, MappingLen); + std::string CoverageMapping; + { + llvm::raw_string_ostream OS(CoverageMapping); + W.write(OS); + } - StringRef NameValue = M->getPGOFuncName(); - assert(!NameValue.empty() && "Expected a named record"); - uint64_t FuncHash = M->getHash(); +#define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) LLVMType, + llvm::Type *FunctionRecordTypes[] = { +#include "llvm/ProfileData/InstrProfData.inc" + }; + auto *FunctionRecordTy = + llvm::StructType::get(Ctx, makeArrayRef(FunctionRecordTypes), + /*isPacked=*/true); - // Create a record for this function. - llvm::Constant *FunctionRecordVals[] = { + // Create the function record constant. #define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) Init, + llvm::Constant *FunctionRecordVals[] = { #include "llvm/ProfileData/InstrProfData.inc" -#undef COVMAP_FUNC_RECORD }; - - FunctionRecords.push_back(llvm::ConstantStruct::get( - FunctionRecordTy, makeArrayRef(FunctionRecordVals))); - PrevSize = CurrentSize; - } - size_t CoverageMappingSize = PrevSize - FilenamesSize; - - // Append extra zeroes if necessary to ensure that the size of the filenames - // and coverage mappings is a multiple of 8. - if (size_t Rem = OS.str().size() % 8) { - CoverageMappingSize += 8 - Rem; - for (size_t I = 0, S = 8 - Rem; I < S; ++I) - OS << '\0'; + auto *FuncRecordConstant = llvm::ConstantStruct::get( + FunctionRecordTy, makeArrayRef(FunctionRecordVals)); + + // Create the function record global. + auto *FuncRecord = new llvm::GlobalVariable( + *getModule(), FunctionRecordTy, /*isConstant=*/true, + llvm::GlobalValue::LinkOnceODRLinkage, FuncRecordConstant, + FuncRecordName); + FuncRecord->setVisibility(llvm::GlobalValue::HiddenVisibility); + FuncRecord->setSection(getInstrProfSection(*this, llvm::IPSK_covfun)); + FuncRecord->setAlignment(llvm::Align(8)); + if (Triple.supportsCOMDAT()) + FuncRecord->setComdat(getModule()->getOrInsertComdat(FuncRecordName)); + + // Make sure the data doesn't get deleted. + addUsedGlobal(FuncRecord); } - auto *FilenamesAndMappingsVal = - llvm::ConstantDataArray::getString(Ctx, OS.str(), false); - - auto *RecordsTy = - llvm::ArrayType::get(FunctionRecordTy, FunctionRecords.size()); - auto *RecordsVal = llvm::ConstantArray::get(RecordsTy, FunctionRecords); // Create the coverage data header. const unsigned NRecords = 0; + const unsigned CoverageMappingSize = 0; llvm::Type *CovDataHeaderTypes[] = { #define COVMAP_HEADER(Type, LLVMType, Name, Init) LLVMType, #include "llvm/ProfileData/InstrProfData.inc" -#undef COVMAP_HEADER }; - auto *CovDataHeaderTy = + auto CovDataHeaderTy = llvm::StructType::get(Ctx, makeArrayRef(CovDataHeaderTypes)); llvm::Constant *CovDataHeaderVals[] = { #define COVMAP_HEADER(Type, LLVMType, Name, Init) Init, #include "llvm/ProfileData/InstrProfData.inc" -#undef COVMAP_HEADER }; - auto *CovDataHeaderVal = llvm::ConstantStruct::get( + auto CovDataHeaderVal = llvm::ConstantStruct::get( CovDataHeaderTy, makeArrayRef(CovDataHeaderVals)); - // Combine the header, function records, and mappings together. - llvm::Type *CovDataTypes[] = {CovDataHeaderTy, RecordsTy, - FilenamesAndMappingsVal->getType()}; - auto *CovDataTy = llvm::StructType::get(Ctx, makeArrayRef(CovDataTypes)); - llvm::Constant *TUDataVals[] = {CovDataHeaderVal, RecordsVal, - FilenamesAndMappingsVal}; - auto *CovDataVal = + // Create the coverage data record + llvm::Type *CovDataTypes[] = {CovDataHeaderTy, FilenamesVal->getType()}; + auto CovDataTy = llvm::StructType::get(Ctx, makeArrayRef(CovDataTypes)); + llvm::Constant *TUDataVals[] = {CovDataHeaderVal, FilenamesVal}; + auto CovDataVal = llvm::ConstantStruct::get(CovDataTy, makeArrayRef(TUDataVals)); - auto CovData = new llvm::GlobalVariable( - *getModule(), CovDataTy, true, llvm::GlobalValue::InternalLinkage, + *getModule(), CovDataTy, true, llvm::GlobalValue::PrivateLinkage, CovDataVal, llvm::getCoverageMappingVarName()); - std::string CovSection = getCoverageSection(*this); - CovData->setSection(CovSection); - CovData->setAlignment(llvm::MaybeAlign(8)); + + CovData->setSection(getInstrProfSection(*this, llvm::IPSK_covmap)); + CovData->setAlignment(llvm::Align(8)); addUsedGlobal(CovData); } From b29f7cd2c10e9ddc4abe4b1fb587a97bc6d65c98 Mon Sep 17 00:00:00 2001 From: Michael Forster Date: Wed, 4 Mar 2020 14:43:49 +0100 Subject: [PATCH 031/222] Fix build breaks for master-next against llvm.org. StringRef conversion to std::string needs to be explicit now. --- unittests/Basic/PrefixMapTest.cpp | 4 ++-- unittests/ClangImporter/ClangImporterTests.cpp | 2 +- unittests/FrontendTool/ModuleLoadingTests.cpp | 2 +- unittests/IDE/Placeholders.cpp | 4 ++-- unittests/SourceKit/SwiftLang/CursorInfoTest.cpp | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/unittests/Basic/PrefixMapTest.cpp b/unittests/Basic/PrefixMapTest.cpp index 75b0dcdee0db6..aea324e273391 100644 --- a/unittests/Basic/PrefixMapTest.cpp +++ b/unittests/Basic/PrefixMapTest.cpp @@ -40,7 +40,7 @@ struct Tester { // Performs an insert operation and tests that the result matches what // we get from the std::map. void insert(StringRef key, int value) { - auto stdmapResult = StdMap.insert({key, value}); + auto stdmapResult = StdMap.insert({key.str(), value}); auto premapResult = PreMap.insert(asArray(key), value); // Whether or not we modified the map should be the same in both @@ -57,7 +57,7 @@ struct Tester { // Tests that the result of a findPrefix matches what we expect from // the std::map. void find(StringRef key) { - auto stdmapResult = StdMap.lower_bound(key); + auto stdmapResult = StdMap.lower_bound(key.str()); while (stdmapResult == StdMap.end() || !key.startswith(stdmapResult->first)) { if (stdmapResult == StdMap.begin()) { diff --git a/unittests/ClangImporter/ClangImporterTests.cpp b/unittests/ClangImporter/ClangImporterTests.cpp index 94d021452a1c1..e353fba57745f 100644 --- a/unittests/ClangImporter/ClangImporterTests.cpp +++ b/unittests/ClangImporter/ClangImporterTests.cpp @@ -25,7 +25,7 @@ static bool emitFileWithContents(StringRef path, StringRef contents, if (llvm::sys::fs::openFileForWrite(path, FD)) return true; if (pathOut) - *pathOut = path; + *pathOut = path.str(); llvm::raw_fd_ostream file(FD, /*shouldClose=*/true); file << contents; return false; diff --git a/unittests/FrontendTool/ModuleLoadingTests.cpp b/unittests/FrontendTool/ModuleLoadingTests.cpp index 0ad89a65878b5..7e343aaeeeab1 100644 --- a/unittests/FrontendTool/ModuleLoadingTests.cpp +++ b/unittests/FrontendTool/ModuleLoadingTests.cpp @@ -33,7 +33,7 @@ static bool emitFileWithContents(StringRef path, StringRef contents, if (llvm::sys::fs::openFileForWrite(path, fd)) return true; if (pathOut) - *pathOut = path; + *pathOut = path.str(); llvm::raw_fd_ostream file(fd, /*shouldClose=*/true); file << contents; return false; diff --git a/unittests/IDE/Placeholders.cpp b/unittests/IDE/Placeholders.cpp index b7ad0efdb458c..8e7913cc67f35 100644 --- a/unittests/IDE/Placeholders.cpp +++ b/unittests/IDE/Placeholders.cpp @@ -11,7 +11,7 @@ static std::string replaceFromString(const std::string &S, auto Buf = llvm::MemoryBuffer::getMemBufferCopy(S, ""); Buf = ide::replacePlaceholders(std::move(Buf), HadPH); - return Buf->getBuffer(); + return Buf->getBuffer().str(); } TEST(Placeholders, Replace) { @@ -83,6 +83,6 @@ TEST(Placeholders, TooShort) { Source += "<##>\n"; } std::string Out = replaceFromString(Source); - std::string Last = StringRef(Out).substr(Out.size()-15); + std::string Last(StringRef(Out).substr(Out.size()-15)); EXPECT_EQ("$_99\n$___\n$___\n", Last); } diff --git a/unittests/SourceKit/SwiftLang/CursorInfoTest.cpp b/unittests/SourceKit/SwiftLang/CursorInfoTest.cpp index 193c8fcd4fad9..2a6841ab7d97a 100644 --- a/unittests/SourceKit/SwiftLang/CursorInfoTest.cpp +++ b/unittests/SourceKit/SwiftLang/CursorInfoTest.cpp @@ -151,14 +151,14 @@ class CursorInfoTest : public ::testing::Test { [&](const RequestResult &Result) { assert(!Result.isCancelled()); if (Result.isError()) { - TestInfo.Error = Result.getError(); + TestInfo.Error = Result.getError().str(); sema.signal(); return; } const CursorInfoData &Info = Result.value(); - TestInfo.Name = Info.Name; - TestInfo.Typename = Info.TypeName; - TestInfo.Filename = Info.Filename; + TestInfo.Name = Info.Name.str(); + TestInfo.Typename = Info.TypeName.str(); + TestInfo.Filename = Info.Filename.str(); TestInfo.DeclarationLoc = Info.DeclarationLoc; sema.signal(); }); From 8c2aeb387cead9a6b0f4dda7e804713a58846329 Mon Sep 17 00:00:00 2001 From: Brent Royal-Gordon Date: Fri, 6 Mar 2020 13:51:15 -0800 Subject: [PATCH 032/222] Patch up runConstructors() change in Immediate.cpp --- lib/Immediate/Immediate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Immediate/Immediate.cpp b/lib/Immediate/Immediate.cpp index 964cf561f4674..ba1025563c6e3 100644 --- a/lib/Immediate/Immediate.cpp +++ b/lib/Immediate/Immediate.cpp @@ -350,7 +350,7 @@ int swift::RunImmediately(CompilerInstance &CI, using MainFnTy = int(*)(int, char*[]); - if (auto Err = JIT->runConstructors()) { + if (auto Err = JIT->initialize(JIT->getMainJITDylib())) { llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), ""); return -1; } @@ -364,7 +364,7 @@ int swift::RunImmediately(CompilerInstance &CI, } LLVM_DEBUG(llvm::dbgs() << "Running static constructors\n"); - if (auto Err = JIT->runConstructors()) { + if (auto Err = JIT->initialize(JIT->getMainJITDylib())) { logAllUnhandledErrors(std::move(Err), llvm::errs(), ""); return -1; } From 5da2adb6b1b823a5ca3ea0ae7b28c1783e9c6f22 Mon Sep 17 00:00:00 2001 From: Rintaro Ishizaki Date: Tue, 10 Mar 2020 10:11:55 -0700 Subject: [PATCH 033/222] Disable SourceKit/CursorInfo/use-swift-source-info.swift rdar://60096971 --- test/SourceKit/CursorInfo/use-swift-source-info.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/SourceKit/CursorInfo/use-swift-source-info.swift b/test/SourceKit/CursorInfo/use-swift-source-info.swift index 7f905f4cf52ca..a255c6f3dc8c1 100644 --- a/test/SourceKit/CursorInfo/use-swift-source-info.swift +++ b/test/SourceKit/CursorInfo/use-swift-source-info.swift @@ -3,6 +3,8 @@ func bar() { foo() } +// FIXME: Rmove XFAIL rdar://problem/60096971 +// XFAIL: * // RUN: %empty-directory(%t) // RUN: echo "/// Some doc" >> %t/Foo.swift // RUN: echo "public func foo() { }" >> %t/Foo.swift From 1bd6a0a3719a5fe7cfb9f7611e443895cfab0bf9 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 11 Mar 2020 15:45:25 -0700 Subject: [PATCH 034/222] Adapt to upstream header file reshuffling in c915cb957dc37275ce1ca1a0b993239c82f12692. --- include/swift/ClangImporter/ClangModule.h | 6 +++--- lib/ClangImporter/ClangImporter.cpp | 2 +- lib/IRGen/IRGenDebugInfo.cpp | 2 +- lib/PrintAsObjC/ModuleContentsWriter.cpp | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/swift/ClangImporter/ClangModule.h b/include/swift/ClangImporter/ClangModule.h index 90cc2c97c9166..f1f15794a0c76 100644 --- a/include/swift/ClangImporter/ClangModule.h +++ b/include/swift/ClangImporter/ClangModule.h @@ -19,6 +19,7 @@ #include "swift/AST/FileUnit.h" #include "swift/ClangImporter/ClangImporter.h" #include "clang/AST/ExternalASTSource.h" +#include "clang/Basic/Module.h" namespace clang { class ASTContext; @@ -37,7 +38,7 @@ class ClangModuleUnit final : public LoadedFile { llvm::PointerIntPair overlayModule; mutable Optional> importedModulesForLookup; /// The metadata of the underlying Clang module. - clang::ExternalASTSource::ASTSourceDescriptor ASTSourceDescriptor; + clang::ASTSourceDescriptor ASTSourceDescriptor; public: /// True if the given Module contains an imported Clang module unit. @@ -115,8 +116,7 @@ class ClangModuleUnit final : public LoadedFile { /// Returns the ASTSourceDescriptor of the associated Clang module if one /// exists. - Optional - getASTSourceDescriptor() const; + Optional getASTSourceDescriptor() const; virtual StringRef getModuleDefiningPath() const override; diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index 4af873767bd1e..8c73c7cd89cb5 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -3316,7 +3316,7 @@ StringRef ClangModuleUnit::getModuleDefiningPath() const { return clangSourceMgr.getFilename(clangModule->DefinitionLoc); } -Optional +Optional ClangModuleUnit::getASTSourceDescriptor() const { if (clangModule) { assert(ASTSourceDescriptor.getModuleOrNull() == clangModule); diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 88e0907553f6c..85a3c2e03ab03 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -665,7 +665,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { return M; } - using ASTSourceDescriptor = clang::ExternalASTSource::ASTSourceDescriptor; + using ASTSourceDescriptor = clang::ASTSourceDescriptor; /// Create a DIModule from a clang module or PCH. /// The clang::Module pointer is passed separately because the recursive case /// needs to fudge the AST descriptor. diff --git a/lib/PrintAsObjC/ModuleContentsWriter.cpp b/lib/PrintAsObjC/ModuleContentsWriter.cpp index a1653028bfdc2..eaba01e51d901 100644 --- a/lib/PrintAsObjC/ModuleContentsWriter.cpp +++ b/lib/PrintAsObjC/ModuleContentsWriter.cpp @@ -22,6 +22,7 @@ #include "swift/ClangImporter/ClangImporter.h" #include "clang/AST/Decl.h" +#include "clang/Basic/Module.h" #include "llvm/Support/raw_ostream.h" From 41f76322d2687c114cff491461a0127467cea8d0 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 12 Mar 2020 10:23:47 -0700 Subject: [PATCH 035/222] Adapt to upstream header file reshuffling --- lib/AST/ClangTypeConverter.cpp | 1 + lib/ClangImporter/ImportDecl.cpp | 10 ++++++---- lib/FrontendTool/FrontendTool.cpp | 2 +- lib/IDE/Utils.cpp | 3 ++- lib/Sema/NameBinding.cpp | 1 + lib/Serialization/SerializedModuleLoader.cpp | 4 +++- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/AST/ClangTypeConverter.cpp b/lib/AST/ClangTypeConverter.cpp index aa141e1454ea9..a535950cf82bb 100644 --- a/lib/AST/ClangTypeConverter.cpp +++ b/lib/AST/ClangTypeConverter.cpp @@ -34,6 +34,7 @@ #include "swift/Basic/LLVM.h" #include "clang/AST/ASTContext.h" +#include "clang/Basic/TargetInfo.h" #include "clang/Sema/Sema.h" using namespace swift; diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index 21b1e5b3f074a..fbacdbe2c2fea 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -16,7 +16,6 @@ #include "CFTypeInfo.h" #include "ImporterImpl.h" -#include "swift/Strings.h" #include "swift/AST/ASTContext.h" #include "swift/AST/ASTMangler.h" #include "swift/AST/Attr.h" @@ -36,17 +35,20 @@ #include "swift/AST/PrettyStackTrace.h" #include "swift/AST/ProtocolConformance.h" #include "swift/AST/Stmt.h" -#include "swift/AST/Types.h" #include "swift/AST/TypeCheckRequests.h" +#include "swift/AST/Types.h" #include "swift/Basic/Defer.h" #include "swift/Basic/PrettyStackTrace.h" +#include "swift/Basic/Statistic.h" #include "swift/ClangImporter/ClangModule.h" -#include "swift/Parse/Lexer.h" #include "swift/Config.h" +#include "swift/Parse/Lexer.h" +#include "swift/Strings.h" + #include "clang/AST/ASTContext.h" #include "clang/AST/Attr.h" #include "clang/Basic/CharInfo.h" -#include "swift/Basic/Statistic.h" +#include "clang/Basic/TargetInfo.h" #include "clang/Lex/Preprocessor.h" #include "clang/Sema/Lookup.h" diff --git a/lib/FrontendTool/FrontendTool.cpp b/lib/FrontendTool/FrontendTool.cpp index 3186dd600aaae..54a2c0762d05d 100644 --- a/lib/FrontendTool/FrontendTool.cpp +++ b/lib/FrontendTool/FrontendTool.cpp @@ -1178,7 +1178,7 @@ static bool emitAnyWholeModulePostTypeCheckSupplementaryOutputs( llvm::SmallString<32> Buffer(*opts.BridgingHeaderDirForPrint); llvm::sys::path::append(Buffer, llvm::sys::path::filename(opts.ImplicitObjCHeaderPath)); - BridgingHeaderPathForPrint = Buffer.str(); + BridgingHeaderPathForPrint = (std::string)Buffer; } else { // By default, include the given bridging header path directly. BridgingHeaderPathForPrint = opts.ImplicitObjCHeaderPath; diff --git a/lib/IDE/Utils.cpp b/lib/IDE/Utils.cpp index 843dcf79bb9dd..58dd3a5969dff 100644 --- a/lib/IDE/Utils.cpp +++ b/lib/IDE/Utils.cpp @@ -19,12 +19,13 @@ #include "swift/Subsystems.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" +#include "clang/Basic/TargetOptions.h" #include "clang/CodeGen/ObjectFilePCHContainerOperations.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/TextDiagnosticBuffer.h" #include "clang/Lex/PreprocessorOptions.h" -#include "clang/Serialization/ASTReader.h" #include "clang/Rewrite/Core/RewriteBuffer.h" +#include "clang/Serialization/ASTReader.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/MemoryBuffer.h" diff --git a/lib/Sema/NameBinding.cpp b/lib/Sema/NameBinding.cpp index c699aaf0e7060..bc7f152a2b64e 100644 --- a/lib/Sema/NameBinding.cpp +++ b/lib/Sema/NameBinding.cpp @@ -33,6 +33,7 @@ #include "llvm/ADT/TinyPtrVector.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/Host.h" #include "llvm/Support/Path.h" #include "llvm/Support/SaveAndRestore.h" #include diff --git a/lib/Serialization/SerializedModuleLoader.cpp b/lib/Serialization/SerializedModuleLoader.cpp index 65eadf33e2c5e..3a93c663b889a 100644 --- a/lib/Serialization/SerializedModuleLoader.cpp +++ b/lib/Serialization/SerializedModuleLoader.cpp @@ -20,12 +20,14 @@ #include "swift/Basic/STLExtras.h" #include "swift/Basic/SourceManager.h" #include "swift/Basic/Version.h" + #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringSet.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/Host.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" -#include "llvm/Support/Debug.h" #include using namespace swift; From 2576ee91f3e7c6a6aa7ac783c2b87f124dbd07e5 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 12 Mar 2020 14:54:02 -0700 Subject: [PATCH 036/222] Add missing include --- unittests/AST/TestContext.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unittests/AST/TestContext.h b/unittests/AST/TestContext.h index 46aa8d985b62b..6736edef7dc0c 100644 --- a/unittests/AST/TestContext.h +++ b/unittests/AST/TestContext.h @@ -17,6 +17,8 @@ #include "swift/Basic/LangOptions.h" #include "swift/Basic/SourceManager.h" +#include "llvm/Support/Host.h" + namespace swift { namespace unittest { From 562afc6e97610eb8ca0420a7065805be1dd35048 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 12 Mar 2020 15:09:34 -0700 Subject: [PATCH 037/222] Update testcases for upstream changes. rdar://problem/60280545 --- test/DebugInfo/inlinescopes.swift | 8 ++++++-- test/DebugInfo/transparent.swift | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/DebugInfo/inlinescopes.swift b/test/DebugInfo/inlinescopes.swift index 6c4a3a4fefc3d..4b40340d49a28 100644 --- a/test/DebugInfo/inlinescopes.swift +++ b/test/DebugInfo/inlinescopes.swift @@ -6,13 +6,17 @@ // RUN: %FileCheck %s -check-prefix=TRANSPARENT-CHECK < %t.ll // CHECK: define{{( dllexport)?}}{{( protected)?( signext)?}} i32 @main{{.*}} -// CHECK: call swiftcc i64 @"$s4main8noinlineys5Int64VADF"(i64 %{{.*}}), !dbg ![[CALL:.*]] +// CHECK: call swiftcc i64 @"$s4main8noinlineys5Int64VADF"(i64 %{{.*}}) +// CHECK-SAME: !dbg ![[CALL:.*]] // CHECK-DAG: ![[TOPLEVEL:.*]] = !DIFile(filename: "{{.*}}inlinescopes.swift" import FooBar @inline(never) -func noinline(_ x: Int64) -> Int64 { return x } +func use(_ x: Int64) -> Int64 { return x } + +@inline(never) +func noinline(_ x: Int64) -> Int64 { return use(x) } @_transparent func transparent(_ x: Int64) -> Int64 { return noinline(x) } diff --git a/test/DebugInfo/transparent.swift b/test/DebugInfo/transparent.swift index 5bfd301c65ca6..b951b4a19e012 100644 --- a/test/DebugInfo/transparent.swift +++ b/test/DebugInfo/transparent.swift @@ -19,7 +19,6 @@ use(z) // CHECK-SAME: !dbg ![[SP:[0-9]+]] // CHECK-NEXT: entry: // CHECK-NEXT: !dbg ![[ZERO:[0-9]+]] -// CHECK-NEXT: !dbg ![[ZERO]] // CHECK-NEXT: } // CHECK: ![[FILE:[0-9]+]] = {{.*}}"" From 6fb3b15c17187294dc80793451050f0e87d6450c Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Fri, 13 Mar 2020 10:21:57 -0700 Subject: [PATCH 038/222] XFAIL two tests failing on master-next https://bugs.swift.org/browse/SR-12362 https://bugs.swift.org/browse/SR-12363 --- test/Driver/bad_tmpdir.swift | 3 +++ test/Serialization/load-target-normalization.swift | 3 +++ 2 files changed, 6 insertions(+) diff --git a/test/Driver/bad_tmpdir.swift b/test/Driver/bad_tmpdir.swift index bf0565ef89439..50be890aee355 100644 --- a/test/Driver/bad_tmpdir.swift +++ b/test/Driver/bad_tmpdir.swift @@ -6,6 +6,9 @@ // // REQUIRES: OS=macosx +// SR-12362: This test is failing on master-next. +// XFAIL: * + // RUN: env TMP="%t/fake/" TMPDIR="%t/fake/" not %target-build-swift -c -driver-filelist-threshold=0 %s 2>&1 | %FileCheck -check-prefix=CHECK-SOURCES %s // CHECK-SOURCES: - unable to create list of input sources diff --git a/test/Serialization/load-target-normalization.swift b/test/Serialization/load-target-normalization.swift index 21040c0c2aab8..d4b6301568122 100644 --- a/test/Serialization/load-target-normalization.swift +++ b/test/Serialization/load-target-normalization.swift @@ -1,6 +1,9 @@ // RUN: %empty-directory(%t/ForeignModule.swiftmodule) // RUN: touch %t/ForeignModule.swiftmodule/garbage-garbage-garbage.swiftmodule +// SR-12363: This test crashes on master-next. +// XFAIL: * + // Test format: We try to import ForeignModule with architectures besides // garbage-garbage-garbage and check the target triple listed in the error // message to make sure it was normalized correctly. This works in lieu of a From cc8653d86eb27abc1e0202bc6fb617c2443335e2 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Wed, 18 Mar 2020 16:19:34 -0700 Subject: [PATCH 039/222] Adjust to llvm change ac1d23ed7de01fb3a18b340536842a419b504d86 --- tools/swift-llvm-opt/LLVMOpt.cpp | 80 +++++++++++++++++--------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/tools/swift-llvm-opt/LLVMOpt.cpp b/tools/swift-llvm-opt/LLVMOpt.cpp index 900fe57e18364..e04693d64b177 100644 --- a/tools/swift-llvm-opt/LLVMOpt.cpp +++ b/tools/swift-llvm-opt/LLVMOpt.cpp @@ -37,7 +37,7 @@ #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Bitcode/BitcodeWriterPass.h" -#include "llvm/CodeGen/CommandFlags.inc" +#include "llvm/CodeGen/CommandFlags.h" #include "llvm/CodeGen/TargetPassConfig.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/DebugInfo.h" @@ -69,6 +69,8 @@ using namespace swift; +static llvm::codegen::RegisterCodeGenFlags CGF; + //===----------------------------------------------------------------------===// // Option Declarations //===----------------------------------------------------------------------===// @@ -97,19 +99,19 @@ static llvm::cl::opt PrintStats("print-stats", llvm::cl::desc("Should LLVM Statistics be printed")); -static cl::opt InputFilename(cl::Positional, - cl::desc(""), - cl::init("-"), - cl::value_desc("filename")); +static llvm::cl::opt InputFilename(llvm::cl::Positional, + llvm::cl::desc(""), + llvm::cl::init("-"), + llvm::cl::value_desc("filename")); -static cl::opt OutputFilename("o", - cl::desc("Override output filename"), - cl::value_desc("filename")); +static llvm::cl::opt + OutputFilename("o", llvm::cl::desc("Override output filename"), + llvm::cl::value_desc("filename")); -static cl::opt DefaultDataLayout( +static llvm::cl::opt DefaultDataLayout( "default-data-layout", - cl::desc("data layout string to use if not specified by module"), - cl::value_desc("layout-string"), cl::init("")); + llvm::cl::desc("data layout string to use if not specified by module"), + llvm::cl::value_desc("layout-string"), llvm::cl::init("")); //===----------------------------------------------------------------------===// // Helper Methods @@ -118,8 +120,8 @@ static cl::opt DefaultDataLayout( static llvm::CodeGenOpt::Level GetCodeGenOptLevel() { // TODO: Is this the right thing to do here? if (Optimized) - return CodeGenOpt::Default; - return CodeGenOpt::None; + return llvm::CodeGenOpt::Default; + return llvm::CodeGenOpt::None; } // Returns the TargetMachine instance or zero if no triple is provided. @@ -127,8 +129,8 @@ static llvm::TargetMachine * getTargetMachine(llvm::Triple TheTriple, StringRef CPUStr, StringRef FeaturesStr, const llvm::TargetOptions &Options) { std::string Error; - const auto *TheTarget = - llvm::TargetRegistry::lookupTarget(MArch, TheTriple, Error); + const auto *TheTarget = llvm::TargetRegistry::lookupTarget( + llvm::codegen::getMArch(), TheTriple, Error); // Some modules don't specify a triple, and this is okay. if (!TheTarget) { return nullptr; @@ -136,12 +138,13 @@ getTargetMachine(llvm::Triple TheTriple, StringRef CPUStr, return TheTarget->createTargetMachine( TheTriple.getTriple(), CPUStr, FeaturesStr, Options, - Optional(RelocModel), getCodeModel(), GetCodeGenOptLevel()); + Optional(llvm::codegen::getExplicitRelocModel()), + llvm::codegen::getExplicitCodeModel(), GetCodeGenOptLevel()); } static void dumpOutput(llvm::Module &M, llvm::raw_ostream &os) { // For now just always dump assembly. - legacy::PassManager EmitPasses; + llvm::legacy::PassManager EmitPasses; EmitPasses.add(createPrintModulePass(os)); EmitPasses.run(M); } @@ -153,11 +156,12 @@ static void dumpOutput(llvm::Module &M, llvm::raw_ostream &os) { // without being given the address of a function in the main executable). void anchorForGetMainExecutable() {} -static inline void addPass(legacy::PassManagerBase &PM, Pass *P) { +static inline void addPass(llvm::legacy::PassManagerBase &PM, llvm::Pass *P) { // Add the pass to the pass manager... PM.add(P); if (P->getPassID() == &SwiftAAWrapperPass::ID) { - PM.add(createExternalAAWrapperPass([](Pass &P, Function &, AAResults &AAR) { + PM.add(llvm::createExternalAAWrapperPass([](llvm::Pass &P, llvm::Function &, + llvm::AAResults &AAR) { if (auto *WrapperPass = P.getAnalysisIfAvailable()) AAR.addAAResult(WrapperPass->getResult()); })); @@ -165,7 +169,7 @@ static inline void addPass(legacy::PassManagerBase &PM, Pass *P) { // If we are verifying all of the intermediate steps, add the verifier... if (VerifyEach) - PM.add(createVerifierPass()); + PM.add(llvm::createVerifierPass()); } static void runSpecificPasses(StringRef Binary, llvm::Module *M, @@ -173,7 +177,7 @@ static void runSpecificPasses(StringRef Binary, llvm::Module *M, llvm::Triple &ModuleTriple) { llvm::legacy::PassManager Passes; llvm::TargetLibraryInfoImpl TLII(ModuleTriple); - Passes.add(new TargetLibraryInfoWrapperPass(TLII)); + Passes.add(new llvm::TargetLibraryInfoWrapperPass(TLII)); const llvm::DataLayout &DL = M->getDataLayout(); if (DL.isDefault() && !DefaultDataLayout.empty()) { @@ -181,13 +185,13 @@ static void runSpecificPasses(StringRef Binary, llvm::Module *M, } // Add internal analysis passes from the target machine. - Passes.add(createTargetTransformInfoWrapperPass(TM ? TM->getTargetIRAnalysis() - : TargetIRAnalysis())); + Passes.add(createTargetTransformInfoWrapperPass( + TM ? TM->getTargetIRAnalysis() : llvm::TargetIRAnalysis())); if (TM) { // FIXME: We should dyn_cast this when supported. - auto <M = static_cast(*TM); - Pass *TPC = LTM.createPassConfig(Passes); + auto <M = static_cast(*TM); + llvm::Pass *TPC = LTM.createPassConfig(Passes); Passes.add(TPC); } @@ -196,8 +200,9 @@ static void runSpecificPasses(StringRef Binary, llvm::Module *M, if (PassInfo->getNormalCtor()) P = PassInfo->getNormalCtor()(); else - errs() << Binary << ": cannot create pass: " << PassInfo->getPassName() - << "\n"; + llvm::errs() << Binary + << ": cannot create pass: " << PassInfo->getPassName() + << "\n"; if (P) { addPass(Passes, P); } @@ -216,7 +221,7 @@ int main(int argc, char **argv) { INITIALIZE_LLVM(); // Initialize passes - PassRegistry &Registry = *PassRegistry::getPassRegistry(); + llvm::PassRegistry &Registry = *llvm::PassRegistry::getPassRegistry(); initializeCore(Registry); initializeScalarOpts(Registry); initializeObjCARCOpts(Registry); @@ -252,16 +257,16 @@ int main(int argc, char **argv) { llvm::SMDiagnostic Err; // Load the input module... - std::unique_ptr M = + std::unique_ptr M = parseIRFile(InputFilename, Err, getGlobalLLVMContext()); if (!M) { - Err.print(argv[0], errs()); + Err.print(argv[0], llvm::errs()); return 1; } - if (verifyModule(*M, &errs())) { - errs() << argv[0] << ": " << InputFilename + if (verifyModule(*M, &llvm::errs())) { + llvm::errs() << argv[0] << ": " << InputFilename << ": error: input module is broken!\n"; return 1; } @@ -280,18 +285,19 @@ int main(int argc, char **argv) { Out.reset( new llvm::ToolOutputFile(OutputFilename, EC, llvm::sys::fs::F_None)); if (EC) { - errs() << EC.message() << '\n'; + llvm::errs() << EC.message() << '\n'; return 1; } llvm::Triple ModuleTriple(M->getTargetTriple()); std::string CPUStr, FeaturesStr; llvm::TargetMachine *Machine = nullptr; - const llvm::TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); + const llvm::TargetOptions Options = + llvm::codegen::InitTargetOptionsFromCodeGenFlags(); if (ModuleTriple.getArch()) { - CPUStr = getCPUStr(); - FeaturesStr = getFeaturesStr(); + CPUStr = llvm::codegen::getCPUStr(); + FeaturesStr = llvm::codegen::getFeaturesStr(); Machine = getTargetMachine(ModuleTriple, CPUStr, FeaturesStr, Options); } @@ -299,7 +305,7 @@ int main(int argc, char **argv) { // Override function attributes based on CPUStr, FeaturesStr, and command line // flags. - setFunctionAttributes(CPUStr, FeaturesStr, *M); + llvm::codegen::setFunctionAttributes(CPUStr, FeaturesStr, *M); if (Optimized) { IRGenOptions Opts; From 95d98249ce239c34f496b05222c6de814b8e98c8 Mon Sep 17 00:00:00 2001 From: Brent Royal-Gordon Date: Sun, 22 Mar 2020 18:04:04 -0700 Subject: [PATCH 040/222] Handle flaky SourceKit/CursorInfo/use-swift-source-info.swift This test was XFAILed on master-next in https://github.com/apple/swift/pull/30330, but it is now passing again. Change the XFAIL to a failing REQUIRES instead. --- test/SourceKit/CursorInfo/use-swift-source-info.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/SourceKit/CursorInfo/use-swift-source-info.swift b/test/SourceKit/CursorInfo/use-swift-source-info.swift index a255c6f3dc8c1..05a391ee5c8b6 100644 --- a/test/SourceKit/CursorInfo/use-swift-source-info.swift +++ b/test/SourceKit/CursorInfo/use-swift-source-info.swift @@ -3,8 +3,9 @@ func bar() { foo() } -// FIXME: Rmove XFAIL rdar://problem/60096971 -// XFAIL: * +// FIXME: Rmove REQUIRES rdar://problem/60096971 +// REQUIRES: rdar60096971 + // RUN: %empty-directory(%t) // RUN: echo "/// Some doc" >> %t/Foo.swift // RUN: echo "public func foo() { }" >> %t/Foo.swift From afafae4148c8413bb15a681d1155f722ef3f548d Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Mon, 23 Mar 2020 10:39:03 -0700 Subject: [PATCH 041/222] Disable irgen test on linux rdar://60752860 --- test/IRGen/pic.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/test/IRGen/pic.swift b/test/IRGen/pic.swift index 8afc50ec49846..6f7b9a8eaf1c3 100644 --- a/test/IRGen/pic.swift +++ b/test/IRGen/pic.swift @@ -3,6 +3,7 @@ // SR-12194 // XFAIL: OS=linux-android, CPU=aarch64 +// UNSUPPORTED: OS=linux-gnu // RUN: %target-swift-frontend %s -module-name main -S -o - | %FileCheck -check-prefix=%target-cpu -check-prefix=%target-cpu-%target-sdk-name %s From f7cf5bde468e29ebe8239fbea53af39e7ecf4f5d Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 23 Mar 2020 18:06:18 -0700 Subject: [PATCH 042/222] Adapt test to upstream readobj output change --- test/DebugInfo/modulecache.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/DebugInfo/modulecache.swift b/test/DebugInfo/modulecache.swift index c4eb24e70c66c..f3bb46b58f200 100644 --- a/test/DebugInfo/modulecache.swift +++ b/test/DebugInfo/modulecache.swift @@ -16,7 +16,7 @@ import ClangModule // RUN: %empty-directory(%t) // RUN: %target-swift-frontend %s -c -g -o %t.o -module-cache-path %t -I %S/Inputs // RUN: llvm-readobj -h %t/*/ClangModule-*.pcm | %FileCheck %s -// CHECK: Format: {{(Mach-O|ELF|COFF)}} +// CHECK: Format: {{(Mach-O|ELF|elf64|COFF)}} // 3. Test that swift-ide-check will not share swiftc's module cache. From 886e25ac1c5666c59f5599b550e7f5bd42299db9 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 23 Mar 2020 18:09:17 -0700 Subject: [PATCH 043/222] Update test for upstream codegen changes --- test/DebugInfo/top_level_code.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/DebugInfo/top_level_code.swift b/test/DebugInfo/top_level_code.swift index 790f5dffbdf84..6693d78863fb4 100644 --- a/test/DebugInfo/top_level_code.swift +++ b/test/DebugInfo/top_level_code.swift @@ -2,7 +2,7 @@ func markUsed(_ t: T) {} // CHECK: {{_?}}main: -// CHECK-NEXT: Lfunc_begin0: +// CHECK: Lfunc_begin0: // Verify that the top-level function (main) begins at line 0 and then // proceeds to the first line. // CHECK: .loc {{[0-9]}} 0 {{[0-9]}} From dfcd6611afc14356e9c908bb61119b0d0f34b168 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Fri, 27 Mar 2020 13:42:17 -0700 Subject: [PATCH 044/222] Handle clang::TargetInfo::HexagonBuiltinVaList --- lib/ClangImporter/ImportDecl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index 906ad9f86dfb7..c879e5e1550b3 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -379,6 +379,7 @@ getSwiftStdlibType(const clang::TypedefNameDecl *D, case clang::TargetInfo::VoidPtrBuiltinVaList: case clang::TargetInfo::PowerABIBuiltinVaList: case clang::TargetInfo::AAPCSABIBuiltinVaList: + case clang::TargetInfo::HexagonBuiltinVaList: assert(ClangCtx.getTypeSize(ClangCtx.VoidPtrTy) == ClangTypeSize && "expected va_list type to be sizeof(void *)"); break; From c04b6b6e329b6017f6297243da1cab70e5435b72 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Fri, 27 Mar 2020 14:04:22 -0700 Subject: [PATCH 045/222] More StringRef -> std::string explicit conversions --- lib/Serialization/ModuleFile.cpp | 2 +- lib/Serialization/Serialization.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Serialization/ModuleFile.cpp b/lib/Serialization/ModuleFile.cpp index f1fab8d01fcee..1c08abf40c60d 100644 --- a/lib/Serialization/ModuleFile.cpp +++ b/lib/Serialization/ModuleFile.cpp @@ -949,7 +949,7 @@ class ModuleFile::DerivativeFunctionConfigTableInfo { while (data < limit) { DeclID genSigId = endian::readNext(data); int32_t nameLength = endian::readNext(data); - StringRef mangledName(reinterpret_cast(data), nameLength); + std::string mangledName(reinterpret_cast(data), nameLength); data += nameLength; result.push_back({mangledName, genSigId}); } diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index a24206eaa28df..37515d87a4a85 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -5126,7 +5126,7 @@ void Serializer::writeAST(ModuleOrSourceFile DC) { DerivativeFunctionConfigTable derivativeConfigs; for (auto entry : uniquedDerivativeConfigs) { for (auto config : entry.second) { - auto paramIndices = config.first.str(); + std::string paramIndices = config.first.str().str(); auto genSigID = addGenericSignatureRef(config.second); derivativeConfigs[entry.first].push_back({paramIndices, genSigID}); } From 9f9668327c7b1e34c3cd1ba5240a3c31a2832657 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Mon, 30 Mar 2020 11:51:32 -0700 Subject: [PATCH 046/222] Add OMPArrayShaping to a few switch statements --- lib/ClangImporter/ClangAdapter.cpp | 1 + lib/ClangImporter/ImportType.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/ClangImporter/ClangAdapter.cpp b/lib/ClangImporter/ClangAdapter.cpp index eddac5d46b3bf..6428b38c31609 100644 --- a/lib/ClangImporter/ClangAdapter.cpp +++ b/lib/ClangImporter/ClangAdapter.cpp @@ -446,6 +446,7 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx, // OpenMP types that don't have Swift equivalents. case clang::BuiltinType::OMPArraySection: + case clang::BuiltinType::OMPArrayShaping: return OmissionTypeName(); // SVE builtin types that don't have Swift equivalents. diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index 3d067ef2fdab5..91e1985282b90 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -320,6 +320,7 @@ namespace { // OpenMP types that don't have Swift equivalents. case clang::BuiltinType::OMPArraySection: + case clang::BuiltinType::OMPArrayShaping: return Type(); // SVE builtin types that don't have Swift equivalents. From a162bd5ea85c843bfb09c9dc1d7b0b1cc8e1c34b Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Fri, 3 Apr 2020 14:52:33 -0700 Subject: [PATCH 047/222] Add OMPIterator to a few switch cases OMPIterator was recently added to upstream clang and thus a few switch statements need to account for this addition. --- lib/ClangImporter/ClangAdapter.cpp | 1 + lib/ClangImporter/ImportType.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/ClangImporter/ClangAdapter.cpp b/lib/ClangImporter/ClangAdapter.cpp index 6428b38c31609..daf1a5c91288a 100644 --- a/lib/ClangImporter/ClangAdapter.cpp +++ b/lib/ClangImporter/ClangAdapter.cpp @@ -447,6 +447,7 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx, // OpenMP types that don't have Swift equivalents. case clang::BuiltinType::OMPArraySection: case clang::BuiltinType::OMPArrayShaping: + case clang::BuiltinType::OMPIterator: return OmissionTypeName(); // SVE builtin types that don't have Swift equivalents. diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index 91e1985282b90..94dca10d3dfe2 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -321,6 +321,7 @@ namespace { // OpenMP types that don't have Swift equivalents. case clang::BuiltinType::OMPArraySection: case clang::BuiltinType::OMPArrayShaping: + case clang::BuiltinType::OMPIterator: return Type(); // SVE builtin types that don't have Swift equivalents. From a49bceeedf2875c6542812b0dc03ae7e382246e1 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Fri, 3 Apr 2020 16:36:26 -0700 Subject: [PATCH 048/222] Convert a clang::Module to non-const to account for a clang API change An upstream clang changed ASTSourceDescriptor to not have a const Module pointer. const_cast here to make this agree. --- lib/ClangImporter/ClangImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index cc5a374c245d1..2ff697bb48a21 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -3305,7 +3305,7 @@ ClangModuleUnit::ClangModuleUnit(ModuleDecl &M, clangModule(clangModule) { // Capture the file metadata before it goes away. if (clangModule) - ASTSourceDescriptor = {*clangModule}; + ASTSourceDescriptor = {*const_cast(clangModule)}; } StringRef ClangModuleUnit::getModuleDefiningPath() const { From 249299d7bb5242a6761f853e9740e5103cb323e3 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Mon, 13 Apr 2020 13:58:33 -0700 Subject: [PATCH 049/222] Tighten-up a Foundation Deserialization Test CocoaError.Code.fileReadUnknown conflicts with the CHECK-NOT line here. We should be checking more specifically for UnknownBlock and UnknownCode anyways. rdar://53284293 --- test/SIL/Serialization/deserialize_foundation.sil | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/SIL/Serialization/deserialize_foundation.sil b/test/SIL/Serialization/deserialize_foundation.sil index 845b1cf97d083..1a9de216aba26 100644 --- a/test/SIL/Serialization/deserialize_foundation.sil +++ b/test/SIL/Serialization/deserialize_foundation.sil @@ -4,4 +4,4 @@ // REQUIRES: objc_interop -// CHECK-NOT: Unknown +// CHECK-NOT: Unknown{{Code|Block}} From 8e0bea991196670a49c19e67dea16d1f15c415e0 Mon Sep 17 00:00:00 2001 From: Michael Forster Date: Fri, 17 Apr 2020 16:57:17 +0200 Subject: [PATCH 050/222] Call the new BinaryOperator factory function The constructor is not public any more. This fixes the master-next build. --- lib/ClangImporter/ImportDecl.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index 09448575c5fd0..bef2145b5acfa 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -1223,15 +1223,16 @@ makeBitFieldAccessors(ClangImporter::Implementation &Impl, fieldType, clang::VK_RValue, clang::SourceLocation()); - - auto cSetterExpr = new (Ctx) clang::BinaryOperator(cSetterMemberExpr, - cSetterValueExpr, - clang::BO_Assign, - fieldType, - clang::VK_RValue, - clang::OK_Ordinary, - clang::SourceLocation(), - clang::FPOptions()); + + auto cSetterExpr = clang::BinaryOperator::Create(Ctx, + cSetterMemberExpr, + cSetterValueExpr, + clang::BO_Assign, + fieldType, + clang::VK_RValue, + clang::OK_Ordinary, + clang::SourceLocation(), + clang::FPOptions()); cSetterDecl->setBody(cSetterExpr); } From 36279e2b6e2600dd45ea5f4ca8c657c46a880ab2 Mon Sep 17 00:00:00 2001 From: Michael Forster Date: Fri, 17 Apr 2020 16:57:17 +0200 Subject: [PATCH 051/222] Use LLVM version of combineHashValue This fixes the master-next build. --- include/swift/AST/SourceFile.h | 8 +++++--- lib/IRGen/LocalTypeDataKind.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/swift/AST/SourceFile.h b/include/swift/AST/SourceFile.h index b3fcb9ac66973..7c6b0ed45251f 100644 --- a/include/swift/AST/SourceFile.h +++ b/include/swift/AST/SourceFile.h @@ -734,9 +734,11 @@ struct DenseMapInfo { StringRefDMI::getTombstoneKey()); } static inline unsigned getHashValue(const ImportedModuleDesc &import) { - return combineHashValue(ImportedModuleDMI::getHashValue(import.module), - combineHashValue(ImportOptionsDMI::getHashValue(import.importOptions), - StringRefDMI::getHashValue(import.filename))); + return detail::combineHashValue( + ImportedModuleDMI::getHashValue(import.module), + detail::combineHashValue( + ImportOptionsDMI::getHashValue(import.importOptions), + StringRefDMI::getHashValue(import.filename))); } static bool isEqual(const ImportedModuleDesc &a, const ImportedModuleDesc &b) { diff --git a/lib/IRGen/LocalTypeDataKind.h b/lib/IRGen/LocalTypeDataKind.h index f45aa30cb1755..1f8215f60eab5 100644 --- a/lib/IRGen/LocalTypeDataKind.h +++ b/lib/IRGen/LocalTypeDataKind.h @@ -211,8 +211,8 @@ template <> struct DenseMapInfo { swift::irgen::LocalTypeDataKind::forFormalTypeMetadata() }; } static unsigned getHashValue(const LocalTypeDataKey &key) { - return combineHashValue(CanTypeInfo::getHashValue(key.Type), - key.Kind.getRawValue()); + return detail::combineHashValue(CanTypeInfo::getHashValue(key.Type), + key.Kind.getRawValue()); } static bool isEqual(const LocalTypeDataKey &a, const LocalTypeDataKey &b) { return a == b; From 7b345931d55cc6153757967c0448e1dea0107154 Mon Sep 17 00:00:00 2001 From: Michael Forster Date: Fri, 17 Apr 2020 12:45:24 +0200 Subject: [PATCH 052/222] Remove Swift's copy of llvm::interleave This is only needed on the master branch, which doesn't have LLVM's copy, yet. --- include/swift/Basic/STLExtras.h | 43 --------------------------------- 1 file changed, 43 deletions(-) diff --git a/include/swift/Basic/STLExtras.h b/include/swift/Basic/STLExtras.h index 14d48f5bafbe5..7a8264ca50cce 100644 --- a/include/swift/Basic/STLExtras.h +++ b/include/swift/Basic/STLExtras.h @@ -69,49 +69,6 @@ struct function_traits { using argument_types = std::tuple; }; -} // end namespace swift - -namespace llvm { - -/// @{ - -/// An STL-style algorithm similar to std::for_each that applies a second -/// functor between every pair of elements. -/// -/// This provides the control flow logic to, for example, print a -/// comma-separated list: -/// \code -/// interleave(names.begin(), names.end(), -/// [&](StringRef name) { OS << name; }, -/// [&] { OS << ", "; }); -/// \endcode -template -inline void interleave(ForwardIterator begin, ForwardIterator end, - UnaryFunctor each_fn, - NullaryFunctor between_fn) { - if (begin == end) - return; - each_fn(*begin); - ++begin; - for (; begin != end; ++begin) { - between_fn(); - each_fn(*begin); - } -} - -template -inline void interleave(const Container &c, UnaryFunctor each_fn, - NullaryFunctor between_fn) { - interleave(c.begin(), c.end(), each_fn, between_fn); -} - -/// @} - -} // end namespace llvm - -namespace swift { - /// @{ /// The equivalent of std::for_each, but for two lists at once. From bcf0afd57af27b5fafee2ab7d2641e51d82b175e Mon Sep 17 00:00:00 2001 From: Michael Forster Date: Mon, 20 Apr 2020 11:45:11 +0200 Subject: [PATCH 053/222] Ignore ExtInt for C interop and IRGen This feature was introduced here: https://github.com/apple/llvm-project/commit/61ba1481e200b5b35baa81ffcff81acb678e8508 --- lib/ClangImporter/ImportType.cpp | 5 +++++ lib/IRGen/GenCall.cpp | 3 +++ 2 files changed, 8 insertions(+) diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index 313ce962aadda..790b1fd665328 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -341,6 +341,11 @@ namespace { llvm_unreachable("Invalid BuiltinType."); } + ImportResult VisitExtIntType(const clang::ExtIntType *) { + // ExtInt is not supported in Swift. + return Type(); + } + ImportResult VisitPipeType(const clang::PipeType *) { // OpenCL types are not supported in Swift. return Type(); diff --git a/lib/IRGen/GenCall.cpp b/lib/IRGen/GenCall.cpp index 92d57820cf640..33a9fabd6a728 100644 --- a/lib/IRGen/GenCall.cpp +++ b/lib/IRGen/GenCall.cpp @@ -724,6 +724,9 @@ namespace { case clang::Type::Pipe: llvm_unreachable("OpenCL type in ABI lowering?"); + case clang::Type::ExtInt: + llvm_unreachable("ExtInt type in ABI lowering?"); + case clang::Type::ConstantArray: { auto array = Ctx.getAsConstantArrayType(type); auto elt = Ctx.getCanonicalType(array->getElementType()); From 21adecc9c27ce43271ba462f6f245751a64af4b6 Mon Sep 17 00:00:00 2001 From: Michael Forster Date: Tue, 21 Apr 2020 06:28:30 +0200 Subject: [PATCH 054/222] Another StringRef -> std::string conversion fix. This is needed to make this code compile on master-next. --- tools/swift-api-digester/swift-api-digester.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/swift-api-digester/swift-api-digester.cpp b/tools/swift-api-digester/swift-api-digester.cpp index 9b145860f67ed..dbf90c1601339 100644 --- a/tools/swift-api-digester/swift-api-digester.cpp +++ b/tools/swift-api-digester/swift-api-digester.cpp @@ -2774,7 +2774,7 @@ static std::string getJsonOutputFilePath(llvm::Triple Triple, bool ABI) { exit(1); } llvm::sys::path::append(OutputPath, getBaselineFilename(Triple)); - return OutputPath.str(); + return OutputPath.str().str(); } llvm::errs() << "Unable to decide output file path\n"; exit(1); From 01096b6a61ea32ea577e37a2bb48242e1beaf3a8 Mon Sep 17 00:00:00 2001 From: Michael Forster Date: Fri, 24 Apr 2020 06:36:20 +0200 Subject: [PATCH 055/222] Fix the master-next build --- lib/ClangImporter/ClangAdapter.cpp | 2 +- lib/IRGen/IRGenDebugInfo.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ClangImporter/ClangAdapter.cpp b/lib/ClangImporter/ClangAdapter.cpp index daf1a5c91288a..351f8b6788f36 100644 --- a/lib/ClangImporter/ClangAdapter.cpp +++ b/lib/ClangImporter/ClangAdapter.cpp @@ -81,7 +81,7 @@ const clang::Decl * importer::getFirstNonLocalDecl(const clang::Decl *D) { D = D->getCanonicalDecl(); auto iter = llvm::find_if(D->redecls(), [](const clang::Decl *next) -> bool { - return !next->isLexicallyWithinFunctionOrMethod(); + return !next->isInLocalScope(); }); if (iter == D->redecls_end()) return nullptr; diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 72e84361ee5d2..7e28353538b97 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -1014,7 +1014,8 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { SmallVector TemplateParams; for (auto Param : BGT->getGenericArgs()) { TemplateParams.push_back(DBuilder.createTemplateTypeParameter( - TheCU, "", getOrCreateType(DebugTypeInfo::getForwardDecl(Param)))); + TheCU, "", getOrCreateType(DebugTypeInfo::getForwardDecl(Param)), + false)); } return DBuilder.getOrCreateArray(TemplateParams); } From b59ffe0edf8c89892faed8ce728b37b8a433f628 Mon Sep 17 00:00:00 2001 From: Shoaib Meenai Date: Wed, 29 Apr 2020 15:20:04 -0700 Subject: [PATCH 056/222] [ClangImporter] Adjust for LLVM changes https://github.com/llvm/llvm-project/commit/9721fbf85b83 refactors the enum; adjust Swift accordingly. --- lib/ClangImporter/ImportDecl.cpp | 11 ++++++----- lib/ClangImporter/ImportType.cpp | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index cb08947a154b0..356f342cfe1a3 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -47,6 +47,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/Attr.h" +#include "clang/AST/DeclObjCCommon.h" #include "clang/Basic/CharInfo.h" #include "swift/Basic/Statistic.h" #include "clang/Basic/TargetInfo.h" @@ -2085,7 +2086,7 @@ classImplementsProtocol(const clang::ObjCInterfaceDecl *constInterface, static void applyPropertyOwnership(VarDecl *prop, - clang::ObjCPropertyDecl::PropertyAttributeKind attrs) { + clang::ObjCPropertyAttribute::Kind attrs) { Type ty = prop->getInterfaceType(); if (auto innerTy = ty->getOptionalObjectType()) ty = innerTy; @@ -2093,19 +2094,19 @@ applyPropertyOwnership(VarDecl *prop, return; ASTContext &ctx = prop->getASTContext(); - if (attrs & clang::ObjCPropertyDecl::OBJC_PR_copy) { + if (attrs & clang::ObjCPropertyAttribute::kind_copy) { prop->getAttrs().add(new (ctx) NSCopyingAttr(false)); return; } - if (attrs & clang::ObjCPropertyDecl::OBJC_PR_weak) { + if (attrs & clang::ObjCPropertyAttribute::kind_weak) { prop->getAttrs().add(new (ctx) ReferenceOwnershipAttr(ReferenceOwnership::Weak)); prop->setInterfaceType(WeakStorageType::get( prop->getInterfaceType(), ctx)); return; } - if ((attrs & clang::ObjCPropertyDecl::OBJC_PR_assign) || - (attrs & clang::ObjCPropertyDecl::OBJC_PR_unsafe_unretained)) { + if ((attrs & clang::ObjCPropertyAttribute::kind_assign) || + (attrs & clang::ObjCPropertyAttribute::kind_unsafe_unretained)) { prop->getAttrs().add( new (ctx) ReferenceOwnershipAttr(ReferenceOwnership::Unmanaged)); prop->setInterfaceType(UnmanagedStorageType::get( diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index 790b1fd665328..9b94b93c93247 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -32,6 +32,7 @@ #include "swift/Parse/Token.h" #include "swift/Strings.h" #include "clang/AST/ASTContext.h" +#include "clang/AST/DeclObjCCommon.h" #include "clang/AST/TypeVisitor.h" #include "clang/Basic/Builtins.h" #include "clang/Lex/Preprocessor.h" @@ -1556,8 +1557,8 @@ bool ClangImporter::Implementation::shouldAllowNSUIntegerAsInt( ImportedType ClangImporter::Implementation::importPropertyType( const clang::ObjCPropertyDecl *decl, bool isFromSystemModule) { const auto assignOrUnsafeUnretained = - clang::ObjCPropertyDecl::OBJC_PR_assign | - clang::ObjCPropertyDecl::OBJC_PR_unsafe_unretained; + clang::ObjCPropertyAttribute::kind_assign | + clang::ObjCPropertyAttribute::kind_unsafe_unretained; ImportTypeKind importKind; // HACK: Certain decls are always imported using bridged types, From b91c475bfb29d64ec5647e0524ac4f3a466d8310 Mon Sep 17 00:00:00 2001 From: Shoaib Meenai Date: Wed, 29 Apr 2020 23:54:23 -0700 Subject: [PATCH 057/222] [runtime] Adjust LLVMSupport for SmallVectorBase change https://github.com/llvm/llvm-project/commit/dda3c19a3618 makes SmallVectorBase templated. Adjust our copy accordingly and add explicit instantiations for the types in question. Note that for an explicit instantiation, the hidden visibility attribute has to be on the instantiation itself and not the template to have an effect. --- stdlib/public/runtime/LLVMSupport.cpp | 40 ++++++++++++++++++++------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/stdlib/public/runtime/LLVMSupport.cpp b/stdlib/public/runtime/LLVMSupport.cpp index ce8d2838d7387..720d165075fbf 100644 --- a/stdlib/public/runtime/LLVMSupport.cpp +++ b/stdlib/public/runtime/LLVMSupport.cpp @@ -39,19 +39,25 @@ report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {} /// grow_pod - This is an implementation of the grow() method which only works /// on POD-like datatypes and is out of line to reduce code duplication. -void -#if !defined(_WIN32) -__attribute__((__weak__, __visibility__("hidden"))) -#endif -llvm::SmallVectorBase::grow_pod(void *FirstEl, size_t MinCapacity, - size_t TSize) { - // Ensure we can fit the new capacity in 32 bits. - if (MinCapacity > UINT32_MAX) +template +void SmallVectorBase::grow_pod(void *FirstEl, size_t MinCapacity, + size_t TSize) { + // Ensure we can fit the new capacity. + // This is only going to be applicable when the capacity is 32 bit. + if (MinCapacity > SizeTypeMax()) report_bad_alloc_error("SmallVector capacity overflow during allocation"); + // Ensure we can meet the guarantee of space for at least one more element. + // The above check alone will not catch the case where grow is called with a + // default MinCapacity of 0, but the current capacity cannot be increased. + // This is only going to be applicable when the capacity is 32 bit. + if (capacity() == SizeTypeMax()) + report_bad_alloc_error("SmallVector capacity unable to grow"); + + // In theory 2*capacity can overflow if the capacity is 64 bit, but the + // original capacity would never be large enough for this to be a problem. size_t NewCapacity = 2 * capacity() + 1; // Always grow. - NewCapacity = - std::min(std::max(NewCapacity, MinCapacity), size_t(UINT32_MAX)); + NewCapacity = std::min(std::max(NewCapacity, MinCapacity), SizeTypeMax()); void *NewElts; if (BeginX == FirstEl) { @@ -68,5 +74,19 @@ llvm::SmallVectorBase::grow_pod(void *FirstEl, size_t MinCapacity, this->Capacity = NewCapacity; } +template +#if !defined(_WIN32) +__attribute__((__weak__, __visibility__("hidden"))) +#endif +void SmallVectorBase::grow_pod(void *FirstEl, size_t MinCapacity, + size_t TSize); + +template +#if !defined(_WIN32) +__attribute__((__weak__, __visibility__("hidden"))) +#endif +void SmallVectorBase::grow_pod(void *FirstEl, size_t MinCapacity, + size_t TSize); + } // end namespace llvm #endif // defined(swiftCore_EXPORTS) From 78b444d1f0993803d14975a529deec84472afb10 Mon Sep 17 00:00:00 2001 From: Shoaib Meenai Date: Wed, 29 Apr 2020 23:57:16 -0700 Subject: [PATCH 058/222] [runtime] Adjust LLVMSupport for upstream 7aaff8fd2da2 https://github.com/llvm/llvm-project/commit/7aaff8fd2da2 moves allocate_buffer and deallocate_buffer out of line, so we have to follow suit. --- stdlib/public/runtime/LLVMSupport.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/stdlib/public/runtime/LLVMSupport.cpp b/stdlib/public/runtime/LLVMSupport.cpp index 720d165075fbf..7b34557ee0e46 100644 --- a/stdlib/public/runtime/LLVMSupport.cpp +++ b/stdlib/public/runtime/LLVMSupport.cpp @@ -11,6 +11,7 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/SmallVector.h" +#include "llvm/Support/MemAlloc.h" // ADT uses report_bad_alloc_error to report an error when it can't allocate // elements for a data structure. The swift runtime uses ADT without linking @@ -88,5 +89,31 @@ __attribute__((__weak__, __visibility__("hidden"))) void SmallVectorBase::grow_pod(void *FirstEl, size_t MinCapacity, size_t TSize); +// The same for allocate_buffer and deallocate_buffer, which are used by +// DenseMap and unique_function. This is a hack. This implementation is copied +// from llvm/lib/Support/MemAlloc.cpp and has to stay in sync with it. +LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * +llvm::allocate_buffer(size_t Size, size_t Alignment) { + return ::operator new(Size +#ifdef __cpp_aligned_new + , + std::align_val_t(Alignment) +#endif + ); +} + +void llvm::deallocate_buffer(void *Ptr, size_t Size, size_t Alignment) { + ::operator delete(Ptr +#ifdef __cpp_sized_deallocation + , + Size +#endif +#ifdef __cpp_aligned_new + , + std::align_val_t(Alignment) +#endif + ); +} + } // end namespace llvm #endif // defined(swiftCore_EXPORTS) From 8637bdab631147fa02f86b7b645251b99fdd9ecc Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Thu, 30 Apr 2020 14:33:12 -0700 Subject: [PATCH 059/222] Merge llvm:master; fix SmallVectorBase in the swift runtime. --- stdlib/public/runtime/LLVMSupport.cpp | 28 +++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/stdlib/public/runtime/LLVMSupport.cpp b/stdlib/public/runtime/LLVMSupport.cpp index ce8d2838d7387..f977cecfa6f23 100644 --- a/stdlib/public/runtime/LLVMSupport.cpp +++ b/stdlib/public/runtime/LLVMSupport.cpp @@ -37,21 +37,30 @@ report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {} // TODO: This is a hack. This implementaiton is copied from LLVM and has to stay // in sync with it. -/// grow_pod - This is an implementation of the grow() method which only works -/// on POD-like datatypes and is out of line to reduce code duplication. +// Note: Moving this function into the header may cause performance regression. +template void #if !defined(_WIN32) __attribute__((__weak__, __visibility__("hidden"))) #endif -llvm::SmallVectorBase::grow_pod(void *FirstEl, size_t MinCapacity, - size_t TSize) { - // Ensure we can fit the new capacity in 32 bits. - if (MinCapacity > UINT32_MAX) +SmallVectorBase::grow_pod(void *FirstEl, size_t MinCapacity, + size_t TSize) { + // Ensure we can fit the new capacity. + // This is only going to be applicable when the capacity is 32 bit. + if (MinCapacity > SizeTypeMax()) report_bad_alloc_error("SmallVector capacity overflow during allocation"); + // Ensure we can meet the guarantee of space for at least one more element. + // The above check alone will not catch the case where grow is called with a + // default MinCapacity of 0, but the current capacity cannot be increased. + // This is only going to be applicable when the capacity is 32 bit. + if (capacity() == SizeTypeMax()) + report_bad_alloc_error("SmallVector capacity unable to grow"); + + // In theory 2*capacity can overflow if the capacity is 64 bit, but the + // original capacity would never be large enough for this to be a problem. size_t NewCapacity = 2 * capacity() + 1; // Always grow. - NewCapacity = - std::min(std::max(NewCapacity, MinCapacity), size_t(UINT32_MAX)); + NewCapacity = std::min(std::max(NewCapacity, MinCapacity), SizeTypeMax()); void *NewElts; if (BeginX == FirstEl) { @@ -68,5 +77,8 @@ llvm::SmallVectorBase::grow_pod(void *FirstEl, size_t MinCapacity, this->Capacity = NewCapacity; } +template class llvm::SmallVectorBase; +template class llvm::SmallVectorBase; + } // end namespace llvm #endif // defined(swiftCore_EXPORTS) From d38f436a5f7f0e9dc96218eb6c286a3c4a068d06 Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Thu, 30 Apr 2020 14:47:43 -0700 Subject: [PATCH 060/222] Revert "Merge llvm:master; fix SmallVectorBase in the swift runtime." --- stdlib/public/runtime/LLVMSupport.cpp | 28 ++++++++------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/stdlib/public/runtime/LLVMSupport.cpp b/stdlib/public/runtime/LLVMSupport.cpp index f977cecfa6f23..ce8d2838d7387 100644 --- a/stdlib/public/runtime/LLVMSupport.cpp +++ b/stdlib/public/runtime/LLVMSupport.cpp @@ -37,30 +37,21 @@ report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {} // TODO: This is a hack. This implementaiton is copied from LLVM and has to stay // in sync with it. -// Note: Moving this function into the header may cause performance regression. -template +/// grow_pod - This is an implementation of the grow() method which only works +/// on POD-like datatypes and is out of line to reduce code duplication. void #if !defined(_WIN32) __attribute__((__weak__, __visibility__("hidden"))) #endif -SmallVectorBase::grow_pod(void *FirstEl, size_t MinCapacity, - size_t TSize) { - // Ensure we can fit the new capacity. - // This is only going to be applicable when the capacity is 32 bit. - if (MinCapacity > SizeTypeMax()) +llvm::SmallVectorBase::grow_pod(void *FirstEl, size_t MinCapacity, + size_t TSize) { + // Ensure we can fit the new capacity in 32 bits. + if (MinCapacity > UINT32_MAX) report_bad_alloc_error("SmallVector capacity overflow during allocation"); - // Ensure we can meet the guarantee of space for at least one more element. - // The above check alone will not catch the case where grow is called with a - // default MinCapacity of 0, but the current capacity cannot be increased. - // This is only going to be applicable when the capacity is 32 bit. - if (capacity() == SizeTypeMax()) - report_bad_alloc_error("SmallVector capacity unable to grow"); - - // In theory 2*capacity can overflow if the capacity is 64 bit, but the - // original capacity would never be large enough for this to be a problem. size_t NewCapacity = 2 * capacity() + 1; // Always grow. - NewCapacity = std::min(std::max(NewCapacity, MinCapacity), SizeTypeMax()); + NewCapacity = + std::min(std::max(NewCapacity, MinCapacity), size_t(UINT32_MAX)); void *NewElts; if (BeginX == FirstEl) { @@ -77,8 +68,5 @@ SmallVectorBase::grow_pod(void *FirstEl, size_t MinCapacity, this->Capacity = NewCapacity; } -template class llvm::SmallVectorBase; -template class llvm::SmallVectorBase; - } // end namespace llvm #endif // defined(swiftCore_EXPORTS) From cc798552652c9dad62fb5124898618148b08cd1c Mon Sep 17 00:00:00 2001 From: Mike Ash Date: Wed, 6 May 2020 13:31:44 -0400 Subject: [PATCH 061/222] [Runtime] Fix ConcurrentMapBase::destroyNode to pass the new alignment parameter to MallocAllocator. rdar://problem/62860159 --- include/swift/Runtime/Concurrent.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/swift/Runtime/Concurrent.h b/include/swift/Runtime/Concurrent.h index 003088c485fbf..4d2f040db8805 100644 --- a/include/swift/Runtime/Concurrent.h +++ b/include/swift/Runtime/Concurrent.h @@ -203,7 +203,7 @@ class ConcurrentMapBase : protected Allocator { // Deallocate the node. The static_cast here is required // because LLVM's allocator API is insane. - this->Deallocate(static_cast(node), allocSize); + this->Deallocate(static_cast(node), allocSize, alignof(Node)); } }; From f8107fbe85e7a6873aafcbfd12c767b2650d99b7 Mon Sep 17 00:00:00 2001 From: Mike Ash Date: Thu, 7 May 2020 11:25:11 -0400 Subject: [PATCH 062/222] [Runtime] Add an alignment parameter to MetadataAllocator::Deallocate to match LLVM. rdar://problem/62975124 --- stdlib/public/runtime/Metadata.cpp | 3 ++- stdlib/public/runtime/MetadataCache.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/stdlib/public/runtime/Metadata.cpp b/stdlib/public/runtime/Metadata.cpp index 2c224d3765875..1e7ac996fe645 100644 --- a/stdlib/public/runtime/Metadata.cpp +++ b/stdlib/public/runtime/Metadata.cpp @@ -5504,7 +5504,8 @@ void *MetadataAllocator::Allocate(size_t size, size_t alignment) { } } -void MetadataAllocator::Deallocate(const void *allocation, size_t size) { +void MetadataAllocator::Deallocate(const void *allocation, size_t size, + size_t alignment) { __asan_poison_memory_region(allocation, size); if (size > PoolRange::MaxPoolAllocationSize) { diff --git a/stdlib/public/runtime/MetadataCache.h b/stdlib/public/runtime/MetadataCache.h index 41d838e630378..77960dc890461 100644 --- a/stdlib/public/runtime/MetadataCache.h +++ b/stdlib/public/runtime/MetadataCache.h @@ -33,7 +33,7 @@ class MetadataAllocator : public llvm::AllocatorBase { LLVM_ATTRIBUTE_RETURNS_NONNULL void *Allocate(size_t size, size_t alignment); using AllocatorBase::Allocate; - void Deallocate(const void *Ptr, size_t size); + void Deallocate(const void *Ptr, size_t size, size_t alignment); using AllocatorBase::Deallocate; void PrintStats() const {} From a195733336ffc51c09a8de0a39ba6df50a17c07d Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Thu, 7 May 2020 10:43:02 -0700 Subject: [PATCH 063/222] [master-next] Fix compile error ParsedRawSyntaxNode and SwiftLangSupport --- include/swift/Parse/ParsedRawSyntaxNode.h | 4 ++-- tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/swift/Parse/ParsedRawSyntaxNode.h b/include/swift/Parse/ParsedRawSyntaxNode.h index 00a1dc93381af..340684556c56f 100644 --- a/include/swift/Parse/ParsedRawSyntaxNode.h +++ b/include/swift/Parse/ParsedRawSyntaxNode.h @@ -99,8 +99,8 @@ class ParsedRawSyntaxNode { assert(DeferredToken.NumTrailingTrivia == numTrailingTrivia && "numLeadingTrivia is too large value!"); } - ParsedRawSyntaxNode(ParsedRawSyntaxNode &other) = delete; - ParsedRawSyntaxNode &operator=(ParsedRawSyntaxNode &other) = delete; + ParsedRawSyntaxNode(const ParsedRawSyntaxNode &other) = delete; + ParsedRawSyntaxNode &operator=(const ParsedRawSyntaxNode &other) = delete; public: ParsedRawSyntaxNode() diff --git a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp index 8fea7e661c542..a6eb8ca6fcbe1 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp @@ -270,7 +270,7 @@ SwiftLangSupport::SwiftLangSupport(SourceKit::Context &SKCtx) llvm::SmallString<128> LibPath(SKCtx.getRuntimeLibPath()); llvm::sys::path::append(LibPath, "swift"); RuntimeResourcePath = std::string(LibPath.str()); - DiagnosticDocumentationPath = SKCtx.getDiagnosticDocumentationPath(); + DiagnosticDocumentationPath = SKCtx.getDiagnosticDocumentationPath().str(); Stats = std::make_shared(); EditorDocuments = std::make_shared(); From 63c0ded8c90f670f886dd213f3148bdb352b60ea Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Mon, 11 May 2020 10:59:45 -0700 Subject: [PATCH 064/222] Include llvm/Support/Debug.h in AdjointValue.h --- include/swift/SILOptimizer/Differentiation/AdjointValue.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/swift/SILOptimizer/Differentiation/AdjointValue.h b/include/swift/SILOptimizer/Differentiation/AdjointValue.h index 104a3f0bc699f..4b316835518f7 100644 --- a/include/swift/SILOptimizer/Differentiation/AdjointValue.h +++ b/include/swift/SILOptimizer/Differentiation/AdjointValue.h @@ -21,6 +21,7 @@ #include "swift/AST/Decl.h" #include "swift/SIL/SILValue.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/Debug.h" namespace swift { namespace autodiff { From 7eec685b074bbd356272c9af7ad9501742f1c663 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Tue, 12 May 2020 08:13:29 -0700 Subject: [PATCH 065/222] ClangImporter: Ignore matrix types for now --- lib/ClangImporter/ImportType.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index 9b94b93c93247..3ad13c1cd555f 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -352,6 +352,11 @@ namespace { return Type(); } + ImportResult VisitMatrixType(const clang::MatrixType *ty) { + // Matrix types are not supported in Swift. + return Type(); + } + ImportResult VisitComplexType(const clang::ComplexType *type) { // FIXME: Implement once Complex is in the library. return Type(); From a7f3d2bae391e888ce804ff9d7ebf0a2dca8d4c0 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Tue, 12 May 2020 08:18:23 -0700 Subject: [PATCH 066/222] Adjust to new ElementCount type for vector operations --- lib/IRGen/GenConstant.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/IRGen/GenConstant.cpp b/lib/IRGen/GenConstant.cpp index 6855b0ccadf94..6c498276def14 100644 --- a/lib/IRGen/GenConstant.cpp +++ b/lib/IRGen/GenConstant.cpp @@ -85,7 +85,8 @@ llvm::Constant *irgen::emitConstantZero(IRGenModule &IGM, BuiltinInst *BI) { if (auto vector = BI->getType().getAs()) { auto zero = helper(vector.getElementType()); - return llvm::ConstantVector::getSplat(vector->getNumElements(), zero); + return llvm::ConstantVector::getSplat( + llvm::ElementCount(vector->getNumElements(), /*scalable*/ false), zero); } return helper(BI->getType().getASTType()); From eab0fe2ff7cb4a31366345e17032d155a9567518 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Tue, 12 May 2020 08:22:22 -0700 Subject: [PATCH 067/222] IRGen: Adjust to added Matrix type ignore for now --- lib/IRGen/GenCall.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/IRGen/GenCall.cpp b/lib/IRGen/GenCall.cpp index eafd9e15b0303..ed01996f0bc47 100644 --- a/lib/IRGen/GenCall.cpp +++ b/lib/IRGen/GenCall.cpp @@ -730,6 +730,10 @@ namespace { case clang::Type::ExtInt: llvm_unreachable("ExtInt type in ABI lowering?"); + case clang::Type::ConstantMatrix: { + llvm_unreachable("ConstantMatrix type in ABI lowering?"); + } + case clang::Type::ConstantArray: { auto array = Ctx.getAsConstantArrayType(type); auto elt = Ctx.getCanonicalType(array->getElementType()); From 622fee54a7996d835c525291926f90ef0dda2e73 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Wed, 13 May 2020 07:35:11 -0700 Subject: [PATCH 068/222] Another std::string StringRef assignment. --- lib/Frontend/ModuleInterfaceLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Frontend/ModuleInterfaceLoader.cpp b/lib/Frontend/ModuleInterfaceLoader.cpp index 0770cbecd2883..9e2494b67678c 100644 --- a/lib/Frontend/ModuleInterfaceLoader.cpp +++ b/lib/Frontend/ModuleInterfaceLoader.cpp @@ -1105,7 +1105,7 @@ bool InterfaceSubContextDelegateImpl::extractSwiftInterfaceVersionAndArgs( if (CompRe.match(SB, &CompMatches)) { assert(CompMatches.size() == 2); - CompilerVersion = SubArgSaver.save(CompMatches[1]); + CompilerVersion = SubArgSaver.save(CompMatches[1]).str(); } else { // Don't diagnose; handwritten module interfaces don't include this field. From 803414cea7f3ad5e60cfb300f3a32f38fd23c28d Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Fri, 15 May 2020 06:40:37 -0700 Subject: [PATCH 069/222] Adjust to MaybeAlign -> Align change in LoadInst api --- lib/IRGen/IRBuilder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/IRGen/IRBuilder.h b/lib/IRGen/IRBuilder.h index 69ecb3de278bb..445bb5730edf5 100644 --- a/lib/IRGen/IRBuilder.h +++ b/lib/IRGen/IRBuilder.h @@ -125,7 +125,7 @@ class IRBuilder : public IRBuilderBase { llvm::LoadInst *CreateLoad(llvm::Value *addr, Alignment align, const llvm::Twine &name = "") { llvm::LoadInst *load = IRBuilderBase::CreateLoad(addr, name); - load->setAlignment(llvm::MaybeAlign(align.getValue())); + load->setAlignment(llvm::Align(align.getValue())); return load; } llvm::LoadInst *CreateLoad(Address addr, const llvm::Twine &name = "") { From 0792b12eed45f5269df6557058eb805f58b73c77 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Fri, 15 May 2020 06:54:53 -0700 Subject: [PATCH 070/222] Make sure we get a valid llvm::Align value --- lib/IRGen/IRBuilder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/IRGen/IRBuilder.h b/lib/IRGen/IRBuilder.h index 445bb5730edf5..c7b875b2b2179 100644 --- a/lib/IRGen/IRBuilder.h +++ b/lib/IRGen/IRBuilder.h @@ -125,7 +125,7 @@ class IRBuilder : public IRBuilderBase { llvm::LoadInst *CreateLoad(llvm::Value *addr, Alignment align, const llvm::Twine &name = "") { llvm::LoadInst *load = IRBuilderBase::CreateLoad(addr, name); - load->setAlignment(llvm::Align(align.getValue())); + load->setAlignment(llvm::MaybeAlign(align.getValue()).valueOrOne()); return load; } llvm::LoadInst *CreateLoad(Address addr, const llvm::Twine &name = "") { From 3ffd0da30d23a8ddf29fe0521435ac4efa989678 Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Mon, 18 May 2020 15:10:23 +0300 Subject: [PATCH 071/222] [NFC] AST: Push up a fast path in TypeBase::getContextSubstitutions --- lib/AST/Type.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index abdc06e298980..439392df88976 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -3949,16 +3949,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(); From 5372afeb98cf7a4523ed3a5cd7582800cd2b7a1a Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Mon, 18 May 2020 06:16:38 -0700 Subject: [PATCH 072/222] Adjust to MaybeAlign -> Align change in llvm::StoreInst api --- lib/IRGen/IRBuilder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/IRGen/IRBuilder.h b/lib/IRGen/IRBuilder.h index c7b875b2b2179..4eaa167b26f49 100644 --- a/lib/IRGen/IRBuilder.h +++ b/lib/IRGen/IRBuilder.h @@ -135,7 +135,7 @@ class IRBuilder : public IRBuilderBase { llvm::StoreInst *CreateStore(llvm::Value *value, llvm::Value *addr, Alignment align) { llvm::StoreInst *store = IRBuilderBase::CreateStore(value, addr); - store->setAlignment(llvm::MaybeAlign(align.getValue())); + store->setAlignment(llvm::MaybeAlign(align.getValue()).valueOrOne()); return store; } llvm::StoreInst *CreateStore(llvm::Value *value, Address addr) { From ffc990f999f4dc7a32af2139d8fd2c3d05276ddd Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Mon, 18 May 2020 16:52:41 -0700 Subject: [PATCH 073/222] [driver/sourcekit] Avoid creating temporary output files in TMPDIR When producing frontend arguments for sourcekitd, force the output mode to -typecheck so that we do not create any temporary output files in the driver. Previously, any sourcekitd operation that created a compiler invocation would create 0-sized .o file inside $TMPDIR that would never be cleaned up. The new swift-driver project handles temporaries much better as VirtualPath, and should not need this approach. rdar://62366123 --- include/swift/Driver/FrontendUtil.h | 6 +++- lib/Driver/FrontendUtil.cpp | 22 +++++++++++++- test/SourceKit/Misc/no-driver-outputs.swift | 29 +++++++++++++++++++ .../lib/SwiftLang/SwiftASTManager.cpp | 2 +- 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 test/SourceKit/Misc/no-driver-outputs.swift 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/lib/Driver/FrontendUtil.cpp b/lib/Driver/FrontendUtil.cpp index bd771faf28c5b..17c565a7ea92f 100644 --- a/lib/Driver/FrontendUtil.cpp +++ b/lib/Driver/FrontendUtil.cpp @@ -25,7 +25,8 @@ 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()); @@ -57,6 +58,25 @@ bool swift::driver::getSingleFrontendInvocationFromDriverArguments( if (Diags.hadAnyError()) return true; + if (ForceNoOutputs) { + // Clear existing output modes. + ArgList->eraseArg(options::OPT_modes_Group); + // Disable other output options that conflict with -typecheck. + ArgList->eraseArg(options::OPT_emit_module); + ArgList->eraseArg(options::OPT_emit_module_path); + ArgList->eraseArg(options::OPT_emit_module_source_info_path); + ArgList->eraseArg(options::OPT_emit_module_interface); + ArgList->eraseArg(options::OPT_emit_module_interface_path); + ArgList->eraseArg(options::OPT_emit_objc_header); + ArgList->eraseArg(options::OPT_emit_objc_header_path); + + 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/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/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp b/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp index 0b4a9d238c3d4..e67659954ebfc 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); From cccb21aca6d7d39e445b583b78299742839e3a18 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Tue, 19 May 2020 13:58:05 -0700 Subject: [PATCH 074/222] [driver] Add test for new behaviour in createCompilerInvocation Test for "ForceNoOutputs" flag. --- test/Driver/createCompilerInvocation.swift | 26 ++++++++++++++++++++++ tools/swift-ide-test/swift-ide-test.cpp | 16 ++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/test/Driver/createCompilerInvocation.swift b/test/Driver/createCompilerInvocation.swift index 0151cd7ea6cfa..30a340e598ad5 100644 --- a/test/Driver/createCompilerInvocation.swift +++ b/test/Driver/createCompilerInvocation.swift @@ -7,3 +7,29 @@ // CHECK-FAIL: error: unable to create a CompilerInvocation // CHECK-NOWARN-NOT: warning + +// RUN: %swift-ide-test_plain -test-createCompilerInvocation -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 %s 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: Frontend Arguments END + +// RUN: %swift-ide-test_plain -test-createCompilerInvocation -force-no-outputs -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 %s 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: Frontend Arguments BEGIN +// NOOUTPUT_ARGS-DAG: -typecheck +// NOOUTPUT_ARGS-DAG: -module-name +// NOOUTPUT_ARGS: Frontend Arguments END diff --git a/tools/swift-ide-test/swift-ide-test.cpp b/tools/swift-ide-test/swift-ide-test.cpp index f1795d894969d..244765c3cba13 100644 --- a/tools/swift-ide-test/swift-ide-test.cpp +++ b/tools/swift-ide-test/swift-ide-test.cpp @@ -3223,7 +3223,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); @@ -3232,8 +3232,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"; @@ -3271,8 +3276,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); } } From 2b2f7dcd2fb6cda1ec1e6ccafa6b2bc7c6695e91 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Wed, 20 May 2020 07:00:33 -0700 Subject: [PATCH 075/222] Adjust to AllocaInst MaybeAlign -> Align api change --- lib/IRGen/GenCall.cpp | 9 ++++++--- lib/IRGen/GenDecl.cpp | 4 ++-- lib/IRGen/GenOpaque.cpp | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/IRGen/GenCall.cpp b/lib/IRGen/GenCall.cpp index ed01996f0bc47..0cb4dfb09157a 100644 --- a/lib/IRGen/GenCall.cpp +++ b/lib/IRGen/GenCall.cpp @@ -2117,7 +2117,8 @@ static void emitCoerceAndExpand(IRGenFunction &IGF, Explosion &in, Alignment(coercionTyLayout->getAlignment().value()); auto alloca = cast(temporary.getAddress()); if (alloca->getAlignment() < coercionTyAlignment.getValue()) { - alloca->setAlignment(llvm::MaybeAlign(coercionTyAlignment.getValue())); + alloca->setAlignment( + llvm::MaybeAlign(coercionTyAlignment.getValue()).valueOrOne()); temporary = Address(temporary.getAddress(), coercionTyAlignment); } @@ -2395,7 +2396,8 @@ static void externalizeArguments(IRGenFunction &IGF, const Callee &callee, auto ABIAlign = AI.getIndirectAlign(); if (ABIAlign > addr.getAlignment()) { auto *AS = cast(addr.getAddress()); - AS->setAlignment(llvm::MaybeAlign(ABIAlign.getQuantity())); + AS->setAlignment( + llvm::MaybeAlign(ABIAlign.getQuantity()).valueOrOne()); addr = Address(addr.getAddress(), Alignment(ABIAlign.getQuantity())); } } @@ -3087,7 +3089,8 @@ static void adjustAllocaAlignment(const llvm::DataLayout &DL, Alignment layoutAlignment = Alignment(layout->getAlignment().value()); auto alloca = cast(allocaAddr.getAddress()); if (alloca->getAlignment() < layoutAlignment.getValue()) { - alloca->setAlignment(llvm::MaybeAlign(layoutAlignment.getValue())); + alloca->setAlignment( + llvm::MaybeAlign(layoutAlignment.getValue()).valueOrOne()); allocaAddr = Address(allocaAddr.getAddress(), layoutAlignment); } } diff --git a/lib/IRGen/GenDecl.cpp b/lib/IRGen/GenDecl.cpp index 97ad57e20d1a6..3509626efd883 100644 --- a/lib/IRGen/GenDecl.cpp +++ b/lib/IRGen/GenDecl.cpp @@ -4378,7 +4378,7 @@ Address IRGenFunction::createAlloca(llvm::Type *type, llvm::AllocaInst *alloca = new llvm::AllocaInst(type, IGM.DataLayout.getAllocaAddrSpace(), name, AllocaIP); - alloca->setAlignment(llvm::MaybeAlign(alignment.getValue())); + alloca->setAlignment(llvm::MaybeAlign(alignment.getValue()).valueOrOne()); return Address(alloca, alignment); } @@ -4389,7 +4389,7 @@ Address IRGenFunction::createAlloca(llvm::Type *type, const llvm::Twine &name) { llvm::AllocaInst *alloca = new llvm::AllocaInst( type, IGM.DataLayout.getAllocaAddrSpace(), ArraySize, - llvm::MaybeAlign(alignment.getValue()), name, AllocaIP); + llvm::MaybeAlign(alignment.getValue()).valueOrOne(), name, AllocaIP); return Address(alloca, alignment); } diff --git a/lib/IRGen/GenOpaque.cpp b/lib/IRGen/GenOpaque.cpp index 25d2635b1c195..07558c8068780 100644 --- a/lib/IRGen/GenOpaque.cpp +++ b/lib/IRGen/GenOpaque.cpp @@ -575,7 +575,7 @@ StackAddress IRGenFunction::emitDynamicAlloca(llvm::Type *eltTy, // Emit the dynamic alloca. auto *alloca = Builder.IRBuilderBase::CreateAlloca(eltTy, arraySize, name); - alloca->setAlignment(llvm::MaybeAlign(align.getValue())); + alloca->setAlignment(llvm::MaybeAlign(align.getValue()).valueOrOne()); assert(!isInEntryBlock || getActiveDominancePoint().isUniversal() && From 81e1c2325fffe9d33ededbfb2d00a4c519cb4876 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Wed, 27 May 2020 08:41:21 -0700 Subject: [PATCH 076/222] [builtins] Fix a broken build by removing a ScalableVecArgument case. The following upstream commit removed the ScalableVecArgument: https://reviews.llvm.org/D80107 I've remove that case from IntrinsicTypeDecoder::decodeImmediate() The aforementioned patch also describes vector widths in terms of ElementCounts, and not unsigned ints. I've updated an access to the vector width to make use of the ElementCount representation via access of the Min member. --- lib/AST/Builtins.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/AST/Builtins.cpp b/lib/AST/Builtins.cpp index c5580e34748b4..724d2d942b584 100644 --- a/lib/AST/Builtins.cpp +++ b/lib/AST/Builtins.cpp @@ -1745,7 +1745,6 @@ Type IntrinsicTypeDecoder::decodeImmediate() { case IITDescriptor::ExtendArgument: case IITDescriptor::TruncArgument: case IITDescriptor::HalfVecArgument: - case IITDescriptor::ScalableVecArgument: case IITDescriptor::VarArg: case IITDescriptor::Token: case IITDescriptor::VecElementArgument: @@ -1774,7 +1773,7 @@ Type IntrinsicTypeDecoder::decodeImmediate() { case IITDescriptor::Vector: { Type eltType = decodeImmediate(); if (!eltType) return Type(); - return makeVector(eltType, D.Vector_Width); + return makeVector(eltType, D.Vector_Width.Min); } // A pointer to an immediate type. From 04e6373f2875113a9d840613554bb2b050a208a5 Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Wed, 8 Apr 2020 21:18:20 +0200 Subject: [PATCH 077/222] Removes redundant buffer zeroing in lowercased() and uppercased() --- stdlib/public/core/String.swift | 58 +++++++++++++++++---------------- 1 file changed, 30 insertions(+), 28 deletions(-) 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 From 9498b03ec3a1e9391e01690ba572e664159a4ab7 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 28 May 2020 12:42:38 -0700 Subject: [PATCH 078/222] [ClangImporter] Add explicit std::string conversion --- lib/ClangImporter/ClangModuleDependencyScanner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ClangImporter/ClangModuleDependencyScanner.cpp b/lib/ClangImporter/ClangModuleDependencyScanner.cpp index d63601776f078..3d2b1d256137e 100644 --- a/lib/ClangImporter/ClangModuleDependencyScanner.cpp +++ b/lib/ClangImporter/ClangModuleDependencyScanner.cpp @@ -254,7 +254,7 @@ void ClangImporter::recordModuleDependencies( swiftArgs.push_back("-Xcc"); swiftArgs.push_back("-Xclang"); swiftArgs.push_back("-Xcc"); - swiftArgs.push_back(arg); + swiftArgs.push_back(arg.str()); }; // Add all args inheritted from creating the importer. for (auto arg: cc1Args) { From 614d257cdb235617fdb79dd1929d3b1ecff910c9 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Thu, 28 May 2020 14:23:32 -0700 Subject: [PATCH 079/222] [builtins] Add the intrinsic BFloat to IntrinsicTypeDecoder::decodeImmediate() (#32051) This type was introduced in ad5d319ee85d31ee2b1ca5c29b3a10b340513fec. For now Swift does nothing in decodeImmediate() (e.g., return Type()) --- lib/AST/Builtins.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/AST/Builtins.cpp b/lib/AST/Builtins.cpp index c5580e34748b4..9d84a74dd055b 100644 --- a/lib/AST/Builtins.cpp +++ b/lib/AST/Builtins.cpp @@ -1740,6 +1740,7 @@ Type IntrinsicTypeDecoder::decodeImmediate() { IITDescriptor D = Table.front(); Table = Table.slice(1); switch (D.Kind) { + case IITDescriptor::BFloat: case IITDescriptor::MMX: case IITDescriptor::Metadata: case IITDescriptor::ExtendArgument: From 042939e77e1949ca5245f527b31d8052d60bb42e Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Sat, 30 May 2020 12:27:54 -0300 Subject: [PATCH 080/222] [ConstraintSystem] Move some property wrappers implementation form header to cpp file --- lib/Sema/ConstraintSystem.cpp | 53 +++++++++++++++++++++++++++++++++++ lib/Sema/ConstraintSystem.h | 50 ++------------------------------- 2 files changed, 56 insertions(+), 47 deletions(-) diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index 536b682c38798..deab8571db37b 100644 --- a/lib/Sema/ConstraintSystem.cpp +++ b/lib/Sema/ConstraintSystem.cpp @@ -928,6 +928,59 @@ TypeVariableType *ConstraintSystem::isRepresentativeFor( return *member; } +Optional> +ConstraintSystem::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; +} + +Optional> +ConstraintSystem::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; +} + +Optional> +ConstraintSystem::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; +} + /// Does a var or subscript produce an l-value? /// /// \param baseType - the type of the base on which this object diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index 28b68e4779354..c74685f997e42 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -3080,62 +3080,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. /// From a331ba0780c4b5f027de5d5076856ada6a17a3d5 Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Sat, 30 May 2020 12:31:53 -0300 Subject: [PATCH 081/222] [ConstraintSystem] Abstract common logic for various get property wrappers get information --- lib/Sema/ConstraintSystem.cpp | 97 ++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 37 deletions(-) diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index deab8571db37b..854dcf019638d 100644 --- a/lib/Sema/ConstraintSystem.cpp +++ b/lib/Sema/ConstraintSystem.cpp @@ -928,59 +928,82 @@ TypeVariableType *ConstraintSystem::isRepresentativeFor( return *member; } -Optional> -ConstraintSystem::getStorageWrapperInformation(SelectedOverload resolvedOverload) { +static Optional> +getPropertyWrappersInformationFromOverload( + SelectedOverload resolvedOverload, DeclContext *DC, + llvm::function_ref>(VarDecl *)> + getInformation) { 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); + 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; } +static Optional> +getStorageWrapperInformationFromDecl(VarDecl *decl) { + 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) { - 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; +ConstraintSystem::getStorageWrapperInformation( + SelectedOverload resolvedOverload) { + return getPropertyWrappersInformationFromOverload( + resolvedOverload, DC, + [](VarDecl *decl) { return getStorageWrapperInformationFromDecl(decl); }); +} + +static Optional> +getPropertyWrapperInformationFromDecl(VarDecl *decl) { + if (!decl->hasAttachedPropertyWrapper()) + return None; + + return std::make_pair(decl, decl->getPropertyWrapperBackingPropertyType()); } Optional> -ConstraintSystem::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); - } - } - } +ConstraintSystem::getPropertyWrapperInformation( + SelectedOverload resolvedOverload) { + return getPropertyWrappersInformationFromOverload( + resolvedOverload, DC, [](VarDecl *decl) { + return getPropertyWrapperInformationFromDecl(decl); + }); +} + +static Optional> +getWrappedPropertyInformationFromDecl(VarDecl *decl) { + if (auto wrapped = decl->getOriginalWrappedProperty()) + return std::make_pair(decl, wrapped->getInterfaceType()); + return None; } +Optional> +ConstraintSystem::getWrappedPropertyInformation( + SelectedOverload resolvedOverload) { + return getPropertyWrappersInformationFromOverload( + resolvedOverload, DC, [](VarDecl *decl) { + return getWrappedPropertyInformationFromDecl(decl); + }); +} + /// Does a var or subscript produce an l-value? /// /// \param baseType - the type of the base on which this object From 915c4a6997119b1c67cd83c61619538dc4586aa9 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 20 Apr 2020 14:10:51 +0900 Subject: [PATCH 082/222] [LTO] Support LLVM level link time optimization This commit adds -lto flag for driver to enable LTO at LLVM level. When -lto=llvm given, compiler emits LLVM bitcode file instead of object file and perform thin LTO using libLTO.dylib plugin. When -lto=llvm-full given, perform full LTO instead of thin LTO. --- include/swift/AST/IRGenOptions.h | 9 +++ include/swift/Driver/Action.h | 7 +- include/swift/Driver/Driver.h | 8 +++ include/swift/Option/Options.td | 4 ++ lib/Driver/DarwinToolChains.cpp | 28 +++++++- lib/Driver/Driver.cpp | 31 ++++++-- lib/Driver/ToolChains.cpp | 5 ++ lib/Driver/ToolChains.h | 3 + lib/Driver/UnixToolChains.cpp | 26 ++++++- lib/Driver/WindowsToolChains.cpp | 71 +++++++++++++++---- lib/Frontend/CompilerInvocation.cpp | 11 +++ lib/IRGen/IRGen.cpp | 9 ++- lib/IRGen/IRGenModule.cpp | 27 +++++-- test/Driver/Inputs/lto/lib.swift | 1 + test/Driver/Inputs/lto/main.swift | 3 + test/Driver/Inputs/lto/multifiles/file.swift | 3 + test/Driver/Inputs/lto/multifiles/main.swift | 1 + test/Driver/link-time-opt-lib-thin.swift | 12 ++++ test/Driver/link-time-opt-lib.swift | 5 ++ .../Driver/link-time-opt-staticlib-thin.swift | 14 ++++ test/Driver/link-time-opt-staticlib.swift | 6 ++ test/Driver/link-time-opt.swift | 5 ++ utils/build-windows.bat | 3 +- 23 files changed, 256 insertions(+), 36 deletions(-) create mode 100644 test/Driver/Inputs/lto/lib.swift create mode 100644 test/Driver/Inputs/lto/main.swift create mode 100644 test/Driver/Inputs/lto/multifiles/file.swift create mode 100644 test/Driver/Inputs/lto/multifiles/main.swift create mode 100644 test/Driver/link-time-opt-lib-thin.swift create mode 100644 test/Driver/link-time-opt-lib.swift create mode 100644 test/Driver/link-time-opt-staticlib-thin.swift create mode 100644 test/Driver/link-time-opt-staticlib.swift create mode 100644 test/Driver/link-time-opt.swift diff --git a/include/swift/AST/IRGenOptions.h b/include/swift/AST/IRGenOptions.h index 52ffcc34aca36..87fe069c794e2 100644 --- a/include/swift/AST/IRGenOptions.h +++ b/include/swift/AST/IRGenOptions.h @@ -65,6 +65,12 @@ enum class IRGenDebugInfoFormat : unsigned { CodeView }; +enum class IRGenLLVMLTOKind : unsigned { + None, + Thin, + Full +}; + enum class IRGenEmbedMode : unsigned { None, EmbedMarker, @@ -221,6 +227,8 @@ class IRGenOptions { /// Whether we should embed the bitcode file. IRGenEmbedMode EmbedMode : 2; + IRGenLLVMLTOKind LLVMLTOKind: 2; + /// Add names to LLVM values. unsigned HasValueNamesSetting : 1; unsigned ValueNames : 1; @@ -323,6 +331,7 @@ class IRGenOptions { DisableFPElimLeaf(false), DisableFPElim(true), Playground(false), EmitStackPromotionChecks(false), FunctionSections(false), PrintInlineTree(false), EmbedMode(IRGenEmbedMode::None), + LLVMLTOKind(IRGenLLVMLTOKind::None), HasValueNamesSetting(false), ValueNames(false), EnableReflectionMetadata(true), EnableReflectionNames(true), EnableAnonymousContextMangledNames(false), ForcePublicLinkage(false), diff --git a/include/swift/Driver/Action.h b/include/swift/Driver/Action.h index 3f4e5c4edec14..eddff1591ce65 100644 --- a/include/swift/Driver/Action.h +++ b/include/swift/Driver/Action.h @@ -329,16 +329,19 @@ class GeneratePCHJobAction : public JobAction { class DynamicLinkJobAction : public JobAction { virtual void anchor(); LinkKind Kind; + bool LTO; public: - DynamicLinkJobAction(ArrayRef Inputs, LinkKind K) + DynamicLinkJobAction(ArrayRef Inputs, LinkKind K, bool LTO) : JobAction(Action::Kind::DynamicLinkJob, Inputs, file_types::TY_Image), - Kind(K) { + Kind(K), LTO(LTO) { assert(Kind != LinkKind::None && Kind != LinkKind::StaticLibrary); } LinkKind getKind() const { return Kind; } + bool PerformLTO() const { return LTO; } + static bool classof(const Action *A) { return A->getKind() == Action::Kind::DynamicLinkJob; } diff --git a/include/swift/Driver/Driver.h b/include/swift/Driver/Driver.h index 9723f4527ced4..156a758af3cb9 100644 --- a/include/swift/Driver/Driver.h +++ b/include/swift/Driver/Driver.h @@ -102,6 +102,14 @@ class OutputInfo { /// The output type which should be used for compile actions. file_types::ID CompilerOutputType = file_types::ID::TY_INVALID; + enum class LTOKind { + None, + LLVMThin, + LLVMFull, + }; + + LTOKind LTOVariant = LTOKind::None; + /// Describes if and how the output of compile actions should be /// linked together. LinkKind LinkAction = LinkKind::None; diff --git a/include/swift/Option/Options.td b/include/swift/Option/Options.td index 96cea8b35cded..1e9ee77e3c561 100644 --- a/include/swift/Option/Options.td +++ b/include/swift/Option/Options.td @@ -499,6 +499,10 @@ def disable_bridging_pch : Flag<["-"], "disable-bridging-pch">, Flags<[HelpHidden]>, HelpText<"Disable automatic generation of bridging PCH files">; +def lto : Joined<["-"], "lto=">, + Flags<[FrontendOption, NoInteractiveOption]>, + HelpText<"Specify the LTO type to either 'llvm' or 'llvm-full'">; + // Experimental feature options // Note: this flag will be removed when JVP/differential generation in the diff --git a/lib/Driver/DarwinToolChains.cpp b/lib/Driver/DarwinToolChains.cpp index bfd3bd442d3cc..f50877d6db639 100644 --- a/lib/Driver/DarwinToolChains.cpp +++ b/lib/Driver/DarwinToolChains.cpp @@ -238,12 +238,15 @@ toolchains::Darwin::addLinkerInputArgs(InvocationInfo &II, Arguments.push_back("-filelist"); Arguments.push_back(context.getTemporaryFilePath("inputs", "LinkFileList")); II.FilelistInfos.push_back( - {Arguments.back(), file_types::TY_Object, + {Arguments.back(), context.OI.CompilerOutputType, FilelistInfo::WhichFiles::InputJobsAndSourceInputActions}); } else { addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, file_types::TY_Object); + addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, + file_types::TY_LLVM_BC); addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); + addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); } @@ -306,6 +309,20 @@ toolchains::Darwin::addArgsToLinkARCLite(ArgStringList &Arguments, } } +void +toolchains::Darwin::addLTOLibArgs(ArgStringList &Arguments, + const JobContext &context) const { + llvm::SmallString<128> LTOLibPath; + if (findXcodeClangPath(LTOLibPath)) { + llvm::sys::path::remove_filename(LTOLibPath); // 'clang' + llvm::sys::path::remove_filename(LTOLibPath); // 'bin' + llvm::sys::path::append(LTOLibPath, "lib", "libLTO.dylib"); + + Arguments.push_back("-lto_library"); + Arguments.push_back(context.Args.MakeArgString(LTOLibPath)); + } +} + void toolchains::Darwin::addSanitizerArgs(ArgStringList &Arguments, const DynamicLinkJobAction &job, @@ -723,6 +740,10 @@ toolchains::Darwin::constructInvocation(const DynamicLinkJobAction &job, addArgsToLinkARCLite(Arguments, context); + if (job.PerformLTO()) { + addLTOLibArgs(Arguments, context); + } + for (const Arg *arg : context.Args.filtered(options::OPT_F, options::OPT_Fsystem)) { Arguments.push_back("-F"); @@ -790,14 +811,17 @@ toolchains::Darwin::constructInvocation(const StaticLinkJobAction &job, if (context.shouldUseInputFileList()) { Arguments.push_back("-filelist"); Arguments.push_back(context.getTemporaryFilePath("inputs", "LinkFileList")); - II.FilelistInfos.push_back({Arguments.back(), file_types::TY_Object, + II.FilelistInfos.push_back({Arguments.back(), context.OI.CompilerOutputType, FilelistInfo::WhichFiles::InputJobs}); } else { addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, file_types::TY_Object); + addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, + file_types::TY_LLVM_BC); } addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); + addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); Arguments.push_back("-o"); diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 4b9428e9d3de0..ffb0d1e9f2770 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1427,12 +1427,15 @@ static bool isSDKTooOld(StringRef sdkPath, const llvm::Triple &target) { void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args, const bool BatchMode, const InputFileList &Inputs, OutputInfo &OI) const { + auto LinkerInputType = Args.hasArg(options::OPT_lto) + ? file_types::TY_LLVM_BC + : file_types::TY_Object; // By default, the driver does not link its output; this will be updated // appropriately below if linking is required. OI.CompilerOutputType = driverKind == DriverKind::Interactive ? file_types::TY_Nothing - : file_types::TY_Object; + : LinkerInputType; if (const Arg *A = Args.getLastArg(options::OPT_num_threads)) { if (BatchMode) { @@ -1462,14 +1465,14 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args, diag::error_static_emit_executable_disallowed); OI.LinkAction = LinkKind::Executable; - OI.CompilerOutputType = file_types::TY_Object; + OI.CompilerOutputType = LinkerInputType; break; case options::OPT_emit_library: OI.LinkAction = Args.hasArg(options::OPT_static) ? LinkKind::StaticLibrary : LinkKind::DynamicLibrary; - OI.CompilerOutputType = file_types::TY_Object; + OI.CompilerOutputType = LinkerInputType; break; case options::OPT_static: @@ -1779,6 +1782,18 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args, } + if (const Arg *A = Args.getLastArg(options::OPT_lto)) { + auto LTOVariant = llvm::StringSwitch>(A->getValue()) + .Case("llvm", OutputInfo::LTOKind::LLVMThin) + .Case("llvm-full", OutputInfo::LTOKind::LLVMFull) + .Default(llvm::None); + if (LTOVariant) + OI.LTOVariant = LTOVariant.getValue(); + else + Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value, + A->getAsString(Args), A->getValue()); + } + if (TC.getTriple().isOSWindows()) { if (const Arg *A = Args.getLastArg(options::OPT_libc)) { OI.RuntimeVariant = @@ -2113,15 +2128,17 @@ void Driver::buildActions(SmallVectorImpl &TopLevelActions, MergeModuleAction = C.createAction(AllModuleInputs); } + auto PerformLTO = Args.hasArg(options::OPT_lto); if (OI.shouldLink() && !AllLinkerInputs.empty()) { JobAction *LinkAction = nullptr; if (OI.LinkAction == LinkKind::StaticLibrary) { LinkAction = C.createAction(AllLinkerInputs, - OI.LinkAction); + OI.LinkAction); } else { LinkAction = C.createAction(AllLinkerInputs, - OI.LinkAction); + OI.LinkAction, + PerformLTO); } // On ELF platforms there's no built in autolinking mechanism, so we @@ -2130,7 +2147,7 @@ void Driver::buildActions(SmallVectorImpl &TopLevelActions, const auto &Triple = TC.getTriple(); SmallVector AutolinkExtractInputs; for (const Action *A : AllLinkerInputs) - if (A->getType() == file_types::TY_Object) { + if (A->getType() == OI.CompilerOutputType) { // Shared objects on ELF platforms don't have a swift1_autolink_entries // section in them because the section in the .o files is marked as // SHF_EXCLUDE. @@ -2146,7 +2163,7 @@ void Driver::buildActions(SmallVectorImpl &TopLevelActions, (Triple.getObjectFormat() == llvm::Triple::ELF && !Triple.isPS4()) || Triple.getObjectFormat() == llvm::Triple::Wasm || Triple.isOSCygMing(); - if (!AutolinkExtractInputs.empty() && AutolinkExtractRequired) { + if (!AutolinkExtractInputs.empty() && AutolinkExtractRequired && !PerformLTO) { auto *AutolinkExtractAction = C.createAction(AutolinkExtractInputs); // Takes the same inputs as the linker... diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 90065e3fe2aa3..70f33d855fd79 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -519,6 +519,11 @@ ToolChain::constructInvocation(const CompileJobAction &job, Arguments.push_back("-track-system-dependencies"); } + if (auto arg = context.Args.getLastArg(options::OPT_lto)) { + Arguments.push_back(context.Args.MakeArgString( + Twine("-lto=") + arg->getValue())); + } + context.Args.AddLastArg( Arguments, options:: diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h index 29a04c1b243a8..946a8e70bc446 100644 --- a/lib/Driver/ToolChains.h +++ b/lib/Driver/ToolChains.h @@ -48,6 +48,9 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public ToolChain { void addDeploymentTargetArgs(llvm::opt::ArgStringList &Arguments, const JobContext &context) const; + void addLTOLibArgs(llvm::opt::ArgStringList &Arguments, + const JobContext &context) const; + void addCommonFrontendArgs( const OutputInfo &OI, const CommandOutput &output, const llvm::opt::ArgList &inputArgs, diff --git a/lib/Driver/UnixToolChains.cpp b/lib/Driver/UnixToolChains.cpp index 59f24a4eafe1e..75c812b9521ad 100644 --- a/lib/Driver/UnixToolChains.cpp +++ b/lib/Driver/UnixToolChains.cpp @@ -72,7 +72,10 @@ ToolChain::InvocationInfo toolchains::GenericUnix::constructInvocation( addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, file_types::TY_Object); + addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, + file_types::TY_LLVM_BC); addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); + addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); Arguments.push_back("-o"); Arguments.push_back( @@ -167,6 +170,9 @@ toolchains::GenericUnix::constructInvocation(const DynamicLinkJobAction &job, std::string Linker; if (const Arg *A = context.Args.getLastArg(options::OPT_use_ld)) { Linker = A->getValue(); + } else if (context.OI.LTOVariant != OutputInfo::LTOKind::None) { + // Force to use lld for LTO + Linker = "lld"; } else { Linker = getDefaultLinker(); } @@ -218,6 +224,16 @@ toolchains::GenericUnix::constructInvocation(const DynamicLinkJobAction &job, Arguments.push_back("-pie"); } + switch (context.OI.LTOVariant) { + case OutputInfo::LTOKind::LLVMThin: + Arguments.push_back("-flto=thin"); + break; + case OutputInfo::LTOKind::LLVMFull: + Arguments.push_back("-flto=full"); + break; + case OutputInfo::LTOKind::None: break; + } + bool staticExecutable = false; bool staticStdlib = false; @@ -253,7 +269,11 @@ toolchains::GenericUnix::constructInvocation(const DynamicLinkJobAction &job, addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, file_types::TY_Object); + addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, + file_types::TY_LLVM_BC); addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); + addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); + for (const Arg *arg : context.Args.filtered(options::OPT_F, options::OPT_Fsystem)) { @@ -368,7 +388,7 @@ toolchains::GenericUnix::constructInvocation(const StaticLinkJobAction &job, ArgStringList Arguments; // Configure the toolchain. - const char *AR = "ar"; + const char *AR = "llvm-ar"; Arguments.push_back("crs"); Arguments.push_back( @@ -376,7 +396,11 @@ toolchains::GenericUnix::constructInvocation(const StaticLinkJobAction &job, addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, file_types::TY_Object); + addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, + file_types::TY_LLVM_BC); addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); + addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); + InvocationInfo II{AR, Arguments}; diff --git a/lib/Driver/WindowsToolChains.cpp b/lib/Driver/WindowsToolChains.cpp index 0fe623675eb1a..5131d14e14f03 100644 --- a/lib/Driver/WindowsToolChains.cpp +++ b/lib/Driver/WindowsToolChains.cpp @@ -143,7 +143,11 @@ toolchains::Windows::constructInvocation(const DynamicLinkJobAction &job, addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, file_types::TY_Object); + addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, + file_types::TY_LLVM_BC); addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); + addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); + for (const Arg *arg : context.Args.filtered(options::OPT_F, options::OPT_Fsystem)) { @@ -186,6 +190,21 @@ toolchains::Windows::constructInvocation(const DynamicLinkJobAction &job, context.Args.AddAllArgs(Arguments, options::OPT_linker_option_Group); context.Args.AddAllArgValues(Arguments, options::OPT_Xclang_linker); + switch (context.OI.LTOVariant) { + case OutputInfo::LTOKind::LLVMThin: + case OutputInfo::LTOKind::LLVMFull: { + if (Linker.empty()) + Arguments.push_back("-fuse-ld=lld"); + if (context.OI.LTOVariant == OutputInfo::LTOKind::LLVMThin) { + Arguments.push_back("-flto=thin"); + } else { + Arguments.push_back("-flto=full"); + } + break; + } + case OutputInfo::LTOKind::None: break; + } + // Run clang++ in verbose mode if "-v" is set if (context.Args.hasArg(options::OPT_v)) { Arguments.push_back("-v"); @@ -210,22 +229,46 @@ toolchains::Windows::constructInvocation(const StaticLinkJobAction &job, ArgStringList Arguments; - const char *Linker = "link"; - if (const Arg *A = context.Args.getLastArg(options::OPT_use_ld)) - Linker = context.Args.MakeArgString(A->getValue()); - - Arguments.push_back("/lib"); - Arguments.push_back("-nologo"); + switch (context.OI.LTOVariant) { + case OutputInfo::LTOKind::LLVMThin: + case OutputInfo::LTOKind::LLVMFull: { + const char *AR = "llvm-ar"; + Arguments.push_back("crs"); - addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, - file_types::TY_Object); - addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); + Arguments.push_back( + context.Args.MakeArgString(context.Output.getPrimaryOutputFilename())); - StringRef OutputFile = context.Output.getPrimaryOutputFilename(); - Arguments.push_back(context.Args.MakeArgString(Twine("/OUT:") + OutputFile)); + addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, + file_types::TY_Object); + addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, + file_types::TY_LLVM_BC); + addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); + addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); - InvocationInfo II{Linker, Arguments}; - II.allowsResponseFiles = true; + InvocationInfo II{AR, Arguments}; - return II; + return II; + } + case OutputInfo::LTOKind::None: + const char *Linker = "link"; + if (const Arg *A = context.Args.getLastArg(options::OPT_use_ld)) + Linker = context.Args.MakeArgString(A->getValue()); + + Arguments.push_back("/lib"); + Arguments.push_back("-nologo"); + + addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, + file_types::TY_Object); + addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, + file_types::TY_LLVM_BC); + addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); + addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); + + StringRef OutputFile = context.Output.getPrimaryOutputFilename(); + Arguments.push_back(context.Args.MakeArgString(Twine("/OUT:") + OutputFile)); + + InvocationInfo II{Linker, Arguments}; + II.allowsResponseFiles = true; + return II; + } } diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 17f28871d3243..7e68f9eeb6631 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1421,6 +1421,17 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args, } } + if (const Arg *A = Args.getLastArg(options::OPT_lto)) { + auto LLVMLTOKind = llvm::StringSwitch>(A->getValue()) + .Case("llvm", IRGenLLVMLTOKind::Thin) + .Case("llvm-full", IRGenLLVMLTOKind::Full) + .Default(llvm::None); + if (LLVMLTOKind) + Opts.LLVMLTOKind = LLVMLTOKind.getValue(); + else + Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value, + A->getAsString(Args), A->getValue()); + } if (const Arg *A = Args.getLastArg(options::OPT_sanitize_coverage_EQ)) { Opts.SanitizeCoverage = diff --git a/lib/IRGen/IRGen.cpp b/lib/IRGen/IRGen.cpp index f3947efa47588..060d2d3ac6c1b 100644 --- a/lib/IRGen/IRGen.cpp +++ b/lib/IRGen/IRGen.cpp @@ -548,9 +548,14 @@ bool swift::performLLVM(const IRGenOptions &Opts, case IRGenOutputKind::LLVMAssembly: EmitPasses.add(createPrintModulePass(*RawOS)); break; - case IRGenOutputKind::LLVMBitcode: - EmitPasses.add(createBitcodeWriterPass(*RawOS)); + case IRGenOutputKind::LLVMBitcode: { + if (Opts.LLVMLTOKind == IRGenLLVMLTOKind::Thin) { + EmitPasses.add(createWriteThinLTOBitcodePass(*RawOS)); + } else { + EmitPasses.add(createBitcodeWriterPass(*RawOS)); + } break; + } case IRGenOutputKind::NativeAssembly: case IRGenOutputKind::ObjectFile: { CodeGenFileType FileType; diff --git a/lib/IRGen/IRGenModule.cpp b/lib/IRGen/IRGenModule.cpp index 306ae4e3697b1..007726983c0f6 100644 --- a/lib/IRGen/IRGenModule.cpp +++ b/lib/IRGen/IRGenModule.cpp @@ -1132,10 +1132,18 @@ void IRGenModule::addLinkLibrary(const LinkLibrary &linkLib) { switch (linkLib.getKind()) { case LibraryKind::Library: { - llvm::SmallString<32> opt = - getTargetDependentLibraryOption(Triple, linkLib.getName()); - AutolinkEntries.push_back( - llvm::MDNode::get(ctx, llvm::MDString::get(ctx, opt))); + if (TargetInfo.OutputObjectFormat == llvm::Triple::ELF && IRGen.Opts.LLVMLTOKind != IRGenLLVMLTOKind::None) { + // When performing LTO, we always use lld that supports auto linking mechanism with ELF. + // So embed dependent libraries names in "llvm.dependent-libraries" instead of options + // to avoid using swift-autolink-extract. + AutolinkEntries.push_back( + llvm::MDNode::get(ctx, llvm::MDString::get(ctx, linkLib.getName()))); + } else { + llvm::SmallString<32> opt = + getTargetDependentLibraryOption(Triple, linkLib.getName()); + AutolinkEntries.push_back( + llvm::MDNode::get(ctx, llvm::MDString::get(ctx, opt))); + } break; } case LibraryKind::Framework: { @@ -1222,7 +1230,12 @@ static bool isFirstObjectFileInModule(IRGenModule &IGM) { void IRGenModule::emitAutolinkInfo() { // Collect the linker options already in the module (from ClangCodeGen). // FIXME: This constant should be vended by LLVM somewhere. - auto *Metadata = Module.getOrInsertNamedMetadata("llvm.linker.options"); + // When performing LTO, we always use lld that supports auto linking mechanism with ELF. + // So embed dependent libraries names in "llvm.dependent-libraries" instead of "llvm.linker.options". + const StringRef AutolinkSectionName = + TargetInfo.OutputObjectFormat == llvm::Triple::ELF && IRGen.Opts.LLVMLTOKind != IRGenLLVMLTOKind::None + ? "llvm.dependent-libraries" : "llvm.linker.options"; + auto *Metadata = Module.getOrInsertNamedMetadata(AutolinkSectionName); for (llvm::MDNode *LinkOption : Metadata->operands()) AutolinkEntries.push_back(LinkOption); @@ -1237,9 +1250,9 @@ void IRGenModule::emitAutolinkInfo() { AutolinkEntries.end()); const bool AutolinkExtractRequired = - (TargetInfo.OutputObjectFormat == llvm::Triple::ELF && !Triple.isPS4()) || + ((TargetInfo.OutputObjectFormat == llvm::Triple::ELF && !Triple.isPS4()) || TargetInfo.OutputObjectFormat == llvm::Triple::Wasm || - Triple.isOSCygMing(); + Triple.isOSCygMing()) && IRGen.Opts.LLVMLTOKind == IRGenLLVMLTOKind::None; if (!AutolinkExtractRequired) { // On platforms that support autolinking, continue to use the metadata. diff --git a/test/Driver/Inputs/lto/lib.swift b/test/Driver/Inputs/lto/lib.swift new file mode 100644 index 0000000000000..2da93851bb3e7 --- /dev/null +++ b/test/Driver/Inputs/lto/lib.swift @@ -0,0 +1 @@ +public func libraryFunction() {} diff --git a/test/Driver/Inputs/lto/main.swift b/test/Driver/Inputs/lto/main.swift new file mode 100644 index 0000000000000..fef49f4c4f8f2 --- /dev/null +++ b/test/Driver/Inputs/lto/main.swift @@ -0,0 +1,3 @@ +import A + +libraryFunction() diff --git a/test/Driver/Inputs/lto/multifiles/file.swift b/test/Driver/Inputs/lto/multifiles/file.swift new file mode 100644 index 0000000000000..2ff6e02c99461 --- /dev/null +++ b/test/Driver/Inputs/lto/multifiles/file.swift @@ -0,0 +1,3 @@ +func anotherFileFunction() { + print(#function) +} diff --git a/test/Driver/Inputs/lto/multifiles/main.swift b/test/Driver/Inputs/lto/multifiles/main.swift new file mode 100644 index 0000000000000..c81b011f13bd9 --- /dev/null +++ b/test/Driver/Inputs/lto/multifiles/main.swift @@ -0,0 +1 @@ +anotherFileFunction() diff --git a/test/Driver/link-time-opt-lib-thin.swift b/test/Driver/link-time-opt-lib-thin.swift new file mode 100644 index 0000000000000..f07ecded6e0c1 --- /dev/null +++ b/test/Driver/link-time-opt-lib-thin.swift @@ -0,0 +1,12 @@ +// FIXME: ld64 in Xcode toolchain uses older version of LLVM than swiftc, so ld64 can't read module summary for LTO +// from bitcode file produced by compiler. This should be fixed before shipping Xcode toolchain by upgrading +// LLVM version used in ld64. +// XFAIL: OS=macosx +// XFAIL: OS=tvos +// XFAIL: OS=watchos +// XFAIL: OS=ios +// RUN: rm -rf %t +// RUN: %empty-directory(%t/thin) + +// RUN: %target-swiftc_driver %S/Inputs/lto/lib.swift -lto=llvm -emit-library -emit-module -module-name A -working-directory %t/thin +// RUN: %target-swiftc_driver %S/Inputs/lto/main.swift -L. -I. -lA -lto=llvm -working-directory %t/thin diff --git a/test/Driver/link-time-opt-lib.swift b/test/Driver/link-time-opt-lib.swift new file mode 100644 index 0000000000000..81cfaa4cafe92 --- /dev/null +++ b/test/Driver/link-time-opt-lib.swift @@ -0,0 +1,5 @@ +// RUN: rm -rf %t +// RUN: %empty-directory(%t/full) + +// RUN: %target-swiftc_driver %S/Inputs/lto/lib.swift -lto=llvm-full -emit-library -emit-module -module-name A -working-directory %t/full +// RUN: %target-swiftc_driver %S/Inputs/lto/main.swift -L. -I. -lA -lto=llvm-full -working-directory %t/full diff --git a/test/Driver/link-time-opt-staticlib-thin.swift b/test/Driver/link-time-opt-staticlib-thin.swift new file mode 100644 index 0000000000000..283b7c541fcbd --- /dev/null +++ b/test/Driver/link-time-opt-staticlib-thin.swift @@ -0,0 +1,14 @@ +// UNSUPPORTED: OS=windows-msvc +// FIXME: ld64 in Xcode toolchain uses older version of LLVM than swiftc, so ld64 can't read module summary for LTO +// from bitcode file produced by compiler. This should be fixed before shipping Xcode toolchain by upgrading +// LLVM version used in ld64. +// XFAIL: OS=macosx +// XFAIL: OS=tvos +// XFAIL: OS=watchos +// XFAIL: OS=ios + +// RUN: rm -rf %t +// RUN: %empty-directory(%t/thin-static) + +// RUN: %target-swiftc_driver %S/Inputs/lto/lib.swift -static -lto=llvm -emit-library -emit-module -module-name A -working-directory %t/thin-static +// RUN: %target-swiftc_driver %S/Inputs/lto/main.swift -L. -I. -lA -lto=llvm -working-directory %t/thin-static diff --git a/test/Driver/link-time-opt-staticlib.swift b/test/Driver/link-time-opt-staticlib.swift new file mode 100644 index 0000000000000..6daf95595bf3e --- /dev/null +++ b/test/Driver/link-time-opt-staticlib.swift @@ -0,0 +1,6 @@ +// UNSUPPORTED: OS=windows-msvc +// RUN: rm -rf %t +// RUN: %empty-directory(%t/full-static) + +// RUN: %target-swiftc_driver %S/Inputs/lto/lib.swift -static -lto=llvm-full -emit-library -emit-module -module-name A -working-directory %t/full-static +// RUN: %target-swiftc_driver %S/Inputs/lto/main.swift -L. -I. -lA -lto=llvm-full -working-directory %t/full-static diff --git a/test/Driver/link-time-opt.swift b/test/Driver/link-time-opt.swift new file mode 100644 index 0000000000000..28a92ad1fcc99 --- /dev/null +++ b/test/Driver/link-time-opt.swift @@ -0,0 +1,5 @@ +// RUN: %target-swiftc_driver -driver-print-jobs %S/../Inputs/empty.swift -lto=llvm | %FileCheck %s --check-prefix=CHECK-%target-os --check-prefix=CHECK +// CHECK: swift{{(c\.exe")?}} -frontend -emit-bc +// CHECK-macosx-NEXT: bin/ld {{.+}} -lto_library {{.+}}/lib/libLTO.dylib +// CHECK-windows-msvc-NEXT: clang.exe" {{.+}} -fuse-ld=lld -flto=thin +// CHECK-linux-gnu-NEXT: bin/clang {{.+}} -flto=thin diff --git a/utils/build-windows.bat b/utils/build-windows.bat index ca62cfef8f43e..3c9c11e65ff49 100644 --- a/utils/build-windows.bat +++ b/utils/build-windows.bat @@ -97,6 +97,7 @@ git clone --depth 1 --single-branch https://github.com/apple/swift-cmark cmark % git clone --depth 1 --single-branch --branch swift/master https://github.com/apple/llvm-project llvm-project %exitOnError% mklink /D "%source_root%\clang" "%source_root%\llvm-project\clang" mklink /D "%source_root%\llvm" "%source_root%\llvm-project\llvm" +mklink /D "%source_root%\lld" "%source_root%\llvm-project\lld" mklink /D "%source_root%\lldb" "%source_root%\llvm-project\lldb" mklink /D "%source_root%\compiler-rt" "%source_root%\llvm-project\compiler-rt" mklink /D "%source_root%\libcxx" "%source_root%\llvm-project\libcxx" @@ -165,7 +166,7 @@ cmake^ -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-windows-msvc^ -DLLVM_ENABLE_PDB:BOOL=YES^ -DLLVM_ENABLE_ASSERTIONS:BOOL=YES^ - -DLLVM_ENABLE_PROJECTS:STRING=clang^ + -DLLVM_ENABLE_PROJECTS:STRING=lld;clang^ -DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;X86"^ -DLLVM_INCLUDE_BENCHMARKS:BOOL=NO^ -DLLVM_INCLUDE_DOCS:BOOL=NO^ From cc15c0b8dd40d5a1a48ed96c1b097999331119fb Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Sun, 31 May 2020 12:28:19 -0300 Subject: [PATCH 083/222] [ConstraintSystem] Remove unnecessary check for decl and use getDeclOrNNull --- lib/Sema/ConstraintSystem.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index 854dcf019638d..4e5dae6538a7b 100644 --- a/lib/Sema/ConstraintSystem.cpp +++ b/lib/Sema/ConstraintSystem.cpp @@ -929,22 +929,21 @@ TypeVariableType *ConstraintSystem::isRepresentativeFor( } static Optional> -getPropertyWrappersInformationFromOverload( +getPropertyWrapperInformationFromOverload( SelectedOverload resolvedOverload, DeclContext *DC, llvm::function_ref>(VarDecl *)> getInformation) { - if (resolvedOverload.choice.isDecl()) { - if (auto *decl = dyn_cast(resolvedOverload.choice.getDecl())) { - 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); + 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; @@ -965,7 +964,7 @@ getStorageWrapperInformationFromDecl(VarDecl *decl) { Optional> ConstraintSystem::getStorageWrapperInformation( SelectedOverload resolvedOverload) { - return getPropertyWrappersInformationFromOverload( + return getPropertyWrapperInformationFromOverload( resolvedOverload, DC, [](VarDecl *decl) { return getStorageWrapperInformationFromDecl(decl); }); } @@ -981,7 +980,7 @@ getPropertyWrapperInformationFromDecl(VarDecl *decl) { Optional> ConstraintSystem::getPropertyWrapperInformation( SelectedOverload resolvedOverload) { - return getPropertyWrappersInformationFromOverload( + return getPropertyWrapperInformationFromOverload( resolvedOverload, DC, [](VarDecl *decl) { return getPropertyWrapperInformationFromDecl(decl); }); @@ -998,7 +997,7 @@ getWrappedPropertyInformationFromDecl(VarDecl *decl) { Optional> ConstraintSystem::getWrappedPropertyInformation( SelectedOverload resolvedOverload) { - return getPropertyWrappersInformationFromOverload( + return getPropertyWrapperInformationFromOverload( resolvedOverload, DC, [](VarDecl *decl) { return getWrappedPropertyInformationFromDecl(decl); }); From c91211c3ad02efbc1a9ba52aebb8f9810ac65d69 Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Sun, 31 May 2020 17:07:25 -0300 Subject: [PATCH 084/222] [ConstraintSystem] Inline static method calls into the closures --- lib/Sema/ConstraintSystem.cpp | 59 +++++++++++++++-------------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index 4e5dae6538a7b..fa6e538308065 100644 --- a/lib/Sema/ConstraintSystem.cpp +++ b/lib/Sema/ConstraintSystem.cpp @@ -934,14 +934,14 @@ getPropertyWrapperInformationFromOverload( llvm::function_ref>(VarDecl *)> getInformation) { if (auto *decl = - dyn_cast_or_null(resolvedOverload.choice.getDeclOrNull())) { + 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); + type = + baseType->getTypeOfMember(DC->getParentModule(), memberDecl, type); } return std::make_pair(decl, type); } @@ -949,57 +949,48 @@ getPropertyWrapperInformationFromOverload( return None; } -static Optional> -getStorageWrapperInformationFromDecl(VarDecl *decl) { - if (!decl->hasAttachedPropertyWrapper()) - return None; - - auto storageWrapper = decl->getPropertyWrapperStorageWrapper(); - if (!storageWrapper) - return None; - - return std::make_pair(storageWrapper, storageWrapper->getInterfaceType()); -} - Optional> ConstraintSystem::getStorageWrapperInformation( SelectedOverload resolvedOverload) { return getPropertyWrapperInformationFromOverload( resolvedOverload, DC, - [](VarDecl *decl) { return getStorageWrapperInformationFromDecl(decl); }); -} + [](VarDecl *decl) -> Optional> { + if (!decl->hasAttachedPropertyWrapper()) + return None; -static Optional> -getPropertyWrapperInformationFromDecl(VarDecl *decl) { - if (!decl->hasAttachedPropertyWrapper()) - return None; + auto storageWrapper = decl->getPropertyWrapperStorageWrapper(); + if (!storageWrapper) + return None; - return std::make_pair(decl, decl->getPropertyWrapperBackingPropertyType()); + return std::make_pair(storageWrapper, + storageWrapper->getInterfaceType()); + }); } Optional> ConstraintSystem::getPropertyWrapperInformation( SelectedOverload resolvedOverload) { return getPropertyWrapperInformationFromOverload( - resolvedOverload, DC, [](VarDecl *decl) { - return getPropertyWrapperInformationFromDecl(decl); - }); -} - -static Optional> -getWrappedPropertyInformationFromDecl(VarDecl *decl) { - if (auto wrapped = decl->getOriginalWrappedProperty()) - return std::make_pair(decl, wrapped->getInterfaceType()); + resolvedOverload, DC, + [](VarDecl *decl) -> Optional> { + if (!decl->hasAttachedPropertyWrapper()) + return None; - return None; + return std::make_pair(decl, + decl->getPropertyWrapperBackingPropertyType()); + }); } Optional> ConstraintSystem::getWrappedPropertyInformation( SelectedOverload resolvedOverload) { return getPropertyWrapperInformationFromOverload( - resolvedOverload, DC, [](VarDecl *decl) { - return getWrappedPropertyInformationFromDecl(decl); + resolvedOverload, DC, + [](VarDecl *decl) -> Optional> { + if (auto wrapped = decl->getOriginalWrappedProperty()) + return std::make_pair(decl, wrapped->getInterfaceType()); + + return None; }); } From 251dbb9b8c4c304903b18db692fc46a5a631c3b2 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Mon, 1 Jun 2020 14:00:39 -0700 Subject: [PATCH 085/222] [driver] Improve handling of supplementary outputs in createCompilerInvocation Mark the relevant options in Options.td rather than hard-coding the list in code, and handle a few more options suggested during the review. --- include/swift/Option/Options.h | 1 + include/swift/Option/Options.td | 58 ++++++++++++++-------- lib/Driver/FrontendUtil.cpp | 13 ++--- test/Driver/createCompilerInvocation.swift | 11 +++- 4 files changed, 51 insertions(+), 32 deletions(-) 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 a430124cc7f27..e98d76a666224 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]>, @@ -403,32 +415,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 : @@ -439,25 +453,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">, diff --git a/lib/Driver/FrontendUtil.cpp b/lib/Driver/FrontendUtil.cpp index 17c565a7ea92f..3c0cac6163d4a 100644 --- a/lib/Driver/FrontendUtil.cpp +++ b/lib/Driver/FrontendUtil.cpp @@ -59,16 +59,11 @@ bool swift::driver::getSingleFrontendInvocationFromDriverArguments( return true; if (ForceNoOutputs) { - // Clear existing output modes. + // Clear existing output modes and supplementary outputs. ArgList->eraseArg(options::OPT_modes_Group); - // Disable other output options that conflict with -typecheck. - ArgList->eraseArg(options::OPT_emit_module); - ArgList->eraseArg(options::OPT_emit_module_path); - ArgList->eraseArg(options::OPT_emit_module_source_info_path); - ArgList->eraseArg(options::OPT_emit_module_interface); - ArgList->eraseArg(options::OPT_emit_module_interface_path); - ArgList->eraseArg(options::OPT_emit_objc_header); - ArgList->eraseArg(options::OPT_emit_objc_header_path); + ArgList->eraseArgIf([](const llvm::opt::Arg *A) { + return A && A->getOption().hasFlag(options::SupplementaryOutput); + }); unsigned index = ArgList->MakeIndex("-typecheck"); // Takes ownership of the Arg. diff --git a/test/Driver/createCompilerInvocation.swift b/test/Driver/createCompilerInvocation.swift index 30a340e598ad5..1f9bec4fe9c3a 100644 --- a/test/Driver/createCompilerInvocation.swift +++ b/test/Driver/createCompilerInvocation.swift @@ -8,7 +8,9 @@ // CHECK-FAIL: error: unable to create a CompilerInvocation // CHECK-NOWARN-NOT: warning -// RUN: %swift-ide-test_plain -test-createCompilerInvocation -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 %s 2>&1 | %FileCheck %s --check-prefix=NORMAL_ARGS --implicit-check-not="error: " +// 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 @@ -19,15 +21,20 @@ // 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 -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 %s 2>&1 > %t.nooutput_args +// 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 From 6e368aec136a733a6355483ef7c52b962e33270b Mon Sep 17 00:00:00 2001 From: Martin Boehme Date: Tue, 2 Jun 2020 16:50:31 +0200 Subject: [PATCH 086/222] Add new enum value clang::BuiltinType::IncompleteMatrixIdx to switch statements. --- lib/ClangImporter/ClangAdapter.cpp | 1 + lib/ClangImporter/ImportType.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/ClangImporter/ClangAdapter.cpp b/lib/ClangImporter/ClangAdapter.cpp index 351f8b6788f36..454b5393e329a 100644 --- a/lib/ClangImporter/ClangAdapter.cpp +++ b/lib/ClangImporter/ClangAdapter.cpp @@ -344,6 +344,7 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx, case clang::BuiltinType::ARCUnbridgedCast: case clang::BuiltinType::BoundMember: case clang::BuiltinType::BuiltinFn: + case clang::BuiltinType::IncompleteMatrixIdx: case clang::BuiltinType::Overload: case clang::BuiltinType::PseudoObject: case clang::BuiltinType::UnknownAny: diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index cd769354c954b..2b62a2c786409 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -243,6 +243,7 @@ namespace { case clang::BuiltinType::ARCUnbridgedCast: case clang::BuiltinType::BoundMember: case clang::BuiltinType::BuiltinFn: + case clang::BuiltinType::IncompleteMatrixIdx: case clang::BuiltinType::Overload: case clang::BuiltinType::PseudoObject: case clang::BuiltinType::UnknownAny: From 51bace649b49dc86d01bdabdf1d1229f9f2b549c Mon Sep 17 00:00:00 2001 From: Nathan Hawes Date: Fri, 15 May 2020 10:17:23 -0700 Subject: [PATCH 087/222] [IDE][SourceKit/DocSupport] Add members of underscored protocol extensions in extensions of conforming types. We would previously hide the protocol, its extensions and members, but the '_' prefix really just means the protocol itself isn't intended for clients, rather than its members. This also adds support for 'fully_annotated_decl' entries in doc-info for extensions to be consistent with every other decl, and removes the 'fully_annotated_generic_signature' entry we supplied as a fallback. Also fixes several bugs with the synthesized extensions mechanism: - The type sustitutions applied to the extension's requirements were computed using the extension itself as the decl context rather than the extension's nominal. The meant the extension's requirements themselves were assumed to hold when determining the substitutions, so equality constraints were always met. Because of this extension members were incorrectly merged with the base nominal or its extensions despite having additional constraints. - Types within the requirements weren't being transformed when printed (e.g. 'Self.Element' was printed rather than 'T') both in the interface output and in the requirements list. We were also incorrectly printing requirements that were already satisfied once the base type was subsituted in. - If both the protocol extension and 'enabling' extension of the base nominal that added the protocol conformance had conditional requirements, we were only printing the protocol extension's requirements in the synthesized extension. - The USR and annotated decl output embedded in the 'key.doc.full_as_xml' string for synthesized members were printed to match their original context, rather than the synthesized one. Resolves rdar://problem/57121937 --- include/swift/IDE/CommentConversion.h | 5 +- lib/AST/ASTPrinter.cpp | 96 +- lib/IDE/CommentConversion.cpp | 29 +- lib/IDE/IDETypeChecking.cpp | 48 +- test/IDE/print_synthesized_extensions.swift | 8 +- .../doc_clang_module.swift.response | 1800 ++++++++--------- .../DocSupport/doc_source_file.swift.response | 1 + .../doc_swift_module.swift.response | 124 +- .../doc_swift_module1.swift.response | 10 +- .../doc_system_module_underscored.swift | 8 + ...c_system_module_underscored.swift.response | 1763 ++++++++++++++++ .../Inputs/UnderscoredProto.swiftinterface | 101 + .../lib/SwiftLang/SwiftDocSupport.cpp | 133 +- .../lib/SwiftLang/SwiftLangSupport.h | 8 +- .../lib/SwiftLang/SwiftSourceDocInfo.cpp | 16 +- 15 files changed, 3106 insertions(+), 1044 deletions(-) create mode 100644 test/SourceKit/DocSupport/doc_system_module_underscored.swift create mode 100644 test/SourceKit/DocSupport/doc_system_module_underscored.swift.response create mode 100644 test/SourceKit/Inputs/UnderscoredProto.swiftinterface 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/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index b3815525627ee..0ee3b2a21fade 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()); } @@ -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) { @@ -2180,8 +2190,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 +2243,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 "; } - 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/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/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/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/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp b/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp index e9749ad813e70..13dd679595455 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) { 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; From b857b224c759b729ddd21f70b72237e511bca777 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Wed, 3 Jun 2020 11:03:54 -0700 Subject: [PATCH 088/222] NFC: Rename shouldCollectToken -> shouldCollectTokens And fix the name of the underlying vector. --- include/swift/AST/SourceFile.h | 11 ++++++++--- lib/AST/Module.cpp | 16 ++++++++-------- lib/Parse/Parser.cpp | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/include/swift/AST/SourceFile.h b/include/swift/AST/SourceFile.h index 0b0a17f56bd58..25903b9415ad3 100644 --- a/include/swift/AST/SourceFile.h +++ b/include/swift/AST/SourceFile.h @@ -573,9 +573,13 @@ class SourceFile final : public FileUnit { 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; @@ -602,8 +606,9 @@ 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; }; diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp index 41c4ac32330e0..54141c4549ef0 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -2232,26 +2232,26 @@ SourceFile::SourceFile(ModuleDecl &M, SourceFileKind K, (void)problem; } if (KeepParsedTokens) { - AllCorrectedTokens = std::vector(); + AllCollectedTokens = std::vector(); } } std::vector &SourceFile::getTokenVector() { - assert(shouldCollectToken() && "Disabled"); - return *AllCorrectedTokens; + assert(shouldCollectTokens() && "Disabled"); + return *AllCollectedTokens; } ArrayRef SourceFile::getAllTokens() const { - assert(shouldCollectToken() && "Disabled"); - return *AllCorrectedTokens; + assert(shouldCollectTokens() && "Disabled"); + return *AllCollectedTokens; } -bool SourceFile::shouldCollectToken() const { +bool SourceFile::shouldCollectTokens() const { switch (Kind) { case SourceFileKind::Library: case SourceFileKind::Main: case SourceFileKind::Interface: - return (bool)AllCorrectedTokens; + return (bool)AllCollectedTokens; case SourceFileKind::SIL: return false; } @@ -2283,7 +2283,7 @@ bool SourceFile::hasDelayedBodyParsing() const { return false; if (hasInterfaceHash()) return false; - if (shouldCollectToken()) + if (shouldCollectTokens()) return false; if (shouldBuildSyntaxTree()) return false; diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 3b3a87d2e5c55..7cd9ccaa429bd 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -531,7 +531,7 @@ Parser::Parser(std::unique_ptr Lex, SourceFile &SF, CurDeclContext(&SF), Context(SF.getASTContext()), CurrentTokenHash(SF.getInterfaceHashPtr()), - TokReceiver(SF.shouldCollectToken() ? + TokReceiver(SF.shouldCollectTokens() ? new TokenRecorder(SF, L->getBufferID()) : new ConsumeTokenReceiver()), SyntaxContext(new SyntaxParsingContext(SyntaxContext, SF, From b5ab29b70c5e68d0a016b0dc71c2f005b1dee88b Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Wed, 3 Jun 2020 11:03:55 -0700 Subject: [PATCH 089/222] NFC: Inline canBeParsedInFull Now that SIL files no longer interleave parsing with type-checking, the query doesn't make much sense. Inline it into its only client, `shouldBuildSyntaxTree`. --- include/swift/AST/SourceFile.h | 2 -- lib/AST/Module.cpp | 14 +------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/include/swift/AST/SourceFile.h b/include/swift/AST/SourceFile.h index 25903b9415ad3..9d599e929691b 100644 --- a/include/swift/AST/SourceFile.h +++ b/include/swift/AST/SourceFile.h @@ -583,8 +583,6 @@ class SourceFile final : public FileUnit { bool shouldBuildSyntaxTree() const; - bool canBeParsedInFull() const; - /// Whether the bodies of types and functions within this file can be lazily /// parsed. bool hasDelayedBodyParsing() const; diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp index 54141c4549ef0..ef202d7fe977b 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -2259,19 +2259,7 @@ bool SourceFile::shouldCollectTokens() const { } 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 && SyntaxInfo->Enable; } bool SourceFile::hasDelayedBodyParsing() const { From 60eae88fd1d232af64ddc5f5e1bef264f6735a40 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Wed, 3 Jun 2020 11:03:55 -0700 Subject: [PATCH 090/222] Sink some parsing options into SourceFile::ParsingFlags Sink the `BuildSyntaxTree` and `CollectParsedTokens` bits into `SourceFile::ParsingFlags`, with a static method to get the parsing options from the lang opts. Also add a parsing flag for enabling the interface hash, which can be used instead of calling `enableInterfaceHash`. --- include/swift/AST/SourceFile.h | 28 ++++++++++++-------- lib/AST/Module.cpp | 47 +++++++++++++++++----------------- lib/Frontend/Frontend.cpp | 16 +++++++----- lib/IDE/CompletionInstance.cpp | 9 +++---- lib/Parse/Parser.cpp | 20 +++++++++------ lib/Sema/SourceLoader.cpp | 7 +++-- unittests/AST/TestContext.cpp | 2 +- 7 files changed, 68 insertions(+), 61 deletions(-) diff --git a/include/swift/AST/SourceFile.h b/include/swift/AST/SourceFile.h index 9d599e929691b..f969a56ce4b1f 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. @@ -110,12 +108,24 @@ class SourceFile final : public FileUnit { /// and adjust the client call 'performParseOnly'. 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(); @@ -544,13 +553,9 @@ 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() { @@ -608,7 +613,8 @@ class SourceFile final : public FileUnit { /// 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/lib/AST/Module.cpp b/lib/AST/Module.cpp index ef202d7fe977b..88ab30be8b007 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -1077,24 +1077,17 @@ 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(); + return ParsingOpts.contains(ParsingFlags::BuildSyntaxTree); } syntax::SourceFileSyntax SourceFile::getSyntaxRoot() const { assert(hasSyntaxRoot() && "no syntax root is set."); - return *SyntaxInfo->SyntaxRoot; + return *SyntaxRoot; } void SourceFile::setSyntaxRoot(syntax::SourceFileSyntax &&Root) { - SyntaxInfo->SyntaxRoot.emplace(Root); + SyntaxRoot = std::make_unique(std::move(Root)); } void DirectOperatorLookupRequest::writeDependencySink( @@ -2216,11 +2209,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,7 +2222,11 @@ SourceFile::SourceFile(ModuleDecl &M, SourceFileKind K, assert(!problem && "multiple main files?"); (void)problem; } - if (KeepParsedTokens) { + + if (hasInterfaceHash()) { + InterfaceHash.emplace(); + } + if (shouldCollectTokens()) { AllCollectedTokens = std::vector(); } } @@ -2241,25 +2236,29 @@ std::vector &SourceFile::getTokenVector() { return *AllCollectedTokens; } +SourceFile::ParsingOptions +SourceFile::getDefaultParsingOptions(const LangOptions &langOpts) { + ParsingOptions opts; + if (langOpts.BuildSyntaxTree) + opts |= ParsingFlags::BuildSyntaxTree; + if (langOpts.CollectParsedToken) + opts |= ParsingFlags::CollectParsedTokens; + return opts; +} + ArrayRef SourceFile::getAllTokens() const { assert(shouldCollectTokens() && "Disabled"); return *AllCollectedTokens; } bool SourceFile::shouldCollectTokens() const { - switch (Kind) { - case SourceFileKind::Library: - case SourceFileKind::Main: - case SourceFileKind::Interface: - return (bool)AllCollectedTokens; - case SourceFileKind::SIL: - return false; - } - llvm_unreachable("unhandled kind"); + return Kind != SourceFileKind::SIL && + ParsingOpts.contains(ParsingFlags::CollectParsedTokens); } bool SourceFile::shouldBuildSyntaxTree() const { - return Kind != SourceFileKind::SIL && SyntaxInfo->Enable; + return Kind != SourceFileKind::SIL && + ParsingOpts.contains(ParsingFlags::BuildSyntaxTree); } bool SourceFile::hasDelayedBodyParsing() const { diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index f39fe20f71962..0de037252aa82 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -902,15 +902,17 @@ 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); - + // Enable interface hash computation for primaries, but not in WMO, as it's + // only currently needed for incremental mode. if (isPrimary) { - inputFile->enableInterfaceHash(); + opts |= SourceFile::ParsingFlags::EnableInterfaceHash; } + opts |= SourceFile::getDefaultParsingOptions(getASTContext().LangOpts); + + auto *inputFile = new (*Context) + SourceFile(*mainModule, fileKind, bufferID, opts, isPrimary); + MainModule->addFile(*inputFile); + return inputFile; } 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/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 7cd9ccaa429bd..91a7d0daf60ff 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -109,6 +109,7 @@ void tokenize(const LangOptions &LangOpts, const SourceManager &SM, using namespace swift; using namespace swift::syntax; +using ParsingFlags = SourceFile::ParsingFlags; void SILParserStateBase::anchor() { } @@ -1196,14 +1197,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 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/unittests/AST/TestContext.cpp b/unittests/AST/TestContext.cpp index eb2439f3bc27e..434767e35edff 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) { From 22c1058d91fb162b7d70fc619370c38614be3f7f Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Wed, 3 Jun 2020 11:03:55 -0700 Subject: [PATCH 091/222] [Parse] Remove some unnecessary code The `SaveAndRestore` is unnecessary as `Parser`'s constructor already sets up the interface hash, and the request covers the `FrontendStatsTracer`. --- lib/Parse/ParseRequests.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/Parse/ParseRequests.cpp b/lib/Parse/ParseRequests.cpp index 3890b5cb55ce8..3667b2ee8b14e 100644 --- a/lib/Parse/ParseRequests.cpp +++ b/lib/Parse/ParseRequests.cpp @@ -149,13 +149,9 @@ 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); From 5fdc5f3098f094ec35edee76d6538b1833dcbcbb Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Wed, 3 Jun 2020 11:03:56 -0700 Subject: [PATCH 092/222] NFC: Clean up TokenRecorder a little Rename `Bag` to `Tokens`, and query the SourceManager from the ASTContext instead of storing it directly. --- lib/Parse/Parser.cpp | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 91a7d0daf60ff..baa364ba8210b 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -412,18 +412,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) { @@ -432,9 +431,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)); @@ -449,19 +448,18 @@ class TokenRecorder: public ConsumeTokenReceiver { } public: - TokenRecorder(SourceFile &SF, unsigned BufferID): - Ctx(SF.getASTContext()), - SM(SF.getASTContext().SourceMgr), - Bag(SF.getTokenVector()), - BufferID(BufferID) {}; + TokenRecorder(SourceFile &SF, unsigned BufferID) + : Ctx(SF.getASTContext()), BufferID(BufferID), + Tokens(SF.getTokenVector()) {} void 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 { @@ -473,14 +471,14 @@ 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()); } 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; } @@ -496,8 +494,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; } @@ -516,7 +514,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. From f57299a5871c0bf61feb10a56b3b167b6528a429 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Wed, 3 Jun 2020 11:03:56 -0700 Subject: [PATCH 093/222] Formalize some SourceFile parsing outputs Currently when parsing a SourceFile, the parser gets handed pointers so that it can write the interface hash and collected tokens directly into the file. It can also call `setSyntaxRoot` at the end of parsing to set the syntax tree. In preparation for the removal of `performParseOnly`, this commit formalizes these values as outputs of `ParseSourceFileRequest`, ensuring that the file gets parsed when the interface hash, collected tokens, or syntax tree is queried. --- include/swift/AST/ASTContext.h | 6 +++ include/swift/AST/ParseRequests.h | 16 +++++-- include/swift/AST/ParseTypeIDZone.def | 2 +- include/swift/AST/SourceFile.h | 18 ++----- include/swift/Parse/Parser.h | 21 ++++++-- include/swift/Parse/SyntaxParseActions.h | 10 +++- include/swift/SyntaxParse/SyntaxTreeCreator.h | 6 ++- lib/AST/Decl.cpp | 2 +- lib/AST/Module.cpp | 41 ++++++++-------- lib/Parse/ParseDecl.cpp | 16 +++---- lib/Parse/ParseIfConfig.cpp | 5 +- lib/Parse/ParseRequests.cpp | 39 +++++++++++---- lib/Parse/Parser.cpp | 48 ++++++++++++------- lib/SyntaxParse/SyntaxTreeCreator.cpp | 10 ++-- tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp | 4 +- .../libSwiftSyntaxParser.cpp | 6 +++ unittests/AST/TestContext.cpp | 6 ++- 17 files changed, 166 insertions(+), 90 deletions(-) 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/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/SourceFile.h b/include/swift/AST/SourceFile.h index f969a56ce4b1f..6ff1a9adbd472 100644 --- a/include/swift/AST/SourceFile.h +++ b/include/swift/AST/SourceFile.h @@ -558,17 +558,8 @@ class SourceFile final : public FileUnit { 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; @@ -576,8 +567,6 @@ 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; @@ -593,7 +582,6 @@ class SourceFile final : public FileUnit { bool hasDelayedBodyParsing() const; syntax::SourceFileSyntax getSyntaxRoot() const; - void setSyntaxRoot(syntax::SourceFileSyntax &&Root); bool hasSyntaxRoot() const; OpaqueTypeDecl *lookupOpaqueResultType(StringRef MangledName) override; @@ -611,7 +599,7 @@ class SourceFile final : public FileUnit { /// If not \c None, the underlying vector contains the parsed tokens of this /// source file. - Optional> AllCollectedTokens; + Optional> AllCollectedTokens; /// The root of the syntax tree representing the source file. std::unique_ptr SyntaxRoot; diff --git a/include/swift/Parse/Parser.h b/include/swift/Parse/Parser.h index 72a89ea2762a7..757bc03878656 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. 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/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/Decl.cpp b/lib/AST/Decl.cpp index 19fb3aca7c390..b726f41c72b4d 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" diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp index 88ab30be8b007..b8f3c5277573d 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -1077,17 +1077,27 @@ LookupConformanceInModuleRequest::evaluate( return ProtocolConformanceRef(conformance); } +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); +} + bool SourceFile::hasSyntaxRoot() const { return ParsingOpts.contains(ParsingFlags::BuildSyntaxTree); } syntax::SourceFileSyntax SourceFile::getSyntaxRoot() const { - assert(hasSyntaxRoot() && "no syntax root is set."); - return *SyntaxRoot; -} - -void SourceFile::setSyntaxRoot(syntax::SourceFileSyntax &&Root) { - SyntaxRoot = std::make_unique(std::move(Root)); + assert(hasSyntaxRoot() && "has no syntax root"); + auto &eval = getASTContext().evaluator; + auto *mutableThis = const_cast(this); + return *evaluateOrDefault(eval, ParseSourceFileRequest{mutableThis}, {}) + .SyntaxRoot; } void DirectOperatorLookupRequest::writeDependencySink( @@ -2222,18 +2232,6 @@ SourceFile::SourceFile(ModuleDecl &M, SourceFileKind K, assert(!problem && "multiple main files?"); (void)problem; } - - if (hasInterfaceHash()) { - InterfaceHash.emplace(); - } - if (shouldCollectTokens()) { - AllCollectedTokens = std::vector(); - } -} - -std::vector &SourceFile::getTokenVector() { - assert(shouldCollectTokens() && "Disabled"); - return *AllCollectedTokens; } SourceFile::ParsingOptions @@ -2248,7 +2246,10 @@ SourceFile::getDefaultParsingOptions(const LangOptions &langOpts) { ArrayRef SourceFile::getAllTokens() const { assert(shouldCollectTokens() && "Disabled"); - return *AllCollectedTokens; + auto &eval = getASTContext().evaluator; + auto *mutableThis = const_cast(this); + return *evaluateOrDefault(eval, ParseSourceFileRequest{mutableThis}, {}) + .CollectedTokens; } bool SourceFile::shouldCollectTokens() const { @@ -2282,7 +2283,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/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index cff3408235418..1730d859a81e9 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() { @@ -4470,16 +4469,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>> S; if (IDC->areTokensHashedForThisBodyInsteadOfInterfaceHash()) { recordTokenHash("{"); recordTokenHash("}"); + S.emplace(CurrentTokenHash, llvm::MD5()); } - llvm::MD5 tokenHashForThisDeclList; - llvm::SaveAndRestore> T( - CurrentTokenHash, IDC->areTokensHashedForThisBodyInsteadOfInterfaceHash() - ? &tokenHashForThisDeclList - : CurrentTokenHash); std::vector decls; ParserStatus Status; @@ -4514,6 +4511,7 @@ Parser::parseDeclList(SourceLoc LBLoc, SourceLoc &RBLoc, Diag<> ErrorDiag, return std::make_pair(decls, None); llvm::MD5::MD5Result result; + auto tokenHashForThisDeclList = CurrentTokenHash.getValueOr(llvm::MD5()); tokenHashForThisDeclList.final(result); llvm::SmallString<32> tokenHashString; llvm::MD5::stringifyResult(result, tokenHashString); @@ -6409,7 +6407,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/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/ParseRequests.cpp b/lib/Parse/ParseRequests.cpp index 3667b2ee8b14e..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(); @@ -155,11 +156,18 @@ ArrayRef ParseSourceFileRequest::evaluate(Evaluator &evaluator, 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( @@ -167,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/Parser.cpp b/lib/Parse/Parser.cpp index baa364ba8210b..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" @@ -148,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); @@ -415,7 +416,7 @@ class TokenRecorder: public ConsumeTokenReceiver { unsigned BufferID; // Token list ordered by their appearance in the source file. - std::vector &Tokens; + 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. @@ -448,11 +449,10 @@ class TokenRecorder: public ConsumeTokenReceiver { } public: - TokenRecorder(SourceFile &SF, unsigned BufferID) - : Ctx(SF.getASTContext()), BufferID(BufferID), - Tokens(SF.getTokenVector()) {} + 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 @@ -472,6 +472,7 @@ class TokenRecorder: public ConsumeTokenReceiver { Scratch); // Accept these orphaned comments. Tokens.insert(Tokens.end(), Scratch.begin(), Scratch.end()); + return std::move(Tokens); } void registerTokenKindChange(SourceLoc Loc, tok NewKind) override { @@ -529,9 +530,8 @@ Parser::Parser(std::unique_ptr Lex, SourceFile &SF, SIL(SIL), CurDeclContext(&SF), Context(SF.getASTContext()), - CurrentTokenHash(SF.getInterfaceHashPtr()), TokReceiver(SF.shouldCollectTokens() ? - new TokenRecorder(SF, L->getBufferID()) : + new TokenRecorder(SF.getASTContext(), L->getBufferID()) : new ConsumeTokenReceiver()), SyntaxContext(new SyntaxParsingContext(SyntaxContext, SF, L->getBufferID(), @@ -542,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); @@ -565,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 { @@ -589,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); } } @@ -1262,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/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/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp b/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp index 741da8b022c19..cda5acb68c1c4 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() { 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/unittests/AST/TestContext.cpp b/unittests/AST/TestContext.cpp index 434767e35edff..9cd85e28bd428 100644 --- a/unittests/AST/TestContext.cpp +++ b/unittests/AST/TestContext.cpp @@ -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)); } } From 7b9ccb76d597b8184c18fe2b8c9ddb3f7717ff54 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Wed, 3 Jun 2020 11:03:57 -0700 Subject: [PATCH 094/222] [Parse] Make sure we don't finalize a DelayedTokenReciever This is temporarily swapped in as the token receiver while backtracking, so make sure we don't try to call `finalize` on it. --- include/swift/Parse/Parser.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/swift/Parse/Parser.h b/include/swift/Parse/Parser.h index 757bc03878656..615643521f48b 100644 --- a/include/swift/Parse/Parser.h +++ b/include/swift/Parse/Parser.h @@ -487,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; From b1ac68b3b137dcfe1ec43dd7748c1c1682dd49f4 Mon Sep 17 00:00:00 2001 From: David Zarzycki Date: Thu, 4 Jun 2020 08:54:36 -0400 Subject: [PATCH 095/222] [test] Clang is now more strict about underlying type enums As of c90e198107431f64b73686bdce31c293e3380ac7, clang is now more strict about parsing of enum-base in order to follow C++11 rules. --- test/DebugInfo/Inputs/Macro.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/DebugInfo/Inputs/Macro.h b/test/DebugInfo/Inputs/Macro.h index 5f43bbf5641a6..7cba01337adde 100644 --- a/test/DebugInfo/Inputs/Macro.h +++ b/test/DebugInfo/Inputs/Macro.h @@ -1,6 +1,12 @@ +#ifdef __cplusplus #define MY_ENUM(NAME) \ - enum NAME : int NAME; \ enum NAME : int +#else +#define MY_ENUM(NAME) \ + enum NAME : int; \ + typedef enum NAME NAME; \ + enum NAME : int +#endif MY_ENUM(macro_enum) { zero = 0 From a72231128efe36a1007cc4300f0de68d3d30216e Mon Sep 17 00:00:00 2001 From: Ashley Garland Date: Thu, 4 Jun 2020 11:52:51 -0700 Subject: [PATCH 096/222] [SymbolGraph] Don't print inherited list in declaration fragments Add a new `PrintInherited` flag to `PrintOptions` to support this. rdar://63033669 --- include/swift/AST/PrintOptions.h | 3 +++ lib/AST/ASTPrinter.cpp | 3 +++ lib/SymbolGraphGen/SymbolGraph.cpp | 1 + .../Mixins/DeclarationFragments/Full/NominalTypes.swift | 4 +++- 4 files changed, 10 insertions(+), 1 deletion(-) 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/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index b3815525627ee..c29f80631a9a9 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -2073,6 +2073,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()) diff --git a/lib/SymbolGraphGen/SymbolGraph.cpp b/lib/SymbolGraphGen/SymbolGraph.cpp index 44aee2e537f49..ffc2c531b1315 100644 --- a/lib/SymbolGraphGen/SymbolGraph.cpp +++ b/lib/SymbolGraphGen/SymbolGraph.cpp @@ -61,6 +61,7 @@ PrintOptions SymbolGraph::getDeclarationFragmentsPrintOptions() const { Opts.SkipPrivateStdlibDecls = true; Opts.SkipUnderscoredStdlibProtocols = true; Opts.PrintGenericRequirements = true; + Opts.PrintInherited = false; Opts.ExclusiveAttrList.clear(); diff --git a/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/NominalTypes.swift b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/NominalTypes.swift index 31e5c69fc1e6b..f875255fe2828 100644 --- a/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/NominalTypes.swift +++ b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/NominalTypes.swift @@ -6,7 +6,9 @@ // 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 {} + +public struct S : P where T: Sequence {} // STRUCT-LABEL: "precise": "s:12NominalTypes1SV", // STRUCT: "declarationFragments": [ From b8abe55bc56f89fde88907c51093da264fb6a0b6 Mon Sep 17 00:00:00 2001 From: Ladd Van Tol Date: Thu, 4 Jun 2020 10:45:53 -0700 Subject: [PATCH 097/222] Build dependency list once Remove changed lines --- lib/FrontendTool/FrontendTool.cpp | 33 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/lib/FrontendTool/FrontendTool.cpp b/lib/FrontendTool/FrontendTool.cpp index 48384a17a74a2..c5439e227c704 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; From 0e7a329ccd39f4753f6fabd470c2ee7fc07c9c67 Mon Sep 17 00:00:00 2001 From: Ashley Garland Date: Thu, 4 Jun 2020 15:40:07 -0700 Subject: [PATCH 098/222] [SymbolGraph] Don't emit extension symbol graphs if empty rdar://63058801 --- lib/SymbolGraphGen/SymbolGraph.h | 5 +++++ lib/SymbolGraphGen/SymbolGraphGen.cpp | 3 +++ test/SymbolGraph/EmptyExtension.swift | 8 ++++++++ 3 files changed, 16 insertions(+) create mode 100644 test/SymbolGraph/EmptyExtension.swift 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/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() {} +} From ddaa3be2a3efce9e27f37a31c8f9aaf7835b456d Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Thu, 4 Jun 2020 18:27:19 -0700 Subject: [PATCH 099/222] Verify The Entire Compilation Session The old tests were just running the type checker because we used to only emit reference dependencies after Sema. Now that we emit them after the pipeline has run, let's upgrade these tests to capture these new references. --- .../Verifier/multi-file-private/Inputs/Derived.swift | 3 +++ test/Incremental/Verifier/multi-file-private/main.swift | 4 ++-- test/Incremental/Verifier/multi-file/Inputs/Derived.swift | 3 +++ test/Incremental/Verifier/multi-file/main.swift | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) 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/main.swift b/test/Incremental/Verifier/multi-file-private/main.swift index 336b4a79df7b8..876ff32b30b84 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 -experimental-private-intransitive-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 -experimental-private-intransitive-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/main.swift b/test/Incremental/Verifier/multi-file/main.swift index 6647e0ac84663..613e9530e80e8 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 -module-name main -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 -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 From 14ade9359469a416ad64fe28c1546627b36c4405 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Thu, 4 Jun 2020 18:28:43 -0700 Subject: [PATCH 100/222] Fix getActiveDependencySourceOrNull For Private Dependencies Restore the behavior here of only looking at the topmost dependency source object that was lost when the referenced name tracker was removed. Oops. --- include/swift/AST/EvaluatorDependencies.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/include/swift/AST/EvaluatorDependencies.h b/include/swift/AST/EvaluatorDependencies.h index 9f42c90d9108a..19fb0cf590c43 100644 --- a/include/swift/AST/EvaluatorDependencies.h +++ b/include/swift/AST/EvaluatorDependencies.h @@ -298,7 +298,12 @@ struct DependencyRecorder { SourceFile *getActiveDependencySourceOrNull() const { if (dependencySources.empty()) return nullptr; - return dependencySources.back().getPointer(); + switch (mode) { + case Mode::StatusQuo: + return dependencySources.back().getPointer(); + case Mode::ExperimentalPrivateDependencies: + return dependencySources.front().getPointer(); + } } public: @@ -331,14 +336,6 @@ 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. From 874cc856f06013de601d2667cd2a7c10e5c0b1ee Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Thu, 4 Jun 2020 18:37:04 -0700 Subject: [PATCH 101/222] Make LookupInModuleRequest a Dependency Sink It wasn't one in the past because the referenced name tracker was written into by unqualified lookup, which would delegate to this request. Now that it's no longer doing that, we have to capture this edge here for private dependencies. --- include/swift/AST/NameLookupRequests.h | 7 ++++++- lib/AST/NameLookupRequests.cpp | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) 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/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. //----------------------------------------------------------------------------// From 0215e373bc8257fd32175d105708af8e302a760c Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Thu, 4 Jun 2020 18:37:21 -0700 Subject: [PATCH 102/222] Add Verifier Tests for A Tricky Typealias Miscompile --- .../Verifier/multi-file-private/Inputs/Inner.swift | 14 ++++++++++++++ .../multi-file-private/Inputs/UsesInner.swift | 8 ++++++++ .../Verifier/multi-file/Inputs/Inner.swift | 14 ++++++++++++++ .../Verifier/multi-file/Inputs/UsesInner.swift | 14 ++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 test/Incremental/Verifier/multi-file-private/Inputs/Inner.swift create mode 100644 test/Incremental/Verifier/multi-file-private/Inputs/UsesInner.swift create mode 100644 test/Incremental/Verifier/multi-file/Inputs/Inner.swift create mode 100644 test/Incremental/Verifier/multi-file/Inputs/UsesInner.swift 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/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..9183dfa48c78e --- /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-expected-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) +} From a9007790b17286505bfa9d06f17297dc82680693 Mon Sep 17 00:00:00 2001 From: 3405691582 Date: Fri, 5 Jun 2020 00:07:10 -0400 Subject: [PATCH 103/222] [stdlib][test] Fix message test expectation. In #32137 direct environment variable parsing was introduced, the availability of which is branched by a preprocessor symbol (`ENVIRON`) if the environment is available directly on the platform, or if getenv must be used. The message expectation in the unit test in the however diverged on the non-`ENVIRON` branch, causing a unit test failure. This PR fixes the expectation, but also, while we're here, OpenBSD supports the `ENVIRON` branch anyway. --- stdlib/public/runtime/EnvironmentVariables.cpp | 2 +- test/Runtime/environment_variables.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/test/Runtime/environment_variables.swift b/test/Runtime/environment_variables.swift index 8f772339d3011..87aa398fe689a 100644 --- a/test/Runtime/environment_variables.swift +++ b/test/Runtime/environment_variables.swift @@ -3,7 +3,7 @@ // RUN: %target-codesign %t/main // 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: From 836bc57fe506305aa389ac9b324919c569d3bf3b Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Thu, 4 Jun 2020 23:06:32 -0700 Subject: [PATCH 104/222] [AST Walker] Stop visiting the bodies of closures as expressions. Single-expression closures have always been traversed differently from multi-statement closures. The former were traversed as if the expression was their only child, skipping the BraceStmt and implicit return, while the later was traversed as a normal BraceStmt. Unify on the latter treatment, so that traversal There are a few places where we unintentionally relied on this expression-as-child behavior. Clean those up to work with arbitrary closures, which is an overall simplification in the logic. --- lib/AST/ASTWalker.cpp | 16 ++----- lib/IDE/Refactoring.cpp | 16 +++++-- lib/Sema/CSApply.cpp | 5 +- lib/Sema/CSClosure.cpp | 3 ++ lib/Sema/CSDiagnostics.cpp | 4 +- lib/Sema/CSGen.cpp | 13 +++--- lib/Sema/CSSimplify.cpp | 4 +- lib/Sema/ConstraintSystem.h | 6 +++ lib/Sema/TypeCheckConstraints.cpp | 33 +++++++++++-- test/Constraints/fixes.swift | 2 +- test/IDE/structure.swift | 10 ++-- .../Sema/diag_constantness_check_os_log.swift | 7 +-- tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp | 46 +++++++++---------- 13 files changed, 102 insertions(+), 63 deletions(-) diff --git a/lib/AST/ASTWalker.cpp b/lib/AST/ASTWalker.cpp index e3340143015ec..2901fd6e3edf2 100644 --- a/lib/AST/ASTWalker.cpp +++ b/lib/AST/ASTWalker.cpp @@ -815,21 +815,15 @@ class Traversal : public ASTVisitorhasSingleExpressionBody()) { - if (Expr *body = doIt(expr->getSingleExpressionBody())) { - expr->setSingleExpressionBody(body); - return expr; - } - return nullptr; - } - - if (!Walker.shouldWalkIntoNonSingleExpressionClosure(expr)) + // Always walk into closures with a single-expression body; for those + // that don't have a single-expression body, ask the walker first. + if (!expr->hasSingleExpressionBody() && + !Walker.shouldWalkIntoNonSingleExpressionClosure(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; diff --git a/lib/IDE/Refactoring.cpp b/lib/IDE/Refactoring.cpp index 080cb1ef1330f..47eb3834222a7 100644 --- a/lib/IDE/Refactoring.cpp +++ b/lib/IDE/Refactoring.cpp @@ -3659,16 +3659,24 @@ 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; - CallExpr *CE = cast(Finder.getContexts().back().get()); + + // If the innermost context is a brace statement, drop it. + if (contexts.back().is()) { + contexts = contexts.drop_back(); + } + + if (contexts.empty() || !contexts.back().is()) + return nullptr; + 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/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp index ec5fb98be762d..5b0bc7e3277a7 100644 --- a/lib/Sema/CSApply.cpp +++ b/lib/Sema/CSApply.cpp @@ -3859,7 +3859,8 @@ namespace { 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; @@ -5788,7 +5789,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); diff --git a/lib/Sema/CSClosure.cpp b/lib/Sema/CSClosure.cpp index 7aafe866c370b..8afb6b6ce7fcb 100644 --- a/lib/Sema/CSClosure.cpp +++ b/lib/Sema/CSClosure.cpp @@ -84,6 +84,9 @@ class ClosureConstraintGenerator if (!expr) return; + // FIXME: Use SolutionApplicationTarget? + cs.setContextualType( + expr, TypeLoc::withoutLoc(closureResultType), CTP_ClosureResult); expr = cs.generateConstraints(expr, closure, /*isInputExpression=*/false); if (!expr) { hadError = true; diff --git a/lib/Sema/CSDiagnostics.cpp b/lib/Sema/CSDiagnostics.cpp index 1f991c955e01a..818385001f7ec 100644 --- a/lib/Sema/CSDiagnostics.cpp +++ b/lib/Sema/CSDiagnostics.cpp @@ -442,7 +442,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; }); @@ -3277,7 +3277,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; }); diff --git a/lib/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index 37a0048728cc0..8add8e7f82755 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -3882,6 +3882,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}; } @@ -4021,12 +4028,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 { diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 7a01584e7a027..e910fb78cc32d 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -1548,7 +1548,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; @@ -9334,7 +9334,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; }); diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index 1883272bb23c4..b8998018fa038 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -5493,6 +5493,12 @@ 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 #endif // LLVM_SWIFT_SEMA_CONSTRAINT_SYSTEM_H diff --git a/lib/Sema/TypeCheckConstraints.cpp b/lib/Sema/TypeCheckConstraints.cpp index 845ec35715ddb..20e31c2704794 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(); @@ -4061,3 +4059,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/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/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/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/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp b/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp index 741da8b022c19..00ec44528ed5c 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp @@ -1615,27 +1615,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 +1628,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 +1767,6 @@ class PlaceholderExpansionScanner { ArrayRef trailingClosures)> MultiClosureCallback, std::function NonClosureCallback) { - SourceLoc PlaceholderStartLoc = SM.getLocForOffset(BufID, Offset); // See if the placeholder is encapsulated with an EditorPlaceholderExpr From a71203d2f4ba15c3dcac6be24bbfcbd9d73b3d80 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Thu, 4 Jun 2020 23:15:07 -0700 Subject: [PATCH 105/222] [Sema] Switch to wasTypeCheckedInEnclosingContext() for walks --- lib/Sema/MiscDiagnostics.cpp | 14 +++++++------- lib/Sema/TypeCheckAvailability.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Sema/MiscDiagnostics.cpp b/lib/Sema/MiscDiagnostics.cpp index de1584df14f7f..442a76a81fab9 100644 --- a/lib/Sema/MiscDiagnostics.cpp +++ b/lib/Sema/MiscDiagnostics.cpp @@ -93,7 +93,7 @@ static void diagSyntacticUseRestrictions(const Expr *E, const DeclContext *DC, bool walkToTypeReprPre(TypeRepr *T) override { return true; } bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + return expr->wasTypeCheckedInEnclosingContext(); } bool shouldWalkIntoTapExpression() override { return false; } @@ -1291,7 +1291,7 @@ static void diagRecursivePropertyAccess(const Expr *E, const DeclContext *DC) { } bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + return expr->wasTypeCheckedInEnclosingContext(); } bool shouldWalkIntoTapExpression() override { return false; } @@ -1464,7 +1464,7 @@ static void diagnoseImplicitSelfUseInClosure(const Expr *E, } bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + return expr->wasTypeCheckedInEnclosingContext(); } bool shouldWalkIntoTapExpression() override { return false; } @@ -3266,7 +3266,7 @@ static void checkStmtConditionTrailingClosure(ASTContext &ctx, const Expr *E) { DiagnoseWalker(ASTContext &ctx) : Ctx(ctx) { } bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + return expr->wasTypeCheckedInEnclosingContext(); } bool shouldWalkIntoTapExpression() override { return false; } @@ -3416,7 +3416,7 @@ class ObjCSelectorWalker : public ASTWalker { : Ctx(dc->getASTContext()), DC(dc), SelectorTy(selectorTy) { } bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + return expr->wasTypeCheckedInEnclosingContext(); } bool shouldWalkIntoTapExpression() override { return false; } @@ -4156,7 +4156,7 @@ static void diagnoseUnintendedOptionalBehavior(const Expr *E, } bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + return expr->wasTypeCheckedInEnclosingContext(); } bool shouldWalkIntoTapExpression() override { return false; } @@ -4232,7 +4232,7 @@ static void diagnoseDeprecatedWritableKeyPath(const Expr *E, } bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + return expr->wasTypeCheckedInEnclosingContext(); } bool shouldWalkIntoTapExpression() override { return false; } diff --git a/lib/Sema/TypeCheckAvailability.cpp b/lib/Sema/TypeCheckAvailability.cpp index 3cc7d89b10253..370fccc93e323 100644 --- a/lib/Sema/TypeCheckAvailability.cpp +++ b/lib/Sema/TypeCheckAvailability.cpp @@ -2344,7 +2344,7 @@ class AvailabilityWalker : public ASTWalker { } bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->hasAppliedFunctionBuilder(); + return expr->wasTypeCheckedInEnclosingContext(); } bool shouldWalkIntoTapExpression() override { return false; } From 1d36224e7496006f498dd020f23618d09ea95ecf Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Thu, 4 Jun 2020 23:16:51 -0700 Subject: [PATCH 106/222] [ClosureExpr] Remove hasAppliedFunctionBuilder. There are no longer any clients of the "has applied function builder" bit in ClosureExpr, so remove it. --- include/swift/AST/Expr.h | 17 +++-------------- lib/Sema/CSClosure.cpp | 1 - 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/include/swift/AST/Expr.h b/include/swift/AST/Expr.h index 34f94465a8ec0..c80354236d881 100644 --- a/include/swift/AST/Expr.h +++ b/include/swift/AST/Expr.h @@ -3770,10 +3770,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; @@ -3800,7 +3797,7 @@ 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), Body(nullptr) { @@ -3906,7 +3903,7 @@ class ClosureExpr : public AbstractClosureExpr { /// 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,14 +3911,6 @@ class ClosureExpr : public AbstractClosureExpr { /// captured non-weakly). bool capturesSelfEnablingImplictSelf() const; - bool hasAppliedFunctionBuilder() const { - return CapturedSelfDeclAndAppliedBuilder.getInt(); - } - - void setAppliedFunctionBuilder(bool flag = true) { - CapturedSelfDeclAndAppliedBuilder.setInt(flag); - } - /// Whether this closure's body was type checked within the enclosing /// context. bool wasTypeCheckedInEnclosingContext() const { diff --git a/lib/Sema/CSClosure.cpp b/lib/Sema/CSClosure.cpp index 8afb6b6ce7fcb..1fa8362d4b7a5 100644 --- a/lib/Sema/CSClosure.cpp +++ b/lib/Sema/CSClosure.cpp @@ -333,7 +333,6 @@ SolutionApplicationToFunctionResult ConstraintSystem::applySolution( fn.setBody(newBody, /*isSingleExpression=*/false); if (closure) { - closure->setAppliedFunctionBuilder(); closure->setTypeCheckedInEnclosingContext(); solution.setExprTypes(closure); } From 2f97d24969764c54de079412cc18e14729dd24d1 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Thu, 4 Jun 2020 23:19:47 -0700 Subject: [PATCH 107/222] Note a fixed compiler crasher --- ...653-child-source-range-not-contained-within-its-parent.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename validation-test/{compiler_crashers => compiler_crashers_fixed}/28653-child-source-range-not-contained-within-its-parent.swift (87%) 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){ From 7eae5f2f0dfd92956ac046354abf9177aaf59a4d Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Thu, 4 Jun 2020 23:24:06 -0700 Subject: [PATCH 108/222] [AST] Remove now-unused ClosureExpr::setSingleExpressionBody(). --- include/swift/AST/AnyFunctionRef.h | 14 -------------- include/swift/AST/Expr.h | 7 ------- lib/AST/Expr.cpp | 13 ------------- 3 files changed, 34 deletions(-) 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/Expr.h b/include/swift/AST/Expr.h index c80354236d881..13093ebb28fe6 100644 --- a/include/swift/AST/Expr.h +++ b/include/swift/AST/Expr.h @@ -3891,13 +3891,6 @@ 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; diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 34d70a3ad815c..2593e2e698b2f 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1898,19 +1898,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(); } From a115ad9f5ccb1bb85e7dffa73c328774f63d0efd Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Fri, 5 Jun 2020 00:05:11 -0700 Subject: [PATCH 109/222] [AST] Record "separately checked" in ClosureExpr. Reverse the polarity of the "checked in context" bit for ClosureExpr to "separately checked", which simplifies the AST walker logic (to "should we walk separately type-checked closure bodies?") and eliminates single-expression closures as a separate case to consider. --- include/swift/AST/ASTWalker.h | 4 ++-- include/swift/AST/Expr.h | 20 +++++++++---------- lib/AST/ASTWalker.cpp | 8 ++++---- lib/AST/Expr.cpp | 2 +- lib/Sema/CSClosure.cpp | 2 -- lib/Sema/MiscDiagnostics.cpp | 32 +++++++++++++++--------------- lib/Sema/TypeCheckAvailability.cpp | 6 +++--- lib/Sema/TypeCheckStmt.cpp | 3 ++- 8 files changed, 38 insertions(+), 39 deletions(-) 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/Expr.h b/include/swift/AST/Expr.h index 13093ebb28fe6..5b3e93d1da7cd 100644 --- a/include/swift/AST/Expr.h +++ b/include/swift/AST/Expr.h @@ -3784,7 +3784,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. @@ -3799,7 +3799,7 @@ class ClosureExpr : public AbstractClosureExpr { BracketRange(bracketRange), CapturedSelfDecl(capturedSelfDecl), ThrowsLoc(throwsLoc), ArrowLoc(arrowLoc), InLoc(inLoc), - ExplicitResultTypeAndEnclosingChecked(explicitResultType, false), + ExplicitResultTypeAndSeparatelyChecked(explicitResultType, false), Body(nullptr) { setParameterList(params); Bits.ClosureExpr.HasAnonymousClosureVars = false; @@ -3854,14 +3854,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(); } @@ -3904,14 +3904,14 @@ class ClosureExpr : public AbstractClosureExpr { /// captured non-weakly). bool capturesSelfEnablingImplictSelf() const; - /// Whether this closure's body was type checked within the enclosing - /// context. - bool wasTypeCheckedInEnclosingContext() const { - return ExplicitResultTypeAndEnclosingChecked.getInt(); + /// Whether this closure's body was type checked separately from its + /// enclosing expression. + bool wasSeparatelyTypeChecked() const { + return ExplicitResultTypeAndSeparatelyChecked.getInt(); } - void setTypeCheckedInEnclosingContext(bool flag = true) { - ExplicitResultTypeAndEnclosingChecked.setInt(flag); + void setSeparatelyTypeChecked(bool flag = true) { + ExplicitResultTypeAndSeparatelyChecked.setInt(flag); } static bool classof(const Expr *E) { diff --git a/lib/AST/ASTWalker.cpp b/lib/AST/ASTWalker.cpp index 2901fd6e3edf2..88da5ab38e09f 100644 --- a/lib/AST/ASTWalker.cpp +++ b/lib/AST/ASTWalker.cpp @@ -815,10 +815,10 @@ class Traversal : public ASTVisitorhasSingleExpressionBody() && - !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. diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 2593e2e698b2f..3319311779634 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1910,7 +1910,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/Sema/CSClosure.cpp b/lib/Sema/CSClosure.cpp index 1fa8362d4b7a5..2d59c179348de 100644 --- a/lib/Sema/CSClosure.cpp +++ b/lib/Sema/CSClosure.cpp @@ -333,7 +333,6 @@ SolutionApplicationToFunctionResult ConstraintSystem::applySolution( fn.setBody(newBody, /*isSingleExpression=*/false); if (closure) { - closure->setTypeCheckedInEnclosingContext(); solution.setExprTypes(closure); } @@ -349,7 +348,6 @@ SolutionApplicationToFunctionResult ConstraintSystem::applySolution( solution, closure, closureFnType->getResult(), rewriteTarget); application.visit(fn.getBody()); - closure->setTypeCheckedInEnclosingContext(); return SolutionApplicationToFunctionResult::Success; } diff --git a/lib/Sema/MiscDiagnostics.cpp b/lib/Sema/MiscDiagnostics.cpp index 442a76a81fab9..913341172357f 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->wasTypeCheckedInEnclosingContext(); + 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->wasTypeCheckedInEnclosingContext(); + 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->wasTypeCheckedInEnclosingContext(); + 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->wasTypeCheckedInEnclosingContext(); + 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->wasTypeCheckedInEnclosingContext(); + bool shouldWalkIntoSeparatelyCheckedClosure(ClosureExpr *expr) override { + return false; } bool shouldWalkIntoTapExpression() override { return false; } @@ -4155,8 +4155,8 @@ static void diagnoseUnintendedOptionalBehavior(const Expr *E, } } - bool shouldWalkIntoNonSingleExpressionClosure(ClosureExpr *expr) override { - return expr->wasTypeCheckedInEnclosingContext(); + 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->wasTypeCheckedInEnclosingContext(); + bool shouldWalkIntoSeparatelyCheckedClosure(ClosureExpr *expr) override { + return false; } bool shouldWalkIntoTapExpression() override { return false; } diff --git a/lib/Sema/TypeCheckAvailability.cpp b/lib/Sema/TypeCheckAvailability.cpp index 370fccc93e323..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->wasTypeCheckedInEnclosingContext(); + bool shouldWalkIntoSeparatelyCheckedClosure(ClosureExpr *expr) override { + return false; } bool shouldWalkIntoTapExpression() override { return false; } 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; } From 2704009ad2aab0103384bef4a6e4ae4fb6404fc0 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Fri, 5 Jun 2020 11:34:31 +0100 Subject: [PATCH 110/222] runtime: fix SwapByteOrder.h when building for WASI `endian.h` in the WASI SDK include root, so should use that instead as some other platforms do. --- stdlib/include/llvm/Support/SwapByteOrder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From b68d827032f7804209e9a8ee4ba352b7b938af43 Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Wed, 3 Jun 2020 17:26:12 +0300 Subject: [PATCH 111/222] [NFC] AST: const-qualify ASTContext refs in PrettyStackTrace.h --- include/swift/AST/PrettyStackTrace.h | 46 +++++++++++++++------------- lib/AST/PrettyStackTrace.cpp | 16 +++++----- 2 files changed, 34 insertions(+), 28 deletions(-) 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/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'; From 8d0014d59010c9b7bd2da5ddff8021dfcad75612 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Fri, 5 Jun 2020 09:08:18 -0700 Subject: [PATCH 112/222] Clarify a comment --- lib/IDE/Refactoring.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/IDE/Refactoring.cpp b/lib/IDE/Refactoring.cpp index 47eb3834222a7..93730a756af2e 100644 --- a/lib/IDE/Refactoring.cpp +++ b/lib/IDE/Refactoring.cpp @@ -3663,7 +3663,8 @@ static CallExpr *findTrailingClosureTarget(SourceManager &SM, if (contexts.empty()) return nullptr; - // If the innermost context is a brace statement, drop it. + // 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(); } From e3ce94d97de01ceefaf8ac817589c8e2ac5602e5 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Fri, 5 Jun 2020 11:03:04 -0700 Subject: [PATCH 113/222] Introduce a `PruneVTables` pass to mark non-overridden entries. Start with some high-level checks of whether a declaration is formally final, or has no visible overrides in the domain of the program visible to the SIL module. We can eventually adopt more of the logic from the Devirtualizer pass to tell whether call sites are "effectively final", and maybe make the Devirtualizer consume that information applied by this pass. --- include/swift/SIL/SILVTable.h | 3 + .../swift/SILOptimizer/PassManager/Passes.def | 4 +- lib/SILOptimizer/Transforms/CMakeLists.txt | 1 + lib/SILOptimizer/Transforms/PruneVTables.cpp | 72 +++++++++ test/SILOptimizer/prune-vtables.sil | 152 ++++++++++++++++++ 5 files changed, 231 insertions(+), 1 deletion(-) create mode 100644 lib/SILOptimizer/Transforms/PruneVTables.cpp create mode 100644 test/SILOptimizer/prune-vtables.sil diff --git a/include/swift/SIL/SILVTable.h b/include/swift/SIL/SILVTable.h index 54dc2aec4cb5b..d5cb3df2010d8 100644 --- a/include/swift/SIL/SILVTable.h +++ b/include/swift/SIL/SILVTable.h @@ -128,6 +128,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/SILOptimizer/PassManager/Passes.def b/include/swift/SILOptimizer/PassManager/Passes.def index b18748cb603d0..32764fb41d601 100644 --- a/include/swift/SILOptimizer/PassManager/Passes.def +++ b/include/swift/SILOptimizer/PassManager/Passes.def @@ -340,7 +340,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/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/PruneVTables.cpp b/lib/SILOptimizer/Transforms/PruneVTables.cpp new file mode 100644 index 0000000000000..c3f7cf8d7ac70 --- /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/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] +} From 975ff757bceed90b7aac0cf497fa4b0a6c02b1bf Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Thu, 4 Jun 2020 20:17:12 -0700 Subject: [PATCH 114/222] Perform The Dependency Unioning Step During Replay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order for private dependencies to be completely correct, it must perform the name lookup unioning step when a cached request is replayed - not just when lookups are first performed. In order to reduce the overhead of this union operation, it is not necessary to walk the entire active request stack, just walk to the nearest cached request in the stack and union into that. When it is popped, its replay step will itself union into the next cached request. To see why, consider a request graph: A* -> B -> C* | -> D* where A, C, and D are cached. If a caller were to force C and D, then force A independenty, today we would *only* replay the names looked up by C and D the first time A was evaluated. That is, subsequent evaluations of A do not replay the correct set of names. If we were to perform the union step during replay as well, requests that force A would also see C and D’s lookups. Without this, callers that force requests like the DeclChecker have to be wary of the way they force the interface type request so other files see the right name sets. rdar://64008262 --- include/swift/AST/Evaluator.h | 2 +- include/swift/AST/EvaluatorDependencies.h | 8 ++- lib/AST/Evaluator.cpp | 64 ++++++++++++++----- .../multi-file/Inputs/UsesInner.swift | 2 +- 4 files changed, 58 insertions(+), 18 deletions(-) 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 19fb0cf590c43..04dbbb80c33f9 100644 --- a/include/swift/AST/EvaluatorDependencies.h +++ b/include/swift/AST/EvaluatorDependencies.h @@ -267,10 +267,16 @@ struct DependencyRecorder { void realize(const DependencyCollector::Reference &ref); public: - void replay(const swift::ActiveRequest &req); + void replay(const llvm::SetVector &stack, + const swift::ActiveRequest &req); void record(const llvm::SetVector &stack, llvm::function_ref rec); +private: + void + unionNearestCachedRequest(ArrayRef stack, + const DependencyCollector::ReferenceSet &scratch); + public: using ReferenceEnumerator = llvm::function_ref; diff --git a/lib/AST/Evaluator.cpp b/lib/AST/Evaluator.cpp index 785b0d99ff277..a38c35933053a 100644 --- a/lib/AST/Evaluator.cpp +++ b/lib/AST/Evaluator.cpp @@ -446,23 +446,12 @@ 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(); @@ -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::StatusQuo); + 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/test/Incremental/Verifier/multi-file/Inputs/UsesInner.swift b/test/Incremental/Verifier/multi-file/Inputs/UsesInner.swift index 9183dfa48c78e..3a1c5ab4d8ad9 100644 --- a/test/Incremental/Verifier/multi-file/Inputs/UsesInner.swift +++ b/test/Incremental/Verifier/multi-file/Inputs/UsesInner.swift @@ -2,7 +2,7 @@ // 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-expected-provides{{Inner}} +// fixme-provides{{Inner}} // expected-provides{{defaultFoo}} // expected-provides{{blah}} From dd7a7f7c89a77d64bd39f46ee66f8474f602b4b0 Mon Sep 17 00:00:00 2001 From: Ashley Garland Date: Mon, 1 Jun 2020 12:34:51 -0700 Subject: [PATCH 115/222] [SymbolGraph] Print non-underscored attributes in declarations rdar://63338507 --- lib/AST/ASTPrinter.cpp | 2 +- lib/SymbolGraphGen/SymbolGraph.cpp | 45 ++++++- .../DeclarationFragments/Full/Function.swift | 12 +- .../Full/MultipleAttributes.swift | 44 +++++++ .../DeclarationFragments/Full/Never.swift | 37 ++++++ .../Full/NominalTypes.swift | 10 +- .../Subheading/Function.swift | 122 +++++++++--------- 7 files changed, 204 insertions(+), 68 deletions(-) create mode 100644 test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/MultipleAttributes.swift create mode 100644 test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/Never.swift diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index c29f80631a9a9..1fe4d5980d042 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -2587,7 +2587,7 @@ static void printParameterFlags(ASTPrinter &printer, PrintOptions options, } if (!options.excludeAttrKind(TAK_escaping) && escaping) - printer << "@escaping "; + printer.printKeyword("@escaping", options, " "); } void PrintAST::visitVarDecl(VarDecl *decl) { diff --git a/lib/SymbolGraphGen/SymbolGraph.cpp b/lib/SymbolGraphGen/SymbolGraph.cpp index ffc2c531b1315..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 = @@ -65,10 +65,35 @@ PrintOptions SymbolGraph::getDeclarationFragmentsPrintOptions() const { 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; } @@ -87,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/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 f875255fe2828..0de978c0b304d 100644 --- a/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/NominalTypes.swift +++ b/test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/NominalTypes.swift @@ -8,11 +8,19 @@ public protocol P {} -public struct S : P where T: Sequence {} +@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/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: ] From a4239370c8d9ffbc1ba09613f36bb22b7fa274b1 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Fri, 5 Jun 2020 14:02:46 -0700 Subject: [PATCH 116/222] [Constraint solver] Wire up "parents" of closure return statements. --- lib/Sema/CSClosure.cpp | 2 -- lib/Sema/ConstraintSystem.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/Sema/CSClosure.cpp b/lib/Sema/CSClosure.cpp index 2d59c179348de..0fd1b69529a54 100644 --- a/lib/Sema/CSClosure.cpp +++ b/lib/Sema/CSClosure.cpp @@ -85,8 +85,6 @@ class ClosureConstraintGenerator return; // FIXME: Use SolutionApplicationTarget? - cs.setContextualType( - expr, TypeLoc::withoutLoc(closureResultType), CTP_ClosureResult); expr = cs.generateConstraints(expr, closure, /*isInputExpression=*/false); if (!expr) { hadError = true; diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index d0ba3ca4a16d9..f1e29946b8cdd 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); From b8440359ad0c4e06596b21ce326fdfa263c45151 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Fri, 5 Jun 2020 14:05:17 -0700 Subject: [PATCH 117/222] Fix a typo in a comment --- lib/Sema/ConstraintSystem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index b8998018fa038..f63170f74ab2e 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -5495,7 +5495,7 @@ 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/ +/// part of the constraint system. void forEachExprInConstraintSystem( Expr *expr, llvm::function_ref callback); From 3ec250f7017ecb8a7654e27b794764e58f4c3337 Mon Sep 17 00:00:00 2001 From: Rintaro Ishizaki Date: Thu, 4 Jun 2020 09:59:59 -0700 Subject: [PATCH 118/222] [CodeCompletion] Wrap base expression with CodeCompletionExpr For example for: funcName(base.) Wrap 'base' with 'CodeCompletionExpr' so that type checker can check 'base' independently without preventing the overload choice of 'funcName'. This increases the chance of successful type checking. rdar://problem/63965160 --- include/swift/AST/Expr.h | 18 ++++++++++--- lib/AST/ASTWalker.cpp | 10 ++++++- lib/Parse/ParseExpr.cpp | 7 +++-- lib/Parse/ParseStmt.cpp | 4 +-- lib/Sema/CSGen.cpp | 21 ++++++++++++--- test/IDE/complete_enum_elements.swift | 13 ++++++++- test/IDE/complete_rdar63965160.swift | 38 +++++++++++++++++++++++++++ test/IDE/complete_skipbody.swift | 6 ++--- 8 files changed, 99 insertions(+), 18 deletions(-) create mode 100644 test/IDE/complete_rdar63965160.swift diff --git a/include/swift/AST/Expr.h b/include/swift/AST/Expr.h index 34f94465a8ec0..112e31368a2ce 100644 --- a/include/swift/AST/Expr.h +++ b/include/swift/AST/Expr.h @@ -598,13 +598,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; diff --git a/lib/AST/ASTWalker.cpp b/lib/AST/ASTWalker.cpp index e3340143015ec..fd27068e79a6b 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) { diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index 3922c9e2d1569..28d9d0c7ec328 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -1132,10 +1132,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/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/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index 86cacf5c8afbf..e5cf5e3cf5031 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) { 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 From d3b6b89de63f1079caa3b8d57a0107a7871e91b8 Mon Sep 17 00:00:00 2001 From: Dan Zheng Date: Fri, 5 Jun 2020 16:25:17 -0700 Subject: [PATCH 119/222] [AutoDiff] Support multiple differentiability result indices in SIL. (#32206) `DifferentiableFunctionInst` now stores result indices. `SILAutoDiffIndices` now stores result indices instead of a source index. `@differentiable` SIL function types may now have multiple differentiability result indices and `@noDerivative` resutls. `@differentiable` AST function types do not have `@noDerivative` results (yet), so this functionality is not exposed to users. Resolves TF-689 and TF-1256. Infrastructural support for TF-983: supporting differentiation of `apply` instructions with multiple active semantic results. --- docs/ABI/Mangling.rst | 4 +- include/swift/AST/AutoDiff.h | 26 ++- include/swift/AST/Types.h | 62 +++-- include/swift/Demangling/TypeDecoder.h | 75 +++--- include/swift/SIL/SILBuilder.h | 5 +- include/swift/SIL/SILCloner.h | 1 + include/swift/SIL/SILInstruction.h | 11 +- include/swift/SIL/TypeSubstCloner.h | 3 +- .../Analysis/DifferentiableActivityAnalysis.h | 6 +- .../SILOptimizer/Differentiation/ADContext.h | 16 +- .../SILOptimizer/Differentiation/JVPEmitter.h | 7 +- lib/AST/ASTContext.cpp | 20 +- lib/AST/ASTDemangler.cpp | 14 +- lib/AST/ASTMangler.cpp | 16 +- lib/AST/ASTPrinter.cpp | 7 + lib/AST/AutoDiff.cpp | 8 +- lib/Demangling/Demangler.cpp | 2 + lib/Demangling/NodePrinter.cpp | 4 +- lib/Demangling/Remangler.cpp | 3 + lib/IRGen/GenDiffFunc.cpp | 17 +- lib/IRGen/IRGenSIL.cpp | 3 +- lib/IRGen/LoadableByAddress.cpp | 2 +- lib/SIL/IR/SILFunctionType.cpp | 169 ++++++++------ lib/SIL/IR/SILInstructions.cpp | 40 ++-- lib/SIL/IR/SILPrinter.cpp | 4 + lib/SIL/IR/TypeLowering.cpp | 17 +- lib/SIL/Parser/ParseSIL.cpp | 53 +++-- lib/SIL/Verifier/SILVerifier.cpp | 4 +- lib/SILGen/SILGenBuiltin.cpp | 9 +- lib/SILGen/SILGenExpr.cpp | 3 +- lib/SILGen/SILGenPoly.cpp | 15 +- lib/SILGen/SILGenThunk.cpp | 5 +- .../DifferentiableActivityAnalysis.cpp | 13 +- .../Differentiation/ADContext.cpp | 4 +- .../Differentiation/JVPEmitter.cpp | 219 ++++++++---------- .../Differentiation/LinearMapInfo.cpp | 80 +++---- .../Differentiation/PullbackEmitter.cpp | 78 ++++--- lib/SILOptimizer/Differentiation/Thunk.cpp | 2 +- .../Differentiation/VJPEmitter.cpp | 72 +++--- .../Mandatory/Differentiation.cpp | 107 +++++---- lib/Sema/TypeCheckType.cpp | 26 ++- lib/Serialization/Deserialization.cpp | 52 ++++- lib/Serialization/DeserializeSIL.cpp | 42 ++-- lib/Serialization/ModuleFormat.h | 11 +- lib/Serialization/SILFormat.h | 2 + lib/Serialization/Serialization.cpp | 14 ++ lib/Serialization/SerializeSIL.cpp | 10 +- .../IRGen/differentiable_function.sil | 2 +- .../differentiable_function_type.swift | 26 +++ .../SIL/differentiable_function_inst.sil | 25 +- test/AutoDiff/SIL/linear_function_inst.sil | 4 +- .../SILGen/differentiable_function.swift | 2 +- test/AutoDiff/SILGen/reabstraction.swift | 8 +- test/AutoDiff/SILGen/vtable.swift | 2 +- test/AutoDiff/SILGen/witness_table.swift | 16 +- .../SILOptimizer/activity_analysis.swift | 58 ++--- .../SILOptimizer/derivative_sil.swift | 4 +- ...ferentiation_function_canonicalization.sil | 24 +- .../SILOptimizer/differentiation_sil.swift | 4 +- ...ferentiation_subset_parameters_thunk.swift | 2 +- test/Demangle/Inputs/manglings.txt | 1 + 61 files changed, 925 insertions(+), 616 deletions(-) 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/AutoDiff.h b/include/swift/AST/AutoDiff.h index ffd3919bdd6bd..64ed422ede11c 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); }, 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/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/SIL/SILBuilder.h b/include/swift/SIL/SILBuilder.h index 26fab8b9acd85..48e6d4438e12a 100644 --- a/include/swift/SIL/SILBuilder.h +++ b/include/swift/SIL/SILBuilder.h @@ -2179,10 +2179,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/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/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/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/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/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/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index c29f80631a9a9..6bec4395b38b8 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -4753,6 +4753,13 @@ void SILResultInfo::print(raw_ostream &OS, const PrintOptions &Opts) const { print(Printer, Opts); } void SILResultInfo::print(ASTPrinter &Printer, const PrintOptions &Opts) const { + switch (getDifferentiability()) { + case SILResultDifferentiability::NotDifferentiable: + Printer << "@noDerivative "; + break; + default: + break; + } Printer << getStringForResultConvention(getConvention()); getInterfaceType().print(Printer, Opts); } 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/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/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/IRGenSIL.cpp b/lib/IRGen/IRGenSIL.cpp index a6114f47737c4..ddd0d2d9d0ab7 100644 --- a/lib/IRGen/IRGenSIL.cpp +++ b/lib/IRGen/IRGenSIL.cpp @@ -1852,7 +1852,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/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/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/SILPrinter.cpp b/lib/SIL/IR/SILPrinter.cpp index 4feafae6df321..a6e94200f2f1b 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 "; 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/Verifier/SILVerifier.cpp b/lib/SIL/Verifier/SILVerifier.cpp index ca14212c91eb3..ba410202e7815 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), 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/SILGenExpr.cpp b/lib/SILGen/SILGenExpr.cpp index a64ad886888f0..24ee39a453cdb 100644 --- a/lib/SILGen/SILGenExpr.cpp +++ b/lib/SILGen/SILGenExpr.cpp @@ -5451,7 +5451,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/SILGenPoly.cpp b/lib/SILGen/SILGenPoly.cpp index e0d71dc6bb708..05170dee11e86 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(); @@ -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/SILOptimizer/Analysis/DifferentiableActivityAnalysis.cpp b/lib/SILOptimizer/Analysis/DifferentiableActivityAnalysis.cpp index c903dbeb6435c..b54f12ac40386 100644 --- a/lib/SILOptimizer/Analysis/DifferentiableActivityAnalysis.cpp +++ b/lib/SILOptimizer/Analysis/DifferentiableActivityAnalysis.cpp @@ -498,9 +498,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 +517,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/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/JVPEmitter.cpp b/lib/SILOptimizer/Differentiation/JVPEmitter.cpp index f37c67a3a7a1f..0cd833d56efcd 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. @@ -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..0ad634cae3b28 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()); diff --git a/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp b/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp index 098709c3e541a..5c9d3f8913000 100644 --- a/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp +++ b/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp @@ -554,7 +554,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 +738,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 +937,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, @@ -1453,31 +1459,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 +1477,23 @@ void PullbackEmitter::visitApplyInst(ApplyInst *ai) { args.push_back(alloc); } + // Get formal callee pullback arguments. + auto *bb = ai->getParent(); + 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 +1503,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 +1525,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..e37aa1b1696e6 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 @@ -585,12 +587,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 +636,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 +648,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 +708,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( 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/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp index 8c6753d888d95..b6ebf45dcdbc2 100644 --- a/lib/Sema/TypeCheckType.cpp +++ b/lib/Sema/TypeCheckType.cpp @@ -1997,6 +1997,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 +2404,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 +2415,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 +2658,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 +3107,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 +3137,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 +3177,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); diff --git a/lib/Serialization/Deserialization.cpp b/lib/Serialization/Deserialization.cpp index 028919584dfd6..3564ff780ae49 100644 --- a/lib/Serialization/Deserialization.cpp +++ b/lib/Serialization/Deserialization.cpp @@ -4759,6 +4759,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 +5432,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 +5443,7 @@ class TypeDeserializer { swift::SILParameterDifferentiability::DifferentiableOrNotApplicable; if (diffKind != DifferentiabilityKind::NonDifferentiable) { auto differentiabilityOpt = - getActualSILParameterDifferentiability(ramDifferentiability); + getActualSILParameterDifferentiability(rawDifferentiability); if (!differentiabilityOpt) MF.fatal(); differentiability = *differentiabilityOpt; @@ -5448,15 +5463,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 +5502,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 +5530,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 +5544,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/ModuleFormat.h b/lib/Serialization/ModuleFormat.h index c5ac6129a8889..260b0f75b99c3 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 = 558; // SIL function type result differentiability /// 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 { 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..deabf9ed2e215 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -3862,6 +3862,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 +4185,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..a7e185abc5274 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; } 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..45420276a7374 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 @@ -260,7 +260,7 @@ 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 @@ -279,7 +279,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" @@ -304,7 +304,7 @@ func testArrayUninitializedIntrinsicAddress(_ x: Float, _ y: Float) -> [Float] { 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 @@ -327,7 +327,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 @@ -369,7 +369,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 @@ -399,7 +399,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 +411,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 +426,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 +444,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 +465,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 +493,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 +509,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 +539,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 +564,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 +596,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 +634,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 @@ -683,7 +683,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 +702,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 +734,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 +777,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 +818,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 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/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 From bcae5016ddfcc6f98bac805088b1c0ced2d22fe2 Mon Sep 17 00:00:00 2001 From: Dan Zheng Date: Fri, 5 Jun 2020 16:26:42 -0700 Subject: [PATCH 120/222] [AutoDiff] NFC: garden test. (#32209) Clarify test name and contents. --- .../validation-test/simple_math.swift | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) 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() From c647c11bb59f7cec3490814c037ba2f5e1506b4b Mon Sep 17 00:00:00 2001 From: Ashley Garland Date: Fri, 5 Jun 2020 16:50:27 -0700 Subject: [PATCH 121/222] [SymbolGraph] Don't consider @show_in_interface for underscored names The fact that a declaration has `@_show_in_interface` shouldn't be used to decide whether something has underscored naming, which is just one specific kind of check regarding naming only. Move the check for this attribute out one level. rdar://63120829 --- lib/AST/Decl.cpp | 7 ++++--- test/SymbolGraph/Symbols/SkipsPublicUnderscore.swift | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 19fb3aca7c390..a38339b4a4616 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -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(); } 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 From be4e23f41e6d6e048d4dce53e03cbc7fb9f71141 Mon Sep 17 00:00:00 2001 From: Greg Titus Date: Fri, 5 Jun 2020 16:57:28 -0700 Subject: [PATCH 122/222] New note for users that have wrongly assumed that generic param conformances use the same separators as type conformances. --- include/swift/AST/DiagnosticsSema.def | 3 ++ lib/Sema/CSDiagnostics.cpp | 51 +++++++++++++++++++ lib/Sema/CSDiagnostics.h | 2 + test/Sema/diag_unintended_generic_param.swift | 24 +++++++++ 4 files changed, 80 insertions(+) create mode 100644 test/Sema/diag_unintended_generic_param.swift diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index e8581d3cbc515..6dd14570b8459 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", ()) diff --git a/lib/Sema/CSDiagnostics.cpp b/lib/Sema/CSDiagnostics.cpp index 83357e9d8efcf..cf13c12753ccf 100644 --- a/lib/Sema/CSDiagnostics.cpp +++ b/lib/Sema/CSDiagnostics.cpp @@ -31,6 +31,8 @@ #include "swift/AST/SourceFile.h" #include "swift/AST/Stmt.h" #include "swift/AST/Types.h" +#include "swift/AST/GenericEnvironment.h" +#include "swift/AST/NameLookupRequests.h" #include "swift/Basic/SourceLoc.h" #include "swift/Parse/Lexer.h" #include "llvm/ADT/ArrayRef.h" @@ -3109,6 +3111,53 @@ DeclName MissingMemberFailure::findCorrectEnumCaseName( return (candidate ? candidate->getName() : DeclName()); } +bool MissingMemberFailure::findUnintendedExtraGenericParam(Type instanceTy, FunctionRefKind functionKind) { + auto archetype = instanceTy->getAs(); + if (!archetype) + return false; + auto genericTy = archetype->mapTypeOutOfContext()->getAs(); + if (!genericTy) + return false; + + 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 &cs = getConstraintSystem(); + auto paramDecl = param->getDecl(); + auto descriptor = UnqualifiedLookupDescriptor( + DeclNameRef(param->getName()), paramDecl->getDeclContext()->getParentForLookup(), paramDecl->getStartLoc(), + UnqualifiedLookupFlags::KnownPrivate | UnqualifiedLookupFlags::TypeLookup); + auto lookup = evaluateOrDefault(cs.getASTContext().evaluator, UnqualifiedLookupRequest{descriptor}, {}); + for (auto &result : lookup) { + if (auto proto = dyn_cast_or_null(result.getValueDecl())) { + auto memberLookup = cs.performMemberLookup( + ConstraintKind::ValueMember, getName().withoutArgumentLabels(), + proto->getDeclaredType(), functionKind, getLocator(), + /*includeInaccessibleMembers=*/true); + if (memberLookup.ViableCandidates.size() || memberLookup.UnviableCandidates.size()) { + 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, paramDecl->getName(), archetype) + .fixItReplaceChars(loc, loc.getAdvancedLoc(1), replacement); + return true; + } + } + } + break; + } + return false; +} + bool MissingMemberFailure::diagnoseAsError() { auto anchor = getRawAnchor(); auto memberBase = getAnchor(); @@ -3217,6 +3266,7 @@ bool MissingMemberFailure::diagnoseAsError() { } } else { emitBasicError(baseType); + findUnintendedExtraGenericParam(instanceTy, FunctionRefKind::DoubleApply); } } else if (auto moduleTy = baseType->getAs()) { emitDiagnosticAt(::getLoc(memberBase), diag::no_member_of_module, @@ -3278,6 +3328,7 @@ bool MissingMemberFailure::diagnoseAsError() { correction->addFixits(diagnostic); } else { emitBasicError(baseType); + findUnintendedExtraGenericParam(baseType, FunctionRefKind::SingleApply); } } } diff --git a/lib/Sema/CSDiagnostics.h b/lib/Sema/CSDiagnostics.h index be251b6da89e6..785f3f0b6fdd8 100644 --- a/lib/Sema/CSDiagnostics.h +++ b/lib/Sema/CSDiagnostics.h @@ -1066,6 +1066,8 @@ class MissingMemberFailure final : public InvalidMemberRefFailure { static DeclName findCorrectEnumCaseName(Type Ty, TypoCorrectionResults &corrections, DeclNameRef memberName); + + bool findUnintendedExtraGenericParam(Type instanceTy, FunctionRefKind functionKind); }; /// Diagnose cases where a member only accessible on generic constraints 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'}} +} From 142aa42f0ddc4f7cbf5bfda249a2044bdc86ec0b Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Thu, 4 Jun 2020 01:09:25 -0700 Subject: [PATCH 123/222] [semantic-arc-opts] Teach semantic-arc-opts how to handle tuples with multiple non-trivial operands. --- include/swift/SIL/OwnershipUtils.h | 8 +++++++ lib/SIL/Utils/OwnershipUtils.cpp | 3 +++ .../Transforms/SemanticARCOpts.cpp | 12 +++++++++++ .../semantic-arc-opts-canonical.sil | 2 -- test/SILOptimizer/semantic-arc-opts.sil | 21 ++++++++++++------- 5 files changed, 37 insertions(+), 9 deletions(-) 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/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/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/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 : $() +} From 104c8f363c7e387596dda1efc289edff61c1062d Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Fri, 5 Jun 2020 20:11:28 -0700 Subject: [PATCH 124/222] [build-script] Make is_build_script_impl_product() a pure method and get rid of default Yes answer. This forces the code to self document this property. This is just an NFC refactor. --- .../swift_build_support/products/cmark.py | 8 +++++++- .../swift_build_support/products/foundation.py | 8 ++++++++ .../swift_build_support/products/libcxx.py | 8 +++++++- .../swift_build_support/products/libdispatch.py | 8 ++++++++ .../swift_build_support/products/libicu.py | 8 ++++++++ .../swift_build_support/products/llbuild.py | 8 +++++++- .../swift_build_support/products/lldb.py | 8 +++++++- .../swift_build_support/products/llvm.py | 8 ++++++++ .../swift_build_support/products/product.py | 2 +- .../swift_build_support/products/swift.py | 8 ++++++++ .../swift_build_support/products/xctest.py | 8 ++++++++ 11 files changed, 77 insertions(+), 5 deletions(-) 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..74777d0fd4947 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,10 @@ 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 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..247c2fe7e8af8 100644 --- a/utils/swift_build_support/swift_build_support/products/foundation.py +++ b/utils/swift_build_support/swift_build_support/products/foundation.py @@ -14,6 +14,14 @@ 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 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..ac11a629d9efc 100644 --- a/utils/swift_build_support/swift_build_support/products/libcxx.py +++ b/utils/swift_build_support/swift_build_support/products/libcxx.py @@ -14,4 +14,10 @@ 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 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..1200284ae942a 100644 --- a/utils/swift_build_support/swift_build_support/products/libdispatch.py +++ b/utils/swift_build_support/swift_build_support/products/libdispatch.py @@ -14,6 +14,14 @@ 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 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..5874c3ab5ccc8 100644 --- a/utils/swift_build_support/swift_build_support/products/libicu.py +++ b/utils/swift_build_support/swift_build_support/products/libicu.py @@ -14,6 +14,14 @@ 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 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..c8d58de682438 100644 --- a/utils/swift_build_support/swift_build_support/products/llbuild.py +++ b/utils/swift_build_support/swift_build_support/products/llbuild.py @@ -14,4 +14,10 @@ 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 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..e9c1aaea679c4 100644 --- a/utils/swift_build_support/swift_build_support/products/lldb.py +++ b/utils/swift_build_support/swift_build_support/products/lldb.py @@ -14,4 +14,10 @@ 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 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..95a1ed2ebf56a 100644 --- a/utils/swift_build_support/swift_build_support/products/llvm.py +++ b/utils/swift_build_support/swift_build_support/products/llvm.py @@ -34,6 +34,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": 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..e7bc9ffbc57be 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): 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..a59b539cfb4c4 100644 --- a/utils/swift_build_support/swift_build_support/products/swift.py +++ b/utils/swift_build_support/swift_build_support/products/swift.py @@ -45,6 +45,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 = [] 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..161ae947a8093 100644 --- a/utils/swift_build_support/swift_build_support/products/xctest.py +++ b/utils/swift_build_support/swift_build_support/products/xctest.py @@ -14,6 +14,14 @@ 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 From 64f903fe2a7b7a511cf9664c21e8a548a2b9c2e1 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Fri, 5 Jun 2020 15:25:30 -0700 Subject: [PATCH 125/222] [Type checker] Experimental support for one-way parameter constraints. Introduce an experimental mode (behind the flag `experimental-one-way-closure-params`) that places one-way constraints between closure parameter types and references to those parameters within the body of the closure. The intent here is to break up constraint systems further, potentially improving type checking performance and making way for larger closure bodies to be supported. This is a source-breaking change when the body of a single-expression closure is used to determine the parameter types. One obvious example is when there is no contextual type, e.g., let _ = { $0 + 1 } this type-checks today because `1` becomes `Int`, which matches the `+` overload with the type `(Int, Int) -> Int`, determining the parameter type `Int` for the closure. Such code would not type-check with one-way constraints. --- include/swift/Basic/LangOptions.h | 5 ++- include/swift/Option/FrontendOptions.td | 4 ++ lib/Frontend/CompilerInvocation.cpp | 2 + lib/Sema/CSBindings.cpp | 3 +- lib/Sema/CSSimplify.cpp | 42 +++++++++++++++++-- lib/Sema/CSSolver.cpp | 1 + lib/Sema/Constraint.cpp | 5 +++ lib/Sema/Constraint.h | 10 ++++- test/Constraints/one_way_closure_params.swift | 8 ++++ 9 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 test/Constraints/one_way_closure_params.swift diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h index 9e4a053e972d4..b3f6bb2047259 100644 --- a/include/swift/Basic/LangOptions.h +++ b/include/swift/Basic/LangOptions.h @@ -549,7 +549,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/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/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 9675923a8d675..f3a78f9373765 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -724,6 +724,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/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/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index b52cb39d501a3..6c9a75fa68c27 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -1322,6 +1322,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 +1388,7 @@ static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1, case ConstraintKind::FunctionInput: case ConstraintKind::FunctionResult: case ConstraintKind::OneWayEqual: + case ConstraintKind::OneWayBindParam: case ConstraintKind::DefaultClosureType: return false; } @@ -1699,6 +1701,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"); } @@ -4406,6 +4409,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"); } @@ -7121,9 +7125,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 +7186,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 +7220,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); @@ -9759,6 +9791,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 +10304,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..df67727623fa2 100644 --- a/lib/Sema/CSSolver.cpp +++ b/lib/Sema/CSSolver.cpp @@ -1688,6 +1688,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/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}} +} + From b1493413abf3fa58c231259f3b4c7ebd05b82de3 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Fri, 5 Jun 2020 22:11:42 -0700 Subject: [PATCH 126/222] [Constraint system] Generalize recording of pattern binding entry targets. Rather than storing the record of each pattern binding entry's solution application targets as part of an applied function builder, store them within the constraint system and solution using a newly-generalized form of SolutionApplicationTargetsKey. --- lib/Sema/BuilderTransform.cpp | 8 +- lib/Sema/ConstraintSystem.h | 136 +++++++++++++++++++++++++++++++--- 2 files changed, 130 insertions(+), 14 deletions(-) diff --git a/lib/Sema/BuilderTransform.cpp b/lib/Sema/BuilderTransform.cpp index b7ae0510c49c6..983b6e5423682 100644 --- a/lib/Sema/BuilderTransform.cpp +++ b/lib/Sema/BuilderTransform.cpp @@ -288,7 +288,7 @@ class BuilderClosureVisitor continue; // Keep track of this binding entry. - applied.patternBindingEntries.insert({{patternBinding, index}, target}); + cs->setSolutionApplicationTarget({patternBinding, index}, target); } } @@ -1035,11 +1035,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/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index f63170f74ab2e..c4642c85e0dda 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. /// @@ -2610,7 +2706,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}); @@ -5501,4 +5596,25 @@ void forEachExprInConstraintSystem( } // 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 From f1febc2d526d9465ec0f12d222be80a5085c9fe7 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Fri, 5 Jun 2020 22:43:44 -0700 Subject: [PATCH 127/222] [Constraint system] Lift PatternBindingDecl into SolutionApplicationTarget. Generalize the code used to generate constraints and apply solutions to PatternBindingDecls so that it is handled directly by the constaint system and solution, respectively, rather than as part of the function builder transform. No functionality change, but this is a cleaner abstraction. --- lib/Sema/BuilderTransform.cpp | 24 ++++--------------- lib/Sema/CSApply.cpp | 23 +++++++++++++++++++ lib/Sema/CSGen.cpp | 43 ++++++++++++++++++++++++++++++++++- lib/Sema/ConstraintSystem.h | 36 +++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 20 deletions(-) diff --git a/lib/Sema/BuilderTransform.cpp b/lib/Sema/BuilderTransform.cpp index 983b6e5423682..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. - cs->setSolutionApplicationTarget({patternBinding, index}, target); + hadError = true; } } diff --git a/lib/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp index 5b0bc7e3277a7..81a018813c9ac 100644 --- a/lib/Sema/CSApply.cpp +++ b/lib/Sema/CSApply.cpp @@ -8103,6 +8103,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(); @@ -8380,6 +8399,10 @@ SolutionApplicationTarget SolutionApplicationTarget::walk(ASTWalker &walker) { } return *this; + + case Kind::patternBinding: + return *this; } + llvm_unreachable("invalid target kind"); } diff --git a/lib/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index 6097936262392..e171866f9b1b7 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -4428,7 +4428,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/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index c4642c85e0dda..dc714e9672eec 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -1334,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. @@ -1402,6 +1405,8 @@ class SolutionApplicationTarget { CaseLabelItem *caseLabelItem; DeclContext *dc; } caseLabelItem; + + PatternBindingDecl *patternBinding; }; // If the pattern contains a single variable that has an attached @@ -1442,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, @@ -1467,6 +1477,7 @@ class SolutionApplicationTarget { case Kind::function: case Kind::stmtCondition: case Kind::caseLabelItem: + case Kind::patternBinding: return nullptr; } llvm_unreachable("invalid expression type"); @@ -1485,6 +1496,9 @@ class SolutionApplicationTarget { case Kind::caseLabelItem: return caseLabelItem.dc; + + case Kind::patternBinding: + return patternBinding->getDeclContext(); } llvm_unreachable("invalid decl context type"); } @@ -1636,6 +1650,7 @@ class SolutionApplicationTarget { case Kind::expression: case Kind::stmtCondition: case Kind::caseLabelItem: + case Kind::patternBinding: return None; case Kind::function: @@ -1649,6 +1664,7 @@ class SolutionApplicationTarget { case Kind::expression: case Kind::function: case Kind::caseLabelItem: + case Kind::patternBinding: return None; case Kind::stmtCondition: @@ -1662,6 +1678,7 @@ class SolutionApplicationTarget { case Kind::expression: case Kind::function: case Kind::stmtCondition: + case Kind::patternBinding: return None; case Kind::caseLabelItem: @@ -1670,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; @@ -1695,6 +1725,9 @@ class SolutionApplicationTarget { case Kind::caseLabelItem: return caseLabelItem.caseLabelItem->getSourceRange(); + + case Kind::patternBinding: + return patternBinding->getSourceRange(); } llvm_unreachable("invalid target type"); } @@ -1713,6 +1746,9 @@ class SolutionApplicationTarget { case Kind::caseLabelItem: return caseLabelItem.caseLabelItem->getStartLoc(); + + case Kind::patternBinding: + return patternBinding->getLoc(); } llvm_unreachable("invalid target type"); } From 37fefa7508ef6bcb41914b4b07abdfcb80ab983f Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Fri, 5 Jun 2020 20:32:52 -0700 Subject: [PATCH 128/222] [build-script] Explicitly separate build-script-impl products and non-build-script-impl-products when building the list of products to build. This was already being done in a really hacky way namely, we computed the build-script-impl list by filtering a single product list. But if one looked at the actual product classes that we have, all of the build-script-impl products are already a prefix of the entire original list?! So just repersent it as a prefix/suffix pair. I also put in an assert to verify we do not break this invariant in the future. --- utils/build-script | 58 +++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/utils/build-script b/utils/build-script index 93ae848fa1fa9..c4541d74aa2a0 100755 --- a/utils/build-script +++ b/utils/build-script @@ -451,7 +451,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 @@ -793,33 +799,41 @@ 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 = [] + impl_product_classes.append(products.CMark) + 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) + 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 +858,12 @@ 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()) + + return (impl_product_classes, product_classes) def execute(self): """Execute the invocation with the configured arguments.""" @@ -872,10 +891,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". From 1e1b350fd1d5196bc0d73515410c819adecf2e2e Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Fri, 5 Jun 2020 20:56:36 -0700 Subject: [PATCH 129/222] [build-script] Add dependencies for all build-script products as a first approximation. In most cases, I followed the ordering of dependencies defined already by build-script's product classes. In a subsequent commit I am going to add an option (disabled by default) that schedules this via a simple topological sort based on proving our dep graph is a DAG and using RPOT numbers. --- .../swift_build_support/products/benchmarks.py | 14 ++++++++++++++ .../swift_build_support/products/cmark.py | 5 +++++ .../swift_build_support/products/foundation.py | 10 ++++++++++ .../products/indexstoredb.py | 15 +++++++++++++++ .../swift_build_support/products/libcxx.py | 5 +++++ .../swift_build_support/products/libdispatch.py | 9 +++++++++ .../swift_build_support/products/libicu.py | 6 ++++++ .../swift_build_support/products/llbuild.py | 12 ++++++++++++ .../swift_build_support/products/lldb.py | 8 ++++++++ .../swift_build_support/products/llvm.py | 4 ++++ .../products/playgroundsupport.py | 14 ++++++++++++++ .../swift_build_support/products/product.py | 5 +++++ .../swift_build_support/products/pythonkit.py | 14 ++++++++++++++ .../products/skstresstester.py | 16 +++++++++++++++- .../products/sourcekitlsp.py | 14 ++++++++++++++ .../swift_build_support/products/swift.py | 7 +++++++ .../swift_build_support/products/swiftevolve.py | 17 +++++++++++++++++ .../products/swiftinspect.py | 14 ++++++++++++++ .../swift_build_support/products/swiftpm.py | 13 +++++++++++++ .../swift_build_support/products/swiftsyntax.py | 14 ++++++++++++++ .../swift_build_support/products/tensorflow.py | 14 ++++++++++++++ .../products/tsan_libdispatch.py | 14 ++++++++++++++ .../swift_build_support/products/xctest.py | 11 +++++++++++ 23 files changed, 254 insertions(+), 1 deletion(-) 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..de1cfa4cb37ff 100644 --- a/utils/swift_build_support/swift_build_support/products/benchmarks.py +++ b/utils/swift_build_support/swift_build_support/products/benchmarks.py @@ -57,6 +57,20 @@ def should_install(self, host_target): def install(self, host_target): pass + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.XCTest, + product.LLBuild, + product.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 74777d0fd4947..cac4f2e03d1b9 100644 --- a/utils/swift_build_support/swift_build_support/products/cmark.py +++ b/utils/swift_build_support/swift_build_support/products/cmark.py @@ -21,3 +21,8 @@ def is_build_script_impl_product(cls): 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 247c2fe7e8af8..d8fbe50063f19 100644 --- a/utils/swift_build_support/swift_build_support/products/foundation.py +++ b/utils/swift_build_support/swift_build_support/products/foundation.py @@ -29,3 +29,13 @@ 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 [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch] 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..1e2021a6f5f82 100644 --- a/utils/swift_build_support/swift_build_support/products/indexstoredb.py +++ b/utils/swift_build_support/swift_build_support/products/indexstoredb.py @@ -45,6 +45,21 @@ def should_install(self, host_target): def install(self, host_target): pass + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.XCTest, + product.LLBuild, + product.SwiftPM, + product.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 ac11a629d9efc..ea33794edb3a0 100644 --- a/utils/swift_build_support/swift_build_support/products/libcxx.py +++ b/utils/swift_build_support/swift_build_support/products/libcxx.py @@ -21,3 +21,8 @@ def is_build_script_impl_product(cls): Whether this product is produced by build-script-impl. """ return True + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.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 1200284ae942a..42fb77592b9cc 100644 --- a/utils/swift_build_support/swift_build_support/products/libdispatch.py +++ b/utils/swift_build_support/swift_build_support/products/libdispatch.py @@ -29,3 +29,12 @@ def product_source_name(cls): The name of the source code directory of this product. """ return "swift-corelibs-libdispatch" + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB] 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 5874c3ab5ccc8..0aedfb538159b 100644 --- a/utils/swift_build_support/swift_build_support/products/libicu.py +++ b/utils/swift_build_support/swift_build_support/products/libicu.py @@ -29,3 +29,9 @@ def product_source_name(cls): The name of the source code directory of this product. """ return "icu" + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.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 c8d58de682438..dd9e5c3348af1 100644 --- a/utils/swift_build_support/swift_build_support/products/llbuild.py +++ b/utils/swift_build_support/swift_build_support/products/llbuild.py @@ -21,3 +21,15 @@ def is_build_script_impl_product(cls): Whether this product is produced by build-script-impl. """ return True + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.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 e9c1aaea679c4..4ba9f14b1c26c 100644 --- a/utils/swift_build_support/swift_build_support/products/lldb.py +++ b/utils/swift_build_support/swift_build_support/products/lldb.py @@ -21,3 +21,11 @@ def is_build_script_impl_product(cls): Whether this product is produced by build-script-impl. """ return True + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.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 95a1ed2ebf56a..a9a623ee2a4df 100644 --- a/utils/swift_build_support/swift_build_support/products/llvm.py +++ b/utils/swift_build_support/swift_build_support/products/llvm.py @@ -65,3 +65,7 @@ def _version_flags(self): 'CLANG_REPOSITORY_STRING', "clang-{}".format(self.args.clang_compiler_version)) return result + + @classmethod + def get_dependencies(cls): + return [product.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..8d930a2f656ab 100644 --- a/utils/swift_build_support/swift_build_support/products/playgroundsupport.py +++ b/utils/swift_build_support/swift_build_support/products/playgroundsupport.py @@ -110,3 +110,17 @@ def install(self, host_target): "TOOLCHAIN_INSTALL_DIR={}".format(toolchain_prefix), "BUILD_PLAYGROUND_LOGGER_TESTS=NO", ]) + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.XCTest, + product.LLBuild, + product.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 e7bc9ffbc57be..abf70d85997cf 100644 --- a/utils/swift_build_support/swift_build_support/products/product.py +++ b/utils/swift_build_support/swift_build_support/products/product.py @@ -66,6 +66,11 @@ def is_swiftpm_unified_build_product(cls): """ 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..7eb5d6684ce64 100644 --- a/utils/swift_build_support/swift_build_support/products/pythonkit.py +++ b/utils/swift_build_support/swift_build_support/products/pythonkit.py @@ -79,3 +79,17 @@ def install(self, host_target): '--build', self.build_dir, '--target', 'install', ]) + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.XCTest, + product.LLBuild, + product.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..781300a76dabc 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 @@ -90,3 +89,18 @@ def install(self, host_target): self.run_build_script_helper('install', [ '--prefix', install_prefix ]) + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.XCTest, + product.LLBuild, + product.SwiftPM, + product.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..9a7c36868b67a 100644 --- a/utils/swift_build_support/swift_build_support/products/sourcekitlsp.py +++ b/utils/swift_build_support/swift_build_support/products/sourcekitlsp.py @@ -44,3 +44,17 @@ 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 [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.XCTest, + product.LLBuild, + product.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 a59b539cfb4c4..c8319340a215b 100644 --- a/utils/swift_build_support/swift_build_support/products/swift.py +++ b/utils/swift_build_support/swift_build_support/products/swift.py @@ -129,3 +129,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 [product.CMark, + product.LLVM, + product.LibCXX, + product.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..91697856e1d79 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftevolve.py +++ b/utils/swift_build_support/swift_build_support/products/swiftevolve.py @@ -10,6 +10,7 @@ # # ---------------------------------------------------------------------------- +from . import product from . import skstresstester @@ -35,3 +36,19 @@ def should_test(self, host_target): def should_install(self, host_target): return self.args.install_swiftevolve + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.XCTest, + product.LLBuild, + product.SwiftPM, + product.SwiftSyntax, + product.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..afacf1fbeb8f5 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftinspect.py +++ b/utils/swift_build_support/swift_build_support/products/swiftinspect.py @@ -49,6 +49,20 @@ def should_install(self, host_target): def install(self, host_target): pass + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.XCTest, + product.LLBuild, + product.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..cdcb28e19bda5 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftpm.py +++ b/utils/swift_build_support/swift_build_support/products/swiftpm.py @@ -93,3 +93,16 @@ def install(self, host_target): self.run_bootstrap_script('install', host_target, [ '--prefix', install_prefix ]) + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.XCTest, + product.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..59ddae12e4744 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftsyntax.py +++ b/utils/swift_build_support/swift_build_support/products/swiftsyntax.py @@ -91,3 +91,17 @@ def install(self, target_name): self.run_swiftsyntax_build_script(target=target_name, additional_params=additional_params) + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.XCTest, + product.LLBuild, + product.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..6bf87f1da5f81 100644 --- a/utils/swift_build_support/swift_build_support/products/tensorflow.py +++ b/utils/swift_build_support/swift_build_support/products/tensorflow.py @@ -79,3 +79,17 @@ def install(self, host_target): '--build', self.build_dir, '--target', 'install', ]) + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.XCTest, + product.LLBuild, + product.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..8c9dbb5ca8859 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 @@ -78,3 +78,17 @@ def should_install(self, host_target): def install(self, host_target): pass + + @classmethod + def get_dependencies(cls): + return [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation, + product.XCTest, + product.LLBuild, + product.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 161ae947a8093..32a0f64b64d50 100644 --- a/utils/swift_build_support/swift_build_support/products/xctest.py +++ b/utils/swift_build_support/swift_build_support/products/xctest.py @@ -29,3 +29,14 @@ 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 [product.CMark, + product.LLVM, + product.LibCXX, + product.LibICU, + product.Swift, + product.LLDB, + product.LibDispatch, + product.Foundation] From 7525b63412a1756bac377536f205f53c835c6827 Mon Sep 17 00:00:00 2001 From: David Zarzycki Date: Sat, 6 Jun 2020 07:27:51 -0400 Subject: [PATCH 130/222] Unbreak after clang added BFloat16 builtin In apple/llvm-project 9e7b7cbbbdb59d53136c0480f17cfe6ecef94163 (llvm/llvm-project ecd682bbf5e69e8690b7e3634258f05ae0a70448), BFloat16 was added to the clang builtins. --- lib/ClangImporter/ClangAdapter.cpp | 1 + lib/ClangImporter/ImportType.cpp | 1 + lib/IRGen/GenCall.cpp | 2 ++ 3 files changed, 4 insertions(+) diff --git a/lib/ClangImporter/ClangAdapter.cpp b/lib/ClangImporter/ClangAdapter.cpp index 454b5393e329a..8d6c05e55f2d1 100644 --- a/lib/ClangImporter/ClangAdapter.cpp +++ b/lib/ClangImporter/ClangAdapter.cpp @@ -377,6 +377,7 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx, case clang::BuiltinType::SatULongFract: case clang::BuiltinType::Half: case clang::BuiltinType::LongDouble: + case clang::BuiltinType::BFloat16: case clang::BuiltinType::Float16: case clang::BuiltinType::Float128: case clang::BuiltinType::NullPtr: diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index 2b62a2c786409..7eabc9ee1aa0d 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -274,6 +274,7 @@ namespace { case clang::BuiltinType::SatUShortFract: case clang::BuiltinType::SatUFract: case clang::BuiltinType::SatULongFract: + case clang::BuiltinType::BFloat16: case clang::BuiltinType::Float128: case clang::BuiltinType::NullPtr: case clang::BuiltinType::Char8: diff --git a/lib/IRGen/GenCall.cpp b/lib/IRGen/GenCall.cpp index 3fc52f5c47b3b..03d008aa35228 100644 --- a/lib/IRGen/GenCall.cpp +++ b/lib/IRGen/GenCall.cpp @@ -917,6 +917,8 @@ namespace { case clang::BuiltinType::Float16: llvm_unreachable("When upstream support is added for Float16 in " "clang::TargetInfo, use the implementation here"); + case clang::BuiltinType::BFloat16: + return convertFloatingType(Ctx.getTargetInfo().getBFloat16Format()); case clang::BuiltinType::Float128: return convertFloatingType(Ctx.getTargetInfo().getFloat128Format()); From de7033c47987679eb0ce6887ae20c5e3775b17a6 Mon Sep 17 00:00:00 2001 From: David Ungar Date: Fri, 5 Jun 2020 20:33:21 -0700 Subject: [PATCH 131/222] Simplest fix to a dependency bug. Better commenting-out --- lib/AST/AbstractSourceFileDepGraphFactory.cpp | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) 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(); From da14e3119c8bfa942ff23f6d4f222cc74548f38e Mon Sep 17 00:00:00 2001 From: David Ungar Date: Sat, 6 Jun 2020 11:12:49 -0700 Subject: [PATCH 132/222] Fix tests to correspond --- test/Frontend/Fingerprints/class-fingerprint.swift | 7 +------ test/Frontend/Fingerprints/enum-fingerprint.swift | 7 +------ test/Frontend/Fingerprints/protocol-fingerprint.swift | 6 +----- test/Frontend/Fingerprints/struct-fingerprint.swift | 7 +------ .../Driver/TypeBodyFingerprintsDependencyGraphTests.cpp | 4 ++-- 5 files changed, 6 insertions(+), 25 deletions(-) diff --git a/test/Frontend/Fingerprints/class-fingerprint.swift b/test/Frontend/Fingerprints/class-fingerprint.swift index 99c8bbeebbd30..3cab8d6e990c5 100644 --- a/test/Frontend/Fingerprints/class-fingerprint.swift +++ b/test/Frontend/Fingerprints/class-fingerprint.swift @@ -71,9 +71,4 @@ // 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..05083f4f7ec9b 100644 --- a/test/Frontend/Fingerprints/enum-fingerprint.swift +++ b/test/Frontend/Fingerprints/enum-fingerprint.swift @@ -71,9 +71,4 @@ // 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/protocol-fingerprint.swift b/test/Frontend/Fingerprints/protocol-fingerprint.swift index 4bf913339d776..62a9ddd000878 100644 --- a/test/Frontend/Fingerprints/protocol-fingerprint.swift +++ b/test/Frontend/Fingerprints/protocol-fingerprint.swift @@ -71,9 +71,5 @@ // 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..a0c9012a7c422 100644 --- a/test/Frontend/Fingerprints/struct-fingerprint.swift +++ b/test/Frontend/Fingerprints/struct-fingerprint.swift @@ -71,9 +71,4 @@ // 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/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)); } } From dc1624dee0e140e84ff23f48002d0f5cfd1748e4 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sat, 30 May 2020 12:40:16 -0700 Subject: [PATCH 133/222] build: style updates (NFC) Adjust the CMakeLists.txt to match the rest of the usage. --- cmake/modules/AddSwift.cmake | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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() From bd85096a7980dcaba0f46ca5bcf96789159cac42 Mon Sep 17 00:00:00 2001 From: David Zarzycki Date: Sun, 7 Jun 2020 07:01:21 -0400 Subject: [PATCH 134/222] Track upstream changes --- lib/IRGen/GenEnum.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/IRGen/GenEnum.cpp b/lib/IRGen/GenEnum.cpp index 96f516f4c3b6a..69149b6038ed4 100644 --- a/lib/IRGen/GenEnum.cpp +++ b/lib/IRGen/GenEnum.cpp @@ -110,6 +110,7 @@ #include "swift/AST/LazyResolver.h" #include "swift/IRGen/Linking.h" #include "swift/SIL/SILModule.h" +#include "llvm/IR/CFG.h" #include "llvm/IR/Function.h" #include "llvm/IR/GlobalVariable.h" #include "llvm/Analysis/CFG.h" From 99e72b6881aac2ccfef6a7351b8f0616c485009e Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Sun, 7 Jun 2020 14:52:56 -0300 Subject: [PATCH 135/222] [TypeCheckConstraints] Check for archetypes when warning about unrelated type conversion --- lib/Sema/TypeCheckConstraints.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Sema/TypeCheckConstraints.cpp b/lib/Sema/TypeCheckConstraints.cpp index 20e31c2704794..8d218f38d8916 100644 --- a/lib/Sema/TypeCheckConstraints.cpp +++ b/lib/Sema/TypeCheckConstraints.cpp @@ -3706,9 +3706,11 @@ CheckedCastKind TypeChecker::typeCheckCheckedCast(Type fromType, else fromRequiresClass = fromType->mayHaveSuperclass(); - // Casts between protocol metatypes only succeed if the type is existential. + // Casts between protocol metatypes only succeed if the type is existential + // or if it involves generic types because they may be protocol conformances + // we can't know at compile time. if (metatypeCast) { - if (toExistential || fromExistential) + if ((toExistential || fromExistential) && !(fromArchetype || toArchetype)) return failed(); } From eb0b2bb2569988cbe812af143f27996e4abd8273 Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Sun, 7 Jun 2020 14:53:22 -0300 Subject: [PATCH 136/222] [tests] Adding regression tests for SR-12946 --- test/expr/cast/metatype_casts.swift | 7 +++++++ 1 file changed, 7 insertions(+) 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) From 71309a8fa95fe9f4c755804316bacb68fe0a2e5c Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sun, 7 Jun 2020 11:25:48 -0700 Subject: [PATCH 137/222] Revert "[LTO] Support LLVM level link time optimization on Darwin, Linux and Windows" --- include/swift/AST/IRGenOptions.h | 9 --- include/swift/Driver/Action.h | 7 +- include/swift/Driver/Driver.h | 8 --- include/swift/Option/Options.td | 4 -- lib/Driver/DarwinToolChains.cpp | 28 +------- lib/Driver/Driver.cpp | 31 ++------ lib/Driver/ToolChains.cpp | 5 -- lib/Driver/ToolChains.h | 3 - lib/Driver/UnixToolChains.cpp | 26 +------ lib/Driver/WindowsToolChains.cpp | 71 ++++--------------- lib/Frontend/CompilerInvocation.cpp | 11 --- lib/IRGen/IRGen.cpp | 9 +-- lib/IRGen/IRGenModule.cpp | 27 ++----- test/Driver/Inputs/lto/lib.swift | 1 - test/Driver/Inputs/lto/main.swift | 3 - test/Driver/Inputs/lto/multifiles/file.swift | 3 - test/Driver/Inputs/lto/multifiles/main.swift | 1 - test/Driver/link-time-opt-lib-thin.swift | 12 ---- test/Driver/link-time-opt-lib.swift | 5 -- .../Driver/link-time-opt-staticlib-thin.swift | 14 ---- test/Driver/link-time-opt-staticlib.swift | 6 -- test/Driver/link-time-opt.swift | 5 -- utils/build-windows.bat | 3 +- 23 files changed, 36 insertions(+), 256 deletions(-) delete mode 100644 test/Driver/Inputs/lto/lib.swift delete mode 100644 test/Driver/Inputs/lto/main.swift delete mode 100644 test/Driver/Inputs/lto/multifiles/file.swift delete mode 100644 test/Driver/Inputs/lto/multifiles/main.swift delete mode 100644 test/Driver/link-time-opt-lib-thin.swift delete mode 100644 test/Driver/link-time-opt-lib.swift delete mode 100644 test/Driver/link-time-opt-staticlib-thin.swift delete mode 100644 test/Driver/link-time-opt-staticlib.swift delete mode 100644 test/Driver/link-time-opt.swift diff --git a/include/swift/AST/IRGenOptions.h b/include/swift/AST/IRGenOptions.h index 31d14627e093e..279fdcefb3c4e 100644 --- a/include/swift/AST/IRGenOptions.h +++ b/include/swift/AST/IRGenOptions.h @@ -65,12 +65,6 @@ enum class IRGenDebugInfoFormat : unsigned { CodeView }; -enum class IRGenLLVMLTOKind : unsigned { - None, - Thin, - Full -}; - enum class IRGenEmbedMode : unsigned { None, EmbedMarker, @@ -223,8 +217,6 @@ class IRGenOptions { /// Whether we should embed the bitcode file. IRGenEmbedMode EmbedMode : 2; - IRGenLLVMLTOKind LLVMLTOKind: 2; - /// Add names to LLVM values. unsigned HasValueNamesSetting : 1; unsigned ValueNames : 1; @@ -326,7 +318,6 @@ class IRGenOptions { DisableSwiftSpecificLLVMOptzns(false), DisableLLVMSLPVectorizer(false), Playground(false), EmitStackPromotionChecks(false), FunctionSections(false), PrintInlineTree(false), EmbedMode(IRGenEmbedMode::None), - LLVMLTOKind(IRGenLLVMLTOKind::None), HasValueNamesSetting(false), ValueNames(false), EnableReflectionMetadata(true), EnableReflectionNames(true), EnableAnonymousContextMangledNames(false), ForcePublicLinkage(false), diff --git a/include/swift/Driver/Action.h b/include/swift/Driver/Action.h index 3f787bace7714..02801d8aece66 100644 --- a/include/swift/Driver/Action.h +++ b/include/swift/Driver/Action.h @@ -328,19 +328,16 @@ class GeneratePCHJobAction : public JobAction { class DynamicLinkJobAction : public JobAction { virtual void anchor(); LinkKind Kind; - bool LTO; public: - DynamicLinkJobAction(ArrayRef Inputs, LinkKind K, bool LTO) + DynamicLinkJobAction(ArrayRef Inputs, LinkKind K) : JobAction(Action::Kind::DynamicLinkJob, Inputs, file_types::TY_Image), - Kind(K), LTO(LTO) { + Kind(K) { assert(Kind != LinkKind::None && Kind != LinkKind::StaticLibrary); } LinkKind getKind() const { return Kind; } - bool PerformLTO() const { return LTO; } - static bool classof(const Action *A) { return A->getKind() == Action::Kind::DynamicLinkJob; } diff --git a/include/swift/Driver/Driver.h b/include/swift/Driver/Driver.h index 018b2a468812b..5e055359d6346 100644 --- a/include/swift/Driver/Driver.h +++ b/include/swift/Driver/Driver.h @@ -101,14 +101,6 @@ class OutputInfo { /// The output type which should be used for compile actions. file_types::ID CompilerOutputType = file_types::ID::TY_INVALID; - enum class LTOKind { - None, - LLVMThin, - LLVMFull, - }; - - LTOKind LTOVariant = LTOKind::None; - /// Describes if and how the output of compile actions should be /// linked together. LinkKind LinkAction = LinkKind::None; diff --git a/include/swift/Option/Options.td b/include/swift/Option/Options.td index fd7992bad5ccf..0ca3c312b961c 100644 --- a/include/swift/Option/Options.td +++ b/include/swift/Option/Options.td @@ -515,10 +515,6 @@ def disable_bridging_pch : Flag<["-"], "disable-bridging-pch">, Flags<[HelpHidden]>, HelpText<"Disable automatic generation of bridging PCH files">; -def lto : Joined<["-"], "lto=">, - Flags<[FrontendOption, NoInteractiveOption]>, - HelpText<"Specify the LTO type to either 'llvm' or 'llvm-full'">; - // Experimental feature options // Note: this flag will be removed when JVP/differential generation in the diff --git a/lib/Driver/DarwinToolChains.cpp b/lib/Driver/DarwinToolChains.cpp index f50877d6db639..bfd3bd442d3cc 100644 --- a/lib/Driver/DarwinToolChains.cpp +++ b/lib/Driver/DarwinToolChains.cpp @@ -238,15 +238,12 @@ toolchains::Darwin::addLinkerInputArgs(InvocationInfo &II, Arguments.push_back("-filelist"); Arguments.push_back(context.getTemporaryFilePath("inputs", "LinkFileList")); II.FilelistInfos.push_back( - {Arguments.back(), context.OI.CompilerOutputType, + {Arguments.back(), file_types::TY_Object, FilelistInfo::WhichFiles::InputJobsAndSourceInputActions}); } else { addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, file_types::TY_Object); - addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, - file_types::TY_LLVM_BC); addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); - addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); } @@ -309,20 +306,6 @@ toolchains::Darwin::addArgsToLinkARCLite(ArgStringList &Arguments, } } -void -toolchains::Darwin::addLTOLibArgs(ArgStringList &Arguments, - const JobContext &context) const { - llvm::SmallString<128> LTOLibPath; - if (findXcodeClangPath(LTOLibPath)) { - llvm::sys::path::remove_filename(LTOLibPath); // 'clang' - llvm::sys::path::remove_filename(LTOLibPath); // 'bin' - llvm::sys::path::append(LTOLibPath, "lib", "libLTO.dylib"); - - Arguments.push_back("-lto_library"); - Arguments.push_back(context.Args.MakeArgString(LTOLibPath)); - } -} - void toolchains::Darwin::addSanitizerArgs(ArgStringList &Arguments, const DynamicLinkJobAction &job, @@ -740,10 +723,6 @@ toolchains::Darwin::constructInvocation(const DynamicLinkJobAction &job, addArgsToLinkARCLite(Arguments, context); - if (job.PerformLTO()) { - addLTOLibArgs(Arguments, context); - } - for (const Arg *arg : context.Args.filtered(options::OPT_F, options::OPT_Fsystem)) { Arguments.push_back("-F"); @@ -811,17 +790,14 @@ toolchains::Darwin::constructInvocation(const StaticLinkJobAction &job, if (context.shouldUseInputFileList()) { Arguments.push_back("-filelist"); Arguments.push_back(context.getTemporaryFilePath("inputs", "LinkFileList")); - II.FilelistInfos.push_back({Arguments.back(), context.OI.CompilerOutputType, + II.FilelistInfos.push_back({Arguments.back(), file_types::TY_Object, FilelistInfo::WhichFiles::InputJobs}); } else { addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, file_types::TY_Object); - addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, - file_types::TY_LLVM_BC); } addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); - addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); Arguments.push_back("-o"); diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index d66279d81771b..d0be6bc80fd3a 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1427,15 +1427,12 @@ static bool isSDKTooOld(StringRef sdkPath, const llvm::Triple &target) { void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args, const bool BatchMode, const InputFileList &Inputs, OutputInfo &OI) const { - auto LinkerInputType = Args.hasArg(options::OPT_lto) - ? file_types::TY_LLVM_BC - : file_types::TY_Object; // By default, the driver does not link its output; this will be updated // appropriately below if linking is required. OI.CompilerOutputType = driverKind == DriverKind::Interactive ? file_types::TY_Nothing - : LinkerInputType; + : file_types::TY_Object; if (const Arg *A = Args.getLastArg(options::OPT_num_threads)) { if (BatchMode) { @@ -1465,14 +1462,14 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args, diag::error_static_emit_executable_disallowed); OI.LinkAction = LinkKind::Executable; - OI.CompilerOutputType = LinkerInputType; + OI.CompilerOutputType = file_types::TY_Object; break; case options::OPT_emit_library: OI.LinkAction = Args.hasArg(options::OPT_static) ? LinkKind::StaticLibrary : LinkKind::DynamicLibrary; - OI.CompilerOutputType = LinkerInputType; + OI.CompilerOutputType = file_types::TY_Object; break; case options::OPT_static: @@ -1782,18 +1779,6 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args, } - if (const Arg *A = Args.getLastArg(options::OPT_lto)) { - auto LTOVariant = llvm::StringSwitch>(A->getValue()) - .Case("llvm", OutputInfo::LTOKind::LLVMThin) - .Case("llvm-full", OutputInfo::LTOKind::LLVMFull) - .Default(llvm::None); - if (LTOVariant) - OI.LTOVariant = LTOVariant.getValue(); - else - Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value, - A->getAsString(Args), A->getValue()); - } - if (TC.getTriple().isOSWindows()) { if (const Arg *A = Args.getLastArg(options::OPT_libc)) { OI.RuntimeVariant = @@ -2128,17 +2113,15 @@ void Driver::buildActions(SmallVectorImpl &TopLevelActions, MergeModuleAction = C.createAction(AllModuleInputs); } - auto PerformLTO = Args.hasArg(options::OPT_lto); if (OI.shouldLink() && !AllLinkerInputs.empty()) { JobAction *LinkAction = nullptr; if (OI.LinkAction == LinkKind::StaticLibrary) { LinkAction = C.createAction(AllLinkerInputs, - OI.LinkAction); + OI.LinkAction); } else { LinkAction = C.createAction(AllLinkerInputs, - OI.LinkAction, - PerformLTO); + OI.LinkAction); } // On ELF platforms there's no built in autolinking mechanism, so we @@ -2147,7 +2130,7 @@ void Driver::buildActions(SmallVectorImpl &TopLevelActions, const auto &Triple = TC.getTriple(); SmallVector AutolinkExtractInputs; for (const Action *A : AllLinkerInputs) - if (A->getType() == OI.CompilerOutputType) { + if (A->getType() == file_types::TY_Object) { // Shared objects on ELF platforms don't have a swift1_autolink_entries // section in them because the section in the .o files is marked as // SHF_EXCLUDE. @@ -2163,7 +2146,7 @@ void Driver::buildActions(SmallVectorImpl &TopLevelActions, (Triple.getObjectFormat() == llvm::Triple::ELF && !Triple.isPS4()) || Triple.getObjectFormat() == llvm::Triple::Wasm || Triple.isOSCygMing(); - if (!AutolinkExtractInputs.empty() && AutolinkExtractRequired && !PerformLTO) { + if (!AutolinkExtractInputs.empty() && AutolinkExtractRequired) { auto *AutolinkExtractAction = C.createAction(AutolinkExtractInputs); // Takes the same inputs as the linker... diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index a235829ff7335..232a69ac30487 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -518,11 +518,6 @@ ToolChain::constructInvocation(const CompileJobAction &job, Arguments.push_back("-track-system-dependencies"); } - if (auto arg = context.Args.getLastArg(options::OPT_lto)) { - Arguments.push_back(context.Args.MakeArgString( - Twine("-lto=") + arg->getValue())); - } - context.Args.AddLastArg( Arguments, options:: diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h index 946a8e70bc446..29a04c1b243a8 100644 --- a/lib/Driver/ToolChains.h +++ b/lib/Driver/ToolChains.h @@ -48,9 +48,6 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public ToolChain { void addDeploymentTargetArgs(llvm::opt::ArgStringList &Arguments, const JobContext &context) const; - void addLTOLibArgs(llvm::opt::ArgStringList &Arguments, - const JobContext &context) const; - void addCommonFrontendArgs( const OutputInfo &OI, const CommandOutput &output, const llvm::opt::ArgList &inputArgs, diff --git a/lib/Driver/UnixToolChains.cpp b/lib/Driver/UnixToolChains.cpp index 75c812b9521ad..59f24a4eafe1e 100644 --- a/lib/Driver/UnixToolChains.cpp +++ b/lib/Driver/UnixToolChains.cpp @@ -72,10 +72,7 @@ ToolChain::InvocationInfo toolchains::GenericUnix::constructInvocation( addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, file_types::TY_Object); - addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, - file_types::TY_LLVM_BC); addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); - addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); Arguments.push_back("-o"); Arguments.push_back( @@ -170,9 +167,6 @@ toolchains::GenericUnix::constructInvocation(const DynamicLinkJobAction &job, std::string Linker; if (const Arg *A = context.Args.getLastArg(options::OPT_use_ld)) { Linker = A->getValue(); - } else if (context.OI.LTOVariant != OutputInfo::LTOKind::None) { - // Force to use lld for LTO - Linker = "lld"; } else { Linker = getDefaultLinker(); } @@ -224,16 +218,6 @@ toolchains::GenericUnix::constructInvocation(const DynamicLinkJobAction &job, Arguments.push_back("-pie"); } - switch (context.OI.LTOVariant) { - case OutputInfo::LTOKind::LLVMThin: - Arguments.push_back("-flto=thin"); - break; - case OutputInfo::LTOKind::LLVMFull: - Arguments.push_back("-flto=full"); - break; - case OutputInfo::LTOKind::None: break; - } - bool staticExecutable = false; bool staticStdlib = false; @@ -269,11 +253,7 @@ toolchains::GenericUnix::constructInvocation(const DynamicLinkJobAction &job, addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, file_types::TY_Object); - addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, - file_types::TY_LLVM_BC); addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); - addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); - for (const Arg *arg : context.Args.filtered(options::OPT_F, options::OPT_Fsystem)) { @@ -388,7 +368,7 @@ toolchains::GenericUnix::constructInvocation(const StaticLinkJobAction &job, ArgStringList Arguments; // Configure the toolchain. - const char *AR = "llvm-ar"; + const char *AR = "ar"; Arguments.push_back("crs"); Arguments.push_back( @@ -396,11 +376,7 @@ toolchains::GenericUnix::constructInvocation(const StaticLinkJobAction &job, addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, file_types::TY_Object); - addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, - file_types::TY_LLVM_BC); addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); - addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); - InvocationInfo II{AR, Arguments}; diff --git a/lib/Driver/WindowsToolChains.cpp b/lib/Driver/WindowsToolChains.cpp index 5131d14e14f03..0fe623675eb1a 100644 --- a/lib/Driver/WindowsToolChains.cpp +++ b/lib/Driver/WindowsToolChains.cpp @@ -143,11 +143,7 @@ toolchains::Windows::constructInvocation(const DynamicLinkJobAction &job, addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, file_types::TY_Object); - addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, - file_types::TY_LLVM_BC); addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); - addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); - for (const Arg *arg : context.Args.filtered(options::OPT_F, options::OPT_Fsystem)) { @@ -190,21 +186,6 @@ toolchains::Windows::constructInvocation(const DynamicLinkJobAction &job, context.Args.AddAllArgs(Arguments, options::OPT_linker_option_Group); context.Args.AddAllArgValues(Arguments, options::OPT_Xclang_linker); - switch (context.OI.LTOVariant) { - case OutputInfo::LTOKind::LLVMThin: - case OutputInfo::LTOKind::LLVMFull: { - if (Linker.empty()) - Arguments.push_back("-fuse-ld=lld"); - if (context.OI.LTOVariant == OutputInfo::LTOKind::LLVMThin) { - Arguments.push_back("-flto=thin"); - } else { - Arguments.push_back("-flto=full"); - } - break; - } - case OutputInfo::LTOKind::None: break; - } - // Run clang++ in verbose mode if "-v" is set if (context.Args.hasArg(options::OPT_v)) { Arguments.push_back("-v"); @@ -229,46 +210,22 @@ toolchains::Windows::constructInvocation(const StaticLinkJobAction &job, ArgStringList Arguments; - switch (context.OI.LTOVariant) { - case OutputInfo::LTOKind::LLVMThin: - case OutputInfo::LTOKind::LLVMFull: { - const char *AR = "llvm-ar"; - Arguments.push_back("crs"); + const char *Linker = "link"; + if (const Arg *A = context.Args.getLastArg(options::OPT_use_ld)) + Linker = context.Args.MakeArgString(A->getValue()); + + Arguments.push_back("/lib"); + Arguments.push_back("-nologo"); - Arguments.push_back( - context.Args.MakeArgString(context.Output.getPrimaryOutputFilename())); + addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, + file_types::TY_Object); + addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); - addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, - file_types::TY_Object); - addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, - file_types::TY_LLVM_BC); - addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); - addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); + StringRef OutputFile = context.Output.getPrimaryOutputFilename(); + Arguments.push_back(context.Args.MakeArgString(Twine("/OUT:") + OutputFile)); - InvocationInfo II{AR, Arguments}; + InvocationInfo II{Linker, Arguments}; + II.allowsResponseFiles = true; - return II; - } - case OutputInfo::LTOKind::None: - const char *Linker = "link"; - if (const Arg *A = context.Args.getLastArg(options::OPT_use_ld)) - Linker = context.Args.MakeArgString(A->getValue()); - - Arguments.push_back("/lib"); - Arguments.push_back("-nologo"); - - addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, - file_types::TY_Object); - addPrimaryInputsOfType(Arguments, context.Inputs, context.Args, - file_types::TY_LLVM_BC); - addInputsOfType(Arguments, context.InputActions, file_types::TY_Object); - addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC); - - StringRef OutputFile = context.Output.getPrimaryOutputFilename(); - Arguments.push_back(context.Args.MakeArgString(Twine("/OUT:") + OutputFile)); - - InvocationInfo II{Linker, Arguments}; - II.allowsResponseFiles = true; - return II; - } + return II; } diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index f3a78f9373765..071ccdf4f65e4 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1428,17 +1428,6 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args, } } - if (const Arg *A = Args.getLastArg(options::OPT_lto)) { - auto LLVMLTOKind = llvm::StringSwitch>(A->getValue()) - .Case("llvm", IRGenLLVMLTOKind::Thin) - .Case("llvm-full", IRGenLLVMLTOKind::Full) - .Default(llvm::None); - if (LLVMLTOKind) - Opts.LLVMLTOKind = LLVMLTOKind.getValue(); - else - Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value, - A->getAsString(Args), A->getValue()); - } if (const Arg *A = Args.getLastArg(options::OPT_sanitize_coverage_EQ)) { Opts.SanitizeCoverage = diff --git a/lib/IRGen/IRGen.cpp b/lib/IRGen/IRGen.cpp index 24886a9b362c9..21a400c8f3213 100644 --- a/lib/IRGen/IRGen.cpp +++ b/lib/IRGen/IRGen.cpp @@ -548,14 +548,9 @@ bool swift::performLLVM(const IRGenOptions &Opts, case IRGenOutputKind::LLVMAssembly: EmitPasses.add(createPrintModulePass(*RawOS)); break; - case IRGenOutputKind::LLVMBitcode: { - if (Opts.LLVMLTOKind == IRGenLLVMLTOKind::Thin) { - EmitPasses.add(createWriteThinLTOBitcodePass(*RawOS)); - } else { - EmitPasses.add(createBitcodeWriterPass(*RawOS)); - } + case IRGenOutputKind::LLVMBitcode: + EmitPasses.add(createBitcodeWriterPass(*RawOS)); break; - } case IRGenOutputKind::NativeAssembly: case IRGenOutputKind::ObjectFile: { CodeGenFileType FileType; diff --git a/lib/IRGen/IRGenModule.cpp b/lib/IRGen/IRGenModule.cpp index c0da6209e7056..87f3207b6ef09 100644 --- a/lib/IRGen/IRGenModule.cpp +++ b/lib/IRGen/IRGenModule.cpp @@ -1098,18 +1098,10 @@ void IRGenModule::addLinkLibrary(const LinkLibrary &linkLib) { switch (linkLib.getKind()) { case LibraryKind::Library: { - if (TargetInfo.OutputObjectFormat == llvm::Triple::ELF && IRGen.Opts.LLVMLTOKind != IRGenLLVMLTOKind::None) { - // When performing LTO, we always use lld that supports auto linking mechanism with ELF. - // So embed dependent libraries names in "llvm.dependent-libraries" instead of options - // to avoid using swift-autolink-extract. - AutolinkEntries.push_back( - llvm::MDNode::get(ctx, llvm::MDString::get(ctx, linkLib.getName()))); - } else { - llvm::SmallString<32> opt = - getTargetDependentLibraryOption(Triple, linkLib.getName()); - AutolinkEntries.push_back( - llvm::MDNode::get(ctx, llvm::MDString::get(ctx, opt))); - } + llvm::SmallString<32> opt = + getTargetDependentLibraryOption(Triple, linkLib.getName()); + AutolinkEntries.push_back( + llvm::MDNode::get(ctx, llvm::MDString::get(ctx, opt))); break; } case LibraryKind::Framework: { @@ -1196,12 +1188,7 @@ static bool isFirstObjectFileInModule(IRGenModule &IGM) { void IRGenModule::emitAutolinkInfo() { // Collect the linker options already in the module (from ClangCodeGen). // FIXME: This constant should be vended by LLVM somewhere. - // When performing LTO, we always use lld that supports auto linking mechanism with ELF. - // So embed dependent libraries names in "llvm.dependent-libraries" instead of "llvm.linker.options". - const StringRef AutolinkSectionName = - TargetInfo.OutputObjectFormat == llvm::Triple::ELF && IRGen.Opts.LLVMLTOKind != IRGenLLVMLTOKind::None - ? "llvm.dependent-libraries" : "llvm.linker.options"; - auto *Metadata = Module.getOrInsertNamedMetadata(AutolinkSectionName); + auto *Metadata = Module.getOrInsertNamedMetadata("llvm.linker.options"); for (llvm::MDNode *LinkOption : Metadata->operands()) AutolinkEntries.push_back(LinkOption); @@ -1216,9 +1203,9 @@ void IRGenModule::emitAutolinkInfo() { AutolinkEntries.end()); const bool AutolinkExtractRequired = - ((TargetInfo.OutputObjectFormat == llvm::Triple::ELF && !Triple.isPS4()) || + (TargetInfo.OutputObjectFormat == llvm::Triple::ELF && !Triple.isPS4()) || TargetInfo.OutputObjectFormat == llvm::Triple::Wasm || - Triple.isOSCygMing()) && IRGen.Opts.LLVMLTOKind == IRGenLLVMLTOKind::None; + Triple.isOSCygMing(); if (!AutolinkExtractRequired) { // On platforms that support autolinking, continue to use the metadata. diff --git a/test/Driver/Inputs/lto/lib.swift b/test/Driver/Inputs/lto/lib.swift deleted file mode 100644 index 2da93851bb3e7..0000000000000 --- a/test/Driver/Inputs/lto/lib.swift +++ /dev/null @@ -1 +0,0 @@ -public func libraryFunction() {} diff --git a/test/Driver/Inputs/lto/main.swift b/test/Driver/Inputs/lto/main.swift deleted file mode 100644 index fef49f4c4f8f2..0000000000000 --- a/test/Driver/Inputs/lto/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -import A - -libraryFunction() diff --git a/test/Driver/Inputs/lto/multifiles/file.swift b/test/Driver/Inputs/lto/multifiles/file.swift deleted file mode 100644 index 2ff6e02c99461..0000000000000 --- a/test/Driver/Inputs/lto/multifiles/file.swift +++ /dev/null @@ -1,3 +0,0 @@ -func anotherFileFunction() { - print(#function) -} diff --git a/test/Driver/Inputs/lto/multifiles/main.swift b/test/Driver/Inputs/lto/multifiles/main.swift deleted file mode 100644 index c81b011f13bd9..0000000000000 --- a/test/Driver/Inputs/lto/multifiles/main.swift +++ /dev/null @@ -1 +0,0 @@ -anotherFileFunction() diff --git a/test/Driver/link-time-opt-lib-thin.swift b/test/Driver/link-time-opt-lib-thin.swift deleted file mode 100644 index f07ecded6e0c1..0000000000000 --- a/test/Driver/link-time-opt-lib-thin.swift +++ /dev/null @@ -1,12 +0,0 @@ -// FIXME: ld64 in Xcode toolchain uses older version of LLVM than swiftc, so ld64 can't read module summary for LTO -// from bitcode file produced by compiler. This should be fixed before shipping Xcode toolchain by upgrading -// LLVM version used in ld64. -// XFAIL: OS=macosx -// XFAIL: OS=tvos -// XFAIL: OS=watchos -// XFAIL: OS=ios -// RUN: rm -rf %t -// RUN: %empty-directory(%t/thin) - -// RUN: %target-swiftc_driver %S/Inputs/lto/lib.swift -lto=llvm -emit-library -emit-module -module-name A -working-directory %t/thin -// RUN: %target-swiftc_driver %S/Inputs/lto/main.swift -L. -I. -lA -lto=llvm -working-directory %t/thin diff --git a/test/Driver/link-time-opt-lib.swift b/test/Driver/link-time-opt-lib.swift deleted file mode 100644 index 81cfaa4cafe92..0000000000000 --- a/test/Driver/link-time-opt-lib.swift +++ /dev/null @@ -1,5 +0,0 @@ -// RUN: rm -rf %t -// RUN: %empty-directory(%t/full) - -// RUN: %target-swiftc_driver %S/Inputs/lto/lib.swift -lto=llvm-full -emit-library -emit-module -module-name A -working-directory %t/full -// RUN: %target-swiftc_driver %S/Inputs/lto/main.swift -L. -I. -lA -lto=llvm-full -working-directory %t/full diff --git a/test/Driver/link-time-opt-staticlib-thin.swift b/test/Driver/link-time-opt-staticlib-thin.swift deleted file mode 100644 index 283b7c541fcbd..0000000000000 --- a/test/Driver/link-time-opt-staticlib-thin.swift +++ /dev/null @@ -1,14 +0,0 @@ -// UNSUPPORTED: OS=windows-msvc -// FIXME: ld64 in Xcode toolchain uses older version of LLVM than swiftc, so ld64 can't read module summary for LTO -// from bitcode file produced by compiler. This should be fixed before shipping Xcode toolchain by upgrading -// LLVM version used in ld64. -// XFAIL: OS=macosx -// XFAIL: OS=tvos -// XFAIL: OS=watchos -// XFAIL: OS=ios - -// RUN: rm -rf %t -// RUN: %empty-directory(%t/thin-static) - -// RUN: %target-swiftc_driver %S/Inputs/lto/lib.swift -static -lto=llvm -emit-library -emit-module -module-name A -working-directory %t/thin-static -// RUN: %target-swiftc_driver %S/Inputs/lto/main.swift -L. -I. -lA -lto=llvm -working-directory %t/thin-static diff --git a/test/Driver/link-time-opt-staticlib.swift b/test/Driver/link-time-opt-staticlib.swift deleted file mode 100644 index 6daf95595bf3e..0000000000000 --- a/test/Driver/link-time-opt-staticlib.swift +++ /dev/null @@ -1,6 +0,0 @@ -// UNSUPPORTED: OS=windows-msvc -// RUN: rm -rf %t -// RUN: %empty-directory(%t/full-static) - -// RUN: %target-swiftc_driver %S/Inputs/lto/lib.swift -static -lto=llvm-full -emit-library -emit-module -module-name A -working-directory %t/full-static -// RUN: %target-swiftc_driver %S/Inputs/lto/main.swift -L. -I. -lA -lto=llvm-full -working-directory %t/full-static diff --git a/test/Driver/link-time-opt.swift b/test/Driver/link-time-opt.swift deleted file mode 100644 index 28a92ad1fcc99..0000000000000 --- a/test/Driver/link-time-opt.swift +++ /dev/null @@ -1,5 +0,0 @@ -// RUN: %target-swiftc_driver -driver-print-jobs %S/../Inputs/empty.swift -lto=llvm | %FileCheck %s --check-prefix=CHECK-%target-os --check-prefix=CHECK -// CHECK: swift{{(c\.exe")?}} -frontend -emit-bc -// CHECK-macosx-NEXT: bin/ld {{.+}} -lto_library {{.+}}/lib/libLTO.dylib -// CHECK-windows-msvc-NEXT: clang.exe" {{.+}} -fuse-ld=lld -flto=thin -// CHECK-linux-gnu-NEXT: bin/clang {{.+}} -flto=thin diff --git a/utils/build-windows.bat b/utils/build-windows.bat index 3c9c11e65ff49..ca62cfef8f43e 100644 --- a/utils/build-windows.bat +++ b/utils/build-windows.bat @@ -97,7 +97,6 @@ git clone --depth 1 --single-branch https://github.com/apple/swift-cmark cmark % git clone --depth 1 --single-branch --branch swift/master https://github.com/apple/llvm-project llvm-project %exitOnError% mklink /D "%source_root%\clang" "%source_root%\llvm-project\clang" mklink /D "%source_root%\llvm" "%source_root%\llvm-project\llvm" -mklink /D "%source_root%\lld" "%source_root%\llvm-project\lld" mklink /D "%source_root%\lldb" "%source_root%\llvm-project\lldb" mklink /D "%source_root%\compiler-rt" "%source_root%\llvm-project\compiler-rt" mklink /D "%source_root%\libcxx" "%source_root%\llvm-project\libcxx" @@ -166,7 +165,7 @@ cmake^ -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-windows-msvc^ -DLLVM_ENABLE_PDB:BOOL=YES^ -DLLVM_ENABLE_ASSERTIONS:BOOL=YES^ - -DLLVM_ENABLE_PROJECTS:STRING=lld;clang^ + -DLLVM_ENABLE_PROJECTS:STRING=clang^ -DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;X86"^ -DLLVM_INCLUDE_BENCHMARKS:BOOL=NO^ -DLLVM_INCLUDE_DOCS:BOOL=NO^ From 9398153c9dbb2db7bc144c8dc86844d9231b75c9 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Sun, 7 Jun 2020 20:18:33 -0700 Subject: [PATCH 138/222] [Parse] Preserve original member hashing behaviour A previous commit inadvertently changed the logic such that the member hash of an extension body would be set to a partial interface hash. Luckily this shouldn't have caused any behavioural change as the interface hash itself would have been left unaffected. This commit makes sure we preserve the original behaviour where if we don't have the body tokens hashed separately, we give the body hash a default constructed MD5. Noticed by inspection. --- lib/Parse/ParseDecl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 1730d859a81e9..6b16711de3b4f 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -4471,11 +4471,11 @@ Parser::parseDeclList(SourceLoc LBLoc, SourceLoc &RBLoc, Diag<> ErrorDiag, // If we're hashing the type body separately, record the curly braces but // nothing inside for the interface hash. - Optional>> S; + Optional>> MemberHashingScope; if (IDC->areTokensHashedForThisBodyInsteadOfInterfaceHash()) { recordTokenHash("{"); recordTokenHash("}"); - S.emplace(CurrentTokenHash, llvm::MD5()); + MemberHashingScope.emplace(CurrentTokenHash, llvm::MD5()); } std::vector decls; @@ -4511,8 +4511,8 @@ Parser::parseDeclList(SourceLoc LBLoc, SourceLoc &RBLoc, Diag<> ErrorDiag, return std::make_pair(decls, None); llvm::MD5::MD5Result result; - auto tokenHashForThisDeclList = CurrentTokenHash.getValueOr(llvm::MD5()); - 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()); From db9a27e24a9fa54c126a43abdb4a936e4fd30fd5 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Sun, 7 Jun 2020 20:21:28 -0700 Subject: [PATCH 139/222] [AST] Remove hasSyntaxRoot Use `shouldBuildSyntaxTree` instead. --- include/swift/AST/SourceFile.h | 1 - lib/AST/Module.cpp | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/include/swift/AST/SourceFile.h b/include/swift/AST/SourceFile.h index 6ff1a9adbd472..7a799659bb182 100644 --- a/include/swift/AST/SourceFile.h +++ b/include/swift/AST/SourceFile.h @@ -582,7 +582,6 @@ class SourceFile final : public FileUnit { bool hasDelayedBodyParsing() const; syntax::SourceFileSyntax getSyntaxRoot() const; - bool hasSyntaxRoot() const; OpaqueTypeDecl *lookupOpaqueResultType(StringRef MangledName) override; diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp index b8f3c5277573d..fc6a7af0409cd 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -1088,12 +1088,8 @@ void SourceFile::getInterfaceHash(llvm::SmallString<32> &str) const { llvm::MD5::stringifyResult(result, str); } -bool SourceFile::hasSyntaxRoot() const { - return ParsingOpts.contains(ParsingFlags::BuildSyntaxTree); -} - syntax::SourceFileSyntax SourceFile::getSyntaxRoot() const { - assert(hasSyntaxRoot() && "has no syntax root"); + assert(shouldBuildSyntaxTree() && "Syntax tree disabled"); auto &eval = getASTContext().evaluator; auto *mutableThis = const_cast(this); return *evaluateOrDefault(eval, ParseSourceFileRequest{mutableThis}, {}) From 504ce0aaedde5a55a44e6025b59bc282f7427d9a Mon Sep 17 00:00:00 2001 From: Dan Zheng Date: Wed, 27 May 2020 21:46:19 -0700 Subject: [PATCH 140/222] [AutoDiff] Handle `array.finalize_intrinsic`. Update differentiation to handle `array.finalize_intrinsic` applications. `VJPEmitter::visitApplyInst` does standard cloning for these applications. `PullbackEmitter::visitApplyInst` treats the intrinsic like an identity function, accumulating result's adjoint into argument's adjoint. This fixes array literal initialization differentiation. --- include/swift/AST/SemanticAttrs.def | 1 + include/swift/AST/SemanticAttrs.h | 1 + .../swift/SILOptimizer/Differentiation/Common.h | 2 ++ .../Differentiation/LinearMapInfo.cpp | 2 ++ .../Differentiation/PullbackEmitter.cpp | 15 +++++++++++++-- lib/SILOptimizer/Differentiation/VJPEmitter.cpp | 9 +++++++++ 6 files changed, 28 insertions(+), 2 deletions(-) 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/SILOptimizer/Differentiation/Common.h b/include/swift/SILOptimizer/Differentiation/Common.h index 7dff0973e46a8..649be7b871618 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 { diff --git a/lib/SILOptimizer/Differentiation/LinearMapInfo.cpp b/lib/SILOptimizer/Differentiation/LinearMapInfo.cpp index 0ad634cae3b28..9fc1a232f8ebf 100644 --- a/lib/SILOptimizer/Differentiation/LinearMapInfo.cpp +++ b/lib/SILOptimizer/Differentiation/LinearMapInfo.cpp @@ -414,6 +414,8 @@ void LinearMapInfo::generateDifferentiationDataStructures( // initialization is linear and handled separately. if (!shouldDifferentiateApplySite(ai) || isArrayLiteralIntrinsic(ai)) continue; + if (ArraySemanticsCall(ai, semantics::ARRAY_FINALIZE_INTRINSIC)) + continue; LLVM_DEBUG(getADDebugStream() << "Adding linear map struct field for " << *ai); addLinearMapToStruct(context, ai); diff --git a/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp b/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp index 5c9d3f8913000..0746e93d24075 100644 --- a/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp +++ b/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp @@ -1424,6 +1424,19 @@ void PullbackEmitter::visitApplyInst(ApplyInst *ai) { // special `store` and `copy_addr` support. if (isArrayLiteralIntrinsic(ai)) 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); @@ -1439,7 +1452,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. @@ -1478,7 +1490,6 @@ void PullbackEmitter::visitApplyInst(ApplyInst *ai) { } // Get formal callee pullback arguments. - auto *bb = ai->getParent(); assert(applyInfo.indices.results->getNumIndices() == 1); for (auto resultIndex : applyInfo.indices.results->getIndices()) { assert(resultIndex < origAllResults.size()); diff --git a/lib/SILOptimizer/Differentiation/VJPEmitter.cpp b/lib/SILOptimizer/Differentiation/VJPEmitter.cpp index e37aa1b1696e6..094690dcbbf1e 100644 --- a/lib/SILOptimizer/Differentiation/VJPEmitter.cpp +++ b/lib/SILOptimizer/Differentiation/VJPEmitter.cpp @@ -541,6 +541,15 @@ void VJPEmitter::visitApplyInst(ApplyInst *ai) { 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; + } // If the original function is a semantic member accessor, do standard // cloning. Semantic member accessors have special pullback generation logic, // so all `apply` instructions can be directly cloned to the VJP. From f96f9368b4d49dd1e1e6c953e66fc6d591bd6891 Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Thu, 4 Jun 2020 13:08:01 +0200 Subject: [PATCH 141/222] SIL: define begin_cow_mutation to have side effects. This fixes a correctness issue. The begin_cow_mutation instruction has dependencies with instructions which retain the buffer operand. This prevents optimizations from moving begin_cow_mutation instructions across such retain instructions. --- include/swift/SIL/SILNodes.def | 7 ++++++- lib/SILOptimizer/Analysis/MemoryBehavior.cpp | 9 ++++++++ test/SILOptimizer/licm.sil | 22 ++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) 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/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/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) From 1559fe333f57abb0368ac5f7ad2271a7088fe9a2 Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Mon, 25 May 2020 21:32:22 +0200 Subject: [PATCH 142/222] SIL: a new library intrinsic to "finalize" array literals For COW support in SIL it's required to "finalize" array literals. _finalizeUninitializedArray is a compiler known stdlib function which is called after all elements of an array literal are stored. This runtime function marks the array literal as finished. %uninitialized_result_tuple = apply %_allocateUninitializedArray(%count) %mutable_array = tuple_extract %uninitialized_result_tuple, 0 %elem_base_address = tuple_extract %uninitialized_result_tuple, 1 ... store %elem_0 to %elem_addr_0 store %elem_1 to %elem_addr_1 ... %final_array = apply %_finalizeUninitializedArray(%mutable_array) In this commit _finalizeUninitializedArray is still a no-op because the COW support is not used in the Array implementation yet. --- include/swift/AST/KnownDecls.def | 2 + lib/SIL/IR/SILModule.cpp | 4 + lib/SILGen/SILGenApply.cpp | 16 ++++ lib/SILGen/SILGenExpr.cpp | 9 ++- lib/SILGen/SILGenFunction.h | 1 + .../LoopTransforms/COWArrayOpt.cpp | 2 +- .../LoopTransforms/ForEachLoopUnroll.cpp | 11 ++- .../Mandatory/OSLogOptimization.cpp | 16 +++- lib/SILOptimizer/Utils/ConstExpr.cpp | 19 +++++ stdlib/public/core/ArrayShared.swift | 12 +++ .../SILOptimizer/activity_analysis.swift | 78 +++++++++++-------- test/IRGen/unmanaged_objc_throw_func.swift | 6 +- test/SILGen/arguments.swift | 4 + test/SILGen/errors.swift | 8 +- test/SILGen/keypaths.swift | 16 +++- test/SILGen/literals.swift | 44 ++++++++--- test/SILGen/objc_bridging_array.swift | 6 +- test/SILGen/scalar_to_tuple_args.swift | 8 +- test/SILOptimizer/OSLogMandatoryOptTest.sil | 12 ++- test/SILOptimizer/OSLogMandatoryOptTest.swift | 32 ++++++-- 20 files changed, 229 insertions(+), 77 deletions(-) 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/lib/SIL/IR/SILModule.cpp b/lib/SIL/IR/SILModule.cpp index 50aadb293da66..a25be897da990 100644 --- a/lib/SIL/IR/SILModule.cpp +++ b/lib/SIL/IR/SILModule.cpp @@ -355,6 +355,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 +406,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/SILGen/SILGenApply.cpp b/lib/SILGen/SILGenApply.cpp index e80d4f8da4d5e..1b18f834f8fcd 100644 --- a/lib/SILGen/SILGenApply.cpp +++ b/lib/SILGen/SILGenApply.cpp @@ -4962,6 +4962,22 @@ void SILGenFunction::emitUninitializedArrayDeallocation(SILLocation loc, SGFContext()); } +ManagedValue SILGenFunction::emitUninitializedArrayFinalization(SILLocation loc, + SILValue array) { + auto &Ctx = getASTContext(); + auto finalize = Ctx.getFinalizeUninitializedArray(); + + CanType arrayTy = array->getType().getASTType(); + + // Invoke the intrinsic. + auto subMap = arrayTy->getContextSubstitutionMap(SGM.M.getSwiftModule(), + Ctx.getArrayDecl()); + RValue result = emitApplyOfLibraryIntrinsic(loc, finalize, subMap, + ManagedValue::forUnmanaged(array), + SGFContext()); + return std::move(result).getScalarValue(); +} + namespace { /// A cleanup that deallocates an uninitialized array. class DeallocateUninitializedArray: public Cleanup { diff --git a/lib/SILGen/SILGenExpr.cpp b/lib/SILGen/SILGenExpr.cpp index 24ee39a453cdb..315fd254557b7 100644 --- a/lib/SILGen/SILGenExpr.cpp +++ b/lib/SILGen/SILGenExpr.cpp @@ -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, array.forward(SGF)); } RValue RValueEmitter::visitTupleExpr(TupleExpr *E, SGFContext C) { diff --git a/lib/SILGen/SILGenFunction.h b/lib/SILGen/SILGenFunction.h index ca922d32de6bf..4ab8b8cbbad40 100644 --- a/lib/SILGen/SILGenFunction.h +++ b/lib/SILGen/SILGenFunction.h @@ -1187,6 +1187,7 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction CleanupHandle enterDeallocateUninitializedArrayCleanup(SILValue array); void emitUninitializedArrayDeallocation(SILLocation loc, SILValue array); + ManagedValue emitUninitializedArrayFinalization(SILLocation loc, SILValue 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/SILOptimizer/LoopTransforms/COWArrayOpt.cpp b/lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp index fc4ca58f5659c..49b45f12e6346 100644 --- a/lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp +++ b/lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp @@ -642,7 +642,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 || 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/OSLogOptimization.cpp b/lib/SILOptimizer/Mandatory/OSLogOptimization.cpp index c543b72f8f79a..19cb23f37a377 100644 --- a/lib/SILOptimizer/Mandatory/OSLogOptimization.cpp +++ b/lib/SILOptimizer/Mandatory/OSLogOptimization.cpp @@ -539,6 +539,15 @@ static SILValue emitCodeForConstantArray(ArrayRef elements, module.findFunction(allocatorMangledName, SILLinkage::PublicExternal); assert(arrayAllocateFun); + FuncDecl *arrayFinalizeDecl = astContext.getFinalizeUninitializedArray(); + assert(arrayFinalizeDecl); + std::string finalizeMangledName = + SILDeclRef(arrayFinalizeDecl, SILDeclRef::Kind::Func).mangle(); + SILFunction *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,7 +605,12 @@ static SILValue emitCodeForConstantArray(ArrayRef elements, StoreOwnershipQualifier::Init); ++elementIndex; } - return arraySIL; + FunctionRefInst *arrayFinalizeRef = + builder.createFunctionRef(loc, arrayFinalizeFun); + ApplyInst *finalizedArray = builder.createApply( + loc, arrayFinalizeRef, subMap, ArrayRef(arraySIL)); + + return finalizedArray; } /// Given a SILValue \p value, return the instruction immediately following the 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/stdlib/public/core/ArrayShared.swift b/stdlib/public/core/ArrayShared.swift index 3e7d5939bac03..f05d54074b7d4 100644 --- a/stdlib/public/core/ArrayShared.swift +++ b/stdlib/public/core/ArrayShared.swift @@ -64,6 +64,18 @@ func _deallocateUninitializedArray( array._deallocateUninitialized() } +@_alwaysEmitIntoClient +@_semantics("array.finalize_intrinsic") +@_effects(readnone) +public // COMPILER_INTRINSIC +func _finalizeUninitializedArray( + _ array: __owned Array +) -> Array { + var mutableArray = array +// TODO: enable this once Array had an _endMutation function +// mutableArray._endMutation() + return mutableArray +} extension Collection { // Utility method for collections that wish to implement diff --git a/test/AutoDiff/SILOptimizer/activity_analysis.swift b/test/AutoDiff/SILOptimizer/activity_analysis.swift index 45420276a7374..8cd0341b6cea8 100644 --- a/test/AutoDiff/SILOptimizer/activity_analysis.swift +++ b/test/AutoDiff/SILOptimizer/activity_analysis.swift @@ -254,6 +254,8 @@ 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] { @@ -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 @@ -298,6 +302,8 @@ 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 @@ -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 @@ -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 { @@ -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 @@ -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 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/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..deb8bb9595970 100644 --- a/test/SILGen/errors.swift +++ b/test/SILGen/errors.swift @@ -639,10 +639,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 +673,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/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/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 From 3bfebf10f7182f60ddde3cc295a1e88bcd0486f8 Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Mon, 8 Jun 2020 15:00:12 +0200 Subject: [PATCH 143/222] runtime lib: a mechanism to set an "immutable" flag on an object for COW buffer runtime checking. In an assert built of the library, store an extra boolean flag (isImmutable) in the object side-buffer table. This flag can be set and get by the Array implementation to sanity check the immutability status of the buffer object. --- stdlib/public/SwiftShims/RefCount.h | 20 ++++++++++++++++++++ stdlib/public/core/Builtin.swift | 10 ++++++++++ stdlib/public/runtime/HeapObject.cpp | 17 +++++++++++++++++ stdlib/public/runtime/RefCount.cpp | 22 ++++++++++++++++++++++ 4 files changed, 69 insertions(+) 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/Builtin.swift b/stdlib/public/core/Builtin.swift index 8aceb9014df08..0141e3991cfac 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 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/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 From 71a642e51bad699776b32ae3357cc7e99af4715b Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Tue, 26 May 2020 18:00:58 +0200 Subject: [PATCH 144/222] stdlib, SIL optimizer: use the SIL copy-on-write representation in the Array types. Use the new builtins for COW representation in Array, ContiguousArray and ArraySlice. The basic idea is to strictly separate code which mutates an array buffer from code which reads from an array. The concept is explained in more detail in docs/SIL.rst, section "Copy-on-Write Representation". The main change is to use beginCOWMutation() instead of isUniquelyReferenced() and insert endCOWMutation() at the end of all mutating functions. Also, reading from the array buffer must be done differently, depending on if the buffer is in a mutable or immutable state. All the required invariants are enforced by runtime checks - but only in an assert-build of the library: a bit in the buffer object side-table indicates if the buffer is mutable or not. Along with the library changes, also two optimizations needed to be updated: COWArrayOpt and ObjectOutliner. --- lib/SILOptimizer/LoopTransforms/ArrayOpt.h | 12 +- .../LoopTransforms/COWArrayOpt.cpp | 84 ++-- .../Transforms/ObjectOutliner.cpp | 159 ++++--- stdlib/public/core/Array.swift | 133 +++--- stdlib/public/core/ArrayBuffer.swift | 130 +++++- stdlib/public/core/ArrayShared.swift | 3 +- stdlib/public/core/ArraySlice.swift | 66 +-- stdlib/public/core/BridgeStorage.swift | 20 + stdlib/public/core/Builtin.swift | 7 + stdlib/public/core/ContiguousArray.swift | 126 +++-- .../public/core/ContiguousArrayBuffer.swift | 227 ++++++++- stdlib/public/core/SliceBuffer.swift | 57 ++- test/IRGen/big_types_corner_cases.swift | 4 +- test/IRGen/newtype.swift | 36 +- test/SILOptimizer/cowarray_opt.sil | 430 +++++++++++------- test/SILOptimizer/globalopt-iter.sil | 5 +- test/SILOptimizer/objectoutliner.sil | 59 ++- test/SILOptimizer/pointer_conversion.swift | 25 +- .../stack_promotion_escaping.swift | 1 + 19 files changed, 1105 insertions(+), 479 deletions(-) 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 49b45f12e6346..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) { @@ -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/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/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 f05d54074b7d4..28c1d25696c55 100644 --- a/stdlib/public/core/ArrayShared.swift +++ b/stdlib/public/core/ArrayShared.swift @@ -72,8 +72,7 @@ func _finalizeUninitializedArray( _ array: __owned Array ) -> Array { var mutableArray = array -// TODO: enable this once Array had an _endMutation function -// mutableArray._endMutation() + mutableArray._endMutation() return mutableArray } 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 0141e3991cfac..e3e472cd299ff 100644 --- a/stdlib/public/core/Builtin.swift +++ b/stdlib/public/core/Builtin.swift @@ -693,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/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..4b6ac4a5ee6fc 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,8 +408,84 @@ 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 { + if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) { + return capacity == 0 || _swift_isImmutableCOWBuffer(_storage) + } + return true + } + nonmutating set { + 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") + } + } + } + } + + @_alwaysEmitIntoClient + internal var isMutable: Bool { + if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) { + return !_swift_isImmutableCOWBuffer(_storage) + } + return true } +#endif /// Get or set the value of the ith element. @inlinable @@ -424,6 +509,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 +522,97 @@ internal struct _ContiguousArrayBuffer: _ArrayBufferProtocol { _internalInvariant(newValue >= 0) _internalInvariant( - newValue <= capacity, + newValue <= mutableCapacity, "Can't grow an array buffer past its capacity") - _storage.countAndCapacity.count = newValue + 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") + + 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 +648,7 @@ internal struct _ContiguousArrayBuffer: _ArrayBufferProtocol { get { return _SliceBuffer( owner: _storage, - subscriptBaseAddress: subscriptBaseAddress, + subscriptBaseAddress: firstElementAddress, indices: bounds, hasNativeBuffer: true) } @@ -503,14 +659,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 +741,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 +866,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 +967,7 @@ internal func _copyCollectionToContiguousArray< return ContiguousArray() } - let result = _ContiguousArrayBuffer( + var result = _ContiguousArrayBuffer( _uninitializedCount: count, minimumCapacity: 0) @@ -796,6 +984,7 @@ internal func _copyCollectionToContiguousArray< _precondition(end == p.endIndex, "invalid Collection: less than 'count' elements in collection") + result.endCOWMutation() return ContiguousArray(_buffer: result) } @@ -847,7 +1036,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 +1064,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 +1088,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/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/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/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/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/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/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/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 {} From f822296cb2f10bd2ae1f7c9dfed36a65a1b53ddb Mon Sep 17 00:00:00 2001 From: Ashley Garland Date: Mon, 8 Jun 2020 10:36:06 -0700 Subject: [PATCH 145/222] [SymbolGraph] Use fully qualified name for type's page titles rdar://64047985 --- lib/SymbolGraphGen/Symbol.cpp | 18 ++++++++++++++++-- test/SymbolGraph/Symbols/Names.swift | 24 +++++++++++++++++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) 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/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" From 5ce546636e3362c00c3fd8e2fc8a7e89eab23d9a Mon Sep 17 00:00:00 2001 From: Nate Chandler Date: Mon, 8 Jun 2020 10:49:39 -0700 Subject: [PATCH 146/222] [metadata prespecialization] NFC: Replaced bool with enum. Previously a bool argument was passed to isCanonicalSpecializedNominalTypeMetadataStaticallyAddressable to indicate whether the metadata was to be used only from a specialized metadata accessor. Here, that bool is replaced with an enum. --- lib/IRGen/MetadataRequest.cpp | 12 ++++++------ lib/IRGen/MetadataRequest.h | 9 +++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/IRGen/MetadataRequest.cpp b/lib/IRGen/MetadataRequest.cpp index 28060ae9313ec..f625f7f5a4489 100644 --- a/lib/IRGen/MetadataRequest.cpp +++ b/lib/IRGen/MetadataRequest.cpp @@ -671,7 +671,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( @@ -698,7 +698,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()) { @@ -787,7 +787,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. @@ -820,7 +820,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 @@ -840,7 +840,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; @@ -922,7 +922,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; 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); From f0711367b5b3168ea99b8e30c9eb5c9190a3d664 Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Mon, 8 Jun 2020 20:27:37 +0200 Subject: [PATCH 147/222] stdlib: temporarily disable COW support runtime checks. Some lldb tests are failing with that. --- stdlib/public/core/ContiguousArrayBuffer.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/stdlib/public/core/ContiguousArrayBuffer.swift b/stdlib/public/core/ContiguousArrayBuffer.swift index 4b6ac4a5ee6fc..0519e44821b95 100644 --- a/stdlib/public/core/ContiguousArrayBuffer.swift +++ b/stdlib/public/core/ContiguousArrayBuffer.swift @@ -454,12 +454,18 @@ internal struct _ContiguousArrayBuffer: _ArrayBufferProtocol { @_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 { @@ -475,14 +481,17 @@ internal struct _ContiguousArrayBuffer: _ArrayBufferProtocol { "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 From 5d72c464ebbcaf5159843967b7bad10bb1c797ee Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Mon, 8 Jun 2020 12:44:13 -0700 Subject: [PATCH 148/222] [Frontend] Remove parsing option params from performParseOnly Lift the `DisablePoundIfEvaluation` parsing option into `LangOptions` to subsume the need for the `EvaluateConditionals` parameter, and sink the computation of `CanDelayBodies` down into `createSourceFileForMainModule`. --- include/swift/AST/SourceFile.h | 2 +- include/swift/Basic/LangOptions.h | 4 ++ include/swift/Frontend/Frontend.h | 9 ++-- lib/AST/Module.cpp | 2 + lib/Frontend/Frontend.cpp | 41 +++++++++++-------- lib/FrontendTool/FrontendTool.cpp | 9 +--- lib/IDE/Refactoring.cpp | 1 + .../lib/SwiftLang/SwiftDocSupport.cpp | 3 +- .../lib/SwiftLang/SwiftEditorInterfaceGen.cpp | 1 + tools/swift-ide-test/swift-ide-test.cpp | 3 ++ tools/swift-refactor/swift-refactor.cpp | 2 +- tools/swift-syntax-test/swift-syntax-test.cpp | 3 ++ 12 files changed, 47 insertions(+), 33 deletions(-) diff --git a/include/swift/AST/SourceFile.h b/include/swift/AST/SourceFile.h index 7a799659bb182..fe3d500d6dc49 100644 --- a/include/swift/AST/SourceFile.h +++ b/include/swift/AST/SourceFile.h @@ -105,7 +105,7 @@ 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. diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h index b3f6bb2047259..33b835b419cda 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 diff --git a/include/swift/Frontend/Frontend.h b/include/swift/Frontend/Frontend.h index c955bb3061eaf..fd350e289eb37 100644 --- a/include/swift/Frontend/Frontend.h +++ b/include/swift/Frontend/Frontend.h @@ -616,8 +616,7 @@ class CompilerInstance { void performSema(); /// Parses the input file but does no type-checking or module imports. - void performParseOnly(bool EvaluateConditionals = false, - bool CanDelayBodies = true); + void performParseOnly(); /// Parses and performs import resolution on all input files. /// @@ -633,8 +632,7 @@ class CompilerInstance { private: SourceFile * createSourceFileForMainModule(SourceFileKind FileKind, - Optional BufferID, - SourceFile::ParsingOptions options = {}); + Optional BufferID); public: void freeASTContext(); @@ -647,8 +645,7 @@ class CompilerInstance { /// Retrieve a description of which modules should be implicitly imported. ImplicitImportInfo getImplicitImportInfo() const; - void performSemaUpTo(SourceFile::ASTStage_t LimitStage, - SourceFile::ParsingOptions POpts = {}); + void performSemaUpTo(SourceFile::ASTStage_t LimitStage); /// Return true if had load error bool loadPartialModulesAndImplicitImports(); diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp index fc6a7af0409cd..50899d20013c5 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -2233,6 +2233,8 @@ SourceFile::SourceFile(ModuleDecl &M, SourceFileKind K, SourceFile::ParsingOptions SourceFile::getDefaultParsingOptions(const LangOptions &langOpts) { ParsingOptions opts; + if (langOpts.DisablePoundIfEvaluation) + opts |= ParsingFlags::DisablePoundIfEvaluation; if (langOpts.BuildSyntaxTree) opts |= ParsingFlags::BuildSyntaxTree; if (langOpts.CollectParsedToken) diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index bb894fac38b89..45f629b22330e 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -729,20 +729,14 @@ void CompilerInstance::setMainModule(ModuleDecl *newMod) { Context->LoadedModules[newMod->getName()] = newMod; } -void CompilerInstance::performParseOnly(bool EvaluateConditionals, - bool CanDelayBodies) { +void CompilerInstance::performParseOnly() { 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); + performSemaUpTo(SourceFile::Unprocessed); assert(Context->LoadedModules.size() == 1 && "Loaded a module during parse-only"); } @@ -755,8 +749,7 @@ void CompilerInstance::performSema() { performSemaUpTo(SourceFile::TypeChecked); } -void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage, - SourceFile::ParsingOptions POpts) { +void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) { FrontendStatsTracer tracer(getStatsReporter(), "perform-sema"); ModuleDecl *mainModule = getMainModule(); @@ -765,7 +758,7 @@ void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage, // 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); + Invocation.getSourceFileKind(), MainBufferID); mainFile->SyntaxParsingCache = Invocation.getMainFileSyntaxParsingCache(); } @@ -789,8 +782,7 @@ void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage, SF = &getMainModule()->getMainSourceFile(Invocation.getSourceFileKind()); } else { // Otherwise create a library file. - SF = createSourceFileForMainModule(SourceFileKind::Library, - BufferID, POpts); + SF = createSourceFileForMainModule(SourceFileKind::Library, BufferID); } // Trigger parsing of the file. if (LimitStage == SourceFile::Unprocessed) { @@ -898,10 +890,28 @@ void CompilerInstance::finishTypeChecking() { } SourceFile *CompilerInstance::createSourceFileForMainModule( - SourceFileKind fileKind, Optional bufferID, - SourceFile::ParsingOptions opts) { + SourceFileKind fileKind, Optional bufferID) { ModuleDecl *mainModule = getMainModule(); + 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; + } + + // 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; + } + auto isPrimary = bufferID && isPrimaryInput(*bufferID); if (isPrimary || isWholeModuleCompilation()) { // Disable delayed body parsing for primaries. @@ -917,7 +927,6 @@ SourceFile *CompilerInstance::createSourceFileForMainModule( if (isPrimary) { opts |= SourceFile::ParsingFlags::EnableInterfaceHash; } - opts |= SourceFile::getDefaultParsingOptions(getASTContext().LangOpts); auto *inputFile = new (*Context) SourceFile(*mainModule, fileKind, bufferID, opts, isPrimary); diff --git a/lib/FrontendTool/FrontendTool.cpp b/lib/FrontendTool/FrontendTool.cpp index c99dcc281f61c..9fa0cc5ae92e8 100644 --- a/lib/FrontendTool/FrontendTool.cpp +++ b/lib/FrontendTool/FrontendTool.cpp @@ -1274,14 +1274,7 @@ static bool performCompile(CompilerInstance &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); + Instance.performParseOnly(); } else if (Action == FrontendOptions::ActionType::ResolveImports) { Instance.performParseAndResolveImportsOnly(); } else { diff --git a/lib/IDE/Refactoring.cpp b/lib/IDE/Refactoring.cpp index 93730a756af2e..704e8d4d9ffc2 100644 --- a/lib/IDE/Refactoring.cpp +++ b/lib/IDE/Refactoring.cpp @@ -1174,6 +1174,7 @@ 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)) diff --git a/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp b/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp index e9749ad813e70..0d569e6bf6f2a 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp @@ -808,6 +808,7 @@ 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, ""); @@ -1406,7 +1407,7 @@ SourceFile *SwiftLangSupport::getSyntacticSourceFile( Error = "Compiler invocation set up failed"; return nullptr; } - ParseCI.performParseOnly(/*EvaluateConditionals*/true); + ParseCI.performParseOnly(); SourceFile *SF = nullptr; unsigned BufferID = ParseCI.getInputBufferIDs().back(); diff --git a/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp b/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp index 1e9a578011da1..022c89104b30f 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp @@ -234,6 +234,7 @@ 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, ""); diff --git a/tools/swift-ide-test/swift-ide-test.cpp b/tools/swift-ide-test/swift-ide-test.cpp index ca09cded78cf4..ebd914945c8de 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. diff --git a/tools/swift-refactor/swift-refactor.cpp b/tools/swift-refactor/swift-refactor.cpp index 2bc77c2b7d684..8c0207ec142f8 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); + CI.performParseOnly(); 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..9a4df84d9ad25 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( From 00dd637acc19d24152834e062e783961cbc3f1a7 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Mon, 8 Jun 2020 12:44:14 -0700 Subject: [PATCH 149/222] [Frontend] Factor out getSourceFileParsingOptions --- include/swift/Frontend/Frontend.h | 5 ++++- lib/Frontend/Frontend.cpp | 22 ++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/include/swift/Frontend/Frontend.h b/include/swift/Frontend/Frontend.h index fd350e289eb37..d5bf674576e3c 100644 --- a/include/swift/Frontend/Frontend.h +++ b/include/swift/Frontend/Frontend.h @@ -460,7 +460,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. @@ -642,6 +642,9 @@ 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; diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index 45f629b22330e..e7b386d7969ee 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -889,10 +889,8 @@ void CompilerInstance::finishTypeChecking() { }); } -SourceFile *CompilerInstance::createSourceFileForMainModule( - SourceFileKind fileKind, Optional bufferID) { - ModuleDecl *mainModule = getMainModule(); - +SourceFile::ParsingOptions +CompilerInstance::getSourceFileParsingOptions(bool forPrimary) const { const auto &frontendOpts = Invocation.getFrontendOptions(); const auto action = frontendOpts.RequestedAction; @@ -912,9 +910,8 @@ SourceFile *CompilerInstance::createSourceFileForMainModule( opts |= SourceFile::ParsingFlags::DisableDelayedBodies; } - auto isPrimary = bufferID && isPrimaryInput(*bufferID); - if (isPrimary || isWholeModuleCompilation()) { - // Disable delayed body parsing for primaries. + 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 @@ -924,9 +921,18 @@ SourceFile *CompilerInstance::createSourceFileForMainModule( // Enable interface hash computation for primaries, but not in WMO, as it's // only currently needed for incremental mode. - if (isPrimary) { + if (forPrimary) { opts |= SourceFile::ParsingFlags::EnableInterfaceHash; } + return opts; +} + +SourceFile *CompilerInstance::createSourceFileForMainModule( + SourceFileKind fileKind, Optional bufferID) { + ModuleDecl *mainModule = getMainModule(); + + auto isPrimary = bufferID && isPrimaryInput(*bufferID); + auto opts = getSourceFileParsingOptions(isPrimary); auto *inputFile = new (*Context) SourceFile(*mainModule, fileKind, bufferID, opts, isPrimary); From ff170df10c05baeb95d3584047dc66a9adfebe12 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Mon, 8 Jun 2020 12:44:14 -0700 Subject: [PATCH 150/222] [Frontend] Populate files in getMainModule Rather than waiting until one of the performXXX methods are called, make sure all the main module's files have been populated up-front by `getMainModule`. --- include/swift/Frontend/Frontend.h | 24 +++++-- lib/Frontend/Frontend.cpp | 111 ++++++++++++++++++------------ 2 files changed, 85 insertions(+), 50 deletions(-) diff --git a/include/swift/Frontend/Frontend.h b/include/swift/Frontend/Frontend.h index d5bf674576e3c..d987680bdba52 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; @@ -630,9 +631,15 @@ class CompilerInstance { bool performSILProcessing(SILModule *silModule); private: - SourceFile * - createSourceFileForMainModule(SourceFileKind FileKind, - Optional BufferID); + /// 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(); @@ -650,8 +657,11 @@ class CompilerInstance { void performSemaUpTo(SourceFile::ASTStage_t LimitStage); - /// 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/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index e7b386d7969ee..527090f6ed8bb 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; } @@ -753,37 +800,13 @@ void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) { 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); - 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; - } // 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); - } + for (auto *file : mainModule->getFiles()) { + auto *SF = dyn_cast(file); + if (!SF) + continue; + // Trigger parsing of the file. if (LimitStage == SourceFile::Unprocessed) { (void)SF->getTopLevelDecls(); @@ -795,15 +818,15 @@ void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) { 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) @@ -839,26 +862,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; } @@ -869,7 +893,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; @@ -928,15 +952,16 @@ CompilerInstance::getSourceFileParsingOptions(bool forPrimary) const { } SourceFile *CompilerInstance::createSourceFileForMainModule( - SourceFileKind fileKind, Optional bufferID) { - ModuleDecl *mainModule = getMainModule(); - + ModuleDecl *mod, SourceFileKind fileKind, + Optional bufferID) const { auto isPrimary = bufferID && isPrimaryInput(*bufferID); auto opts = getSourceFileParsingOptions(isPrimary); auto *inputFile = new (*Context) - SourceFile(*mainModule, fileKind, bufferID, opts, isPrimary); - MainModule->addFile(*inputFile); + SourceFile(*mod, fileKind, bufferID, opts, isPrimary); + + if (bufferID == MainBufferID) + inputFile->SyntaxParsingCache = Invocation.getMainFileSyntaxParsingCache(); return inputFile; } From 7824dc10489dc8ca82580e7ac92c3582b14882d8 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Mon, 8 Jun 2020 12:44:15 -0700 Subject: [PATCH 151/222] [Frontend] Move parse-only module load assert Move into `performEndOfPipelineActions`, and move the call up a bit in `performCompile` to make sure it gets called even for a parse-only invocation. Unfortunately this requires carving out an exception for `-emit-imported-modules`, which can load modules. --- lib/Frontend/Frontend.cpp | 2 -- lib/FrontendTool/FrontendTool.cpp | 27 +++++++++++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index 527090f6ed8bb..b8ac4398d2275 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -784,8 +784,6 @@ void CompilerInstance::performParseOnly() { (void)Kind; performSemaUpTo(SourceFile::Unprocessed); - assert(Context->LoadedModules.size() == 1 && - "Loaded a module during parse-only"); } void CompilerInstance::performParseAndResolveImportsOnly() { diff --git a/lib/FrontendTool/FrontendTool.cpp b/lib/FrontendTool/FrontendTool.cpp index 9fa0cc5ae92e8..4d1eb187c0fca 100644 --- a/lib/FrontendTool/FrontendTool.cpp +++ b/lib/FrontendTool/FrontendTool.cpp @@ -1226,9 +1226,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); @@ -1273,6 +1284,13 @@ 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)) { Instance.performParseOnly(); } else if (Action == FrontendOptions::ActionType::ResolveImports) { @@ -1330,13 +1348,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; From 1ed810653c48579ebd2f1d519951299df088f739 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Mon, 8 Jun 2020 12:44:15 -0700 Subject: [PATCH 152/222] [Frontend] Remove performParseOnly Most clients were only using it to populate the main module with files, which is now done by `getMainModule`. Instead, they can now just rely on parsing happening lazily. --- include/swift/AST/SourceFile.h | 2 +- include/swift/Frontend/Frontend.h | 3 -- lib/AST/ASTDumper.cpp | 8 +++++- lib/Frontend/Frontend.cpp | 10 ------- lib/FrontendTool/FrontendTool.cpp | 28 +++++++++++++------ lib/IDE/Refactoring.cpp | 2 -- .../lib/SwiftLang/SwiftDocSupport.cpp | 6 +--- .../lib/SwiftLang/SwiftEditorInterfaceGen.cpp | 5 +--- tools/swift-ide-test/swift-ide-test.cpp | 4 +-- tools/swift-refactor/swift-refactor.cpp | 2 +- tools/swift-syntax-test/swift-syntax-test.cpp | 6 ++-- 11 files changed, 34 insertions(+), 42 deletions(-) diff --git a/include/swift/AST/SourceFile.h b/include/swift/AST/SourceFile.h index fe3d500d6dc49..ca305f8675db8 100644 --- a/include/swift/AST/SourceFile.h +++ b/include/swift/AST/SourceFile.h @@ -490,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. /// diff --git a/include/swift/Frontend/Frontend.h b/include/swift/Frontend/Frontend.h index d987680bdba52..15b834723207c 100644 --- a/include/swift/Frontend/Frontend.h +++ b/include/swift/Frontend/Frontend.h @@ -616,9 +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(); - /// Parses and performs import resolution on all input files. /// /// This is similar to a parse-only invocation, but module imports will also diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index cd7c1b627e887..6335fdaa499bb 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -1420,7 +1420,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'; } diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index b8ac4398d2275..b405dbc774bd0 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -776,16 +776,6 @@ void CompilerInstance::setMainModule(ModuleDecl *newMod) { Context->LoadedModules[newMod->getName()] = newMod; } -void CompilerInstance::performParseOnly() { - const InputFileKind Kind = Invocation.getInputKind(); - assert((Kind == InputFileKind::Swift || Kind == InputFileKind::SwiftLibrary || - Kind == InputFileKind::SwiftModuleInterface) && - "only supports parsing .swift files"); - (void)Kind; - - performSemaUpTo(SourceFile::Unprocessed); -} - void CompilerInstance::performParseAndResolveImportsOnly() { performSemaUpTo(SourceFile::ImportsResolved); } diff --git a/lib/FrontendTool/FrontendTool.cpp b/lib/FrontendTool/FrontendTool.cpp index 4d1eb187c0fca..2c327d1ec57cb 100644 --- a/lib/FrontendTool/FrontendTool.cpp +++ b/lib/FrontendTool/FrontendTool.cpp @@ -510,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; @@ -884,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); } } @@ -1292,7 +1288,14 @@ static bool performCompile(CompilerInstance &Instance, }; if (FrontendOptions::shouldActionOnlyParse(Action)) { - Instance.performParseOnly(); + // 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 { @@ -1300,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); diff --git a/lib/IDE/Refactoring.cpp b/lib/IDE/Refactoring.cpp index 704e8d4d9ffc2..3445ab78ecfc5 100644 --- a/lib/IDE/Refactoring.cpp +++ b/lib/IDE/Refactoring.cpp @@ -1180,8 +1180,6 @@ getNotableRegions(StringRef SourceText, unsigned NameOffset, StringRef Name, 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); diff --git a/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp b/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp index 0d569e6bf6f2a..41e588a3e0695 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp @@ -814,10 +814,7 @@ static bool makeParserAST(CompilerInstance &CI, StringRef Text, 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, @@ -1407,7 +1404,6 @@ SourceFile *SwiftLangSupport::getSyntacticSourceFile( Error = "Compiler invocation set up failed"; return nullptr; } - ParseCI.performParseOnly(); SourceFile *SF = nullptr; unsigned BufferID = ParseCI.getInputBufferIDs().back(); diff --git a/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp b/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp index 022c89104b30f..bcbe8d7241599 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp @@ -240,10 +240,7 @@ static bool makeParserAST(CompilerInstance &CI, StringRef Text, 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/swift-ide-test/swift-ide-test.cpp b/tools/swift-ide-test/swift-ide-test.cpp index ebd914945c8de..a0401c1581dc1 100644 --- a/tools/swift-ide-test/swift-ide-test.cpp +++ b/tools/swift-ide-test/swift-ide-test.cpp @@ -1727,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()) { diff --git a/tools/swift-refactor/swift-refactor.cpp b/tools/swift-refactor/swift-refactor.cpp index 8c0207ec142f8..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(); + // 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 9a4df84d9ad25..c492162111927 100644 --- a/tools/swift-syntax-test/swift-syntax-test.cpp +++ b/tools/swift-syntax-test/swift-syntax-test.cpp @@ -636,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); @@ -648,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; From 55cf78b022637f1bb302a6601c5284205a928d22 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Mon, 8 Jun 2020 12:44:15 -0700 Subject: [PATCH 153/222] [Frontend] Inline performSemaUpTo Now that it no longer needs to handle the parse-only case, we can simplify things by having `performSema` call into `performParseAndResolveImportsOnly`. --- include/swift/Frontend/Frontend.h | 2 -- lib/Frontend/Frontend.cpp | 36 ++++++++----------------------- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/include/swift/Frontend/Frontend.h b/include/swift/Frontend/Frontend.h index 15b834723207c..f8cad378fc6ae 100644 --- a/include/swift/Frontend/Frontend.h +++ b/include/swift/Frontend/Frontend.h @@ -652,8 +652,6 @@ class CompilerInstance { /// Retrieve a description of which modules should be implicitly imported. ImplicitImportInfo getImplicitImportInfo() const; - void performSemaUpTo(SourceFile::ASTStage_t LimitStage); - /// 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. diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index b405dbc774bd0..059ef75e72ae4 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -777,35 +777,15 @@ void CompilerInstance::setMainModule(ModuleDecl *newMod) { } void CompilerInstance::performParseAndResolveImportsOnly() { - performSemaUpTo(SourceFile::ImportsResolved); -} - -void CompilerInstance::performSema() { - performSemaUpTo(SourceFile::TypeChecked); -} - -void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) { - FrontendStatsTracer tracer(getStatsReporter(), "perform-sema"); - - ModuleDecl *mainModule = getMainModule(); + FrontendStatsTracer tracer(getStatsReporter(), "parse-and-resolve-imports"); - // Then parse all the input files. + // Resolve imports for all the source files. + auto *mainModule = getMainModule(); for (auto *file : mainModule->getFiles()) { - auto *SF = dyn_cast(file); - if (!SF) - continue; - - // Trigger parsing of the file. - if (LimitStage == SourceFile::Unprocessed) { - (void)SF->getTopLevelDecls(); - } else { + if (auto *SF = dyn_cast(file)) performImportResolution(*SF); - } } - if (LimitStage == SourceFile::Unprocessed) - return; - assert(llvm::all_of(mainModule->getFiles(), [](const FileUnit *File) -> bool { auto *SF = dyn_cast(File); if (!SF) @@ -815,10 +795,12 @@ void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) { mainModule->setHasResolvedImports(); 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); From 580bf4d2c905fe99cca9fcc794c16ee3a7bc5bc2 Mon Sep 17 00:00:00 2001 From: Ashley Garland Date: Mon, 8 Jun 2020 12:51:10 -0700 Subject: [PATCH 154/222] [SymbolGraph] Don't add precise identifier to `Self` fragment So that these identifiers aren't turned into links. rdar://63941806 --- .../DeclarationFragmentPrinter.cpp | 7 ++- .../DeclarationFragments/SelfNotLinked.swift | 47 +++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 test/SymbolGraph/Symbols/Mixins/DeclarationFragments/SelfNotLinked.swift 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/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: ], From 8effe4984e01bc8837e84183b9cb47c9011df333 Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Sat, 6 Jun 2020 01:15:11 -0700 Subject: [PATCH 155/222] [build-script] Add a really simple build scheduler that assumes/enforces a DAG build graph. Some notes: * I am purposely trying to not do something too crazy here. My hope is that this can tied us over until we can remove a bunch of build-script logic (after build-script-impl is destroyed). * Given this need for simplicity, I purposely did something really simple: I assumed the build-graph was a DAG. This makes it really easy to compute a topological ordering just by computing RPOT numbers from POT numbers. That is what I did in this implementation. I haven't wired it up to anything and just added a simple test that shows how it can properly infer from a toy dependency tree the dependencies of a "toy swiftpm" project. --- .../swift_build_support/build_graph.py | 164 ++++++++++++++++++ .../tests/test_build_graph.py | 59 +++++++ 2 files changed, 223 insertions(+) create mode 100644 utils/swift_build_support/swift_build_support/build_graph.py create mode 100644 utils/swift_build_support/tests/test_build_graph.py 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/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) From 363bd5d26ec3d58c364354be570ba947633f7488 Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Mon, 8 Jun 2020 13:01:55 -0700 Subject: [PATCH 156/222] [build-script] Fix import of dependencies of each product. While actually wiring this up, I discovered that I imported these products incorrectly. Should be NFC. --- .../products/benchmarks.py | 33 ++++++++++------ .../products/foundation.py | 21 ++++++---- .../products/indexstoredb.py | 36 +++++++++++------ .../swift_build_support/products/libcxx.py | 6 ++- .../products/libdispatch.py | 18 ++++++--- .../swift_build_support/products/libicu.py | 9 +++-- .../swift_build_support/products/llbuild.py | 27 ++++++++----- .../swift_build_support/products/lldb.py | 15 ++++--- .../swift_build_support/products/llvm.py | 3 +- .../products/playgroundsupport.py | 33 ++++++++++------ .../swift_build_support/products/pythonkit.py | 33 ++++++++++------ .../products/skstresstester.py | 36 +++++++++++------ .../products/sourcekitlsp.py | 33 ++++++++++------ .../swift_build_support/products/swift.py | 12 ++++-- .../products/swiftevolve.py | 39 ++++++++++++------- .../products/swiftinspect.py | 33 ++++++++++------ .../swift_build_support/products/swiftpm.py | 30 +++++++++----- .../products/swiftsyntax.py | 33 ++++++++++------ .../products/tensorflow.py | 33 ++++++++++------ .../products/tsan_libdispatch.py | 33 ++++++++++------ .../swift_build_support/products/xctest.py | 24 ++++++++---- 21 files changed, 359 insertions(+), 181 deletions(-) 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 de1cfa4cb37ff..fe42367c15215 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,18 @@ import os import platform +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 @@ -59,17 +70,17 @@ def install(self, host_target): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest, - product.LLBuild, - product.SwiftPM] + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + lldb.LLDB, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM] def run_build_script_helper(host_target, product, args): 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 d8fbe50063f19..e90c919726dc7 100644 --- a/utils/swift_build_support/swift_build_support/products/foundation.py +++ b/utils/swift_build_support/swift_build_support/products/foundation.py @@ -10,7 +10,14 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import libcxx +from . import libdispatch +from . import libicu +from . import lldb +from . import llvm from . import product +from . import swift class Foundation(product.Product): @@ -32,10 +39,10 @@ def product_source_name(cls): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch] + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + lldb.LLDB, + libdispatch.LibDispatch] 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 1e2021a6f5f82..18f8371a2aba6 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,19 @@ import os +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 swiftsyntax +from . import xctest from .. import shell from .. import targets @@ -47,18 +59,18 @@ def install(self, host_target): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest, - product.LLBuild, - product.SwiftPM, - product.SwiftSyntax] + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + lldb.LLDB, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM, + swiftsyntax.SwiftSyntax] def run_build_script_helper(action, host_target, product, args, 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 ea33794edb3a0..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,6 +10,8 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import llvm from . import product @@ -24,5 +26,5 @@ def is_build_script_impl_product(cls): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM] + 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 42fb77592b9cc..a6bc49ae67bdf 100644 --- a/utils/swift_build_support/swift_build_support/products/libdispatch.py +++ b/utils/swift_build_support/swift_build_support/products/libdispatch.py @@ -10,7 +10,13 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import libcxx +from . import libicu +from . import lldb +from . import llvm from . import product +from . import swift class LibDispatch(product.Product): @@ -32,9 +38,9 @@ def product_source_name(cls): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB] + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + lldb.LLDB] 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 0aedfb538159b..2aaaada676fb6 100644 --- a/utils/swift_build_support/swift_build_support/products/libicu.py +++ b/utils/swift_build_support/swift_build_support/products/libicu.py @@ -10,6 +10,9 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import libcxx +from . import llvm from . import product @@ -32,6 +35,6 @@ def product_source_name(cls): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX] + 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 dd9e5c3348af1..35759f4b45a82 100644 --- a/utils/swift_build_support/swift_build_support/products/llbuild.py +++ b/utils/swift_build_support/swift_build_support/products/llbuild.py @@ -10,7 +10,16 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import lldb +from . import llvm from . import product +from . import swift +from . import xctest class LLBuild(product.Product): @@ -24,12 +33,12 @@ def is_build_script_impl_product(cls): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest] + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + lldb.LLDB, + 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 4ba9f14b1c26c..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,7 +10,12 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import libcxx +from . import libicu +from . import llvm from . import product +from . import swift class LLDB(product.Product): @@ -24,8 +29,8 @@ def is_build_script_impl_product(cls): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift] + 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 a9a623ee2a4df..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 @@ -68,4 +69,4 @@ def _version_flags(self): @classmethod def get_dependencies(cls): - return [product.CMark] + 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 8d930a2f656ab..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 @@ -113,14 +124,14 @@ def install(self, host_target): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest, - product.LLBuild, - product.SwiftPM] + 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/pythonkit.py b/utils/swift_build_support/swift_build_support/products/pythonkit.py index 7eb5d6684ce64..cae6d4b1969c3 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,18 @@ import os +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 @@ -82,14 +93,14 @@ def install(self, host_target): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest, - product.LLBuild, - product.SwiftPM] + 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/skstresstester.py b/utils/swift_build_support/swift_build_support/products/skstresstester.py index 781300a76dabc..5ef366b9fed59 100644 --- a/utils/swift_build_support/swift_build_support/products/skstresstester.py +++ b/utils/swift_build_support/swift_build_support/products/skstresstester.py @@ -15,7 +15,19 @@ 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 lldb +from . import llvm from . import product +from . import swift +from . import swiftpm +from . import swiftsyntax +from . import xctest from .. import shell @@ -92,15 +104,15 @@ def install(self, host_target): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest, - product.LLBuild, - product.SwiftPM, - product.SwiftSyntax] + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + lldb.LLDB, + 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 9a7c36868b67a..2ea8873c49d81 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,19 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import foundation from . import indexstoredb +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 class SourceKitLSP(product.Product): @@ -47,14 +58,14 @@ def install(self, host_target): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest, - product.LLBuild, - product.SwiftPM] + 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/swift.py b/utils/swift_build_support/swift_build_support/products/swift.py index c8319340a215b..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 @@ -132,7 +136,7 @@ def _enable_experimental_differentiable_programming(self): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU] + 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 91697856e1d79..7eb6a511a09b7 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftevolve.py +++ b/utils/swift_build_support/swift_build_support/products/swiftevolve.py @@ -10,8 +10,19 @@ # # ---------------------------------------------------------------------------- -from . import product +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 skstresstester +from . import swift +from . import swiftpm +from . import swiftsyntax +from . import xctest class SwiftEvolve(skstresstester.SKStressTester): @@ -39,16 +50,16 @@ def should_install(self, host_target): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest, - product.LLBuild, - product.SwiftPM, - product.SwiftSyntax, - product.SKStressTester] + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + lldb.LLDB, + 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 afacf1fbeb8f5..099e5fb50f349 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,18 @@ import os import platform +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 @@ -51,17 +62,17 @@ def install(self, host_target): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest, - product.LLBuild, - product.SwiftPM] + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + lldb.LLDB, + libdispatch.LibDispatch, + foundation.Foundation, + xctest.XCTest, + llbuild.LLBuild, + swiftpm.SwiftPM] def run_build_script_helper(host_target, product, args): 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 cdcb28e19bda5..2d0d652282d79 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,17 @@ import os +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 xctest from .. import shell @@ -96,13 +106,13 @@ def install(self, host_target): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest, - product.LLBuild] + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + lldb.LLDB, + 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 59ddae12e4744..8c2d3ccc04522 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,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 lldb +from . import llvm from . import product +from . import swift +from . import swiftpm +from . import xctest from .. import shell @@ -94,14 +105,14 @@ def install(self, target_name): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest, - product.LLBuild, - product.SwiftPM] + 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/tensorflow.py b/utils/swift_build_support/swift_build_support/products/tensorflow.py index 6bf87f1da5f81..85d604e18ba35 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,18 @@ import os +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 @@ -82,14 +93,14 @@ def install(self, host_target): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest, - product.LLBuild, - product.SwiftPM] + 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/tsan_libdispatch.py b/utils/swift_build_support/swift_build_support/products/tsan_libdispatch.py index 8c9dbb5ca8859..0a9b0f3219496 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,18 @@ import os +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 @@ -81,14 +92,14 @@ def install(self, host_target): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation, - product.XCTest, - product.LLBuild, - product.SwiftPM] + 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/xctest.py b/utils/swift_build_support/swift_build_support/products/xctest.py index 32a0f64b64d50..c8d1f3623d46b 100644 --- a/utils/swift_build_support/swift_build_support/products/xctest.py +++ b/utils/swift_build_support/swift_build_support/products/xctest.py @@ -10,7 +10,15 @@ # # ---------------------------------------------------------------------------- +from . import cmark +from . import foundation +from . import libcxx +from . import libdispatch +from . import libicu +from . import lldb +from . import llvm from . import product +from . import swift class XCTest(product.Product): @@ -32,11 +40,11 @@ def product_source_name(cls): @classmethod def get_dependencies(cls): - return [product.CMark, - product.LLVM, - product.LibCXX, - product.LibICU, - product.Swift, - product.LLDB, - product.LibDispatch, - product.Foundation] + return [cmark.CMark, + llvm.LLVM, + libcxx.LibCXX, + libicu.LibICU, + swift.Swift, + lldb.LLDB, + libdispatch.LibDispatch, + foundation.Foundation] From 9a5f2dc98d4078f786ccb598627b98eadb9c1936 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Mon, 8 Jun 2020 13:22:47 -0700 Subject: [PATCH 157/222] [Function builders] Infer function builder through @_dynamicReplacement(for:). Fixes rdar://problem/63898120. --- include/swift/AST/DiagnosticsSema.def | 4 +- lib/Sema/TypeCheckRequestFunctions.cpp | 129 +++++++++++++----- test/Constraints/function_builder_infer.swift | 45 ++++++ 3 files changed, 144 insertions(+), 34 deletions(-) diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index e8581d3cbc515..26ab431c934fa 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -5075,8 +5075,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/lib/Sema/TypeCheckRequestFunctions.cpp b/lib/Sema/TypeCheckRequestFunctions.cpp index bf26315290381..7ab8c6511f595 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() + " "); diff --git a/test/Constraints/function_builder_infer.swift b/test/Constraints/function_builder_infer.swift index 7444cbb179110..9b4228f4ef8aa 100644 --- a/test/Constraints/function_builder_infer.swift +++ b/test/Constraints/function_builder_infer.swift @@ -184,3 +184,48 @@ 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: Tupled { + @_dynamicReplacement(for: dynamicTuple) + var tuple: some Any { + 0 + } +} From d80a405a46d1f9134aa38b073d35807f16485b3e Mon Sep 17 00:00:00 2001 From: Mike Ash Date: Mon, 8 Jun 2020 16:44:10 -0400 Subject: [PATCH 158/222] [Runtime] Clean up verifyMangledNameRoundtrip comment. --- stdlib/public/runtime/Metadata.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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; From 452b6dd08f8da7c766cc12fd5da003e10db9d2fa Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Mon, 8 Jun 2020 14:06:12 -0700 Subject: [PATCH 159/222] [build-script-impl] Require --install-llvm to be passed in to install llvm. Before this patch, we assumed that if LLVM_INSTALL_COMPONENTS was non-empty that we wanted to install llvm. This is different than /every other/ product in build-script-impl where INSTALL_$PRODUCT controls if an install is attempted. If a components sort of thing is required, we force it to only be a configuration of an option that is a no-op if INSTALL_$PRODUCT is set to true. I went through build-presets and looked at every place we had an install statement and added install-llvm when appropriate. This was generally when we did an install-swift. The one special case is with the tsan_libdsipatch test. That being said, if I was too aggressive with where I put these install-llvm, no harm will result since in those cases LLVM_INSTALL_COMPONENTS had to be empty previously anyways (since otherwise we would have attempted an install). --- utils/build-presets.ini | 16 ++++++++++++++++ utils/build-script-impl | 7 ++++--- 2 files changed, 20 insertions(+), 3 deletions(-) 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-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 ;; From 88589e193013743b8d87ec7382ee4c99b568a971 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Mon, 8 Jun 2020 14:46:25 -0700 Subject: [PATCH 160/222] [Function builders] Improve test case for inference behavior --- test/Constraints/function_builder_infer.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/Constraints/function_builder_infer.swift b/test/Constraints/function_builder_infer.swift index 9b4228f4ef8aa..1715352d39424 100644 --- a/test/Constraints/function_builder_infer.swift +++ b/test/Constraints/function_builder_infer.swift @@ -223,9 +223,12 @@ struct DynamicTupled3 { } } -extension DynamicTupled3: Tupled { +extension DynamicTupled3: OtherTupled { @_dynamicReplacement(for: dynamicTuple) - var tuple: some Any { + 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 } } From d43c5158d9c82a1d28cd7ee520943468e46afb4f Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Mon, 8 Jun 2020 14:43:01 -0700 Subject: [PATCH 161/222] [Property wrappers] Reject opaque result types when there is no initializer. Fixes rdar://problem/63169705 / FB7699647. --- lib/Sema/TypeCheckStorage.cpp | 4 ++++ test/decl/var/property_wrappers.swift | 2 +- test/decl/var/property_wrappers_opaque.swift | 24 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 test/decl/var/property_wrappers_opaque.swift diff --git a/lib/Sema/TypeCheckStorage.cpp b/lib/Sema/TypeCheckStorage.cpp index adc999956ed4e..fdfedeaba0961 100644 --- a/lib/Sema/TypeCheckStorage.cpp +++ b/lib/Sema/TypeCheckStorage.cpp @@ -2693,6 +2693,10 @@ PropertyWrapperBackingPropertyInfoRequest::evaluate(Evaluator &evaluator, 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/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..e83ba8b97528d --- /dev/null +++ b/test/decl/var/property_wrappers_opaque.swift @@ -0,0 +1,24 @@ +// 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}} +} + From 8ec75d49333f83369673d84b7c756d5e7b69755f Mon Sep 17 00:00:00 2001 From: Nate Chandler Date: Thu, 28 May 2020 12:51:24 -0700 Subject: [PATCH 162/222] [metadata prespecialization] Support classes with non-generic ancestors. Previously, metadata prespecialization for classes only occurred when all of a specialized generic class's ancestors were themselves generic. Here, that requirement is lifted so that generic classes with concrete ancestors are also eligible for prespecialization. --- lib/IRGen/GenClass.cpp | 23 +- lib/IRGen/MetadataRequest.cpp | 38 ++- .../StdlibUnittest/StdlibUnittest.swift | 33 ++ stdlib/public/core/Prespecialize.swift | 19 ++ .../Inputs/class-open-0argument.swift | 8 + ...-2nd_argument_distinct_generic_class.swift | 6 +- ...t_same_generic_class_different_value.swift | 6 +- ...gument_same_generic_class_same_value.swift | 6 +- ...n_int-2nd_anc_gen-1st-arg_con_double.swift | 5 +- ...int-2nd_anc_gen-1st-arg_subclass_arg.swift | 5 +- ...lass_arg-2nd_anc_gen-1st-arg_con_int.swift | 5 +- ...s_arg-2nd_anc_gen-1st-arg_subcls_arg.swift | 5 +- ...-1argument-1st_argument_constant_int.swift | 5 +- ...ument-1st_argument_subclass_argument.swift | 3 +- ...ic-1argument-1st_argument_superclass.swift | 8 +- ...tor_nongeneric-external-nonresilient.swift | 220 +++++++++++++ ...cestor_nongeneric-external-resilient.swift | 37 +++ ...-1st_ancestor_nongeneric-fileprivate.swift | 305 ++++++++++++++++++ ...-fileprivate-2nd_ancestor_nongeneric.swift | 276 ++++++++++++++++ ...ric-fileprivate-2nd_ancestor_generic.swift | 51 +++ .../stdlib/SwiftNativeNSBase.swift | 10 +- 21 files changed, 1018 insertions(+), 56 deletions(-) create mode 100644 test/IRGen/prespecialized-metadata/Inputs/class-open-0argument.swift create mode 100644 test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_nongeneric-external-nonresilient.swift create mode 100644 test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_nongeneric-external-resilient.swift create mode 100644 test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-1ancestor-1distinct_use-1st_ancestor_nongeneric-fileprivate.swift create mode 100644 test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-2ancestor-1du-1st_ancestor_generic-fileprivate-2nd_ancestor_nongeneric.swift create mode 100644 test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1argument-2ancestor-1du-1st_ancestor_nongeneric-fileprivate-2nd_ancestor_generic.swift 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/MetadataRequest.cpp b/lib/IRGen/MetadataRequest.cpp index 28060ae9313ec..e8f71a65deb49 100644 --- a/lib/IRGen/MetadataRequest.cpp +++ b/lib/IRGen/MetadataRequest.cpp @@ -749,7 +749,10 @@ bool irgen::isCanonicalSpecializedNominalTypeMetadataStaticallyAddressable( auto superclassType = type->getSuperclass(/*useArchetypes=*/false)->getCanonicalType(); if (!isInitializableTypeMetadataStaticallyAddressable(IGM, - superclassType)) { + superclassType) && + !tryEmitConstantHeapMetadataRef( + IGM, superclassType, + /*allowDynamicUninitialized=*/false)) { return false; } } @@ -2171,12 +2174,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 @@ -2196,10 +2208,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); @@ -2219,12 +2227,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/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/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/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/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()) } From 3eb82c183662945687f48e11c09828f551b34858 Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Tue, 9 Jun 2020 00:45:57 +0200 Subject: [PATCH 163/222] Fixes typo in comment in KeyPaths.cpp (#32240) --- stdlib/public/runtime/KeyPaths.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 017d99d7e400bb764095941e05fe298fff4155cb Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 21 May 2020 22:58:36 +0000 Subject: [PATCH 164/222] test: add a test to prevent weak symbol leakage The Swift standard library should not export weak symbols. Ensure that no public weak symbols are defined in the standard library by adding a test case. This would have identified the issue introduced by the recent changes for the runtime. --- test/stdlib/symbol-visibility-darwin.test-sh | 21 +++++++ test/stdlib/symbol-visibility-linux.test-sh | 60 ++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 test/stdlib/symbol-visibility-darwin.test-sh create mode 100644 test/stdlib/symbol-visibility-linux.test-sh 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 From 3e7b4ae168abc02fe30357c71585e382d7e7df74 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Mon, 8 Jun 2020 16:26:06 -0700 Subject: [PATCH 165/222] [Property wrappers] Fix another opaque-result-types crasher. Test case from Holly Borla, thank you! --- lib/Sema/TypeCheckStorage.cpp | 21 ++++++++++---------- test/decl/var/property_wrappers_opaque.swift | 3 +++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/Sema/TypeCheckStorage.cpp b/lib/Sema/TypeCheckStorage.cpp index fdfedeaba0961..d5f417dd3dce5 100644 --- a/lib/Sema/TypeCheckStorage.cpp +++ b/lib/Sema/TypeCheckStorage.cpp @@ -2683,16 +2683,17 @@ 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); diff --git a/test/decl/var/property_wrappers_opaque.swift b/test/decl/var/property_wrappers_opaque.swift index e83ba8b97528d..966b259f318c1 100644 --- a/test/decl/var/property_wrappers_opaque.swift +++ b/test/decl/var/property_wrappers_opaque.swift @@ -22,3 +22,6 @@ struct FB7699647 { @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}} +} From 8215ea105ce31fdc345724f465cf229d90650ddd Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 5 Jun 2020 17:08:50 -0700 Subject: [PATCH 166/222] Emit coverage mappings for all modules Previously in WMO builds where IR was multithreaded only the primary module would emit the coverage mapping leading to only the first object file to have the __llvm_covmap section. This change emits coverage for all modules so they are correctly reflected in the final coverage report. --- lib/IRGen/GenDecl.cpp | 7 +++++-- test/Profiler/Inputs/coverage_num_threads1.swift | 1 + test/Profiler/Inputs/coverage_num_threads2.swift | 1 + test/Profiler/coverage_num_threads.swift | 12 ++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 test/Profiler/Inputs/coverage_num_threads1.swift create mode 100644 test/Profiler/Inputs/coverage_num_threads2.swift create mode 100644 test/Profiler/coverage_num_threads.swift diff --git a/lib/IRGen/GenDecl.cpp b/lib/IRGen/GenDecl.cpp index 7e6710311b798..9dd9c4944b2c3 100644 --- a/lib/IRGen/GenDecl.cpp +++ b/lib/IRGen/GenDecl.cpp @@ -1105,8 +1105,11 @@ void IRGenerator::emitGlobalTopLevel(llvm::StringSet<> *linkerDirectives) { IGM->emitSILDifferentiabilityWitness(&dw); } - // Emit code coverage mapping data. - PrimaryIGM->emitCoverageMapping(); + // Emit code coverage mapping data for all modules + for (auto Iter : *this) { + IRGenModule *IGM = Iter.second; + IGM->emitCoverageMapping(); + } for (auto Iter : *this) { IRGenModule *IGM = Iter.second; diff --git a/test/Profiler/Inputs/coverage_num_threads1.swift b/test/Profiler/Inputs/coverage_num_threads1.swift new file mode 100644 index 0000000000000..6ca641732e7e1 --- /dev/null +++ b/test/Profiler/Inputs/coverage_num_threads1.swift @@ -0,0 +1 @@ +func func1() {} diff --git a/test/Profiler/Inputs/coverage_num_threads2.swift b/test/Profiler/Inputs/coverage_num_threads2.swift new file mode 100644 index 0000000000000..639ea1b4ad4b7 --- /dev/null +++ b/test/Profiler/Inputs/coverage_num_threads2.swift @@ -0,0 +1 @@ +func func2() {} diff --git a/test/Profiler/coverage_num_threads.swift b/test/Profiler/coverage_num_threads.swift new file mode 100644 index 0000000000000..1a50c76335596 --- /dev/null +++ b/test/Profiler/coverage_num_threads.swift @@ -0,0 +1,12 @@ +// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 0 -emit-ir %S/Inputs/coverage_num_threads1.swift | %FileCheck %s -check-prefix=SINGLE-SOURCE --implicit-check-not="llvm_coverage_mapping =" + +// SINGLE-SOURCE: llvm_coverage_mapping = + +// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 0 -emit-ir %S/Inputs/coverage_num_threads1.swift %S/Inputs/coverage_num_threads2.swift | %FileCheck %s -check-prefix=SINGLE-OBJECT --implicit-check-not="llvm_coverage_mapping =" + +// SINGLE-OBJECT: llvm_coverage_mapping = + +// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 2 -emit-ir %S/Inputs/coverage_num_threads1.swift %S/Inputs/coverage_num_threads2.swift | %FileCheck %s -check-prefix=MULTIPLE-OBJECTS --implicit-check-not="llvm_coverage_mapping =" + +// MULTIPLE-OBJECTS: llvm_coverage_mapping = +// MULTIPLE-OBJECTS: llvm_coverage_mapping = From 68351d21105d8bce516ce2108b87444526b54694 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Mon, 8 Jun 2020 16:48:38 -0700 Subject: [PATCH 167/222] Revert "Merge remote-tracking branch 'origin/master-next'" This reverts commit 1c9b0908e65d9a06d1c5b7f13c9c1eb661619418, reversing changes made to 3eb82c183662945687f48e11c09828f551b34858. --- include/swift/AST/ClangNode.h | 4 +- include/swift/AST/SimpleRequest.h | 1 - include/swift/AST/SourceFile.h | 8 +- include/swift/Basic/STLExtras.h | 45 ++++++ include/swift/ClangImporter/ClangModule.h | 6 +- .../swift/Frontend/FrontendInputsAndOutputs.h | 1 - include/swift/Parse/ParsedRawSyntaxNode.h | 4 +- include/swift/SIL/SILLocation.h | 2 +- include/swift/SIL/SILNode.h | 1 - lib/AST/ASTPrinter.cpp | 1 - lib/AST/Builtins.cpp | 4 +- lib/AST/Expr.cpp | 15 +- lib/ClangImporter/ClangAdapter.cpp | 6 +- lib/ClangImporter/ClangImporter.cpp | 2 +- lib/ClangImporter/ImportDecl.cpp | 39 ++--- lib/ClangImporter/ImportType.cpp | 19 +-- lib/Frontend/CompilerInvocation.cpp | 2 +- lib/Frontend/ModuleInterfaceLoader.cpp | 2 +- lib/FrontendTool/FrontendTool.cpp | 2 +- lib/IDE/SwiftSourceDocInfo.cpp | 1 - lib/IDE/Utils.cpp | 2 +- lib/IRGen/GenCall.cpp | 18 +-- lib/IRGen/GenConstant.cpp | 3 +- lib/IRGen/GenCoverage.cpp | 145 +++++++++--------- lib/IRGen/GenDecl.cpp | 4 +- lib/IRGen/GenEnum.cpp | 1 - lib/IRGen/GenOpaque.cpp | 2 +- lib/IRGen/IRBuilder.h | 4 +- lib/IRGen/IRGenDebugInfo.cpp | 5 +- lib/IRGen/LocalTypeDataKind.h | 4 +- lib/IRGen/TypeLayout.h | 1 - lib/Immediate/Immediate.cpp | 4 +- lib/PrintAsObjC/DeclAndTypePrinter.cpp | 1 - lib/PrintAsObjC/ModuleContentsWriter.cpp | 1 - lib/SILOptimizer/IPO/GlobalOpt.cpp | 2 +- .../Transforms/AccessEnforcementOpts.cpp | 2 +- lib/Sema/CSSolver.cpp | 6 +- lib/Serialization/ModuleFile.cpp | 2 +- lib/Serialization/Serialization.cpp | 2 +- lib/Serialization/SerializedModuleLoader.cpp | 3 +- test/DebugInfo/Inputs/Macro.h | 8 +- test/DebugInfo/inlinescopes.swift | 8 +- test/DebugInfo/modulecache.swift | 2 +- test/DebugInfo/top_level_code.swift | 2 +- test/DebugInfo/transparent.swift | 1 + test/Driver/bad_tmpdir.swift | 3 - test/IRGen/pic.swift | 1 - .../load-target-normalization.swift | 3 - .../CursorInfo/use-swift-source-info.swift | 3 - .../lib/SwiftLang/SwiftLangSupport.cpp | 2 +- .../swift-api-digester/swift-api-digester.cpp | 2 +- tools/swift-llvm-opt/LLVMOpt.cpp | 80 +++++----- unittests/AST/TestContext.h | 2 - 53 files changed, 233 insertions(+), 261 deletions(-) diff --git a/include/swift/AST/ClangNode.h b/include/swift/AST/ClangNode.h index 608ba9ada8af4..cbf120840b661 100644 --- a/include/swift/AST/ClangNode.h +++ b/include/swift/AST/ClangNode.h @@ -48,8 +48,8 @@ class ClangNode { template using Box = detail::ClangNodeBox; - llvm::PointerUnion, Box, - Box, Box> Ptr; + llvm::PointerUnion4, Box, + Box, Box> Ptr; public: ClangNode() = default; diff --git a/include/swift/AST/SimpleRequest.h b/include/swift/AST/SimpleRequest.h index d59c61618079e..42751e142682c 100644 --- a/include/swift/AST/SimpleRequest.h +++ b/include/swift/AST/SimpleRequest.h @@ -24,7 +24,6 @@ #include "swift/Basic/TypeID.h" #include "llvm/ADT/Hashing.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/Support/Error.h" #include #include diff --git a/include/swift/AST/SourceFile.h b/include/swift/AST/SourceFile.h index ad3f4dce3b0a7..ca305f8675db8 100644 --- a/include/swift/AST/SourceFile.h +++ b/include/swift/AST/SourceFile.h @@ -688,11 +688,9 @@ struct DenseMapInfo { StringRefDMI::getTombstoneKey()); } static inline unsigned getHashValue(const ImportedModuleDesc &import) { - return detail::combineHashValue( - ImportedModuleDMI::getHashValue(import.module), - detail::combineHashValue( - ImportOptionsDMI::getHashValue(import.importOptions), - StringRefDMI::getHashValue(import.filename))); + return combineHashValue(ImportedModuleDMI::getHashValue(import.module), + combineHashValue(ImportOptionsDMI::getHashValue(import.importOptions), + StringRefDMI::getHashValue(import.filename))); } static bool isEqual(const ImportedModuleDesc &a, const ImportedModuleDesc &b) { diff --git a/include/swift/Basic/STLExtras.h b/include/swift/Basic/STLExtras.h index 21d2993bbaa90..fa06044937165 100644 --- a/include/swift/Basic/STLExtras.h +++ b/include/swift/Basic/STLExtras.h @@ -69,6 +69,51 @@ struct function_traits { using argument_types = std::tuple; }; +} // end namespace swift + +#if !defined(swiftCore_EXPORTS) +namespace llvm { + +/// @{ + +/// An STL-style algorithm similar to std::for_each that applies a second +/// functor between every pair of elements. +/// +/// This provides the control flow logic to, for example, print a +/// comma-separated list: +/// \code +/// interleave(names.begin(), names.end(), +/// [&](StringRef name) { OS << name; }, +/// [&] { OS << ", "; }); +/// \endcode +template +inline void interleave(ForwardIterator begin, ForwardIterator end, + UnaryFunctor each_fn, + NullaryFunctor between_fn) { + if (begin == end) + return; + each_fn(*begin); + ++begin; + for (; begin != end; ++begin) { + between_fn(); + each_fn(*begin); + } +} + +template +inline void interleave(const Container &c, UnaryFunctor each_fn, + NullaryFunctor between_fn) { + interleave(c.begin(), c.end(), each_fn, between_fn); +} + +/// @} + +} // end namespace llvm +#endif + +namespace swift { + /// @{ /// The equivalent of std::for_each, but for two lists at once. diff --git a/include/swift/ClangImporter/ClangModule.h b/include/swift/ClangImporter/ClangModule.h index f1f15794a0c76..90cc2c97c9166 100644 --- a/include/swift/ClangImporter/ClangModule.h +++ b/include/swift/ClangImporter/ClangModule.h @@ -19,7 +19,6 @@ #include "swift/AST/FileUnit.h" #include "swift/ClangImporter/ClangImporter.h" #include "clang/AST/ExternalASTSource.h" -#include "clang/Basic/Module.h" namespace clang { class ASTContext; @@ -38,7 +37,7 @@ class ClangModuleUnit final : public LoadedFile { llvm::PointerIntPair overlayModule; mutable Optional> importedModulesForLookup; /// The metadata of the underlying Clang module. - clang::ASTSourceDescriptor ASTSourceDescriptor; + clang::ExternalASTSource::ASTSourceDescriptor ASTSourceDescriptor; public: /// True if the given Module contains an imported Clang module unit. @@ -116,7 +115,8 @@ class ClangModuleUnit final : public LoadedFile { /// Returns the ASTSourceDescriptor of the associated Clang module if one /// exists. - Optional getASTSourceDescriptor() const; + Optional + getASTSourceDescriptor() const; virtual StringRef getModuleDefiningPath() const override; diff --git a/include/swift/Frontend/FrontendInputsAndOutputs.h b/include/swift/Frontend/FrontendInputsAndOutputs.h index 969031eb08e53..76f5ef125bc14 100644 --- a/include/swift/Frontend/FrontendInputsAndOutputs.h +++ b/include/swift/Frontend/FrontendInputsAndOutputs.h @@ -17,7 +17,6 @@ #include "swift/Basic/SupplementaryOutputPaths.h" #include "swift/Frontend/InputFile.h" #include "llvm/ADT/Hashing.h" -#include "llvm/ADT/StringMap.h" #include #include diff --git a/include/swift/Parse/ParsedRawSyntaxNode.h b/include/swift/Parse/ParsedRawSyntaxNode.h index 81985d929fc46..916e3d816703b 100644 --- a/include/swift/Parse/ParsedRawSyntaxNode.h +++ b/include/swift/Parse/ParsedRawSyntaxNode.h @@ -98,8 +98,8 @@ class ParsedRawSyntaxNode { assert(DeferredToken.NumTrailingTrivia == numTrailingTrivia && "numLeadingTrivia is too large value!"); } - ParsedRawSyntaxNode(const ParsedRawSyntaxNode &other) = delete; - ParsedRawSyntaxNode &operator=(const ParsedRawSyntaxNode &other) = delete; + ParsedRawSyntaxNode(ParsedRawSyntaxNode &other) = delete; + ParsedRawSyntaxNode &operator=(ParsedRawSyntaxNode &other) = delete; public: ParsedRawSyntaxNode() diff --git a/include/swift/SIL/SILLocation.h b/include/swift/SIL/SILLocation.h index 92e68396b03f9..60bedd6f8ef31 100644 --- a/include/swift/SIL/SILLocation.h +++ b/include/swift/SIL/SILLocation.h @@ -65,7 +65,7 @@ class SILLocation { using type = Pattern; }; - using ASTNodeTy = llvm::PointerUnion; + using ASTNodeTy = llvm::PointerUnion4; public: enum LocationKind : unsigned { diff --git a/include/swift/SIL/SILNode.h b/include/swift/SIL/SILNode.h index 829ac3536c2b7..6f1f50a2dc453 100644 --- a/include/swift/SIL/SILNode.h +++ b/include/swift/SIL/SILNode.h @@ -19,7 +19,6 @@ #include "llvm/Support/Compiler.h" #include "llvm/ADT/DenseMapInfo.h" -#include "llvm/Support/PointerLikeTypeTraits.h" #include "swift/Basic/InlineBitfield.h" #include "swift/Basic/LLVM.h" #include diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index 797e0fcb7ec78..8084deab1cb23 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -47,7 +47,6 @@ #include "clang/AST/Decl.h" #include "clang/AST/DeclObjC.h" #include "clang/Basic/Module.h" -#include "clang/Basic/SourceManager.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ConvertUTF.h" diff --git a/lib/AST/Builtins.cpp b/lib/AST/Builtins.cpp index be52dbe64d42c..32516e69f9a5b 100644 --- a/lib/AST/Builtins.cpp +++ b/lib/AST/Builtins.cpp @@ -1740,12 +1740,12 @@ Type IntrinsicTypeDecoder::decodeImmediate() { IITDescriptor D = Table.front(); Table = Table.slice(1); switch (D.Kind) { - case IITDescriptor::BFloat: case IITDescriptor::MMX: case IITDescriptor::Metadata: case IITDescriptor::ExtendArgument: case IITDescriptor::TruncArgument: case IITDescriptor::HalfVecArgument: + case IITDescriptor::ScalableVecArgument: case IITDescriptor::VarArg: case IITDescriptor::Token: case IITDescriptor::VecElementArgument: @@ -1774,7 +1774,7 @@ Type IntrinsicTypeDecoder::decodeImmediate() { case IITDescriptor::Vector: { Type eltType = decodeImmediate(); if (!eltType) return Type(); - return makeVector(eltType, D.Vector_Width.Min); + return makeVector(eltType, D.Vector_Width); } // A pointer to an immediate type. diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index c82c04d6266fa..3319311779634 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -831,15 +831,16 @@ APInt BuiltinIntegerWidth::parse(StringRef text, unsigned radix, bool negate, static APFloat getFloatLiteralValue(bool IsNegative, StringRef Text, const llvm::fltSemantics &Semantics) { APFloat Val(Semantics); - auto Res = - Val.convertFromString(Text, llvm::APFloat::rmNearestTiesToEven); - assert(Res && "Sema didn't reject invalid number"); - consumeError(Res.takeError()); + llvm::Expected MaybeRes = + Val.convertFromString(Text, llvm::APFloat::rmNearestTiesToEven); + assert(MaybeRes && *MaybeRes != APFloat::opInvalidOp && + "Sema didn't reject invalid number"); + (void)MaybeRes; if (IsNegative) { auto NegVal = APFloat::getZero(Semantics, /*negative*/ true); - Res = NegVal.subtract(Val, llvm::APFloat::rmNearestTiesToEven); - assert(Res && "Sema didn't reject invalid number"); - consumeError(Res.takeError()); + auto Res = NegVal.subtract(Val, llvm::APFloat::rmNearestTiesToEven); + assert(Res != APFloat::opInvalidOp && "Sema didn't reject invalid number"); + (void)Res; return NegVal; } return Val; diff --git a/lib/ClangImporter/ClangAdapter.cpp b/lib/ClangImporter/ClangAdapter.cpp index 8d6c05e55f2d1..eddac5d46b3bf 100644 --- a/lib/ClangImporter/ClangAdapter.cpp +++ b/lib/ClangImporter/ClangAdapter.cpp @@ -81,7 +81,7 @@ const clang::Decl * importer::getFirstNonLocalDecl(const clang::Decl *D) { D = D->getCanonicalDecl(); auto iter = llvm::find_if(D->redecls(), [](const clang::Decl *next) -> bool { - return !next->isInLocalScope(); + return !next->isLexicallyWithinFunctionOrMethod(); }); if (iter == D->redecls_end()) return nullptr; @@ -344,7 +344,6 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx, case clang::BuiltinType::ARCUnbridgedCast: case clang::BuiltinType::BoundMember: case clang::BuiltinType::BuiltinFn: - case clang::BuiltinType::IncompleteMatrixIdx: case clang::BuiltinType::Overload: case clang::BuiltinType::PseudoObject: case clang::BuiltinType::UnknownAny: @@ -377,7 +376,6 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx, case clang::BuiltinType::SatULongFract: case clang::BuiltinType::Half: case clang::BuiltinType::LongDouble: - case clang::BuiltinType::BFloat16: case clang::BuiltinType::Float16: case clang::BuiltinType::Float128: case clang::BuiltinType::NullPtr: @@ -448,8 +446,6 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx, // OpenMP types that don't have Swift equivalents. case clang::BuiltinType::OMPArraySection: - case clang::BuiltinType::OMPArrayShaping: - case clang::BuiltinType::OMPIterator: return OmissionTypeName(); // SVE builtin types that don't have Swift equivalents. diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index cad4a0b098dec..142ab1d3b358a 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -3309,7 +3309,7 @@ StringRef ClangModuleUnit::getModuleDefiningPath() const { return clangSourceMgr.getFilename(clangModule->DefinitionLoc); } -Optional +Optional ClangModuleUnit::getASTSourceDescriptor() const { if (clangModule) { assert(ASTSourceDescriptor.getModuleOrNull() == clangModule); diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index 0cd4bcaf44726..5f971d0872e63 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -16,6 +16,7 @@ #include "CFTypeInfo.h" #include "ImporterImpl.h" +#include "swift/Strings.h" #include "swift/AST/ASTContext.h" #include "swift/AST/ASTMangler.h" #include "swift/AST/Attr.h" @@ -35,19 +36,15 @@ #include "swift/AST/PrettyStackTrace.h" #include "swift/AST/ProtocolConformance.h" #include "swift/AST/Stmt.h" -#include "swift/AST/TypeCheckRequests.h" #include "swift/AST/Types.h" +#include "swift/AST/TypeCheckRequests.h" #include "swift/Basic/Defer.h" #include "swift/Basic/PrettyStackTrace.h" -#include "swift/Basic/Statistic.h" #include "swift/ClangImporter/ClangModule.h" -#include "swift/Config.h" #include "swift/Parse/Lexer.h" -#include "swift/Strings.h" - +#include "swift/Config.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Attr.h" -#include "clang/AST/DeclObjCCommon.h" #include "clang/AST/DeclCXX.h" #include "clang/Basic/CharInfo.h" #include "swift/Basic/Statistic.h" @@ -382,7 +379,6 @@ getSwiftStdlibType(const clang::TypedefNameDecl *D, case clang::TargetInfo::VoidPtrBuiltinVaList: case clang::TargetInfo::PowerABIBuiltinVaList: case clang::TargetInfo::AAPCSABIBuiltinVaList: - case clang::TargetInfo::HexagonBuiltinVaList: assert(ClangCtx.getTypeSize(ClangCtx.VoidPtrTy) == ClangTypeSize && "expected va_list type to be sizeof(void *)"); break; @@ -1226,16 +1222,15 @@ makeBitFieldAccessors(ClangImporter::Implementation &Impl, fieldType, clang::VK_RValue, clang::SourceLocation()); - - auto cSetterExpr = clang::BinaryOperator::Create(Ctx, - cSetterMemberExpr, - cSetterValueExpr, - clang::BO_Assign, - fieldType, - clang::VK_RValue, - clang::OK_Ordinary, - clang::SourceLocation(), - clang::FPOptions()); + + auto cSetterExpr = new (Ctx) clang::BinaryOperator(cSetterMemberExpr, + cSetterValueExpr, + clang::BO_Assign, + fieldType, + clang::VK_RValue, + clang::OK_Ordinary, + clang::SourceLocation(), + clang::FPOptions()); cSetterDecl->setBody(cSetterExpr); } @@ -2088,7 +2083,7 @@ classImplementsProtocol(const clang::ObjCInterfaceDecl *constInterface, static void applyPropertyOwnership(VarDecl *prop, - clang::ObjCPropertyAttribute::Kind attrs) { + clang::ObjCPropertyDecl::PropertyAttributeKind attrs) { Type ty = prop->getInterfaceType(); if (auto innerTy = ty->getOptionalObjectType()) ty = innerTy; @@ -2096,19 +2091,19 @@ applyPropertyOwnership(VarDecl *prop, return; ASTContext &ctx = prop->getASTContext(); - if (attrs & clang::ObjCPropertyAttribute::kind_copy) { + if (attrs & clang::ObjCPropertyDecl::OBJC_PR_copy) { prop->getAttrs().add(new (ctx) NSCopyingAttr(false)); return; } - if (attrs & clang::ObjCPropertyAttribute::kind_weak) { + if (attrs & clang::ObjCPropertyDecl::OBJC_PR_weak) { prop->getAttrs().add(new (ctx) ReferenceOwnershipAttr(ReferenceOwnership::Weak)); prop->setInterfaceType(WeakStorageType::get( prop->getInterfaceType(), ctx)); return; } - if ((attrs & clang::ObjCPropertyAttribute::kind_assign) || - (attrs & clang::ObjCPropertyAttribute::kind_unsafe_unretained)) { + if ((attrs & clang::ObjCPropertyDecl::OBJC_PR_assign) || + (attrs & clang::ObjCPropertyDecl::OBJC_PR_unsafe_unretained)) { prop->getAttrs().add( new (ctx) ReferenceOwnershipAttr(ReferenceOwnership::Unmanaged)); prop->setInterfaceType(UnmanagedStorageType::get( diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index 39c76bef1df49..87c5518c3e1e3 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -32,7 +32,6 @@ #include "swift/Parse/Token.h" #include "swift/Strings.h" #include "clang/AST/ASTContext.h" -#include "clang/AST/DeclObjCCommon.h" #include "clang/AST/TypeVisitor.h" #include "clang/Basic/Builtins.h" #include "clang/Lex/Preprocessor.h" @@ -243,7 +242,6 @@ namespace { case clang::BuiltinType::ARCUnbridgedCast: case clang::BuiltinType::BoundMember: case clang::BuiltinType::BuiltinFn: - case clang::BuiltinType::IncompleteMatrixIdx: case clang::BuiltinType::Overload: case clang::BuiltinType::PseudoObject: case clang::BuiltinType::UnknownAny: @@ -274,7 +272,6 @@ namespace { case clang::BuiltinType::SatUShortFract: case clang::BuiltinType::SatUFract: case clang::BuiltinType::SatULongFract: - case clang::BuiltinType::BFloat16: case clang::BuiltinType::Float128: case clang::BuiltinType::NullPtr: case clang::BuiltinType::Char8: @@ -345,8 +342,6 @@ namespace { // OpenMP types that don't have Swift equivalents. case clang::BuiltinType::OMPArraySection: - case clang::BuiltinType::OMPArrayShaping: - case clang::BuiltinType::OMPIterator: return Type(); // SVE builtin types that don't have Swift equivalents. @@ -368,21 +363,11 @@ namespace { llvm_unreachable("Invalid BuiltinType."); } - ImportResult VisitExtIntType(const clang::ExtIntType *) { - // ExtInt is not supported in Swift. - return Type(); - } - ImportResult VisitPipeType(const clang::PipeType *) { // OpenCL types are not supported in Swift. return Type(); } - ImportResult VisitMatrixType(const clang::MatrixType *ty) { - // Matrix types are not supported in Swift. - return Type(); - } - ImportResult VisitComplexType(const clang::ComplexType *type) { // FIXME: Implement once Complex is in the library. return Type(); @@ -1598,8 +1583,8 @@ bool ClangImporter::Implementation::shouldAllowNSUIntegerAsInt( ImportedType ClangImporter::Implementation::importPropertyType( const clang::ObjCPropertyDecl *decl, bool isFromSystemModule) { const auto assignOrUnsafeUnretained = - clang::ObjCPropertyAttribute::kind_assign | - clang::ObjCPropertyAttribute::kind_unsafe_unretained; + clang::ObjCPropertyDecl::OBJC_PR_assign | + clang::ObjCPropertyDecl::OBJC_PR_unsafe_unretained; ImportTypeKind importKind; // HACK: Certain decls are always imported using bridged types, diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index d2e002f3ab643..071ccdf4f65e4 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -76,7 +76,7 @@ void CompilerInvocation::setDefaultPrebuiltCacheIfNecessary() { platform = getPlatformNameForTriple(LangOpts.Target); } llvm::sys::path::append(defaultPrebuiltPath, platform, "prebuilt-modules"); - FrontendOpts.PrebuiltModuleCachePath = std::string(defaultPrebuiltPath.str()); + FrontendOpts.PrebuiltModuleCachePath = defaultPrebuiltPath.str(); } static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts, diff --git a/lib/Frontend/ModuleInterfaceLoader.cpp b/lib/Frontend/ModuleInterfaceLoader.cpp index 8cc5fb2a9e67e..5e573ceb6412b 100644 --- a/lib/Frontend/ModuleInterfaceLoader.cpp +++ b/lib/Frontend/ModuleInterfaceLoader.cpp @@ -1131,7 +1131,7 @@ bool InterfaceSubContextDelegateImpl::extractSwiftInterfaceVersionAndArgs( if (CompRe.match(SB, &CompMatches)) { assert(CompMatches.size() == 2); - CompilerVersion = ArgSaver.save(CompMatches[1]).str(); + CompilerVersion = ArgSaver.save(CompMatches[1]); } else { // Don't diagnose; handwritten module interfaces don't include this field. diff --git a/lib/FrontendTool/FrontendTool.cpp b/lib/FrontendTool/FrontendTool.cpp index 7edaacc2ea557..2c327d1ec57cb 100644 --- a/lib/FrontendTool/FrontendTool.cpp +++ b/lib/FrontendTool/FrontendTool.cpp @@ -1175,7 +1175,7 @@ static bool emitAnyWholeModulePostTypeCheckSupplementaryOutputs( llvm::SmallString<32> Buffer(*opts.BridgingHeaderDirForPrint); llvm::sys::path::append(Buffer, llvm::sys::path::filename(opts.ImplicitObjCHeaderPath)); - BridgingHeaderPathForPrint = (std::string)Buffer; + BridgingHeaderPathForPrint = Buffer.str(); } else { // By default, include the given bridging header path directly. BridgingHeaderPathForPrint = opts.ImplicitObjCHeaderPath; diff --git a/lib/IDE/SwiftSourceDocInfo.cpp b/lib/IDE/SwiftSourceDocInfo.cpp index 66143bd87b67a..f8211c437795a 100644 --- a/lib/IDE/SwiftSourceDocInfo.cpp +++ b/lib/IDE/SwiftSourceDocInfo.cpp @@ -24,7 +24,6 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" #include "clang/Basic/Module.h" -#include "clang/Basic/SourceManager.h" #include "clang/Index/USRGeneration.h" #include "clang/Lex/Lexer.h" #include "clang/Basic/CharInfo.h" diff --git a/lib/IDE/Utils.cpp b/lib/IDE/Utils.cpp index 5b9b998149074..616a0e6e0678f 100644 --- a/lib/IDE/Utils.cpp +++ b/lib/IDE/Utils.cpp @@ -24,8 +24,8 @@ #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/TextDiagnosticBuffer.h" #include "clang/Lex/PreprocessorOptions.h" -#include "clang/Rewrite/Core/RewriteBuffer.h" #include "clang/Serialization/ASTReader.h" +#include "clang/Rewrite/Core/RewriteBuffer.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/MemoryBuffer.h" diff --git a/lib/IRGen/GenCall.cpp b/lib/IRGen/GenCall.cpp index 18e2f8a66135e..292c36e5ff718 100644 --- a/lib/IRGen/GenCall.cpp +++ b/lib/IRGen/GenCall.cpp @@ -727,13 +727,6 @@ namespace { case clang::Type::Pipe: llvm_unreachable("OpenCL type in ABI lowering?"); - case clang::Type::ExtInt: - llvm_unreachable("ExtInt type in ABI lowering?"); - - case clang::Type::ConstantMatrix: { - llvm_unreachable("ConstantMatrix type in ABI lowering?"); - } - case clang::Type::ConstantArray: { auto array = Ctx.getAsConstantArrayType(type); auto elt = Ctx.getCanonicalType(array->getElementType()); @@ -917,8 +910,6 @@ namespace { case clang::BuiltinType::Float16: llvm_unreachable("When upstream support is added for Float16 in " "clang::TargetInfo, use the implementation here"); - case clang::BuiltinType::BFloat16: - return convertFloatingType(Ctx.getTargetInfo().getBFloat16Format()); case clang::BuiltinType::Float128: return convertFloatingType(Ctx.getTargetInfo().getFloat128Format()); @@ -2119,8 +2110,7 @@ static void emitCoerceAndExpand(IRGenFunction &IGF, Explosion &in, Alignment(coercionTyLayout->getAlignment().value()); auto alloca = cast(temporary.getAddress()); if (alloca->getAlignment() < coercionTyAlignment.getValue()) { - alloca->setAlignment( - llvm::MaybeAlign(coercionTyAlignment.getValue()).valueOrOne()); + alloca->setAlignment(llvm::MaybeAlign(coercionTyAlignment.getValue())); temporary = Address(temporary.getAddress(), coercionTyAlignment); } @@ -2398,8 +2388,7 @@ static void externalizeArguments(IRGenFunction &IGF, const Callee &callee, auto ABIAlign = AI.getIndirectAlign(); if (ABIAlign > addr.getAlignment()) { auto *AS = cast(addr.getAddress()); - AS->setAlignment( - llvm::MaybeAlign(ABIAlign.getQuantity()).valueOrOne()); + AS->setAlignment(llvm::MaybeAlign(ABIAlign.getQuantity())); addr = Address(addr.getAddress(), Alignment(ABIAlign.getQuantity())); } } @@ -3091,8 +3080,7 @@ static void adjustAllocaAlignment(const llvm::DataLayout &DL, Alignment layoutAlignment = Alignment(layout->getAlignment().value()); auto alloca = cast(allocaAddr.getAddress()); if (alloca->getAlignment() < layoutAlignment.getValue()) { - alloca->setAlignment( - llvm::MaybeAlign(layoutAlignment.getValue()).valueOrOne()); + alloca->setAlignment(llvm::MaybeAlign(layoutAlignment.getValue())); allocaAddr = Address(allocaAddr.getAddress(), layoutAlignment); } } diff --git a/lib/IRGen/GenConstant.cpp b/lib/IRGen/GenConstant.cpp index ac7cc747e4652..071d49f82603b 100644 --- a/lib/IRGen/GenConstant.cpp +++ b/lib/IRGen/GenConstant.cpp @@ -85,8 +85,7 @@ llvm::Constant *irgen::emitConstantZero(IRGenModule &IGM, BuiltinInst *BI) { if (auto vector = BI->getType().getAs()) { auto zero = helper(vector.getElementType()); - return llvm::ConstantVector::getSplat( - llvm::ElementCount(vector->getNumElements(), /*scalable*/ false), zero); + return llvm::ConstantVector::getSplat(vector->getNumElements(), zero); } return helper(BI->getType().getASTType()); diff --git a/lib/IRGen/GenCoverage.cpp b/lib/IRGen/GenCoverage.cpp index 8a12869d7a138..699d1584e4eb1 100644 --- a/lib/IRGen/GenCoverage.cpp +++ b/lib/IRGen/GenCoverage.cpp @@ -22,23 +22,19 @@ #include "llvm/IR/Constants.h" #include "llvm/IR/Module.h" #include "llvm/IR/Type.h" -#include "llvm/ProfileData/Coverage/CoverageMappingWriter.h" #include "llvm/ProfileData/InstrProf.h" +#include "llvm/ProfileData/Coverage/CoverageMappingWriter.h" #include "llvm/Support/FileSystem.h" -// This selects the coverage mapping format defined when `InstrProfData.inc` -// is textually included. -#define COVMAP_V3 - using namespace swift; using namespace irgen; -using llvm::coverage::CounterMappingRegion; using llvm::coverage::CovMapVersion; +using llvm::coverage::CounterMappingRegion; -static std::string getInstrProfSection(IRGenModule &IGM, - llvm::InstrProfSectKind SK) { - return llvm::getInstrProfSectionName(SK, IGM.Triple.getObjectFormat()); +static std::string getCoverageSection(IRGenModule &IGM) { + return llvm::getInstrProfSectionName(llvm::IPSK_covmap, + IGM.Triple.getObjectFormat()); } void IRGenModule::emitCoverageMapping() { @@ -65,6 +61,8 @@ void IRGenModule::emitCoverageMapping() { Files.push_back(M->getFile()); // Awkwardly munge absolute filenames into a vector of StringRefs. + // TODO: This is heinous - the same thing is happening in clang, but the API + // really needs to be cleaned up for both. llvm::SmallVector FilenameStrs; llvm::SmallVector FilenameRefs; for (StringRef Name : Files) { @@ -74,31 +72,33 @@ void IRGenModule::emitCoverageMapping() { FilenameRefs.push_back(FilenameStrs.back()); } - // Encode the filenames. - std::string Filenames; - llvm::LLVMContext &Ctx = getLLVMContext(); - { - llvm::raw_string_ostream OS(Filenames); - llvm::coverage::CoverageFilenamesSectionWriter(FilenameRefs).write(OS); - } - auto *FilenamesVal = - llvm::ConstantDataArray::getString(Ctx, Filenames, false); - const int64_t FilenamesRef = llvm::IndexedInstrProf::ComputeHash(Filenames); - const size_t FilenamesSize = Filenames.size(); + // Encode the filenames first. + std::string FilenamesAndCoverageMappings; + llvm::raw_string_ostream OS(FilenamesAndCoverageMappings); + llvm::coverage::CoverageFilenamesSectionWriter(FilenameRefs).write(OS); + size_t FilenamesSize = OS.str().size(); + size_t CurrentSize, PrevSize = FilenamesSize; - // Emit the function records. + // Now we need to build up the list of function records. + llvm::LLVMContext &Ctx = getLLVMContext(); auto *Int32Ty = llvm::Type::getInt32Ty(Ctx); - for (const auto &M : Mappings) { - StringRef NameValue = M->getPGOFuncName(); - assert(!NameValue.empty() && "Expected a named record"); - uint64_t FuncHash = M->getHash(); - const uint64_t NameHash = llvm::IndexedInstrProf::ComputeHash(NameValue); - std::string FuncRecordName = "__covrec_" + llvm::utohexstr(NameHash); + llvm::Type *FunctionRecordTypes[] = { +#define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) LLVMType, +#include "llvm/ProfileData/InstrProfData.inc" +#undef COVMAP_FUNC_RECORD + }; + + auto FunctionRecordTy = + llvm::StructType::get(Ctx, llvm::makeArrayRef(FunctionRecordTypes), + /*isPacked=*/true); + std::vector FunctionRecords; + std::vector Regions; + for (const auto &M : Mappings) { unsigned FileID = std::find(Files.begin(), Files.end(), M->getFile()) - Files.begin(); - std::vector Regions; + Regions.clear(); for (const auto &MR : M->getMappedRegions()) Regions.emplace_back(CounterMappingRegion::makeRegion( MR.Counter, /*FileID=*/0, MR.StartLine, MR.StartCol, MR.EndLine, @@ -107,70 +107,73 @@ void IRGenModule::emitCoverageMapping() { ArrayRef VirtualFileMapping(FileID); llvm::coverage::CoverageMappingWriter W(VirtualFileMapping, M->getExpressions(), Regions); - std::string CoverageMapping; - { - llvm::raw_string_ostream OS(CoverageMapping); - W.write(OS); - } + W.write(OS); -#define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) LLVMType, - llvm::Type *FunctionRecordTypes[] = { -#include "llvm/ProfileData/InstrProfData.inc" - }; - auto *FunctionRecordTy = - llvm::StructType::get(Ctx, makeArrayRef(FunctionRecordTypes), - /*isPacked=*/true); + CurrentSize = OS.str().size(); + unsigned MappingLen = CurrentSize - PrevSize; + StringRef CoverageMapping(OS.str().c_str() + PrevSize, MappingLen); - // Create the function record constant. -#define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) Init, + StringRef NameValue = M->getPGOFuncName(); + assert(!NameValue.empty() && "Expected a named record"); + uint64_t FuncHash = M->getHash(); + + // Create a record for this function. llvm::Constant *FunctionRecordVals[] = { +#define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) Init, #include "llvm/ProfileData/InstrProfData.inc" +#undef COVMAP_FUNC_RECORD }; - auto *FuncRecordConstant = llvm::ConstantStruct::get( - FunctionRecordTy, makeArrayRef(FunctionRecordVals)); - - // Create the function record global. - auto *FuncRecord = new llvm::GlobalVariable( - *getModule(), FunctionRecordTy, /*isConstant=*/true, - llvm::GlobalValue::LinkOnceODRLinkage, FuncRecordConstant, - FuncRecordName); - FuncRecord->setVisibility(llvm::GlobalValue::HiddenVisibility); - FuncRecord->setSection(getInstrProfSection(*this, llvm::IPSK_covfun)); - FuncRecord->setAlignment(llvm::Align(8)); - if (Triple.supportsCOMDAT()) - FuncRecord->setComdat(getModule()->getOrInsertComdat(FuncRecordName)); - - // Make sure the data doesn't get deleted. - addUsedGlobal(FuncRecord); + + FunctionRecords.push_back(llvm::ConstantStruct::get( + FunctionRecordTy, makeArrayRef(FunctionRecordVals))); + PrevSize = CurrentSize; + } + size_t CoverageMappingSize = PrevSize - FilenamesSize; + + // Append extra zeroes if necessary to ensure that the size of the filenames + // and coverage mappings is a multiple of 8. + if (size_t Rem = OS.str().size() % 8) { + CoverageMappingSize += 8 - Rem; + for (size_t I = 0, S = 8 - Rem; I < S; ++I) + OS << '\0'; } + auto *FilenamesAndMappingsVal = + llvm::ConstantDataArray::getString(Ctx, OS.str(), false); + + auto *RecordsTy = + llvm::ArrayType::get(FunctionRecordTy, FunctionRecords.size()); + auto *RecordsVal = llvm::ConstantArray::get(RecordsTy, FunctionRecords); // Create the coverage data header. - const unsigned NRecords = 0; - const unsigned CoverageMappingSize = 0; llvm::Type *CovDataHeaderTypes[] = { #define COVMAP_HEADER(Type, LLVMType, Name, Init) LLVMType, #include "llvm/ProfileData/InstrProfData.inc" +#undef COVMAP_HEADER }; - auto CovDataHeaderTy = + auto *CovDataHeaderTy = llvm::StructType::get(Ctx, makeArrayRef(CovDataHeaderTypes)); llvm::Constant *CovDataHeaderVals[] = { #define COVMAP_HEADER(Type, LLVMType, Name, Init) Init, #include "llvm/ProfileData/InstrProfData.inc" +#undef COVMAP_HEADER }; - auto CovDataHeaderVal = llvm::ConstantStruct::get( + auto *CovDataHeaderVal = llvm::ConstantStruct::get( CovDataHeaderTy, makeArrayRef(CovDataHeaderVals)); - // Create the coverage data record - llvm::Type *CovDataTypes[] = {CovDataHeaderTy, FilenamesVal->getType()}; - auto CovDataTy = llvm::StructType::get(Ctx, makeArrayRef(CovDataTypes)); - llvm::Constant *TUDataVals[] = {CovDataHeaderVal, FilenamesVal}; - auto CovDataVal = + // Combine the header, function records, and mappings together. + llvm::Type *CovDataTypes[] = {CovDataHeaderTy, RecordsTy, + FilenamesAndMappingsVal->getType()}; + auto *CovDataTy = llvm::StructType::get(Ctx, makeArrayRef(CovDataTypes)); + llvm::Constant *TUDataVals[] = {CovDataHeaderVal, RecordsVal, + FilenamesAndMappingsVal}; + auto *CovDataVal = llvm::ConstantStruct::get(CovDataTy, makeArrayRef(TUDataVals)); + auto CovData = new llvm::GlobalVariable( - *getModule(), CovDataTy, true, llvm::GlobalValue::PrivateLinkage, + *getModule(), CovDataTy, true, llvm::GlobalValue::InternalLinkage, CovDataVal, llvm::getCoverageMappingVarName()); - - CovData->setSection(getInstrProfSection(*this, llvm::IPSK_covmap)); - CovData->setAlignment(llvm::Align(8)); + std::string CovSection = getCoverageSection(*this); + CovData->setSection(CovSection); + CovData->setAlignment(llvm::MaybeAlign(8)); addUsedGlobal(CovData); } diff --git a/lib/IRGen/GenDecl.cpp b/lib/IRGen/GenDecl.cpp index 4fa9388680584..7e6710311b798 100644 --- a/lib/IRGen/GenDecl.cpp +++ b/lib/IRGen/GenDecl.cpp @@ -4463,7 +4463,7 @@ Address IRGenFunction::createAlloca(llvm::Type *type, llvm::AllocaInst *alloca = new llvm::AllocaInst(type, IGM.DataLayout.getAllocaAddrSpace(), name, AllocaIP); - alloca->setAlignment(llvm::MaybeAlign(alignment.getValue()).valueOrOne()); + alloca->setAlignment(llvm::MaybeAlign(alignment.getValue())); return Address(alloca, alignment); } @@ -4474,7 +4474,7 @@ Address IRGenFunction::createAlloca(llvm::Type *type, const llvm::Twine &name) { llvm::AllocaInst *alloca = new llvm::AllocaInst( type, IGM.DataLayout.getAllocaAddrSpace(), ArraySize, - llvm::MaybeAlign(alignment.getValue()).valueOrOne(), name, AllocaIP); + llvm::MaybeAlign(alignment.getValue()), name, AllocaIP); return Address(alloca, alignment); } diff --git a/lib/IRGen/GenEnum.cpp b/lib/IRGen/GenEnum.cpp index a2666b7fad980..dad7aaf4a0381 100644 --- a/lib/IRGen/GenEnum.cpp +++ b/lib/IRGen/GenEnum.cpp @@ -110,7 +110,6 @@ #include "swift/AST/LazyResolver.h" #include "swift/IRGen/Linking.h" #include "swift/SIL/SILModule.h" -#include "llvm/IR/CFG.h" #include "llvm/IR/Function.h" #include "llvm/IR/GlobalVariable.h" #include "llvm/Analysis/CFG.h" diff --git a/lib/IRGen/GenOpaque.cpp b/lib/IRGen/GenOpaque.cpp index 87052fb758e04..a6a328f273aa4 100644 --- a/lib/IRGen/GenOpaque.cpp +++ b/lib/IRGen/GenOpaque.cpp @@ -575,7 +575,7 @@ StackAddress IRGenFunction::emitDynamicAlloca(llvm::Type *eltTy, // Emit the dynamic alloca. auto *alloca = Builder.IRBuilderBase::CreateAlloca(eltTy, arraySize, name); - alloca->setAlignment(llvm::MaybeAlign(align.getValue()).valueOrOne()); + alloca->setAlignment(llvm::MaybeAlign(align.getValue())); assert(!isInEntryBlock || getActiveDominancePoint().isUniversal() && diff --git a/lib/IRGen/IRBuilder.h b/lib/IRGen/IRBuilder.h index 4eaa167b26f49..69ecb3de278bb 100644 --- a/lib/IRGen/IRBuilder.h +++ b/lib/IRGen/IRBuilder.h @@ -125,7 +125,7 @@ class IRBuilder : public IRBuilderBase { llvm::LoadInst *CreateLoad(llvm::Value *addr, Alignment align, const llvm::Twine &name = "") { llvm::LoadInst *load = IRBuilderBase::CreateLoad(addr, name); - load->setAlignment(llvm::MaybeAlign(align.getValue()).valueOrOne()); + load->setAlignment(llvm::MaybeAlign(align.getValue())); return load; } llvm::LoadInst *CreateLoad(Address addr, const llvm::Twine &name = "") { @@ -135,7 +135,7 @@ class IRBuilder : public IRBuilderBase { llvm::StoreInst *CreateStore(llvm::Value *value, llvm::Value *addr, Alignment align) { llvm::StoreInst *store = IRBuilderBase::CreateStore(value, addr); - store->setAlignment(llvm::MaybeAlign(align.getValue()).valueOrOne()); + store->setAlignment(llvm::MaybeAlign(align.getValue())); return store; } llvm::StoreInst *CreateStore(llvm::Value *value, Address addr) { diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 50a59480c1e79..41a640f3e96c3 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -672,7 +672,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { return M; } - using ASTSourceDescriptor = clang::ASTSourceDescriptor; + using ASTSourceDescriptor = clang::ExternalASTSource::ASTSourceDescriptor; /// Create a DIModule from a clang module or PCH. /// The clang::Module pointer is passed separately because the recursive case /// needs to fudge the AST descriptor. @@ -1020,8 +1020,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { SmallVector TemplateParams; for (auto Param : BGT->getGenericArgs()) { TemplateParams.push_back(DBuilder.createTemplateTypeParameter( - TheCU, "", getOrCreateType(DebugTypeInfo::getForwardDecl(Param)), - false)); + TheCU, "", getOrCreateType(DebugTypeInfo::getForwardDecl(Param)))); } return DBuilder.getOrCreateArray(TemplateParams); } diff --git a/lib/IRGen/LocalTypeDataKind.h b/lib/IRGen/LocalTypeDataKind.h index 1f8215f60eab5..f45aa30cb1755 100644 --- a/lib/IRGen/LocalTypeDataKind.h +++ b/lib/IRGen/LocalTypeDataKind.h @@ -211,8 +211,8 @@ template <> struct DenseMapInfo { swift::irgen::LocalTypeDataKind::forFormalTypeMetadata() }; } static unsigned getHashValue(const LocalTypeDataKey &key) { - return detail::combineHashValue(CanTypeInfo::getHashValue(key.Type), - key.Kind.getRawValue()); + return combineHashValue(CanTypeInfo::getHashValue(key.Type), + key.Kind.getRawValue()); } static bool isEqual(const LocalTypeDataKey &a, const LocalTypeDataKey &b) { return a == b; diff --git a/lib/IRGen/TypeLayout.h b/lib/IRGen/TypeLayout.h index 2f6a163011a55..a6fa9d7858527 100644 --- a/lib/IRGen/TypeLayout.h +++ b/lib/IRGen/TypeLayout.h @@ -16,7 +16,6 @@ #include "TypeInfo.h" #include "swift/SIL/SILType.h" #include "llvm/ADT/FoldingSet.h" -#include "llvm/Support/Debug.h" namespace swift { namespace irgen { diff --git a/lib/Immediate/Immediate.cpp b/lib/Immediate/Immediate.cpp index 3ee13bfd31e3a..2728b1898e8ac 100644 --- a/lib/Immediate/Immediate.cpp +++ b/lib/Immediate/Immediate.cpp @@ -305,7 +305,7 @@ int swift::RunImmediately(CompilerInstance &CI, using MainFnTy = int(*)(int, char*[]); LLVM_DEBUG(llvm::dbgs() << "Running static constructors\n"); - if (auto Err = JIT->initialize(JIT->getMainJITDylib())) { + if (auto Err = JIT->runConstructors()) { llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), ""); return -1; } @@ -322,7 +322,7 @@ int swift::RunImmediately(CompilerInstance &CI, int Result = llvm::orc::runAsMain(JITMain, CmdLine); LLVM_DEBUG(llvm::dbgs() << "Running static destructors\n"); - if (auto Err = JIT->deinitialize(JIT->getMainJITDylib())) { + if (auto Err = JIT->runDestructors()) { logAllUnhandledErrors(std::move(Err), llvm::errs(), ""); return -1; } diff --git a/lib/PrintAsObjC/DeclAndTypePrinter.cpp b/lib/PrintAsObjC/DeclAndTypePrinter.cpp index 8c03ede87f821..468b0c002230f 100644 --- a/lib/PrintAsObjC/DeclAndTypePrinter.cpp +++ b/lib/PrintAsObjC/DeclAndTypePrinter.cpp @@ -32,7 +32,6 @@ #include "clang/AST/Decl.h" #include "clang/AST/DeclObjC.h" #include "clang/Basic/CharInfo.h" -#include "clang/Basic/SourceManager.h" using namespace swift; using namespace swift::objc_translation; diff --git a/lib/PrintAsObjC/ModuleContentsWriter.cpp b/lib/PrintAsObjC/ModuleContentsWriter.cpp index c9f72559cd56c..ba703f28937cc 100644 --- a/lib/PrintAsObjC/ModuleContentsWriter.cpp +++ b/lib/PrintAsObjC/ModuleContentsWriter.cpp @@ -22,7 +22,6 @@ #include "swift/ClangImporter/ClangImporter.h" #include "clang/AST/Decl.h" -#include "clang/Basic/Module.h" #include "llvm/Support/raw_ostream.h" diff --git a/lib/SILOptimizer/IPO/GlobalOpt.cpp b/lib/SILOptimizer/IPO/GlobalOpt.cpp index 17b8613935cee..4c5178eba7f3d 100644 --- a/lib/SILOptimizer/IPO/GlobalOpt.cpp +++ b/lib/SILOptimizer/IPO/GlobalOpt.cpp @@ -301,7 +301,7 @@ bool SILGlobalOpt::isInLoop(SILBasicBlock *CurBB) { if (LoopCheckedFunctions.insert(F).second) { for (auto I = scc_begin(F); !I.isAtEnd(); ++I) { - if (I.hasCycle()) + if (I.hasLoop()) for (SILBasicBlock *BB : *I) LoopBlocks.insert(BB); } diff --git a/lib/SILOptimizer/Transforms/AccessEnforcementOpts.cpp b/lib/SILOptimizer/Transforms/AccessEnforcementOpts.cpp index bf6e4a5f0743c..8aadfb4ce1f93 100644 --- a/lib/SILOptimizer/Transforms/AccessEnforcementOpts.cpp +++ b/lib/SILOptimizer/Transforms/AccessEnforcementOpts.cpp @@ -1020,7 +1020,7 @@ static bool mergeAccesses( info.id = 0; for (auto sccIt = scc_begin(F); !sccIt.isAtEnd(); ++sccIt) { ++info.id; - info.hasLoop = sccIt.hasCycle(); + info.hasLoop = sccIt.hasLoop(); for (auto *bb : *sccIt) { blockToSCCMap.insert(std::make_pair(bb, info)); } diff --git a/lib/Sema/CSSolver.cpp b/lib/Sema/CSSolver.cpp index b2519d2ec0747..df67727623fa2 100644 --- a/lib/Sema/CSSolver.cpp +++ b/lib/Sema/CSSolver.cpp @@ -436,11 +436,11 @@ ConstraintSystem::SolverState::~SolverState() { // Update the "largest" statistics if this system is larger than the // previous one. // FIXME: This is not at all thread-safe. - if (NumStatesExplored > LargestNumStatesExplored.getValue()) { - LargestSolutionAttemptNumber = SolutionAttempt-1; + if (NumStatesExplored > LargestNumStatesExplored.Value) { + LargestSolutionAttemptNumber.Value = SolutionAttempt-1; ++LargestSolutionAttemptNumber; #define CS_STATISTIC(Name, Description) \ - JOIN2(Largest,Name) = Name-1; \ + JOIN2(Largest,Name).Value = Name-1; \ ++JOIN2(Largest,Name); #include "ConstraintSolverStats.def" } diff --git a/lib/Serialization/ModuleFile.cpp b/lib/Serialization/ModuleFile.cpp index e9e789fcf69da..524c264c0406f 100644 --- a/lib/Serialization/ModuleFile.cpp +++ b/lib/Serialization/ModuleFile.cpp @@ -954,7 +954,7 @@ class ModuleFile::DerivativeFunctionConfigTableInfo { while (data < limit) { DeclID genSigId = endian::readNext(data); int32_t nameLength = endian::readNext(data); - std::string mangledName(reinterpret_cast(data), nameLength); + StringRef mangledName(reinterpret_cast(data), nameLength); data += nameLength; result.push_back({mangledName, genSigId}); } diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index 21c3bf40f5fa6..deabf9ed2e215 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -5138,7 +5138,7 @@ void Serializer::writeAST(ModuleOrSourceFile DC) { DerivativeFunctionConfigTable derivativeConfigs; for (auto entry : uniquedDerivativeConfigs) { for (auto config : entry.second) { - std::string paramIndices = config.first.str().str(); + auto paramIndices = config.first.str(); auto genSigID = addGenericSignatureRef(config.second); derivativeConfigs[entry.first].push_back({paramIndices, genSigID}); } diff --git a/lib/Serialization/SerializedModuleLoader.cpp b/lib/Serialization/SerializedModuleLoader.cpp index 86261e3cc7b70..6a8c3be82b06b 100644 --- a/lib/Serialization/SerializedModuleLoader.cpp +++ b/lib/Serialization/SerializedModuleLoader.cpp @@ -21,14 +21,13 @@ #include "swift/Basic/STLExtras.h" #include "swift/Basic/SourceManager.h" #include "swift/Basic/Version.h" - #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringSet.h" -#include "llvm/Support/Debug.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Host.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" +#include "llvm/Support/Debug.h" #include using namespace swift; diff --git a/test/DebugInfo/Inputs/Macro.h b/test/DebugInfo/Inputs/Macro.h index 7cba01337adde..5f43bbf5641a6 100644 --- a/test/DebugInfo/Inputs/Macro.h +++ b/test/DebugInfo/Inputs/Macro.h @@ -1,12 +1,6 @@ -#ifdef __cplusplus #define MY_ENUM(NAME) \ + enum NAME : int NAME; \ enum NAME : int -#else -#define MY_ENUM(NAME) \ - enum NAME : int; \ - typedef enum NAME NAME; \ - enum NAME : int -#endif MY_ENUM(macro_enum) { zero = 0 diff --git a/test/DebugInfo/inlinescopes.swift b/test/DebugInfo/inlinescopes.swift index 4b40340d49a28..6c4a3a4fefc3d 100644 --- a/test/DebugInfo/inlinescopes.swift +++ b/test/DebugInfo/inlinescopes.swift @@ -6,17 +6,13 @@ // RUN: %FileCheck %s -check-prefix=TRANSPARENT-CHECK < %t.ll // CHECK: define{{( dllexport)?}}{{( protected)?( signext)?}} i32 @main{{.*}} -// CHECK: call swiftcc i64 @"$s4main8noinlineys5Int64VADF"(i64 %{{.*}}) -// CHECK-SAME: !dbg ![[CALL:.*]] +// CHECK: call swiftcc i64 @"$s4main8noinlineys5Int64VADF"(i64 %{{.*}}), !dbg ![[CALL:.*]] // CHECK-DAG: ![[TOPLEVEL:.*]] = !DIFile(filename: "{{.*}}inlinescopes.swift" import FooBar @inline(never) -func use(_ x: Int64) -> Int64 { return x } - -@inline(never) -func noinline(_ x: Int64) -> Int64 { return use(x) } +func noinline(_ x: Int64) -> Int64 { return x } @_transparent func transparent(_ x: Int64) -> Int64 { return noinline(x) } diff --git a/test/DebugInfo/modulecache.swift b/test/DebugInfo/modulecache.swift index f3bb46b58f200..c4eb24e70c66c 100644 --- a/test/DebugInfo/modulecache.swift +++ b/test/DebugInfo/modulecache.swift @@ -16,7 +16,7 @@ import ClangModule // RUN: %empty-directory(%t) // RUN: %target-swift-frontend %s -c -g -o %t.o -module-cache-path %t -I %S/Inputs // RUN: llvm-readobj -h %t/*/ClangModule-*.pcm | %FileCheck %s -// CHECK: Format: {{(Mach-O|ELF|elf64|COFF)}} +// CHECK: Format: {{(Mach-O|ELF|COFF)}} // 3. Test that swift-ide-check will not share swiftc's module cache. diff --git a/test/DebugInfo/top_level_code.swift b/test/DebugInfo/top_level_code.swift index 6693d78863fb4..790f5dffbdf84 100644 --- a/test/DebugInfo/top_level_code.swift +++ b/test/DebugInfo/top_level_code.swift @@ -2,7 +2,7 @@ func markUsed(_ t: T) {} // CHECK: {{_?}}main: -// CHECK: Lfunc_begin0: +// CHECK-NEXT: Lfunc_begin0: // Verify that the top-level function (main) begins at line 0 and then // proceeds to the first line. // CHECK: .loc {{[0-9]}} 0 {{[0-9]}} diff --git a/test/DebugInfo/transparent.swift b/test/DebugInfo/transparent.swift index b951b4a19e012..5bfd301c65ca6 100644 --- a/test/DebugInfo/transparent.swift +++ b/test/DebugInfo/transparent.swift @@ -19,6 +19,7 @@ use(z) // CHECK-SAME: !dbg ![[SP:[0-9]+]] // CHECK-NEXT: entry: // CHECK-NEXT: !dbg ![[ZERO:[0-9]+]] +// CHECK-NEXT: !dbg ![[ZERO]] // CHECK-NEXT: } // CHECK: ![[FILE:[0-9]+]] = {{.*}}"" diff --git a/test/Driver/bad_tmpdir.swift b/test/Driver/bad_tmpdir.swift index 50be890aee355..bf0565ef89439 100644 --- a/test/Driver/bad_tmpdir.swift +++ b/test/Driver/bad_tmpdir.swift @@ -6,9 +6,6 @@ // // REQUIRES: OS=macosx -// SR-12362: This test is failing on master-next. -// XFAIL: * - // RUN: env TMP="%t/fake/" TMPDIR="%t/fake/" not %target-build-swift -c -driver-filelist-threshold=0 %s 2>&1 | %FileCheck -check-prefix=CHECK-SOURCES %s // CHECK-SOURCES: - unable to create list of input sources diff --git a/test/IRGen/pic.swift b/test/IRGen/pic.swift index 6f7b9a8eaf1c3..8afc50ec49846 100644 --- a/test/IRGen/pic.swift +++ b/test/IRGen/pic.swift @@ -3,7 +3,6 @@ // SR-12194 // XFAIL: OS=linux-android, CPU=aarch64 -// UNSUPPORTED: OS=linux-gnu // RUN: %target-swift-frontend %s -module-name main -S -o - | %FileCheck -check-prefix=%target-cpu -check-prefix=%target-cpu-%target-sdk-name %s diff --git a/test/Serialization/load-target-normalization.swift b/test/Serialization/load-target-normalization.swift index 6dbc31841fd78..e1120d75ac3ff 100644 --- a/test/Serialization/load-target-normalization.swift +++ b/test/Serialization/load-target-normalization.swift @@ -1,9 +1,6 @@ // RUN: %empty-directory(%t/ForeignModule.swiftmodule) // RUN: touch %t/ForeignModule.swiftmodule/garbage-garbage-garbage.swiftmodule -// SR-12363: This test crashes on master-next. -// XFAIL: * - // Test format: We try to import ForeignModule with architectures besides // garbage-garbage-garbage and check the target triple listed in the error // message to make sure it was normalized correctly. This works in lieu of a diff --git a/test/SourceKit/CursorInfo/use-swift-source-info.swift b/test/SourceKit/CursorInfo/use-swift-source-info.swift index 05a391ee5c8b6..7f905f4cf52ca 100644 --- a/test/SourceKit/CursorInfo/use-swift-source-info.swift +++ b/test/SourceKit/CursorInfo/use-swift-source-info.swift @@ -3,9 +3,6 @@ func bar() { foo() } -// FIXME: Rmove REQUIRES rdar://problem/60096971 -// REQUIRES: rdar60096971 - // RUN: %empty-directory(%t) // RUN: echo "/// Some doc" >> %t/Foo.swift // RUN: echo "public func foo() { }" >> %t/Foo.swift diff --git a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp index a6eb8ca6fcbe1..8fea7e661c542 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp @@ -270,7 +270,7 @@ SwiftLangSupport::SwiftLangSupport(SourceKit::Context &SKCtx) llvm::SmallString<128> LibPath(SKCtx.getRuntimeLibPath()); llvm::sys::path::append(LibPath, "swift"); RuntimeResourcePath = std::string(LibPath.str()); - DiagnosticDocumentationPath = SKCtx.getDiagnosticDocumentationPath().str(); + DiagnosticDocumentationPath = SKCtx.getDiagnosticDocumentationPath(); Stats = std::make_shared(); EditorDocuments = std::make_shared(); diff --git a/tools/swift-api-digester/swift-api-digester.cpp b/tools/swift-api-digester/swift-api-digester.cpp index 5128ca659fa84..b8ab15e72a9d2 100644 --- a/tools/swift-api-digester/swift-api-digester.cpp +++ b/tools/swift-api-digester/swift-api-digester.cpp @@ -2803,7 +2803,7 @@ static std::string getJsonOutputFilePath(llvm::Triple Triple, bool ABI) { exit(1); } llvm::sys::path::append(OutputPath, getBaselineFilename(Triple)); - return OutputPath.str().str(); + return OutputPath.str(); } llvm::errs() << "Unable to decide output file path\n"; exit(1); diff --git a/tools/swift-llvm-opt/LLVMOpt.cpp b/tools/swift-llvm-opt/LLVMOpt.cpp index bd01da64bda25..a1db84b4edc35 100644 --- a/tools/swift-llvm-opt/LLVMOpt.cpp +++ b/tools/swift-llvm-opt/LLVMOpt.cpp @@ -36,7 +36,7 @@ #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Bitcode/BitcodeWriterPass.h" -#include "llvm/CodeGen/CommandFlags.h" +#include "llvm/CodeGen/CommandFlags.inc" #include "llvm/CodeGen/TargetPassConfig.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/DebugInfo.h" @@ -68,8 +68,6 @@ using namespace swift; -static llvm::codegen::RegisterCodeGenFlags CGF; - //===----------------------------------------------------------------------===// // Option Declarations //===----------------------------------------------------------------------===// @@ -98,19 +96,19 @@ static llvm::cl::opt PrintStats("print-stats", llvm::cl::desc("Should LLVM Statistics be printed")); -static llvm::cl::opt InputFilename(llvm::cl::Positional, - llvm::cl::desc(""), - llvm::cl::init("-"), - llvm::cl::value_desc("filename")); +static cl::opt InputFilename(cl::Positional, + cl::desc(""), + cl::init("-"), + cl::value_desc("filename")); -static llvm::cl::opt - OutputFilename("o", llvm::cl::desc("Override output filename"), - llvm::cl::value_desc("filename")); +static cl::opt OutputFilename("o", + cl::desc("Override output filename"), + cl::value_desc("filename")); -static llvm::cl::opt DefaultDataLayout( +static cl::opt DefaultDataLayout( "default-data-layout", - llvm::cl::desc("data layout string to use if not specified by module"), - llvm::cl::value_desc("layout-string"), llvm::cl::init("")); + cl::desc("data layout string to use if not specified by module"), + cl::value_desc("layout-string"), cl::init("")); //===----------------------------------------------------------------------===// // Helper Methods @@ -119,8 +117,8 @@ static llvm::cl::opt DefaultDataLayout( static llvm::CodeGenOpt::Level GetCodeGenOptLevel() { // TODO: Is this the right thing to do here? if (Optimized) - return llvm::CodeGenOpt::Default; - return llvm::CodeGenOpt::None; + return CodeGenOpt::Default; + return CodeGenOpt::None; } // Returns the TargetMachine instance or zero if no triple is provided. @@ -128,8 +126,8 @@ static llvm::TargetMachine * getTargetMachine(llvm::Triple TheTriple, StringRef CPUStr, StringRef FeaturesStr, const llvm::TargetOptions &Options) { std::string Error; - const auto *TheTarget = llvm::TargetRegistry::lookupTarget( - llvm::codegen::getMArch(), TheTriple, Error); + const auto *TheTarget = + llvm::TargetRegistry::lookupTarget(MArch, TheTriple, Error); // Some modules don't specify a triple, and this is okay. if (!TheTarget) { return nullptr; @@ -137,13 +135,12 @@ getTargetMachine(llvm::Triple TheTriple, StringRef CPUStr, return TheTarget->createTargetMachine( TheTriple.getTriple(), CPUStr, FeaturesStr, Options, - Optional(llvm::codegen::getExplicitRelocModel()), - llvm::codegen::getExplicitCodeModel(), GetCodeGenOptLevel()); + Optional(RelocModel), getCodeModel(), GetCodeGenOptLevel()); } static void dumpOutput(llvm::Module &M, llvm::raw_ostream &os) { // For now just always dump assembly. - llvm::legacy::PassManager EmitPasses; + legacy::PassManager EmitPasses; EmitPasses.add(createPrintModulePass(os)); EmitPasses.run(M); } @@ -155,12 +152,11 @@ static void dumpOutput(llvm::Module &M, llvm::raw_ostream &os) { // without being given the address of a function in the main executable). void anchorForGetMainExecutable() {} -static inline void addPass(llvm::legacy::PassManagerBase &PM, llvm::Pass *P) { +static inline void addPass(legacy::PassManagerBase &PM, Pass *P) { // Add the pass to the pass manager... PM.add(P); if (P->getPassID() == &SwiftAAWrapperPass::ID) { - PM.add(llvm::createExternalAAWrapperPass([](llvm::Pass &P, llvm::Function &, - llvm::AAResults &AAR) { + PM.add(createExternalAAWrapperPass([](Pass &P, Function &, AAResults &AAR) { if (auto *WrapperPass = P.getAnalysisIfAvailable()) AAR.addAAResult(WrapperPass->getResult()); })); @@ -168,7 +164,7 @@ static inline void addPass(llvm::legacy::PassManagerBase &PM, llvm::Pass *P) { // If we are verifying all of the intermediate steps, add the verifier... if (VerifyEach) - PM.add(llvm::createVerifierPass()); + PM.add(createVerifierPass()); } static void runSpecificPasses(StringRef Binary, llvm::Module *M, @@ -176,7 +172,7 @@ static void runSpecificPasses(StringRef Binary, llvm::Module *M, llvm::Triple &ModuleTriple) { llvm::legacy::PassManager Passes; llvm::TargetLibraryInfoImpl TLII(ModuleTriple); - Passes.add(new llvm::TargetLibraryInfoWrapperPass(TLII)); + Passes.add(new TargetLibraryInfoWrapperPass(TLII)); const llvm::DataLayout &DL = M->getDataLayout(); if (DL.isDefault() && !DefaultDataLayout.empty()) { @@ -184,13 +180,13 @@ static void runSpecificPasses(StringRef Binary, llvm::Module *M, } // Add internal analysis passes from the target machine. - Passes.add(createTargetTransformInfoWrapperPass( - TM ? TM->getTargetIRAnalysis() : llvm::TargetIRAnalysis())); + Passes.add(createTargetTransformInfoWrapperPass(TM ? TM->getTargetIRAnalysis() + : TargetIRAnalysis())); if (TM) { // FIXME: We should dyn_cast this when supported. - auto <M = static_cast(*TM); - llvm::Pass *TPC = LTM.createPassConfig(Passes); + auto <M = static_cast(*TM); + Pass *TPC = LTM.createPassConfig(Passes); Passes.add(TPC); } @@ -199,9 +195,8 @@ static void runSpecificPasses(StringRef Binary, llvm::Module *M, if (PassInfo->getNormalCtor()) P = PassInfo->getNormalCtor()(); else - llvm::errs() << Binary - << ": cannot create pass: " << PassInfo->getPassName() - << "\n"; + errs() << Binary << ": cannot create pass: " << PassInfo->getPassName() + << "\n"; if (P) { addPass(Passes, P); } @@ -220,7 +215,7 @@ int main(int argc, char **argv) { INITIALIZE_LLVM(); // Initialize passes - llvm::PassRegistry &Registry = *llvm::PassRegistry::getPassRegistry(); + PassRegistry &Registry = *PassRegistry::getPassRegistry(); initializeCore(Registry); initializeScalarOpts(Registry); initializeObjCARCOpts(Registry); @@ -257,16 +252,16 @@ int main(int argc, char **argv) { // Load the input module... auto LLVMContext = std::make_unique(); - std::unique_ptr M = + std::unique_ptr M = parseIRFile(InputFilename, Err, *LLVMContext.get()); if (!M) { - Err.print(argv[0], llvm::errs()); + Err.print(argv[0], errs()); return 1; } - if (verifyModule(*M, &llvm::errs())) { - llvm::errs() << argv[0] << ": " << InputFilename + if (verifyModule(*M, &errs())) { + errs() << argv[0] << ": " << InputFilename << ": error: input module is broken!\n"; return 1; } @@ -285,19 +280,18 @@ int main(int argc, char **argv) { Out.reset( new llvm::ToolOutputFile(OutputFilename, EC, llvm::sys::fs::F_None)); if (EC) { - llvm::errs() << EC.message() << '\n'; + errs() << EC.message() << '\n'; return 1; } llvm::Triple ModuleTriple(M->getTargetTriple()); std::string CPUStr, FeaturesStr; llvm::TargetMachine *Machine = nullptr; - const llvm::TargetOptions Options = - llvm::codegen::InitTargetOptionsFromCodeGenFlags(); + const llvm::TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); if (ModuleTriple.getArch()) { - CPUStr = llvm::codegen::getCPUStr(); - FeaturesStr = llvm::codegen::getFeaturesStr(); + CPUStr = getCPUStr(); + FeaturesStr = getFeaturesStr(); Machine = getTargetMachine(ModuleTriple, CPUStr, FeaturesStr, Options); } @@ -305,7 +299,7 @@ int main(int argc, char **argv) { // Override function attributes based on CPUStr, FeaturesStr, and command line // flags. - llvm::codegen::setFunctionAttributes(CPUStr, FeaturesStr, *M); + setFunctionAttributes(CPUStr, FeaturesStr, *M); if (Optimized) { IRGenOptions Opts; diff --git a/unittests/AST/TestContext.h b/unittests/AST/TestContext.h index 6736edef7dc0c..46aa8d985b62b 100644 --- a/unittests/AST/TestContext.h +++ b/unittests/AST/TestContext.h @@ -17,8 +17,6 @@ #include "swift/Basic/LangOptions.h" #include "swift/Basic/SourceManager.h" -#include "llvm/Support/Host.h" - namespace swift { namespace unittest { From e9622edd51b719890bbd94265cee47af4b7b01ed Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Mon, 8 Jun 2020 18:33:03 -0700 Subject: [PATCH 168/222] test: mark test as executable_test This should repair the android bots. --- test/Runtime/environment_variables.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/Runtime/environment_variables.swift b/test/Runtime/environment_variables.swift index 87aa398fe689a..c62a74c4b5e74 100644 --- a/test/Runtime/environment_variables.swift +++ b/test/Runtime/environment_variables.swift @@ -1,6 +1,9 @@ // 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 SWIFT_DEBUG_ variables will not be flagged.}} From 39d0827ec47cdf6fa06c18f5930fdb3971d63648 Mon Sep 17 00:00:00 2001 From: Richard Wei Date: Mon, 8 Jun 2020 19:25:58 -0700 Subject: [PATCH 169/222] Fix typo in 'KeyedEncodingContainer.superEncoder' documentation. (#32252) "returns A new encoder" -> "returns a new encoder" Resolves rdar://64136400. --- stdlib/public/core/Codable.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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. From 450b005c3c4a9a54b8464f7a6ed5e3a7dce07405 Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Mon, 8 Jun 2020 13:35:45 -0700 Subject: [PATCH 170/222] [build-script] Add support for specifying that a product is a non-darwin only product. We have a few of these like foundation, libdispatch, icu, xctest that are built outside of build-script on Darwin. --- .../swift_build_support/products/foundation.py | 4 ++++ .../swift_build_support/products/libdispatch.py | 4 ++++ .../swift_build_support/products/libicu.py | 4 ++++ .../swift_build_support/products/product.py | 7 +++++++ .../swift_build_support/products/xctest.py | 4 ++++ 5 files changed, 23 insertions(+) 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 e90c919726dc7..0533e406060c0 100644 --- a/utils/swift_build_support/swift_build_support/products/foundation.py +++ b/utils/swift_build_support/swift_build_support/products/foundation.py @@ -46,3 +46,7 @@ def get_dependencies(cls): swift.Swift, lldb.LLDB, libdispatch.LibDispatch] + + @classmethod + def is_nondarwin_only_build_product(cls): + return True 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 a6bc49ae67bdf..b6fe1fe9a2eea 100644 --- a/utils/swift_build_support/swift_build_support/products/libdispatch.py +++ b/utils/swift_build_support/swift_build_support/products/libdispatch.py @@ -36,6 +36,10 @@ def product_source_name(cls): """ return "swift-corelibs-libdispatch" + @classmethod + def is_nondarwin_only_build_product(cls): + return True + @classmethod def get_dependencies(cls): return [cmark.CMark, 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 2aaaada676fb6..39e1b60262f70 100644 --- a/utils/swift_build_support/swift_build_support/products/libicu.py +++ b/utils/swift_build_support/swift_build_support/products/libicu.py @@ -33,6 +33,10 @@ def product_source_name(cls): """ return "icu" + @classmethod + def is_nondarwin_only_build_product(cls): + return True + @classmethod def get_dependencies(cls): return [cmark.CMark, 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 abf70d85997cf..ed4c944bc008e 100644 --- a/utils/swift_build_support/swift_build_support/products/product.py +++ b/utils/swift_build_support/swift_build_support/products/product.py @@ -66,6 +66,13 @@ 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""" 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 c8d1f3623d46b..ce5f1080351ba 100644 --- a/utils/swift_build_support/swift_build_support/products/xctest.py +++ b/utils/swift_build_support/swift_build_support/products/xctest.py @@ -48,3 +48,7 @@ def get_dependencies(cls): lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation] + + @classmethod + def is_nondarwin_only_build_product(cls): + return True From 00146f8b1c02051bf0ce3d06c35d639f4b82d476 Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Mon, 8 Jun 2020 16:50:34 -0700 Subject: [PATCH 171/222] [build-script] Define default llvm_install_components. This is just based off of the defaults that we use on the buildbots as of this commit. In order to not break the bots as they are, I left the internal representation as a semicolon list of components. So this should be NFC from the perspective of the bots since they all explicitly specify llvm-install-components if needed (and we do not install without install-llvm anymore). --- utils/build-script | 5 +++++ utils/build_swift/build_swift/defaults.py | 14 ++++++++++++++ utils/build_swift/build_swift/driver_arguments.py | 4 ++++ utils/build_swift/tests/expected_options.py | 5 ++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/utils/build-script b/utils/build-script index c4541d74aa2a0..494c22893d4de 100755 --- a/utils/build-script +++ b/utils/build-script @@ -752,6 +752,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() 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..868be0ac4944e 100644 --- a/utils/build_swift/build_swift/driver_arguments.py +++ b/utils/build_swift/build_swift/driver_arguments.py @@ -497,6 +497,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') diff --git a/utils/build_swift/tests/expected_options.py b/utils/build_swift/tests/expected_options.py index 7da789ba0984b..168964feab6c2 100644 --- a/utils/build_swift/tests/expected_options.py +++ b/utils/build_swift/tests/expected_options.py @@ -236,7 +236,8 @@ 'validation_test': None, 'verbose_build': False, 'watchos': False, - 'watchos_all': False + 'watchos_all': False, + 'llvm_install_components': defaults.llvm_install_components(), } @@ -675,4 +676,6 @@ class BuildScriptImplOption(_BaseOption): IgnoreOption('--ios-all'), IgnoreOption('--tvos-all'), IgnoreOption('--watchos-all'), + + StrOption('--llvm-install-components'), ] From 49288f757db7b057cac09a5cbd744aa3d9848acd Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Mon, 8 Jun 2020 21:25:32 -0700 Subject: [PATCH 172/222] [build-script] Remove a bunch of conservative dependencies on lldb. I only didn't touch playground-support since I don't know if there are deps there or not. Everything else here though shouldn't need lldb to be built. --- .../swift_build_support/products/benchmarks.py | 2 -- .../swift_build_support/products/foundation.py | 2 -- .../swift_build_support/products/indexstoredb.py | 2 -- .../swift_build_support/products/libdispatch.py | 4 +--- .../swift_build_support/products/llbuild.py | 2 -- .../swift_build_support/products/pythonkit.py | 2 -- .../swift_build_support/products/skstresstester.py | 2 -- .../swift_build_support/products/sourcekitlsp.py | 2 -- .../swift_build_support/products/swiftevolve.py | 2 -- .../swift_build_support/products/swiftinspect.py | 2 -- .../swift_build_support/products/swiftpm.py | 2 -- .../swift_build_support/products/swiftsyntax.py | 2 -- .../swift_build_support/products/tensorflow.py | 2 -- .../swift_build_support/products/tsan_libdispatch.py | 2 -- .../swift_build_support/products/xctest.py | 2 -- 15 files changed, 1 insertion(+), 31 deletions(-) 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 fe42367c15215..cac1e241e4451 100644 --- a/utils/swift_build_support/swift_build_support/products/benchmarks.py +++ b/utils/swift_build_support/swift_build_support/products/benchmarks.py @@ -19,7 +19,6 @@ from . import libdispatch from . import libicu from . import llbuild -from . import lldb from . import llvm from . import product from . import swift @@ -75,7 +74,6 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation, xctest.XCTest, 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 e90c919726dc7..5029550ab5389 100644 --- a/utils/swift_build_support/swift_build_support/products/foundation.py +++ b/utils/swift_build_support/swift_build_support/products/foundation.py @@ -14,7 +14,6 @@ from . import libcxx from . import libdispatch from . import libicu -from . import lldb from . import llvm from . import product from . import swift @@ -44,5 +43,4 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch] 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 18f8371a2aba6..65d720c4889fa 100644 --- a/utils/swift_build_support/swift_build_support/products/indexstoredb.py +++ b/utils/swift_build_support/swift_build_support/products/indexstoredb.py @@ -18,7 +18,6 @@ from . import libdispatch from . import libicu from . import llbuild -from . import lldb from . import llvm from . import product from . import swift @@ -64,7 +63,6 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation, xctest.XCTest, 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 a6bc49ae67bdf..d0df8701bd700 100644 --- a/utils/swift_build_support/swift_build_support/products/libdispatch.py +++ b/utils/swift_build_support/swift_build_support/products/libdispatch.py @@ -13,7 +13,6 @@ from . import cmark from . import libcxx from . import libicu -from . import lldb from . import llvm from . import product from . import swift @@ -42,5 +41,4 @@ def get_dependencies(cls): llvm.LLVM, libcxx.LibCXX, libicu.LibICU, - swift.Swift, - lldb.LLDB] + swift.Swift] 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 35759f4b45a82..e723b03ecb199 100644 --- a/utils/swift_build_support/swift_build_support/products/llbuild.py +++ b/utils/swift_build_support/swift_build_support/products/llbuild.py @@ -15,7 +15,6 @@ from . import libcxx from . import libdispatch from . import libicu -from . import lldb from . import llvm from . import product from . import swift @@ -38,7 +37,6 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation, xctest.XCTest] 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 cae6d4b1969c3..05f5b72c5468d 100644 --- a/utils/swift_build_support/swift_build_support/products/pythonkit.py +++ b/utils/swift_build_support/swift_build_support/products/pythonkit.py @@ -18,7 +18,6 @@ from . import libdispatch from . import libicu from . import llbuild -from . import lldb from . import llvm from . import product from . import swift @@ -98,7 +97,6 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation, xctest.XCTest, 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 5ef366b9fed59..ae79373d99c7c 100644 --- a/utils/swift_build_support/swift_build_support/products/skstresstester.py +++ b/utils/swift_build_support/swift_build_support/products/skstresstester.py @@ -21,7 +21,6 @@ from . import libdispatch from . import libicu from . import llbuild -from . import lldb from . import llvm from . import product from . import swift @@ -109,7 +108,6 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation, xctest.XCTest, 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 2ea8873c49d81..aa3d22602aeac 100644 --- a/utils/swift_build_support/swift_build_support/products/sourcekitlsp.py +++ b/utils/swift_build_support/swift_build_support/products/sourcekitlsp.py @@ -17,7 +17,6 @@ from . import libdispatch from . import libicu from . import llbuild -from . import lldb from . import llvm from . import product from . import swift @@ -63,7 +62,6 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation, xctest.XCTest, 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 7eb6a511a09b7..efebc85e1b6f9 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftevolve.py +++ b/utils/swift_build_support/swift_build_support/products/swiftevolve.py @@ -16,7 +16,6 @@ from . import libdispatch from . import libicu from . import llbuild -from . import lldb from . import llvm from . import skstresstester from . import swift @@ -55,7 +54,6 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation, xctest.XCTest, 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 099e5fb50f349..b2c54190f1b1e 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftinspect.py +++ b/utils/swift_build_support/swift_build_support/products/swiftinspect.py @@ -19,7 +19,6 @@ from . import libdispatch from . import libicu from . import llbuild -from . import lldb from . import llvm from . import product from . import swift @@ -67,7 +66,6 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation, xctest.XCTest, 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 2d0d652282d79..48c18256629b5 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftpm.py +++ b/utils/swift_build_support/swift_build_support/products/swiftpm.py @@ -18,7 +18,6 @@ from . import libdispatch from . import libicu from . import llbuild -from . import lldb from . import llvm from . import product from . import swift @@ -111,7 +110,6 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation, xctest.XCTest, 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 8c2d3ccc04522..9dd6a8436b30f 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftsyntax.py +++ b/utils/swift_build_support/swift_build_support/products/swiftsyntax.py @@ -20,7 +20,6 @@ from . import libdispatch from . import libicu from . import llbuild -from . import lldb from . import llvm from . import product from . import swift @@ -110,7 +109,6 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation, xctest.XCTest, 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 85d604e18ba35..6c458156d6f9e 100644 --- a/utils/swift_build_support/swift_build_support/products/tensorflow.py +++ b/utils/swift_build_support/swift_build_support/products/tensorflow.py @@ -18,7 +18,6 @@ from . import libdispatch from . import libicu from . import llbuild -from . import lldb from . import llvm from . import product from . import swift @@ -98,7 +97,6 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation, xctest.XCTest, 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 0a9b0f3219496..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 @@ -18,7 +18,6 @@ from . import libdispatch from . import libicu from . import llbuild -from . import lldb from . import llvm from . import product from . import swift @@ -97,7 +96,6 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation, xctest.XCTest, 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 c8d1f3623d46b..96b8106ffed68 100644 --- a/utils/swift_build_support/swift_build_support/products/xctest.py +++ b/utils/swift_build_support/swift_build_support/products/xctest.py @@ -15,7 +15,6 @@ from . import libcxx from . import libdispatch from . import libicu -from . import lldb from . import llvm from . import product from . import swift @@ -45,6 +44,5 @@ def get_dependencies(cls): libcxx.LibCXX, libicu.LibICU, swift.Swift, - lldb.LLDB, libdispatch.LibDispatch, foundation.Foundation] From 4b4634141f13727e2ddadb4c4d85765a6dfc494c Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Sun, 7 Jun 2020 04:39:27 +0300 Subject: [PATCH 173/222] Sema: Remove TypeLoc from ExplicitCast --- include/swift/AST/ASTNode.h | 4 +- include/swift/AST/Expr.h | 125 ++++++++++----------- include/swift/AST/TypeAlignments.h | 6 +- include/swift/AST/TypeLoc.h | 2 +- include/swift/AST/TypeRepr.h | 2 +- lib/AST/ASTDumper.cpp | 20 ++-- lib/AST/ASTNode.cpp | 14 ++- lib/AST/ASTWalker.cpp | 5 +- lib/AST/Expr.cpp | 76 +++++++++++++ lib/ClangImporter/ImportDecl.cpp | 11 +- lib/Parse/ParseExpr.cpp | 11 +- lib/SILGen/SILGenExpr.cpp | 2 +- lib/Sema/CSApply.cpp | 84 +++++++------- lib/Sema/CSDiagnostics.cpp | 26 +++-- lib/Sema/CSFix.cpp | 9 +- lib/Sema/CSGen.cpp | 100 ++++++++--------- lib/Sema/CSSolver.cpp | 3 +- lib/Sema/ConstraintSystem.cpp | 2 +- lib/Sema/ConstraintSystem.h | 6 - lib/Sema/TypeCheckCaptures.cpp | 7 +- lib/Sema/TypeCheckConstraints.cpp | 39 ++++--- lib/Sema/TypeCheckPattern.cpp | 8 +- lib/Sema/TypeCheckStorage.cpp | 17 +-- lib/Sema/TypeCheckType.cpp | 2 +- test/Sema/diag_erroneous_iuo.swift | 2 +- test/decl/class/circular_inheritance.swift | 5 - 26 files changed, 322 insertions(+), 266 deletions(-) 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/Expr.h b/include/swift/AST/Expr.h index 9168f0583e618..de66fc660c374 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; @@ -4591,23 +4590,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; } @@ -4623,7 +4621,7 @@ class ExplicitCastExpr : public Expr { } SourceRange getSourceRange() const { - SourceRange castTyRange = CastTy.getSourceRange(); + const SourceRange castTyRange = CastTy->getSourceRange(); if (castTyRange.isInvalid()) return SubExpr->getSourceRange(); @@ -4648,14 +4646,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); @@ -4679,22 +4676,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; } @@ -4708,21 +4703,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; } @@ -4737,16 +4735,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; } @@ -4755,35 +4750,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/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/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/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index af02d2e0d37c9..4dcd5fd124c6d 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -1775,18 +1775,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) { @@ -2605,7 +2605,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) << ')'; @@ -2870,21 +2873,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/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/ASTWalker.cpp b/lib/AST/ASTWalker.cpp index e3340143015ec..8e6d28cf0611f 100644 --- a/lib/AST/ASTWalker.cpp +++ b/lib/AST/ASTWalker.cpp @@ -898,8 +898,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; } diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 79ea2455f9eb0..38779a41c53dd 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, diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index 748c2df1e73c3..3faea71bd4329 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. diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index 3922c9e2d1569..b197027454c3d 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); } diff --git a/lib/SILGen/SILGenExpr.cpp b/lib/SILGen/SILGenExpr.cpp index a64ad886888f0..fa63d28d0b0fd 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); } diff --git a/lib/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp index 78232a90851c2..f70ad877449eb 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,11 +3847,11 @@ 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. @@ -3871,7 +3870,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 +3933,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 +3964,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 +4010,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 +4053,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); diff --git a/lib/Sema/CSDiagnostics.cpp b/lib/Sema/CSDiagnostics.cpp index b704deb84fa24..a5043325feabc 100644 --- a/lib/Sema/CSDiagnostics.cpp +++ b/lib/Sema/CSDiagnostics.cpp @@ -2356,8 +2356,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); @@ -5115,7 +5115,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); @@ -5213,15 +5213,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 { @@ -5276,7 +5278,7 @@ bool MissingGenericArgumentsFailure::findArgumentLocations( } associator(Parameters, callback); - typeLoc.getTypeRepr()->walk(associator); + typeRepr->walk(associator); return associator.allParamsAssigned(); } diff --git a/lib/Sema/CSFix.cpp b/lib/Sema/CSFix.cpp index 7e68315383a1f..7df9e089aba8d 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) diff --git a/lib/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index f87d0fc5c686c..8bbd5b8111599 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -1477,13 +1477,15 @@ namespace { diag::super_with_no_base_class); } - Type resolveTypeReferenceInExpression(TypeRepr *repr) { + Type resolveTypeReferenceInExpression(TypeRepr *repr, + TypeResolverContext resCtx) { TypeLoc loc(repr); - return resolveTypeReferenceInExpression(loc); + return resolveTypeReferenceInExpression(loc, resCtx); } - Type resolveTypeReferenceInExpression(TypeLoc &loc) { - TypeResolutionOptions options(TypeResolverContext::InExpression); + Type resolveTypeReferenceInExpression(TypeLoc &loc, + TypeResolverContext resCtx) { + TypeResolutionOptions options(resCtx); options |= TypeResolutionFlags::AllowUnboundGenerics; bool hadError = TypeChecker::validateType( loc, TypeResolution::forContextual(CS.DC, options)); @@ -1499,7 +1501,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(); @@ -2220,7 +2223,9 @@ namespace { return declaredTy; } - return resolveTypeReferenceInExpression(closure->getExplicitResultTypeRepr()); + return resolveTypeReferenceInExpression( + closure->getExplicitResultTypeRepr(), + TypeResolverContext::InExpression); }; Type resultTy; @@ -2516,8 +2521,8 @@ namespace { case PatternKind::Is: { auto isPattern = cast(pattern); - Type castType = - resolveTypeReferenceInExpression(isPattern->getCastTypeLoc()); + Type castType = resolveTypeReferenceInExpression( + isPattern->getCastTypeLoc(), TypeResolverContext::InExpression); if (!castType) return Type(); @@ -2566,8 +2571,8 @@ namespace { FunctionRefKind functionRefKind = FunctionRefKind::Compound; if (!enumPattern->getParentType().isNull()) { // Resolve the parent type. - Type parentType = - resolveTypeReferenceInExpression(enumPattern->getParentType()); + Type parentType = resolveTypeReferenceInExpression( + enumPattern->getParentType(), TypeResolverContext::InExpression); if (!parentType) return Type(); @@ -3056,18 +3061,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); @@ -3077,8 +3081,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; @@ -3086,17 +3089,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); @@ -3108,8 +3110,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; @@ -3121,17 +3122,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); @@ -3140,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( OptionalType::get(toType), locator); @@ -3151,18 +3150,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()); @@ -3366,7 +3364,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); @@ -3436,7 +3435,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); diff --git a/lib/Sema/CSSolver.cpp b/lib/Sema/CSSolver.cpp index cf30977daf891..121ebf95703c1 100644 --- a/lib/Sema/CSSolver.cpp +++ b/lib/Sema/CSSolver.cpp @@ -987,8 +987,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); diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index 40ad7edae7db1..12d60cdf84f3f 100644 --- a/lib/Sema/ConstraintSystem.cpp +++ b/lib/Sema/ConstraintSystem.cpp @@ -4524,7 +4524,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 60cf395ea1fda..05d0d5ceedf4d 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -2506,16 +2506,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 +2534,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; 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 8d3a82dbe8251..fee3f565e07e3 100644 --- a/lib/Sema/TypeCheckConstraints.cpp +++ b/lib/Sema/TypeCheckConstraints.cpp @@ -1916,34 +1916,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; } @@ -3032,9 +3035,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 { @@ -3043,7 +3046,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 { @@ -3229,6 +3232,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(); @@ -3253,9 +3261,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; diff --git a/lib/Sema/TypeCheckPattern.cpp b/lib/Sema/TypeCheckPattern.cpp index d74a4841258bf..2dca6ae545e11 100644 --- a/lib/Sema/TypeCheckPattern.cpp +++ b/lib/Sema/TypeCheckPattern.cpp @@ -360,10 +360,11 @@ class ResolvePattern : public ASTVisitor(E->getElement(1)); if (!cast) return nullptr; - + + const auto tyLoc = TypeLoc(cast->getCastTypeRepr(), cast->getCastType()); Pattern *subPattern = getSubExprPattern(E->getElement(0)); - return new (Context) IsPattern(cast->getLoc(), cast->getCastTypeLoc(), - subPattern, CheckedCastKind::Unresolved); + return new (Context) IsPattern(cast->getLoc(), tyLoc, subPattern, + CheckedCastKind::Unresolved); } // Convert a paren expr to a pattern if it contains a pattern. @@ -1253,7 +1254,6 @@ Pattern *TypeChecker::coercePatternToType(ContextualPattern pattern, pattern.forSubPattern(P, /*retainTopLevle=*/true), type, options); } - CheckedCastKind castKind = TypeChecker::typeCheckCheckedCast(type, IP->getCastTypeLoc().getType(), type->hasError() diff --git a/lib/Sema/TypeCheckStorage.cpp b/lib/Sema/TypeCheckStorage.cpp index c5c195b581eca..387adabb0e45b 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); diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp index 9bc5d3f264acd..5c9dca1d9c7ef 100644 --- a/lib/Sema/TypeCheckType.cpp +++ b/lib/Sema/TypeCheckType.cpp @@ -3394,7 +3394,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(), 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/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}} From 6c46118cfdf3368c167133320dbafc645065964b Mon Sep 17 00:00:00 2001 From: David Zarzycki Date: Tue, 9 Jun 2020 10:51:03 -0400 Subject: [PATCH 174/222] [SIL] NFC: "Stop being a sop" --- lib/SIL/IR/SILGlobalVariable.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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); From c73b144ad8b55f2c9ce1e57bf880a1bcbe643fe8 Mon Sep 17 00:00:00 2001 From: Greg Titus Date: Tue, 9 Jun 2020 09:02:42 -0700 Subject: [PATCH 175/222] Perform the unintended generic detection in simplifyMemberConstraint and define a ConstraintFix to produce the new note. --- lib/Sema/CSDiagnostics.cpp | 75 ++++++++++++-------------------------- lib/Sema/CSDiagnostics.h | 20 ++++++++-- lib/Sema/CSFix.cpp | 17 +++++++++ lib/Sema/CSFix.h | 27 ++++++++++++++ lib/Sema/CSSimplify.cpp | 51 +++++++++++++++++++++++++- 5 files changed, 135 insertions(+), 55 deletions(-) diff --git a/lib/Sema/CSDiagnostics.cpp b/lib/Sema/CSDiagnostics.cpp index cf13c12753ccf..7afef86a094e0 100644 --- a/lib/Sema/CSDiagnostics.cpp +++ b/lib/Sema/CSDiagnostics.cpp @@ -31,8 +31,6 @@ #include "swift/AST/SourceFile.h" #include "swift/AST/Stmt.h" #include "swift/AST/Types.h" -#include "swift/AST/GenericEnvironment.h" -#include "swift/AST/NameLookupRequests.h" #include "swift/Basic/SourceLoc.h" #include "swift/Parse/Lexer.h" #include "llvm/ADT/ArrayRef.h" @@ -3111,53 +3109,6 @@ DeclName MissingMemberFailure::findCorrectEnumCaseName( return (candidate ? candidate->getName() : DeclName()); } -bool MissingMemberFailure::findUnintendedExtraGenericParam(Type instanceTy, FunctionRefKind functionKind) { - auto archetype = instanceTy->getAs(); - if (!archetype) - return false; - auto genericTy = archetype->mapTypeOutOfContext()->getAs(); - if (!genericTy) - return false; - - 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 &cs = getConstraintSystem(); - auto paramDecl = param->getDecl(); - auto descriptor = UnqualifiedLookupDescriptor( - DeclNameRef(param->getName()), paramDecl->getDeclContext()->getParentForLookup(), paramDecl->getStartLoc(), - UnqualifiedLookupFlags::KnownPrivate | UnqualifiedLookupFlags::TypeLookup); - auto lookup = evaluateOrDefault(cs.getASTContext().evaluator, UnqualifiedLookupRequest{descriptor}, {}); - for (auto &result : lookup) { - if (auto proto = dyn_cast_or_null(result.getValueDecl())) { - auto memberLookup = cs.performMemberLookup( - ConstraintKind::ValueMember, getName().withoutArgumentLabels(), - proto->getDeclaredType(), functionKind, getLocator(), - /*includeInaccessibleMembers=*/true); - if (memberLookup.ViableCandidates.size() || memberLookup.UnviableCandidates.size()) { - 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, paramDecl->getName(), archetype) - .fixItReplaceChars(loc, loc.getAdvancedLoc(1), replacement); - return true; - } - } - } - break; - } - return false; -} - bool MissingMemberFailure::diagnoseAsError() { auto anchor = getRawAnchor(); auto memberBase = getAnchor(); @@ -3266,7 +3217,6 @@ bool MissingMemberFailure::diagnoseAsError() { } } else { emitBasicError(baseType); - findUnintendedExtraGenericParam(instanceTy, FunctionRefKind::DoubleApply); } } else if (auto moduleTy = baseType->getAs()) { emitDiagnosticAt(::getLoc(memberBase), diag::no_member_of_module, @@ -3328,7 +3278,6 @@ bool MissingMemberFailure::diagnoseAsError() { correction->addFixits(diagnostic); } else { emitBasicError(baseType); - findUnintendedExtraGenericParam(baseType, FunctionRefKind::SingleApply); } } } @@ -3386,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(); diff --git a/lib/Sema/CSDiagnostics.h b/lib/Sema/CSDiagnostics.h index 785f3f0b6fdd8..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) @@ -1066,8 +1066,22 @@ class MissingMemberFailure final : public InvalidMemberRefFailure { static DeclName findCorrectEnumCaseName(Type Ty, TypoCorrectionResults &corrections, DeclNameRef memberName); - - bool findUnintendedExtraGenericParam(Type instanceTy, FunctionRefKind functionKind); +}; + +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 diff --git a/lib/Sema/CSFix.cpp b/lib/Sema/CSFix.cpp index ab31071816944..5480f2d9dac7d 100644 --- a/lib/Sema/CSFix.cpp +++ b/lib/Sema/CSFix.cpp @@ -531,6 +531,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/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 85aecf8352a9d..fa44872bbdff7 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" @@ -6928,6 +6929,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 From 825a2a259bae4062ce107caf2d972be6d9ea2981 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Wed, 3 Jun 2020 07:27:26 -0700 Subject: [PATCH 176/222] Mark non-foreign entry points of `@objc dynamic` methods in generic classes `dynamically_replaceable` ``` class Generic { @objc dynamic func method() {} } extension Generic { @_dynamicReplacement(for:method()) func replacement() {} } ``` The standard mechanism of using Objective-C categories for dynamically replacing @objc methods in generic classes does not work. Instead we mark the native entry point as replaceable. Because this affects all @objc methods in generic classes (whether there is a replacement or not) by making the native entry point `[dynamically_replaceable]` (regardless of optimization mode) we guard this by the -enable-implicit-dynamic flag because we are late in the release cycle. * Replace isNativeDynamic and isObjcDynamic by calls to shouldUse*Dispatch and shouldUse*Replacement This disambiguates between which dispatch method we should use at call sites and how these methods should implement dynamic function replacement. * Don't emit the method entry for @_dynamicReplacement(for:) of generic class methods There is not way to call this entry point since we can't generate an objective-c category for generic classes. rdar://63679357 --- include/swift/AST/Decl.h | 32 ++++++++ include/swift/Serialization/Validation.h | 5 ++ lib/AST/ASTVerifier.cpp | 4 +- lib/AST/Decl.cpp | 61 +++++++++++++- lib/IRGen/GenArchetype.cpp | 2 +- lib/IRGen/GenDecl.cpp | 2 +- lib/IRGen/GenMeta.cpp | 2 +- lib/IRGen/GenObjC.cpp | 17 +++- lib/SIL/IR/SILDeclRef.cpp | 31 +++++-- lib/SIL/IR/SILFunctionBuilder.cpp | 10 ++- lib/SILGen/SILGenApply.cpp | 2 +- lib/SILGen/SILGenBridging.cpp | 2 +- lib/SILGen/SILGenConstructor.cpp | 2 +- lib/SILGen/SILGenFunction.cpp | 2 +- lib/SILGen/SILGenLValue.cpp | 2 +- lib/SILGen/SILGenPoly.cpp | 2 +- lib/SILGen/SILGenType.cpp | 17 +++- lib/Sema/MiscDiagnostics.cpp | 2 +- lib/Sema/ResilienceDiagnostics.cpp | 2 +- lib/Sema/TypeCheckAttr.cpp | 2 +- lib/Sema/TypeCheckDecl.cpp | 4 +- lib/Sema/TypeCheckDeclObjC.cpp | 8 ++ lib/Sema/TypeCheckDeclOverride.cpp | 2 +- lib/Sema/TypeCheckStorage.cpp | 4 +- lib/Serialization/ModuleFile.cpp | 3 + lib/Serialization/ModuleFormat.h | 9 ++- lib/Serialization/Serialization.cpp | 7 +- lib/Serialization/SerializedModuleLoader.cpp | 2 + lib/TBDGen/TBDGen.cpp | 4 +- .../Inputs/objc_dynamic_replacement_ext.swift | 16 ++++ .../SILGen/objc_dynamic_replacement_ext.swift | 81 +++++++++++++++++++ 31 files changed, 298 insertions(+), 43 deletions(-) create mode 100644 test/SILGen/Inputs/objc_dynamic_replacement_ext.swift create mode 100644 test/SILGen/objc_dynamic_replacement_ext.swift 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/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/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/Decl.cpp b/lib/AST/Decl.cpp index 19fb3aca7c390..a3a4a91756fb8 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1912,7 +1912,7 @@ SourceRange IfConfigDecl::getSourceRange() const { } static bool isPolymorphic(const AbstractStorageDecl *storage) { - if (storage->isObjCDynamic()) + if (storage->shouldUseObjCDispatch()) return true; @@ -2063,7 +2063,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 +2148,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 @@ -2906,6 +2906,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 +5185,7 @@ bool AbstractStorageDecl::hasDidSetOrWillSetDynamicReplacement() const { bool AbstractStorageDecl::hasAnyNativeDynamicAccessors() const { for (auto accessor : getAllAccessors()) { - if (accessor->isNativeDynamic()) + if (accessor->shouldUseNativeDynamicDispatch()) return true; } 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/GenDecl.cpp b/lib/IRGen/GenDecl.cpp index 7e6710311b798..60aabd107152e 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; } 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/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/SILGen/SILGenApply.cpp b/lib/SILGen/SILGenApply.cpp index e80d4f8da4d5e..977e150ce00bf 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' 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/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/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/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/SILGenPoly.cpp b/lib/SILGen/SILGenPoly.cpp index 05170dee11e86..4d3cd693fdd34 100644 --- a/lib/SILGen/SILGenPoly.cpp +++ b/lib/SILGen/SILGenPoly.cpp @@ -4504,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) 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/Sema/MiscDiagnostics.cpp b/lib/Sema/MiscDiagnostics.cpp index 913341172357f..a0867506418d1 100644 --- a/lib/Sema/MiscDiagnostics.cpp +++ b/lib/Sema/MiscDiagnostics.cpp @@ -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/TypeCheckAttr.cpp b/lib/Sema/TypeCheckAttr.cpp index 934521b90670b..abd39331ef685 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(); 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/TypeCheckStorage.cpp b/lib/Sema/TypeCheckStorage.cpp index adc999956ed4e..0e5ce0b681e27 100644 --- a/lib/Sema/TypeCheckStorage.cpp +++ b/lib/Sema/TypeCheckStorage.cpp @@ -2082,7 +2082,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 +2127,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. 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/ModuleFormat.h b/lib/Serialization/ModuleFormat.h index 260b0f75b99c3..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; // SIL function type result differentiability +const uint16_t SWIFTMODULE_VERSION_MINOR = 559; // Serialization of -implicit-dynamic /// A standard hash seed used for all string hashes in a serialized module. /// @@ -775,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< @@ -801,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/Serialization.cpp b/lib/Serialization/Serialization.cpp index deabf9ed2e215..abe402eb7e470 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())); @@ -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; } 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/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/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/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) -> () +} From 42cc98913616fbb6dede87407bac4f070c68e379 Mon Sep 17 00:00:00 2001 From: Xi Ge Date: Mon, 8 Jun 2020 12:29:12 -0700 Subject: [PATCH 177/222] DependenciesScanner: teach the scanner to handle cross-import overlays --- include/swift/AST/DiagnosticsCommon.def | 8 +- include/swift/AST/Module.h | 5 ++ include/swift/AST/ModuleDependencies.h | 7 ++ lib/AST/Module.cpp | 40 +++++++-- lib/AST/ModuleLoader.cpp | 90 ++++++++++++++----- lib/FrontendTool/ScanDependencies.cpp | 33 ++++++- .../E.swiftcrossimport/SubE.swiftoverlay | 5 ++ .../Swift/_cross_import_E.swiftinterface | 6 ++ test/ScanDependencies/module_deps.swift | 3 + 9 files changed, 164 insertions(+), 33 deletions(-) create mode 100644 test/ScanDependencies/Inputs/Swift/E.swiftcrossimport/SubE.swiftoverlay create mode 100644 test/ScanDependencies/Inputs/Swift/_cross_import_E.swiftinterface 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/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/lib/AST/Module.cpp b/lib/AST/Module.cpp index 41c4ac32330e0..e5c61a233e387 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -1520,6 +1520,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 +1537,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 +1581,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 +1822,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 +1844,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 +1858,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 //===----------------------------------------------------------------------===// 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/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/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": From 38d8b135202a7030640757b56ff27e3c948de286 Mon Sep 17 00:00:00 2001 From: Rintaro Ishizaki Date: Thu, 21 May 2020 16:21:59 -0700 Subject: [PATCH 178/222] [CodeCompletion] Add keypath apply subscript after open bracket rdar://problem/61016147 --- lib/IDE/CodeCompletion.cpp | 36 ++++++++++++++++++++----------- lib/IDE/ExprContextAnalysis.cpp | 23 +++++++++++++++++--- test/IDE/complete_subscript.swift | 25 +++++++++++++++------ 3 files changed, 63 insertions(+), 21 deletions(-) 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/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/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 +} From a313f62522c00e8327084820bd22dc3d2870610e Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Mon, 8 Jun 2020 12:05:15 -0700 Subject: [PATCH 179/222] [build-script] Add option --infer to infer dependencies. This causes build-script to use the conservative dependency information that I committed. When one uses this option, it is assumed that one wants to also install all built products. Some notes: 1. I included an extra --install-all option so without --infer enabled one can enable this sort of install everything that we want to build behavior. 2. I added %cmake as a lit variable. I did this so I could specify in my build-system unit tests that on Linux they should use the just built cmake (if we built cmake due to an old cmake being on the system). Otherwise, the build system unit tests took way too long. These are meant to be dry-runs, so building this cmake again is just wasteful and doesn't make sense. 3. I unified how we handle cmark, llvm, swift with the rest of the build products by making them conditional on build_* variables, but to preserve current behavior I made it so that they are just enabled by default unlike things like llbuild/swiftpm/foundation/etc. This was necessary since previously we would just pass these flags to build-script-impl and build-script didn't know about them. Now I taught build-script about them so I can manipulate these skip-build-{cmark,llvm,swift} and then just pass them down to build-script-impl if appropriate rather than relying on build-script-impl to control if these are built. Once this lands, I think we are at a good enough place with build-script until we get rid of build-script-impl in terms of high value QoI that will imnprove productivity. Once build-script-impl is destroyed, we can start paring back what build-script itself does. --- test/lit.cfg | 7 +- test/lit.site.cfg.in | 1 + utils/build-script | 77 ++++++++++++++----- .../build_swift/driver_arguments.py | 15 ++++ .../tests/build_swift/test_presets.py | 1 + utils/build_swift/tests/expected_options.py | 11 +++ .../swift_build_support/cmake.py | 2 +- .../infer_implies_install_all.test | 10 +++ validation-test/BuildSystem/install_all.test | 7 ++ .../BuildSystem/install_all_linux.test | 13 ++++ .../BuildSystem/skip_cmark_swift_llvm.test | 33 ++++++++ validation-test/lit.site.cfg.in | 1 + 12 files changed, 158 insertions(+), 20 deletions(-) create mode 100644 validation-test/BuildSystem/infer_implies_install_all.test create mode 100644 validation-test/BuildSystem/install_all.test create mode 100644 validation-test/BuildSystem/install_all_linux.test create mode 100644 validation-test/BuildSystem/skip_cmark_swift_llvm.test diff --git a/test/lit.cfg b/test/lit.cfg index 1bdc5cf705e8f..1e8372b3507cb 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,6 +162,11 @@ 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) 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/utils/build-script b/utils/build-script index 494c22893d4de..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( @@ -548,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: @@ -816,13 +829,16 @@ class BuildScriptInvocation(object): # FIXME: This is a weird division (returning a list of class objects), # but it matches the existing structure of the `build-script-impl`. impl_product_classes = [] - impl_product_classes.append(products.CMark) - impl_product_classes.append(products.LLVM) + 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: impl_product_classes.append(products.LibCXX) if self.args.build_libicu: impl_product_classes.append(products.LibICU) - impl_product_classes.append(products.Swift) + if self.args.build_swift: + impl_product_classes.append(products.Swift) if self.args.build_lldb: impl_product_classes.append(products.LLDB) if self.args.build_libdispatch: @@ -868,6 +884,30 @@ class BuildScriptInvocation(object): 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): @@ -956,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_swift/build_swift/driver_arguments.py b/utils/build_swift/build_swift/driver_arguments.py index 868be0ac4944e..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(), @@ -545,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') @@ -1096,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 168964feab6c2..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, @@ -482,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'), @@ -537,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'), @@ -632,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'), 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/validation-test/BuildSystem/infer_implies_install_all.test b/validation-test/BuildSystem/infer_implies_install_all.test new file mode 100644 index 0000000000000..2b36960d1e7a7 --- /dev/null +++ b/validation-test/BuildSystem/infer_implies_install_all.test @@ -0,0 +1,10 @@ +# 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 + +# 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..e8888d25beaf9 --- /dev/null +++ b/validation-test/BuildSystem/install_all.test @@ -0,0 +1,7 @@ +# 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 + +# 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..fa2c103503bee --- /dev/null +++ b/validation-test/BuildSystem/install_all_linux.test @@ -0,0 +1,13 @@ +# 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: 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..093aef4d755c8 --- /dev/null +++ b/validation-test/BuildSystem/skip_cmark_swift_llvm.test @@ -0,0 +1,33 @@ +# 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/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@" From d975478b90bf6d1fff31c2068cda73f9c6d01556 Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Tue, 9 Jun 2020 06:33:23 -0300 Subject: [PATCH 180/222] [NFC] Clarify comment on metatype casts on TypeCheckConstraints --- lib/Sema/TypeCheckConstraints.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Sema/TypeCheckConstraints.cpp b/lib/Sema/TypeCheckConstraints.cpp index 8d218f38d8916..545350209866b 100644 --- a/lib/Sema/TypeCheckConstraints.cpp +++ b/lib/Sema/TypeCheckConstraints.cpp @@ -3706,9 +3706,9 @@ CheckedCastKind TypeChecker::typeCheckCheckedCast(Type fromType, else fromRequiresClass = fromType->mayHaveSuperclass(); - // Casts between protocol metatypes only succeed if the type is existential - // or if it involves generic types because they may be protocol conformances - // we can't know at compile time. + // 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) && !(fromArchetype || toArchetype)) return failed(); From acb16cf216e37010f8e372fc4fa38964a0364c83 Mon Sep 17 00:00:00 2001 From: Dan Zheng Date: Tue, 9 Jun 2020 12:16:56 -0700 Subject: [PATCH 181/222] [AutoDiff] Dedupe array semantic call utilities. (#32266) Delete differentiation array semantic call utilities: - `bool isArrayLiteralIntrinsic(FullApplySite applySite)` - `ApplyInst *getAllocateUninitializedArrayIntrinsic(SILValue v)` Use ArraySemanticsCall from ArraySemantics.h instead. Resolves SR-12894. --- .../SILOptimizer/Differentiation/Common.h | 11 ++--------- .../DifferentiableActivityAnalysis.cpp | 4 +++- lib/SILOptimizer/Differentiation/Common.cpp | 19 +++---------------- .../Differentiation/JVPEmitter.cpp | 2 +- .../Differentiation/LinearMapInfo.cpp | 7 +++++-- .../Differentiation/PullbackEmitter.cpp | 9 +++++---- .../Differentiation/VJPEmitter.cpp | 11 ++++++----- 7 files changed, 25 insertions(+), 38 deletions(-) diff --git a/include/swift/SILOptimizer/Differentiation/Common.h b/include/swift/SILOptimizer/Differentiation/Common.h index 649be7b871618..a4d8637b386d8 100644 --- a/include/swift/SILOptimizer/Differentiation/Common.h +++ b/include/swift/SILOptimizer/Differentiation/Common.h @@ -37,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` @@ -57,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/lib/SILOptimizer/Analysis/DifferentiableActivityAnalysis.cpp b/lib/SILOptimizer/Analysis/DifferentiableActivityAnalysis.cpp index b54f12ac40386..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()) { 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 0cd833d56efcd..8f53b37667113 100644 --- a/lib/SILOptimizer/Differentiation/JVPEmitter.cpp +++ b/lib/SILOptimizer/Differentiation/JVPEmitter.cpp @@ -1181,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; diff --git a/lib/SILOptimizer/Differentiation/LinearMapInfo.cpp b/lib/SILOptimizer/Differentiation/LinearMapInfo.cpp index 9fc1a232f8ebf..4582c20521d6d 100644 --- a/lib/SILOptimizer/Differentiation/LinearMapInfo.cpp +++ b/lib/SILOptimizer/Differentiation/LinearMapInfo.cpp @@ -412,7 +412,8 @@ 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; @@ -476,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 0746e93d24075..04e923bdfd4e6 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; @@ -1420,9 +1421,9 @@ 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(); diff --git a/lib/SILOptimizer/Differentiation/VJPEmitter.cpp b/lib/SILOptimizer/Differentiation/VJPEmitter.cpp index 094690dcbbf1e..57cd002e4bc4a 100644 --- a/lib/SILOptimizer/Differentiation/VJPEmitter.cpp +++ b/lib/SILOptimizer/Differentiation/VJPEmitter.cpp @@ -533,11 +533,12 @@ 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; } From fdf31c88a684bc33466369e68b511be0d38b2d63 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Tue, 9 Jun 2020 12:15:24 -0700 Subject: [PATCH 182/222] Add Flags to Enable or Disable EnableExperientalPrivateIntransitiveDependencies Turn the existing flag into an on-off switch and migrate all the tests in preparation for it being on by default --- include/swift/Option/Options.td | 9 +- lib/Driver/ToolChains.cpp | 3 +- lib/Frontend/CompilerInvocation.cpp | 6 +- .../Dependencies/bindings-build-record.swift | 12 +-- .../chained-additional-kinds-fine.swift | 8 +- .../Dependencies/chained-after-fine.swift | 6 +- test/Driver/Dependencies/chained-fine.swift | 12 +-- .../chained-private-after-fine.swift | 6 +- .../chained-private-after-multiple-fine.swift | 6 +- ...-after-multiple-nominal-members-fine.swift | 6 +- .../Dependencies/chained-private-fine.swift | 6 +- .../check-interface-implementation-fine.swift | 6 +- .../Dependencies/crash-added-fine.swift | 10 +-- test/Driver/Dependencies/crash-new-fine.swift | 16 ++-- .../Dependencies/crash-simple-fine.swift | 6 +- .../dependencies-preservation-fine.swift | 2 +- ...iver-show-incremental-arguments-fine.swift | 4 +- ...cremental-conflicting-arguments-fine.swift | 8 +- ...iver-show-incremental-malformed-fine.swift | 10 +-- .../driver-show-incremental-mutual-fine.swift | 6 +- ...-show-incremental-swift-version-fine.swift | 4 +- .../embed-bitcode-parallel-fine.swift | 4 +- .../Driver/Dependencies/fail-added-fine.swift | 8 +- .../Dependencies/fail-chained-fine.swift | 18 ++-- .../fail-interface-hash-fine.swift | 6 +- test/Driver/Dependencies/fail-new-fine.swift | 16 ++-- .../Dependencies/fail-simple-fine.swift | 6 +- .../fail-with-bad-deps-fine.swift | 10 +-- .../Driver/Dependencies/file-added-fine.swift | 6 +- .../Dependencies/independent-fine.swift | 16 ++-- .../independent-parseable-fine.swift | 12 +-- .../malformed-but-valid-yaml-fine.swift | 16 ++-- test/Driver/Dependencies/malformed-fine.swift | 16 ++-- test/Driver/Dependencies/moduleonly.swift | 20 ++--- test/Driver/Dependencies/mutual-fine.swift | 8 +- .../mutual-interface-hash-fine.swift | 12 +-- .../Dependencies/nominal-members-fine.swift | 10 +-- .../one-way-depends-after-fine.swift | 18 ++-- .../one-way-depends-before-fine.swift | 18 ++-- .../one-way-external-delete-fine.swift | 10 +-- .../Dependencies/one-way-external-fine.swift | 12 +-- test/Driver/Dependencies/one-way-fine.swift | 26 +++--- .../one-way-merge-module-fine.swift | 4 +- .../Dependencies/one-way-parallel-fine.swift | 4 +- .../Dependencies/one-way-parseable-fine.swift | 8 +- .../one-way-provides-after-fine.swift | 16 ++-- .../one-way-provides-before-fine.swift | 16 ++-- .../one-way-while-editing-fine.swift | 8 +- test/Driver/Dependencies/only-skip-once.swift | 4 +- .../Dependencies/private-after-fine.swift | 10 +-- test/Driver/Dependencies/private-fine.swift | 14 ++-- .../bindings-build-record.swift | 14 ++-- .../chained-additional-kinds-fine.swift | 8 +- .../chained-after-fine.swift | 6 +- .../PrivateDependencies/chained-fine.swift | 12 +-- .../chained-private-after-fine.swift | 6 +- .../chained-private-after-multiple-fine.swift | 6 +- ...-after-multiple-nominal-members-fine.swift | 6 +- .../chained-private-fine.swift | 6 +- .../check-interface-implementation-fine.swift | 6 +- .../crash-added-fine.swift | 10 +-- .../PrivateDependencies/crash-new-fine.swift | 16 ++-- .../crash-simple-fine.swift | 6 +- .../dependencies-preservation-fine.swift | 2 +- ...cremental-conflicting-arguments-fine.swift | 8 +- .../driver-show-incremental-inputs-fine.swift | 4 +- ...iver-show-incremental-malformed-fine.swift | 10 +-- .../driver-show-incremental-mutual-fine.swift | 6 +- ...-show-incremental-swift-version-fine.swift | 4 +- .../embed-bitcode-parallel-fine.swift | 4 +- .../PrivateDependencies/fail-added-fine.swift | 8 +- .../fail-chained-fine.swift | 18 ++-- .../fail-interface-hash-fine.swift | 6 +- .../PrivateDependencies/fail-new-fine.swift | 16 ++-- .../fail-simple-fine.swift | 6 +- .../fail-with-bad-deps-fine.swift | 10 +-- .../PrivateDependencies/file-added-fine.swift | 6 +- .../independent-fine.swift | 16 ++-- .../independent-half-dirty-fine.swift | 6 +- .../independent-parseable-fine.swift | 12 +-- .../malformed-but-valid-yaml-fine.swift | 16 ++-- .../PrivateDependencies/malformed-fine.swift | 16 ++-- .../PrivateDependencies/moduleonly.swift | 20 ++--- .../PrivateDependencies/mutual-fine.swift | 8 +- .../mutual-interface-hash-fine.swift | 12 +-- .../nominal-members-fine.swift | 10 +-- .../one-way-depends-before-fine.swift | 18 ++-- .../one-way-external-delete-fine.swift | 10 +-- .../one-way-external-fine.swift | 12 +-- .../PrivateDependencies/one-way-fine.swift | 26 +++--- .../one-way-merge-module-fine.swift | 4 +- .../one-way-parallel-fine.swift | 4 +- .../one-way-parseable-fine.swift | 8 +- .../one-way-provides-after-fine.swift | 16 ++-- .../one-way-provides-before-fine.swift | 16 ++-- .../one-way-while-editing-fine.swift | 8 +- .../PrivateDependencies/only-skip-once.swift | 4 +- .../private-after-fine.swift | 10 +-- .../PrivateDependencies/private-fine.swift | 14 ++-- .../whole-module-build-record.swift | 4 +- .../Fingerprints/class-fingerprint.swift | 8 +- .../Fingerprints/enum-fingerprint.swift | 8 +- .../Fingerprints/extension-adds-member.swift | 8 +- .../Fingerprints/protocol-fingerprint.swift | 8 +- .../Fingerprints/struct-fingerprint.swift | 8 +- .../class-fingerprint/definesAB-after.swift | 5 ++ .../class-fingerprint/definesAB-before.swift | 4 + .../Inputs/class-fingerprint/main.swift | 1 + .../Inputs/class-fingerprint/ofm.json | 22 +++++ .../Inputs/class-fingerprint/usesA.swift | 1 + .../Inputs/class-fingerprint/usesB.swift | 1 + .../enum-fingerprint/definesAB-after.swift | 7 ++ .../enum-fingerprint/definesAB-before.swift | 6 ++ .../Inputs/enum-fingerprint/main.swift | 1 + .../Inputs/enum-fingerprint/ofm.json | 22 +++++ .../Inputs/enum-fingerprint/usesA.swift | 1 + .../Inputs/enum-fingerprint/usesB.swift | 1 + .../definesAB-after.swift | 9 ++ .../definesAB-before.swift | 8 ++ .../Inputs/extension-adds-member/main.swift | 1 + .../Inputs/extension-adds-member/ofm.json | 22 +++++ .../Inputs/extension-adds-member/usesA.swift | 1 + .../Inputs/extension-adds-member/usesB.swift | 1 + .../definesAB-after.swift | 5 ++ .../definesAB-before.swift | 4 + .../Inputs/protocol-fingerprint/main.swift | 1 + .../Inputs/protocol-fingerprint/ofm.json | 22 +++++ .../Inputs/protocol-fingerprint/usesA.swift | 3 + .../Inputs/protocol-fingerprint/usesB.swift | 2 + .../struct-fingerprint/definesAB-after.swift | 5 ++ .../struct-fingerprint/definesAB-before.swift | 4 + .../Inputs/struct-fingerprint/main.swift | 1 + .../Inputs/struct-fingerprint/ofm.json | 22 +++++ .../Inputs/struct-fingerprint/usesA.swift | 1 + .../Inputs/struct-fingerprint/usesB.swift | 1 + .../class-fingerprint.swift | 73 ++++++++++++++++ .../enum-fingerprint.swift | 73 ++++++++++++++++ .../extension-adds-member.swift | 83 +++++++++++++++++++ .../protocol-fingerprint.swift | 74 +++++++++++++++++ .../struct-fingerprint.swift | 73 ++++++++++++++++ .../Dependencies/private-function-fine.swift | 4 +- .../private-function-return-type-fine.swift | 4 +- .../private-protocol-conformer-fine.swift | 4 +- .../private-struct-member-fine.swift | 4 +- .../Dependencies/private-subscript-fine.swift | 4 +- .../Dependencies/private-typealias-fine.swift | 4 +- .../Dependencies/private-var-fine.swift | 4 +- ...erence-dependencies-consistency-fine.swift | 2 +- ...nce-dependencies-dynamic-lookup-fine.swift | 4 +- .../reference-dependencies-errors.swift | 2 +- .../reference-dependencies-fine.swift | 4 +- .../reference-dependencies-members-fine.swift | 4 +- .../private-function-fine.swift | 4 +- .../private-function-return-type-fine.swift | 4 +- .../private-protocol-conformer-ext-fine.swift | 4 +- .../private-protocol-conformer-fine.swift | 4 +- .../private-struct-member-fine.swift | 4 +- .../private-subscript-fine.swift | 4 +- .../private-typealias-fine.swift | 4 +- .../private-var-fine.swift | 4 +- ...erence-dependencies-consistency-fine.swift | 2 +- ...nce-dependencies-dynamic-lookup-fine.swift | 4 +- .../reference-dependencies-errors.swift | 2 +- .../reference-dependencies-fine.swift | 4 +- .../reference-dependencies-members-fine.swift | 4 +- .../Verifier/multi-file-private/main.swift | 4 +- .../Verifier/multi-file/main.swift | 4 +- .../single-file-private/AnyObject.swift | 2 +- .../single-file-private/Conformances.swift | 2 +- .../Verifier/single-file/AnyObject.swift | 2 +- .../Verifier/single-file/Conformances.swift | 2 +- test/Incremental/superfluous-cascade.swift | 8 +- 172 files changed, 1135 insertions(+), 566 deletions(-) create mode 100644 test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/definesAB-after.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/definesAB-before.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/main.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/ofm.json create mode 100644 test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/usesA.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/class-fingerprint/usesB.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/definesAB-after.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/definesAB-before.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/main.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/ofm.json create mode 100644 test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/usesA.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/enum-fingerprint/usesB.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/definesAB-after.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/definesAB-before.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/main.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/ofm.json create mode 100644 test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/usesA.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/extension-adds-member/usesB.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/definesAB-after.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/definesAB-before.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/main.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/ofm.json create mode 100644 test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/usesA.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/protocol-fingerprint/usesB.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/definesAB-after.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/definesAB-before.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/main.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/ofm.json create mode 100644 test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/usesA.swift create mode 100644 test/Frontend/PrivateFingerprints/Inputs/struct-fingerprint/usesB.swift create mode 100644 test/Frontend/PrivateFingerprints/class-fingerprint.swift create mode 100644 test/Frontend/PrivateFingerprints/enum-fingerprint.swift create mode 100644 test/Frontend/PrivateFingerprints/extension-adds-member.swift create mode 100644 test/Frontend/PrivateFingerprints/protocol-fingerprint.swift create mode 100644 test/Frontend/PrivateFingerprints/struct-fingerprint.swift diff --git a/include/swift/Option/Options.td b/include/swift/Option/Options.td index 0ca3c312b961c..7498655d3ed7f 100644 --- a/include/swift/Option/Options.td +++ b/include/swift/Option/Options.td @@ -534,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_experimental_private_intransitive_dependencies : Flag<["-"], + "enable-experimental-private-intransitive-dependencies">, Flags<[FrontendOption, HelpHidden]>, HelpText<"Enable experimental dependency tracking that never cascades">; +def disable_experimental_private_intransitive_dependencies : Flag<["-"], + "disable-experimental-private-intransitive-dependencies">, + Flags<[FrontendOption, HelpHidden]>, + HelpText<"Disable experimental dependency tracking that never cascades">; + // Diagnostic control options def suppress_warnings : Flag<["-"], "suppress-warnings">, diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 232a69ac30487..afb6b8f391d62 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_experimental_private_intransitive_dependencies, + options::OPT_disable_experimental_private_intransitive_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 071ccdf4f65e4..e99150416656e 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.EnableExperientalPrivateIntransitiveDependencies = + Args.hasFlag(OPT_enable_experimental_private_intransitive_dependencies, + OPT_disable_experimental_private_intransitive_dependencies, + /*default*/ true); Opts.EnableExperimentalForwardModeDifferentiation |= Args.hasArg(OPT_enable_experimental_forward_mode_differentiation); diff --git a/test/Driver/Dependencies/bindings-build-record.swift b/test/Driver/Dependencies/bindings-build-record.swift index 95ffe59d0325f..c65fd761c1079 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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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..b01a0f43c50b4 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..329eefc66e3e7 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..7e780c298ca7c 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..a8c92d235ce79 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..aacb7415d4113 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..1931ce3fde944 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..8bcf3033f3a73 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..0fc06a2f128ae 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..5f091d9e516f8 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..cbe1ba4a4e58c 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-dependencies -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 // 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..0cbe3356761fb 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..b0934c3d2048b 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" -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-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/Dependencies/driver-show-incremental-arguments-fine.swift b/test/Driver/Dependencies/driver-show-incremental-arguments-fine.swift index 454e270ef3014..098482f13e903 100644 --- a/test/Driver/Dependencies/driver-show-incremental-arguments-fine.swift +++ b/test/Driver/Dependencies/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" -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-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" -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" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-dependencies -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/Dependencies/driver-show-incremental-conflicting-arguments-fine.swift b/test/Driver/Dependencies/driver-show-incremental-conflicting-arguments-fine.swift index c1021b731b377..f078e2732432c 100644 --- a/test/Driver/Dependencies/driver-show-incremental-conflicting-arguments-fine.swift +++ b/test/Driver/Dependencies/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 -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" -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-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 -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" -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-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 -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" -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-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 -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" -c ./main.swift ./other.swift -module-name main -incremental -disable-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 // 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-malformed-fine.swift b/test/Driver/Dependencies/driver-show-incremental-malformed-fine.swift index 8b9ea8bb7a62c..06b8d594e7056 100644 --- a/test/Driver/Dependencies/driver-show-incremental-malformed-fine.swift +++ b/test/Driver/Dependencies/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 -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" -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-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 -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" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-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 -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" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-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 -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" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-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 -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" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-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/Dependencies/driver-show-incremental-mutual-fine.swift b/test/Driver/Dependencies/driver-show-incremental-mutual-fine.swift index 3d741f84fd20e..f6b2d3da01673 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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..17099b47b1dd1 100644 --- a/test/Driver/Dependencies/driver-show-incremental-swift-version-fine.swift +++ b/test/Driver/Dependencies/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 -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" -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-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 -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" -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-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/Dependencies/embed-bitcode-parallel-fine.swift b/test/Driver/Dependencies/embed-bitcode-parallel-fine.swift index 6de636653418f..8e87dacca2243 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-experimental-private-intransitive-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-experimental-private-intransitive-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..9105fa8f14275 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..da5473cfee00a 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..1ea43b9321a7e 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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: %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" -output-file-map %t/output.json -incremental -disable-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 // 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..d955ac60ad054 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..32c46ab981af6 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..06c349a275176 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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: %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" -output-file-map %t/output.json -incremental -disable-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 diff --git a/test/Driver/Dependencies/file-added-fine.swift b/test/Driver/Dependencies/file-added-fine.swift index ae1bcebca7d08..dadca3a1967fd 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..5c66158229ed5 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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: 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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-parseable-fine.swift b/test/Driver/Dependencies/independent-parseable-fine.swift index a5598145260c8..68c6623f29926 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..145669b56a1aa 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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: 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..48911600a35b9 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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: 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..5cb4765c24645 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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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..18d12eccbc9c2 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 diff --git a/test/Driver/Dependencies/mutual-interface-hash-fine.swift b/test/Driver/Dependencies/mutual-interface-hash-fine.swift index 20a956553c044..d6eea25e70ac3 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 diff --git a/test/Driver/Dependencies/nominal-members-fine.swift b/test/Driver/Dependencies/nominal-members-fine.swift index 7c1578f80de91..0eb41dbc28dc0 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..e6350625dcbbb 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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: %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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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: 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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: 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..0bbaff605726e 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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: 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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 diff --git a/test/Driver/Dependencies/one-way-external-delete-fine.swift b/test/Driver/Dependencies/one-way-external-delete-fine.swift index 106249269b30a..30e4929dc8218 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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: 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..5d936a33f7e70 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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: 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..f15acf747ac57 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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: 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..75dfd37223c74 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..0b695de4dbcbd 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..16e9fc29dd473 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..c48a3a3f29f50 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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: %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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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: 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" -output-file-map %t/output.json -incremental -disable-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: 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" -output-file-map %t/output.json -incremental -disable-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 // 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..5c185eb9392e4 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-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 // 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-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: 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..0c470b63c06ea 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-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..8d837fae535b4 100644 --- a/test/Driver/Dependencies/only-skip-once.swift +++ b/test/Driver/Dependencies/only-skip-once.swift @@ -4,7 +4,7 @@ // 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-experimental-private-intransitive-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-experimental-private-intransitive-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..583f18462f76f 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..76def831ccd2b 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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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/bindings-build-record.swift b/test/Driver/PrivateDependencies/bindings-build-record.swift index 917e1af5b84b9..96e99162c34cc 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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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..f436bb2e2048e 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..f3a9b16e18bdb 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..7c1e3ee49c096 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..18815ba5fde69 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..71834054137e7 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..759e078a9f5b5 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..ca4eece69c183 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..1ef85d2a40c60 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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 // 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..6caf85f65e1d8 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..9565be220e241 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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 // 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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 // 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..b7cd70c89da08 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..1f0b440e1f6af 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" -c ./main.swift ./other.swift -module-name main -incremental -enable-experimental-private-intransitive-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-conflicting-arguments-fine.swift b/test/Driver/PrivateDependencies/driver-show-incremental-conflicting-arguments-fine.swift index 7a6168864bcf5..1525df6392ef1 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" -c ./main.swift ./other.swift -module-name main -incremental -enable-experimental-private-intransitive-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" -c ./main.swift ./other.swift -module-name main -incremental -enable-experimental-private-intransitive-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" -c ./main.swift ./other.swift -module-name main -incremental -enable-experimental-private-intransitive-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" -c ./main.swift ./other.swift -module-name main -incremental -enable-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 // 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..01fa3b5012488 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" -c ./main.swift ./other.swift -module-name main -incremental -enable-experimental-private-intransitive-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" -c ./main.swift -module-name main -incremental -enable-experimental-private-intransitive-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..c11d8eba0a806 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" -c ./main.swift ./other.swift -module-name main -incremental -enable-experimental-private-intransitive-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" -g -c ./main.swift ./other.swift -module-name main -incremental -enable-experimental-private-intransitive-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" -g -c ./main.swift ./other.swift -module-name main -incremental -enable-experimental-private-intransitive-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" -g -c ./main.swift ./other.swift -module-name main -incremental -enable-experimental-private-intransitive-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" -g -c ./main.swift ./other.swift -module-name main -incremental -enable-experimental-private-intransitive-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..0ba8539484975 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" -output-file-map %t/output.json -incremental -enable-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 // 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" -output-file-map %t/output.json -incremental -enable-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 // 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" -output-file-map %t/output.json -incremental -enable-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 // 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..cd986b09f71ef 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" -c ./main.swift ./other.swift -module-name main -incremental -enable-experimental-private-intransitive-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" -c ./main.swift ./other.swift -module-name main -incremental -enable-experimental-private-intransitive-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..6de1bf92513ae 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-experimental-private-intransitive-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-experimental-private-intransitive-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..4b1da505aed71 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..3c6cf9c527bc6 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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..6929f7d6506ce 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" -output-file-map %t/output.json -incremental -enable-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 // 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" -output-file-map %t/output.json -incremental -enable-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: %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" -output-file-map %t/output.json -incremental -enable-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 // 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..b1f09440cb0eb 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..e060287a033e5 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..c2cbd0a90e873 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" -output-file-map %t/output.json -incremental -enable-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 // 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" -output-file-map %t/output.json -incremental -enable-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 // 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" -output-file-map %t/output.json -incremental -enable-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 // 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" -output-file-map %t/output.json -incremental -enable-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: %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" -output-file-map %t/output.json -incremental -enable-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 diff --git a/test/Driver/PrivateDependencies/file-added-fine.swift b/test/Driver/PrivateDependencies/file-added-fine.swift index 4cc0a906c0760..d607c6ea177f7 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..7c2286e67d74a 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..69cbdfaa196a2 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..71d2c445f1a04 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..b18fe408ab3b3 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..e96e409a078d2 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..2809b1c97c512 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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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..72842b6e1c12d 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" -output-file-map %t/output.json -incremental -enable-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 // 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" -output-file-map %t/output.json -incremental -enable-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 // 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" -output-file-map %t/output.json -incremental -enable-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 // 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" -output-file-map %t/output.json -incremental -enable-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 diff --git a/test/Driver/PrivateDependencies/mutual-interface-hash-fine.swift b/test/Driver/PrivateDependencies/mutual-interface-hash-fine.swift index 5a35a3db0f20a..67b8e77e424f5 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" -output-file-map %t/output.json -incremental -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -enable-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 // 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" -output-file-map %t/output.json -incremental -enable-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 // 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" -output-file-map %t/output.json -incremental -enable-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 diff --git a/test/Driver/PrivateDependencies/nominal-members-fine.swift b/test/Driver/PrivateDependencies/nominal-members-fine.swift index 29a943e1619e2..e218447fa3a87 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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 // 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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 // 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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 // CHECK-TOUCHED-EXT-NOT: Handled // CHECK-TOUCHED-EXT: Handled a-ext.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..27e8389917d60 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..5cd28564d1a76 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..f3e54eace1efb 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..14fb65c24f288 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..544d2ba080232 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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 // 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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 // 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..7039b98fef8fc 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..7d40e2f36e7b2 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..8fbc179041cfa 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..2be7fbe87c265 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..db479c860283c 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-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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..2c7821cd87c9b 100644 --- a/test/Driver/PrivateDependencies/only-skip-once.swift +++ b/test/Driver/PrivateDependencies/only-skip-once.swift @@ -4,7 +4,7 @@ // 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-experimental-private-intransitive-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-experimental-private-intransitive-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..4553e23ad290c 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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 // 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-experimental-private-intransitive-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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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..c0c752c80deb8 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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 // 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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents -enable-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: %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..2629741eb1e23 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-experimental-private-intransitive-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-experimental-private-intransitive-dependencies ./main.swift ./other.swift -module-name main -j1 -v 2>&1 // Just don't crash. diff --git a/test/Frontend/Fingerprints/class-fingerprint.swift b/test/Frontend/Fingerprints/class-fingerprint.swift index 3cab8d6e990c5..6a37150fbec20 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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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,7 +67,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 >&output4 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-experimental-private-intransitive-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 diff --git a/test/Frontend/Fingerprints/enum-fingerprint.swift b/test/Frontend/Fingerprints/enum-fingerprint.swift index 05083f4f7ec9b..39408347897d0 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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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,7 +67,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 >&output4 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-experimental-private-intransitive-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 diff --git a/test/Frontend/Fingerprints/extension-adds-member.swift b/test/Frontend/Fingerprints/extension-adds-member.swift index 1bac527921a73..34ac19affd7b6 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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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 62a9ddd000878..518d106f16b4d 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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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,7 +67,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 >&output4 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-experimental-private-intransitive-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 diff --git a/test/Frontend/Fingerprints/struct-fingerprint.swift b/test/Frontend/Fingerprints/struct-fingerprint.swift index a0c9012a7c422..6fbbe4ada884b 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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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,7 +67,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 >&output4 +// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-experimental-private-intransitive-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 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/Incremental/Dependencies/private-function-fine.swift b/test/Incremental/Dependencies/private-function-fine.swift index c1337019a65bc..b8eeee8ff6089 100644 --- a/test/Incremental/Dependencies/private-function-fine.swift +++ b/test/Incremental/Dependencies/private-function-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/private-function-return-type-fine.swift b/test/Incremental/Dependencies/private-function-return-type-fine.swift index 2e8e517e7c7e9..dd96f4c412ed4 100644 --- a/test/Incremental/Dependencies/private-function-return-type-fine.swift +++ b/test/Incremental/Dependencies/private-function-return-type-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/private-protocol-conformer-fine.swift b/test/Incremental/Dependencies/private-protocol-conformer-fine.swift index 2e62737c2d710..9db8c32e92b8a 100644 --- a/test/Incremental/Dependencies/private-protocol-conformer-fine.swift +++ b/test/Incremental/Dependencies/private-protocol-conformer-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/private-struct-member-fine.swift b/test/Incremental/Dependencies/private-struct-member-fine.swift index b66e08ece8ded..a8d4868179fe8 100644 --- a/test/Incremental/Dependencies/private-struct-member-fine.swift +++ b/test/Incremental/Dependencies/private-struct-member-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/private-subscript-fine.swift b/test/Incremental/Dependencies/private-subscript-fine.swift index ff8efe16e50e7..ce0041e4d2f1e 100644 --- a/test/Incremental/Dependencies/private-subscript-fine.swift +++ b/test/Incremental/Dependencies/private-subscript-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/private-typealias-fine.swift b/test/Incremental/Dependencies/private-typealias-fine.swift index e78e73e9a9f5b..f94acc2f1802b 100644 --- a/test/Incremental/Dependencies/private-typealias-fine.swift +++ b/test/Incremental/Dependencies/private-typealias-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/private-var-fine.swift b/test/Incremental/Dependencies/private-var-fine.swift index 764216859efc5..a710212527b9d 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-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..c87712f735a93 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-experimental-private-intransitive-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..7ae477d3eb1cf 100644 --- a/test/Incremental/Dependencies/reference-dependencies-dynamic-lookup-fine.swift +++ b/test/Incremental/Dependencies/reference-dependencies-dynamic-lookup-fine.swift @@ -4,10 +4,10 @@ // 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 -disable-experimental-private-intransitive-dependencies -primary-file %t/main.swift -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: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -disable-experimental-private-intransitive-dependencies -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: diff %t-processed.swiftdeps %t-2-processed.swiftdeps diff --git a/test/Incremental/Dependencies/reference-dependencies-errors.swift b/test/Incremental/Dependencies/reference-dependencies-errors.swift index 72dc06066331f..c05a4de4e7de3 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-experimental-private-intransitive-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..d80af35894585 100644 --- a/test/Incremental/Dependencies/reference-dependencies-fine.swift +++ b/test/Incremental/Dependencies/reference-dependencies-fine.swift @@ -6,9 +6,9 @@ // 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-experimental-private-intransitive-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-experimental-private-intransitive-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 diff --git a/test/Incremental/Dependencies/reference-dependencies-members-fine.swift b/test/Incremental/Dependencies/reference-dependencies-members-fine.swift index 5c90284ea2cf8..1375007051af5 100644 --- a/test/Incremental/Dependencies/reference-dependencies-members-fine.swift +++ b/test/Incremental/Dependencies/reference-dependencies-members-fine.swift @@ -6,9 +6,9 @@ // 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 -disable-experimental-private-intransitive-dependencies -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 -emit-reference-dependencies-path - > %t-2.swiftdeps +// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -disable-experimental-private-intransitive-dependencies -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 diff --git a/test/Incremental/PrivateDependencies/private-function-fine.swift b/test/Incremental/PrivateDependencies/private-function-fine.swift index 2faaa24cd690c..fe084fe230038 100644 --- a/test/Incremental/PrivateDependencies/private-function-fine.swift +++ b/test/Incremental/PrivateDependencies/private-function-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift b/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift index 0ae374461af8c..7755845c1fa94 100644 --- a/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift +++ b/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift b/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift index 1b638a1865b91..f31863afef2a5 100644 --- a/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift +++ b/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift b/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift index f50ab48ef4226..2c5ab354be811 100644 --- a/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift +++ b/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-struct-member-fine.swift b/test/Incremental/PrivateDependencies/private-struct-member-fine.swift index c0e961a85b660..26469429bf735 100644 --- a/test/Incremental/PrivateDependencies/private-struct-member-fine.swift +++ b/test/Incremental/PrivateDependencies/private-struct-member-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-subscript-fine.swift b/test/Incremental/PrivateDependencies/private-subscript-fine.swift index c634d6c81c96a..f90eed9f0494a 100644 --- a/test/Incremental/PrivateDependencies/private-subscript-fine.swift +++ b/test/Incremental/PrivateDependencies/private-subscript-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-typealias-fine.swift b/test/Incremental/PrivateDependencies/private-typealias-fine.swift index 438f4798f5109..4810c50b45950 100644 --- a/test/Incremental/PrivateDependencies/private-typealias-fine.swift +++ b/test/Incremental/PrivateDependencies/private-typealias-fine.swift @@ -2,11 +2,11 @@ // 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-var-fine.swift b/test/Incremental/PrivateDependencies/private-var-fine.swift index 588c13d333124..20373e0cdceb9 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-experimental-private-intransitive-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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-experimental-private-intransitive-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..512abb9201cf8 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-experimental-private-intransitive-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..28686be5162c7 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-dynamic-lookup-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-dynamic-lookup-fine.swift @@ -4,10 +4,10 @@ // 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-experimental-private-intransitive-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: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -primary-file %t/main.swift -emit-reference-dependencies-path - -enable-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: diff %t-processed.swiftdeps %t-2-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/reference-dependencies-errors.swift b/test/Incremental/PrivateDependencies/reference-dependencies-errors.swift index 4bc2fc47e0721..6480b44fa3e99 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-experimental-private-intransitive-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..732e03f552c85 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-fine.swift @@ -6,9 +6,9 @@ // 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-experimental-private-intransitive-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-experimental-private-intransitive-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 diff --git a/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift b/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift index 6c89ab21ec192..6d4525abbbe97 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift @@ -6,9 +6,9 @@ // 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-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 - -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-members-helper.swift -emit-reference-dependencies-path - -enable-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 diff --git a/test/Incremental/Verifier/multi-file-private/main.swift b/test/Incremental/Verifier/multi-file-private/main.swift index 876ff32b30b84..78451d1378f4c 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 -c -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 -c -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-experimental-private-intransitive-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-experimental-private-intransitive-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/main.swift b/test/Incremental/Verifier/multi-file/main.swift index 613e9530e80e8..41193bf7bf384 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 -c -output-file-map %t/output.json -incremental -module-name main -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 -verify-incremental-dependencies @%t.resp +// RUN: cd %t && %target-swiftc_driver -c -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-dependencies -module-name main -verify-incremental-dependencies @%t.resp +// RUN: cd %t && %target-swiftc_driver -c -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-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..f382e9c75cec9 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-experimental-private-intransitive-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..d56924bdaaf46 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-experimental-private-intransitive-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..138ab7af295d7 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-experimental-private-intransitive-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..5b35f90948284 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-experimental-private-intransitive-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..07282cb261267 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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-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-experimental-private-intransitive-dependencies >&output4 // RUN: %FileCheck -check-prefix=CHECK-PRIVATE-RECOMPILED %s --dump-input=always < %t/output4 From ec059f34de783ccf35e19c6bc175dab5249c59d3 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Tue, 9 Jun 2020 12:16:55 -0700 Subject: [PATCH 183/222] Enable ExperientalPrivateIntransitiveDependencies By Default "Private Intransitive Dependencies" differ from the status quo by no longer requiring the concept of a "cascading dependency edge". This is because the request evaluator automatically tracks, records, and replays the names looked up while a given file is being processed by the frontend. To remove transitivity from the swiftdeps files, each primary file processed by the Swift frontend is charged for *all* name lookups that occur while it is being processed. Further, because of the replay step, lookups hidden behind cached requests are now entirely visible to the dependency tracking code. The net result is that all formerly implicit transitivity in the dependency graph has been made completely explicit and direct. This establishes a tighter overall dependency structure for each individual file, and results in a remarkable decrease in the amount of files that are rebuilt for any particular change. This feature can be disabled via -disable-experimental-private-intransitive-dependencies, which will cause a return to the cascading status quo. --- include/swift/Basic/LangOptions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h index 33b835b419cda..25cd70ebe8eed 100644 --- a/include/swift/Basic/LangOptions.h +++ b/include/swift/Basic/LangOptions.h @@ -367,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 EnableExperientalPrivateIntransitiveDependencies = true; /// Enable verification when every SubstitutionMap is constructed. bool VerifyAllSubstitutionMaps = false; From 7997183dbcc067c6665e5faaf2a96424f2a98912 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Mon, 8 Jun 2020 11:45:55 -0700 Subject: [PATCH 184/222] IRGen: Move emitProtocolConformance before emitLazyDefinitions It is possible that the only mention of metadata happens as part of protocol conformannce emission. This ordering makes sure we emit this metadata. SR-12891 rdar://63819461 --- lib/IRGen/GenDecl.cpp | 9 +++-- test/IRGen/associated_type_witness.swift | 36 ++++++++++--------- test/IRGen/lazy_metadata_no_reflection.swift | 2 +- test/IRGen/protocol_conformance_records.swift | 8 ++--- test/IRGen/protocol_resilience.sil | 35 +++++++++--------- test/IRGen/reflection_metadata.swift | 2 +- 6 files changed, 47 insertions(+), 45 deletions(-) diff --git a/lib/IRGen/GenDecl.cpp b/lib/IRGen/GenDecl.cpp index 7e6710311b798..0cfa3a13d2082 100644 --- a/lib/IRGen/GenDecl.cpp +++ b/lib/IRGen/GenDecl.cpp @@ -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/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/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/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}} From a48776705db72cf8d8fb5621f388d5231f5dbdcc Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Tue, 9 Jun 2020 13:52:09 -0700 Subject: [PATCH 185/222] [CS] Add a missing null check in repairFailures If we fail to simplify the locator, such as in the case where we have synthesized a missing call argument, bail without trying to add a missing call fix. Resolves SR-12964. Resolves rdar://64168162. --- lib/Sema/CSSimplify.cpp | 7 ++++--- test/Constraints/sr12964.swift | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 test/Constraints/sr12964.swift diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 03939a37519fc..37e2639ccf9a3 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -3047,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; 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}} From c749f37e8040240271ec5a7b69606b75bb42f191 Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Tue, 9 Jun 2020 13:18:59 -0700 Subject: [PATCH 186/222] [ownership] Add new OwnershipEliminatorPass that does not run when the current module is the stdlib. As part of bringing up ossa on the rest of the optimizer, I am going to be first moving ossa back for the stdlib module since the stdlib module does not have any sil based dependencies. To do so, I am adding this pass that I can place at the beginning of the pipeline (where NonTransparentFunctionOwnershipModelEliminator runs today) and then move NonTransparentFunctionOwnershipModelEliminator down as I update passes. If we are processing the stdlib, the ome doesn't run early and instead runs late. If we are not processing the stdlib, we perform first an OME run early and then perform an additional OME run that does nothing since lowering ownership is an idempotent operation. --- .../swift/SILOptimizer/PassManager/Passes.def | 3 +++ .../Mandatory/OwnershipModelEliminator.cpp | 24 +++++++++++++++---- test/SILOptimizer/ome_ignore_stdlib.sil | 13 ++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 test/SILOptimizer/ome_ignore_stdlib.sil diff --git a/include/swift/SILOptimizer/PassManager/Passes.def b/include/swift/SILOptimizer/PassManager/Passes.def index 32764fb41d601..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", 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/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 : $() +} From d890f29dfa92d21543c3cd1077efebfe500ee15b Mon Sep 17 00:00:00 2001 From: Dan Zheng Date: Tue, 9 Jun 2020 14:01:04 -0700 Subject: [PATCH 187/222] [AutoDiff] Improve debugging utilities. (#32269) - Show SIL type when printing `AdjointValue`. - Add utilities to print `PullbackEmitter` adjoint value and buffer mappings. - Print generated VJP before printing generated pullback. - This is useful because pullback generation may crash after VJP generation succeeds. --- .../Differentiation/AdjointValue.h | 9 ++- .../Differentiation/PullbackEmitter.h | 7 +++ .../Differentiation/PullbackEmitter.cpp | 60 +++++++++++++++++++ .../Differentiation/VJPEmitter.cpp | 7 ++- 4 files changed, 75 insertions(+), 8 deletions(-) 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/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/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp b/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp index 04e923bdfd4e6..f6e2c5be52732 100644 --- a/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp +++ b/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp @@ -514,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 //--------------------------------------------------------------------------// diff --git a/lib/SILOptimizer/Differentiation/VJPEmitter.cpp b/lib/SILOptimizer/Differentiation/VJPEmitter.cpp index 57cd002e4bc4a..a5e2b80348dae 100644 --- a/lib/SILOptimizer/Differentiation/VJPEmitter.cpp +++ b/lib/SILOptimizer/Differentiation/VJPEmitter.cpp @@ -842,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; } From 3228a5903a37b8e21253c5349b621b2dc0a73fa9 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Tue, 9 Jun 2020 15:44:02 -0700 Subject: [PATCH 188/222] [NFC] Rename Flags -enable-experimental-private-intransitive-dependencies -> -enable-direct-intramodule-dependencies -disable-experimental-private-intransitive-dependencies -> -disable-direct-intramodule-dependencies While we're here, rename DependencyCollector::Mode's constants and clean up the documentation. --- include/swift/AST/EvaluatorDependencies.h | 24 +++++++++-------- include/swift/Basic/LangOptions.h | 2 +- include/swift/Option/Options.td | 8 +++--- lib/AST/Evaluator.cpp | 26 +++++++++---------- lib/Driver/ToolChains.cpp | 4 +-- lib/Frontend/CompilerInvocation.cpp | 8 +++--- .../Dependencies/bindings-build-record.swift | 12 ++++----- .../chained-additional-kinds-fine.swift | 8 +++--- .../Dependencies/chained-after-fine.swift | 6 ++--- test/Driver/Dependencies/chained-fine.swift | 12 ++++----- .../chained-private-after-fine.swift | 6 ++--- .../chained-private-after-multiple-fine.swift | 6 ++--- ...-after-multiple-nominal-members-fine.swift | 6 ++--- .../Dependencies/chained-private-fine.swift | 6 ++--- .../check-interface-implementation-fine.swift | 6 ++--- .../Dependencies/crash-added-fine.swift | 10 +++---- test/Driver/Dependencies/crash-new-fine.swift | 16 ++++++------ .../Dependencies/crash-simple-fine.swift | 6 ++--- .../dependencies-preservation-fine.swift | 2 +- ...iver-show-incremental-arguments-fine.swift | 4 +-- ...cremental-conflicting-arguments-fine.swift | 8 +++--- ...iver-show-incremental-malformed-fine.swift | 10 +++---- .../driver-show-incremental-mutual-fine.swift | 6 ++--- ...-show-incremental-swift-version-fine.swift | 4 +-- .../embed-bitcode-parallel-fine.swift | 4 +-- .../Driver/Dependencies/fail-added-fine.swift | 8 +++--- .../Dependencies/fail-chained-fine.swift | 18 ++++++------- .../fail-interface-hash-fine.swift | 6 ++--- test/Driver/Dependencies/fail-new-fine.swift | 16 ++++++------ .../Dependencies/fail-simple-fine.swift | 6 ++--- .../fail-with-bad-deps-fine.swift | 10 +++---- .../Driver/Dependencies/file-added-fine.swift | 6 ++--- .../Dependencies/independent-fine.swift | 16 ++++++------ .../independent-parseable-fine.swift | 12 ++++----- .../malformed-but-valid-yaml-fine.swift | 16 ++++++------ test/Driver/Dependencies/malformed-fine.swift | 16 ++++++------ test/Driver/Dependencies/moduleonly.swift | 20 +++++++------- test/Driver/Dependencies/mutual-fine.swift | 8 +++--- .../mutual-interface-hash-fine.swift | 12 ++++----- .../Dependencies/nominal-members-fine.swift | 10 +++---- .../one-way-depends-after-fine.swift | 18 ++++++------- .../one-way-depends-before-fine.swift | 18 ++++++------- .../one-way-external-delete-fine.swift | 10 +++---- .../Dependencies/one-way-external-fine.swift | 12 ++++----- test/Driver/Dependencies/one-way-fine.swift | 26 +++++++++---------- .../one-way-merge-module-fine.swift | 4 +-- .../Dependencies/one-way-parallel-fine.swift | 4 +-- .../Dependencies/one-way-parseable-fine.swift | 8 +++--- .../one-way-provides-after-fine.swift | 16 ++++++------ .../one-way-provides-before-fine.swift | 16 ++++++------ .../one-way-while-editing-fine.swift | 8 +++--- test/Driver/Dependencies/only-skip-once.swift | 4 +-- .../Dependencies/private-after-fine.swift | 10 +++---- test/Driver/Dependencies/private-fine.swift | 14 +++++----- .../bindings-build-record.swift | 14 +++++----- .../chained-additional-kinds-fine.swift | 8 +++--- .../chained-after-fine.swift | 6 ++--- .../PrivateDependencies/chained-fine.swift | 12 ++++----- .../chained-private-after-fine.swift | 6 ++--- .../chained-private-after-multiple-fine.swift | 6 ++--- ...-after-multiple-nominal-members-fine.swift | 6 ++--- .../chained-private-fine.swift | 6 ++--- .../check-interface-implementation-fine.swift | 6 ++--- .../crash-added-fine.swift | 10 +++---- .../PrivateDependencies/crash-new-fine.swift | 16 ++++++------ .../crash-simple-fine.swift | 6 ++--- .../dependencies-preservation-fine.swift | 2 +- ...cremental-conflicting-arguments-fine.swift | 8 +++--- .../driver-show-incremental-inputs-fine.swift | 4 +-- ...iver-show-incremental-malformed-fine.swift | 10 +++---- .../driver-show-incremental-mutual-fine.swift | 6 ++--- ...-show-incremental-swift-version-fine.swift | 4 +-- .../embed-bitcode-parallel-fine.swift | 4 +-- .../PrivateDependencies/fail-added-fine.swift | 8 +++--- .../fail-chained-fine.swift | 18 ++++++------- .../fail-interface-hash-fine.swift | 6 ++--- .../PrivateDependencies/fail-new-fine.swift | 16 ++++++------ .../fail-simple-fine.swift | 6 ++--- .../fail-with-bad-deps-fine.swift | 10 +++---- .../PrivateDependencies/file-added-fine.swift | 6 ++--- .../independent-fine.swift | 16 ++++++------ .../independent-half-dirty-fine.swift | 6 ++--- .../independent-parseable-fine.swift | 12 ++++----- .../malformed-but-valid-yaml-fine.swift | 16 ++++++------ .../PrivateDependencies/malformed-fine.swift | 16 ++++++------ .../PrivateDependencies/moduleonly.swift | 20 +++++++------- .../PrivateDependencies/mutual-fine.swift | 8 +++--- .../mutual-interface-hash-fine.swift | 12 ++++----- .../nominal-members-fine.swift | 10 +++---- .../one-way-depends-before-fine.swift | 18 ++++++------- .../one-way-external-delete-fine.swift | 10 +++---- .../one-way-external-fine.swift | 12 ++++----- .../PrivateDependencies/one-way-fine.swift | 26 +++++++++---------- .../one-way-merge-module-fine.swift | 4 +-- .../one-way-parallel-fine.swift | 4 +-- .../one-way-parseable-fine.swift | 8 +++--- .../one-way-provides-after-fine.swift | 16 ++++++------ .../one-way-provides-before-fine.swift | 16 ++++++------ .../one-way-while-editing-fine.swift | 8 +++--- .../PrivateDependencies/only-skip-once.swift | 4 +-- .../private-after-fine.swift | 10 +++---- .../PrivateDependencies/private-fine.swift | 14 +++++----- .../whole-module-build-record.swift | 4 +-- .../Fingerprints/class-fingerprint.swift | 8 +++--- .../Fingerprints/enum-fingerprint.swift | 8 +++--- .../Fingerprints/extension-adds-member.swift | 8 +++--- .../Fingerprints/protocol-fingerprint.swift | 8 +++--- .../Fingerprints/struct-fingerprint.swift | 8 +++--- .../Dependencies/private-function-fine.swift | 4 +-- .../private-function-return-type-fine.swift | 4 +-- .../private-protocol-conformer-fine.swift | 4 +-- .../private-struct-member-fine.swift | 4 +-- .../Dependencies/private-subscript-fine.swift | 4 +-- .../Dependencies/private-typealias-fine.swift | 4 +-- .../Dependencies/private-var-fine.swift | 4 +-- ...erence-dependencies-consistency-fine.swift | 2 +- ...nce-dependencies-dynamic-lookup-fine.swift | 4 +-- .../reference-dependencies-errors.swift | 2 +- .../reference-dependencies-fine.swift | 4 +-- .../reference-dependencies-members-fine.swift | 4 +-- .../private-function-fine.swift | 4 +-- .../private-function-return-type-fine.swift | 4 +-- .../private-protocol-conformer-ext-fine.swift | 4 +-- .../private-protocol-conformer-fine.swift | 4 +-- .../private-struct-member-fine.swift | 4 +-- .../private-subscript-fine.swift | 4 +-- .../private-typealias-fine.swift | 4 +-- .../private-var-fine.swift | 4 +-- ...erence-dependencies-consistency-fine.swift | 2 +- ...nce-dependencies-dynamic-lookup-fine.swift | 4 +-- .../reference-dependencies-errors.swift | 2 +- .../reference-dependencies-fine.swift | 4 +-- .../reference-dependencies-members-fine.swift | 4 +-- .../Verifier/multi-file-private/main.swift | 4 +-- .../Verifier/multi-file/main.swift | 4 +-- .../single-file-private/AnyObject.swift | 2 +- .../single-file-private/Conformances.swift | 2 +- .../Verifier/single-file/AnyObject.swift | 2 +- .../Verifier/single-file/Conformances.swift | 2 +- test/Incremental/superfluous-cascade.swift | 8 +++--- unittests/AST/ArithmeticEvaluator.cpp | 4 +-- 141 files changed, 600 insertions(+), 598 deletions(-) diff --git a/include/swift/AST/EvaluatorDependencies.h b/include/swift/AST/EvaluatorDependencies.h index 04dbbb80c33f9..8af35b6f96896 100644 --- a/include/swift/AST/EvaluatorDependencies.h +++ b/include/swift/AST/EvaluatorDependencies.h @@ -237,17 +237,19 @@ 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: @@ -305,9 +307,9 @@ struct DependencyRecorder { if (dependencySources.empty()) return nullptr; switch (mode) { - case Mode::StatusQuo: + case Mode::LegacyCascadingDependencies: return dependencySources.back().getPointer(); - case Mode::ExperimentalPrivateDependencies: + case Mode::DirectDependencies: return dependencySources.front().getPointer(); } } @@ -347,9 +349,9 @@ struct DependencyRecorder { /// 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/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h index 25cd70ebe8eed..9456b729871b3 100644 --- a/include/swift/Basic/LangOptions.h +++ b/include/swift/Basic/LangOptions.h @@ -367,7 +367,7 @@ namespace swift { /// Whether to enable a more aggressive mode of incremental dependency /// gathering that never captures cascading edges. - bool EnableExperientalPrivateIntransitiveDependencies = true; + bool DirectIntramoduleDependencies = true; /// Enable verification when every SubstitutionMap is constructed. bool VerifyAllSubstitutionMaps = false; diff --git a/include/swift/Option/Options.td b/include/swift/Option/Options.td index 7498655d3ed7f..edaf19bdc3559 100644 --- a/include/swift/Option/Options.td +++ b/include/swift/Option/Options.td @@ -534,13 +534,13 @@ def enable_experimental_concise_pound_file : Flag<["-"], Flags<[FrontendOption]>, HelpText<"Enable experimental concise '#file' identifier">; -def enable_experimental_private_intransitive_dependencies : Flag<["-"], - "enable-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_experimental_private_intransitive_dependencies : Flag<["-"], - "disable-experimental-private-intransitive-dependencies">, +def disable_direct_intramodule_dependencies : Flag<["-"], + "disable-direct-intramodule-dependencies">, Flags<[FrontendOption, HelpHidden]>, HelpText<"Disable experimental dependency tracking that never cascades">; diff --git a/lib/AST/Evaluator.cpp b/lib/AST/Evaluator.cpp index a38c35933053a..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( @@ -455,7 +451,11 @@ void evaluator::DependencyRecorder::replay( 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; } @@ -503,7 +503,7 @@ void evaluator::DependencyRecorder::replay( void evaluator::DependencyRecorder::unionNearestCachedRequest( ArrayRef stack, const DependencyCollector::ReferenceSet &scratch) { - assert(mode != Mode::StatusQuo); + assert(mode != Mode::LegacyCascadingDependencies); auto nearest = std::find_if(stack.rbegin(), stack.rend(), [](const auto &req){ return req.isCached(); }); if (nearest == stack.rend()) { diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index afb6b8f391d62..b1d6f97b0e887 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -254,8 +254,8 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI, inputArgs.AddLastArg(arguments, options::OPT_verify_incremental_dependencies); inputArgs.AddLastArg(arguments, - options::OPT_enable_experimental_private_intransitive_dependencies, - options::OPT_disable_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 e99150416656e..c1fc9ac970bf5 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -435,10 +435,10 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args, if (Args.hasArg(OPT_enable_experimental_additive_arithmetic_derivation)) Opts.EnableExperimentalAdditiveArithmeticDerivedConformances = true; - Opts.EnableExperientalPrivateIntransitiveDependencies = - Args.hasFlag(OPT_enable_experimental_private_intransitive_dependencies, - OPT_disable_experimental_private_intransitive_dependencies, - /*default*/ 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); diff --git a/test/Driver/Dependencies/bindings-build-record.swift b/test/Driver/Dependencies/bindings-build-record.swift index c65fd761c1079..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 -disable-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 -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 -disable-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 -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 -disable-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 -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 -disable-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 -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 -disable-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 -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 -disable-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 -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 b01a0f43c50b4..f92c6346a8936 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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 329eefc66e3e7..56ab83ab43fcb 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 7e780c298ca7c..08bc5db3a6375 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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 a8c92d235ce79..6ba403117f3af 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 aacb7415d4113..786b16e751a32 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 1931ce3fde944..a7dbecd31408c 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 8bcf3033f3a73..d0a57f692710b 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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-dependencies -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" -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 0fc06a2f128ae..c33c0a12d8fa5 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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 5f091d9e516f8..f9d15e9b43127 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 -disable-experimental-private-intransitive-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 && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.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 -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 -disable-experimental-private-intransitive-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: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -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 -disable-experimental-private-intransitive-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 && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.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 -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 -disable-experimental-private-intransitive-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: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -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 -disable-experimental-private-intransitive-dependencies -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" -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 cbe1ba4a4e58c..feb3e2a288598 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-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 +// 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 -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// 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 -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 -disable-experimental-private-intransitive-dependencies -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" -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 | %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 -disable-experimental-private-intransitive-dependencies -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" -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 0cbe3356761fb..098d8ce46c855 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 b0934c3d2048b..b420a8830ce68 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 -disable-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" -c ./main.swift ./other.swift -module-name main -incremental -disable-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/Dependencies/driver-show-incremental-arguments-fine.swift b/test/Driver/Dependencies/driver-show-incremental-arguments-fine.swift index 098482f13e903..be02cbf537130 100644 --- a/test/Driver/Dependencies/driver-show-incremental-arguments-fine.swift +++ b/test/Driver/Dependencies/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 -disable-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" -c ./main.swift ./other.swift -module-name main -incremental -disable-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" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-experimental-private-intransitive-dependencies -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" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-direct-intramodule-dependencies -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/Dependencies/driver-show-incremental-conflicting-arguments-fine.swift b/test/Driver/Dependencies/driver-show-incremental-conflicting-arguments-fine.swift index f078e2732432c..d669dcc188058 100644 --- a/test/Driver/Dependencies/driver-show-incremental-conflicting-arguments-fine.swift +++ b/test/Driver/Dependencies/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 -disable-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" -c ./main.swift ./other.swift -module-name main -incremental -disable-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 -disable-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" -c ./main.swift ./other.swift -module-name main -incremental -disable-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 -disable-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" -c ./main.swift ./other.swift -module-name main -incremental -disable-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 -disable-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" -c ./main.swift ./other.swift -module-name main -incremental -disable-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/Dependencies/driver-show-incremental-malformed-fine.swift b/test/Driver/Dependencies/driver-show-incremental-malformed-fine.swift index 06b8d594e7056..02bdbe375e6f5 100644 --- a/test/Driver/Dependencies/driver-show-incremental-malformed-fine.swift +++ b/test/Driver/Dependencies/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 -disable-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" -c ./main.swift ./other.swift -module-name main -incremental -disable-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 -disable-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" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-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 -disable-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" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-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 -disable-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" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-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 -disable-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" -g -c ./main.swift ./other.swift -module-name main -incremental -disable-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/Dependencies/driver-show-incremental-mutual-fine.swift b/test/Driver/Dependencies/driver-show-incremental-mutual-fine.swift index f6b2d3da01673..3895382df7c54 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 -disable-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" -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 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 -disable-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" -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 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 -disable-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" -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 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 17099b47b1dd1..151e581a114c0 100644 --- a/test/Driver/Dependencies/driver-show-incremental-swift-version-fine.swift +++ b/test/Driver/Dependencies/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 -disable-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" -c ./main.swift ./other.swift -module-name main -incremental -disable-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 -disable-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" -c ./main.swift ./other.swift -module-name main -incremental -disable-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/Dependencies/embed-bitcode-parallel-fine.swift b/test/Driver/Dependencies/embed-bitcode-parallel-fine.swift index 8e87dacca2243..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 -disable-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 -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 -disable-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 -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 9105fa8f14275..a1e27ab3b4e08 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 -disable-experimental-private-intransitive-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 && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.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 -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 -disable-experimental-private-intransitive-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: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -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 -disable-experimental-private-intransitive-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 && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.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 -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 -disable-experimental-private-intransitive-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: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -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 da5473cfee00a..ee10b7bbd45a3 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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 1ea43b9321a7e..ae1dd733df7c5 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 -disable-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" -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 -disable-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" -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 -disable-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" -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 d955ac60ad054..b11374a4febea 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-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 +// 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 -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-dependencies -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" -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 32c46ab981af6..2f4f7595f1644 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-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: cd %t && not %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies-bad.py" -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 -disable-experimental-private-intransitive-dependencies -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" -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 06c349a275176..f027a5b13caae 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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 dadca3a1967fd..7fd6a3bb13eda 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 5c66158229ed5..fb8c3790b1d69 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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-parseable-fine.swift b/test/Driver/Dependencies/independent-parseable-fine.swift index 68c6623f29926..147d2611d4db5 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 145669b56a1aa..2e0edd7d9c6aa 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 48911600a35b9..1f77c7ce375d6 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 5cb4765c24645..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 -disable-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 -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 -disable-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 -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 -disable-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 -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 -disable-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 -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 -disable-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 -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 -disable-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 -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 -disable-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 -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 -disable-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 -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 -disable-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 -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 -disable-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 -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 18d12eccbc9c2..a5d4610794e15 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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 d6eea25e70ac3..36677de2493f1 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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 0eb41dbc28dc0..637298694bca3 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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 e6350625dcbbb..310e4e6b8539c 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 0bbaff605726e..c7a081c10aa00 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 30e4929dc8218..12304986c4ab8 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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 5d936a33f7e70..771796ffc72a6 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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 f15acf747ac57..afaf4d3bf84ef 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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 75dfd37223c74..8548ca9e36459 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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 0b695de4dbcbd..3b251ce6b1324 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 16e9fc29dd473..f1287332305e5 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 c48a3a3f29f50..37e791282556a 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 5c185eb9392e4..06207033351ee 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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" -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 0c470b63c06ea..d05a3f14a95e5 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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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" -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 8d837fae535b4..714d99f526441 100644 --- a/test/Driver/Dependencies/only-skip-once.swift +++ b/test/Driver/Dependencies/only-skip-once.swift @@ -4,7 +4,7 @@ // 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 -disable-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 -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 -disable-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 -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 583f18462f76f..0a002d35f4199 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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-dependencies -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" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 76def831ccd2b..1d3249d74bb8f 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 -disable-experimental-private-intransitive-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 +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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 -disable-experimental-private-intransitive-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: cd %t && %swiftc_driver -c -driver-use-frontend-path "%{python};%S/Inputs/update-dependencies.py" -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/bindings-build-record.swift b/test/Driver/PrivateDependencies/bindings-build-record.swift index 96e99162c34cc..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 -enable-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 -enable-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 -enable-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 -enable-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 -enable-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 -enable-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 -enable-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 f436bb2e2048e..08a90d1620637 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 f3a9b16e18bdb..b3d0718b7908b 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 7c1e3ee49c096..48e95a4f3bf4c 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 18815ba5fde69..fda6851f03bfd 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 71834054137e7..9bcd64b9cc265 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 759e078a9f5b5..57664db3e39c1 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 ca4eece69c183..faa7a286871fc 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 1ef85d2a40c60..cd0722ac7e532 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 6caf85f65e1d8..0b47de5f57305 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 9565be220e241..e2cd57610f593 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 b7cd70c89da08..d3061b7f86411 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 1f0b440e1f6af..2a365335f2c40 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 -enable-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" -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-conflicting-arguments-fine.swift b/test/Driver/PrivateDependencies/driver-show-incremental-conflicting-arguments-fine.swift index 1525df6392ef1..96dfb68034de2 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 01fa3b5012488..cdc301d4e608e 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 -enable-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" -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 -enable-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" -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 c11d8eba0a806..508d9b6a70bce 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 0ba8539484975..fbaa9edce8cc8 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 cd986b09f71ef..8ca6af2cea4c0 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 -enable-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" -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 -enable-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" -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 6de1bf92513ae..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 -enable-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 -enable-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 4b1da505aed71..1713e01d2791c 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 3c6cf9c527bc6..c18d9a3cfa478 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 6929f7d6506ce..30d4bf3a2dd39 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 b1f09440cb0eb..2e693d89656da 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 e060287a033e5..4d18a57665af2 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 c2cbd0a90e873..6829308e1d3d1 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 d607c6ea177f7..5267332ab1c04 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 7c2286e67d74a..9ac0c744aa73c 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 69cbdfaa196a2..08cec4506b45a 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 71d2c445f1a04..84733cd3f5bc3 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 b18fe408ab3b3..890d85f72bcc9 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 e96e409a078d2..a0b730c410773 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 2809b1c97c512..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 -enable-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 -enable-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 -enable-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 -enable-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 -enable-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 -enable-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 -enable-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 -enable-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 -enable-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 -enable-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 72842b6e1c12d..89156276c2fcf 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 67b8e77e424f5..cd7914f87ba99 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 e218447fa3a87..16410e8602231 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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-before-fine.swift b/test/Driver/PrivateDependencies/one-way-depends-before-fine.swift index 27e8389917d60..2596b1ee6ebec 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 5cd28564d1a76..572210af5073b 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 f3e54eace1efb..3d9a16768e551 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 14fb65c24f288..1188e0b294ede 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 544d2ba080232..7e05e56c54c1b 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 -enable-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" -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 -enable-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" -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 7039b98fef8fc..a5c9b0b273086 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 -enable-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" -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 -enable-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" -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 7d40e2f36e7b2..92267a0c0e6a2 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 8fbc179041cfa..5fb57ed44f2f8 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 2be7fbe87c265..bf1b48d0d3b5d 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 db479c860283c..50b7968d64351 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 -enable-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 -enable-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" -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 -enable-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 -enable-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" -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 2c7821cd87c9b..597bfcd9e02f2 100644 --- a/test/Driver/PrivateDependencies/only-skip-once.swift +++ b/test/Driver/PrivateDependencies/only-skip-once.swift @@ -4,7 +4,7 @@ // 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 -enable-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 -enable-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 4553e23ad290c..d453f717bfa7d 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 c0c752c80deb8..94fde640767b4 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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 -enable-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" -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 2629741eb1e23..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 -enable-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 -enable-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/Frontend/Fingerprints/class-fingerprint.swift b/test/Frontend/Fingerprints/class-fingerprint.swift index 6a37150fbec20..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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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,7 +67,7 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-experimental-private-intransitive-dependencies -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 diff --git a/test/Frontend/Fingerprints/enum-fingerprint.swift b/test/Frontend/Fingerprints/enum-fingerprint.swift index 39408347897d0..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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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,7 +67,7 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-experimental-private-intransitive-dependencies -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 diff --git a/test/Frontend/Fingerprints/extension-adds-member.swift b/test/Frontend/Fingerprints/extension-adds-member.swift index 34ac19affd7b6..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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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 518d106f16b4d..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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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,7 +67,7 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-experimental-private-intransitive-dependencies -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 diff --git a/test/Frontend/Fingerprints/struct-fingerprint.swift b/test/Frontend/Fingerprints/struct-fingerprint.swift index 6fbbe4ada884b..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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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,7 +67,7 @@ // RUN: touch -t 200101010101 %t/*.swift // RUN: touch -t 200301010101 %t/definesAB.swift -// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-experimental-private-intransitive-dependencies -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 diff --git a/test/Incremental/Dependencies/private-function-fine.swift b/test/Incremental/Dependencies/private-function-fine.swift index b8eeee8ff6089..831a3868a4e77 100644 --- a/test/Incremental/Dependencies/private-function-fine.swift +++ b/test/Incremental/Dependencies/private-function-fine.swift @@ -2,11 +2,11 @@ // 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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/private-function-return-type-fine.swift b/test/Incremental/Dependencies/private-function-return-type-fine.swift index dd96f4c412ed4..fbca3430d4c40 100644 --- a/test/Incremental/Dependencies/private-function-return-type-fine.swift +++ b/test/Incremental/Dependencies/private-function-return-type-fine.swift @@ -2,11 +2,11 @@ // 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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/private-protocol-conformer-fine.swift b/test/Incremental/Dependencies/private-protocol-conformer-fine.swift index 9db8c32e92b8a..7abe04b7e016f 100644 --- a/test/Incremental/Dependencies/private-protocol-conformer-fine.swift +++ b/test/Incremental/Dependencies/private-protocol-conformer-fine.swift @@ -2,11 +2,11 @@ // 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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/private-struct-member-fine.swift b/test/Incremental/Dependencies/private-struct-member-fine.swift index a8d4868179fe8..de059f9804dda 100644 --- a/test/Incremental/Dependencies/private-struct-member-fine.swift +++ b/test/Incremental/Dependencies/private-struct-member-fine.swift @@ -2,11 +2,11 @@ // 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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/private-subscript-fine.swift b/test/Incremental/Dependencies/private-subscript-fine.swift index ce0041e4d2f1e..e113b15c108b6 100644 --- a/test/Incremental/Dependencies/private-subscript-fine.swift +++ b/test/Incremental/Dependencies/private-subscript-fine.swift @@ -2,11 +2,11 @@ // 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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/private-typealias-fine.swift b/test/Incremental/Dependencies/private-typealias-fine.swift index f94acc2f1802b..20957a091b653 100644 --- a/test/Incremental/Dependencies/private-typealias-fine.swift +++ b/test/Incremental/Dependencies/private-typealias-fine.swift @@ -2,11 +2,11 @@ // 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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-NEW // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/Dependencies/private-var-fine.swift b/test/Incremental/Dependencies/private-var-fine.swift index a710212527b9d..0f9157953cea9 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 -disable-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 -disable-direct-intramodule-dependencies | %FileCheck %s -check-prefix=CHECK-OLD // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%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 -disable-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 -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 c87712f735a93..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 -disable-experimental-private-intransitive-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 +// 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 7ae477d3eb1cf..861863d686a3d 100644 --- a/test/Incremental/Dependencies/reference-dependencies-dynamic-lookup-fine.swift +++ b/test/Incremental/Dependencies/reference-dependencies-dynamic-lookup-fine.swift @@ -4,10 +4,10 @@ // RUN: %empty-directory(%t) // RUN: cp %s %t/main.swift -// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -disable-experimental-private-intransitive-dependencies -primary-file %t/main.swift -emit-reference-dependencies-path - > %t.swiftdeps +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -disable-direct-intramodule-dependencies -primary-file %t/main.swift -emit-reference-dependencies-path - > %t.swiftdeps // Check that the output is deterministic. -// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -disable-experimental-private-intransitive-dependencies -primary-file %t/main.swift -emit-reference-dependencies-path - > %t-2.swiftdeps +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -disable-direct-intramodule-dependencies -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: diff %t-processed.swiftdeps %t-2-processed.swiftdeps diff --git a/test/Incremental/Dependencies/reference-dependencies-errors.swift b/test/Incremental/Dependencies/reference-dependencies-errors.swift index c05a4de4e7de3..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 -disable-experimental-private-intransitive-dependencies -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 d80af35894585..ea311fffc8572 100644 --- a/test/Incremental/Dependencies/reference-dependencies-fine.swift +++ b/test/Incremental/Dependencies/reference-dependencies-fine.swift @@ -6,9 +6,9 @@ // 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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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 diff --git a/test/Incremental/Dependencies/reference-dependencies-members-fine.swift b/test/Incremental/Dependencies/reference-dependencies-members-fine.swift index 1375007051af5..71de041cdc29a 100644 --- a/test/Incremental/Dependencies/reference-dependencies-members-fine.swift +++ b/test/Incremental/Dependencies/reference-dependencies-members-fine.swift @@ -6,9 +6,9 @@ // 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 -disable-experimental-private-intransitive-dependencies -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 -disable-direct-intramodule-dependencies -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 -disable-experimental-private-intransitive-dependencies -primary-file %t/main.swift %S/../Inputs/reference-dependencies-members-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-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 diff --git a/test/Incremental/PrivateDependencies/private-function-fine.swift b/test/Incremental/PrivateDependencies/private-function-fine.swift index fe084fe230038..8df8fc0b6a231 100644 --- a/test/Incremental/PrivateDependencies/private-function-fine.swift +++ b/test/Incremental/PrivateDependencies/private-function-fine.swift @@ -2,11 +2,11 @@ // 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 -enable-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: %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 -enable-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: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift b/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift index 7755845c1fa94..1edb3b055c2b4 100644 --- a/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift +++ b/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift @@ -2,11 +2,11 @@ // 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 -enable-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: %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 -enable-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: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift b/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift index f31863afef2a5..3e48ce8cde141 100644 --- a/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift +++ b/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift @@ -2,11 +2,11 @@ // 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 -enable-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: %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 -enable-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: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift b/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift index 2c5ab354be811..f30c6ef106be1 100644 --- a/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift +++ b/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift @@ -2,11 +2,11 @@ // 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 -enable-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: %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 -enable-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: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-struct-member-fine.swift b/test/Incremental/PrivateDependencies/private-struct-member-fine.swift index 26469429bf735..e231a68dfdae5 100644 --- a/test/Incremental/PrivateDependencies/private-struct-member-fine.swift +++ b/test/Incremental/PrivateDependencies/private-struct-member-fine.swift @@ -2,11 +2,11 @@ // 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 -enable-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: %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 -enable-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: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-subscript-fine.swift b/test/Incremental/PrivateDependencies/private-subscript-fine.swift index f90eed9f0494a..2d12a7972e690 100644 --- a/test/Incremental/PrivateDependencies/private-subscript-fine.swift +++ b/test/Incremental/PrivateDependencies/private-subscript-fine.swift @@ -2,11 +2,11 @@ // 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 -enable-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: %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 -enable-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: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-typealias-fine.swift b/test/Incremental/PrivateDependencies/private-typealias-fine.swift index 4810c50b45950..a24e27cce8305 100644 --- a/test/Incremental/PrivateDependencies/private-typealias-fine.swift +++ b/test/Incremental/PrivateDependencies/private-typealias-fine.swift @@ -2,11 +2,11 @@ // 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 -enable-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: %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 -enable-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: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps // RUN: %FileCheck -check-prefix=CHECK-DEPS %s < %t-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/private-var-fine.swift b/test/Incremental/PrivateDependencies/private-var-fine.swift index 20373e0cdceb9..704b195a14cc3 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 -enable-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: %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 -enable-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 512abb9201cf8..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 -enable-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 28686be5162c7..2da5c38919347 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-dynamic-lookup-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-dynamic-lookup-fine.swift @@ -4,10 +4,10 @@ // 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 - -enable-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 - -enable-experimental-private-intransitive-dependencies > %t-2.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 <%t.swiftdeps >%t-processed.swiftdeps // RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh <%t-2.swiftdeps >%t-2-processed.swiftdeps // RUN: diff %t-processed.swiftdeps %t-2-processed.swiftdeps diff --git a/test/Incremental/PrivateDependencies/reference-dependencies-errors.swift b/test/Incremental/PrivateDependencies/reference-dependencies-errors.swift index 6480b44fa3e99..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 - -enable-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 732e03f552c85..99a8fbd2e4ff9 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-fine.swift @@ -6,9 +6,9 @@ // 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 - -enable-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 - -enable-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 diff --git a/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift b/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift index 6d4525abbbe97..554694628e3b3 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift @@ -6,9 +6,9 @@ // 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 - -enable-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 - -enable-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-members-helper.swift -emit-reference-dependencies-path - -enable-direct-intramodule-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 diff --git a/test/Incremental/Verifier/multi-file-private/main.swift b/test/Incremental/Verifier/multi-file-private/main.swift index 78451d1378f4c..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 -c -output-file-map %t/output.json -incremental -module-name main -enable-experimental-private-intransitive-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-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/main.swift b/test/Incremental/Verifier/multi-file/main.swift index 41193bf7bf384..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 -c -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-dependencies -module-name main -verify-incremental-dependencies @%t.resp -// RUN: cd %t && %target-swiftc_driver -c -output-file-map %t/output.json -incremental -disable-experimental-private-intransitive-dependencies -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 f382e9c75cec9..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 -enable-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 d56924bdaaf46..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 -enable-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 138ab7af295d7..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 -disable-experimental-private-intransitive-dependencies -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 5b35f90948284..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 -disable-experimental-private-intransitive-dependencies -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 07282cb261267..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 -disable-experimental-private-intransitive-dependencies -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 -disable-experimental-private-intransitive-dependencies -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 -enable-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 -enable-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/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); From 2cbf28d506bfe98819674eb3eefea85d5202047b Mon Sep 17 00:00:00 2001 From: 3405691582 Date: Fri, 13 Mar 2020 21:03:06 -0400 Subject: [PATCH 189/222] [test] Set LD_LIBRARY_PATH if testing on OpenBSD. LLVM binaries are built with rpath and dynamic libraries referenced relative to $ORIGIN. However, on OpenBSD, ld.so resolves $ORIGIN relative to the working directory, because on this platform there is no mechanism available to generically and portably track the path of a running executable[1]. Therefore, work around this by setting LD_LIBRARY_PATH to ensure that LLVM executables running in unit tests can properly reference the necessary LLVM dynamic libraries. [1] See https://marc.info/?l=openbsd-misc&m=144987773230417&w=2 --- test/lit.cfg | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/lit.cfg b/test/lit.cfg index 1bdc5cf705e8f..33a08cd66c828 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -166,6 +166,12 @@ swift_obj_root = getattr(config, 'swift_obj_root', None) 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'])) From 330dc0163499eb64c6e1d6888481f031eb990240 Mon Sep 17 00:00:00 2001 From: Dan Zheng Date: Tue, 9 Jun 2020 16:39:30 -0700 Subject: [PATCH 190/222] [AutoDiff upstream] NFC: garden doc comment. (#32264) --- include/swift/AST/AutoDiff.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/swift/AST/AutoDiff.h b/include/swift/AST/AutoDiff.h index 64ed422ede11c..5b447027b20c5 100644 --- a/include/swift/AST/AutoDiff.h +++ b/include/swift/AST/AutoDiff.h @@ -521,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, From 0d1f6ae8bbe3b63563ec03dc439ee2c2fc9485fd Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Tue, 9 Jun 2020 17:13:09 -0700 Subject: [PATCH 191/222] Print @escaping For Closures In Generated Memberwise Initializer Augment the "generate memberwise initializer" refactoring action to automatically print @escaping in parameter position. Closures as stored properties always escape. rdar://62202381 --- lib/IDE/Refactoring.cpp | 13 +++++++++++-- .../class_members.swift.expected | 8 +++++++- .../struct_members.swift.expected | 7 ++++++- .../MemberwiseInit/generate_memberwise.swift | 6 +++++- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/lib/IDE/Refactoring.cpp b/lib/IDE/Refactoring.cpp index 3445ab78ecfc5..a64ad89315458 100644 --- a/lib/IDE/Refactoring.cpp +++ b/lib/IDE/Refactoring.cpp @@ -3126,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, @@ -3139,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"; 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 From 07a328b7c4f140aedaca44bfbe2d5db3e4e9b1d2 Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Tue, 9 Jun 2020 19:42:49 -0700 Subject: [PATCH 192/222] [generics] Change replaceWithSpecializedCallee to use an exhaustive switch. This will ensure that if we ever add additional apply sites, we will get a warning to update this code. I also updated the coding style in this old piece of code. Just noticed this as I was preparing to update some code here. Should be NFC. --- lib/SILOptimizer/Utils/Generics.cpp | 127 +++++++++++++++------------- 1 file changed, 66 insertions(+), 61 deletions(-) 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"); } From 6a9d08793a1dc19a0e7260fe833307cc5fee2cab Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Tue, 9 Jun 2020 18:51:42 +0200 Subject: [PATCH 193/222] SILCombine: a peephole optimization to optimize alloc_stack of enums. 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 https://bugs.swift.org/browse/SR-12710 --- lib/SILOptimizer/SILCombiner/SILCombiner.h | 1 + .../SILCombiner/SILCombinerMiscVisitors.cpp | 99 ++++++++++++++ ...cast_optimizer_conditional_conformance.sil | 36 ++---- .../optional_of_existential.swift | 26 ++++ .../sil_combine_concrete_existential.sil | 16 +-- test/SILOptimizer/sil_combine_enum_addr.sil | 8 +- test/SILOptimizer/sil_combine_enums.sil | 121 +++++++++++++++++- 7 files changed, 265 insertions(+), 42 deletions(-) create mode 100644 test/SILOptimizer/optional_of_existential.swift 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/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/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/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 : $() +} + From 537b1030120b766f79490d112e18b886c8e6ff1e Mon Sep 17 00:00:00 2001 From: David Zarzycki Date: Wed, 10 Jun 2020 05:58:24 -0400 Subject: [PATCH 194/222] [testing] add missing REQUIRES: standalone_build --- validation-test/BuildSystem/infer_implies_install_all.test | 2 ++ validation-test/BuildSystem/install_all_linux.test | 1 + 2 files changed, 3 insertions(+) diff --git a/validation-test/BuildSystem/infer_implies_install_all.test b/validation-test/BuildSystem/infer_implies_install_all.test index 2b36960d1e7a7..48b570c66ec12 100644 --- a/validation-test/BuildSystem/infer_implies_install_all.test +++ b/validation-test/BuildSystem/infer_implies_install_all.test @@ -2,6 +2,8 @@ # 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 --- diff --git a/validation-test/BuildSystem/install_all_linux.test b/validation-test/BuildSystem/install_all_linux.test index fa2c103503bee..60dd5ab950ab0 100644 --- a/validation-test/BuildSystem/install_all_linux.test +++ b/validation-test/BuildSystem/install_all_linux.test @@ -2,6 +2,7 @@ # 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 --- From 9168b81a173b29c8954442d4ad6b39f5672faf76 Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Wed, 10 Jun 2020 13:25:49 +0200 Subject: [PATCH 195/222] Don't require the stdlib to contain the _finalizeUninitializedArray intrinsic function. Prevent SILGen to crash if the compiler is used with a stdlib which does not have the _finalizeUninitializedArray intrinsic function. rdar://problem/64195028 --- lib/SILGen/SILGenApply.cpp | 17 ++++++++--- lib/SILGen/SILGenExpr.cpp | 2 +- lib/SILGen/SILGenFunction.h | 3 +- .../Mandatory/OSLogOptimization.cpp | 30 ++++++++++--------- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/lib/SILGen/SILGenApply.cpp b/lib/SILGen/SILGenApply.cpp index 1b18f834f8fcd..aa1df2648942d 100644 --- a/lib/SILGen/SILGenApply.cpp +++ b/lib/SILGen/SILGenApply.cpp @@ -4963,17 +4963,26 @@ void SILGenFunction::emitUninitializedArrayDeallocation(SILLocation loc, } ManagedValue SILGenFunction::emitUninitializedArrayFinalization(SILLocation loc, - SILValue array) { + ManagedValue array) { auto &Ctx = getASTContext(); - auto finalize = Ctx.getFinalizeUninitializedArray(); + 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; - CanType arrayTy = array->getType().getASTType(); + 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(array), + ManagedValue::forUnmanaged(arrayVal), SGFContext()); return std::move(result).getScalarValue(); } diff --git a/lib/SILGen/SILGenExpr.cpp b/lib/SILGen/SILGenExpr.cpp index 315fd254557b7..886b14874deb9 100644 --- a/lib/SILGen/SILGenExpr.cpp +++ b/lib/SILGen/SILGenExpr.cpp @@ -2117,7 +2117,7 @@ ManagedValue Lowering::emitEndVarargs(SILGenFunction &SGF, SILLocation loc, if (array.hasCleanup()) SGF.Cleanups.setCleanupState(array.getCleanup(), CleanupState::Active); - return SGF.emitUninitializedArrayFinalization(loc, array.forward(SGF)); + return SGF.emitUninitializedArrayFinalization(loc, std::move(array)); } RValue RValueEmitter::visitTupleExpr(TupleExpr *E, SGFContext C) { diff --git a/lib/SILGen/SILGenFunction.h b/lib/SILGen/SILGenFunction.h index 4ab8b8cbbad40..554882727c383 100644 --- a/lib/SILGen/SILGenFunction.h +++ b/lib/SILGen/SILGenFunction.h @@ -1187,7 +1187,8 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction CleanupHandle enterDeallocateUninitializedArrayCleanup(SILValue array); void emitUninitializedArrayDeallocation(SILLocation loc, SILValue array); - ManagedValue emitUninitializedArrayFinalization(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/SILOptimizer/Mandatory/OSLogOptimization.cpp b/lib/SILOptimizer/Mandatory/OSLogOptimization.cpp index 19cb23f37a377..9b0ded1b091ed 100644 --- a/lib/SILOptimizer/Mandatory/OSLogOptimization.cpp +++ b/lib/SILOptimizer/Mandatory/OSLogOptimization.cpp @@ -539,14 +539,15 @@ static SILValue emitCodeForConstantArray(ArrayRef elements, module.findFunction(allocatorMangledName, SILLinkage::PublicExternal); assert(arrayAllocateFun); - FuncDecl *arrayFinalizeDecl = astContext.getFinalizeUninitializedArray(); - assert(arrayFinalizeDecl); - std::string finalizeMangledName = - SILDeclRef(arrayFinalizeDecl, SILDeclRef::Kind::Func).mangle(); - SILFunction *arrayFinalizeFun = - module.findFunction(finalizeMangledName, SILLinkage::SharedExternal); - assert(arrayFinalizeFun); - module.linkFunction(arrayFinalizeFun); + 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 @@ -605,12 +606,13 @@ static SILValue emitCodeForConstantArray(ArrayRef elements, StoreOwnershipQualifier::Init); ++elementIndex; } - FunctionRefInst *arrayFinalizeRef = - builder.createFunctionRef(loc, arrayFinalizeFun); - ApplyInst *finalizedArray = builder.createApply( - loc, arrayFinalizeRef, subMap, ArrayRef(arraySIL)); - - return finalizedArray; + if (arrayFinalizeFun) { + FunctionRefInst *arrayFinalizeRef = + builder.createFunctionRef(loc, arrayFinalizeFun); + arraySIL = builder.createApply(loc, arrayFinalizeRef, subMap, + ArrayRef(arraySIL)); + } + return arraySIL; } /// Given a SILValue \p value, return the instruction immediately following the From 017ee7bf04acac1cc11c205959129d9df9affdde Mon Sep 17 00:00:00 2001 From: David Zarzycki Date: Mon, 8 Jun 2020 10:42:04 -0400 Subject: [PATCH 196/222] [SIL] NFC: Simplify SILVTable and save 8 bytes per SILVTable We were not using the primary benefits of an intrusive list, namely the ability to insert or remove from the middle of the list, so let's switch to a plain vector. This also avoids linked-list pointer chasing. --- include/swift/SIL/SILModule.h | 23 ++++++++----------- include/swift/SIL/SILVTable.h | 5 +--- lib/Frontend/Frontend.cpp | 2 +- lib/FrontendTool/FrontendTool.cpp | 2 +- lib/SIL/IR/SILModule.cpp | 3 +++ lib/SIL/IR/SILPrinter.cpp | 10 ++++---- lib/SIL/Verifier/SILVerifier.cpp | 16 ++++++------- .../Analysis/BasicCalleeAnalysis.cpp | 14 +++++------ .../Analysis/ClassHierarchyAnalysis.cpp | 4 ++-- .../IPO/DeadFunctionElimination.cpp | 16 ++++++------- lib/SILOptimizer/Transforms/PruneVTables.cpp | 2 +- .../UtilityPasses/SerializeSILPass.cpp | 2 +- lib/Serialization/SerializeSIL.cpp | 8 +++---- tools/sil-nm/SILNM.cpp | 4 ++-- 14 files changed, 53 insertions(+), 58 deletions(-) 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/SILVTable.h b/include/swift/SIL/SILVTable.h index d5cb3df2010d8..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. diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index 059ef75e72ae4..36c99310b587e 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -1000,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 2c327d1ec57cb..8610dbc96e654 100644 --- a/lib/FrontendTool/FrontendTool.cpp +++ b/lib/FrontendTool/FrontendTool.cpp @@ -736,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(); diff --git a/lib/SIL/IR/SILModule.cpp b/lib/SIL/IR/SILModule.cpp index a25be897da990..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 diff --git a/lib/SIL/IR/SILPrinter.cpp b/lib/SIL/IR/SILPrinter.cpp index a6e94200f2f1b..7d1c2b91b437f 100644 --- a/lib/SIL/IR/SILPrinter.cpp +++ b/lib/SIL/IR/SILPrinter.cpp @@ -2797,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(); @@ -3067,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()); diff --git a/lib/SIL/Verifier/SILVerifier.cpp b/lib/SIL/Verifier/SILVerifier.cpp index ba410202e7815..2a974fb82aa74 100644 --- a/lib/SIL/Verifier/SILVerifier.cpp +++ b/lib/SIL/Verifier/SILVerifier.cpp @@ -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/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/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/Transforms/PruneVTables.cpp b/lib/SILOptimizer/Transforms/PruneVTables.cpp index c3f7cf8d7ac70..cbd9ce1288736 100644 --- a/lib/SILOptimizer/Transforms/PruneVTables.cpp +++ b/lib/SILOptimizer/Transforms/PruneVTables.cpp @@ -61,7 +61,7 @@ class PruneVTables : public SILModuleTransform { SILModule *M = getModule(); for (auto &vtable : M->getVTables()) { - runOnVTable(M, &vtable); + runOnVTable(M, vtable); } } }; 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/Serialization/SerializeSIL.cpp b/lib/Serialization/SerializeSIL.cpp index a7e185abc5274..8eeaff83c2aff 100644 --- a/lib/Serialization/SerializeSIL.cpp +++ b/lib/Serialization/SerializeSIL.cpp @@ -2659,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/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'); } From 65a08466fdfbe65578ab041f45a4b4529994e2b3 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Wed, 10 Jun 2020 06:42:31 -0700 Subject: [PATCH 197/222] Fix c_globals.swift test on arm64 This test sets -mno-omit-leaf-frame-pointer --- test/IRGen/c_globals.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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" From 05ed0dd1a6d73d7ddf35cb110e408ff5e88ae49e Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Wed, 10 Jun 2020 08:39:10 -0700 Subject: [PATCH 198/222] Add back test case --- .../conditional_conformance_typemetadata.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/IRGen/conditional_conformance_typemetadata.swift 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) From 50dc7d85ddcf99f2b27ca0b7a88f2c929e6f5dc3 Mon Sep 17 00:00:00 2001 From: Nathan Hawes Date: Tue, 9 Jun 2020 14:49:22 -0700 Subject: [PATCH 199/222] [Driver/SourceKit] Handle filelist driver args in getSingleFrontendInvocationFromDriverArguments getSingleFrontendInvocationFromDriverArguments is set up to never produce file lists in the output frontend arguments, but since the driver accepts file lists as input arguments, this should too. --- lib/Driver/FrontendUtil.cpp | 12 ++++++++++++ .../SourceKit/Misc/handle-filelist-driver-args.swift | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 test/SourceKit/Misc/handle-filelist-driver-args.swift diff --git a/lib/Driver/FrontendUtil.cpp b/lib/Driver/FrontendUtil.cpp index 3c0cac6163d4a..7d796ddfc722c 100644 --- a/lib/Driver/FrontendUtil.cpp +++ b/lib/Driver/FrontendUtil.cpp @@ -19,6 +19,8 @@ #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; @@ -46,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); 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 From 99ab7db18d6bad8c8c9f7109ee8f815794bf10f2 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Wed, 10 Jun 2020 11:11:22 -0700 Subject: [PATCH 200/222] [Gardening] Document DependencyRecorder and DependencyCollector --- include/swift/AST/EvaluatorDependencies.h | 58 +++++++++++++++++++++-- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/include/swift/AST/EvaluatorDependencies.h b/include/swift/AST/EvaluatorDependencies.h index 8af35b6f96896..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,11 +235,15 @@ 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; @@ -266,15 +278,49 @@ 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 llvm::SetVector &stack, - 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); @@ -282,6 +328,12 @@ struct DependencyRecorder { 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 ; From 673027044fb8214353aba3418da3c4e261d5c14c Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 2 Jun 2020 00:46:02 -0400 Subject: [PATCH 201/222] Dependencies: Small cleanup in FineGrainedDependencies.{h,cpp} --- include/swift/AST/FineGrainedDependencies.h | 2 +- lib/AST/FineGrainedDependencies.cpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/swift/AST/FineGrainedDependencies.h b/include/swift/AST/FineGrainedDependencies.h index f76a0f5305484..02084b51bd10c 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 // diff --git a/lib/AST/FineGrainedDependencies.cpp b/lib/AST/FineGrainedDependencies.cpp index b3f9c752b0e80..62d37ed24273b 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 From d59a76c248613dbd8348d608cbf4b3f704d056b0 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 2 Jun 2020 00:46:55 -0400 Subject: [PATCH 202/222] Dependencies: New binary format for fine-grained dependency graph --- include/swift/AST/FileSystem.h | 1 + include/swift/AST/FineGrainedDependencies.h | 6 +- .../swift/AST/FineGrainedDependencyFormat.h | 106 ++++ lib/AST/CMakeLists.txt | 1 + lib/AST/FineGrainedDependencies.cpp | 24 +- lib/AST/FineGrainedDependencyFormat.cpp | 482 ++++++++++++++++++ lib/AST/FrontendSourceFileDepGraphFactory.cpp | 8 +- .../FineGrainedDependencyDriverGraph.cpp | 2 + 8 files changed, 621 insertions(+), 9 deletions(-) create mode 100644 include/swift/AST/FineGrainedDependencyFormat.h create mode 100644 lib/AST/FineGrainedDependencyFormat.cpp 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 02084b51bd10c..854d0e921fa76 100644 --- a/include/swift/AST/FineGrainedDependencies.h +++ b/include/swift/AST/FineGrainedDependencies.h @@ -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()); @@ -872,7 +877,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..c514a5217c75f --- /dev/null +++ b/include/swift/AST/FineGrainedDependencyFormat.h @@ -0,0 +1,106 @@ +//===---- 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; + +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; + +namespace record_block { + enum { + METADATA = 1, + SOURCE_FILE_DEP_GRAPH_NODE, + FINGERPRINT_NODE, + DEPENDS_ON_DEFINITION_NODE, + IDENTIFIER_NODE, + }; + + using MetadataLayout = BCRecordLayout< + METADATA, // ID + BCFixed<16>, // Dependency graph format major version + BCFixed<16>, // Dependency graph format minor version + BCBlob // Compiler version string + >; + + using SourceFileDepGraphNodeLayout = BCRecordLayout< + SOURCE_FILE_DEP_GRAPH_NODE, // ID + NodeKindField, // Dependency key node kind + DeclAspectField, // Dependency key declaration aspect + IdentifierIDField, // Dependency key mangled context type name + IdentifierIDField, // Dependency key basic name + BCFixed<1> // Is this a "provides" node? + >; + + // Optionally follows DEPENDS_ON_DEFINITION_NODE. + using FingerprintNodeLayout = BCRecordLayout< + FINGERPRINT_NODE, + BCBlob + >; + + // Optionally follows SOURCE_FILE_DEP_GRAPH_NODE and FINGERPRINT_NODE. + using DependsOnDefNodeLayout = BCRecordLayout< + DEPENDS_ON_DEFINITION_NODE, + BCVBR<16> + >; + + // Optionally follows all other nodes. + using IdentifierNodeLayout = BCRecordLayout< + IDENTIFIER_NODE, + BCBlob + >; +} + +bool readFineGrainedDependencyGraph(llvm::MemoryBuffer &buffer, + SourceFileDepGraph &g); + +bool readFineGrainedDependencyGraph(llvm::StringRef path, + SourceFileDepGraph &g); + +bool writeFineGrainedDependencyGraph(DiagnosticEngine &diags, llvm::StringRef path, + const SourceFileDepGraph &g); + +} // namespace fine_grained_dependencies +} // namespace swift + +#endif 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/FineGrainedDependencies.cpp b/lib/AST/FineGrainedDependencies.cpp index 62d37ed24273b..ad553152e2b6b 100644 --- a/lib/AST/FineGrainedDependencies.cpp +++ b/lib/AST/FineGrainedDependencies.cpp @@ -17,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" @@ -29,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 @@ -50,13 +52,21 @@ 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()) - return None; - // return fg; compiles for Mac but not Linux, because it cannot be copied. - return Optional(std::move(fg)); + if (false) { + SourceFileDepGraph fg; + llvm::yaml::Input yamlReader(llvm::MemoryBufferRef(buffer), nullptr); + yamlReader >> fg; + if (yamlReader.error()) + return None; + // return fg; compiles for Mac but not Linux, because it cannot be copied. + return Optional(std::move(fg)); + } else { + SourceFileDepGraph fg; + if (swift::fine_grained_dependencies::readFineGrainedDependencyGraph( + buffer, fg)) + return None; + return Optional(std::move(fg)); + } } //============================================================================== diff --git a/lib/AST/FineGrainedDependencyFormat.cpp b/lib/AST/FineGrainedDependencyFormat.cpp new file mode 100644 index 0000000000000..c3b7f0ef986b1 --- /dev/null +++ b/lib/AST/FineGrainedDependencyFormat.cpp @@ -0,0 +1,482 @@ +//===---- 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; + + 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() { + { + 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; + } + + { + 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..60bc24b6416ac 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,18 @@ bool fine_grained_dependencies::emitReferenceDependencies( SF, outputPath, depTracker, alsoEmitDotFile) .construct(); - const bool hadError = + bool hadError = false; + if (false) { + hadError = withOutputFile(diags, outputPath, [&](llvm::raw_pwrite_stream &out) { out << g.yamlProlog(SF->getASTContext().hadError()); llvm::yaml::Output yamlWriter(out); yamlWriter << g; return false; }); + } else { + 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/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; From 82c0897b45e901a34fcb717809750c41c0a5cd75 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 7 Jun 2020 02:43:40 -0400 Subject: [PATCH 203/222] Dependencies: Fix uninitialized memory in SourceFileDepGraphNode --- include/swift/AST/FineGrainedDependencies.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/swift/AST/FineGrainedDependencies.h b/include/swift/AST/FineGrainedDependencies.h index 854d0e921fa76..eaea1dcb58c2c 100644 --- a/include/swift/AST/FineGrainedDependencies.h +++ b/include/swift/AST/FineGrainedDependencies.h @@ -689,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; @@ -697,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, From 4ff62ec27744027602931e0fd7d0ed903a17f194 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 7 Jun 2020 02:45:10 -0400 Subject: [PATCH 204/222] Dependencies: Implement SourceFileDepGraphNode::dump() --- include/swift/AST/FineGrainedDependencies.h | 3 +++ lib/AST/FineGrainedDependencies.cpp | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/swift/AST/FineGrainedDependencies.h b/include/swift/AST/FineGrainedDependencies.h index eaea1dcb58c2c..381b4443c0cb3 100644 --- a/include/swift/AST/FineGrainedDependencies.h +++ b/include/swift/AST/FineGrainedDependencies.h @@ -741,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()); diff --git a/lib/AST/FineGrainedDependencies.cpp b/lib/AST/FineGrainedDependencies.cpp index ad553152e2b6b..8a90050e1b3bd 100644 --- a/lib/AST/FineGrainedDependencies.cpp +++ b/lib/AST/FineGrainedDependencies.cpp @@ -341,6 +341,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() + From 915e215a3d50381b8571aa3e30b03e15551c6de3 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 5 Jun 2020 14:38:27 -0700 Subject: [PATCH 205/222] [ClangImporter] Make sure that inherited convenience constructors are included in members of `IterableDeclContext` Previously inherited constructors would be skipped from added in member list, depending on the order of request evaluator calls. This was a regression compared to swift 5.2 --- lib/ClangImporter/ImportDecl.cpp | 27 +- .../api-digester/Inputs/Foo-new-version/foo.h | 10 + test/api-digester/Inputs/Foo/foo.h | 10 + .../Outputs/clang-module-dump.txt | 334 ++++++++++++++++++ 4 files changed, 371 insertions(+), 10 deletions(-) diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index 5f971d0872e63..a2726dd6c4c29 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -4313,12 +4313,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 +4562,7 @@ namespace { ImportedName importedName, ArrayRef args, bool variadic, - bool &redundant); + ConstructorDecl *&existing); void recordObjCOverride(SubscriptDecl *subscript); @@ -6241,11 +6241,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 +6357,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 +6458,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 +7395,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/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 From fc9070c072d806e96a5142bfa75e89dab0785203 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Wed, 10 Jun 2020 12:05:28 -0700 Subject: [PATCH 206/222] Strip TypeLoc from IsPattern --- include/swift/AST/Pattern.h | 30 ++++++------------ lib/AST/ASTDumper.cpp | 2 +- lib/AST/ASTPrinter.cpp | 2 +- lib/AST/ASTWalker.cpp | 5 +-- lib/AST/Pattern.cpp | 30 ++++++++++++++++++ lib/Parse/ParsePattern.cpp | 6 ++-- lib/SILGen/SILGenDecl.cpp | 2 +- lib/SILGen/SILGenPattern.cpp | 7 ++--- lib/Sema/CSGen.cpp | 10 +++--- lib/Sema/TypeCheckPattern.cpp | 59 +++++++++++++++++------------------ 10 files changed, 85 insertions(+), 68 deletions(-) diff --git a/include/swift/AST/Pattern.h b/include/swift/AST/Pattern.h index 7b11705882afb..51baeacded90c 100644 --- a/include/swift/AST/Pattern.h +++ b/include/swift/AST/Pattern.h @@ -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; diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index 2e3c555a7e646..1769bbce13e47 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -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); diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index 8084deab1cb23..dab5dd0bd6716 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -1158,7 +1158,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; } diff --git a/lib/AST/ASTWalker.cpp b/lib/AST/ASTWalker.cpp index b00602418e3f1..8732a3e548b9d 100644 --- a/lib/AST/ASTWalker.cpp +++ b/lib/AST/ASTWalker.cpp @@ -1691,8 +1691,9 @@ 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; } diff --git a/lib/AST/Pattern.cpp b/lib/AST/Pattern.cpp index a6385bc564991..a506dd02da5f2 100644 --- a/lib/AST/Pattern.cpp +++ b/lib/AST/Pattern.cpp @@ -441,6 +441,36 @@ 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) { + 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) 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/SILGen/SILGenDecl.cpp b/lib/SILGen/SILGenDecl.cpp index ace1e9e71c359..20c4f77afeaa3 100644 --- a/lib/SILGen/SILGenDecl.cpp +++ b/lib/SILGen/SILGenDecl.cpp @@ -966,7 +966,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/SILGenPattern.cpp b/lib/SILGen/SILGenPattern.cpp index ecacd2536ca7d..7bf50937aff6e 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; @@ -1581,7 +1580,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(); } diff --git a/lib/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index dd38eb631021b..67afbdfdb513f 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -2524,7 +2524,7 @@ namespace { auto isPattern = cast(pattern); Type castType = resolveTypeReferenceInExpression( - isPattern->getCastTypeLoc(), TypeResolverContext::InExpression); + isPattern->getCastTypeRepr(), TypeResolverContext::InExpression); if (!castType) return Type(); @@ -2749,10 +2749,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; } diff --git a/lib/Sema/TypeCheckPattern.cpp b/lib/Sema/TypeCheckPattern.cpp index 2dca6ae545e11..aed7bedfdb90b 100644 --- a/lib/Sema/TypeCheckPattern.cpp +++ b/lib/Sema/TypeCheckPattern.cpp @@ -361,10 +361,16 @@ class ResolvePattern : public ASTVisitorgetCastTypeRepr(), cast->getCastType()); Pattern *subPattern = getSubExprPattern(E->getElement(0)); - return new (Context) IsPattern(cast->getLoc(), tyLoc, 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. @@ -614,12 +620,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. @@ -1222,11 +1226,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; @@ -1254,15 +1258,11 @@ Pattern *TypeChecker::coercePatternToType(ContextualPattern pattern, pattern.forSubPattern(P, /*retainTopLevle=*/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 +1272,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 +1285,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 +1299,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; @@ -1528,10 +1527,8 @@ Pattern *TypeChecker::coercePatternToType(ContextualPattern pattern, // 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; } From 60ec3f1b904bced371180a6490d8999e2aeb12a9 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Wed, 10 Jun 2020 13:31:10 -0700 Subject: [PATCH 207/222] Fix debug description for cases with multiple items (#32282) * [SILGenFunction] Don't create redundant nested debug scopes Instead of emitting: ``` sil_scope 4 { loc "main.swift":6:19 parent 3 } sil_scope 5 { loc "main.swift":7:3 parent 4 } sil_scope 6 { loc "main.swift":7:3 parent 5 } sil_scope 7 { loc "main.swift":7:3 parent 5 } sil_scope 8 { loc "main.swift":9:5 parent 4 } ``` Emit: ``` sil_scope 4 { loc "main.swift":6:19 parent 3 } sil_scope 5 { loc "main.swift":7:3 parent 4 } sil_scope 6 { loc "main.swift":9:5 parent 5 } ``` * [IRGenSIL] Diagnose conflicting shadow copies If we attempt to store a value with the wrong type into a slot reserved for a shadow copy, diagnose what went wrong. * [SILGenPattern] Defer debug description of case variables Create unique nested debug scopes for a switch, each of its case labels, and each of its case bodies. This looks like: ``` switch ... { // Enter scope 1. case ... : // Enter scope 2, nested within scope 1. // Enter scope 3, nested within scope 2. case ... : // Enter scope 4, nested within scope 1. // Enter scope 5, nested within scope 4. } ``` Use the new scope structure to defer emitting debug descriptions of case bindings. Specifically, defer the work until we can nest the scope for a case body under the scope for a pattern match. This fixes SR-7973, a problem where it was impossible to inspect a case binding in lldb when stopped at a case with multiple items. Previously, we would emit the debug descriptions too early (in the pattern match), leading to duplicate/conflicting descriptions. The only reason that the ambiguous description was allowed to compile was because the debug scopes were nested incorrectly. rdar://41048339 * Update tests --- include/swift/SIL/SILBuilder.h | 8 ++ include/swift/SIL/SILDebugScope.h | 12 +-- include/swift/SIL/SILLocation.h | 2 + lib/IRGen/IRGenSIL.cpp | 26 +++++- lib/SIL/IR/SILPrinter.cpp | 10 +-- lib/SILGen/Initialization.h | 6 ++ lib/SILGen/SILGenDecl.cpp | 9 +- lib/SILGen/SILGenFunction.h | 11 ++- lib/SILGen/SILGenPattern.cpp | 29 ++++++- .../SILOptimizer/activity_analysis.swift | 12 +-- test/DebugInfo/patternmatching.swift | 87 ++++++++++++------- test/DebugInfo/patternvars.swift | 10 +-- test/SILGen/errors.swift | 4 +- .../switch-case-debug-descriptions.swift | 57 ++++++++++++ test/SILGen/switch.swift | 3 +- test/SILGen/switch_debuginfo.swift | 10 +-- test/SILGen/switch_fallthrough.swift | 4 +- test/SILGen/switch_isa.swift | 2 + .../switch_multiple_entry_address_only.swift | 1 + test/SILGen/switch_var.swift | 7 +- 20 files changed, 227 insertions(+), 83 deletions(-) create mode 100644 test/SILGen/switch-case-debug-descriptions.swift diff --git a/include/swift/SIL/SILBuilder.h b/include/swift/SIL/SILBuilder.h index 48e6d4438e12a..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, \ 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/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/lib/IRGen/IRGenSIL.cpp b/lib/IRGen/IRGenSIL.cpp index ddd0d2d9d0ab7..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(); diff --git a/lib/SIL/IR/SILPrinter.cpp b/lib/SIL/IR/SILPrinter.cpp index 7d1c2b91b437f..29034513c01e0 100644 --- a/lib/SIL/IR/SILPrinter.cpp +++ b/lib/SIL/IR/SILPrinter.cpp @@ -3381,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); @@ -3391,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()) @@ -3403,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/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/SILGenDecl.cpp b/lib/SILGen/SILGenDecl.cpp index ace1e9e71c359..8fdfeaa055ce3 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, diff --git a/lib/SILGen/SILGenFunction.h b/lib/SILGen/SILGenFunction.h index 554882727c383..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); } diff --git a/lib/SILGen/SILGenPattern.cpp b/lib/SILGen/SILGenPattern.cpp index ecacd2536ca7d..1024cbd4ff8d7 100644 --- a/lib/SILGen/SILGenPattern.cpp +++ b/lib/SILGen/SILGenPattern.cpp @@ -1193,6 +1193,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()); @@ -2441,7 +2452,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 +2483,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 +2624,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 +2648,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 +2772,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/test/AutoDiff/SILOptimizer/activity_analysis.swift b/test/AutoDiff/SILOptimizer/activity_analysis.swift index 8cd0341b6cea8..bb177b0d5bc97 100644 --- a/test/AutoDiff/SILOptimizer/activity_analysis.swift +++ b/test/AutoDiff/SILOptimizer/activity_analysis.swift @@ -843,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/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/SILGen/errors.swift b/test/SILGen/errors.swift index deb8bb9595970..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 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) From 2371e5c260200886dbaed8442bcc5d820cf031a9 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Wed, 10 Jun 2020 13:15:10 -0700 Subject: [PATCH 208/222] Strip TypeLoc from EnumElementPattern --- include/swift/AST/Pattern.h | 59 +++++-------- lib/AST/ASTDumper.cpp | 3 +- lib/AST/ASTWalker.cpp | 4 +- lib/AST/Pattern.cpp | 35 ++++++++ lib/Sema/CSGen.cpp | 17 ++-- lib/Sema/DerivedConformanceCodingKey.cpp | 4 +- lib/Sema/DerivedConformanceComparable.cpp | 16 ++-- .../DerivedConformanceEquatableHashable.cpp | 29 +++---- .../DerivedConformanceRawRepresentable.cpp | 6 +- lib/Sema/DerivedConformances.cpp | 6 +- lib/Sema/TypeCheckPattern.cpp | 86 +++++++++---------- test/Constraints/patterns.swift | 20 ++++- 12 files changed, 159 insertions(+), 126 deletions(-) diff --git a/include/swift/AST/Pattern.h b/include/swift/AST/Pattern.h index 51baeacded90c..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. @@ -503,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; @@ -511,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; } @@ -543,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; } @@ -567,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/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index 1769bbce13e47..e8f68bfe4b95e 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -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'; diff --git a/lib/AST/ASTWalker.cpp b/lib/AST/ASTWalker.cpp index 8732a3e548b9d..4f553432aa766 100644 --- a/lib/AST/ASTWalker.cpp +++ b/lib/AST/ASTWalker.cpp @@ -1698,8 +1698,8 @@ Pattern *Traversal::visitIsPattern(IsPattern *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/Pattern.cpp b/lib/AST/Pattern.cpp index a506dd02da5f2..97178c4eb9156 100644 --- a/lib/AST/Pattern.cpp +++ b/lib/AST/Pattern.cpp @@ -466,6 +466,7 @@ SourceRange IsPattern::getSourceRange() const { Type IsPattern::getCastType() const { return CastType->getInstanceType(); } void IsPattern::setCastType(Type type) { + assert(type); CastType->setType(MetatypeType::get(type)); } @@ -479,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/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index 67afbdfdb513f..79b8d7ab346f8 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -1481,11 +1481,6 @@ namespace { Type resolveTypeReferenceInExpression(TypeRepr *repr, TypeResolverContext resCtx) { TypeLoc loc(repr); - return resolveTypeReferenceInExpression(loc, resCtx); - } - - Type resolveTypeReferenceInExpression(TypeLoc &loc, - TypeResolverContext resCtx) { TypeResolutionOptions options(resCtx); options |= TypeResolutionFlags::AllowUnboundGenerics; bool hadError = TypeChecker::validateType( @@ -2581,10 +2576,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(), TypeResolverContext::InExpression); + Type parentType = [&]() -> Type { + if (auto preTy = enumPattern->getParentType()) { + return preTy; + } + return resolveTypeReferenceInExpression( + enumPattern->getParentTypeRepr(), + TypeResolverContext::InExpression); + }(); if (!parentType) return Type(); 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..d543ffb7314a6 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(); diff --git a/lib/Sema/DerivedConformanceEquatableHashable.cpp b/lib/Sema/DerivedConformanceEquatableHashable.cpp index c55e9117207ae..dbd323d495fe0 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(); @@ -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/TypeCheckPattern.cpp b/lib/Sema/TypeCheckPattern.cpp index aed7bedfdb90b..ab3058092a526 100644 --- a/lib/Sema/TypeCheckPattern.cpp +++ b/lib/Sema/TypeCheckPattern.cpp @@ -483,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. @@ -499,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) { @@ -515,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); } @@ -549,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; @@ -573,7 +575,8 @@ class ResolvePattern : public ASTVisitor(enumTy->getAnyNominal())) + auto *enumDecl = dyn_cast_or_null(enumTy->getAnyNominal()); + if (!enumDecl) return nullptr; referencedElement @@ -583,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); } }; @@ -1204,11 +1208,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); } @@ -1238,24 +1241,25 @@ 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( @@ -1405,7 +1409,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; @@ -1519,12 +1523,8 @@ 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 = 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}} } } From 499ed05fd9571c2633acc19c30fa36dcb07a6002 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 10 Jun 2020 15:16:00 -0700 Subject: [PATCH 209/222] Revert "Emit coverage mappings for all modules" --- lib/IRGen/GenDecl.cpp | 7 ++----- test/Profiler/Inputs/coverage_num_threads1.swift | 1 - test/Profiler/Inputs/coverage_num_threads2.swift | 1 - test/Profiler/coverage_num_threads.swift | 12 ------------ 4 files changed, 2 insertions(+), 19 deletions(-) delete mode 100644 test/Profiler/Inputs/coverage_num_threads1.swift delete mode 100644 test/Profiler/Inputs/coverage_num_threads2.swift delete mode 100644 test/Profiler/coverage_num_threads.swift diff --git a/lib/IRGen/GenDecl.cpp b/lib/IRGen/GenDecl.cpp index cb35a96febc4c..60aabd107152e 100644 --- a/lib/IRGen/GenDecl.cpp +++ b/lib/IRGen/GenDecl.cpp @@ -1105,11 +1105,8 @@ void IRGenerator::emitGlobalTopLevel(llvm::StringSet<> *linkerDirectives) { IGM->emitSILDifferentiabilityWitness(&dw); } - // Emit code coverage mapping data for all modules - for (auto Iter : *this) { - IRGenModule *IGM = Iter.second; - IGM->emitCoverageMapping(); - } + // Emit code coverage mapping data. + PrimaryIGM->emitCoverageMapping(); for (auto Iter : *this) { IRGenModule *IGM = Iter.second; diff --git a/test/Profiler/Inputs/coverage_num_threads1.swift b/test/Profiler/Inputs/coverage_num_threads1.swift deleted file mode 100644 index 6ca641732e7e1..0000000000000 --- a/test/Profiler/Inputs/coverage_num_threads1.swift +++ /dev/null @@ -1 +0,0 @@ -func func1() {} diff --git a/test/Profiler/Inputs/coverage_num_threads2.swift b/test/Profiler/Inputs/coverage_num_threads2.swift deleted file mode 100644 index 639ea1b4ad4b7..0000000000000 --- a/test/Profiler/Inputs/coverage_num_threads2.swift +++ /dev/null @@ -1 +0,0 @@ -func func2() {} diff --git a/test/Profiler/coverage_num_threads.swift b/test/Profiler/coverage_num_threads.swift deleted file mode 100644 index 1a50c76335596..0000000000000 --- a/test/Profiler/coverage_num_threads.swift +++ /dev/null @@ -1,12 +0,0 @@ -// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 0 -emit-ir %S/Inputs/coverage_num_threads1.swift | %FileCheck %s -check-prefix=SINGLE-SOURCE --implicit-check-not="llvm_coverage_mapping =" - -// SINGLE-SOURCE: llvm_coverage_mapping = - -// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 0 -emit-ir %S/Inputs/coverage_num_threads1.swift %S/Inputs/coverage_num_threads2.swift | %FileCheck %s -check-prefix=SINGLE-OBJECT --implicit-check-not="llvm_coverage_mapping =" - -// SINGLE-OBJECT: llvm_coverage_mapping = - -// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 2 -emit-ir %S/Inputs/coverage_num_threads1.swift %S/Inputs/coverage_num_threads2.swift | %FileCheck %s -check-prefix=MULTIPLE-OBJECTS --implicit-check-not="llvm_coverage_mapping =" - -// MULTIPLE-OBJECTS: llvm_coverage_mapping = -// MULTIPLE-OBJECTS: llvm_coverage_mapping = From 7b431b4ddbe07ea5d5a2b392413b8fa89f4b40bf Mon Sep 17 00:00:00 2001 From: 3405691582 Date: Fri, 20 Mar 2020 21:07:22 -0400 Subject: [PATCH 210/222] [test] Mark XFAIL tests for OpenBSD. These tests are marked XFAIL or UNSUPPORTED because either the tests: require libc annotation, require Mach-O support, don't recognize calls to swift-autolink-extract, requires porting alongside Linux, or rely on simd which is not present. Additionally, explicit REQUIRES for tsan/asan/fuzzer are added to some tests, since OpenBSD does not support these sanitizers or fuzzers, since it's nicer to mark that with REQUIRES rather than XFAIL. --- test/ClangImporter/availability_returns_twice.swift | 1 + test/Driver/Dependencies/only-skip-once.swift | 2 +- test/Driver/PrivateDependencies/only-skip-once.swift | 2 +- test/Driver/parseable_output.swift | 2 +- test/Driver/parseable_output_unicode.swift | 2 +- test/Driver/sdk-apple.swift | 2 +- test/Frontend/embed-bitcode.swift | 1 + test/IRGen/abitypes.swift | 2 +- test/IRGen/address_sanitizer_recover.swift | 1 + test/IRGen/asan-attributes.swift | 1 + test/IRGen/module_hash.swift | 1 + test/IRGen/sanitize_coverage.swift | 3 ++- test/IRGen/tsan-attributes.swift | 1 + test/IRGen/tsan_coroutines.swift | 1 + test/Profiler/instrprof_tsan.swift | 1 + test/Prototypes/CollectionTransformers.swift | 2 +- test/SILGen/tsan_instrumentation.swift | 1 + test/stdlib/simd.swift.gyb | 2 +- test/stdlib/simd_diagnostics.swift | 2 +- 19 files changed, 20 insertions(+), 10 deletions(-) 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/Driver/Dependencies/only-skip-once.swift b/test/Driver/Dependencies/only-skip-once.swift index 714d99f526441..548155b9e32bb 100644 --- a/test/Driver/Dependencies/only-skip-once.swift +++ b/test/Driver/Dependencies/only-skip-once.swift @@ -1,4 +1,4 @@ -// XFAIL: linux +// XFAIL: linux, openbsd // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/only-skip-once/* %t diff --git a/test/Driver/PrivateDependencies/only-skip-once.swift b/test/Driver/PrivateDependencies/only-skip-once.swift index 597bfcd9e02f2..2e08f1645cbd0 100644 --- a/test/Driver/PrivateDependencies/only-skip-once.swift +++ b/test/Driver/PrivateDependencies/only-skip-once.swift @@ -1,4 +1,4 @@ -// XFAIL: linux +// XFAIL: linux, openbsd // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/only-skip-once/* %t 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/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/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/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/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/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/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/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 From e1015761fb73c51ccce2536f74b4801a4fb335b5 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Wed, 10 Jun 2020 14:53:25 -0700 Subject: [PATCH 211/222] [NFC] Reduce usage of TypedPattern::getTypeLoc --- lib/AST/ASTDumper.cpp | 4 +-- lib/AST/Decl.cpp | 16 ++++++---- lib/Parse/ParseDecl.cpp | 7 +---- lib/Sema/MiscDiagnostics.cpp | 2 +- lib/Sema/TypeCheckPattern.cpp | 58 ++++++++++++++++++----------------- 5 files changed, 44 insertions(+), 43 deletions(-) diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index e8f68bfe4b95e..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) << ')'; } diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 8a168cda9f395..8f3a00ffafea2 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1860,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()) { @@ -1870,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; + } + } + } } } @@ -2841,7 +2845,7 @@ OpaqueReturnTypeRepr *ValueDecl::getOpaqueResultTypeRepr() const { assert(NP->getDecl() == VD); (void) NP; - returnRepr = TP->getTypeLoc().getTypeRepr(); + returnRepr = TP->getTypeRepr(); } } } else { @@ -5586,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(); diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 2f095271755d6..b13b09ceea5d1 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -5694,12 +5694,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( diff --git a/lib/Sema/MiscDiagnostics.cpp b/lib/Sema/MiscDiagnostics.cpp index a0867506418d1..28c1b5b03e12c 100644 --- a/lib/Sema/MiscDiagnostics.cpp +++ b/lib/Sema/MiscDiagnostics.cpp @@ -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; } diff --git a/lib/Sema/TypeCheckPattern.cpp b/lib/Sema/TypeCheckPattern.cpp index ab3058092a526..3cee1b6d1ce01 100644 --- a/lib/Sema/TypeCheckPattern.cpp +++ b/lib/Sema/TypeCheckPattern.cpp @@ -671,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); } - } else { - hadError = TypeChecker::validateType(TL, resolution); + + 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); + } + + 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) { @@ -768,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 @@ -824,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); } From 08b7e7e3064b8a49ab17b53f64e1e66ca286dfac Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Wed, 10 Jun 2020 17:46:42 -0700 Subject: [PATCH 212/222] [gardening] Convert an explicit usage of rbegin,rend -> llvm::reverse(...). NFC. --- lib/SILOptimizer/Transforms/GenericSpecializer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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"; }); From bd23534db64ff8a60010d2f2f2c6111d6394cc86 Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Thu, 11 Jun 2020 04:54:44 +0300 Subject: [PATCH 213/222] [NFC] CS: Inline a parameter in openUnboundGenericType --- lib/Sema/ConstraintSystem.cpp | 10 +++++----- lib/Sema/ConstraintSystem.h | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index 4d1dff495fdff..9100d34d24ba2 100644 --- a/lib/Sema/ConstraintSystem.cpp +++ b/lib/Sema/ConstraintSystem.cpp @@ -655,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) { @@ -667,6 +667,7 @@ Type ConstraintSystem::openUnboundGenericType(UnboundGenericType *unbound, } // Open up the generic type. + OpenedTypeMap replacements; openGeneric(unboundDecl->getDeclContext(), unboundDecl->getGenericSignature(), locator, replacements); @@ -790,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; diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index be05109c2e095..d458367f0f40b 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -3411,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 From fb8fdd96446eb622071d3a28e0586743ddbac0a9 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Wed, 10 Jun 2020 16:04:03 -0700 Subject: [PATCH 214/222] Replace resolveCustomAttrType with a Request --- include/swift/AST/Attr.h | 14 +++++++-- include/swift/AST/TypeCheckRequests.h | 35 +++++++++++++++++++++ include/swift/AST/TypeCheckerTypeIDZone.def | 3 ++ lib/AST/ASTScope.cpp | 4 +-- lib/AST/Attr.cpp | 12 +++---- lib/AST/Decl.cpp | 2 +- lib/AST/NameLookup.cpp | 9 +++--- lib/AST/TypeCheckRequests.cpp | 30 ++++++++++++++++++ lib/IDE/Formatting.cpp | 4 +-- lib/IDE/SourceEntityWalker.cpp | 2 +- lib/IDE/SwiftSourceDocInfo.cpp | 2 +- lib/IDE/SyntaxModel.cpp | 2 +- lib/Index/Index.cpp | 4 +-- lib/Sema/ConstraintSystem.cpp | 12 ++++--- lib/Sema/TypeCheckAccess.cpp | 6 ++-- lib/Sema/TypeCheckAttr.cpp | 8 ++--- lib/Sema/TypeCheckPropertyWrapper.cpp | 33 ++++++++++--------- lib/Sema/TypeCheckRequestFunctions.cpp | 6 ++-- lib/Sema/TypeCheckStorage.cpp | 10 ++++-- lib/Sema/TypeCheckType.cpp | 11 +++---- lib/Sema/TypeCheckType.h | 15 --------- lib/Serialization/Deserialization.cpp | 5 ++- lib/Serialization/Serialization.cpp | 6 ++-- 23 files changed, 153 insertions(+), 82 deletions(-) diff --git a/include/swift/AST/Attr.h b/include/swift/AST/Attr.h index fde3102843bd5..4856fb5b810d0 100644 --- a/include/swift/AST/Attr.h +++ b/include/swift/AST/Attr.h @@ -1125,7 +1125,7 @@ class TypeEraserAttr final : public DeclAttribute { public: static TypeEraserAttr *create(ASTContext &ctx, SourceLoc atLoc, SourceRange range, - TypeLoc typeEraserLoc); + TypeRepr *typeEraserRepr); static TypeEraserAttr *create(ASTContext &ctx, LazyMemberLoader *Resolver, @@ -1628,8 +1628,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 { return type.getTypeRepr(); } + Type getType() const { return type.getType(); } Expr *getArg() const { return arg; } void setArg(Expr *newArg) { arg = newArg; } @@ -1642,6 +1642,14 @@ class CustomAttr final : public DeclAttribute, static bool classof(const DeclAttribute *DA) { return DA->getKind() == DAK_Custom; } + +private: + friend class CustomAttrNominalRequest; + void resetTypeInformation(TypeRepr *repr) { type = TypeLoc(repr); } + +private: + friend class CustomAttrTypeRequest; + void setType(Type ty) { type = TypeLoc(getTypeRepr(), ty); } }; /// Relates a property to its projection value property, as described by a property wrapper. For 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/lib/AST/ASTScope.cpp b/lib/AST/ASTScope.cpp index 33cf89aa8e28b..019cc3ccfde42 100644 --- a/lib/AST/ASTScope.cpp +++ b/lib/AST/ASTScope.cpp @@ -99,9 +99,9 @@ AttachedPropertyWrapperScope::getSourceRangeOfVarDecl(const VarDecl *const vd) { SourceRange sr; for (auto *attr : vd->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/Attr.cpp b/lib/AST/Attr.cpp index cf90377151b74..90b8192cdf9a2 100644 --- a/lib/AST/Attr.cpp +++ b/lib/AST/Attr.cpp @@ -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,8 +1386,8 @@ SourceLoc DynamicReplacementAttr::getRParenLoc() const { TypeEraserAttr *TypeEraserAttr::create(ASTContext &ctx, SourceLoc atLoc, SourceRange range, - TypeLoc typeEraserLoc) { - return new (ctx) TypeEraserAttr(atLoc, range, typeEraserLoc, nullptr, 0); + TypeRepr *typeEraserRepr) { + return new (ctx) TypeEraserAttr(atLoc, range, typeEraserRepr, nullptr, 0); } TypeEraserAttr *TypeEraserAttr::create(ASTContext &ctx, diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 8f3a00ffafea2..81706cee2a48b 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -6515,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/NameLookup.cpp b/lib/AST/NameLookup.cpp index 5da65daf1d014..473bae0a226fb 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,7 @@ CustomAttrNominalRequest::evaluate(Evaluator &evaluator, identTypeRepr }; - typeLoc = TypeLoc(IdentTypeRepr::create(ctx, components)); + attr->resetTypeInformation(IdentTypeRepr::create(ctx, components)); return nominal; } } diff --git a/lib/AST/TypeCheckRequests.cpp b/lib/AST/TypeCheckRequests.cpp index f6313796e1fc4..ae152a98f6cc5 100644 --- a/lib/AST/TypeCheckRequests.cpp +++ b/lib/AST/TypeCheckRequests.cpp @@ -1498,3 +1498,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/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/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/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/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index 4d1dff495fdff..2b579f51e7352 100644 --- a/lib/Sema/ConstraintSystem.cpp +++ b/lib/Sema/ConstraintSystem.cpp @@ -4389,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(), @@ -4405,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( 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 abd39331ef685..a357745c916ed 100644 --- a/lib/Sema/TypeCheckAttr.cpp +++ b/lib/Sema/TypeCheckAttr.cpp @@ -2850,8 +2850,8 @@ void AttributeChecker::visitImplementsAttr(ImplementsAttr *attr) { TypeResolutionOptions options = None; options |= TypeResolutionFlags::AllowUnboundGenerics; - auto resolution = TypeResolution::forContextual(DC, options); - T = resolution.resolveType(ProtoTypeLoc.getTypeRepr()); + T = TypeResolution::forContextual(DC, options) + .resolveType(ProtoTypeLoc.getTypeRepr()); ProtoTypeLoc.setType(T); } @@ -2925,11 +2925,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/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/TypeCheckRequestFunctions.cpp b/lib/Sema/TypeCheckRequestFunctions.cpp index 7ab8c6511f595..45952db5306a0 100644 --- a/lib/Sema/TypeCheckRequestFunctions.cpp +++ b/lib/Sema/TypeCheckRequestFunctions.cpp @@ -362,8 +362,10 @@ 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); + Type type = evaluateOrDefault( + evaluator, + CustomAttrTypeRequest{mutableAttr, dc, CustomAttrTypeKind::NonGeneric}, + Type()); if (!type) return Type(); auto nominal = type->getAnyNominal(); diff --git a/lib/Sema/TypeCheckStorage.cpp b/lib/Sema/TypeCheckStorage.cpp index c43f4f52ea5fd..609c828010faa 100644 --- a/lib/Sema/TypeCheckStorage.cpp +++ b/lib/Sema/TypeCheckStorage.cpp @@ -2479,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); @@ -2496,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; } diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp index 7bb65199a882a..7e7b18b97225e 100644 --- a/lib/Sema/TypeCheckType.cpp +++ b/lib/Sema/TypeCheckType.cpp @@ -3882,8 +3882,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. @@ -3891,12 +3892,10 @@ 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(); 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/Serialization/Deserialization.cpp b/lib/Serialization/Deserialization.cpp index 3564ff780ae49..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; } diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index abe402eb7e470..2920b29971e44 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -2388,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; } From 80d3a32ff53d85c7cace325dd8603ff84a3e65ec Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Wed, 10 Jun 2020 16:37:47 -0700 Subject: [PATCH 215/222] Strip ImplementsAttr of its TypeLoc --- include/swift/AST/Attr.h | 14 ++++++++------ lib/AST/Attr.cpp | 19 ++++++++++++------- lib/Parse/ParseDecl.cpp | 4 ++-- lib/Sema/DerivedConformanceComparable.cpp | 4 ++-- .../DerivedConformanceEquatableHashable.cpp | 4 ++-- lib/Sema/TypeCheckAttr.cpp | 16 +++++++--------- lib/Sema/TypeCheckProtocol.cpp | 2 +- 7 files changed, 34 insertions(+), 29 deletions(-) diff --git a/include/swift/AST/Attr.h b/include/swift/AST/Attr.h index 4856fb5b810d0..fe77241eb2245 100644 --- a/include/swift/AST/Attr.h +++ b/include/swift/AST/Attr.h @@ -56,6 +56,7 @@ class LazyConformanceLoader; class LazyMemberLoader; class PatternBindingInitializer; class TrailingWhereClause; +class TypeExpr; /// TypeAttributes - These are attributes that may be applied to types. class TypeAttributes { @@ -1464,25 +1465,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; } diff --git a/lib/AST/Attr.cpp b/lib/AST/Attr.cpp index 90b8192cdf9a2..4b0801bc0c375 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; } @@ -1814,7 +1814,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 +1826,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,12 +1834,17 @@ 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(); +} + +TypeRepr *ImplementsAttr::getProtocolTypeRepr() const { + return ProtocolType->getTypeRepr(); } CustomAttr::CustomAttr(SourceLoc atLoc, SourceRange range, TypeLoc type, diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index b13b09ceea5d1..c56bd23635067 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -811,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)); } diff --git a/lib/Sema/DerivedConformanceComparable.cpp b/lib/Sema/DerivedConformanceComparable.cpp index d543ffb7314a6..216db050d320b 100644 --- a/lib/Sema/DerivedConformanceComparable.cpp +++ b/lib/Sema/DerivedConformanceComparable.cpp @@ -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 dbd323d495fe0..589c61b447d6e 100644 --- a/lib/Sema/DerivedConformanceEquatableHashable.cpp +++ b/lib/Sema/DerivedConformanceEquatableHashable.cpp @@ -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())); } diff --git a/lib/Sema/TypeCheckAttr.cpp b/lib/Sema/TypeCheckAttr.cpp index a357745c916ed..505232f6748ad 100644 --- a/lib/Sema/TypeCheckAttr.cpp +++ b/lib/Sema/TypeCheckAttr.cpp @@ -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; T = TypeResolution::forContextual(DC, options) - .resolveType(ProtoTypeLoc.getTypeRepr()); - ProtoTypeLoc.setType(T); + .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()); } } 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(); From 29cdbe87f1ad9da6676eae2d1dadb747530b1781 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Wed, 10 Jun 2020 18:00:04 -0700 Subject: [PATCH 216/222] Strip TypeEraserAttr of its TypeLoc --- include/swift/AST/Attr.h | 37 ++++++++++------------- lib/AST/Attr.cpp | 41 ++++++++++++++++++++------ lib/AST/NameLookup.cpp | 3 +- lib/AST/TypeCheckRequests.cpp | 14 ++++++--- lib/Parse/ParseDecl.cpp | 6 ++-- lib/Sema/TypeCheckRequestFunctions.cpp | 2 +- 6 files changed, 64 insertions(+), 39 deletions(-) diff --git a/include/swift/AST/Attr.h b/include/swift/AST/Attr.h index fe77241eb2245..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" @@ -1111,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, - TypeRepr *typeEraserRepr); + TypeExpr *typeEraserRepr); static TypeEraserAttr *create(ASTContext &ctx, LazyMemberLoader *Resolver, @@ -1134,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, @@ -1149,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. @@ -1597,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; @@ -1605,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, @@ -1630,8 +1623,8 @@ class CustomAttr final : public DeclAttribute, unsigned getNumArguments() const { return numArgLabels; } bool hasArgumentLabelLocs() const { return hasArgLabelLocs; } - TypeRepr *getTypeRepr() const { return type.getTypeRepr(); } - Type getType() const { return type.getType(); } + TypeRepr *getTypeRepr() const; + Type getType() const; Expr *getArg() const { return arg; } void setArg(Expr *newArg) { arg = newArg; } @@ -1647,11 +1640,11 @@ class CustomAttr final : public DeclAttribute, private: friend class CustomAttrNominalRequest; - void resetTypeInformation(TypeRepr *repr) { type = TypeLoc(repr); } + void resetTypeInformation(TypeExpr *repr); private: friend class CustomAttrTypeRequest; - void setType(Type ty) { type = TypeLoc(getTypeRepr(), ty); } + void setType(Type ty); }; /// Relates a property to its projection value property, as described by a property wrapper. For diff --git a/lib/AST/Attr.cpp b/lib/AST/Attr.cpp index 4b0801bc0c375..8173205f3d2cf 100644 --- a/lib/AST/Attr.cpp +++ b/lib/AST/Attr.cpp @@ -1386,25 +1386,36 @@ SourceLoc DynamicReplacementAttr::getRParenLoc() const { TypeEraserAttr *TypeEraserAttr::create(ASTContext &ctx, SourceLoc atLoc, SourceRange range, - TypeRepr *typeEraserRepr) { - return new (ctx) TypeEraserAttr(atLoc, range, typeEraserRepr, 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, @@ -1847,20 +1858,21 @@ TypeRepr *ImplementsAttr::getProtocolTypeRepr() const { return ProtocolType->getTypeRepr(); } -CustomAttr::CustomAttr(SourceLoc atLoc, SourceRange range, TypeLoc type, +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, @@ -1869,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; @@ -1878,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(); @@ -1888,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/NameLookup.cpp b/lib/AST/NameLookup.cpp index 473bae0a226fb..36311b7f85644 100644 --- a/lib/AST/NameLookup.cpp +++ b/lib/AST/NameLookup.cpp @@ -2347,7 +2347,8 @@ CustomAttrNominalRequest::evaluate(Evaluator &evaluator, identTypeRepr }; - attr->resetTypeInformation(IdentTypeRepr::create(ctx, components)); + auto *newTE = new (ctx) TypeExpr(IdentTypeRepr::create(ctx, components)); + attr->resetTypeInformation(newTE); return nominal; } } diff --git a/lib/AST/TypeCheckRequests.cpp b/lib/AST/TypeCheckRequests.cpp index ae152a98f6cc5..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()); + } } //----------------------------------------------------------------------------// diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index c56bd23635067..b69991bafd180 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -2218,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; } @@ -2591,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); diff --git a/lib/Sema/TypeCheckRequestFunctions.cpp b/lib/Sema/TypeCheckRequestFunctions.cpp index 45952db5306a0..cda70bdc3ee53 100644 --- a/lib/Sema/TypeCheckRequestFunctions.cpp +++ b/lib/Sema/TypeCheckRequestFunctions.cpp @@ -366,7 +366,7 @@ Type FunctionBuilderTypeRequest::evaluate(Evaluator &evaluator, evaluator, CustomAttrTypeRequest{mutableAttr, dc, CustomAttrTypeKind::NonGeneric}, Type()); - if (!type) return Type(); + if (!type || type->hasError()) return Type(); auto nominal = type->getAnyNominal(); if (!nominal) { From 8f065e7a615fc080ce6192a262c47689ca548c64 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Wed, 10 Jun 2020 19:27:47 -0700 Subject: [PATCH 217/222] Delete TypeChecker::validateType Inline it into its final user: swift::performTypeLocChecking --- include/swift/AST/LazyResolver.h | 1 - include/swift/Basic/Statistics.def | 3 --- lib/AST/ConformanceLookupTable.h | 1 - lib/Parse/ParseType.cpp | 1 - lib/Sema/CSGen.cpp | 10 ++++++---- lib/Sema/TypeCheckType.cpp | 16 +--------------- lib/Sema/TypeChecker.cpp | 10 +++++++++- lib/Serialization/ModuleFile.h | 1 - 8 files changed, 16 insertions(+), 27 deletions(-) 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/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/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/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/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index d77d99c7b48e9..15b1d5ee7a85a 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -1495,12 +1495,14 @@ namespace { Type resolveTypeReferenceInExpression(TypeRepr *repr, TypeResolverContext resCtx) { - TypeLoc loc(repr); 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) { diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp index 7e7b18b97225e..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; @@ -3898,7 +3884,7 @@ Type CustomAttrTypeRequest::evaluate(Evaluator &eval, CustomAttr *attr, // We always require the type to resolve to a nominal type. if (!type->getAnyNominal()) { assert(ctx.Diags.hadAnyError()); - return Type(); + return ErrorType::get(ctx); } return type; 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/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" From 4ff5dd4ed918ceed8b056de4d58ddb9741d63a40 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 9 Jun 2020 01:58:27 -0400 Subject: [PATCH 218/222] Dependencies: New swift-dependency-tool to convert between binary and YAML formats --- tools/CMakeLists.txt | 1 + tools/swift-dependency-tool/CMakeLists.txt | 10 ++ .../swift-dependency-tool.cpp | 123 ++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 tools/swift-dependency-tool/CMakeLists.txt create mode 100644 tools/swift-dependency-tool/swift-dependency-tool.cpp 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/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; +} From fe3f6b361679c1c3de4643fb8336b1a8b647537e Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 9 Jun 2020 17:33:28 -0400 Subject: [PATCH 219/222] Dependencies: Update tests for new binary format --- .../pch-bridging-header-deps-fine.swift | 4 +-- .../Inputs/chained-after-fine/main.swiftdeps | Bin 795 -> 408 bytes .../Inputs/chained-after-fine/other.swiftdeps | Bin 1002 -> 416 bytes .../chained-after-fine/yet-another.swiftdeps | Bin 815 -> 420 bytes .../chained-private-after-fine/main.swiftdeps | Bin 1162 -> 388 bytes .../other.swiftdeps | Bin 1002 -> 416 bytes .../yet-another.swiftdeps | Bin 815 -> 420 bytes .../main.swiftdeps | Bin 1421 -> 456 bytes .../other.swiftdeps | Bin 1002 -> 416 bytes .../yet-another.swiftdeps | Bin 815 -> 420 bytes .../main.swiftdeps | Bin 1848 -> 492 bytes .../other.swiftdeps | Bin 1009 -> 428 bytes .../yet-another.swiftdeps | Bin 815 -> 420 bytes .../crash.swiftdeps | Bin 595 -> 392 bytes .../main.swiftdeps | Bin 593 -> 392 bytes .../other.swiftdeps | Bin 595 -> 392 bytes .../fail-interface-hash-fine/bad.swiftdeps | Bin 951 -> 368 bytes .../depends-on-bad.swiftdeps | Bin 761 -> 368 bytes .../depends-on-main.swiftdeps | Bin 764 -> 368 bytes .../fail-interface-hash-fine/main.swiftdeps | Bin 955 -> 368 bytes .../fail-with-bad-deps-fine/bad.swiftdeps | Bin 1398 -> 424 bytes .../depends-on-bad.swiftdeps | Bin 1188 -> 396 bytes .../depends-on-main.swiftdeps | Bin 1185 -> 396 bytes .../fail-with-bad-deps-fine/main.swiftdeps | Bin 1402 -> 424 bytes .../malformed-after-fine/main.swiftdeps | Bin 795 -> 408 bytes .../malformed-after-fine/other.swiftdeps | Bin 594 -> 392 bytes .../main.swiftdeps | Bin 795 -> 408 bytes .../other.swiftdeps | Bin 594 -> 392 bytes .../does-change.swiftdeps | Bin 2015 -> 476 bytes .../does-not-change.swiftdeps | Bin 2019 -> 472 bytes .../mutual-with-swiftdeps-fine/main.swiftdeps | Bin 592 -> 392 bytes .../other.swiftdeps | Bin 594 -> 392 bytes .../one-way-depends-after-fine/main.swiftdeps | Bin 593 -> 392 bytes .../other.swiftdeps | Bin 1010 -> 420 bytes .../main.swiftdeps | Bin 803 -> 408 bytes .../other.swiftdeps | Bin 1010 -> 420 bytes .../main.swiftdeps | Bin 795 -> 408 bytes .../other.swiftdeps | Bin 596 -> 392 bytes .../main.swiftdeps | Bin 795 -> 408 bytes .../other.swiftdeps | Bin 1434 -> 472 bytes .../main.swiftdeps | Bin 592 -> 392 bytes .../other.swiftdeps | Bin 594 -> 392 bytes .../Inputs/private-after-fine/a.swiftdeps | Bin 1006 -> 416 bytes .../Inputs/private-after-fine/b.swiftdeps | Bin 1424 -> 456 bytes .../Inputs/private-after-fine/c.swiftdeps | Bin 1216 -> 436 bytes .../Inputs/private-after-fine/d.swiftdeps | Bin 795 -> 408 bytes .../Inputs/private-after-fine/e.swiftdeps | Bin 795 -> 408 bytes .../Inputs/private-after-fine/f.swiftdeps | Bin 1214 -> 436 bytes .../Inputs/private-after-fine/g.swiftdeps | Bin 1216 -> 436 bytes .../Inputs/update-dependencies-bad.py | 12 ++++++-- .../Inputs/update-dependencies.py | 12 ++++++-- .../chained-additional-kinds-fine.swift | 8 +++--- .../Dependencies/chained-after-fine.swift | 6 ++-- test/Driver/Dependencies/chained-fine.swift | 12 ++++---- .../chained-private-after-fine.swift | 6 ++-- .../chained-private-after-multiple-fine.swift | 6 ++-- ...-after-multiple-nominal-members-fine.swift | 6 ++-- .../Dependencies/chained-private-fine.swift | 6 ++-- .../check-interface-implementation-fine.swift | 6 ++-- .../Dependencies/crash-added-fine.swift | 10 +++---- test/Driver/Dependencies/crash-new-fine.swift | 16 +++++------ .../Dependencies/crash-simple-fine.swift | 6 ++-- .../dependencies-preservation-fine.swift | 2 +- ...iver-show-incremental-arguments-fine.swift | 6 ++-- ...cremental-conflicting-arguments-fine.swift | 10 +++---- .../driver-show-incremental-inputs-fine.swift | 4 +-- ...iver-show-incremental-malformed-fine.swift | 12 ++++---- .../driver-show-incremental-mutual-fine.swift | 6 ++-- ...-show-incremental-swift-version-fine.swift | 6 ++-- .../Driver/Dependencies/fail-added-fine.swift | 8 +++--- .../Dependencies/fail-chained-fine.swift | 18 ++++++------ .../fail-interface-hash-fine.swift | 6 ++-- test/Driver/Dependencies/fail-new-fine.swift | 16 +++++------ .../Dependencies/fail-simple-fine.swift | 6 ++-- .../fail-with-bad-deps-fine.swift | 10 +++---- .../Driver/Dependencies/file-added-fine.swift | 6 ++-- .../Dependencies/independent-fine.swift | 16 +++++------ .../independent-half-dirty-fine.swift | 6 ++-- .../independent-parseable-fine.swift | 12 ++++---- .../malformed-but-valid-yaml-fine.swift | 16 +++++------ test/Driver/Dependencies/malformed-fine.swift | 16 +++++------ test/Driver/Dependencies/mutual-fine.swift | 8 +++--- .../mutual-interface-hash-fine.swift | 12 ++++---- .../Dependencies/nominal-members-fine.swift | 10 +++---- .../one-way-depends-after-fine.swift | 18 ++++++------ .../one-way-depends-before-fine.swift | 18 ++++++------ .../one-way-external-delete-fine.swift | 10 +++---- .../Dependencies/one-way-external-fine.swift | 12 ++++---- test/Driver/Dependencies/one-way-fine.swift | 26 +++++++++--------- .../one-way-merge-module-fine.swift | 4 +-- .../Dependencies/one-way-parallel-fine.swift | 4 +-- .../Dependencies/one-way-parseable-fine.swift | 8 +++--- .../one-way-provides-after-fine.swift | 16 +++++------ .../one-way-provides-before-fine.swift | 16 +++++------ .../one-way-while-editing-fine.swift | 4 +-- .../Dependencies/private-after-fine.swift | 10 +++---- test/Driver/Dependencies/private-fine.swift | 14 +++++----- .../Inputs/chained-after-fine/main.swiftdeps | Bin 795 -> 408 bytes .../Inputs/chained-after-fine/other.swiftdeps | Bin 1002 -> 416 bytes .../chained-after-fine/yet-another.swiftdeps | Bin 815 -> 420 bytes .../chained-private-after-fine/main.swiftdeps | Bin 1162 -> 388 bytes .../other.swiftdeps | Bin 1002 -> 416 bytes .../yet-another.swiftdeps | Bin 815 -> 420 bytes .../main.swiftdeps | Bin 1421 -> 456 bytes .../other.swiftdeps | Bin 1002 -> 416 bytes .../yet-another.swiftdeps | Bin 815 -> 420 bytes .../main.swiftdeps | Bin 1848 -> 492 bytes .../other.swiftdeps | Bin 1009 -> 428 bytes .../yet-another.swiftdeps | Bin 815 -> 420 bytes .../crash.swiftdeps | Bin 595 -> 392 bytes .../main.swiftdeps | Bin 593 -> 392 bytes .../other.swiftdeps | Bin 595 -> 392 bytes .../fail-interface-hash-fine/bad.swiftdeps | Bin 951 -> 368 bytes .../depends-on-bad.swiftdeps | Bin 761 -> 368 bytes .../depends-on-main.swiftdeps | Bin 764 -> 368 bytes .../fail-interface-hash-fine/main.swiftdeps | Bin 955 -> 368 bytes .../fail-with-bad-deps-fine/bad.swiftdeps | Bin 1398 -> 424 bytes .../depends-on-bad.swiftdeps | Bin 1188 -> 396 bytes .../depends-on-main.swiftdeps | Bin 1185 -> 396 bytes .../fail-with-bad-deps-fine/main.swiftdeps | Bin 1402 -> 424 bytes .../malformed-after-fine/main.swiftdeps | Bin 795 -> 408 bytes .../malformed-after-fine/other.swiftdeps | Bin 594 -> 392 bytes .../main.swiftdeps | Bin 795 -> 408 bytes .../other.swiftdeps | Bin 594 -> 392 bytes .../does-change.swiftdeps | Bin 2015 -> 476 bytes .../does-not-change.swiftdeps | Bin 2019 -> 472 bytes .../mutual-with-swiftdeps-fine/main.swiftdeps | Bin 592 -> 392 bytes .../other.swiftdeps | Bin 594 -> 392 bytes .../one-way-depends-after-fine/main.swiftdeps | Bin 593 -> 392 bytes .../other.swiftdeps | Bin 1010 -> 420 bytes .../main.swiftdeps | Bin 803 -> 408 bytes .../other.swiftdeps | Bin 1010 -> 420 bytes .../main.swiftdeps | Bin 795 -> 408 bytes .../other.swiftdeps | Bin 596 -> 392 bytes .../main.swiftdeps | Bin 795 -> 408 bytes .../other.swiftdeps | Bin 1434 -> 472 bytes .../main.swiftdeps | Bin 592 -> 392 bytes .../other.swiftdeps | Bin 594 -> 392 bytes .../Inputs/private-after-fine/a.swiftdeps | Bin 1006 -> 416 bytes .../Inputs/private-after-fine/b.swiftdeps | Bin 1424 -> 456 bytes .../Inputs/private-after-fine/c.swiftdeps | Bin 1216 -> 436 bytes .../Inputs/private-after-fine/d.swiftdeps | Bin 795 -> 408 bytes .../Inputs/private-after-fine/e.swiftdeps | Bin 795 -> 408 bytes .../Inputs/private-after-fine/f.swiftdeps | Bin 1214 -> 436 bytes .../Inputs/private-after-fine/g.swiftdeps | Bin 1216 -> 436 bytes .../Inputs/update-dependencies-bad.py | 12 ++++++-- .../Inputs/update-dependencies.py | 12 ++++++-- .../chained-additional-kinds-fine.swift | 8 +++--- .../chained-after-fine.swift | 6 ++-- .../PrivateDependencies/chained-fine.swift | 12 ++++---- .../chained-private-after-fine.swift | 6 ++-- .../chained-private-after-multiple-fine.swift | 6 ++-- ...-after-multiple-nominal-members-fine.swift | 6 ++-- .../chained-private-fine.swift | 6 ++-- .../check-interface-implementation-fine.swift | 6 ++-- .../crash-added-fine.swift | 10 +++---- .../PrivateDependencies/crash-new-fine.swift | 16 +++++------ .../crash-simple-fine.swift | 6 ++-- .../dependencies-preservation-fine.swift | 2 +- ...iver-show-incremental-arguments-fine.swift | 4 +-- ...cremental-conflicting-arguments-fine.swift | 8 +++--- .../driver-show-incremental-inputs-fine.swift | 4 +-- ...iver-show-incremental-malformed-fine.swift | 10 +++---- .../driver-show-incremental-mutual-fine.swift | 6 ++-- ...-show-incremental-swift-version-fine.swift | 4 +-- .../PrivateDependencies/fail-added-fine.swift | 8 +++--- .../fail-chained-fine.swift | 18 ++++++------ .../fail-interface-hash-fine.swift | 6 ++-- .../PrivateDependencies/fail-new-fine.swift | 16 +++++------ .../fail-simple-fine.swift | 6 ++-- .../fail-with-bad-deps-fine.swift | 10 +++---- .../PrivateDependencies/file-added-fine.swift | 6 ++-- .../independent-fine.swift | 16 +++++------ .../independent-half-dirty-fine.swift | 6 ++-- .../independent-parseable-fine.swift | 12 ++++---- .../malformed-but-valid-yaml-fine.swift | 16 +++++------ .../PrivateDependencies/malformed-fine.swift | 16 +++++------ .../PrivateDependencies/mutual-fine.swift | 8 +++--- .../mutual-interface-hash-fine.swift | 12 ++++---- .../nominal-members-fine.swift | 10 +++---- .../one-way-depends-after-fine.swift | 18 ++++++------ .../one-way-depends-before-fine.swift | 18 ++++++------ .../one-way-external-delete-fine.swift | 10 +++---- .../one-way-external-fine.swift | 12 ++++---- .../PrivateDependencies/one-way-fine.swift | 26 +++++++++--------- .../one-way-merge-module-fine.swift | 4 +-- .../one-way-parallel-fine.swift | 4 +-- .../one-way-parseable-fine.swift | 8 +++--- .../one-way-provides-after-fine.swift | 16 +++++------ .../one-way-provides-before-fine.swift | 16 +++++------ .../one-way-while-editing-fine.swift | 4 +-- .../private-after-fine.swift | 10 +++---- .../PrivateDependencies/private-fine.swift | 14 +++++----- test/Frontend/dependencies-fine.swift | 6 ++-- .../dependencies-preservation-fine.swift | 4 +-- .../Dependencies/private-function-fine.swift | 8 +++--- .../private-function-return-type-fine.swift | 8 +++--- .../private-protocol-conformer-ext-fine.swift | 4 +-- .../private-protocol-conformer-fine.swift | 8 +++--- .../private-struct-member-fine.swift | 8 +++--- .../Dependencies/private-subscript-fine.swift | 8 +++--- .../Dependencies/private-typealias-fine.swift | 8 +++--- .../Dependencies/private-var-fine.swift | 2 +- ...nce-dependencies-dynamic-lookup-fine.swift | 8 +++--- .../reference-dependencies-fine.swift | 4 +-- .../reference-dependencies-members-fine.swift | 8 +++--- .../private-function-fine.swift | 4 +-- .../private-function-return-type-fine.swift | 4 +-- .../private-protocol-conformer-ext-fine.swift | 4 +-- .../private-protocol-conformer-fine.swift | 4 +-- .../private-struct-member-fine.swift | 4 +-- .../private-subscript-fine.swift | 4 +-- .../private-typealias-fine.swift | 4 +-- .../private-var-fine.swift | 2 +- ...nce-dependencies-dynamic-lookup-fine.swift | 4 +-- .../reference-dependencies-fine.swift | 4 +-- .../reference-dependencies-members-fine.swift | 4 +-- test/Inputs/process_fine_grained_swiftdeps.sh | 4 ++- ...ine_grained_swiftdeps_with_fingerprints.sh | 4 ++- .../added_method-type-fingerprints.swift | 4 +-- ...s_private_property-type-fingerprints.swift | 4 +-- ...ate_class_property-type-fingerprints.swift | 4 +-- ...m_private_property-type-fingerprints.swift | 4 +-- ...vate_enum_property-type-fingerprints.swift | 4 +-- ...ded_private_method-type-fingerprints.swift | 4 +-- ...method_value_types-type-fingerprints.swift | 4 +-- ...te_protocol_method-type-fingerprints.swift | 4 +-- ..._protocol_property-type-fingerprints.swift | 4 +-- ...t_private_property-type-fingerprints.swift | 4 +-- ...te_struct_property-type-fingerprints.swift | 4 +-- ...edited_method_body-type-fingerprints.swift | 4 +-- ...ed_property_getter-type-fingerprints.swift | 4 +-- test/lit.cfg | 2 ++ 233 files changed, 593 insertions(+), 559 deletions(-) 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/Driver/Dependencies/Inputs/chained-after-fine/main.swiftdeps b/test/Driver/Dependencies/Inputs/chained-after-fine/main.swiftdeps index ab68f2a75146fd48893ba594c68a57f7419ac818..c00e208418ef20355cadfc0bc66faf469376d166 100644 GIT binary patch literal 408 zcmaiuy-&hG7{=e8d@jV8xSxqJ9M{r9X@dy^R&c_^gv8l?CYXpu46dXyGB_|YICOAS zrw$C{aOlA3U*gQ*ONg!xcf<4io?qTp`=Tr505||-rH@5ov5DXbVe7E?Cip~@8iyx* zN|Z5SWBkSPXeIbpC{HXzSVZ_#sLvK#2z3_9VxV#bUx%LY;?vjVa1P9uXxHJpOYu+a*MC8exs5-vSP<08G4@c%uc?UPp|c z661O=^(pP|=5rb8y_qLif8&GhV=s81L;rrzyX{k>tSg>Bq{U9>@|*@n#k5^htGY7X za;|-7|x#?gVbd(G0_> Y8;(~qO}lQoSpw<87X6n^1Ef$5KiOq^3jhEB literal 795 zcmd5)O-sZu6ukFW1U&4irCYb9^ehX4EM7c`hkQ(yuxS#LwCcaNO)C_{gSZECNFFaU z@4cDih8&eae)e=a1R2XL&-09GeX;_f%LvKI1s`)TuZuFGTf$`zcJLfWrSa(Ps03CZ z4GuhRpvpveN%+~2{$h$m-FN1jPVUec8ctE{k2 z6#XzOxRxos)97I$jmnzTk&u7k%>E~5{$xzF?g1n8s`Q$lgr=I`UbyqH!J&hr zI(1-Z9u6HC{Y#t~e1z!gaPM%=@0@!Z&8xN`0#E=*3m;Kzk}0DxlC__GV|2=Lwc|57 zLuG0m?zNdIsT3oV|l(G|T=POsyZ@-vs8 zpA=koLby~_THBz74lF36#~X?MM`^OP(wtS9VC*A$G&AZYzsX9A^EHn2Z$ZxN>h08LSBz 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 463b4dfae1c71b24c0e092e4bbd62c902e1c9f80..becd8c3d80bce7e4a30b5d30a8a7b4d72e0a1e48 100644 GIT binary patch literal 420 zcmaiwy-&hW6vbbk^0gRa!d?<%c)XUjv?XoAfEAoDF(F~L_9J2<7$6XxNM&SjU}SLU z;HXX=7|6q+1EYV5GlQ29U46-Y!#%%q?#->$FPmH%A&L-6aUaXrB2z|VOg2IOjnOG9 zRE|&S42u&?Ch)V>$(qrxK$u#9kPy=ulb$WIWYRnkCRli3Qp6~9DzzsP26S$b7z?pg zh_JW`=mL`&Tb*wm7Kt!fGiedf4Rj$apdl7RMx(!sYP|p`SVNE@=~qCxD}+qg8N1^p zFTaine}?tjqy0}VdzeWlx%X-YgZvGJnxnQq;D=tX-|lvJy{L+=H{|n;M(cw2b){@O zWx3=C{El-}(^nPWyLJh9(^-Tbyn$$Ux`P|9SL|=IT<^ZW)!=U0o!#yzkF7)!;p(1@ oY}-?{lBwyArW>v-8@6d0rfb6t#gNTX3Zulq4*i!+1)dlQ72F9*<)%uDv4J%;CIy(>sA1)#1G}2PH8A z!CMqz0aX;xwIIF$!VHOz1!A>|R053)B4bAk9LR)Mbg6$=ZIEdF1a1}W&{;PWpBVsn zT^4n@7UjBaLSDxWB$y)L+q0KC`FrV);0udIM2oCkK=h5^ zOTy-Ib+t`cEFf$xjiullq*x}nPjp}M;IE@v&!H8gKFZkiD?p|VVB*ch_Ci{C^%%V* zrQ3t}r*gEPQj^MiHAPVV#)0Nz-+iDHXEg2)2egzg>b5hX*+!#vP2G}N?)1uq)1F3m zzFzU%Et;;=wHapBG{9Y_Kgf@_CAM=vMuz`7+d{M3QWby>`VvVX)mRL=jyoJV_)7wb X^bY;AI3zLvVGKNR2+&r*!!*DT23T?j literal 1162 zcmchWOH0Hs6ovQw6&GC0s--h_)wK)=GPu!=xJa9mAx!fyNvr;Q`-o5|1!qRhBDo~z z-rSFq+|XWXq({g4g;SR&X__XiX%2?NmkCiyCwvaUFiukQatf!}o7UCX%Lb3mbdnNyrz*d8Cm!p_|qPX4DjKQi%BrrR~9tB``R59n~Y XMeBc(jSVlnDbD2(tno;)EK9xs=n*jj 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 fdebaf57ebfb4aab27e919a0a84209c4901c0cbf..536f71123e364ba2a263dc74c7f297350aab94c4 100644 GIT binary patch literal 416 zcmaiuy-&hW6vb~ZAZ1Zw;$9PDc)XTUumutZtl)%+35m0%9}x#JKyW3Mk->qH!J&hr zI(1-Z9u6HC{Y#t~e1z!gaPM%=@0@!Z&8xN`0#E=*3m;Kzk}0DxlC__GV|2=Lwc|57 zLuG0m?zNdIsT3oV|l(G|T=POsyZ@-vs8 zpA=koLby~_THBz74lF36#~X?MM`^OP(wtS9VC*A$G&AZYzsX9A^EHn2Z$ZxN>h08LSBz 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 6c6e6bd8f844a45e7b68158269c57185264c20db..a9ff90ae9f81aa286a0c7c93c86eca08631c872e 100644 GIT binary patch literal 420 zcmaiwzfZzI9L2Av{924LVK0d>9M{s8QfdLqu>d!P5d-(0nJ)ew>hQG`%J_*h0ZnQ$6mvI(+poKASI ze0)ZySRP|ChL^8S)|`F?(!>UYgqTjb@@$hOS7w1U#?lK{=A433u0D}4pfj69Sc>f2 z9Lt-4E-;z$)x|bplQ|}9t}Ft&0Ts#u8e%!*bpF>-spSBLXb3hm{Te89jgSR9V{fz+ z)z=Xb&#`fPwEroj4^zpw@Low_u)pD=#zWg5h(p%vx4RwD$m_DlhGMo}Z(fSNp_QCg zNiDP_amTfE%hxrZxgLRRGL6t98^}(lJGf!Je1F^JvHSkkgMTaDIqi<-He+#wD|;$Z oi@M=6-}Fq)R1LGpJjb;PrlFn|EZxh($ literal 815 zcmd5)J#WJx6x{tQkUC_tWjnUqc&;LKiMq5))d8C$L9rhcaN7L)`h!Z5q7G3zlmVXL z?!g^*$F_k(kcg0@6J`z<|WF(Nwcnmb16{ zNV%ZSg@<`NOhW$3o8ENjL7sc1X}*!M|71}1lR>}ohjg!qcR}y%i7EOqv{~~K8eHWj SBx+mm>5|YbFRgsGLlw(>7LY=~+48TW-ppeZ(Ex31`ZXZi1u*f=#P&i- zdG)AtPW0=;_@{7ukQS4|dp%9i{>B6C$ASAGjh*|^;C3kKMXg{vV=32abuJ}WSB+lZ zP|AH-+UNRO)zwtjv22R0m;t!y4Ti;0RAM`KBh>J}Dv_vK9Z>-2MLC>LI1@=A^_T*^ zileKVRk3uVs#&h#>WXdj6wfp9brmjEjgQW3 zmB1)u-eMIFq)G>Ll2u=V%5;X^fnqX=u9`J?;0Vxkv1R^U$so}BK_!)5qqDAibuVQE zX;E^*>HN0jaxQ5u=2b3eS#U~beDL!4)}pR()ixYm=a>&>fzsdKp+zm8tkDa2f!P$u z6ezq70_7u|k8uUp_8fnen#R`Hpbji3qlX^>{zZO@vHXyWGNVnSG^-=&>8(QgjwtwZ zeBh{IVk;e$dp3rXUlr$9qH!J&hr zI(1-Z9u6HC{Y#t~e1z!gaPM%=@0@!Z&8xN`0#E=*3m;Kzk}0DxlC__GV|2=Lwc|57 zLuG0m?zNdIsT3oV|l(G|T=POsyZ@-vs8 zpA=koLby~_THBz74lF36#~X?MM`^OP(wtS9VC*A$G&AZYzsX9A^EHn2Z$ZxN>h08LSBz 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 045438f5550d62b58e0fa545b666ddce5b04c61e..f49792b949a856c54fd6a0492089de6fee17b9b5 100644 GIT binary patch literal 420 zcmaiwy-&hG7{;%sd@aV9u$RObj%#Ua`D(&|6`U|JAz>DJ*NBN=fMDE6Wn^$*WN_%< zs7@Ui$l=g|(Z9r*!IuzSz2t6qp5ODlZ?0OqYDjT}C_*SEeJn$pOa%=w*?8$UL8l^9 zK0c!}tWGeQz$;cKYeBy}WoiRLd`xFTd$!3^Xmd}QVC6+)#)1TW+aMmWlu+z oVKQ#Ciw1XdC6;rFrd}vnF0(9F)GeLIFp3=P(0|!T3WmV>0iH#EcK`qY literal 815 zcmd5)J#WJx6x{tQkUC_tWhYi0d#)mNiMq5))d9nipx6%=aN7L)`h!ZAq7G3zlmVXL z?%*AF$99?!A1ogh$U zcO8UZKs9+-#l<&3m|^2{fmp2qm3WHDpPJlYum 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 ad8a56b02c2e39ae196ce401911ca08ccc923431..b43c0bf3f82f1edfac625119f095bf94c8d89b46 100644 GIT binary patch literal 492 zcmah_J4?e*6h66qq=JZuf@1`c-rmGCjfpKd)M#C-P$+b6o>0LmR;pu(9XmL5bm)-5 zQJpe4l&eFBj{Xwo4xS=DHivu9;d}9M4lA{~kO5!-APUdpiA4vTO$eQZ*+Jh!*G z&xS643D{@?9AjtV^~O^E zp+}_yVw|od--Na0g-lv_DlZVEKkz~Qx)oeWUH`JvI&VwHwyt=7SISnajT0#_G}Cs? ze8H8aFP*EG0$mGy$D`=YECHO^t@d_j9^&~I9mMcnJ9AKT8o#^!XTND=1OR*P$9aP@ zl?GBy1J~4vqI%#49fKNvwh++T$ literal 1848 zcmd6nJ#T|B5QcYt#Yr8q016>MlDUf1CF;^HRR@F5krixH8`AXOmk(EpL{Ul_q%eSm z-aGrbd(RKBa+Rgle3ayVOkaAa*w*ub=FQw z7pou%!gR%AWYIc|;$)4hG|WGbsacwlTl>m=@AQ*^rcX818=Z! zVd+BTLhM2U@2!j*i)ifWN?kQHwJYGvbphO}AR&c_^goN4B*G5bP0|Zy{WMpt)WN_%< zs7?$FnK&y0u|9v*rMszfWsSrGjTJbgSle7 z4zO~8?7M@VPbs;dkYmz&DS?FjEe2|j&7i0B{Z6;pZYg#qt5LtNq^i~Wl@i!y-u3c^ z<*CY+^Rk5?YX*LUVv&{i0NTASbp63~FnvInhsth29J-+urzxK+=Y6yot*wzbNs|N49Jt&DI zkOzk%PN2#}^fecs0Aaht+XS&#j8wxlPKW?DKBF(ftE!_!7ZR*iW{2MSuIzwij8P#e zFBzA#E{WLk}HKWgoXik5SVz7$jxMfL&XZwoO1 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 c279ebaf043ab71881b565d8b587b1a049709a67..fd1bac5a8aeb1a94210f1546839964987ba43fff 100644 GIT binary patch literal 420 zcmaiwy-&hG7{;%sd@aV9u$RObj%#UaDIW;~R&c_^goN3)*G5bP0|etnDkFmfBZET+ zM|JAJKn{lvjQ%Cg48DZu>Lqu>^ZcIYeRK83RZB=BL=i#>;bR$@WXfrT$;QvVaXRI> z>hT$!VR?ed1YW*6S#$d3OH&gN5@0&x%Ckw9T$%gQ1WPYm2{{F&T7M#ePv<6yuoRiO z5X&2%E-;z#)x|bpk`R+MR~A0qfC^s|db8Orm?SBgC!&EXZyw_3~>~FZJ_0aK#;>hg}I=!xF?8s`I5sYVoQjN6nlYvJMu2ZKLMS=Hc`BxHlqlM{oM&$a$6+TGJUVld0uqpU z3p^~K5(BuN@oxY(W+8Yst}t-l#%7(eE{UJA9M$9Bo=X7K<^*!!2*gWYp^9RWKCY< zk@QKOPY(-jn1uY5H`*%DfPn>RFy2VWe==zH?FWN?Y>|WkD>z|dLgH*`dl3gU)Zj|ajtmZr3=SO} z)u{smIUG7L`jh) z{KI*b8mkyA==wxvb6Wsj-wm%y;i|^#SUG==+=%*v+5blc6~c= QtIYQNuAABXA1BYiH}PkBVgLXD literal 595 zcmd6jK~KaW5QXpk6(k<^M6+$Qb$d3Oc-eUIWIRmav65{8fv)=RrL-nJ8xL}T$?&~_ z_iorx8}PHIbVzpH7o78ghT&u-LRT=x*#%#7F|Ug@vRle!4|ehbM?K)l+pCsXK?)8c zZcuF^ydv=f2%8$88)COxrG`dqgp3JK;jIiGT15#LGN!aS!#khGE^J%laHnpms`|ry zUALlA4ao-7sz%73vMS(xf)O}PV-KH%``ngL;qd_uMm{@hI`+cYYrfH8wH4MMML*3B c{wkEw4H#h}MQu%fG1>hW$yC2erYy_i8^4aC6aWAK 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 f8db87488755d62b8b8c8adc26a661cdeee5215f..90c08952efcd808f61a5907c938fc769594617d4 100644 GIT binary patch literal 392 zcma)$F;Bu!6oqe}g0K){;{HsG;qh8Zi!G8cU%+XqOcfz&rjP%(q5B@SJ~=v0qPv*H=Tc6~c= QE5i2tj+@H;kHa(Y4a|pm^#A|> literal 593 zcmd6jKTpFj5XJX=ijx>RIcg$EXy&RCOU1&37##b#vKs%vb_#rZ5+_KR5d$91r@P;? z@7^7qv<15aK3$S-`+_l6@L@PRiP#lHjIQ{allfe=mEDpqF}g7bob-U_;BH!C1$p!k zX@hE;5EK_bfN)dcb3^QQtJHFXjgZJpvz75ft0duLrj)i91RthX7qqQ$cu@Des`|rY zUALlA4VMjgs~RDDo>dX=BdoxAG(Ey3+~=}{icd#)Soz|e?dX;0Eq8QWw~FgPDU9<1 bf8~ks0}O29NjsZ=B>ES|RKGH&EX(2>ESI4? 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 08e363ec1de1ab0771796bb6a7bbc8034e6ed90b..9f9f8bff887d6da1f70862f2c4888dea839418b3 100644 GIT binary patch literal 392 zcma)$u}{K46vkgqL0Ht7xSxqJ9M@7>Y>|WkD>z|dLgH*`dl3gQl;BEEMg|8)28Rxg z>ePXO91a~A{Y#t~JYsZqcyIW=-}k*&Z(O#N3;+dyE#-ZlIAknng2;;JUIiVCeD&~@ zPLMW2WF)s(94!U?r<+bD>YUIzsBR&|^WRQmsFdh|{S<5~LM&9Y}O+x6|h QEi>Em+iq(6f1Er6-}n7`a{vGU literal 595 zcmd6jKTpIk48`|;3QG((rMgzoa-GphEGHHw#E>R0M|7H^@zQkNXF`ZfcHPNo#3myWbivn@Oy^=*H%q$2=!T$hv>l#;yIPGEl+i<_ z4Qe?d7^!{$<;KG2hS=>^Da#%kA(2aO2zmUlCTaLMW5)6s!H03|!qz1Ycji_WMSHj} z%UTttlDdMdO{H`zXH~@e09H5+eTy&(_j6gp#K#ACuzvQA8+svnojW$JYsK|PDGbvF be`QMVJM`crlXX15Nc2CPDSqWlp6A&&<@TaB 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 527f7825b3eaf1653d73adf5c2d9ddc52c7ea3e9..36923733d1d0f303fa6512e9086ef7c7309191ee 100644 GIT binary patch literal 368 zcmX|-zfZzY5XY}qKo~T}#Qm8V!{fCSB#@XeU&X-Kb9kFb)d2_|Qa z(wSE(dTz(zluhpfblOgSxbAS=hvAy(e+-f-z?!Z@$MyOHm;Q&4+}ofnO9CV!9ehjx HGRpn}`#)|0 literal 951 zcmchUF>Avx5QTUDih~ZBY}|D7Tmpp>x?~C+Wa%l0*e6Aj-S*$tmR&Hk?vk_`q(k@a z-F@60?F=J7c`-bS`ZCM&JQGc`w+f-kh;lmPV+_V~Hms^CobF&dFR?QXUcBv%!YmZQ zLB@sDaD>-FehH)0D13rVC6pWvMzOebXxZT(~&aOuDj z`>w6whjf`r6m)ocgafOCvs}@Uw)C1(Cd{*kxoz~_=yfad)-`CsQAA@obtL*f{QEWh otLUS3&*;(2I5%E*a{ac*?HWn>w2)o{16snOmsdIV>qs*Ac4e$0V_CRVnX69&})JN7;11OCnJLcBZET+ zM|JAJKn{lvjQ%Cg41R>ja5p^f`#!l`t$y1yQUC$~_KdGZZ5UsTm zbL3OKyxuGv9wJ|9d#=QqD9Mxv&bfEd%^`6*J4*YJv$4a@P<;o$;G#Ym|%qtbjtxh?A-Z9y> z*C}3j#eyf>E~jnk7{HZ}vgi8!Uc2Sy{Edu=Pgx9r5G0a-)mRML((4Z-{UbtRe~Wf3 J0T3r0`~jF1a9;ob literal 761 zcmc&yv1-FG5Z(0^2OTomq!~SzK%s;#ok9lLdI}=4r0Qh1{rk$Y3x?vUfohPByZ7F4 z@AN=N<4|3r%#WgRFRH2%(%O?(;6@Ntbi>yaOy_2tYUXgh*$=V9(OA4jKN^JvC^?`@ zE2wb^QOoWJ(D|JBTp@P5h3aIF6_H3Gz$x~wm8#|sqf^dsL2Ki#h#_Y6nbJc0IQL+@ z4{#k$L*F9i^1e_MG(SHT$+zHLLuWeBrIZXWL-5i+#bMIAmj!*W=;4w~#=Fvy=pTG| m-16a1HY6WjFv2c#-SY$Fy%*JA8$E1IvawGsEko3GEyOoY2+cNibI2M_?Tt9{L5n~#-G@9-^2i>(%CSWlg0qLgP(YkrG5IwHF>rF|~P&Mr>yzG*?p0 zkWbX&YMroognX&2nG`FcR3=4;W~fB8?WoqXWTj|GGBy1RaC`?~(9P%!=Pds|?`WUZG?M&F1I_2I_rwNnKj`*+R>~Dk#~rXtqj7u9yi%du>Xh?m9fNIr zo#MGyEO>6);gr>n037$x^_`&SKeW1jE?Bn_3P4W+tWjzQu$o9f+x2>Vm;Q*5+S{Nl JO97A@;19}zaa{la literal 764 zcmc&yJ!``-5Z(1F4mxDANi%vbfkFvgI+YHJ^%O*8N!7`2`|m5uDj15V2C6|i?%sR% zr8_zrhvpJxeiTi6(KL;a)}FiqcY>&)E52r9K3C&Zx0uV#evCbi#^O2p$tYBy7g n{njA7EF6DHW&*e$=ny!j&gYo~{;RyH=OrDce=ZH4#-l4{Pu 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 43ededaf30de400d907f02df19537e9ff4ce3783..dad602b6f208f13817c9a1b9968359373b658a2b 100644 GIT binary patch literal 368 zcmX|-F;Buk7>2)o6oiEs6ZbPQhT~ca5=cxKu!0jNCM3=RZ4*oc0|r)dGBP+YGB|W_ zRHqIM&Ee32(O=@s;75oIcf<3(?~}{b>bFfT2_OLAK>G?Ko6nSpkZ)w>Ly4KnR!%R) z9L*{6Dcx#ywpQXt8Z(YB$L8N(^n$cJF4|8RcY!|Os4+;PVNB=dNVqckmcVeoLyn* z;Yk11jt^7Gg!WlYA;rIRpgHb(&urulhTVRTm2ySXaYroEXx!Z}uT&_vI_3O%$6&i& zr+DEN3!d9{IBk<@fX7z1mm6*+j{7turterh0a%U2pzV77flL2~5Kr&Wp2Y$5Fa{IU I0U7!J05&0R{{R30 literal 955 zcmchUK~KaW5QXpk6_a?_6HQ%jJ)2ET%*Kl+u2wPmjOoL zIP@p@lx}i~gbH`Ja4_=GS<})J?ddtEbST4z(l`2H^4bc$cO80|$fLF~{lVcBiYKR<4sZZr?Pa#G*+B9Iv85M#l6)ZJxvc{} zq(q-sUu`+xev|y&GY7V^FrWBPS`RjxNo(YpeKN<=nntwZ5C$ zshh@+ub$a+Gig`U9Hz4R8j!SVRVUf`YH>uX13dsJ0zC?puA0?uxzQEv>ebm@OX%ys z(REi`i1t4UgjPWLKmax2Hrqn|I*4!xVM1v2TlnQ6AUF%4M?p|ULr)v4BQ)R>q#%8~ literal 1398 zcmchX!E1vs6vprV6%TgsQl0JEi{~K}O6g%cjUA$SDWNgRlIYg|eo-?JhLp8+Ihded zKJxpXFAq>~iOJCrKT&A2C`pot2(ecbZ5{z6aKdx9=*Edlnh(q2X;ot?EV#gfQ7xw! zgv4sB+(^o$L&He*BdC;r@ikJ!ao8$JjiZeKar#&in%Ym!97SyhA>;ChMjLNDs7qwZ z4E7d38k808o4Q2fKWDu+MP|3ps8P~atz-^wuv)-o0c&{g1>6P-8xG)1(>dNNgIWu$ zQ99zdk^%RBgIG=laZ>_L=^eHx0@6K;?C-Ji8E9GjpUoD;W zHFf9fo9C`scAcKhD4RV3C>pkN?+k5E9}V?h*DiY7Lef0qG^JtDD+3UMR2r}@%g}S& f(b%CsRUm_q+S{q*`PEYZN-Tqq3SdV9U!qw*`GRxl literal 1188 zcmc(eu};G<5Qg_Wg(Ze8IE2zEBdRJPp^AkGF*xz>%Bo`<+X?XYIEgDof(+1Bc(70B z|L*kN*;iyMHR#^4cyQ8}8KpF1O6?4XuQEa?IpA|JhINpdSCcvI-gK_PRw_I>(@Tyd zWZt3)GpW=8PO#=EXiRi`%oKT^LN#kK3nU~jZa6G7_ta=wGhX<2DMIx5DMm=WhqEr$ zI0n`b#!a<6-a6<8yRNO_qM#fLaR~pg8S_3{qbu@4R@Y=rUdLPM6OT_BgX@NL=jujl z62)o6ex=^CQdFjF^1z>3KB?67_fp9Bqk)z{AinCA{c6LZ7L&!10#b& z2S;^cU}z494vhXK&J2DHk>PH5-uHcSxq9QaEhzvT0MgP|7@2G)c!X^0XFmj=iCp#U ziqBD>BAe1J*5@0+e|&9bQiTP`=fZe3StyK!uT4>V6UI_-BGvi}3w*vXS%g|-=9Z{$ zeZE3A7wemNVX`H%jWAX|-x4L6&jZv0!IyhSt&yWDO#_O_^dG=!2cSf6M#~G;!n?=R zYb@U%$=}lPVMa+wpS289{7VPg&jaU4o!Db{FdC}md`Y+LiJEOT?^>!;E>^nzO5vif zsk>gkbm^3ej@`2uZIu&%ykXgo_RwsiWD2mBNI=ha eMq``)RE9J{@?b|{&yxUhm;euDz>WkSY2Xhp$#ks% literal 1185 zcmc(ezfZ&<6vy}e6(kN_q}KDM&gK#my|_3T2M)em$WcI`RsVZwi%Aphpm!G;fV`i4 z-s4@6jWVEn&(a}CUl)|pf@!_A0--4gq2z#%;WDg)GNPHT(;jT+IW|h;(c4}LWJ4Al zc$}Fk6X7M}Uk2PJ!TZdjEVHX&EoP2{l+~4hgAsvRL)-MyD!eHflQ2w9Qkgxx^C`*X zxr4NRN)_<_yn%gH|zia 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 5844ed2c32e396173bcaf0325b703983948c8ef3..898b323f45903e3bd5c10f993e41d7bfa89fbd48 100644 GIT binary patch literal 424 zcmYk0ze@sP7{{M`Jo8*ag!T&}e0@((6NSRTE)@cUz-aczy%&b5oMN=e<>=7h=-_Ze zV>R92Ag>J$j{POg4!tHu!}AQE?+?ED!gX0v04M+iq>uU1AR|tfNY+l|jnfg2W{=M4 z7-K^uL-G0Ic*W_Lqm2w5D&?U>obS01r=oubus30>iu=(3Q=JdQCG;KX(zy81>j6}~Gl`SB zrfz-p)Txz9TC8RgkySzfas8p%XvMpm8k2RpiVUzJN*Lg>)nj+eE;V}0t~PI;I&7OM xHrv(SKkDBD%=vs!V^-T1o&Z8XhJYXZ`@h1D`vK&+4+ba$RwNimQ!zpU_yG)?e!2hv literal 1402 zcmchWF>Avx5QTUDih~YbV%JTR#d9$PLg>&=rGsLff`}}slI%ABzOt=?p@`5Vt_NAj z?;iT@{O+LQ60?IL{zaiHk}S&-BE(Knv}FR2!4XgWrhkrH(sJC6t5vP3vEl-sjp{hX zAS6~}?Iuz#9U4aJA3?4B!Pi8QrlC}l1}B98X@1}M>*e;7Ge=R|QOUSGpwY%VkMcb- zWk!FCA1%rncWtvr<3AUJIYnkSPpDDSSFL0TZ?Im#Y5_}l9|YV63>$9XOxru&stJu2 z*r0U8aU}!qKX>9G)`_cH;FR8ChaxcDa{T@52ispmUB*y~d0DQUVjSo(1~f0v<u oQXj%C_u(eu<)kC=Tm2P`5n;~2(dxh}+*xYxuO4yUDsUW9}JD>z|dLgH+%2_~WugDa_w3=WJ84jmlT zsRIK!ICNn2mpC){5u&TZIm7!t?~||9zUT@$00sbA;bW0lbi!Fe=sGOEaW>(l#^DK@ z5_wGM7=OMzT5Ni8;fh(R!j$$YvHzh?H2Rn8@pp z%?X|I<=JLo(U{N`SLPvGV~VnnMMRD`i~k(Wb_r3OMp&ciw}68y026N}-e@7JuOlj+ z661O=^(pM{=5rb0y_qLif8&GhV=s6RhyMMbciR_@vL<`}P%L&jm*-+&R7~47)v7Cr zTh7($fmR88$D_E-6##DRUcWrpNId^;fSCYbW0%eVY3``tySlD9PQ6xjHCr`pUDF)T Z(~q5+;rotV%@Rl#w&=fX8X$#g_yOL*dQ|`b literal 795 zcmd5)yH3O~5bX06D^XmPC?o;yQlpcQ(20f$QTQ=AS?Acsb^`o8c_BrDtGEIe_G&$| z-kJ3k?Ug}#^lUgJ^?8z}X~MKVScy<4L@Ax{IR@i8DI@DSocCZmFR)h{Pu})QVga(? zAmR$DOoVTk_y!0&BtBM%&1Rt*)?!5@YKPvk@UEID;lhM!lsUpXKUAHe5LH!jzS|a} zWce+t%92Z2-SO=Wz*#Y|0^T|pfkW4F_<@*DX^AF0+{3}hXJ<`KFI3R$bfv-~D=ZyF z-;D|`WlHNbTA0Y9vSxab=wCQre%K}qSiuPs6B1{oca1oR0fH+z85tZH85}w| zs#6CBayWEg^e=H{@QBgb;l1Je{d~Xg)#?{bEd@XTU`up literal 594 zcmd6jy>7!G6oq#`#g#f_!XlBSV$W5iEK!$CQ3nEt6vYM#IBnm){;TArojQ~OuHZZ8 zUd{vUtpmG8IUJhqykLwKvTcuEBQ*sPqZ>ZQVq7=tbTgOpo_rq__O``y^mnVVfHDQB zyh5$Zh(@Y!K>6X~V?}H>i`2;uD_?}+ d%A^Y|I=C#e^=|4&^gn{x{uIow$&_VTd;viIpt1k} 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 a9561fcf725d2213836793d0f20ab5230647d057..db076f86e69f651c79d76b99391c6b075cd8bd03 100644 GIT binary patch literal 408 zcmaiuJ5Rz;7>2(dxh}+*xYxuO4yUDsUW9}JD>z|dLgH+%2_~WugDa_w3=WJ84jmlT zsRIK!ICNn2mpC){5u&TZIm7!t?~||9zUT@$00sbA;bW0lbi!Fe=sGOEaW>(l#^DK@ z5_wGM7=OMzT5Ni8;fh(R!j$$YvHzh?H2Rn8@pp z%?X|I<=JLo(U{N`SLPvGV~VnnMMRD`i~k(Wb_r3OMp&ciw}68y026N}-e@7JuOlj+ z661O=^(pM{=5rb0y_qLif8&GhV=s6RhyMMbciR_@vL<`}P%L&jm*-+&R7~47)v7Cr zTh7($fmR88$D_E-6##DRUcWrpNId^;fSCYbW0%eVY3``tySlD9PQ6xjHCr`pUDF)T Z(~q5+;rotV%@Rl#w&=fX8X$#g_yOL*dQ|`b literal 795 zcmd5)yH3O~5bX06D^XmPC?o;yQlpcQ(20f$QTQ=AS?Acsb^`o8c_BrDtGEIe_G&$| z-kJ3k?Ug}#^lUgJ^?8z}X~MKVScy<4L@Ax{IR@i8DI@DSocCZmFR)h{Pu})QVga(? zAmR$DOoVTk_y!0&BtBM%&1Rt*)?!5@YKPvk@UEID;lhM!lsUpXKUAHe5LH!jzS|a} zWce+t%92Z2-SO=Wz*#Y|0^T|pfkW4F_<@*DX^AF0+{3}hXJ<`KFI3R$bfv-~D=ZyF z-;D|`WlHNbTA0Y9vSxab=wCQre%K}qSiuPs6B1{oca1oR0fH+z85tZH85}w| zs#6CBayWEg^e=H{@QBgb;l1Je{d~Xg)#?{bEd@XTU`up literal 594 zcmd6jy>7!G6oq#`#g#f_!XlBSV$W5iEK!$CQ3nEt6vYM#IBnm){;TArojQ~OuHZZ8 zUd{vUtpmG8IUJhqykLwKvTcuEBQ*sPqZ>ZQVq7=tbTgOpo_rq__O``y^mnVVfHDQB zyh5$Zh(@Y!K>6X~V?}H>i`2;uD_?}+ d%A^Y|I=C#e^=|4&^gn{x{uIow$&_VTd;viIpt1k} 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 c3f3e8151be883147b2f35c4650de0f0918294e3..c40809bb79d8266e4484b8af022a45baa7906730 100644 GIT binary patch literal 476 zcmYk0ze~eF9K~P0{gJwei0%G~J z>%2!+hge7b@@3&o^7p{(+A6|A;yszYwOJ&ycY)a~p|J%2i_l56KE8AN*|;H!~`#s-ePa=@($`7}!=flj}!D z?%rp{1{KbxPl|8Y8v0UYJSzrFL|QkGSyAZ0&YXJtm>&#KM{+q@s=wtT4SaG>pxogQD>~vz)rm_ zPDHa@Ym26HesFyuls^S*oj08JKR1yC6=N|}gx6@QjGlz9Lnr7d=y4<_zwsYW0P!dW bpW>in4ZijP^r1yK0(_)_Jzs?bcALv0&z!Tp@k z#wTwh7Fa0LE@APbLYd>dDi>({>$C}BSlH;Ez7{oA+p&!F2h9SH)GHyE_ z+kJ{NRh{=-)hM;V5~ZV#E7`0F@b@LT4VC1iDmbNQxJJ=oopUQZG&z4++YfQ1mjyY| z#Q@D+h~}~|#~;weZdV2&j_Y5z?*AZE ZJa2TM!H@nOStb;9d%4EPaV1F-eFIyd3^xD( 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 5dc734cb0e00071b37831a90b4f24165fef24d9b..d62a86322d3a5ac0afc532469138a45fbcfe5b80 100644 GIT binary patch literal 472 zcmYk0u}dRS5XQe9lWc56-J3PJ=y5lh$Xi$*jF*~R0!WlfpF zBBh1J7M5z2!eV(^q_Ff45$hDbH7Zxk49xHQzL~Z4?Hw%(Z~(e?9}jKTlYB^Q6y|Ov z@5%hiuT|bBt4pk_x_q2}mi#3&d$y9Wh|rR2#nNIH$Y++G4CbO!&0=`?Tfw|Iu^?RGA=n&Y93N&{NO}x(+>y^wb!A hur!d0ClF8ybf6*7UV&?9G4_D~Iba(L_}>HdWFBJBa{Hp(Ro|lD$*8!o+^^+%eR)PRO~B z8EyOqO_uff^^C=j5@m*qvRI<=ll?l(Ft@Wu)F|1DRx*WGn8YxSVGzSGh7r8gGHzQU z+y0C*Wwq|P>QQKc1xiO9SF+v_;4g}D8!F04b#O}0af6}-JLhqDsMq{u?jXd`zbwd! zJ_cy+LNu3!IsTH;-L4En9M|nifaX3#bFHq-yrI53&be>CR6K8WpfipR1?tkw}J0t?@`>!6qI}iI#fBgy>7b zri6~={AAVeXhP^h8dJfRs3J_TnCP)&$seQMEMgR^G1^G_HDLDwz`~yiAIwzqWkA(q z;#_U7e<(X!x$K7WR?iW%zi^=a(24HVet6gG+;ml^Wa~WatA$qU{8Wvcvg-$~X$6}4 zlMC!>WS67xl2hzv^8nX=r(5c+AUwS70c19S)YnWnJSe-4$+>IWerN@}Qstp#1(gbF OJ`bvy{Qq)z2EGBmzj>1Y literal 592 zcmd6jKTpFj5XJX=ijx>RIZ9I~Y38aDOU2R&F&N)VWi_#l?UeHEasD7>fr$YR_UZh4 z=jV4v2W=qEUZ#WTT4X|qOt$UOGD4jZ3A*5OD28>>hU=-E_F#LjaL_HDy}fG249ei3 z;sVts!Z%WV1InhxZ9%M7v((5A3n5XLyyf9TH<97ONHyA=;hj%YC-m`ty?rQ{x0{Vb zskquP%2HKT>Pc3+Q5Eps!zdj4?hQT(i?PjU!qXlOhEL9#nqKI2ywG9(RG9rl-w*!( dDw58%=wPCZ+M4l2qJNRg`lnoe4JOa?>ePXO91a~A{Y#t~JYsZqcyIWAKi}_r)!Jo4Ndr&-*jC=>iA%%ybL`HIp#qm1G8g)kt0Sa73q2N8D&^`Ui8!6QBtdH8=3=C+ zIGrIf5sUM6!X+^xOQFv=T}f4zaT*~l5;XqnsMK;2mC;Drvgy}=!)pLj{*3(L92+k~ zg3pkByTAFN9PDM%TgqD{gQWc>2O1CUu#X2px7Y66VLNYWelWnRBP@C}72cX0p! literal 594 zcmd6jKTpFj5XJX=ijx>RC5lr*n#`zDmx_f6F}U_~v6|Sf?G*U-BSIKHdG^ z+4t^fuMN_(=ffrGmM3YNCcJHrRw6VBQA!tlj>&i~+Q?>3=NN471@^kdleaf5v4A`{ zh`2(viSUYxZ$Q|g@UbE`n?-7Phn0}X#y9vZylWLDT$nJW%^BYLVeHI;75A*J*p^j! zURJ!W*-7kn+oC8{`Jlw43b^(#0>{2P!4JZGDodzvc!YzI&(4~LUg&jd=&)=RmJdbW gj|=>jC!K52!9*UlHPeek|HByelQF+KlVw@*1+Vv?6aWAK 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 9183a8ba33282953213470ea05e0ce6f04649ac5..0fbef28af95e2d036619182ac932f5f99771546a 100644 GIT binary patch literal 392 zcma)$zfZzI6vtmrL0E_}aj%In9M{sL{IE?Ju!0jNCM3>6@0wsD8X>rnlaaxJk-?#Z zqdIk9AcsQ-M*k9L29Fq>9o`$h-_Q5^UcGVA(oz5f0Cu$ZMeN~;Br(Ekk$sh9B6HQl z6Ea2S7~!$na(T3p9LDouDWrBpr3?+&FI%vRKq3jKwnc%J3e54D>jac`Y+B;3L#gXJ R+z*_ReasV?|8eRJd;_f2c#!}A literal 593 zcmd6jJ8#1v6oq&HiYs-zFOzUQx>X&lalOLnR(F}Nw{%#ajP^18v zH>hzLQ49G4NM9~KH^gqYN}aIS2#IW&txg|CXN8bvN*i}Y46(Q_sA~4Am8xqs=a&O- z(6yX*T??t(=J2?5O?V&SB+jF~AQmB?%@lMxJt4rUm*8DbuS9S2i%ILR(mGI%<7D+$ anbz|dV&W|Qia3Y?f-9+v3=WJ84jmlT zsRKjvaOlA3U*gQ*BScq+`)+d1@0|OZt;;JR4?qDRCw#<-MW&1fAWbcfkPzvNDbE&(nKBQg2}&ghA4-OMt>cRR*9oL8giRA{Tgt117Pw$qdSg8^>s|d zGpyb1r$2>*-9kPqyf+HS?QcGC_1N`?;>ha{y1jd`R@P+K8;Qks`}#ukYZas87;4p# z#4YD&rmt0e&vpsV=Jx=~N^f}U^~-}zkLx`QHo5@N;X9KBY@}4MJ>S+eU#}XbV|H9e iHFVup4b|6;6VF$T971Mii~h@I0Mc;^#+U{a`Hdf^OMChN literal 1010 zcmd6lO-sZu5Qgvl6#)-DwZ^towr5!oWbxujJfz8+HEf&2B(3`I?UzuHdf64sAsHs` z%;cHL71=9|)&A|xxDk3ByCwz{^xK2uoYBuNHo6d3URf9)odL^(3 znYZ9!B~?1WNyfhg+zgJ7l_HLpP|aGb0tt!JYZG4KQva@G5U_rhN~Mo*)(xp=eGOUX zxh%4B$9GI{S{6l3ODc=<7Lt}z0gty1n&Z&5HQW$LC%1s~_jj<+;>j9ak!O;Tm+4CR zh0QO|3a%S5F4dXVHfW&(3(DxJA|d~$JvUqJIjcLt*a!4z7TimI7dGYmG3IQGgZ?eZ RnbX~%$+u{Jg-O#i`T}%P38?@8 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 b21ca1bfe8e11b02a36e870fab3fe2dce24bc591..e64b80c08a11666407962925adc27e9522d94065 100644 GIT binary patch literal 408 zcmaiuzfZzI6vtmrew4)!6Ze`J!*MMwl-80kU|)%cB)1Ure320>Kd?Q?5U|c)|43^KGNz ztIC%1&01)dL)s0n=*oG3l78d$`lZ1}6VSVXECF~TOJ@Kzb_}o`@3`uFwrM(5$D!ETQbG+sXIXX5Rg8D2ws{JTQL+U3nBQOD3Di&4CPeces`=xU^S|n7nDU6y HG>yIhy&lwu 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 b0a83b5a9b5beaa0f5ebf0158e912ed39009452e..c49bc07e3e6eb0f49eba50005acfd0fca1a2e08a 100644 GIT binary patch literal 420 zcmaiuy-&hW6vb~Z--}Tb_nH{Pz|dV&W|Qia3Y?f-9+v3=WJ84jmlT zsRKjvaOlA3U*gQ*BScq+`)+d1@0|OZt;;JR4?qDRCw#<-MW&1fAWbcfkPzvNDbE&(nKBQg2}&ghA4-OMt>cRR*9oL8giRA{Tgt117Pw$qdSg8^>s|d zGpyb1r$2>*-9kPqyf+HS?QcGC_1N`?;>ha{y1jd`R@P+K8;Qks`}#ukYZas87;4p# z#4YD&rmt0e&vpsV=Jx=~N^f}U^~-}zkLx`QHo5@N;X9KBY@}4MJ>S+eU#}XbV|H9e iHFVup4b|6;6VF$T971Mii~h@I0Mc;^#+U{a`Hdf^OMChN literal 1010 zcmd6lO-sZu5Qgvl6#)-DwZ^towr5!oWbxujJfz8+HEf&2B(3`I?UzuHdf64sAsHs` z%;cHL71=9|)&A|xxDk3ByCwz{^xK2uoYBuNHo6d3URf9)odL^(3 znYZ9!B~?1WNyfhg+zgJ7l_HLpP|aGb0tt!JYZG4KQva@G5U_rhN~Mo*)(xp=eGOUX zxh%4B$9GI{S{6l3ODc=<7Lt}z0gty1n&Z&5HQW$LC%1s~_jj<+;>j9ak!O;Tm+4CR zh0QO|3a%S5F4dXVHfW&(3(DxJA|d~$JvUqJIjcLt*a!4z7TimI7dGYmG3IQGgZ?eZ RnbX~%$+u{Jg-O#i`T}%P38?@8 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 2f22faafc626f27f1bd7bda77f888e669ef8be68..dad97a138822e81bb9a521b469d19e6429107c65 100644 GIT binary patch literal 408 zcmaiuzfZzI7>2)|{9K4Jaj%In9M{s8+NucyR&c_^gv8m>_7Y4)BLr7c85tZH85}w| zs#6CBayWEg^e=H{@FPT5hr8i@pZCdEZ(O#d8~_7=tn@KY96A;(A#@cM-vk?rQg#27 zO^7-obcDZH94rO<3YD>g2#pAv2<_RSbD>Q`Wki%0p~Zq>QmsGHC}dNICPYb`QcToU z$Yz92#NvFtaA-{EQfRY~tuRGd$ReUfg2jK1TBC$0P9v<*^jpB*HGqvb6Ms0D_17Vl z&xm!illqi)xAVD-^j^yotiSO=>#@W8@*sHVb?&;dRW?;W7|6wD^Xfw8mSMY|tyern z-f*6I!cBt*ZJ**cR{*$mJKb_`E%Af<9%d4Ni(NVcq_(94uNXEzwDii6YjW3abJI6$ Y&uHtG?;oQmOCVj?p#QRIfE23X2h>q|R{#J2 literal 795 zcmd5)!Ait15WV*+20ZMkrR}<_^ehX4EM7c`hctOv!lp?~(yD)Nn^q`@2XPPPkPMUe zX6C)*iVn&kKY2DDf`&57^E_i(AFV)WGNPQ$_?Uueos|*I9L{^Nz2`V6jYn?>C9nWl zaNuzTRVKnq#=ijEj*0gbVzXJOhILpGiMnyNBD^UX1zbodsmux9`LXH@m36h3*SoU5 zVOz=et=x)g&#SiF32`gYCRV^}55sZnyB2;VmMJYD!~Go`jCgX^H1te0y`(D@7Fl7L zDEfXre%K}qSiuPs6B1{oca1oR0fH+z85tZH85}w| zs#6CBayWEg^e=H{@QBgb;l1Je{d~Xg)#?{bEd@XTU`up literal 596 zcmd6jy>7!G6oq%5;z}JdVUfsEvF9pMm#9mpssn*Tiedu=oVIUY|5fr_btnT|!FSHR zoI5%?4}M8%JPh3g+qDq%^9qq$`QJ3 zQ0EJhRr&|eVZ8X<5WC$f^{U54NEFH&Qk6fPEe0{qn05Yw6w_$Cu%_M{sZArT5a)xa z(MTbhMnYRzAMTg78SewU#%bu!NTX29W(GDtJ|M!I=NNoTFGR2Ni_7b`@;XsT!({bW aq4cps4_{Pq!OtCu{zo$VUnNsj6=UC3ETG%~ 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 2f22faafc626f27f1bd7bda77f888e669ef8be68..dad97a138822e81bb9a521b469d19e6429107c65 100644 GIT binary patch literal 408 zcmaiuzfZzI7>2)|{9K4Jaj%In9M{s8+NucyR&c_^gv8m>_7Y4)BLr7c85tZH85}w| zs#6CBayWEg^e=H{@FPT5hr8i@pZCdEZ(O#d8~_7=tn@KY96A;(A#@cM-vk?rQg#27 zO^7-obcDZH94rO<3YD>g2#pAv2<_RSbD>Q`Wki%0p~Zq>QmsGHC}dNICPYb`QcToU z$Yz92#NvFtaA-{EQfRY~tuRGd$ReUfg2jK1TBC$0P9v<*^jpB*HGqvb6Ms0D_17Vl z&xm!illqi)xAVD-^j^yotiSO=>#@W8@*sHVb?&;dRW?;W7|6wD^Xfw8mSMY|tyern z-f*6I!cBt*ZJ**cR{*$mJKb_`E%Af<9%d4Ni(NVcq_(94uNXEzwDii6YjW3abJI6$ Y&uHtG?;oQmOCVj?p#QRIfE23X2h>q|R{#J2 literal 795 zcmd5)!Ait15WV*+20ZMkrR}<_^ehX4EM7c`hctOv!lp?~(yD)Nn^q`@2XPPPkPMUe zX6C)*iVn&kKY2DDf`&57^E_i(AFV)WGNPQ$_?Uueos|*I9L{^Nz2`V6jYn?>C9nWl zaNuzTRVKnq#=ijEj*0gbVzXJOhILpGiMnyNBD^UX1zbodsmux9`LXH@m36h3*SoU5 zVOz=et=x)g&#SiF32`gYCRV^}55sZnyB2;VmMJYD!~Go`jCgX^H1te0y`(D@7Fl7L zDEfXD6r@PvfK^CLFfqY6TiREHF=~MLv60Hi;K0b> z(7{oi7#PUYfx*$g#F@cMh{ny~-r=0{JNNFD4{M4FzyTnlypAUp>q$OAHudArlJ{g{ zdwqxZG1*1dr7hn!J|zG2^`1o$79j7-^n=C5GClD1F6xgmJ(Qf3?Y(;z_(OGrFCz zmU-$hZ5Q)rE1`E~H5OGDm6uW!$^N2&+D*f2YuBRLYFu7u`BX0Hifb)itsWm}UfwWm z$IN6MU7P2eT+z!Jo~XNwSak{DHr1LnxZssdoo^cdYgzqH%cMq4!P^P{^fp{@Yz zU$n)kX#P0Z;6Eysnmg-K=vbGCQj^66un;CsJ2&T;*yPSQqXiH zhM4E;=~GcmST4rM$Al9xW_*oxm#5E)G^15juF1v5K|Re$_{B3>()`UDJ%e``^`Yp) z5I$;w^evfhe=4}@2yrW4N~@?O9WY3v>n{TQzd3oAIaj$7j9t=>REv4bL(;LyMHk25 zz93ibY6s0@7tMWPE|2b984ODqqmSzKV4Lv&O5*UZSOS$lpTRqxwnelg-a%){MwgLg HS(bbQAVYY4 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 f5b2d6b0dd35ceff4cd5eecd5498947bae8cfb3c..4553fd0ac029f08b172bf14cdf3f11e983cfee31 100644 GIT binary patch literal 392 zcma)$zfZzY5XY}iL0E_}aj%InJYGwG*{TTxR&c_^gv8m>_9d8z#u{8nWn^$*WN_%< zs7@Ui$itxnqkoArgGY?c4tK-%$LFrmJa0<{00saX()%oP=}54Q&}CeH6>KCbwcTSj zChCyTA#O3>TL|_UD*j%HanI>+D=-}2=;(G3 N93miB`d<#uz&FfidDj2{ literal 592 zcmd6jy-ve06ovOZ#g!O3IZ9d@P-aw#rDExX7##b!vKs$jJ1x9Di4&wOFfri4zPkR- z_3^o*gSKGjz{f+z|dLgFm6eGvySl;BD#BZC7YgF^>L zb?U%C9u6HC{Y#t~JYsZqxEsDdK6lmHWkbpVFaX$)-e;*xM}nnrijx>RB}!TvP-aw#rD9=1436))wVK$*b_)D^5+_JmU}C_-`E>Wa zv+v!|K^x>JFUE`MT4s5kXQJzlmJynaD5ncPr(`-8ZMd1!IR-m;iG%L&+yH=6mLc)|bCwS+_u`{c-RjqFK<@QeO zl&D*^qDO0CK61I5F{*k_6#(P<*3gN=xay2VwNH# zt^=|_ct)4!8;6M_gjZBr1Z2&oEG!@)5<^O&zl=t^#874pnaq-Y1t?qr80==`j$>Ya z9b^6sY1aokpQ)q$JeN(qH}Z(d->jhf*!Lg!k#|4r-wt@KtctET;)|V5?}GO=MYkMX zt~dg}{1HEi3j lRBIKbrW%T+8;++KhHc~!WcIe`zig%e5T{`r90Krc{|~gzds_ei literal 1006 zcmc&y%WA_g5WM><1U=+r<5v>lTcHGc3B9zJ(t|9mgNU_KB{^;XzJ91+2rhl3R0nBU z&8&7-b47L%AwF2vAA+3HD30TZwe4ODa8*P|Opfq21j9N?6x9??yVITJu#+v^S$&cM z0+2Za+|QsAJ=liv4*=JF;&p~ttpXL9f*FyJ>%_gt#tSfRgftQlV2$ldPPk3FuIaig z1g+~PFSmKNEojCzltV^oO-Gi4=MIp=zEd^Wo|ukl0gb!80Rt%RjmC;RlAJt^SJDMd zF0|uqH?)7Li73;80`$yFjpK`i{Qp?8rLp{KDyWr2)&`Z|cSosugJ$d@6gcxpaL?H% Z=SynRKb7;Pul=c}VoB4dl9D8e-T?gahLo^Px%P+ypG*wAMAFho zg($uD$qeB!U7T+m1`ZKk(d^78Yqn)!J_%4dpd|dssMJ#oW!8YnEa_W-L>s_hHzQ{- z7v<*x7SE7+br^l;jt}C(4)~VT^IXfp%q#2ySef1?!EtYUAh5qGT$`P4&T9S6=AYSZ@jHMj5gD|S ztJ|_(l1;0aR}{yy99>hLl3h^Lf}AhL5X5-k_qR0s&qskz0L&vW@Q(o6)jfcz$PQxl E1r`H>{Qv*} literal 1424 zcmc(eyK2KQ6oz*{#eoi4YUB8l*q%$EOX$)rrGqRT2NCO1$xhq1uP-VXLP(t^RD&d> z|491I`E>^yF45l^(hUp_q38R)N9ua37}~-E@L`W%{iJVuE?F^7$KI;eP~7kupNu+i zhE7PVM%qlITsCMbLVpBQbqk*p#bV(?B@s9Y1SkXh!K;R$wu7YNa)(Bn?#NNM$}p#4 zo`s}bM{&%mlI5$EWi*M?B#hQWl*RWJCBl#_YlF` zu*FJ$Kcz(~!6m63=6r`FqBH5Td~pXH z`NTQssL;_VobaYNzpCw}Oz|nEnx#Ds*I{!B0tjTl@>Wn^$*WN_%< zs7?$F&BK9#(Z9r*!AFQXI^5-Q-_Q4(%hl?aO^yd30FdO~qlJk_lq?Wl1({b$Ml@SK zs**91h6oQ?r}N__C7*#fG8uwHM8;HpGI2!ZNgxi9_)O&~C2Ui!J>oDR6B93xxG=L* zB&`B6LwHQ*=WBJ)*57Qm5?g>OF$D}yQ*B3a w4ZmcouC3}NwP1Kf-E&S#mR7QoaY!Oa>~3iImrtYtq8JQ<1AumQhg}5l4Fht3dH?_b literal 1216 zcmc(eJx{|h5Qg{s3QG)KNR%dNLo%aEEENkZh{3VXl~sRXI|cqd`7lzXDuMtN9_*9- z-r3LH`3mj0g7{!@w@`FSqd1NuEW}<@aCL-GjE?Z$8~r$PMeETVXQx|BV8;dATYcgb zf)G0c#80GLd9VzVPXW>0#@j@(S_M~yB}^O{y6Uwepfu4s` z?gEwzFY>nS3H~Z6(g={CJoa3x;l>X4-!rqG%gnE`qO{}+i$J-&K?>RR=$br+0B3Cy q8tAOf*&I!JQJim;_NPqw9MeUSzWTx=O|!T{#ZnrEg@Y(blIR0oU_I^t diff --git a/test/Driver/Dependencies/Inputs/private-after-fine/d.swiftdeps b/test/Driver/Dependencies/Inputs/private-after-fine/d.swiftdeps index 93de7a407514b9bf290fe7b55739e645ee530b6c..7866ec7f6385b8d920c87a19518fa72d0c47ab0c 100644 GIT binary patch literal 408 zcmaiwzfZzI9L2AvK#7SlChjFMhT~dVC~a-RfEAoDF(GlbKNCzuBL-J;GBP+YGB|W_ zRHqIM;pLvqR=woicfZP-(4}2U2U$7=5$U8#cG~{?`a=an=nz_{2I)Ax zce;CecW_XI>B+O<5OB$pG))tx_0b9pO#+a@89&EhTxUh1nZtPxw)Y$lO5>xq7bP$P zS#Zd^1yoUoUNZg-;C4uSED)MJM#m4<%<@joY&2xu|8; zmZB|pRaw-y*&)BL*tTL5E8ts?#PQgh7X3iXr?fyB9`@*v#FMkszzY=cI$fy{X9}^M z&i7;cf2D|V8Vyp%I%R2k5#ax2S^p%a#=UT%AVp2+J>AO*jRm-h3i)M5hi(v79=k z1S_kE&M=wq#o0RHkOY$@S7#AjfeK|2jj~FZJ^Vkg^qyf9{cW--=QP!1!4WwebeR(d0M#Xe} zQ>*&2wBdZ+4)sdNynsMf+(C$y`|E~)-Sv?Oe^tA2yS++qnaLvD*wT>A4Bhj!zz!`> f4?Nwp^s3EjCi9Oi*Rb3iMw#6W`Y)R)z)(0pH9C6} literal 795 zcmc&yJ!``-6x{tQ1RXNjICc`(oY5VW%4;2idLujEIq{q|U z(|f18BL``ao;)26PA++prfEWzI$Dm!jwq?t5UW=+N zd0XzPvZ%4yf!$YhThWOX@YcgH9DCiu55#;*bBOS;hlAly&YFh2kb=BUS2DzzLTsn= z{n-9rDWaW%hUsW0t(jgVnf65Vt4$;GYH L2&w{-EX$HFGr-cf diff --git a/test/Driver/Dependencies/Inputs/private-after-fine/f.swiftdeps b/test/Driver/Dependencies/Inputs/private-after-fine/f.swiftdeps index 993aae48b3a01fa996bdc97a56af898ba57dbd8d..24bed2a42a7facf0b13e4fa364b53fb46d084896 100644 GIT binary patch literal 436 zcmaiwu}{K46vkf1b6M*k9L29FSR^djii%Z4BV5CDh^??GtcF(VmJy|$lxv3|Qko?SYGe-EPRDHz0N2V4IksMm- z8Op3YGDmpA7Uye+g=YvaS#Iu;72onOkN7C#Gcx)T-fjNPv>Dq1RE{WMQcdmH wietJ)M|C=?Zm0#57IkW$7;VjH#}UMKH|YOt6kk literal 1214 zcmc(eJx{|h5Qg{sijx>RB}$XDp_x%7mWl-y#NgPkE31he?4-cICm%+tR8>$)g$LU@ zzh~cbcfO&u(g?Sf^^2f=9E4#Qu&UY^0apY>A?@%nY=*H@S`^cEnw{w^$68f*ux76W zypXvDygiUA-NH)7zXaU$hW7)-Z021xt8w5+BqR5xWGm3PQ6iPz!ZxIUBtkUOQ-xO;?w&y<0()rsQQjQO+Yd zA5Ck!A^N{cNZnMZp*Lm7_}|2LyjPcxKRJtniH9|4kWfKzrevPOX* zzl^YOhSaP5=m&SWm*BU!w@Lyr`HK}aA9~KcFtqOmy_>$EW|fR(4~0~t(Yg>EHCODI zMLBPZ!iF=IlB47t+psY6^4kF2>|mW>*|!7W*{=%MonAlJZT-zoE4Brw5|N=~tBPUD xR>{!}#WIwlrsPX@p=g^YT1VA7@hHR*#CA6{{L9CZ06_#s?g2o%y2CC4_y!45fQA47 literal 1216 zcmc(eJx{|h5Qg{sijx?+kSI;khGa&SSSl7+5QAf%BddvRY^T7#Cm%+NR7Fsr!h?OX z-#h!cJ72+0NDOO3`h~$U4#F@DNYm^ULt6#_Asq01Fotmul9iJ=%~o}W;!ZSpZ`4sR z^g?1aQa6(d>CkXOKLu3v8*ekkYUN!eX>sNVP)GJvaK}*FQNo3+(P-0$oOA_l(u&5c z;CYp@D&6L3Qed`4dXtk)PDU?_FC9vX`>w6f^p5ek&5+x>Thu7ogI2PHCrGX#gXi&7 zSdV4>i=62Og1<^is~c=lI^u+qih>V`v_1j= 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/chained-additional-kinds-fine.swift b/test/Driver/Dependencies/chained-additional-kinds-fine.swift index f92c6346a8936..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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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: cd %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 56ab83ab43fcb..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 -disable-direct-intramodule-dependencies -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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 08bc5db3a6375..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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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: cd %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 -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: cd %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 -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 +// RUN: cd %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 6ba403117f3af..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 -disable-direct-intramodule-dependencies -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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 786b16e751a32..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 -disable-direct-intramodule-dependencies -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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 a7dbecd31408c..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 -disable-direct-intramodule-dependencies -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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 d0a57f692710b..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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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: cd %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 c33c0a12d8fa5..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 -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: cd %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 -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: 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 -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 +// RUN: cd %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 f9d15e9b43127..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 -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 && %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 -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: 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 -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 && %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 -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: 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 -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 +// RUN: cd %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 feb3e2a288598..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 -disable-direct-intramodule-dependencies -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 -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 +// 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 -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 +// RUN: cd %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 -disable-direct-intramodule-dependencies -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 -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 +// RUN: cd %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 -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 +// 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 -disable-direct-intramodule-dependencies -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 -disable-direct-intramodule-dependencies -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 098d8ce46c855..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 -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 +// RUN: cd %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 -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 +// 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 -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 +// RUN: cd %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 b420a8830ce68..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 -disable-direct-intramodule-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 -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 be02cbf537130..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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-dependencies -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 d669dcc188058..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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 -disable-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 +// 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 02bdbe375e6f5..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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 3895382df7c54..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 -disable-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 +// RUN: cd %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 -disable-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 +// RUN: cd %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 -disable-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 +// RUN: cd %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 151e581a114c0..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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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/fail-added-fine.swift b/test/Driver/Dependencies/fail-added-fine.swift index a1e27ab3b4e08..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 -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 && %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 -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: 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 -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 && %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 -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: 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 ee10b7bbd45a3..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 -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: cd %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 -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: 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 -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: cd %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 -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: cd %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 -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: 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 -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: cd %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 -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: cd %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 -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: 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 -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: cd %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 ae1dd733df7c5..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 -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 +// RUN: cd %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 -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: 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 -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 +// RUN: cd %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 b11374a4febea..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 -disable-direct-intramodule-dependencies -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 -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 +// 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 -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: cd %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 -disable-direct-intramodule-dependencies -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 -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 +// RUN: cd %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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -disable-direct-intramodule-dependencies -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 2f4f7595f1644..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 -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 +// RUN: cd %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 -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: 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 -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 +// RUN: cd %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 f027a5b13caae..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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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: 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 -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 +// RUN: cd %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 7fd6a3bb13eda..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 -disable-direct-intramodule-dependencies -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 -disable-direct-intramodule-dependencies -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 -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 +// RUN: cd %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 fb8c3790b1d69..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 -disable-direct-intramodule-dependencies -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 -disable-direct-intramodule-dependencies -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 -disable-direct-intramodule-dependencies -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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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 -disable-direct-intramodule-dependencies -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 147d2611d4db5..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 -disable-direct-intramodule-dependencies -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 -disable-direct-intramodule-dependencies -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 -disable-direct-intramodule-dependencies -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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 2e0edd7d9c6aa..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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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 1f77c7ce375d6..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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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/mutual-fine.swift b/test/Driver/Dependencies/mutual-fine.swift index a5d4610794e15..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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 36677de2493f1..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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 637298694bca3..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 -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 +// RUN: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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 +// RUN: cd %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 310e4e6b8539c..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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 c7a081c10aa00..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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 12304986c4ab8..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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 771796ffc72a6..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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 afaf4d3bf84ef..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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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 +// RUN: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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 +// RUN: cd %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 -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: cd %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 -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 +// RUN: cd %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 8548ca9e36459..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 -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 +// 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 -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 +// 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 3b251ce6b1324..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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 f1287332305e5..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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 37e791282556a..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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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 06207033351ee..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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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 -disable-direct-intramodule-dependencies -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 -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: cd %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 -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: cd %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 -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: cd %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 d05a3f14a95e5..e2be06aa56fa7 100644 --- a/test/Driver/Dependencies/one-way-while-editing-fine.swift +++ b/test/Driver/Dependencies/one-way-while-editing-fine.swift @@ -12,7 +12,7 @@ // 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 -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 +// RUN: cd %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 @@ -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 -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 +// RUN: cd %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/private-after-fine.swift b/test/Driver/Dependencies/private-after-fine.swift index 0a002d35f4199..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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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: cd %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 -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 +// RUN: cd %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 -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: cd %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 1d3249d74bb8f..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 -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 +// RUN: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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-after-fine/main.swiftdeps b/test/Driver/PrivateDependencies/Inputs/chained-after-fine/main.swiftdeps index ab68f2a75146fd48893ba594c68a57f7419ac818..c00e208418ef20355cadfc0bc66faf469376d166 100644 GIT binary patch literal 408 zcmaiuy-&hG7{=e8d@jV8xSxqJ9M{r9X@dy^R&c_^gv8l?CYXpu46dXyGB_|YICOAS zrw$C{aOlA3U*gQ*ONg!xcf<4io?qTp`=Tr505||-rH@5ov5DXbVe7E?Cip~@8iyx* zN|Z5SWBkSPXeIbpC{HXzSVZ_#sLvK#2z3_9VxV#bUx%LY;?vjVa1P9uXxHJpOYu+a*MC8exs5-vSP<08G4@c%uc?UPp|c z661O=^(pP|=5rb8y_qLif8&GhV=s81L;rrzyX{k>tSg>Bq{U9>@|*@n#k5^htGY7X za;|-7|x#?gVbd(G0_> Y8;(~qO}lQoSpw<87X6n^1Ef$5KiOq^3jhEB literal 795 zcmd5)O-sZu6ukFW1U&4irCYb9^ehX4EM7c`hkQ(yuxS#LwCcaNO)C_{gSZECNFFaU z@4cDih8&eae)e=a1R2XL&-09GeX;_f%LvKI1s`)TuZuFGTf$`zcJLfWrSa(Ps03CZ z4GuhRpvpveN%+~2{$h$m-FN1jPVUec8ctE{k2 z6#XzOxRxos)97I$jmnzTk&u7k%>E~5{$xzF?g1n8s`Q$lgr=I`UbyqH!J&hr zI(1-Z9u6HC{Y#t~e1z!gaPM%=@0@!Z&8xN`0#E=*3m;Kzk}0DxlC__GV|2=Lwc|57 zLuG0m?zNdIsT3oV|l(G|T=POsyZ@-vs8 zpA=koLby~_THBz74lF36#~X?MM`^OP(wtS9VC*A$G&AZYzsX9A^EHn2Z$ZxN>h08LSBz 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 463b4dfae1c71b24c0e092e4bbd62c902e1c9f80..becd8c3d80bce7e4a30b5d30a8a7b4d72e0a1e48 100644 GIT binary patch literal 420 zcmaiwy-&hW6vbbk^0gRa!d?<%c)XUjv?XoAfEAoDF(F~L_9J2<7$6XxNM&SjU}SLU z;HXX=7|6q+1EYV5GlQ29U46-Y!#%%q?#->$FPmH%A&L-6aUaXrB2z|VOg2IOjnOG9 zRE|&S42u&?Ch)V>$(qrxK$u#9kPy=ulb$WIWYRnkCRli3Qp6~9DzzsP26S$b7z?pg zh_JW`=mL`&Tb*wm7Kt!fGiedf4Rj$apdl7RMx(!sYP|p`SVNE@=~qCxD}+qg8N1^p zFTaine}?tjqy0}VdzeWlx%X-YgZvGJnxnQq;D=tX-|lvJy{L+=H{|n;M(cw2b){@O zWx3=C{El-}(^nPWyLJh9(^-Tbyn$$Ux`P|9SL|=IT<^ZW)!=U0o!#yzkF7)!;p(1@ oY}-?{lBwyArW>v-8@6d0rfb6t#gNTX3Zulq4*i!+1)dlQ72F9*<)%uDv4J%;CIy(>sA1)#1G}2PH8A z!CMqz0aX;xwIIF$!VHOz1!A>|R053)B4bAk9LR)Mbg6$=ZIEdF1a1}W&{;PWpBVsn zT^4n@7UjBaLSDxWB$y)L+q0KC`FrV);0udIM2oCkK=h5^ zOTy-Ib+t`cEFf$xjiullq*x}nPjp}M;IE@v&!H8gKFZkiD?p|VVB*ch_Ci{C^%%V* zrQ3t}r*gEPQj^MiHAPVV#)0Nz-+iDHXEg2)2egzg>b5hX*+!#vP2G}N?)1uq)1F3m zzFzU%Et;;=wHapBG{9Y_Kgf@_CAM=vMuz`7+d{M3QWby>`VvVX)mRL=jyoJV_)7wb X^bY;AI3zLvVGKNR2+&r*!!*DT23T?j literal 1162 zcmchWOH0Hs6ovQw6&GC0s--h_)wK)=GPu!=xJa9mAx!fyNvr;Q`-o5|1!qRhBDo~z z-rSFq+|XWXq({g4g;SR&X__XiX%2?NmkCiyCwvaUFiukQatf!}o7UCX%Lb3mbdnNyrz*d8Cm!p_|qPX4DjKQi%BrrR~9tB``R59n~Y XMeBc(jSVlnDbD2(tno;)EK9xs=n*jj 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 fdebaf57ebfb4aab27e919a0a84209c4901c0cbf..536f71123e364ba2a263dc74c7f297350aab94c4 100644 GIT binary patch literal 416 zcmaiuy-&hW6vb~ZAZ1Zw;$9PDc)XTUumutZtl)%+35m0%9}x#JKyW3Mk->qH!J&hr zI(1-Z9u6HC{Y#t~e1z!gaPM%=@0@!Z&8xN`0#E=*3m;Kzk}0DxlC__GV|2=Lwc|57 zLuG0m?zNdIsT3oV|l(G|T=POsyZ@-vs8 zpA=koLby~_THBz74lF36#~X?MM`^OP(wtS9VC*A$G&AZYzsX9A^EHn2Z$ZxN>h08LSBz 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 6c6e6bd8f844a45e7b68158269c57185264c20db..a9ff90ae9f81aa286a0c7c93c86eca08631c872e 100644 GIT binary patch literal 420 zcmaiwzfZzI9L2Av{924LVK0d>9M{s8QfdLqu>d!P5d-(0nJ)ew>hQG`%J_*h0ZnQ$6mvI(+poKASI ze0)ZySRP|ChL^8S)|`F?(!>UYgqTjb@@$hOS7w1U#?lK{=A433u0D}4pfj69Sc>f2 z9Lt-4E-;z$)x|bplQ|}9t}Ft&0Ts#u8e%!*bpF>-spSBLXb3hm{Te89jgSR9V{fz+ z)z=Xb&#`fPwEroj4^zpw@Low_u)pD=#zWg5h(p%vx4RwD$m_DlhGMo}Z(fSNp_QCg zNiDP_amTfE%hxrZxgLRRGL6t98^}(lJGf!Je1F^JvHSkkgMTaDIqi<-He+#wD|;$Z oi@M=6-}Fq)R1LGpJjb;PrlFn|EZxh($ literal 815 zcmd5)J#WJx6x{tQkUC_tWjnUqc&;LKiMq5))d8C$L9rhcaN7L)`h!Z5q7G3zlmVXL z?!g^*$F_k(kcg0@6J`z<|WF(Nwcnmb16{ zNV%ZSg@<`NOhW$3o8ENjL7sc1X}*!M|71}1lR>}ohjg!qcR}y%i7EOqv{~~K8eHWj SBx+mm>5|YbFRgsGLlw(>7LY=~+48TW-ppeZ(Ex31`ZXZi1u*f=#P&i- zdG)AtPW0=;_@{7ukQS4|dp%9i{>B6C$ASAGjh*|^;C3kKMXg{vV=32abuJ}WSB+lZ zP|AH-+UNRO)zwtjv22R0m;t!y4Ti;0RAM`KBh>J}Dv_vK9Z>-2MLC>LI1@=A^_T*^ zileKVRk3uVs#&h#>WXdj6wfp9brmjEjgQW3 zmB1)u-eMIFq)G>Ll2u=V%5;X^fnqX=u9`J?;0Vxkv1R^U$so}BK_!)5qqDAibuVQE zX;E^*>HN0jaxQ5u=2b3eS#U~beDL!4)}pR()ixYm=a>&>fzsdKp+zm8tkDa2f!P$u z6ezq70_7u|k8uUp_8fnen#R`Hpbji3qlX^>{zZO@vHXyWGNVnSG^-=&>8(QgjwtwZ zeBh{IVk;e$dp3rXUlr$9qH!J&hr zI(1-Z9u6HC{Y#t~e1z!gaPM%=@0@!Z&8xN`0#E=*3m;Kzk}0DxlC__GV|2=Lwc|57 zLuG0m?zNdIsT3oV|l(G|T=POsyZ@-vs8 zpA=koLby~_THBz74lF36#~X?MM`^OP(wtS9VC*A$G&AZYzsX9A^EHn2Z$ZxN>h08LSBz 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 045438f5550d62b58e0fa545b666ddce5b04c61e..f49792b949a856c54fd6a0492089de6fee17b9b5 100644 GIT binary patch literal 420 zcmaiwy-&hG7{;%sd@aV9u$RObj%#Ua`D(&|6`U|JAz>DJ*NBN=fMDE6Wn^$*WN_%< zs7@Ui$l=g|(Z9r*!IuzSz2t6qp5ODlZ?0OqYDjT}C_*SEeJn$pOa%=w*?8$UL8l^9 zK0c!}tWGeQz$;cKYeBy}WoiRLd`xFTd$!3^Xmd}QVC6+)#)1TW+aMmWlu+z oVKQ#Ciw1XdC6;rFrd}vnF0(9F)GeLIFp3=P(0|!T3WmV>0iH#EcK`qY literal 815 zcmd5)J#WJx6x{tQkUC_tWhYi0d#)mNiMq5))d9nipx6%=aN7L)`h!ZAq7G3zlmVXL z?%*AF$99?!A1ogh$U zcO8UZKs9+-#l<&3m|^2{fmp2qm3WHDpPJlYum 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 ad8a56b02c2e39ae196ce401911ca08ccc923431..b43c0bf3f82f1edfac625119f095bf94c8d89b46 100644 GIT binary patch literal 492 zcmah_J4?e*6h66qq=JZuf@1`c-rmGCjfpKd)M#C-P$+b6o>0LmR;pu(9XmL5bm)-5 zQJpe4l&eFBj{Xwo4xS=DHivu9;d}9M4lA{~kO5!-APUdpiA4vTO$eQZ*+Jh!*G z&xS643D{@?9AjtV^~O^E zp+}_yVw|od--Na0g-lv_DlZVEKkz~Qx)oeWUH`JvI&VwHwyt=7SISnajT0#_G}Cs? ze8H8aFP*EG0$mGy$D`=YECHO^t@d_j9^&~I9mMcnJ9AKT8o#^!XTND=1OR*P$9aP@ zl?GBy1J~4vqI%#49fKNvwh++T$ literal 1848 zcmd6nJ#T|B5QcYt#Yr8q016>MlDUf1CF;^HRR@F5krixH8`AXOmk(EpL{Ul_q%eSm z-aGrbd(RKBa+Rgle3ayVOkaAa*w*ub=FQw z7pou%!gR%AWYIc|;$)4hG|WGbsacwlTl>m=@AQ*^rcX818=Z! zVd+BTLhM2U@2!j*i)ifWN?kQHwJYGvbphO}AR&c_^goN4B*G5bP0|Zy{WMpt)WN_%< zs7?$FnK&y0u|9v*rMszfWsSrGjTJbgSle7 z4zO~8?7M@VPbs;dkYmz&DS?FjEe2|j&7i0B{Z6;pZYg#qt5LtNq^i~Wl@i!y-u3c^ z<*CY+^Rk5?YX*LUVv&{i0NTASbp63~FnvInhsth29J-+urzxK+=Y6yot*wzbNs|N49Jt&DI zkOzk%PN2#}^fecs0Aaht+XS&#j8wxlPKW?DKBF(ftE!_!7ZR*iW{2MSuIzwij8P#e zFBzA#E{WLk}HKWgoXik5SVz7$jxMfL&XZwoO1 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 c279ebaf043ab71881b565d8b587b1a049709a67..fd1bac5a8aeb1a94210f1546839964987ba43fff 100644 GIT binary patch literal 420 zcmaiwy-&hG7{;%sd@aV9u$RObj%#UaDIW;~R&c_^goN3)*G5bP0|etnDkFmfBZET+ zM|JAJKn{lvjQ%Cg48DZu>Lqu>^ZcIYeRK83RZB=BL=i#>;bR$@WXfrT$;QvVaXRI> z>hT$!VR?ed1YW*6S#$d3OH&gN5@0&x%Ckw9T$%gQ1WPYm2{{F&T7M#ePv<6yuoRiO z5X&2%E-;z#)x|bpk`R+MR~A0qfC^s|db8Orm?SBgC!&EXZyw_3~>~FZJ_0aK#;>hg}I=!xF?8s`I5sYVoQjN6nlYvJMu2ZKLMS=Hc`BxHlqlM{oM&$a$6+TGJUVld0uqpU z3p^~K5(BuN@oxY(W+8Yst}t-l#%7(eE{UJA9M$9Bo=X7K<^*!!2*gWYp^9RWKCY< zk@QKOPY(-jn1uY5H`*%DfPn>RFy2VWe==zH?FWN?Y>|WkD>z|dLgH*`dl3gU)Zj|ajtmZr3=SO} z)u{smIUG7L`jh) z{KI*b8mkyA==wxvb6Wsj-wm%y;i|^#SUG==+=%*v+5blc6~c= QtIYQNuAABXA1BYiH}PkBVgLXD literal 595 zcmd6jK~KaW5QXpk6(k<^M6+$Qb$d3Oc-eUIWIRmav65{8fv)=RrL-nJ8xL}T$?&~_ z_iorx8}PHIbVzpH7o78ghT&u-LRT=x*#%#7F|Ug@vRle!4|ehbM?K)l+pCsXK?)8c zZcuF^ydv=f2%8$88)COxrG`dqgp3JK;jIiGT15#LGN!aS!#khGE^J%laHnpms`|ry zUALlA4ao-7sz%73vMS(xf)O}PV-KH%``ngL;qd_uMm{@hI`+cYYrfH8wH4MMML*3B c{wkEw4H#h}MQu%fG1>hW$yC2erYy_i8^4aC6aWAK 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 f8db87488755d62b8b8c8adc26a661cdeee5215f..90c08952efcd808f61a5907c938fc769594617d4 100644 GIT binary patch literal 392 zcma)$F;Bu!6oqe}g0K){;{HsG;qh8Zi!G8cU%+XqOcfz&rjP%(q5B@SJ~=v0qPv*H=Tc6~c= QE5i2tj+@H;kHa(Y4a|pm^#A|> literal 593 zcmd6jKTpFj5XJX=ijx>RIcg$EXy&RCOU1&37##b#vKs%vb_#rZ5+_KR5d$91r@P;? z@7^7qv<15aK3$S-`+_l6@L@PRiP#lHjIQ{allfe=mEDpqF}g7bob-U_;BH!C1$p!k zX@hE;5EK_bfN)dcb3^QQtJHFXjgZJpvz75ft0duLrj)i91RthX7qqQ$cu@Des`|rY zUALlA4VMjgs~RDDo>dX=BdoxAG(Ey3+~=}{icd#)Soz|e?dX;0Eq8QWw~FgPDU9<1 bf8~ks0}O29NjsZ=B>ES|RKGH&EX(2>ESI4? 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 08e363ec1de1ab0771796bb6a7bbc8034e6ed90b..9f9f8bff887d6da1f70862f2c4888dea839418b3 100644 GIT binary patch literal 392 zcma)$u}{K46vkgqL0Ht7xSxqJ9M@7>Y>|WkD>z|dLgH*`dl3gQl;BEEMg|8)28Rxg z>ePXO91a~A{Y#t~JYsZqcyIW=-}k*&Z(O#N3;+dyE#-ZlIAknng2;;JUIiVCeD&~@ zPLMW2WF)s(94!U?r<+bD>YUIzsBR&|^WRQmsFdh|{S<5~LM&9Y}O+x6|h QEi>Em+iq(6f1Er6-}n7`a{vGU literal 595 zcmd6jKTpIk48`|;3QG((rMgzoa-GphEGHHw#E>R0M|7H^@zQkNXF`ZfcHPNo#3myWbivn@Oy^=*H%q$2=!T$hv>l#;yIPGEl+i<_ z4Qe?d7^!{$<;KG2hS=>^Da#%kA(2aO2zmUlCTaLMW5)6s!H03|!qz1Ycji_WMSHj} z%UTttlDdMdO{H`zXH~@e09H5+eTy&(_j6gp#K#ACuzvQA8+svnojW$JYsK|PDGbvF be`QMVJM`crlXX15Nc2CPDSqWlp6A&&<@TaB 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 527f7825b3eaf1653d73adf5c2d9ddc52c7ea3e9..36923733d1d0f303fa6512e9086ef7c7309191ee 100644 GIT binary patch literal 368 zcmX|-zfZzY5XY}qKo~T}#Qm8V!{fCSB#@XeU&X-Kb9kFb)d2_|Qa z(wSE(dTz(zluhpfblOgSxbAS=hvAy(e+-f-z?!Z@$MyOHm;Q&4+}ofnO9CV!9ehjx HGRpn}`#)|0 literal 951 zcmchUF>Avx5QTUDih~ZBY}|D7Tmpp>x?~C+Wa%l0*e6Aj-S*$tmR&Hk?vk_`q(k@a z-F@60?F=J7c`-bS`ZCM&JQGc`w+f-kh;lmPV+_V~Hms^CobF&dFR?QXUcBv%!YmZQ zLB@sDaD>-FehH)0D13rVC6pWvMzOebXxZT(~&aOuDj z`>w6whjf`r6m)ocgafOCvs}@Uw)C1(Cd{*kxoz~_=yfad)-`CsQAA@obtL*f{QEWh otLUS3&*;(2I5%E*a{ac*?HWn>w2)o{16snOmsdIV>qs*Ac4e$0V_CRVnX69&})JN7;11OCnJLcBZET+ zM|JAJKn{lvjQ%Cg41R>ja5p^f`#!l`t$y1yQUC$~_KdGZZ5UsTm zbL3OKyxuGv9wJ|9d#=QqD9Mxv&bfEd%^`6*J4*YJv$4a@P<;o$;G#Ym|%qtbjtxh?A-Z9y> z*C}3j#eyf>E~jnk7{HZ}vgi8!Uc2Sy{Edu=Pgx9r5G0a-)mRML((4Z-{UbtRe~Wf3 J0T3r0`~jF1a9;ob literal 761 zcmc&yv1-FG5Z(0^2OTomq!~SzK%s;#ok9lLdI}=4r0Qh1{rk$Y3x?vUfohPByZ7F4 z@AN=N<4|3r%#WgRFRH2%(%O?(;6@Ntbi>yaOy_2tYUXgh*$=V9(OA4jKN^JvC^?`@ zE2wb^QOoWJ(D|JBTp@P5h3aIF6_H3Gz$x~wm8#|sqf^dsL2Ki#h#_Y6nbJc0IQL+@ z4{#k$L*F9i^1e_MG(SHT$+zHLLuWeBrIZXWL-5i+#bMIAmj!*W=;4w~#=Fvy=pTG| m-16a1HY6WjFv2c#-SY$Fy%*JA8$E1IvawGsEko3GEyOoY2+cNibI2M_?Tt9{L5n~#-G@9-^2i>(%CSWlg0qLgP(YkrG5IwHF>rF|~P&Mr>yzG*?p0 zkWbX&YMroognX&2nG`FcR3=4;W~fB8?WoqXWTj|GGBy1RaC`?~(9P%!=Pds|?`WUZG?M&F1I_2I_rwNnKj`*+R>~Dk#~rXtqj7u9yi%du>Xh?m9fNIr zo#MGyEO>6);gr>n037$x^_`&SKeW1jE?Bn_3P4W+tWjzQu$o9f+x2>Vm;Q*5+S{Nl JO97A@;19}zaa{la literal 764 zcmc&yJ!``-5Z(1F4mxDANi%vbfkFvgI+YHJ^%O*8N!7`2`|m5uDj15V2C6|i?%sR% zr8_zrhvpJxeiTi6(KL;a)}FiqcY>&)E52r9K3C&Zx0uV#evCbi#^O2p$tYBy7g n{njA7EF6DHW&*e$=ny!j&gYo~{;RyH=OrDce=ZH4#-l4{Pu 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 43ededaf30de400d907f02df19537e9ff4ce3783..dad602b6f208f13817c9a1b9968359373b658a2b 100644 GIT binary patch literal 368 zcmX|-F;Buk7>2)o6oiEs6ZbPQhT~ca5=cxKu!0jNCM3=RZ4*oc0|r)dGBP+YGB|W_ zRHqIM&Ee32(O=@s;75oIcf<3(?~}{b>bFfT2_OLAK>G?Ko6nSpkZ)w>Ly4KnR!%R) z9L*{6Dcx#ywpQXt8Z(YB$L8N(^n$cJF4|8RcY!|Os4+;PVNB=dNVqckmcVeoLyn* z;Yk11jt^7Gg!WlYA;rIRpgHb(&urulhTVRTm2ySXaYroEXx!Z}uT&_vI_3O%$6&i& zr+DEN3!d9{IBk<@fX7z1mm6*+j{7turterh0a%U2pzV77flL2~5Kr&Wp2Y$5Fa{IU I0U7!J05&0R{{R30 literal 955 zcmchUK~KaW5QXpk6_a?_6HQ%jJ)2ET%*Kl+u2wPmjOoL zIP@p@lx}i~gbH`Ja4_=GS<})J?ddtEbST4z(l`2H^4bc$cO80|$fLF~{lVcBiYKR<4sZZr?Pa#G*+B9Iv85M#l6)ZJxvc{} zq(q-sUu`+xev|y&GY7V^FrWBPS`RjxNo(YpeKN<=nntwZ5C$ zshh@+ub$a+Gig`U9Hz4R8j!SVRVUf`YH>uX13dsJ0zC?puA0?uxzQEv>ebm@OX%ys z(REi`i1t4UgjPWLKmax2Hrqn|I*4!xVM1v2TlnQ6AUF%4M?p|ULr)v4BQ)R>q#%8~ literal 1398 zcmchX!E1vs6vprV6%TgsQl0JEi{~K}O6g%cjUA$SDWNgRlIYg|eo-?JhLp8+Ihded zKJxpXFAq>~iOJCrKT&A2C`pot2(ecbZ5{z6aKdx9=*Edlnh(q2X;ot?EV#gfQ7xw! zgv4sB+(^o$L&He*BdC;r@ikJ!ao8$JjiZeKar#&in%Ym!97SyhA>;ChMjLNDs7qwZ z4E7d38k808o4Q2fKWDu+MP|3ps8P~atz-^wuv)-o0c&{g1>6P-8xG)1(>dNNgIWu$ zQ99zdk^%RBgIG=laZ>_L=^eHx0@6K;?C-Ji8E9GjpUoD;W zHFf9fo9C`scAcKhD4RV3C>pkN?+k5E9}V?h*DiY7Lef0qG^JtDD+3UMR2r}@%g}S& f(b%CsRUm_q+S{q*`PEYZN-Tqq3SdV9U!qw*`GRxl literal 1188 zcmc(eu};G<5Qg_Wg(Ze8IE2zEBdRJPp^AkGF*xz>%Bo`<+X?XYIEgDof(+1Bc(70B z|L*kN*;iyMHR#^4cyQ8}8KpF1O6?4XuQEa?IpA|JhINpdSCcvI-gK_PRw_I>(@Tyd zWZt3)GpW=8PO#=EXiRi`%oKT^LN#kK3nU~jZa6G7_ta=wGhX<2DMIx5DMm=WhqEr$ zI0n`b#!a<6-a6<8yRNO_qM#fLaR~pg8S_3{qbu@4R@Y=rUdLPM6OT_BgX@NL=jujl z62)o6ex=^CQdFjF^1z>3KB?67_fp9Bqk)z{AinCA{c6LZ7L&!10#b& z2S;^cU}z494vhXK&J2DHk>PH5-uHcSxq9QaEhzvT0MgP|7@2G)c!X^0XFmj=iCp#U ziqBD>BAe1J*5@0+e|&9bQiTP`=fZe3StyK!uT4>V6UI_-BGvi}3w*vXS%g|-=9Z{$ zeZE3A7wemNVX`H%jWAX|-x4L6&jZv0!IyhSt&yWDO#_O_^dG=!2cSf6M#~G;!n?=R zYb@U%$=}lPVMa+wpS289{7VPg&jaU4o!Db{FdC}md`Y+LiJEOT?^>!;E>^nzO5vif zsk>gkbm^3ej@`2uZIu&%ykXgo_RwsiWD2mBNI=ha eMq``)RE9J{@?b|{&yxUhm;euDz>WkSY2Xhp$#ks% literal 1185 zcmc(ezfZ&<6vy}e6(kN_q}KDM&gK#my|_3T2M)em$WcI`RsVZwi%Aphpm!G;fV`i4 z-s4@6jWVEn&(a}CUl)|pf@!_A0--4gq2z#%;WDg)GNPHT(;jT+IW|h;(c4}LWJ4Al zc$}Fk6X7M}Uk2PJ!TZdjEVHX&EoP2{l+~4hgAsvRL)-MyD!eHflQ2w9Qkgxx^C`*X zxr4NRN)_<_yn%gH|zia 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 5844ed2c32e396173bcaf0325b703983948c8ef3..898b323f45903e3bd5c10f993e41d7bfa89fbd48 100644 GIT binary patch literal 424 zcmYk0ze@sP7{{M`Jo8*ag!T&}e0@((6NSRTE)@cUz-aczy%&b5oMN=e<>=7h=-_Ze zV>R92Ag>J$j{POg4!tHu!}AQE?+?ED!gX0v04M+iq>uU1AR|tfNY+l|jnfg2W{=M4 z7-K^uL-G0Ic*W_Lqm2w5D&?U>obS01r=oubus30>iu=(3Q=JdQCG;KX(zy81>j6}~Gl`SB zrfz-p)Txz9TC8RgkySzfas8p%XvMpm8k2RpiVUzJN*Lg>)nj+eE;V}0t~PI;I&7OM xHrv(SKkDBD%=vs!V^-T1o&Z8XhJYXZ`@h1D`vK&+4+ba$RwNimQ!zpU_yG)?e!2hv literal 1402 zcmchWF>Avx5QTUDih~YbV%JTR#d9$PLg>&=rGsLff`}}slI%ABzOt=?p@`5Vt_NAj z?;iT@{O+LQ60?IL{zaiHk}S&-BE(Knv}FR2!4XgWrhkrH(sJC6t5vP3vEl-sjp{hX zAS6~}?Iuz#9U4aJA3?4B!Pi8QrlC}l1}B98X@1}M>*e;7Ge=R|QOUSGpwY%VkMcb- zWk!FCA1%rncWtvr<3AUJIYnkSPpDDSSFL0TZ?Im#Y5_}l9|YV63>$9XOxru&stJu2 z*r0U8aU}!qKX>9G)`_cH;FR8ChaxcDa{T@52ispmUB*y~d0DQUVjSo(1~f0v<u oQXj%C_u(eu<)kC=Tm2P`5n;~2(dxh}+*xYxuO4yUDsUW9}JD>z|dLgH+%2_~WugDa_w3=WJ84jmlT zsRIK!ICNn2mpC){5u&TZIm7!t?~||9zUT@$00sbA;bW0lbi!Fe=sGOEaW>(l#^DK@ z5_wGM7=OMzT5Ni8;fh(R!j$$YvHzh?H2Rn8@pp z%?X|I<=JLo(U{N`SLPvGV~VnnMMRD`i~k(Wb_r3OMp&ciw}68y026N}-e@7JuOlj+ z661O=^(pM{=5rb0y_qLif8&GhV=s6RhyMMbciR_@vL<`}P%L&jm*-+&R7~47)v7Cr zTh7($fmR88$D_E-6##DRUcWrpNId^;fSCYbW0%eVY3``tySlD9PQ6xjHCr`pUDF)T Z(~q5+;rotV%@Rl#w&=fX8X$#g_yOL*dQ|`b literal 795 zcmd5)yH3O~5bX06D^XmPC?o;yQlpcQ(20f$QTQ=AS?Acsb^`o8c_BrDtGEIe_G&$| z-kJ3k?Ug}#^lUgJ^?8z}X~MKVScy<4L@Ax{IR@i8DI@DSocCZmFR)h{Pu})QVga(? zAmR$DOoVTk_y!0&BtBM%&1Rt*)?!5@YKPvk@UEID;lhM!lsUpXKUAHe5LH!jzS|a} zWce+t%92Z2-SO=Wz*#Y|0^T|pfkW4F_<@*DX^AF0+{3}hXJ<`KFI3R$bfv-~D=ZyF z-;D|`WlHNbTA0Y9vSxab=wCQre%K}qSiuPs6B1{oca1oR0fH+z85tZH85}w| zs#6CBayWEg^e=H{@QBgb;l1Je{d~Xg)#?{bEd@XTU`up literal 594 zcmd6jy>7!G6oq#`#g#f_!XlBSV$W5iEK!$CQ3nEt6vYM#IBnm){;TArojQ~OuHZZ8 zUd{vUtpmG8IUJhqykLwKvTcuEBQ*sPqZ>ZQVq7=tbTgOpo_rq__O``y^mnVVfHDQB zyh5$Zh(@Y!K>6X~V?}H>i`2;uD_?}+ d%A^Y|I=C#e^=|4&^gn{x{uIow$&_VTd;viIpt1k} 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 a9561fcf725d2213836793d0f20ab5230647d057..db076f86e69f651c79d76b99391c6b075cd8bd03 100644 GIT binary patch literal 408 zcmaiuJ5Rz;7>2(dxh}+*xYxuO4yUDsUW9}JD>z|dLgH+%2_~WugDa_w3=WJ84jmlT zsRIK!ICNn2mpC){5u&TZIm7!t?~||9zUT@$00sbA;bW0lbi!Fe=sGOEaW>(l#^DK@ z5_wGM7=OMzT5Ni8;fh(R!j$$YvHzh?H2Rn8@pp z%?X|I<=JLo(U{N`SLPvGV~VnnMMRD`i~k(Wb_r3OMp&ciw}68y026N}-e@7JuOlj+ z661O=^(pM{=5rb0y_qLif8&GhV=s6RhyMMbciR_@vL<`}P%L&jm*-+&R7~47)v7Cr zTh7($fmR88$D_E-6##DRUcWrpNId^;fSCYbW0%eVY3``tySlD9PQ6xjHCr`pUDF)T Z(~q5+;rotV%@Rl#w&=fX8X$#g_yOL*dQ|`b literal 795 zcmd5)yH3O~5bX06D^XmPC?o;yQlpcQ(20f$QTQ=AS?Acsb^`o8c_BrDtGEIe_G&$| z-kJ3k?Ug}#^lUgJ^?8z}X~MKVScy<4L@Ax{IR@i8DI@DSocCZmFR)h{Pu})QVga(? zAmR$DOoVTk_y!0&BtBM%&1Rt*)?!5@YKPvk@UEID;lhM!lsUpXKUAHe5LH!jzS|a} zWce+t%92Z2-SO=Wz*#Y|0^T|pfkW4F_<@*DX^AF0+{3}hXJ<`KFI3R$bfv-~D=ZyF z-;D|`WlHNbTA0Y9vSxab=wCQre%K}qSiuPs6B1{oca1oR0fH+z85tZH85}w| zs#6CBayWEg^e=H{@QBgb;l1Je{d~Xg)#?{bEd@XTU`up literal 594 zcmd6jy>7!G6oq#`#g#f_!XlBSV$W5iEK!$CQ3nEt6vYM#IBnm){;TArojQ~OuHZZ8 zUd{vUtpmG8IUJhqykLwKvTcuEBQ*sPqZ>ZQVq7=tbTgOpo_rq__O``y^mnVVfHDQB zyh5$Zh(@Y!K>6X~V?}H>i`2;uD_?}+ d%A^Y|I=C#e^=|4&^gn{x{uIow$&_VTd;viIpt1k} 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 c3f3e8151be883147b2f35c4650de0f0918294e3..c40809bb79d8266e4484b8af022a45baa7906730 100644 GIT binary patch literal 476 zcmYk0ze~eF9K~P0{gJwei0%G~J z>%2!+hge7b@@3&o^7p{(+A6|A;yszYwOJ&ycY)a~p|J%2i_l56KE8AN*|;H!~`#s-ePa=@($`7}!=flj}!D z?%rp{1{KbxPl|8Y8v0UYJSzrFL|QkGSyAZ0&YXJtm>&#KM{+q@s=wtT4SaG>pxogQD>~vz)rm_ zPDHa@Ym26HesFyuls^S*oj08JKR1yC6=N|}gx6@QjGlz9Lnr7d=y4<_zwsYW0P!dW bpW>in4ZijP^r1yK0(_)_Jzs?bcALv0&z!Tp@k z#wTwh7Fa0LE@APbLYd>dDi>({>$C}BSlH;Ez7{oA+p&!F2h9SH)GHyE_ z+kJ{NRh{=-)hM;V5~ZV#E7`0F@b@LT4VC1iDmbNQxJJ=oopUQZG&z4++YfQ1mjyY| z#Q@D+h~}~|#~;weZdV2&j_Y5z?*AZE ZJa2TM!H@nOStb;9d%4EPaV1F-eFIyd3^xD( 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 5dc734cb0e00071b37831a90b4f24165fef24d9b..d62a86322d3a5ac0afc532469138a45fbcfe5b80 100644 GIT binary patch literal 472 zcmYk0u}dRS5XQe9lWc56-J3PJ=y5lh$Xi$*jF*~R0!WlfpF zBBh1J7M5z2!eV(^q_Ff45$hDbH7Zxk49xHQzL~Z4?Hw%(Z~(e?9}jKTlYB^Q6y|Ov z@5%hiuT|bBt4pk_x_q2}mi#3&d$y9Wh|rR2#nNIH$Y++G4CbO!&0=`?Tfw|Iu^?RGA=n&Y93N&{NO}x(+>y^wb!A hur!d0ClF8ybf6*7UV&?9G4_D~Iba(L_}>HdWFBJBa{Hp(Ro|lD$*8!o+^^+%eR)PRO~B z8EyOqO_uff^^C=j5@m*qvRI<=ll?l(Ft@Wu)F|1DRx*WGn8YxSVGzSGh7r8gGHzQU z+y0C*Wwq|P>QQKc1xiO9SF+v_;4g}D8!F04b#O}0af6}-JLhqDsMq{u?jXd`zbwd! zJ_cy+LNu3!IsTH;-L4En9M|nifaX3#bFHq-yrI53&be>CR6K8WpfipR1?tkw}J0t?@`>!6qI}iI#fBgy>7b zri6~={AAVeXhP^h8dJfRs3J_TnCP)&$seQMEMgR^G1^G_HDLDwz`~yiAIwzqWkA(q z;#_U7e<(X!x$K7WR?iW%zi^=a(24HVet6gG+;ml^Wa~WatA$qU{8Wvcvg-$~X$6}4 zlMC!>WS67xl2hzv^8nX=r(5c+AUwS70c19S)YnWnJSe-4$+>IWerN@}Qstp#1(gbF OJ`bvy{Qq)z2EGBmzj>1Y literal 592 zcmd6jKTpFj5XJX=ijx>RIZ9I~Y38aDOU2R&F&N)VWi_#l?UeHEasD7>fr$YR_UZh4 z=jV4v2W=qEUZ#WTT4X|qOt$UOGD4jZ3A*5OD28>>hU=-E_F#LjaL_HDy}fG249ei3 z;sVts!Z%WV1InhxZ9%M7v((5A3n5XLyyf9TH<97ONHyA=;hj%YC-m`ty?rQ{x0{Vb zskquP%2HKT>Pc3+Q5Eps!zdj4?hQT(i?PjU!qXlOhEL9#nqKI2ywG9(RG9rl-w*!( dDw58%=wPCZ+M4l2qJNRg`lnoe4JOa?>ePXO91a~A{Y#t~JYsZqcyIWAKi}_r)!Jo4Ndr&-*jC=>iA%%ybL`HIp#qm1G8g)kt0Sa73q2N8D&^`Ui8!6QBtdH8=3=C+ zIGrIf5sUM6!X+^xOQFv=T}f4zaT*~l5;XqnsMK;2mC;Drvgy}=!)pLj{*3(L92+k~ zg3pkByTAFN9PDM%TgqD{gQWc>2O1CUu#X2px7Y66VLNYWelWnRBP@C}72cX0p! literal 594 zcmd6jKTpFj5XJX=ijx>RC5lr*n#`zDmx_f6F}U_~v6|Sf?G*U-BSIKHdG^ z+4t^fuMN_(=ffrGmM3YNCcJHrRw6VBQA!tlj>&i~+Q?>3=NN471@^kdleaf5v4A`{ zh`2(viSUYxZ$Q|g@UbE`n?-7Phn0}X#y9vZylWLDT$nJW%^BYLVeHI;75A*J*p^j! zURJ!W*-7kn+oC8{`Jlw43b^(#0>{2P!4JZGDodzvc!YzI&(4~LUg&jd=&)=RmJdbW gj|=>jC!K52!9*UlHPeek|HByelQF+KlVw@*1+Vv?6aWAK 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 9183a8ba33282953213470ea05e0ce6f04649ac5..0fbef28af95e2d036619182ac932f5f99771546a 100644 GIT binary patch literal 392 zcma)$zfZzI6vtmrL0E_}aj%In9M{sL{IE?Ju!0jNCM3>6@0wsD8X>rnlaaxJk-?#Z zqdIk9AcsQ-M*k9L29Fq>9o`$h-_Q5^UcGVA(oz5f0Cu$ZMeN~;Br(Ekk$sh9B6HQl z6Ea2S7~!$na(T3p9LDouDWrBpr3?+&FI%vRKq3jKwnc%J3e54D>jac`Y+B;3L#gXJ R+z*_ReasV?|8eRJd;_f2c#!}A literal 593 zcmd6jJ8#1v6oq&HiYs-zFOzUQx>X&lalOLnR(F}Nw{%#ajP^18v zH>hzLQ49G4NM9~KH^gqYN}aIS2#IW&txg|CXN8bvN*i}Y46(Q_sA~4Am8xqs=a&O- z(6yX*T??t(=J2?5O?V&SB+jF~AQmB?%@lMxJt4rUm*8DbuS9S2i%ILR(mGI%<7D+$ anbz|dV&W|Qia3Y?f-9+v3=WJ84jmlT zsRKjvaOlA3U*gQ*BScq+`)+d1@0|OZt;;JR4?qDRCw#<-MW&1fAWbcfkPzvNDbE&(nKBQg2}&ghA4-OMt>cRR*9oL8giRA{Tgt117Pw$qdSg8^>s|d zGpyb1r$2>*-9kPqyf+HS?QcGC_1N`?;>ha{y1jd`R@P+K8;Qks`}#ukYZas87;4p# z#4YD&rmt0e&vpsV=Jx=~N^f}U^~-}zkLx`QHo5@N;X9KBY@}4MJ>S+eU#}XbV|H9e iHFVup4b|6;6VF$T971Mii~h@I0Mc;^#+U{a`Hdf^OMChN literal 1010 zcmd6lO-sZu5Qgvl6#)-DwZ^towr5!oWbxujJfz8+HEf&2B(3`I?UzuHdf64sAsHs` z%;cHL71=9|)&A|xxDk3ByCwz{^xK2uoYBuNHo6d3URf9)odL^(3 znYZ9!B~?1WNyfhg+zgJ7l_HLpP|aGb0tt!JYZG4KQva@G5U_rhN~Mo*)(xp=eGOUX zxh%4B$9GI{S{6l3ODc=<7Lt}z0gty1n&Z&5HQW$LC%1s~_jj<+;>j9ak!O;Tm+4CR zh0QO|3a%S5F4dXVHfW&(3(DxJA|d~$JvUqJIjcLt*a!4z7TimI7dGYmG3IQGgZ?eZ RnbX~%$+u{Jg-O#i`T}%P38?@8 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 b21ca1bfe8e11b02a36e870fab3fe2dce24bc591..e64b80c08a11666407962925adc27e9522d94065 100644 GIT binary patch literal 408 zcmaiuzfZzI6vtmrew4)!6Ze`J!*MMwl-80kU|)%cB)1Ure320>Kd?Q?5U|c)|43^KGNz ztIC%1&01)dL)s0n=*oG3l78d$`lZ1}6VSVXECF~TOJ@Kzb_}o`@3`uFwrM(5$D!ETQbG+sXIXX5Rg8D2ws{JTQL+U3nBQOD3Di&4CPeces`=xU^S|n7nDU6y HG>yIhy&lwu 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 b0a83b5a9b5beaa0f5ebf0158e912ed39009452e..c49bc07e3e6eb0f49eba50005acfd0fca1a2e08a 100644 GIT binary patch literal 420 zcmaiuy-&hW6vb~Z--}Tb_nH{Pz|dV&W|Qia3Y?f-9+v3=WJ84jmlT zsRKjvaOlA3U*gQ*BScq+`)+d1@0|OZt;;JR4?qDRCw#<-MW&1fAWbcfkPzvNDbE&(nKBQg2}&ghA4-OMt>cRR*9oL8giRA{Tgt117Pw$qdSg8^>s|d zGpyb1r$2>*-9kPqyf+HS?QcGC_1N`?;>ha{y1jd`R@P+K8;Qks`}#ukYZas87;4p# z#4YD&rmt0e&vpsV=Jx=~N^f}U^~-}zkLx`QHo5@N;X9KBY@}4MJ>S+eU#}XbV|H9e iHFVup4b|6;6VF$T971Mii~h@I0Mc;^#+U{a`Hdf^OMChN literal 1010 zcmd6lO-sZu5Qgvl6#)-DwZ^towr5!oWbxujJfz8+HEf&2B(3`I?UzuHdf64sAsHs` z%;cHL71=9|)&A|xxDk3ByCwz{^xK2uoYBuNHo6d3URf9)odL^(3 znYZ9!B~?1WNyfhg+zgJ7l_HLpP|aGb0tt!JYZG4KQva@G5U_rhN~Mo*)(xp=eGOUX zxh%4B$9GI{S{6l3ODc=<7Lt}z0gty1n&Z&5HQW$LC%1s~_jj<+;>j9ak!O;Tm+4CR zh0QO|3a%S5F4dXVHfW&(3(DxJA|d~$JvUqJIjcLt*a!4z7TimI7dGYmG3IQGgZ?eZ RnbX~%$+u{Jg-O#i`T}%P38?@8 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 2f22faafc626f27f1bd7bda77f888e669ef8be68..dad97a138822e81bb9a521b469d19e6429107c65 100644 GIT binary patch literal 408 zcmaiuzfZzI7>2)|{9K4Jaj%In9M{s8+NucyR&c_^gv8m>_7Y4)BLr7c85tZH85}w| zs#6CBayWEg^e=H{@FPT5hr8i@pZCdEZ(O#d8~_7=tn@KY96A;(A#@cM-vk?rQg#27 zO^7-obcDZH94rO<3YD>g2#pAv2<_RSbD>Q`Wki%0p~Zq>QmsGHC}dNICPYb`QcToU z$Yz92#NvFtaA-{EQfRY~tuRGd$ReUfg2jK1TBC$0P9v<*^jpB*HGqvb6Ms0D_17Vl z&xm!illqi)xAVD-^j^yotiSO=>#@W8@*sHVb?&;dRW?;W7|6wD^Xfw8mSMY|tyern z-f*6I!cBt*ZJ**cR{*$mJKb_`E%Af<9%d4Ni(NVcq_(94uNXEzwDii6YjW3abJI6$ Y&uHtG?;oQmOCVj?p#QRIfE23X2h>q|R{#J2 literal 795 zcmd5)!Ait15WV*+20ZMkrR}<_^ehX4EM7c`hctOv!lp?~(yD)Nn^q`@2XPPPkPMUe zX6C)*iVn&kKY2DDf`&57^E_i(AFV)WGNPQ$_?Uueos|*I9L{^Nz2`V6jYn?>C9nWl zaNuzTRVKnq#=ijEj*0gbVzXJOhILpGiMnyNBD^UX1zbodsmux9`LXH@m36h3*SoU5 zVOz=et=x)g&#SiF32`gYCRV^}55sZnyB2;VmMJYD!~Go`jCgX^H1te0y`(D@7Fl7L zDEfXre%K}qSiuPs6B1{oca1oR0fH+z85tZH85}w| zs#6CBayWEg^e=H{@QBgb;l1Je{d~Xg)#?{bEd@XTU`up literal 596 zcmd6jy>7!G6oq%5;z}JdVUfsEvF9pMm#9mpssn*Tiedu=oVIUY|5fr_btnT|!FSHR zoI5%?4}M8%JPh3g+qDq%^9qq$`QJ3 zQ0EJhRr&|eVZ8X<5WC$f^{U54NEFH&Qk6fPEe0{qn05Yw6w_$Cu%_M{sZArT5a)xa z(MTbhMnYRzAMTg78SewU#%bu!NTX29W(GDtJ|M!I=NNoTFGR2Ni_7b`@;XsT!({bW aq4cps4_{Pq!OtCu{zo$VUnNsj6=UC3ETG%~ 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 2f22faafc626f27f1bd7bda77f888e669ef8be68..dad97a138822e81bb9a521b469d19e6429107c65 100644 GIT binary patch literal 408 zcmaiuzfZzI7>2)|{9K4Jaj%In9M{s8+NucyR&c_^gv8m>_7Y4)BLr7c85tZH85}w| zs#6CBayWEg^e=H{@FPT5hr8i@pZCdEZ(O#d8~_7=tn@KY96A;(A#@cM-vk?rQg#27 zO^7-obcDZH94rO<3YD>g2#pAv2<_RSbD>Q`Wki%0p~Zq>QmsGHC}dNICPYb`QcToU z$Yz92#NvFtaA-{EQfRY~tuRGd$ReUfg2jK1TBC$0P9v<*^jpB*HGqvb6Ms0D_17Vl z&xm!illqi)xAVD-^j^yotiSO=>#@W8@*sHVb?&;dRW?;W7|6wD^Xfw8mSMY|tyern z-f*6I!cBt*ZJ**cR{*$mJKb_`E%Af<9%d4Ni(NVcq_(94uNXEzwDii6YjW3abJI6$ Y&uHtG?;oQmOCVj?p#QRIfE23X2h>q|R{#J2 literal 795 zcmd5)!Ait15WV*+20ZMkrR}<_^ehX4EM7c`hctOv!lp?~(yD)Nn^q`@2XPPPkPMUe zX6C)*iVn&kKY2DDf`&57^E_i(AFV)WGNPQ$_?Uueos|*I9L{^Nz2`V6jYn?>C9nWl zaNuzTRVKnq#=ijEj*0gbVzXJOhILpGiMnyNBD^UX1zbodsmux9`LXH@m36h3*SoU5 zVOz=et=x)g&#SiF32`gYCRV^}55sZnyB2;VmMJYD!~Go`jCgX^H1te0y`(D@7Fl7L zDEfXD6r@PvfK^CLFfqY6TiREHF=~MLv60Hi;K0b> z(7{oi7#PUYfx*$g#F@cMh{ny~-r=0{JNNFD4{M4FzyTnlypAUp>q$OAHudArlJ{g{ zdwqxZG1*1dr7hn!J|zG2^`1o$79j7-^n=C5GClD1F6xgmJ(Qf3?Y(;z_(OGrFCz zmU-$hZ5Q)rE1`E~H5OGDm6uW!$^N2&+D*f2YuBRLYFu7u`BX0Hifb)itsWm}UfwWm z$IN6MU7P2eT+z!Jo~XNwSak{DHr1LnxZssdoo^cdYgzqH%cMq4!P^P{^fp{@Yz zU$n)kX#P0Z;6Eysnmg-K=vbGCQj^66un;CsJ2&T;*yPSQqXiH zhM4E;=~GcmST4rM$Al9xW_*oxm#5E)G^15juF1v5K|Re$_{B3>()`UDJ%e``^`Yp) z5I$;w^evfhe=4}@2yrW4N~@?O9WY3v>n{TQzd3oAIaj$7j9t=>REv4bL(;LyMHk25 zz93ibY6s0@7tMWPE|2b984ODqqmSzKV4Lv&O5*UZSOS$lpTRqxwnelg-a%){MwgLg HS(bbQAVYY4 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 f5b2d6b0dd35ceff4cd5eecd5498947bae8cfb3c..4553fd0ac029f08b172bf14cdf3f11e983cfee31 100644 GIT binary patch literal 392 zcma)$zfZzY5XY}iL0E_}aj%InJYGwG*{TTxR&c_^gv8m>_9d8z#u{8nWn^$*WN_%< zs7@Ui$itxnqkoArgGY?c4tK-%$LFrmJa0<{00saX()%oP=}54Q&}CeH6>KCbwcTSj zChCyTA#O3>TL|_UD*j%HanI>+D=-}2=;(G3 N93miB`d<#uz&FfidDj2{ literal 592 zcmd6jy-ve06ovOZ#g!O3IZ9d@P-aw#rDExX7##b!vKs$jJ1x9Di4&wOFfri4zPkR- z_3^o*gSKGjz{f+z|dLgFm6eGvySl;BD#BZC7YgF^>L zb?U%C9u6HC{Y#t~JYsZqxEsDdK6lmHWkbpVFaX$)-e;*xM}nnrijx>RB}!TvP-aw#rD9=1436))wVK$*b_)D^5+_JmU}C_-`E>Wa zv+v!|K^x>JFUE`MT4s5kXQJzlmJynaD5ncPr(`-8ZMd1!IR-m;iG%L&+yH=6mLc)|bCwS+_u`{c-RjqFK<@QeO zl&D*^qDO0CK61I5F{*k_6#(P<*3gN=xay2VwNH# zt^=|_ct)4!8;6M_gjZBr1Z2&oEG!@)5<^O&zl=t^#874pnaq-Y1t?qr80==`j$>Ya z9b^6sY1aokpQ)q$JeN(qH}Z(d->jhf*!Lg!k#|4r-wt@KtctET;)|V5?}GO=MYkMX zt~dg}{1HEi3j lRBIKbrW%T+8;++KhHc~!WcIe`zig%e5T{`r90Krc{|~gzds_ei literal 1006 zcmc&y%WA_g5WM><1U=+r<5v>lTcHGc3B9zJ(t|9mgNU_KB{^;XzJ91+2rhl3R0nBU z&8&7-b47L%AwF2vAA+3HD30TZwe4ODa8*P|Opfq21j9N?6x9??yVITJu#+v^S$&cM z0+2Za+|QsAJ=liv4*=JF;&p~ttpXL9f*FyJ>%_gt#tSfRgftQlV2$ldPPk3FuIaig z1g+~PFSmKNEojCzltV^oO-Gi4=MIp=zEd^Wo|ukl0gb!80Rt%RjmC;RlAJt^SJDMd zF0|uqH?)7Li73;80`$yFjpK`i{Qp?8rLp{KDyWr2)&`Z|cSosugJ$d@6gcxpaL?H% Z=SynRKb7;Pul=c}VoB4dl9D8e-T?gahLo^Px%P+ypG*wAMAFho zg($uD$qeB!U7T+m1`ZKk(d^78Yqn)!J_%4dpd|dssMJ#oW!8YnEa_W-L>s_hHzQ{- z7v<*x7SE7+br^l;jt}C(4)~VT^IXfp%q#2ySef1?!EtYUAh5qGT$`P4&T9S6=AYSZ@jHMj5gD|S ztJ|_(l1;0aR}{yy99>hLl3h^Lf}AhL5X5-k_qR0s&qskz0L&vW@Q(o6)jfcz$PQxl E1r`H>{Qv*} literal 1424 zcmc(eyK2KQ6oz*{#eoi4YUB8l*q%$EOX$)rrGqRT2NCO1$xhq1uP-VXLP(t^RD&d> z|491I`E>^yF45l^(hUp_q38R)N9ua37}~-E@L`W%{iJVuE?F^7$KI;eP~7kupNu+i zhE7PVM%qlITsCMbLVpBQbqk*p#bV(?B@s9Y1SkXh!K;R$wu7YNa)(Bn?#NNM$}p#4 zo`s}bM{&%mlI5$EWi*M?B#hQWl*RWJCBl#_YlF` zu*FJ$Kcz(~!6m63=6r`FqBH5Td~pXH z`NTQssL;_VobaYNzpCw}Oz|nEnx#Ds*I{!B0tjTl@>Wn^$*WN_%< zs7?$F&BK9#(Z9r*!AFQXI^5-Q-_Q4(%hl?aO^yd30FdO~qlJk_lq?Wl1({b$Ml@SK zs**91h6oQ?r}N__C7*#fG8uwHM8;HpGI2!ZNgxi9_)O&~C2Ui!J>oDR6B93xxG=L* zB&`B6LwHQ*=WBJ)*57Qm5?g>OF$D}yQ*B3a w4ZmcouC3}NwP1Kf-E&S#mR7QoaY!Oa>~3iImrtYtq8JQ<1AumQhg}5l4Fht3dH?_b literal 1216 zcmc(eJx{|h5Qg{s3QG)KNR%dNLo%aEEENkZh{3VXl~sRXI|cqd`7lzXDuMtN9_*9- z-r3LH`3mj0g7{!@w@`FSqd1NuEW}<@aCL-GjE?Z$8~r$PMeETVXQx|BV8;dATYcgb zf)G0c#80GLd9VzVPXW>0#@j@(S_M~yB}^O{y6Uwepfu4s` z?gEwzFY>nS3H~Z6(g={CJoa3x;l>X4-!rqG%gnE`qO{}+i$J-&K?>RR=$br+0B3Cy q8tAOf*&I!JQJim;_NPqw9MeUSzWTx=O|!T{#ZnrEg@Y(blIR0oU_I^t diff --git a/test/Driver/PrivateDependencies/Inputs/private-after-fine/d.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after-fine/d.swiftdeps index 93de7a407514b9bf290fe7b55739e645ee530b6c..7866ec7f6385b8d920c87a19518fa72d0c47ab0c 100644 GIT binary patch literal 408 zcmaiwzfZzI9L2AvK#7SlChjFMhT~dVC~a-RfEAoDF(GlbKNCzuBL-J;GBP+YGB|W_ zRHqIM;pLvqR=woicfZP-(4}2U2U$7=5$U8#cG~{?`a=an=nz_{2I)Ax zce;CecW_XI>B+O<5OB$pG))tx_0b9pO#+a@89&EhTxUh1nZtPxw)Y$lO5>xq7bP$P zS#Zd^1yoUoUNZg-;C4uSED)MJM#m4<%<@joY&2xu|8; zmZB|pRaw-y*&)BL*tTL5E8ts?#PQgh7X3iXr?fyB9`@*v#FMkszzY=cI$fy{X9}^M z&i7;cf2D|V8Vyp%I%R2k5#ax2S^p%a#=UT%AVp2+J>AO*jRm-h3i)M5hi(v79=k z1S_kE&M=wq#o0RHkOY$@S7#AjfeK|2jj~FZJ^Vkg^qyf9{cW--=QP!1!4WwebeR(d0M#Xe} zQ>*&2wBdZ+4)sdNynsMf+(C$y`|E~)-Sv?Oe^tA2yS++qnaLvD*wT>A4Bhj!zz!`> f4?Nwp^s3EjCi9Oi*Rb3iMw#6W`Y)R)z)(0pH9C6} literal 795 zcmc&yJ!``-6x{tQ1RXNjICc`(oY5VW%4;2idLujEIq{q|U z(|f18BL``ao;)26PA++prfEWzI$Dm!jwq?t5UW=+N zd0XzPvZ%4yf!$YhThWOX@YcgH9DCiu55#;*bBOS;hlAly&YFh2kb=BUS2DzzLTsn= z{n-9rDWaW%hUsW0t(jgVnf65Vt4$;GYH L2&w{-EX$HFGr-cf diff --git a/test/Driver/PrivateDependencies/Inputs/private-after-fine/f.swiftdeps b/test/Driver/PrivateDependencies/Inputs/private-after-fine/f.swiftdeps index 993aae48b3a01fa996bdc97a56af898ba57dbd8d..24bed2a42a7facf0b13e4fa364b53fb46d084896 100644 GIT binary patch literal 436 zcmaiwu}{K46vkf1b6M*k9L29FSR^djii%Z4BV5CDh^??GtcF(VmJy|$lxv3|Qko?SYGe-EPRDHz0N2V4IksMm- z8Op3YGDmpA7Uye+g=YvaS#Iu;72onOkN7C#Gcx)T-fjNPv>Dq1RE{WMQcdmH wietJ)M|C=?Zm0#57IkW$7;VjH#}UMKH|YOt6kk literal 1214 zcmc(eJx{|h5Qg{sijx>RB}$XDp_x%7mWl-y#NgPkE31he?4-cICm%+tR8>$)g$LU@ zzh~cbcfO&u(g?Sf^^2f=9E4#Qu&UY^0apY>A?@%nY=*H@S`^cEnw{w^$68f*ux76W zypXvDygiUA-NH)7zXaU$hW7)-Z021xt8w5+BqR5xWGm3PQ6iPz!ZxIUBtkUOQ-xO;?w&y<0()rsQQjQO+Yd zA5Ck!A^N{cNZnMZp*Lm7_}|2LyjPcxKRJtniH9|4kWfKzrevPOX* zzl^YOhSaP5=m&SWm*BU!w@Lyr`HK}aA9~KcFtqOmy_>$EW|fR(4~0~t(Yg>EHCODI zMLBPZ!iF=IlB47t+psY6^4kF2>|mW>*|!7W*{=%MonAlJZT-zoE4Brw5|N=~tBPUD xR>{!}#WIwlrsPX@p=g^YT1VA7@hHR*#CA6{{L9CZ06_#s?g2o%y2CC4_y!45fQA47 literal 1216 zcmc(eJx{|h5Qg{sijx?+kSI;khGa&SSSl7+5QAf%BddvRY^T7#Cm%+NR7Fsr!h?OX z-#h!cJ72+0NDOO3`h~$U4#F@DNYm^ULt6#_Asq01Fotmul9iJ=%~o}W;!ZSpZ`4sR z^g?1aQa6(d>CkXOKLu3v8*ekkYUN!eX>sNVP)GJvaK}*FQNo3+(P-0$oOA_l(u&5c z;CYp@D&6L3Qed`4dXtk)PDU?_FC9vX`>w6f^p5ek&5+x>Thu7ogI2PHCrGX#gXi&7 zSdV4>i=62Og1<^is~c=lI^u+qih>V`v_1j= 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/chained-additional-kinds-fine.swift b/test/Driver/PrivateDependencies/chained-additional-kinds-fine.swift index 08a90d1620637..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -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: cd %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 b3d0718b7908b..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 48e95a4f3bf4c..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -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: cd %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 -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: cd %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 -enable-direct-intramodule-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 fda6851f03bfd..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 9bcd64b9cc265..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 57664db3e39c1..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 faa7a286871fc..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 cd0722ac7e532..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -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 +// RUN: cd %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 0b47de5f57305..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 e2cd57610f593..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -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 +// 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 -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 +// RUN: cd %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 -enable-direct-intramodule-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 d3061b7f86411..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 2a365335f2c40..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 -enable-direct-intramodule-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 96dfb68034de2..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -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 +// 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 cdc301d4e608e..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 508d9b6a70bce..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 fbaa9edce8cc8..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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 8ca6af2cea4c0..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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/fail-added-fine.swift b/test/Driver/PrivateDependencies/fail-added-fine.swift index 1713e01d2791c..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 c18d9a3cfa478..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 -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: cd %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 -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: 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 -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: cd %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 -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: cd %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 -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: 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 -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: cd %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 -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: cd %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 -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: 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 -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: cd %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 30d4bf3a2dd39..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 -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 +// RUN: cd %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 -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: 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 -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 +// RUN: cd %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 2e693d89656da..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 4d18a57665af2..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 6829308e1d3d1..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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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: 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 -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 +// RUN: cd %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 5267332ab1c04..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 9ac0c744aa73c..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 08cec4506b45a..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 84733cd3f5bc3..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 890d85f72bcc9..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 a0b730c410773..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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/mutual-fine.swift b/test/Driver/PrivateDependencies/mutual-fine.swift index 89156276c2fcf..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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 cd7914f87ba99..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 -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 +// RUN: cd %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 16410e8602231..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 -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 +// RUN: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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 +// RUN: cd %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 2596b1ee6ebec..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 572210af5073b..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 3d9a16768e551..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 1188e0b294ede..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 7e05e56c54c1b..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 -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 +// 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 -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 +// 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 a5c9b0b273086..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 92267a0c0e6a2..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 5fb57ed44f2f8..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 bf1b48d0d3b5d..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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 -enable-direct-intramodule-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 50b7968d64351..2b7d04de643aa 100644 --- a/test/Driver/PrivateDependencies/one-way-while-editing-fine.swift +++ b/test/Driver/PrivateDependencies/one-way-while-editing-fine.swift @@ -12,7 +12,7 @@ // 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 -enable-direct-intramodule-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 @@ -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 -enable-direct-intramodule-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/private-after-fine.swift b/test/Driver/PrivateDependencies/private-after-fine.swift index d453f717bfa7d..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 -enable-direct-intramodule-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 -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 +// RUN: cd %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 -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: cd %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 -enable-direct-intramodule-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 -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: cd %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 94fde640767b4..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 -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 +// RUN: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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 -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: cd %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/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/Incremental/Dependencies/private-function-fine.swift b/test/Incremental/Dependencies/private-function-fine.swift index 831a3868a4e77..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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 fbca3430d4c40..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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 7abe04b7e016f..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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 de059f9804dda..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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 e113b15c108b6..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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 20957a091b653..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 -disable-direct-intramodule-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 -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 -disable-direct-intramodule-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 -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 0f9157953cea9..d5d0901800d2b 100644 --- a/test/Incremental/Dependencies/private-var-fine.swift +++ b/test/Incremental/Dependencies/private-var-fine.swift @@ -4,7 +4,7 @@ // 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 diff --git a/test/Incremental/Dependencies/reference-dependencies-dynamic-lookup-fine.swift b/test/Incremental/Dependencies/reference-dependencies-dynamic-lookup-fine.swift index 861863d686a3d..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 -disable-direct-intramodule-dependencies -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 -disable-direct-intramodule-dependencies -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-fine.swift b/test/Incremental/Dependencies/reference-dependencies-fine.swift index ea311fffc8572..81de9852e34d9 100644 --- a/test/Incremental/Dependencies/reference-dependencies-fine.swift +++ b/test/Incremental/Dependencies/reference-dependencies-fine.swift @@ -11,8 +11,8 @@ // 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 71de041cdc29a..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 -disable-direct-intramodule-dependencies -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 -disable-direct-intramodule-dependencies -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 8df8fc0b6a231..701993af63a37 100644 --- a/test/Incremental/PrivateDependencies/private-function-fine.swift +++ b/test/Incremental/PrivateDependencies/private-function-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 -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 -enable-direct-intramodule-dependencies | %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 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 1edb3b055c2b4..b519f71d2972b 100644 --- a/test/Incremental/PrivateDependencies/private-function-return-type-fine.swift +++ b/test/Incremental/PrivateDependencies/private-function-return-type-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 -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 -enable-direct-intramodule-dependencies | %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 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 3e48ce8cde141..5a8ad95c8ea38 100644 --- a/test/Incremental/PrivateDependencies/private-protocol-conformer-ext-fine.swift +++ b/test/Incremental/PrivateDependencies/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 -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 -enable-direct-intramodule-dependencies | %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/PrivateDependencies/private-protocol-conformer-fine.swift b/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift index f30c6ef106be1..7b417286438a3 100644 --- a/test/Incremental/PrivateDependencies/private-protocol-conformer-fine.swift +++ b/test/Incremental/PrivateDependencies/private-protocol-conformer-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 -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 -enable-direct-intramodule-dependencies | %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 : InterestingProto {} diff --git a/test/Incremental/PrivateDependencies/private-struct-member-fine.swift b/test/Incremental/PrivateDependencies/private-struct-member-fine.swift index e231a68dfdae5..0f29734faa0a5 100644 --- a/test/Incremental/PrivateDependencies/private-struct-member-fine.swift +++ b/test/Incremental/PrivateDependencies/private-struct-member-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 -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 -enable-direct-intramodule-dependencies | %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 Wrapper { diff --git a/test/Incremental/PrivateDependencies/private-subscript-fine.swift b/test/Incremental/PrivateDependencies/private-subscript-fine.swift index 2d12a7972e690..d33ec6232d1e1 100644 --- a/test/Incremental/PrivateDependencies/private-subscript-fine.swift +++ b/test/Incremental/PrivateDependencies/private-subscript-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 -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 -enable-direct-intramodule-dependencies | %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 struct Wrapper { diff --git a/test/Incremental/PrivateDependencies/private-typealias-fine.swift b/test/Incremental/PrivateDependencies/private-typealias-fine.swift index a24e27cce8305..20cabd8eb0464 100644 --- a/test/Incremental/PrivateDependencies/private-typealias-fine.swift +++ b/test/Incremental/PrivateDependencies/private-typealias-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 -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 -enable-direct-intramodule-dependencies | %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 Wrapper { diff --git a/test/Incremental/PrivateDependencies/private-var-fine.swift b/test/Incremental/PrivateDependencies/private-var-fine.swift index 704b195a14cc3..3a849b4c1267a 100644 --- a/test/Incremental/PrivateDependencies/private-var-fine.swift +++ b/test/Incremental/PrivateDependencies/private-var-fine.swift @@ -4,7 +4,7 @@ // 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 diff --git a/test/Incremental/PrivateDependencies/reference-dependencies-dynamic-lookup-fine.swift b/test/Incremental/PrivateDependencies/reference-dependencies-dynamic-lookup-fine.swift index 2da5c38919347..c4c42c752ecf7 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-dynamic-lookup-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-dynamic-lookup-fine.swift @@ -8,8 +8,8 @@ // 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 - -enable-direct-intramodule-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: %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-fine.swift b/test/Incremental/PrivateDependencies/reference-dependencies-fine.swift index 99a8fbd2e4ff9..eb05e967c9c4f 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-fine.swift @@ -11,8 +11,8 @@ // 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 554694628e3b3..84e8f31141749 100644 --- a/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift +++ b/test/Incremental/PrivateDependencies/reference-dependencies-members-fine.swift @@ -9,8 +9,8 @@ // 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 - -enable-direct-intramodule-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: %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/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/lit.cfg b/test/lit.cfg index 06db7787248a2..81c20d27225ad 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -247,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') @@ -398,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) ) From 53931c06a6a806812cfccd53e37076ecb01c8b34 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 10 Jun 2020 15:35:37 -0400 Subject: [PATCH 220/222] Dependencies: Remove apparently-unused test inputs --- .../chained-additional-kinds/main.swift | 3 -- .../chained-additional-kinds/other.swift | 2 -- .../chained-additional-kinds/output.json | 17 ---------- .../yet-another.swift | 2 -- .../Inputs/chained-after/main.swift | 3 -- .../Inputs/chained-after/main.swiftdeps | 2 -- .../Inputs/chained-after/other.swift | 2 -- .../Inputs/chained-after/other.swiftdeps | 2 -- .../Inputs/chained-after/output.json | 17 ---------- .../Inputs/chained-after/yet-another.swift | 2 -- .../chained-after/yet-another.swiftdeps | 2 -- .../main.swift | 4 --- .../main.swiftdeps | 4 --- .../other.swift | 2 -- .../other.swiftdeps | 2 -- .../output.json | 17 ---------- .../yet-another.swift | 2 -- .../yet-another.swiftdeps | 2 -- .../chained-private-after-multiple/main.swift | 3 -- .../main.swiftdeps | 3 -- .../other.swift | 2 -- .../other.swiftdeps | 2 -- .../output.json | 17 ---------- .../yet-another.swift | 2 -- .../yet-another.swiftdeps | 2 -- .../Inputs/chained-private-after/main.swift | 3 -- .../chained-private-after/main.swiftdeps | 3 -- .../Inputs/chained-private-after/other.swift | 2 -- .../chained-private-after/other.swiftdeps | 2 -- .../Inputs/chained-private-after/output.json | 17 ---------- .../chained-private-after/yet-another.swift | 2 -- .../yet-another.swiftdeps | 2 -- .../Inputs/chained-private/main.swift | 3 -- .../Inputs/chained-private/other.swift | 2 -- .../Inputs/chained-private/output.json | 17 ---------- .../Inputs/chained-private/yet-another.swift | 2 -- .../Inputs/crash-simple/crash.swift | 2 -- .../Inputs/crash-simple/main.swift | 2 -- .../Inputs/crash-simple/other.swift | 2 -- .../Inputs/crash-simple/output.json | 17 ---------- .../Dependencies/Inputs/fail-chained/a.swift | 2 -- .../Dependencies/Inputs/fail-chained/b.swift | 2 -- .../Inputs/fail-chained/bad.swift | 3 -- .../Dependencies/Inputs/fail-chained/c.swift | 3 -- .../Dependencies/Inputs/fail-chained/d.swift | 3 -- .../Dependencies/Inputs/fail-chained/e.swift | 3 -- .../Dependencies/Inputs/fail-chained/f.swift | 3 -- .../Inputs/fail-chained/output.json | 33 ------------------- .../Inputs/fail-interface-hash/bad.swift | 3 -- .../Inputs/fail-interface-hash/bad.swiftdeps | 3 -- .../fail-interface-hash/depends-on-bad.swift | 3 -- .../depends-on-bad.swiftdeps | 3 -- .../fail-interface-hash/depends-on-main.swift | 3 -- .../depends-on-main.swiftdeps | 3 -- .../Inputs/fail-interface-hash/main.swift | 3 -- .../Inputs/fail-interface-hash/main.swiftdeps | 3 -- .../Inputs/fail-interface-hash/output.json | 21 ------------ .../Dependencies/Inputs/fail-simple/bad.swift | 2 -- .../Inputs/fail-simple/main.swift | 2 -- .../Inputs/fail-simple/other.swift | 2 -- .../Inputs/fail-simple/output.json | 17 ---------- .../Inputs/fail-with-bad-deps/bad.swift | 4 --- .../Inputs/fail-with-bad-deps/bad.swiftdeps | 3 -- .../fail-with-bad-deps/depends-on-bad.swift | 3 -- .../depends-on-bad.swiftdeps | 3 -- .../fail-with-bad-deps/depends-on-main.swift | 3 -- .../depends-on-main.swiftdeps | 3 -- .../Inputs/fail-with-bad-deps/main.swift | 3 -- .../Inputs/fail-with-bad-deps/main.swiftdeps | 3 -- .../Inputs/fail-with-bad-deps/output.json | 21 ------------ .../Inputs/independent/main.swift | 1 - .../Inputs/independent/other.swift | 1 - .../Inputs/independent/output.json | 13 -------- .../Inputs/malformed-after/main.swift | 2 -- .../Inputs/malformed-after/main.swiftdeps | 2 -- .../Inputs/malformed-after/other.swift | 2 -- .../Inputs/malformed-after/other.swiftdeps | 1 - .../Inputs/malformed-after/output.json | 13 -------- .../malformed-but-valid-yaml/main.swift | 2 -- .../malformed-but-valid-yaml/main.swiftdeps | 2 -- .../malformed-but-valid-yaml/other.swift | 2 -- .../malformed-but-valid-yaml/other.swiftdeps | 1 - .../malformed-but-valid-yaml/output.json | 13 -------- .../mutual-interface-hash/does-change.swift | 4 --- .../does-change.swiftdeps | 4 --- .../does-not-change.swift | 4 --- .../does-not-change.swiftdeps | 4 --- .../Inputs/mutual-interface-hash/output.json | 13 -------- .../Inputs/mutual-with-swiftdeps/main.swift | 3 -- .../mutual-with-swiftdeps/main.swiftdeps | 0 .../Inputs/mutual-with-swiftdeps/other.swift | 3 -- .../mutual-with-swiftdeps/other.swiftdeps | 0 .../Inputs/mutual-with-swiftdeps/output.json | 13 -------- .../Dependencies/Inputs/mutual/main.swift | 3 -- .../Dependencies/Inputs/mutual/other.swift | 3 -- .../Dependencies/Inputs/mutual/output.json | 13 -------- .../Inputs/nominal-members/a-ext.swift | 2 -- .../Inputs/nominal-members/a.swift | 3 -- .../nominal-members/depends-on-a-ext.swift | 3 -- .../nominal-members/depends-on-a-foo.swift | 3 -- .../Inputs/nominal-members/output.json | 21 ------------ .../Inputs/one-way-depends-after/main.swift | 2 -- .../one-way-depends-after/main.swiftdeps | 1 - .../Inputs/one-way-depends-after/other.swift | 2 -- .../one-way-depends-after/other.swiftdeps | 2 -- .../Inputs/one-way-depends-after/output.json | 13 -------- .../Inputs/one-way-depends-before/main.swift | 1 - .../one-way-depends-before/main.swiftdeps | 2 -- .../Inputs/one-way-depends-before/other.swift | 2 -- .../one-way-depends-before/other.swiftdeps | 2 -- .../Inputs/one-way-depends-before/output.json | 13 -------- .../Inputs/one-way-external/main.swift | 3 -- .../Inputs/one-way-external/main1-external | 0 .../Inputs/one-way-external/main2-external | 0 .../Inputs/one-way-external/other.swift | 3 -- .../Inputs/one-way-external/other1-external | 0 .../Inputs/one-way-external/other2-external | 0 .../Inputs/one-way-external/output.json | 13 -------- .../Inputs/one-way-provides-after/main.swift | 2 -- .../one-way-provides-after/main.swiftdeps | 2 -- .../Inputs/one-way-provides-after/other.swift | 2 -- .../one-way-provides-after/other.swiftdeps | 1 - .../Inputs/one-way-provides-after/output.json | 13 -------- .../Inputs/one-way-provides-before/main.swift | 2 -- .../one-way-provides-before/main.swiftdeps | 2 -- .../one-way-provides-before/other.swift | 1 - .../one-way-provides-before/other.swiftdeps | 2 -- .../one-way-provides-before/output.json | 13 -------- .../Inputs/one-way-with-swiftdeps/main.swift | 2 -- .../one-way-with-swiftdeps/main.swiftdeps | 0 .../Inputs/one-way-with-swiftdeps/other.swift | 2 -- .../one-way-with-swiftdeps/other.swiftdeps | 0 .../Inputs/one-way-with-swiftdeps/output.json | 17 ---------- .../Dependencies/Inputs/private-after/a.swift | 2 -- .../Inputs/private-after/a.swiftdeps | 2 -- .../Dependencies/Inputs/private-after/b.swift | 3 -- .../Inputs/private-after/b.swiftdeps | 3 -- .../Dependencies/Inputs/private-after/c.swift | 3 -- .../Inputs/private-after/c.swiftdeps | 3 -- .../Dependencies/Inputs/private-after/d.swift | 3 -- .../Inputs/private-after/d.swiftdeps | 3 -- .../Dependencies/Inputs/private-after/e.swift | 3 -- .../Inputs/private-after/e.swiftdeps | 3 -- .../Dependencies/Inputs/private-after/f.swift | 3 -- .../Inputs/private-after/f.swiftdeps | 3 -- .../Dependencies/Inputs/private-after/g.swift | 3 -- .../Inputs/private-after/g.swiftdeps | 3 -- .../Inputs/private-after/output.json | 33 ------------------- .../chained-additional-kinds/main.swift | 3 -- .../chained-additional-kinds/other.swift | 2 -- .../chained-additional-kinds/output.json | 17 ---------- .../yet-another.swift | 2 -- .../Inputs/chained-after/main.swift | 3 -- .../Inputs/chained-after/main.swiftdeps | 2 -- .../Inputs/chained-after/other.swift | 2 -- .../Inputs/chained-after/other.swiftdeps | 2 -- .../Inputs/chained-after/output.json | 17 ---------- .../Inputs/chained-after/yet-another.swift | 2 -- .../chained-after/yet-another.swiftdeps | 2 -- .../main.swift | 4 --- .../main.swiftdeps | 4 --- .../other.swift | 2 -- .../other.swiftdeps | 2 -- .../output.json | 17 ---------- .../yet-another.swift | 2 -- .../yet-another.swiftdeps | 2 -- .../chained-private-after-multiple/main.swift | 3 -- .../main.swiftdeps | 3 -- .../other.swift | 2 -- .../other.swiftdeps | 2 -- .../output.json | 17 ---------- .../yet-another.swift | 2 -- .../yet-another.swiftdeps | 2 -- .../Inputs/chained-private-after/main.swift | 3 -- .../chained-private-after/main.swiftdeps | 3 -- .../Inputs/chained-private-after/other.swift | 2 -- .../chained-private-after/other.swiftdeps | 2 -- .../Inputs/chained-private-after/output.json | 17 ---------- .../chained-private-after/yet-another.swift | 2 -- .../yet-another.swiftdeps | 2 -- .../Inputs/chained-private/main.swift | 3 -- .../Inputs/chained-private/other.swift | 2 -- .../Inputs/chained-private/output.json | 17 ---------- .../Inputs/chained-private/yet-another.swift | 2 -- .../crash-simple-with-swiftdeps/crash.swift | 2 -- .../crash.swiftdeps | 0 .../crash-simple-with-swiftdeps/main.swift | 2 -- .../main.swiftdeps | 0 .../crash-simple-with-swiftdeps/other.swift | 2 -- .../other.swiftdeps | 0 .../crash-simple-with-swiftdeps/output.json | 17 ---------- .../Inputs/crash-simple/crash.swift | 2 -- .../Inputs/crash-simple/main.swift | 2 -- .../Inputs/crash-simple/other.swift | 2 -- .../Inputs/crash-simple/output.json | 17 ---------- .../Inputs/fail-chained/a.swift | 2 -- .../Inputs/fail-chained/b.swift | 2 -- .../Inputs/fail-chained/bad.swift | 3 -- .../Inputs/fail-chained/c.swift | 3 -- .../Inputs/fail-chained/d.swift | 3 -- .../Inputs/fail-chained/e.swift | 3 -- .../Inputs/fail-chained/f.swift | 3 -- .../Inputs/fail-chained/output.json | 33 ------------------- .../Inputs/fail-interface-hash/bad.swift | 3 -- .../Inputs/fail-interface-hash/bad.swiftdeps | 3 -- .../fail-interface-hash/depends-on-bad.swift | 3 -- .../depends-on-bad.swiftdeps | 3 -- .../fail-interface-hash/depends-on-main.swift | 3 -- .../depends-on-main.swiftdeps | 3 -- .../Inputs/fail-interface-hash/main.swift | 3 -- .../Inputs/fail-interface-hash/main.swiftdeps | 3 -- .../Inputs/fail-interface-hash/output.json | 21 ------------ .../Inputs/fail-simple/bad.swift | 2 -- .../Inputs/fail-simple/main.swift | 2 -- .../Inputs/fail-simple/other.swift | 2 -- .../Inputs/fail-simple/output.json | 17 ---------- .../Inputs/fail-with-bad-deps/bad.swift | 4 --- .../Inputs/fail-with-bad-deps/bad.swiftdeps | 3 -- .../fail-with-bad-deps/depends-on-bad.swift | 3 -- .../depends-on-bad.swiftdeps | 3 -- .../fail-with-bad-deps/depends-on-main.swift | 3 -- .../depends-on-main.swiftdeps | 3 -- .../Inputs/fail-with-bad-deps/main.swift | 3 -- .../Inputs/fail-with-bad-deps/main.swiftdeps | 3 -- .../Inputs/fail-with-bad-deps/output.json | 21 ------------ .../Inputs/independent/main.swift | 1 - .../Inputs/independent/other.swift | 1 - .../Inputs/independent/output.json | 13 -------- .../Inputs/malformed-after/main.swift | 2 -- .../Inputs/malformed-after/main.swiftdeps | 2 -- .../Inputs/malformed-after/other.swift | 2 -- .../Inputs/malformed-after/other.swiftdeps | 1 - .../Inputs/malformed-after/output.json | 13 -------- .../malformed-but-valid-yaml/main.swift | 2 -- .../malformed-but-valid-yaml/main.swiftdeps | 2 -- .../malformed-but-valid-yaml/other.swift | 2 -- .../malformed-but-valid-yaml/other.swiftdeps | 1 - .../malformed-but-valid-yaml/output.json | 13 -------- .../mutual-interface-hash/does-change.swift | 4 --- .../does-change.swiftdeps | 4 --- .../does-not-change.swift | 4 --- .../does-not-change.swiftdeps | 4 --- .../Inputs/mutual-interface-hash/output.json | 13 -------- .../Inputs/mutual-with-swiftdeps/main.swift | 3 -- .../mutual-with-swiftdeps/main.swiftdeps | 0 .../Inputs/mutual-with-swiftdeps/other.swift | 3 -- .../mutual-with-swiftdeps/other.swiftdeps | 0 .../Inputs/mutual-with-swiftdeps/output.json | 13 -------- .../Inputs/mutual/main.swift | 3 -- .../Inputs/mutual/other.swift | 3 -- .../Inputs/mutual/output.json | 13 -------- .../Inputs/nominal-members/a-ext.swift | 2 -- .../Inputs/nominal-members/a.swift | 3 -- .../nominal-members/depends-on-a-ext.swift | 3 -- .../nominal-members/depends-on-a-foo.swift | 3 -- .../Inputs/nominal-members/output.json | 21 ------------ .../Inputs/one-way-depends-after/main.swift | 2 -- .../one-way-depends-after/main.swiftdeps | 1 - .../Inputs/one-way-depends-after/other.swift | 2 -- .../one-way-depends-after/other.swiftdeps | 2 -- .../Inputs/one-way-depends-after/output.json | 13 -------- .../Inputs/one-way-depends-before/main.swift | 1 - .../one-way-depends-before/main.swiftdeps | 2 -- .../Inputs/one-way-depends-before/other.swift | 2 -- .../one-way-depends-before/other.swiftdeps | 2 -- .../Inputs/one-way-depends-before/output.json | 13 -------- .../Inputs/one-way-external/main.swift | 3 -- .../Inputs/one-way-external/main1-external | 0 .../Inputs/one-way-external/main2-external | 0 .../Inputs/one-way-external/other.swift | 3 -- .../Inputs/one-way-external/other1-external | 0 .../Inputs/one-way-external/other2-external | 0 .../Inputs/one-way-external/output.json | 13 -------- .../Inputs/one-way-provides-after/main.swift | 2 -- .../one-way-provides-after/main.swiftdeps | 2 -- .../Inputs/one-way-provides-after/other.swift | 2 -- .../one-way-provides-after/other.swiftdeps | 1 - .../Inputs/one-way-provides-after/output.json | 13 -------- .../Inputs/one-way-provides-before/main.swift | 2 -- .../one-way-provides-before/main.swiftdeps | 2 -- .../one-way-provides-before/other.swift | 1 - .../one-way-provides-before/other.swiftdeps | 2 -- .../one-way-provides-before/output.json | 13 -------- .../Inputs/one-way-with-swiftdeps/main.swift | 2 -- .../one-way-with-swiftdeps/main.swiftdeps | 0 .../Inputs/one-way-with-swiftdeps/other.swift | 2 -- .../one-way-with-swiftdeps/other.swiftdeps | 0 .../Inputs/one-way-with-swiftdeps/output.json | 17 ---------- .../Inputs/private-after/a.swift | 2 -- .../Inputs/private-after/a.swiftdeps | 2 -- .../Inputs/private-after/b.swift | 3 -- .../Inputs/private-after/b.swiftdeps | 3 -- .../Inputs/private-after/c.swift | 3 -- .../Inputs/private-after/c.swiftdeps | 3 -- .../Inputs/private-after/d.swift | 3 -- .../Inputs/private-after/d.swiftdeps | 3 -- .../Inputs/private-after/e.swift | 3 -- .../Inputs/private-after/e.swiftdeps | 3 -- .../Inputs/private-after/f.swift | 3 -- .../Inputs/private-after/f.swiftdeps | 3 -- .../Inputs/private-after/g.swift | 3 -- .../Inputs/private-after/g.swiftdeps | 3 -- .../Inputs/private-after/output.json | 33 ------------------- 303 files changed, 1441 deletions(-) delete mode 100644 test/Driver/Dependencies/Inputs/chained-additional-kinds/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-additional-kinds/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-additional-kinds/output.json delete mode 100644 test/Driver/Dependencies/Inputs/chained-additional-kinds/yet-another.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-after/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-after/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/chained-after/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-after/other.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/chained-after/output.json delete mode 100644 test/Driver/Dependencies/Inputs/chained-after/yet-another.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-after/yet-another.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/other.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/output.json delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple/other.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple/output.json delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple/yet-another.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after-multiple/yet-another.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after/other.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after/output.json delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after/yet-another.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-private-after/yet-another.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/chained-private/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-private/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/chained-private/output.json delete mode 100644 test/Driver/Dependencies/Inputs/chained-private/yet-another.swift delete mode 100644 test/Driver/Dependencies/Inputs/crash-simple/crash.swift delete mode 100644 test/Driver/Dependencies/Inputs/crash-simple/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/crash-simple/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/crash-simple/output.json delete mode 100644 test/Driver/Dependencies/Inputs/fail-chained/a.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-chained/b.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-chained/bad.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-chained/c.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-chained/d.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-chained/e.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-chained/f.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-chained/output.json delete mode 100644 test/Driver/Dependencies/Inputs/fail-interface-hash/bad.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-interface-hash/bad.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-bad.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-bad.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-main.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-interface-hash/depends-on-main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/fail-interface-hash/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-interface-hash/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/fail-interface-hash/output.json delete mode 100644 test/Driver/Dependencies/Inputs/fail-simple/bad.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-simple/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-simple/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-simple/output.json delete mode 100644 test/Driver/Dependencies/Inputs/fail-with-bad-deps/bad.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-with-bad-deps/bad.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-bad.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-bad.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-main.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-with-bad-deps/depends-on-main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/fail-with-bad-deps/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/fail-with-bad-deps/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/fail-with-bad-deps/output.json delete mode 100644 test/Driver/Dependencies/Inputs/independent/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/independent/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/independent/output.json delete mode 100644 test/Driver/Dependencies/Inputs/malformed-after/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/malformed-after/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/malformed-after/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/malformed-after/other.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/malformed-after/output.json delete mode 100644 test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/other.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/malformed-but-valid-yaml/output.json delete mode 100644 test/Driver/Dependencies/Inputs/mutual-interface-hash/does-change.swift delete mode 100644 test/Driver/Dependencies/Inputs/mutual-interface-hash/does-change.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/mutual-interface-hash/does-not-change.swift delete mode 100644 test/Driver/Dependencies/Inputs/mutual-interface-hash/does-not-change.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/mutual-interface-hash/output.json delete mode 100644 test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/other.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/mutual-with-swiftdeps/output.json delete mode 100644 test/Driver/Dependencies/Inputs/mutual/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/mutual/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/mutual/output.json delete mode 100644 test/Driver/Dependencies/Inputs/nominal-members/a-ext.swift delete mode 100644 test/Driver/Dependencies/Inputs/nominal-members/a.swift delete mode 100644 test/Driver/Dependencies/Inputs/nominal-members/depends-on-a-ext.swift delete mode 100644 test/Driver/Dependencies/Inputs/nominal-members/depends-on-a-foo.swift delete mode 100644 test/Driver/Dependencies/Inputs/nominal-members/output.json delete mode 100644 test/Driver/Dependencies/Inputs/one-way-depends-after/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/one-way-depends-after/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/one-way-depends-after/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/one-way-depends-after/other.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/one-way-depends-after/output.json delete mode 100644 test/Driver/Dependencies/Inputs/one-way-depends-before/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/one-way-depends-before/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/one-way-depends-before/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/one-way-depends-before/other.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/one-way-depends-before/output.json delete mode 100644 test/Driver/Dependencies/Inputs/one-way-external/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/one-way-external/main1-external delete mode 100644 test/Driver/Dependencies/Inputs/one-way-external/main2-external delete mode 100644 test/Driver/Dependencies/Inputs/one-way-external/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/one-way-external/other1-external delete mode 100644 test/Driver/Dependencies/Inputs/one-way-external/other2-external delete mode 100644 test/Driver/Dependencies/Inputs/one-way-external/output.json delete mode 100644 test/Driver/Dependencies/Inputs/one-way-provides-after/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/one-way-provides-after/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/one-way-provides-after/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/one-way-provides-after/other.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/one-way-provides-after/output.json delete mode 100644 test/Driver/Dependencies/Inputs/one-way-provides-before/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/one-way-provides-before/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/one-way-provides-before/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/one-way-provides-before/other.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/one-way-provides-before/output.json delete mode 100644 test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/main.swift delete mode 100644 test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/main.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/other.swift delete mode 100644 test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/other.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/one-way-with-swiftdeps/output.json delete mode 100644 test/Driver/Dependencies/Inputs/private-after/a.swift delete mode 100644 test/Driver/Dependencies/Inputs/private-after/a.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/private-after/b.swift delete mode 100644 test/Driver/Dependencies/Inputs/private-after/b.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/private-after/c.swift delete mode 100644 test/Driver/Dependencies/Inputs/private-after/c.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/private-after/d.swift delete mode 100644 test/Driver/Dependencies/Inputs/private-after/d.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/private-after/e.swift delete mode 100644 test/Driver/Dependencies/Inputs/private-after/e.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/private-after/f.swift delete mode 100644 test/Driver/Dependencies/Inputs/private-after/f.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/private-after/g.swift delete mode 100644 test/Driver/Dependencies/Inputs/private-after/g.swiftdeps delete mode 100644 test/Driver/Dependencies/Inputs/private-after/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-additional-kinds/yet-another.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-after/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-after/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-after/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-after/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-after/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-after/yet-another.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-after/yet-another.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple-nominal-members/yet-another.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/yet-another.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after-multiple/yet-another.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after/yet-another.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private-after/yet-another.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/chained-private/yet-another.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/crash.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/crash.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/crash-simple-with-swiftdeps/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/crash-simple/crash.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/crash-simple/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/crash-simple/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/crash-simple/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-chained/a.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-chained/b.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-chained/bad.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-chained/c.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-chained/d.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-chained/e.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-chained/f.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-chained/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-interface-hash/bad.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-interface-hash/bad.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-bad.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-bad.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-interface-hash/depends-on-main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-interface-hash/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-interface-hash/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-interface-hash/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-simple/bad.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-simple/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-simple/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-simple/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/bad.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/bad.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-bad.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-bad.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/depends-on-main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/fail-with-bad-deps/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/independent/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/independent/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/independent/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/malformed-after/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/malformed-after/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/malformed-after/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/malformed-after/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/malformed-after/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/malformed-but-valid-yaml/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-change.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-change.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-not-change.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/does-not-change.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual-interface-hash/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual-with-swiftdeps/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/mutual/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/nominal-members/a-ext.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/nominal-members/a.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/nominal-members/depends-on-a-ext.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/nominal-members/depends-on-a-foo.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/nominal-members/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-depends-after/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-depends-after/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-depends-after/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-depends-after/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-depends-after/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-depends-before/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-depends-before/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-depends-before/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-depends-before/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-depends-before/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-external/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-external/main1-external delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-external/main2-external delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-external/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-external/other1-external delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-external/other2-external delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-external/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-provides-after/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-provides-after/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-provides-after/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-provides-after/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-provides-after/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-provides-before/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-provides-before/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-provides-before/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-provides-before/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-provides-before/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/main.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/main.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/other.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/other.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/one-way-with-swiftdeps/output.json delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/a.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/a.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/b.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/b.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/c.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/c.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/d.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/d.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/e.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/e.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/f.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/f.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/g.swift delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/g.swiftdeps delete mode 100644 test/Driver/PrivateDependencies/Inputs/private-after/output.json 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/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-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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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-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/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/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/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/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/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/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/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/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/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/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/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/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/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" - } -} From b873fe214edf1cf0e6bd1ea82e8a7d09ba7cc4a4 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 10 Jun 2020 19:55:56 -0400 Subject: [PATCH 221/222] Code review feedback from Dave Ungar --- .../swift/AST/FineGrainedDependencyFormat.h | 53 ++++++++++++++----- lib/AST/FineGrainedDependencies.cpp | 20 ++----- lib/AST/FineGrainedDependencyFormat.cpp | 4 ++ lib/AST/FrontendSourceFileDepGraphFactory.cpp | 13 +---- 4 files changed, 50 insertions(+), 40 deletions(-) diff --git a/include/swift/AST/FineGrainedDependencyFormat.h b/include/swift/AST/FineGrainedDependencyFormat.h index c514a5217c75f..a4d35695ceebb 100644 --- a/include/swift/AST/FineGrainedDependencyFormat.h +++ b/include/swift/AST/FineGrainedDependencyFormat.h @@ -33,6 +33,8 @@ 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; @@ -47,6 +49,13 @@ 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, @@ -56,6 +65,7 @@ namespace record_block { IDENTIFIER_NODE, }; + // Always the first record in the file. using MetadataLayout = BCRecordLayout< METADATA, // ID BCFixed<16>, // Dependency graph format major version @@ -63,40 +73,57 @@ namespace record_block { 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 - NodeKindField, // Dependency key node kind - DeclAspectField, // Dependency key declaration aspect - IdentifierIDField, // Dependency key mangled context type name - IdentifierIDField, // Dependency key basic name + // 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? >; - // Optionally follows DEPENDS_ON_DEFINITION_NODE. + // Follows DEPENDS_ON_DEFINITION_NODE when the SourceFileDepGraphNode has a + // fingerprint set. using FingerprintNodeLayout = BCRecordLayout< FINGERPRINT_NODE, BCBlob >; - // Optionally follows SOURCE_FILE_DEP_GRAPH_NODE and FINGERPRINT_NODE. + // 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> - >; - - // Optionally follows all other nodes. - using IdentifierNodeLayout = BCRecordLayout< - IDENTIFIER_NODE, - BCBlob + 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); diff --git a/lib/AST/FineGrainedDependencies.cpp b/lib/AST/FineGrainedDependencies.cpp index 8a90050e1b3bd..4a0c99bbfcd3c 100644 --- a/lib/AST/FineGrainedDependencies.cpp +++ b/lib/AST/FineGrainedDependencies.cpp @@ -52,21 +52,11 @@ Optional SourceFileDepGraph::loadFromPath(StringRef path) { Optional SourceFileDepGraph::loadFromBuffer(llvm::MemoryBuffer &buffer) { - if (false) { - SourceFileDepGraph fg; - llvm::yaml::Input yamlReader(llvm::MemoryBufferRef(buffer), nullptr); - yamlReader >> fg; - if (yamlReader.error()) - return None; - // return fg; compiles for Mac but not Linux, because it cannot be copied. - return Optional(std::move(fg)); - } else { - SourceFileDepGraph fg; - if (swift::fine_grained_dependencies::readFineGrainedDependencyGraph( - buffer, fg)) - return None; - return Optional(std::move(fg)); - } + SourceFileDepGraph fg; + if (swift::fine_grained_dependencies::readFineGrainedDependencyGraph( + buffer, fg)) + return None; + return Optional(std::move(fg)); } //============================================================================== diff --git a/lib/AST/FineGrainedDependencyFormat.cpp b/lib/AST/FineGrainedDependencyFormat.cpp index c3b7f0ef986b1..b52cc2af98baf 100644 --- a/lib/AST/FineGrainedDependencyFormat.cpp +++ b/lib/AST/FineGrainedDependencyFormat.cpp @@ -35,6 +35,7 @@ class Deserializer { SmallVector Scratch; StringRef BlobData; + // These all return true if there was an error. bool readSignature(); bool enterTopLevelBlock(); bool readMetadata(); @@ -63,6 +64,8 @@ bool Deserializer::readSignature() { } 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) { @@ -80,6 +83,7 @@ bool Deserializer::enterTopLevelBlock() { return true; } + // Enters our subblock, which contains the actual dependency information. { auto next = Cursor.advance(); if (!next) { diff --git a/lib/AST/FrontendSourceFileDepGraphFactory.cpp b/lib/AST/FrontendSourceFileDepGraphFactory.cpp index 60bc24b6416ac..3f690852197f5 100644 --- a/lib/AST/FrontendSourceFileDepGraphFactory.cpp +++ b/lib/AST/FrontendSourceFileDepGraphFactory.cpp @@ -292,18 +292,7 @@ bool fine_grained_dependencies::emitReferenceDependencies( SF, outputPath, depTracker, alsoEmitDotFile) .construct(); - bool hadError = false; - if (false) { - hadError = - withOutputFile(diags, outputPath, [&](llvm::raw_pwrite_stream &out) { - out << g.yamlProlog(SF->getASTContext().hadError()); - llvm::yaml::Output yamlWriter(out); - yamlWriter << g; - return false; - }); - } else { - hadError = writeFineGrainedDependencyGraph(diags, outputPath, g); - } + bool hadError = writeFineGrainedDependencyGraph(diags, outputPath, g); // If path is stdout, cannot read it back, so check for "-" assert(outputPath == "-" || g.verifyReadsWhatIsWritten(outputPath)); From f171358eb5a195dd823fbc6211c9befcaa06df58 Mon Sep 17 00:00:00 2001 From: David Zarzycki Date: Thu, 11 Jun 2020 08:54:13 -0400 Subject: [PATCH 222/222] [testing] Add missing REQUIRES: standalone_test --- validation-test/BuildSystem/install_all.test | 2 ++ validation-test/BuildSystem/skip_cmark_swift_llvm.test | 2 ++ 2 files changed, 4 insertions(+) diff --git a/validation-test/BuildSystem/install_all.test b/validation-test/BuildSystem/install_all.test index e8888d25beaf9..63d0ca62f3f9a 100644 --- a/validation-test/BuildSystem/install_all.test +++ b/validation-test/BuildSystem/install_all.test @@ -2,6 +2,8 @@ # 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/skip_cmark_swift_llvm.test b/validation-test/BuildSystem/skip_cmark_swift_llvm.test index 093aef4d755c8..223410c03ab0a 100644 --- a/validation-test/BuildSystem/skip_cmark_swift_llvm.test +++ b/validation-test/BuildSystem/skip_cmark_swift_llvm.test @@ -1,3 +1,5 @@ +# 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