Skip to content

Commit 687aeaa

Browse files
committed
runtime: remove unnecessary preprocessor condition, flip cases (NFC)
The use of `__APPLE__` is unnecessary as the case is guarded by the `SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT` preprocessor guard which is implicitly specific to that environment. Additionally, flip the condition around so that the positive (which is the future) appears ahead of the negative case.
1 parent 814e656 commit 687aeaa

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

include/swift/AST/KnownIdentifiers.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ IDENTIFIER(stringValue)
100100
IDENTIFIER(super)
101101
IDENTIFIER(superDecoder)
102102
IDENTIFIER(superEncoder)
103-
#if __APPLE__ && !SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
103+
#if SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
104+
IDENTIFIER_WITH_NAME(SwiftObject, "_TtCs12_SwiftObject")
105+
#else
104106
// Pre-stable ABI uses un-mangled name for SwiftObject.
105107
IDENTIFIER(SwiftObject)
106-
#else
107-
IDENTIFIER_WITH_NAME(SwiftObject, "_TtCs12_SwiftObject")
108108
#endif
109109
IDENTIFIER(to)
110110
IDENTIFIER(toRaw)

stdlib/public/runtime/SwiftObject.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030

3131
#if SWIFT_OBJC_INTEROP
3232

33-
#if __APPLE__ && !SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
34-
// Pre-stable ABI uses un-mangled name for SwiftObject
35-
#else
33+
#if SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
3634
// Source code: "SwiftObject"
3735
// Real class name: mangled "Swift._SwiftObject"
3836
#define SwiftObject _TtCs12_SwiftObject
37+
#else
38+
// Pre-stable ABI uses un-mangled name for SwiftObject
3939
#endif
4040

4141
#if __has_attribute(objc_root_class)

test/stdlib/Inputs/SwiftObjectNSObject/SwiftObjectNSObject.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@
5252

5353
// Add methods to class SwiftObject that can be called by performSelector: et al
5454

55-
#if __APPLE__ && !SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
56-
// Pre-stable ABI uses un-mangled name for SwiftObject.
57-
#define SwiftObjectDemangledName "SwiftObject"
58-
#else
55+
#if SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
5956
// mangled Swift._SwiftObject
6057
#define SwiftObject _TtCs12_SwiftObject
6158
#define SwiftObjectDemangledName "Swift._SwiftObject"
59+
#else
60+
// Pre-stable ABI uses un-mangled name for SwiftObject.
61+
#define SwiftObjectDemangledName "SwiftObject"
6262
#endif
6363

6464
@interface SwiftObject /* trust me, I know what I'm doing */ @end

0 commit comments

Comments
 (0)