Commit 607fd9f
committed
[PrintAsObjc] Import/fwd-declare the unbridged type for known types.
For non-Clang types that conform to `_ObjectiveCBridgeable` but have
type mappings defined in `getKnownTypeInfo`, always use the Clang type
in the mapping to determine which module to import.
`CGFloat` is a rare case of an `_ObjectiveCBridgeable` type that is
a native Swift `struct` declared in an overlay instead of extending
the original Clang decl with the conformance. Since `hasClangNode`
returns false in this case, it fell through to the rest of the logic
for `getObjCBridgedClass` and would forward declare `@class NSNumber`
instead of `@import CoreGraphics`. Thus, in some cases (e.g., the
header only defines APIs that use `CGFloat`), the header would be
invalid.
Fixes SR-14266.1 parent ef318a1 commit 607fd9f
File tree
2 files changed
+36
-2
lines changed- lib/PrintAsObjC
- test/PrintAsObjC
2 files changed
+36
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1183 | 1183 | | |
1184 | 1184 | | |
1185 | 1185 | | |
1186 | | - | |
| 1186 | + | |
1187 | 1187 | | |
1188 | 1188 | | |
1189 | 1189 | | |
| |||
1371 | 1371 | | |
1372 | 1372 | | |
1373 | 1373 | | |
1374 | | - | |
| 1374 | + | |
| 1375 | + | |
1375 | 1376 | | |
1376 | 1377 | | |
1377 | 1378 | | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
1378 | 1383 | | |
1379 | 1384 | | |
1380 | 1385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments