mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
IRGen: Implement lowering of has_symbol SIL instruction.
This commit is contained in:
@@ -315,9 +315,6 @@ private:
|
||||
/// This is the set of undef values we've created, for uniquing purposes.
|
||||
llvm::DenseMap<SILType, SILUndef *> UndefValues;
|
||||
|
||||
/// The list of decls that require query functions for #_hasSymbol conditions.
|
||||
llvm::SetVector<ValueDecl *> hasSymbolDecls;
|
||||
|
||||
llvm::DenseMap<std::pair<Decl *, VarDecl *>, unsigned> fieldIndices;
|
||||
llvm::DenseMap<EnumElementDecl *, unsigned> enumCaseIndices;
|
||||
|
||||
@@ -703,12 +700,6 @@ public:
|
||||
return externallyVisible.count(decl) != 0;
|
||||
}
|
||||
|
||||
void addHasSymbolDecl(ValueDecl *decl) { hasSymbolDecls.insert(decl); }
|
||||
|
||||
ArrayRef<ValueDecl *> getHasSymbolDecls() {
|
||||
return hasSymbolDecls.getArrayRef();
|
||||
}
|
||||
|
||||
using sil_global_iterator = GlobalListType::iterator;
|
||||
using sil_global_const_iterator = GlobalListType::const_iterator;
|
||||
GlobalListType &getSILGlobalList() { return silGlobals; }
|
||||
|
||||
@@ -86,20 +86,19 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
void IRGenModule::emitHasSymbolFunctions() {
|
||||
SILSymbolVisitorOptions opts;
|
||||
opts.VisitMembers = false;
|
||||
auto silCtx = SILSymbolVisitorContext(getSwiftModule(), opts);
|
||||
auto linkInfo = UniversalLinkageInfo(*this);
|
||||
auto symbolVisitorCtx = IRSymbolVisitorContext(linkInfo, silCtx);
|
||||
llvm::Function *IRGenModule::emitHasSymbolFunction(ValueDecl *decl) {
|
||||
|
||||
for (ValueDecl *decl : getSILModule().getHasSymbolDecls()) {
|
||||
PrettyStackTraceDecl trace("emitting #_hasSymbol query for", decl);
|
||||
Mangle::ASTMangler mangler;
|
||||
|
||||
auto func = cast<llvm::Function>(getOrCreateHelperFunction(
|
||||
mangler.mangleHasSymbolQuery(decl), Int1Ty, {},
|
||||
[decl, this, symbolVisitorCtx](IRGenFunction &IGF) {
|
||||
[decl, this](IRGenFunction &IGF) {
|
||||
SILSymbolVisitorOptions opts;
|
||||
opts.VisitMembers = false;
|
||||
auto silCtx = SILSymbolVisitorContext(getSwiftModule(), opts);
|
||||
auto linkInfo = UniversalLinkageInfo(*this);
|
||||
auto symbolVisitorCtx = IRSymbolVisitorContext(linkInfo, silCtx);
|
||||
auto &Builder = IGF.Builder;
|
||||
llvm::SmallVector<llvm::Constant *, 4> addrs;
|
||||
HasSymbolIRGenVisitor(*this, addrs).visit(decl, symbolVisitorCtx);
|
||||
@@ -122,12 +121,8 @@ void IRGenModule::emitHasSymbolFunctions() {
|
||||
/*IsNoInline*/ false));
|
||||
|
||||
func->setDoesNotThrow();
|
||||
func->setCallingConv(SwiftCC);
|
||||
func->setCallingConv(DefaultCC);
|
||||
func->addFnAttr(llvm::Attribute::ReadOnly);
|
||||
}
|
||||
}
|
||||
|
||||
void IRGenerator::emitHasSymbolFunctions() {
|
||||
for (auto &IGM : *this)
|
||||
IGM.second->emitHasSymbolFunctions();
|
||||
return func;
|
||||
}
|
||||
|
||||
@@ -1348,9 +1348,6 @@ GeneratedModule IRGenRequest::evaluate(Evaluator &evaluator,
|
||||
// Okay, emit any definitions that we suddenly need.
|
||||
irgen.emitLazyDefinitions();
|
||||
|
||||
// Emit functions supporting `if #_hasSymbol(...)` conditions.
|
||||
IGM.emitHasSymbolFunctions();
|
||||
|
||||
// Register our info with the runtime if needed.
|
||||
if (Opts.UseJIT) {
|
||||
IGM.emitBuiltinReflectionMetadata();
|
||||
|
||||
@@ -432,9 +432,6 @@ public:
|
||||
/// Emit coverage mapping info.
|
||||
void emitCoverageMapping();
|
||||
|
||||
/// Emit helper functions for `if #_hasSymbol(...)` conditions.
|
||||
void emitHasSymbolFunctions();
|
||||
|
||||
/// Checks if metadata for this type can be emitted lazily. This is true for
|
||||
/// non-public types as well as imported types, except for classes and
|
||||
/// protocols which are always emitted eagerly.
|
||||
@@ -1832,7 +1829,7 @@ public:
|
||||
void emitRuntimeRegistration();
|
||||
void emitVTableStubs();
|
||||
void emitTypeVerifier();
|
||||
void emitHasSymbolFunctions();
|
||||
llvm::Function *emitHasSymbolFunction(ValueDecl *decl);
|
||||
|
||||
/// Create llvm metadata which encodes the branch weights given by
|
||||
/// \p TrueCount and \p FalseCount.
|
||||
|
||||
@@ -2614,7 +2614,12 @@ void IRGenSILFunction::visitDifferentiabilityWitnessFunctionInst(
|
||||
}
|
||||
|
||||
void IRGenSILFunction::visitHasSymbolInst(HasSymbolInst *i) {
|
||||
llvm_unreachable("unimplemented"); // FIXME: implement lowering
|
||||
auto fn = IGM.emitHasSymbolFunction(i->getDecl());
|
||||
llvm::CallInst *call = Builder.CreateCall(fn->getFunctionType(), fn, {});
|
||||
|
||||
Explosion e;
|
||||
e.add(call);
|
||||
setLoweredValue(i, e);
|
||||
}
|
||||
|
||||
FunctionPointer::Kind irgen::classifyFunctionPointerKind(SILFunction *fn) {
|
||||
|
||||
@@ -9,73 +9,115 @@
|
||||
|
||||
@_weakLinked import has_symbol_helper
|
||||
|
||||
func testGlobalFunctions() {
|
||||
public func testGlobalFunctions() {
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper8function4withySi_tFTwS"()
|
||||
if #_hasSymbol(function(with:)) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper8function4withySi_tFTwS"()
|
||||
// CHECK: ret i1 icmp ne (void ({{i32|i64}})* @"$s17has_symbol_helper8function4withySi_tF", void (i64)* null)
|
||||
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper12throwingFuncyyKFTwS"()
|
||||
if #_hasSymbol(throwingFunc) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper12throwingFuncyyKFTwS"()
|
||||
// CHECK: ret i1 icmp ne (void (%swift.refcounted*, %swift.error**)* @"$s17has_symbol_helper12throwingFuncyyKF", void (%swift.refcounted*, %swift.error**)* null)
|
||||
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper11genericFuncyyxAA1PRzlFTwS"()
|
||||
if #_hasSymbol(genericFunc(_:) as (S) -> Void) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper11genericFuncyyxAA1PRzlFTwS"()
|
||||
// CHECK: ret i1 icmp ne (void (%swift.opaque*, %swift.type*, i8**)* @"$s17has_symbol_helper11genericFuncyyxAA1PRzlF", void (%swift.opaque*, %swift.type*, i8**)* null)
|
||||
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper20funcWithOpaqueResultQryFTwS"()
|
||||
if #_hasSymbol(funcWithOpaqueResult) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper20funcWithOpaqueResultQryFTwS"()
|
||||
// CHECK: ret i1 and (i1 icmp ne (%swift.type_descriptor* @"$s17has_symbol_helper20funcWithOpaqueResultQryFQOMQ", %swift.type_descriptor* null), i1 icmp ne (void (%swift.opaque*)* @"$s17has_symbol_helper20funcWithOpaqueResultQryF", void (%swift.opaque*)* null))
|
||||
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper9cdeclFuncyyFTwS"()
|
||||
if #_hasSymbol(cdeclFunc) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper9cdeclFuncyyFTwS"()
|
||||
// CHECK: ret i1 and (i1 icmp ne (void ()* @"$s17has_symbol_helper9cdeclFuncyyF", void ()* null), i1 icmp ne (void ()* @cdecl_func, void ()* null))
|
||||
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper19forwardDeclaredFuncyyFTwS"()
|
||||
if #_hasSymbol(forwardDeclaredFunc) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper19forwardDeclaredFuncyyFTwS"()
|
||||
// CHECK: ret i1 icmp ne (void ()* @forward_declared_func, void ()* null)
|
||||
|
||||
// FIXME: Test `dynamic` functions
|
||||
// FIXME: Test `dynamic` functions with opaque return types
|
||||
}
|
||||
|
||||
func testVars() {
|
||||
// --- function(with:) ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper8function4withySi_tFTwS"()
|
||||
// CHECK: ret i1 icmp ne (void ({{i32|i64}})* @"$s17has_symbol_helper8function4withySi_tF", void (i64)* null)
|
||||
|
||||
// --- throwingFunc() ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper12throwingFuncyyKFTwS"()
|
||||
// CHECK: ret i1 icmp ne (void (%swift.refcounted*, %swift.error**)* @"$s17has_symbol_helper12throwingFuncyyKF", void (%swift.refcounted*, %swift.error**)* null)
|
||||
|
||||
// --- genericFunc(_:) ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper11genericFuncyyxAA1PRzlFTwS"()
|
||||
// CHECK: ret i1 icmp ne (void (%swift.opaque*, %swift.type*, i8**)* @"$s17has_symbol_helper11genericFuncyyxAA1PRzlF", void (%swift.opaque*, %swift.type*, i8**)* null)
|
||||
|
||||
// --- funcWithOpaqueResult() ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper20funcWithOpaqueResultQryFTwS"()
|
||||
// CHECK: ret i1 and (i1 icmp ne (%swift.type_descriptor* @"$s17has_symbol_helper20funcWithOpaqueResultQryFQOMQ", %swift.type_descriptor* null), i1 icmp ne (void (%swift.opaque*)* @"$s17has_symbol_helper20funcWithOpaqueResultQryF", void (%swift.opaque*)* null))
|
||||
|
||||
// --- cdeclFunc() ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper9cdeclFuncyyFTwS"()
|
||||
// CHECK: ret i1 and (i1 icmp ne (void ()* @"$s17has_symbol_helper9cdeclFuncyyF", void ()* null), i1 icmp ne (void ()* @cdecl_func, void ()* null))
|
||||
|
||||
// --- forwardDeclaredFunc() ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper19forwardDeclaredFuncyyFTwS"()
|
||||
// CHECK: ret i1 icmp ne (void ()* @forward_declared_func, void ()* null)
|
||||
|
||||
public func testVars() {
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper6globalSivpTwS"()
|
||||
if #_hasSymbol(global) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper6globalSivpTwS"()
|
||||
// CHECK: ret i1 icmp ne (i64 ()* @"$s17has_symbol_helper6globalSivg", i64 ()* null)
|
||||
}
|
||||
|
||||
func testClass(_ c: C) {
|
||||
// --- global ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper6globalSivpTwS"()
|
||||
// CHECK: ret i1 icmp ne (i64 ()* @"$s17has_symbol_helper6globalSivg", i64 ()* null)
|
||||
|
||||
public func testClass(_ c: C) {
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1CCACycfcTwS"()
|
||||
if #_hasSymbol(C.init) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1CCACycfcTwS"()
|
||||
// CHECK: ret i1 and (i1 icmp ne (%T17has_symbol_helper1CC* (%T17has_symbol_helper1CC*)* @"$s17has_symbol_helper1CCACycfc", %T17has_symbol_helper1CC* (%T17has_symbol_helper1CC*)* null), i1 icmp ne (%T17has_symbol_helper1CC* (%swift.type*)* @"$s17has_symbol_helper1CCACycfC", %T17has_symbol_helper1CC* (%swift.type*)* null))
|
||||
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1CC6method4withySi_tFTwS"()
|
||||
if #_hasSymbol(c.method(with:)) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1CC6method4withySi_tFTwS"()
|
||||
// CHECK: ret i1 and (i1 icmp ne (void (i64, %T17has_symbol_helper1CC*)* @"$s17has_symbol_helper1CC6method4withySi_tFTj", void (i64, %T17has_symbol_helper1CC*)* null), i1 icmp ne (%swift.method_descriptor* @"$s17has_symbol_helper1CC6method4withySi_tFTq", %swift.method_descriptor* null))
|
||||
}
|
||||
|
||||
func testStruct(_ s: S) {
|
||||
// --- C.init() ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1CCACycfcTwS"()
|
||||
// CHECK: ret i1 and (i1 icmp ne (%T17has_symbol_helper1CC* (%T17has_symbol_helper1CC*)* @"$s17has_symbol_helper1CCACycfc", %T17has_symbol_helper1CC* (%T17has_symbol_helper1CC*)* null), i1 icmp ne (%T17has_symbol_helper1CC* (%swift.type*)* @"$s17has_symbol_helper1CCACycfC", %T17has_symbol_helper1CC* (%swift.type*)* null))
|
||||
|
||||
// --- C.method(with:) ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1CC6method4withySi_tFTwS"()
|
||||
// CHECK: ret i1 and (i1 icmp ne (void (i64, %T17has_symbol_helper1CC*)* @"$s17has_symbol_helper1CC6method4withySi_tFTj", void (i64, %T17has_symbol_helper1CC*)* null), i1 icmp ne (%swift.method_descriptor* @"$s17has_symbol_helper1CC6method4withySi_tFTq", %swift.method_descriptor* null))
|
||||
|
||||
public func testStruct(_ s: S) {
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1SV6memberSivpTwS"()
|
||||
if #_hasSymbol(s.member) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1SV6memberSivpTwS"()
|
||||
// CHECK: ret i1 and (i1 and (i1 and (i1 icmp ne (%swift.type_descriptor* @"$s17has_symbol_helper1SV6memberSivpMV", %swift.type_descriptor* null), i1 icmp ne (i64 (%swift.opaque*)* @"$s17has_symbol_helper1SV6memberSivg", i64 (%swift.opaque*)* null)), i1 icmp ne (void (i64, %swift.opaque*)* @"$s17has_symbol_helper1SV6memberSivs", void (i64, %swift.opaque*)* null)), i1 icmp ne ({ i8*, %TSi* } (i8*, %swift.opaque*)* @"$s17has_symbol_helper1SV6memberSivM", { i8*, %TSi* } (i8*, %swift.opaque*)* null))
|
||||
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1SV6method4withySi_tFTwS"()
|
||||
if #_hasSymbol(s.method(with:)) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1SV6method4withySi_tFTwS"()
|
||||
// CHECK: ret i1 icmp ne (void (i64, %swift.opaque*)* @"$s17has_symbol_helper1SV6method4withySi_tF", void (i64, %swift.opaque*)* null)
|
||||
}
|
||||
|
||||
func testEnum(_ e: E) {
|
||||
// --- S.member ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1SV6memberSivpTwS"()
|
||||
// CHECK: ret i1 and (i1 and (i1 and (i1 icmp ne (%swift.type_descriptor* @"$s17has_symbol_helper1SV6memberSivpMV", %swift.type_descriptor* null), i1 icmp ne (i64 (%swift.opaque*)* @"$s17has_symbol_helper1SV6memberSivg", i64 (%swift.opaque*)* null)), i1 icmp ne (void (i64, %swift.opaque*)* @"$s17has_symbol_helper1SV6memberSivs", void (i64, %swift.opaque*)* null)), i1 icmp ne ({ i8*, %TSi* } (i8*, %swift.opaque*)* @"$s17has_symbol_helper1SV6memberSivM", { i8*, %TSi* } (i8*, %swift.opaque*)* null))
|
||||
|
||||
// --- S.method(with:) ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1SV6method4withySi_tFTwS"()
|
||||
// CHECK: ret i1 icmp ne (void (i64, %swift.opaque*)* @"$s17has_symbol_helper1SV6method4withySi_tF", void (i64, %swift.opaque*)* null)
|
||||
|
||||
public func testEnum(_ e: E) {
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1EO9basicCaseyA2CmFTwS"()
|
||||
if #_hasSymbol(E.basicCase) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1EO9basicCaseyA2CmFTwS"()
|
||||
// CHECK: ret i1 icmp ne (i32* @"$s17has_symbol_helper1EO9basicCaseyA2CmFWC", i32* null)
|
||||
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1EO11payloadCaseyAcA1SVcACmFTwS"()
|
||||
if #_hasSymbol(E.payloadCase) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1EO11payloadCaseyAcA1SVcACmFTwS"()
|
||||
// CHECK: ret i1 icmp ne (i32* @"$s17has_symbol_helper1EO11payloadCaseyAcA1SVcACmFWC", i32* null)
|
||||
}
|
||||
|
||||
func testMetatypes() {
|
||||
// --- E.basicCase ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1EO9basicCaseyA2CmFTwS"()
|
||||
// CHECK: ret i1 icmp ne (i32* @"$s17has_symbol_helper1EO9basicCaseyA2CmFWC", i32* null)
|
||||
|
||||
// --- E.payloadCase(_:) ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1EO11payloadCaseyAcA1SVcACmFTwS"()
|
||||
// CHECK: ret i1 icmp ne (i32* @"$s17has_symbol_helper1EO11payloadCaseyAcA1SVcACmFWC", i32* null)
|
||||
|
||||
public func testMetatypes() {
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1SVTwS"()
|
||||
if #_hasSymbol(S.self) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1SVTwS"()
|
||||
// CHECK: ret i1 and (i1 and (i1 icmp ne (%swift.type_descriptor* @"$s17has_symbol_helper1SVMn", %swift.type_descriptor* null), i1 icmp ne (%swift.type* @"$s17has_symbol_helper1SVN", %swift.type* null)), i1 icmp ne (%swift.metadata_response (i64)* @"$s17has_symbol_helper1SVMa", %swift.metadata_response (i64)* null))
|
||||
}
|
||||
|
||||
// --- S.self ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1SVTwS"()
|
||||
// CHECK: ret i1 and (i1 and (i1 icmp ne (%swift.type_descriptor* @"$s17has_symbol_helper1SVMn", %swift.type_descriptor* null), i1 icmp ne (%swift.type* @"$s17has_symbol_helper1SVN", %swift.type* null)), i1 icmp ne (%swift.metadata_response (i64)* @"$s17has_symbol_helper1SVMa", %swift.metadata_response (i64)* null))
|
||||
|
||||
@@ -7,24 +7,36 @@
|
||||
|
||||
@_weakLinked import has_symbol_helper
|
||||
|
||||
func testGlobalFunctions() {
|
||||
public func testGlobalFunctions() {
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper9asyncFuncyyYaFTwS"()
|
||||
if #_hasSymbol(asyncFunc) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper9asyncFuncyyYaFTwS"()
|
||||
// CHECK: ret i1 and (i1 icmp ne (void (%swift.context*)* @"$s17has_symbol_helper9asyncFuncyyYaF", void (%swift.context*)* null), i1 icmp ne (%swift.async_func_pointer* @"$s17has_symbol_helper9asyncFuncyyYaFTu", %swift.async_func_pointer* null))
|
||||
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper12isolatedFuncyyFTwS"()
|
||||
if #_hasSymbol(isolatedFunc) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper12isolatedFuncyyFTwS"()
|
||||
// CHECK: ret i1 icmp ne (void ()* @"$s17has_symbol_helper12isolatedFuncyyF", void ()* null)
|
||||
}
|
||||
|
||||
func testActor(_ a: A) {
|
||||
if #_hasSymbol(A.init) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1ACACycfcTwS"()
|
||||
// CHECK: ret i1 and (i1 icmp ne (%T17has_symbol_helper1AC* (%T17has_symbol_helper1AC*)* @"$s17has_symbol_helper1ACACycfc", %T17has_symbol_helper1AC* (%T17has_symbol_helper1AC*)* null), i1 icmp ne (%T17has_symbol_helper1AC* (%swift.type*)* @"$s17has_symbol_helper1ACACycfC", %T17has_symbol_helper1AC* (%swift.type*)* null))
|
||||
// --- asyncFunc() ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper9asyncFuncyyYaFTwS"()
|
||||
// CHECK: ret i1 and (i1 icmp ne (void (%swift.context*)* @"$s17has_symbol_helper9asyncFuncyyYaF", void (%swift.context*)* null), i1 icmp ne (%swift.async_func_pointer* @"$s17has_symbol_helper9asyncFuncyyYaFTu", %swift.async_func_pointer* null))
|
||||
|
||||
// --- isolatedFunc() ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper12isolatedFuncyyFTwS"()
|
||||
// CHECK: ret i1 icmp ne (void ()* @"$s17has_symbol_helper12isolatedFuncyyF", void ()* null)
|
||||
|
||||
public func testActor(_ a: A) {
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1ACACycfcTwS"()
|
||||
if #_hasSymbol(A.init) {}
|
||||
|
||||
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1AC11asyncMethodyyYaFTwS"()
|
||||
if #_hasSymbol(a.asyncMethod) {}
|
||||
// CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1AC11asyncMethodyyYaFTwS"()
|
||||
// CHECK: ret i1 and (i1 and (i1 icmp ne (void (%swift.context*, %T17has_symbol_helper1AC*)* @"$s17has_symbol_helper1AC11asyncMethodyyYaFTj", void (%swift.context*, %T17has_symbol_helper1AC*)* null), i1 icmp ne (%swift.async_func_pointer* @"$s17has_symbol_helper1AC11asyncMethodyyYaFTjTu", %swift.async_func_pointer* null)), i1 icmp ne (%swift.method_descriptor* @"$s17has_symbol_helper1AC11asyncMethodyyYaFTq", %swift.method_descriptor* null))
|
||||
|
||||
// FIXME: Add support for actor isolated methods
|
||||
}
|
||||
|
||||
// --- A.init() ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1ACACycfcTwS"()
|
||||
// CHECK: ret i1 and (i1 icmp ne (%T17has_symbol_helper1AC* (%T17has_symbol_helper1AC*)* @"$s17has_symbol_helper1ACACycfc", %T17has_symbol_helper1AC* (%T17has_symbol_helper1AC*)* null), i1 icmp ne (%T17has_symbol_helper1AC* (%swift.type*)* @"$s17has_symbol_helper1ACACycfC", %T17has_symbol_helper1AC* (%swift.type*)* null))
|
||||
|
||||
// --- A.asyncMethod() ---
|
||||
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1AC11asyncMethodyyYaFTwS"()
|
||||
// CHECK: ret i1 and (i1 and (i1 icmp ne (void (%swift.context*, %T17has_symbol_helper1AC*)* @"$s17has_symbol_helper1AC11asyncMethodyyYaFTj", void (%swift.context*, %T17has_symbol_helper1AC*)* null), i1 icmp ne (%swift.async_func_pointer* @"$s17has_symbol_helper1AC11asyncMethodyyYaFTjTu", %swift.async_func_pointer* null)), i1 icmp ne (%swift.method_descriptor* @"$s17has_symbol_helper1AC11asyncMethodyyYaFTq", %swift.method_descriptor* null))
|
||||
|
||||
Reference in New Issue
Block a user