mirror of
https://github.com/apple/swift.git
synced 2026-10-26 20:15:53 +01:00
That is, when we have:
struct Foo {
enum Bar { B1, B2 };
};
We should be able to access Foo.B1 and Foo.B2 in Swift just as we would
access Foo::B1 and Foo::B2 in C++.
The previous commit makes this lookup possible, but doesn't load those
members when dumping the module interface. This patch fixes the member
loading path.
Furthermore, it *broke* ObjC interop, whereby those enum members were
available at the top-level scope, to be consistent with C scoping rules.
This patch fixes that by changing the effective Clang context for such
enums to be the enclosing struct, rather than the translation unit.
Closes #54905
Closes #62127
rdar://175283372
30 lines
313 B
C++
30 lines
313 B
C++
#pragma once
|
|
|
|
struct Struct {
|
|
enum class Scoped {
|
|
S1, S2, S3
|
|
};
|
|
|
|
enum Unscoped {
|
|
U1, U2, U3
|
|
};
|
|
|
|
enum /* anonymous */ {
|
|
A1, A2, A3
|
|
};
|
|
};
|
|
|
|
namespace Namespace {
|
|
enum class Scoped {
|
|
S1, S2, S3
|
|
};
|
|
|
|
enum Unscoped {
|
|
U1, U2, U3
|
|
};
|
|
|
|
enum /* anonymous */ {
|
|
A1, A2, A3
|
|
};
|
|
};
|