[clang] [CIR] Upstream minimal support for structure types (PR #135105)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 11 16:46:25 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h,c -- clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h clang/test/CIR/CodeGen/struct.c clang/test/CIR/CodeGen/struct.cpp clang/test/CIR/CodeGen/union.c clang/include/clang/CIR/Dialect/IR/CIRTypes.h clang/include/clang/CIR/MissingFeatures.h clang/lib/CIR/CodeGen/CIRGenBuilder.h clang/lib/CIR/CodeGen/CIRGenDecl.cpp clang/lib/CIR/CodeGen/CIRGenModule.cpp clang/lib/CIR/CodeGen/CIRGenTypes.cpp clang/lib/CIR/CodeGen/CIRGenTypes.h clang/lib/CIR/Dialect/IR/CIRTypes.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h b/clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h
index 00500c763..72ead2381 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h
+++ b/clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h
@@ -54,8 +54,8 @@ struct RecordTypeStorage : public mlir::TypeStorage {
                     RecordType::RecordKind kind)
       : members(members), name(name), incomplete(incomplete), packed(packed),
         padded(padded), kind(kind) {
-          assert(name || !incomplete && "Incomplete records must have a name");
-        }
+    assert(name || !incomplete && "Incomplete records must have a name");
+  }
 
   KeyTy getAsKey() const {
     return KeyTy(members, name, incomplete, packed, padded, kind);
@@ -65,8 +65,8 @@ struct RecordTypeStorage : public mlir::TypeStorage {
     if (name)
       return (name == key.name) && (kind == key.kind);
     return std::tie(members, name, incomplete, packed, padded, kind) ==
-               std::tie(key.members, key.name, key.incomplete, key.packed,
-                        key.padded, key.kind);
+           std::tie(key.members, key.name, key.incomplete, key.packed,
+                    key.padded, key.kind);
   }
 
   static llvm::hash_code hashKey(const KeyTy &key) {
diff --git a/clang/lib/CIR/CodeGen/CIRGenDecl.cpp b/clang/lib/CIR/CodeGen/CIRGenDecl.cpp
index a17bca19a..3d15a70d1 100644
--- a/clang/lib/CIR/CodeGen/CIRGenDecl.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenDecl.cpp
@@ -260,7 +260,7 @@ void CIRGenFunction::emitExprAsInit(const Expr *init, const ValueDecl *d,
 
 void CIRGenFunction::emitDecl(const Decl &d) {
   switch (d.getKind()) {
-  case Decl::Record:    // struct/union/class X;
+  case Decl::Record: // struct/union/class X;
     assert(!cir::MissingFeatures::generateDebugInfo());
     return;
   case Decl::Var: {

``````````

</details>


https://github.com/llvm/llvm-project/pull/135105


More information about the cfe-commits mailing list