Skip to content

[swift-3.0-preview-1] stdlib: fix incorrect distance measurement between UTF-16 indices #4080

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

Closed
wants to merge 110 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
6160971
[utils] Add support for swift-3.0-branch
shahmishal Aug 3, 2016
9cf4f04
[noescape-by-default] Better diagnostics for parameters
milseman Aug 2, 2016
224613a
[noescape-by-default] Expand useful diagnostics to more cases
milseman Aug 2, 2016
cc98458
[noescape-by-default] incorporate Doug's feedback
milseman Aug 3, 2016
03415be
Merge pull request #3948 from milseman/3_0_noescape_by_default
tkremenek Aug 3, 2016
adfb6ec
Count tail-padding in the size of imported C types.
rjmccall Aug 2, 2016
daca860
[Driver] Make sure to rebuild dependents when a dirty file fails. (#3…
jrose-apple Aug 3, 2016
b8304d5
Fix test case for 32-bit systems.
rjmccall Aug 3, 2016
01eb46e
[Driver] Remove debugging code from 848b3eb.
jrose-apple Aug 3, 2016
fda6d4e
Add fast path for queue.async(flags: .barrier)
lilyball Aug 1, 2016
73b25c5
Use shims for all calls to Dispatch APIs that take blocks
lilyball Aug 1, 2016
ce0083a
Merge pull request #3962 from harlanhaskins/aristotelianism
tkremenek Aug 3, 2016
50068d8
This test is known to fail on a debug stdlib
aschwaighofer Aug 3, 2016
682b5e2
Merge pull request #3970 from aschwaighofer/swift-3.0-branch
tkremenek Aug 3, 2016
1ca2203
[FixCode] Help users construct mutable pointer from a pointer by inse…
nkcsgexi Aug 3, 2016
ad4e777
Eliminate race in swift_bridgeErrorToNSError.
DougGregor Aug 1, 2016
07e731d
Merge pull request #3955 from rjmccall/count-c-tail-padding-3.0
rjmccall Aug 3, 2016
122ad91
[sil-cloner] Always call doPreProcess when visiting SILInstructions.
swiftix Aug 3, 2016
f395524
[PrintAsObjC] Hack: Assume all option sets have typedefs. (#3961)
jrose-apple Aug 3, 2016
388625b
Addressing Chris' code review comments on 6324314. NFC
nkcsgexi Aug 4, 2016
9ad7cbd
SpriteKit overlay: add a better variant of the SKWarpGeometryGrid() i…
gribozavr Aug 3, 2016
7878fed
SpriteKit overlay: fix a typo
gribozavr Aug 3, 2016
5738e1f
Merge pull request #3978 from swiftix/swift-3.0-branch
tkremenek Aug 4, 2016
fc5b4fe
Merge pull request #3975 from DougGregor/rdar-27541751-error-bridging…
DougGregor Aug 4, 2016
04b9f0d
Merge pull request #3957 from jrose-apple/swift-3.0-we-can-rebuild-them
tkremenek Aug 4, 2016
0fd1993
Merge pull request #3966 from apple/swift3-dispatch-overlay-blocks
tkremenek Aug 4, 2016
141c0f9
[SILGen] Use the 'Class' existential representation for NSError subcl…
DougGregor Aug 2, 2016
fe2f9ce
[NSError bridging] Use embedded NSError when erasing types to Error e…
DougGregor Aug 3, 2016
a0128f9
[NSError bridging] Extract embedded NSError from an Error consistently.
DougGregor Aug 3, 2016
60d0f47
[NSError bridging] Rename runtime entry points for _getErrorEmbeddedN…
DougGregor Aug 3, 2016
171a18c
[Runtime] Extract an embedded NSError when dynamic casting to an Erro…
DougGregor Aug 4, 2016
a1e2d4e
stdlib/Foundation: optimize the NSDictionary and NSSet copy-constructors
eeckstein Aug 3, 2016
b38dce8
Merge pull request #3984 from apple/swift3-spritekit-fixes
tkremenek Aug 4, 2016
7d2ee67
rdar://problem/27541751: Temporarily disable test.
DougGregor Aug 4, 2016
553c804
[Preset] SR-2232 Update preset to use build-swift-static-sdk-overlay
shahmishal Aug 3, 2016
967a1d4
Merge pull request #3976 from DougGregor/swift-3-nserror-wrapping
DougGregor Aug 4, 2016
5cf855d
Make bridged String and collection types conform to CVarArg.
jckarter Aug 3, 2016
091b910
[ClangImporter] Preserve macros from all implicit submodules. (#3983)
jrose-apple Aug 4, 2016
e860c44
Merge pull request #3994 from apple/fix-SR-2232-swift-3.0-branch
shahmishal Aug 4, 2016
6a127fd
Dependency analysis: treat member operators as top-level "provides". …
jrose-apple Aug 4, 2016
c8f3901
Merge pull request #3992 from apple/swift3-nsdictionary-nsset-optimiz…
tkremenek Aug 4, 2016
d1c3264
Improve Foundation overlay to handle bridging subscripts and dictiona…
jckarter Aug 2, 2016
52bed3b
[ClangImporter] Don't bridge weak and unsafe_unretained properties to…
jrose-apple Aug 4, 2016
938b12b
[SceneKit] Explicitly control some renames
milseman Aug 3, 2016
a4a9b05
[SceneKit] more tests on new names
milseman Aug 4, 2016
fc89c7e
[SceneKit] add explicit availability to test, makes it less fragile
milseman Aug 4, 2016
cf2d718
[SceneKit] test only on macOS
milseman Aug 4, 2016
89a414d
Remove redundant tests for SpriteKit
gribozavr Aug 4, 2016
610dc14
stdlib: add tests for Stride types on integers
gribozavr Aug 4, 2016
593915a
StdlibCollectionUnittest: reduce boilerplate
gribozavr Aug 4, 2016
a88d532
[FixCode] Using coercion (as) instead of forced-coercion (as!) when t…
nkcsgexi Aug 4, 2016
2b85c6d
Merge pull request #3973 from nkcsgexi/xge/swift-3.0-branch
tkremenek Aug 4, 2016
8a7cf3c
Merge pull request #4003 from jckarter/foundation-overlay-post-0072-3.0
tkremenek Aug 4, 2016
b1be3d2
Stop ad-hoc signing stdlib dylibs for benchmarks
lplarson Aug 3, 2016
5e91357
Merge pull request #4011 from nkcsgexi/xge/fixit-3.0
tkremenek Aug 4, 2016
d4182c0
Don't emit @noescape error on every "@autoclosure is now a ..." error
benlangmuir Aug 4, 2016
5979039
Merge pull request #4001 from jrose-apple/swift-3-macros-and-submodules
tkremenek Aug 4, 2016
c0ffd05
Convert CoreGraphics tests to StdlibUnittest
gribozavr Aug 4, 2016
60033a2
Merge pull request #4005 from milseman/3_0_scenekit
tkremenek Aug 4, 2016
6e7a281
Runtime: Handle universal bridging of class metatypes.
jckarter Aug 4, 2016
c8659ca
Runtime: Handle Protocol objects through universal bridging too.
jckarter Aug 4, 2016
78557ae
Merge pull request #4024 from jckarter/metatype-universal-bridging-3.0
tkremenek Aug 5, 2016
13b6429
Force LLVM to preserve value names in the same situations where we em…
rjmccall Aug 5, 2016
8c8ee7f
Runtime: Fix undersized allocation for out-of-line optional cast result.
jckarter Aug 4, 2016
31c6b28
Merge pull request #4010 from apple/swift3-test-improvements
tkremenek Aug 5, 2016
68eaccb
Merge pull request #4037 from jckarter/27671131-3.0
tkremenek Aug 5, 2016
489b5be
Merge pull request #4002 from jrose-apple/swift-3-operator-dependencies
tkremenek Aug 5, 2016
90089e3
SILOptimizer: fixed bugs which cause memory leaks.
eeckstein Aug 4, 2016
837ea08
Merge pull request #4017 from benlangmuir/autoclosure-noescape-diag-3.0
tkremenek Aug 5, 2016
0003a7b
Merge pull request #4035 from rjmccall/preserve-value-names-3.0
tkremenek Aug 5, 2016
2c26f2b
Merge pull request #4006 from jrose-apple/swift-3-weak-properties-are…
Aug 5, 2016
569a2d2
Merge pull request #4014 from lplarson/3.0-branch-dont-adhoc-sign-ben…
lplarson Aug 5, 2016
b6eb0a0
Add implicit conversions and casts from T:Hashable <-> AnyHashable.
rjmccall Aug 4, 2016
5291dc6
Update CHANGELOG for SE-0115
CodaFi Aug 3, 2016
9ade20a
Fix the source ranges of ill-formed precedence groups.
rjmccall Aug 5, 2016
f1fd488
Merge pull request #4000 from jckarter/cvararg-post-0072-3.0
tkremenek Aug 5, 2016
0e246a4
[Serialization] Fix deserialization crash occurring when a mixed fram…
akyrtzi Aug 4, 2016
d187455
[test] Fix test failure on non x86_64 target in failed-clang-module t…
rintaro Aug 5, 2016
45be5fe
[noescape by default] Add @autoclosure @escaping syntax
milseman Aug 4, 2016
d6e2d59
[noescape by default] drop @noescape from stdlib
milseman Aug 4, 2016
d51b276
[noescape by default] purge tests of needless @noescape
milseman Aug 4, 2016
47e37fa
[noescape by default] drop superfluous @noescape from validation suite
milseman Aug 4, 2016
d80ae1f
[noescape by default] Emit deprecation warning/fixit for @noescape
milseman Aug 4, 2016
e2121fd
[noescape by default] Migration should apply @noescape deprecation fi…
milseman Aug 4, 2016
d031e5a
Adjust diagnostic: s/@noescape/non-escaping/
milseman Aug 5, 2016
6ba1bb7
[noescape by default] Incorporate Slav's feedback
milseman Aug 5, 2016
b3b6b74
Fix crash during type checking when adding members to an extension.
rudkx Aug 4, 2016
44fe446
Increase the amount of memory we allow the constraint solver to use.
rudkx Aug 2, 2016
819cd0d
[Fix-it] Support defaulted and variadic arguments in renamed fix-it (…
jrose-apple Aug 5, 2016
82f0260
Merge pull request #4049 from rjmccall/invalid-precedencegroup-range
tkremenek Aug 5, 2016
6f165cc
Merge pull request #4047 from jckarter/anyhashable-conversions-3.0
DougGregor Aug 5, 2016
a172ef4
[NFC] ConstrainSystem::getComputedBindings() is dead. Kill it.
DougGregor Aug 4, 2016
63d65b0
Look through type sugar in ConstraintSystem::openBindingType().
DougGregor Aug 4, 2016
66d45aa
[Constraint solver] Try ‘defaultable’ bindings even if there are othe…
DougGregor Aug 4, 2016
1b1d29b
[Constraint solver] Introduce a *trivial* 'meet' operation for types.
DougGregor Aug 5, 2016
674e16e
Add a bit and some diagnostics logic to help with the ongoing id-as-a…
lattner Aug 3, 2016
133d5a7
minor fix to a setter, NFC.
lattner Aug 3, 2016
2583e2c
[Type system] Infer 'Any' for array elements and dictionary values an…
DougGregor Aug 4, 2016
d3eabb0
[Type checker] Don't merge dictionary key type variables with differe…
DougGregor Aug 5, 2016
46622c3
Merge pull request #4045 from eeckstein/leak3
tkremenek Aug 6, 2016
8af213a
Merge pull request #4039 from aciidb0mb3r/pty_glibc
tkremenek Aug 6, 2016
2a87c50
Merge pull request #4053 from rudkx/fix-27671033
tkremenek Aug 6, 2016
9cefeab
Merge pull request #4054 from rudkx/increase-solver-memory
tkremenek Aug 6, 2016
bb1bc65
Merge pull request #4052 from milseman/3_0_noescape_by_default
tkremenek Aug 6, 2016
977e687
Merge pull request #4050 from akyrtzi/deserialization-crash-3-27709042
tkremenek Aug 6, 2016
41dd243
Add some availability attributes for UnsafePointer conversion.
atrick Aug 3, 2016
5e5a623
Merge pull request #4064 from atrick/swift-3.0-branch
tkremenek Aug 6, 2016
c102e91
Merge pull request #4061 from DougGregor/existential-collection-liter…
tkremenek Aug 6, 2016
4c399e0
StdlibUnittest: add checkStrideable()
gribozavr Aug 7, 2016
68afeb9
stdlib: fix incorrect distance measurement between UTF-16 indices
gribozavr Aug 7, 2016
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@ Note: This is in reverse chronological order, so newer entries are added to the

Swift 3.0
---------

* [SE-103](https://github.com/apple/swift-evolution/blob/master/proposals/0103-make-noescape-default.md)

Closure parameters are non-escaping by default, rather than explicitly being
annotated `@noescape`. Use `@escaping` to say that a closure parameter may
escape. `@autoclosure(escaping)` is now spelled `@autoclosure @escaping`.
`@noescape` and `@autoclosure(escaping)` are deprecated.

* [SE-0115](https://github.com/apple/swift-evolution/blob/master/proposals/0115-literal-syntax-protocols.md)

To clarify the role of `*LiteralConvertible` protocols, they have
been renamed to `ExpressibleBy*Literal`. No requirements of these
protocols have changed.

* [SE-0107](https://github.com/apple/swift-evolution/blob/master/proposals/0107-unsaferawpointer.md)

An `Unsafe[Mutable]RawPointer` type has been introduced. It
Expand Down
95 changes: 95 additions & 0 deletions apinotes/SceneKit.apinotes
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,98 @@ Protocols:
SwiftPrivate: true
MethodKind: Instance

#
# New wrapper types will be made for these typedefs, and we want to nest them
#
Typedefs:
- Name: SCNGeometrySourceSemantic
SwiftName: SCNGeometrySource.Semantic
- Name: SCNLightType
SwiftName: SCNLight.LightType
- Name: SCNLightingModel
SwiftName: SCNMaterial.LightingModel
- Name: SCNParticleProperty
SwiftName: SCNParticleSystem.ParticleProperty
- Name: SCNPhysicsShapeOption
SwiftName: SCNPhysicsShape.Option
- Name: SCNPhysicsShapeType
SwiftName: SCNPhysicsShape.ShapeType
- Name: SCNPhysicsTestOption
SwiftName: SCNPhysicsWorld.TestOption
- Name: SCNPhysicsTestSearchMode
SwiftName: SCNPhysicsWorld.TestSearchMode
- Name: SCNSceneAttribute
SwiftName: SCNScene.Attribute
- Name: SCNSceneSourceAnimationImportPolicy
SwiftName: SCNSceneSource.AnimationImportPolicy
- Name: SCNSceneSourceLoadingOption
SwiftName: SCNSceneSource.LoadingOption
- Name: SCNViewOption
SwiftName: SCNView.Option

#
# Name overrides for globals that we will be nesting onto our new wrapper types
#
Globals:
- Name: SCNHitTestFirstFoundOnlyKey
SwiftName: SCNHitTestOption.firstFoundOnly
- Name: SCNHitTestSortResultsKey
SwiftName: SCNHitTestOption.sortResults
- Name: SCNHitTestClipToZRangeKey
SwiftName: SCNHitTestOption.clipToZRange
- Name: SCNHitTestBackFaceCullingKey
SwiftName: SCNHitTestOption.backFaceCulling
- Name: SCNHitTestBoundingBoxOnlyKey
SwiftName: SCNHitTestOption.boundingBoxOnly
- Name: SCNHitTestIgnoreChildNodesKey
SwiftName: SCNHitTestOption.ignoreChildNodes
- Name: SCNHitTestRootNodeKey
SwiftName: SCNHitTestOption.rootNode
- Name: SCNHitTestIgnoreHiddenNodesKey
SwiftName: SCNHitTestOption.ignoreHiddenNodes
- Name: SCNPhysicsShapeTypeKey
SwiftName: SCNPhysicsShape.Option.type
- Name: SCNPhysicsShapeKeepAsCompoundKey
SwiftName: SCNPhysicsShape.Option.keepAsCompound
- Name: SCNPhysicsShapeScaleKey
SwiftName: SCNPhysicsShape.Option.scale
- Name: SCNPhysicsTestCollisionBitMaskKey
SwiftName: SCNPhysicsWorld.TestOption.collisionBitMask
- Name: SCNPhysicsTestSearchModeKey
SwiftName: SCNPhysicsWorld.TestOption.searchMode
- Name: SCNPhysicsTestBackfaceCullingKey
SwiftName: SCNPhysicsWorld.TestOption.backfaceCulling
- Name: SCNSceneStartTimeAttributeKey
SwiftName: SCNScene.Attribute.startTime
- Name: SCNSceneEndTimeAttributeKey
SwiftName: SCNScene.Attribute.endTime
- Name: SCNSceneFrameRateAttributeKey
SwiftName: SCNScene.Attribute.frameRate
- Name: SCNSceneUpAxisAttributeKey
SwiftName: SCNScene.Attribute.upAxis
- Name: SCNSceneSourceCreateNormalsIfAbsentKey
SwiftName: SCNSceneSource.LoadingOption.createNormalsIfAbsent
- Name: SCNSceneSourceCheckConsistencyKey
SwiftName: SCNSceneSource.LoadingOption.checkConsistency
- Name: SCNSceneSourceFlattenSceneKey
SwiftName: SCNSceneSource.LoadingOption.flattenScene
- Name: SCNSceneSourceUseSafeModeKey
SwiftName: SCNSceneSource.LoadingOption.useSafeMode
- Name: SCNSceneSourceAssetDirectoryURLsKey
SwiftName: SCNSceneSource.LoadingOption.assetDirectoryURLs
- Name: SCNSceneSourceOverrideAssetURLsKey
SwiftName: SCNSceneSource.LoadingOption.overrideAssetURLs
- Name: SCNSceneSourceStrictConformanceKey
SwiftName: SCNSceneSource.LoadingOption.strictConformance
- Name: SCNSceneSourceConvertUnitsToMetersKey
SwiftName: SCNSceneSource.LoadingOption.convertUnitsToMeters
- Name: SCNSceneSourceConvertToYUpKey
SwiftName: SCNSceneSource.LoadingOption.convertToYUp
- Name: SCNSceneSourceAnimationImportPolicyKey
SwiftName: SCNSceneSource.LoadingOption.animationImportPolicy
- Name: SCNPreferredRenderingAPIKey
SwiftName: SCNView.Option.preferredRenderingAPI
- Name: SCNPreferredDeviceKey
SwiftName: SCNView.Option.preferredDevice
- Name: SCNPreferLowPowerDeviceKey
SwiftName: SCNView.Option.preferLowPowerDevice
14 changes: 0 additions & 14 deletions benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ function (swift_benchmark_compile_archopts)
DEPENDS
${bench_library_objects} ${SWIFT_BENCH_OBJFILES}
"${objcfile}"
"adhoc-sign-swift-stdlib-${BENCH_COMPILE_ARCHOPTS_PLATFORM}"
COMMAND
"${CLANG_EXEC}"
"-fno-stack-protector"
Expand Down Expand Up @@ -356,19 +355,6 @@ function(swift_benchmark_compile)
endforeach()
endif()

add_custom_target("copy-swift-stdlib-${SWIFT_BENCHMARK_COMPILE_PLATFORM}"
DEPENDS ${stdlib_dependencies}
COMMAND
"${CMAKE_COMMAND}" "-E" "copy_directory"
"${SWIFT_LIBRARY_PATH}/${SWIFT_BENCHMARK_COMPILE_PLATFORM}"
"${benchmark-lib-swift-dir}/${SWIFT_BENCHMARK_COMPILE_PLATFORM}")

add_custom_target("adhoc-sign-swift-stdlib-${SWIFT_BENCHMARK_COMPILE_PLATFORM}"
DEPENDS "copy-swift-stdlib-${SWIFT_BENCHMARK_COMPILE_PLATFORM}"
COMMAND
"codesign" "-f" "-s" "-"
"${benchmark-lib-swift-dir}/${SWIFT_BENCHMARK_COMPILE_PLATFORM}/*.dylib" "2>/dev/null")

set(platform_executables)
foreach(arch ${${SWIFT_BENCHMARK_COMPILE_PLATFORM}_arch})
set(platform_executables)
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ class ASTContext {
PrecedenceGroupDecl *right) const;

/// Retrieve the declaration of Swift.Error.
NominalTypeDecl *getErrorDecl() const;
ProtocolDecl *getErrorDecl() const;
CanType getExceptionType() const;

/// Retrieve the declaration of Swift.Bool.
Expand Down
6 changes: 6 additions & 0 deletions include/swift/AST/DiagnosticsParse.def
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,12 @@ ERROR(attr_noescape_conflicts_escaping_autoclosure,none,
ERROR(attr_noescape_implied_by_autoclosure,none,
"@noescape is implied by @autoclosure and should not be "
"redundantly specified", ())
WARNING(attr_autoclosure_escaping_deprecated,none,
"@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead",
())
WARNING(attr_noescape_deprecated,none,
"@noescape is the default and is deprecated",
())

// convention
ERROR(convention_attribute_expected_lparen,none,
Expand Down
19 changes: 17 additions & 2 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ ERROR(cannot_call_with_params, none,
"cannot invoke %select{|initializer for type }2'%0' with an argument list"
" of type '%1'", (StringRef, StringRef, bool))

NOTE(pointer_init_add_mutating,none,
"do you want to add 'mutating'", ())
ERROR(expected_do_in_statement,none,
"expected 'do' keyword to designate a block of statements", ())

Expand Down Expand Up @@ -2095,7 +2097,11 @@ ERROR(discard_expr_outside_of_assignment,none,
())
ERROR(inout_expr_outside_of_call,none,
"'&' can only appear immediately in a call argument list", ())

ERROR(collection_literal_heterogenous,none,
"heterogenous collection literal could only be inferred to %0; add"
" explicit type annotation if this is intentional", (Type))
ERROR(collection_literal_empty,none,
"empty collection literal requires an explicit type", ())

ERROR(unresolved_member_no_inference,none,
"reference to member %0 cannot be resolved without a contextual type",
Expand Down Expand Up @@ -2233,7 +2239,7 @@ ERROR(closure_implicit_capture_mutating_self,none,
())
ERROR(nested_function_with_implicit_capture_argument,none,
"nested function with %select{an |}0implicitly captured inout "
"parameter%select{|s}0 can only be used as a @noescape argument", (bool))
"parameter%select{|s}0 can only be used as a non-escaping argument", (bool))
ERROR(nested_function_escaping_inout_capture,none,
"nested function cannot capture inout parameter and escape", ())

Expand Down Expand Up @@ -2310,6 +2316,15 @@ ERROR(closure_noescape_use,none,
ERROR(decl_closure_noescape_use,none,
"declaration closing over non-escaping parameter %0 may allow it to escape",
(Identifier))
ERROR(passing_noescape_to_escaping,none,
"passing non-escaping parameter %0 to function expecting an @escaping closure",
(Identifier))
ERROR(assigning_noescape_to_escaping,none,
"assigning non-escaping parameter %0 to an @escaping closure",
(Identifier))
ERROR(general_noescape_to_escaping,none,
"using non-escaping parameter %0 in a context expecting an @escaping closure",
(Identifier))

ERROR(capture_across_type_decl,none,
"%0 declaration cannot close over value %1 defined in outer scope",
Expand Down
33 changes: 32 additions & 1 deletion include/swift/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,10 @@ class CollectionExpr : public Expr {

Expr *SemanticExpr = nullptr;

/// True if the type of this collection expr was inferred by the collection
/// fallback type, like [Any].
bool IsTypeDefaulted = false;

protected:
CollectionExpr(ExprKind Kind, SourceLoc LBracketLoc,
MutableArrayRef<Expr*> Elements,
Expand All @@ -2157,6 +2161,9 @@ class CollectionExpr : public Expr {
void setElement(unsigned i, Expr *E) { Elements[i] = E; }
unsigned getNumElements() const { return Elements.size(); }

bool isTypeDefaulted() const { return IsTypeDefaulted; }
void setIsTypeDefaulted(bool value = true) { IsTypeDefaulted = value; }

SourceLoc getLBracketLoc() const { return LBracketLoc; }
SourceLoc getRBracketLoc() const { return RBracketLoc; }
SourceRange getSourceRange() const {
Expand Down Expand Up @@ -3010,12 +3017,36 @@ class ErasureExpr : public ImplicitConversionExpr {
ArrayRef<ProtocolConformanceRef> getConformances() const {
return Conformances;
}

static bool classof(const Expr *E) {
return E->getKind() == ExprKind::Erasure;
}
};

/// AnyHashableErasureExpr - Perform type erasure by converting a value
/// to AnyHashable type.
///
/// The type of the sub-expression should always be a type that implements
/// the Hashable protocol.
class AnyHashableErasureExpr : public ImplicitConversionExpr {
ProtocolConformanceRef Conformance;

public:
AnyHashableErasureExpr(Expr *subExpr, Type type,
ProtocolConformanceRef conformance)
: ImplicitConversionExpr(ExprKind::AnyHashableErasure, subExpr, type),
Conformance(conformance) {}

/// \brief Retrieve the mapping specifying how the type of the
/// subexpression conforms to the Hashable protocol.
ProtocolConformanceRef getConformance() const {
return Conformance;
}

static bool classof(const Expr *E) {
return E->getKind() == ExprKind::AnyHashableErasure;
}
};
/// UnresolvedSpecializeExpr - Represents an explicit specialization using
/// a type parameter list (e.g. "Vector<Int>") that has not been resolved.
class UnresolvedSpecializeExpr : public Expr {
Expand Down
1 change: 1 addition & 0 deletions include/swift/AST/ExprNodes.def
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ ABSTRACT_EXPR(ImplicitConversion, Expr)
EXPR(MetatypeConversion, ImplicitConversionExpr)
EXPR(CollectionUpcastConversion, ImplicitConversionExpr)
EXPR(Erasure, ImplicitConversionExpr)
EXPR(AnyHashableErasure, ImplicitConversionExpr)
EXPR(DerivedToBase, ImplicitConversionExpr)
EXPR(ArchetypeToSuper, ImplicitConversionExpr)
EXPR(InjectIntoOptional, ImplicitConversionExpr)
Expand Down
12 changes: 12 additions & 0 deletions include/swift/AST/IRGenOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,18 @@ class IRGenOptions {
Hash = (Hash << 1) | DisableLLVMARCOpts;
return Hash;
}

/// Should LLVM IR value names be emitted and preserved?
bool shouldProvideValueNames() const {
// If the command line contains an explicit request about whether to add
// LLVM value names, honor it. Otherwise, add value names only if the
// final result is textual LLVM assembly.
if (HasValueNamesSetting) {
return ValueNames;
} else {
return OutputKind == IRGenOutputKind::LLVMAssembly;
}
}
};

} // end namespace swift
Expand Down
4 changes: 4 additions & 0 deletions include/swift/AST/KnownDecls.def
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ FUNC_DECL(ConditionallyBridgeFromObjectiveCBridgeable,
FUNC_DECL(BridgeAnythingToObjectiveC,
"_bridgeAnythingToObjectiveC")

FUNC_DECL(ConvertToAnyHashable, "_convertToAnyHashable")

FUNC_DECL(DidEnterMain, "_stdlib_didEnterMain")
FUNC_DECL(DiagnoseUnexpectedNilOptional, "_diagnoseUnexpectedNilOptional")

FUNC_DECL(GetErrorEmbeddedNSError, "_stdlib_getErrorEmbeddedNSError")

#undef FUNC_DECL
26 changes: 25 additions & 1 deletion include/swift/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,30 @@ class Type {

/// Get the canonical type, or return null if the type is null.
CanType getCanonicalTypeOrNull() const; // in Types.h


/// Computes the meet between two types.
///
/// The meet of two types is the most specific type that is a supertype of
/// both \c type1 and \c type2. For example, given a simple class hierarchy as
/// follows:
///
/// \code
/// class A { }
/// class B : A { }
/// class C : A { }
/// class D { }
/// \endcode
///
/// The meet of B and C is A, the meet of A and B is A. However, there is no
/// meet of D and A (or D and B, or D and C) because there is no common
/// superclass. One would have to jump to an existential (e.g., \c AnyObject)
/// to find a common type.
///
/// \returns the meet of the two types, if there is a concrete type that can
/// express the meet, or a null type if the only meet would be a more-general
/// existential type (e.g., \c Any).
static Type meet(Type type1, Type type2);

private:
// Direct comparison is disabled for types, because they may not be canonical.
void operator==(Type T) const = delete;
Expand Down Expand Up @@ -432,6 +455,7 @@ class CanGenericSignature {
return Signature;
}
};

} // end namespace swift

namespace llvm {
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ namespace swift {

/// \brief The upper bound, in bytes, of temporary data that can be
/// allocated by the constraint solver.
unsigned SolverMemoryThreshold = 15000000;
unsigned SolverMemoryThreshold = 33554432; /* 32 * 1024 * 1024 */

/// \brief Perform all dynamic allocations using malloc/free instead of
/// optimized custom allocator, so that memory debugging tools can be used.
Expand Down
4 changes: 4 additions & 0 deletions include/swift/Runtime/Metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -1980,6 +1980,10 @@ struct TargetValueMetadata : public TargetMetadata<Runtime> {
return (asWords + Description->GenericParams.Offset);
}

const TargetNominalTypeDescriptor<Runtime> *getDescription() const {
return Description.get();
}

StoredPointer offsetToDescriptorOffset() const {
return offsetof(TargetValueMetadata<Runtime>, Description);
}
Expand Down
11 changes: 8 additions & 3 deletions include/swift/SIL/SILCloner.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ class SILCloner : protected SILVisitor<ImplClass> {
SILBuilder &getBuilder() { return Builder; }

protected:
void beforeVisit(ValueBase *V) {
if (auto I = dyn_cast<SILInstruction>(V)) {
// Update the set of available opened archetypes with the opened
// archetypes used by the current instruction.
doPreProcess(I);
}
}

#define VALUE(CLASS, PARENT) \
void visit##CLASS(CLASS *I) { \
llvm_unreachable("SILCloner visiting non-instruction?"); \
Expand Down Expand Up @@ -380,9 +388,6 @@ SILCloner<ImplClass>::visitSILBasicBlock(SILBasicBlock* BB) {
SILFunction &F = getBuilder().getFunction();
// Iterate over and visit all instructions other than the terminator to clone.
for (auto I = BB->begin(), E = --BB->end(); I != E; ++I) {
// Update the set of available opened archetypes with the opened archetypes
// used by the current instruction.
doPreProcess(&*I);
asImpl().visit(&*I);
}
// Iterate over successors to do the depth-first search.
Expand Down
Loading