Skip to content

Commit f292ec9

Browse files
committed
Use the new template deduction guides rather than makeArrayRef
LLVM has removed `make*ArrayRef`, migrate all references to their constructor equivalent.
1 parent b4a5ad2 commit f292ec9

File tree

122 files changed

+305
-360
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

+305
-360
lines changed

CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,14 +1385,6 @@ endif()
13851385
add_subdirectory(include)
13861386

13871387
if(SWIFT_INCLUDE_TOOLS)
1388-
# TODO Remove this once release/5.9 is done and we can finish migrating Swift
1389-
# off of `llvm::None`/`llvm::Optional`, and `llvm::makeArrayRef`.
1390-
# This is to silence the avalanche of deprecation warnings from LLVM headers
1391-
# until we can actually do something about them. This is nasty, but it's
1392-
# better than losing context due to the sheer number in-actionable deprecation
1393-
# warnings or the massive number of merge-conflicts we would get otherwise.
1394-
add_definitions(-DSWIFT_TARGET)
1395-
13961388
add_subdirectory(lib)
13971389

13981390
add_subdirectory(SwiftCompilerSources)

include/swift/ABI/GenericContext.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -318,19 +318,19 @@ class RuntimeGenericSignature {
318318
PackShapeHeader(packShapeHeader), PackShapeDescriptors(packShapeDescriptors) {}
319319

320320
llvm::ArrayRef<GenericParamDescriptor> getParams() const {
321-
return llvm::makeArrayRef(Params, Header.NumParams);
321+
return llvm::ArrayRef(Params, Header.NumParams);
322322
}
323323

324324
llvm::ArrayRef<TargetGenericRequirementDescriptor<Runtime>> getRequirements() const {
325-
return llvm::makeArrayRef(Requirements, Header.NumRequirements);
325+
return llvm::ArrayRef(Requirements, Header.NumRequirements);
326326
}
327327

328328
const GenericPackShapeHeader &getGenericPackShapeHeader() const {
329329
return PackShapeHeader;
330330
}
331331

332332
llvm::ArrayRef<GenericPackShapeDescriptor> getGenericPackShapeDescriptors() const {
333-
return llvm::makeArrayRef(PackShapeDescriptors, PackShapeHeader.NumPacks);
333+
return llvm::ArrayRef(PackShapeDescriptors, PackShapeHeader.NumPacks);
334334
}
335335

336336
size_t getArgumentLayoutSizeInWords() const {
@@ -379,20 +379,20 @@ class TargetGenericEnvironment
379379
public:
380380
/// Retrieve the cumulative generic parameter counts at each level of genericity.
381381
llvm::ArrayRef<uint16_t> getGenericParameterCounts() const {
382-
return llvm::makeArrayRef(this->template getTrailingObjects<uint16_t>(),
383-
Flags.getNumGenericParameterLevels());
382+
return llvm::ArrayRef(this->template getTrailingObjects<uint16_t>(),
383+
Flags.getNumGenericParameterLevels());
384384
}
385385

386386
/// Retrieve the generic parameters descriptors.
387387
llvm::ArrayRef<GenericParamDescriptor> getGenericParameters() const {
388-
return llvm::makeArrayRef(
388+
return llvm::ArrayRef(
389389
this->template getTrailingObjects<GenericParamDescriptor>(),
390390
getGenericParameterCounts().back());
391391
}
392392

393393
/// Retrieve the generic requirements.
394394
llvm::ArrayRef<GenericRequirementDescriptor> getGenericRequirements() const {
395-
return llvm::makeArrayRef(
395+
return llvm::ArrayRef(
396396
this->template getTrailingObjects<GenericRequirementDescriptor>(),
397397
Flags.getNumGenericRequirements());
398398
}

include/swift/AST/ASTContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ class ASTContext final {
523523
StringRef AllocateCopy(StringRef Str,
524524
AllocationArena arena = AllocationArena::Permanent) const {
525525
ArrayRef<char> Result =
526-
AllocateCopy(llvm::makeArrayRef(Str.data(), Str.size()), arena);
526+
AllocateCopy(llvm::ArrayRef(Str.data(), Str.size()), arena);
527527
return StringRef(Result.data(), Result.size());
528528
}
529529

include/swift/AST/CaptureInfo.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ class CaptureInfo {
145145
: DynamicSelf(dynamicSelf), OpaqueValue(opaqueValue), Count(count) { }
146146

147147
ArrayRef<CapturedValue> getCaptures() const {
148-
return llvm::makeArrayRef(this->getTrailingObjects<CapturedValue>(),
149-
Count);
148+
return llvm::ArrayRef(this->getTrailingObjects<CapturedValue>(), Count);
150149
}
151150

152151
DynamicSelfType *getDynamicSelfType() const {

include/swift/AST/Comment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class DocComment {
4646
}
4747

4848
ArrayRef<StringRef> getTags() const {
49-
return llvm::makeArrayRef(Parts.Tags.begin(), Parts.Tags.end());
49+
return llvm::ArrayRef(Parts.Tags.begin(), Parts.Tags.end());
5050
}
5151

5252
std::optional<const swift::markup::Paragraph *> getBrief() const {

include/swift/AST/NameLookup.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,16 @@ class LookupResult {
163163
bool empty() const { return innerResults().empty(); }
164164

165165
ArrayRef<LookupResultEntry> innerResults() const {
166-
return llvm::makeArrayRef(Results).take_front(IndexOfFirstOuterResult);
166+
return llvm::ArrayRef(Results).take_front(IndexOfFirstOuterResult);
167167
}
168168

169169
ArrayRef<LookupResultEntry> outerResults() const {
170-
return llvm::makeArrayRef(Results).drop_front(IndexOfFirstOuterResult);
170+
return llvm::ArrayRef(Results).drop_front(IndexOfFirstOuterResult);
171171
}
172172

173173
/// \returns An array of both the inner and outer results.
174174
ArrayRef<LookupResultEntry> allResults() const {
175-
return llvm::makeArrayRef(Results);
175+
return llvm::ArrayRef(Results);
176176
}
177177

178178
const LookupResultEntry& operator[](unsigned index) const {

include/swift/AST/SILLayout.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class SILLayout final : public llvm::FoldingSetNode,
142142

143143
/// Get the fields inside the layout.
144144
ArrayRef<SILField> getFields() const {
145-
return llvm::makeArrayRef(getTrailingObjects<SILField>(), NumFields);
145+
return llvm::ArrayRef(getTrailingObjects<SILField>(), NumFields);
146146
}
147147

148148
/// Produce a profile of this layout, for use in a folding set.

include/swift/AST/SourceFile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class SourceFile final : public FileUnit {
302302
std::optional<ArrayRef<ASTNode>> getCachedTopLevelItems() const {
303303
if (!Items)
304304
return std::nullopt;
305-
return llvm::makeArrayRef(*Items);
305+
return llvm::ArrayRef(*Items);
306306
}
307307

308308
/// Retrieve the parsing options for the file.

include/swift/AST/Stmt.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,7 @@ class alignas(8) PoundAvailableInfo final :
514514
bool isUnavailability);
515515

516516
ArrayRef<AvailabilitySpec *> getQueries() const {
517-
return llvm::makeArrayRef(getTrailingObjects<AvailabilitySpec *>(),
518-
NumQueries);
517+
return llvm::ArrayRef(getTrailingObjects<AvailabilitySpec *>(), NumQueries);
519518
}
520519

521520
SourceLoc getLParenLoc() const { return LParenLoc; }

include/swift/AST/TypeRepr.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ class AttributedTypeRepr final
281281
TypeRepr *ty);
282282

283283
ArrayRef<TypeOrCustomAttr> getAttrs() const {
284-
return llvm::makeArrayRef(getTrailingObjects<TypeOrCustomAttr>(),
285-
Bits.AttributedTypeRepr.NumAttributes);
284+
return llvm::ArrayRef(getTrailingObjects<TypeOrCustomAttr>(),
285+
Bits.AttributedTypeRepr.NumAttributes);
286286
}
287287

288288
TypeAttribute *get(TypeAttrKind kind) const;
@@ -871,12 +871,12 @@ class PackTypeRepr final
871871
SourceRange getBracesRange() const { return BraceLocs; }
872872

873873
MutableArrayRef<TypeRepr*> getMutableElements() {
874-
return llvm::makeMutableArrayRef(getTrailingObjects<TypeRepr*>(),
875-
Bits.PackTypeRepr.NumElements);
874+
return llvm::MutableArrayRef(getTrailingObjects<TypeRepr *>(),
875+
Bits.PackTypeRepr.NumElements);
876876
}
877877
ArrayRef<TypeRepr*> getElements() const {
878-
return llvm::makeArrayRef(getTrailingObjects<TypeRepr*>(),
879-
Bits.PackTypeRepr.NumElements);
878+
return llvm::ArrayRef(getTrailingObjects<TypeRepr *>(),
879+
Bits.PackTypeRepr.NumElements);
880880
}
881881

882882
static bool classof(const TypeRepr *T) {

0 commit comments

Comments
 (0)