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 c,h,cpp -- 
clang/test/Sema/attr-bounds-safety-function-ptr-param.c 
clang/include/clang/AST/ASTContext.h 
clang/include/clang/AST/RecursiveASTVisitor.h 
clang/include/clang/AST/TypeBase.h clang/include/clang/AST/TypeLoc.h 
clang/include/clang/Parse/Parser.h clang/include/clang/Sema/DeclSpec.h 
clang/include/clang/Sema/Sema.h clang/lib/AST/ASTContext.cpp 
clang/lib/AST/ASTImporter.cpp clang/lib/AST/ASTStructuralEquivalence.cpp 
clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/TypeLoc.cpp 
clang/lib/AST/TypePrinter.cpp clang/lib/CodeGen/CGDebugInfo.cpp 
clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/Parse/ParseCXXInlineMethods.cpp 
clang/lib/Parse/ParseDecl.cpp clang/lib/Sema/Sema.cpp 
clang/lib/Sema/SemaBoundsSafety.cpp clang/lib/Sema/SemaDecl.cpp 
clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaExpr.cpp 
clang/lib/Sema/SemaType.cpp clang/lib/Sema/TreeTransform.h 
clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.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 clang/tools/libclang/CIndex.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/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 1d5ab1aa1..d38f1c54c 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1589,7 +1589,7 @@ public:
   /// This type wraps another type and holds the LateParsedAttribute
   /// that will be parsed later.
   QualType getLateParsedAttrType(QualType Wrapped,
-                                  LateParsedTypeAttribute *LateParsedAttr) 
const;
+                                 LateParsedTypeAttribute *LateParsedAttr) 
const;
 
   /// Return the uniqued reference to a type adjusted from the original
   /// type to a new type.
diff --git a/clang/include/clang/Parse/Parser.h 
b/clang/include/clang/Parse/Parser.h
index 218ecb472..7d714e8cd 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -1427,10 +1427,11 @@ private:
   void ParseLexedCAttribute(LateParsedAttribute &LA, bool EnterScope,
                             ParsedAttributes *OutAttrs = nullptr);
 
+  void ParseLexedTypeAttribute(LateParsedTypeAttribute &LA, bool EnterScope,
+                               ParsedAttributes &OutAttrs);
 
-  void ParseLexedTypeAttribute(LateParsedTypeAttribute &LA, bool EnterScope, 
ParsedAttributes &OutAttrs);
-
-  static void LateTypeAttrParserCallback(void *P, void *LA, bool EnterScope, 
ParsedAttributes &OutAttrs);
+  static void LateTypeAttrParserCallback(void *P, void *LA, bool EnterScope,
+                                         ParsedAttributes &OutAttrs);
 
   void ParseLexedPragmas(ParsingClass &Class);
   void ParseLexedPragma(LateParsedPragma &LP);
diff --git a/clang/include/clang/Sema/DeclSpec.h 
b/clang/include/clang/Sema/DeclSpec.h
index a44757664..388f212e8 100644
--- a/clang/include/clang/Sema/DeclSpec.h
+++ b/clang/include/clang/Sema/DeclSpec.h
@@ -74,113 +74,112 @@ namespace clang {
     virtual void ParseLexedPragmas();
   };
 
-/// Contains the lexed tokens of an attribute with arguments that
-/// may reference member variables and so need to be parsed at the
-/// end of the class declaration after parsing all other member
-/// member declarations.
-/// FIXME: Perhaps we should change the name of LateParsedDeclaration to
-/// LateParsedTokens.
-struct LateParsedAttribute : public LateParsedDeclaration {
-
-  enum LPA_Kind {
-    LPA_Declaration,
-    LPA_Type,
-  };
+  /// Contains the lexed tokens of an attribute with arguments that
+  /// may reference member variables and so need to be parsed at the
+  /// end of the class declaration after parsing all other member
+  /// member declarations.
+  /// FIXME: Perhaps we should change the name of LateParsedDeclaration to
+  /// LateParsedTokens.
+  struct LateParsedAttribute : public LateParsedDeclaration {
+
+    enum LPA_Kind {
+      LPA_Declaration,
+      LPA_Type,
+    };
 
-  Parser *Self;
-  CachedTokens Toks;
-  IdentifierInfo &AttrName;
-  IdentifierInfo *MacroII = nullptr;
-  SourceLocation AttrNameLoc;
-  SmallVector<Decl *, 2> Decls;
+    Parser *Self;
+    CachedTokens Toks;
+    IdentifierInfo &AttrName;
+    IdentifierInfo *MacroII = nullptr;
+    SourceLocation AttrNameLoc;
+    SmallVector<Decl *, 2> Decls;
 
-private:
-  LPA_Kind Kind;
+  private:
+    LPA_Kind Kind;
 
-public:
-  explicit LateParsedAttribute(Parser *P, IdentifierInfo &Name,
-                               SourceLocation Loc,
-                               LPA_Kind Kind = LPA_Declaration)
-      : Self(P), AttrName(Name), AttrNameLoc(Loc), Kind(Kind) {}
+  public:
+    explicit LateParsedAttribute(Parser *P, IdentifierInfo &Name,
+                                 SourceLocation Loc,
+                                 LPA_Kind Kind = LPA_Declaration)
+        : Self(P), AttrName(Name), AttrNameLoc(Loc), Kind(Kind) {}
 
-  void ParseLexedAttributes() override;
+    void ParseLexedAttributes() override;
 
-  void addDecl(Decl *D) { Decls.push_back(D); }
+    void addDecl(Decl *D) { Decls.push_back(D); }
 
-  LPA_Kind getKind() const { return Kind; }
+    LPA_Kind getKind() const { return Kind; }
 
-  // LLVM-style RTTI support
-  static bool classof(const LateParsedAttribute* LA) {
+    // LLVM-style RTTI support
+    static bool classof(const LateParsedAttribute *LA) {
       // LateParsedAttribute matches both Declaration and Type kinds
       return LA->getKind() == LPA_Declaration || LA->getKind() == LPA_Type;
-  }
-};
+    }
+  };
 
