[PATCH] D86218: Teach the swift calling convention about _Atomic types
Arnold Schwaighofer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 19 09:07:07 PDT 2020
aschwaighofer updated this revision to Diff 286575.
aschwaighofer added a comment.
Try to sooth clang-tidy
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86218/new/
https://reviews.llvm.org/D86218
Files:
clang/lib/CodeGen/SwiftCallingConv.cpp
clang/test/CodeGen/64bit-swiftcall.c
Index: clang/test/CodeGen/64bit-swiftcall.c
===================================================================
--- clang/test/CodeGen/64bit-swiftcall.c
+++ clang/test/CodeGen/64bit-swiftcall.c
@@ -1042,3 +1042,15 @@
// CHECK-NOT: call void @llvm.lifetime.
take_int5(return_int5());
}
+
+typedef struct {
+ unsigned long long a;
+ unsigned long long b;
+} double_word;
+
+typedef struct {
+ _Atomic(double_word) a;
+} atomic_double_word;
+
+// CHECK-LABEL: use_atomic(i64 %0, i64 %1)
+SWIFTCALL void use_atomic(atomic_double_word a) {}
Index: clang/lib/CodeGen/SwiftCallingConv.cpp
===================================================================
--- clang/lib/CodeGen/SwiftCallingConv.cpp
+++ clang/lib/CodeGen/SwiftCallingConv.cpp
@@ -62,9 +62,12 @@
void SwiftAggLowering::addTypedData(QualType type, CharUnits begin) {
// Deal with various aggregate types as special cases:
+ // Atomic types.
+ if (const auto *atomicType = type->getAs<AtomicType>()) {
+ addTypedData(atomicType->getValueType(), begin);
- // Record types.
- if (auto recType = type->getAs<RecordType>()) {
+ // Record types.
+ } else if (const auto *recType = type->getAs<RecordType>()) {
addTypedData(recType->getDecl(), begin);
// Array types.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86218.286575.patch
Type: text/x-patch
Size: 1258 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200819/62a5366d/attachment.bin>
More information about the cfe-commits
mailing list