Skip to content

Commit 3666e02

Browse files
authored
Merge pull request swiftlang#20544 from compnerd/blocks-abi
IRGen: conform to the BlocksRuntime ABI
2 parents f212d18 + cddc106 commit 3666e02

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/IRGen/GenFunc.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
#include "swift/AST/PrettyStackTrace.h"
7878
#include "swift/AST/SubstitutionMap.h"
7979
#include "swift/AST/Types.h"
80+
#include "clang/AST/ASTContext.h"
8081
#include "clang/CodeGen/CodeGenABITypes.h"
8182
#include "llvm/IR/Constants.h"
8283
#include "llvm/IR/DerivedTypes.h"
@@ -1648,8 +1649,13 @@ void irgen::emitBlockHeader(IRGenFunction &IGF,
16481649
// Build the block descriptor.
16491650
ConstantInitBuilder builder(IGF.IGM);
16501651
auto descriptorFields = builder.beginStruct();
1651-
descriptorFields.addInt(IGF.IGM.IntPtrTy, 0);
1652-
descriptorFields.addInt(IGF.IGM.IntPtrTy,
1652+
1653+
const clang::ASTContext &ASTContext = IGF.IGM.getClangASTContext();
1654+
llvm::IntegerType *UnsignedLongTy =
1655+
llvm::IntegerType::get(IGF.IGM.LLVMContext,
1656+
ASTContext.getTypeSize(ASTContext.UnsignedLongTy));
1657+
descriptorFields.addInt(UnsignedLongTy, 0);
1658+
descriptorFields.addInt(UnsignedLongTy,
16531659
storageTL.getFixedSize().getValue());
16541660

16551661
if (!isPOD) {

0 commit comments

Comments
 (0)