Skip to content

Commit 6bb167f

Browse files
committed
Merge remote-tracking branch 'origin/main' into rebranch
2 parents 7cb03c7 + f78f302 commit 6bb167f

File tree

11 files changed

+28
-26
lines changed

11 files changed

+28
-26
lines changed

include/swift/Basic/Lazy.h

-3
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ template <class T> class Lazy {
5555
};
5656

5757
template <typename T> inline T &Lazy<T>::get(void (*initCallback)(void*)) {
58-
static_assert(std::is_literal_type<Lazy<T>>::value,
59-
"Lazy<T> must be a literal type");
60-
6158
swift::once(OnceToken, initCallback, &Value);
6259
return unsafeGetAlreadyInitialized();
6360
}

lib/IRGen/Callee.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ namespace irgen {
340340
AuthInfo(authInfo), Sig(signature), awaitSignature(awaitSignature) {
341341
// The function pointer should have function type.
342342
assert(!value->getContext().supportsTypedPointers() ||
343-
value->getType()->getPointerElementType()->isFunctionTy());
343+
value->getType()->getNonOpaquePointerElementType()->isFunctionTy());
344344
// TODO: maybe assert similarity to signature.getType()?
345345
if (authInfo) {
346346
if (kind == Kind::Function) {

lib/IRGen/GenCall.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3192,7 +3192,7 @@ void CallEmission::emitToExplosion(Explosion &out, bool isOutlined) {
31923192
auto temp = IGF.createAlloca(resultTy, Alignment(), "indirect.result");
31933193
if (IGF.IGM.getLLVMContext().supportsTypedPointers()) {
31943194
temp = IGF.Builder.CreateElementBitCast(
3195-
temp, fnType->getParamType(0)->getPointerElementType());
3195+
temp, fnType->getParamType(0)->getNonOpaquePointerElementType());
31963196
}
31973197
emitToMemory(temp, substResultTI, isOutlined);
31983198
return;

lib/IRGen/IRGenSIL.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5433,7 +5433,7 @@ void IRGenSILFunction::emitDebugInfoForAllocStack(AllocStackInst *i,
54335433
shadowTy = IGM.Int8Ty;
54345434
}
54355435
assert(!IGM.getLLVMContext().supportsTypedPointers() ||
5436-
shadowTy == shadow->getType()->getPointerElementType());
5436+
shadowTy == shadow->getType()->getNonOpaquePointerElementType());
54375437
addr = builder.CreateLoad(shadowTy, shadow);
54385438
}
54395439

lib/LLVMPasses/LLVMMergeFunctions.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1271,15 +1271,15 @@ fixUpTypesInByValAndStructRetAttributes(llvm::FunctionType *fnType,
12711271
auto paramTy = fnType->getParamType(i);
12721272
auto attrListIndex = llvm::AttributeList::FirstArgIndex + i;
12731273
if (attrList.hasParamAttr(i, llvm::Attribute::StructRet) &&
1274-
paramTy->getPointerElementType() != attrList.getParamStructRetType(i))
1274+
paramTy->getNonOpaquePointerElementType() != attrList.getParamStructRetType(i))
12751275
attrList = attrList.replaceAttributeTypeAtIndex(
12761276
context, attrListIndex, llvm::Attribute::StructRet,
1277-
paramTy->getPointerElementType());
1277+
paramTy->getNonOpaquePointerElementType());
12781278
if (attrList.hasParamAttr(i, llvm::Attribute::ByVal) &&
1279-
paramTy->getPointerElementType() != attrList.getParamByValType(i))
1279+
paramTy->getNonOpaquePointerElementType() != attrList.getParamByValType(i))
12801280
attrList = attrList.replaceAttributeTypeAtIndex(
12811281
context, attrListIndex, llvm::Attribute::ByVal,
1282-
paramTy->getPointerElementType());
1282+
paramTy->getNonOpaquePointerElementType());
12831283
}
12841284
return attrList;
12851285
}

lib/SILGen/SILGenApply.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -2251,9 +2251,13 @@ class ClaimedParamsRef {
22512251
checkParams();
22522252
}
22532253

