Skip to content

Commit 8124bc7

Browse files
authored
---
yaml --- r: 341750 b: refs/heads/rxwei-patch-1 c: 70a79c4 h: refs/heads/master
1 parent edd5861 commit 8124bc7

File tree

7 files changed

+19
-47
lines changed

7 files changed

+19
-47
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: 84f9eed9c8559deb0e55c73ccc690cafa8f8f65e
1018+
refs/heads/rxwei-patch-1: 70a79c4dc5874dc4728d338bebbf731d92f6245f
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/include/swift/AST/SimpleRequest.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ namespace detail {
113113

114114
/// Extract the first, nearest source location from a tuple.
115115
template<unsigned Index, typename ...Types,
116-
typename = typename std::enable_if<sizeof...(Types) - Index
117-
? true
118-
: false>::type>
116+
typename = typename std::enable_if<(Index < sizeof...(Types))>::type>
119117
SourceLoc extractNearestSourceLocTuple(const std::tuple<Types...> &value) {
120118
SourceLoc loc = maybeExtractNearestSourceLoc(std::get<Index>(value));
121119
if (loc.isValid())

branches/rxwei-patch-1/lib/Sema/TypeCheckProtocol.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5473,15 +5473,3 @@ void TypeChecker::inferDefaultWitnesses(ProtocolDecl *proto) {
54735473
req.getFirstType()->getCanonicalType(), requirementProto, *conformance);
54745474
}
54755475
}
5476-
5477-
Type TypeChecker::getWitnessType(Type type, ProtocolDecl *protocol,
5478-
ProtocolConformanceRef conformance,
5479-
Identifier name,
5480-
Diag<> brokenProtocolDiag) {
5481-
Type ty = conformance.getTypeWitnessByName(type, name);
5482-
if (!ty &&
5483-
!(conformance.isConcrete() && conformance.getConcrete()->isInvalid()))
5484-
diagnose(protocol->getLoc(), brokenProtocolDiag);
5485-
5486-
return (!ty || ty->hasError()) ? Type() : ty;
5487-
}

branches/rxwei-patch-1/lib/Sema/TypeCheckStmt.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -763,9 +763,8 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
763763
return nullptr;
764764
S->setSequenceConformance(conformance);
765765

766-
iteratorTy = TC.getWitnessType(sequenceType, sequenceProto, *conformance,
767-
TC.Context.Id_Iterator,
768-
diag::sequence_protocol_broken);
766+
iteratorTy = conformance->getTypeWitnessByName(sequenceType,
767+
TC.Context.Id_Iterator);
769768
if (!iteratorTy)
770769
return nullptr;
771770

@@ -796,7 +795,7 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
796795
// be around.
797796
auto nextResultType =
798797
OptionalType::get(conformance->getTypeWitnessByName(
799-
sequenceType, DC->getASTContext().Id_Element))
798+
sequenceType, TC.Context.Id_Element))
800799
->getCanonicalType();
801800
auto *genBinding = PatternBindingDecl::createImplicit(
802801
TC.Context, StaticSpellingKind::None, genPat,
@@ -829,9 +828,8 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
829828
if (!genConformance)
830829
return nullptr;
831830

832-
Type elementTy = TC.getWitnessType(iteratorTy, iteratorProto,
833-
*genConformance, TC.Context.Id_Element,
834-
diag::iterator_protocol_broken);
831+
Type elementTy = genConformance->getTypeWitnessByName(iteratorTy,
832+
TC.Context.Id_Element);
835833
if (!elementTy)
836834
return nullptr;
837835

branches/rxwei-patch-1/lib/Sema/TypeChecker.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,26 +1536,6 @@ class TypeChecker final : public LazyResolver {
15361536
/// array literals exist.
15371537
bool requireArrayLiteralIntrinsics(SourceLoc loc);
15381538

1539-
/// Retrieve the witness type with the given name.
1540-
///
1541-
/// \param type The type that conforms to the given protocol.
1542-
///
1543-
/// \param protocol The protocol through which we're looking.
1544-
///
1545-
/// \param conformance The protocol conformance.
1546-
///
1547-
/// \param name The name of the associated type.
1548-
///
1549-
/// \param brokenProtocolDiag Diagnostic to emit if the type cannot be
1550-
/// accessed.
1551-
///
1552-
/// \return the witness type, or null if an error occurs or the type
1553-
/// returned would contain an ErrorType.
1554-
Type getWitnessType(Type type, ProtocolDecl *protocol,
1555-
ProtocolConformanceRef conformance,
1556-
Identifier name,
1557-
Diag<> brokenProtocolDiag);
1558-
15591539
/// Build a call to the witness with the given name and arguments.
15601540
///
15611541
/// \param base The base expression, whose witness will be invoked.

branches/rxwei-patch-1/stdlib/public/SwiftShims/RefCount.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,7 @@ _Static_assert(_Alignof(InlineRefCounts) == _Alignof(__swift_uintptr_t),
14961496
#endif
14971497

14981498
#if defined(_WIN32) && defined(_M_ARM64)
1499+
#if defined(__cplusplus)
14991500
namespace std {
15001501
template <>
15011502
inline void _Atomic_storage<swift::SideTableRefCountBits, 16>::_Unlock() const noexcept {
@@ -1505,5 +1506,6 @@ inline void _Atomic_storage<swift::SideTableRefCountBits, 16>::_Unlock() const n
15051506
}
15061507
}
15071508
#endif
1509+
#endif
15081510

15091511
#endif

branches/rxwei-patch-1/stdlib/public/runtime/Metadata.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "llvm/Support/PointerLikeTypeTraits.h"
3232
#include <algorithm>
3333
#include <cctype>
34+
#include <cinttypes>
3435
#include <condition_variable>
3536
#include <new>
3637
#include <unordered_set>
@@ -3897,10 +3898,15 @@ void _swift_debug_verifyTypeLayoutAttribute(Metadata *type,
38973898
size_t size,
38983899
const char *description) {
38993900
auto presentValue = [&](const void *value) {
3900-
if (size < sizeof(long long)) {
3901-
long long intValue = 0;
3902-
memcpy(&intValue, value, size);
3903-
fprintf(stderr, "%lld (%#llx)\n ", intValue, intValue);
3901+
if (size <= sizeof(uint64_t)) {
3902+
uint64_t intValue = 0;
3903+
auto ptr = reinterpret_cast<uint8_t *>(&intValue);
3904+
#if defined(__BIG_ENDIAN__)
3905+
ptr += sizeof(uint64_t) - size;
3906+
#endif
3907+
memcpy(ptr, value, size);
3908+
fprintf(stderr, "%" PRIu64 " (%#" PRIx64 ")\n", intValue, intValue);
3909+
fprintf(stderr, " ");
39043910
}
39053911
auto bytes = reinterpret_cast<const uint8_t *>(value);
39063912
for (unsigned i = 0; i < size; ++i) {

0 commit comments

Comments
 (0)