Skip to content

Commit ac2603c

Browse files
authored
Merge pull request #79168 from rintaro/astgen-tweaks
[ASTGen] Small followup tweaks after AvailableAttr
2 parents ca2febe + 0098569 commit ac2603c

File tree

12 files changed

+18
-17
lines changed

12 files changed

+18
-17
lines changed

SwiftCompilerSources/Sources/Basic/Utils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ extension Optional where Wrapped == UnsafeMutablePointer<BridgedSwiftObject> {
173173

174174
extension BridgedArrayRef {
175175
public func withElements<T, R>(ofType ty: T.Type, _ c: (UnsafeBufferPointer<T>) -> R) -> R {
176-
let start = data?.bindMemory(to: ty, capacity: count)
176+
let start = data?.assumingMemoryBound(to: ty)
177177
let buffer = UnsafeBufferPointer(start: start, count: count)
178178
return c(buffer)
179179
}

include/swift/AST/ParseRequests.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class EvaluateIfConditionRequest
196196
/// Parse the '-define-availability' arguments.
197197
class AvailabilityMacroArgumentsRequest
198198
: public SimpleRequest<AvailabilityMacroArgumentsRequest,
199-
AvailabilityMacroMap *(ASTContext *),
199+
const AvailabilityMacroMap *(ASTContext *),
200200
RequestFlags::Cached> {
201201
public:
202202
using SimpleRequest::SimpleRequest;
@@ -205,7 +205,8 @@ class AvailabilityMacroArgumentsRequest
205205
friend SimpleRequest;
206206

207207
// Evaluation.
208-
AvailabilityMacroMap *evaluate(Evaluator &evaluator, ASTContext *ctx) const;
208+
const AvailabilityMacroMap *evaluate(Evaluator &evaluator,
209+
ASTContext *ctx) const;
209210

210211
public:
211212
// Caching.

include/swift/AST/ParseTypeIDZone.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ SWIFT_REQUEST(Parse, EvaluateIfConditionRequest,
3535
(std::pair<bool, bool>)(SourceFile *, SourceRange, bool), Uncached,
3636
NoLocationInfo)
3737
SWIFT_REQUEST(Parse, AvailabilityMacroArgumentsRequest,
38-
(AvailabilityMacroMap *)(ASTContext *), Cached,
38+
(const AvailabilityMacroMap *)(ASTContext *), Cached,
3939
NoLocationInfo)

include/swift/Basic/BasicBridging.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@ class BridgedArrayRef {
172172

173173
SWIFT_NAME("getter:BridgedArrayRef.data(self:)")
174174
BRIDGED_INLINE
175-
const void *_Nullable BridgedArrayRef_data(const BridgedArrayRef arr);
175+
const void *_Nullable BridgedArrayRef_data(BridgedArrayRef arr);
176176

177177
SWIFT_NAME("getter:BridgedArrayRef.count(self:)")
178-
BRIDGED_INLINE SwiftInt BridgedArrayRef_count(const BridgedArrayRef arr);
178+
BRIDGED_INLINE SwiftInt BridgedArrayRef_count(BridgedArrayRef arr);
179179

180180
SWIFT_NAME("getter:BridgedArrayRef.isEmpty(self:)")
181-
BRIDGED_INLINE bool BridgedArrayRef_isEmpty(const BridgedArrayRef arr);
181+
BRIDGED_INLINE bool BridgedArrayRef_isEmpty(BridgedArrayRef arr);
182182

183183
//===----------------------------------------------------------------------===//
184184
// MARK: Data

include/swift/Basic/BasicBridgingImpl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
2323
// MARK: BridgedArrayRef
2424
//===----------------------------------------------------------------------===//
2525

26-
const void *_Nullable BridgedArrayRef_data(const BridgedArrayRef arr) {
26+
const void *_Nullable BridgedArrayRef_data(BridgedArrayRef arr) {
2727
return arr.Data;
2828
}
2929

30-
SwiftInt BridgedArrayRef_count(const BridgedArrayRef arr) {
30+
SwiftInt BridgedArrayRef_count(BridgedArrayRef arr) {
3131
return static_cast<SwiftInt>(arr.Length);
3232
}
3333

34-
bool BridgedArrayRef_isEmpty(const BridgedArrayRef arr) {
34+
bool BridgedArrayRef_isEmpty(BridgedArrayRef arr) {
3535
return arr.Length == 0;
3636
}
3737

lib/ASTGen/Sources/ASTGen/Availability.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- Attrs.swift ------------------------------------------------------===//
1+
//===--- Availability.swift -----------------------------------------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/ASTGen/Sources/ASTGen/Bridge.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ extension ConcatCollection: LazyCollectionProtocol {
313313

314314
extension BridgedArrayRef {
315315
public func withElements<T, R>(ofType ty: T.Type, _ c: (UnsafeBufferPointer<T>) -> R) -> R {
316-
let start = data?.bindMemory(to: ty, capacity: count)
316+
let start = data?.assumingMemoryBound(to: ty)
317317
let buffer = UnsafeBufferPointer(start: start, count: count)
318318
return c(buffer)
319319
}

lib/ASTGen/Sources/ASTGen/DeclAttrs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- Attrs.swift ------------------------------------------------------===//
1+
//===--- DeclAttrs.swift --------------------------------------------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/ASTGen/Sources/ASTGen/Diagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===----------------------------------------------------------------------===//
1+
//===--- Diagnostics.swift ------------------------------------------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

lib/ASTGen/Sources/ASTGen/ParameterClause.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===----------------------------------------------------------------------===//
1+
//===--- ParameterClause.swift --------------------------------------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

0 commit comments

Comments
 (0)