Skip to content

Commit c9f54e1

Browse files
committed
[nfc] Rename CxxCustom -> Custom and fix comments based on review feedback.
1 parent ee2a7ee commit c9f54e1

File tree

13 files changed

+39
-39
lines changed

13 files changed

+39
-39
lines changed

include/swift/AST/ReferenceCounting.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ enum class ReferenceCounting : uint8_t {
3535

3636
/// The object uses swift_attr("retain:XXX") and "release:XXX" to implement
3737
/// reference counting.
38-
CxxCustom,
38+
Custom,
3939

4040
/// The object uses _Block_copy/_Block_release reference counting.
4141
///

lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5252,7 +5252,7 @@ bool ClassDecl::hasRefCountingAnnotations() const {
52525252
ReferenceCounting ClassDecl::getObjectModel() const {
52535253
if (isForeignReferenceType())
52545254
return hasRefCountingAnnotations()
5255-
? ReferenceCounting::CxxCustom
5255+
? ReferenceCounting::Custom
52565256
: ReferenceCounting::None;
52575257

52585258
if (checkAncestry(AncestryFlags::ObjCObjectModel))

lib/AST/Type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6041,7 +6041,7 @@ ReferenceCounting TypeBase::getReferenceCounting() {
60416041
return lookThroughAllOptionalTypes()
60426042
->getClassOrBoundGenericClass()
60436043
->hasRefCountingAnnotations()
6044-
? ReferenceCounting::CxxCustom
6044+
? ReferenceCounting::Custom
60456045
: ReferenceCounting::None;
60466046

60476047
// In the absence of Objective-C interoperability, everything uses native

lib/IRGen/ClassTypeInfo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ClassTypeInfo : public HeapTypeInfo<ClassTypeInfo> {
6161

6262
void emitScalarRelease(IRGenFunction &IGF, llvm::Value *value,
6363
Atomicity atomicity) const override {
64-
if (getReferenceCounting() == ReferenceCounting::CxxCustom) {
64+
if (getReferenceCounting() == ReferenceCounting::Custom) {
6565
auto releaseFn = findForeignReferenceTypeRefCountingOperation(getClass(),
6666
ForeignReferenceTypeRefCountingOperation::release);
6767
IGF.emitForeignReferenceTypeLifetimeOperation(releaseFn, value);
@@ -73,7 +73,7 @@ class ClassTypeInfo : public HeapTypeInfo<ClassTypeInfo> {
7373

7474
void emitScalarRetain(IRGenFunction &IGF, llvm::Value *value,
7575
Atomicity atomicity) const override {
76-
if (getReferenceCounting() == ReferenceCounting::CxxCustom) {
76+
if (getReferenceCounting() == ReferenceCounting::Custom) {
7777
auto releaseFn = findForeignReferenceTypeRefCountingOperation(getClass(),
7878
ForeignReferenceTypeRefCountingOperation::retain);
7979
IGF.emitForeignReferenceTypeLifetimeOperation(releaseFn, value);
@@ -87,7 +87,7 @@ class ClassTypeInfo : public HeapTypeInfo<ClassTypeInfo> {
8787
// using basic reference counting.
8888
void strongRetain(IRGenFunction &IGF, Explosion &e,
8989
Atomicity atomicity) const override {
90-
if (getReferenceCounting() == ReferenceCounting::CxxCustom) {
90+
if (getReferenceCounting() == ReferenceCounting::Custom) {
9191
llvm::Value *value = e.claimNext();
9292
auto releaseFn = findForeignReferenceTypeRefCountingOperation(getClass(),
9393
ForeignReferenceTypeRefCountingOperation::retain);
@@ -100,7 +100,7 @@ class ClassTypeInfo : public HeapTypeInfo<ClassTypeInfo> {
100100

101101
void strongRelease(IRGenFunction &IGF, Explosion &e,
102102
Atomicity atomicity) const override {
103-
if (getReferenceCounting() == ReferenceCounting::CxxCustom) {
103+
if (getReferenceCounting() == ReferenceCounting::Custom) {
104104
llvm::Value *value = e.claimNext();
105105
auto releaseFn = findForeignReferenceTypeRefCountingOperation(getClass(),
106106
ForeignReferenceTypeRefCountingOperation::release);

lib/IRGen/GenClass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ namespace {
148148
HeaderSize = CurSize;
149149
break;
150150
case ReferenceCounting::None:
151-
case ReferenceCounting::CxxCustom:
151+
case ReferenceCounting::Custom:
152152
break;
153153
case ReferenceCounting::Block:
154154
case ReferenceCounting::Unknown:

lib/IRGen/GenHeap.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ unsigned IRGenModule::getReferenceStorageExtraInhabitantCount(
589589
case ReferenceCounting::ObjC:
590590
case ReferenceCounting::None:
591591
case ReferenceCounting::Unknown:
592-
case ReferenceCounting::CxxCustom:
592+
case ReferenceCounting::Custom:
593593
break;
594594
case ReferenceCounting::Bridge:
595595
case ReferenceCounting::Error:
@@ -619,7 +619,7 @@ SpareBitVector IRGenModule::getReferenceStorageSpareBits(
619619
case ReferenceCounting::Block:
620620
case ReferenceCounting::ObjC:
621621
case ReferenceCounting::None:
622-
case ReferenceCounting::CxxCustom:
622+
case ReferenceCounting::Custom:
623623
case ReferenceCounting::Unknown:
624624
break;
625625
case ReferenceCounting::Bridge:
@@ -650,7 +650,7 @@ APInt IRGenModule::getReferenceStorageExtraInhabitantValue(unsigned bits,
650650
case ReferenceCounting::Block:
651651
case ReferenceCounting::ObjC:
652652
case ReferenceCounting::None:
653-
case ReferenceCounting::CxxCustom:
653+
case ReferenceCounting::Custom:
654654
case ReferenceCounting::Unknown:
655655
break;
656656
case ReferenceCounting::Bridge:
@@ -672,7 +672,7 @@ APInt IRGenModule::getReferenceStorageExtraInhabitantMask(
672672
case ReferenceCounting::Block:
673673
case ReferenceCounting::ObjC:
674674
case ReferenceCounting::None:
675-
case ReferenceCounting::CxxCustom:
675+
case ReferenceCounting::Custom:
676676
case ReferenceCounting::Unknown:
677677
break;
678678
case ReferenceCounting::Bridge:
@@ -693,7 +693,7 @@ llvm::Value *IRGenFunction::getReferenceStorageExtraInhabitantIndex(Address src,
693693
case ReferenceCounting::Block:
694694
case ReferenceCounting::ObjC:
695695
case ReferenceCounting::None:
696-
case ReferenceCounting::CxxCustom:
696+
case ReferenceCounting::Custom:
697697
case ReferenceCounting::Unknown:
698698
break;
699699
case ReferenceCounting::Bridge:
@@ -731,7 +731,7 @@ void IRGenFunction::storeReferenceStorageExtraInhabitant(llvm::Value *index,
731731
case ReferenceCounting::Block:
732732
case ReferenceCounting::ObjC:
733733
case ReferenceCounting::None:
734-
case ReferenceCounting::CxxCustom:
734+
case ReferenceCounting::Custom:
735735
case ReferenceCounting::Unknown:
736736
break;
737737
case ReferenceCounting::Bridge:
@@ -766,7 +766,7 @@ void IRGenFunction::storeReferenceStorageExtraInhabitant(llvm::Value *index,
766766
std::move(spareBits), isOptional); \
767767
case ReferenceCounting::ObjC: \
768768
case ReferenceCounting::None: \
769-
case ReferenceCounting::CxxCustom: \
769+
case ReferenceCounting::Custom: \
770770
case ReferenceCounting::Block: \
771771
case ReferenceCounting::Unknown: \
772772
return new Unknown##Name##ReferenceTypeInfo( \
@@ -1022,7 +1022,7 @@ void IRGenFunction::emitStrongRelease(llvm::Value *value,
10221022
return emitBridgeStrongRelease(value, atomicity);
10231023
case ReferenceCounting::Error:
10241024
return emitErrorStrongRelease(value);
1025-
case ReferenceCounting::CxxCustom:
1025+
case ReferenceCounting::Custom:
10261026
llvm_unreachable("Ref counting should be handled in TypeInfo.");
10271027
case ReferenceCounting::None:
10281028
return; // This is a no-op if we don't have any ref-counting.
@@ -1051,7 +1051,7 @@ void IRGenFunction::emitStrongRetain(llvm::Value *value,
10511051
case ReferenceCounting::Error:
10521052
emitErrorStrongRetain(value);
10531053
return;
1054-
case ReferenceCounting::CxxCustom:
1054+
case ReferenceCounting::Custom:
10551055
llvm_unreachable("Ref counting should be handled in TypeInfo.");
10561056
case ReferenceCounting::None:
10571057
return; // This is a no-op if we don't have any ref-counting.
@@ -1072,7 +1072,7 @@ llvm::Type *IRGenModule::getReferenceType(ReferenceCounting refcounting) {
10721072
return UnknownRefCountedPtrTy;
10731073
case ReferenceCounting::Error:
10741074
return ErrorPtrTy;
1075-
case ReferenceCounting::CxxCustom:
1075+
case ReferenceCounting::Custom:
10761076
case ReferenceCounting::None:
10771077
return OpaquePtrTy;
10781078
}
@@ -1092,7 +1092,7 @@ llvm::Type *IRGenModule::getReferenceType(ReferenceCounting refcounting) {
10921092
case ReferenceCounting::Bridge: \
10931093
case ReferenceCounting::Block: \
10941094
case ReferenceCounting::Error: \
1095-
case ReferenceCounting::CxxCustom: \
1095+
case ReferenceCounting::Custom: \
10961096
case ReferenceCounting::None: \
10971097
llvm_unreachable("unsupported reference kind with reference storage"); \
10981098
} \
@@ -1110,7 +1110,7 @@ llvm::Type *IRGenModule::getReferenceType(ReferenceCounting refcounting) {
11101110
case ReferenceCounting::Bridge: \
11111111
case ReferenceCounting::Block: \
11121112
case ReferenceCounting::Error: \
1113-
case ReferenceCounting::CxxCustom: \
1113+
case ReferenceCounting::Custom: \
11141114
case ReferenceCounting::None: \
11151115
llvm_unreachable("unsupported reference kind with reference storage"); \
11161116
} \

lib/IRGen/GenType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ IRGenModule::getReferenceObjectTypeInfo(ReferenceCounting refcounting) {
16001600
case ReferenceCounting::Block:
16011601
case ReferenceCounting::Error:
16021602
case ReferenceCounting::ObjC:
1603-
case ReferenceCounting::CxxCustom:
1603+
case ReferenceCounting::Custom:
16041604
case ReferenceCounting::None:
16051605
llvm_unreachable("not implemented");
16061606
}

lib/IRGen/GenValueWitness.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ getAddrOfKnownValueWitnessTable(IRGenModule &IGM, CanType type,
11631163
break;
11641164
case ReferenceCounting::Error:
11651165
case ReferenceCounting::None:
1166-
case ReferenceCounting::CxxCustom:
1166+
case ReferenceCounting::Custom:
11671167
break;
11681168
}
11691169
}

lib/IRGen/HeapTypeInfo.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class HeapTypeInfo
134134
// using strong reference counting.
135135
virtual void emitScalarRelease(IRGenFunction &IGF, llvm::Value *value,
136136
Atomicity atomicity) const {
137-
assert(asDerived().getReferenceCounting() != ReferenceCounting::CxxCustom);
137+
assert(asDerived().getReferenceCounting() != ReferenceCounting::Custom);
138138
IGF.emitStrongRelease(value, asDerived().getReferenceCounting(), atomicity);
139139
}
140140

@@ -144,22 +144,22 @@ class HeapTypeInfo
144144

145145
virtual void emitScalarRetain(IRGenFunction &IGF, llvm::Value *value,
146146
Atomicity atomicity) const {
147-
assert(asDerived().getReferenceCounting() != ReferenceCounting::CxxCustom);
147+
assert(asDerived().getReferenceCounting() != ReferenceCounting::Custom);
148148
IGF.emitStrongRetain(value, asDerived().getReferenceCounting(), atomicity);
149149
}
150150

151151
// Implement the primary retain/release operations of ReferenceTypeInfo
152152
// using basic reference counting.
153153
void strongRetain(IRGenFunction &IGF, Explosion &e,
154154
Atomicity atomicity) const override {
155-
assert(asDerived().getReferenceCounting() != ReferenceCounting::CxxCustom);
155+
assert(asDerived().getReferenceCounting() != ReferenceCounting::Custom);
156156
llvm::Value *value = e.claimNext();
157157
asDerived().emitScalarRetain(IGF, value, atomicity);
158158
}
159159

160160
void strongRelease(IRGenFunction &IGF, Explosion &e,
161161
Atomicity atomicity) const override {
162-
assert(asDerived().getReferenceCounting() != ReferenceCounting::CxxCustom);
162+
assert(asDerived().getReferenceCounting() != ReferenceCounting::Custom);
163163
llvm::Value *value = e.claimNext();
164164
asDerived().emitScalarRelease(IGF, value, atomicity);
165165
}
@@ -216,28 +216,28 @@ class HeapTypeInfo
216216
#define ALWAYS_LOADABLE_CHECKED_REF_STORAGE_HELPER(Name, name) \
217217
void strongRetain##Name(IRGenFunction &IGF, Explosion &e, \
218218
Atomicity atomicity) const override {\
219-
assert(asDerived().getReferenceCounting() != ReferenceCounting::CxxCustom); \
219+
assert(asDerived().getReferenceCounting() != ReferenceCounting::Custom); \
220220
llvm::Value *value = e.claimNext(); \
221221
assert(asDerived().getReferenceCounting() == ReferenceCounting::Native); \
222222
IGF.emitNativeStrongRetain##Name(value, atomicity); \
223223
} \
224224
void strongRetain##Name##Release(IRGenFunction &IGF, Explosion &e, \
225225
Atomicity atomicity) const override { \
226-
assert(asDerived().getReferenceCounting() != ReferenceCounting::CxxCustom); \
226+
assert(asDerived().getReferenceCounting() != ReferenceCounting::Custom); \
227227
llvm::Value *value = e.claimNext(); \
228228
assert(asDerived().getReferenceCounting() == ReferenceCounting::Native); \
229229
IGF.emitNativeStrongRetainAnd##Name##Release(value, atomicity); \
230230
} \
231231
void name##Retain(IRGenFunction &IGF, Explosion &e, \
232232
Atomicity atomicity) const override { \
233-
assert(asDerived().getReferenceCounting() != ReferenceCounting::CxxCustom); \
233+
assert(asDerived().getReferenceCounting() != ReferenceCounting::Custom); \
234234
llvm::Value *value = e.claimNext(); \
235235
assert(asDerived().getReferenceCounting() == ReferenceCounting::Native); \
236236
IGF.emitNative##Name##Retain(value, atomicity); \
237237
} \
238238
void name##Release(IRGenFunction &IGF, Explosion &e, \
239239
Atomicity atomicity) const override { \
240-
assert(asDerived().getReferenceCounting() != ReferenceCounting::CxxCustom); \
240+
assert(asDerived().getReferenceCounting() != ReferenceCounting::Custom); \
241241
llvm::Value *value = e.claimNext(); \
242242
assert(asDerived().getReferenceCounting() == ReferenceCounting::Native); \
243243
IGF.emitNative##Name##Release(value, atomicity); \

lib/IRGen/IRGenModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ class IRGenModule {
837837
case ReferenceCounting::ObjC:
838838
case ReferenceCounting::Block:
839839
case ReferenceCounting::None:
840-
case ReferenceCounting::CxxCustom:
840+
case ReferenceCounting::Custom:
841841
return true;
842842

843843
case ReferenceCounting::Bridge:

0 commit comments

Comments
 (0)