@@ -7023,23 +7023,26 @@ void ClangImporter::withSymbolicFeatureEnabled(
70237023 oldImportSymbolicCXXDecls.get ());
70247024}
70257025
7026- const clang::TypedefType *ClangImporter::getTypedefForCXXCFOptionsDefinition (
7027- const clang::Decl *candidateDecl, const ASTContext &ctx) {
7028- if (!ctx.LangOpts .EnableCXXInterop )
7026+ const clang::TypedefType *ClangImporter::getTypeDefForCXXCFOptionsDefinition (
7027+ const clang::Decl *candidateDecl) {
7028+
7029+ if (!Impl.SwiftContext .LangOpts .EnableCXXInterop )
70297030 return nullptr ;
70307031
70317032 auto enumDecl = dyn_cast<clang::EnumDecl>(candidateDecl);
70327033 if (!enumDecl)
70337034 return nullptr ;
7035+
70347036 if (!enumDecl->getDeclName ().isEmpty ())
70357037 return nullptr ;
70367038
70377039 const clang::ElaboratedType *elaboratedType =
7038- enumDecl-> getIntegerType ()-> getAs <clang::ElaboratedType>();
7040+ dyn_cast <clang::ElaboratedType>(enumDecl-> getIntegerType (). getTypePtr () );
70397041 if (auto typedefType =
70407042 elaboratedType
70417043 ? dyn_cast<clang::TypedefType>(elaboratedType->desugar ())
7042- : enumDecl->getIntegerType ()->getAs <clang::TypedefType>()) {
7044+ : dyn_cast<clang::TypedefType>(
7045+ enumDecl->getIntegerType ().getTypePtr ())) {
70437046 auto enumExtensibilityAttr =
70447047 elaboratedType
70457048 ? enumDecl->getAttr <clang::EnumExtensibilityAttr>()
@@ -7052,13 +7055,8 @@ const clang::TypedefType *ClangImporter::getTypedefForCXXCFOptionsDefinition(
70527055 enumExtensibilityAttr->getExtensibility () ==
70537056 clang::EnumExtensibilityAttr::Open &&
70547057 hasFlagEnumAttr) {
7055- // Make sure the typedef is marked as unavailable in Swift.
7056- auto typedefDecl = typedefType->getDecl ();
7057- for (auto *attr :
7058- typedefDecl->specific_attrs <clang::AvailabilityAttr>()) {
7059- if (attr->getPlatform ()->getName () == " swift" )
7060- return typedefType;
7061- }
7058+ return Impl.isUnavailableInSwift (typedefType->getDecl ()) ? typedefType
7059+ : nullptr ;
70627060 }
70637061 }
70647062
0 commit comments