Skip to content

Commit fd87717

Browse files
committed
---
yaml --- r: 347029 b: refs/heads/master c: e9a456c h: refs/heads/master i: 347027: b5e6b47
1 parent 8b95c47 commit fd87717

File tree

8 files changed

+29
-21
lines changed

8 files changed

+29
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 4c4963aebd0c5e462f3a2f6f25f9452295459aa3
2+
refs/heads/master: e9a456ce5f7191f5b067c444367534c63e032596
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/stdlib/public/Darwin/os/os.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
if (_os_log_encode(buf, fmt, args, saved_errno, &ob)) {
8888
if (os_log_pack_send) {
8989
size_t sz = _os_log_pack_size(ob.ob_len);
90-
uint8_t _Alignas(os_log_pack_s) buf[sz];
91-
os_log_pack_t p = (os_log_pack_t)buf;
90+
uint8_t _Alignas(os_log_pack_s) pack[sz];
91+
os_log_pack_t p = (os_log_pack_t)pack;
9292
/*
9393
* _os_log_encode has already packed `saved_errno` into a
9494
* OSLF_CMD_TYPE_SCALAR command as the OSLF_CMD_TYPE_ERRNO does not
@@ -136,8 +136,8 @@
136136
_os_log_encode(buf, fmt, args, saved_errno, &ob);
137137
if (encoded) {
138138
size_t sz = _os_log_pack_size(ob.ob_len);
139-
uint8_t _Alignas(os_log_pack_s) buf[sz];
140-
os_log_pack_t p = (os_log_pack_t)buf;
139+
uint8_t _Alignas(os_log_pack_s) pack[sz];
140+
os_log_pack_t p = (os_log_pack_t)pack;
141141
uint8_t *ptr = _os_signpost_pack_fill(p, sz, saved_errno, dso,
142142
fmt, spnm, spid);
143143
p->olp_pc = ra;

trunk/stdlib/public/SwiftShims/GlobalObjects.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,6 @@ static_assert(
102102
4 * sizeof(__swift_intptr_t) + sizeof(__swift_int64_t),
103103
"_SwiftSetBodyStorage has unexpected size");
104104

105-
static_assert(std::is_pod<_SwiftEmptyArrayStorage>::value,
106-
"empty array type should be POD");
107-
static_assert(std::is_pod<_SwiftEmptyDictionarySingleton>::value,
108-
"empty dictionary type should be POD");
109-
static_assert(std::is_pod<_SwiftEmptySetSingleton>::value,
110-
"empty set type should be POD");
111-
112105
}} // extern "C", namespace swift
113106
#endif
114107

trunk/stdlib/public/SwiftShims/HeapObject.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ __swift_size_t swift_weakRetainCount(HeapObject *obj);
9393
#endif
9494

9595
#ifdef __cplusplus
96-
static_assert(swift::IsTriviallyConstructible<HeapObject>::value,
97-
"HeapObject must be trivially initializable");
9896
static_assert(std::is_trivially_destructible<HeapObject>::value,
9997
"HeapObject must be trivially destructible");
10098

trunk/stdlib/public/SwiftShims/RefCount.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,8 +1188,6 @@ class RefCounts {
11881188
typedef RefCounts<InlineRefCountBits> InlineRefCounts;
11891189
typedef RefCounts<SideTableRefCountBits> SideTableRefCounts;
11901190

1191-
static_assert(swift::IsTriviallyConstructible<InlineRefCounts>::value,
1192-
"InlineRefCounts must be trivially initializable");
11931191
static_assert(std::is_trivially_destructible<InlineRefCounts>::value,
11941192
"InlineRefCounts must be trivially destructible");
11951193

trunk/stdlib/public/core/Optional.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ func _diagnoseUnexpectedNilOptional(_filenameStart: Builtin.RawPointer,
300300
_filenameIsASCII: Builtin.Int1,
301301
_line: Builtin.Word,
302302
_isImplicitUnwrap: Builtin.Int1) {
303-
_preconditionFailure(
303+
// Cannot use _preconditionFailure as the file and line info would not be
304+
// printed.
305+
preconditionFailure(
304306
Bool(_isImplicitUnwrap)
305307
? "Unexpectedly found nil while implicitly unwrapping an Optional value"
306308
: "Unexpectedly found nil while unwrapping an Optional value",

trunk/stdlib/public/runtime/HeapObject.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ static HeapObject *_swift_allocObject_(HeapMetadata const *metadata,
8484
assert(isAlignmentMask(requiredAlignmentMask));
8585
auto object = reinterpret_cast<HeapObject *>(
8686
swift_slowAlloc(requiredSize, requiredAlignmentMask));
87-
// FIXME: this should be a placement new but that adds a null check
88-
object->metadata = metadata;
89-
object->refCounts.init();
87+
88+
// NOTE: this relies on the C++17 guaranteed semantics of no null-pointer
89+
// check on the placement new allocator which we have observed on Windows,
90+
// Linux, and macOS.
91+
new (object) HeapObject(metadata);
9092

9193
// If leak tracking is enabled, start tracking this object.
9294
SWIFT_LEAKS_START_TRACKING_OBJECT(object);

trunk/test/stdlib/OptionalTraps.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,22 @@ OptionalTraps.test("UnwrapNone")
2525
{ _isFastAssertConfiguration() },
2626
reason: "this trap is not guaranteed to happen in -Ounchecked"))
2727
.code {
28-
var a: AnyObject? = returnNil()
28+
let a: AnyObject? = returnNil()
29+
expectCrashLater()
30+
let unwrapped: AnyObject = a!
31+
_blackHole(unwrapped)
32+
}
33+
34+
OptionalTraps.test("UnwrapNone/location")
35+
.skip(.custom(
36+
{ _isFastAssertConfiguration() },
37+
reason: "this trap is not guaranteed to happen in -Ounchecked"))
38+
.crashOutputMatches(_isDebugAssertConfiguration()
39+
? "test/stdlib/OptionalTraps.swift, line 45"
40+
: "")
41+
.code {
42+
expectCrashLater()
43+
let a: AnyObject? = returnNil()
2944
expectCrashLater()
3045
let unwrapped: AnyObject = a!
3146
_blackHole(unwrapped)

0 commit comments

Comments
 (0)