@@ -47,6 +47,10 @@ LayoutConstraint getLayoutConstraint(Identifier ID, ASTContext &Ctx) {
47
47
return LayoutConstraint::getLayoutConstraint (
48
48
LayoutConstraintKind::NativeClass, Ctx);
49
49
50
+ if (ID == Ctx.Id_BridgeObjectLayout )
51
+ return LayoutConstraint::getLayoutConstraint (
52
+ LayoutConstraintKind::BridgeObject, Ctx);
53
+
50
54
return LayoutConstraint::getLayoutConstraint (
51
55
LayoutConstraintKind::UnknownLayout, Ctx);
52
56
}
@@ -73,6 +77,8 @@ StringRef LayoutConstraintInfo::getName(LayoutConstraintKind Kind, bool internal
73
77
return " _TrivialAtMost" ;
74
78
case LayoutConstraintKind::TrivialOfExactSize:
75
79
return " _Trivial" ;
80
+ case LayoutConstraintKind::BridgeObject:
81
+ return " _BridgeObject" ;
76
82
}
77
83
78
84
llvm_unreachable (" Unhandled LayoutConstraintKind in switch." );
@@ -132,14 +138,18 @@ bool LayoutConstraintInfo::isNativeClass(LayoutConstraintKind Kind) {
132
138
}
133
139
134
140
bool LayoutConstraintInfo::isRefCounted (LayoutConstraintKind Kind) {
135
- return isAnyRefCountedObject (Kind) || isClass (Kind);
141
+ return isAnyRefCountedObject (Kind) || isClass (Kind) || isBridgeObject (Kind) ;
136
142
}
137
143
138
144
bool LayoutConstraintInfo::isNativeRefCounted (LayoutConstraintKind Kind) {
139
145
return Kind == LayoutConstraintKind::NativeRefCountedObject ||
140
146
Kind == LayoutConstraintKind::NativeClass;
141
147
}
142
148
149
+ bool LayoutConstraintInfo::isBridgeObject (LayoutConstraintKind Kind) {
150
+ return Kind == LayoutConstraintKind::BridgeObject;
151
+ }
152
+
143
153
SourceRange LayoutConstraintLoc::getSourceRange () const { return getLoc (); }
144
154
145
155
#define MERGE_LOOKUP (lhs, rhs ) \
@@ -170,50 +180,55 @@ static LayoutConstraintKind mergeTable[unsigned(E(LastLayout)) +
170
180
E (/* TrivialOfAtMostSize */ TrivialOfAtMostSize), E (/* Trivial */ Trivial),
171
181
E (/* Class */ Class), E (/* NativeClass */ NativeClass),
172
182
E (/* RefCountedObject*/ RefCountedObject),
173
- E (/* NativeRefCountedObject */ NativeRefCountedObject)},
183
+ E (/* NativeRefCountedObject */ NativeRefCountedObject), MERGE_CONFLICT },
174
184
175
185
// Initialize the row for TrivialOfExactSize.
176
186
{E (/* UnknownLayout */ TrivialOfExactSize),
177
187
E (/* TrivialOfExactSize */ TrivialOfExactSize), MERGE_CONFLICT,
178
188
E (/* Trivial */ TrivialOfExactSize), MERGE_CONFLICT, MERGE_CONFLICT,
179
- MERGE_CONFLICT, MERGE_CONFLICT},
189
+ MERGE_CONFLICT, MERGE_CONFLICT, MERGE_CONFLICT },
180
190
181
191
// Initialize the row for TrivialOfAtMostSize.
182
192
{E (/* UnknownLayout */ TrivialOfAtMostSize), MERGE_CONFLICT,
183
193
E (/* TrivialOfAtMostSize */ TrivialOfAtMostSize),
184
194
E (/* Trivial */ TrivialOfAtMostSize), MERGE_CONFLICT, MERGE_CONFLICT,
185
- MERGE_CONFLICT, MERGE_CONFLICT},
195
+ MERGE_CONFLICT, MERGE_CONFLICT, MERGE_CONFLICT },
186
196
187
197
// Initialize the row for Trivial.
188
198
{E (/* UnknownLayout */ Trivial),
189
199
E (/* TrivialOfExactSize */ TrivialOfExactSize),
190
200
E (/* TrivialOfAtMostSize */ TrivialOfAtMostSize), E (/* Trivial */ Trivial),
191
- MERGE_CONFLICT, MERGE_CONFLICT, MERGE_CONFLICT, MERGE_CONFLICT},
201
+ MERGE_CONFLICT, MERGE_CONFLICT, MERGE_CONFLICT, MERGE_CONFLICT,
202
+ MERGE_CONFLICT},
192
203
193
204
// Initialize the row for Class.
194
205
{E (/* UnknownLayout*/ Class), MERGE_CONFLICT, MERGE_CONFLICT,
195
206
MERGE_CONFLICT, E (/* Class */ Class), E (/* NativeClass */ NativeClass),
196
207
E (/* RefCountedObject */ Class),
197
- E (/* NativeRefCountedObject */ NativeClass)},
208
+ E (/* NativeRefCountedObject */ NativeClass), MERGE_CONFLICT },
198
209
199
210
// Initialize the row for NativeClass.
200
211
{E (/* UnknownLayout */ NativeClass), MERGE_CONFLICT, MERGE_CONFLICT,
201
212
MERGE_CONFLICT, E (/* Class */ NativeClass),
202
213
E (/* NativeClass */ NativeClass), E (/* RefCountedObject */ NativeClass),
203
- E (/* NativeRefCountedObject */ NativeClass)},
214
+ E (/* NativeRefCountedObject */ NativeClass), MERGE_CONFLICT },
204
215
205
216
// Initialize the row for RefCountedObject.
206
217
{E (/* UnknownLayout */ RefCountedObject), MERGE_CONFLICT, MERGE_CONFLICT,
207
218
MERGE_CONFLICT, E (/* Class */ Class), E (/* NativeClass */ NativeClass),
208
219
E (/* RefCountedObject */ RefCountedObject),
209
- E (/* NativeRefCountedObject */ NativeRefCountedObject)},
220
+ E (/* NativeRefCountedObject */ NativeRefCountedObject), MERGE_CONFLICT },
210
221
211
222
// Initialize the row for NativeRefCountedObject.
212
223
{E (/* UnknownLayout */ NativeRefCountedObject), MERGE_CONFLICT,
213
224
MERGE_CONFLICT, MERGE_CONFLICT, E (/* Class */ NativeClass),
214
225
E (/* NativeClass */ NativeClass),
215
226
E (/* RefCountedObject */ NativeRefCountedObject),
216
- E (/* NativeRefCountedObject*/ NativeRefCountedObject)},
227
+ E (/* NativeRefCountedObject*/ NativeRefCountedObject), MERGE_CONFLICT},
228
+
229
+ {E (BridgeObject), MERGE_CONFLICT, MERGE_CONFLICT, MERGE_CONFLICT,
230
+ MERGE_CONFLICT, MERGE_CONFLICT, MERGE_CONFLICT, MERGE_CONFLICT,
231
+ E (/* BridgeObject*/ BridgeObject)},
217
232
};
218
233
219
234
#undef E
@@ -324,6 +339,8 @@ LayoutConstraint::getLayoutConstraint(LayoutConstraintKind Kind) {
324
339
&LayoutConstraintInfo::RefCountedObjectConstraintInfo);
325
340
case LayoutConstraintKind::UnknownLayout:
326
341
return LayoutConstraint (&LayoutConstraintInfo::UnknownLayoutConstraintInfo);
342
+ case LayoutConstraintKind::BridgeObject:
343
+ return LayoutConstraint (&LayoutConstraintInfo::BridgeObjectConstraintInfo);
327
344
case LayoutConstraintKind::TrivialOfAtMostSize:
328
345
case LayoutConstraintKind::TrivialOfExactSize:
329
346
llvm_unreachable (" Wrong layout constraint kind" );
@@ -352,6 +369,9 @@ LayoutConstraintInfo LayoutConstraintInfo::NativeClassConstraintInfo(
352
369
LayoutConstraintInfo LayoutConstraintInfo::TrivialConstraintInfo (
353
370
LayoutConstraintKind::Trivial);
354
371
372
+ LayoutConstraintInfo LayoutConstraintInfo::BridgeObjectConstraintInfo (
373
+ LayoutConstraintKind::BridgeObject);
374
+
355
375
int LayoutConstraint::compare (LayoutConstraint rhs) const {
356
376
if (Ptr->getKind () != rhs->getKind ())
357
377
return int (rhs->getKind ()) - int (Ptr->getKind ());
0 commit comments