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,h,c -- 
clang/include/clang/AST/TypeBase.h clang/include/clang/Parse/Parser.h 
clang/include/clang/Sema/Sema.h clang/lib/Parse/ParseDecl.cpp 
clang/lib/Sema/SemaBoundsSafety.cpp clang/lib/Sema/SemaDecl.cpp 
clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaType.cpp 
clang/test/AST/attr-counted-by-or-null-struct-ptrs.c 
clang/test/AST/attr-counted-by-struct-ptrs.c 
clang/test/AST/attr-sized-by-or-null-struct-ptrs.c 
clang/test/AST/attr-sized-by-struct-ptrs.c 
clang/test/Sema/attr-counted-by-late-parsed-struct-ptrs.c 
clang/test/Sema/attr-counted-by-or-null-last-field.c 
clang/test/Sema/attr-counted-by-or-null-late-parsed-struct-ptrs.c 
clang/test/Sema/attr-counted-by-or-null-struct-ptrs-completable-incomplete-pointee.c
 clang/test/Sema/attr-counted-by-or-null-struct-ptrs.c 
clang/test/Sema/attr-counted-by-struct-ptrs-completable-incomplete-pointee.c 
clang/test/Sema/attr-counted-by-struct-ptrs.c 
clang/test/Sema/attr-sized-by-late-parsed-struct-ptrs.c 
clang/test/Sema/attr-sized-by-or-null-late-parsed-struct-ptrs.c 
clang/test/Sema/attr-sized-by-or-null-struct-ptrs.c 
clang/test/Sema/attr-sized-by-struct-ptrs.c --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/include/clang/Parse/Parser.h 
b/clang/include/clang/Parse/Parser.h
index af0f90401..fdf0414e4 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -8177,9 +8177,9 @@ private:
                                                 unsigned pointerNestLevel);
 
   /// The late-parsed type attributes of the record currently being parsed, so 
a
-  /// nested anonymous record can hand its unresolved attributes to the 
enclosing
-  /// record whose scope makes their arguments visible. Null outside a record
-  /// body.
+  /// nested anonymous record can hand its unresolved attributes to the
+  /// enclosing record whose scope makes their arguments visible. Null outside 
a
+  /// record body.
   SmallVectorImpl<LateParsedTypeAttribute *> *CurRecordLateParsedTypeAttrs =
       nullptr;
 
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index fe2cfe8a5..9a609adb5 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -4819,9 +4819,9 @@ void Parser::ParseStructDeclaration(
 
   // Late-parsed type attributes written in declaration-specifier position 
(e.g.
   // `IP __counted_by(n) a, b;` where `IP` is a pointer typedef) belong to 
every
-  // declarator in this declaration, so remember where this declaration's 
entries
-  // start before the specifier list is parsed. Indices, not iterators: the 
side
-  // list is a SmallVector and only ever grows within a record body.
+  // declarator in this declaration, so remember where this declaration's
+  // entries start before the specifier list is parsed. Indices, not iterators:
+  // the side list is a SmallVector and only ever grows within a record body.
   unsigned DeclSpecMark =
       CurRecordLateParsedTypeAttrs ? CurRecordLateParsedTypeAttrs->size() : 0;
 
@@ -5235,8 +5235,7 @@ void Parser::ParseStructUnionBody(SourceLocation 
RecordLoc,
   // attribute-specifiers between `}` and the `;`/declarator are skipped with a
   // reverting tentative parse, so a trailing `[[...]]` / `__attribute__` etc.
   // doesn't defeat the check.
-  if (getLangOpts().ExperimentalLateParseAttributes &&
-      !LateTypeAttrs.empty()) {
+  if (getLangOpts().ExperimentalLateParseAttributes && !LateTypeAttrs.empty()) 
{
     bool IsAnonymous = false;
     if (!TagDecl->getIdentifier()) {
       TentativeParsingAction TPA(*this);
@@ -6780,9 +6779,10 @@ void Parser::ParseDeclaratorInternal(Declarator &D,
     // CountAttributedType with a null count in the AST. Such parameters fall
     // back to eager handling instead. A function-pointer parameter inside a
     // struct field is still late-parsed, since that record completes it.
-    bool LateParsingContext = (D.getContext() == DeclaratorContext::Member ||
-                               D.getContext() == DeclaratorContext::Prototype) 
&&
-                              CurRecordLateParsedTypeAttrs != nullptr;
+    bool LateParsingContext =
+        (D.getContext() == DeclaratorContext::Member ||
+         D.getContext() == DeclaratorContext::Prototype) &&
+        CurRecordLateParsedTypeAttrs != nullptr;
 
     // No guard on ExperimentalLateParseAttributes is needed here;
     // DS.getLateAttributes() already initializes with
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index ae40bc491..69a019347 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -20132,7 +20132,6 @@ bool Sema::EntirelyFunctionPointers(const RecordDecl 
*Record) {
   return llvm::all_of(Record->decls(), IsFunctionPointerOrForwardDecl);
 }
 
-
 void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl,
                        ArrayRef<Decl *> Fields, SourceLocation LBrac,
                        SourceLocation RBrac,
@@ -20176,8 +20175,7 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, 
Decl *EnclosingDecl,
       FieldDecl *FD = cast<FieldDecl>(D);
       if (auto *CAT = FD->getType()->getAs<CountAttributedType>()) {
         if (CheckCountedByAttrOnField(FD, CAT->getCountExpr(),
-                                          CAT->isCountInBytes(),
-                                          CAT->isOrNull())) {
+                                      CAT->isCountInBytes(), CAT->isOrNull())) 
{
           // Rejected. Strip the CountAttributedType so the field keeps its
           // plain wrapped type. The pre-refactor eager path built the type 
only
           // after this check passed, so on failure no CAT ever existed; 
leaving
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 532813165..c3762dd4a 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -4743,9 +4743,9 @@ static TypeSourceInfo 
*GetFullTypeForDeclarator(TypeProcessingState &state,
       if (const auto *CATy = T->getAs<CountAttributedType>()) {
         // A counted_by-family attribute buried under another pointer or array
         // can't maintain its bounds. Diagnose it and drop it to its wrapped
-        // type -- matching the eager path, which drops the attribute rather 
than
-        // applying it. Because this fires just before the enclosing chunk 
wraps
-        // the node, replacing T here needs no enclosing-type rebuild. The
+        // type -- matching the eager path, which drops the attribute rather
+        // than applying it. Because this fires just before the enclosing chunk
+        // wraps the node, replacing T here needs no enclosing-type rebuild. 
The
         // node is left orphaned; the completion pass detects and skips it (see
         // Sema::ActOnLateParsedTypeAttrArgument).
         S.Diag(DeclType.Loc, diag::err_counted_by_on_nested_pointer)

``````````

</details>


https://github.com/llvm/llvm-project/pull/224560
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to