[clang] [clang]Fix Handle structs exceeding 1EB size limit (PR #146032)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 26 23:51:57 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 c,cpp -- clang/test/AST/absurdly_big_struct.cpp clang/lib/AST/RecordLayoutBuilder.cpp clang/test/Sema/offsetof-64.c
``````````

</details>

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

``````````diff
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index f6a4f76bc..6d819031c 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -3463,11 +3463,11 @@ ASTContext::getASTRecordLayout(const RecordDecl *D) const {
 
   ASTRecordLayouts[D] = NewEntry;
 
-  constexpr uint64_t MaxStructSizeInBytes = 1ULL << 60; 
-  CharUnits StructSize = NewEntry->getSize(); 
+  constexpr uint64_t MaxStructSizeInBytes = 1ULL << 60;
+  CharUnits StructSize = NewEntry->getSize();
   if (static_cast<uint64_t>(StructSize.getQuantity()) >= MaxStructSizeInBytes) {
     getDiagnostics().Report(D->getLocation(), diag::err_struct_too_large)
-      << D->getName() << MaxStructSizeInBytes;
+        << D->getName() << MaxStructSizeInBytes;
   }
 
   if (getLangOpts().DumpRecordLayouts) {

``````````

</details>


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


More information about the cfe-commits mailing list