mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen: honour -static-libclosure in block creation
When creating a block, ensure that we correctly associate the DLL Storage on the `_NSConcreteStackBlock` root object declaration based upon whether we are generating code with `-static-libclosure` being passed to the clang importer or not.
This commit is contained in:
@@ -1170,10 +1170,15 @@ llvm::Constant *swift::getRuntimeFn(
|
||||
|
||||
if (IGM && useDllStorage(IGM->Triple) && IsExternal) {
|
||||
bool bIsImported = true;
|
||||
swift::ASTContext &Context = IGM->Context;
|
||||
if (IGM->getSwiftModule()->getPublicModuleName(true).str() == ModuleName)
|
||||
bIsImported = false;
|
||||
else if (ModuleDecl *MD = IGM->Context.getModuleByName(ModuleName))
|
||||
else if (ModuleDecl *MD = Context.getModuleByName(ModuleName))
|
||||
bIsImported = !MD->isStaticLibrary();
|
||||
else if (strcmp(ModuleName, "BlocksRuntime") == 0)
|
||||
bIsImported =
|
||||
!static_cast<ClangImporter *>(Context.getClangModuleLoader())
|
||||
->getCodeGenOpts().StaticClosure;
|
||||
|
||||
if (bIsImported)
|
||||
fn->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
|
||||
|
||||
Reference in New Issue
Block a user