File tree Expand file tree Collapse file tree 6 files changed +22
-6
lines changed Expand file tree Collapse file tree 6 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -89,10 +89,10 @@ CFPointeeInfo::classifyTypedef(const clang::TypedefNameDecl *typedefDecl) {
89
89
isWhitelistedCFTypeName (typedefDecl->getName ())) {
90
90
return forRecord (isConst, record->getDecl ());
91
91
}
92
- } else if (isConst && pointee->isVoidType ()) {
92
+ } else if (pointee->isVoidType ()) {
93
93
if (typedefDecl->hasAttr <clang::ObjCBridgeAttr>() ||
94
94
isWhitelistedCFTypeName (typedefDecl->getName ())) {
95
- return forConstVoid ();
95
+ return isConst ? forConstVoid () : forVoid ();
96
96
}
97
97
}
98
98
}
Original file line number Diff line number Diff line change @@ -59,6 +59,14 @@ class CFPointeeInfo {
59
59
return info;
60
60
}
61
61
62
+ static CFPointeeInfo forVoid () {
63
+ CFPointeeInfo info;
64
+ info.IsValid = true ;
65
+ info.IsConst = false ;
66
+ info.Decl = nullptr ;
67
+ return info;
68
+ }
69
+
62
70
static CFPointeeInfo forInvalid () {
63
71
CFPointeeInfo info;
64
72
info.IsValid = false ;
@@ -73,7 +81,7 @@ class CFPointeeInfo {
73
81
74
82
bool isConst () const { return IsConst; }
75
83
76
- bool isConstVoid () const {
84
+ bool isVoid () const {
77
85
assert (isValid ());
78
86
return Decl.isNull ();
79
87
}
Original file line number Diff line number Diff line change @@ -472,7 +472,7 @@ class IAMInference {
472
472
typedefType->getDecl ()->getCanonicalDecl ())) {
473
473
if (pointeeInfo.isRecord () || pointeeInfo.isTypedef ())
474
474
return {typedefType->getDecl ()->getCanonicalDecl ()};
475
- assert (pointeeInfo.isConstVoid () && " no other type" );
475
+ assert (pointeeInfo.isVoid () && " no other type" );
476
476
return {};
477
477
}
478
478
qt = qt.getSingleStepDesugaredType (clangSema.getASTContext ());
Original file line number Diff line number Diff line change @@ -1550,9 +1550,9 @@ namespace {
1550
1550
return typealias;
1551
1551
}
1552
1552
1553
- // If the pointee is 'const void', 'CFTypeRef', bring it
1553
+ // If the pointee is 'void', 'CFTypeRef', bring it
1554
1554
// in specifically as AnyObject.
1555
- if (pointee.isConstVoid ()) {
1555
+ if (pointee.isVoid ()) {
1556
1556
auto proto = Impl.SwiftContext .getProtocol (
1557
1557
KnownProtocolKind::AnyObject);
1558
1558
if (!proto)
Original file line number Diff line number Diff line change @@ -48,3 +48,6 @@ void CCRefrigeratorCreateIndirect(CCRefrigeratorRef * __nullable __attribute__((
48
48
// Note that the fridge parameter is incorrectly annotated.
49
49
void CCRefrigeratorGetPowerSupplyIndirect (CCRefrigeratorRef __attribute__ ((cf_returns_not_retained)) fridge, CCPowerSupplyRef * __nonnull __attribute__((cf_returns_not_retained)) outPower);
50
50
void CCRefrigeratorGetItemUnaudited (CCRefrigeratorRef fridge, unsigned index, CCItemRef *outItem);
51
+
52
+ typedef void *CFNonConstVoidRef __attribute__ ((objc_bridge(id )));
53
+ CFNonConstVoidRef CFNonConstBottom ();
Original file line number Diff line number Diff line change @@ -144,3 +144,8 @@ func nameCollisions() {
144
144
np = np2
145
145
np2 = np
146
146
}
147
+
148
+ func testNonConstVoid( ) {
149
+ let value : Unmanaged < CFNonConstVoidRef > = CFNonConstBottom ( ) !
150
+ assertUnmanaged ( value)
151
+ }
You can’t perform that action at this time.
0 commit comments