-/// Contains the lexed tokens of an attribute with arguments that
-/// may reference member variables and so need to be parsed at the
-/// end of the class declaration after parsing all other member
-/// member declarations.
-/// FIXME: Perhaps we should change the name of LateParsedDeclaration to
-/// LateParsedTokens.
-struct LateParsedTypeAttribute : public LateParsedAttribute {
+  /// Contains the lexed tokens of an attribute with arguments that
+  /// may reference member variables and so need to be parsed at the
+  /// end of the class declaration after parsing all other member
+  /// member declarations.
+  /// FIXME: Perhaps we should change the name of LateParsedDeclaration to
+  /// LateParsedTokens.
+  struct LateParsedTypeAttribute : public LateParsedAttribute {
 
-  explicit LateParsedTypeAttribute(Parser *P, IdentifierInfo &Name,
-                                SourceLocation Loc)
-      : LateParsedAttribute(P, Name, Loc, LPA_Type) {}
+    explicit LateParsedTypeAttribute(Parser *P, IdentifierInfo &Name,
+                                     SourceLocation Loc)
+        : LateParsedAttribute(P, Name, Loc, LPA_Type) {}
 
-  void ParseLexedAttributes() override;
-  void ParseLexedTypeAttributes() override;
+    void ParseLexedAttributes() override;
+    void ParseLexedTypeAttributes() override;
 
-  void addDecl(Decl *D) { Decls.push_back(D); }
+    void addDecl(Decl *D) { Decls.push_back(D); }
 
-  /// Parse this late-parsed type attribute and store results in OutAttrs.
-  /// This method can be called from Sema during type transformation to
-  /// parse the cached tokens and produce the final attribute.
-  void ParseInto(ParsedAttributes &OutAttrs);
+    /// Parse this late-parsed type attribute and store results in OutAttrs.
+    /// This method can be called from Sema during type transformation to
+    /// parse the cached tokens and produce the final attribute.
+    void ParseInto(ParsedAttributes &OutAttrs);
 
-  // LLVM-style RTTI support
-  static bool classof(const LateParsedAttribute* LA) {
+    // LLVM-style RTTI support
+    static bool classof(const LateParsedAttribute *LA) {
       return LA->getKind() == LPA_Type;
-  }
-};
-
-// A list of late-parsed attributes.  Used by ParseGNUAttributes.
-class LateParsedAttrList : public SmallVector<LateParsedAttribute *, 2> {
-public:
-  LateParsedAttrList(bool PSoon = false,
-                      bool LateAttrParseExperimentalExtOnly = false,
-                      bool LateAttrParseTypeAttrOnly = false)
-      : ParseSoon(PSoon),
-        LateAttrParseExperimentalExtOnly(LateAttrParseExperimentalExtOnly),
-        LateAttrParseTypeAttrOnly(LateAttrParseTypeAttrOnly) {}
-
-  bool parseSoon() { return ParseSoon; }
-  /// returns true iff the attribute to be parsed should only be late parsed
-  /// if it is annotated with `LateAttrParseExperimentalExt`
-  bool lateAttrParseExperimentalExtOnly() {
-    return LateAttrParseExperimentalExtOnly;
-  }
+    }
+  };
 
-  bool lateAttrParseTypeAttrOnly() {
-    return LateAttrParseTypeAttrOnly;
-  }
+  // A list of late-parsed attributes.  Used by ParseGNUAttributes.
+  class LateParsedAttrList : public SmallVector<LateParsedAttribute *, 2> {
+  public:
+    LateParsedAttrList(bool PSoon = false,
+                       bool LateAttrParseExperimentalExtOnly = false,
+                       bool LateAttrParseTypeAttrOnly = false)
+        : ParseSoon(PSoon),
+          LateAttrParseExperimentalExtOnly(LateAttrParseExperimentalExtOnly),
+          LateAttrParseTypeAttrOnly(LateAttrParseTypeAttrOnly) {}
+
+    bool parseSoon() { return ParseSoon; }
+    /// returns true iff the attribute to be parsed should only be late parsed
+    /// if it is annotated with `LateAttrParseExperimentalExt`
+    bool lateAttrParseExperimentalExtOnly() {
+      return LateAttrParseExperimentalExtOnly;
+    }
 
-  void takeTypeAttrsAppendingFrom(LateParsedAttrList &Other) {
-    auto it = std::remove_if(Other.begin(), Other.end(), 
[&](LateParsedAttribute *LA){
-          if (auto *LTA = dyn_cast<LateParsedTypeAttribute>(LA)) {
-            push_back(LTA);
-            return true;
-          }
-          return false;
-        });
-    Other.erase(it, Other.end());
-  }
+    bool lateAttrParseTypeAttrOnly() { return LateAttrParseTypeAttrOnly; }
+
+    void takeTypeAttrsAppendingFrom(LateParsedAttrList &Other) {
+      auto it = std::remove_if(
+          Other.begin(), Other.end(), [&](LateParsedAttribute *LA) {
+            if (auto *LTA = dyn_cast<LateParsedTypeAttribute>(LA)) {
+              push_back(LTA);
+              return true;
+            }
+            return false;
+          });
+      Other.erase(it, Other.end());
+    }
 
-private:
-  bool ParseSoon; // Are we planning to parse these shortly after creation?
-  bool LateAttrParseExperimentalExtOnly;
-  bool LateAttrParseTypeAttrOnly;
-};
+  private:
+    bool ParseSoon; // Are we planning to parse these shortly after creation?
+    bool LateAttrParseExperimentalExtOnly;
+    bool LateAttrParseTypeAttrOnly;
+  };
 
 /// Represents a C++ nested-name-specifier or a global scope specifier.
 ///
@@ -600,7 +599,8 @@ public:
         FS_noreturn_specified(false), FriendSpecifiedFirst(false),
         ConstexprSpecifier(
             static_cast<unsigned>(ConstexprSpecKind::Unspecified)),
-        Attrs(attrFactory), LateParsedAttrs(true, true, true), writtenBS(), 
ObjCQualifiers(nullptr) {}
+        Attrs(attrFactory), LateParsedAttrs(true, true, true), writtenBS(),
+        ObjCQualifiers(nullptr) {}
 
   // storage-class-specifier
   SCS getStorageClassSpec() const { return (SCS)StorageClassSpec; }
@@ -978,9 +978,11 @@ public:
   ParsedAttributes &getAttributes() { return Attrs; }
   const ParsedAttributes &getAttributes() const { return Attrs; }
 
-  LateParsedAttrList *getLateAttributePtr() { return &LateParsedAttrs;  }
-  LateParsedAttrList &getLateAttributes() { return LateParsedAttrs;  }
-  const LateParsedAttrList &getLateAttributes() const { return 
LateParsedAttrs;  }
+  LateParsedAttrList *getLateAttributePtr() { return &LateParsedAttrs; }
+  LateParsedAttrList &getLateAttributes() { return LateParsedAttrs; }
+  const LateParsedAttrList &getLateAttributes() const {
+    return LateParsedAttrs;
+  }
 
   void takeAttributesAppendingingFrom(ParsedAttributes &attrs) {
     Attrs.takeAllAppendingFrom(attrs);
@@ -2145,8 +2147,8 @@ public:
         Redeclaration(false), Extension(false), ObjCIvar(false),
         ObjCWeakProperty(false), InlineStorageUsed(false),
         HasInitializer(false), Attrs(DS.getAttributePool().getFactory()),
-        DeclarationAttrs(DeclarationAttrs), LateParsedAttrs(true, true, true), 
AsmLabel(nullptr),
-        TrailingRequiresClause(nullptr),
+        DeclarationAttrs(DeclarationAttrs), LateParsedAttrs(true, true, true),
+        AsmLabel(nullptr), TrailingRequiresClause(nullptr),
         InventedTemplateParameterList(nullptr) {
     assert(llvm::all_of(DeclarationAttrs,
                         [](const ParsedAttr &AL) {
@@ -2467,10 +2469,9 @@ public:
   /// EndLoc, which should be the last token of the chunk.
   /// This function takes attrs by R-Value reference because it takes ownership
   /// of those attributes from the parameter.
-  void
-  AddTypeInfo(const DeclaratorChunk &TI, ParsedAttributes &&attrs,
-              SourceLocation EndLoc,
-              const LateParsedAttrList &LateAttrs = {}) {
+  void AddTypeInfo(const DeclaratorChunk &TI, ParsedAttributes &&attrs,
+                   SourceLocation EndLoc,
+                   const LateParsedAttrList &LateAttrs = {}) {
     DeclTypeInfo.push_back(TI);
     DeclTypeInfo.back().getAttrs().prepend(attrs.begin(), attrs.end());
     getAttributePool().takeAllFrom(attrs.getPool());
@@ -2808,8 +2809,10 @@ public:
     return DeclarationAttrs;
   }
 
-  LateParsedAttrList &getLateAttributes() { return LateParsedAttrs;  }
-  const LateParsedAttrList &getLateAttributes() const { return 
LateParsedAttrs;  }
+  LateParsedAttrList &getLateAttributes() { return LateParsedAttrs; }
+  const LateParsedAttrList &getLateAttributes() const {
+    return LateParsedAttrs;
+  }
 
   void takeLateTypeAttributesAppending(LateParsedAttrList &lateAttrs) {
     LateParsedAttrs.takeTypeAttrsAppendingFrom(lateAttrs);
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 7628015ab..d852a66ff 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -2484,11 +2484,11 @@ public:
   /// `counted_by_or_null` attribute.
   ///
   /// \returns false iff semantically valid.
-  bool CheckCountedByAttrOnField(FieldDecl *FD, QualType T, Expr *E, bool 
CountInBytes,
-                                 bool OrNull);
+  bool CheckCountedByAttrOnField(FieldDecl *FD, QualType T, Expr *E,
+                                 bool CountInBytes, bool OrNull);
 
   bool CheckCountedByAttrOnFieldDecl(FieldDecl *FD, Expr *E, bool CountInBytes,
-                                      bool OrNull);
+                                     bool OrNull);
 
   /// Perform Bounds Safety Semantic checks for assigning to a `__counted_by` 
or
   /// `__counted_by_or_null` pointer type \param LHSTy.
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 80bd2ae24..9ff823164 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -49,7 +49,6 @@
 #include "clang/AST/VTableBuilder.h"
 #include "clang/Basic/AddressSpaces.h"
 #include "clang/Basic/Builtins.h"
-#include "clang/Sema/DeclSpec.h"
 #include "clang/Basic/CommentOptions.h"
 #include "clang/Basic/ExceptionSpecificationType.h"
 #include "clang/Basic/IdentifierTable.h"
@@ -66,6 +65,7 @@
 #include "clang/Basic/TargetCXXABI.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/XRayLists.h"
+#include "clang/Sema/DeclSpec.h"
 #include "llvm/ADT/APFixedPoint.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/APSInt.h"
@@ -2469,7 +2469,8 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const 
{
     return getTypeInfo(cast<CountAttributedType>(T)->desugar().getTypePtr());
 
   case Type::LateParsedAttr:
-    return 
getTypeInfo(cast<LateParsedAttrType>(T)->getWrappedType().getTypePtr());
+    return getTypeInfo(
+        cast<LateParsedAttrType>(T)->getWrappedType().getTypePtr());
 
   case Type::BTFTagAttributed:
     return getTypeInfo(
diff --git a/clang/lib/AST/ASTStructuralEquivalence.cpp 
b/clang/lib/AST/ASTStructuralEquivalence.cpp
index 8af6d3f97..8aab06f42 100644
--- a/clang/lib/AST/ASTStructuralEquivalence.cpp
+++ b/clang/lib/AST/ASTStructuralEquivalence.cpp
@@ -1198,9 +1198,9 @@ bool ASTStructuralEquivalence::isEquivalent(
     break;
 
   case Type::LateParsedAttr:
-    if (!IsStructurallyEquivalent(Context,
-                                  
cast<LateParsedAttrType>(T1)->getWrappedType(),
-                                  
cast<LateParsedAttrType>(T2)->getWrappedType()))
+    if (!IsStructurallyEquivalent(
+            Context, cast<LateParsedAttrType>(T1)->getWrappedType(),
+            cast<LateParsedAttrType>(T2)->getWrappedType()))
       return false;
     break;
 
diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp
index 7abd30671..df369a977 100644
--- a/clang/lib/AST/TypePrinter.cpp
+++ b/clang/lib/AST/TypePrinter.cpp
@@ -1817,14 +1817,14 @@ void TypePrinter::printCountAttributedAfter(const 
CountAttributedType *T,
 }
 
 void TypePrinter::printLateParsedAttrBefore(const LateParsedAttrType *T,
-                                             raw_ostream &OS) {
+                                            raw_ostream &OS) {
   // LateParsedAttrType is a transient placeholder that should not appear
   // in user-facing output. Just print the wrapped type.
   printBefore(T->getWrappedType(), OS);
 }
 
 void TypePrinter::printLateParsedAttrAfter(const LateParsedAttrType *T,
-                                            raw_ostream &OS) {
+                                           raw_ostream &OS) {
   // LateParsedAttrType is a transient placeholder that should not appear
   // in user-facing output. Just print the wrapped type.
   printAfter(T->getWrappedType(), OS);
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index b060b8449..c3b607abd 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -116,7 +116,8 @@ static bool IsAttributeTypeAttr(ParsedAttr::Kind Kind) {
 #define TYPE_ATTR(NAME) case ParsedAttr::AT_##NAME:
 #include "clang/Basic/AttrList.inc"
     return true;
-    default: return false;
+  default:
+    return false;
 #undef DECL_OR_TYPE_ATTR
 #undef TYPE_ATTR
 #undef ATTR
@@ -172,9 +173,8 @@ bool Parser::ParseSingleGNUAttribute(ParsedAttributes 
&Attrs,
     return false;
   }
 
-
-  ParsedAttr::Kind AttrKind =
-        ParsedAttr::getParsedKind(AttrName, nullptr, 
ParsedAttr::Form::GNU().getSyntax());
+  ParsedAttr::Kind AttrKind = ParsedAttr::getParsedKind(
+      AttrName, nullptr, ParsedAttr::Form::GNU().getSyntax());
 
   bool LateParse = false;
   if (!LateAttrs)
@@ -185,7 +185,8 @@ bool Parser::ParseSingleGNUAttribute(ParsedAttributes 
&Attrs,
     // only be late parsed if the experimental language option is enabled.
     LateParse = getLangOpts().ExperimentalLateParseAttributes &&
                 IsAttributeLateParsedExperimentalExt(*AttrName) &&
-                (IsAttributeTypeAttr(AttrKind) || 
!LateAttrs->lateAttrParseTypeAttrOnly());
+                (IsAttributeTypeAttr(AttrKind) ||
+                 !LateAttrs->lateAttrParseTypeAttrOnly());
   } else {
     // The caller did not restrict late parsing to only
     // `LateAttrParseExperimentalExt` attributes so late parse
@@ -2754,9 +2755,11 @@ void Parser::ParseSpecifierQualifierList(
   ParsedTemplateInfo TemplateInfo;
 
   if (LateAttrs)
-    assert(!std::any_of(LateAttrs->begin(), LateAttrs->end(), [&](const 
LateParsedAttribute *LA) {
-      return isa<LateParsedTypeAttribute>(LA);
-    }) && "Late type attribute carried over");
+    assert(!std::any_of(LateAttrs->begin(), LateAttrs->end(),
+                        [&](const LateParsedAttribute *LA) {
+                          return isa<LateParsedTypeAttribute>(LA);
+                        }) &&
+           "Late type attribute carried over");
 
   /// specifier-qualifier-list is a subset of declaration-specifiers.  Just
   /// parse declaration-specifiers and complain about extra stuff.
@@ -4827,7 +4830,9 @@ void Parser::ParseLexedCAttributeList(LateParsedAttrList 
&LAs, bool EnterScope,
   LAs.clear();
 }
 
-void Parser::ParseLexedTypeAttribute(LateParsedTypeAttribute &LA, bool 
EnterScope, ParsedAttributes &OutAttrs) {
+void Parser::ParseLexedTypeAttribute(LateParsedTypeAttribute &LA,
+                                     bool EnterScope,
+                                     ParsedAttributes &OutAttrs) {
   // Create a fake EOF so that attribute parsing won't go off the end of the
   // attribute.
   Token AttrEnd;
@@ -4929,10 +4934,12 @@ void Parser::ParseLexedCAttribute(LateParsedAttribute 
&LA, bool EnterScope,
   }
 }
 
-void Parser::LateTypeAttrParserCallback(void *P, void *OLA, bool EnterScope, 
ParsedAttributes &OutAttrs) {
+void Parser::LateTypeAttrParserCallback(void *P, void *OLA, bool EnterScope,
+                                        ParsedAttributes &OutAttrs) {
   auto *LA = static_cast<LateParsedAttribute *>(OLA);
   auto *LTA = cast<LateParsedTypeAttribute>(LA);
-  return ((Parser *)(P))->ParseLexedTypeAttribute(*LTA, /*EnterScope=*/false, 
OutAttrs);
+  return ((Parser *)(P))
+      ->ParseLexedTypeAttribute(*LTA, /*EnterScope=*/false, OutAttrs);
 }
 
 void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
@@ -6556,15 +6563,13 @@ void Parser::ParseDeclaratorInternal(Declarator &D,
                          : AR_GNUAttributesParsedAndRejected);
     // FIXME: Don't need to pass parameter. It's not used. This is the path
     // where it is experimental only.
-    // FIXME: Still don't know whether this is the right context to do late 
parsing. Is it okay?
-    // You don't want to do late parsing if it's a variable declaration.
-    // You can probably look at the DeclaratorContext!
+    // FIXME: Still don't know whether this is the right context to do late
+    // parsing. Is it okay? You don't want to do late parsing if it's a 
variable
+    // declaration. You can probably look at the DeclaratorContext!
     bool LateParsingContext = D.getContext() == DeclaratorContext::Member ||
-        D.getContext() == DeclaratorContext::Prototype;
+                              D.getContext() == DeclaratorContext::Prototype;
     LateParsedAttrList *LateAttrs =
-        LateParsingContext
-            ? &DS.getLateAttributes()
-            : nullptr;
+        LateParsingContext ? &DS.getLateAttributes() : nullptr;
 
     ParseTypeQualifierListOpt(DS, Reqs, /*AtomicOrPtrauthAllowed=*/true,
                               !D.mayOmitIdentifier(), {}, LateAttrs);
@@ -7222,7 +7227,8 @@ void Parser::ParseParenDeclarator(Declarator &D) {
     return;
   }
 
-  assert(LateAttrs.empty() && "Late parsed type attribute on FirstParamAttr is 
dropped");
+  assert(LateAttrs.empty() &&
+         "Late parsed type attribute on FirstParamAttr is dropped");
 
   // Okay, if this wasn't a grouping paren, it must be the start of a function
   // argument list.  Recognize that this declarator will never have an
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index f36d73c62..d53527af3 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -276,8 +276,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer 
&consumer,
       Context(ctxt), Consumer(consumer), Diags(PP.getDiagnostics()),
       SourceMgr(PP.getSourceManager()), APINotes(SourceMgr, LangOpts),
       AnalysisWarnings(*this), ThreadSafetyDeclCache(nullptr),
-      LateTemplateParser(nullptr), OpaqueParser(nullptr),
-      CurContext(nullptr),
+      LateTemplateParser(nullptr), OpaqueParser(nullptr), CurContext(nullptr),
       ExternalSource(nullptr), StackHandler(Diags), CurScope(nullptr),
       Ident_super(nullptr), AMDGPUPtr(std::make_unique<SemaAMDGPU>(*this)),
       ARMPtr(std::make_unique<SemaARM>(*this)),
diff --git a/clang/lib/Sema/SemaBoundsSafety.cpp 
b/clang/lib/Sema/SemaBoundsSafety.cpp
index 7b39ba93b..51f8b619e 100644
--- a/clang/lib/Sema/SemaBoundsSafety.cpp
+++ b/clang/lib/Sema/SemaBoundsSafety.cpp
@@ -232,7 +232,7 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, 
QualType T, Expr *E,
 }
 
 bool Sema::CheckCountedByAttrOnFieldDecl(FieldDecl *FD, Expr *E,
-                                          bool CountInBytes, bool OrNull) {
+                                         bool CountInBytes, bool OrNull) {
   unsigned Kind = getCountAttrKind(CountInBytes, OrNull);
 
   if (FD->getParent()->isUnion()) {
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 46eb1de27..5191b3166 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -10,8 +10,8 @@
 //
 
//===----------------------------------------------------------------------===//
 
-#include "TypeLocBuilder.h"
 #include "TreeTransform.h"
+#include "TypeLocBuilder.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTLambda.h"
@@ -19714,7 +19714,8 @@ bool Sema::EntirelyFunctionPointers(const RecordDecl 
*Record) {
   return llvm::all_of(Record->decls(), IsFunctionPointerOrForwardDecl);
 }
 
-static QualType handleCountedByAttrField(Sema &S, QualType T, Decl *D, const 
ParsedAttr &AL) {
+static QualType handleCountedByAttrField(Sema &S, QualType T, Decl *D,
+                                         const ParsedAttr &AL) {
   if (!AL.diagnoseLangOpts(S))
     return QualType();
 
@@ -19748,11 +19749,11 @@ static QualType handleCountedByAttrField(Sema &S, 
QualType T, Decl *D, const Par
     llvm_unreachable("unexpected counted_by family attribute");
   }
 
-  return S.BuildCountAttributedArrayOrPointerType(
-      T, CountExpr, CountInBytes, OrNull);
+  return S.BuildCountAttributedArrayOrPointerType(T, CountExpr, CountInBytes,
+                                                  OrNull);
 }
 struct RebuildTypeWithLateParsedAttr
-  : TreeTransform<RebuildTypeWithLateParsedAttr> {
+    : TreeTransform<RebuildTypeWithLateParsedAttr> {
   FieldDecl *FD;
 
   RebuildTypeWithLateParsedAttr(Sema &SemaRef, FieldDecl *FD)
@@ -19770,7 +19771,7 @@ struct RebuildTypeWithLateParsedAttr
   }
 
   QualType TransformLateParsedAttrType(TypeLocBuilder &TLB,
-                                        LateParsedAttrTypeLoc TL) {
+                                       LateParsedAttrTypeLoc TL) {
     const LateParsedAttrType *LPA = TL.getTypePtr();
     auto *LTA = LPA->getLateParsedAttribute();
 
@@ -19839,7 +19840,7 @@ struct RebuildTypeWithLateParsedAttr
   }
 
   QualType TransformConstantArrayType(TypeLocBuilder &TLB,
-                                       ConstantArrayTypeLoc TL) {
+                                      ConstantArrayTypeLoc TL) {
     const ConstantArrayType *T = TL.getTypePtr();
     QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
     if (ElementType.isNull()) {
@@ -19885,7 +19886,7 @@ struct RebuildTypeWithLateParsedAttr
   }
 
   QualType TransformIncompleteArrayType(TypeLocBuilder &TLB,
-                                         IncompleteArrayTypeLoc TL) {
+                                        IncompleteArrayTypeLoc TL) {
     const IncompleteArrayType *T = TL.getTypePtr();
     QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
     if (ElementType.isNull()) {
@@ -19893,8 +19894,8 @@ struct RebuildTypeWithLateParsedAttr
       return QualType();
     }
 
-    // Diagnose flexible array member with element type having counted_by 
attribute
-    // e.g., int * __counted_by(n) arr[];
+    // Diagnose flexible array member with element type having counted_by
+    // attribute e.g., int * __counted_by(n) arr[];
     if (diagnoseCountAttributedType(ElementType, TL.getLBracketLoc()))
       return QualType();
 
@@ -19918,7 +19919,7 @@ struct RebuildTypeWithLateParsedAttr
   }
 
   QualType TransformVariableArrayType(TypeLocBuilder &TLB,
-                                       VariableArrayTypeLoc TL) {
+                                      VariableArrayTypeLoc TL) {
     const VariableArrayType *T = TL.getTypePtr();
     QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
     if (ElementType.isNull()) {
@@ -19960,7 +19961,7 @@ struct RebuildTypeWithLateParsedAttr
   }
 
   QualType TransformDependentSizedArrayType(TypeLocBuilder &TLB,
-                                             DependentSizedArrayTypeLoc TL) {
+                                            DependentSizedArrayTypeLoc TL) {
     const DependentSizedArrayType *T = TL.getTypePtr();
     QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
     if (ElementType.isNull()) {
@@ -19968,8 +19969,9 @@ struct RebuildTypeWithLateParsedAttr
       return QualType();
     }
 
-    // Diagnose dependent-sized array with element type having counted_by 
attribute
-    // e.g., template<int N> struct S { int * __counted_by(n) arr[N]; };
+    // Diagnose dependent-sized array with element type having counted_by
+    // attribute e.g., template<int N> struct S { int * __counted_by(n) arr[N];
+    // };
     if (diagnoseCountAttributedType(ElementType, TL.getLBracketLoc()))
       return QualType();
 
@@ -19995,7 +19997,8 @@ struct RebuildTypeWithLateParsedAttr
       }
     }
 
-    DependentSizedArrayTypeLoc NewTL = 
TLB.push<DependentSizedArrayTypeLoc>(Result);
+    DependentSizedArrayTypeLoc NewTL =
+        TLB.push<DependentSizedArrayTypeLoc>(Result);
     NewTL.setLBracketLoc(TL.getLBracketLoc());
     NewTL.setRBracketLoc(TL.getRBracketLoc());
     NewTL.setSizeExpr(Size);
@@ -20066,7 +20069,7 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, 
Decl *EnclosingDecl,
     FieldDecl *FD = cast<FieldDecl>(*i);
     if (auto *CAT = FD->getType()->getAs<CountAttributedType>()) {
       CheckCountedByAttrOnFieldDecl(FD, CAT->getCountExpr(),
-                                     CAT->isCountInBytes(), CAT->isOrNull());
+                                    CAT->isCountInBytes(), CAT->isOrNull());
     }
   }
 
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index b6fd4f4b3..b627388a5 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -8099,9 +8099,9 @@ static bool isKernelDecl(Decl *D) {
          D->hasAttr<CUDAGlobalAttr>();
 }
 
-void Sema::ProcessDeclAttributeList(Scope *S, Decl *D,
-                                    const ParsedAttributesView &AttrList,
-                                    const ProcessDeclAttributeOptions 
&Options) {
+void Sema::ProcessDeclAttributeList(
+    Scope *S, Decl *D, const ParsedAttributesView &AttrList,
+    const ProcessDeclAttributeOptions &Options) {
   if (AttrList.empty())
     return;
 
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 153e45d9d..8a4da158a 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -398,7 +398,9 @@ processTypeAttrs(TypeProcessingState &state, QualType &type,
                  TypeAttrLocation TAL, const ParsedAttributesView &attrs,
                  CUDAFunctionTarget CFT = CUDAFunctionTarget::HostDevice);
 
-static bool processLateTypeAttrs(TypeProcessingState &state, QualType &type, 
const LateParsedAttrList &LateAttrs, unsigned chunkIndex = 0);
+static bool processLateTypeAttrs(TypeProcessingState &state, QualType &type,
+                                 const LateParsedAttrList &LateAttrs,
+                                 unsigned chunkIndex = 0);
 
 static bool handleFunctionTypeAttr(TypeProcessingState &state, ParsedAttr 
&attr,
                                    QualType &type, CUDAFunctionTarget CFT);
@@ -8877,18 +8879,18 @@ static unsigned getPointerNestLevel(TypeProcessingState 
&state,
   if (chunkIndex > 0) {
     const auto &stateDeclarator = state.getDeclarator();
     assert(chunkIndex <= stateDeclarator.getNumTypeObjects());
-    // DeclChunks are ordered identifier out. Index 0 is the outer most type 
object.
-    // Find outer pointer, array or function.
+    // DeclChunks are ordered identifier out. Index 0 is the outer most type
+    // object. Find outer pointer, array or function.
     for (unsigned i = 0; i < chunkIndex; ++i) {
       auto TypeObject = stateDeclarator.getTypeObject(i);
       switch (TypeObject.Kind) {
-        case DeclaratorChunk::Function:
-        case DeclaratorChunk::Array:
-        case DeclaratorChunk::Pointer:
-          pointerNestLevel++;
-          break;
-        default:
-          break;
+      case DeclaratorChunk::Function:
+      case DeclaratorChunk::Array:
+      case DeclaratorChunk::Pointer:
+        pointerNestLevel++;
+        break;
+      default:
+        break;
       }
     }
   }
@@ -8896,10 +8898,10 @@ static unsigned getPointerNestLevel(TypeProcessingState 
&state,
 }
 
 static bool validateCountedByAttrType(Sema &S, QualType Ty,
-                                       ParsedAttr::Kind AttrKind,
-                                       SourceLocation AttrLoc,
-                                       unsigned pointerNestLevel,
-                                       bool &CountInBytes, bool &OrNull) {
+                                      ParsedAttr::Kind AttrKind,
+                                      SourceLocation AttrLoc,
+                                      unsigned pointerNestLevel,
+                                      bool &CountInBytes, bool &OrNull) {
   switch (AttrKind) {
   case ParsedAttr::AT_CountedBy:
     CountInBytes = false;
@@ -8981,8 +8983,7 @@ static bool validateCountedByAttrType(Sema &S, QualType 
Ty,
   }
 
   if (pointerNestLevel > 0) {
-    S.Diag(AttrLoc, diag::err_counted_by_on_nested_pointer)
-            << Kind;
+    S.Diag(AttrLoc, diag::err_counted_by_on_nested_pointer) << Kind;
     return false;
   }
 
@@ -8990,7 +8991,7 @@ static bool validateCountedByAttrType(Sema &S, QualType 
Ty,
 }
 
 static void HandleCountedByAttrOnType(TypeProcessingState &State,
-                                       QualType &CurType, ParsedAttr &Attr) {
+                                      QualType &CurType, ParsedAttr &Attr) {
   Sema &S = State.getSema();
 
   // This attribute is only supported in C.
@@ -9008,8 +9009,8 @@ static void HandleCountedByAttrOnType(TypeProcessingState 
&State,
 
   // This is a mechanism to prevent nested count pointer types in the contexts
   // where late parsing isn't allowed: currently that is any context other than
-  // struct fields. In the context where late parsing is allowed, the level 
check
-  // will be done once the whole context is constructed.
+  // struct fields. In the context where late parsing is allowed, the level
+  // check will be done once the whole context is constructed.
   unsigned chunkIndex = State.getCurrentChunkIndex();
   unsigned pointerNestLevel = 0;
 
@@ -9021,16 +9022,18 @@ static void 
HandleCountedByAttrOnType(TypeProcessingState &State,
 
   bool CountInBytes, OrNull;
   if (!validateCountedByAttrType(S, CurType, Attr.getKind(), Attr.getLoc(),
-                                   pointerNestLevel, CountInBytes, OrNull)) {
+                                 pointerNestLevel, CountInBytes, OrNull)) {
     Attr.setInvalid();
     return;
   }
 
   CurType = S.BuildCountAttributedArrayOrPointerType(CurType, CountExpr,
-                                                       CountInBytes, OrNull);
+                                                     CountInBytes, OrNull);
 }
 
-static bool processLateTypeAttrs(TypeProcessingState &state, QualType &type, 
const LateParsedAttrList &LateAttrs, unsigned chunkIndex) {
+static bool processLateTypeAttrs(TypeProcessingState &state, QualType &type,
+                                 const LateParsedAttrList &LateAttrs,
+                                 unsigned chunkIndex) {
 
   if (LateAttrs.empty())
     return true;
@@ -9041,12 +9044,12 @@ static bool processLateTypeAttrs(TypeProcessingState 
&state, QualType &type, con
   unsigned pointerNestLevel = 0;
 
   for (auto *LA : LateAttrs) {
-    ParsedAttr::Kind AttrKind =
-      ParsedAttr::getParsedKind(&LA->AttrName, nullptr, 
ParsedAttr::Form::GNU().getSyntax());
+    ParsedAttr::Kind AttrKind = ParsedAttr::getParsedKind(
+        &LA->AttrName, nullptr, ParsedAttr::Form::GNU().getSyntax());
 
     bool CountInBytes, OrNull;
     if (!validateCountedByAttrType(S, type, AttrKind, LA->AttrNameLoc,
-                                     pointerNestLevel, CountInBytes, OrNull))
+                                   pointerNestLevel, CountInBytes, OrNull))
       return false;
 
     type = S.getASTContext().getLateParsedAttrType(
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 490ef3ba9..846bd58ee 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -7749,8 +7749,9 @@ QualType 
TreeTransform<Derived>::TransformCountAttributedType(
 }
 
 template <typename Derived>
-QualType TreeTransform<Derived>::TransformLateParsedAttrType(
-    TypeLocBuilder &TLB, LateParsedAttrTypeLoc TL) {
+QualType
+TreeTransform<Derived>::TransformLateParsedAttrType(TypeLocBuilder &TLB,
+                                                    LateParsedAttrTypeLoc TL) {
   const LateParsedAttrType *OldTy = TL.getTypePtr();
   QualType InnerTy = getDerived().TransformType(TLB, TL.getInnerLoc());
   if (InnerTy.isNull())
diff --git a/clang/lib/Serialization/ASTWriter.cpp 
b/clang/lib/Serialization/ASTWriter.cpp
index cfb226476..70eb3934c 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -157,7 +157,8 @@ static TypeCode getTypeCodeForTypeClass(Type::TypeClass id) 
{
   case Type::CLASS_ID: return TYPE_##CODE_ID;
 #include "clang/Serialization/TypeBitCodes.def"
   case Type::LateParsedAttr:
-    llvm_unreachable("should be replaced with a concrete type before 
serialization");
+    llvm_unreachable(
+        "should be replaced with a concrete type before serialization");
   case Type::Builtin:
     llvm_unreachable("shouldn't be serializing a builtin type this way");
   }

``````````

</details>


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

Reply via email to