mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
PrintAsClang: Print @cdecl enums in the compatibility header
Print @cdecl enums in the C section of the compatibility header. Use and extend the macros to support C compiler clients. The macro is adapted to the features supported by the client compiler. It uses an Objective-C style macro with raw type when available and fallbacks to a simple typedef for C compatibility.
This commit is contained in:
@@ -530,6 +530,10 @@ public:
|
||||
}
|
||||
|
||||
void forwardDeclare(const EnumDecl *ED) {
|
||||
// Don't forward declare C enums.
|
||||
if (ED->getAttrs().getAttribute<CDeclAttr>())
|
||||
return;
|
||||
|
||||
assert(ED->isObjC() || ED->hasClangNode());
|
||||
|
||||
forwardDeclare(ED, [&]{
|
||||
@@ -864,7 +868,7 @@ public:
|
||||
|
||||
SmallVector<ProtocolConformance *, 1> conformances;
|
||||
auto errorTypeProto = ctx.getProtocol(KnownProtocolKind::Error);
|
||||
if (outputLangMode != OutputLanguageMode::Cxx
|
||||
if (outputLangMode == OutputLanguageMode::ObjC
|
||||
&& ED->lookupConformance(errorTypeProto, conformances)) {
|
||||
bool hasDomainCase = std::any_of(ED->getAllElements().begin(),
|
||||
ED->getAllElements().end(),
|
||||
|
||||
Reference in New Issue
Block a user