Skip to content

Commit ad503af

Browse files
authored
Merge pull request swiftlang#76515 from swiftlang/egorzhdan/scs-reduce-unsafe
[cxx-interop][SwiftCompilerSources] Reduce the number of `SWIFT_IMPORT_UNSAFE` attributes
2 parents 108abc3 + 3b540dd commit ad503af

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

include/swift/SIL/SILBridging.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,8 @@ struct BridgedFunction {
634634
};
635635

636636
SWIFT_NAME("init(obj:)")
637-
SWIFT_IMPORT_UNSAFE BridgedFunction(SwiftObject obj) : obj(obj) {}
638-
SWIFT_IMPORT_UNSAFE BridgedFunction() {}
637+
BridgedFunction(SwiftObject obj) : obj(obj) {}
638+
BridgedFunction() {}
639639
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE swift::SILFunction * _Nonnull getFunction() const;
640640
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedStringRef getName() const;
641641
BridgedOwnedString getDebugDescription() const;
@@ -940,7 +940,7 @@ struct BridgedInstruction {
940940
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedGlobalVar GlobalAccessInst_getGlobal() const;
941941
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedGlobalVar AllocGlobalInst_getGlobal() const;
942942
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedFunction FunctionRefBaseInst_getReferencedFunction() const;
943-
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE OptionalInt IntegerLiteralInst_getValue() const;
943+
BRIDGED_INLINE OptionalInt IntegerLiteralInst_getValue() const;
944944
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedStringRef StringLiteralInst_getValue() const;
945945
BRIDGED_INLINE int StringLiteralInst_getEncoding() const;
946946
BRIDGED_INLINE SwiftInt TupleExtractInst_fieldIndex() const;

include/swift/SIL/SILLocation.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,6 @@ class SILDebugLocation {
766766
bool isAutoGenerated() const { return location.isAutoGenerated(); }
767767
operator bool() const { return bool(location) && debugScope; }
768768

769-
SWIFT_IMPORT_UNSAFE
770769
SILDebugLocation getAutogeneratedLocation() const {
771770
SILDebugLocation autoGenLoc(RegularLocation::getAutoGeneratedLocation(), getScope());
772771
return autoGenLoc;
@@ -784,7 +783,7 @@ class SILDebugLocation {
784783
static SILDebugLocation getArtificialUnreachableLocation() {
785784
return SILDebugLocation(ArtificialUnreachableLocation(), nullptr);
786785
}
787-
};
786+
} SWIFT_SELF_CONTAINED;
788787

789788
} // end swift namespace
790789

include/swift/SIL/SILType.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,19 +243,16 @@ class SILType {
243243

244244
/// Retrieve the ClassDecl for a type that maps to a Swift class or
245245
/// bound generic class type.
246-
SWIFT_IMPORT_UNSAFE
247246
ClassDecl *getClassOrBoundGenericClass() const {
248247
return getASTType().getClassOrBoundGenericClass();
249248
}
250249
/// Retrieve the StructDecl for a type that maps to a Swift struct or
251250
/// bound generic struct type.
252-
SWIFT_IMPORT_UNSAFE
253251
StructDecl *getStructOrBoundGenericStruct() const {
254252
return getASTType().getStructOrBoundGenericStruct();
255253
}
256254
/// Retrieve the EnumDecl for a type that maps to a Swift enum or
257255
/// bound generic enum type.
258-
SWIFT_IMPORT_UNSAFE
259256
EnumDecl *getEnumOrBoundGenericEnum() const {
260257
return getASTType().getEnumOrBoundGenericEnum();
261258
}
@@ -286,15 +283,13 @@ class SILType {
286283

287284
bool isBuiltinBridgeObject() const { return is<BuiltinBridgeObjectType>(); }
288285

289-
SWIFT_IMPORT_UNSAFE
290286
SILType getBuiltinVectorElementType() const {
291287
auto vector = castTo<BuiltinVectorType>();
292288
return getPrimitiveObjectType(vector.getElementType());
293289
}
294290

295291
/// Retrieve the NominalTypeDecl for a type that maps to a Swift
296292
/// nominal or bound generic nominal type.
297-
SWIFT_IMPORT_UNSAFE
298293
NominalTypeDecl *getNominalOrBoundGenericNominal() const {
299294
return getASTType().getNominalOrBoundGenericNominal();
300295
}

0 commit comments

Comments
 (0)