Skip to content

Commit 99eeda5

Browse files
committed
Fix for bad cherry-pick to the 6.2 branch
1 parent 9caa4a3 commit 99eeda5

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

lib/ClangImporter/SwiftDeclSynthesizer.cpp

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "swift/AST/Stmt.h"
2222
#include "swift/Basic/Assertions.h"
2323
#include "swift/ClangImporter/ClangImporterRequests.h"
24+
#include "swift/ClangImporter/CXXMethodBridging.h"
2425
#include "clang/AST/Mangle.h"
2526
#include "clang/Sema/DelayedDiagnostic.h"
2627

@@ -2902,43 +2903,3 @@ void SwiftDeclSynthesizer::addExplicitDeinitIfRequired(
29022903

29032904
nominal->addMember(destructor);
29042905
}
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

Comments
 (0)