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 origin/main HEAD --extensions cpp --
clang/lib/AST/RecordLayoutBuilder.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</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 15fe6e85b..6b5027772 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -3384,7 +3384,7 @@ ASTContext::getASTRecordLayout(const RecordDecl *D) const
{
// not a complete definition (which is what isCompleteDefinition() tests)
// until we *finish* parsing the definition.
D = D->getDefinition();
-
+
// Handle invalid declarations gracefully during error recovery
// This can happen when there are template specialization errors
if (!D || D->isInvalidDecl() || !D->isCompleteDefinition()) {
@@ -3392,20 +3392,20 @@ ASTContext::getASTRecordLayout(const RecordDecl *D)
const {
const ASTRecordLayout *Entry = ASTRecordLayouts[D];
if (Entry)
return *Entry;
-
+
// Create a minimal safe layout for error recovery
// Use 1-byte size and alignment to avoid division by zero or other issues
- ASTRecordLayout *NewEntry = new (*this) ASTRecordLayout(
- *this,
- CharUnits::One(), // Size = 1 byte
- CharUnits::One(), // Alignment = 1 byte
- CharUnits::One(), // PreferredAlignment = 1 byte
- CharUnits::One(), // UnadjustedAlignment = 1 byte
- CharUnits::One(), // RequiredAlignment = 1 byte
- CharUnits::One(), // DataSize = 1 byte
- ArrayRef<uint64_t>() // Empty field offsets
- );
-
+ ASTRecordLayout *NewEntry = new (*this)
+ ASTRecordLayout(*this,
+ CharUnits::One(), // Size = 1 byte
+ CharUnits::One(), // Alignment = 1 byte
+ CharUnits::One(), // PreferredAlignment = 1 byte
+ CharUnits::One(), // UnadjustedAlignment = 1 byte
+ CharUnits::One(), // RequiredAlignment = 1 byte
+ CharUnits::One(), // DataSize = 1 byte
+ ArrayRef<uint64_t>() // Empty field offsets
+ );
+
ASTRecordLayouts[D] = NewEntry;
return *NewEntry;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/208153
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits