|
21 | 21 | #include "swift/AST/Stmt.h"
|
22 | 22 | #include "swift/Basic/Assertions.h"
|
23 | 23 | #include "swift/ClangImporter/ClangImporterRequests.h"
|
| 24 | +#include "swift/ClangImporter/CXXMethodBridging.h" |
24 | 25 | #include "clang/AST/Mangle.h"
|
25 | 26 | #include "clang/Sema/DelayedDiagnostic.h"
|
26 | 27 |
|
@@ -2902,43 +2903,3 @@ void SwiftDeclSynthesizer::addExplicitDeinitIfRequired(
|
2902 | 2903 |
|
2903 | 2904 | nominal->addMember(destructor);
|
2904 | 2905 | }
|
2905 |
| - |
2906 |
| -FuncDecl *SwiftDeclSynthesizer::makeAvailabilityDomainPredicate( |
2907 |
| - const clang::VarDecl *var) { |
2908 |
| - ASTContext &ctx = ImporterImpl.SwiftContext; |
2909 |
| - clang::ASTContext &clangCtx = var->getASTContext(); |
2910 |
| - auto featureInfo = |
2911 |
| - clangCtx.getFeatureAvailInfo(const_cast<clang::VarDecl *>(var)); |
2912 |
| - |
2913 |
| - // If the decl doesn't represent and availability domain, skip it. |
2914 |
| - if (featureInfo.first.empty()) |
2915 |
| - return nullptr; |
2916 |
| - |
2917 |
| - // Only dynamic availability domains require a predicate function. |
2918 |
| - if (featureInfo.second.Kind != clang::FeatureAvailKind::Dynamic) |
2919 |
| - return nullptr; |
2920 |
| - |
2921 |
| - if (!featureInfo.second.Call) |
2922 |
| - return nullptr; |
2923 |
| - |
2924 |
| - // Synthesize `func __swift_XYZ_isAvailable() -> Builtin.Int1 { ... }`. |
2925 |
| - std::string s; |
2926 |
| - llvm::raw_string_ostream os(s); |
2927 |
| - os << "__swift_" << featureInfo.first << "_isAvailable"; |
2928 |
| - DeclName funcName(ctx, DeclBaseName(ctx.getIdentifier(s)), |
2929 |
| - ParameterList::createEmpty(ctx)); |
2930 |
| - |
2931 |
| - auto funcDecl = FuncDecl::createImplicit( |
2932 |
| - ctx, StaticSpellingKind::None, funcName, SourceLoc(), /*Async=*/false, |
2933 |
| - /*Throws=*/false, Type(), {}, ParameterList::createEmpty(ctx), |
2934 |
| - BuiltinIntegerType::get(1, ctx), ImporterImpl.ImportedHeaderUnit); |
2935 |
| - funcDecl->setBodySynthesizer(synthesizeAvailabilityDomainPredicateBody, |
2936 |
| - (void *)var); |
2937 |
| - funcDecl->setAccess(AccessLevel::Public); |
2938 |
| - funcDecl->getAttrs().add(new (ctx) |
2939 |
| - AlwaysEmitIntoClientAttr(/*IsImplicit=*/true)); |
2940 |
| - |
2941 |
| - ImporterImpl.availabilityDomainPredicates[var] = funcDecl; |
2942 |
| - |
2943 |
| - return funcDecl; |
2944 |
| -} |
0 commit comments