summaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorTim Northover <t.p.northover@gmail.com>2020-12-17 13:29:40 +0000
committerTim Northover <t.p.northover@gmail.com>2020-12-18 18:58:22 +0000
commit36e0c08ed8ac0ab51608baaaad625266e603c11f (patch)
tree1c7df10fc7559db0d35a2a76bcf930d0b0a0a057 /clang/lib/Sema/SemaDeclAttr.cpp
parentbdc0a1d6fda17a527fad86d5af7e49b4c0a9ad60 (diff)
downloadllvm-cherry-pick-something.tar.gz
Swift support: add __attribute__((swift_async_context)) to args.cherry-pick-something
This translates to "swiftasync" LLVM attribute.
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index ae68bc70f6ba..a1627fd53a69 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -4795,6 +4795,14 @@ void Sema::AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI,
D->addAttr(::new (Context) SwiftContextAttr(Context, CI));
return;
+ case ParameterABI::SwiftAsyncContext:
+ if (!isValidSwiftContextType(type)) {
+ Diag(CI.getLoc(), diag::err_swift_abi_parameter_wrong_type)
+ << getParameterABISpelling(abi) << /*pointer to pointer */ 0 << type;
+ }
+ D->addAttr(::new (Context) SwiftAsyncContextAttr(Context, CI));
+ return;
+
case ParameterABI::SwiftErrorResult:
if (!isValidSwiftErrorResultType(type)) {
Diag(CI.getLoc(), diag::err_swift_abi_parameter_wrong_type)
@@ -7838,6 +7846,9 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
case ParsedAttr::AT_SwiftContext:
S.AddParameterABIAttr(D, AL, ParameterABI::SwiftContext);
break;
+ case ParsedAttr::AT_SwiftAsyncContext:
+ S.AddParameterABIAttr(D, AL, ParameterABI::SwiftAsyncContext);
+ break;
case ParsedAttr::AT_SwiftErrorResult:
S.AddParameterABIAttr(D, AL, ParameterABI::SwiftErrorResult);
break;