aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorPavel Yaskevich <xedin@apache.org>2024-10-31 04:15:22 -0700
committerGitHub <noreply@github.com>2024-10-31 11:15:22 +0000
commitd3daa3c4435a54f7876d0ced81787fea92e77d08 (patch)
treeaf15240c5e52e59378c2cbf8f7f20b0c911cddab /clang/lib/Sema/SemaDecl.cpp
parent95c5042db8f962f382edb09c8f4c514e57c23c4c (diff)
downloadllvm-d3daa3c4435a54f7876d0ced81787fea92e77d08.zip
llvm-d3daa3c4435a54f7876d0ced81787fea92e77d08.tar.gz
llvm-d3daa3c4435a54f7876d0ced81787fea92e77d08.tar.bz2
[clang/AST] Make it possible to use SwiftAttr in type context (#108631)
Swift ClangImporter now supports concurrency annotations on imported declarations and their parameters/results, to make it possible to use imported APIs in Swift safely there has to be a way to annotate individual parameters and result types with relevant attributes that indicate that e.g. a block is called on a particular actor or it accepts a `Sendable` parameter. To faciliate that `SwiftAttr` is switched from `InheritableAttr` which is a declaration attribute to `DeclOrTypeAttr`. To support this attribute in type context we need access to its "Attribute" argument which requires `AttributedType` to be extended to include `Attr *` when available instead of just `attr::Kind` otherwise it won't be possible to determine what attribute should be imported.
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index f8e5f3c..c56883a 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3332,9 +3332,7 @@ static void mergeParamDeclTypes(ParmVarDecl *NewParam,
}
} else {
QualType NewT = NewParam->getType();
- NewT = S.Context.getAttributedType(
- AttributedType::getNullabilityAttrKind(*Oldnullability),
- NewT, NewT);
+ NewT = S.Context.getAttributedType(*Oldnullability, NewT, NewT);
NewParam->setType(NewT);
}
}