2254-
struct iterator : public std::iterator<std::random_access_iterator_tag,
2255-
SILParameterInfo>
2256-
{
2254+
struct iterator {
2255+
using iterator_category = std::random_access_iterator_tag;
2256+
using value_type = SILParameterInfo;
2257+
using difference_type = std::ptrdiff_t;
2258+
using pointer = value_type*;
2259+
using reference = value_type&;
2260+
22572261
const SILParameterInfo *Base;
22582262
unsigned I, SkipParamIndex;
22592263

lib/SILOptimizer/PassManager/PassManager.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -1028,9 +1028,13 @@ namespace {
10281028
SmallVector<Edge, 8> Children;
10291029
};
10301030

1031-
struct child_iterator
1032-
: public std::iterator<std::random_access_iterator_tag, Node *,
1033-
ptrdiff_t> {
1031+
struct child_iterator {
1032+
using iterator_category = std::random_access_iterator_tag;
1033+
using value_type = Node*;
1034+
using difference_type = std::ptrdiff_t;
1035+
using pointer = value_type*;
1036+
using reference = value_type&;
1037+
10341038
SmallVectorImpl<Edge>::iterator baseIter;
10351039

10361040
child_iterator(SmallVectorImpl<Edge>::iterator baseIter) :

lib/SILOptimizer/UtilityPasses/ParseTestSpecification.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,6 @@ static TraceValueMap traceValues;
544544

545545
class ParseTestSpecification {
546546
friend class ParseArgumentSpecification;
547-
SILFunction *function;
548547
SmallVectorImpl<StringRef> &components;
549548

550549
SILValue getTraceValue(unsigned index, SILFunction *function) {
@@ -561,9 +560,8 @@ class ParseTestSpecification {
561560
}
562561

563562
public:
564-
ParseTestSpecification(SILFunction *function,
565-
SmallVectorImpl<StringRef> &components)
566-
: function(function), components(components) {}
563+
ParseTestSpecification(SmallVectorImpl<StringRef> &components)
564+
: components(components) {}
567565

568566
void parse(UnparsedSpecification const &specification, Arguments &arguments) {
569567
StringRef specificationString = specification.string;
@@ -607,6 +605,6 @@ void swift::test::getTestSpecifications(
607605
void swift::test::parseTestArgumentsFromSpecification(
608606
SILFunction *function, UnparsedSpecification const &specification,
609607
Arguments &arguments, SmallVectorImpl<StringRef> &argumentStrings) {
610-
ParseTestSpecification parser(function, argumentStrings);
608+
ParseTestSpecification parser(argumentStrings);
611609
parser.parse(specification, arguments);
612610
}

stdlib/include/llvm/ADT/DenseMap.h

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ class DenseMapBase {
128128
P->getFirst() = EmptyKey;
129129
}
130130
}
131+
(void)NumEntries;
131132
assert(NumEntries == 0 && "Node count imbalance!");
132133
}
133134
setNumEntries(0);

stdlib/public/Concurrency/Task.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void FutureFragment::destroy() {
9191
auto queueHead = waitQueue.load(std::memory_order_acquire);
9292
switch (queueHead.getStatus()) {
9393
case Status::Executing:
94-
assert(false && "destroying a task that never completed");
94+
swift_unreachable("destroying a task that never completed");
9595

9696
case Status::Success:
9797
resultType->vw_destroy(getStoragePtr());

stdlib/public/runtime/Metadata.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ FunctionCacheEntry::FunctionCacheEntry(const Key &key) {
13421342
Data.ValueWitnesses = &VALUE_WITNESS_SYM(DIFF_FUNCTION_MANGLING);
13431343
break;
13441344
default:
1345-
assert(false && "unsupported function witness");
1345+
swift_unreachable("unsupported function witness");
13461346
case FunctionMetadataDifferentiabilityKind::NonDifferentiable:
13471347
Data.ValueWitnesses = &VALUE_WITNESS_SYM(FUNCTION_MANGLING);
13481348
break;
@@ -5771,13 +5771,11 @@ static Result performOnMetadataCache(const Metadata *metadata,
57715771
swift_unreachable("bad metadata initialization kind");
57725772
}
57735773

5774-
auto &generics = description->getFullGenericContextHeader();
5775-
57765774
auto genericArgs =
57775775
reinterpret_cast<const void * const *>(
57785776
description->getGenericArguments(metadata));
57795777
auto &cache = getCache(*description);
5780-
assert(generics.Base.NumKeyArguments == cache.SigLayout.sizeInWords());
5778+
assert(description->getFullGenericContextHeader().Base.NumKeyArguments == cache.SigLayout.sizeInWords());
57815779
auto key = MetadataCacheKey(cache.SigLayout, genericArgs);
57825780

57835781
return std::move(callbacks).forGenericMetadata(metadata, description,

0 commit comments

Comments
 (0)