mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This patch fixes an issue with C++-Interop that has been making it so that enums under interop were not getting properly looked up and therefore not getting imported. The reason for this was that the proper DeclContext was not getting applied when grabbing the decls use by VisitDecls later in the ClangImporter. The lookup code at SwiftLookupTable::lookup is given a clang TU which is what implcitly gets turned into an EffectiveClangContext. The EffectiveClangContext is the piece that decides which DeclContext to use. In the case of an extern "C" (ie LinkageSpecDecl), the EffectiveClangContext was not traversing inside the lexical scope of the extern "C" as the context for searching the EnumDecl (the NS_OPTIONS Enum). This patch adds new behavior when EffectiveClangContext is given a LinkageSpecDecl. It sets the DeclContext to the lexical decl context. With this fix in place in the presence of C++-Interop we not only import the NS_OPTIONS typedef properly, but we also import the enum (and therefore the EnumConstants) correctly (which are used for getting to the flags for populating the NS_OPTIONS bitfields.
24 lines
405 B
Plaintext
24 lines
405 B
Plaintext
module BoolEnums {
|
|
header "bool-enums.h"
|
|
requires cplusplus
|
|
}
|
|
|
|
module ScopedEnums {
|
|
header "scoped-enums.h"
|
|
requires cplusplus
|
|
}
|
|
|
|
module AnonymousWithSwiftName {
|
|
header "anonymous-with-swift-name.h"
|
|
requires cplusplus
|
|
}
|
|
|
|
module CenumsWithOptionsOmit {
|
|
header "c-enums-withOptions-omit.h"
|
|
requires cplusplus
|
|
}
|
|
|
|
module CenumsNSOptions {
|
|
header "c-enums-NS_OPTIONS.h"
|
|
requires cplusplus
|
|
} |