Files
swift-mirror/test/ClangImporter
John Hui f830b1c665 [ClangImporter] Do not import enum when already imported via DeclContext (#85424)
If we try to import this in ObjC interop mode:

```objc
typedef CF_OPTIONS(uint32_t, MyFlags) {
  ...
} CF_SWIFT_NAME(MyCtx.Flags);

struct MyStruct {
  MyFlags flags;
  ...
} CF_SWIFT_NAME(MyCtx);
```

ClangImporter tries to import `MyCtx/MyStruct` before it imports
`MyFlags` (via `importDeclContextOf()`), which in turn tries to import
`MyFlags` again due to the `flags` field. The existing cycle-breaking
mechanism prevents us from looping infinitely, but leads us to import
two copies of the Swift `EnumDecl`, which can cause errors later during
CodeGen.

~~This patch adds an assertion to catch such issues earlier, and breaks
the cycle by checking the cache again.~~ This patch no longer does so
because that caused issues beyond the scope of this patch.

rdar://162317760
2025-11-17 13:18:59 -08:00
..
2025-10-07 13:22:34 -07:00
2024-05-28 12:59:26 -07:00
2021-06-07 12:04:31 -07:00