Skip to content

Commit e7ddf70

Browse files
committed
Merge branch 'autodiff-accessor-derivatives' of https://github.com/apple/swift into autodiff-accessor-derivatives
2 parents 586cb24 + bf998e1 commit e7ddf70

File tree

122 files changed

+2782
-1520
lines changed

Some content is hidden

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

122 files changed

+2782
-1520
lines changed

CMakeLists.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -487,16 +487,6 @@ if(NOT SWIFT_LIPO)
487487
find_toolchain_tool(SWIFT_LIPO "${SWIFT_DARWIN_XCRUN_TOOLCHAIN}" lipo)
488488
endif()
489489

490-
# Reset CMAKE_SYSTEM_PROCESSOR if not cross-compiling.
491-
# CMake refuses to use `uname -m` on OS X
492-
# http://public.kitware.com/Bug/view.php?id=10326
493-
if(NOT CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386")
494-
execute_process(
495-
COMMAND "uname" "-m"
496-
OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR
497-
OUTPUT_STRIP_TRAILING_WHITESPACE)
498-
endif()
499-
500490
get_filename_component(SWIFT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} REALPATH)
501491
set(SWIFT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
502492
set(SWIFT_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

benchmark/single-source/Substring.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public let SubstringTest = [
1717
BenchmarkInfo(name: "EqualSubstringString", runFunction: run_EqualSubstringString, tags: [.validation, .api, .String]),
1818
BenchmarkInfo(name: "EqualSubstringSubstring", runFunction: run_EqualSubstringSubstring, tags: [.validation, .api, .String]),
1919
BenchmarkInfo(name: "EqualSubstringSubstringGenericEquatable", runFunction: run_EqualSubstringSubstringGenericEquatable, tags: [.validation, .api, .String]),
20+
BenchmarkInfo(name: "SubstringRemoveFirst1", runFunction: run_SubstringRemoveFirst1, tags: [.validation, .api, .String]),
21+
BenchmarkInfo(name: "SubstringRemoveLast1", runFunction: run_SubstringRemoveLast1, tags: [.validation, .api, .String]),
2022
BenchmarkInfo(name: "LessSubstringSubstring", runFunction: run_LessSubstringSubstring, tags: [.validation, .api, .String]),
2123
BenchmarkInfo(name: "LessSubstringSubstringGenericComparable", runFunction: run_LessSubstringSubstringGenericComparable, tags: [.validation, .api, .String]),
2224
BenchmarkInfo(name: "StringFromLongWholeSubstring", runFunction: run_StringFromLongWholeSubstring, tags: [.validation, .api, .String]),
@@ -34,6 +36,8 @@ let longWide = "fὢasὢodὢijὢadὢolὢsjὢalὢsdὢjlὢasὢdfὢijὢ
3436
let (s1, ss1) = equivalentWithDistinctBuffers()
3537
let (s2, ss2) = equivalentWithDistinctBuffers()
3638

39+
let quiteLong = String(repeating: "0", count: 10_000)[...]
40+
3741
@inline(never)
3842
public func run_SubstringFromLongString(_ N: Int) {
3943
var s = longWide
@@ -126,6 +130,24 @@ public func run_EqualSubstringSubstringGenericEquatable(_ N: Int) {
126130
}
127131
}
128132

133+
@inline(never)
134+
public func run_SubstringRemoveFirst1(_ N: Int) {
135+
for _ in 1...N {
136+
var s = quiteLong
137+
s.removeFirst(1)
138+
blackHole(s.first == "0")
139+
}
140+
}
141+
142+
@inline(never)
143+
public func run_SubstringRemoveLast1(_ N: Int) {
144+
for _ in 1...N {
145+
var s = quiteLong
146+
s.removeLast(1)
147+
blackHole(s.first == "0")
148+
}
149+
}
150+
129151
/*
130152
func checkEqual<T, U>(_ x: T, _ y: U)
131153
where T : StringProtocol, U : StringProtocol {

cmake/modules/AddSwift.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function(_swift_gyb_target_sources target scope)
2323

2424
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${generated}
2525
COMMAND
26-
$<TARGET_FILE:Python2::Interpreter> ${SWIFT_SOURCE_DIR}/utils/gyb -D CMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P} ${SWIFT_GYB_FLAGS} -o ${CMAKE_CURRENT_BINARY_DIR}/${generated}.tmp ${absolute}
26+
$<TARGET_FILE:Python3::Interpreter> ${SWIFT_SOURCE_DIR}/utils/gyb -D CMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P} ${SWIFT_GYB_FLAGS} -o ${CMAKE_CURRENT_BINARY_DIR}/${generated}.tmp ${absolute}
2727
COMMAND
2828
${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${generated}.tmp ${CMAKE_CURRENT_BINARY_DIR}/${generated}
2929
COMMAND

cmake/modules/SwiftHandleGybSources.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
include(SwiftAddCustomCommandTarget)
22
include(SwiftSetIfArchBitness)
33

4-
find_package(Python2 COMPONENTS Interpreter REQUIRED)
5-
64
# Create a target to process single gyb source with the 'gyb' tool.
75
#
86
# handle_gyb_source_single(
@@ -60,7 +58,7 @@ function(handle_gyb_source_single dependency_out_var_name)
6058
COMMAND
6159
"${CMAKE_COMMAND}" -E make_directory "${dir}"
6260
COMMAND
63-
"$<TARGET_FILE:Python2::Interpreter>" "${gyb_tool}" ${SWIFT_GYB_FLAGS} ${GYB_SINGLE_FLAGS} -o "${GYB_SINGLE_OUTPUT}.tmp" "${GYB_SINGLE_SOURCE}"
61+
"$<TARGET_FILE:Python3::Interpreter>" "${gyb_tool}" ${SWIFT_GYB_FLAGS} ${GYB_SINGLE_FLAGS} -o "${GYB_SINGLE_OUTPUT}.tmp" "${GYB_SINGLE_SOURCE}"
6462
COMMAND
6563
"${CMAKE_COMMAND}" -E copy_if_different "${GYB_SINGLE_OUTPUT}.tmp" "${GYB_SINGLE_OUTPUT}"
6664
COMMAND

docs/Android.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,9 @@ $ NDK_PATH="path/to/android-ndk21"
103103
$ build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swiftc \ # The Swift compiler built in the previous step.
104104
# The location of the tools used to build Android binaries
105105
-tools-directory ${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin/ \
106-
-target armv7a-none-linux-androideabi \ # Targeting android-armv7.
107-
-sdk ${NDK_PATH}/platforms/android-21/arch-arm \ # Use the same architecture and API version as you used to build the stdlib in the previous step.
108-
-Xclang-linker -nostdlib++ \ # Don't link libc++, and supply the path to libgcc.
106+
-target armv7a-none-linux-androideabi \ # Targeting android-armv7, and supply the path to libgcc.
109107
-L ${NDK_PATH}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/armv7-a \
108+
-sdk ${NDK_PATH}/platforms/android-21/arch-arm \ # Use the same architecture and API version as you used to build the stdlib in the previous step.
110109
hello.swift
111110
```
112111

docs/ExternalResources.md

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# External Resources
2+
3+
The official [Swift blog](https://swift.org/blog/) has a lot of useful
4+
information, such as [how runtime reflection works][mirror-post] and how the
5+
compiler's [new diagnostic architecture][diagnostic-arch-post] is structured.
6+
7+
[mirror-post]: https://swift.org/blog/how-mirror-works/
8+
[diagnostic-arch-post]: https://swift.org/blog/new-diagnostic-arch-overview/
9+
10+
This page lists some external resources apart from the Swift blog which may be
11+
helpful for people interested in contributing to Swift. The resources are listed
12+
in reverse-chronological order and organized by topic.
13+
14+
<!--
15+
Some resources don't fall cleanly into one topic bucket or another; in such a
16+
case we break the tie arbitrarily.
17+
-->
18+
19+
<!--
20+
The textual descriptions should be written in a way that makes it clear
21+
which topics are discussed, and what a potential contributor to Swift
22+
will gain from it. This is usually different from the talk's abstract.
23+
-->
24+
25+
## Contributing Guides and Tips
26+
27+
- [Steps for first PR and asking questions][] by Varun Gandhi (Swift forum
28+
comment, Dec 2019).
29+
- [Contributing to Swift for the First Time][] by Robert Pieta (talk, Jun 2019):
30+
This talk describes Robert's experience contributing to
31+
`swift-corelibs-foundation` and later `swift`, providing a step-by-step guide
32+
for new contributors to get their feet wet.
33+
- [Contributing to Swift compiler][] by Yusuke Kita (lightning talk, Apr 2019).
34+
- Contributing to Swift ([Part 1][Contributing to Swift - Part 1],
35+
[Part 2][Contributing to Swift - Part 2]) by Suyash Srijan (blog post series,
36+
Dec 2018).
37+
- [Setting up a compile-edit-test cycle][] by Robert Widmann (Swift forum
38+
comment, May 2018)
39+
- [Becoming an Effective Contributor to Swift][] by Harlan Haskins and Robert
40+
Widmann (talk, Apr 2018): Covers the following topics:
41+
- The organization of different projects part of the Swift monorepo.
42+
- How to set up an environment for building Swift.
43+
- Common utilities and compiler flags for debugging different stages.
44+
- Common build configurations.
45+
- Tips and tricks for testing: early exiting, filtering tests,
46+
testing Swift and Objective-C together, using `PrettyStackTrace`.
47+
- A live demo fixing a crash:
48+
- Copying program arguments into Xcode for debugging.
49+
- Using `dump()` for print debugging.
50+
- [Getting Started with Swift Compiler Development][] by Brian Gesiak (blog post
51+
series, Aug 2017 - Jun 2018)
52+
- [Contributing to Open Source Swift][] by Jesse Squires (talk, Mar 2016):
53+
Covers the following topics:
54+
- The overall compiler pipeline.
55+
- The organization of different projects part of the Swift monorepo,
56+
including some "difficulty levels" for different projects.
57+
- Tips for contributing effectively.
58+
59+
[Steps for first PR and asking questions]:
60+
https://forums.swift.org/t/getting-started-with-swift-compiler-development/31502/2
61+
[Contributing to Swift for the First Time]: https://youtu.be/51j7TrFNKiA
62+
[Contributing to Swift compiler]: https://youtu.be/HAXJsgYniqE
63+
[Contributing to Swift - Part 1]: https://medium.com/kinandcartacreated/contributing-to-swift-part-1-ea19108a2a54
64+
[Contributing to Swift - Part 2]:
65+
https://medium.com/kinandcartacreated/contributing-to-swift-part-2-efebcf7b6c93
66+
[Setting up a compile-edit-test cycle]: https://forums.swift.org/t/need-a-workflow-advice/12536/14
67+
[Becoming an Effective Contributor to Swift]: https://youtu.be/oGJKsp-pZPk
68+
[Getting Started with Swift Compiler Development]: https://modocache.io/getting-started-with-swift-development
69+
[Contributing to Open Source Swift]: https://youtu.be/Ysa2n8ZX-YY
70+
71+
## AST
72+
73+
- [The secret life of types in Swift][] by Slava Pestov (blog post, Jul 2016):
74+
This blog post describes the representation of Swift types inside the compiler.
75+
It covers many important concepts: `TypeLoc` vs `TypeRepr` vs `Type`, the
76+
representation of generic types, substitutions and more.
77+
<!-- TODO: It would be great to integrate some of the descriptions
78+
in this blog post into the compiler's own doc comments. -->
79+
80+
[The secret life of types in Swift]: https://medium.com/@slavapestov/the-secret-life-of-types-in-swift-ff83c3c000a5
81+
82+
### libSyntax and SwiftSyntax
83+
84+
- [An overview of SwiftSyntax][] by Luciano Almeida (blog post, Apr 2019):
85+
This post provides a quick tour of libSyntax and SwiftSyntax.
86+
- [Improving Swift Tools with libSyntax][] by Harlan Haskins (talk, Sep 2017):
87+
This talk describes the design of libSyntax/SwiftSyntax and discusses some
88+
useful APIs. It also describes how to write a simple Swift formatter using the
89+
library.
90+
91+
[An overview of SwiftSyntax]: https://medium.com/@lucianoalmeida1/an-overview-of-swiftsyntax-cf1ae6d53494
92+
[Improving Swift Tools with libSyntax]: https://youtu.be/5ivuYGxW_3M
93+
94+
## Type checking and inference
95+
96+
- [Implementing Swift Generics][] by Slava Pestov and John McCall (talk, Oct 2017):
97+
This talk dives into how Swift's compilation scheme for generics balances
98+
(a) modularity and separate compilation with (b) the ability to pass unboxed
99+
values and (c) the flexibility to optionally generate fully specialized code.
100+
It covers the following type-checking related topics: type-checking generic
101+
contexts, requirement paths and canonicalized generic signatures.
102+
- [A Type System from Scratch][] by Robert Widmann (talk, Apr 2017):
103+
This talk covers several topics related to type-checking and inference in Swift:
104+
- Understanding sequent notation which can be used to represent typing judgments.
105+
- An overview of how bidirectional type-checking works.
106+
- Examples of checking and inferring types for some Swift expressions.
107+
- Interaction complexity of different type system features with type inference.
108+
- Type variables and constraint graphs.
109+
110+
[Implementing Swift Generics]: https://youtu.be/ctS8FzqcRug
111+
[A Type System from Scratch]: https://youtu.be/IbjoA5xVUq0
112+
113+
## SIL
114+
115+
- [Ownership SSA][] by Michael Gottesman (talk, Oct 2019): This talk describes
116+
efficiency and correctness challenges with automatic reference counting and
117+
how including ownership semantics in the compiler's intermediate representation
118+
helps tackles those challenges.
119+
- [How to talk to your kids about SIL type use][] by Slava Pestov (blog post,
120+
Jul 2016): This blog post describes several important SIL concepts: object
121+
vs address types, AST -> SIL type lowering, trivial vs loadable vs
122+
address-only SIL types, abstraction patterns and more.
123+
- [Swift's High-Level IR][] by Joe Groff and Chris Lattner (talk, Oct 2015):
124+
This talk describes the goals and design of SIL. It covers the following:
125+
- Some commonly used SIL instructions and how they are motivated by language
126+
features.
127+
- Some early passes in SIL processing, such as mandatory inlining,
128+
box-to-stack promotion and definite initialization.
129+
- Why SIL is useful as an intermediate representation between the AST and
130+
LLVM IR.
131+
132+
[Ownership SSA]: https://youtu.be/qy3iZPHZ88o
133+
[How to talk to your kids about SIL type use]: https://medium.com/@slavapestov/how-to-talk-to-your-kids-about-sil-type-use-6b45f7595f43
134+
[Swift's High-Level IR]: https://youtu.be/Ntj8ab-5cvE
135+
136+
## Code generation, runtime and ABI
137+
138+
- [How Swift Achieved Dynamic Linking Where Rust Couldn't][] by Alexis
139+
Beingessner (blog post, Nov 2019): This blog post describes Swift's approach
140+
for compiling polymorphic functions, contrasting it with the strategy used by
141+
Rust and C++ (monomorphization). It covers the following topics: ABI stability,
142+
library evolution, resilient type layout, reabstraction, materialization,
143+
ownership and calling conventions.
144+
- [arm64e: An ABI for Pointer Authentication][] by Ahmed Bougacha and John McCall
145+
(talk, Oct 2019): This talk does not mention Swift specifically, but provides a
146+
good background on the arm64e ABI and pointer authentication. The ABI affects
147+
parts of IR generation, the Swift runtime, and small parts of the standard
148+
library using unsafe code.
149+
- [Exploiting The Swift ABI][] by Robert Widmann (talk, July 2019):
150+
This talk is a whirlwind tour of different aspects of the Swift ABI and runtime
151+
touching the following topics: reflection, type layout, ABI entrypoints,
152+
Swift's compilation model for generics and archetypes, witness tables,
153+
relative references, context descriptors and more.
154+
- [Efficiently Implementing Runtime Metadata][] by Joe Groff and Doug Gregor
155+
(talk, Oct 2018): This talk covers the use of relative references in Swift's
156+
runtime metadata structures. After describing some important metrics impacted
157+
by the use of dynamic libraries, it goes through the different kinds of
158+
relative references used in the Swift runtime and the resulting tooling and
159+
performance benefits.
160+
- [Coroutine Representations and ABIs in LLVM][] by John McCall (talk, Oct 2018):
161+
This talk describes several points in the design space for coroutines, diving
162+
into important implementation tradeoffs. It explains how different language
163+
features can be built on top of coroutines and how they impose different
164+
design requirements. It also contrasts C++20's coroutines feature with
165+
Swift's accessors, describing the differences between the two as implemented
166+
in LLVM.
167+
- [Implementing Swift Generics][]: This talk is mentioned in the type-checking
168+
section. It also covers the following code generation and runtime topics:
169+
value witness tables, type metadata, abstraction patterns, reabstraction,
170+
reabstraction thunks and protocol witness tables.
171+
172+
[How Swift Achieved Dynamic Linking Where Rust Couldn't]: https://gankra.github.io/blah/swift-abi/
173+
[arm64e: An ABI for Pointer Authentication]: https://youtu.be/C1nZvpEBfYA
174+
[Exploiting The Swift ABI]: https://youtu.be/0rHG_Pa86oA
175+
[Efficiently Implementing Runtime Metadata]: https://youtu.be/G3bpj-4tWVU
176+
[Coroutine Representations and ABIs in LLVM]: https://youtu.be/wyAbV8AM9PM

docs/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,10 @@ They are preserved mostly for historical interest.
252252

253253
## External Resources
254254

255-
The official [Swift blog](https://swift.org/blog/) contains a lot of useful
256-
information, such as how library evolution works and how the compiler's new
257-
diagnostic architecture is structured, helping us provide more precise
258-
diagnostics.
259-
260-
TODO: Add a new document ExternalResources.md.
255+
External resources are listed in [docs/ExternalResources.md](ExternalResources.md).
256+
These cover a variety of topics,
257+
such as the design of different aspects of the Swift compiler and runtime
258+
and contributing to the project more effectively.
261259

262260
## Uncategorized
263261

include/swift/AST/Decl.h

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5502,35 +5502,10 @@ class ParamDecl : public VarDecl {
55025502
}
55035503

55045504
/// Does this parameter reject temporary pointer conversions?
5505-
bool isNonEphemeral() const {
5506-
if (getAttrs().hasAttribute<NonEphemeralAttr>())
5507-
return true;
5508-
5509-
// Only pointer parameters can be non-ephemeral.
5510-
auto ty = getInterfaceType();
5511-
if (!ty->lookThroughSingleOptionalType()->getAnyPointerElementType())
5512-
return false;
5513-
5514-
// Enum element pointer parameters are always non-ephemeral.
5515-
auto *parentDecl = getDeclContext()->getAsDecl();
5516-
if (parentDecl && isa<EnumElementDecl>(parentDecl))
5517-
return true;
5518-
5519-
return false;
5520-
}
5505+
bool isNonEphemeral() const;
55215506

55225507
/// Attempt to apply an implicit `@_nonEphemeral` attribute to this parameter.
5523-
void setNonEphemeralIfPossible() {
5524-
// Don't apply the attribute if this isn't a pointer param.
5525-
auto type = getInterfaceType();
5526-
if (!type->lookThroughSingleOptionalType()->getAnyPointerElementType())
5527-
return;
5528-
5529-
if (!getAttrs().hasAttribute<NonEphemeralAttr>()) {
5530-
auto &ctx = getASTContext();
5531-
getAttrs().add(new (ctx) NonEphemeralAttr(/*IsImplicit*/ true));
5532-
}
5533-
}
5508+
void setNonEphemeralIfPossible();
55345509

55355510
/// Remove the type of this varargs element designator, without the array
55365511
/// type wrapping it. A parameter like "Int..." will have formal parameter

include/swift/AST/DiagnosticsSIL.def

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -496,12 +496,6 @@ NOTE(autodiff_cannot_differentiate_through_multiple_results,none,
496496
"cannot differentiate through multiple results", ())
497497
NOTE(autodiff_cannot_differentiate_through_inout_arguments,none,
498498
"cannot differentiate through 'inout' arguments", ())
499-
// TODO(TF-1149): Remove this diagnostic.
500-
NOTE(autodiff_loadable_value_addressonly_tangent_unsupported,none,
501-
"cannot yet differentiate value whose type %0 has a compile-time known "
502-
"size, but whose 'TangentVector' contains stored properties of unknown "
503-
"size; consider modifying %1 to use fewer generic parameters in stored "
504-
"properties", (Type, Type))
505499
NOTE(autodiff_enums_unsupported,none,
506500
"differentiating enum values is not yet supported", ())
507501
NOTE(autodiff_stored_property_parent_not_differentiable,none,

include/swift/AST/DiagnosticsSema.def

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,9 @@ ERROR(optional_base_not_unwrapped,none,
10751075
NOTE(optional_base_chain,none,
10761076
"chain the optional using '?' to access member %0 only for non-'nil' "
10771077
"base values", (DeclNameRef))
1078+
NOTE(optional_base_remove_optional_for_keypath_root, none,
1079+
"use unwrapped type %0 as key path root", (Type))
1080+
10781081
ERROR(missing_unwrap_optional_try,none,
10791082
"value of optional type %0 not unwrapped; did you mean to use 'try!' "
10801083
"or chain with '?'?",
@@ -2689,7 +2692,8 @@ ERROR(decl_from_hidden_module,none,
26892692
"in an extension with public or '@usableFromInline' members|"
26902693
"in an extension with conditional conformances}2; "
26912694
"%select{%3 has been imported as implementation-only|"
2692-
"it is an SPI imported from %3}4",
2695+
"it is an SPI imported from %3|"
2696+
"it is SPI}4",
26932697
(DescriptiveDeclKind, DeclName, unsigned, Identifier, unsigned))
26942698
ERROR(conformance_from_implementation_only_module,none,
26952699
"cannot use conformance of %0 to %1 %select{here|as property wrapper here|"
@@ -4769,7 +4773,8 @@ WARNING(resilience_decl_unavailable_warn,
47694773
ERROR(inlinable_decl_ref_from_hidden_module,
47704774
none, "%0 %1 cannot be used in " FRAGILE_FUNC_KIND "2 "
47714775
"because %select{%3 was imported implementation-only|"
4772-
"it is an SPI imported from %3}4",
4776+
"it is an SPI imported from %3|"
4777+
"it is SPI}4",
47734778
(DescriptiveDeclKind, DeclName, unsigned, Identifier, unsigned))
47744779

47754780
#undef FRAGILE_FUNC_KIND

include/swift/AST/Expr.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5380,6 +5380,13 @@ class KeyPathExpr : public Expr {
53805380
return Loc;
53815381
}
53825382

5383+
SourceRange getSourceRange() const {
5384+
if (auto *indexExpr = getIndexExpr()) {
5385+
return indexExpr->getSourceRange();
5386+
}
5387+
return Loc;
5388+
}
5389+
53835390
Kind getKind() const {
53845391
return KindValue;
53855392
}

include/swift/AST/SILOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class SILOptions {
4141
int UnrollThreshold = 250;
4242

4343
/// The number of threads for multi-threaded code generation.
44-
int NumThreads = 0;
44+
unsigned NumThreads = 0;
4545

4646
/// Controls whether to pull in SIL from partial modules during the
4747
/// merge modules step. Could perhaps be merged with the link mode

0 commit comments

Comments
 (0)