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.


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.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to