Skip to content

Commit 59b1dee

Browse files
committed
Adjust to addition of llvm::Attribute::SwiftAsync
This the Swift change to go with the llvm PR swiftlang/llvm-project#2274.
1 parent a364394 commit 59b1dee

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,14 @@ static void addIndirectResultAttributes(IRGenModule &IGM,
487487
b);
488488
}
489489

490+
void IRGenModule::addSwiftAsyncContextAttributes(llvm::AttributeList &attrs,
491+
unsigned argIndex) {
492+
llvm::AttrBuilder b;
493+
b.addAttribute(llvm::Attribute::SwiftAsync);
494+
attrs = attrs.addAttributes(this->getLLVMContext(),
495+
argIndex + llvm::AttributeList::FirstArgIndex, b);
496+
}
497+
490498
void IRGenModule::addSwiftSelfAttributes(llvm::AttributeList &attrs,
491499
unsigned argIndex) {
492500
llvm::AttrBuilder b;
@@ -1515,6 +1523,9 @@ void SignatureExpansion::expandExternalSignatureTypes() {
15151523
switch (FI.getExtParameterInfo(i).getABI()) {
15161524
case clang::ParameterABI::Ordinary:
15171525
break;
1526+
case clang::ParameterABI::SwiftAsyncContext:
1527+
IGM.addSwiftAsyncContextAttributes(Attrs, getCurParamIndex());
1528+
break;
15181529
case clang::ParameterABI::SwiftContext:
15191530
IGM.addSwiftSelfAttributes(Attrs, getCurParamIndex());
15201531
break;

lib/IRGen/IRGenModule.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,6 +1620,9 @@ private: \
16201620
/// Add the swiftself attribute.
16211621
void addSwiftSelfAttributes(llvm::AttributeList &attrs, unsigned argIndex);
16221622

1623+
void addSwiftAsyncContextAttributes(llvm::AttributeList &attrs,
1624+
unsigned argIndex);
1625+
16231626
/// Add the swifterror attribute.
16241627
void addSwiftErrorAttributes(llvm::AttributeList &attrs, unsigned argIndex);
16251628

0 commit comments

Comments
 (0)