Skip to content

[pull] swiftwasm from master #1234

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2a48e19
[SourceKit] Add Effective Scope to Index
rockbruno May 24, 2020
f000639
Improve tests and generate the rest of the output
rockbruno May 25, 2020
9b05823
Remove accessors and add PW tests
rockbruno May 26, 2020
51c0024
Whitelist instead of blacklist
rockbruno May 26, 2020
6ebf0d5
Add a test showing local content being ignored
rockbruno May 26, 2020
b50813a
Run linux only test
rockbruno May 27, 2020
8f2f14b
[CSSimplify] Modify logic on match representations to allow ONLY thic…
LucianoPAlmeida May 30, 2020
bacbc57
[tests] Adding silgen validation tests for SR-12723 to ensure that ce…
LucianoPAlmeida May 30, 2020
baccbde
[CSSimplify] Simplify logic for valiting to thick conversion on subtype
LucianoPAlmeida Jun 2, 2020
d6bf34e
[CSSimplify] Thin to thin is also allowed
LucianoPAlmeida Jun 5, 2020
346771f
Update tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp
rockbruno Jun 9, 2020
2b47815
IRGen: Lookup the conformance of an archetype in the right substituti…
aschwaighofer Jun 9, 2020
adba283
[CSSimplify] Abstract function conversion validation into static method
LucianoPAlmeida Jun 9, 2020
478e13b
Address review feedback
aschwaighofer Jun 10, 2020
8a2bfb0
No need to lookup the conformance we can just take the protocol from …
aschwaighofer Jun 11, 2020
632b5ce
Ignore OnFastPath builtin while looking for valid static initializer …
meg-gupta Jun 11, 2020
2efde25
[Gardening] Ignored Package.resolved for swift-inspect.
nate-chandler Jun 13, 2020
f20d567
Fix the hardcoded Swift AST section / segment name for Mach-O
adrian-prantl Jun 13, 2020
c8ba437
[test] Handle architecture aliasing for OpenBSD.
3405691582 Mar 21, 2020
1484360
CS node->type map requires ordering because it can be partially undone,
gregomni Jun 13, 2020
8bfaba7
Update WindowsBuild.md
compnerd Jun 14, 2020
76ca05f
reland: Emit coverage mappings for all modules
keith Jun 12, 2020
e57d375
build: do not assume that XML2 should be enabled
compnerd Jun 14, 2020
77d0919
Merge pull request #32365 from gregomni/solution-node-map
xedin Jun 15, 2020
da53129
[CSSimplify] Adjusting naming and comments of method that validates r…
LucianoPAlmeida Jun 15, 2020
3455ba9
Merge pull request #32377 from apple/compnerd-ICU-67
compnerd Jun 15, 2020
a666d32
Merge pull request #32379 from compnerd/xml2-control
compnerd Jun 15, 2020
e2a20ab
Merge pull request #32360 from nate-chandler/gardening/ignore-swift-i…
nate-chandler Jun 15, 2020
4d705ab
Merge pull request #32319 from meg-gupta/onfastpath
meg-gupta Jun 15, 2020
4849947
Merge pull request #32277 from aschwaighofer/irgen_fix_addAbstractCon…
aschwaighofer Jun 15, 2020
73d8419
Merge pull request #32352 from keith/ks/reland-emit-coverage-mappings…
compnerd Jun 15, 2020
2a377bc
Merge pull request #32363 from 3405691582/Test_OpenBSD_ArchAliasing
compnerd Jun 15, 2020
4b1ffa5
[NameLookup] Ensure extensions are updated after module load
hamishknight Jun 15, 2020
403b2bf
Merge pull request #32362 from adrian-prantl/63991514
adrian-prantl Jun 15, 2020
47554c1
Merge pull request #31942 from rockbruno/allelementsmatter
Jun 15, 2020
80e2b48
[Test] Version cleanup
DougGregor Jun 15, 2020
f155ce8
Merge pull request #32375 from hamishknight/cached-my-last-rain-check
hamishknight Jun 15, 2020
8573d70
[Typechecker] Diagnose use of magic literals as raw value for enum ca…
theblixguy Jun 15, 2020
d22821e
Merge pull request #31814 from LucianoPAlmeida/SR-12723-conventions
LucianoPAlmeida Jun 16, 2020
542721b
[AutoDiff] Disable flaky tests on Linux. (#32394)
dan-zheng Jun 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/WindowsBuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Extract the zip files, ignoring the top level directory, into `S:/Library`. The

```
/Library
┝ icu-64
┝ icu-67
│ ┕ usr/...
├ libcurl-development
│ ┕ usr/...
Expand Down Expand Up @@ -138,10 +138,10 @@ cmake -B "S:\b\toolchain" ^
-D LLDB_ENABLE_PYTHON=YES ^
-D LLVM_EXTERNAL_SWIFT_SOURCE_DIR="S:/swift" ^
-D LLVM_EXTERNAL_CMARK_SOURCE_DIR="S:/cmark" ^
-D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-64/usr/include" ^
-D SWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-64/usr/lib/icuuc64.lib" ^
-D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-64/usr/include" ^
-D SWIFT_WINDOWS_x86_64_ICU_I18N="S:/Library/icu-64/usr/lib/icuin64.lib" ^
-D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-67/usr/include" ^
-D SWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-67/usr/lib/icuuc67.lib" ^
-D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-67/usr/include" ^
-D SWIFT_WINDOWS_x86_64_ICU_I18N="S:/Library/icu-67/usr/lib/icuin67.lib" ^
-D CMAKE_INSTALL_PREFIX="C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr" ^
-D PYTHON_EXECUTABLE=C:\Python27\python.exe ^
-D SWIFT_BUILD_DYNAMIC_STDLIB=YES ^
Expand All @@ -158,7 +158,7 @@ ninja -C S:\b\toolchain
## Running Swift tests on Windows

```cmd
path S:\Library\icu-64\usr\bin;S:\b\toolchain\bin;S:\b\toolchain\tools\swift\libdispatch-prefix\bin;%PATH%;%ProgramFiles%\Git\usr\bin
path S:\Library\icu-67\usr\bin;S:\b\toolchain\bin;S:\b\toolchain\tools\swift\libdispatch-prefix\bin;%PATH%;%ProgramFiles%\Git\usr\bin
ninja -C S:\b\toolchain check-swift
```

Expand All @@ -178,7 +178,7 @@ ninja -C S:\b\libdispatch check
## Build swift-corelibs-foundation

```cmd
cmake -B S:\b\foundation -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=S:/b/toolchain/bin/clang-cl.exe -D CMAKE_Swift_COMPILER=S:/b/toolchain/bin/swiftc.exe -D CURL_LIBRARY="S:/Library/libcurl-development/usr/lib/libcurl.lib" -D CURL_INCLUDE_DIR="S:/Library/libcurl-development/usr/include" -D ICU_ROOT="S:/Library/icu-64" -D ICU_INCLUDE_DIR=S:/Library/icu-64/usr/include -D LIBXML2_LIBRARY="S:/Library/libxml2-development/usr/lib/libxml2s.lib" -D LIBXML2_INCLUDE_DIR="S:/Library/libxml2-development/usr/include/libxml2" -D ENABLE_TESTING=NO -D dispatch_DIR=S:/b/libdispatch/cmake/modules -G Ninja -S S:\swift-corelibs-foundation
cmake -B S:\b\foundation -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=S:/b/toolchain/bin/clang-cl.exe -D CMAKE_Swift_COMPILER=S:/b/toolchain/bin/swiftc.exe -D CURL_LIBRARY="S:/Library/libcurl-development/usr/lib/libcurl.lib" -D CURL_INCLUDE_DIR="S:/Library/libcurl-development/usr/include" -D ICU_ROOT="S:/Library/icu-67" -D ICU_INCLUDE_DIR=S:/Library/icu-67/usr/include -D LIBXML2_LIBRARY="S:/Library/libxml2-development/usr/lib/libxml2s.lib" -D LIBXML2_INCLUDE_DIR="S:/Library/libxml2-development/usr/include/libxml2" -D ENABLE_TESTING=NO -D dispatch_DIR=S:/b/libdispatch/cmake/modules -G Ninja -S S:\swift-corelibs-foundation
ninja -C S:\b\foundation
```

Expand Down Expand Up @@ -210,7 +210,7 @@ ninja -C S:\b\xctest check-xctest
## Rebuild Foundation

```cmd
cmake -B S:\b\foundation -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=S:/b/toolchain/bin/clang-cl.exe -D CMAKE_Swift_COMPILER=S:/b/toolchain/bin/swiftc.exe -D CURL_LIBRARY="S:/Library/libcurl-development/usr/lib/libcurl.lib" -D CURL_INCLUDE_DIR="S:/Library/libcurl-development/usr/include" -D ICU_ROOT="S:/Library/icu-64" -D LIBXML2_LIBRARY="S:/Library/libxml2-development/usr/lib/libxml2.lib" -D LIBXML2_INCLUDE_DIR="S:/Library/libxml2-development/usr/include" -D ENABLE_TESTING=YES -D dispatch_DIR=S:/b/libdispatch/cmake/modules -D XCTest_DIR=S:/b/xctest/cmake/modules -G Ninja -S S:\swift-corelibs-foundation
cmake -B S:\b\foundation -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=S:/b/toolchain/bin/clang-cl.exe -D CMAKE_Swift_COMPILER=S:/b/toolchain/bin/swiftc.exe -D CURL_LIBRARY="S:/Library/libcurl-development/usr/lib/libcurl.lib" -D CURL_INCLUDE_DIR="S:/Library/libcurl-development/usr/include" -D ICU_ROOT="S:/Library/icu-67" -D LIBXML2_LIBRARY="S:/Library/libxml2-development/usr/lib/libxml2.lib" -D LIBXML2_INCLUDE_DIR="S:/Library/libxml2-development/usr/include" -D ENABLE_TESTING=YES -D dispatch_DIR=S:/b/libdispatch/cmake/modules -D XCTest_DIR=S:/b/xctest/cmake/modules -G Ninja -S S:\swift-corelibs-foundation
ninja -C S:\b\foundation
```

Expand Down
3 changes: 3 additions & 0 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -2668,6 +2668,9 @@ ERROR(enum_non_integer_convertible_raw_type_no_value,none,
"expressible by integer or string literal", ())
ERROR(enum_raw_value_not_unique,none,
"raw value for enum case is not unique", ())
ERROR(enum_raw_value_magic_literal,none,
"use of '%0' literal as raw value for enum case is not supported",
(StringRef))
NOTE(enum_raw_value_used_here,none,
"raw value previously used here", ())
NOTE(enum_raw_value_incrementing_from_here,none,
Expand Down
4 changes: 2 additions & 2 deletions include/swift/Basic/Dwarf.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace swift {
/// The DWARF version emitted by the Swift compiler.
const unsigned DWARFVersion = 4;

static const char MachOASTSegmentName[] = "__SWIFT";
static const char MachOASTSectionName[] = "__ast";
static const char MachOASTSegmentName[] = "__DWARF";
static const char MachOASTSectionName[] = "__swift_ast";
static const char ELFASTSectionName[] = ".swift_ast";
static const char COFFASTSectionName[] = "swiftast";
static const char WasmASTSectionName[] = ".swift_ast";
Expand Down
6 changes: 6 additions & 0 deletions lib/AST/NameLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,12 @@ DirectLookupRequest::evaluate(Evaluator &evaluator,

decl->prepareLookupTable();

// If we're allowed to load extensions, call prepareExtensions to ensure we
// properly invalidate the lazily-complete cache for any extensions brought in
// by modules loaded after-the-fact. This can happen with the LLDB REPL.
if (!disableAdditionalExtensionLoading)
decl->prepareExtensions();

auto &Table = *decl->LookupTable;
if (!useNamedLazyMemberLoading) {
// Make sure we have the complete list of members (in this nominal and in
Expand Down
7 changes: 5 additions & 2 deletions lib/IRGen/GenDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 3 additions & 5 deletions lib/IRGen/GenProto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2749,12 +2749,10 @@ static void addAbstractConditionalRequirements(
auto *proto =
req.getSecondType()->castTo<ProtocolType>()->getDecl();
auto ty = req.getFirstType()->getCanonicalType();
if (!isa<ArchetypeType>(ty))
auto archetype = dyn_cast<ArchetypeType>(ty);
if (!archetype)
continue;
auto conformance = subMap.lookupConformance(ty, proto);
if (!conformance.isAbstract())
continue;
requirements.insert({ty, conformance.getAbstract()});
requirements.insert({ty, proto});
}
// Recursively add conditional requirements.
for (auto &conf : subMap.getConformances()) {
Expand Down
4 changes: 4 additions & 0 deletions lib/IRGen/IRGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,10 @@ swift::createSwiftModuleObjectFile(SILModule &SILMod, StringRef Buffer,
assert(!Ctx.hadError());

IRGenOptions Opts;
// This tool doesn't pass the necessary runtime library path to
// TypeConverter, because this feature isn't needed.
Opts.DisableLegacyTypeInfo = true;

Opts.OutputKind = IRGenOutputKind::ObjectFile;
IRGenerator irgen(Opts, SILMod);

Expand Down
2 changes: 2 additions & 0 deletions lib/SIL/IR/SILGlobalVariable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ bool SILGlobalVariable::isValidStaticInitializerInst(const SILInstruction *I,
auto *TE = bi->getSingleUserOfType<TupleExtractInst>();
return TE && getOffsetSubtract(TE, M);
}
case BuiltinValueKind::OnFastPath:
return true;
default:
break;
}
Expand Down
39 changes: 36 additions & 3 deletions lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1350,20 +1350,53 @@ ConstraintSystem::matchTupleTypes(TupleType *tuple1, TupleType *tuple2,
return getTypeMatchSuccess();
}

// Determine whether conversion is allowed between two function types
// based on their representations.
static bool
isConversionAllowedBetween(FunctionTypeRepresentation rep1,
FunctionTypeRepresentation rep2) {
auto isThin = [](FunctionTypeRepresentation rep) {
return rep == FunctionTypeRepresentation::CFunctionPointer ||
rep == FunctionTypeRepresentation::Thin;
};

// Allowing "thin" (c, thin) to "thin" conventions
if (isThin(rep1) && isThin(rep2))
return true;

// Allowing all to "thick" (swift, block) conventions
// "thin" (c, thin) to "thick" or "thick" to "thick"
if (rep2 == FunctionTypeRepresentation::Swift ||
rep2 == FunctionTypeRepresentation::Block)
return true;

return rep1 == rep2;
}

// Returns 'false' (i.e. no error) if it is legal to match functions with the
// corresponding function type representations and the given match kind.
static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1,
FunctionTypeRepresentation rep2,
ConstraintKind kind) {
ConstraintKind kind,
ConstraintLocatorBuilder locator) {
switch (kind) {
case ConstraintKind::Bind:
case ConstraintKind::BindParam:
case ConstraintKind::BindToPointerType:
case ConstraintKind::Equal:
return rep1 != rep2;

case ConstraintKind::Subtype: {
auto last = locator.last();
if (!(last && last->is<LocatorPathElt::FunctionArgument>()))
return false;

// Inverting the result because matchFunctionRepresentations
// returns false in conversions are allowed.
return !isConversionAllowedBetween(rep1, rep2);
}

case ConstraintKind::OpaqueUnderlyingType:
case ConstraintKind::Subtype:
case ConstraintKind::Conversion:
case ConstraintKind::BridgingConversion:
case ConstraintKind::ArgumentConversion:
Expand Down Expand Up @@ -1658,7 +1691,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,

if (matchFunctionRepresentations(func1->getExtInfo().getRepresentation(),
func2->getExtInfo().getRepresentation(),
kind)) {
kind, locator)) {
return getTypeMatchFailure(locator);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/ConstraintSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ class Solution {
llvm::SmallPtrSet<ConstraintLocator *, 2> DefaultedConstraints;

/// The node -> type mappings introduced by this solution.
llvm::MapVector<ASTNode, Type> nodeTypes;
llvm::DenseMap<ASTNode, Type> nodeTypes;

/// Contextual types introduced by this solution.
std::vector<std::pair<ASTNode, ContextualTypeInfo>> contextualTypes;
Expand Down
18 changes: 15 additions & 3 deletions lib/Sema/TypeCheckDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,21 @@ EnumRawValuesRequest::evaluate(Evaluator &eval, EnumDecl *ED,
if (ED->LazySemanticInfo.hasFixedRawValues())
continue;

// Using magic literals like #file as raw value is not supported right now.
// TODO: We could potentially support #file, #function, #line and #column.
auto &Diags = ED->getASTContext().Diags;
SourceLoc diagLoc = uncheckedRawValueOf(elt)->isImplicit()
? elt->getLoc()
: uncheckedRawValueOf(elt)->getLoc();
if (auto magicLiteralExpr =
dyn_cast<MagicIdentifierLiteralExpr>(prevValue)) {
auto kindString =
magicLiteralExpr->getKindString(magicLiteralExpr->getKind());
Diags.diagnose(diagLoc, diag::enum_raw_value_magic_literal, kindString);
elt->setInvalid();
continue;
}

// Check that the raw value is unique.
RawValueKey key{prevValue};
RawValueSource source{elt, lastExplicitValueElt};
Expand All @@ -1091,9 +1106,6 @@ EnumRawValuesRequest::evaluate(Evaluator &eval, EnumDecl *ED,
continue;

// Diagnose the duplicate value.
auto &Diags = ED->getASTContext().Diags;
SourceLoc diagLoc = uncheckedRawValueOf(elt)->isImplicit()
? elt->getLoc() : uncheckedRawValueOf(elt)->getLoc();
Diags.diagnose(diagLoc, diag::enum_raw_value_not_unique);
assert(lastExplicitValueElt &&
"should not be able to have non-unique raw values when "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// SR-12493: SIL verification error regarding substituted function types and
// `differentiable_function_extract` instruction. Occurs only with `-O`.

// FIXME(SR-13021): Disabled due to flakiness on Linux.
// REQUIRES: SR13021

import _Differentiation

func exampleVJP_1(_ x0: Float) -> (Float, (Float) -> (Float)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// RUN: %target-build-swift -g %s

// SR-12650: IRGenDebugInfo type reconstruction crash because `@noDerivative`
// parameters are not mangled.

// FIXME(SR-13021): Disabled due to flakiness on Linux.
// REQUIRES: SR13021

import _Differentiation
func id(_ x: Float, _ y: Float) -> Float { x }
let transformed: @differentiable (Float, @noDerivative Float) -> Float = id

// Incorrect reconstructed type for $sS3fIedgyyd_D
// Original type:
// (sil_function_type type=@differentiable @callee_guaranteed (Float, @noDerivative Float) -> Float
// (input=struct_type decl=Swift.(file).Float)
// (input=struct_type decl=Swift.(file).Float)
// (result=struct_type decl=Swift.(file).Float)
// (substitution_map generic_signature=<nullptr>)
// (substitution_map generic_signature=<nullptr>))
// Reconstructed type:
// (sil_function_type type=@differentiable @callee_guaranteed (Float, Float) -> Float
// (input=struct_type decl=Swift.(file).Float)
// (input=struct_type decl=Swift.(file).Float)
// (result=struct_type decl=Swift.(file).Float)
// (substitution_map generic_signature=<nullptr>)
// (substitution_map generic_signature=<nullptr>))
// Stack dump:
// ...
// 1. Swift version 5.3-dev (LLVM 803d1b184d, Swift 477af9f90d)
// 2. While evaluating request IRGenSourceFileRequest(IR Generation for file "noderiv.swift")
// 0 swift 0x00000001104c7ae8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
// 1 swift 0x00000001104c6a68 llvm::sys::RunSignalHandlers() + 248
// 2 swift 0x00000001104c80dd SignalHandler(int) + 285
// 3 libsystem_platform.dylib 0x00007fff718335fd _sigtramp + 29
// 4 libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338611739168
// 5 libsystem_c.dylib 0x00007fff71709808 abort + 120
// 6 swift 0x0000000110604152 (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) (.cold.20) + 146
// 7 swift 0x000000010c24ab1e (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) + 3614
// 8 swift 0x000000010c245437 swift::irgen::IRGenDebugInfo::emitGlobalVariableDeclaration(llvm::GlobalVariable*, llvm::StringRef, llvm::StringRef, swift::irgen::DebugTypeInfo, bool, bool, llvm::Optional<swift::SILLocation>) + 167
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ foreach(SDK ${SWIFT_SDKS})
set(validation_test_bin_dir
"${CMAKE_CURRENT_BINARY_DIR}/../validation-test${VARIANT_SUFFIX}")

if(LibXml2_FOUND)
if(LLVM_ENABLE_LIBXML2)
set(SWIFT_HAVE_LIBXML2 TRUE)
else()
set(SWIFT_HAVE_LIBXML2 FALSE)
Expand Down
14 changes: 14 additions & 0 deletions test/DebugInfo/ASTSection-single.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// REQUIRES: executable_test
// REQUIRES: swift_tools_extra

// Test that a module-wrapped Swift AST section can be parsed.

// RUN: %empty-directory(%t)

// RUN: echo "public let a0 = 0" >%t/a0.swift
// RUN: %target-build-swift %t/a0.swift -emit-module -emit-module-path %t/a0.swiftmodule
// RUN: %target-swift-modulewrap %t/a0.swiftmodule -o %t/a0-mod.o

// RUN: %lldb-moduleimport-test -verbose %t/a0-mod.o | %FileCheck %s
// CHECK: Importing a0... ok!

2 changes: 1 addition & 1 deletion test/DebugInfo/ASTSection_linker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// RUN: %swift-ide-test -test-CompilerInvocation-from-module -source-filename=%t/ASTSection.swiftmodule

// Test the inline section mechanism.
// RUN: %target-ld %t/ASTSection.o -sectcreate __SWIFT __ast %t/ASTSection.swiftmodule -o %t/ASTSection.dylib -dylib -lSystem -lobjc
// RUN: %target-ld %t/ASTSection.o -sectcreate __DWARF __swift_ast %t/ASTSection.swiftmodule -o %t/ASTSection.dylib -dylib -lSystem -lobjc
// RUN: %lldb-moduleimport-test -verbose %t/ASTSection.dylib | %FileCheck %s

// Test the symbol table entry.
Expand Down
24 changes: 22 additions & 2 deletions test/IRGen/partial_apply_forwarder.sil
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ protocol MyEquatable {
static func isEqual (lhs: Self, rhs: Self) -> Builtin.Int1
}

protocol MyExtended : MyEquatable {
func extended()
}
public struct Inner<Element> {
public init()
public init(_ e: Element)
Expand All @@ -278,7 +281,7 @@ public struct Outermost<Value> {
sil @$closure : $@convention(method) <Value where Value : MyEquatable> (Outer<Value>, Outer<Value>, @thin Outer<Value>.Type) -> Builtin.Int1
sil @$closure2 : $@convention(method) <Value where Value : MyEquatable> (Outermost<Value>, Outermost<Value>, @thin Outermost<Value>.Type) -> Builtin.Int1

sil @$dont_crash_test_capture_specialized_conditional_conformance : $@convention(thin) <Element where Element : MyEquatable> (Outer<Inner<Element>>) -> () {
sil @$dont_crash_test_capture_specialized_conditional_conformance : $@convention(thin) <Element where Element : MyExtended> (Outer<Inner<Element>>) -> () {
bb0(%0 : $Outer<Inner<Element>>):
%2 = alloc_stack $Outer<Inner<Element>>
store %0 to %2 : $*Outer<Inner<Element>>
Expand All @@ -291,7 +294,24 @@ bb0(%0 : $Outer<Inner<Element>>):
return %15 : $()
}

sil @$dont_crash_test_capture_specialized_conditional_conformance_nested : $@convention(thin) <Element where Element : MyEquatable> (Outer<Inner<Element>>) -> () {
protocol AssocType {
associatedtype A : MyExtended
}

sil @$dont_crash_test_capture_specialized_conditional_conformance_associated_type : $@convention(thin) <Element where Element : AssocType> (Outer<Inner<Element.A>>) -> () {
bb0(%0 : $Outer<Inner<Element.A>>):
%2 = alloc_stack $Outer<Inner<Element.A>>
store %0 to %2 : $*Outer<Inner<Element.A>>
%4 = metatype $@thin Outer<Inner<Element.A>>.Type
%5 = function_ref @$closure : $@convention(method) <τ_0_0 where τ_0_0 : MyEquatable> (Outer<τ_0_0>, Outer<τ_0_0>, @thin Outer<τ_0_0>.Type) -> Builtin.Int1
%6 = partial_apply [callee_guaranteed] %5<Inner<Element.A>>(%4) : $@convention(method) <τ_0_0 where τ_0_0 : MyEquatable> (Outer<τ_0_0>, Outer<τ_0_0>, @thin Outer<τ_0_0>.Type) -> Builtin.Int1
strong_release %6 : $@callee_guaranteed (Outer<Inner<Element.A>>, Outer<Inner<Element.A>>) -> Builtin.Int1
dealloc_stack %2 : $*Outer<Inner<Element.A>>
%15 = tuple ()
return %15 : $()
}

sil @$dont_crash_test_capture_specialized_conditional_conformance_nested : $@convention(thin) <A, B, Element where Element : MyEquatable> (Outer<Inner<Element>>) -> () {
bb0(%0 : $Outer<Inner<Element>>):
%4 = metatype $@thin Outermost<Outer<Inner<Element>>>.Type
%5 = function_ref @$closure2 : $@convention(method) <Value where Value : MyEquatable> (Outermost<Value>, Outermost<Value>, @thin Outermost<Value>.Type) -> Builtin.Int1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/include/Lib.swiftmodule)
// RUN: cp %S/Inputs/prebuilt-module-cache/Lib.swiftinterface %t/include/Lib.swiftmodule/%target-cpu.swiftinterface
// RUN: cp %S/Inputs/prebuilt-module-cache/Lib.swiftinterface %t/include/Lib.swiftmodule/%target-swiftinterface-name

// Baseline check: if the prebuilt cache path does not exist, everything should
// still work.
Expand Down
Loading